Method XbpStatusBar():addItem() Foundation
Adds a status bar item (panel) to the XbpStatusBar object.
:addItem( [<cCaption>], [<xImage>], [<cDLL>], [<nStyle>], [<cKey>] ) => <oPanel>
The method :addItem() returns a reference to the XbpStatusBarPanel() object added to the status bar item array.
The method :addItem() is used to add a new status bar panel to the XbpStatusBar object. Status bar panels are used to divide the display area into separate sections, each displaying different kinds of status information. One status bar panel is automatically defined when method :create() is called to create an XbpStatusBar instance. Additional panels can later be added by the application via method :addItem().
Each status bar panel can optionally display its own status message and image. Also, several pre-defined status bar panel styles exist, which can be selected by specifying one of following constants in parameter <nStyle>:
Constant | Description |
---|---|
XBPSTATUSBAR_PANEL_TEXT *) | Panel displays status text |
XBPSTATUSBAR_PANEL_CAPSLOCK | Panel displays status of CAPSLOCK key |
XBPSTATUSBAR_PANEL_NUMLOCK | Panel displays status of NUMLOCK key |
XBPSTATUSBAR_PANEL_INSERT | Panel displays status of INSERT key |
XBPSTATUSBAR_PANEL_SCROLL | Panel displays status of SCROLL LOCK key |
XBPSTATUSBAR_PANEL_TIME | Panel displays current time |
XBPSTATUSBAR_PANEL_DATE | Panel displays current date |
|
In addition to the status or key state displayed, a panel added to an XbpStatusBar object can also display an application-defined image. The image must be specified using parameter <xImage> when a new panel is added using :addItem(). The image may be defined in the resource linked to the application, a Dynamic Link Library (DLL) or may be loaded from disk using an object of the XbpBitmap() or XbpIcon() classes.
After the XbpStatusBar object is configured, the items defined in the internal array of status bar panels can be retrieved using method :getItem(). For easier access and better readability of the source code, a unique identifier may be assigned to each panel added using method :addItem(). The key must be specified as a character string in parameter <cKey>.
//
// Example for using :addItem() to add a panel
// to an XbpStatusBar object
//
#include "XBP.CH"
PROCEDURE Main()
LOCAL oSBar
LOCAL oPanel
// Create the XbpStatusBar object
oSBar := XbpStatusBar():new()
oSBar:create( ,, {0,0}, {SetAppWindow():currentSize()[1],30} )
// Add a new status bar panel and assign it
// a unique identifier
oSBar:addItem( ,,,, "TXTPANEL" )
// Use :getItem() to retrieve a reference
// to the panel just added. Use this to
// change the caption text and the
// panel's size.
oPanel := oSBar:getItem( "TXTPANEL" )
oPanel:caption := "Test Status Text"
oPanel:autoSize := XBPSTATUSBAR_AUTOSIZE_CONTENTS
WAIT
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.