From 5e9d0fdebe68b406b8f3af22b8387f8f6837707c Mon Sep 17 00:00:00 2001 From: cxl Date: Thu, 14 May 2009 06:36:59 +0000 Subject: [PATCH] reference: DropGrid example git-svn-id: svn://ultimatepp.org/upp/trunk@1170 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- reference/DropGridExample/DropGridExample.upp | 11 ++++ reference/DropGridExample/init | 4 ++ reference/DropGridExample/main.cpp | 50 +++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 reference/DropGridExample/DropGridExample.upp create mode 100644 reference/DropGridExample/init create mode 100644 reference/DropGridExample/main.cpp diff --git a/reference/DropGridExample/DropGridExample.upp b/reference/DropGridExample/DropGridExample.upp new file mode 100644 index 000000000..f88939c4c --- /dev/null +++ b/reference/DropGridExample/DropGridExample.upp @@ -0,0 +1,11 @@ +description "DropGrid examples\377"; + +uses + DropGrid; + +file + main.cpp; + +mainconfig + "" = "GUI"; + diff --git a/reference/DropGridExample/init b/reference/DropGridExample/init new file mode 100644 index 000000000..0ef26dcce --- /dev/null +++ b/reference/DropGridExample/init @@ -0,0 +1,4 @@ +#ifndef _DropGridExample_icpp_init_stub +#define _DropGridExample_icpp_init_stub +#include "DropGrid/init" +#endif diff --git a/reference/DropGridExample/main.cpp b/reference/DropGridExample/main.cpp new file mode 100644 index 000000000..e80910876 --- /dev/null +++ b/reference/DropGridExample/main.cpp @@ -0,0 +1,50 @@ +#include + +using namespace Upp; + +struct App : public TopWindow { + DropGrid drop; + + void Person() { PromptOK("Person!"); } + void Client() { PromptOK("Client!"); } + void Select() { PromptOK("Select!"); } + void List() { PromptOK(AsString(drop.GetKey())); } + + App() + { + Sizeable().Zoomable(); + SetRect(Size(600, 100)); + Title("DropGrid"); + + drop.ClearButton(); + drop.AddPlus(THISBACK(Action)); + + Add(drop.LeftPosZ(20, 350).TopPosZ(20, 19)); + + drop.AddColumn("ID"); + drop.AddColumn("Value"); + drop.AddColumn("Description"); + + drop.AddText("Add person", THISBACK(Person)); + drop.AddText("Add client", THISBACK(Client)).Left().SetImage(GridImg::Append()); + drop.AddSelect(THISBACK(Select)).Left(); + + for(int i = 0; i < 20; i++) + drop.Add(i, Format("Hello %d", i), Format("How are you mr Hello %d", i)); + + drop.Width(300); + drop.DisplayAll(0); + drop.ColorRows(); + drop.SetDropLines(15); + drop.SetValueColumn(1); + drop.AddValueColumn(0).AddValueColumn(1); + drop <<= THISBACK(List); + } + + typedef App CLASSNAME; +}; + +GUI_APP_MAIN +{ + App().Run(); +}