LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

So you're coding a LabVIEW executable...

5/10 EDIT: New version of Center FP on Top Level now works for proxy called VIs by effectively centering on the highest level visible VI.

________________________________________________________________________
Reinventing the wheel is fun, right?

If you said, 'Yes', stop reading and throw your computer away - technology isn't for you.

________________________________________________________________________

I end up using the following quite often when writing VIs that will be used in the development environment (by internal users or developers) as well as being built executables (other users).

Here is our trivial sample application:

simple app.png

We click 'Go' and something happens, we click 'Exit' and our program stops. Simple.

1. Exit Runtime Application

So first, we need a way to close the program down in the case of the built executable.

exit runtime.png

If the application type is 'Runtime System', the 'Exit Runtime Application' VI will exit LabVIEW, which closes our program. If not, the program will just stop as usual.

2. Set Runtime Control Visibility

Typically, LabVIEW users expect a stop button for the VI. Runtime users don't expect this, and would expect to just close the window to stop their application.

Exit Button Visibility.pngvisibility compare.png

My 'Set Control Visibility' VI takes a reference to my stop button (Exit) control and will set visibility of that control based on the application type being Runtime System or not. Now my LabVIEW users get their stop button while my windows application users can just close the VI and I handle the correct events to close down normally and exit - no confusing stop button.

3. Center Front Panel on Top-Level

I often will create informative dialog/configuration VIs that are shown as part of the program. It is desirable for these to be centered on the Top-Level VI. If I set the VI property (Window Run-Time Position), it centers the dialog on computer's screen. I want it centered on my application's UI.

set center.png

If I drop the 'Center FP on Top-Level' VI, it will center the containing VI on the highest level caller's FP. Bingo.

Disclaimer: this is just an example to show functionality of the VI.  Since the containing VI shown is the top level VI, it reverts to centering the VI to the owning screen. As mentioned, I usually use this VI for subVI dialog/config windows.

________________________________________________________________________

Nothing life-changing, but I get asked for these more than occasionally, so I thought I would share.

I figure if I save 2 people 10 minutes, then this will have been worth my time.

As usual, LV 8.6 or later.



Evan Prothro
RF Systems Engineer | NI

0 Kudos
Message 1 of 6
(5,102 Views)

In my opinion, a STOP button does not belong on the front panel of any serious program. Period. 😮

 

(A stop button has some use for simple forum examples but not for anything bigger)

 

For all my projects, I exclusively use the industry standard [X] in the upper right window corner, but I capture it with a filtering event and a conditional disable structure as follows

 

  • If it is running in the development environment, it acts like a stop button, running eventual cleanup code and then returning me to edit mode without closing the window.
  • If it is running as an executable, it runs cleanup code and then closes itself.

 

0 Kudos
Message 2 of 6
(3,060 Views)

While I agree with you Christian, that's a serious bump for the old post.  


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 6
(3,046 Views)

Well, I have no idea why it showed up as unread on top of a page I opened. Assumed it was new..... 😄

0 Kudos
Message 4 of 6
(3,043 Views)

I guess it's true - what's old is new again.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 6
(3,024 Views)

@altenbach wrote:

Well, I have no idea why it showed up as unread on top of a page I opened. Assumed it was new..... 😄


Looks to me like an old community document just got moved to this board.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 6
(3,007 Views)