Chapter 5. BaseDialog Class

Table of Contents
Class Methods
Attributes
Preparing and Running the Dialog
Connect Event Methods
Connect Attribute Methods
Get and Set Methods
Standard Event Methods
Combo Box Methods
List Box Methods
Scroll Bar Methods
Methods to Query Operating System Values
Appearance and Behavior Methods
Window Draw Methods
Bitmap Methods
Device Context Methods
Text Methods
Animated Buttons
Menu Methods
Debugging Method

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.

Requires:

BaseDlg.cls is the source file of this class.

::requires oodialog.cls

Attributes:

Instances of the BaseDialog class have the following attributes:

AutoDetect

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.

AutomaticMethods

A queue containing the methods that are started concurrently before the execution of the dialog.

BkgBitmap

The handle to a bitmap that is displayed in the dialog's background.

BkgBrushBmp

The handle to a bitmap that is used to draw the dialog's background.

ConstDir

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."
DataConnection

A protected attribute to store connections between dialog items and the attributes of the dialog instance.

DlgHandle

The handle to the dialog.

Finished

When this is set to 1, Ok or Cancel will terminate the dialog on exit.

InitCode

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.

IsExtended

A protected attribute that is true (=1) if the graphics extension is installed.

UseStem

A protected attribute that is true (=1) if a stem variable was passed to Init.

Routines:

See Public Routines for a description of the audio Play routine.

Cross Reference:

The following table cross references the descriptions for the BaseDialog class methods, attributes, and instance methods:

Table 5-1. BaseDialog Reference

