Re: How do I use the Event driven system to...
- From: Peter Krueger <pkrueger appss de>
- To: Douglas Phillipson <dougp intermind net>
- Cc: "gtk-app-devel-list gnome org" <gtk-app-devel-list gnome org>
- Subject: Re: How do I use the Event driven system to...
- Date: Sun, 29 Feb 2004 09:55:27 +0100 (MET)
On Sat, 28 Feb 2004, Douglas Phillipson wrote:
Ive gotten to know and use GTK pretty well so far, but I haven't seen
how to do things that aren't event driven. For example, how would one
monitor the serial port or uSB port for incomming data to display on the
graphics area as it comes in. Can I somehow attach a GTK event to the
serial port and get dropped in a callback routine to grab data when I
see a byte? I don't need to know how to monitor the serial port, I can
do that already but if GTK sits in an event loop, how do you get input
from non GTK stuff to use and display with GTK?
Hello Douglas,
in our applications we use our own main loop to process different things.
Part of this mainloop is to process GTK events. We do this with the
command:
while (gtk_events_pending()) gtk_main_iteration();
This processes all pending events and doesn't block your mainloop if there
shouldn't be any GTK events to process.
Another approach would be the use of an idle function in combination with
gtk_main(). See g_idle_add().
In both approaches your program is able to regularly check the serial port
for new data.
Regards,
Peter
--
====================================================================
Peter Krüger
applied software solutions (appss) GmbH
Sandtorstr. 23
D-39106 Magdeburg
Germany
Phone: +49-(0)391-54486-19388
Fax: +49-(0)391-54486-19222
email: krueger appss de
URL: http://www.appss.de
Managing Director: Uwe Hess, Dietmar Schäfer
Register: HRB12386, AG Mageburg
"Virtual business becomes reality!"
This e-mail may contain confidential and/or privileged information. If
you are not the intended recipient (or have received this e-mail in
error) please notify the sender immediately and destroy this e-mail. Any
unauthorised copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.
====================================================================
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]