cannot create item with duplicate context menu id in extension

In Chrome, you should create the context menu just once after install/update. Use onInstalled event: chrome.runtime.onInstalled.addListener(() => { chrome.contextMenus.create({ id: “zm_mark_down_preview_beta”, title: ‘preview and edit’, contexts: [“editable”] }); }); Alternatively, you can simply suppress the error by accessing lastError in the callback: chrome.contextMenus.create({ id: “zm_mark_down_preview_beta”, title: ‘preview and edit’, contexts: [“editable”] }, () => chrome.runtime.lastError);

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

I finally solved it: In Visual Studio, create a ContextMenuStrip with an item called “DeleteRow” Then at the DataGridView link the ContextMenuStrip Using the code below helped me getting it work. this.MyDataGridView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.MyDataGridView_MouseDown); this.DeleteRow.Click += new System.EventHandler(this.DeleteRow_Click); Here is the cool part private void MyDataGridView_MouseDown(object sender, MouseEventArgs e) { if(e.Button == MouseButtons.Right) { … Read more

How to handle onContextItemSelected in a multi fragment activity?

I’ll post an answer even though you found a workaround because I just dealt with a similar issue. When you inflate the context menu for a specific fragment, assign each menu item a groupId that is unique to the fragment. Then test for the groupId in ‘onContextItemSelected.’ For Example: public void onCreateContextMenu(ContextMenu menu, View v,ContextMenuInfo … Read more

Add contextmenu items to a Chrome extension’s browser action button

It is now possible, AdBlock chrome extensions has it. Below is working example of “context menu in browser action”. manifest.json: { “name”: “Custom context menu in browser action”, “version”: “1”, “manifest_version”: 2, “background”: { “scripts”: [“background.js”] }, “browser_action”: { “default_title”: “Some tooltip”, “default_popup”: “popup.html” }, “permissions”: [ “contextMenus” ], “icons”: { “16”: “icon16.png” } } … Read more

How to create context menu for RecyclerView

Thanks for the info and comments. I was able to achieve ContextMenu for items in Recyclerview. Here is what I did in Fragment’s onViewCreated method or Activity’s onCreate method: registerForContextMenu(mRecyclerView); Then in Adapter add private int position; public int getPosition() { return position; } public void setPosition(int position) { this.position = position; } make the … Read more

Disable EditText context menu

I have made this code for EditText, and it worked fine for such an issue. try { edtName.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { edtName.setSelection(0); } }); edtName.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { return true; } }); edtName.setCustomSelectionActionModeCallback(new ActionMode.Callback() { @Override public boolean onCreateActionMode(ActionMode actionMode, Menu menu) { return false; … Read more

Create contextmenus for datagrid rows

As far as I know, some of the actions will be disabled or enabled depending on the row, so there is no point in a single ContextMenu for a DataGrid. I have an example of the row-level context menu. <UserControl.Resources> <ContextMenu x:Key=”RowMenu” DataContext=”{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource Self}}”> <MenuItem Header=”Edit” Command=”{Binding EditCommand}”/> </ContextMenu> <Style x:Key=”DefaultRowStyle” TargetType=”{x:Type DataGridRow}”> … Read more