12-10-2007 12:51 PM
One additional possibility could be to react to EVENT_GOT_FOCUS event in the panel callback: raise a global flag when receiving the event and start a simple timer that simply clears the flag and disables itself after some tenth of second. In the quit button callback simply test flag value and return immediately if set.
If you don't like to use global variables, you can place a hidden check box on the panel: set it to 1 in EVENT_GOT_FOCUS panel event and clear it in the timer callback; check its value in quit button callback.
01-02-2008 04:04 PM
Wow, lots of hits on this subject. Thought you might be interested in the final solution (my thanks to Nicolas)
Before:
int CVICALLBACK BITTopExit (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
if (event == EVENT_COMMIT)
{
DiscardPanel (b2handle);
UndimAllMainPanelButtons ();
FocusPanel = GetActivePanel();
}
return 0;
}
After
int CVICALLBACK BITTopExit (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
if (event == EVENT_COMMIT)
{
int tmpPanel, tmeCtrl;
// avoid inadvertent double click
Delay (0.200);
while (GetUserEvent (0, &tmpPanel, &tmeCtrl));
DiscardPanel (b2handle);
UndimAllMainPanelButtons ();
FocusPanel = GetActivePanel();
}
return 0;
}
It's still in test, but preliminary results look good.
DJW