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 » Layout call procedure buggy for invisible controls?
Layout call procedure buggy for invisible controls? [message #28970] Wed, 29 September 2010 17:41 Go to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
hi all,

i have a hierarchy of Ctrl's which is pretty huge...500+ controls of different types...arbitrary grouped, tree depth is up to 10..
a huge one...

i noticed that when i resize the container, which has them all, is it ofcorse is slowly relayouting, which is understandable.

BUT: when the container, beeing part of ExpanderCtrl, is collapsed, and made invisible, and i still resize the Splitter it is part of, the whole relayouting is still slow as before, though nothing is visible..

i encountered, that SyncLayout is called fully recursively on the whole tree, even if it is invisible..

is there any way to optimize that? or am i doing sth wrong in terms of using the api of upp ctrls?

just a remarker where it is at:
CtrlPos.cpp:162
void Ctrl::SyncLayout(int force)
{
	GuiLock __;
	LLOG("SyncLayout " << Name() << " size: " << GetSize());
	bool refresh = false;
	Rect oview = GetView();
	Rect view = GetRect().Size();
	overpaint = OverPaint();
	for(int i = 0; i < frame.GetCount(); i++) {
		Frame& f = frame[i];
		f.frame->FrameLayout(view);
		if(view != f.view) {
			f.view = view;
			refresh = true;
		}
		int q = f.frame->OverPaint();
		if(q > overpaint) overpaint = q;
	}
	if(oview.Size() != view.Size() || force > 1) {
		for(Ctrl *q = GetFirstChild(); q; q = q->next) {
			q->rect = q->CalcRect(rect, view);
			LLOG("Layout set rect " << q->Name() << " " << q->rect);
			q->SyncLayout(force > 1 ? force : 0);
		}
		Refresh();
	}
	if(oview != view || force) {
		State(LAYOUTPOS);
		Layout();
	}
	if(refresh)
		RefreshFrame();
}

Re: Layout call procedure buggy for invisible controls? [message #29272 is a reply to message #28970] Wed, 13 October 2010 19:50 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
kohait00 wrote on Wed, 29 September 2010 11:41

i encountered, that SyncLayout is called fully recursively on the whole tree, even if it is invisible..

is there any way to optimize that? or am i doing sth wrong in terms of using the api of upp ctrls?



I do not think this is a good idea - widgets can do a lot of processing even if they are not visible. They might expect to be placed correctly...
Re: Layout call procedure buggy for invisible controls? [message #29281 is a reply to message #29272] Wed, 13 October 2010 22:00 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
so this behaviour is by design Smile
just wanted to know..

any hints on what i can do better to improve performance?
maybe restructure tree? from deep tree to flat tree?
Re: Layout call procedure buggy for invisible controls? [message #29313 is a reply to message #29281] Fri, 15 October 2010 11:13 Go to previous message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
I have made a modification to ExpanderFrame that might help you. Instead of just making it's client Ctrl invisible when it's closed it now fully removes it, preventing layout.

My (limited) testing hasn't found any problems and it's a relatively simple change but I would advise some testing.

Hope it helps.
Previous Topic: .t files failure
Next Topic: How can I detect Button press / release
Goto Forum:
  


Current Time: Fri Mar 29 00:40:30 CET 2024

Total time taken to generate the page: 0.00982 seconds