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 #51342 is a reply to message #51341] Tue, 12 March 2019 12:50 Go to previous messageGo to previous message
Oblivion is currently offline  Oblivion
Messages: 1209
Registered: August 2007
Senior Contributor
Hello Qwak, and welcome to the U++ forums!


A simple example might be better than describing it (This works on Linux, at the moment I don't have access to Windows)

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

class MenuTest : public TopWindow {
	TrayIcon tray;


public:
	typedef MenuTest CLASSNAME;
	void MainMenu(Bar& bar)
	{
		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!");
	}
	void Func2()
	{
		Exclamation("Meeting menu entry invoked!");
	}
	void Do()
	{
		tray.Icon(CtrlImg::Diskette());
		tray.WhenBar = THISFN(MainMenu);
		tray.Run();
	}
};

GUI_APP_MAIN
{
	MenuTest().Do();
}




Note that this menu bar can also be used as context menu, just pass it to the relevant function.

Best regards,
Oblivion


[Updated on: Tue, 12 March 2019 13:10]

Report message to a moderator

 
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: Sat Jun 07 12:04:23 CEST 2025

Total time taken to generate the page: 0.04063 seconds