LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

height of a table column label

Solved!
Go to solution

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!

0 Kudos
Message 1 of 10
(4,160 Views)

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 

0 Kudos
Message 2 of 10
(4,157 Views)

OK,

 

just in case you thought it's solved - it's not Smiley Tongue 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...

0 Kudos
Message 3 of 10
(4,140 Views)
Solution
Accepted by topic author Wolfgang

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

Message 4 of 10
(4,129 Views)

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

0 Kudos
Message 5 of 10
(4,123 Views)

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

Message 6 of 10
(4,111 Views)

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 Smiley Wink

 

 

0 Kudos
Message 7 of 10
(4,107 Views)

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 Smiley Sad

0 Kudos
Message 8 of 10
(4,104 Views)

No worries. I'm glad it helped.

 

Luis

0 Kudos
Message 9 of 10
(4,099 Views)

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.

John C
0 Kudos
Message 10 of 10
(2,253 Views)