.reference

git-svn-id: svn://ultimatepp.org/upp/trunk@13477 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2019-07-08 08:38:04 +00:00
parent 9e566c05cb
commit 2a728dbdb4
4 changed files with 73 additions and 0 deletions

View file

@ -0,0 +1,7 @@
LAYOUT(MyDlgLayout, 200, 88)
ITEM(Label, dv___0, SetLabel(t_("Text")).LeftPosZ(8, 32).TopPosZ(8, 19))
ITEM(EditString, text, LeftPosZ(44, 152).TopPosZ(8, 19))
ITEM(Option, option, SetLabel(t_("Option")).LeftPosZ(44, 108).TopPosZ(36, 15))
ITEM(Button, ok, SetLabel(t_("OK")).LeftPosZ(132, 64).TopPosZ(60, 24))
END_LAYOUT

View file

@ -0,0 +1,12 @@
description "Using CtrlMapper to edit C++ structure in dialog\377";
uses
CtrlLib;
file
main.cpp,
CtrlMapper.lay;
mainconfig
"" = "GUI";

View file

@ -0,0 +1,7 @@
LAYOUT(CtrlRetrieverLayout, 200, 88)
ITEM(Label, dv___0, SetLabel(t_("Text")).LeftPosZ(8, 32).TopPosZ(8, 19))
ITEM(EditString, text, LeftPosZ(44, 152).TopPosZ(8, 19))
ITEM(Option, option, SetLabel(t_("Option")).LeftPosZ(44, 108).TopPosZ(36, 15))
ITEM(Button, ok, SetLabel(t_("OK")).LeftPosZ(132, 64).TopPosZ(60, 24))
END_LAYOUT

View file

@ -0,0 +1,47 @@
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
#define LAYOUTFILE <CtrlMapper/CtrlMapper.lay>
#include <CtrlCore/lay.h>
struct MyStruct {
String text;
bool option;
};
struct MyDlg : WithMyDlgLayout<TopWindow> {
typedef MyDlg CLASSNAME;
void Map(CtrlMapper& m, MyStruct& s);
MyDlg();
};
MyDlg::MyDlg()
{
CtrlLayoutOK(*this, "My Dialog");
}
void MyDlg::Map(CtrlMapper& m, MyStruct& s)
{
m
(text, s.text)
(option, s.option)
;
}
GUI_APP_MAIN
{
MyStruct data;
data.text = "Some text";
data.option = true;
MyDlg dlg;
dlg.Map(CtrlMapper().ToCtrls(), data);
if(dlg.Run() == IDOK)
dlg.Map(CtrlMapper().ToValues(), data);
PromptOK(String() << "text: [* \1" << data.text << "\1]&"
<< "option: [* " << data.option);
}