Attributes

This section describes the important attributes of instances of the BaseDialog. (This section of the documentation is a work in progress. Please see the attrbutes list at the beginning of this chapeter for attributes not listed here.)

fontName (Attribute)

>>--fontName----------------------------------------------------><

>>--fontName=---------------------------------------------------><

Prior to the creation of the underlying Windows dialog, the font name attribute specifies the name of the font that will be used to create the dialog. This font is only used when the font is not specified in the create() or the createCenter() methods. After the creation of the dialog, the attribute reflects the font name that was actually used to create the dialog.

This applies to all dialogs, with this cavaet. With a binary compiled dialog resource (ResDialog) the font has always been specified when the dialog template was compiled. Therefore the font name attribute has no effect on a ResDialog prior to the execution of the dialog. However, when the ResDialog object is executed, the font name attribute is updated to reflect the font used by the dialog.

Details

Getting the value of the font name attribute is public:

      
      name = dlgObj~fontName
      
      

Setting the value of the font name attribute is private:

      
      dlgObj~fontName = "MS Sans Serif"
      
      
will result in an error.

Set the value of the font name within a method context of the dialog object:

      
      ::class 'MessageBox' subclass UserDialog

      ::method init

        forward class (super) continue
        if self~initCode <> 0 then return

        self~fontName = "MS Sans Serif"
      
      

Note: The font name and font size attributes are set in the super class init() method to the value of the default dialog font. Therefore, to have any effect, setting the font name attribute has to be done after the super class init() is finished.

Example:

This example is a portion of the code used to to create a message box dialog using a variable font. The calcSizes() method is not shown, but in that method the size and position of the controls, and the overall size of the dialog, are calculated in relation to the size needed for the message.

      
        fontName = "Tahoma"
        fontSize = 20
        message = "Drive z: is a network drive and is not accesible."
        title = "Disk Drive Error"

        dlg = .MessageBox~new( , , message, title, fontName, fontSize)
        if dlg~initCode = 0 then do
          dlg~Execute("SHOWTOP", 14)
        end

        dlg~Deinstall

      return 0
      -- End of entry point.

      ::requires "oodWin32.cls"

      ::class 'MessageBox' subclass UserDialog inherit AdvancedControls MessageExtensions

      ::method init
        expose cx cy message title fontName fontSize

        a = .array~new(2)
        if arg(1, 'E') then a[1] = arg(1)
        if arg(2, 'E') then a[2] = arg(2)

        message = arg(3)
        title = arg(4)
        if arg(5, 'E') then do
          fontName = arg(5)
          fontSize = arg(6)
        end

        forward class (super) arguments (a) continue
        if self~initCode <> 0 then return

        if arg(5, 'E') then do
          self~fontName = fontName
          self~fontSize = fontSize
        end

        self~calcSizes()
        self~createCenter(cx, cy, title)
      
      

fontSize (Attribute)

>>--fontSize----------------------------------------------------><

>>--fontSize=---------------------------------------------------><

Prior to the creation of the underlying Windows dialog, the font size attribute specifies the size of the font that will be used to create the dialog. This font is only used when the font is not specified in the create() or the createCenter() methods. After the creation of the dialog, the attribute reflects the font size that was actually used to create the dialog.

This applies to all dialogs, with this cavaet. With a binary compiled dialog resource (ResDialog) the font has always been specified when the dialog template was compiled. Therefore the font size attribute has no effect on a ResDialog prior to the execution of the dialog. However, when the ResDialog object is executed, the font size attribute is updated to reflect the font used by the dialog.

Details

Getting the value of the font size attribute is public:

      
      size = dlgObj~fontSize
      
      

Setting the value of the font size attribute is private:

      
      dlgObj~fontSize = 8
      
      
will result in an error.

Set the value of the font name within a method context of the dialog object:

      
      ::class 'MessageBox' subclass UserDialog

      ::method init

        forward class (super) continue
        if self~initCode <> 0 then return

        self~fontSize = 8
      
      

Note: The font name and font size attributes are set in the super class init() method to the value of the default dialog font. Therefore, to have any effect, setting the font size attribute has to be done after the super class init() is finished.

Example:

See the fontName() example, which also uses the fontSize attribute.