Forum Discussion

forrestaustin's avatar
forrestaustin
Contributor
6 years ago
Solved

Is there a way to find the tooltip of a text field using a script?

I have a .NET application that I am writing a script for to check the min and max range of text fields. If the value entered is out of range then a tooltip appears stating the range. Is there a way to check to see if this tooltip appears without previously knowing the name of this tooltip? I'm envisioning something like click a textbox, entering a value out of range, and then searching to see if there is a tool tip on the screen. If there is then get the text from it. Does this sound possible?

There would only ever be one tooltip at a time.

 

Here is a pic for reference

  • Many times, an object will have a property called "Tooltip".  The tooltip itself is not a seperate object but a property that is populated as needed.

    So... my first thing to check would be to use the TestComplete Object Spy to inspect the edit field and look to see if such a property exists.  If this works, you wouldn't need to know the name of the tooltip object, simply check the tooltip of the edit box and validate the text.

  • tristaanogre's avatar
    tristaanogre
    6 years ago

    As mentioned... that was step one... .time to play Sherlock, my friend.

    so... step 2, since there doesn't appear to be a relevant property on the target object, the tooltip probably is a separate object.

    Using Object Spy, there's a method for object spy called Point and Fix.  Instead of the target reticule, you can use the Point and Fix method to highlight objects that might not be able to be targetted... can you use that for highlighting the tool tip?

    To anticipate your question as to why I don't have a "Well, all you have to do is reverse the polarity of the neutron flow" is because there are many different ways for developers and components to generate tool tips.  So, we need to investigate and find it.  Now, of course, if you have access to the developers, you could ask them... show them what you're trying to do, sit with a developer with TestComplete open, show them the Object Browser... and see if they can help you find the tooltip.  Honestly, that's the best way to go to make your life easier... 

6 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Many times, an object will have a property called "Tooltip".  The tooltip itself is not a seperate object but a property that is populated as needed.

    So... my first thing to check would be to use the TestComplete Object Spy to inspect the edit field and look to see if such a property exists.  If this works, you wouldn't need to know the name of the tooltip object, simply check the tooltip of the edit box and validate the text.

    • forrestaustin's avatar
      forrestaustin
      Contributor

      Thanks for the response. Using the object spy I went to the all the properties of the control and I only saw two properties: "ToolTipsEnabled" and "m_activateToolTip". It saysthat ToolTips is enabled for this control but that doesn't really help me.

       

      I just tried using this link to map the control wnd class to a win32 tool tip as done in the documentation but there was no difference in what information was available. 

       

      I feel like this should be a simple task, but I am making absolutely no progress towards this and its important that TC is able to recognize the tooltips.

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        As mentioned... that was step one... .time to play Sherlock, my friend.

        so... step 2, since there doesn't appear to be a relevant property on the target object, the tooltip probably is a separate object.

        Using Object Spy, there's a method for object spy called Point and Fix.  Instead of the target reticule, you can use the Point and Fix method to highlight objects that might not be able to be targetted... can you use that for highlighting the tool tip?

        To anticipate your question as to why I don't have a "Well, all you have to do is reverse the polarity of the neutron flow" is because there are many different ways for developers and components to generate tool tips.  So, we need to investigate and find it.  Now, of course, if you have access to the developers, you could ask them... show them what you're trying to do, sit with a developer with TestComplete open, show them the Object Browser... and see if they can help you find the tooltip.  Honestly, that's the best way to go to make your life easier...