Show colsize togetter with colnames on rightclick

Show colsize togetter with colnames on rightclick

Postby Marc Venken » Sat Jan 21, 2017 7:34 pm

If you rightclick on the headers of Xbrowse you see the header names.

Is it possible to see also the col width ?

It would be easy when it can, so you create the browse, execute the program, change the width and see the new sizes to change the source.

Marc
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1425
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Show colsize togetter with colnames on rightclick

Postby ukoenig » Sat Jan 21, 2017 9:41 pm

Marc,

why not using the column-tooltip to include the needed infos.

oBrw:aCols[ 2 ]:bToolTip := { | oBrw, nRow, nCol, nFlags | MyToolTip( oBrw, nRow, nCol, nFlags) }

oBrw1:aCols[ 2 ]:bToolTip := { | oBrw, nRow, nCol, nFlags | oBrw1:aCols[ 2 ]:nWidth } // shows the width of column 2
oBrw1:aCols[ 3 ]:bToolTip := { | oBrw, nRow, nCol, nFlags | oBrw1:aCols[ 3 ]:nWidth } // shows the width of column 3

regards
Uwe :?:
Last edited by ukoenig on Sat Jan 21, 2017 10:13 pm, edited 2 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Show colsize togetter with colnames on rightclick

Postby Marc Venken » Sat Jan 21, 2017 9:54 pm

Because I already use tooltip for something else ?
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1425
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Show colsize togetter with colnames on rightclick

Postby nageswaragunupudi » Sat Jan 21, 2017 10:07 pm

It would be easy when it can, so you create the browse, execute the program, change the width and see the new sizes to change the source.


You know oBrw:nWidths gives an array of column widths.
If you want to quickly prepare code to copy and paste into your application, you can do something like:
Code: Select all  Expand view

oBrw:bRClicked := { || MEMOEDIT( "COLSIZES " + FW_ArrayAsList( oBrw:nWidths ) ) }
 

When you right click on the browse, you will see
Code: Select all  Expand view

COLSIZES 166,166,246,246,61,86,86,79,46,94,566
 

in a memoedit, which you can copy and paste in your application.
You can have this code in your application only during development and remove later on
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Show colsize togetter with colnames on rightclick

Postby ukoenig » Sat Jan 21, 2017 10:22 pm

Marc,

You can add the info at the bottom of Your defined tooltip-text

oBrw1:aCols[ 2 ]:bToolTip := { | oBrw, nRow, nCol, nFlags | ;
"Tooltip Col 2" + CRLF + "width : " + LTRIM(STR(oBrw1:aCols[ 2 ]:nWidth)) }


Image

regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Show colsize togetter with colnames on rightclick

Postby Marc Venken » Sat Jan 21, 2017 10:37 pm

Thank U both !

I can use both now. The tooltip is handy for this info.

Marc
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1425
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Show colsize togetter with colnames on rightclick

Postby nageswaragunupudi » Sat Jan 21, 2017 10:47 pm

In continuation to my above posting, we can extend the logic to generate mini code.
Create a browse, swap columns, resize columns as you like and then call
oBrw:bRClicked := { || MEMOEDIT( QuickCode( oBrw ) }

This the function QuickCode:
Code: Select all  Expand view
function QuickCode( oBrw )

   local cCode := ""

   cCode := "COLUMNS "  + FW_ValToExp( oBrw:cExprs ) + " ;" + CRLF
   cCode += "HEADERS "  + FW_ValToExp( oBrw:cHeaders ) + " ;" + CRLF
   cCode += "COLSIZES " + FW_ArrayAsList( oBrw:nWidths )

return cCode
 


Output is like this:
Code: Select all  Expand view
COLUMNS {"ID","FIRST","LAST","STREET","CITY","STATE","ZIP","HIREDATE","MARRIED","AGE","SALARY","NOTES"} ;
HEADERS {"ID","FIRST","LAST","STREET","CITY","STATE","ZIP","HIREDATE","MARRIED","AGE","SALARY","NOTES"} ;
COLSIZES 97,146,146,216,216,40,76,76,56,62,104,496


This you can copy and paste in your program
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Show colsize togetter with colnames on rightclick

Postby Marc Venken » Sat Jan 21, 2017 11:02 pm

Nice,

I just posted a new question somewhat related to this last answer.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1425
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 51 guests