[Home] [Prev] [Next] [Up]


XGDialog class

Handles creating and managing dialog boxes

Usage:

#include <XDialog.h>

class XGDialog;

Description

This class handles the creation of a modal and modeless dialog box. A dialog box is a window with additional functionality. A dialog box sends messages for mouse clicks and scrollbar changes to a callback procedure; this allows a simple modal box to be put up with little effort.

Things to do

The tab stop parameter is not used properly. That is, while the tab stop and enter key are passed to the dialog regartdless of the focus (as long as the focus is in the dialog box), they are currently ignored.

The enter key, likewise, needs to be wired up to work.

Construction/Destruction

static XGDialog *XGDialog::Create(short resID, XGPDialogProc proc, void *data)

This creates a modeless dialog box from the 'VRes' resource template specified. The proc field is the callback procedure used to manage the dialog messages. And the data field contains a pointer to custom data you may wish to associate with this dialog box.

The XGPDialogProc callback procedure should be declared as:

long MyProc(XGDialog *dialog, void *data, long msg, long arg, void *parg);

The fields in this callback are

 dialog Pointer to the dialog box being manipulated. Use FindViewByID to find the child controls in this control
data The data field passed to XGDialog::Create or XGDialog::ModalDialog methods
msg The dispatch message
arg The dispatch message argumnet
parg The dispatch message argument pointer

The last 3 fields are the same as those passed to the XGDispatch::ReceiveDispatch() method.

static long XGDialog::ModalDialog(short resID, XGPDialogProc proc, void *data)

This creates a modal dialog box. This operates the same as a modeless dialog box, except that the dialog box routine does not return until the dialog is dismissed.

The return value is the same as the value passed to the EndDialog procedure.

Dialog Management

static void XGDialog:EndDialog(void value)

This ends the specified dialog box. This is the way you close a dialog box, either a modal dialog box or a modeless one.

The value specified is returned by the XGDialog::ModalDialog routine if this was a modal dialog, and ignored if this was a modeless dialog box.


[Home] [Prev] [Next] [Up]