LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

click on button

Solved!
Go to solution

I want to activate a button by program, but I'm unable to do it.

I read on the forum that it must not be a latching one, and that's ok it's a common "switch when released".

So I saved its state:

Immagine1.png

 

... and in anothe part of the program I try to switch its state:

 

Immagine2.png

 

the problem is that when the switching happens it only partly works, e.g. I see the button label switch Start<->Stop,

 

but the associated methods (e.g. shown above "Stop camera") do not fire, as if the case structure <"Start": value change> is not activated...

 

any hint?

 

alessandro

 

 

 

 

0 Kudos
Message 1 of 7
(3,353 Views)
Solution
Accepted by alzyx

Hi! 

Try changing button's value via property node-> value(signaling). This will trigger the event structure

Message 2 of 7
(3,341 Views)

Hi alessandro,

 

So I saved its state

I hope you don't mean this copy operation from terminal to local variable as "saving": What's the purpose of reading a terminal and writing this value back into a local variable of the terminal/control?

 

and in anothe part of the program I try to switch its state

This looks like heavy overuse of local variables!

 

but the associated methods … do not fire

These are no "methods", it's an event structure handling events!

 

As said before: writing to local variables will not fire an event. Only UI actions (well, mostly) do fire events - and special property nodes…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 7
(3,331 Views)

thank you all for the help...

 

it is just a few days I struggle with Labview, and I'm still confused!

 

There is some place a page about "common Labview mistakes" ? If it's there, I'd like to add this:

 

If you arrive from some other language, and you are thinking about using a local variable, in 99% of the cases you are thinking about a Property Node.

 

alessandro

0 Kudos
Message 4 of 7
(3,294 Views)

@alzyx wrote:

 

There is some place a page about "common Labview mistakes" ? If it's there, I'd like to add this:

 

If you arrive from some other language, and you are thinking about using a local variable, in 99% of the cases you are thinking about a Property Node.

 

alessandro


No.  That's not true at all.  Local variables are very similiar to "Value" property nodes with some subtle differences you won't need to worry about now.

 

Spoiler
Property Nodes are slower than local variables.  Property nodes usually call the the UI thread.

Your statement really should say that "In LabVIEW the wire is the 'variable'. "

0 Kudos
Message 5 of 7
(3,288 Views)

@alzyx wrote:

If you arrive from some other language, and you are thinking about using a local variable, in 99% of the cases you are thinking about a Property Node.


You just hit my pet peeve #1.  The Value Property Node is a HORRIBLE alternative to a local variable.  I am talking 1000+ times slower.  Use wires whenever possible!  The wire is the variable!


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 7
(3,282 Views)

Obligatory free training links, feel free to go over some when you have some free time, I recommend the Self paced training if you have an SSP (bought LabVIEW in the last year), or the 6 hour introduction.  Some of it maybe review but I'm sure there are a few things to learn from it.

 

NI Learning Center

NI Getting Started

-Hardware Basics

-MyRIO Project Essentials Guide (lots of good simple circuits with links to youtube demonstrations)

-LabVEW Basics

-DAQ Application Tutorials

-cRIO Developer's Guide

 

Learn NI Training Resource Videos

6 Hour LabVIEW Introduction
Self Paced training for students
Self Paced training beginner to advanced, SSP Required

Message 7 of 7
(3,255 Views)