Welcome, Guest
Username: Password: Remember me
Visual Objects

Please use this forum to post questions about Visual Objects and Vulcan.NET
  • Page:
  • 1

TOPIC:

Field grouping in bBrowser 20 Nov 2019 07:56 #11819

  • BiggyRat
  • BiggyRat's Avatar
  • Topic Author



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?

Please Log in or Create an account to join the conversation.

Field grouping in bBrowser 20 Nov 2019 07:58 #11820

  • wriedmann
  • wriedmann's Avatar


  • Posts: 3366
  • Hi Jeff,
    create an access in your DBServer class and use it in the bBrowser column.
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    Field grouping in bBrowser 20 Nov 2019 08:10 #11823

    • BiggyRat
    • BiggyRat's Avatar
    • Topic Author



    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?

    Please Log in or Create an account to join the conversation.

    Last edit: by BiggyRat.

    Field grouping in bBrowser 20 Nov 2019 17:46 #11832

    • g.bunzel@domonet.de's Avatar


  • Posts: 90
  • 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

    Please Log in or Create an account to join the conversation.

    Field grouping in bBrowser 20 Nov 2019 17:58 #11834

    • Karl-Heinz
    • Karl-Heinz's Avatar


  • Posts: 774
  • 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.
    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

    Please Log in or Create an account to join the conversation.

    Field grouping in bBrowser 20 Nov 2019 23:23 #11837

    • BiggyRat
    • BiggyRat's Avatar
    • Topic Author



    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:



    Jeff
    Attachments:

    Please Log in or Create an account to join the conversation.

    Field grouping in bBrowser 21 Nov 2019 07:03 #11839

    • Karl-Heinz
    • Karl-Heinz's Avatar


  • Posts: 774
  • Hi Jeff,

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

    www.xsharp.eu/forum/suggestions/1371-attaching-images-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.

    ...  
    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

    Please Log in or Create an account to join the conversation.

    Field grouping in bBrowser 21 Nov 2019 10:15 #11841

    • BiggyRat
    • BiggyRat's Avatar
    • Topic Author



    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:


    Attachments:

    Please Log in or Create an account to join the conversation.

    Last edit: by BiggyRat.
    • Page:
    • 1