Let's say the user of a wxPython-based app is traversing a list control,
grid or what-have-you with DOWN ARROW, and the keyboard repeat rate is
faster than the background work associated with each change in
position. In my case, the background work is displaying a preview of a
large image.
I think what I want to do is peek at the future events list and if I see
additional movement events (arrow keys, for example), skip the
background work (e.g., the image preview). In this way, the user could
traverse as quickly as their keyboard repeat rate is set.
Has anyone done anything like this? Is there a recommended approach?
None of the documented wxEvtHandler methods looked useful for this
purpose.
···
--
Chuck
http://ChuckEsterbrook.com
Hi,
I had a similar problem but inverted: I wanted to make sure that every page was displayed. I did this by setting a flag in an OnChar() handler when the drawing was complete for a page down, say. This flag was reset only in OnPaint(). And the page down handler only did something if the flag was reset. So new a page was drawn only when there was a key press and the last page had been displayed.
In your case it seems you could do something similar. For example, the wxTreeCtrl has a EVT_TREE_KEY_DOWN event which you could trap and set an indicator. In your background task you could check this indicator and if set, stop and reset it. I don't understand how you are doing this background image creation, but each time it is entered it will continue only if this indicator is not set.
Does that help?
-Rick King
Southfield MI
Let's say the user of a wxPython-based app is traversing a list control,
grid or what-have-you with DOWN ARROW, and the keyboard repeat rate is
faster than the background work associated with each change in
position. In my case, the background work is displaying a preview of a
large image.
I think what I want to do is peek at the future events list and if I see
additional movement events (arrow keys, for example), skip the
background work (e.g., the image preview). In this way, the user could
traverse as quickly as their keyboard repeat rate is set.
No because my background task is a fairly atomic chunk of work: PIL
resizes the image (using a rather slow, but high quality algorithm) and
then I convert to a wx.Bitmap and display.
Hmmm, maybe I can break up those three as you describe and combined with
the delay technique, get what I need.
So maybe it helps after all. Thanks.
Peeking at the events would still be useful.
···
On Tuesday 08 April 2003 02:30 pm, Rick King wrote:
In your case it seems you could do something similar. For example,
the wxTreeCtrl has a EVT_TREE_KEY_DOWN event which you could trap
and set an indicator. In your background task you could check this
indicator and if set, stop and reset it. I don't understand how you
are doing this background image creation, but each time it is entered
it will continue only if this indicator is not set.
Does that help?
--
Chuck
http://ChuckEsterbrook.com