08-12-2008 02:34 PM
08-12-2008 03:03 PM
08-13-2008 03:14 AM
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
08-13-2008 06:33 AM
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
08-13-2008 09:52 PM
I do what you are wanting to do a lot and it works fine. Can you post some code?
Mike...
08-14-2008 01:58 AM
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
08-14-2008 02:30 AM
08-18-2008 07:49 AM
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...
08-18-2008 10:49 AM
Sorry, I did some more testing and it seems I was wrong. Actually, the error is:
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.
08-18-2008 12:28 PM - edited 08-18-2008 12:35 PM
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.