TWBrowse
Source: source/classes/wbrowse.prg
Inherits from: TControl
TWBrowse is FiveWin's original browse control for navigating database records and array data in a tabular format. It provides column headers, adjustable column sizing, keyboard navigation, inline editing, and integration with database objects, arrays, and ADO recordsets. TXBrowse is the modern successor, but TWBrowse remains in active use for simpler scenarios.
Key DATA Members
| DATA | Type | Description |
|---|---|---|
cAlias | Character | Alias of the work area being browsed |
bLine | Block | Code block for drawing each row |
bSkip | Block | Custom skip block for navigation |
nRowPos | Numeric | Current row position |
nColPos | Numeric | Current column position |
aHeaders | Array | Array of column header strings |
aColSizes | Array | Array of column widths in pixels |
lAutoEdit | Logical | Enable automatic inline editing |
lCellStyle | Logical | Use cell-level styling instead of row-level |
Methods
| Method | Description |
|---|---|
New( nRow, nCol, nW, nH, bLine, aHeaders, aColSizes, oWnd ) | Create a new browse control |
SetArray( aArr ) | Bind the browse to an array data source |
SetOBJ( oDbf ) | Bind the browse to a TDatabase object |
SetADO( oRs ) | Bind the browse to an ADO recordset |
SetFilter( cField, u1, u2 ) | Apply a filter condition to the current data source |
Report( cTitle, lPreview ) | Generate a printed report of the browse content |
Html() | Export the browse content as an HTML table string |
Example: 3-Column Browse Bound to DBF
#include "FiveWin.ch"
function Main()
local oWnd, oBrw
USE CUSTOMER NEW
DEFINE WINDOW oWnd TITLE "Customers" SIZE 600, 400
@ 10, 10 BROWSE oBrw ;
HEADERS "Code", "Name", "City" ;
SIZES 60, 200, 150 ;
OF oWnd
oBrw:SetOBJ( TDatabase():Open( nil, "CUSTOMER" ) )
ACTIVATE WINDOW oWnd CENTERED
return nil
Notes
- TWBrowse supports three data binding modes: array (
SetArray), database object (SetOBJ), and ADO recordset (SetADO). - For simple DBF browsing without an explicit TDatabase object, the browse automatically uses the current work area (
cAlias). - The
bLinecode block allows custom row rendering. It receives the row object and the column value array as parameters. - Use
bSkipto implement custom navigation logic for non-standard data sources. - For new projects, consider using TXBrowse which offers richer features including bitmap headers, footers, groups, and advanced styling.