From Friday, January 17th 11 PM CDT (January 18th 5 AM UTC) through Saturday, January 18th 11:30 AM CDT (January 18th 5:30 PM UTC), ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Loop with user interactions

I got a dialog with 2 buttons, PLAY and PLAYSLIDESHOW

 

PLAY - clicking this button, i want to make some action, for example run command ---logfilewrite "hello NI"---

PLAYSLIDESHOW - here i would like to create loop, which will click every second on first PLAY button.

 

The problem i got is i dont know how to let the user end this loop.

 

Got following code

 

Do While Not IsKeyPressed(&H20) 
  Call KeyWait
  Call btNext.RunClick
  Call oUDI.Sleep(1000)
Loop

This is useless, because its frozen untill user press some key. I would like it to run every second, but ends only when user press ESC. This could be done, if the function "KeyWait" would have a ms parameter like Sleep command has.

Does Diadem got some pattern for creating this kind of loop?

 

If i comment the "KeyWait"  function, its sleeps for one second and in this one second, all diadem buttons and everything is frozen, so i cant do nothing, even stop it and needs to kill Diadem application.

0 Kudos
Message 1 of 2
(4,122 Views)

Hi Lukas,

 

I can think of a way of doing this with Non-modal dialog box and a global variable. Non-modal dialog boxes don't stop the script,  so it could have the control to change the user variable while the code would have the loop.

 

Create global variable

Create & show non-modal dialog

Loop checking the variable

 

In dialog's control --> change the global variable

0 Kudos
Message 2 of 2
(4,107 Views)