diff --git a/tutorial/Gui16/Gui16.upp b/tutorial/Gui16a/Gui16a.upp similarity index 100% rename from tutorial/Gui16/Gui16.upp rename to tutorial/Gui16a/Gui16a.upp diff --git a/tutorial/Gui16/dlg.lay b/tutorial/Gui16a/dlg.lay similarity index 100% rename from tutorial/Gui16/dlg.lay rename to tutorial/Gui16a/dlg.lay diff --git a/tutorial/Gui16/main.cpp b/tutorial/Gui16a/main.cpp similarity index 86% rename from tutorial/Gui16/main.cpp rename to tutorial/Gui16a/main.cpp index cefa6174a..074c73630 100644 --- a/tutorial/Gui16/main.cpp +++ b/tutorial/Gui16a/main.cpp @@ -2,7 +2,7 @@ using namespace Upp; -#define LAYOUTFILE +#define LAYOUTFILE #include struct MyAppWindow : public WithDlgLayout { diff --git a/tutorial/Gui16b/Gui16b.upp b/tutorial/Gui16b/Gui16b.upp new file mode 100644 index 000000000..5ff05f728 --- /dev/null +++ b/tutorial/Gui16b/Gui16b.upp @@ -0,0 +1,12 @@ +description "Layouts - Upp namespace agnostic\377"; + +uses + CtrlLib; + +file + main.cpp, + dlg.lay; + +mainconfig + "" = "GUI"; + diff --git a/tutorial/Gui16b/dlg.lay b/tutorial/Gui16b/dlg.lay new file mode 100644 index 000000000..7f2429304 --- /dev/null +++ b/tutorial/Gui16b/dlg.lay @@ -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 + diff --git a/tutorial/Gui16b/main.cpp b/tutorial/Gui16b/main.cpp new file mode 100644 index 000000000..8ad7ed2b9 --- /dev/null +++ b/tutorial/Gui16b/main.cpp @@ -0,0 +1,15 @@ +#include + +#define LAYOUTFILE +#include + +struct MyAppWindow : public WithDlgLayout { + MyAppWindow() { + CtrlLayout(*this, "MyDialog"); + } +}; + +GUI_APP_MAIN +{ + MyAppWindow().Run(); +} diff --git a/uppsrc/CtrlLib/srcdoc.tpp/Tutorial_en-us.tpp b/uppsrc/CtrlLib/srcdoc.tpp/Tutorial_en-us.tpp index f987977ab..bd86731e4 100644 --- a/uppsrc/CtrlLib/srcdoc.tpp/Tutorial_en-us.tpp +++ b/uppsrc/CtrlLib/srcdoc.tpp/Tutorial_en-us.tpp @@ -928,7 +928,7 @@ is such that it can be directly included into C`+`+:&] [s7; &] [s7; using namespace Upp;&] [s7; &] -[s7; [* #define LAYOUTFILE ]&] +[s7; [* #define LAYOUTFILE ]&] [s7; [* #include ]&] [s7; &] [s7; struct MyAppWindow : public [* WithDlgLayout] `{&] @@ -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 &] [s7; &] -[s7; #define LAYOUTFILE &] +[s7; #define LAYOUTFILE &] [s7; #include &] [s7; &] -[s7; struct MyAppWindow : public Upp`::WithDlgLayout -`{&] +[s7; struct MyAppWindow : public WithDlgLayout `{&] [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 &] -[s7; -|#include &] -[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