lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Am 09.05.12 18:15, schrieb Michal Kottman:
> On 9 May 2012 13:22, Rob Hoelz <rob@hoelz.ro> wrote:
>> So let's say I wanted to print 'hello' a second after a user
>> clicked a button in a GUI.  I could do something like this:
>>
>>  -- this assumes that the GUI plays nicely with the event loop
>>  button:onclick(function()
>>    ev:sleep(1)
>>    print 'hi'
>>  end)
>>
>> and other events would continue to fire while the button handler is
>> sleeping.
> 
> This should be doable with Qt. The proposed library should provide a
> generic way for other libraries to "register themselves" onto the
> event loop using a "step" function to query/handle a single/few
> events.
> 
> In Qt you would implement this step function using
> QCoreLibrary::processEvents(QEventLoop::AllEvents) to handle GUI
> events and give back control to the event library, so that it could
> process other stuff, such as networking. You can even specify a
> timeout which you are willing to wait, like "spend max 100ms
> processing Qt events" -
> QCoreLibrary::processEvents(QEventLoop::AllEvents, 100).

fwiw, LuaMotif supports Xt and this Timeouts (and all other event types
that X11 supports).  I think I even added a timeuout.lua example on github.

- mb