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 » Community » Newbie corner » Submenu Clickable
Re: Submenu Clickable [message #51344 is a reply to message #51343] Tue, 12 March 2019 14:53 Go to previous messageGo to previous message
Oblivion is currently offline  Oblivion
Messages: 1093
Registered: August 2007
Senior Contributor
Quote:
What i want to do is :


I see. AFAIK, there is no direct way to achieve that. It maybe possible with some workaround but I never tried such a thing. Smile


But what is the point of it anyway?

On the other hand, if you need to alternate between a menu item and a sub menu, for example a "pause" submenu and a clickable "continue" menu item, you can achieve that easily. (If this is what you want to achieve.)
#include <CtrlLib/CtrlLib.h>

using namespace Upp;

class MenuTest : public TopWindow {
	TrayIcon tray;
	bool     paused;

public:
	typedef MenuTest CLASSNAME;
	
	MenuTest()
	{
		paused = false;
	}
	void MainMenu(Bar& bar)
	{
		if(paused)	bar.Add("Continue", [&] { paused = false; });
		else bar.Sub("Pause", THISFN(PauseMenu));
		bar.Separator();
		bar.Add("Exit", [&]{ tray.Break(); });
	}
	void PauseMenu(Bar& bar)
	{
        bar.Add("Pause", THISFN(Func1));
        bar.Add("RĂ©union", THISFN(Func2));
	}
	void Func1()
	{
		PromptOK("Pause menu entry invoked!");
		paused = true;
	}
	void Func2()
	{
		Exclamation("Meeting menu entry invoked!");
		paused = true;
	}
	void Do()
	{
		tray.Icon(CtrlImg::Diskette());
		tray.WhenBar = THISFN(MainMenu);
		tray.Run();
	}
};

GUI_APP_MAIN
{
	MenuTest().Do();
}


Best regards,
Oblivion


 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [solved] Is it an encoding problem ?
Next Topic: Confusion about where to start or what to use
Goto Forum:
  


Current Time: Fri May 10 05:01:31 CEST 2024

Total time taken to generate the page: 0.02361 seconds