LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Table

Hello,
I have a problem working with tables.
I need to solve this problem and I don't know how to program it, can't anyone help me?

1) Delete Row - I need to delete the entire selected row. So far, I have only been able to delete the first line.
2) Restore - If I delete something, I would like to restore it back when I'm wrong.
3) Add a row - I would like to add an entire row to the end of the table.
4) Sorts by - I would like to sort the whole table alphabetically and how to load (Routes)
5) Scroll up and back one line at a time and jump to the end of the table and the arrow to the beginning of the table.

I can't deal with this problem, thank you very much for your help and I'm attaching the project.

 

 

 

infouseku.png

0 Kudos
Message 1 of 10
(2,673 Views)

You've mocked up a very complex project with a lot of table features.  I would recommend starting very simple, perhaps only support the add/delete rows. 

 

I've worked with tables a lot in many of my projects.  They are powerful, but very cumbersome to manipulate, particularly if you need to keep track of row contents in local memory.

 

In your case, wanting to "remember" the contents of a row to effectively undo a delete is where you will need to keep track of the table in your own memory.  I would recommend some sort of struct that defines the column fields.  Then make an array of this struct, equal in the number of rows.

 

As to adding rows in specific indexes, this is supported.  InsertTableRows with the index is what you want.

0 Kudos
Message 2 of 10
(2,617 Views)

I can point you to the correct commands to use and to some relevant example.

 

1. DeleteTableRows is the command to use in this case

 

2. You can copy table data to clipboard before deleting them and restore them from the clipboard to roll them back. ClipboardPutTableVals and ClipboardGetTableVals are the commands to use

 

3. InsertTableRows is useful in this case. Look at colview.cws example

 

4. SortTableCells: an example is the same project as above

 

5. Use SetCtrlAttribute with ATTR_FIRST_VISIBLE_ROW and some effort in coding

 

Generally speaking, all these informations can be found in the help: right click on the table control in the UIR editor and choose Control Help to access the help page for table controls: Programming with Table Controls is the page where to found all relevant informations on coding.



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 3 of 10
(2,615 Views)

I second Roberto's advice. The help is truly amazing.  Also, look for the sample projects linked right there in the help window.  They are great!

 

help.jpg

 

 

There's no other way to gain this knowledge but to just jump in.  I spent many hours learning tables, but it's worth it.  

 

Message 4 of 10
(2,608 Views)

Greetings Roberto Bozzolo 🙂

I apologize for the late response.

 

1) I've already figured this out, I knew the "DeleteTableRows" command, of course, but it didn't delete the whole table, but only one part of it, so I had to add a pointer to the structure.

2) These commands might work, but I don't know how to use them.

3) This example helped me, thank you.

4) The example also contains sorting, I haven't gotten to that yet.

5) Can I find an example somewhere? How is this programmed?

 

Thank you for your advice.
Have a nice day

0 Kudos
Message 5 of 10
(2,517 Views)

1) I'm confused by the solution you took.  Can you explain further?  

 

The function DeleteTableRows already has a built-in ability to delete all table rows, as per its numberOfRows parameter: "To delete all items from rowIndex to the end, enter –1."

0 Kudos
Message 6 of 10
(2,498 Views)

2) To save part of a table you need to call ClipboardPutTableVals passing the appropriate Rect structure defining the area of interest. MakeRect can be of help in this case.

The help describes how data is saved to the clipboard.

ClipboardGetTableVals works the opposite way.

 



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 7 of 10
(2,491 Views)

Yes, it deleted the row, but only one of her cells. The whole row consists of 14 cells. I had to use the "GetActiveTableCell" function where he then deleted the whole row.

0 Kudos
Message 8 of 10
(2,458 Views)

This is not the way it should work: can you post a reduced project that shows this abnormal behavior?



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 9 of 10
(2,445 Views)

Point selectedRange;

GetActiveTableCell (panelHandle, PANEL_TABLE, &selectedRange);
DeleteTableRows (panelHandle, PANEL_TABLE, selectedRange.y, 1);

 

5) I would like to assign the "Page Down" key and the "Page UP" key to a specific button. Is there any way to do this?

0 Kudos
Message 10 of 10
(2,441 Views)