08-27-2013 11:47 AM
I have an Xcontrol that works great when I run my VI by clicking the run arrow; however, the Xcontrol does not seem to register events when the VI is dynamically run in a subpanel. FYI, all other functionality of the dynamically run VI works fine (only the Xcontrol fails to work properly). I need help understanding why and finding a good solution.
Thanks!
Solved! Go to Solution.
08-27-2013 12:33 PM
FYI, I found that the Xcontrol (at least for LV2011) works if the dynamically called VI is open before the subpanel VI dynamically calls it. Therefore, the Xcontrol does not work when docked inside the subpanel, but it does work if it is undocked.
08-27-2013 12:43 PM
Sorry, I should have specified that I'm using LV2011SP1
08-27-2013 12:51 PM
More specifically, it appears that I cannot use property nodes inside the Xcontrol, which is on a VI that is called dynamically to appear inside of a subpanel on the calling VI...
08-27-2013 02:04 PM
Found it. The Display State cluster of references was not linked to the controls and indicators on the FP. My guess is that the Exec State Change event within the event structure was not registered (this is where I would check if the references were good, and if not, then I would reinitialize the references. As a work around, I used my references inside of a global variable instead of the display state shift register. Now it works great even in the subpanel!
08-27-2013 02:18 PM
pictures attached
08-27-2013 02:20 PM
all functionality works when you use variables instead of the Display State shift register whether on VI or on dynamically called VI
08-27-2013 02:24 PM - edited 08-27-2013 02:26 PM
There is also a fundamental distinction that you need to understand. A subpanel does not call the VI that is in it - it's merely showing its front panel in a window. Consequently, the VI that is in the subpanel doesn't know that it is in a subpanel, as far as it can tell, its window is closed. So with that being the case, it is possible that the references in the xcontrol that allow it to access the VI that's calling it, are not fully initialized.
Also a VI in a subpanel doesn't have any direct access to the VI that is displaying it unless you explicitly pass it a reference when you open it.
You also said that the original problem went away if the VI with the xcontrol on it was already running before you tried to put it into the subpanel. This makes me wonder if there could be a timing issue. Loading a VI into memory with an xcontrol on it causes the xcontrol to start executing so there is a finite delay between when the vi is loaded and when it is ready to do something useful. What happens if you insert a delay of say a couple seconds between opening the reference to the VI and where you run it and put it into the subpanel - in fact for test purposes it might be interesting to put a longish delay between each of the step: opening the VI, running the VI and inserting it into the subpanel.
Mike...
08-27-2013 02:32 PM
Actually, The symptom was the same if the Dynamically called VI was running continuously before it was shown in the subpanel. The symptom seemed to go away if the dynamically called VI was open (running or not), therefore, the FP of the dynamically called VI did not display in the subpanel window, but the FP is open as a separate window ( I called it to run dynamically and saw the references worked fine).
But thank you very much for the explanations, I'm always trying to understand things better. Thanks for replying!