diff --git a/reference/Cpp11/main.cpp b/reference/Cpp11/main.cpp index d2d544365..0df8730f7 100644 --- a/reference/Cpp11/main.cpp +++ b/reference/Cpp11/main.cpp @@ -5,6 +5,8 @@ using namespace Upp; #define LAYOUTFILE #include +#ifdef CPP_11 + GUI_APP_MAIN { WithMyAppLayout dlg; @@ -22,3 +24,34 @@ GUI_APP_MAIN }; dlg.Execute(); } + +#else + +struct MyApp : WithMyAppLayout { + typedef MyApp CLASSNAME; + + void Add() { + if(list.Find(~number) < 0) + list.Add(~number); + } + void Sel() { + number <<= list.GetKey(); + } + MyApp() { + CtrlLayout(*this, "C++ demo"); + list.NoHeader().AddColumn(); + Vector x; + x << 1 << 2 << 12 << 34 << 15 << 11; + for(int i = 0; i < x.GetCount(); i++) + list.Add(x[i]); + add <<= THISBACK(Add); + list.WhenSel = THISBACK(Sel); + } +}; + +GUI_APP_MAIN +{ + MyApp().Execute();; +} + +#endif