Home » Community » Newbie corner » Switching layout inside class
Re: Switching layout inside class [message #48445 is a reply to message #48443] |
Tue, 04 July 2017 11:36 |
rafiwui
Messages: 105 Registered: June 2017 Location: Stuttgart, Germany
|
Experienced Member |
|
|
Didn't work with the following code:
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
#define LAYOUTFILE <main/layouts.lay>
#include <CtrlCore/lay.h>
class MyWindow : public TopWindow
{
public:
Button button1;
Button button2;
typedef MyWindow CLASSNAME;
MyWindow();
private:
void OnClickButton1();
void OnClickButton2();
};
MyWindow::MyWindow()
{
button1.SetLabel("Button 1").LeftPosZ(10, 100).TopPosZ(20, 30);
button2.SetLabel("Button 2").RightPosZ(10, 100).TopPosZ(20, 30);
button1 << THISBACK(OnClickButton1);
button2 << THISBACK(OnClickButton2);
Add(button1);
Add(button2);
}
void MyWindow::OnClickButton1()
{
Title("Layout 1");
WithTest1<ParentCtrl> layout1;
SetLayout_Test1(layout1, true, true);
}
void MyWindow::OnClickButton2()
{
Title("Layout 2");
WithTest2<ParentCtrl> layout2;
SetLayout_Test2(*this, layout2, true, true);
}
GUI_APP_MAIN
{
MyWindow app;
app.SetRect(0, 0, Zx(250), Zy(70));
app.Run();
}
Do I have to do sth with the layout1? Like layout1.Show()? Or Give it a size?
And which of the two SetLayout... is the correct one to use?
Greetings
Daniel
[Updated on: Tue, 04 July 2017 11:37] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Mon Apr 29 12:48:58 CEST 2024
Total time taken to generate the page: 0.02875 seconds
|