Hi,

[EMAIL PROTECTED] writes:

>       I have a question regarding concurrent instructions in gtk+. I will use the 
>following example. Consider a program that creates a window using gtk+ and also 
>prints variables to the terminal from which the program was run. Usless program I 
>know, but good for the example. I want to be able interact with the GUI while the 
>numbers are being printed, but I don't know how.

> I was wondering if there was some signal function in GTK+ where a function and an 
>interval were set. Every time of length interval a signal was sent to the program and 
>the associated function was run. I am a native windows programmer and just new to 
>linux, so this was my first idea.

Of course. GTK+ is all about signals and callbacks. The following code
should work:

[construct GUI here]

gtk_timeout_add (1000, print_number, NULL);

gtk_main ();


and would call function print_number() every second.

> I have also done some reading on a function fork(), which created two threads 
>through the program. In theory I think that this might work, but am not sure. Does 
>anyone know?

Using multiple processes is sometimes necessary, but can be avoided for
most apps.

I think you should start by reading the GTK+ tutorial on www.gtk.org. It 
explains signals and callbacks in the first chapters and goes into more 
detail (idle functions, timeouts) somewhere around chapter 18.


Salut, Sven





_______________________________________________
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to