LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

deactivate buttons after selection

Hi,

I am writing an application that should give the user the possibility to choose three data channels from a pool of different data and display the selection in charts. The user chooses the data by clicking on a button associated with each data channel. I have only three charts available. That means after the third data source is chosen the other buttons should be disabled.
Is there a general method to do this in Lab VIEW.
Thanks for Your help,

SDFlow
0 Kudos
Message 1 of 13
(3,474 Views)
You could do a counter that would count the number of times you pressed the selection buttons, and once it reached 3 it would disable the buttons using the Disabled property.  And then you could reeneable the buttons when you clear the graphs/a graph.
Kenny

0 Kudos
Message 2 of 13
(3,458 Views)
I usually don't like to annoy the user by disabling things so certain controls can no longer be operated. What if the user changes his mind on what needs to be displayed?
 
The UI should be more permissive. For example you could make the selector into an Xcontrol and add code that the last three items clicked are selected and if you click on a forth item, the first selected gets unselected.
 You can also e.g. allows up to three checkboxes and a new one can only be selected if one of the currently active boxes is unselected.
0 Kudos
Message 3 of 13
(3,449 Views)
That sounds exactly what I want to do. The problem is that I am still learning LV. and don't know how to implement that. Do You have an example how to leave the last 3 selections active?

SDFlow
0 Kudos
Message 4 of 13
(3,444 Views)
Assuming an event-driven interface, one way to do it would be to have a single event that handles the clicking of any of the four buttons. When that event fires, the code determines which button was clicked by lookig at the label:text property of the control reference in the event data, and does everything else that need to happen to select the signal. In addition the code looks at the states of all the buttons and if the number of selected items is equal or greater than 3 it disables all buttons that are not turned in the TRUE state. If the number of selected items is less than 3, it enables all the unselected buttons. That way the operator isn't locked out, because turning off one of the three selected signal will reenable all the other buttons.

Mike...

PS: if you would like to see code implementing this, let me know what version you are working in...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 5 of 13
(3,430 Views)
Yahh, an example would be great! I use LV 8.2.

Thanks

SDFlow
0 Kudos
Message 6 of 13
(3,426 Views)
This is not an optimal implementation of the idea, but it should get you pointed in the right direction.

Mike...

Message Edited by mikeporter on 05-18-2007 08:07 PM


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 7 of 13
(3,421 Views)

Sorry, I was in meetings all day. Here's a quick draft. See if it makes sense.

(I use an array of booleans for simplicity, then simply keep the indices of the true elements in a size=3 array)

 

.

0 Kudos
Message 8 of 13
(3,415 Views)
Thanks Mike!

Your example is a great help.
0 Kudos
Message 9 of 13
(3,374 Views)
Thanks altenbach!

It took me a while to get throug your programm (as I said I am still a beginner), but it makes sens to me now. I haven't used arrays that much yet. If I heave questions I am going to get back to you guys (Mike as well)

Thanks!!

Sdflow
0 Kudos
Message 10 of 13
(3,373 Views)