PxPlus User Forum

Main Board => Discussions => Programming => Topic started by: Jeffrey Ferreira on June 21, 2023, 08:44:27 AM

Title: Screen Position of a Control
Post by: Jeffrey Ferreira 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
Title: Re: Screen Position of a Control
Post by: Jeffrey Ferreira 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)))
Title: Re: Screen Position of a Control
Post by: Mike King 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.
Title: Re: Screen Position of a Control
Post by: Jeffrey Ferreira 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