Window.hasmessages
From codeTank
Contents |
Description
window.hasmessages is used to determine if any messages are pending inside the message queue. If messages are pending, it is a good idea to call window.pumpmessages in order to pump the messages out of the queue, and to the appropriate event handlers.
window.hasmessages will return immediately, and will not wait around for messages to happen. This is in contrast to window.pumpmessages, which will wait around for a message if none exist.
Arguments
No arguments.
Returns
window.hasmessages will return either true or false immediately, without blocking.
Example
wnd = window.create{ onpaint = function(wnd, pnt) pnt:circle(math.random(0, wnd.width), math.random(0, wnd.height), math.random(0, 100), false, rgb(math.random(255))) end, } while window.getcount() > 0 do if (window.hasmessages()) then window.pumpmessages() else syncframe(0.01) wnd:invalidate(false) end end

