contextmenu

How to add a separator to a WinForms ContextMenu?

流过昼夜 提交于 2019-11-30 04:08:27
Inside my control, I have: ContextMenu = new ContextMenu(); ContextMenu.MenuItems.Add(new MenuItem("&Add Item", onAddSpeaker)); ContextMenu.MenuItems.Add(new MenuItem("&Edit Item", onEditSpeaker)); ContextMenu.MenuItems.Add(new MenuItem("&Delete Item", onDeleteSpeaker)); ContextMenu.MenuItems.Add( ??? ); ContextMenu.MenuItems.Add(new MenuItem("Cancel")); How to add a separation line to this ContextMenu? I believe it's just a dash: ContextMenu.MenuItems.Add("-"); This works just as well as the dash, and i suspect the Winforms will translate the dash to a ToolStripSeparator. I for one think this

Implementing a dynamic ContextMenu for a Primefaces multi-select Datatable

喜欢而已 提交于 2019-11-30 04:01:53
问题 I have a paged PrimeFaces Datatable with a context menu, and i wish to implement multi-select, where the menu items in the context menu will depend on the number of items selected, as some actions will only be available when only one item is selected, and others will valid when one or more are selected. My first idea was to use the "rendered" option of individual menu items, which is set in the controller bean. This sort-of works, as indeed the correct menu items were displayed. The problem

How to set CommandTarget for MenuItem inside a ContextMenu?

佐手、 提交于 2019-11-30 02:11:29
(This question is related to another one , but different enough that I think it warrants placement here.) Here's a (heavily snipped) Window : <Window x:Class="Gmd.TimeTracker2.TimeTrackerMainForm" xmlns:local="clr-namespace:Gmd.TimeTracker2" xmlns:localcommands="clr-namespace:Gmd.TimeTracker2.Commands" x:Name="This" DataContext="{Binding ElementName=This}"> <Window.CommandBindings> <CommandBinding Command="localcommands:TaskCommands.ViewTaskProperties" Executed="HandleViewTaskProperties" CanExecute="CanViewTaskPropertiesExecute" /> </Window.CommandBindings> <DockPanel> <!-- snip stuff -->

WPF - how to hide menu item if command's CanExecute is false?

最后都变了- 提交于 2019-11-30 01:44:09
By default menu items become disabled when its command cannot be executed (CanExecute = false). What is the easiest way to make the menu item visible/collapsed based on the CanExecute method? You can simply bind Visibility to IsEnabled (set to false on CanExecute == false). You still would need an IValueConverter to convert the bool to visible/collapsed. public class BooleanToCollapsedVisibilityConverter : IValueConverter { #region IValueConverter Members public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { //reverse conversion

Right-click context menu for Java JTree?

限于喜欢 提交于 2019-11-29 23:55:36
I'm trying to implement pop-up menus in Java JTree. I've sub-classed DefaultTreeCellRenderer (to change node appearance) and DefaultTreeCellEditor (to create Components to attach event listeners to, since apparently the Components that DefaultTreeCellRenderer.getTreeCellRendererComponent() returns can't do it?). I don't really want to "edit" the nodes, just be able to pop-up a menu when a node gets right-clicked, but this is the only way I can think of doing it right now... Below is the code that I have so far-- I'm just trying to figure out how to capture MouseEvents. It sort of works, but

Windows Explorer right click context menu for files and folders

萝らか妹 提交于 2019-11-29 22:06:22
问题 my question is similar into this, but that didn't gave all info I need, or I didn't understand that very well. I want that in file context menu there would be option to notify my app. I added keys: HKLM/SOFTWARE/Classes/*/shell/MyApp/command::"C:\\path\\test.exe" "%1" HKLM/SOFTWARE/Classes/Folder/shell/MyApp/command::"C:\\path\\test.exe" "%1" Code of test: #include <iostream> int main(int argc, char *argv[]) { for (int i = 1; i < argc; ++i) std::cout << argv[i] << "\r\n"; system("pause");

Context Menu on Android WebView

狂风中的少年 提交于 2019-11-29 21:33:52
问题 I'd like to add a context menu on an entire Android WebView. I have the following code: registerForContextMenu(findViewById(R.id.webview)); ... public void onCreateContextMenu (ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); if (v.getId() == R.id.webview) { //display context menu } } I noticed that the context menu is only displayed when a long press is done on a link in the webpage rendered by the WebView. When a long press is done in an

Custom values to Context Menu Items in JQgrid

若如初见. 提交于 2019-11-29 17:41:46
I am using this link from Oleg and Demo to create context menu. Is there a way to pass some dynamic values to each row apart from rowId. May be one way is to set hidden values for each row and get those hidden column values but not sure how to implement this functionality. Thanks for any help or suggestions.. loadComplete: function(data) { // Fix the Grid Width... fixGridWidth($("#grid")); // Context Menu $("tr.jqgrow", this).contextMenu('contextMenu', { bindings: { 'abc1': function(trigger) { // would like to pass some custom values }, 'abc2': function(trigger) { // open a link in new window

Android - EditTexts in Gallery show strange behaviour when being (long)-clicked

醉酒当歌 提交于 2019-11-29 16:51:23
my program is based on Google's Hello Gallery example: http://developer.android.com/guide/tutorials/views/hello-gallery.html Instead of using images, I create a bunch of EditText s in the constructor. My question is now: When I long click on an EditText, I want its Context Menu (with "select all", "copy" and so on) to be shown. I've tried setting an OnItemLongClickListener which calls the selected view via myGallery.getAdapter().getView(position, ...).showContextMenu() , but that runs into a StackOverflowError (that's btw the reason why I posted my question here - ok, that one was lame.): 08

Adding a context menu item in Windows for a specific file extension

北战南征 提交于 2019-11-29 16:35:27
I am trying to add a context menu item to a DLL file. The reason is that I have written an application which retracts and deployed a managed DLL file to the GAC. The application is all good, but now I want the ability to right-click a DLL and just click "copy to GAC". I've tried to follow instructions as per this question: How add context menu item to Windows Explorer for folders but to no avail. When I right click a DLL, nothing new is appearing. I've also tried the following: https://winaero.com/blog/add-register-dll-context-menu-commands-for-dll-files-in-windows-10/#comment-22928 - ran the