contextmenu

Getting the control of a context menu

让人想犯罪 __ 提交于 2019-12-06 01:01:00
I have a context menu that looks like this A |--1 |--2 |--3 I need to access the object that the context menu is called from, after selecting 1 2 or 3 meaning if this is a context menu of a textbox1 then I need to access that object, how do I do that? Forgot to mention, this is a WPF application. so Im using the System.Windows.Controls and the ContextMenu is created programmatically You can walk up the tree and get the control from the ContextMenu.PlacementTarget , e.g. private void MenuItem_Click(object sender, RoutedEventArgs e) { var item = sender as MenuItem; while (item.Parent is MenuItem

Swing Mouse Click Event for JMenu and JPopupMenu

霸气de小男生 提交于 2019-12-05 22:54:49
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 it on a table final JPopupMenu popupMenu = new JPopupMenu(); JMenuItem viewProfile = new JMenuItem(

Adding context menu to leaf node in TreeView WPF

浪尽此生 提交于 2019-12-05 21:04:54
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.Count}" Foreground="Blue" /> <TextBlock Text="]" Foreground="Blue" /> </StackPanel> <

Customizing Context Menu in WPF

浪尽此生 提交于 2019-12-05 19:37:45
问题 I have a project here where I require customizing the context menu in my WPF application in which a button would be placed at the bottom of all the menuitems. However, if I were to add the button through the XAML, it would appear as another item in the collection in the context menu and the mouse-over highlight would act on it. I would like to have the context menu tuned to a grid-like style whereby I could customize the style underneath it. Any idea how I can achieve this (preferably in the

React Context Menu on react table using react-contexify

那年仲夏 提交于 2019-12-05 18:32:49
I have a project that I am using react table with but also need a context menu to popup on right click of the row in the react table. The only thing I cant get is the selected row data. Because I have to wrap the entire react table in the context menu component, props returns just the main react table component and not active row. Here is my code. <ContextMenuProvider id="menu_id"> <ReactTable data={items} columns={columns} showPagination={false} getTdProps={(state, rowInfo, column, instance) => { return { onClick: (e, handleOriginal) => { const activeItem = rowInfo.original this.getDetails

Adding a right click context menu with link with multiple widgets?

断了今生、忘了曾经 提交于 2019-12-05 18:21:42
My issue is a kind of follow up of this question I would like to get the widget which has been right clicked to do an action on it. Conditions : right click on "my label 2" select "Display the label" Expected results : => "my label 2" should be printed Initial code to solve : from Tkinter import * # Tkinter -> tkinter in Python 3 root = Tk() def print_label(): print "Please, help me to print the label which has been clicked !" def popup(event): menu.post(event.x_root, event.y_root) # create a popup menu menu = Menu(root, tearoff=0) menu.add_command(label="Display the label", command=print

Context menu is cut in some situations in WPF

大城市里の小女人 提交于 2019-12-05 18:13:58
Context menu is truncated in different .NET Framework. See images inside ZIP file (there are two screenshots, one from XP and other from Win7). I created a simple Visual Studio 2010 solution which repro my issue. ( http://www.mediafire.com/download.php?doq7gsh75qgvzwq ). On XP it seems to work fine, but not on Windows 7. The issue can be reproduced on Windows 7 if target .NET Framework is 3.5 (including SP1) (please see the image from zip). If I change the target framework to 4.0 it works fine also on Windows 7. Is a solution to make context menu full visible in .NET Framework 3.5 on Windows 7

JavaFX ContextMenu how do I get the clicked Object?

∥☆過路亽.° 提交于 2019-12-05 18:07:02
I am learning javafx.scene.control.ContextMenu, and right now I am facing a problem: how do I get the clicked Object from EventHandler? both event.source() and event.target() return the MenuItem. let me explain with an example: what should I write inside the function handle? TextField text = new TextField(); Label label1 = new Label("hello"); Label label2 = new Label("world"); Label label3 = new Label("java"); ContextMenu menu = new ContextMenu(); MenuItem item = new MenuItem("copy to text field"); menu.getItems().add(item); item.setOnAction(new EventHandler(){ public void handle(Event event)

Is it possible to add an item to the right-click context menu of a Mac OS programmatically?

十年热恋 提交于 2019-12-05 18:02:03
问题 I have a program that works with a variety of files on both the Windows and Mac OS. I would like to give the user the option of adding a new option to their right click/control click context menu to the effect of "Compress with [Name of App]". I know this is quite possible in Windows with modifications to the registry, but is there a way to achieve this for the Mac? Perhaps using C++ or objective C? 回答1: Yes, you can. You need to make a contextual menu plugin. Apple has contextual menu plugin

Command bind to ContextMenu (which on ListBoxItem in ListBox) don't work [duplicate]

大憨熊 提交于 2019-12-05 16:34:41
This question already has an answer here: ContextMenu Command Binding to parent and to self 1 answer In WPF, with MVVM light, there's a Class (which is consist of some students), and the Class hold some Student s. Right-Click one Student's name, then will show a MessageBox , it is ok in this way: ClassDetailView.xaml <UserControl DataContext="{Binding ClassDetail, Source={StaticResource Locator}}"> <DockPanel> <ListBox ItemsSource="{Binding Students}" DisplayMemberPath="Name"> <ListBox.ContextMenu> <ContextMenu DataContext="{Binding Path=PlacementTarget, RelativeSource={RelativeSource Self}}">