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.
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.
// 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 "gra.ch"
#include "xbp.ch"
#include "Appevent.ch"
PROCEDURE Main
LOCAL nEvent, mp1, mp2, oXbp
LOCAL oDlg, oDraw, oStatic, cText
SetColor( "N/W" )
CLS
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:autoSize:=.T.
oStatic:type := XBPSTATIC_TYPE_SYSICON
oStatic:caption := XBPSTATIC_SYSICON_ICONINFORMATION
oStatic:create()
// 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 + ;
XBPSTATIC_TEXT_WORDBREAK
// Change word wrap character from semicolon to Chr(13)
oStatic:caption := StrTran( cText, ";", Chr(13) )
oStatic:create()
// XbpStatic object with box
oStatic := XbpStatic():new( oDraw,, {60, 130}, {420, 120} )
oStatic:type := XBPSTATIC_TYPE_RAISEDRECT
oStatic:create()
nEvent := 0
// Event loop
DO WHILE nEvent <> xbeP_Close
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
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.