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 » Add layouts/ParentCtrl to column list
Re: Add layouts/ParentCtrl to column list [message #48507 is a reply to message #48493] Tue, 11 July 2017 09:35 Go to previous messageGo to previous message
rafiwui is currently offline  rafiwui
Messages: 105
Registered: June 2017
Location: Stuttgart, Germany
Experienced Member
So basically you mean it like this I guess (of course with the array and the list but this is good to show):

LAYOUT(Test1, 250, 70)
	ITEM(Label, dv___0, SetLabel(t_("Layout 1")).SetAlign(ALIGN_CENTER).SetFont(StdFontZ(20).Bold()).LeftPosZ(25, 200).TopPosZ(10, 50))
END_LAYOUT

LAYOUT(Test2, 250, 70)
	ITEM(Label, dv___0, SetLabel(t_("Layout 2")).SetAlign(ALIGN_CENTER).SetFont(StdFontZ(20).Bold()).LeftPosZ(25, 200).TopPosZ(10, 50))
END_LAYOUT

LAYOUT(MainLayout, 400, 200)
	ITEM(StaticRect, viewport, LeftPosZ(50, 300).TopPosZ(30, 100))
	ITEM(Button, button1, SetLabel(t_("Layout 1")).LeftPosZ(100, 75).TopPosZ(150, 30))
	ITEM(Button, button2, SetLabel(t_("Layout 2")).RightPosZ(100, 75).TopPosZ(150, 30))
END_LAYOUT


#include <CtrlLib/CtrlLib.h>
using namespace Upp;

#define LAYOUTFILE <main/layouts.lay>
#include <CtrlCore/lay.h>

class MyWindow : public WithMainLayout<TopWindow>
{
public:
	WithTest1<ParentCtrl> layout1;
	WithTest2<ParentCtrl> layout2;
	
	typedef MyWindow CLASSNAME;
	MyWindow();
	
private:
	void OnClickButton1();
	void OnClickButton2();
};

MyWindow::MyWindow()
{
	CtrlLayout(layout1);
	CtrlLayout(layout2);
	layout1.Hide();
	layout2.Hide();
	viewport.Add(layout1);
	viewport.Add(layout2);
	layout1.SizePos();
	layout2.SizePos();
	
	button1 << THISBACK(OnClickButton1);
	button2 << THISBACK(OnClickButton2);
}

void MyWindow::OnClickButton1()
{
	Title("Layout 1");
	layout1.Show();
	layout2.Hide();
}

void MyWindow::OnClickButton2()
{
	Title("Layout 2");
	layout1.Hide();
	layout2.Show();
}

GUI_APP_MAIN
{
	MyWindow app;
	CtrlLayout(app);
	app.SetRect(0, 0, Zx(400), Zy(200));
	app.Run();
}


But this does not work because the layouts are not centered/filling the StaticRect completely.
Can you tell me why and/or how to achieve this?


Greetings
Daniel
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: [BUG] Patch to Switch.cpp to support touch screens
Next Topic: [Closed] Get size and position of widget
Goto Forum:
  


Current Time: Thu Aug 14 08:05:42 CEST 2025

Total time taken to generate the page: 0.08402 seconds