
Dialog boxes are designed and created using a dialog box resource. Y u cano
Constructing a
use Borland’ Resource W rkshop or any other resource editor to creates o
dialog box object
dialog box resources and bind them to your application. The dialog box
resource describes the appearance and location of controls, such as buttons,
list boxes, group boxes, and so on. The dialog box resource isn’t responsible
for the behavior of the dialog box; that’ the responsibility of thes
application.
Each dialog box resource has an identifier that enables a dialog box object
to specify which dialog box resource it uses. The identifier can be either a
string or an integer Y u pass this identifier to the dialog box constructor to. o
specify which resource the object should use.
T construct a dialog box object, create it using a pointer to a parento
Calling the
window object and a resource identifier (the resource identifier can be
constructor
either string or integer based) as the parameters to the constructor:
TDialog dialog1(this, "DIALOG_1");
.
.
.
TDialog dialog2(this, IDD_MY_DIALOG);
The parent window is almost always this, since you normally construct
dialog box objects in a member function of a window object. If you don’t
construct a dialog box object in a window object, use the application’ mains
window as its parent, because that is the only window object always
present in an ObjectWindows application:
TDialog mySpecialDialog(GetApplication()->GetMainWindow(), IDD_DLG);
The exception to this is when you specify a dialog box object as a client
window in a TFrameWindow or TFrameWindow-based constructor The.
constructor passes the dialog box object to the TFrameWindow::Init function,
which automatically sets the dialog box’ parent. See page 181.s
Executing a dialog box is analogous to creating and displaying a window.
Executing a
However because dialog boxes are usually displayed for a shorter period,
dialog box
of time, some of the steps can be abbreviated. This depends on whether the
dialog box is a modal or modeless dialog box.
Most dialog boxes are modal. While a modal dialog box is displayed, the
Modal dialog boxes
user can’t select or use its parent window. The user must use the dialog box
and close it before proceeding. A modal dialog box, in effect, freezes the
operation of the rest of the application.
176
OWL P ogrammer’ Guider s