Popup window and Window size and location problem


I was trying to make a popup window and place it on a specific location in one of my main windows, but it looks like the whole location thing does not work or I don't understand how it works.
Let me explain my problem:

I have a window with the following position and size:
If I want a popup window to be on the right side of the main window and the size of the popup window is: 255/1190. I have to subtract 255 from 2520 right? then it should be exactly on the right side of my main window. but instead, it ends up further away.

And besides that, the whole screen gets zoomed and that is not what I want.

How is your popup being triggered? ...from a button?

What does your code look like?

Here are a few examples of popup position manipulation that seem relevant to your question:
Open popup at bottom right corner of the window

Popup Windows Debugging

Resize Popup Window but not Content in Window

I open it with a button. and the button is configured as follows

There is no code.

• Change the action in the Navigation tab to "No Action."
• Then, click on the "Script Editor" tab, and open the popup with a script.

# Get the parent window
parentWindow = system.gui.getParentWindow(event)

# Get and open the popup
popup = system.nav.openWindow('CM/Popup')

# Calculate the desired coordinates for the popup's position
x = parentWindow.width - popup.width # Far right of Main Window
y = 0 # Top of Main Window

# Position the popup
popup.setLocation(x, y)

It still does the same thing. Not as I want. I have lowered the Y a bit so you can see that the popup is still not aligned with my main window.

What is that header component with a blue background that is displaying the time? Is that a docked window, a container of some kind, a label? Perhaps we can simply position off of that.

Main window

The popup window should get over the rootcontainer on the right side of the main window

I'm guessing from the tab strip we've got some docked windows going on that are offsetting the coordinates. Are there docked windows?

What prints in the console if you add this to your code?

print parentWindow.path

Does the button retrieve the main window as its parent?

I think you need something to reference where the parent window is on the screen.

x = parentWindow.getLocationOnScreen().x + parentWindow.width - popup.width
1 Like

yes there are docked windows I use that pop next to this window I just added in a reply. For the print parentWindow.path should I replace 'Window' for the name of my main window?

This didn't change anything.


parentWindow = system.gui.getParentWindow(event)
print parentWindow.path

Sorry im not sure what parentWindow does? because nothing is printing in the console

Click Tools-->Console

Click this button to clear any preexisting stuff:

Then, run this code from the button's actionPerformed event handler:

parentWindow = system.gui.getParentWindow(event)
print 'Parent Window Path: ', parentWindow.path

See what prints out

Line 8? There should only be two lines.

Is that a docked area on the right hand side, and is it where the button resides?

1 Like

I'm also imagining that the button is not in the main window, and we are going to have figure out the relative position to get the coordinate right.

You just need to reference the window name.

mainWindow = system.gui.getWindow('Window Name')
x = mainWindow.getLocationOnScreen().x + mainWindow.width - popup.width
y = mainWindow.getLocationOnScreen().y

popup.setLocation(x, y)

with the code you send is this what i get:

Stil not on the right place. Also every time I click the button so that it opens the popup window everything gets zoomed in for some reason.