ultimatepp/uppdev/DropListBug/main.cpp
cxl 8434791866 syncing uppdev
git-svn-id: svn://ultimatepp.org/upp/trunk@1549 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2009-09-04 12:31:01 +00:00

54 lines
963 B
C++

#include <CtrlLib/CtrlLib.h>
using namespace Upp;
#define LAYOUTFILE <DropListBug/DropListBug.lay>
#include <CtrlCore/lay.h>
class DropListBug : public WithDropListBugLayout<TopWindow>
{
private:
char chr;
public:
typedef DropListBug CLASSNAME;
DropListBug()
{
chr = 'a';
CtrlLayout(*this, "Window title");
addButton <<= THISBACK(AddButtonClicked);
removeButton <<= THISBACK(RemoveButtonClicked);
for(int i=0;i<10;i++){
dropList.Add(i,Format("%d",i));
if(((i+1)%3)==0) dropList.AddSeparator();
}
}
void AddButtonClicked()
{
dropList.Add(String().Cat() << chr++);
dropList.SetIndex(dropList.GetCount() - 1);
}
void RemoveButtonClicked()
{
if (dropList.GetCount() == 0)
return;
dropList.Remove(dropList.GetIndex());
}
};
GUI_APP_MAIN
{
DropListBug bug;
bug.Open();
bool quit = false;
while(!quit) {
Sleep(1000);
Ctrl::ProcessEvents(&quit);
}
}