Home » Community » Newbie corner » image drawing
Re: image drawing [message #26365 is a reply to message #26362] |
Tue, 27 April 2010 19:19  |
|
raxvan wrote on Tue, 27 April 2010 17:50 | Can i use safely multiple windows at the same time? (using threads)
How can i fire an event from a thread to another to update the window?
|
Yes, it is possible, actually even without threads. See GUI tutorial, paragraph 6 for description how. Usual approach to keep the GUI responsive is to have one thread handling GUI and a separate one for computations.
For updating the GUI from computation thread, there exist more possible ways. I usually use the dirty but simple one - I store a pointer to the part of GUI I need to update. Following example worked well for me when I needed to report the progress of computation to the user in a LineEdit: thread__ LineEdit* ReportEditPtr;
void Report(String str,bool stamp,bool nl) {
GuiLock __;
(*ReportEditPtr)<<=(~(*ReportEditPtr)).ToString()+
(stamp?FormatTime(GetSysTime(),"hh:mm:ss "):"")+str+(nl?"\n":"");
(*ReportEditPtr).SetCursor((~(*ReportEditPtr)).ToString().GetLength()-1);
(*ReportEditPtr).Refresh(); (*ReportEditPtr).Sync();
}
And in the window constructor: ReportEditPtr=&ReportLineEdit;
Hopefully someone will recommend you some cleaner way 
Honza
|
|
|
 |
 |
image drawing
By: raxvan on Tue, 27 April 2010 08:02
|
 |
|
Re: image drawing
By: koldo on Tue, 27 April 2010 10:05
|
 |
|
Re: image drawing
By: raxvan on Tue, 27 April 2010 10:34
|
 |
|
Re: image drawing
By: koldo on Tue, 27 April 2010 11:32
|
 |
|
Re: image drawing
By: raxvan on Tue, 27 April 2010 13:32
|
 |
|
Re: image drawing
By: koldo on Tue, 27 April 2010 15:49
|
 |
|
Re: image drawing
By: raxvan on Tue, 27 April 2010 15:59
|
 |
|
Re: image drawing
By: koldo on Tue, 27 April 2010 16:12
|
 |
|
Re: image drawing
By: mrjt on Tue, 27 April 2010 16:17
|
 |
|
Re: image drawing
By: raxvan on Tue, 27 April 2010 17:50
|
 |
|
Re: image drawing
By: mrjt on Tue, 27 April 2010 18:01
|
 |
|
Re: image drawing
|
Goto Forum:
Current Time: Mon Apr 28 23:24:15 CEST 2025
Total time taken to generate the page: 0.00475 seconds
|