LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

table cell button events

I currently have a table with several of the cells using the button mode.  Is there an easy way to tell if the button is pressed?  I would have thought it would have generated a "EVENT_COMMIT" event to the table callback when it's pressed, but it doesn't seem too.  It just seems to do an "event left click" and a "active cell change" (forgot the order, but those seem to be the only events sent).
0 Kudos
Message 1 of 6
(4,341 Views)
You should be getting an EVENT_COMMIT.  Make sure the control mode is 'Hot' -- not 'Normal'.  Normal mode does not generate commit events.  You can check this setting in the Edit Table dialog or programmatically by using GetCtrlAttribute to query the ATTR_CTRL_MODE attribute.

Mert A.
National Instruments
0 Kudos
Message 2 of 6
(4,339 Views)
I thought that too. 🙂   What I had been doing was setting default table control settings to grid mode and normal (or pretty much anything for that matter) control mode.  In the code I then add rows with the "use master cell type" value, update some values and such, and then finally change the cells in question to val_hot. (using settablecellattribute(blah, blah, blah, ATTR_CELL_MODE, VAL_HOT)).  
 
I went into the table properties and change the default cells to HOT... seems to work now, but I should be able to set whatever default value and change it to what I really want in the code right?
0 Kudos
Message 3 of 6
(4,315 Views)
In order to receive COMMIT events from a table cell, it actually doesn't matter whether the cell is set HOT or NORMAL. What matters is the mode of the table itself. It is the table that needs to have its mode set to HOT.

And yes, you're right, you are able to change any cell or control attribute programmatically, using SetTableCellAttribute or SetCtrlAttribute, respectively.

Luis
NI
0 Kudos
Message 4 of 6
(4,308 Views)
I think you're getting the table control's mode mixed up with the default cell mode.  Setting the table control's mode to 'normal' will prevent the table from generating commit events -- even if you set individual cell modes to 'hot'.  The 'Control Mode' setting in the Edit Table dialog is not the default cell mode when the table is set to grid mode.  It actually corresponds to setting ATTR_CTRL_MODE.  You are interested in ATTR_CELL_MODE.

Leave the table in hot mode, then change the default cell mode via SetCtrlAttribute(..., ATTR_CELL_MODE, VAL_NORMAL) and you should have the behavior you expected.

Hope this helps.

Mert A.
National Instruments
0 Kudos
Message 5 of 6
(4,307 Views)
I think your right, I was confusing the table as a whole and individual cells.  Thanks for all your help.
0 Kudos
Message 6 of 6
(4,304 Views)