Page 1 of 1
Problem with a Progress bar
Posted: Wed Sep 19, 2007 2:58 am
by Armoured
Hi

How I can update a ProgressBarGadget from inside a thread?
note: The ProgressBarGadget is generated outside the thread
Thanks
Posted: Wed Sep 19, 2007 2:00 pm
by AND51
SetGadgetState() and/or SetGadgetAttribute()... Does also work in a thread here, altough the ProgressBarGadget() has been created outside that thread.
Posted: Thu Sep 20, 2007 5:40 pm
by Armoured
Hi AND51
SetGadgetState() and/or SetGadgetAttribute()... Does also work in a thread here, altough the ProgressBarGadget() has been created outside that thread.
Yes but the window isn't update immediately. I need to change the gadget state and view instantaneously the result in the GUI
Posted: Thu Sep 20, 2007 6:00 pm
by Fred
You can try to flush the events with "while windowevent() : wend"
Posted: Fri Sep 21, 2007 12:17 am
by Armoured
Fred wrote:You can try to flush the events with "while windowevent() : wend"
Thanks Fred and AND51

Posted: Fri Sep 21, 2007 9:39 am
by AND51
Fred wrote:You can try to flush the events with "while windowevent() : wend"
But not inside the thread! The thread cannot use
WindowEvent() to receive events from windows that were not created by it.
In my current project, the main program creates a window and receives the WindowEvents. The thread updates the progressbar periodically with the method I described above.
The main thread, however (and that is the trick), does
not use
WaitWindowEvent(), but
WaitWindowEvent(200), so even if there is no incoming event, the timeout will cause the program to update the progressbar.
Understand?
Happy coding, AND51