I am creating an West Side Menu (Pop-Up window) that slides in from off-screen. There is also a Modal Window (Main Window) which fades in and covers the remainder of the working area.
When the side menu slides back off screen its final location is (-150, 100). Any application re-paint events like opening or closing other windows or re-sizing the application force the side menu back to location (0, 100).
I tried closing the side menu when it is off-screen so it will not be moved during application re-paint events, but it still ends up at x location 0 upon opening.
I was able to get a working method (shown below). I set the side menu’s InternalFrame to transparent, and set
rootContainer.visible = False before closing. After opening again, I move the window off-screen then set
rootContainer.visible = True.
Is there a better way to implement a slide-out menu? Can I keep the InternalFrame transparent between closing and opening? Could I setup the application repaint event to ignore my pop-up, and keep the pop-up open and off-screen?
from time import sleep from java.awt import Color def menuSlide(btn): menuSlide.btn = btn system.util.invokeAsynchronous(slide) def slide(): m = system.nav.openWindow('101 sideMenu') o = system.nav.openWindow('101a overlay') flag = system.tag.read('CSS\sFlag').value if not flag: m.setLocation(-150,100) m.rootContainer.visible = True for i in range (151): if flag: x = -i a = 150 - i else: x = -150 + i a = i def paint(): m.setLocation(x, 100) o.rootContainer.setBackground(Color(100,100,100,a)) system.util.invokeLater(paint) sleep(0.0022) if flag: m.rootContainer.visible = False system.nav.closeWindow(m) system.nav.closeWindow(o) menuSlide.btn.visible = True system.tag.write('CSS\sFlag', not flag)