Using ::GetMenuItemInfo() I see that on my Win 8.1 x 64 'Delete' menu item ID is equal to decimal 18 and 'Properties' ID is equal to 20. Are they the same on any Windows and where are they defined in the SDK headers?
UPDATE
I'd like to use TrackPopupMenu to show the system menu for some files inside my app, but I want to override some of items such as 'Delete'. How can I check whether an item #i (where i is an index from 0 to item count) is the 'Delete' item to change its id to my own and handle it later? If IDs are constant, it seems to be pretty simple, but otherwise...
Don`t use menu item ID for command identification. Command IDs can be different in different time even on the same PC. If you want to override any menu item you must analyse verb of command instead of ID. Verbs are always the same.
When you have IContextMenu of object enum menu items and call IContextMenu.GetCommandString function with GCS_VERBA or GCS_VERBW parameter. When GetCommandString return you 'delete' string - at this position you have Delete command. When GetCommandString return you 'properties' string - at this position you have Properties command.
Related
I have one web table, in this I want to delete particular record by clicking on record's delete button.
I got the value of row but I am not able to perform click on web button of particular row and also there is 2 buttons in one column.
How to click on delete icon of particular row?
You need to set a reference to the item within the specific row and then click on it - something like this:
Set oLink = Browser("myBrowser").Page("myPage").WebTable("myTable").ChildItem(iRow,8,"Link",0)
oLink.Click
You will potentially need to amend the "Link" and the number 8 in your own code. iRow represents the row you are trying to interact with.
Essentially what this code does is set an object reference to the first item of type "Link", in column 8 of the table, then uses a Click event to select it. If your delete icon is a WebButton, then replace "Link" with "WebButton" for example. The final 0 in the command tells UFT to select the first element matching the object type - you might need 1 if your two icons are in the same column of the table.
Let me know if that helped.
My goal is to Programmatically select items from the List of the combo box, but without updating the edit control. The same can be achieved with the mouse. E.g. when you drop down and hover an item from the list, that item is highlited. And that is all. If you want to select in it the combo box (e.g. move it to the edit control) - you must click on the LisBox.
I tried with CB_SELECTSTRING. But it automatically updates the ComboBox edit control with the selected text which is not what I want. I want to do this using raw Win32 or VB6
Thanks
There is a big difference between highlighting an item in the drop-down list and actually selecting an item to make it active. CB_SELECTSTRING selects an item, as its name implies. But there is no official ComboBox API to highlight an item, though.
However, you can display the drop-down list manually (CB_SHOWDROPDOWN), and either:
move the mouse over the desired item so the list can perform hot-tracking logic.
manipulate the list directly. Use CB_GETCOMBOBOXINFO or GetComboBoxInfo() to get the list's HWND, and then send LB_SETCURSEL to it.
I have a Datawindow Grid in a window I've created and one column of this DW has as its data, different menu paths that are the same of the menus and submenus I have created. The point is that when I double-click on every DW row, I want to execute the clicked event of the different menu path that is stored as data in each row.
For example the first row is "m_epith_frame.m_parms_su.m_poi.m_poi_ergast", the second is "m_appl_frame.m_1_sb.m_2_sb" etc.
I know that when in scripts, I write m_epith_frame.m_parms_su.m_poi.m_poi_ergast.Clicked(), it triggers the Clicked event of this menu item and for example opens a form...
So how can I click each row and trigger the clicked event for every menu path of each row?
It is, I suppose, a dynamic event call problem, but I can not find any solution..
Thanks in advance
You can recurse menus to build up a string array of the menu paths. At the same time build up an array of the menu items and assign the menuitem object to this using the same array index number as for the strings. Don't use create, just assign the menuitem to the array.
When someone clicks on a row, find the index of the path in the string array, then trigger a click event on the menu item array using the same index.
The menu item array holds pointers to the real menu items in the menu, so it's the same as clicking on the menu option, e.g you can code
im_menuitems[li_menuindex].Triggerevent (Clicked!)
and if this is m_epith_frame.m_parms_su.m_poi.m_poi_ergast that is what is clicked.
I'm using the ListPicker control from the WP7 Toolkit. I want to initially present the list with no items selected. Is there a way of doing this?
According to this blog entry List Picker works with the idea of "there is always an active selection".
The approach I would follow is to have the first item in the list be you "no selected item" item. With appropriate values (maybe a null id) that you can identify later on.
By design ListPicker must have a selected item. If you try to set it to null or set the SelectedIndex to -1 you will get an exception.
I have QTable widget, where I set
setVerticalHeaderItem(0, QTableWidgetItem("some header", 0))
I set a contex menu by
setContextMenuPolicy(Qt.ActionsContextMenu)
and it works fine on my table's elements other than 1st column, i.e. a VerticalHeaderItem. Basically, when I right-click on 1st column item a context menu doesn't pop up, while clicking on any other elements >1st column causes the context menu to pop up (populated with the QActions I defined, not shown here for clarity).
Is there any attribute I should set in order to make 1st (VerticalHeaderItem) column react to right-click? Qt.ItemFlags maybe? If so, could anyone write a code snippet how to set it properly? Preferably in Python, but C++ would be also OK.
My conf: QT 4.5.2, PyQT 4.5.4, under Windows XP SP2.
The headers are widgets on their own. So, set the context menu policy on myTableWidget.verticalHeader().