From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

Where do I set OnPanelChanged variable?

Using DIADEM 2012 Trial

 

I need to run a sub procedure that will add units (oz-in) to one of my channels and then ultimately converts it to(Nm).  I got that working fine so I want to now have it run based on an event.  It looks like if I use OnPanelChanged I can set it to call this sub anytime I switch from Nav to View.  Where do I set the variable? 

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

Hello Tweedy,

 

Here are the steps to reproduce:

 

-Create and save a script file containing:

 

Call AddUserCommandToEvent("onPanelChanged", "yourSub")

Sub yourSub(LastPanel, NewPanel)

End Sub

 

The Call AddUserCommandToEvent adds the myTest function as a callback when the onPanelChanged event occurs. The function needs to contain the two parameters for the LastPanel and NewPanel. You can call your sub within that sub or just make your sub the callback function however it would have to have only the LastPanel and NewPanel as parameter inputs.

 

-Navigate to Settings>>Options>>Extensions>>User Commands

-Add the script you created above

-Click Refresh and the script should be loaded

Ian M.
National Instruments
0 Kudos
Message 2 of 2
(4,590 Views)