Class XbpStatic() Foundation

Class function of the XbpStatic class.


The XbpStatic class provides objects that display static dialog elements. These dialog elements are generally not changed and are used to display text, lines, boxes, graphics icons, and bitmaps.

The XbpStatic object's display is controlled by the instance variable :type that must be assigned a value before the :create()method is called. Valid values for this instance variable are defined as constants in the XBP.CH file. These constants begin with the prefix XBPSTATIC_TYPE_.

An XbpStatic object is generally used to display text, lines, boxes, and graphics. However, XbpStatic objects can also be assigned as the parent and/or owner in order to group Xbase Parts. For example, a set of radio buttons can be combined into a single group by assigning the XbpStatic object as the parent for the radio buttons. An XbpStatic object can also be the parent of a combo box in order to ensure correct display behavior of the combo box.

Class methods
Creates an instance of the XbpStatic class.

The instance variables in this group configure system resources. If changes are made to the default values, they must be made before the :create() method is executed or :configure() must be called to activate the changes.

Automatically fits the size of the XbpStatic object to the caption.
The caption of the XbpStatic object.
Determines whether the parent is clipped during graphic output.
Determines whether siblings are clipped during graphic output.
Name of the DLL file containing icons or bitmaps
Specifies the drawing mode of the static object.
Options for an XbpStatic object.
Determines the type of the XbpStatic object.
Specifies the visual style to use for display.
Life cycle
Requests system resources for the XbpStatic object.
Reconfigures the XbpStatic object after :create() has been executed.
Releases the system resources of the XbpStatic object.
Specifies a new caption.
Informs the application that an owner-drawn static object needs to be redrawn.
Static dialog elements

// In this example, three different static dialog elements 
// are displayed in a dialog window. The objects displayed 
// are a system icon, text, and a box. 

#include "" 
#include "" 
#include "" 

   LOCAL nEvent, mp1, mp2, oXbp 
   LOCAL oDlg, oDraw, oStatic, cText 

   SetColor( "N/W" ) 
   SetAppwindow():useShortCuts := .T. 

   oDlg          := XbpDialog():new() 
   oDlg:title    := "Test Static Controls" 
   oDlg:create( ,, {50,50}, {500,300} ) 

   oDraw := oDlg:drawingArea 

   // XbpStatic object with system icon 
   oStatic         := XbpStatic():new( oDraw,, {10, 200 }  ) 
   oStatic:type    := XBPSTATIC_TYPE_SYSICON 

   // XbpStatic object with multi-row text 
   // Note :options where constants are summed 
   cText := "This is a text which is displayed;"   + ; 
            "in several rows.;"                    + ; 
            "The XbpStatic object displays;"       + ; 
            "five rows.;"                          + ; 
            "The text is centered" 

   oStatic := XbpStatic():new( oDraw,, {70, 140},  {400, 100} ) 
   oStatic:options := XBPSTATIC_TEXT_CENTER  + ; 
   // Change word wrap character from semicolon to Chr(13) 
   oStatic:caption := StrTran( cText, ";", Chr(13) ) 

   // XbpStatic object with box 
   oStatic := XbpStatic():new( oDraw,, {60, 130},  {420, 120} ) 

   nEvent := 0 
   // Event loop 
   DO WHILE nEvent <> xbeP_Close 
      nEvent := AppEvent( @mp1, @mp2, @oXbp ) 
      oXbp:handleEvent( nEvent, mp1, mp2 ) 


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.