Class XbpColumn() Foundation

Class function of the XbpColumn class

Superclass
Description

Instances of the XbpColumn class are used together with XbpBrowse objects to display tables in graphic mode. The creation of a GUI browser starts with an XbpBrowse object to which XbpColumn objects are attached or inserted. One XbpColumn object displays data of one table column.

XbpColumn objects consist of three distinct areas, each of which can be configured in detail: heading, data area, and footing. Configuration of these areas is accomplished using presentation parameters, which are specified as a two-column array. This array must be passed to either method :new() or :create(). Presentation parameters for columns can be specified already for the XbpBrowse object that is to contain XbpColumn objects. In this case, the presentation parameters are valid for all XbpColumn objects subsequently attached to the XbpBrowse object with the :addColumn() method.

To enable an XbpColumn object to display data of a table column, a data code block must be assigned to its instance variable :dataLink. The return value of this code block is displayed in the data area of the object. Data can be displayed in different visual representation, such as literal, bitmap or icon. The instance variable :type of an XbpColumn object determines how data is displayed.

Class methods
:new()
Creates instances of the XbpColumn class.
Configuration

The instance variables in this group configure system resources. If changes are made to these values, they must either be made before the :create() method is executed or the :configure() method must be used to activate the changes.

Depending on column type, the data code block stored in :dataLinkmust return corresponding data:

XBPCOL_TYPE_TEXT

The default value of :type (XBPCOL_TYPE_TEXT) is used to display data stored in a database or an array. In this case, :dataLinkaccesses a variable and returns its value.

XBPCOL_TYPE_BITMAP , XBPCOL_TYPE_ICON

When the constants XBPCOL_TYPE_BITMAP or XBPCOL_TYPE_ICON are specified, :dataLink must return the numeric resource ID of a bitmap or icon. Either must be linked as a resource to the EXE. Alternatively, :dataLink may return an object of the XbpBitmap or XbpIcon classes. This allows to display images loaded from disk, for example. Furthermore, if a transparent color has been defined for the bitmap object, transparent areas within the bitmap are automatically replaced with the background color defined for the individual cells in the column.

If the :dataLink code block returns XbpBitmap or XbpIcon objects, either :load() or :loadFile() must have been called previously. For bitmaps created in memory, method :make() must have been called. Furthermore, reusing the same bitmap or icon object to load a different image is discouraged as long as the object is used as the value for a cell. Instead, a new bitmap or icon object should be returned for each individual image loaded from disk.

XBPCOL_TYPE_SYSICON

With XBPCOL_TYPE_SYSICON, :dataLink must return a constant prefixed with XBPSTATIC_SYSICON_. These constants are defined in XBP.CH.

XBPCOL_TYPE_FILEICON , XBPCOL_TYPE_FILEMINIICON

An XbpColumn object displays file names as symbols when either constant XBPCOL_TYPE_FILEICON or XBPCOL_TYPE_FILEMINIICON defines the column type. The:dataLink code block must return a fully-qualified file name including drive and path as character string.

:colorBlock
Changes the color of cells depending on displayed data.
:dataLink
Contains the data code block of a column.
:drawMode
Specifies the drawing mode of the XbpColumn object.
:type
Defines how data is displayed by an XbpColumn object.
Runtime
:dataArea
Object displaying the data area of the column.
:displayIndex
Contains the display position of the column.
:footing
Object displaying the footing of the column.
:heading
Object displaying the heading of the column.
:index
Contains the ordinal number of the column.
:picture
Contains the PICTURE format for formatted display.
:valType
The data type of the displayed values.
Life cycle
:create()
Requests system resources for the XbpColumn object.
:configure()
Reconfigures the XbpColumn object after :create() has been executed.
:destroy()
Releases the system resources of the XbpColumn object.
Display methods
:drawRow()
Refreshes a single row in the data area of the column.
:getRow()
Retrieves the value displayed in a row of the data area.
:hiliteRow()
Displays a row of the data area in normal or highlight color.
:refreshRows()
Refreshes one or more rows in the data area of the column.
:rowCount()
Determines the number of rows displayed in the data area of the column.
:scrollDown()
Scrolls rows in the data area upwards and refreshes the rows at the bottom.
:scrollUp()
Scrolls rows in the data area downwards and refreshes the rows at the top.
Examples
Configure a table column of a graphic browser

// This example demonstrates how to configure a single XbpColumn 
// object using presentation parameters before it is attached 
// to an XbpBrowse object with :addColumn(). 

aPresParam := { ; 
   { XBP_PP_COL_HA_CAPTION     , "Name"                     }, ; 
   { XBP_PP_COL_HA_FGCLR       , XBPSYSCLR_WINDOWSTATICTEXT }, ; 
   { XBP_PP_COL_HA_BGCLR       , XBPSYSCLR_DIALOGBACKGROUND }, ; 
   { XBP_PP_COL_DA_FGCLR       , GRA_CLR_BLACK              }, ; 
   { XBP_PP_COL_DA_BGCLR       , GRA_CLR_WHITE              }, ; 
   { XBP_PP_COL_DA_HILITE_FGCLR, GRA_CLR_WHITE              }, ; 
   { XBP_PP_COL_DA_HILITE_BGCLR, GRA_CLR_DARKGRAY           }, ; 
   { XBP_PP_COL_DA_ROWSEPARATOR, XBPCOL_SEP_DOTTED          }, ; 
   { XBP_PP_COL_DA_COLSEPARATOR, XBPCOL_SEP_DOTTED          }  } 

oXbpColumn          := XbpColumn():new(,,,,aPresParam) 
oXbpColumn:dataLink := {|| CUSTOMER->NAME } 
oXbpColumn:create() 

oXbpBrowse:addColumn( oXbpColumn ) 
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.