Control a hidden menu behind a button with pywinauto - button

I'm very new to pywinauto ans I love it already. But I have a problem:
I want to automate an old software program with pywinauto and can control most of the buttons. But there is a certain button when clicked, there appaers a menu with icons (not the windows style of menu but a custom menu). The button's name is "Toolbar2" so I guess it's not a normal button.
With this code I can click the button I want to. When I use "ctrl.Click(), the button doesn't get clicked, I need to use ClickInput(). With the normal buttons I do can use Click().
w_handle = pywinauto.findwindows.find_windows(title=u'P2-NLTlog013', class_name='TfrmDisplayFilteredData')[0]
window = pwa_app.window_(handle=w_handle)
window.Click()
ctrl = window['ToolBar2']
ctrl.ClickInput()
My question now is: How can I get the names of the items of the hidden menu And click them. I already used this code, but then he gives a 'MatchError'.
window = pwa_app.Window_(best_match='ToolBar2', top_level_only=True).ChildWindow(best_match='PopupMenu').Click()
window.Click()
I don't know what language the software was written in...
Thanks in advance,
Fred

You may get the menu object by window.Menu() and then try to access subitem by menu.Items()
Useful methods: menu_item.Index(), menu_item.SubMenu()

Related

Drop dialog on a list page not disappearing automatically

When I add a drop-dialog to a list page, the drop dialog drops down when I click on it, but does not disappear when I click somewhere else.
I am trying to add my own drop-dialog, but I can reproduce this issue with standard Dynamics AX objects. I guess I am just missing some property on an object, but I just cannot figure out which one.
If you want to reproduce my problem in order to solve it, do the following:
Create a new Form. (Form 1)
Change the FormTemplate property to ListPage (Click on Yes)
Add the query MainAccountListPage to the DataSources
Create an ActionPanTab.
Add a Drop-dialog button with the menu item MainAccountListPageBalanceParameters.
Save and open the new List page by right clicking and choosing open. (or open the menu item)
In my case, when I click on Parameters, the drop dialog drops down. When I then click outside the drop-dialog, it disappears as it should.
Create a new display menu item. Set the object to the new list page (Form 1)
Drag the Menu item to any menu. I added mine to General ledger (Common)
Restore, open new workspace. Click on the new menu item in the general ledger menu.
Click on “parameters” and click outside the drop dialog.
When I do this the drop dialog does not disappear again. You can see this same drop dialog working fine on the Main Accounts list page. I have tried changing properties on both menu items, on the menu, on the form etc. I have tried different drop dialogs and different list pages. It always works on the details page and when opened from the AOT.
Am I missing a property? Is the entire way I am adding the drop dialog wrong?
The answer to the above example is.. add the MainAccountDetailPart Form part to the list page's (Form1) Parts.
With my other example, EcoResProductPerCompanyListPage, I had to add the EcoResProductVariantsPerCompanyFactBox to Parts.
I have no idea why this is, but adding a part to a list page fixes the drop dialogs. For example, adding MainAccountDetailPart Form part to a new list page not only fixes the MainAccountListPageBalanceParameters in my example, but it also fixes any other drop dialog that previously did not want to close. Removing the part the breaks all the drop dialogs in the list page again.
Thanks, FH-Inway, for the suggestion, I would have never have found the answer without your method. The solution really surprised me!

Unity3D: How to programmatically test new UI features

I have an app built in Unity which uses the new canvas features including buttons and inputfields.
I'm wondering how I could implement automated testing by programmatically entering characters into the input fields and clicking buttons.
In the case of the button the UI.Button component doesnt seem to have a click method you can call.
Is there a way of registering mouse clicks at the buttons location? Or some other way of achieving this?
Ok, This is how you click a button programmatically
MyButton.onClick.Invoke();
and for the inputfields you can just set their text fields like so..
MyInput.text = "flooopybloopybloo";

How to use Panel as Button Menu in Sencha Architect?

PROGRAMS USED: Sencha Architect with ExtJS 4.2.
CURRENT SITUATION: My Button use a Start Menu style. The Start Menu is Panel type. I put both the Button and the Start Menu Panel in a Taskbar. Since I can't point the Button to use the Panel as a Menu in Architect (it automatically creates a Menu type when I click create Menu), so I use this code in the Taskbar afterLayout event:
container.getComponent('StartButton').menu = container.getComponent('StartMenuView');
PROBLEMS: The StartMenu displayed correctly when I click the Button, but I can't close it no matter where I click. What did I miss? Any help is appreciated.
Decided to switch to another much simpler approach that I've just figured: Use my "StartMenu" Panel as a Menu Item in my "Start" Button.

Qt:creating a dynamic button

I want to create an application in which i will create a button and by pressing that button as list of options will open and i can choose one of them.for example i will create a button named "searching algorithm" and by clicking this button a list will open at same place which display two options as linear search and binary search.can anyone give me an idea how to do that?
You want a QComboBox:
The QComboBox widget is a combined button and popup list.
I believe what you need is a popup window where you can have list of options, whenever your button is clicked show this window, hide it when user selects an item in the list or clicks outside of the working area. There is an example you can use as a reference:
QT 4.7 Google Suggest Example
hope this helps,
regards

What is the proper name for a multibutton?

I'm trying to design a UI in Qt and I can't find anywhere in the designer a button which can be "droped down" like combobox. What I mean by that is that I would like to have this button with his "default" option choosen so if I like it I would have to just click on it but if I would like to choose different option I would be able to clik the little arrow on the right side of this button and then pick option suitable for me at that moment.
You're looking for a QToolButton that has a set of actions or a menu set on it. From the documentation, the QToolButton::ToolButtonPopupMode...
Describes how a menu should be popped up for tool buttons that has a menu set or contains a list of actions.
Of it's values, the two that I see most frequently are DelayedPopup:
After pressing and holding the tool button down for a certain amount of time (the timeout is style dependant, see QStyle::SH_ToolButton_PopupDelay), the menu is displayed. A typical application example is the "back" button in some web browsers's tool bars. If the user clicks it, the browser simply browses back to the previous page. If the user presses and holds the button down for a while, the tool button shows a menu containing the current history list
And MenuButtonPopup:
In this mode the tool button displays a special arrow to indicate that a menu is present. The menu is displayed when the arrow part of the button is pressed.

Resources