- Blake McBride -
Software Projects
: Dynace
: WDS : Sample Code

WDS Sample - Add a Dialog

The actual dialog is defined using the resource editor which comes with your compiler. As in the previous example, the dialog function is associated with a menu option such that when the user selects the appropriate menu option the dialog function will be evoked.

The dialog function simply loads, performs and frees the indicated dialog. Code may be added between the gPerform() and gDispose() in order to obtain the values the user entered into the dialog. In addition, code may be added between the mNewDialog() and gPerform() in order to set default values for the controls within the dialog.

#include "generics.h"
#include "resource.h"

static long file_message(object wind);
static long file_exit(object wind);
static long file_dialog(object wind);

int start()
object win;

win = vNew(MainWindow, "My Test Application");

vPrintf(win, "Hello, World!\n");

mLoadMenu(win, IDR_MENU1);
mAssociate(win, ID_FILE_MESSAGE, file_message);
mAssociate(win, ID_FILE_EXIT, file_exit);
mAssociate(win, ID_FILE_DIALOG, file_dialog);

return gProcessMessages(win);

static long file_dialog(object wind)
object dlg;
int r;

dlg = mNewDialog(ModalDialog, DL1, wind);

r = gPerform(dlg);


return 0L;

static long file_message(object wind)
gMessage(wind, "File_Message");
return 0L;

static long file_exit(object wind)
gQuitApplication(Application, 0);
return 0L;

[ Back to Top ]

Site Content 2006-2018 Blake McBride.
All Rights Reserved.