Skip to content

Infragistics Community Forum / Test Automation For Micro Focus Uft Windows Forms / How to get the menu items for lower level menu

How to get the menu items for lower level menu

New Discussion
Brian
Brian asked on Mar 29, 2013 9:16 AM

Good afternoon,

I have a menu which has child menus that I have already built a functio work with. I now need to go 1 more level deep. Below is the code for the function and the calling code. I need some help on line 183 which is the last code to get the 3rd level menu.

Menu / Item 1 works with existing funciton

Menu / Item 1 / SubItem 1 I cannot get past the error on line 183 see code below.

Regards,

Brian

Set objectMainPage = SwfWindow(“Summit FT – Bond Definition”)

‘Process the selection of  Bond Definiton, Analytics, Details… from the menu
‘Build up the menu code here to select from the menus
Set objectToolBar =objectMainPage.SwfToolbar(“_toolbarsDockAreaTop”)
specifiedToolBar = “Desktop Menu”
specfiiedToolBarMenuItem = “Bond Definition” ‘This is what the text that you see is without the shortcut keybon
specifiedToolBarSubMenu = “Validate” ‘Text is case sensitive
specifiedToolBarSubSubMenu = “Details…” ‘Text is case sensitive
nameToolBar = “” ‘Toolbar name
nameToolBarMenu = “” ‘Toolbar main menu item
nameToolBarMenuSubMenu = “” ‘The submenu name
nameToolBarMenuSubSubMenu = “” ‘The submenu name
objectToolBarSubSubmenu = “” ‘The object to recieve the subsubmenu object for validation of enabled etc properties in the calling script
reporterDetailsFuncSelectToolBar = “”
‘Get the toolbar text/name with the toolbarbutton text/name
eventCodeFuncSelectToolBarMenu = CommonTMSSelectToolBarMenuItemTwoLevels(objectToolBar, specifiedToolBar, specfiiedToolBarMenuItem, specifiedToolBarSubMenu, specifiedToolBarSubSubMenu, nameToolBar, nameTBarItem, nameToolBarMenuSubMenu, nameToolBarMenuSubSubMenu, objectToolBarSubSubmenu, reporterDetailsFuncSelectToolBar)
If  eventCodeFuncSelectToolBarMenu = 0 Then
‘Click on the menu item by opening the dropdown and then selecting the submenu
objectToolBar.DropdownToolbarTool specifiedToolBar,nameTBarItem
‘Click the submenu item right afterwards or it will not work ***No Steping Though This one
‘DropdownMenuTool “Desktop Menu,186:EntityView”,”197:Analytics”
objectToolBar.DropdownMenuTool nameToolBar & “,” &  nameTBarItem,  nameToolBarMenuSubMenu
‘Click the subsubmenu item right afterwards or it will not work ***No Steping Though This one
‘ClickMenuTool “Desktop Menu,186:EntityView,197:Analytics”,”208:Detail”
objectToolBar.ClickMenuTool nameToolBar & “,” &  nameTBarItem,  nameToolBarMenuSubSubMenu
‘Check if the tab for the main page has the Asset Details Tab
Else
eventCode = 1
eventLoopCode = 1
reporterDetails = reporterDetails & reporterDetailsFuncSelectToolBar
End If

‘ @Function Name  CommonTMSSelectToolBarMenuItemTwoLevels
‘ @Description  Select the submenu item from the menu item. We are matching based on the text displayed for the menu item not the recorded values
‘ *******NOTE: you will need to get the toolbar name by recording the selection of a buttom and getting the toolbar name
‘ *****************Example
‘ SwfWindow(“Summit FT – Calendar Definition”).SwfToolbar(“_toolbarsDockAreaTop”).DropdownToolbarTool “Desktop Menu”,”57:EntityView”
‘DropdownMenuTool “Desktop Menu,186:EntityView”,”197:Analytics”
‘ClickMenuTool “Desktop Menu,186:EntityView,197:Analytics”,”208:Detail”
‘ Toolbar =  “Desktop Menu”
‘ToolbarMenu= “EntityView”   ++++++++++++ We have replaced the compare based on the visible text to the user instead of the Key which is EntityView
‘ ToolbarSubMenu = “Open”

