Ranorex

Problem obtaining menu from form.

 
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexNet
View previous topic :: View next topic  
Author Message
jeffras



Joined: 06 Nov 2006
Posts: 5

PostPosted: Tue Nov 07, 2006 10:38 pm    Post subject: Problem obtaining menu from form.
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
Back to top
View user's profile Send private message
jeffras



Joined: 06 Nov 2006
Posts: 5

PostPosted: Tue Nov 07, 2006 11:00 pm    Post subject:
After more digging at this problem I found that our application uses a non windows menubar (http://www.componentsource.com/products/514434/19963/summary.html)

Is there any way to access the menu items of the control or am I out of luck?

Thanks
Jeff
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Wed Nov 08, 2006 9:22 am    Post subject:
Can you see the menu items with RanorexSpy?
If yes, then you can automate the menu with Ranorex.

Jenö Herget
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
jeffras



Joined: 06 Nov 2006
Posts: 5

PostPosted: Wed Nov 08, 2006 5:39 pm    Post subject:
I can only see the menu and not the individual menu items with ranorexspy. It looks like I will not be able to test the menubar with ranorex :0(

Thanks for the help with this.

Jeff
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Wed Nov 08, 2006 9:00 pm    Post subject:
You can also send Keyboard shortcuts to start a menu command.
To start the File New menu you can send:

Code: click into code to enlarge
// Send ALT + f + n
form.SendKeys("%fn");

or if you want to do it slower:

Code: click into code to enlarge
// Send ALT + f + n
form.SendKeys("%f");
Application.Sleep(500);
form.SendKeys("n");
Application.Sleep(500);

You can also send global Keyboard events with the function Application.SendKeys();

Jenö Herget
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
CookieMonster



Joined: 14 Aug 2006
Posts: 6

PostPosted: Fri Nov 24, 2006 9:29 am    Post subject:
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.
Code: click into code to enlarge
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);
                }
            }
        }     
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexNet All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum