Hi,
I am using RFT8.0 and Visual Studio2008 with TestAdvantage proxy to work with infragistics controls in our application.
Please help for the below issue while working with Menubar/Toolbar control object.
Below code snippet used to click on Menu bar items using its caption, but we are unable to add one more menu item for AtList method. Here we need to click on Driver Status submenu item after List Setup parent menu item.
Dim objTool111 As UltraToolbarsDockAreaTestObject 'Find Tool Bar Items AMS_Globalvariables.tObj = AMS_Globalvariables.objWinForm.Find(AtChild(".class", "Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea", "Name", "_FormBase_Toolbars_Dock_Area_Top")) If AMS_Globalvariables.tObj.Length > 0 Then objTool111 = CType(AMS_Globalvariables.tObj(0), UltraToolbarsDockAreaTestObject) Else LogError("Failed to Find the Tool Bar Object") End If
'Click on Toolbox-->System Administration-->List Setup-->Driver Status... objTool111.Click(AtList(AtText("MainMenuToolbar"), AtName("&Toolbox"), AtName("&System Administration"), AtName("List Setup")))
AtList() method accepting only four parameter itmes(Captions) as mentioned in above code snippet, so how to pass more than four items in AtList method. Let us know how to use the subitems in array format.
Kindly help me in this regard.
Thanks,
Vijay.
Hi Vijhay,
You access Items in the “Tools” collection by providing a string key or an index of the item. For example Tools[0] is the first tool in the collection. To get a list of all properties on the SharedProps object you can go to this link: https://www.infragistics.com/help/winforms/infragistics.win.ultrawintoolbars~infragistics.win.ultrawintoolbars.toolbase~sharedpropsI noticed that you are using the Caption property on the SharedProps object. I think you better off using the CaptionResolved property defined directly on the Tool. Here is how you can loop through the Tools under “Suspense” popup menu.
str = objTool111.GetNAProperty("ToolbarsManager.Toolbars[1].Tools[12].CaptionResolved")str1 = “”If InStr(str, "Suspense") > 0 Then ToolsCount = objTool111.GetNAProperty("ToolbarsManager.Toolbars[1].Tools[12].Tools.Count") For j = 0 To ToolsCount – 1 str = "ToolbarsManager.Toolbars[1].Tools[12].Tools[" & j & "]" If objTool111.GetNAProperty(str & “.VisibleResolved”) = True str = objTool111.GetNAProperty(str) str1 = str1 & CSTR(objTool111.GetNAProperty(str & “CaptionResolved”)) & “, ” End If Next LogInfo("Visible Tools under Suspense: " & str1)Else LogInfo("No Menu Item Matched with the expected")End If
You can check the different properties defined on each tool by visiting the following link:For All tools (Base class): https://www.infragistics.com/help/winforms/infragistics.win.ultrawintoolbars~infragistics.win.ultrawintoolbars.toolbase_membersFor PopupTools: https://www.infragistics.com/help/winforms/infragistics.win.ultrawintoolbars~infragistics.win.ultrawintoolbars.popuptoolbase_membersI know you don’t use the recorder of VP’s but if you could, that will save you a lot of coding as we provide a Verification point to do exactly what you are trying to do. You can create this VP on the root popup tool and it will check the child tools (and their children if they exist) this VP will can give you a look at the different property values and you can choose which one you want to verify (like if a tool is enabled or disabled)
I hope this will be helpful.Regards,Ammar
Hello Ammar,
Woderfull!!! Its working fine with code snippet you have provided. Thank you very much Ammar.
Can you please provide below one more clarification regarding Toolbar items.
We need to validate the popupmenu items, so we are able to retreive the popup menu items captions using the below code snippet. Here we used parent tool menu item index(key) as '12' to get the submenu popup items. So instead of key, Is there any option or property to specify the submenu title or caption to get the popup items of that submenu. Because the key may vary in future and there are hidden keys or items avaialble in the toolbar. Here the caption for the key 12 is 'Suspense'.
str = objTool111.GetNAProperty("ToolbarsManager.Toolbars[1].Tools[12].SharedProps.Caption") If InStr(str, "Suspense") > 0 Then For j = 0 To 1 str = "ToolbarsManager.Toolbars[1].Tools[12].Tools[" & j & "].SharedProps.Caption" str = objTool111.GetNAProperty(str) str1 = str1 & str Next Else LogInfo("No Menu Item Matched with the expected") End If
How to see the sub properties of "Toolbarmanager.Toolbars.Tools.SharedProps...." and provide any helplink or document to refer the properties of SharedProps method.
Please let me know if you need any more information.
Thanks a lot for your support.
Thanks & Regards,Vijay.
Hi Vijay,
Any list with more than four items you will need to use the following overload for the AtList: AtList( subitems() As Rational.Test.Ft.Script.Subitem) Passing in an array of SubItem.
So for your example you will need to use this:
objTool111.Click(AtList(New Subitem() {AtText("MainMenuToolbar"), AtName("&Toolbox"), AtName("&System Administration"), AtName("List Setup"), AtName("Driver Status...")}))
I’m sure this will work for you. Let me know if you any issues. If this works for you, remember to verify it as an answer so others can benefit from it
Regards,
Ammar