/***************************************************
* A simple ABOUT dialog box that can be executed alone
* or added to a tabular dialog box.
***************************************************/
void myAboutDialog ( ) Trans2
{
int dlg = parse_int("/DLG=", mparm_str);
int m = parse_int("/M=", mparm_str);
int res = parse_int("/RES=", mparm_str);
/********************************************************************
* When used from another function (such as a tabbed dialog box)
* The m variable would allow you to exclude the execution of the dialog
* and give control to the calling macro. 0 would build the 'stand alone'
* dialog while 1 would only build the controls for the dialog
* NOTE that the title will also be omitted so the tab can be used.
*********************************************************************/
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 not already created, create the dialog
if(!dlg)
DlgCreate( dlg );
/************************************************************
Here the controls to the newly created dialog are added.
For a list of the available controls view the DIALOG.SH file located in
the src subdirectory of your Multi-Edit install.
int DlgAddCtrl( int dlg, // the dialog handle create with DlgCreate
int ctrltype, // the control type
str ctrltext, // the control title
int x, // the x coordinate or column number
int y, // the y coordinate or row number
int width, // the width of the control
int height, // the height of the control
int ctrlid, // the identifying number for the control
int flags, // bit flags
str misc // miscelaneous parameters
);
Please note the use of 'Dlg_PosOffset'. This holds the positioning
value of the last added control. 'Dlg_NegOffset' can also be used
to position the next control in reverse reference to the previous.
*************************************************************/
//Bitmap/icon - for information on DLG_Units, view Microsofts API help
DlgAddCtrl( dlg, DLG_BitmapStatic, "WL_SETUP_WIZ",
DLG_Units | 1, DLG_Units | 1, 0, 0, -1, 0, "");
//Group box just to make it visually appealing..
DlgAddCtrl( dlg, DLG_GroupBox, "About...", 5, 1, 35, 4, -1, 0, "" );
/************************************************************
The next three controls are static text labels. These remain seperated
to allow easier positioning.
*************************************************************/
DlgAddCtrl( dlg, DLG_Static, "How to create a Tabular Dialog",
Dlg_PosOffset + 3, Dlg_PosOffset + 1, 0, 0,
1000, 0, "");
DlgAddCtrl( dlg, DLG_Static, "By",
Dlg_PosOffset + 12, Dlg_PosOffset + 1, 0, 0,
1000, 0, "");
DlgAddCtrl( dlg, DLG_Static, "Dan Hughes - MESI",
Dlg_NegOffset + 6, Dlg_PosOffset + 1, 0, 0,
1000, 0, "");
//If this is a stand alone dialog, add an OK button to it.
if ( m == 0)
{
DlgAddCtrl( dlg, DLG_PushButton, "OK",
38 - ((DLG_StanBtnWidth + 1) * 2), DLG_PosOffset + 3, DLG_StanBtnWidth, 0,
2001, DLGF_DefButton, "/R=1");
res = DlgExecute( dlg, 1000, "My About Dialog", "", "", 0 );
}
ret;
_EndDlg:
if ( res )
{
//redraw the screen
redraw;
}
ret;
} // myAboutDialog
|