mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 06:05:58 -06:00
CtrlLib, Tutorial: fixed 16.2 tutorial (Layouts - Upp agnostic implementation).
This commit is contained in:
parent
b11938a43c
commit
d670725115
7 changed files with 41 additions and 19 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
using namespace Upp;
|
||||
|
||||
#define LAYOUTFILE <Gui16/dlg.lay>
|
||||
#define LAYOUTFILE <Gui16a/dlg.lay>
|
||||
#include <CtrlCore/lay.h>
|
||||
|
||||
struct MyAppWindow : public WithDlgLayout<TopWindow> {
|
||||
12
tutorial/Gui16b/Gui16b.upp
Normal file
12
tutorial/Gui16b/Gui16b.upp
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
description "Layouts - Upp namespace agnostic\377";
|
||||
|
||||
uses
|
||||
CtrlLib;
|
||||
|
||||
file
|
||||
main.cpp,
|
||||
dlg.lay;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
|
||||
6
tutorial/Gui16b/dlg.lay
Normal file
6
tutorial/Gui16b/dlg.lay
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
LAYOUT(DlgLayout, 208, 64)
|
||||
ITEM(Upp::Label, dv___0, SetLabel(t_("Label")).LeftPosZ(8, 36).TopPosZ(8, 19))
|
||||
ITEM(Upp::EditString, text, LeftPosZ(48, 92).TopPosZ(8, 19))
|
||||
ITEM(Upp::Option, option, SetLabel(t_("Option")).LeftPosZ(8, 108).TopPosZ(32, 15))
|
||||
END_LAYOUT
|
||||
|
||||
15
tutorial/Gui16b/main.cpp
Normal file
15
tutorial/Gui16b/main.cpp
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#include <CtrlLib/CtrlLib.h>
|
||||
|
||||
#define LAYOUTFILE <Gui16b/dlg.lay>
|
||||
#include <CtrlCore/lay.h>
|
||||
|
||||
struct MyAppWindow : public WithDlgLayout<Upp::TopWindow> {
|
||||
MyAppWindow() {
|
||||
CtrlLayout(*this, "MyDialog");
|
||||
}
|
||||
};
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
MyAppWindow().Run();
|
||||
}
|
||||
|
|
@ -928,7 +928,7 @@ is such that it can be directly included into C`+`+:&]
|
|||
[s7; &]
|
||||
[s7; using namespace Upp;&]
|
||||
[s7; &]
|
||||
[s7; [* #define LAYOUTFILE <Gui16/dlg.lay>]&]
|
||||
[s7; [* #define LAYOUTFILE <Gui16a/dlg.lay>]&]
|
||||
[s7; [* #include <CtrlCore/lay.h>]&]
|
||||
[s7; &]
|
||||
[s7; struct MyAppWindow : public [* WithDlgLayout<TopWindow>] `{&]
|
||||
|
|
@ -1004,17 +1004,16 @@ variable name used for unnamed layout members (0 is index of
|
|||
member).]&]
|
||||
[s22;:16`.2: 16.2 Upp namespace agnostic implementation&]
|
||||
[s5; If you prefer to write code that is namespace agnostic, you
|
||||
are not forced to use using namespace Upp in the context of using
|
||||
layouts. Below implementation presents how you can avoid such
|
||||
situation:&]
|
||||
are not forced to use `"using namespace Upp`" in the context
|
||||
of using layouts. Below implementation presents how you could
|
||||
avoid such situation:&]
|
||||
[s0; &]
|
||||
[s7; #include <CtrlLib/CtrlLib.h>&]
|
||||
[s7; &]
|
||||
[s7; #define LAYOUTFILE <Gui16/dlg.lay>&]
|
||||
[s7; #define LAYOUTFILE <Gui16b/dlg.lay>&]
|
||||
[s7; #include <CtrlCore/lay.h>&]
|
||||
[s7; &]
|
||||
[s7; struct MyAppWindow : public Upp`::WithDlgLayout<Upp`::TopWindow>
|
||||
`{&]
|
||||
[s7; struct MyAppWindow : public WithDlgLayout<Upp`::TopWindow> `{&]
|
||||
[s7; -|MyAppWindow() `{&]
|
||||
[s7; -|-|CtrlLayout(`*this, `"MyDialog`");&]
|
||||
[s7; -|`}&]
|
||||
|
|
@ -1024,17 +1023,7 @@ situation:&]
|
|||
[s7; `{&]
|
||||
[s7; -|MyAppWindow().Run();&]
|
||||
[s7; `}&]
|
||||
[s0; &]
|
||||
[s5; Please note that from version 2021.1 of U`+`+ framework surrounding
|
||||
inclusion with namespace is not longer required:&]
|
||||
[s0; &]
|
||||
[s7; namespace Upp `{&]
|
||||
[s7; -|#define LAYOUTFILE <Gui16/dlg.lay>&]
|
||||
[s7; -|#include <CtrlCore/lay.h>&]
|
||||
[s7; `}&]
|
||||
[s0; &]
|
||||
[s5; However, for backward compatibility above construction is still
|
||||
valid.&]
|
||||
[s5; &]
|
||||
[s3;:17: 17. Value of widget&]
|
||||
[s5; Many widgets have some sort of natural value. E.g. the value
|
||||
of [^`:`:EditString^ EditString] is String entered by user, whereas
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue