home *** CD-ROM | disk | FTP | other *** search
- Notes on the predefined TBrowse object class.
-
- Note: this information supersedes the information in the
- pre-release documentation.
-
-
- o TBrowse
-
- Note: for a general discussion of Clipper 5.0 predefined
- objects (and Tbrowse objects), refer to the "Basic
- Concepts" chapter of the documentation.
-
- A TBrowse object is a general purpose browsing mechanism for
- table-oriented data. TBrowse objects provide a sophisticated
- architecture for acquiring, formatting, and displaying data.
- Data retrieval and file positioning are performed via
- user-supplied code blocks, allowing a high degree of
- flexibility and interaction between the browsing mechanism and
- the underlying data source. The format of individual data
- items can be precisely controlled via the data-retrieval code
- blocks; overall display formatting and attritubutes can be
- controlled by sending appropriate messages to the TBrowse
- object.
-
- A TBrowse object relies on one or more TBColumn objects. A
- TBColumn object contains the information necessary to define a
- single column of the browse (see the section on TBColumn
- objects below).
-
- During operation, a TBrowse object retrieves data by evaluating
- code blocks. The data is organized into rows and columns, and
- displayed within a specified rectangular area of the screen.
- The TBrowse object maintains an internal "browse cursor." The
- data item on which the browse cursor rests is displayed in a
- highlighted color. (The actual screen cursor is also
- positioned to the first character of this data item.)
-
- Initially, the browse cursor is placed on the data item at the
- top left of the browse display. Messages can then be sent to
- the TBrowse object to navigate the displayed data, causing the
- browse cursor to move. These messages are normally sent in
- response to user keystrokes.
-
- New data is automatically retrieved as required by navigation
- requests. When navigation proceeds past the edge of the
- visible rectangle, rows or columns beyond that edge are
- automatically brought into view. When new rows are brought
- into view, the underlying data source is repositioned by
- evaluating a code block.
-
-
- o Exported Instance Variables
-
- cargo (Assignable)
-
- Contains a value of any data type. This instance variable is
- unused by the standard TBrowse object. It is provided as a
- user-definable slot.
-
-
- colCount
-
- Contains a numeric value indicating the total number of data
- columns in the browse. For each column, there is an associated
- TBColumn object.
-
-
- colorSpec (Assignable)
-
- Contains a character string defining a color table for the
- TBrowse display. By default, the current SETCOLOR() value is
- copied into this variable when the TBrowse object is created
- (see the Standard Functions chapter).
-
-
- colPos (Assignable)
-
- Contains a numeric value that indicates which data column the
- browse cursor is currently on. Columns are numbered from one,
- starting with the leftmost column.
-
-
- colSep (Assignable)
-
- Contains a character value which defines a default column
- separator for TBColumns which don't specify a column separator
- (see the section on the TBColumn class).
-
-
- freeze (Assignable)
-
- Contains a numeric value that defines the number of data
- columns frozen on the left side of the display. Frozen columns
- are always visible, even when other columns are panned off the
- display.
-
-
- goBottomBlock (Assignable)
-
- Contains a code block that is executed in response to the
- goBottom message. This block is responsible for repositioning
- the data source to the last record which is to take part in the
- browse. Typically, the data source is a database file and this
- block contains a call to a function that executes a GO BOTTOM
- command.
-
-
- goTopBlock (Assignable)
-
- Contains a code block that is executed in response to the goTop
- message. This block is responsible for repositioning the data
- source to the first record which is to take part in the
- browse. Typically, the data source is a database file and this
- block contains a call to a function that executes a GO TOP
- command.
-
-
- headSep (Assignable)
-
- Contains a character value which defines a default heading
- separator for TBColumns which don't specify a heading separator
- (see the section on the TBColumn class).
-
-
- hitBottom (Assignable)
-
- Contains a logical value. A true (.T.) value indicates that an
- attempt was made to navigate past the end of the available
- data. During stabilization, the TBrowse object sets this
- variable if the skip block indicates that it was unable to skip
- forward as many records as requested.
-
-
- hitTop (Assignable)
-
- Contains a logical value. A true (.T.) value indicates that an
- attempt was made to navigate past the beginning of the
- available data. During stabilization, the TBrowse object sets
- this variable if the skip block indicates that it was unable to
- skip backward as many records as requested.
-
-
- nBottom (Assignable)
-
- Contains a numeric value that defines the bottom screen row
- used for the TBrowse display.
-
-
- nLeft (Assignable)
-
- Contains a numeric value that defines the leftmost screen
- column used for the TBrowse display.
-
-
- nRight (Assignable)
-
- Contains a numeric value that defines the rightmost screen
- column used for the TBrowse display.
-
-
- nTop (Assignable)
-
- Contains a numeric value that defines the top screen row used
- for the TBrowse display.
-
-
- rowCount
-
- Contains a numeric value indicating the number of data rows
- that are visible in the browse display. Only data rows are
- included in the count; rows occupied by headings, footings, or
- separators are not included.
-
-
- rowPos (Assignable)
-
- Contains a numeric value that indicates which data row the
- browse cursor is currently on. Data rows are numbered from
- one, starting with the topmost data row. Screen rows
- containing headers, footers or seperators are not considered
- data rows.
-
-
- skipBlock (Assignable)
-
- Contains a code block that takes a single numeric parameter.
- During stabilization, this code block is executed when the
- TBrowse object needs to reposition the data source. The
- numeric parameter passed to the block represents the number of
- records to be skipped. A positive value means skip forward and
- a negative value means skip backward. A value of zero
- indicates that the data source does not need to be
- repositioned, but the current record may need to be refreshed.
- Typically, the data source is a database file and this block
- calls a function that executes SKIP commands to reposition the
- record pointer.
-
- The block must return the number of rows (positive, negative or
- zero) actually skipped. If the value returned is not the same
- as the value requested, the TBrowse object assumes that the
- skip operation encountered beginning or end of file.
-
-
- stable (Assignable)
-
- Contains a logical value that is true (.T.) if the TBrowse
- object is stable and false (.F.) otherwise. The browse is
- considered stable when all data has been retrieved and
- displayed, the data source has been repositioned to the record
- corresponding to the browse cursor, and the current cell has
- been highlighted. When navigation messages are sent to the
- TBrowse object, this flag is set to false (.F.). After
- stabilization is performed (using the stabilize message), the
- flag is set to true (.T.).
-
-
- o Cursor Movement Methods
-
- down() <-- self
-
- Moves the browse cursor down one row. If the cursor is already
- on the bottom row, the display is scrolled and a new row is
- brought into view. If the data source is already at logical
- end-of-file and the browse cursor is already on the bottom row,
- hitBottom is set true (.T.).
-
-
- end() <-- self
-
- Moves the browse cursor to the rightmost data column that is
- currently visible.
-
-
- goBottom() <-- self
-
- Repositions the data source to logical bottom-of-file (by
- evaluating the goBottomBlock), refills the display with the
- bottom-most available data, and moves the browse cursor to the
- lowermost data row for which data is available. The pan
- position of the window is not changed.
-
-
- goTop() <-- self
-
- Repositions the data source to logical top-of-file (by
- evaluating the goTopBlock), refills the display with the
- topmost available data, and moves the browse cursor to the
- uppermost data row for which data is available. The pan
- position of the window is not changed.
-
-
- home() <-- self
-
- Moves the browse cursor to the leftmost unfrozen column on the
- display.
-
-
- left() <-- self
-
- Moves the browse cursor left one data column. If the cursor is
- already on the leftmost displayed column, the display is panned
- and the previous data column (if there is one) is brought into
- view.
-
-
- pageDown() <-- self
-
- Repositions the data source downward and refills the display.
- If the data source is already at logical end-of-file (i.e. the
- bottom-most available record is already shown), the browse
- cursor is simply moved to the lowermost row containing data.
- If the data source is already at logical end-of-file and the
- browse cursor is already on the bottom row, hitBottom is set
- true (.T.).
-
-
- pageUp() <-- self
-
- Repositions the data source upward and refills the display. If
- the data source is already at logical beginning-of-file (i.e.
- the topmost available record is already shown), the browse
- cursor is simply moved to the top data row. If the data source
- is already at logical beginning-of-file and the browse cursor
- is already on the first data row, hitTop is set true (.T.).
-
-
- panEnd() <-- self
-
- Moves the browse cursor to the rightmost data column, causing
- the display to be panned all the way to the right.
-
-
- panHome() <-- self
-
- Moves the browse cursor to the leftmost data column, causing
- the display to be panned all the way to the left.
-
-
- panLeft() <-- self
-
- Pans the display without changing the browse cursor (if
- possible). When the screen is panned with panLeft, at least
- one data column which was out of view to the left is brought
- into view, while one or more columns are panned off screen to
- the right.
-
-
- panRight() <-- self
-
- Pans the display without changing the browse cursor (if
- possible). When the screen is panned with panRight, at least
- one data column which was out of view to the right is brought
- into view, while one or more columns are panned off screen to
- the left.
-
-
- right() <-- self
-
- Moves the browse cursor right one data column. If the cursor
- is already at the right edge, the display is panned and the
- next data column (if there is one) is brought into view.
-
-
- up() <-- self
-
- Moves the browse cursor up one row. If the cursor is already
- on the top data row, the display is scrolled and a new row is
- brought into view. If the data source is already at logical
- beginning-of-file and the browse cursor is already on the top
- data row, hitTop is set true (.T.).
-
-
- o Miscellaneous Methods
-
- addColumn(<objColumn>) <-- method>
-
- Adds a new column to the browse. The parameter is a TBColumn
- object. The column count of the TBrowse object is increased by
- one.
-
-
- configure() <-- self
-
- Causes the TBrowse object to reexamine all instance variables
- and TBColumn objects, and reconfigure its internal settings as
- required. This message can be used to force re-configuration
- when a TBColumn object is modified directly.
-
-
- getColumn(<nColumn>) <-- method>
-
- Returns the TBColumn object specified by nColumn.
-
-
- refreshAll() <-- self
-
- Internally marks all data rows as invalid, causing them to be
- refilled and redisplayed during the next stabilize loop.
-
-
- refreshCurrent() <-- self
-
- Internally marks the current data row as invalid, causing it to
- be refilled and redisplayed during the next stabilize loop.
-
-
- setColumn(<nColumn>, <objColumn>) <-- objColumn
-
- Replaces the TBColumn object indicated by nColumn with the
- TBColumn object specified by objColumn.
-
-
- stabilize() <-- lStable
-
- Performs incremental stabilization. Each time this message is
- sent, some part of the stabilization process is performed.
- Stabilization is performed in increments so that it can be
- interrupted by a keystroke or other asynchronous event.
-
- If the TBrowse object is already stable, a value of true (.T.)
- is returned; otherwise a value of false (.F.) is returned,
- indicating that further stabilize messages should be sent. The
- browse is considered stable when all data has been retrieved
- and displayed, the data source has been repositioned to the
- record corresponding to the browse cursor, and the current cell
- has been highlighted.
-
-
-
- o The TBrowseNew() function
-
- TBrowseNew(<nTop>, <nLeft>, <nBottom>, <nRight>) <-- objTBrowse
-
- Returns a new TBrowse object with the specified coordinate
- settings. The TBrowse object is created with no columns and no
- code blocks for data source positioning. These must be
- provided before the TBrowse can be used.
-
-
-
- o The TBrowseDB() function
-
- TBrowseDB(<nTop>, <nLeft>, <nBottom>, <nRight>) <-- objTBrowse
-
- Returns a new TBrowse object with the specified coordinate
- settings and default code blocks for data source positioning.
- The default code blocks execute GO TOP, Go BOTTOM, and SKIP
- commands for data source positioning.
-
- The TBrowse object is created with no columns. These must be
- provided before the TBrowse can be used.
-
-
-
- o TBColumn Objects
-
- A TBColumn object is a simple object containing the information
- needed to fully define one data column of a TBrowse object (see
- the section on the TBrowse class). TBColumn objects have no
- methods, only exported instance variables.
-
-
- o Exported Instance Variables
-
- block (Assignable)
-
- Contains a code block that is used to retrieve data for the
- column. Any code block is valid, and no block parameters are
- supplied when the block is executed. The code block must
- return the appropriate data value for the column.
-
-
- cargo (Assignable)
-
- Contains a numeric value. This instance variable is a
- user-definable slot, allowing arbitrary information to be
- attached to a TBColumn and retrieved later.
-
-
- colorBlock (Assignable)
-
- An optional code block that determines the color of data items
- as they are displayed. If present, this block is executed each
- time a new value is retrieved via the data retrieval block.
- The newly retrieved data value is passed as a parameter to the
- colorBlock, which must return an array containing two numeric
- values. The values returned are used as indexes into the color
- table of the TBrowse object as described below for defColor.
-
- The colorBlock allows display colors for data items to be based
- on the value of the data being displayed.
-
- colSep (Assignable)
-
-
- An optional character string used to draw a vertical separator
- to the left of this data column (if this data column is
- displayed with another column to the left of it). If no value
- is supplied for colSep, the column separator specified in the
- TBrowse object is used.
-
-
- defColor (Assignable)
-
- An array containing two numeric values. The values are used as
- indexes into the color table in the TBrowse object. The first
- value determines the unselected color. The unselected color is
- used to display headings, footings, etc. It is also used to
- display data values when the browse cursor is not on the data
- value being displayed. The second value determines the
- selected color. The selected color is used to display data
- values when the browse cursor is positioned to the data item
- being displayed. The default value for defColor is {1, 2}.
- This causes the first two colors in the TBrowse color table to
- be used for unselected and selected, respectively. Note that
- colors set using the colorBlock instance variable override
- those set by defColor.
-
-
- footing (Assignable)
-
- Contains a character value that defines the footer for this
- data column.
-
-
- footSep (Assignable)
-
- Contains a character value used to draw a horizontal line
- between the data values and the footer.
-
-
- heading (Assignable)
-
- Contains a character value that defines the header for this
- data column.
-
-
- headSep (Assignable)
-
- An optional character string used to draw a horizontal
- separator between the header and the data values. If no value
- is supplied, the heading separator specified in the TBrowse
- object is used.
-
-
- width (Assignable)
-
- Contains a numeric value that defines the display width for the
- column. If not assigned, the width is determined by examining
- a data value returned by the data retrieval block.
-
-
-
- o The TBColumnNew() function
-
- TBColumnNew(<cHeading>, <bBlock>) <-- objTBColumn
-
- Returns a new TBColumn object with the specified heading and
- data retrieval block. Other elements of the TBColumn object
- can be assigned directly using the syntax for assigning
- exported instance variables.
-
-
-
- o Examples
-
- For examples of TBrowse and TBColumn, refer to the file
- TBDEMO.PRG in the SOURCE directory.
-