Chapter 7. UserDialog Class

Table of Contents
Init
InitAutoDetection
Create
CreateCenter
DefineDialog
Load
LoadFrame
LoadItems
Add... Methods
Dialog Control Methods
Menu Methods

The UserDialog class extends the BaseDialog class. It provides methods to create a dialog with these control elements:

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:

There are three basic ways of creating a dialog using the UserDialog class:

Requires:

UserDlg.cls is the source file of this class.

::requires "oodialog.cls"

Subclass:

The UserDialog class is a subclass of BaseDialog.

Attributes:

Instances of the UserDialog class have the following attributes:

AktPtr

An attribute for internal use

BasePtr

An attribute for internal use

DialogItemCount

An attribute for internal use

FactorX

Horizontal size of one dialog unit (in pixels)

FactorY

Vertical size of one dialog unit (in pixels)

SizeX

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.

SizeY

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.

Methods:

Instances of the UserDialog class implement the methods listed in the following table.

Table 7-1. UserDialog Instance Methods

Method......on page
addBitmapButtonaddBitmapButton
addBlackFrameaddBlackFrame
addBlackRectaddBlackRect
addButtonaddButton
addButtonGroupaddButtonGroup
addCheckBoxaddCheckBox
addCheckBoxStemaddCheckBoxStem
addCheckGroupaddCheckGroup
addComboBoxaddComboBox
addComboInputaddComboInput
addEntryLineaddEntryLine
addEtchedFrameaddEtchedFrame
addGrayFrameaddGreyFrame
addGrayRectaddGrayRect
addGroupBoxaddGroupBox
addEtchedHorizontaladdEtchedHorizontal
addIconaddIcon
addInputaddInput
addInputGroupaddInputGroup
addInputStemaddInputStem
addListBoxaddListBox
AddMenuItemAddMenuItem
AddMenuSeparatorAddMenuSeparator
addOkCancelLeftBottomaddOkCancelLeftBottom
addOkCancelLeftTopaddOkCancelLeftTop
addOkCancelRightBottomaddOkCancelRightBottom
addOkCancelRightTopaddOkCancelRightTop
addPasswordLineaddPasswordLine
AddPopupMenuAddPopupMenu
addRadioButtonaddRadioButton
addRadioGroupaddRadioGroup
addRadioStemaddRadioStem
addStaticaddStatic
addScrollBaraddScrollBar
addTextaddText
addEtchedVerticaladdEtchedVertical
addWhiteFrameaddWhiteFrame
addWhiteRectaddWhiteRect
CreateCreate
CreateCenterCreateCenter
CreateMenuCreateMenu
DefineDialogDefineDialog
InitInit
InitAutoDetectionInitAutoDetection
LoadLoad
LoadFrameLoadFrame
LoadItemsLoadItems
LoadMenuLoadMenu
SetMenuSetMenu
StartItStartIt
StopItStopIt

Init

>>-aUserDialog~Init(--+----------+--+---------------+--)-------><
                      +-DlgData.-+  +-,--headerFile-+


The Init method initializes a new dialog object.

Arguments:

The arguments are:

DlgData.

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.

headerFile

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.

Example:

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.