contextmenu

Android: How to enable/disable option menu item on button click?

≯℡__Kan透↙ 提交于 2019-11-26 17:11:45
I can easily do it when I am using onCreateOptionsMenu or onOptionsItemSelected methods. But I have a button somewhere in screen, and on clicking that button, it should enable/disable context menu items. Vikas Anyway, the documentation covers all the things. Changing menu items at runtime Once the activity is created, the onCreateOptionsMenu() method is called only once, as described above. The system keeps and re-uses the Menu you define in this method until your activity is destroyed. If you want to change the Options Menu any time after it's first created, you must override the

WPF ContextMenu woes: How do I set the DataContext of the ContextMenu?

谁说胖子不能爱 提交于 2019-11-26 16:32:40
I am having some trouble figuring out how to set the correct DataContext on a ContextMenu . I have a collection of view models who are the source of an ItemsControl . Each view model has a collection of items which are also the source of another ItemsControl . Each item is used to draw image which has a ContextMenu . The MenuItems in that ContextMenu need to bind to a command on the view model, but the PlacementTarget of the ContextMenu is pointing to the individual item. My Xaml looks something like this: <ItemsControl ItemsSource="{Binding Markers"}> <ItemsControl.ItemTemplate> <DataTemplate

Create contextmenus for datagrid rows

百般思念 提交于 2019-11-26 16:16:57
问题 I have a datagrid that potentially can have many rows. As the user right clicks one of the rows, I need to show a context menu for each of the rows and perform an action (same action but different data item according to the current selected row) when the user clicks the option. What is the best strategy for this? I'm fearing that a ContextMenu for each row is overkill even though I'm creating the menu using the ContextMenuOpening event, sort of a "lazy load" for the context menu. Should I

How to disable right-click context-menu in JavaScript [duplicate]

为君一笑 提交于 2019-11-26 15:54:53
This question already has an answer here: How do I disable right click on my web page? 23 answers Not that I'm trying to prevent 'View Source' or anything silly like that, but I'm making some custom context menus for certain elements. EDIT: response to answers: I've tried this: <a id="moo" href=''> </a> <script type="text/javascript"> var moo = document.getElementById('moo'); function handler(event) { event = event || window.event; if (event.stopPropagation) event.stopPropagation(); event.cancelBubble = true; return false; } moo.innerHTML = 'right-click here'; moo.onclick = handler; moo

Adding a menu item to Windows Explorer right click context menu in C# [closed]

浪尽此生 提交于 2019-11-26 15:46:39
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . I am developing an application in which I want to add a menu item to context menu which appears when we right click one or more file or folders in Windows Explorer . By selecting multiple files or folder and clicking my item in context menu it should send the path of all the files

Right click to select a row in a Datagridview and show a menu to delete it

ε祈祈猫儿з 提交于 2019-11-26 15:29:57
问题 I have few columns in my DataGridView, and there is data in my rows. I saw few solutions in here, but I can not combine them! Simply a way to right-click on a row, it will select the whole row and show a menu with an option to delete the row and when the option selected it will delete the row. I made few attempts but none is working and it looks messy. What should I do? 回答1: I finally solved it: In Visual Studio, create a ContextMenuStrip with an item called "DeleteRow" Then at the

Get context of PopupMenu like ContextMenu

那年仲夏 提交于 2019-11-26 15:29:57
So my ExpandableListView has group rows that are defined like : group_row.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/GroupName" style="@style/ListViewRowStyle" android:paddingLeft="40dp" android:textSize="18sp" > </TextView> <ImageView android:id="@+id/Menu" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_marginTop="10dp" android

Creating a submenu in context menu from overridden getActions in Java JHotDraw

半城伤御伤魂 提交于 2019-11-26 14:52:51
问题 I am overriding the getActions method in the Java based framework JHotDraw, an open source project hosted here. The method getActions creates a right click context menu on Figure in the Drawingview . I can correctly add addidtional context menu options using the code below. I need to know how to add a sub menu to the context menu. @Override public Collection<Action> getActions(Point2D.Double p) { Collection<Action> popupMenu = new ArrayList<Action>(); popupMenu.add(new AbstractAction("add

Find node clicked under context menu

只愿长相守 提交于 2019-11-26 12:53:59
问题 How can I find out which node in a tree list the context menu has been activated? For instance right-clicking a node and selecting an option from the menu. I can\'t use the TreeViews\' SelectedNode property because the node is only been right-clicked and not selected. 回答1: You can add a mouse click event to the TreeView, then select the correct node using GetNodeAt given the mouse coordinates provided by the MouseEventArgs. void treeView1MouseUp(object sender, MouseEventArgs e) { if(e.Button

right click context menu for datagridview

删除回忆录丶 提交于 2019-11-26 12:43:33
I have a datagridview in a .NET winform app. I would like to rightclick on a row and have a menu pop up. Then i would like to select things such as copy, validate, etc How do i make A) a menu pop up B) find which row was right clicked. I know i could use selectedIndex but i should be able to right click without changing what is selected? right now i could use selected index but if there is a way to get the data without changing what is selected then that would be useful. Stuart Helwig You can use the CellMouseEnter and CellMouseLeave to track the row number that the mouse is currently hovering