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: 

Can I put abort execution button and Run button in GUI ?

I can't make any solution for out from infinite loop, so I try to use abort execution .

Thanks to all.....

0 Kudos
Message 11 of 20
(1,849 Views)

You shouldn't implement infinite loops. Read about state machine.

 

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 12 of 20
(1,846 Views)

@wMw wrote:

I can't make any solution for out from infinite loop, so I try to use abort execution .

Thanks to all.....


Then your problem isn't that there is no simple way to place those buttons. Your problem is that you are creating infinite loops.

 

Rule #1 of programming: Don't create infinite loops.

Rule #1a of programming: Unless you're programming a microprocessor, which is designed to be used in situation where you can simply turn everything off.

0 Kudos
Message 13 of 20
(1,842 Views)

In some rare cases you may want o hit the abort button and re-start. Lets say some instruments fail intermittently and you want to avoid showing the abort and run button and have the user give a another try starting from scratch.

 

This is not the recommended method but it may do what you are looking for and it is very simple to do in an event handler.

 

CHECK THIS NI LINK:

http://digital.ni.com/public.nsf/allkb/19973E97DD7AFED386256E1D0075404F

 

Hope this helps

 

 

JCollado
0 Kudos
Message 14 of 20
(1,597 Views)

@Norbert_B wrote:

You shouldn't use "abort execution". Never ever!

 

What you are looking for is a state machine with idle case. In this idle case, you poll the "run" button. Once your machine is working, all your transitions will poll the "abort" button (i would rather call it "stop" in distinction to "quit") and handle it appropriately.

 

Norbert 

 

EDIT: Danil is of course right. The buttons i refer to are front panel elements (not connected to the "buttons" in the icon bar!) and so the VI has to run in order to poll those buttons. 


I  disagree.  I use the Abort button frequently when things go haywire in development; and I have a link on my desktop to Abort_All_VIs.vi (which autoruns).

Also, I don't like polling.  Event driven programming is much better.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 15 of 20
(1,591 Views)

@Norbert_B wrote:

@smercurio_fc wrote:

@Norbert_B wrote:

You shouldn't use "abort execution". Never ever!


Unless you have a situation like this. (note that it's from the same poster)[...]


Still i insist on NEVER EVER!

It always gives me stomacheache seeing something like this. To be more precise: You should never ever come into a situation like this!

 

There is a reason for advanced design patterns like producer/consumer or actor framework......

 

Norbert 


You can insist all you want, but I don't think people should care about your zealotry.  I use infinite loops and the Abort button frequently when trying out little pieces of code.  Sometimes I even  use the "Run Continuously" button (did you know you can turn that on programmatically?).  Of course I don't put stuff like that in deployed S/W.

 

"All buttons are meant to be pushed"

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 16 of 20
(1,590 Views)

Paul,

its a 5 year old thread and a new reference to an implementation in LabVIEW 7.0 (no event structure in all versions)

 

Probably worth ignoring since the OP has very likely learned not to create infinite loops by now (or doesn't use LabVIEW anymore --same effect, no infinite loops)

 

Watch that Abort_All_VIs.vi and its nasty counterpart "Revoke All Models.vi"  they can change VI execution properties without notifying the developer. Smiley Wink


"Should be" isn't "Is" -Jay
0 Kudos
Message 17 of 20
(1,588 Views)
If I recall correctly, event structures showed up in LV 6.1
"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 18 of 20
(1,575 Views)

@paul_cardinale wrote:
If I recall correctly, event structures showed up in LV 6.1

Required Pro.  Not in Base or Student.  I don't recall if Full had it


"Should be" isn't "Is" -Jay
0 Kudos
Message 19 of 20
(1,571 Views)

I think "full" and "student" had the event structure since it was introduced. Only "base" didn't have it.

0 Kudos
Message 20 of 20
(1,561 Views)