DialogBox

DialogBox creates a user input box that pops up over the screen and contains one or more dialog controls (Edit, ListBox, etc.). Dialog boxes are used whenever the program needs to obtain information from the user. They support a standard CUA interface method for selecting a field, traversing the fields, and acting upon the entered information. The dialog box appears as a white box with a black border and a gray shadow with all of the dialog control fields are contained within it.

An entire dialog consists of a DialogBox window and an array of child windows defining the various controls within the dialog. The DialogBox window is the ultimate parent of all of the dialog controls and is responsible for the movement among the controls, termination of the dialog, and other operations global to the dialog. The dialog controls make the actual connections to the data being operated on in the dialog.

LHAPI has an internal limit of 50 controls per dialog.

Window Structure Details

Messages

  1. The DialogBox handler sets the Parent of the dialog to the window currently with the focus. This action insures that the the DialogBox handler will remember the window to reset the focus to when the dialog box is later destroyed.
  2. If the Dialog box style has STYLE_PUSHB_WIDTH set, the DialogBox calculates the length of the longest pushbutton. For all the windows, if the window is a pushbutton (indicated by STYLE_PUSHBUTTON in the child window's style long), the length of the pushbutton is calculated, and all the pushbuttons are sized to the length of the longest one.
  3. Sets up the default pushbutton, by marking the STATUS_DEF_PUSHBUTTON bit in that window's status byte. The default pushbutton is the one that will be executed if the user presses enter, and is defined as the first pushbutton that has ENTER as the hotkey (i.e. that window's LogicalSize==13).
  4. Then the DialogBox handler loops through the all the controls in the Dialog control array and:
  5. If the Parent of the child window is set to NULL, DialogBox sets the parent to the dialog box window.
  6. DialogBox sets the STYLE_LEAF bit in the Style field of the child's window structure. Note: Because of this, if a window control does not want the STYLE_LEAF bit set, it must clear it as part of its CREATE processing.
  7. The DialogBox handler CREATEs the window.