Jump to content

Futurebasic/Language/Reference/def setbuttonfontstyle

From Wikibooks, open books for an open world

Syntax

[edit | edit source]

DEF SETBUTTONFONTSTYLE

Revised

[edit | edit source]

February, 2002 (Release 6)

Description

[edit | edit source]

This procedure sets up all of the font information associated with an Appearance Manager, control-based edit field. You may build such a field using the APPEARANCE BUTTON statement with the type of _kControlEditTextProc. Text may be placed in this type of button using DEF SETBUTTONTEXTSTRING. Before modifying text in an Appearance Manager, control-based edit field, you must create a control font style record. This record is defined in the Tlbx Appearance.Incl as follows:

BEGIN RECORD

ControlFontStyleRec

  DIM flags     AS SHORT
  
  DIM font      AS SHORT
  
  DIM size      AS SHORT
  
  DIM style     AS SHORT
  
  DIM mode      AS SHORT
  
  DIM just      AS SHORT
  
  DIM foreColor AS RGBCOLOR
  
  DIM backColor AS RGBCOLOR

END RECORD

You dimension a local copy of the record like this: DIM cfsr AS ControlFontStyleRec The first item that must be filled in for the controlFontStyleRec is the flags entry which will tell the Appearance Manager which parameters are important. Appropriate values for this item are:

_kControlUseFontMask

_kControlUseFaceMask

_kControlUseSizeMask

_kControlUseForeColorMask

_kControlUseBackColorMask

_kControlUseModeMask

_kControlUseJustMask

Items may be added together by joining the appropriate constants. For instance, if you wanted to change the font and back color of a field, you would use the following: cfsr.flags = _kControlUseFontMask_kControlUseBackColorMask The following, fully functional program creates an Appearance Manager, control-based edit field and sets the text to Monaco, bold on a red background: WINDOW 1 APPEARANCE BUTTON 1,1,1,0,1,"",¬

 (10,10)-(200,200),_kControlEditTextProc DIM cfs AS ControlFontStyleRec cfs.flags = _kControlUseFontMask + ¬
           _kControlUseFaceMask + ¬
           _kControlUseBackColorMask

cfs.font = _monaco

cfs.style = _boldBit%

cfs.backColor.red = -1

cfs.backColor.green = 0

cfs.backColor.blue = 0

DEF SETBUTTONFONTSTYLE( 1, cfs ) DEF SETBUTTONTEXTSTRING( 1, "Hello" ) DO HANDLEEVENTS UNTIL 0

See Also

[edit | edit source]

DEF SETBUTTONDATA, BUTTON function, APPEARANCE BUTTON, BUTTONTEXTSTRING$