# Relative Popup Perspective Via Script

**URL:** <https://forum.inductiveautomation.com/t/relative-popup-perspective-via-script/32245>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [February 13, 2020, 9:02pm UTC](https://forum.inductiveautomation.com/t/relative-popup-perspective-via-script/32245 "2020-02-13T21:02:12Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![grietveld](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/grietveld/32/6984_2.png) [@grietveld](https://forum.inductiveautomation.com/u/grietveld)\
**Post date:** [February 13, 2020, 9:02pm UTC](https://forum.inductiveautomation.com/t/relative-popup-perspective-via-script/32245/1 "2020-02-13T21:02:12Z")

</div>

Is there anyway to open a popup relative to the cursor via script? I’m trying to open a color picker for a table based on clicking on the cell. Only option that tells me what cell and row is clicked to confirm that the right option is clicked is ‘onSelectionChange’ but that doesn’t seem to give mouse cursor to do an ‘exact’ position.

Is relative position an option via script?

---

<div class="post-metadata">

**Author:** ![kirsten.chambers](https://avatars.discourse-cdn.com/v4/letter/k/48db29/32.png) [@kirsten.chambers](https://forum.inductiveautomation.com/u/kirsten.chambers)\
**Post date:** [February 13, 2020, 9:12pm UTC](https://forum.inductiveautomation.com/t/relative-popup-perspective-via-script/32245/2 "2020-02-13T21:12:00Z")

</div>

I believe the only way to get mouse cursor position in a script is via event properties (e.g. the clientX, clientY properties in an `onClick` mouse event’s event property).

I think you could move your logic from an `onSelectionChange` event to an `onClick` one and only fire if the table’s props.selection.selectedRow/Column match to get the functionality you’re looking for, although there will probably be some side-effects to work out.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 13, 2020, 10:01pm UTC](https://forum.inductiveautomation.com/t/relative-popup-perspective-via-script/32245/3 "2020-02-13T22:01:37Z")

</div>

> [@grietveld](#):
>
> Is relative position an option via script?

Not at this time, no. Relative positioning was something which was requested as an edge case and so there is not yet a full parity between the scripting of a Popup and a Popup Action.

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [March 13, 2021, 2:44pm UTC](https://forum.inductiveautomation.com/t/relative-popup-perspective-via-script/32245/4 "2021-03-13T14:44:21Z")

</div>

It will be awesome if a **contextual menu** could be added to perspective in a near future.

> [@\[IGN-1770\]Perspective best solution to convert vision Jmenu](http://forum.inductiveautomation.com/t/perspective-best-solution-to-convert-vision-jmenu/35948/3):
>
> Cool, I Hope this feature has an High priority in the backlog slightly_smiling_face

In the meantime, in order to try to achieve this feature, it will be usefull to be able to open popup with a relative position, close to the component clicked, with the ability to calculate the height of the popup according to the number of "menu" items.

We can use popup view action to open a popup with a relative Position, but in that case the height and other dimension of the popup view are constant...

+1, that's another use case to try to mimic a contextual popup in perspective

**Vision example to achieve in perspective...**

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/7/771b0cfe2c6e2871c17699c022233ba1158d151a.png)

---

<div class="post-metadata">

**Author:** ![deon.korb](https://avatars.discourse-cdn.com/v4/letter/d/8c91f0/32.png) [@deon.korb](https://forum.inductiveautomation.com/u/deon.korb)\
**Post date:** [May 20, 2021, 1:49pm UTC](https://forum.inductiveautomation.com/t/relative-popup-perspective-via-script/32245/5 "2021-05-20T13:49:18Z")

</div>

Has this function been added since way back then?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [May 20, 2021, 10:07pm UTC](https://forum.inductiveautomation.com/t/relative-popup-perspective-via-script/32245/6 "2021-05-20T22:07:40Z")

</div>

No, relative positioning was never added to the popup functions.

---

<div class="post-metadata">

**Author:** ![louagejasper](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/louagejasper/32/86311_2.png) [@louagejasper](https://forum.inductiveautomation.com/u/louagejasper)\
**Post date:** [January 28, 2022, 11:38am UTC](https://forum.inductiveautomation.com/t/relative-popup-perspective-via-script/32245/7 "2022-01-28T11:38:07Z")

</div>

Should be picked up again!

---

<div class="post-metadata">

**Author:** ![Patrick\_Whitlock](https://avatars.discourse-cdn.com/v4/letter/p/aca169/32.png) [@Patrick\_Whitlock](https://forum.inductiveautomation.com/u/Patrick_Whitlock)\
**Post date:** [January 9, 2025, 9:38pm UTC](https://forum.inductiveautomation.com/t/relative-popup-perspective-via-script/32245/8 "2025-01-09T21:38:26Z")

</div>

Is there any chance that its possible to create a popup relative to the mouse cursor via a script now?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [January 9, 2025, 11:59pm UTC](https://forum.inductiveautomation.com/t/relative-popup-perspective-via-script/32245/9 "2025-01-09T23:59:45Z")

</div>

No change here.

> [@8.1.4 Perspective openPopup new arg viewportBound doesn't and doesn't resize apply if position supplied opens it off screen](https://forum.inductiveautomation.com/t/8-1-4-perspective-openpopup-new-arg-viewportbound-doesnt-and-doesnt-resize-apply-if-position-supplied-opens-it-off-screen/43991/19):
>
> No, the ticket is still far down in the backlog. It doesn't look like the issue has been encountered at a large scale so it's been marked as a low priority. With everything else being worked on for 8.3 I would not expect this to be fixed anytime soon.

---

<div class="post-metadata">

**Author:** ![Steve\_Laubach](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/steve_laubach/32/60900_2.png) [@Steve\_Laubach](https://forum.inductiveautomation.com/u/Steve_Laubach)\
**Post date:** [March 24, 2025, 6:16pm UTC](https://forum.inductiveautomation.com/t/relative-popup-perspective-via-script/32245/11 "2025-03-24T18:16:34Z")

</div>

I looked at the wrong date. I'm sure there's no update in 2 months.
