XxXxX
March 18th, 2003, 04:42 PM
I'm not sure whether I can describe this problem clearly, here is my best shot.
I had a class say ClassA and a method MethodA. In MethodA, it will spawn several threads to do their work. Within these spawned threads, some progress information will be reported. Now the problem is that my classes works fine in command line env (e.g. if I just print out some message to stdout from spawned threads for reporting progresses) but failed in a GUI env (e.g. reporting by adding text to a text component). Seems the problem is that my code called a gui function (like TextBox.text="xxx") in some other threads than the from the default gui thread.
I remembered reading some material on this, like the gui event handlers runs in a thread and you can't just call a gui method from other threads. You need some special treatment. But I can't remember the source. Could anyone help me?
Thank.
I had a class say ClassA and a method MethodA. In MethodA, it will spawn several threads to do their work. Within these spawned threads, some progress information will be reported. Now the problem is that my classes works fine in command line env (e.g. if I just print out some message to stdout from spawned threads for reporting progresses) but failed in a GUI env (e.g. reporting by adding text to a text component). Seems the problem is that my code called a gui function (like TextBox.text="xxx") in some other threads than the from the default gui thread.
I remembered reading some material on this, like the gui event handlers runs in a thread and you can't just call a gui method from other threads. You need some special treatment. But I can't remember the source. Could anyone help me?
Thank.