Field grouping in bBrowser
Posted: Wed Nov 20, 2019 6:56 am
I'm trying to combine CLADD1 and CLADD2 into a two line column, using the bBrowser help file entry here:
My Code:
method PostInit(oWindow,iCtlID,oServer,uExtra) class AddBookList
//Put your PostInit additions here
LOCAL oColumn as bDataColumn
Local oBrowser as bBrowser
oBrowser := self:oDCbBrowser1
oServer := self:oDCbBrowser1:Server
oColumn := bDataColumn{oBrowser, oServer, {|Server| Server:CLADD1+CRLF+Server:CLADD2}, #Expression}
oColumn:Width := 350
self:oDCbBrowser1:AddColumn(oColumn)
self:oDCbBrowser1:Refresh()
self:oDCbBrowser1:Recalculate()
Return nil
bBrowser 4 Help File
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()
It does not work. Nothing happens... What am I doing wrong please?
My Code:
method PostInit(oWindow,iCtlID,oServer,uExtra) class AddBookList
//Put your PostInit additions here
LOCAL oColumn as bDataColumn
Local oBrowser as bBrowser
oBrowser := self:oDCbBrowser1
oServer := self:oDCbBrowser1:Server
oColumn := bDataColumn{oBrowser, oServer, {|Server| Server:CLADD1+CRLF+Server:CLADD2}, #Expression}
oColumn:Width := 350
self:oDCbBrowser1:AddColumn(oColumn)
self:oDCbBrowser1:Refresh()
self:oDCbBrowser1:Recalculate()
Return nil
bBrowser 4 Help File
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()
It does not work. Nothing happens... What am I doing wrong please?