LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why are events on subvi front panel not processed?

Hello,

I have a main vi and a subvi constantly running. Sometimes I want to open the subvi's front panel by selecting from the main vi's menue and then process events like "mouse down" on the subvi's front panel and close it afterwards again. But for some reason the events are not processed.
It works fine if the subvi is normally stopped and I start it from a static vi reference with "run vi", open the front panel with "set front panel open" and stop it after processing the events.
It does not work if I keep the subvi running even if I load it dynamically and use the same reference for loading and for opening the front panel.

Has anybody an idea how to get that solved? Or is there sort of a standard how to do that?

Thanks for any help,
regards Clemens
0 Kudos
Message 1 of 11
(4,150 Views)
I think your main VI is not ready to process the events, maybe the opening of the subVI is done in one of the other event-frames.
Test this with execution highlighting.

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 2 of 11
(4,142 Views)

Hi Ton,

thanks for your answer but that's not the problem: the event has to be processed inside the subvi, the main vi only has to open its front panel. I just found out that "register for events" of the subvi returns error 1001 "The vi front panel is not open".

Is there any way to register for events of closed vis exept for having the front panel open when registering (as a workaround maybe transparent)?

 

Regards Clemens

P.S.: I forgot to say that I'm using LV8.0 on Suse Linux 

0 Kudos
Message 3 of 11
(4,128 Views)

Hi Ckis!

You said if you start it via a static vi reference, you open the frontpanel by "set front panel open". Don't know if this is the problem, but I can process events in SubVIs. The difference is that I have set the Window appearance to "Dialog" in the preferences. This opens the frontpanel automatically. Perhaps you haven't defined your window as dialog and it only shows up by this "set front panel open"... If so, try selecting "Dialog" from the preferences...

 

Greetings

 

Christian


THINK G!! 😉
------------------------------------------------------------------------------------------------
Using LabView 2010 and 2011 on Mac and Win
Programming in Microsoft Visual C++ (Win), XCode (Mac)
Message 4 of 11
(4,113 Views)

I do what you are wanting to do a lot and it works fine. Can you post some code?

 

Mike... 


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 5 of 11
(4,086 Views)

Hi @ all,

 

here's some code to test. Run eventtestMain.vi and open the subvis front panel with the "Ok" button. If you click on the tab control of the subvi it should count the clicks- but it doesn't. If you click the "Count" button it does.

 

I think the problem is as written in my last post that the front panel isn't open when registering for events. So for the moment I'm using the workaround that you can find in the disabled case of the subvi.

I didn't see the problem at first because of the different behaviour depending on how registering for the event (by reference <-> with the event structure dialog). Or do I have wrong settings somewhere?

 

Regards Clemens 

Download All
0 Kudos
Message 6 of 11
(4,078 Views)
Using LabVIEW 8.5.1, things work fine once I change the dynamic tab "mouse down" event to something else and then change it back to "mouse down". Maybe something was corrupt in your original VI?
Message 7 of 11
(4,074 Views)

Hi altenbach,

 

I tried what you suggested but it doesn't work with LV 8.0. Maybe it's just another bug from migrating from LV 71 to LV 8.0.

 

Thank you anyway...

0 Kudos
Message 8 of 11
(4,037 Views)

Sorry, I did some more testing and it seems I was wrong. Actually, the error is:

 


Error 1001 occurred at Register For Events in eventtestSub.vi->eventtestMain.vi

Possible reason(s):

LabVIEW:  The VI front panel is not open.


 

... and the same error also occurs in 8.5.1 (I must have accidentally left the FP of the subVI open when I thought it worked). So it appears that you can only register dynamic events for VIs that have the FP open (such as the main VI). I wasn't aware of this restriction.  Maybe somebody from NI can enlighten us why it has to be this way. 😉

 

So, the obvious workaround is to NOT use dynamic events for the subVI FP objects (tab control, stop), but use plain events for those. Of course the dynamic event for the stop button in the main VI can be successfully registered.

 

 

Message 9 of 11
(4,023 Views)

It seems to work for me.

 

Didn't initally work, but I re-wired some things and now it seems to work.  The error message remains (unusually enough) but the functionality seems to be OK in 8.2.1.

 

However, removing the references to the controls from WITHIN the sub-VI removes the error.  It seems that an static reference to a control within the sub-VI is not valid if the FP is not loaded.  I think the error is coming from there, and not from passing the Event.  Since this example wasn't working for me initially suggests there was a corruption somewhere in the original.

 

If you remove the "register" from two references to controls from within the sub-VI, the error disappears also.

 

Summary: Registering for a dynamic event within a VI with a closed FP raises an error, even though the functionality seems to be OK.   The part about the functionality not being OK ist most likely a corruption issue.  After re-wiring it works fine.

 

Shane.

Message Edited by Intaris on 08-18-2008 12:35 PM
Message 10 of 11
(4,002 Views)