From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW sends subpanel events to a non running clone VI - UI Froze

Hi,

 

I've faced a weird issue with using JKI State Machine in one of my VI. Whenever the user clicks the 'Enter' key in the VI which has the JKI SM, the entire UI froze, and the user will not be able to access any UI elements any further. There is no other way than killing the LabVIEW.

 

Before diving into the reason, some background about JKI State Machine(You can download the package from here).

1. JKI State Machine will have an event structure by default
2. This has to be there for the 'JKI State Explorer' (An important feature of JKI SM) to work
3. Adding to this, there is a default 'OK' button present in the JKI State Machine template
4. This OK button has Key Navigation Configured to 'Enter' key which means when we click 'Enter' it will trigger 'OK' value change event

5. This OK button also has an event configured where the 'Lock Panel until the event case completes' option enabled
6. This means when the OK button is clicked, LabVIEW UI will be deferred(Blocked) until the event gets processed

CannySurya_0-1600796306842.png

 


Now coming to the issue,

In one of my VI (let's call it 'JKI SM Loader.vi'), I have a sub panel. This VI would load another VI which has a JKI SM (let's call it 'JKI SM Test.vi) into the subpanel as a clone. The JKI SM Test.vi will not be running by default. To make it clear, the JKI SM Loader.vi will load the JKI SM Test.vi as a clone in its subpanel.

 

At this point, when the user clicks the 'Enter' key, the subpanel captures the key event and sends/queue it to the loaded JKI SM Test.vi event structure.

In the JKI SM Test.vi, the OK button is configured to respond for the 'Entey' key event and configured to lock the panel(Defer) until the event case is processed. Since the JKI SM Test.vi is not running, the enqueued event by the outer subpanel cannot be processed and the VI will freeze the UI infinitely.

 

We have a good learning until here.


Possible solutions can be,

1. Remove the 'OK' button and its event structure after you place a JKI State Machine in your VI.

OR

2. Disable the option 'Lock Panel until the event case completes' tied to the 'OK' button in edit event dialog.

 

But the strange thing here is, LabVIEW VI or the subpanel not enqueuing the 'Enter' key event when the original VI is loaded to the subpanel directly(Meaning not as a clone). This problem occurs only when we load the VI as a clone into the subpanel. It is confirmed by using the Event Inspector Window(see the attached images). I've also attached the sample VIs to test this scenario.

 

Is LabVIEW having a bug in enqueing the events to the clone VIs which are actually not running?

 
0 Kudos
Message 1 of 4
(1,362 Views)

Need to go to a meeting now, so cannot write in-depth explanation.

 

But, one problem is you are inserting the VI into the subPanel, BUT you are not "running" the VI in the subPanel. You are inserting a non-running VI. Look at the subPanel examples for inspiration.

 

To communicate between subPanel VI and Main VI you will need, queues, user events(recommended), channels, etc.

 

mcduff

Message 2 of 4
(1,323 Views)

@mcduff

 

I purposely don't want to run the clone VI which is getting loaded to the subpanel. In our software, we will just load the VI into the subpanel and let the user enter some values in the control and then we will run the VI from the loader.vi(Using Run VI method)

 

Since I have the reference of the Test.vi in my loader VI, I can control it however I want. I'll will load, run, stop, and do other controlling externally using LabVIEW property & Invoke node. I don't want to send any data to the VI.

0 Kudos
Message 3 of 4
(1,281 Views)

This has nothing to do with the subpanel; it's to do with the "Open VI reference".

 

LabVIEW VIs really have three states:

  • not ready to execute
  • ready to execute
  • actually executing

Opening a VI ref with option 0x8 appears to put the clone into the Ready to Execute state, while option 0x0 makes a reference to the VI without making it Ready to Execute.

 

Static Events, like your OK button, are created in going from not-ready-to-execute to ready-to-execute, which is why you see the behaviour you do.

0 Kudos
Message 4 of 4
(1,266 Views)