Home » U++ Library support » Menus&Toolbars » ToolBar's context menu
Re: ToolBar's context menu [message #15084 is a reply to message #15083] |
Sat, 29 March 2008 11:10   |
Oblivion
Messages: 1206 Registered: August 2007
|
Senior Contributor |
|
|
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.
Github page: https://github.com/ismail-yilmaz
upp-components: https://github.com/ismail-yilmaz/upp-components
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[Updated on: Sat, 29 March 2008 11:14] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Thu May 15 10:23:52 CEST 2025
Total time taken to generate the page: 0.01882 seconds
|