Discussion:
[Foxgui-users] Question with FOX toolkit
JVZ
2016-12-16 21:44:27 UTC
Permalink
On Fri, 16 Dec 2016 16:22:09 -0500
Hello
While I am performing a database save in my application, I would like to
block all other FOX Toolkit GUI events until the save is complete. I do not
want the User to change anything in the interface while the database write
is occurring. How can I do this, so that it still processes the save but
blocks everything else?
Thanks
Julia
Try runModalFor(), runModalWhile(), or one of these variants.

What runModalFor() does is to enter the event loop, blocking mouse and keyboard
events to windows other than the one passed as the modal window.

Typical use case:

1) Modal dialog box. Block events to windows other than the dialog,
[paint and resize, etc. are passed normally].

2) Doing long computation, during which one occasionally enters the
event loop to process any repaint events. In this case you'd want
to use runModalWhileEvents() which will return after the event queue
is exhausted.

If the computation is to be stopped or cancelled, you can pass the
stop-button as the modal window; this will block keyboard and mouse
events to all but the stop-button.

As a suggestion, every so many loops you could call the runModalWhileEvents()
and proceed with the computation if the user didn't press any button.

Now, of course you can also consider making the application multi-threaded; start a thread
for the long computation and let the GUI thread continue to manage the GUI (possibly using
runModal() if the GUI needs to be "locked out" from doing something else).

This may be better if you don't mind the slightly increased complexity.


Hope these are useful suggestions,




-- JVZ



+----------------------------------------------------------------------------+
| Copyright (C) 15:30 12/16/2016 Jeroen van der Zijp. All Rights Reserved. |
+----------------------------------------------------------------------------+
Loading...