algorithms.us - Blake McBride - Arahant.com
     
fader
 
Nav Header
  - Company
  - Software Projects
  - Philosophy Interest
  - GO Links
  - Contact
  - Home Page
table-botm
 
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);

gDispose(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 ]
 


Company | Software Projects | Philosophy Interest
GO Links | Contact | Home Page


Site Content 2006 Blake McBride.
All Rights Reserved.


.

.