contextmenu

Add an item in Finder's contextual menu with Cocoa

心不动则不痛 提交于 2020-01-05 08:46:23
问题 In Cocoa on Mac, I would like to add a menu item in the Finder's popup menu that comes when I right-click on a file or a folder, and having this item pointing to a function in my app. How can I achieve this ? Thanks ! 回答1: A good place to start is CocoaDev: StandardService. It outlines what you are trying to accomplish and they give some source code to follow such as the MakingServices example. 2015 Update: As of Yosemite, Apple includes an extension called Finder Sync which allows you to

Accessing TextBox inside a ContextMenu

≯℡__Kan透↙ 提交于 2020-01-05 08:13:56
问题 I've got a TextBox that's part of a ContextMenu's MenuItem. However, I can't seem to access that TextBox the same way I can access other controls that are outside of the ContextMenu. Here's my XAML: <ListBox Name="ItemList"> <ListBox.Resources> <ContextMenu x:Key="listBoxItemContextMenu"> <MenuItem Header="Rename"> <TextBox Name="newFilename" KeyUp="renameFile" /> </MenuItem> </ContextMenu> </ListBox.Resources> <ListBox.ItemContainerStyle> <Style TargetType="ListBoxItem"> <Setter Property=

WPF Context Menu

杀马特。学长 韩版系。学妹 提交于 2020-01-05 04:14:08
问题 TextBox has a default context menu. I would like to add an item to it. OK, that means cloning the default one, and adding an extra item to that. I'd like to reuse some code here. I have five textboxes. Each needs the additional item on its context menu. The item needs act on the textbox that was clicked. I know "copy and paste" is the recommended method of code reuse in WPF, but if possible I'd prefer not to define five menus in XAML and five commands in the code behind. Is there any

Contextual menu with search result for a NSSearchField

不问归期 提交于 2020-01-04 09:30:31
问题 I would like to have a contextual menu that shows search results as text is entered in a search field. This is an image of the default mail app in OS X that does this. I know how to filter an array of strings according to the search request of the user, but I do not know how to display it this way. I am using Swift and for a Cocoa application. Any help is appreciated. 回答1: Building from the previous answer, here is a simple Swift 3 class which you can use to automatically handle recent

Is it possible to add Menu Items to a context menu during implementation?

匆匆过客 提交于 2020-01-04 07:04:13
问题 I hope I asked the right question, but here's my situation. I have a TreeViewItem that I'm implementing. Inside it I set/add various properties, one of them being a ContextMenu . All I want to do is add MenuItems to the ContextMenu without passing to functions and such. Here's how I implement my TreeViewItem with ContextMenu : public static TreeViewItem Item = new TreeViewItem() //Child Node { ContextMenu = new ContextMenu //CONTEXT MENU { Background = Brushes.White, BorderBrush = Brushes

WPF context menu whose items are defined as data templates

怎甘沉沦 提交于 2020-01-04 04:37:13
问题 I have a list view that displays a collection of items, each item has as its underlying data a view model (MVVM). What I would like to do is display different menu items within the context menu when the user right clicks one of these list view items. The menu items displayed is dependent on the type of the item selected (i.e. the type of the underlying view model). I would expect the below to work, but it does not (no items are displayed in the context menu). <ListView.ContextMenu>

Context menu in list activity

戏子无情 提交于 2020-01-04 02:52:10
问题 I have list activity with custom array adapter and I can't to get context menu when make long press on list item. <TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content"/> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="5dp"> <ListView android:id="@+id/list" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </FrameLayout>

How to have a ContextMenu when the recyclerview item is set onLongClickListener

倾然丶 夕夏残阳落幕 提交于 2020-01-03 15:50:11
问题 How can I have a context menu inside the RecyclerViewAdapter when the view is set onLongClickListener? Here is my code: public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { public TextView name; public ViewHolder(View itemLayoutView) { super(itemLayoutView); name = (TextView) itemLayoutView.findViewById(R.id.rvname); itemLayoutView.setOnClickListener(this); itemLayoutView.setOnLongClickListener(new View.OnLongClickListener() { @Override public

Android - Long Click on RecyclerView item and ContextMenu

眉间皱痕 提交于 2020-01-03 13:01:25
问题 Problem: Cannot display a context menu showing a "delete" option" when longclicking on an item within a recyclerview Result expected: see image below I'm almost there, but I'm missing something to make the contextMenu displayed on a longClick. Here is what I put in the viewHolder. I don't know what I should add and where to display the context menu in the onLongClick event. I skipped some lines of code and kept the ones relevant to my question. Thanks a lot for your assistance, My interface

Can I create a multiple-column context menu in .NET Windows Forms?

拈花ヽ惹草 提交于 2020-01-03 12:33:21
问题 I want to create a context menu that has several columns. Basically it would go like this: First item | [common option] | All Options > Second item | [common option] | All Options > Third item | [common option] | All Options > Fourth item | [common option] | All Options > So basically there are a bunch of items (generated at runtime), each item can be launched on its own; or with a commonly used option; or you can get a submenu with all possible options. How can I do this? I'm trying to abuse