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 » How to get an "OnParentOpen" in a control
Re: How to get an "OnParentOpen" in a control [message #24120 is a reply to message #24105] Sun, 27 December 2009 16:25 Go to previous messageGo to previous message
koldo is currently offline  koldo
Messages: 3365
Registered: August 2008
Senior Veteran
dolik.rce wrote on Sat, 26 December 2009 23:42

Hi Koldo

I believe that Mirek meant virtual function Ctrl::Layout() which is called everytime when layout is computed, i.e. when resizing or when ctrl is created. If you overwrite it and put in your code it will be called once everytime you need it Wink At least I believe that is what you need...

Best regards,
Honza


Thank you Honza

It works, but not perfectly... see:

This is to put a control as the first child
bool SetFirstChild(Ctrl *ctrl) {
	if (Ctrl *p = ctrl->GetParent()) {
		if (p->GetFirstChild() != ctrl) {
			p->RemoveChild(ctrl);
			p->AddChildBefore(ctrl, p->GetFirstChild());
		}
		return true;
	} else
		return false;
}


The goal is to set the control as the first child (to be the window background) and to fill all the window size:

This works:
void StaticImage::Paint(Draw& w) {
...
	SetFirstChild(this);
	SizePos();


This fills the background but the control is not the first child:
void StaticImage::Layout() {
	static bool resized = false;

	if (!resized) 
		resized = SetFirstChild((Ctrl *)this);
	SizePos();
	Ctrl::Layout();
}


With this the program gets hanged:
void StaticImage::Layout() {
	SetFirstChild((Ctrl *)this);
	SizePos();
	Ctrl::Layout();
}


Best regards
Koldo


Best regards
IƱaki
 
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: How to mix use widgets and win32 window in u++?
Next Topic: Additon to SliderCtrl: Jump
Goto Forum:
  


Current Time: Sat May 18 04:09:52 CEST 2024

Total time taken to generate the page: 0.02276 seconds