Forum Discussion

jmassey's avatar
jmassey
Contributor
9 years ago

Some simple items on ToolStrip not appearing in Object Browser

Hey all, I have a simple toolstrip on a print preview window that I am trying to automate. On the right hand side of the toolstrip are a textbox and buttons to navigate pages of the print job, and those are recognized fine with methods to automate them, but on the left side, I have a 'Close' button, a 'Print' button that is just a printer icon, and a 'Zoom' dropdown that is the type with a checkmark beside the selection. None of these appear at all in Object Browser. Any ideas how I can access them?

 

  • They'll be buttons within the toolstrip rather than separate child objects.

     

    Address them in a similar way as you would a dropdown - so by button name (if they have one) or index (less ideal as more breakable).

     

    Personally, I use ToolTip text on my .NET ToolStrips as the buttons are not visibly named on screen and index numbers are not reliable.

  • They'll be buttons within the toolstrip rather than separate child objects.

     

    Address them in a similar way as you would a dropdown - so by button name (if they have one) or index (less ideal as more breakable).

     

    Personally, I use ToolTip text on my .NET ToolStrips as the buttons are not visibly named on screen and index numbers are not reliable.

    • jmassey's avatar
      jmassey
      Contributor

      Nice, that seems to work for Print and Close. *Edit: Nevermind, figured out Zoom by just doing a recording and seeing what it does. It's convoluted, but it works. Still curious about the below, however:

       

      On a sort-of side note, I can use the Object Spy to find the dropdown options, but they are just seen as a direct child of the process, apparently? Also, I can't seem to find any way to map them. Once I unfocus them (e.g. by clicking 'Highlight Object in the Object Tree'), the dropdown collapses again and Object Browser can't find them. Isn't there some way to add an item to Name Mapping directly from Object Spy for cases like this? Or is there some other approach I should use for that kind of thing (even if in this particular case name mapping that item isn't the best approach, just in a general sense - how would I name map something that disappears when out of focus?)

      • Colin_McCrae's avatar
        Colin_McCrae
        Community Hero

        Objects that get destroyed when they lose focus can be tricky.

         

        My normal approach is to get what I can with CTRL + SHIFT + A. Which will at least give you a snapshot of the object at that point. From there, I tend to take the parent object (which is a property of the capture you have) and then write a little routine to trigger the transient object. Then using break points, gathered properties, and anything else I can get from debug info once paused.

         

        But it very much depends how helpful, or not, the object is. In the few cases I've had to resort to this, I've managed to find what I need to manipulate them to do what I need.

         

        I don't map objects like this. Just use routines to handle them dynamically at runtime.

         

        Other possibilities are ....

         

        1. If the object is a certain class/type of control, look up the documentation for it! You can usually get a lot of info on what *should* be available using this.

        2. If they are available, speak to the dev team. They wrote it, so they should know what it is, how to control it, and how it behaves.

         

        The dropdown should be similar to the tool strip. The options are not objects. They are part of the dropdown. So you'd map the dropdown and use a method to search/find/change the current option. Exactly how depends on the dropdown. There are loads of different types and how you manipulate them varies. Or, of course, it could be an entirely custom control the dev guys have built. It happens.