gavin.landon
06-30-2009, 05:18 PM
I'm just needing an understand of the DIALOG_ID when creating custom dialogs. Do I need to create custom dialog id's for each custom dialog I have or do these ID's reference a type of dialog it's based on?
I have 3 custome dialogs on the first 2 are fine, but the third fails as soon as I call:
nCmdValue = WaitOnDialog (szDialogName);
nCmdValue returns -1; //_FAILED
---- CODE STARTS ----
#define DESTINATION_DLG_ID 12013
#define DESTINATION_TITLE 50
#define DESTINATION_TITLE_TEXT "Destination Location and Instance Name"
#define DESTINATION_DESCRIPTION 51
#define DESTINATION_DESCRIPTION_TEXT "Select Install and then select whether you are installing a New Installation or upgrading an existing instance."
#define DESTINATION_DESCRIPTION_FOLDER 1303
#define DESTINATION_DESCRIPTION_DERNAME 1302
#define DESTINATION_DESCRIPTION_FULLPATH 1304
//declare methods
prototype NUMBER dlg3_DestinationFolder( STRING );
//methods
function NUMBER dlg3_DestinationFolder( szDialogCaption )
string szDialogName, szFullPath, svTmp;
BOOL bDone;
number nCmdValue, nResult;
string szMsg;
HWND hTimesNewRoman14Bold;
number hwndDlg;
begin
// Name of Dialog
szDialogName = "dlg3_Destination";
hTimesNewRoman14Bold = GetFont("Arial", 14, STYLE_BOLD);
nResult = EzDefineDialog (szDialogName, ISUSER, szDialogName, DESTINATION_DLG_ID);
// Initialize the indicator used to control the loop.
bDone = FALSE;
repeat
nCmdValue = WaitOnDialog (szDialogName);
// Respond to the event.
switch (nCmdValue)
case _DLG_CLOSE:
// The user clicked the window's Close button.
Do (EXIT);
case DLG_INIT:
hwndDlg = CmdGetHwndDlg (szDialogName);
//change font
CtrlSetFont(szDialogName, hTimesNewRoman14Bold, DESTINATION_TITLE);
//set Dialog Caption
SetWindowText (hwndDlg, szDialogCaption);
// Set static text description displayed above check boxes.
CtrlSetText (szDialogName, DESTINATION_TITLE, DESTINATION_TITLE_TEXT);
// Set static text description displayed above check boxes.
CtrlSetText (szDialogName, DESTINATION_DESCRIPTION, DESTINATION_DESCRIPTION_TEXT);
case _BUTTON_NEXT:
bDone = TRUE;
case _BUTTON_CANCEL:
Do (EXIT);
case _BUTTON_BACK:
bDone = TRUE;
case _FAILED:
//Failed to create
MessageBox("Error creating Destination dialog.", SEVERE);
abort;
default:
//NumToStr(svCmdValue, nCmdValue);
SprintfBox(SEVERE, szDialogCaption, "'%d' is not a valid case.", nCmdValue);
abort;
endswitch;
until bDone;
//destroy dialog
EndDialog ( szDialogName );
return nCmdValue;
end;
I have 3 custome dialogs on the first 2 are fine, but the third fails as soon as I call:
nCmdValue = WaitOnDialog (szDialogName);
nCmdValue returns -1; //_FAILED
---- CODE STARTS ----
#define DESTINATION_DLG_ID 12013
#define DESTINATION_TITLE 50
#define DESTINATION_TITLE_TEXT "Destination Location and Instance Name"
#define DESTINATION_DESCRIPTION 51
#define DESTINATION_DESCRIPTION_TEXT "Select Install and then select whether you are installing a New Installation or upgrading an existing instance."
#define DESTINATION_DESCRIPTION_FOLDER 1303
#define DESTINATION_DESCRIPTION_DERNAME 1302
#define DESTINATION_DESCRIPTION_FULLPATH 1304
//declare methods
prototype NUMBER dlg3_DestinationFolder( STRING );
//methods
function NUMBER dlg3_DestinationFolder( szDialogCaption )
string szDialogName, szFullPath, svTmp;
BOOL bDone;
number nCmdValue, nResult;
string szMsg;
HWND hTimesNewRoman14Bold;
number hwndDlg;
begin
// Name of Dialog
szDialogName = "dlg3_Destination";
hTimesNewRoman14Bold = GetFont("Arial", 14, STYLE_BOLD);
nResult = EzDefineDialog (szDialogName, ISUSER, szDialogName, DESTINATION_DLG_ID);
// Initialize the indicator used to control the loop.
bDone = FALSE;
repeat
nCmdValue = WaitOnDialog (szDialogName);
// Respond to the event.
switch (nCmdValue)
case _DLG_CLOSE:
// The user clicked the window's Close button.
Do (EXIT);
case DLG_INIT:
hwndDlg = CmdGetHwndDlg (szDialogName);
//change font
CtrlSetFont(szDialogName, hTimesNewRoman14Bold, DESTINATION_TITLE);
//set Dialog Caption
SetWindowText (hwndDlg, szDialogCaption);
// Set static text description displayed above check boxes.
CtrlSetText (szDialogName, DESTINATION_TITLE, DESTINATION_TITLE_TEXT);
// Set static text description displayed above check boxes.
CtrlSetText (szDialogName, DESTINATION_DESCRIPTION, DESTINATION_DESCRIPTION_TEXT);
case _BUTTON_NEXT:
bDone = TRUE;
case _BUTTON_CANCEL:
Do (EXIT);
case _BUTTON_BACK:
bDone = TRUE;
case _FAILED:
//Failed to create
MessageBox("Error creating Destination dialog.", SEVERE);
abort;
default:
//NumToStr(svCmdValue, nCmdValue);
SprintfBox(SEVERE, szDialogCaption, "'%d' is not a valid case.", nCmdValue);
abort;
endswitch;
until bDone;
//destroy dialog
EndDialog ( szDialogName );
return nCmdValue;
end;