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   |
|
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!
|
|
|
Goto Forum:
Current Time: Thu May 15 18:17:31 CEST 2025
Total time taken to generate the page: 0.03164 seconds
|