LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

control tab with booleans

Solved!
Go to solution

I was wondering if someone here could help me out with a tab control issue I'm having.  I would like to be able to select tabs by clicking on boolean controls... but I'm having a hard time coding this, I feel like I'm going about it all wrong.  My problems are that, if you click one button I need the rest to be off, you should never be able to have to active buttons, because each button should correspond to one tab and you can't select two tabs at once... so I've been creating local variables for all other buttons and trying to use an event structure to turn them off each time one is selected... I've attached some code to show what I'm talking about...

 

is there a better way to go about this?

 

Thanks!

0 Kudos
Message 1 of 7
(3,236 Views)
All you really need to do is use the correct mechanical action for the Booleans. Here's your example cleaned up.
0 Kudos
Message 2 of 7
(3,224 Views)

Thank you Dennis for your response.... the code you fixed up works exactly right except the indicators on the buttons are dead after it's clicked... I'm trying to have it so that the light on the button will indicate which tab is available... so I need the button to stay true and the rest to be off.... is the only way to do this is by using local variables on the rest of the buttons and forcing them all to flase when another button is clicked?  I noticed on your code you didn't have to have a number wired for the timeout.... if I remove timeout from my event case I always get stuck in the event case, but your code doesn't... does this have something to do with the mechanical action of my booleans?

 

PS - I will be hiding the tabs, so I can't use the tabs to let the user know which tab they are on

 

Thanks!

0 Kudos
Message 3 of 7
(3,219 Views)
Solution
Accepted by topic author Monse
It sounds like you want a radio button control, which LabVIEW has integrated support for. Radio buttons only allow one button to be selected, and would avoid any race conditions from trying to maintain this state yourself using local variables.
Jarrod S.
National Instruments
0 Kudos
Message 4 of 7
(3,213 Views)

A radio button control seems to be more suitable.

 

(Edit: Ah, Jarrod had the same idea ... :))

 

Message Edited by altenbach on 04-12-2009 07:22 PM
Message 5 of 7
(3,209 Views)
Awesome thank you Jarrod and altenbach!
0 Kudos
Message 6 of 7
(3,198 Views)

Monse wrote:

 if I remove timeout from my event case I always get stuck in the event case, but your code doesn't... does this have something to do with the mechanical action of my booleans?


That's because you don't have an event for the stop button. Since you don't, you need the timeout case to poll the stop button or it won't work. Once you have an event for the stop button, the timeout event is no longer needed. Also your 50ms way makes absolutely no sense here, because the loop timing is determined by the event structure.

 

Your code is also flawed because the timeout event resets the tab control to the default value, immediately undoing any button actions. Think about it!

 

 

Attached is a quick modification of my earlier example that makes the radio container transparent. Now it looks the about the same as your version..

Message Edited by altenbach on 04-12-2009 07:48 PM
0 Kudos
Message 7 of 7
(3,193 Views)