04-12-2009 04:11 PM
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!
Solved! Go to Solution.
04-12-2009 08:17 PM
04-12-2009 08:52 PM
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!
04-12-2009 09:17 PM
04-12-2009 09:21 PM - edited 04-12-2009 09:22 PM
A radio button control seems to be more suitable.
(Edit: Ah, Jarrod had the same idea ... :))
04-12-2009 09:35 PM
04-12-2009 09:47 PM - edited 04-12-2009 09:48 PM
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..