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: 

Is it possible to run the vi with a button on the front panel?

Hi to all,

 

I was wondering if it is possible to run a vi with a button placed on the front panel.

 

Regards,

 

Palazzo

0 Kudos
Message 1 of 10
(2,672 Views)

Hi Palazzo,

 

yes, it's possible!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 10
(2,665 Views)

The answer of a such a question can be like that of course 🙂

 

I should accept your answer with kudos 🙂

 

anyway how to manage it, can you tell me a little more or may be some visual examples.

 

thanks

0 Kudos
Message 3 of 10
(2,655 Views)

How is it possible? You can run a VI with the run arrow or you can set it to run when opened. You can call and run a subVI by pressing a button on a running VI. But if a VI is not running then the FP buttons will not do anything unless they are XControls. But my experience with XControls is very close to zero.

 

I have been wrong many times before. Whenever I find out I am wrong it means that I learned something so I don't mind Smiley Happy

 

Edit: GerdW I think I get it now. Yes it is possible to run a VI even if it has a button on the front panel Smiley Very Happy

=====================
LabVIEW 2012


0 Kudos
Message 4 of 10
(2,654 Views)

Run vi when opened is not useful in my application, I know that option, thanks.

 

What are the xcontrols and what are they for? Can you inform me a little about that?

 

Regards

 

Palazzo

0 Kudos
Message 5 of 10
(2,643 Views)

Hi Palazzo,

 

Back in those days of textual programming we wrote something like:

 

while not(keypress)

  wait(125)

wend

call program

 

That's the LabVIEW equivalent:

check.png

 

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 10
(2,636 Views)

@Palazzo wrote:

Run vi when opened is not useful in my application, I know that option, thanks.


Can you elaborate? Programmed as a proper state machine, have the program run in an idle state that only waits for for a button press.

There is no need ever to go to edit mode during execution of a finished program.

 

 

while I have written a demo Xcontrol to show that everything is possible, I strongly recommend against it. It makes no sense.

 

See here for the example and instructions. But please read the entire thread, though.

 

Message 7 of 10
(2,630 Views)

GerdW,

 

Sorry, take this as enexperience, but I don't get the point of using this loops. Actually I don't get how the run button and the controller of the while loop relate. The code you've written, is it useful in math script node?

 

Regards,

 

Palazzo

0 Kudos
Message 8 of 10
(2,623 Views)

GerdW, that VI is running!

 

Palazzo, XControls are custom controls with a block diagram. They are running even in edit mode. They contain an event structure with an event to run when you drop it on the front panel and when the user interacts with it. If it is possible with an XControl to run the VI in which it is placed that is only an interesting curiosity.

 

Altenbach, yes I totally agree that you would not want edit mode to ever be part of the end users experience.

=====================
LabVIEW 2012


0 Kudos
Message 9 of 10
(2,618 Views)

It seems we should avoid that approach.

0 Kudos
Message 10 of 10
(2,588 Views)