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++ Core » Init a ctrl inside INITBLOCK
Re: Init a ctrl inside INITBLOCK [message #35108 is a reply to message #35107] Thu, 12 January 2012 15:50 Go to previous messageGo to previous message
koldo is currently offline  koldo
Messages: 3361
Registered: August 2008
Senior Veteran
Hello Honza

I have successfully applied this:
Quote:

Safe solution should be to just make the RegisterExample() store the list of things to be initialized into some container. The actual initialization can then by done by separate function called in GUI_APP_MAIN or in the constructor of the application window.


Now code is like this:

struct MyExample : ParentCtrl {
	virtual void Init() = 0;
};

struct Tab1 : WithTab1<MyExample> {
	Tab1() {...}		// No GUI here
	virtual void Init() {
		CtrlLayout(*this);	
		...		// GUI here
	}
...
}

INITBLOCK {
	RegisterExample("Basic", new Tab1);
}

...

GUI_APP_MAIN
{
	for (int i = 0; i < Examples().GetCount(); ++i)
		Examples()[i].ctrl->Init();	// GUI loaded here

	ScatterCtrl_Demo().Run();
}


Best regards
IƱaki
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Date& operator++
Next Topic: random functions proposal
Goto Forum:
  


Current Time: Thu May 09 13:05:37 CEST 2024

Total time taken to generate the page: 0.02762 seconds