[QUESTION] Perspective popup window position

I see in the script actions for popup some settings for position but I cannot seem to get what I want to work using them. What I would like to do is when you hover over a label it pops up a small window positioned where the label is. Keep in mind the label is in a flex container so it’s position isn’t necessarily static. Any thoughts on a way to go about achieving this?

Currently, no - not in the situation you provided.

In a coordinate container where you’re positioning components - and can therefore bind to their known positions - you could manage this. Flex Containers remove any insight into a Component’s positioning as it’s all dynamic based on the display’s viewport.

While you can’t make it appear where the label is on a flex container, you could make it appear where the mouse is when it starts hovering over the label using the components of the event.
In your case, on the label create a Script Action on the onMouseEnter event. The event object here has positional components of the mouse when it enters the label component, pageX and pageY which can be placed as position variables in the script like below:

	id = '1'
	view = 'test'
	x = event.pageX.intValue()
	y = event.pageY.intValue()
	position = {"left":x,"top":y}
	system.perspective.openPopup(id=id,view=view,position=position)

With this script the top,left corner of the popup should appear where the mouse is when it hovers over the label.

2 Likes