contextmenu

How to create dialog that looks exactly like ContextMenu?

 ̄綄美尐妖づ 提交于 2019-12-06 07:08:10
问题 Sometimes it`s not convenient to use standart activity methods for creating ContextMenu (because there is can be many places in one activity but in different classes where it would be necessary to show contextmenu). But creating dialogs is easy from any place. How can I create dialog that looks exactly like ContextMenu? Where can I find layout of standart context menu or something like that? 回答1: I decide to use AlertDialog s with list (http://developer.android.com/guide/topics/ui/dialogs

Prevent menu key from showing a context menu

て烟熏妆下的殇ゞ 提交于 2019-12-06 06:48:30
问题 I know that the keyboard menu key is keyCode === 93 . So I have the following code: $(window).on("keydown", document, function(event){ if (event.keyCode === 93) { //context menu console.log("context menu key", event); event.preventDefault(); event.stopPropagation(); return false; } }); Although the event does fire, and the console does get logged inside the if statement, but the context menu still shows even though both event.preventDefault(); and event.stopPropagation(); are present in my

Android NULL menuInfo in onCreateContextMenu and onContextItemSelected only with manual call to openContextMenu in onListItemClick. Long click works

陌路散爱 提交于 2019-12-06 06:28:47
问题 I have parsed through a lot of the posts here and haven't found anything quite like my problem. Basically I am trying to call openContextMenu(l) in onListItemClick . Doing so creates a context menu with no menuInfo . Performing a long click will work correctly. After the long click is performed, my code will start working and actually get a menuInfo that is not null. I have a ListActivity that is filled with a SimpleCursorAdapter which grabs data from SQL . In my onCreate I

jQUery context menu on left click

时光总嘲笑我的痴心妄想 提交于 2019-12-06 04:58:50
I am using jQuery context menu plugin by Chris Domigan to appy a context menu. This is how it works: $('#contacts tbody tr').contextMenu('myMenu1', { bindings: { 'copy': function(t) { alert('Trigger was '+t.id+'\nAction was Copy'); }, 'delete': function(t) { alert('Trigger was '+t.id+'\nAction was Delete'); } }, }); Now I want this context menu to appear on left click instead of right click. I can not find an option in the doc. Any ideas how to do that? Do I have to modify the source? As the title on the source ContextMenu - jQuery plugin for right-click context menus Also in the doc there's

How can I set up a context menu in Google Chrome so that all of the menu are top level?

余生颓废 提交于 2019-12-06 04:45:46
问题 I am working on a Google Chrome extension and I have set up several right click context menu items. I see that there is something in the syntax for adding a menu item which allows you to choose a parentID, but I don't see anything that would allow you to choose to have all the menu items as top level items. Here's an example of my plugin with a single top level menu item and then several sub menu items: I'd like to bring those out to the top level because I use them a lot. This is the code

Custom context menu in d3 and svg

只谈情不闲聊 提交于 2019-12-06 04:36:26
问题 I would like to have custom context menu appearing when I right click on an svg circle. For now I have found this answer that helps me to handle the right click with the following code: .on("contextmenu", function(data, index) { //handle right click //stop showing browser menu d3.event.preventDefault() }); Now I would like to know how I can show a box containing some HTML. Thanks in advance. 回答1: d3.select('#stock_details .sym').on("contextmenu", function(data, index) { var position = d3

Get the SourceControl of my ContextMenuStrip when I use the shortcut key

六月ゝ 毕业季﹏ 提交于 2019-12-06 03:40:13
I have single ContextMenuStrip attached to two controls ( DataGridView ). In the ToolStripMenuItem click event, I manage to get the original caller (the DataGridView ) with this code : var menu = (ToolStripDropDownItem)sender; var strip = (ContextMenuStrip)menu.Owner; var dgv = (DataGridView)strip.SourceControl; It works pretty good when I click on my ToolStripMenuItem . But when I use the sortcut key linked to the ToolStripMenuItem , the strip. SourceControl return null. Does anyone know why ? The SourceControl property shows the control that caused the ContextMenuStrip to open. Since in this

Disable Firefox's silly right click context menu

天大地大妈咪最大 提交于 2019-12-06 03:33:28
I am making an HTML 5 game which requires the use of right click to control the player. I have been able to disable the right click context menu by doing: <body oncontextmenu="return(false);"> Then it came to my attention that if you hold shift and right click, a context menu still opens in Firefox! So I disabled that by adding this JS as well: document.onclick = function(e) { if(e.button == 2 || e.button == 3) { e.preventDefault(); e.stopPropagation(); return(false); } }; However, if you hold shift, and then double right click in Firefox it still opens! Please tell me how to disable this

jQuery allow contextmenu only on certain elements

醉酒当歌 提交于 2019-12-06 02:34:42
问题 // this works $(document).on('contextmenu', function() { return false; }); // without the code above, this works too $(document).on('contextmenu', '#special', function() { alert('#special right clicked'); }); How can I combine these 2 pieces of code so that I can disable context menu on the whole document except the one with id #special. 回答1: $(document).on('contextmenu', function(e) { if (!$(e.target).is("#special")) return false; alert('#special right clicked'); // you may want e

How to set ContextMenu of a bound item?

≡放荡痞女 提交于 2019-12-06 01:28:32
问题 I am trying to achieve the following: <Style TargetType="ListBoxItem"> <Setter Property="ContextMenu"> <Setter.Value> <ContextMenu> <MenuItem Name="mnuEdit" Header="_Edit" Click="MenuItem_Click" /> </ContextMenu> </Setter.Value> </Setter> <Style> But it throws the following exception: Cannot add content of type 'System.Windows.Controls.ContextMenu' to an object of type 'System.Object'. Error at object 'System.Windows.Controls.ContextMenu' in markup file blah blah blah 回答1: Try this instead: