Forum Discussion

Logiv's avatar
Logiv
Contributor
4 years ago

aqObject.SetPropertyValue Not able to set value for Keys or Text

Hello,

I have a date field which I am trying to input with today's date. The particular field does not have the Text property but it does have the Keys property.

 

I am trying to make sense of how they work but I don't fully understand how it works - or maybe the limitations are in my software and not TC. I have currently insert the proper date format in the variable "FormatedDate".


I have Field A that has both Text and Keys properties
and Field B (which is the one I need) with only Keys property.

I can enter the date in field A using:

aqObject.SetPropertyValue(Sys.Process("Maint").VCLObject("MainForm").Window("MDIClient", "", 1).VCLObject("PLUForm").VCLObject("BackPanel").VCLObject("Panel10").VCLObject("Edit2"),"Text",FormatedDate)

But when I try to do the same using Keys (or even without the date, I try to type 123) and nothing happens (no error, no output):
aqObject.SetPropertyValue(Sys.Process("Maint").VCLObject("MainForm").Window("MDIClient", "", 1).VCLObject("PLUForm").VCLObject("BackPanel").VCLObject("Panel10").VCLObject("Edit2"),"Keys","123")

So I can achieve the desired result on fields that have the Text property, but on the fields that have the Keys property I am unable to get any data in those fields. There are no other obvious fields to use (no wtext, no caption, etc). I seem to only have Keys available.

  • The quickest way to see what works is to record a short test where you type in that box and see what code TC gives you in the test it creates.

    • Logiv's avatar
      Logiv
      Contributor

      Yes that is what I tried at first. 

      When recorded, the test does a click in the field, then enters the value. This works, but I wanted to avoid the clicking the field in case it changes to a different position (also timing issues and things like that sometimes don't make the cursor/clicking reliable).
      When recorded and converted to script, it doesn't use the aqObject.SetPropertyValue.

       

      I thought that by setting the property that way, I could avoid the clicking in the specific field.

  • ApplePen's avatar
    ApplePen
    Community Leader

    As  

    • Logiv's avatar
      Logiv
      Contributor

      Thank you. I don't have that property either.

      I might need to resolve into clicking! Thanks to both of you.

      • Marsha_R's avatar
        Marsha_R
        Moderator

        Since you are using object properties to click the field, it will not matter if the field moves.  That's only an issue if you are using coordinates instead of the properties.  

         

        Timing issues may indeed come up but those are common and can be addressed with some version of Wait.  If that happens to you, start another post and we can help you fix that.