Make a window pop-up after pressing a button for X seconds

We are designing a front on Ignition Vision and we would like to make the user press the button for X seconds to enter the settings window. How could we make it? Thanks.

I would use two components:

  • An unbound momentary pushbutton component with the desired label/icon, and

  • A timer component, set to the desired duration, with its Enable property bound to the control property of the momentary button. The timer component's action event would open the settings window.

2 Likes

Another way you could do it, using only one component, is to have a momentary pushbutton with the following script:
def WaitFunction():
if event.source.controlValue == 1:
system.nav.swapTo('Test_Settings')
system.util.invokeLater(WaitFunction,5000)

This script fires when the button is pressed, then checks 5 seconds later to see if it is still pressed. One caveat for this method is that the button does not need to be pressed continuously (ie. you could press the button, release it for 3 seconds, then press and hold it until 5 seconds after the initial press.)

Pretty big caveat. Don't do it this way.

1 Like