void myConfigDialog( ) Trans2
{
int dlg = parse_int("/DLG=", mparm_str);
int m = parse_int("/M=", mparm_str);
int res = parse_int("/RES=", mparm_str);
switch ( m ) {
case 0 :
call _BuildCtrls;
call _EndDlg;
DlgKill( dlg );
return_int = 0;
break;
case 1 :
call _BuildCtrls;
break;
case 2 :
call _EndDlg;
break;
}
return();
_BuildCtrls:
if(!dlg)
DlgCreate( dlg );
//Adding a groupbox (group1) and radio buttons
DlgAddCtrl( dlg,
DLG_GroupBox,
"Group 1",
0,
1,
35,
3,
4000,
0,
"" );
DlgAddCtrl( dlg,
DLG_RadioButton,
"Yes",
DLG_PosOffset + 5,
DLG_PosOffset + 1,
0,
0,
5000,
0,
"" );
DlgAddCtrl( dlg,
DLG_RadioButton,
"No",
DLG_PosOffset,
DLG_PosOffset + 1,
0,
0,
5001,
0,
"" );
//Adding a second groupbox (group2) and radio buttons
DlgAddCtrl( dlg,
DLG_GroupBox,
"Group 2",
38,
1,
35,
3,
4001,
0,
"" );
DlgAddCtrl( dlg,
DLG_RadioButton,
"Yes",
DLG_PosOffset + 5,
DLG_PosOffset + 1,
0,
0,
5002,
0,
"" );
DlgAddCtrl( dlg,
DLG_RadioButton,
"No",
DLG_PosOffset,
DLG_PosOffset + 1,
0,
0,
5003,
0,
"" );
//Adding a third groupbox (group3) and radio buttons
DlgAddCtrl( dlg,
DLG_GroupBox,
"Group 3",
0,
DLG_PosOffset + 1,
73,
10,
-3,
0,
"");
DlgAddCtrl( dlg,
DLG_Static,
"Drop down 1",
Dlg_PosOffset + 12,
Dlg_PosOffset + 1,
0,
0,
-1,
0,
"");
DlgAddCtrl( dlg,
DLG_Choice,
"Yes()No()Sure()Maybe()",
DLG_PosOffset,
DLG_PosOffset + 1,
0,
0,
5004,
0,
"" );
DlgAddCtrl( dlg,
DLG_Static,
"Drop down 2",
Dlg_PosOffset + 30,
Dlg_NegOffset + 1,
0,
0,
-1,
0,
"");
DlgAddCtrl( dlg,
DLG_Choice,
"Yes()No()Sure()Maybe()",
DLG_PosOffset,
DLG_PosOffset + 1,
0,
0,
5005,
0,
"" );
DlgAddCtrl( dlg,
DLG_Static,
"Text Area",
Dlg_NegOffset + 30,
Dlg_PosOffset + 2,
0,
0,
-1,
0,
"");
DlgAddCtrl( dlg,
DLG_BlackFrame,
"",
DLG_PosOffset,
DLG_PosOffset + 1,
53,
4,
-1,
0,
"" );
if ( m == 0)
{
DlgAddCtrl( dlg, DLG_PushButton,
"&OK",
42 - ((DLG_StanBtnWidth + 1) * 2),
15,
DLG_StanBtnWidth,
0,
2001,
DLGF_DefButton,
"/R=1");
DlgAddCtrl( dlg,
DLG_PushButton,
"&Cancel",
42 - (DLG_StanBtnWidth + 1),
DLG_PosOffset,
DLG_StanBtnWidth,
0,
2000,
0,
"/R=0");
DlgAddCtrl( dlg,
DLG_PushButton,
"&Help",
42,
DLG_PosOffset,
DLG_StanBtnWidth,
0,
2002,
0,
"/R=2");
res = DlgExecute( dlg, 1000, "Multi-Edit's Configure Dialog", "", "", 0 );
}
ret;
_EndDlg:
if ( res )
{
str dlgResult;
/************************************************************
Here we collect the information received from the
dialog and display it in the status bar. First
see which check box was selected in group 1
***********************************************************/
if ( DlgGetInt(dlg, 5000) == 1) {
dlgResult = "Group 1: yes ";
}
else if ( DlgGetInt(dlg, 5001) == 1 ) {
dlgResult = "Group 1: no ";
}
//Group 2 values...
if ( DlgGetInt(dlg, 5002) == 1) {
dlgResult = dlgResult + "Group 2: yes ";
}
else if ( DlgGetInt(dlg, 5003) == 1 ){
dlgResult = "Group 2: no ";
}
//drop down 1
dlgResult = dlgResult + "Drop down 1: " + dlgGetStr(dlg, 5004);
//drop down 2
dlgResult = dlgResult + " Drop down 2: " + dlgGetStr(dlg, 5005);
//displaying the dialog results.
make_message( dlgResult );
//redraw the screen
Redraw;
}
ret;
} // myConfigDialog
Onward to part 3 'Creating a tabular dialog box'
|