Commands
to Define or Add 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> [ PIXELS ] ] ;
[ 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>
]
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> [
PIXELS ] ] ;
[ 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>
]
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> [ PIXELS ] ] ;
[ 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>
]
Define and
add to Browse a column from an oDbf
object:
( TdataBase, TMultiDBF, TDbf )
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> [ PIXELS ] ] ;
[ 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> ]
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 nRGB( 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 o DT_VERT respectively.
Finally, these can also be CodeBlocks that, when
evaluated, return one of the above mentioned values.
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. Bloque de Código que será
evaluado antes de iniciar la edición de bData . Este bloque en combinación con bPostEdit resulta de gran utilidad para actualizar
la variable que se usa en el Footer de la columna sin tener que recorrer la
base de datos en su totalidad. Este Bloque sirve también para condicionar la
edición en tiempo de ejecución, si devuelve un valor falso, la edición de la
celda en esta columna, no se realizará.
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.
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.
COMMAND to
DEFINE and ADD Super Headers.
ADD [ SUPER ] HEADER TO <oBrw>
;
FROM [ COLUMN ] <nFromCol>
;
TO [ COLUMN ] <nToCol> ;
TITLE, HEADER <cHeader>
;
[ HEIGHT <nHeight>
] ;
[ COLOR, COLORS <aColors> ]
[ 3DLOOK, LOOK3D ] ;
[ FONT <uFont>
] ;
[ NOGRID,
NOLINES ] ;
[ BITMAP ] ;
[ ADJUST ] ;
[ TRANSPARENT
] ;
[ HORZ [
ALIGN ] <nHAlign> ] ;
[ VERT [
ALIGN ] <nVAlign> ] ;
With this command are created headers shown on top
the normal TSBrowse Headers, aligned with the embraced columns (FROM/TO). They
can be of type text that are shown centered, or bitmaps getting this appearance
(among others):
January
|
February
|
||
Units |
Import |
Units |
Import |
12345 |
12345 |
12345 |
12345 |
This command must be invoked after the columns of the
Browse have been defined.
Parameters:
<oBrw> (
REQUIRED ) Reference to
the TSBrowse object on which the Super Headers will be added.
<nFromCol>
<nToCol> (
REQUIRED ) Range of the
Browse columns (From/To) on top of which the Super Header will be aligned.
<cHeader> (
REQUIRED ) Expression
whose contents will be shown as Super Header. It can be a constant expressed
between quotation marks, a text type variable, a reference to a Bitmap
object, or its handler ; or also a Code Block whose evaluation will
return any of the above mentioned data types.
<nHeight> (
OPTIONAL ) Height in pixels of the Super-Header. If omitted, TSBrowse will
calculate the height based on the font (uFont)
used, or on the height of the BitMap. If more than one Super-Headers are
defined, the final height for every one will be the higher between them. In the
case of BitMaps, if nHeight is smaller
than the BitMap height, and the clause ADJUST is defined, nHeight will be respected and the BipMap will be
adjusted to nHeight, otherwise the
height of the BitMap will prevail.
<aColors> (
OPTIONAL ) Simple list of
3 color expressions in the following order:
1. - Text Color (will
not apply on BitMaps)
2. - Background Color
3. - Line Color
Example: COLORS CLR_BLACK,
CLR_HGRAY, CLR_RED
If aColors is
omitted, the corresponding column Header colors of the first column in the
range will apply.
<uFont> (
OPTIONAL ) A Tfont object
reference, or its handler. Each Super_Header can use different fonts.
If uFont is
omitted, the font used for the normal Header will be applied.
<nHAlign> (
OPTIONAL ) A digit
indicating the horizontal alignment of the Super-Header according to the
following:
0 = DT_LEFT = Left alignment
1 = DT_CENTER = Centered
2 = DT_RIGHT = Right alignment
<nVAlign> (
OPTIONAL ) A digit
indicating the vertical alignment of the Super-Header according to the
following:
0 = DT_TOP = Align Top
1 = DT_CENTER = Centered
2 = DT_BOTTOM = Align Bottom
Optional Logical Clauses:
3DLOOK,
LOOK3D Indicates that the Super-Header will appear
in 3D. If omitted, will appear without this attribute.
NOGRID,
NOLINES Indicates that the Super-Header will be shown without
grid lines.
BITMAP Indicates that uHead
is a BitMap.
ADJUST The BitMap will be adjusted to the dimensions of nHeight and the width of the column.
TRANSPARENT The background color of the BitMap will be the same
as the background color of the Super-Header.