PxPlus User Forum

Twitter Twitter Twitter

Author Topic: Screen Position of a Control  (Read 998 times)

Jeffrey Ferreira

  • Diamond Member
  • *****
  • Posts: 176
  • I must have taken a wrong turn at Albuquerque.
    • View Profile
Screen Position of a Control
« on: June 21, 2023, 08:44:27 AM »
Hello All,

i'm trying to figure out where a pxplus control is positioned relative to the monitor not relative to the pxplus panel.
i'm also not sure what is standard unit of measure for stating this (i think it is pixels)
can anyone help me out?

thanks

jeff

Jeffrey Ferreira

  • Diamond Member
  • *****
  • Posts: 176
  • I must have taken a wrong turn at Albuquerque.
    • View Profile
Re: Screen Position of a Control
« Reply #1 on: June 21, 2023, 03:44:28 PM »
i think i figured it out.
this obj command gave me the position in pixels.
i was then able to reference it in powershell and hover mouse over button..
that is what i was looking for

1520 let WINDOW_OBJ$=obj(0)
1530 let WINDOW_COLUMN=int(dec(WINDOW_OBJ$(21,2)))
1540 let WINDOW_LINE=int(dec(WINDOW_OBJ$(23,2)))
1550 let BUTTON_OBJ$=obj(BUTTON_1.CTL)
1551 let BUTTON_COLUMN=int(dec(BUTTON_OBJ$(21,2)))
1552 let BUTTON_LINE=int(dec(BUTTON_OBJ$(23,2)))

Mike King

  • Diamond Member
  • *****
  • Posts: 3818
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: Screen Position of a Control
« Reply #2 on: June 25, 2023, 02:35:16 PM »
Jeffrey,

Why did you want to know the screen position for a control?
Also, for most controls you can reference the 'Top and 'Left properties to get the pixel co-ordinates of a control relative to the window they are in.  This may be easier than using the OBJ function.
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

Jeffrey Ferreira

  • Diamond Member
  • *****
  • Posts: 176
  • I must have taken a wrong turn at Albuquerque.
    • View Profile
Re: Screen Position of a Control
« Reply #3 on: June 26, 2023, 07:53:20 AM »
Hi Mike,

I'm just experimenting with something where i'm trying to auto click a button if it pops up during an automated process.

jeff