Re: How to create a dialog window from a thread?



On 17 Nov 2000, at 17:13, Havoc Pennington wrote:

I mean:

 dialog = gtk_dialog_new ();
 gtk_widget_show (dialog);
 gdk_flush ();

With the main loop running in another thread.


Unfortunenately his didn't work for me.

I haven't tried the code on Linux yet, I will mail the result to the list, 
when I get it done (probably sometime tuesday).

I have made some modifications to the structure of the program, 
and it is now working.
This is what I have done:

The code that listens to the serial port (checkForMessages) is still 
running in its own thread. When a proper message is recieved from 
the port, the thread sets a global variable to indicate that there is a 
new message.

I have added a gtk_idle function, that looks at the global variable. 
When the variable turns TRUE, my serPortMessageHandler 
function is called. This function decides what to do, and one of its 
choices is to emit the signal that creates the dialog window.

The serPortMessageHandler function is not running in it own thread 
anymore.

This design isn't as beautiful as I wanted it to be, but I'll leave it like 
this for now (unless some of you have other suggestions on how to 
solve this).


 - Michael




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]