[vtkusers] check for pending tk events
Kevin Wright
krw at viz-solutions.com
Tue Jul 23 13:41:33 EDT 2002
At 12:00 PM 7/23/2002 -0400, you wrote:
>Hi All,
>
>I'm looking for a way to abort a render if a user interacts with the
>window, and the easiest way seems to be for the window's AbortCheck
>method to check if there are any tk events pending.
>
>Is there a way, either in raw tk or within the vtkTkRenderWidget, to
>check if there are events pending? I've searched the tk documentation
>with no luck.
I've never tried this, so I'm not entirely sure it would work, but I think
if you call Tcl_DoOneEvent with flags set to make it only process window
events, and not to wait, if there are no window events present, it will
return 0, otherwise it will process one event and return 1. So something
like this, I think:
if ( Tcl_DoOneEvent ( TCL_DONT_WAIT | TCL_WINDOW_EVENTS ) ) {
// BAIL OUT
}
As long as you don't mind processing the next event on the queue. If you
don't want to do that, then you can actually get a handle to the event
queue itself and work along the linked list looking for certain events, but
I'm afraid I wouldn't be much help with that. Look in tclNotify.c for some
of the code that controls the event queue itself.
Hope that helps,
Kevin.
More information about the vtkusers
mailing list