Keep menu open after selecting a item - qooxdoo

I need my menu (opened by a menubutton) to stay open after you select an item from the menu. So that you can select more then one items before it closes (by clicking outside of the list)
I couldn't find anything in the api, so i hope you guys know the trick
Another solution would be if you hover over the button, then the menu opens. When you leave the menu with your mouse, the menu would close.

Cross post from the mailing List:
http://qooxdoo.678.n2.nabble.com/Keeping-a-menu-open-after-selecting-an-option-td7580767.html;cid=1345706918184-716
Answer from the list:
In order to keep the menu open after clicks, you need to provide your
own implementation of menu.Button. You can subclass qx.ui.menu.Button,
and then need to overwrite the _onClick method so it doens't call
qx.ui.menu.Manager.hideAll (Have a look on qx.ui.menu.Button source code).
Then, onMouseout of the entire menu, call
qx.ui.menu.Manager.getInstance().hideAll().

Related

Hide the close button on the context-sensitive menu? (XAF)

I want to remove the close button from the context-sensitive menu that appears when I right click a record in list view.
I found instructions how to do it for web forms but I am using Winforms.
I don't want to deactivate the controller because I still need the close button on the main toolbar.
I am wondering whether to move the barContainerClose from the barContainerView
In the template

How know if right click is on a "text being edited" not/before "text changed" event in winforms?

My question might be simple but I couldn't find specific answer on web.
I have a winforms application with a grid inside, in which I have implemented a context menu to be shown on right click on cells. These cells include text elements that can be edited. When user clicks or double clicks on the cell, the text can be edited and that's what I want. The problem is when the text is in edit mode and user right clicks on it again, 2 context menus are shown on each other. One is my context menu and the other is windows right click on text including options like copy, paste etc.
I wonder if there is any event like "text being edited" or "windows default context menu opened" that can be used for such scenarios? Or what is the proper way of solving this problem, which I guess must be a common one.
In these cases I want to show only the windows right-click menu, not mine.
Perhaps you need the Control.GotFocus event: https://msdn.microsoft.com/en-us/library/system.windows.forms.control.gotfocus%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396
You could look for focus, then prevent right clicks in the control until the control has lost focus (Control.LostFocus). If the control gets focus from a right click, then you could open your context menu (I think).

Template for Button with an appended toggleButton (ToggleButton shows context menu on clicking)

How to make a control which has both button and togglebutton/Combobox? on clicking the toggle button i should be able fire a command depends on the selection.
1. I want some templates to achieve this (i.e. On clicking left side of the control, i have to fire Open command and on selecting right side of the control it should open other options ).
2. Also, is there any way to achieve such that i just have to provide various items like "Open", "Show previous versions" and the button takes the first item (in this case "Open")

GtkNotebook: Appending to the Default Popup Menu

Is there a way to append a menu item to the popup menu that appears by default on right-clicking a GtkNotebook's tab (the one that contains the names of all the open tabs)?
As a somewhat gross hack, it might be possible to use gtk_notebook_get_menu_label() to get the GtkLabel in one of the tab's menu items on that menu, and then use parent-walking from there to find the menu.
Possibly this only works when the menu is being realized/shown, you could try adding event handlers on that label to detect that.
On the other hand, user4815162342's suggestion of re-implementing the menu is way easier.
Looking at the source code, it would appear that there is no way to append to the existing menu: the menu is kept in a private structure, and it is popped up directly on button-press event.
You can disable the default menu, connect to button-press event, and popup your own menu.

Show NotifyIcon Context Menu and Control Its Position?

I'm trying to show a context menu when I left-click a NotifyIcon. Just calling NotifyIcon.ContextMenuStrip.Show() doesn't work very well. A solution has been posted here before that calls a secret method using Reflection:
Dim mi As System.Reflection.MethodInfo = GetType(NotifyIcon).GetMethod("ShowContextMenu", Reflection.BindingFlags.Instance Or Reflection.BindingFlags.NonPublic)
mi.Invoke(Icon, Nothing)
This works great, except that I also need to control where the menu is shown. I want to wait for the SystemInformation.DoubleClickTime to elapse between receiving the NotifyIcon.MouseUp event and displaying the menu, so that I can handle single-clicks and double-clicks separately. But invoking the ShowContextMenu method displays the menu at the current mouse position when ShowContextMenu is called, not when the icon was actually clicked. Which means that if the mouse moved during the DoubleClickTime, the menu will be displayed in a different part of the screen. So if I can control where the menu is shown, I can just save the mouse coordinates when I receive the MouseUp event, and then I can ensure that the menu is displayed near the icon. Is there a way to do this?
Thanks in advance.
Well, I just discovered that there are existing programs that exhibit this same behavior. I just went through all the icons in my system tray and about half of them do it. If you left-click the icon and then move the mouse during the delay before the menu appears, the menu will appear at the last mouse location, wherever that is on the screen. Snagit is one application that does this. Outlook is the only program in my tray that always shows the menu where I clicked the icon. But Snagit looks like it's using a .NET ContextMenuStrip, while Outlook is probably using a native menu.
So either this is standard behavior, or it's a problem that no one else has been able to solve either. And as a user, I've never noticed this behavior until yesterday when I was testing my own application. So I guess it's not that big of a deal and I won't worry about it.

Resources