Browses
  
  

Browse From Source Code

Standard definition:

@ <nRow>,<nCol> TBROWSE <oBrw>
[ID <nId>] ;
[ OF | PARENT | DIALOG> <
cParent> ]
[ WIDTH <
nWidth> ]
[ HEIGHT <
nHeight> ]
[ HEAD | HEADER | HEADERS <
aHeaders,...> ]
[ WIDTHS | FIELDSIZES | SIZES | COLSIZES <
aColSizes,...> ]
[ ALIAS | ITEMS | ARRAY | WORKAREA <
cAlias> ]
[ FIELDS <
Fields,...> ]
[ SELECTFILTER <
cField> FOR <uValue1> [ TO <uValue2> ] ]
[ VALUE <
nValue> ]
[ FONT <
cFontName> ]
[ SIZE <
nFontSize> ]
[ BOLD ]
[ ITALIC ]
[ UNDERLINE ]
[ STRIKEOUT ]
[ TOOLTIP <
cTooltip> ]
[ BACKCOLOR <
aBackcolor> ]
[ FONTCOLOR <
aFontcolor> ]
[ COLOR | COLORS> <
aColors,...> ]
[ ON GOTFOCUS <
gotfocus> ]
[ ON CHANGE <
uChange> ]
[ ON LOSTFOCUS <
lostfocus> ]
[ ON DBLCLICK <
uLDblClick> ]
[ EDIT ]
[ CELL | CELLED | GRID ]
[ STYLE <
nStyle> ]
[ APPEND ]
[ ON HEADCLICK <
aHeadClick> ]
[ WHEN <
uWhen> ]
[ VALID <
aValidFields> ]
[ VALIDMESSAGES <
aValidMessages> ]
[ MESSAGE <
cMsg> ]
[ READONLY <
aReadOnly> ]
[ LOCK ]
[ DELETE ]
[ NOLINES ]
[ IMAGE <
aImages,...> ]
[ JUSTIFY <
aJust> ]
[ HELPID <
helpid> ]
[ BREAK ]

Extend definition:

DEFINE TBROWSE <oBrw>
AT <
nRow>,<nCol>
[ID <
nId>]
[ OF | PARENT | DIALOG> <
cParent> ]
[ WIDTH <
nWidth> ]
[ HEIGHT <
nHeight> ]
[ HEAD | HEADER | HEADERS <
aHeaders,...> ]
[ WIDTHS | FIELDSIZES | SIZES | COLSIZES <
aColSizes,...> ]
[ ALIAS | ITEMS | ARRAY | WORKAREA <
cAlias> ]
[ FIELDS <
Fields,...> ]
[ SELECTFILTER <
cField> FOR <uValue1> [ TO <uValue2> ] ]
[ VALUE <
nValue> ]
[ FONT <
cFontName> ]
[ SIZE <
nFontSize> ]
[ BOLD ]
[ ITALIC ]
[ UNDERLINE ]
[ STRIKEOUT ]
[ TOOLTIP <
cTooltip> ]
[ BACKCOLOR <
aBackcolor> ]
[ FONTCOLOR <
aFontcolor> ]
[ COLOR | COLORS> <
aColors,...> ]
[ ON GOTFOCUS <
gotfocus> ]
[ ON CHANGE <
uChange> ]
[ ON LOSTFOCUS <
lostfocus> ]
[ ON DBLCLICK <
uLDblClick> ]
[ EDIT ]
[ CELL | CELLED | GRID ]
[ STYLE <
nStyle> ]
[ APPEND ]
[ ON HEADCLICK <
aHeadClick> ]
[ WHEN <
uWhen> ]
[ VALID <
aValidFields> ]
[ VALIDMESSAGES <
aValidMessages> ]
[ MESSAGE <
cMsg> ]
[ READONLY <
aReadOnly> ]
[ LOCK ]
[ DELETE ]
[ NOLINES ]
[ IMAGE <
aImages,...> ]
[ JUSTIFY <
aJust> ]
[ HELPID <
helpid> ]
[ BREAK ]

Collumn definition......

or/and

Parameters of TBrowse definition.....

END TBROWSE


Browse From Resources ( Not implemented yet... )

