From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reference VI questions

I'm using a VI reference, to run 2 VI's basically in parallel... So, in
effect, I have my main menu, in which you press a button, and a new window
opens, which does most of the processing.

If the user closes the new screen, with the X in the top right, does it stop
the application? Or will it keep running without the front panel being
open?

Is there anyway that I can periodically check a variable, or something, in
the main menu, that will tell me if the program is closed, or running? I
want to close any VISA session's I opened within the new window, and is this
necessary? (closing the VISA sessions, i mean)

If I haven't explained this clearly enough, can you please email me?

--
Slade Squire
Programmer
Rectifier Technologies Pacific
Melbourne
, Australia
SladeSquire@rtp.com.au
0 Kudos
Message 1 of 6
(2,750 Views)
Hello, Slade. I'll do my best to answer your question.

If the user closes the new screen with the X in the top right, the application stops running. If you do not
want the user to be able to close the window, you can disable the X in the top right. See the attached VI for how to do this.

You can use a property node in your main menu to periodically check the state of your processing VI
and take action based on the returned state. See the attached VI for how to do this.

I hope this helps.
Mark Ridgley
0 Kudos
Message 2 of 6
(2,750 Views)
As demonstrated in Mark's demo, the Exec.State property will return the info you seek on the general state of the vi.

However I am not sure that his description of closing the VI is entirely accurate.

I have a central vi that launches six (6) subsystems, 5 of which are dynamically loaded VI's launched via the VIServer. What goes on in these subsystems is of little interest to the end user other than troubleshooting and confirming proper operation so generally they are not viewed. For each subsystem the central VI has only a boolean LED to indicate the state of the subsystem and a button to display or hide the subsystems front panel via the FP.Open property. While any of those subsystem's front panels are displayed and I click the close window ('X') button the dynamically loaded VI's front panel closes (hides the window quite similarly to the FP.Open = false) but that VI continues to run.

IMPORTANT NOTE: My original central VI is still running and my references to the dynamically loaded VI's are still open and referenced in the central VI.

To confirm this before I had all the button stuff working, I would select the 'closed' subsystem VI via dbl clicking in the Windows Explorer while everything was running and the subsystem front panel would appear still running. Since then I have confirmed many times that these subsystem VI's 'closed' via the 'X' are indeed still running and functioning with no apparent loss of data or gaps by simply pressing the corresponding button on the central VI to FP.Open = True and they popup with all data collected since their last appearance intact.

If this is a desired behavior then I recommend it. I like it because it keeps the taskbar clear of clutter from VI's for which the end user has little use. At least it does with these Labview.ini or application_name.ini keys set:
hideRootWindow=True
useTaskBar=False

My application is too complex and hardware dependent to attach as an example but if you need one let me know and I can strip this stuff out for you.

Hope this helps.
0 Kudos
Message 3 of 6
(2,750 Views)
I understand where you're coming from, thank you.

Now, what I would like to know... Is there anyway that I can have it setup,
such that, if the user pushes the X button (top right), the VI will close
the front panel AND stop?

My subVI's (from the main menu) are all testing stations (user interface's),
so I would like the user to be able to press X and reselect the same VI from
the menu and have it restart. (Cause I reckon that's what a lot of people
would do)


