The UserDialog class extends the BaseDialog class. It provides methods to create a dialog with these control elements:
Entry lines
Push buttons
Check boxes
Radio buttons
List boxes
Combo boxes
Frames and rectangles
Note: The class also inherits the methods of its parent class: the BaseDialog class.
Subclasses of the UserDialog can inherit the mixin AdvancedControls class. This class provides methods to dynamically create a dialog with these additional elements:
List controls (List-view controls)
Tree controls
Tab controls
Slider controls
Progress Bar controls
There are three basic ways of creating a dialog using the UserDialog class:
Load the dialog from a resource script using the Load method. This will create the dialog and its controls from the definitions in the resource script. An alternative to calling the Load method is to use the RcDialog class. This class is a subclass of the UserDialog class and provides a convenient way to create a dialog from a resource script. It handles the details of loading the resource script transparently and leaves the programmer free to concentrate on the details of the behavior of the dialog.
Invoke Add... methods on an instance of this class or a subclass and create the dialog step by step, one method for one dialog item. The best place to invoke these Add... methods is to override the DefineDialog method. The DefineDialog method is called automatically when an instance of the UserDialog is created.
In addition to creating dialog items one at a time, there are also methods that enable you to define a group of the same dialog elements together. The names of these methods begin with Add... and end with Group or Stem.
Combine loading a dialog from a resource script and adding elements dynamically. This would define the dialog and some of the dialog controls using the resource script. The programmer could then define additional dialog controls using the Add... methods in the DefineDialog method. For instance, this could be useful in an application that had several dialogs with similar features. The similar aspects of each dialog could be placed in a resource script and then the individual dialogs could be customized using the Add... methods.
UserDlg.cls is the source file of this class.
::requires "oodialog.cls"
The UserDialog class is a subclass of BaseDialog.
Instances of the UserDialog class have the following attributes:
An attribute for internal use
An attribute for internal use
An attribute for internal use
Horizontal size of one dialog unit (in pixels)
Vertical size of one dialog unit (in pixels)
The width of the dialog, in dialog units, when the underlying Windows dialog object is created.
Note: If the program creates a resizable dialog and the user changes the size of the dialog, this attribute is not updated by ooDialog. If the programmer requires that the SizeX attribute always reflects the actual size of the dialog, (for a resizable dialog,) then the programmer is responsible for updating its value when the size of the dialog changes. The programmer would use the ConnectResize method to receive notifications when the dialog changed size and update the attribute accordingly.
The height of the dialog, in dialog units, when the Windows dialog object is created.
Note: In a similar fashion to the SizeX attribute, the programmer would be responsible for updating this attribute for resizable dialogs.
Instances of the UserDialog class implement the methods listed in the following table.
Table 6-1. UserDialog Instance Methods
Method... | ...on page |
---|---|
AddBitmapButton | AddBitmapButton |
AddBlackFrame | AddBlackFrame |
AddBlackRect | AddBlackRect |
AddButton | AddButton |
AddButtonGroup | AddButtonGroup |
AddCheckBox | AddCheckBox |
AddCheckBoxStem | AddCheckBoxStem |
AddCheckGroup | AddCheckGroup |
AddComboBox | AddComboBox |
AddComboInput | AddComboInput |
AddEntryLine | AddEntryLine |
AddGrayFrame | AddGreyFrame |
AddGrayRect | AddGrayRect |
AddGroupBox | AddGroupBox |
AddIcon | AddIcon |
AddInput | AddInput |
AddInputGroup | AddInputGroup |
AddInputStem | AddInputStem |
AddListBox | AddListBox |
AddMenuItem | AddMenuItem |
AddMenuSeparator | AddMenuSeparator |
AddOkCancelLeftBottom | AddOkCancelLeftBottom |
AddOkCancelLeftTop | AddOkCancelLeftTop |
AddOkCancelRightBottom | AddOkCancelRightBottom |
AddOkCancelRightTop | AddOkCancelRightTop |
AddPasswordLine | AddPasswordLine |
AddPopupMenu | AddPopupMenu |
AddRadioButton | AddRadioButton |
AddRadioGroup | AddRadioGroup |
AddRadioStem | AddRadioStem |
AddScrollBar | AddScrollBar |
AddText | AddText |
AddWhiteFrame | AddWhiteFrame |
AddWhiteRect | AddWhiteRect |
Create | Create |
CreateCenter | CreateCenter |
CreateMenu | CreateMenu |
DefineDialog | DefineDialog |
Init | Init |
InitAutoDetection | InitAutoDetection |
Load | Load |
LoadFrame | LoadFrame |
LoadItems | LoadItems |
LoadMenu | LoadMenu |
SetMenu | SetMenu |
StartIt | StartIt |
StopIt | StopIt |
>>-aUserDialog~Init(--+----------+--+---------------+--)------->< +-DlgData.-+ +-,--headerFile-+
The Init method initializes a new dialog object.
The arguments are:
A stem variable that is used to initialize the data fields of the dialog. If the dialog is terminated by means of the OK button, the values of the dialog's data fields are copied to this variable. The ID of the dialog items is used to name each entry within the stem.
A file defining symbolic IDs for dialog resources. Symbolic IDs defined in the file can be used in method calls where resource IDs are required.
The following example creates a new dialog object, adding any symbolic IDs defined in resources.h to the object's ConstDir directory:
MyDialog=.UserDialog~new(aStem., "resources.h")
The example for the init method in the BaseDialog section shows the use of the dialog data stem and header file arguments in more detail.