‘********************Menu Submenu Selection
‘ Example if nameTBarMenu = “File” &  nameTBarSubMenu “Open” we will open the dropdown Menu for File and then select the submenu Open item
‘ @Documentation <objectPageToolBar> the toolbar control in the object repository for the page
‘ @Documentation <nameSpecifiedToolBar> the name of the toolbar to find
‘ @Documentation <nameSpecifiedToolBarButton> the name of the toolbar button to find
‘ Returns:
‘  <nameTBar> the toolbar text/name for selecting the button
‘  <nameTBarItem> the toolbar button text/name for selecting the button
‘  <objectTBarSubMenu> the menu object found for use in the calling script to check enabled and other status.
‘  <resultDetails> the details regarding the function
‘  <resultCode> the result code for pass or fail
‘  Otherwise, the value of the NoData environment valueJim
‘ Created: 04/25/2011 BLW
‘ Last Updated:
Function  CommonTMSSelectToolBarMenuItemTwoLevels(byVal objectPageToolBar, byVal nameSpecifiedToolBar, byRef nameSpecifiedToolBarMenu, ByRef nameSpecifiedToolBarSubMenu, ByRef nameSpecifiedToolBarSubSubMenu, byRef nameTBar, byRef nameTBarMenu, byRef nameTBarSubMenu, byRef nameTBarSubSubMenu, ByRef objectTBarSubSubMenu, byRef resultDetails)
‘ &&&&&&&&&&&& Note the values in the menu and compares are text and Case Senseitive. please insure you send in the value to match the menu item
resultCode = 2
countToolBar = 0
booleanToolBarFound = False
booleanToolBarMenuFound = False
booleanToolBarSubMenuFound = False
booleanToolBarSubSubMenuFound = False
objectTBarManager = “” ‘Temp destroy on exit
objectTBar = “” ‘Temp destroy on exit
‘Set the toolbar manager based on the control from the page
Set objectTBarManager = objectPageToolBar.Object.ToolbarsManager.Toolbars
countToolBar = objectTBarManager.Count
If  countToolBar > 0Then
For loopToolbars = 0 to countToolBar – 1
nameTBar = Trim(objectTBarManager.GetItem(loopToolbars).Key)
If nameTBar =  nameSpecifiedToolBar Then
Set objectTBar =  objectTBarManager.GetItem(loopToolbars)
booleanToolBarFound = True
Exit For
End If
Next
If booleanToolBarFound = False Then
resultCode = 1
resultDetails = resultDetails & ” WE DID NOT FIND toolbar of: ” & nameSpecifiedToolBar & ” WE CANNOT SEARCH FOR THE MENU.”
End If
Else
resultCode = 1
resultDetails = resultDetails & ” WE DID NOT FIND ANY TOOLBARS.”
End If
‘Start looking for the menu if the assigned toolbar was found
If booleanToolBarFound = True Then
‘See if we can get the menu next
countToolBarMenus = objectTBar.Tools.Count
If  countToolBarMenus > 0 Then
‘Check the button and see if we can find the one we specified
For loopMenus = 0 to countToolBarMenus -1
inStringToolName= “”
textTBarItem = “”
nameTBarMenu = objectTBar.Tools.GetItem(loopMenus).Key
textTBarMenu = CStr(objectTBar.Tools.GetItem(loopMenus).CaptionResolved)
stringHotKey =”&”
‘Strip out the & key for the hotkey in the menu item
instringLoc = InStr(1, textTBarMenu, stringHotKey)
lenString = Len(textTBarMenu)
tempStringLeft = “”
tempStringRight = “”
Select Case instringLoc
Case 0
‘Do nothing there is no hotkey specified for this item
Case 1
‘Remove the & from the front of the text
textTBarMenu = Right(textTBarMenu, lenString – instringLoc)
Case Else
‘Build the string by gettting what is left of the & and then what is right of the &
tempStringLeft = Left(textTBarMenu,instringLoc – 1)
tempStringRight = Right(textTBarMenu, lenString – instringLoc)
textTBarMenu = tempStringLeft & tempStringRight
End Select
‘Check if the displayed text matches the requrested menu item
If  textTBarMenu = nameSpecifiedToolBarMenu Then
booleanToolBarMenuFound = True
Set objectTBarMenu = objectTBar.Tools.GetItem(loopMenus)
Exit For
End If
Next
If  booleanToolBarMenuFound = False Then
resultCode = 1
resultDetails = resultDetails & ” We found the toolbar of: ” & nameSpecifiedToolBar & ” BUTthe menu item of: ” & nameSpecifiedToolBarMenu & ” was not found.”
End If
Else
resultCode = 1
resultDetails = resultDetails & ” We found the toolbar of: ” & nameSpecifiedToolBar & ” BUT NO MENUS WERE FOUND.”
End If
End If ‘Tool Bar found and looking for the menu
‘Start Looking for the submenu item if menu found
If booleanToolBarMenuFound = True Then
‘See if the menu item has any submenu items
countToolBarSubMenus = objectTBarMenu.Tools.Count
If  countToolBarSubMenus > 0 Then
‘Check the button and see if we can find the one we specified
For loopSubMenus = 0 to countToolBarSubMenus -1
nameTBarSubMenu = objectTBarMenu.Tools.GetItem(loopSubMenus).Key
textTBarSubMenu = CStr(objectTBarMenu.Tools.GetItem(loopSubMenus).CaptionResolved)
stringHotKey =”&”
‘Strip out the & key for the hotkey in the menu item
instringLoc = InStr(1, textTBarSubMenu, stringHotKey)
lenString = Len(textTBarSubMenu)
tempStringLeft = “”
tempStringRight = “”
‘Use case statement here to work with 0, 1, or else
Select Case instringLoc
Case 0
‘Do nothing there is no hotkey
Case 1
‘Remove the & from the front of the text
textTBarSubMenu = Right(textTBarSubMenu, lenString – instringLoc)
Case Else
‘Build the string by gettting what is left of the & and then what is right of the &
tempStringLeft = Left(textTBarSubMenu,instringLoc – 1)
tempStringRight = Right(textTBarSubMenu, lenString – instringLoc)
textTBarSubMenu = tempStringLeft & tempStringRight
End Select
”Check if the displayed text matches the requrested submenu item
If  Cstr(trim(textTBarSubMenu)) = Cstr(trim(nameSpecifiedToolBarSubMenu)) Then
Set objectTBarSubMenu = objectTBarMenu.Tools.GetItem(loopSubMenus) ‘Set the object only if correct object is found
booleanToolBarSubMenuFound = True
Exit For
End If
Next
If booleanToolBarSubMenuFound = False Then
resultCode = 1
resultDetails = resultDetails & ” We found the toolbar of: ” & nameSpecifiedToolBar & ” the toolbar contained the menu of: ” & nameSpecifiedToolBarMenu &_
” BUT the submenu of: ” & namespecifiedToolBarSubMenu & ” WAS NOT DISPLAYED. ”
End If
Else
resultCode = 1
resultDetails = resultDetails & ” We found the toolbar of: ” & nameSpecifiedToolBar & ” the toolbar contained the menu of: ” & nameSpecifiedToolBarMenu &_
“however, NO SUBMENU ITEMS WERE AVAILABLE.”
End If
End If
‘Start Looking for the SubSubMenu if we found the SubMenu item
If booleanToolBarSubMenuFound = True Then
‘See if the menu item has any submenu items
countToolBarSubSubMenus = objectTBarSubMenu.Tools.Count ‘Error Object doesn’t support this property or method: ‘objectTBarSubMenu.Tools’  Line (183): “countToolBarSubSubMenus = objectTBarSubMenu.Tools.Count”.
  If  countToolBarSubSubMenus  > 0 Then
