LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to set the default value of the controls to be zero and when I click on a control its value changes to 1.

Solved!
Go to solution

Hello guys,

I have several image controls. I have a simple example of my problem.
On my vi I have 3 controls.
I want the default value of the controls to be zero and when I click on a control its value changes to 1.
How can I do this please? I have no idea how to do this.
Thanks in advance for your help.
0 Kudos
Message 1 of 9
(1,390 Views)

Hi ngouda,

 

use a boolean control set to false by default. When the user clicks the control it changes to true...

When you need a numeric value you can use BooleanTo0/1 function.

Best regards,
GerdW


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

Hi GrdW,

Thank you for your answer.
But I didn't quite understand, can you please show me an example?
Thank you
Sincerely
0 Kudos
Message 3 of 9
(1,341 Views)
Solution
Accepted by topic author Ngouda

Something like this?


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
Message 4 of 9
(1,335 Views)

Hi Crossrulz,

Thank you very much for your answer.
Now I have another question please.
On my vi below I want to save the name of the control and its value (0 or 1) in a .txt file in this format: name of control= value of controls.
I got an error trying to do this. Can you please check?
Thanks in advance.
0 Kudos
Message 5 of 9
(1,294 Views)

Hi Ngouda,

 


@Ngouda wrote:
On my vi below I want to save the name of the control and its value (0 or 1) in a .txt file in this format: name of control= value of controls.
I got an error trying to do this. Can you please check?

Which error do you got?

 

You know your 3 controls are booleans: why do you convert the control reference inside to loop to a string reference? Wouldn't it make sense to convert to a boolean reference???

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 9
(1,277 Views)

Hi GerdW,

Thanks for your reply. Below is the error I have.
Yes you are right but I don't see how to collect the name of the control and concatenate it with its value. That's why I tried this not so good method.
Do you have a much simpler method and more sense please?
Thanks in advance
Best regards
0 Kudos
Message 7 of 9
(1,263 Views)
Solution
Accepted by topic author Ngouda

I did some clean up of your code.  I would highly recommend avoiding using references and searches, etc.  Just use local variables to get your values.


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
Message 8 of 9
(1,244 Views)

Hi crossrulz,

Thank your very much for your help and for taking your time.

Your code is much simpler and less cumbersome, I like tool your suggestions.
Its work as I wanted it to, thanks again.
Best regards

0 Kudos
Message 9 of 9
(1,215 Views)