04-12-2013 02:48 PM
Hi,
I have a string control in HOT mode with a callback associated with it. If the cursor is on the control and I QuitUserInterface on the EVENT_CLOSE of the panel callback, the string control callback receives an EVENT_COMMIT. I don't understand why this is happening any Ideas? Do I need to remove the callback in the panel EVENT_CLOSE by setting the ATTR_CALLBACK_FUNCTION_POINTER to 0 or settting the mode to NORMAL? I have never run into this before.
Thanks,
Mike
04-13-2013 03:59 AM
Hi,
can you post your string control callback...?
04-14-2013 03:59 PM
If you are editing the string in the control it seems not strange to me. It happens the same when you operate another control during editing (e.g. type some characters in the string control and next click on a button): the string control receives the commit and lost focus events, next the new control receives the got focus and other possible events.
04-15-2013 01:33 AM
Roberto is right, as usual
While I was aware of the LOST_FOCUS event I didn't realize that this will also trigger a COMMIT event because changing the focus will also finish the text input.
04-15-2013 08:20 AM
I didn't enter anything in, but the cursor was in the box before I hit the close button. I ended up just disabling the callback before the QuitUserInterface. Below is the code for the string callback and the panel callback.
Mike
int CVICALLBACK cbkTraveler (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{ // cbkTraveler
int iRet;
switch (event)
{ // Switch Event
case EVENT_COMMIT:
iRet = Message_Box("Database Access","Retrieving S/N's");
iRet = Message_Box("Load","Load Parts");
iRet = Message_Box("Marking","Marking");
iRet = Message_Box("Un Load","Remove Parts");
iRet = Message_Box("Verify","Are Parts OK");
break; // EVENT_COMMIT
case EVENT_LEFT_CLICK:
break; // EVENT_LEFT_CLICK
case EVENT_LEFT_DOUBLE_CLICK:
break; // EVENT_LEFT_DOUBLE_CLICK
} // Switch Event
return 0;
} // cbkTraveler
int CVICALLBACK cbkMainPnl (int panel, int event, void *callbackData,
int eventData1, int eventData2)
{ // cbkMainPnl
switch (event)
{ // Switch Event
case EVENT_GOT_FOCUS:
break; // EVENT_GOT_FOCUS
case EVENT_LOST_FOCUS:
break; // EVENT_LOST_FOCUS
case EVENT_CLOSE:
SetCtrlAttribute(panel, PNL_MAIN_TXT_TRAVELER, ATTR_CALLBACK_FUNCTION_POINTER, 0);
QuitUserInterface(0);
break; // EVENT_CLOSE
} // Switch Event
return 0;
} // cbkMainPnl