Re: multi-tasking
- From: Owen Taylor <owt1 cornell edu>
- To: "Brian C. Lane" <nexus tatoosh com>
- Cc: gtk-list redhat com
- Subject: Re: multi-tasking
- Date: 22 Feb 1998 14:23:23 -0500
"Brian C. Lane" <nexus@tatoosh.com> writes:
> I'm new to GTK+ so I apologize if this is covered somewhere. I've
> written a cd player control panel and it works, mostly. The problem I'm
> having is that when the play, FF and REW buttons are pressed I set the
> button's pixmap to its down image and then call the appropriate cdrom
> routine.
>
> The problem is that the new pixmap doesn't get drawn until after the
> cdrom routine is done and the button press event for the button is exited.
> Most of the time the down image doesn't show up at all because you've
> already released the mouse button by the time it is done switching to the
> next track.
Well, you should most likely actually be only setting the down
pixmap in the "button_press_event" callback. The actual triggering
should be on the "clicked" event. (Try fooling around some with
how a button triggers) If you unset your pixmap in the
"button_release_event", then that won't be displayed until your
command finishes, but that may be the right effect.
But as of 0.99.4, you should be able to say, in the beginning
of your "clicked" routine:
while (gtk_events_pending())
gtk_main_iteration();
And everything will be redrawn, if that's what you want.
> Does anyone have a good solution for this? Someone should, since its
> important to have a good user interface and still be able to interact with
> real-world devices.
>
> One though I had was maybe starting a timer when the key is pressed and
> doing the actual cdrom command when the timer goes off (after, say 100mS).
If you actually _want_ a button that triggers when the thing is
pressed. (Say you are implementing the typical CD "scan through
track when >> is held down") then this might be a good thing to do -
you can get autorepeat behavior in the bargain.
Hope this helps,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]