contextmenu

Right click with SendKeys in .NET

☆樱花仙子☆ 提交于 2019-12-23 02:02:08
问题 I am using sendkeys in C# .NET. I have letters, arrow keys and enter working. I cant figure out how to send a right click for the context menu. I know i can press a key on my keyboard to do it but i have no idea how to send the msg. How do i? i googled and saw new MenuItem().PerformClick(); as a solution however i didnt see any affect. The keys are being sent to another application. 回答1: You can wrap the user32.dll, I got the general idea from here EDIT: I added in posX and posY, which would

Can Execute of a ICommand while a Context menu open

我是研究僧i 提交于 2019-12-23 01:59:11
问题 A Control has its ContextMenu and its MenuItem is bound to an ICommand . ICommand's Can Execute has some code to enable and disable the MenuItem . This hits while loading and checks for Can Execute but it can hit while open the ContexMenu and it need to be hit(Checks) for each time while opening the ContextMenu . <Border> <Border.ContextMenu> <ContextMenu> <MenuItem Command="{Binding SaveCommand, Source={StaticResource vm}}" CommandParameter="{Binding}" Header="Menu1" /> </ContextMenu> <

How to gray out some context-menu options with an IExecuteCommand-based shell extension?

强颜欢笑 提交于 2019-12-23 01:57:13
问题 When implementing a context-menu shell extension using the IExecuteCommand approach (as described in this blog post), how can a given menu option be grayed out? E.g. Suppose that the shell extension offers some menu options, and some of them should be grayed out basing on some state and conditions that the shell extension computes, for example: if the user right-clicks on a file and the shell extension detects that this file has some given properties, some of the shell extension context menu

WPF ContextMenu using ItemsControl, incorrectly highlight the whole collection

倾然丶 夕夏残阳落幕 提交于 2019-12-23 01:52:08
问题 I need to design one ContextMenu which includes one MenuItem , this MenuItem has a deeper level menu list which binds to a property of type ObservableCollection from my ViewModel. The code looks like this: <ContextMenu DataContext="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource Self}}" > ... <MenuItem Header="Map to account" > <ItemsControl ItemsSource="{Binding RelatedAccounts}" > <ItemsControl.ItemTemplate> <DataTemplate> <MenuItem Header="{Binding Number}" Command="

How to cancel the creation of a context menu after onCreateContextMenu() has been called

人走茶凉 提交于 2019-12-22 20:48:14
问题 I have an activity that registers a list view for the creation of the context menu: registerForContextMenu(getListView()); The problem is that a long click on some items should not present the context menu, because the items are disabled. public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); bool bDisplayMenu = isItemEnabled(((AdapterView.AdapterContextMenuInfo) menuInfo).position); if(bDisplayMenu) {

How to cancel the creation of a context menu after onCreateContextMenu() has been called

眉间皱痕 提交于 2019-12-22 20:46:04
问题 I have an activity that registers a list view for the creation of the context menu: registerForContextMenu(getListView()); The problem is that a long click on some items should not present the context menu, because the items are disabled. public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); bool bDisplayMenu = isItemEnabled(((AdapterView.AdapterContextMenuInfo) menuInfo).position); if(bDisplayMenu) {

Establish a service in Finder context

心已入冬 提交于 2019-12-22 14:38:48
问题 I'm trying to add a service to the Finder's context menu using this class: public class Service { public func handleServices(pboard:NSPasteboard, userData:String, error:UnsafeMutableBufferPointer<String>) { // not sure about the correct parameters if (pboard.types?.contains(NSFilenamesPboardType) != nil) { let fileArray = pboard.propertyListForType(NSFilenamesPboardType) print(fileArray) } } init () { NSApp.servicesProvider = self NSUpdateDynamicServices() } } The service is announced in info

How to get the file right click menu in windows explorer in Java

孤街浪徒 提交于 2019-12-22 11:37:52
问题 I am making a twin panel commander. I made two JTables which displays the current directory contents. I would like to implement that a right click on a file would display the windows explorer shell context menu. Is it somehow possible ? 回答1: Figured that out with using external app Runmenu. String runMenuApp = "path\\to\\runmenu.exe /show "; String file = "\"" + "path\\to\\fileordir" + "\""; Process p = Runtime.getRuntime().exec(runMenuApp + file); 来源: https://stackoverflow.com/questions

Adding context menu to leaf node in TreeView WPF

陌路散爱 提交于 2019-12-22 10:53:10
问题 In my WPF application, I want to add a context menu and its handler in ViewModel to the leaf nodes of my TreeView control. Here is how I have added the TreeView Control. <TreeView Name="treePads" ItemsSource="{Binding pads}" Width="190"> <TreeView.Resources> <HierarchicalDataTemplate DataType="{x:Type self:Pad}" ItemsSource="{Binding Members}"> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding Name}" /> <TextBlock Text=" [" Foreground="Blue" /> <TextBlock Text="{Binding Members

Swing Mouse Click Event for JMenu and JPopupMenu

六月ゝ 毕业季﹏ 提交于 2019-12-22 09:43:51
问题 I would like to have Eclipse behavior for mouse clicks outside menus and popup menus in Swing. Basically, in Eclipse, when you press the mouse OUTSIDE the menu, the menu disappears and the mouse press event is forwarded to the component on which you clicked with the mouse. Irritatingly, Swing does not do this, and I can't find a way around it. Right now, even with Windows LAF, i have to click a second time to get the component to register the mouse click. For the sake of the response just do