I would approach the problem from the other end - instead of trying to control the event loop, try to control the dialogs you pop up. Have some kind of registration mechanism where you register the handlers that will be called sequentially by your mechanism. Then you'll be sure that only one such dialog is active at all times. You could then block and unblock the mechanism when entering a piece of code that you wouldn't like to disrupt with such dialogs.
Bookmarks