LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Editing lost in table control when updating values

Hello All,
 
I have an application written in LabWindows 7.1 that is using a table control to both display values that are acquired from external instruments and to allow the operator to enter values that are then transmitted to external instruments. I have a software loop that continuously walks through and updates all values in the table one at a time using the SetTableCellAttribute (panel, control, cell, ATTR_CTRL_VAL, value) function call. I have a problem when the table control is placed into edit mode and the operator attempts to edit a value, as soon as the update loop updates any cell value the cell that is currently being edited is reset to its original value. I have an in use flag that prevents the update loop from updating the value of the cell that is being edited but this makes no difference. If any value in the table is updated then the cell being updated is reset. Is this a bug in the table control and if so is there any work around?
 
Thanks,
Jim Vander Werp
Grand Rapids, MI 
0 Kudos
Message 1 of 3
(3,212 Views)
Hello Jim,

Yes, you did find a previously unknown bug in the table. Although one would expect the changes to be lost if you programmatically change the value of the cell being edited, the fact that they are also lost when you change a different cell is unexpected, and is a bug.

The bug will be fixed in the next version of CVI. In the meanwhile, there is a workaround that might help: before you run your loop, you need to check the state of the table, and if it's set to VAL_EDIT_STATE, you should change it:

    SetCtrlAttribute (panel, PANEL_TABLE, ATTR_TABLE_RUN_STATE, VAL_SELECT_STATE)

Changing the state will commit the pending changes from the edit session. After your loop runs, you can then set it back to VAL_EDIT_STATE. The only caveat is that the cursor position within the cell will have been lost (I believe the whole cell will be highlighted) which could be a bit disruptive to the person doing the editing. Also, keep in mind that you will still have to avoid setting the value for the cell that was being edited, of course.

Let me know if have any questions.

Luis

0 Kudos
Message 2 of 3
(3,195 Views)

Thanks Luis

Jim

 

0 Kudos
Message 3 of 3
(3,191 Views)