Home » U++ TheIDE » U++ TheIDE: Layout (Forms) Designer » Is the Layout Designer outdated?
[Solved] Re: Is the Layout Designer outdated? [message #57060 is a reply to message #57059] |
Wed, 19 May 2021 00:25   |
Oblivion
Messages: 1209 Registered: August 2007
|
Senior Contributor |
|
|
Hello MeerMusik,
Quote:
Also what confused me for a while: In the C++ Header File I have to write "LabelBase Label1" but in the Layout File it is just Upp::Label - guess that is Part of the Charme of UPP.
Layout file is just a simple C++ file, there is nothing magical, no special processing, really. Only a couple of C++ macros (to simplify templating, and naming).
This:
struct MyWindow : TopWindow {
Label label1;
MyWindow()
{
Title("Window title").Sizeable().Zoomable().SetRect(0,0,640, 400);
Add(label1. SetLabel(t_("I am a label")).SetInk(Color(226, 42, 0)).LeftPosZ(13, 243).TopPosZ(20, 144));
}
};
İs not different than this:
Layout:
LAYOUT(MyWindowLayout, 640, 400)
ITEM(Upp::Label, Label1, SetLabel(t_("I am a label")).SetInk(Color(226, 42, 0)).LeftPosZ(13, 243).TopPosZ(20, 144))
END_LAYOUT
Cpp:
#define LAYOUTFILE <MyWindow/MyWindow.lay>
#include <CtrlCore/lay.h>
class MyWindow : public WithMyWindowLayout<TopWindow> {
public:
MyWindow()
{
CtrlLayout(*this, "Window title");
}
};
The layout code does the ctrl instantiating for you. That's all. While the latter may seem complex at first glance, it actually simplifies things a lot, if you build complex GUIs. Not to mention it relies on C++ templating rules so the errors will be catched by the c++ compiler on compile-time.
Best regards,
Oblivion
Github page: https://github.com/ismail-yilmaz
upp-components: https://github.com/ismail-yilmaz/upp-components
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[Updated on: Wed, 19 May 2021 00:51] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Fri Jun 06 06:17:43 CEST 2025
Total time taken to generate the page: 0.04610 seconds
|