LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

sorting a table column

Solved!
Go to solution

When sorting a table column with the built-in popup menu (CVI2010), I came across two issues I do not understand:

 

1) I am starting with a table with one row, and programmatically insert further rows, in this case 2 more giving a total of 3. I also checked using GetCtrlAttribute (, , ATTR_NUM_VISIBLE_ROWS, ) which results also in three rows, see the figure below.

 

table-sort-1.jpg

 

Interestingly, when using sort, it shows a cell range extending up to 13...?

 

2) Clicking on the OK button yields the result shown in the figure below, i.e. three empty fields...?

 

table-sort-2.jpg

 

 

Thanks, Wolfgang

0 Kudos
Message 1 of 6
(4,562 Views)

Your table actually has 13 rows in it as the Sort Table Cells dialog shows. You probably have 10 empty rows below the 3 with data in them. The empty rows will show at the top of the because you are sorting by Ascending values. If you sorted by Descending Column Values you'd see your 3 file names in reverse order.

Kevin B.
Message 2 of 6
(4,550 Views)

Hi Kevin,

 

Your explanation is convincing! Thanks a lot!

 

My confusion was because in the UI editor I thought having created a table with 1 row and 7 columns. In the program, I inserted 2 rows, and this should have yielded 3...

 

Now, after your reply I have checked this using GetNumTableRows just after loading the panel, and the number of rows returned was 11! Of course, if I insert 2 more rows I will end up with 13. So everything is fine!

 

So let me re-adjust my question: How can I check the number of rows in the UI editor if I have set the table with only 1 visible row? My solution now was to cut all rows and then re-insert one, but isn't there something more elegant?

0 Kudos
Message 3 of 6
(4,544 Views)

There are a couple ways to tell how many rows are visible in the UI Editor using the Table Dialog (you've obviously figured out how to determine the number of rows at run-time):

 

1) You can set the Scroll bars to either "Both scroll bars" or "Vertical Scroll Bar". If there are rows that aren't visible the scroll bar will be enabled and you can use either the scroll bar thumb or arrow buttons to see all the rows. Be aware that changing the Scroll Bar setting in the Table Dialog might require you to adjust the number of visible rows/columns in the "Size/Scroll Options..."

 

2) You can check the "Row labels visible" checkbox which will show you what the current row is. You can then use the keyboard arrows to go down until the row numbers stop incrementing.

 

 

Kevin B.
0 Kudos
Message 4 of 6
(4,538 Views)
Solution
Accepted by topic author Wolfgang

...or simply go to the box with add, cut, paste, edit row buttons, type 1000 in the row number and press Tab key: it will be coerced to the last row number present in the table. Smiley Wink



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 6
(4,533 Views)

Thanks for the suggestions! I will adapt the smart procedure of Roberto.

 

Still, for the less experienced user I have added a product suggestion here

0 Kudos
Message 6 of 6
(4,527 Views)