Actaully I must correct myself. The timer callbacks should not stop
firing on account of the menu being tracked. In my test, I had a call
to ProcessSystemEvents() in the timer callback. This was the only
reason why the timer callbacks stopped firing when I opened up a menu.
Here is what the help of ProcessSystemEvent states
Note When ProcessSystemEvents
handles an event that starts a tracking loop, such as the user pulling down a
menu, ProcessSystemEvents does not return until the
tracking loop completes. In the case of pulling down a menu, the tracking loop
does not complete until the user dismisses the menu. Consequently, do not call
ProcessSystemEvents in your program if you want to
continue executing the subsequent lines of code even during a tracking loop.
Once I remove the call to ProcessSystemEvents(), the timer callback no longer gets held up when I bring up a menu.
This function will wait only if the tracking loop starts while
ProcessSystemEvents() is processing messages. For example, if you set
the timer callback interval to a large value like 2 seconds, and then
play around with menus, you will notice that timer callbacks are no
longer being held up. This is because in this case, the call to
ProcessSystemEvents() is being nested inside of the tracking loop
started by the menu. The tracking loop was already running by the time
the call to ProcessSystemEvents occured.
Ofcourse if the timer is running really fast, you have a higher
probability that the tracking loop will be started during a call to
ProcessSystemEvents() (hence the tracking loop is nested inside of the
call to ProcessSystemEvents() ). In this case, ProcessSystemEvents will
not return until the tracking loop returns.
This is the same behavior with GetUserEvents(). Here is what the help says
Note When the User Interface Library handles an event that
starts a tracking loop, such as the user pulling down a menu, GetUserEvent does not return until the tracking loop
completes, even if you pass 0 as the waitMode parameter. In the
case of pulling down a menu, the tracking loop does not complete until the user
dismisses the menu. Consequently, do not call GetUserEvent in your program if you want to continue
executing the subsequent lines of code even during a tracking loop.
I hope this explains things. This all is unrelated to that CVI menu bug that initially started this thread.
Message Edited by bilalD on 07-06-2005 06:42 PM
Bilal Durrani
NI