LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I set table cell focus

Is there a way to set a table cell in LabWindows/CVI 6.1 so the user can start typing into a table cell as soon as the panel is loaded? I set the tab stops so the table has the focus as soon as the table loads. I also tried the following commands but the user still has to click on a cell before typing anything.

SetCtrlAttribute (sysinfo, SYSINFO_TABLE, ATTR_TABLE_RUN_STATE, VAL_EDIT_STATE);
SetActiveTableCell (sysinfo, SYSINFO_TABLE, activeCell);

In this application the technician will type or scan in serial numbers and part numbers before the test starts.

John Bessire
Test Engineer
0 Kudos
Message 1 of 4
(4,051 Views)
Hi,

I tried with an application of mine and it does work with exactly your code provided thet SetActiveTableCell is put BEFORE SetCtrlAttribute (... ATTR_TABLE_RUN_STATE...). It seems that programmatically moving the active cell determines the table to loose the edit mode.

Other possible reasons for not being able to type into a cell can be the table or the individual cell set as indicator.

Hope this helps
Roberto

Message Edited by Roberto Bozzolo on 06-16-2005 09:18 AM



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 2 of 4
(4,042 Views)
Roberto,

That simple change got it to work. Thank you for the help.


John Bessire
Test Engineer
0 Kudos
Message 3 of 4
(4,023 Views)
John,

Roberto is correct. If you change the active cell programmatically, the table reverts back to its selection state. This also happens if, while editing a particular cell, the end user clicks on a different cell. You will need to follow Roberto's suggestion, and if you want to prevent users from leaving edit mode, you might have to "swallow" some keypress and left-click events in the table's callback.

Another thing you need to ensure is that the table is the active control. If you have multiple controls in the panel, you might need to stick a SetActiveCtrl call in there somewhere.

As a side note, the next version of CVI will have some feature enhancements to the table control; one of which is the ability to edit a cell automatically, by simply typing on it, eliminating the need to double-click or press .

Luis
NI
0 Kudos
Message 4 of 4
(4,019 Views)