FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Show colsize togetter with colnames on rightclick
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM

Show colsize togetter with colnames on rightclick

Posted: Sat Jan 21, 2017 07: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.08 with Harbour
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM

Re: Show colsize togetter with colnames on rightclick

Posted: Sat Jan 21, 2017 09: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 :-)
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.
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM

Re: Show colsize togetter with colnames on rightclick

Posted: Sat Jan 21, 2017 09:54 PM

Because I already use tooltip for something else ?

Marc Venken

Using: FWH 23.08 with Harbour
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: Show colsize togetter with colnames on rightclick

Posted: 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 (fw): Select all Collapse
oBrw:bRClicked := { || MEMOEDIT( "COLSIZES " + FW_ArrayAsList( oBrw:nWidths ) ) }

When you right click on the browse, you will see
Code (fw): Select all Collapse
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
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM

Re: Show colsize togetter with colnames on rightclick

Posted: 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)) }




regards
Uwe :-)
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.
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM

Re: Show colsize togetter with colnames on rightclick

Posted: 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.08 with Harbour
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: Show colsize togetter with colnames on rightclick

Posted: 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 (fw): Select all Collapse
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 (fw): Select all Collapse
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
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM

Re: Show colsize togetter with colnames on rightclick

Posted: 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.08 with Harbour

Continue the discussion