Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site











SourceForge.net Logo

IdCtrls

 

Demonstrates IdCtrls utility class to match widgets with keys (in JSON here)

 

 

main.cpp

 

#include <CtrlLib/CtrlLib.h>

 

using namespace Upp;

 

#define LAYOUTFILE <IdCtrls/IdCtrls.lay>

#include <CtrlCore/lay.h>

 

struct Dialog : WithDialogLayout<TopWindow> {

    typedef Dialog CLASSNAME;

    

    IdCtrls ctrls;

    

    Dialog();

};

 

Dialog::Dialog()

{

    CtrlLayout(*this, "Dialog");

 

    ctrls

        ("FIRSTNAME", firstname)

        ("LASTNAME", lastname)

        ("YEAR", year)

    ;

}

 

GUI_APP_MAIN

{

    ValueMap m;

    LoadFromJsonFile(m);

    Dialog dlg;

    dlg.ctrls.Set(m);

    dlg.Execute();

    StoreAsJsonFile(dlg.ctrls.Get());

}

 

 

 

IdCtrls.lay

 

LAYOUT(DialogLayout, 204, 88)

    ITEM(Label, dv___0, SetLabel(t_("First name")).LeftPosZ(8, 68).TopPosZ(8, 21))

    ITEM(EditString, firstname, LeftPosZ(80, 116).TopPosZ(8, 19))

    ITEM(Label, dv___2, SetLabel(t_("Last name")).LeftPosZ(8, 68).TopPosZ(32, 21))

    ITEM(EditString, lastname, LeftPosZ(80, 116).TopPosZ(32, 19))

    ITEM(Label, dv___4, SetLabel(t_("Year of birth")).LeftPosZ(8, 68).TopPosZ(56, 21))

    ITEM(EditInt, year, LeftPosZ(80, 40).TopPosZ(56, 19))

END_LAYOUT

 

 

 

 

 

Do you want to contribute?