‘Check the button and see if we can find the one we specified
For loopSubSubMenus = 0 to countToolBarSubSubMenus -1
nameTBarSubSubMenu = objectTBarSubMenu.Tools.GetItem(loopSubSubMenus).Key
textTBarSubSubMenu = CStr(objectTBarSubMenu.Tools.GetItem(loopSubSubMenus).CaptionResolved)
stringHotKey =”&”
‘Strip out the & key for the hotkey in the menu item
instringLoc = InStr(1, textTBarSubMenu, stringHotKey)
lenString = Len(textTBarSubMenu)
tempStringLeft = “”
tempStringRight = “”
‘Use case statement here to work with 0, 1, or else
Select Case instringLoc
Case 0
‘Do nothing there is no hotkey
Case 1
‘Remove the & from the front of the text
textTBarSubSubMenu = Right(textTBarSubSubMenu, lenString – instringLoc)
Case Else
‘Build the string by gettting what is left of the & and then what is right of the &
tempStringLeft = Left(textTBarSubSubMenu,instringLoc – 1)
tempStringRight = Right(textTBarSubSubMenu, lenString – instringLoc)
textTBarSubSubMenu = tempStringLeft & tempStringRight
End Select
”Check if the displayed text matches the requrested submenu item
If  Cstr(trim(textTBarSubSubMenu)) = Cstr(trim(nameSpecifiedToolBarSubSubMenu)) Then
Set objectTBarSubSubMenu = objectTBarSubMenu.Tools.GetItem(loopSubSubMenus) ‘Set the object only if correct object is found
booleanToolBarSubSubMenuFound = True
Exit For
End If
Next
If booleanToolBarSubSubMenuFound = True Then
‘Report we found the submenu item
resultDetails = resultDetails & ” We found the toolbar of: ” & nameSpecifiedToolBar & ” the toolbar contained the menu of: ” & nameSpecifiedToolBarMenu &_
“and the submenu of: ” & namespecifiedToolBarSubMenu & ” but the sub submenu of: ” & nameSpecifiedToolBarSubSubMenu & ” WAS DISPLAYED. ”
Else
resultCode = 1
resultDetails = resultDetails & ” We found the toolbar of: ” & nameSpecifiedToolBar & ” the toolbar contained the menu of: ” & nameSpecifiedToolBarMenu &_
“and the submenu of: ” & namespecifiedToolBarSubMenu & ” but the sub submenu of: ” & nameSpecifiedToolBarSubSubMenu & ” WAS NOT DISPLAYED. ”
End If
Else
resultCode = 1
resultDetails = resultDetails & ” We found the toolbar of: ” & nameSpecifiedToolBar & ” the toolbar contained the menu of: ” & nameSpecifiedToolBarMenu &_
“and the submenu of: ” & namespecifiedToolBarSubMenu & “however, NO SUB SUBMENU ITEMS WERE AVAILABLE.”
End If
End If

