11-30-2012 03:37 AM
Hello,
I am trying to get the reference of a control in a vi loaded in a subpanel. Usually I would get the reference of the vi and from that the reference to the control I want. However I cannot find a way to get the ref to the vi loaded from the subpanel methods. Obviously I know that I can save the reference to the subpanel-vi in the vi holding the subpanel, and go along with it. However I would prefer to access the ref directly from the subpanel methods/properties so that I dont have to write the code to keep track of what I am loading or unloading in the subpanel especially because I am having clones vi loaded in. Is there anyway to do it? Thanks in advance for any help.
11-30-2012 05:48 AM
resolved
11-30-2012 05:48 AM
Thanks!
11-30-2012 11:45 PM
Actually I found that there was an error in the posted solution that was hanging my more complex main, the correction is attached
12-14-2012 06:35 AM
sorry there were still some bugs in the previous control, I guess I got them out of the way and made it a little more usable.
you can also push and pop the subpanel vi in and out of the subpanel.... And you can implement a custom menu on the subpanel to integrate such funcionality into your code (standard subpanel have inaccessible menus as far as I tried).
12-14-2012 07:50 AM
If you don't have a VI reference, how do you put the VI into the subpanel in the first place?
What exactly is this xcontrol supposed to do?
Mike...
12-14-2012 08:18 AM
From your reply I guess my question was not clear; lets say that: 1-I open a vi reference using a path, 2-throw the reference to the subpanel, 3-run or do whatever.... ....after some time I want to get some data from the subpanel loaded vi. Now if I don't keep a local variable or some register with the ref to the vi loaded in the subpanel, I cannot get such reference from the subpanel itself (and this might be a problem if you have loaded the subpanel programmatically.. ).
The xcontrol I posted do exactly this: will get you back the vi ref loaded in the subpanel without the need to keep track of what you have loaded. Moreover I can implement menus on it now, something I canot do with the 'standard' subpanel.
Hope that helps
12-14-2012 08:41 AM
If you insert the VI reference into the subpanel and then can't go back and use it later, that seems like a problem with how your program is designed.
I don't know what you mean about implementing menus, I implement menus on VIs that are in subpanels all the time...
Mike...
12-14-2012 09:16 AM
Mike, I guess the attachment may help better than explaining
12-14-2012 10:01 AM
Ok, I think you may have a basic misunderstanding of what a subpanel is for. The whole idea of it is to display the front panel of another VI that is running in parallel with the VI containing the subpanel. As such, the VI that is being shown in the subpanel should be designed to handle all its own menus, and most everything else for that matter.
The purpose of the VI containing the subpanel is to manage the insertion of other VIs in its subpanel, and perhaps provide some common resources that all the VIs going into the subpanel might need, like a systematic way to shutdown the application as a whole, a common menubar, or perhaps some front panel buttons that the subpanel VIs could use.
You don't need anything as complicated (or as potentially troublesome) as an XControl.
Mike...
PS: In terms of getting a reference to the inserted VI, how about the "InsertedVI" property...