Forum Discussion

Oferv's avatar
Oferv
Super Contributor
13 years ago

Relative coordinates

Hi,



i don't like to use coordinates as an object recognition but i have a question regarding this kind of issue.



if i have the following line code:




//Double-clicks at point (10, 12) of the 'TextBox' object.

  Aliases["DesktopMainWindow"]["HwndSource_DocumentInformationDialog"]["DocumentInformationDialog"]["Grid"]["Grid"]["TextBox"]["DblClick"](10, 12);



Does the coordinates in this case are relative? means it doesn't matter where i'm going to run this line it will not fail because of a resolution changing or similar stuff because it's relative to the object?



Thanks
 

4 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    The co-ordinates are relative to the object... but if the resolution is such that the co-ordinates are outside of the bounds of the object, you will still get an error.
  • Oferv's avatar
    Oferv
    Super Contributor
    Thx Robert,



    so how can double click a text field to capture and delete existing text and not to miss the text field while the resolution is cahnging?



    Thanks
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    I wouldn't capture the text...I would simply set the text using either the SetText method or assigning a value to the native "text" or "value" property of the field.
  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi Ofer,



    While I agree with Robert, in the worst case you can have something like ...["TextBox"]["DblClick"](5, 5)

    with the high probability that with any (reasonable?) screen resolution the point 5 pixels right and 5 pixels down relative to the top-left corner of the control will still be visible, belong to the control and have a part of the control's text (so that double-click will select the text).