06-29-2012 05:57 AM
Hello all,
Call me slow, but I only just notice the existence of an EVENT_CLOSE event for panels. Previously I always used a [Close] button placed in the [Close control] attribute of the panel.
What is the difference between those two methods ?
If you place QuitUserInterface in both callbacks, which one(s) are called and in which order ?
07-02-2012 05:11 AM
I thought that this help topic could help, but apparently there at least one element missing.
Having made some test it appears that when you press the red "X" in the upper right corner of the panel the panel callback is called first and the control callback is called last (both are indeed called). This is somewhat an exception to the rule in the mentioned document, that does not lists the button callback on panel generated events. I have not tested where the button callback is fired in relation to the main callback (I'm not even sure if there is a consistent precedence between them) but is appears consistently that the panelcallback is fired before the control callback.
On the other side, pressing the button does not fires the panel callback correctly following the above document.
07-02-2012 09:50 AM
OK, thanks. I wonder if there are some kind of distinctions as well when:
- the panel is a child panel (no close button)
- the panel is deleted grammatically (no callbacks are called I guess)
- the application is closed (but not from clicking on the close button of that particular panel)
- the system is shutdown (isn't there a specific panel event for that one ?)
Anyway, I think in practice the distinction between the panel close and the button close is minimal, as long as you catch one of them. Right ?
07-03-2012 02:00 AM
In some occasions a EVENT_DISCARD event is received in some callback; this is the case of a panel being closed programmatically, either a child panel or a top level one: its callback (if any) will receive the event.
With reference to application closing (not from the dedicated button you have), you'll get a EVENT_END_TASK in the callback installed via InstallMainCallback; the same applies when you shutdown the system. Returning -1 from this event should postpone or abort the shutdown.
07-03-2012 02:37 AM
Thanks for he details. While we are on the subject, does CVI also passes sleep/hibernate events and wake ups ?
07-03-2012 03:56 AM
I really don't know! As I'm mainly involved in developing endurance and life test, I normally disable those functions on all my customers' PCs.
07-03-2012 04:00 AM
So do I. I wouldn't want the control system of the nuclear reactor to go to sleep, even if it's a small one... ![]()