Set objectTBarManager = Nothing ‘Temp destroy on exit
Set objectTBar = Nothing ‘Temp destroy on exit
Set objectTBarMenu = Nothing ‘Temp destroy on exit
CommonTMSSelectToolBarMenuItemTwoLevels = resultCode
End Function

 

Sign In to post a reply

Replies

  • 0
    Michael Germann
    Michael Germann answered on Jun 1, 2011 9:32 PM

    It's hard to say specifically what's wrong with it by looking at the code. But what I can say is, likely the Tool it's interacting with at that moment is not what you believe it is, either it's null, a tool that doesn't have subtools, or is merged from a parent mdi toolbar, and therefore is just a placeholder tool, that you need to look at the UnderlyingTool property to interact with it.  Start with eliminating the excess. When it hits the error at that line, look at the values of all the pertinent local variables, to get your bearings of is it where you believe it is, and is the tool you are interacting with is the type of tool that you expected.

     

    • 0
      Brian
      Brian answered on Jun 2, 2011 1:32 PM

      Hi Michael,

      I do not really follow what you are saying here. The function has gotten rather large just to get the the toolbar, menu, submenu items. This code works and allows me to select the sub menu when I need to . Unfortunately the submenu of the submenu is a different issue. I think the issue may be in line 164 where I have found the submenu item and I set the object so I can start looking for the next level down.

      Set objectTBarSubMenu = objectTBarMenu.Tools.GetItem(loopSubMenus) 'Set the object only if correct object is found

      The above line sets the submenu. I then need to find out how to get the next set of menu items.

      Here is the recorded code for the click. It will work only until I restart the application or at best on just my machine due to the dynamic nature of the menus.

      SwfWindow("Summit FT – Bond Definition").SwfToolbar("_toolbarsDockAreaTop").DropdownToolbarTool "Desktop Menu","50:EntityView"
      SwfWindow("Summit FT – Bond Definition").SwfToolbar("_toolbarsDockAreaTop").DropdownMenuTool "Desktop Menu,50:EntityView","78:Maintenance"
      SwfWindow("Summit FT – Bond Definition").SwfToolbar("_toolbarsDockAreaTop").ClickMenuTool "Desktop Menu,50:EntityView,78:Maintenance","79:PastReset"

      As far as debuging the code. I have stepped through all the code to the line which states:  If booleanToolBarSubMenuFound = True Then which is the line above 183. The values found are correct. The other issue is of course that we cannot look at the properties of the menu with QTP. What other properties can I set to get the final menu item?

      Please let me know if you have any questions or if I should open a ticket on this so we can speak over the phone.

      Regards,

      Brian

      • 0
        Michael Germann
        Michael Germann answered on Jun 3, 2011 4:58 PM

          A ticket has been opened, and it could be useful if you contacted our developer support directly on this matter. The issue from what I can tell is that you are getting an exception:

        'Error Object doesn't support this property or method: 'objectTBarSubMenu.Tools'  Line (183): "countToolBarSubSubMenus = objectTBarSubMenu.Tools.Count".

        It is basically saying that the subMenu object that you retrieved does not have a Tools property. Since I imagine you were expecting some form of PopUpMenu, which would have a Tools property, then likely the Tool you grabbed is not a PopUpMenu tool.

        Why it isn't I cannot say, I can say possibilities, one of which is the Tool you grabbed, is an MdiPlaceHolderTool, which is used when the actually tool you want is housed on a parent form and not on the child form that you are interacting with. To access the tool you want, you need to see if the UnderlyingTool property has a value or not, and if so get the Tools property of that.This of course is typically really only a possibility if you have a form within another form, in which the parent form has the same tool in it even if you closed the child form.

        It could also be some flaw in how you are getting the subMenu, it's honestly hard for me to tell without walking through it, but again I would suggest checking to see if the CaptionResolved is what you believe it to be. If it is, and it using UnderlyingTool does not resolve it, then I would recommend contacting our DeveloperSupport to have them walk through it with you.

      • 0
        Brian
        Brian answered on Jun 8, 2011 1:09 PM

        Hi Michael and David,

        I am inserting a screen capture of the menu that I am trying to work with. This does not appear to be anything which is unique or different from the other levels of the menu that I have been able to work with successfully. Please let me know what else we can try to get this menu so we can select it.

        Regards,

        Brian

      • 0
        Dave Frischknecht
        Dave Frischknecht answered on Jun 8, 2011 9:23 PM

        Hello Brian,

        In order for me to really be able to help you with this, I would need a sample application and script which reproduces the issue.  Once you have everything in one ZIP file, you can attach it to a post by selecting the Options tab before submitting your post.

      • 0
        Brian
        Brian answered on Jun 9, 2011 1:23 PM

        Hi Dave,

        Unfortunately we cannot get you a sample of the menu code from the third party supplier. The function I have given you the code for in the forum is an extension of the following menu code which works to get the second level menu as noted below. This code was built using information from the Infragistic site. Do you have menus like this in your sample applications which we could use to see if we can get to the next level of menus?

        Any help on getting this done would be appreciated.

         

        Regards,

        Brian.

        ' @Function Name  CommonTMSSelectToolBarMenuItem
        ' @Description  Select the submenu item from the menu item. We are matching based on the text displayed for the menu item not the recorded values
        ' *******NOTE: you will need to get the toolbar name by recording the selection of a buttom and getting the toolbar name
        ' *****************Example
        ' SwfWindow("Summit FT – Calendar Definition").SwfToolbar("_toolbarsDockAreaTop").DropdownToolbarTool "Desktop Menu","57:EntityView"
        'SwfWindow("Summit FT – Calendar Definition").SwfToolbar("_toolbarsDockAreaTop").ClickMenuTool "Desktop Menu,57:EntityView","60:Open"
        ' Toolbar =  "Desktop Menu"
        'ToolbarMenu= "EntityView"   ++++++++++++ We have replaced the compare based on the visible text to the user instead of the Key which is EntityView
        ' ToolbarSubMenu = "Open"

        '********************Menu Submenu Selection
        ' Example if nameTBarMenu = "File" &  nameTBarSubMenu "Open" we will open the dropdown Menu for File and then select the submenu Open item
        ' @Documentation <objectPageToolBar> the toolbar control in the object repository for the page
        ' @Documentation <nameSpecifiedToolBar> the name of the toolbar to find
        ' @Documentation <nameSpecifiedToolBarButton> the name of the toolbar button to find
        ' Returns:
        '  <nameTBar> the toolbar text/name for selecting the button
        '  <nameTBarItem> the toolbar button text/name for selecting the button
        '  <objectTBarSubMenu> the menu object found for use in the calling script to check enabled and other status.
        '  <resultDetails> the details regarding the function
        '  <resultCode> the result code for pass or fail
        '  Otherwise, the value of the NoData environment valueJim
        ' Created: 04/25/2011 BLW
        ' Last Updated:
        Function  CommonTMSSelectToolBarMenuItem(byVal objectPageToolBar, byVal nameSpecifiedToolBar, byRef nameSpecifiedToolBarMenu, ByRef nameSpecifiedToolBarSubMenu, byRef nameTBar, byRef nameTBarMenu, byRef nameTBarSubMenu, ByRef objectTBarSubMenu, byRef resultDetails)
        ' &&&&&&&&&&&& Note the values in the menu and compares are text and Case Senseitive. please insure you send in the value to match the menu item
         resultCode = 2
         countToolBar = 0
         booleanToolBarFound = False
         booleanToolBarMenuFound = False
         booleanToolBarSubMenuFound = False
         objectTBarManager = "" 'Temp destroy on exit
         objectTBar = "" 'Temp destroy on exit
         'Set the toolbar manager based on the control from the page
         Set objectTBarManager = objectPageToolBar.Object.ToolbarsManager.Toolbars
         countToolBar = objectTBarManager.Count
         If  countToolBar > 0Then
          For loopToolbars = 0 to countToolBar – 1
           nameTBar = Trim(objectTBarManager.GetItem(loopToolbars).Key)
           If nameTBar =  nameSpecifiedToolBar Then
            Set objectTBar =  objectTBarManager.GetItem(loopToolbars)
            booleanToolBarFound = True
            Exit For
           End If
          Next
          If booleanToolBarFound = True Then
           'See if we can get the menu next
           countToolBarMenus = objectTBar.Tools.Count
           If  countToolBarMenus > 0 Then
            'Check the button and see if we can find the one we specified
            For loopMenus = 0 to countToolBarMenus -1
             inStringToolName= ""
             textTBarItem = ""
             nameTBarMenu = objectTBar.Tools.GetItem(loopMenus).Key
             textTBarMenu = CStr(objectTBar.Tools.GetItem(loopMenus).CaptionResolved)
             stringHotKey ="&"
             'Strip out the & key for the hotkey in the menu item
             instringLoc = InStr(1, textTBarMenu, stringHotKey)
             lenString = Len(textTBarMenu)
             tempStringLeft = ""
             tempStringRight = ""
             Select Case instringLoc
              Case 0
               'Do nothing there is no hotkey specified for this item
              Case 1
               'Remove the & from the front of the text
               textTBarMenu = Right(textTBarMenu, lenString – instringLoc)
              Case Else
               'Build the string by gettting what is left of the & and then what is right of the &
               tempStringLeft = Left(textTBarMenu,instringLoc – 1)
               tempStringRight = Right(textTBarMenu, lenString – instringLoc)
               textTBarMenu = tempStringLeft & tempStringRight
             End Select
             'Check if the displayed text matches the requrested menu item
             If  textTBarMenu = nameSpecifiedToolBarMenu Then
              booleanToolBarMenuFound = True
              Set objectTBarMenu = objectTBar.Tools.GetItem(loopMenus)
              Exit For
             End If
            Next
            If booleanToolBarMenuFound = True Then
             'See if the menu item has any submenu items
             countToolBarSubMenus = objectTBarMenu.Tools.Count
             If  countToolBarSubMenus > 0 Then
              'Check the button and see if we can find the one we specified
              For loopSubMenus = 0 to countToolBarSubMenus -1
               nameTBarSubMenu = objectTBarMenu.Tools.GetItem(loopSubMenus).Key
               textTBarSubMenu = CStr(objectTBarMenu.Tools.GetItem(loopSubMenus).CaptionResolved)
               stringHotKey ="&"
               'Strip out the & key for the hotkey in the menu item
               instringLoc = InStr(1, textTBarSubMenu, stringHotKey)
               lenString = Len(textTBarSubMenu)
               tempStringLeft = ""
               tempStringRight = ""
               'Use case statement here to work with 0, 1, or else
               Select Case instringLoc
                Case 0
                  'Do nothing there is no hotkey
                Case 1
                                            'Remove the & from the front of the text
                 textTBarSubMenu = Right(textTBarSubMenu, lenString – instringLoc)
                Case Else
                 'Build the string by gettting what is left of the & and then what is right of the &
                 tempStringLeft = Left(textTBarSubMenu,instringLoc – 1)
                 tempStringRight = Right(textTBarSubMenu, lenString – instringLoc)
                 textTBarSubMenu = tempStringLeft & tempStringRight
               End Select
               ''Check if the displayed text matches the requrested submenu item
               If  Cstr(trim(textTBarSubMenu)) = Cstr(trim(nameSpecifiedToolBarSubMenu)) Then
                booleanToolBarSubMenuFound = True
                Exit For
               End If
              Next
              'See if we have found the submenu item
              If booleanToolBarSubMenuFound = True Then
               Set objectTBarSubMenu = objectTBarMenu.Tools.GetItem(loopSubMenus) 'Set the object only if correct object is found
               resultCode = 0
               resultDetails = resultDetails & " We found the toolbar of: " & nameSpecifiedToolBar & " the toolbar contained the menu of: " & nameSpecifiedToolBarMenu &_
                " and the submenu of: " & namespecifiedToolBarSubMenu & " was displayed. "
              Else
               resultCode = 1
               resultDetails = resultDetails & " We found the toolbar of: " & nameSpecifiedToolBar & " the toolbar contained the menu of: " & nameSpecifiedToolBarMenu &_
                " BUT the submenu of: " & namespecifiedToolBarSubMenu & " WAS NOT DISPLAYED. "
              End If
             Else
              resultCode = 1
              resultDetails = resultDetails & " We found the toolbar of: " & nameSpecifiedToolBar & " the toolbar contained the menu of: " & nameSpecifiedToolBarMenu &_
               "however, NO SUBMENU ITEMS WERE AVAILABLE."
             End If
            Else
             resultCode = 1
             resultDetails = resultDetails & " We found the toolbar of: " & nameSpecifiedToolBar & " BUT THE MENU OF: " & nameSpecifiedToolBarMenu & " WAS NOT FOUND."
            End If
           Else
            resultCode = 1
            resultDetails = resultDetails & " We found the toolbar of: " & nameSpecifiedToolBar & " BUT NO MENUS WERE FOUND."
           End If
             Else
           resultCode = 1
           resultDetails = resultDetails & " WE DID NOT FIND toolbar of: " & nameSpecifiedToolBar & " WE CANNOT SEARCH FOR THE MENU."
          End If
         Else
          resultCode = 1
          resultDetails = resultDetails & " WE DID NOT FIND ANY TOOLBARS."
         End If
         Set objectTBarManager = Nothing 'Temp destroy on exit
         Set objectTBar = Nothing 'Temp destroy on exit
         Set objectTBarMenu = Nothing 'Temp destroy on exit
         CommonTMSSelectToolBarMenuItem = resultCode
        End Function

      • 0
        Dave Frischknecht
        Dave Frischknecht answered on Jul 5, 2011 8:36 PM

        Hello Brian,

        The ClickMenuTool function takes two parameters; this is why you are seeing the comma you highlighted in your last update.  The string delimited by the first set of quotes identifies the menu which contains the tool that you want clicked.  The second string identifies the tool itself.  In order for the ClickMenuTool function to work properly, you need to pass two strings to it.  What you've been trying to do is pass just one string to it.  Try passing two strings in the same way that it gets recorded and see if it works.

      • 0
        QTP11_USER
        QTP11_USER answered on Mar 28, 2013 12:26 PM

        Haï

         

        What was the issue for the question befor ?

        I have the same error onD ropdownToolbarTool'  "Object doess't support this property or method 'ObjMenu.DropdownToolbarTool Toolbar,Menu1'

        Example : ObjMenu.DropdownToolbarTool "Desktop Menu","11:File"

        This error produce on windows 7 / 64 bits but does not produce on Windows XP SP3 / 32 bits.

        I'm in TA 2011 Vol2 for QTP 11.0

        Thanks for your help

      • 0
        Alan Halama
        Alan Halama answered on Mar 28, 2013 2:14 PM

        Hello,

        What patches do you have installed for QTP?

        Make sure you have QTP_00116 as this is needed for 64 bit testing.  Also if your application under test is targeting .NET 4.0 or you have Windows 7 SP1 installed then you may need to install QTPNET_00116 as that addresses issues with .NET 4.0 and Windows 7 SP1.

        Let me know if you have any questions with this matter.

      • 0
        QTP11_USER
        QTP11_USER answered on Mar 28, 2013 2:25 PM

        Thanks Alan for your reactivity.

        This KM talking only about QTP_00699, that i already install (with 2 other PATCHs QTP_00709 + QTP_00925) + One RRV_xx for result viewer.

        I do i search in HP Site and did not found any QTP_00116 or QTPNET_00116 to download.

        Please where do i can fiund theeses patchs ?

        Are they any where on ftp site in your side where i can download them ?

        Thanks for your help.

      • 0
        QTP11_USER
        QTP11_USER answered on Mar 28, 2013 5:25 PM

        FYI we wil create a CASE for HP to download the  QTPNET_00116 HOTFixe.

        I'l feed you back if the problem Persist.

        Thanks

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Brian
Favorites
0
Replies
11
Created On
Mar 29, 2013
Last Post
12 years, 11 months ago

Suggested Discussions

Created by

Created on

Mar 29, 2013 9:16 AM

Last activity on

Feb 20, 2026 11:41 AM