ultimatepp/reference/ArrayCtrlCtrls/main.cpp
cxl 0978c90a4b .reference
git-svn-id: svn://ultimatepp.org/upp/trunk@11351 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2017-10-07 09:49:43 +00:00

35 lines
842 B
C++

#include <CtrlLib/CtrlLib.h>
using namespace Upp;
GUI_APP_MAIN
{
ArrayCtrl list;
list.AddColumn("Trivial").Ctrls<EditString>(); // specify type of widget as template argument
list.AddColumn("Factory").With( // class factory creates widget - allows customization of widget
[](One<Ctrl>& x) {
x.Create<Option>().NoWantFocus();
}
);
list.AddColumn("Lined").WithLined( // passes the row index as the first argument
[](int line, One<Ctrl>& x)
{
if(line & 1)
x.Create<EditString>();
else
x.Create<Option>().SetLabel("Line " + AsString(line));
}
);
for(int i = 0; i < 300; i++)
list.Add(AsString(i), i & 1, AsString(i));
for(int i = 1; i < 300; i += 3)
list.GetCtrl(i, 0)->Disable();
list.SetLineCy(Draw::GetStdFontCy() + DPI(8));
TopWindow app;
app.Add(list.SizePos());
app.Sizeable();
app.Run();
}