I have used the examples of passing the form to the menu constructor on our application and I always receive a menu object with no items (getItemCount() = 0). I can iterate through all of the controls and I have identified the main menu control. Is there a way to create a menu object from the actual control?
Thanks
Jeff
Problem obtaining menu from form.
After more digging at this problem I found that our application uses a non windows menubar (http://www.componentsource.com/products ... mmary.html)
Is there any way to access the menu items of the control or am I out of luck?
Thanks
Jeff
Is there any way to access the menu items of the control or am I out of luck?
Thanks
Jeff
You can also send Keyboard shortcuts to start a menu command.
To start the File New menu you can send:
or if you want to do it slower:
You can also send global Keyboard events with the function Application.SendKeys();
Jenö Herget
Ranorex Team
To start the File New menu you can send:
Code: Select all
// Send ALT + f + n
form.SendKeys("%fn");
Code: Select all
// Send ALT + f + n
form.SendKeys("%f");
Application.Sleep(500);
form.SendKeys("n");
Application.Sleep(500);
Jenö Herget
Ranorex Team
-
- Certified Professional
- Posts: 74
- Joined: Mon Aug 14, 2006 7:17 pm
- Location: CH
Hi Jeffras,
I had the same problems with the DevExpress Controls. If Ranorex can find the main menu control, then you can use a modified version of the DumpTree Example, in my example (ClickChildElement) . But I works only if you can set the Accessibility Name to the submemu items
Best Regards and I hope it helps
Dan
Here the Example: It is a little bit slow but it works for me.
I had the same problems with the DevExpress Controls. If Ranorex can find the main menu control, then you can use a modified version of the DumpTree Example, in my example (ClickChildElement) . But I works only if you can set the Accessibility Name to the submemu items
Best Regards and I hope it helps
Dan
Here the Example: It is a little bit slow but it works for me.
Code: Select all
public void ClickChildElement(Element mnuMainElement, int level, String ctrlName)
{
level++;
int childCount = element.GetChildCount;
for (int index = 0; index < childCount; index++)
{
Element child = element.GetChild(index);
if (child.Name.Equals(ctrlName))
{
Mouse.ClickElement(child);
}
else
{
GetChildElement(child, level, ctrlName);
}
}
}