Classes

Member variable XbpStatusBar():caption Foundation

Contains the caption string displayed by an XbpStatusBar object.

Attribute: EXPORTED
Data type: Character ("")
Description

The instance variable :caption contains a character string that defines the caption displayed by an XbpStatusBar object. When a character string is assigned to the :caption instance variable, the XbpStatusBar object displays the caption string in a single panel that spans the whole width of the statusbar's parent object.

Using the :caption instance variable provides a convenient way for displaying simple status messages. Also, assigning a string to :caption allows an application to temporarily hide the status bar panels displayed by the XbpStatusBar object. For example, a lengthy operation sometimes results in the temporary unresponsiveness of the application. In such a case, the application may assign the character string "Busy..." to its statusbar's :caption instance variable. After that, all panels (including those displaying key state information) will be hidden until the operation concluded and the application is again ready to respond to user interaction.

To redisplay status bar panels temporarily hidden by a simple status message, assign the empty string ("") to the :captioninstance variable.

The instance variable :caption can only be used after the XbpStatusBar object was created using method :create(). If :caption is accessed before :create() was called, a runtime error is generated.

// 
// Using :caption to display a simple status message 
// 
#include "XBP.CH" 

PROCEDURE Main() 
  LOCAL oSBar 

    // Create the XbpStatusBar object 
    oSBar := XbpStatusBar():new() 
    oSBar:create( ,, {0,0}, {SetAppWindow():currentSize()[1],30} ) 

    SetAppFocus( SetAppWindow() ) 

    // Add another status bar panel for illustrational 
    // purposes. Also, display some status information 
    oSBar:getItem(1):Caption := "Ready" 
    oSBar:addItem( "Please press a key..." ) 
    oSBar:getItem(2):autoSize := XBPSTATUSBAR_AUTOSIZE_SPRING 
    Inkey( 0 ) 

    // Use :caption to display simple status messages, 
    // temporarily hiding the panels defined previously 
    oSBar:caption   := "This is a simple status message. Please press another key." 
    Inkey( 0 ) 

    oSBar:caption   := "Thank you, that felt good. I'll restore the "; + 
                       "original status bar now." 
    Inkey( 0 ) 

    oSBar:caption   := "" 
    WAIT "Done. Thank you." 
 RETURN 

Feedback

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.