Getting Absolute/Global coordinates of an embedded reference object

Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
2 posts • Page 1 of 1
Sector97
Posts:13
Joined: Thu Feb 02, 2023 3:26 am

Getting Absolute/Global coordinates of an embedded reference object

Post by Sector97 »

Was hoping to get some advice on the easiest way on how to get the global/absolute coordinates of any embedded panel that is not directly on the base panel.

For instance what would be the best way in OA to get the global/absolute coordinates of this search bar which is embedded within a toolbar object:
https://imgur.com/a/Pe9OCXA
Image


I've tried several approaches, but none have returned the correct coordinates (see list of attempts below):

1. positionAsDyn() - Only ever returns the same relative coordinates of the associated search field. Regardless of where the search field is placed.
2. mapToGlobal() - In theory, this should return the global coordinates, however, I find it returns coordinates that aren't even within the ballpark of the correct position.
3.panelPosition() - This function seems to only return the absolute position when dealing with base panels. For anything embedded just seems to get the relative coordinates.

Note that I am running on Win CC OA 3.18.

dbindernagel
Posts:161
Joined: Mon Feb 23, 2015 1:34 pm

Re: Getting Absolute/Global coordinates of an embedded reference object

Post by dbindernagel »

In general this should work just fine (just created a full screen test panel with ref in ref) but there are many pitfalls.

- Reference points
Ref Points are taken into consideration. Please check these are not off.
Not just for the panel but for the shapes inside the panel, too.

- Shape the "mapToGlobal" function is used on.
On which shape, on which panel / reference are you using the function?

- Scaling
With scaled panels the function is also wrong. No Idea how to fix this other than not use scaled panels.

- Panel not yet initialized
On my test panel I had to use a delay for it to be initialized. I guess because of "titleBar(false);" in the init script.

2 posts • Page 1 of 1