Field grouping in bBrowser

Public support forum for peer to peer support with related to the Visual Objects and Vulcan.NET products
Post Reply
Anonymous

Field grouping in bBrowser

Post by Anonymous »

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?
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Field grouping in bBrowser

Post by wriedmann »

Hi Jeff,
create an access in your DBServer class and use it in the bBrowser column.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
BiggyRat

Field grouping in bBrowser

Post by BiggyRat »

Hmm ok. Thank you once again Wolfgang

I couldn't get that to work. Nothing changed at all. Is tge order ive done everything correct?
g.bunzel@domonet.de
Posts: 97
Joined: Tue Mar 01, 2016 11:50 am
Location: Germany

Field grouping in bBrowser

Post by g.bunzel@domonet.de »

Jeff,

...maybe you see only the first line of your two line field?

This line is not in your code:

// Enable the variable row height so that the
// column values are displayed in 2 lines.
oBrowser:EnableRowHeightVariable(TRUE)


HTH

Gerhard Bunzel
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am

Field grouping in bBrowser

Post by Karl-Heinz »

Hi Jeff,

I´m using a expression Datacolumn in a different way. Using a callback method gives you much more flexibility to control the cell content. BTW. if CRLFs are used you must ensure that the Valtype of the column is always "M".

Just add this code to your app and give it a try.

Code: Select all

method PostInit(oWindow,iCtlID,oServer,uExtra) class AddBookList

oBrowser:EnableRowHeightVariable(TRUE) 
...
oColumn := bDataColumn{ oBrowser, oServer, { | oDB, oOwner| oOwner:FillColumnCladd ( oDB) }, #Expression , self }
oColumn :ValType := "M"	
...


METHOD FillColumnCladd ( oServer ) CLASS AddBookList

 	RETURN oServer:Fieldget ( #CLADD1 ) + CRLF + oServer:Fieldget ( #CLADD2 ) 

regards
Karl-Heinz
BiggyRat

Field grouping in bBrowser

Post by BiggyRat »

Sorry Karl-Heinz:

This 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
oBrowser:EnableRowHeightVariable(true)
oBrowser:Use(oServer, {#CLADD1, #CLADD2})
oColumn := bDataColumn{ oBrowser, oServer, { | oServer, oBrowser| oBrowser:FillColumnCladd ( oServer) }, #Expression , self }
oColumn :ValType := "M"
oBrowser:AddColumn(oColumn)
oBrowser:Refresh()
oBrowser:Recalculate()
Return nil

METHOD FillColumnCladd ( oServer ) CLASS AddBookList

RETURN oServer:Fieldget ( #CLADD1 ) + CRLF + oServer:Fieldget ( #CLADD2 )


Still returns:
Capture.JPG
Capture.JPG (13.34 KiB) Viewed 276 times
Jeff
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am

Field grouping in bBrowser

Post by Karl-Heinz »

Hi Jeff,

The quality of the attached image is poor, but that´s another story <sigh> ...

https://www.xsharp.eu/forum/suggestions ... s-to-a-msg

I "see" two columns, but the 3th column that should show the content of #CLADD1 *and* #CLADD2 is not visible because you do not open the created column. Note: In addition i added a Hyperlabel.

Code: Select all

...  
oColumn := bDataColumn{ oBrowser, oServer, { | oDB, oOwner| oOwner:FillColumnCladd ( oDB) }, #Expression , self }
oColumn:ValType := "M"	
oColumn:Width := 200
oColumn:HyperLabel := HyperLabel{#USERCLADD,"USERCLADD",NULL_STRING,NULL_STRING}
oColumn:Caption := "Jeffs special Col"
oBrowser:addcolumn ( oColumn )
oBrowser:OpenColumn ( oColumn )  // <--------------
...
regards
Karl-Heinz
BiggyRat

Field grouping in bBrowser

Post by BiggyRat »

Thanks so much Karl-Heinz! I had put the OpenColumn in in past attempts, but obviously not all together. Thank you very much again Karl-Heinz and Wolfgang. Here's what I wanted to achieve, and thanks to you guys, I now have:

New Column.JPG
New Column.JPG (19.48 KiB) Viewed 276 times
Post Reply