Page 208 - DCAP408_WEB_PROGRAMMING
P. 208
Windows Programming
Notes A Form is by default loaded in this state if no arguments are supplied with Show method.
12.4.3 System Modal Dialog Box
A System Modal dialog box restricts the user from continuing work on the system unless it gets
unloaded.
Example: Screen Saver with passwords is the pretty example of a Modal dialog box.
Creating such a dialog box is a bit tricky, however you can have a default message box in System
Modal mode.
The show method of forms does not give you such style. In order to call a default message box
in a system Modal style, use the following syntax:
MsgBox “Message String”, VbOKonly + VbSystemModal, “Title”
Self Assessment
Fill in the blanks:
9. Dialog boxes are specifically used for accepting ......................... from the user or displaying
a message to the user.
10. Modal dialog boxes can be also called as ......................... .
11. The ......................... method of form uses VbModal style to load the form as a Modal dialog
box.
12. ......................... dialog boxes are just like any other form in your application and loose their
focus as soon as you click some other Window outside the application.
13. A ......................... dialog box restricts the user from continuing work on the system unless
it gets unloaded.
12.5 Creating a Modeless Dialog Box
You create a modeless dialog box by means of the CreateDialog function, mentioning the
identifier or name of a dialog box template resource and a pointer to the dialog box procedure.
CreateDialog loads the template, creates the dialog box, and optionally exhibits it.
!
Caution Your application is accountable for taking and transmitting user input messages
to the dialog box procedure.
Example: In the following example, the application exhibits a modeless dialog box — if
it is not already shown — when the user clicks Go To from an application menu. The dialog box
includes an edit control, a check box, and OK and Cancel buttons. The dialog box template is a
resource in the application’s executable file and has the resource identifier DLG_GOTO. The user
enters a line number in the edit control and verifies the check box to state that the line number
is relative to the current line. The control identifiers are ID_LINE, ID_ABSREL, IDOK, and
IDCANCEL.
The statements in the first part of the example create the modeless dialog box. These statements,
in the window procedure for the application’s main window, create the dialog box when the
202 LOVELY PROFESSIONAL UNIVERSITY