Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Menus&Toolbars » Close context menu from within Execute() handler
Re: Close context menu from within Execute() handler [message #25421 is a reply to message #25347] Mon, 22 February 2010 15:36 Go to previous messageGo to previous message
gxl117 is currently offline  gxl117
Messages: 71
Registered: March 2009
Location: China
Member
The following example is normal.
#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();
}
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Bigger images/icons in menu
Next Topic: Popup menu on button click
Goto Forum:
  


Current Time: Fri Jun 07 12:08:31 CEST 2024

Total time taken to generate the page: 0.01310 seconds