> I wonder if anyone can help? I'm trying to put together a simulator
> which contains a top level VI which acts as an options screen with options
> to select. When an option is selected I want the corresponding subVI to
> open in run mode. In each of the subVIs that open I want to have a button
> which when pressed stops execution and closes the subVI and returns to top
> level options VI. I've so far tried using a combination of the VI set-up
> options for the subVI to Open when Called, and Close if originally closed,
> along with the "opening VI References" to the VI, using a property node in
> the main menu VI to make its panel Visible or not.
> The results I have achieved so far is that I can select an option and it
> will open the subVI, but not in run mode. How do I get it to do this. I've
> tried using the execute when opened option on the property node but don't
> think I'm doing it right. I can only manage to open the subVI in run mode
> when I open it separately on its own due to the settings in the VI set-up
> options, but not from the options VI. With regards to the return to options
> VI button, at present this stops subVI execution, but I'm having trouble
> linking this with the options screen so that it closes the subVI down.
> Does anyone have an example VI that shows how to link VI's in this sort
> of way? Any help would be greatly appreciated.
>
> Regards,
> Martin.
>
> PS. In the online help there is a VI called "Open VI", but I cannot find
> this anywhere in the Labview library?
The Open VI was replaced by the VI Server functionality. It was name
based and a VI by that name does exist for compatibility, but it isn't
in the palettes.
The other thread explains, if taken all together, how to do what you
want dynamicaly, using the VI Server. If going that route, you
should probably build a subVI that does this for a button. You feed
in either a path or a reference to the VI, and the subVI does the
rest until the subPanel returns. Once you have some code that works,
select it, and in the Edit menu, choose SubVI from Selection. This
lets you use this same subVI for all of the other buttons. If you
need to do something else each time the panel comes up or if there
is a bug in the code, it won't be in dozens of frames of a switch
statement, just in one subVI.
If you don't even need this to be dynamic, you can get this to work
without using the VI Server, and it will be quite a bit simpler, though
a little less flexible. You will need to configure each of the subVIs
to be dialogs, to open when called, and close if originally closed.
The Options VI will then just call the various subVIs, their windows
will open, when they finish, their windows will return to their previous
state, and the options VI can continue. This is still a valid way of
doing this, and can be combined with the VI server to do things like
window placement; so it isn't necessary to abandon these easy methods
just because of the VI Server.
The tradeoff here between these two techniqes is that the first will
load the VIs from disk each time they are needed unless they are
statically used elsewhere. The second technique staticaly references
the subVIs; so they are always in memory, ready to open. The first will
use a bit less memory, but the panels will load a bit slower and it will
be more difficult to manage the source since the VI hierarchy doesn't
contain the dynamic references. The second will solve those issues, but
will use a bit more memory since all possible button options will be in
memory at once.
Greg McKaskle