mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
32 lines
603 B
C++
32 lines
603 B
C++
#include <CtrlLib/CtrlLib.h>
|
|
|
|
using namespace Upp;
|
|
|
|
struct MyAppWindow : TopWindow {
|
|
void Exit() {
|
|
if(PromptOKCancel("Exit MyApp?"))
|
|
Break();
|
|
}
|
|
|
|
void RightDown(Point, dword) override {
|
|
int result = Null;
|
|
MenuBar menu;
|
|
for(int i = 0; i < 10; i++)
|
|
menu.Add(AsString(i), [=, &result] { result = i; });
|
|
menu.Separator();
|
|
menu.Add("Exit", [=] { Exit(); });
|
|
menu.Execute();
|
|
if(!IsNull(result))
|
|
PromptOK("You have selected " + AsString((int)result));
|
|
}
|
|
|
|
MyAppWindow() {
|
|
Title("My application with context menu").Sizeable();
|
|
}
|
|
};
|
|
|
|
GUI_APP_MAIN
|
|
{
|
|
MyAppWindow app;
|
|
app.Run();
|
|
}
|