Class XbpStatusBar() Foundation

Class function of the XbpStatusBar() class


The class XbpStatusBar implements an Xbase Part that can be used by an Xbase++ application to inform the user of the application's status. An XbpStatusBar object consists of one or more panels, each of which can display status text as well as an application-defined image.

Possible uses of the XbpStatusBar class include:

Display the current keyboard state for keys such as the Insert (INS) key.
Display the current time and date
Display status information, such as whether the application is currently busy
Display information about the file or database currently open in the application

Using the XbpStatusBar Xbase Part

An instance of the XbpStatusBar class is created by calling its :new() method followed by :create(). After the object is created, an application uses the object's instance variables and methods to assign the status text and/or image to be displayed by the Xbase Part. The visible area of an XbpStatusBar object can be divided into one or more status bar panels, each of which can display a status message and image. A status bar panel is defined using the method :addItem(). An XbpStatusBar object can hold up to 16 panels.

Usage in MDI applications

In so-called MDI applications, one or more child or document windows can be displayed within the main window of the application. MDI applications are created by making the XbpDialog objects representing the child windows a child of the :drawingArea of the main window. Afterwards, the child windows can be moved freely within the drawing area of the main window. The child dialogs overlap each other as well as all other childs defined in the :drawingArea of the main window. This is to be taken into account when using the XbpStatusBar class within the main window of an MDI application. In this case, the status bar often visualizes the global application status and hence should be visible at all times. In order to prevent the status bar from being hidden by overlapping child dialogs, the status bar should be created as a child of the main window (XbpDialog), and not as a child of the main window's drawing area. Also, the dimension of the drawing area must be reduced by the height of the status bar, and the position must be adjusted accordingly.

To function properly, the XbpStatusBar class requires a certain system component, the Microsoft Common Controls Version 6.0, to be installed on your computer. Normally, this component is not installed along with the operating system, so provisions must be taken to distribute the component with your Xbase++ application. An installation package with the required system files for using the XbpStatusBar Xbase Part is available from Alaska Software. The corresponding archive should be located on your Xbase++ disk or CD ROM. For further information, please click the 'Info' button on this page.

Class methods
Creates an instance of the XbpStatusBar class.
Life cycle
Requests system resources for the XbpStatusBar object.
Reconfigures the XbpStatusBar object after :create() has been executed.
Releases the system resources of the object.
Runtime Data

The instance variables in the following section can only be used after method :create() was called.

Contains the caption string displayed by an XbpStatusBar object.
Specifies whether the XbpStatusBar displays a size grip.
Adds a status bar item (panel) to the XbpStatusBar object.
Removes an item (panel) from the XbpStatusBar object.
Retrieves an item (panel) from the XbpStatusBar object's item array.
Returns the number of status bar items (panels) defined for an XbpStatusBar object.
Removes all status bar items (panels) defined for an XbpStatusBar object.
A status bar panel has been clicked with the mouse.
A status bar panel has been double-clicked with the mouse.
Example for using the XbpStatusBar Xbase Part

 // Example for using the XbpStatusBar Xbase Part 
 #include "XBP.CH" 
 #include "AppEvent.CH" 

  LOCAL oDlg 
  LOCAL oSBar 
  LOCAL nEvent, mp1, mp2, oXbp 
  LOCAL oPanel 

   // Create application's main dialog 
   oDlg := XbpDialog():new( Appdesktop() ) 
   oDlg:title 	  := "Statusbar Example" 
   oDlg:taskList := .T. 
   oDlg:close    := {|| PostAppEvent(xbeP_Quit,,, oDlg) } 
   oDlg:create( ,, {50,50}, {640,480},, .F. ) 
   oDlg:drawingArea:resize := {|| ResizeStatusbar(oSBar)} 

   // Create an XbpStatusBar object and 
   // add it at the bottom of the dialog 
   oSBar := XbpStatusBar():new( oDlg:drawingArea ) 
   oSBar:create( ,, {0,0}, {oDlg:drawingArea:currentSize()[1],30} ) 

   // Use two status bar panels to display status 
   // information: application mode ("Ready") and 
   // current time 
   oPanel := oSBar:getItem( 1 ) 
   oPanel:caption  := "Ready" 

   oPanel := oSBar:addItem() 

   // Display the main dialog and process 
   // application events until the dialog 
   // is closed 

   SetAppWindow( oDlg ) 
   SetAppFocus( oDlg ) 

   nEvent := xbeP_Quit 
   DO WHILE nEvent != xbeP_Close 
     nEvent := AppEvent( @mp1, @mp2, @oXbp ) 
     oXbp:handleEvent( nEvent, mp1, mp2 ) 


 // Resize XbpStatusBar object to always span the 
 // whole width of the dialog's drawing area 
 PROCEDURE ResizeStatusbar( oSBar ) 
   LOCAL oParent := oSBar:setParent() 

     oSBar:setSize( {oParent:currentSize()[1], oSBar:currentSize()[2]} ) 

 // Overloaded AppSys() procedure to prevent 
 // creation of the default XbpCrt window 

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.