I was unable to allow mouse events to penetrate an open window to reach components behind the window.
However, using system.gui.transform
to slide a container in a window off-screen instead of sliding the entire window off-screen meant the negative X-coordinate of the container was saved between closing and opening of the window.
As a result, I opted to close the flyout menu window and overlay window using a callback from the system.gui.transform
method. Since the X-coordinate of the container is saved I was able to eliminate extra flags and use the coordinates as my conditionals.
This code will:
-
Open a floating window called sideMenu that is configured with position(0,0) and layout anchored to North, South, West
-
Move a container in sideMenu on and off the screen. This container holds navigation buttons
-
Simultaneously open a floating full-screen window called overlay
-
Fade the overlay background color transparency up and down
-
Close both sideMenu and Overlay upon retraction / fade down
#In project library script 'CSS'
#Call with this line of code: system.util.invokeAsynchronous(project.CSS.flyout)
from time import sleep
from java.awt import Color
def flyout():
w = system.nav.openWindow('101 sideMenu')
c = w.getRootContainer().getComponent('cont menu')
o = system.nav.openWindow('101a overlay')
if c.location().x == 0:
system.gui.transform(c, newX = -c.size.width, duration = 250, callback=project.CSS.cleanup)
fade(o, 0, -3, 0.0033)
if c.location().x < 0:
system.gui.transform(c, newX = 0, duration = 250)
fade(o, 150, 3, 0.0033)
def fade(o, a2, s, d):
a = o.getRootContainer().getBackground().getAlpha()
def run():
for i in range(a,a2,s):
def paint():
o.rootContainer.setBackground(Color(255,255,255,i))
system.util.invokeLater(paint)
sleep(d)
system.util.invokeAsynchronous(run)
def cleanup():
system.nav.closeWindow('101 sideMenu')
system.nav.closeWindow('101a overlay')