How to prevent UI updates interfering with user's actions?
Carsten A. Arnholm
arnholm at offline.no
Wed Jun 13 14:06:36 PDT 2007
Hello,
I am using wxWidgets 2.8.4 (Ansi) on Windows XP and Linux Kubuntu 7.04.
Using VS2005 Express C++ compiler on Windows and GCC on Linux.
I am working on an application that controls a webcam, and I am having some
issues with the dialog shown here:
<http://www.arnholm.org/tmp/camera_properties.jpg> . The dialog is derived
from wxPropertySheetDialog and each tab is derived from wxPanel.
The dialog allows the user to change typical camera properties: Brightness,
Gamma, Gain etc. using various controls such as sliders, radio boxes and
more. This works ok and the camera display responds as it should.
However, the camera properties are "volatile", they can change without the
user using the controls shown (I don't go into the details about why here,
but there are real reasons why it happens). It is therefore needed to
frequently update the controls to reflect the actual state of the camera
properties. I have also written required code to do this. Currently this is
triggered using a timer in the active tab, every second or so the timer
fires an event and the controls are updated by reading from the camera.
The problem is that when the user tries to drag a slider, this gets
overridden by the timer event slider update. At one stage I thought I could
avoid this by SetFocus/KillFocus events and block the timer updating the
controls when the user was busy doing it, but now I can't seem to get
SetFocus/KillFocus events to work at all.
I wonder what I am doing wrong here. I have tried removing the timer and
using idle processing instead, but that seems even more aggressive.
In summary: How can I update the controls from within the program without
interfering with the user when he/she is updating something?
I hope this is clear enough and would appreciate any suggestions....
Thanks
Carsten A. Arnholm
http://arnholm.org/
N59.776 E10.457
More information about the wx-users
mailing list