Method XbpBrowse():addColumn() Foundation

Attaches a column (XbpColumn object) to an XbpBrowse object.

Syntax
:addColumn( <oXbpColumn> ) --> oXbpColumn
or
:addColumn( <bDataLink>, ;
            [<nWidth>], ;
            [<cHeading|nHeadID>], ;
            [<cFooting|nFootID>], ;
            [<nType>] ) --> oXbpColumn
Parameters
<oXbpColumn>
<oXbpColumn> is an XbpColumn object that retrieves data from a table to be displayed by the XbpBrowse object. An XbpColumn object that has not executed its :create() method can be passed.
<bDataLink>
Instead of an object the first parameter can be a data code block whose return value is to be displayed in a column on the screen. In this case, the XbpBrowse object creates an XbpColumn object and assigns <bDataLink> to its :dataLink instance variable.
<nWidth>
<nWidth> defines the width of a column as number of characters. The width of a column then depends on the font used for displaying data. The default value for<nWidth> is the constant XBP_AUTOSIZE. This means that the column width is calculated from the return value of <bDataLink>.
<cHeading|nHeadID>
The heading of a table column can be defined as a character string <cHeading>, or as numeric resource ID of a bitmap <nHeadID>. The default value is NIL, which causes a column to be created without a heading.
<cFooting|nFootID>
The footing of a table column can be defined as a character string <cFooting>, or as numeric resource ID of a bitmap <nFootID>. The default value is NIL, which causes a column to be created without a footing.
<nType>
This parameter defines the type of the XbpColumn object to be created by the XbpBrowse object. Constants defined in XBP.CH are used for <nType>. They are listed in the table below:
Constants used for <nType>
Constant Description
XBPCOL_TYPE_BITMAP The column displays bitmaps
XBPCOL_TYPE_ICON The column displays icons
XBPCOL_TYPE_SYSICON The column displays system-icons
XBPCOL_TYPE_FILEICON The column displays normal file-icons
XBPCOL_TYPE_FILEMINIICON The column displays small file-icons
XBPCOL_TYPE_TEXT *) The column displays textual data
  1. default value
Return

The method returns the attached XbpColumn object.

Description

The method :addColumn() attaches a table column to an XbpBrowse object. Display of columns is done by XbpColumn objects. The method must receive either a configured XbpColumn object or a data code block which returns data to be displayed in a column. In this case the XbpBrowse object creates the XbpColumn object and attaches it to itself.

Parameters for width, heading, footing and column type are optional. The type determines whether a column is to display text, icons or bitmaps. Depending on column type, the data code block must return corresponding data:

XBPCOL_TYPE_TEXT

The default value of <nType> (XBPCOL_TYPE_TEXT) is used to display data stored in a database or an array. In this case, <bDataLink>accesses a variable and returns its value.

XBPCOL_TYPE_BITMAP , XBPCOL_TYPE_ICON

When the constants XBPCOL_TYPE_BITMAP or XBPCOL_TYPE_ICON are specified, <bDataLink> must return the numeric resource ID of a bitmap or icon. Either must be linked as a resource to the EXE.

XBPCOL_TYPE_SYSICON

With XBPCOL_TYPE_SYSICON, <bDataLink> 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<bDataLink> code block must return a fully-qualified file name including drive and path as character string.

Windows uses the Windows Bitmap file format as the default image format. If a numeric resource id is assigned to <nHeadID> or <nFootID>, it must be the id of a BITMAP resource linked into the application. In order to use the other image file formats, an XbpBitmap object must be assigned to the respective parameter instead. See XbpBitmap:load()for further information.

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.