Purpose
Formats several columns in the browser.
Class
Type
Method
Syntax
<oBrowser>:FormatColumns(<auFormat>) Æ lSuccess
Arguments
<auFormat> | A 1- or 2-dimensional array, that contains one or more formats for the columns. |
Data Type: | Array |
Return Value
lSuccess | A logical value that indicates whether the columns were formated. |
TRUE | The columns was formated. |
FALSE | The columns could not be formated. |
Data Type: | Logic |
Description
bBrowser:FormatColumns() formats several columns in the browser.
For the argument <auFormat> the following array types are supported:
•1-dimensional array
For each column an array item must exist that the column caption as string contains.
•2-dimensional array:
Each sub-array consists of 2 items. The first item contains the name of the column as string or symbol. The second item can contain either the column caption as string or an object of the class bNameArray. With an object of the class bNameArray the following names of values are supported:
•#Alignment
•#AutoEdit
•#Background
•#Caption
•#CaptionView
•#CaptionVisible
•#DataView
•#Editable
•#EditCloseFlags
•#EditStartFlags
•#FieldSpec
•#Font
•#Footer
•#FooterView
•#FooterVisible
•#Foreground
•#Grid
•#HeightVariable
•#Movable
•#Resizable
•#Selectable
•#SuspendEmptyValues
•#TextFormat
•#ToolTipText
•#ValueTransformList
•#ViewEmptyValuesAs
•#ViewValueAs
•#Width
•#WidthMax
•#WidthMin
For the several names the values are supported that are defined in the access of the class bDataColumn of the same name.
Samples
In the following sample the column captions of all columns are set.
// create bArrayServer
auStruct := {;
{"LASTNAME", "C", 20, 0},;
{"FIRSTNAME", "C", 15, 0},;
{"BIRTHDAY", "D", 8, 0};
}
oasServer := bArrayServer{auStruct}
// create and show browser
oBrowser := bBrowser{oOwner,;
1000,;
Point{0, 0},;
Dimension{300, 250}}
oBrowser:Use(oasServer)
oBrowser:Show()
// format columns
acCaption := {"Last Name", "First Name", "Birthday"}
oBrowser:FormatColumns(acCaption)
In the following sample the column captions for the 2 columns LASTNAME and FIRSTNAME are set.
// create bArrayServer
auStruct := {;
{"ID", "N", 5, 0},;
{"LASTNAME", "C", 20, 0},;
{"FIRSTNAME", "C", 15, 0},;
{"BIRTHDAY", "D", 8, 0};
}
oasServer := bArrayServer{auStruct}
// create and show browser
oBrowser := bBrowser{oOwner,;
1000,;
Point{0, 0},;
Dimension{300, 250}}
oBrowser:Use(oasServer)
oBrowser:Show()
// format columns
auCaption := {;
{#FIRSTNAME, "Vorname"},;
{#LASTNAME, "Nachname"};
}
oBrowser:FormatColumns(auCaption)
In the following sample with the class bNameArray several formattings for individual columns are set.
// create bArrayServer
auStruct := {;
{"ID", "N", 5, 0},;
{"LASTNAME", "C", 20, 0},;
{"FIRSTNAME", "C", 15, 0},;
{"BIRTHDAY", "D", 8, 0};
}
oasServer := bArrayServer{auStruct}
// create and show browser
oBrowser := bBrowser{oOwner,;
1000,;
Point{0, 0},;
Dimension{300, 250}}
oBrowser:Use(oasServer)
oBrowser:Show()
// format columns
auFormat := {}
onaColumn := bNameArray{}
onaColumn:Add(#Caption, "Last Name")
onaColumn:Add(#Width, 100)
onaColumn:Add(#AutoEdit, #Sensitive)
AADD(auFormat, {#LASTNAME, onaColumn})
onaColumn := bNameArray{}
onaColumn:Add(#Caption, "First Name")
onaColumn:Add(#Width, 80)
onaColumn:Add(#AutoEdit, #Sensitive)
AADD(auFormat, {#FIRSTNAME, onaColumn})
onaColumn := bNameArray{}
onaColumn:Add(#Width, 40)
onaColumn:Add(#Editable, FALSE)
onaColumn:Add(#Grid, bGrid{ BGRID_CONVEX})
AADD(auFormat, {#ID, onaColumn})
oBrowser:FormatColumns(auFormat)
See Also
bBrowser:GetFormatFromColumns()
Page url: http://www.YOURSERVER.com/index.html?bbrowser_formatcolumns.htm