Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » image drawing
Re: image drawing [message #26365 is a reply to message #26362] Tue, 27 April 2010 19:19 Go to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

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 Smile

Honza
 
Read Message icon5.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Upp .dll
Next Topic: Void pointer to NTL Array and VectorMap
Goto Forum:
  


Current Time: Wed May 15 18:02:07 CEST 2024

Total time taken to generate the page: 0.02940 seconds