The BaseDialog class implements base methods for all dialogs regardless of whether the dialog is implemented as a binary resource, a resource script, or created dynamically. Binary (compiled) resources are stored in a DLL. A dialog is created dynamically by using Add... methods. Dialogs that are implemented using a resource script (.RC) are generated semi-dynamically.
BaseDialog is an abstract class. You cannot use it to execute a Windows dialog but have to use one of its subclasses.
See the subclasses UserDialog Class, ResDialog Class, and RcDialog Class for additional information.
BaseDlg.cls is the source file of this class.
::requires oodialog.cls
Instances of the BaseDialog class have the following attributes:
Automatic data field detection on (=1, default) or off (=0). For the UserDialog subclass the default is off and Connect... methods or a resource script are usually used.
A queue containing the methods that are started concurrently before the execution of the dialog.
The handle to a bitmap that is displayed in the dialog's background.
The handle to a bitmap that is used to draw the dialog's background.
A directory object whose indexes are symbolic IDs. The entry for each index is the numerical value of the symbolic ID. Once a symbolic ID is added to the Constdir directory, the symbolic ID can be used in place of the numeric value in any method of the ooDialog classes that requires a resource ID.
A few symbolic IDs are pre-defined by ooDialog and are present in the ConstDir directory of all ooDialogs. See the table, Symbolic IDs Used by ooDialog, for a list of these IDs. The programmer can add symbolic IDs to this directory by using #define statements in a resource script or a header file. Of course, symbolic IDs can also be added directly in the program as the following code snippet shows:
::method Init
forward class (super) continue
self~ConstDir["ID_GB"] = 101
self~ConstDir["ID_CB_REGINA"] = 107
self~ConstDir["ID_CB_REGINALD"] = 111
self~ConstDir["ID_CB_OOREXX"] = 115
...
::method defineDialog
self~addGroupBox(10, 20, 150, 90, "Pick an interpreter", "BORDER", ID_GB)
self~addCheckBox(ID_CB_REGINA, "cb1", 30, 40, , , "Regina", "GROUP")
self~addCheckBox(ID_CB_REGINALD, "cb2", 30, 60, , , "Reginald")
self~addCheckBox(ID_CB_OOREXX, "cb3", 30, 80, , , "ooRexx")
...
::method ok
oorexxCB = self~getCheckControl(ID_CB_OOREXX)
if oorexxCB~checked then
say "You picked the right interpreter."
A protected attribute to store connections between dialog items and the attributes of the dialog instance.
The handle to the dialog.
When this is set to 1, Ok or Cancel will terminate the dialog on exit.
After the Init method has executed the InitCode attribute will be 0 if the object initialization detected no errors. The attribute will be non-zero if initialization failed or an error was detected. The programmer should always check the InitCode attribute after instantiating a dialog object. If the attribute is not zero, then the object was not initialized correctly and its behavior is undefined.
After the dialog is finished, the attribute will be 1 if terminated with Ok, 2 if terminated with Cancel.
A protected attribute that is true (=1) if the graphics extension is installed.
A protected attribute that is true (=1) if a stem variable was passed to Init.
See Public Routines for a description of the audio Play routine.
The following table cross references the descriptions for the BaseDialog class methods, attributes, and instance methods:
Table 5-1. BaseDialog Reference
| Item... | ...description |
|---|---|
| Class Method | Link |
| getFontName (Class method) | getFontName |
| getFontSize (Class method) | getFontSize |
| setDefaultFont (Class method) | setDefaultFont |
| Attributes | Link |
| fontName (Attribute) | fontName |
| fontSize (Attribute) | fontSize |
| Instance Methods | Link |
| AbsRect2LogRect | AbsRect2LogRect |
| AddAttribute | AddAttribute |
| AddAutoStartMethod | AddAutoStartMethod |
| AddComboEntry | AddComboEntry |
| AddListEntry | AddListEntry |
| addUserMsg | addUserMsg |
| assignWindow (deprecated) | AssignWindow (deprecated) |
| AsyncMessageHandling | AsyncMessageHandling |
| AutoDetection | AutoDetection |
| BackgroundBitmap | BackgroundBitmap |
| BackgroundColor | BackgroundColor |
| Cancel | Cancel |
| CaptureMouse | CaptureMouse |
| Center | Center |
| ChangeBitmapButton | ChangeBitmapButton |
| ChangeComboEntry | ChangeComboEntry |
| ChangeListEntry | ChangeListEntry |
| CheckMenuItem | CheckMenuItem |
| Clear | Clear |
| ClearButtonRect | ClearButtonRect |
| ClearMessages | ClearMessages |
| ClearRect | ClearRect |
| ClearWindowRect | ClearWindowRect |
| ClientToScreen | ClientToScreen |
| CombineELwithSB | CombineELwithSB |
| ComboAddDirectory | ComboAddDirectory |
| ComboDrop | ComboDrop |
| ConnectAllSBEvents | ConnectAllSBEvents |
| ConnectAnimatedButton | ConnectAnimatedButton |
| ConnectBitmapButton | ConnectBitmapButton |
| ConnectButton | ConnectButton |
| ConnectCheckBox | ConnectCheckBox |
| connectComboBox | connectComboBox |
| ConnectControl | ConnectControl |
| ConnectDraw | ConnectDraw |
| ConnectEntryLine | ConnectEntryLine |
| ConnectFKeyPress | ConnectFKeyPress |
| ConnectHelp | ConnectHelp |
| ConnectKeyPress | ConnectKeyPress |
| ConnectList | ConnectList |
| ConnectListBox | ConnectListBox |
| ConnectListLeftDoubleClick | ConnectListLeftDoubleClick |
| ConnectMenuItem | ConnectMenuItem |
| ConnectMouseCapture | ConnectMouseCapture |
| ConnectMove | ConnectMove |
| ConnectMultiListBox | ConnectMultiListBox |
| ConnectPosChanged | ConnectPosChanged |
| ConnectRadioButton | ConnectRadioButton |
| ConnectResize | ConnectResize |
| ConnectScrollBar | ConnectScrollBar |
| CreateBrush | CreateBrush |
| createFontEx | createFontEx |
| CreatePen | CreatePen |
| Cursor_AppStarting | Cursor_AppStarting |
| Cursor_Arrow | Cursor_Arrow |
| Cursor_Cross | Cursor_Cross |
| Cursor_No | Cursor_No |
| CursorPos | CursorPos |
| Cursor_Wait | Cursor_Wait |
| DeInstall | DeInstall |
| DeleteComboEntry | DeleteComboEntry |
| DeleteFont | DeleteFont |
| DeleteListEntry | DeleteListEntry |
| DeleteObject | DeleteObject |
| DetermineSBPosition | DetermineSBPosition |
| Disable | Disable |
| DisableItem | DisableItem |
| DisableMenuItem | DisableMenuItem |
| DisconnectKeyPress | DisconnectKeyPress |
| DisplaceBitmap | DisplaceBitmap |
| Display | Display |
| Draw | Draw |
| DrawAngleArc | DrawAngleArc |
| DrawArc | DrawArc |
| DrawBitmap | DrawBitmap |
| DrawButton | DrawButton |
| DrawLine | DrawLine |
| DrawPie | DrawPie |
| DrawPixel | DrawPixel |
| Dump | Dump |
| Enable | Enable |
| EnableMenuItem | EnableMenuItem |
| EnableItem | EnableItem |
| EndAsyncExecution | EndAsyncExecution |
| EnsureVisible | EnsureVisible |
| Execute | Execute |
| ExecuteAsync | ExecuteAsync |
| FillDrawing | FillDrawing |
| FindComboEntry | FindComboEntry |
| FindListEntry | FindListEntry |
| FocusItem | FocusItem |
| FontColor | FontColor |
| FontToDC | FontToDC |
| ForegroundWindow | ForegroundWindow |
| FreeButtonDC | FreeButtonDC |
| FreeDC | FreeDC |
| FreeWindowDC | FreeWindowDC |
| Get | Get |
| GetArcDirection | GetArcDirection |
| GetAttrib | GetAttrib |
| GetBitmapSizeX | GetBitmapSizeX |
| GetBitmapSizeY | GetBitmapSizeY |
| GetBmpDisplacement | GetBmpDisplacement |
| GetButtonDC | GetButtonDC |
| GetButtonRect | GetButtonRect |
| GetClientRect | GetClientRect |
| GetCheckBox | GetCheckBox |
| GetComboEntry | GetComboEntry |
| GetComboItems | GetComboItems |
| GetComboLine | GetComboLine |
| GetControlID | GetControlID |
| GetCurrentComboIndex | GetCurrentComboIndex |
| GetCurrentListIndex | GetCurrentListIndex |
| GetData | GetData |
| GetDataStem | GetDataStem |
| GetDC | GetDC |
| GetEntryLine | GetEntryLine |
| getExStyleRaw | getExStyleRaw |
| GetFocus | GetFocus |
| getFont | getFont |
| GetID | GetID |
| GetItem | GetItem |
| GetListEntry | GetListEntry |
| GetListItemHeight | GetListItemHeight |
| GetListItems | GetListItems |
| GetListLine | GetListLine |
| GetListWidth | GetListWidth |
| GetMenuItemState | GetMenuItemState |
| GetMouseCapture | GetMouseCapture |
| GetMultiList | GetMultiList |
| GetPixel | GetPixel |
| GetPos | GetPos |
| GetRadioButton | GetRadioButton |
| GetRect | GetRect |
| GetSBPos | GetSBPos |
| GetSBRange | GetSBRange |
| GetSelf | GetSelf |
| GetSize | GetSize |
| getStyleRaw | getStyleRaw |
| getTextSize (deprecated) | getTextSize (deprecated) |
| getTextSizeDlg | getTextSizeDlg |
| getTextSizeScreen | getTextSizeScreen |
| GetValue | GetValue |
| GetWindowDC | GetWindowDC |
| GetWindowRect | GetWindowRect |
| GrayMenuItem | GrayMenuItem |
| HandleMessages | HandleMessages |
| HasKeyPressConnection | HasKeyPressConnection |
| HScrollPos | HScrollPos |
| Help | Help |
| Hide | Hide |
| HideFast | HideFast |
| HideItem | HideItem |
| HideItemFast | HideItemFast |
| HideWindow | HideWindow |
| HideWindowFast | HideWindowFast |
| Init | Init |
| InitAutoDetection | InitAutoDetection |
| InitDialog | InitDialog |
| IsMouseButtonDown | IsMouseButtonDown |
| Leaving | Leaving |
| InsertComboEntry | InsertComboEntry |
| InsertListEntry | InsertListEntry |
| IsDialogActive | IsDialogActive |
| isEnabled | isEnabled |
| IsMaximized | IsMaximized |
| IsMinimized | IsMinimized |
| isVisible | isVisible |
| ItemTitle | ItemTitle |
| ListAddDirectory | ListAddDirectory |
| ListDrop | ListDrop |
| LoadBitmap | LoadBitmap |
| LogRect2AbsRect | LogRect2AbsRect |
| Maximize | Maximize |
| Minimize | Minimize |
| Move | Move |
| MoveItem | MoveItem |
| NoAutoDetection | NoAutoDetection |
| ObjectToDC | ObjectToDC |
| OK | OK |
| OpaqueText | OpaqueText |
| PeekDialogMessage | PeekDialogMessage |
| Popup | Popup |
| PopupAsChild | PopupAsChild |
| Rectangle | Rectangle |
| Redraw | Redraw |
| RedrawClient | RedrawClient |
| RedrawButton | RedrawButton |
| RedrawRect | RedrawRect |
| RedrawWindow | RedrawWindow |
| RedrawWindowRect | RedrawWindowRect |
| ReleaseMouseCapture | ReleaseMouseCapture |
| RemoveBitmap | RemoveBitmap |
| Resize | Resize |
| ResizeItem | ResizeItem |
| Restore | Restore |
| RestoreCursorShape | RestoreCursorShape |
| Run | Run |
| ScreenToClient | ScreenToClient |
| Scroll | Scroll |
| ScrollBitmapFromTo | ScrollBitmapFromTo |
| ScrollButton | ScrollButton |
| ScrollInButton | ScrollInButton |
| ScrollText | ScrollText |
| SendMessageToItem | SendMessageToItem |
| SetArcDirection | SetArcDirection |
| SetAttrib | SetAttrib |
| SetCheckBox | SetCheckBox |
| SetComboLine | SetComboLine |
| SetCursorPos | SetCursorPos |
| SetCurrentComboIndex | SetCurrentComboIndex |
| SetCurrentListIndex | SetCurrentListIndex |
| SetData | SetData |
| SetDataStem | SetDataStem |
| SetEntryLine | SetEntryLine |
| SetFocus | SetFocus |
| SetFocusToWindow | SetFocusToWindow |
| setFont | SetFont |
| SetForegroundWindow | SetForegroundWindow |
| SetGroup | SetGroup |
| SetHScrollPos | SetHScrollPos |
| SetVScrollPos | SetVScrollPos |
| SetItemFont | SetItemFont |
| SetListColumnWidth | SetListColumnWidth |
| SetListItemHeight | SetListItemHeight |
| SetListLine | SetListLine |
| SetListWidth | SetListWidth |
| SetListTabulators | SetListTabulators |
| SetMenuItemRadio | SetMenuItemRadio |
| SetMultiList | SetMultiList |
| SetRadioButton | SetRadioButton |
| SetRect | SetRect |
| SetSBPos | SetSBPos |
| SetSBRange | SetSBRange |
| SetStaticText | SetStaticText |
| SetTabStop | SetTabStop |
| SetTitle | SetTitle |
| SetValue | SetValue |
| SetWindowRect | SetWindowRect |
| SetWindowTitle | SetWindowTitle |
| Show | Show |
| ShowFast | ShowFast |
| ShowItem | ShowItem |
| ShowItemFast | ShowItemFast |
| ShowWindow | ShowWindow |
| ShowWindowFast | ShowWindowFast |
| StopIt | StopIt |
| TabToNext | TabToNext |
| TabToPrevious | TabToPrevious |
| TiledBackgroundBitmap | TiledBackgroundBitmap |
| Title | Title |
| Title= | Title= |
| TransparentText | TransparentText |
| ToTheTop | ToTheTop |
| UncheckMenuItem | UncheckMenuItem |
| Update | Update |
| Validate | Validate |
| VScrollPos | VScrollPos |
| Write | Write |
| WriteDirect | WriteDirect |
| WriteToButton | WriteToButton |
| WriteToWindow | WriteToWindow |
The class methods listed here are class methods of the PlainBaseDialog class.
>>--setDefaultFont(--fontName--,--fontSize--)----------------------------------><
This method changes the default dialog font used for all dialogs. The default dialog font is used whenever a dialog template, used in a dynamically defined dialog, does not specify a font. Since it is very unusual for a resource script to not specify a font, this mostly effects the PlainUserDialog and UserDialog classes. Binary compiled dialog templates (ResDialog) can not be changed, so the default dialog font has no meaning for a ResDialog.
Currently the default font is MS Shell Dlg with a size of 8. MS Shell Dlg is not a true font name, but rather a pseudo name that signals the operating system to use a standard font for the specific version of Windows. In other words, on Windows 2000, MS Shell Dlg will cause the operating system to use the standard font for dialogs on Windows 2000. On XP, the operating system will use the standard XP dialog font. (The two fonts are different.) By using this font for the default, ooDialog produces dialogs that match what is most common on the current operating system.
Of course, when the ooDialog programmer specifies a font in either the create() or the createCenter() methods then the defualt font is ignored. Once the default font is changed in a process then all dynamic dialogs, that don't specify a font, that are created afterwards will use the new default font.
The actual font used by a dialog directly effects the value of a dialog unit.
The arguments are:
The family name to use for the default font, for example Tahoma.
The size of the font, for example, 10.
This method does not return a value.
This example shows a change to the oostddlg.rex sample program. The default font is changed to Tahoma pt 10. This causes all the Standard Dialogs to be created using this font.
/*--------------------------------------------------------------------------*/
/* */
/* OODialog\Samples\oostddlg.rex Standard Dialog demonstration */
/* */
/*--------------------------------------------------------------------------*/
.PlainBaseDialog~setDefaultFont("Tahoma", 10)
say
say 'Starting standard dialog demonstration...'
...
>>--getFontName----------------------------------------------------><
Returns the current default dialog font name. The default dialog font is used whenever a dialog template, used in a dynamically defined dialog, does not specify a font.
There are no arguments.
This method returns the current default font family name. For instance, MS Shell Dlg.
The following example temporarily changes the default font to run the accounting program. The accounting program uses a large number of dynamically defined dialogs. It does not specify the dialog font for any of the dialogs. Before starting the program, the default font is changed to 10 pt Tahoma. Then, all the dialogs created while the accounting program is executing will be created using 10 pt Tahoma. When the accounting program is done, the old default is restored.
oldName = .PlainBaseDialog~getFontName
oldSize = .PlainBaseDialog~getFontSize
.PlainBaseDialog~setDefaultFont("Tahoma", 10)
ret = excuteAccounting("Daily")
.PlainBaseDialog~setDefaultFont(oldName, oldSize)
>>--getFontSize----------------------------------------------------><
Returns the current default dialog font size. The default dialog font is used whenever a dialog template, used in a dynamically defined dialog, does not specify a font.
There are no arguments.
This method returns the current default font size. For instance, 8.
See the previous getFontName() example.