Define / Redefine to create Browses and Columns.
Browse From Recourses:
REDEFINE [ COLUMN
] BROWSE <oBrw> ;
[ FIELDS ] [ <Flds> ] ;
[ ALIAS <cAlias> ] ;
[ ID <nId>
] ;
[ OF, DIALOG <oDlg>
] ;
[ FIELDSIZES, SIZES, COLSIZES <aColSizes>
] ;
[ HEAD,HEADER,HEADERS
<aHeaders> ] ;
[ SELECT <cField> FOR <uValue1> [ TO <uValue2>
] ] ;
[ ON CHANGE <uChange>
] ;
[ ON [ LEFT ] CLICK <uLClick>
] ;
[ ON [ LEFT ] DBLCLICK <uLDblClick>
] ;
[ ON RIGHT CLICK <uRClick> ]
;
[ FONT <oFont> ] ;
[ CURSOR <oCursor>
] ;
[ COLOR, COLORS <aColors> ] ;
[ MESSAGE <cMsg> ] ;
[ UPDATE ] ;
[ WHEN <uWhen> ] ;
[ VALID <uValid>
] ;
[ CELL, CELLED, GRID ]
Browse From Source Code:
@ <nRow>,
<nCol> BROWSE <oBrw> ;
[ FIELDS <Flds> ] ;
[ ALIAS <cAlias> ] ;
[ FIELDSIZES, SIZES, COLSIZES <aColSizes>
] ;
[ HEAD, HEADER, HEADERS <aHeaders>
] ;
[ SIZE <nWidth>, <nHeigth> ] ;
[ OF, DIALOG <oDlg>
] ;
[ SELECT <cField> FOR <uValue1> [ TO <uValue2>
] ] ;
[ ON CHANGE <uChange>
] ;
[ ON [ LEFT ] CLICK <uLClick>
] ;
[ ON [ LEFT ] DBLCLICK <uLDblClick>
] ;
[ ON RIGHT CLICK <uRClick> ]
;
[ FONT <oFont> ] ;
[ CURSOR <oCursor>
] ;
[ COLOR, COLORS <aColors> ] ;
[ MESSAGE <cMsg> ] ;
[ UPDATE ] ;
[ PIXEL ] ;
[ WHEN <uWhen> ]
;
[ DESIGN ] ;
[ VALID <uValid>
] ;
[ CELL, CELLED, GRID ] ;
[ STYLE <nStyle>
]
<oBrw> ( REQUIRED ) Reference to the TSBrowse object created with
the above commands.
<nRow>
<nCol> (OPTIONAL) On screen position
coordinates for the upper left corner of the Browser . If the Clause PIXEL is
specified , those coordinates will define the point (pixel) on screen,
otherwise TSBrowse will assume that text type coordinates are specified (Row,
Column ), and will calculate the positioning point by multiplying nRow * BRSE_CHARPIX_H y nCol *
BRSE_CHARPIX_W. Those constants are defined in the header file TSBrowse.ch and
the predefined values are 14 and 8 respectively. If any of those 2 data is
omitted, TSBrowse will assume the value of 0 (zero).
<Flds> (OPTIONAL) A simple list of
valid Clipper expressions, using a coma (,) as separator. The result of the
evaluation for each expression will be displayed in the correspondent column
with the same order as in the expressions list. Those expressions can be of any
valid type to display (Alpha, Numeric, Date, Memo, or Logical). Of course can
be CodeBlocks whose evaluation returns any of the above mentioned data types.
This parameter is kept for
compatibility with TWBrowse and can be omitted if the columns are defined
individually using the commands described below. TSBrowse will create
automatically the columns returning each element of the list as the instance
variable bData of the object TSColumn.
<cAlias> (OPTIONAL) If the Browse will
visualize/edit the contents of a database, indicate here the name of the Alias.
If the browse will display the contents of an array, write “ARRAY”. If you omit
this parameter, TSBrowse will assume that will visualise/edit the contents of
the active database. This assumption will be ignored if after create the
browse, you will use the methods SetArray( ), SetTxtFile( ) or SetOdbf(
) necessary to visualize/edit
Arrays, Text or objects oDbf.
<aColSizes> (OPTIONAL) Simple list containing the
sizes for each column of the Browse expressed in Pixels. If you omit this
parameter, TSBrowse will calculate automatically the size (width) for each
column considering the max of the following values:
a).- Length in pixels
of the column title. (Header text)
b).- Length in
pixels of the contents of the variable bData including Picture (if this
is the case).
<aHeaders> (OPTIONAL) Simple list of the strings
that will be used as Headers for each column of the Browse. You can use simple
text (in quotation marks) or CodeBlocks whose evaluation returns text data
type. Both aHeaders> and <aColSizes>
can be omitted if you will define individual columns later on. If you omit <aHeaders>
and you do not define columns,
TSBrowse will define the titles (Headers) using the field names from the
database.
<nId> (REQUIRED) Is the
identification (ID) number assigned to the object TSBrowse in the file *.RC or
*.DLL. Applies only when using the command REDEFINE BROWSE.
<nWidth> (OPTIONAL) Size in pixels of the width
of the browse. If you omit this parameter, TSBrowse will assume 100 pixels.
<nHeigth> (OPTIONAL) Height of the browse in
pixels. If you omit this parameter, TSBrowse will assume 100 pixels.
<oDlg> (OPTIONAL) Reference to the
object (Dialog / Window) container of the control Browse. If omitted, the
application window will be assumed by default.
<uChange> (OPTIONAL) Function or CodeBlock that
will execute every time the active row of
the Browse changes. When evaluating this CodeBlock, TSBrowse will pass 2
parameters { | oBrw, nKey | ...
where oBrw is a reference of the object
TSBrowse itself and nKey corresponds to the pressed key which
made the row change.
<uLClick> (OPTIONAL) Function or CodeBlock which
will be executed when the user clicks the left mouse button on the Browse
cells.
<uRClick> (OPTIONAL) Function or CodeBlock which
will be executed when the user clicks the right mouse button on the Browse
cells .
<uLDblClick> (OPTIONAL) Function or CodeBlock which
will be executed when the user double-clicks on the Browse cells.
<oFont> (OPTIONAL) Reference to the
Tfont object (Font or Letter Type) which will be used by default in the Browse.
TSBrowse permits to define different types of letters for each element of the
column (Headers, Cells, Footers). TSBrowse will use this font by default, only
if omitted the font definition for each individual column.
<ValidFunc> (OPTIONAL) Expression (function or
CodeBlock), executed when the Browse tries to loose focus. It depends on the
value that this expression returns, if the Browse will loose focus or not.
<aColors> (OPTIONAL) Simple list of color
expressions de that will apply by default to each Browse column. Those color
expressions can be: Function nRGB( nRed, nGreen, nBlue ); predefined constants
in the header file Colors.ch (CLR_BLACK; CLR_RED; etc) or, CodeBlocks that
return the numeric value of an RGB color. This list can contain 1 to 15
elements. To understand how to apply each one of list elements, see help page
relative to the method SetColor(). The colors defined
in this list, will apply only if the color definitions for the individual
columns are omitted. In the case of omitted color definition here and for each
one of the columns, TSBrowse will apply the default colors defined in
Appearance of Windows.
Filters based on indexes: clause SELECT (OPTIONAL)
<cField>,
<uValue1>,
<uValue2> Parameters that make up the
clause SELECT where <cField> is a text type expression (generally between quotation marks)
corresponding to the field name that will be evaluated, to establish the limits
(upper and lower) of the filter; <uValue1> will be an expression
returning a value of the same type as the type of the active index key, which
will become the upper filter limit; and <uValue2> with the same condition
as <uValue1>, which will become the lower filter limit. If you
omit this last parameter, TSBrowse will apply <uValue1> as upper and
lower limit.
The clause SELECT is
recommended only when using the RDD "DBFNTX" (Replaceable Data
Driver) ,due to its lack of functions to establish Scopes, which in most cases make unnecessary the use
of basic Clipper filters.
<nStyle> (OPTIONAL) Browse window style
definition, following the Windows style definition rules.
DESIGN Allows the user to
move and resize the Browse with the mouse.
UPDATE The Browse will be
updated calling the method Refresh() of the dialog or window container the
control.
PIXEL Indicates that the
coordinates @nRow, nCol are given in
Pixels and NOT in text mode coordinates (Rows and Columns).
It is
recommended the use this of this clause to locate in a more accurate way the
Browse on screen.
CELL,
CELLED,
GRID This clause defines the
movement and visual definition of the cursor at Cell level.
Important Cell editing in TSBrowse will only be
permitted, if this Clause is defined. The cursor will cover the cell space and
not all the line.