Columns
  

Define a general data column (without adding it to Browse):


DEFINE COLUMN <oCol>
[ DATA | SHOWBLOCK
<uData> ]
[ TITLE | HEADER>
<cHead> [ OEM | ANSI | CONVERT ] ]
[ FOOT | FOOTER | FOOTERS
<cFoot> [ OEM | ANSI | CONVERT ] ]
[ COLOR | COLORS
<aColors> ]
[ ALIGN | ALIGNS
<aAlign> ]
[ WIDTH | SIZE
<nWidth> ]
[ PICTURE
<cPicture> ]
[ BITMAP | CHECKBOX ]
[ EDITABLE ]
[ VALID
<bValid> ]
[ NOBAR | NOHILITE ]
[ ORDER | INDEX | TAG
<cOrder> ]
[ PRE EDIT | PREEDIT
<bPrevEdit> ]
[ POST EDIT | POSTEDIT
<bPostEdit> ]
[ MOVE | SHIFT
<nMoveDir> ]
[ DBLCURSOR | DOUBLE CURSOR | FIXED ]
[ LOOK3D | 3DLOOK
<a3DLook> ]
[ WHEN
<uWhen> ]
[ MESSAGE <cMsg> ]
[ TOOLTIP <cToolTip> ]
[ TOTAL | TOTALIZE ]


Define and add to Browse a general data column:

ADD [ COLUMN ] TO [ BROWSE ] <oBrw>
[ DATA | SHOWBLOCK>
<uData> ]
[ TITLE | HEADER
<cHead> [ OEM, ANSI, CONVERT ] ]
[ FOOT | FOOTER | FOOTERS
<cFoot> [ OEM, ANSI, CONVERT ] ]
[ COLOR | COLORS
<aColors> ]
[ ALIGN | ALIGNS
<aAlign> ]
[ WIDTH | SIZE
<nWidth> ]
[ PICTURE
<cPicture> ]
[ BITMAP | CHECKBOX ]
[ EDITABLE ]
[ VALID
<bValid> ]
[ NOBAR | NOHILITE ]
[ ORDER | INDEX | TAG
<cOrder> ]
[ PRE EDIT | PREEDIT
<bPrevEdit> ]
[ POST EDIT | POSTEDIT
<bPostEdit> ]
[ MOVE | SHIFT
<nMoveDir> ]
[ DBLCURSOR | DOUBLE CURSOR | FIXED ]
[ LOOK3D | 3DLOOK
<a3DLook> ]
[ WHEN
<uWhen> ]
[ MESSAGE <cMsg> ]
[ TOOLTIP <cToolTip> ]
[ TOTAL | TOTALIZE ]


Define and add to Browse a column from Array:

ADD [ COLUMN ] TO [ BROWSE ] <oBrw> [ DATA ] ARRAY
[ ELM | ELEMENT
<elm> ]
[ TITLE | HEADER
<cHead> [ OEM, ANSI, CONVERT ] ]
[ FOOT | FOOTER | FOOTERS
<cFoot> [ OEM, ANSI, CONVERT ] ]
[ COLOR | COLORS
<aColors> ]
[ ALIGN | ALIGNS
<aAlign> ]
[ WIDTH | SIZE
<nWidth> ]
[ PICTURE
<cPicture> ]
[ BITMAP | CHECKBOX ]
[ EDITABLE ]
[ VALID
<bValid> ]
[ NOBAR | NOHILITE ]
[ PRE EDIT | PREEDIT
<bPrevEdit> ]
[ POST EDIT | POSTEDIT
<bPostEdit> ]
[ MOVE | SHIFT
<nMoveDir> ]
[ DBLCURSOR | DOUBLE CURSOR | FIXED ]
[ LOOK3D | 3DLOOK
<a3DLook> ]
[ WHEN
<uWhen> ]
[ MESSAGE <cMsg> ]
[ TOOLTIP <cToolTip> ]
[ TOTAL | TOTALIZE ]


Define and add to Browse a column from an oDbf object:

ADD [ COLUMN ] TO [ BROWSE ] <oBrw> [ DATA ]
<oDbf> FIELD <field>
[ ALIAS
<cAlias> ]
[ TITLE | HEADER
<cHead> [ OEM, ANSI, CONVERT ] ]
[ FOOT | FOOTER | FOOTERS
<cFoot> [ OEM, ANSI, CONVERT ] ]
[ COLOR | COLORS
<aColors> ]
[ ALIGN | ALIGNS
<aAlign> ]
[ WIDTH | SIZE
<nWidth> ]
[ PICTURE
<cPicture> ]
[ BITMAP | CHECKBOX ]
[ EDITABLE ]
[ VALID
<bValid> ]
[ NOBAR | NOHILITE ]
[ ORDER | INDEX | TAG
<cOrder> ]
[ PRE EDIT | PREEDIT
<bPrevEdit> ]
[ POST EDIT | POSTEDIT
<bPostEdit> ]
[ MOVE | SHIFT
<nMoveDir> ]
[ DBLCURSOR | DOUBLE CURSOR | FIXED ]
[ LOOK3D | 3DLOOK
<a3DLook> ]
[ MESSAGE <cMsg> ]
[ TOOLTIP <cToolTip> ]
[ TOTAL | TOTALIZE ]



