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 » ToolBar's context menu
Re: ToolBar's context menu [message #26933 is a reply to message #15084] Thu, 10 June 2010 16:22 Go to previous messageGo to previous message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

Oblivion wrote on Sat, 29 March 2008 12:10

Quote:


How to get a context menu of toolbar by right-clicking on it? Like in OperaAC toolbars, for example.



Well there are at least 3 ways:
1: If you want to activate the context menu with right-button down in the empty area of the Bar, just override ChildFrameEvent() method BUT don't use "child" pointer, instead use child->GetParent();

2: Better Way: If you want to activate context menu even when the tool buttons are pressed with the rigth buttons (or if you want to assign different context menus to tool buttons, use:

void BarContext::ChildMouseEvent(Ctrl *child, int event, Point p, int zdelta, dword keyflags)
{
	if(toolbar.HasChildDeep(child)) // Effects tool buttons too... (just specify which button, then you'll get different menus for each button)
	{
		if(event == RIGHTDOWN) MenuBar::Execute(THISBACK(SetMenuBar));
	}
	TopWindow::ChildMouseEvent(child, event, p, zdelta, keyflags);
}



3: Derive your class from ToolBar, then override ChildMouseEvent (imho, unnecessary)

Here is the example.






Your method did not work for toolbutton!
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Popup menu on button click
Next Topic: ToolButton: Label Patch!
Goto Forum:
  


Current Time: Sun Jun 16 11:52:03 CEST 2024

Total time taken to generate the page: 0.01625 seconds