Item......description
Class MethodLink
getFontName (Class method)getFontName
getFontSize (Class method)getFontSize
setDefaultFont (Class method)setDefaultFont
AttributesLink
fontName (Attribute)fontName
fontSize (Attribute)fontSize
Instance MethodsLink
AbsRect2LogRectAbsRect2LogRect
AddAttributeAddAttribute
AddAutoStartMethodAddAutoStartMethod
AddComboEntryAddComboEntry
AddListEntryAddListEntry
addUserMsgaddUserMsg
assignWindow (deprecated)AssignWindow (deprecated)
AsyncMessageHandlingAsyncMessageHandling
AutoDetectionAutoDetection
BackgroundBitmapBackgroundBitmap
BackgroundColorBackgroundColor
CancelCancel
CaptureMouseCaptureMouse
CenterCenter
ChangeBitmapButtonChangeBitmapButton
ChangeComboEntryChangeComboEntry
ChangeListEntryChangeListEntry
CheckMenuItemCheckMenuItem
ClearClear
ClearButtonRectClearButtonRect
ClearMessagesClearMessages
ClearRectClearRect
ClearWindowRectClearWindowRect
ClientToScreenClientToScreen
CombineELwithSBCombineELwithSB
ComboAddDirectoryComboAddDirectory
ComboDropComboDrop
ConnectAllSBEventsConnectAllSBEvents
ConnectAnimatedButtonConnectAnimatedButton
ConnectBitmapButtonConnectBitmapButton
ConnectButtonConnectButton
ConnectCheckBoxConnectCheckBox
connectComboBoxconnectComboBox
ConnectControlConnectControl
ConnectDrawConnectDraw
ConnectEntryLineConnectEntryLine
ConnectFKeyPressConnectFKeyPress
ConnectHelpConnectHelp
ConnectKeyPressConnectKeyPress
ConnectListConnectList
ConnectListBoxConnectListBox
ConnectListLeftDoubleClickConnectListLeftDoubleClick
ConnectMenuItemConnectMenuItem
ConnectMouseCaptureConnectMouseCapture
ConnectMoveConnectMove
ConnectMultiListBoxConnectMultiListBox
ConnectPosChangedConnectPosChanged
ConnectRadioButtonConnectRadioButton
ConnectResizeConnectResize
ConnectScrollBarConnectScrollBar
CreateBrushCreateBrush
createFontExcreateFontEx
CreatePenCreatePen
Cursor_AppStartingCursor_AppStarting
Cursor_ArrowCursor_Arrow
Cursor_CrossCursor_Cross
Cursor_NoCursor_No
CursorPosCursorPos
Cursor_WaitCursor_Wait
DeInstallDeInstall
DeleteComboEntryDeleteComboEntry
DeleteFontDeleteFont
DeleteListEntryDeleteListEntry
DeleteObjectDeleteObject
DetermineSBPositionDetermineSBPosition
DisableDisable
DisableItemDisableItem
DisableMenuItemDisableMenuItem
DisconnectKeyPressDisconnectKeyPress
DisplaceBitmapDisplaceBitmap
DisplayDisplay
DrawDraw
DrawAngleArcDrawAngleArc
DrawArcDrawArc
DrawBitmapDrawBitmap
DrawButtonDrawButton
DrawLineDrawLine
DrawPieDrawPie
DrawPixelDrawPixel
DumpDump
EnableEnable
EnableMenuItemEnableMenuItem
EnableItemEnableItem
EndAsyncExecutionEndAsyncExecution
EnsureVisibleEnsureVisible
ExecuteExecute
ExecuteAsyncExecuteAsync
FillDrawingFillDrawing
FindComboEntryFindComboEntry
FindListEntryFindListEntry
FocusItemFocusItem
FontColorFontColor
FontToDCFontToDC
ForegroundWindowForegroundWindow
FreeButtonDCFreeButtonDC
FreeDCFreeDC
FreeWindowDCFreeWindowDC
GetGet
GetArcDirectionGetArcDirection
GetAttribGetAttrib
GetBitmapSizeXGetBitmapSizeX
GetBitmapSizeYGetBitmapSizeY
GetBmpDisplacementGetBmpDisplacement
GetButtonDCGetButtonDC
GetButtonRectGetButtonRect
GetClientRectGetClientRect
GetCheckBoxGetCheckBox
GetComboEntryGetComboEntry
GetComboItemsGetComboItems
GetComboLineGetComboLine
GetControlIDGetControlID
GetCurrentComboIndexGetCurrentComboIndex
GetCurrentListIndexGetCurrentListIndex
GetDataGetData
GetDataStemGetDataStem
GetDCGetDC
GetEntryLineGetEntryLine
getExStyleRawgetExStyleRaw
GetFocusGetFocus
getFontgetFont
GetIDGetID
GetItemGetItem
GetListEntryGetListEntry
GetListItemHeightGetListItemHeight
GetListItemsGetListItems
GetListLineGetListLine
GetListWidthGetListWidth
GetMenuItemStateGetMenuItemState
GetMouseCaptureGetMouseCapture
GetMultiListGetMultiList
GetPixelGetPixel
GetPosGetPos
GetRadioButtonGetRadioButton
GetRectGetRect
GetSBPosGetSBPos
GetSBRangeGetSBRange
GetSelfGetSelf
GetSizeGetSize
getStyleRawgetStyleRaw
getTextSize (deprecated)getTextSize (deprecated)
getTextSizeDlggetTextSizeDlg
getTextSizeScreengetTextSizeScreen
GetValueGetValue
GetWindowDCGetWindowDC
GetWindowRectGetWindowRect
GrayMenuItemGrayMenuItem
HandleMessagesHandleMessages
HasKeyPressConnectionHasKeyPressConnection
HScrollPosHScrollPos
HelpHelp
HideHide
HideFastHideFast
HideItemHideItem
HideItemFastHideItemFast
HideWindowHideWindow
HideWindowFastHideWindowFast
InitInit
InitAutoDetectionInitAutoDetection
InitDialogInitDialog
IsMouseButtonDownIsMouseButtonDown
LeavingLeaving
InsertComboEntryInsertComboEntry
InsertListEntryInsertListEntry
IsDialogActiveIsDialogActive
isEnabledisEnabled
IsMaximizedIsMaximized
IsMinimizedIsMinimized
isVisibleisVisible
ItemTitleItemTitle
ListAddDirectoryListAddDirectory
ListDropListDrop
LoadBitmapLoadBitmap
LogRect2AbsRectLogRect2AbsRect
MaximizeMaximize
MinimizeMinimize
MoveMove
MoveItemMoveItem
NoAutoDetectionNoAutoDetection
ObjectToDCObjectToDC
OKOK
OpaqueTextOpaqueText
PeekDialogMessagePeekDialogMessage
PopupPopup
PopupAsChildPopupAsChild
RectangleRectangle
RedrawRedraw
RedrawClientRedrawClient
RedrawButtonRedrawButton
RedrawRectRedrawRect
RedrawWindowRedrawWindow
RedrawWindowRectRedrawWindowRect
ReleaseMouseCaptureReleaseMouseCapture
RemoveBitmapRemoveBitmap
ResizeResize
ResizeItemResizeItem
RestoreRestore
RestoreCursorShapeRestoreCursorShape
RunRun
ScreenToClientScreenToClient
ScrollScroll
ScrollBitmapFromToScrollBitmapFromTo
ScrollButtonScrollButton
ScrollInButtonScrollInButton
ScrollTextScrollText
SendMessageToItemSendMessageToItem
SetArcDirectionSetArcDirection
SetAttribSetAttrib
SetCheckBoxSetCheckBox
SetComboLineSetComboLine
SetCursorPosSetCursorPos
SetCurrentComboIndexSetCurrentComboIndex
SetCurrentListIndexSetCurrentListIndex
SetDataSetData
SetDataStemSetDataStem
SetEntryLineSetEntryLine
SetFocusSetFocus
SetFocusToWindowSetFocusToWindow
setFontSetFont
SetForegroundWindowSetForegroundWindow
SetGroupSetGroup
SetHScrollPosSetHScrollPos
SetVScrollPosSetVScrollPos
SetItemFontSetItemFont
SetListColumnWidthSetListColumnWidth
SetListItemHeightSetListItemHeight
SetListLineSetListLine
SetListWidthSetListWidth
SetListTabulatorsSetListTabulators
SetMenuItemRadioSetMenuItemRadio
SetMultiListSetMultiList
SetRadioButtonSetRadioButton
SetRectSetRect
SetSBPosSetSBPos
SetSBRangeSetSBRange
SetStaticTextSetStaticText
SetTabStopSetTabStop
SetTitleSetTitle
SetValueSetValue
SetWindowRectSetWindowRect
SetWindowTitleSetWindowTitle
ShowShow
ShowFastShowFast
ShowItemShowItem
ShowItemFastShowItemFast
ShowWindowShowWindow
ShowWindowFastShowWindowFast
StopItStopIt
TabToNextTabToNext
TabToPreviousTabToPrevious
TiledBackgroundBitmapTiledBackgroundBitmap
TitleTitle
Title=Title=
TransparentTextTransparentText
ToTheTopToTheTop
UncheckMenuItemUncheckMenuItem
UpdateUpdate
ValidateValidate
VScrollPosVScrollPos
WriteWrite
WriteDirectWriteDirect
WriteToButtonWriteToButton
WriteToWindowWriteToWindow

Class Methods

The class methods listed here are class methods of the PlainBaseDialog class.

setDefaultFont (Class method)

>>--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.

Arguments:

The arguments are:

fontName

The family name to use for the default font, for example Tahoma.

fontSize

The size of the font, for example, 10.

Return value:

This method does not return a value.

Example:

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 (Class method)

>>--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.

Arguments:

There are no arguments.

Return value:

This method returns the current default font family name. For instance, MS Shell Dlg.

Example:

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 (Class method)

>>--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.

Arguments:

There are no arguments.

Return value:

This method returns the current default font size. For instance, 8.

Example:

See the previous getFontName() example.