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 » Resizing a GUI object?
Resizing a GUI object? [message #48747] Sun, 10 September 2017 07:31 Go to previous message
ptkacz is currently offline  ptkacz
Messages: 89
Registered: March 2017
Member
Hi Guys,

When we create a U++ APP, a layout is created. For example, if our APP is named SimpleAPP, the layout SimpleAPPLayout gets created.

Within the SimpleApp class header file, the class gets defined as,
class SimpleAPP : public WithSimpleAPPLayout<TopWindow> {...

We might also define some private member variables:
DrawCanvas canvas;
WithButtonLayout<ParentCtrl> buttonPanel;

Within main.cpp, the mail GUI body looks as follows:
GUI_APP_MAIN
{
	SimpleAPP().Run();
}

Within the SimpleAPP constructor, our APP is defined as follows:
SimpleAPP::SimpleAPP()
{
	CtrlLayout(*this, "Simple APP");
	Sizeable();
	canvas.SetRect(100, 0, 600, 500 );

	CtrlLayout(buttonPanel);
	buttonPanel.someButton << THISBACK(doSomething);
	
	Add(buttonPanel);
	Add(canvas);
	BackPaint();	
}


When the APP's window gets resized or maxed, the Paint method of our APP's class gets called (i.e. void Paint(Draw& w)). I can retrieve a layouts size, etc. for example:
Size sz2 = buttonPanel.GetSize();

This can be done for other components (i.e. canvas). The width of the buttonPanel can be accessed as, sz2.cx.

How can one set the size of a widget since a SetSize method does not appear to exist? In this case, it would be liked for the buttonPanel to remain the same size, but have the canvas be resized to fill the remaining space.


Peter




 
Read Message
Read Message
Read Message
Previous Topic: What's the relationship between the U++ GUI and OpenGL?
Next Topic: Using namespace Upp
Goto Forum:
  


Current Time: Wed Apr 24 17:37:55 CEST 2024

Total time taken to generate the page: 0.03073 seconds