LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

set table column width automatically

Hello,
 
when putting a string in a table cell using the SetTableCellVal function (or SetTableAttribute with ATTR_CTRL_VAL), is there any way to adjust the column width automatically, so the entire string can be seen by the user? It seems that the column attributes Fit Mode and Size Mode can only be used for picture cells, not for strings Smiley Sad . If this is not possible, how can I check the width (in pixels) of the string that I am putting in the table cell?
 
All hints are appreciated,
Wim
0 Kudos
Message 1 of 5
(3,760 Views)
I am also interested in such a feature that I have not found till now.
At present the only solution seems the use of metafonts: if I am using a metafont I can obtain the lenght of the string via GetTextDisplaySize command, so that I can adequate column width according to the size obtained.


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 5
(3,755 Views)
Wim, Roberto,

Actually, there is a function that lets you do this. It's called SetColumnWidthToWidestCellContents. It works for both trees and tables.

Luis
Message 3 of 5
(3,746 Views)

Thanks a lot.

Roberto's solution was working fine, but it is of course more elegant to do it in jut one line of code, and I can reduce my list of local variables.

0 Kudos
Message 4 of 5
(3,719 Views)

LuisG wrote: Wim, Roberto, Actually, there is a function that lets you do this. It's called SetColumnWidthToWidestCellContents. It works for both trees and tables. Luis

Mmmm, introduced in version 7: seems I need to re-study what's new in that version! Smiley Surprised

Thanks you very much, Luis.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 5 of 5
(3,714 Views)