On 8/24/07, Mario <[EMAIL PROTECTED]> wrote:
> I'd like to stop the execution of my program for some seconds, allowing
> the user to read a message.
> If nothing happens during this time, the program just waits n seconds
> and then goes on, but if the user want to speed things, he may just
> touch a key or move the mouse.
>
> Is it possible to do this with wxLua ?
>
> I found the function wxSleep()
> It stops the program execution, "Sleeps", for the specified number of
> seconds.
> But you cannot speed things by touching a key or the mouse.

Here's a few code snippits that should get you on the right path. I
don't believe that ShowModal() will work since that usually means that
a new event loop is created, but you should try it. You may also
simulate the behavior below using a wxTimer, which is probably a
better way.

tracker_var = false
MyDialog = wx.wxDialog(...)
myDialog:Connect(ID_OK, wx.wxEVT_LEFT_DOWN,
    function(event) tracker_var = true end)
myDialog:Show()

for i = 1, 20 do
    wx.wxMilliSleep(500)
    wx.wxYield()
    if tracker_var == true then break end
end

dialog:Destroy()

Hope this helps,
    John Labenski

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to