Purpose
Creates an object of the class bDataColumn.
Class
Type
Method
Syntax
bDataColumn{
<oOwner>,
<oServer>,
<uField> | <uExpression> | <uAccess> | <uAccessAssign>,
<symFieldMode>,
[<uArgument2>],
[<uArgument3>],
[<uArgument4>],
[<uArgument5>]
} Æ oDataColumn
Arguments
<oOwner> | The owner of the column. This is the bBrowser in which the column is to be used. |
Data type: | Object |
<oServer> | The server, with which the column is to be linked. The server is used to determined the column values. |
Data type: | Object |
<uField> | A field in the server, with which the column is to be linked. The field can specified either by the field name (string or symbol) or by its field position in the server. In combination with the server, the field is used for determining column values. If the server is not write protected, the assign bDataColumn:Editable is set automatically on TRUE. |
Data type: | Integer | String | Symbol |
<uExpression> | An expression, with which the column is to be linked. If the expression is specified as string, this is converted automatically into a _Codeblock statement. The transformation is made by the instruction |
&("{|Server, Arg2, Arg3, Arg4, Arg5| "+uExpression+"}")
The arguments Arg2 to Arg5 can be specified by the arguments uArgument2 to uArgument5 (see further below). In combination with the server, the expression is used for determining the column values.
Data type: | String | _Codeblock | Codeblock |
<uAccess> | Access in the server, with which the column is to be linked. The name of the access can be specified either as string or as symbol. In combination with the server, the access is used for determining the column values. |
Data type: | String | Symbol |
<uAccessAssign> | Access and assign in the server, with which the column is to be linked. The name of the access and assign can be specified either as string or as symbol. In combination with the server, the access is used for determining the column values. If the server is not write protected, the assign bDataColumn:Editable is set automatically on TRUE. |
Data type: | String | Symbol |
<symFieldMode> | The mode that indicates whether in the third argument a field, an expression, an access or an access and assign are specified. The following values are supported: |
Value |
Description |
#Field |
The third argument is a field in the server, specified either as field position or as field name (string or symbol). |
#Expression |
The third argument is an expression, specified either as string or as _Codeblock statement. |
#Access |
The third argument is an access in the server, specified either as string or as symbol. |
#AccessAssign |
The third argument is an access and assign in the server, specified either as string or as symbol. |
Data type: | Symbol |
uArgument2 .. 5 | The arguments that are to be passed to an expression (<symFieldMode> = # Expression) as arguments. |
Data type: | Usual |
Return Value
oDataColumn | The created object of the class bDataColumn. |
Data type: | bDataColumn |
Description
bDataColumn:Init() creates a new object of the class bDataColumn and initializes it.
The values that are returned through <uField>, <uExpression>, <uAccess> or <uAccessAssign> can be of the following data types:
Data Type |
Description |
C |
String |
D |
Date |
L |
Logic |
M |
Memo |
N |
Byte, Short, Integer, Long, Word, DWord, Float, Real4, Real8 |
O |
Object
Bitmap and icon objects are drawn as image. |
Note!
If the column is created for an expression (see argument <uExpression>), then the column doesn't have a field name (see bDataColumn:FieldName). So that the column can be identified later the column should be assigned a HyperLabel object (see bDataColumn:HyperLabel) after creating.
Samples
In the following sample a data column is created for the field FIRSTNAME in a DBServer (CUSTOMER.DBF).
LOCAL odbsCUSTOMER AS DBServer
LOCAL oBrowser AS bBrowser
LOCAL oColumn AS bDataColumn
// Create DBServer
odbsCUSTOMER := DBServer{"CUSTOMER"}
// Create browser
oBrowser := bBrowser{oOwner,;
1000,;
Point{0, 0},;
Dimension{300, 250}}
// Set the DBServer in browser and show the browser
// -> The empty array results in no data columns
// being created automatically.
oBrowser:Use(odbsCUSTOMER, {})
oBrowser:Show()
// Create data column for field FIRSTNAME
oColumn := bDataColumn{oBrowser,;
odbsCUSTOMER,;
#FIRSTNAME,;
#FIELD)
// Add data column to browser and open it
oBrowser:AddColumn(oColumn)
oBrowser:OpenColumn()
In the following sample a data column is created on an expression. The expression is defined as a codeblock and determines the RecNo in a DBServer (CUSTOMER.DBF).
LOCAL odbsCUSTOMER AS DBServer
LOCAL oBrowser AS bBrowser
LOCAL oColumn AS bDataColumn
// Create DBServer
odbsCUSTOMER := DBServer{"CUSTOMER"}
// Create browser
oBrowser := bBrowser{oOwner,;
1000,;
Point{0, 0},;
Dimension{300, 250}}
// Set the DBServer in browser and show the browser
// -> The empty array results in no data columns
// being created automatically.
oBrowser:Use(odbsCUSTOMER, {})
oBrowser:Show()
// Create data column on RecNo
oColumn := bDataColumn{oBrowser,;
odbsCUSTOMER,;
{|Server| Server:RecNo},;
#EXPRESSION}
oColumn:Hyperlabel := HyperLabel{#RecNo, "RecNo"}
// Add data column to browser and open it
oBrowser:AddColumn(oColumn)
oBrowser:OpenColumn()
In the following sample a data column is created on an expression. The expression adds the 2 fields FIRSTNAME and LASTNAME from a DBServer (CUSTOMER.DBF) to a double line value.
LOCAL odbsCUSTOMER AS DBServer
LOCAL oBrowser AS bBrowser
LOCAL oColumn AS bDataColumn
// Create DBServer
odbsCUSTOMER := DBServer{"CUSTOMER"}
// Create browser
oBrowser := bBrowser{oOwner,;
1000,;
Point{0, 0},;
Dimension{300, 250}}
// Set the DBServer in browser and show the browser
// -> The empty array results in no data columns
// being created automatically.
oBrowser:Use(odbsCUSTOMER, {})
oBrowser:Show()
// Enable the variable row height so that the
// column values are displayed in 2 lines.
oBrowser:EnableRowHeightVariable(TRUE)
// Create a data column for the fields FIRSTNAME and LASTNAME
oColumn := bDataColumn{oBrowser,;
odbsCUSTOMER,;
"Server:FIRSTNAME" + CRLF + "Server:LASTNAME",;
#EXPRESSION}
oColumn:Hyperlabel := HyperLabel{#MYCOLUMN}
// Add data column to browser and open it
oBrowser:AddColumn(oColumn)
oBrowser:OpenColumn()
In the following sample a data column is created on an expression. The expression shows dependent on the field FEMININE 2 different icons. The icons are passed on the arguments <uArgument2> and <uArgument3>.
LOCAL odbsCUSTOMER AS DBServer
LOCAL oBrowser AS bBrowser
LOCAL oColumn AS bDataColumn
LOCAL oicoMale AS Icon
LOCAL oicoFeminine AS Icon
// Create DBServer
odbsCUSTOMER := DBServer{"CUSTOMER"}
// Create browser
oBrowser := bBrowser{oOwner,;
1000,;
Point{0, 0},;
Dimension{300, 250}}
// Set the DBServer in browser and show the browser
// -> The empty array results in no data columns
// being created automatically.
oBrowser:Use(odbsCUSTOMER, {})
oBrowser:Show()
// Enable the variable row height so that the
// column values are displayed in 2 lines.
oBrowser:EnableRowHeightVariable(TRUE)
// Create icons for male and feminine
oicoMale := Icon{ICONEXCLAMATION}
oicoFeminine := Icon{ICONASTERISK}
// Create data column for the 2 icons
oColumn := bDataColumn{oBrowser,;
odbsCUSTOMER,;
{|Server,Icon1,Icon2| iif(Server:FEMININE, Icon1, Icon2},;
#EXPRESSION,;
oicoFeminine,;
oicoMale}
oColumn:Hyperlabel := HyperLabel{#FEMININE}
// Add data column to browser and open it
oBrowser:AddColumn(oColumn)
oBrowser:OpenColumn()
See Also
Page url: http://www.YOURSERVER.com/index.html?bdatacolumn_init.htm