//
//	Legato Code Examples
//	--------------------
//
//	Dialog Examples -- Text Controls
//
//	Group:		Dialog
//	Title:		Simple Dialog
//	Description:	Example dialog with inline resource using a text "edit" control.
//	Revised:	12/16/2014
//
//	(c) Novaworks, LLC
//

#define	MY_NAME			101

						// Default Entry Point

    string		name;
    int			rc;
        
    rc = DialogBox("NameQuery", "query_");
    MessageBox('I', "Result 0x%08X\r\r%s", rc, name);
    exit;


						// Dialog Procedure to Validate

int query_validate() {
    name = EditGetText(MY_NAME);
    if (name == "") {
      MessageBox('X', "Please Enter a Name.");
      return ERROR_SOFT | MY_NAME;
      }
    return ERROR_NONE;
    }
        

						// Inline Resource

#resource
NameQuery DIALOG 0, 0, 240, 44
STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION
CAPTION "My Function Needs a Data"
FONT 8, "MS Sans Serif"
{
 CONTROL "Enter Name:", -1, "static", SS_LEFT | WS_CHILD | WS_VISIBLE, 6, 16, 44, 8, 0
 CONTROL "", MY_NAME, "edit", ES_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 53, 15, 119, 12, 0
 CONTROL "OK", IDOK, "BUTTON", BS_DEFPUSHBUTTON | BS_CENTER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 186, 6, 45, 12
 CONTROL "Cancel", IDCANCEL, "BUTTON", BS_PUSHBUTTON | BS_CENTER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 186, 24, 45, 12
}
#endresource
