07-04-2011 07:08 AM
Hello,
I want to calculate and set the total table height, depending on the number of rows (provided this number is smaller than a threshold). For this purpose I need the height of the regular and of the topmost row. I could not find a suitable attribute, but due to the complexity of the table control I might well have overlooked it... Someone who knows how to accomplish this task?
Thanks!
Solved! Go to Solution.
07-04-2011 08:17 AM - edited 07-04-2011 08:27 AM
Hi and sorry for the trouble,
I found a partial answer: the regular row height can be obtained using GetTableRowAttribute ( , , 1, ATTR_ROW_ACTUAL_HEIGHT, ); so far I found no corresponding attribute for the topmost row
ok, and the column height can be determined using GetCtrlAttribute ( , , ATTR_COLUMN_LABELS_HEIGHT, )
still some frame height seems to be missing in my pixel sum
07-05-2011 06:45 AM
OK,
just in case you thought it's solved - it's not Probably my description wasn't clear enough, so I'll try again:
At present I have determined the height of the topmost table row (the row with the label) in the UI editor by chosing different number of rows (2, 3) and reading the total table height using SHIFT+F10. The difference then yields the height of a regular row and with this number I can deduce the height of the topmost row.
In my case, regular rows are 19 pixel high, and a table with 1+1 row makes 50 pixels height.
Using GetTableRowAttribute ( , , 1, ATTR_ROW_ACTUAL_HEIGHT, ) gives the correct number of 19. So far I have found no possibility to obtain the height of the topmost row of 31 pixels...
I can do it only indirectly via
GetCtrlAttribute ( , , ATTR_HEIGHT, );
GetCtrlAttribute ( , , ATTR_NUM_VISIBLE_ROWS, );
and do the math as with the UI editor. I am wondering if there is no dedicated attribute, or phrased differently, why
GetTableRowAttribute ( , , 0, ATTR_ROW_ACTUAL_HEIGHT, ) doesn't work...
07-07-2011 12:16 PM
Wolfgang,
I might be misunderstanding your goal, but if all you are looking for is to set the height of a table to some specific number of rows, all you need to do is:
SetCtrlAttribute (, , ATTR_NUM_VISIBLE_ROWS, n);
Does that not work for you?
Luis
07-07-2011 01:12 PM
Hi Luis,
I am sorry to say that my wording was unclear and you misunderstood my request. I want to obtain the height in pixels of 'row 0', that is the row with the labels. I can obtain the height of the label, but not of the corresponding row and guess I simply miss the proper attribute...
Thanks,
Wolfgang
07-08-2011 09:19 AM
Hello Wolfgang,
if have looked through the available atrributes for the table control (Table Control Attributes: http://zone.ni.com/reference/en-XX/help/370051T-01/cvi/uiref/cvitable_attributes/) too and it seems, that is not possible to to read out the height of the row with the Column-Labels.
May I ask you, what you need the height for?
Regards,
Johannes
07-08-2011 10:35 AM
Hello Johannes,
Thanks for the reference list of table attributes!
The reason I want to obtain the height of the topmost row is because I want to set the total table height during run time, depending on the number of rows. I want to have a popup panel showing some intermediate results for confirmation. So if there are only 6 data elements to show I build a table that only has 6 rows, plus the label row. Accordingly I adjust the height of the popup panel. If, however, there are say 50 elements, I will turn on the vertical scroll bar and limit the table height to show exactly 10 rows. So in short, the reason is cosmetic, because a table / panel which is mostly empty doesn't look so nice imho, and tables showing 6.3 rows either
07-08-2011 10:47 AM
Hi Luis,
After reading your post a second time today I have to admit that your suggestion actually is what I am looking for - sorry for the much delayed insight...
Indeed I can use this attribute and then query the height of the table to adjust the other controls on my popup panel.
Thanks and sorry for ignoring you the first time
07-08-2011 02:43 PM
No worries. I'm glad it helped.
Luis
03-04-2021 09:09 AM
Resurrecting a 10 year old thread, just in case anyone else needs this.
I'm interested in setting the height of the column labels for which this works;
SetCtrlAttribute (panel , control , ATTR_COLUMN_LABELS_HEIGHT , 50);
I presume that;
GetCtrlAttribute (panel , control , ATTR_COLUMN_LABELS_HEIGHT , & height);
will work although I haven't tested it.