General Parameters:

<oBrw>   ( REQUIRED ) Reference to TSBrowse object on which column will be added.

<uData>  ( OPTIONAL ) Expression which, when evaluated, will be converted in data that will be displayed on the corresponding cell of the column. Generally a Visualize/Edit CodeBlock is described as below:

{ | uVar | If( uVar == Nil,
Variable/Field/Function, Variable/Field := uVar }

This CodeBlock works this way:
When visualizing, the CodeBlock will not receive any parameters ( uVar = Nil ), and TSBrowse will apply the
first part of the CodeBlock, showing the value of the “Variable/Field/Function”.
When editing Editable columns, TSBrowse will pass the parameter uVar (which will be the data value "Variable/Field/Function" after being edited), and the
second part of the block will be applied, assigning the value of uVar to “Variable/Field”
uData can be defined also (in the case of Databases ) with the Clipper functions FieldBlock() or FieldWBlock(), returning a CodeBlock similar to the above mentioned. Syntax will be as follows:

FieldBlock(“
Field_Name")
FieldWBlock( “
Field_Name", Area_Number)

Field_Name must be stated between quotation marks and the Area_number is a number, or a numeric variable or the function Select ("Alias").
For more information on these functions see Clipper Norton Guides.
When the columns are defined with Array format (Define and add to Browse a column from Array) the CodeBlock uData will be automatically defined.
In NO Editable columns, uData can be a simple expression "Variable/Filed/Function". If uData is ommited, TSBrowse will create an empty CodeBlock, and will not display anything.

<cHead>    ( OPTIONAL ) Expression which, when evaluated, will be displayed as Column Title (header). It can be a constant expressed between quotation marks or a text variable or the reference to a bitmap object or the bitmap handler (hBitmap). Also it can be a CodeBlock which when evaluated returns an expression type of the above mentioned.
If the final result is text type, it can be divided in more than one row using the predefined constant CRLF (Chr(13)+Cher(10)), resulting in a MultiLine Header.

<cFoot>     ( OPTIONAL ) Expression that when evaluated will be displayed as Footer of the column. It can be a constant expressed between quotation marks or a text variable or the reference to a bitmap object or the bitmap handler (hBitmap). Also it can be a CodeBlock which when evaluated returns an expression type of the above mentioned.
If the final result is text type, it can be divided in more than one row using the predefined constant CRLF (Chr(13)+Cher(10)), resulting a MultiLine Footer. <aColors> (OPTIONAL) Simple list of color expressions that may be applied to each element of the column (Header, Cell, Footer). Those color expressions can be: The function RGB( nRed, nGreen, nBlue ); predefined constants in the header file Colors.ch; or CodeBlocks returning the numeric value of an RGB mixed color. This list can contain 1 to 15 elements. To see the application of each list element, see the help page with method
SetColor()
If
aColors is omitted TSBrowse will apply the default colors to the column.
Example: COLORS CLR_BLACK, CLR_HGRAY, ...etc

<aAlign>    ( OPTIONAL ) Simple list of 3 elements that will correspond the align type of the Cell, Header and Footer respectively. Those 3 list elements can be a digit according to the following:

0 = Align Left.
1 = Centered.
2 = Align Right.
3 = Vertical text (applies only to Headers)

You can also use the predefined constants DT_LEFT, DT_CENTER, DT_RIGHT and DT_VERT respectively.
Finally, these can also be CodeBlocks that, when evaluated, return one of the above mentioned values.
If aAlign is omitted, the default Align Left will be assumed. If the elements 2 or 3 are omitted, the value of the first element will be taken by default.

Examples:
ALIGN DT_RIGHT, DT_CENTER, DT_CENTER . With this the cell values will be displayed Right aligned, and the Header, just like the Footer, will be displayed Centered.
ALIGN DT_LEFT, DT_VERT. With this, the value of the Cell and the Footer will be displayed Left aligned, and the Header will be displayed Vertical.
ALIGN DT_CENTER. With this, the 3 values will be displayed Centered.

<nWidth> (OPTIONAL) Width size of the column in Pixels. If you omit this parameter, TSBrowse will calculate the width of the column automatically, considering the bigger of the following values:
a). -
Length of the column's header, in pixels.
b)
. - Length of the return value of bData, including cPicture (if this is the case).

<cPicture> ( OPTIONAL ) Editing template with which bData will be displayed and edited (if this is the case). Follows the properties of Picture of any Get object.

<bValid> ( OPTIONAL ) CodeBlock returning a logical value indicating to TSBrowse that the result of cell editing, complies or not with certain conditions evaluated in this CodeBlock.

If the evaluation of the CodeBlock returns .T., then TSBrowse will proceed to execute the second part of the Visualization/Edition Block bData, and will assign the value of uVar to the field or variable of the cell, if not, then the field or variable will remain without changes.

<cOrder> ( OPTIONAL ) File name of the active Index, or name of the active Tag. It can be a text type variable, or a constant expressed between quotation marks. Using this clause, you indicate to TSBrowse to base on this column the Incremental Search feature.
TSBrowse will assign cOrder as active index when the user hits with a Double Click on the Header of the column, or when the program calls the method oBrw:SetOrder(nColumn). cOrder can be defined for more than one columns.
If TSBrowse will not detect any column with cOrder, will not activate the Incremental Search.

<bPrevEdit> ( OPTIONAL ) Code Block that will be evaluated before starting the bData editing. This Code Block combined with bPostEdit, will be of great help when need to update the variable used in the Footer of the column, without going through the entire database. It also conditions the editing during run time, if it returns a False value, then the cell editing does not take place.
TSBrowse passes as parameter to this Block the value of the variable before editing.

<bPostEdit> ( OPTIONAL ) CodeBlock the will be evaluated after editing bData.
TSBrowse passes as parameter to this Block the value of the variable after editing.

Example: PREEDIT { | uVar | nValAnt := uVar, .T. } ;
POSTEDIT { | uVar | nFooter += ( uVar – nValAnt ), oBrw:DrawFooters() }

Note: bPrevEdit, as well bPostEdit will be evaluated only if the column is EDITABLE.

<nMoveDir> ( OPTIONAL ) This parameter indicates to TSBrowse the direction to move the cursor after editing a cell. Allowed values are:

0 = DT_DONT_MOVE = Stays on the same cell.
1 = DT_MOVE_RIGHT = Moves right if current column is not the rightmost column.
2 = DT_MOVE_DOWN = Moves down if current row is not the last row.
3 = DT_MOVE_LEFT = Moves left if current column is not the first column.
4 = DT_MOVE_UP = Moves up if current row is not the first row
5 = DT_MOVE_NEXT = Moves to the next editable cell to the right, or to the first editable cell on the next row, if there are not any more editable cells to the right.
If nMoveDir is omitted, will be by default DT_MOVE_RIGHT.
When the Automatic Append feature is activated with the method SetAppendMode(.T.), DT_MOVE_DOWN as well DT_MOVE_NEXT, will iniciate the automatic append, if the cursor is on the last row.
In run time, will be possible to change the direction of the movement, by pressing the key combination: Shift+Ctrl+Arrow. Also can be changed by clicking with the Right button of the mouse, on the header of the column, and selecting "Cursor" from the PopUp menu that TSBrowse will display.

<a3DLook> ( OPTIONAL ) Simple list of 3 logical elements, that will determine the 3D view of the Cell, Header and Footer respectively.
Elements of the list can be also the predefined constants TRUE and FALSE.
If a3Dlook is omitted, .F. will be assumed.
If element 2 or element 3 are omitted, then the value of element 1 will be assumed.

Example: LOOK3D FALSE, TRUE, TRUE

<bWhen> ( OPTIONAL ) CodeBlock that will be evaluated to allow or disallow editing of the cell on this column.

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


Logical clauses (OPTIONALS):

EDITABLE Indicates that this column is editable, if is omitted, the column is not editable.

BITMAP,
CHECKBOX Indicates that bData is a BitMap, or that will be edited with a Control Check Box (when bData is logical type).

NOBAR
NOHILITE Does not allow positioning the cursor on this column.

DBLCURSOR
DOUBLE CURSOR
FIXED Activates the double cursor feature on the freezed columns.


SPECIAL PARAMETERS:

<elm> ( REQUIRED ) When using the command ADD COLUMN TO oBrw, this parameter indicates the Array element that will be shown/edited on this column. TSBrowse will automatically create the editing Code Block bData.

Example: REDEFINE BROWSE oBrw... etc.
OBrw:SetArray(
MyArray )
ADD COLUMN TO
oBrw ARRAY ELEMENT 1... etc.
ADD COLUMN TO
oBrw ARRAY ELEMENT 3... etc.