Ranorex

mainmenu control not found

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



Joined: 02 Oct 2006
Posts: 3

PostPosted: Mon Oct 09, 2006 1:10 pm    Post subject: mainmenu control not found
hi
i use Ranorex to test GUI of Application Made by Visual Studio.NET 2003 , and i want to work with main menu control , i try menustrip as : MenuStrip menuStrip = form.FindMenuStrip("mmnMain"); but it always return null and i didn't found any control in Ranorex name MainMenu.
i will be so happy if you can help me.
thanks
bye
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Mon Oct 09, 2006 9:34 pm    Post subject:
The classes MenuStrip, ToolStrip and StatusStrip are new in Visual Studio 2005 and does not exist in Visual Studio 2003.
(We extended the RanorexNet documentation with this information for the next version.)
Visual Studio 2003 applications have an old style menu bar with menu handle, not a menu strip.
You can automate such a menu as follows:

Code: click into code to enlarge
Menu menu = new Menu(form);
if (menu != null)
{
    // Get the item count of the first submenu
    ret = menu.GetItemCount(1);
    Console.WriteLine("  GetItemCount(1)={0}", ret);
   
    // Get the text of the second menu item of the first submenu
    itemText = menu.GetItemText(1, 2);
    Console.WriteLine("  GetItemText(1,2)={0}", itemText);
   
    // Select a menu item
    ret = menu.SelectItemText("Submenu2", "Submenu2Item1");
}


The following code sample dumps out all menu item of the submenu 1 and 2.

Code: click into code to enlarge
for (int submenu = 1; submenu <= 2; submenu++)
{
    Int32 itemCount = menu.GetItemCount(submenu);
    for (int itemPosition = 1; itemPosition <= itemCount; itemPosition++)
    {
        itemText = menu.GetItemText(submenu, itemPosition);
        Console.WriteLine("    Item({0})={1}", itemPosition, itemText);
    }
}


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



Joined: 02 Oct 2006
Posts: 3

PostPosted: Tue Oct 10, 2006 8:23 am    Post subject:
thanks for your reply , really your reply is very useful for me.
thanks again.
bye
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