contextmenu

Right click contextMenu on QPushButton

被刻印的时光 ゝ 提交于 2019-12-20 10:41:05
问题 For my app I have created a GUI in Qt Designer and converted it into python(2.6) code. On some of the QPushButton (created with the designer) I want to add a right click context menu. The menu options depend on the application status. How to implement such a context menu ? 回答1: Check if an example below would work for you. The key thing is to set context menu policy for your widget to CustomContextMenu and connect to the widget's customContextMenuRequested signal: import sys from PyQt4 import

How can I tell a ContextMenu to place itself relatively to its control and not the cursor? [duplicate]

被刻印的时光 ゝ 提交于 2019-12-20 10:24:38
问题 This question already has answers here : Setting a WPF ContextMenu's PlacementTarget property in XAML? (3 answers) Closed 3 years ago . I have a button with a default command and a context menu for other available commands: <Button Content="Do this" Height="23" Width="75" Command="local:MyCommands.ThisCommand"> <Button.ContextMenu> <ContextMenu> <MenuItem Header="Do this" Command="local:MyCommands.ThisCommand" /> <MenuItem Header="Do that" Command="local:MyCommands.ThatCommand" /> <

Hide items in the right-click context menus in Visual Studio 2010 (08)?

試著忘記壹切 提交于 2019-12-20 08:25:28
问题 The right-click context menus of the source editor, the project items and the solution item, is getting ridiculously long, and two of them even have scrolling now on my 1680x1050 screen. Is there any way for me to hide items on these menus, even if I have to add an event to my Visual Studio macro-system and find and hide them manually? Here's examples, many of these items I never use: Edit1: The current answer + comments suggest I should use the Customize menu item in the toolbar context

Programmatically Calling Browser Right-Click Menu Options?

谁说胖子不能爱 提交于 2019-12-20 07:25:06
问题 I would like to be able to programmatically invoke the right-click menu options, initiated from user events like rollover and whatnot of course. Is this possible? Specifically, I would like to be able to call the Safari "Use Image as Desktop Picture" or the "Add Image to iPhoto Library", or the Firefox "Set as Desktop Background" using pure Javascript, so you don't have to right click. Is that possible? 回答1: You can't and this is because of security limitations. If you could do that,

How to pass variables on long press on ListView?

一世执手 提交于 2019-12-20 05:30:10
问题 I would have listview and a lot of items inside. I want that user can long press on item and set it as Favorite. To do that, I need to get DB id to this menu on long press. I have the following code @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); menu.setHeaderTitle("Favorite"); menu.add(0, REMOVE_TODO, Menu.NONE, R.string.favorit_add); } It works just fine... But what I want to do is to

WPF How to catch ContextMenuClosing event

心已入冬 提交于 2019-12-20 02:17:11
问题 I have the following XAML: <Grid > <Grid.ColumnDefinitions> <ColumnDefinition Width="20"/> <ColumnDefinition Width="*"/> <ColumnDefinition Width="20"/> </Grid.ColumnDefinitions> <local:DropDownButton HorizontalAlignment="Right" Grid.Column="2" Width="18" Style="{StaticResource OrangeButton}" ContextMenuClosing="colorPallete_ContextMenuClosing" x:Name="btnSelectColor"> <Polygon Points="0,0,5,4,10,0" Fill="Black"/> <local:DropDownButton.DropDown> <ContextMenu StaysOpen="True" Name="colorPallete

.NET Multiple ToolStripButtons in a single ContextMenuItem

僤鯓⒐⒋嵵緔 提交于 2019-12-19 11:20:22
问题 I'm trying to create a ContextMenu where some items in the menu contain more than a single item. You could see it as trying to combine a ToolStrip and ContextMenuItem. I've tried using a ToolStripControlHost, but this creates problems with the focus. It basically requires you to click everything in the ToolStrip twice.. ContextMenuStrip m = new ContextMenuStrip(); ToolStrip tStrip = new ToolStrip(new ToolStripDropDownButton(), new ToolStripButton()); ToolStripControlHost tsHost = new

JTable right-click copy/paste menu to copy cell data on one click

寵の児 提交于 2019-12-19 10:46:06
问题 I created my JPopupMenu . It appears on my JTable when I right click on a cell. However, I cannot copy the data in the cell unless I first double click and then highlight the data, and then right click anywhere but this current cell to show my popup menu and copy option. I would like to copy the data in a cell without having to double click on a cell and enter into cell edit mode where I then need to select the data. How can I do this? popup = new JPopupMenu(); popup.setName("popupMenu");

MultichoiceModeListener on RecyclerView android

一世执手 提交于 2019-12-19 10:28:13
问题 I have a recyclerview with respective adapter. I want to show multiple customview menu options in toolbar on the long press of recyclerview item. Any help is highly appreciated. Thanks in advance. 回答1: I'm doing the same work. This post is helpful: RecyclerView with choice modes Basically you have to add this code in your OnLongClick method @Override public boolean onLongClick(View view) { if (!mMultiSelector.isSelectable()) { ((AppCompatActivity) getActivity()).startSupportActionMode

Persisting a context menu after screen rotation

China☆狼群 提交于 2019-12-19 09:43:53
问题 I have an activity that on it's onCreate method it does: registerForContextMenu(theView); and in onCreateContextMenu: super.onCreateContextMenu(menu, v, menuInfo); menu.add(blablabla); This works great, but the problem is that the context menu disappears when the screen rotates. How to fix this? Thanks for reading! 回答1: Here's the solution: The contextMenu disappeared because by default when rotating android calls destroy() and then onCreate() but : If you don't want Android to go through the