Home » U++ Library support » U++ Widgets - General questions or Mixed problems » Add layouts/ParentCtrl to column list
Add layouts/ParentCtrl to column list [message #48487] |
Fri, 07 July 2017 10:51 |
rafiwui
Messages: 105 Registered: June 2017 Location: Stuttgart, Germany
|
Experienced Member |
|
|
I want to make a selection screen where you can select different "pages" of my app.
I tried to add my WithTestLayout<ParentCtrl> members to the column list like this:
ColumnList columnList;
WithTestLayout<ParentCtrl> layout;
columnList.Add(layout);
The compiler then tells me that he can't convert WithTestLayout<ParentCtrl> to const Upp::Value& (I guessed that before compiling but better try)
So my question is: Is there a way to achieve this or do I have to write my own ParentCtrlList?
Greetings
Daniel
Greetings
Daniel
|
|
|
|
Re: Add layouts/ParentCtrl to column list [message #48507 is a reply to message #48493] |
Tue, 11 July 2017 09:35 |
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
|
|
|
|
Goto Forum:
Current Time: Fri Apr 26 21:39:31 CEST 2024
Total time taken to generate the page: 0.02452 seconds
|