Matthew Gregory schrieb: > Thanks Fabian, > I should have mentioned we thought of this but didn't like the idea. > Using the example that a checkbox would disable a button when it was > checked, if the timer was set to 1 second a user could easily click the > checkbox and the button quickly afterwards before our timer fires. > > Any other ideas or thoughts on the method outlined below? > Maybe the "useraction" event is what you want:
qx.event.Registration.addListener(window, "useraction", callback); we fire it on the document.window after all event handler of a user action are called. User actions include all mouse and keyboard events. Then you could start a timer with timeout 0 in the user event callback to get your "idle" event. Hope this helps, Fabian > Fabian Jakobs wrote: > >> Hi Matthew, >> >>> Hi All, >>> Is there some kind of onIdle event available in qooxdoo 0.8? We are >>> working on quite a large application and mainly coming from a C++ >>> background. With Borland's VCL there was an onIdle event that you could >>> hook into and was ideal for enabling/disabling controls depending on an >>> application's state. >>> >>> >> No there is no such thing as an explicit idle event in qooxdoo but you >> can just use JavaScript timers. Since JavaScript is guaranteed to be >> single threaded the timer's callback will always fire after the >> currently running JavaScript code has returned the control to the >> browser. You can for example use the "interval" event of an instance of >> qx.event.Timer [1] as idle event. This will never interrupt any running >> JavaScript. No need to write a custom event dispatcher. >> >> Best Fabian >> >> [1] <http://demo.qooxdoo.org/devel/apiviewer/#qx.event.Timer> >> >>> If not, this is the best solution we could come up with after looking at >>> the source code: >>> * Create a class that implements qx.event.IDispatcher (more than likely >>> this would also be a singleton) >>> * Register this in qx.event.Registration.addDispatcher with a high priority >>> * qx.event.Manager will call our canDispatchEvent method for every >>> (correct?) event fired >>> * For all events that can change the 'state' of our application, e.g. >>> click and and key press we do something along the lines of the following >>> but always return false >>> killTimeout(this.timer); >>> this.timer = setTimeout(... , 0); >>> * Once all events have been handled our last time-out will fire once, >>> when the browser becomes 'idle' >>> * The timeout then dispatches an 'idle' event to all widgets that are >>> interested. >>> >>> That's the plan. The idea is then we can add an event listener for this >>> 'idle' function whenever we need it. The code inside these handlers will >>> be quick, simple things such as enabling a control as long as checkbox >>> is ticked. >>> >>> What are peoples thoughts on this? >>> >>> >> >> > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > qooxdoo-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel > > > -- Fabian Jakobs JavaScript Framework Developer 1&1 Internet AG Brauerstraße 48 76135 Karlsruhe Amtsgericht Montabaur HRB 6484 Vorstand: Henning Ahlert, Ralph Dommermuth, Matthias Ehrlich, Thomas Gottschlich, Matthias Greve, Robert Hoffmann, Markus Huhn, Oliver Mauss, Achim Weiss Aufsichtsratsvorsitzender: Michael Scheeren ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ qooxdoo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
