Solved! Go to Solution.
I see the same behavior in CVI 9.01. Seems strange to allow Ctrl-tab when text editing is disabled.
Why do you need the control to be HOT when you have text editing disabled? Why not just set it to be an indicator?
SetCtrlAttribute (panelHandle, PANEL_TEXTBOX, ATTR_CTRL_MODE, VAL_INDICATOR); // or VAL_HOT to resume editing
If you do want it to be HOT, you can do a workaround by swallowing key press events. Assign a callback function to the textbox control (by editing the control in the UIR editor), check if text editing is disabled, and if it is, swallow any keypress event by returning 1. See the CVI help on Swallowing Events for more info.
int CVICALLBACK textboxCallback (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
GetCtrlAttribute (panelHandle, PANEL_TEXTBOX, ATTR_NO_EDIT_TEXT, &no_edit_attr);
// swallow event if text box is set to no edit
I tested the code I posted. Swallowing the key press event does work for Ctrl-Tab (meaning that the control text does not get modified when you press Ctrl-Tab). The callback is made before the control is updated. That's the whole point of callbacks. If you swallow the keypress event (as in the code I posted), Ctrl-Tab will not overwrite the text.
I have attached a sample project that shows how swallow events will help you. Run it and follow the instructions on the screen.
Just a quick note to let you know that we agree that this does look like a bug in CVI, and it will be resolved in a future release. The problem report is 190831.
Thanks for reporting this.