#include <CtrlLib/CtrlLib.h> using namespace Upp; class MenuTest : public TopWindow { public: typedef MenuTest CLASSNAME; MenuTest() { ef.WhenEnter = THISBACK(EnterPressed); } void ThisMenu(Bar& bar) { bar.Gap(10); bar.Add(ef.SizePos(), Size(200, 20)); bar.Gap(10); bar.Add("One", THISBACK(Action)); bar.Add("Two", THISBACK(Action)); } void EnterPressed() { //... //some internal work //... //PromptOK(AsString(~ef)); CloseTopCtrls(); // <-- try to close menu here } void RightDown(Point p, dword d) { MenuBar::Execute(THISBACK(ThisMenu)); } void Action() {} EditField ef; }; GUI_APP_MAIN { MenuTest().Run(); }
Report message to a moderator