How to restrict pop-up to open out side of window

Ignition v8.0.9
OS - Windows Server 2012 R2

Hi…I have checked some topics on forum and tried following script to get mouse position and change the location of pop-up window.

Pop-up Window W = 333 & H = 270

********** Script - Mouse Released ****************

windowParent = system.gui.getParentWindow(event)
point = windowParent.mousePosition
x = int(point.getX())
y = int(point.getY())
xOffset = 110
yOffset = 100

param1 = event.source.parent.getComponent(‘TagLabel’).text

if ((x + xOffset + 333 > 1920) or (y + yOffset + 270 > 1010)) :
window = system.nav.openWindowInstance(‘Control Modules/a0_AnalogIn’, {‘Tag’ : param1})
system.nav.centerWindow(window)
else:
window = system.nav.openWindowInstance(‘Control Modules/a0_AnalogIn’, {‘Tag’ : param1})
window.setLocation(x + xOffset, y + yOffset)

************************** END************************************

I put object/template near to window border from which I am opening pop-up. But my pop-up is opening outside of windows. And my window has a scroll bar.

image

I think I am doing some mistakes in script or project settings.