"Spaz" wrote in message
news:50650000000500000057500000-1005954886000@exchange.ni.com...
> As demonstrated in Mark's demo, the Exec.State property will return
> the info you seek on the general state of the vi.
>
> However I am not sure that his description of closing the VI is
> entirely accurate.
>
> I have a central vi that launches six (6) subsystems, 5 of which are
> dynamically loaded VI's launched via the VIServer. What goes on in
> these subsystems is of little interest to the end user other than
> troubleshooting and confirming proper operation so generally they are
> not viewed. For each subsystem the central VI has only a boolean LED
> to indicate the state of the subsystem and a button to display or hide
> the subsystems front panel via the FP.Open property. While any of
> those subsystem's front panels are displayed and I click the close
> window ('X') button the dynamically loaded VI's front panel closes
> (hides the window quite similarly to the FP.Open = false) but that VI
> continues to run.
>
> IMPORTANT NOTE: My original central VI is still running and my
> references to the dynamically loaded VI's are still open and
> referenced in the central VI.
>
> To confirm this before I had all the button stuff working, I would
> select the 'closed' subsystem VI via dbl clicking in the Windows
> Explorer while everything was running and the subsystem front panel
> would appear still running. Since then I have confirmed many times
> that these subsystem VI's 'closed' via the 'X' are indeed still
> running and functioning with no apparent loss of data or gaps by
> simply pressing the corresponding button on the central VI to FP.Open
> = True and they popup with all data collected since their last
> appearance intact.
>
> If this is a desired behavior then I recommend it. I like it because
> it keeps the taskbar clear of clutter from VI's for which the end user
> has little use. At least it does with these Labview.ini or
> application_name.ini keys set:
> hideRootWindow=True
> useTaskBar=False
>
> My application is too complex and hardware dependent to attach as an
> example but if you need one let me know and I can strip this stuff out
> for you.
>
> Hope this helps.
0 Kudos
Message 4 of 6
(2,750 Views)
Your intended behavior is 180 out from mine but I suppose one method you could use is to monitor the FP.Open property of the test station references in your menu program and when it is false assume 'X' has been pressed (actually anything that would cause FP.Open = false, which as far as I know is actually setting FP.Open=false, pressing 'X' or the program stopping for some other reason like an error or abort from the toolbar) and close that reference.

A few interesting side notes:

1.)If the test station has exited for one of these other reasons and the Menu program acts to close the reference since the test stations FP.Open = false, the Close Reference function does NOT return an error

2.) In deference to Mark's earlier answer, pre
ssing the 'x' when the test station VI is visible prior to starting the menu program (as it likely could be in development and probably wouldn't be in deployment) will result in the test station VI actually closing and exiting as opposed to hiding the window.

There are probably a lot of different (and better) ways to do this I don't think I will ever be able to purport to be a Labview Guru. So hopefully somebody else will post them to you. I usually avoid answering because somebody's usually got a better answer.

I don't know how you will deploy your app. My 'menu program' will be compiled and my 'test stations' will be native LV launched dynamically. This allows me to change 'test stations' (my 'subsystems') for equipment variations w/o recompiling simply by changing their name in a global vi (which I hope to do programmatically by loading the global and saving the changes. Sort of like a visual .ini file)

Good luck.
0 Kudos
Message 5 of 6
(2,750 Views)
That's helped me a lot... It seems to be exactly what I need. Thanks


"Spaz" wrote in message
news:5065000000050000005F500000-1005954886000@exchange.ni.com...
> Your intended behavior is 180 out from mine but I suppose one method
> you could use is to monitor the FP.Open property of the test station
> references in your menu program and when it is false assume 'X' has
> been pressed (actually anything that would cause FP.Open = false,
> which as far as I know is actually setting FP.Open=false, pressing 'X'
> or the program stopping for some other reason like an error or abort
> from the toolbar) and close that reference.
>
> A few interesting side notes:
>
> 1.)If the test station has exited for one of these other
reasons and
> the Menu program acts to close the reference since the test stations
> FP.Open = false, the Close Reference function does NOT return an error
>
> 2.) In deference to Mark's earlier answer, pressing the 'x' when the
> test station VI is visible prior to starting the menu program (as it
> likely could be in development and probably wouldn't be in deployment)
> will result in the test station VI actually closing and exiting as
> opposed to hiding the window.
>
> There are probably a lot of different (and better) ways to do this I
> don't think I will ever be able to purport to be a Labview Guru. So
> hopefully somebody else will post them to you. I usually avoid
> answering because somebody's usually got a better answer.
>
> I don't know how you will deploy your app. My 'menu program' will be
> compiled and my 'test stations' will be native LV launched
> dynamically. This allows me to change 'test stations' (my
> 'subsystems') for equipment variations w/o recompiling si
mply by
> changing their name in a global vi (which I hope to do
> programmatically by loading the global and saving the changes. Sort
> of like a visual .ini file)
>
> Good luck.
0 Kudos
Message 6 of 6
(2,750 Views)