#ifndef _SplitterBackgroundBug_SplitterBackgroundBug_h
#define _SplitterBackgroundBug_SplitterBackgroundBug_h
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
#define LAYOUTFILE <SplitterBackgroundBug/SplitterBackgroundBug.lay>
#include <CtrlCore/lay.h>
class TopPanel : public WithTopPanelLayout<Ctrl> {
public:
TopPanel();
};
class BottomPanel : public WithBottomPanelLayout<Ctrl> {
public:
BottomPanel();
};
class SplitterBackgroundBug : public TopWindow {
public:
SplitterBackgroundBug();
void ButtonPushed();
private:
TopPanel toppanel;
BottomPanel bottompanel;
Splitter split;
};
#endif
LAYOUT(TopPanelLayout, 292, 28)
ITEM(Upp::Option, myopt, SetLabel(t_("An option")).LeftPosZ(8, 72).TopPosZ(4, 16))
END_LAYOUT
LAYOUT(BottomPanelLayout, 412, 28)
ITEM(Upp::Button, mybutton, SetLabel(t_("Push this")).LeftPosZ(4, 56).TopPosZ(4, 15))
ITEM(Upp::Label, mylabel, SetLabel(t_("This label changes when you push the button")).LeftPosZ(64, 340).TopPosZ(4, 19))
END_LAYOUT
#include "SplitterBackgroundBug.h"
SplitterBackgroundBug::SplitterBackgroundBug()
{
Title("Click the button");
SetRect(0, 0, 400, 200);
Sizeable();
split.Vert();
split.Add(toppanel);
split.Add(bottompanel);
Add(split.SizePos());
bottompanel.mybutton.WhenPush = [this](){ ButtonPushed(); } ; // THISBACK(ButtonPushed); //<- doesn't work for some reason...
}
void SplitterBackgroundBug::ButtonPushed()
{
bottompanel.mylabel.SetText("The button was pushed");
}
TopPanel::TopPanel()
{
CtrlLayout(*this);
}
BottomPanel::BottomPanel()
{
CtrlLayout(*this);
}
GUI_APP_MAIN
{
SplitterBackgroundBug().Run();
}
]]>