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 » U++ Library support » U++ Widgets - General questions or Mixed problems » howto best Ctrl Refresh handling w/ MT & very frequent refreshes
Re: howto best Ctrl Refresh handling w/ MT & very frequent refreshes [message #26968 is a reply to message #26964] Tue, 15 June 2010 22:18 Go to previous messageGo to previous message
Sender Ghost is currently offline  Sender Ghost
Messages: 301
Registered: November 2008
Senior Member
Hello, Konstantin.

Another possibility is changing Ctrl class.
You can start with Ctrl::RefreshFrame method(s).
void Ctrl::RefreshFrame(const Rect& r) {
	GuiLock __;
	if (manualRefresh || !IsOpen() || !IsVisible() || r.IsEmpty()) return;

Add switches in private area of Ctrl:
private:
	bool manualRefresh;

in public area:
public:
	bool IsUpdate() const { return manualRefresh; }
	void BeginUpdate() { manualRefresh = true; }
	void EndUpdate() { manualRefresh = false; RefreshFrame(); }

Default value in Ctrl constructor:
Ctrl::Ctrl() {
	GuiLock __;
	manualRefresh = false;


And use in some threading function:
	Array<Ctrl *> ctrls;
	// Adding needed ctrls to update
	// ...
	// Begin updating of ctrls
	for (int i = 0, n = ctrls.GetCount(); i < n; ++i)
		ctrls[i]->BeginUpdate();
	// Changing data
	// ...
	// End updating of ctrls
	for (int i = 0, n = ctrls.GetCount(); i < n; ++i)
		ctrls[i]->EndUpdate();

[Updated on: Wed, 16 June 2010 00:53]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: GtkWidget inside U++
Next Topic: DONE: ColumnList with Ctrl's
Goto Forum:
  


Current Time: Tue May 07 18:12:03 CEST 2024

Total time taken to generate the page: 0.01755 seconds