Classes

Method XbpToolBar():loadImageSet() Foundation

Loads a set of pre-defined standard images for usage with tool bar buttons.

Syntax
:loadImageSet( <nImageSet> ) => lSuccess
Parameters
<nImageSet>
<nImageSet> is a numeric value that specifies the image set to be loaded.
Return

:loadImageSet() returns a logical value. If the image set specified in <nImageSet> is loaded successfully, the value .T. (TRUE) is returned. In case of an error, method :loadImageSet() returns .F. (FALSE).

Description

Using method :loadImageSet(), a set of pre-defined images representing standard application commands can be loaded into an XbpToolBar object. After an image set has been loaded, its images can be assigned to buttons that are added to the tool bar.

Calling the :loadImageSet() method resets all images already assigned to tool bar buttons. Consequently, :loadImageSet()should be called prior to adding buttons to a tool bar.

The image set to be loaded by :loadImageSet() must be specified using the <nImageSet> parameter. To do that, one of the following constants may be used:

Constants defined for selecting standard tool bar images
Constant Description
XBPTOOLBAR_STDIMAGES_SMALL Std. images for commands such as Copy, Save or Find
XBPTOOLBAR_STDIMAGES_LARGE Std. images, large version
XBPTOOLBAR_VIEWIMAGES_SMALL Images for view commands such as View Details, View as List, Sort by Name
XBPTOOLBAR_VIEWIMAGES_LARGE View images, large version
XBPTOOLBAR_EXPLORERIMAGES_SMALL Images for browser commands such as Back, Forward
XBPTOOLBAR_EXPLORERIMAGES_LARGE Images for browser, large version

To display one of the images in an image set in a tool bar button, an Xbase++ application assigns one of the following constants to the button object's :image instance variable. Also, the contants can be used with the <xImage> parameter to method :addItem().

Constants defined for images in the standard image set
Constant Represents command or function
STD_IMAGE_COPY Copy
STD_IMAGE_CUT Cut
STD_IMAGE_DELETE Delete
STD_IMAGE_FILENEW Create New File
STD_IMAGE_FILEOPEN Open File
STD_IMAGE_FILESAVE Save File
STD_IMAGE_FIND Find
STD_IMAGE_HELP Help
STD_IMAGE_PASTE Paste
STD_IMAGE_PRINT Print
STD_IMAGE_PRINTPRE Print Preview
STD_IMAGE_PROPERTIES Generic Properties
STD_IMAGE_REDO Redo
STD_IMAGE_REPLACE Replace
STD_IMAGE_UNDO Undo

Constants defined images in the view image set
Constant Represents command or function
VIEW_IMAGE_DETAILS View Details
VIEW_IMAGE_LARGEICONS View as Large Icons
VIEW_IMAGE_LIST View as List
VIEW_IMAGE_NETCONNECT Connect to Network Resource
VIEW_IMAGE_NETDISCONNECT Disconnect from Network Resource
VIEW_IMAGE_NEWFOLDER New Folder
VIEW_IMAGE_PARENTFOLDER Change to Parent Folder
VIEW_IMAGE_SMALLICONS View as Small Icons
VIEW_IMAGE_SORTDATE Sort by Date
VIEW_IMAGE_SORTNAME Sort by Name
VIEW_IMAGE_SORTSIZE Sort by Size
VIEW_IMAGE_SORTTYPE Sort by Type

Constants defined images in the browser image set
Constant Represents command or function
EXPLORER_IMAGE_ADDTOFAVORITES Add to Favorits
EXPLORER_IMAGE_BACK Navigate Backwards
EXPLORER_IMAGE_FAVORITES Display Favorites
EXPLORER_IMAGE_FORWARD Navigate Forward
EXPLORER_IMAGE_VIEWTREE View History Tree

The images that can be loaded using method :loadImageSet() were defined to represent a toolbar button's unpressed, enabled state. To specify images for other button states, an application can use a tool bar button's :disabledImage and :hotImage instance variables once the button has been added. Alternatively, the <xDisabledImage> and <xHotImage> parameters to method :addItem() may be used. However, doing so is not required. Windows applications normally use only the images defined in the system image sets or define custom button images.

  // 
  // Example for using standard system images 
  // with the buttons defined in a XbpToolBar 
  // object 
  // 
  #include "XBP.CH" 

  PROCEDURE Main() 
    LOCAL oTBar 
    LOCAL oButton 

      // Create the XbpToolBar object 
      oTBar := XbpToolBar():new() 
      oTBar:create( ,, {0,SetAppWindow():ySize-30},; 
                       {SetAppWindow():xSize,30} ) 


      // Assign a callback code block to process 
      // button clicks 
      oTBar:buttonClick := {|oButton| HandleButtonClick(oButton)} 

      // Use :loadImageSet() to load the images 
      // for the standard commands into the 
      // tool bar object 
      oTBar:loadImageSet( XBPTOOLBAR_STDIMAGES_SMALL ) 

      // Add a new tool bar button for application's 
      // Open File command 
      oTBar:addItem( ,STD_IMAGE_FILEOPEN,,,,, "OPEN" ) 

      // Add a new tool bar button for application's 
      // Save File command 
      oTBar:addItem( ,STD_IMAGE_FILESAVE,,,,, "SAVE" ) 

      SetAppFocus( SetAppWindow() ) 

      SetPos( 5,0 ) 
      WAIT 
   RETURN 

   // Process events generated by the user 
   // clicking on one of the tool bar buttons 
   PROCEDURE HandleButtonClick( oButton ) 
      DO CASE 
         CASE oButton:key == "OPEN" 
            MsgBox( "Would open a file now if I wasn't an example!" ) 
         CASE oButton:key == "SAVE" 
            MsgBox( "Would save a file now if I wasn't an example!" ) 
      ENDCASE 
   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.