Forum Discussion

arijken's avatar
arijken
New Contributor
15 hours ago

Loop through submenuitems

I have an Delphi application.
I got a mainmenu Item "files" with 14  subitems which are are categories and every categroy has Submenu items ant every item opens a form.

I like to loop through all Submenu items to open the form and to perform an insert, modify and delete action 
I am using Javascript 
The problem I have now is that I can't seem find the main menu 

 

4 Replies

  • arijken's avatar
    arijken
    New Contributor

    The mainmenu is not available in the object Spy. I cannot select the menu items in the object spy

    The application is written in Delphi 12

     

    • Hassan_Ballan's avatar
      Hassan_Ballan
      Icon for Champion Level 3 rankChampion Level 3

      It’s important to clarify how TestComplete handles Delphi applications, because the main menu not appearing in Object Spy is expected for Delphi’s non-visual TMainMenu component. Delphi menu bars typically aren’t visible as separate GUI controls in the tree view even when the app is recognized. 

      However, the core issue here is version support:

      Official TestComplete documentation lists the Delphi versions it supports, and that list includes up through Delphi 10.4 (and earlier Delphi compiler versions) but does not list Delphi 12. That means native VCL/Open Application support may not be available for Delphi 12 applications. (SmartBear Support)

      Because of this:

      • If the application is recognized with native Delphi support (e.g., you see VCLObject() and native properties in Object Spy or Object Browser), you can access the form’s MainMenu property in code and iterate or click items via the Menu.Click() or Menu.Select() methods. 
      • If the app is not recognized with native Delphi support (likely with Delphi 12), then internal VCL properties like MainMenu won’t be exposed. In that scenario you can try to use the window/menus API — for example accessing the MainMenu object from the window and using its Click() method with a full path string for the menu item (e.g., "File|Open"). 

       

      Because you indicates the menu isn’t visible in Object Spy, that alone does not mean TestComplete fails to recognize the app; Delphi menus simply don’t show as separate visual objects in the hierarchy. The key question is whether native Delphi/VCL object access is available at all. If it isn’t, try the menu simulation methods.

      If this resolves your scenario, marking it as the solution helps future readers find it quickly.

  • rraghvani's avatar
    rraghvani
    Icon for Champion Level 3 rankChampion Level 3

    Is the Object Spy tool able to identify the menu? Are you able to see the properties? Can you provide screenshots?