Class XbpBrowse() Foundation
Class function of the XbpBrowse class
General description: The XbpBrowse class is used to create a GUI browser to display data organized in table form. These can be databases or arrays. An XbpBrowse object on its own is a container for XbpColumn objects which are necessary to display a single column of a table. An XbpColumn object has a data code block to retrieve data, for example from a database field, and displays it on the screen.
Similar to the TBrowse class (text mode browser), the :addColumn()method is used to add a table column, or XbpColumn object, to an XbpBrowse object. The latter is not able to display table data on its own, it rather navigates through a table and positions columns on the screen.
Navigation: An XbpBrowse object navigates through a table by means of a browse cursor that can be configured optionally as a row cursor or a cell cursor. The browse cursor corresponds to the record pointer of the underlying data source, and both are automatically synchronized during navigation. To enable an XbpBrowse object to navigate, seven code blocks must be assigned to the object, three of which are used to configure a vertical scroll bar (see the example).
Display: Data is displayed on screen when an XbpBrowse object executes its :forceStable() method. Normally, this method need not be called in a program explicitly. It is executed automatically when an XbpBrowse object processes the xbeBRW_ForceStable event. This event is created by navigation methods, such as :up(), :left()or :pageDown(). This means, an XbpBrowse object has a default behaviour to react to keyboard or mouse events.
Difference to TBrowse: For an XbpBrowse object to display a table, it is sufficient to assign navigation code blocks to the object. This is a major difference between the TBrowse and XbpBrowse class. A TBrowse object requires code to be implemented for display (DO WHILE .NOT. oBrowse:stabilize()) and to process keyboard input. This is not the case with an XbpBrowse object, because it displays data and processes events within the event loop (nEvent := AppEvent() ; oBrowse:handleEvent(nEvent)).
Event handling: The next table lists all keys which are recognized by an XbpBrowse object for navigation:
Key | Description |
---|---|
Left Arrow | One column to the left |
Right Arrow | One column to the right |
Up Arrow | Previous record |
Down Arrow | Next record |
Ctrl+Up Arrow | Scrolls the display down a line |
Ctrl+Down Arrow | Scrolls the display up a line |
Page Up | Previous screen |
Page Down | Next screen |
Ctrl+Page Up | First record |
Ctrl+Page Down | Last record |
Home | First column |
End | Last column |
Return | Evaluates :itemSelected code block |
Left click | Moves browse cursor to mouse pointer |
Left double click | Evaluates :itemSelected code block |
Configuration: The appearance of a table on screen can be configured very detailed by means of presentation parameters. When an XbpBrowse object is created presentation parameters can be specified, too, which are valid for XbpColumn objects. These settings are then used by all XbpColumn objects subsequently added to the XbpBrowse object.
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.
Callback code blocks for synchronous messages differ from other callback code blocks by their return value. If the return value is NIL, the XbpBrowse object performs no further action. For any other return value, the XbpBrowse object shows its default behaviour after the code block is evaluated. Therefore, returning NIL suppresses the default behaviour of an XbpBrowse object.
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.