REDEFINE TBROWSE <oBrw>
ID <
nId> ;
[ OF | PARENT | DIALOG> <
cParent> ]
[ HEAD | HEADER | HEADERS <
aHeaders,...> ]
[ WIDTHS | FIELDSIZES | SIZES | COLSIZES <
aColSizes,...> ]
[ ALIAS | ITEMS | ARRAY | WORKAREA <
cAlias> ]
[ FIELDS <
Fields,...> ]
[ SELECTFILTER <
cField> FOR <uValue1> [ TO <uValue2> ] ]
[ VALUE <
nValue> ]
[ FONT <
cFontName> ]
[ SIZE <
nFontSize> ]
[ BOLD ]
[ ITALIC ]
[ UNDERLINE ]
[ STRIKEOUT ]
[ TOOLTIP <
cTooltip> ]
[ BACKCOLOR <
aBackcolor> ]
[ FONTCOLOR <
aFontcolor> ]
[ COLOR | COLORS> <
aColors,...> ]
[ ON GOTFOCUS <
gotfocus> ]
[ ON CHANGE <
uChange> ]
[ ON LOSTFOCUS <
lostfocus> ]
[ ON DBLCLICK <
uLDblClick> ]
[ EDIT ]
[ CELL | CELLED | GRID ]
[ APPEND ]
[ ON HEADCLICK <
aHeadClick> ]
[ WHEN <
uWhen> ]
[ VALID <
aValidFields> ]
[ VALIDMESSAGES <
aValidMessages> ]
[ MESSAGE <
cMsg> ]
[ READONLY <
aReadOnly> ]
[ LOCK ]
[ DELETE ]
[ NOLINES ]
[ IMAGE <
aImages,...> ]
[ JUSTIFY <
aJust> ]
[ HELPID <
helpid> ]
[ BREAK ]

General Parameters:
(
Color red - not implemented yet )


<oBrw> ( REQUIRED ) Name and 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).

<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.

<cParent> (OPTIONAL) Reference to the object (Dialog / Window) container of the control Browse. If omitted, the application window will be assumed by default.

<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.

<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.

<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).

<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.

<Fields> (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.

Filters based on indexes: clause SELECTFILTER (OPTIONAL)

<cField>,<uValue1>,<uValue2> Parameters that make up the clause SELECTFILTER 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
SELECTFILTER 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.

<Value> (OPTIONAL) Initial record position

<cFontName> (OPTIONAL) Reference to the Font object (or full declaration to Font object - SIZE, BOLD, ITALIC, UNDERLINE, STRIKEOUT ) 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.

<cTooltip> (OPTIONAL) Displays a single line of text that describes the purpose of a TSBrowse in an application.

<aBackcolor> (OPTIONAL) Sets the background color for the text written in the TSBrowse.

<aFontcolor> (OPTIONAL) Sets the foreground color for the text written in the TSBrowse

<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.

<gotfocus> (OPTIONAL) Function or CodeBlock that will execute when the Browse got the focus.

<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.

<lostfocus> (OPTIONAL) Function or CodeBlock that will execute when the Browse losing the focus.

<uLDblClick> (OPTIONAL) Function or CodeBlock which will be executed when the user double-clicks on the Browse cells.

<aHeadClick> (OPTIONAL) A list of actions ( Function or CodeBlock ) to be executed when a certain column header is clicked with the mouse.

<uWhen> (OPTIONAL) Function or CodeBlock to evaluate indicating if the Browse is or not enable.

<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.

<aValidFields>(OPTIONAL) A list of actions ( Function or CodeBlock ) to be validated when the editable Field loses its focus.

<aValidMessages> (OPTIONAL) A list of actions associated messages of fields displayed when editable Field loses its focus and is not valid.

<cMsg> (OPTIONAL) The associated message of the Browse.

<helpid> (OPTIONAL) The help topic identifier for this Browse.

Logical clauses (OPTIONALS):

EDIT Indicates that the Browse is editable, if is omitted, the Browse is not editable.

APPEND Activate Automatic Append Mode. Automatic append using the "TSBrowse" method SetAppendMode(). When you press down arrow key at the last row, "TSBrowse" opens a virtual blank record that can be edited. Actual append is done when you complete the edition of the first editable field. Pressing Esc key annulates the virtual append.

DELETE It allows the user to delete the active row of the Browse by pressing the [Del] key

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.

NOLINES This clause sets the grid lines for cels unvisible.

Clauses not implement jet..

<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 .
<nStyle> (OPTIONAL) Browse window style definition, following the Windows style definition rules.

Example: nOR( WS_CHILD, WS_TABSTOP, WS_VISIBLE, etc…, ). This parameter does not apply when using the command REDEFINE BROWSE.

UPDATE The Browse will be updated calling the method Refresh() of the dialog or window container the control.

LOCK
IMAGE <aImages,...>
JUSTIFY <aJust>
BREAK

    Added a new class TCursor for proper processing of TBROWSE cursor which was defined by user for a whole control.

Syntax:
TCursor():New(
cResCursorName [, cPredefinedCursorName ] )
where the predefined names are "ARROW", "IBEAM", "WAIT", "CROSS" etc.

Sample code:
oBrw:oCursor := TCursor():New( , "HAND" )