Hello!
I have been attempting to set up a window such that when I click the button that opens it, the window slides from left to right.
I am hoping to use this as a sub-menu to my tabs on the left side of my screen. I have been able to make the screen move every time I click the button that opens it, but I have not been able to have it slide on its own.
This is my current script in the InternalFrameActivated event handler for the moving window.
x = system.gui.getParentWindow(event).getComponentForPath(‘Root Container.Timer’).value
y = 0
window = fpmi.gui.openWindow(‘window folder/window’)
window.setLocation(x,y)
This script is bound to a timer so that when the timer makes a step, the window position changes. I realize that this should be under a different event handler but I am unsure where to put it or how to make it work correctly.
I am a bit new to scripting in Ignition so any help would be appreciated 
If you create another docked window to the West and open that window, then you should get the affect you are looking for. Try it out.
Well I am trying to get the sub-menu to actually slide out from behind my docked window and have it stop right next to it instead of it just appearing there or pushing over another docked window.
I did as you suggested and its not really what I’m looking for, not sure if my first post was as clear as I thought.
I’m actually looking to make the sub-menu window slide sideways, in my case slide 150 east over a period of 1 second.
Try this (make sure your current navigation window has a higher layer than the new window):
def doAsych():
import system
from time import sleep
sWinName = "submenu"
win = system.nav.openWindow(sWinName)
xmax = 150
win.setLocation(0,0)
for i in range(xmax):
sleep(1.0/xmax)
win.setLocation(i,0)
system.util.invokeAsynchronous(doAsych)
Brilliant!
Thank you so much 
I understand most of what you did there, but I wouldn’t mind a bit of explanation for learning purposes 
Most of the code inside the function should be self explanatory (open the window and set its location to move it). The only two things that probably need explaining are the sleep function and the doAsych function:
sleep : I used the 1.0 / xmax to have the for loop take 1.0 second of time. You can increase this number (1.5) for a slower slide or decrease it (0.5) for a faster slide. Just make sure to include the decimal, otherwise Python will assume the division result should be an integer and it will simply not sleep.
doAsych : If you don’t use this function, the code will run without updating the view that the user is looking at so the code will go through but it will look just like you simply opened the window. Using Ignition’s system.util.invokeAsynchronous, allows the code to run while also updating the screen so the user sees the changes.
1 Like