LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can a Combo Box control a Tab Control, like an Enumerated Ring control can

Is there any way to have a Combo Box control a Tab Control.  An Enumerated Ring control can if all the names match "Exactly", question is can a Combo Box do the same, especially within an Event Structure?

I haven't been able to figure it out.  Enclosed is a test VI that has an enumerated ring example, and a combo box with the same data.  Thanks for your help...

0 Kudos
Message 1 of 8
(3,237 Views)
A tab control can be treated like an enum, so your question comes down to: "Can I map a string value to an enum?" The answer is yes. Take the enum's array of strings, which can be accessed via a property node, and search the array for your string. See below pic:



Now, as to your VI. Smiley Surprised

A couple of things:
  • You don't need to use separate event structures to handle separate controls. Just use one event structure with different event cases.
  • You might want to really rething your user interface. If I were a user asked to operate your VI my head would be spinning very quickly. Those tab controls are extremely unwieldy. Tab controls aren't meant to be used with 35 tabs.

Message Edited by smercurio_fc on 11-14-2006 02:50 PM

0 Kudos
Message 2 of 8
(3,228 Views)

Thanks for the reply, but in the real user interface the tabs are hidden, and there are several other controls on each tab.  The real question is:  how can i select the correct tab using the combo box as the control.  ie.  if I select, in this example, the combo box labeled COMMAND, to "Get CCU RX Status (R4)" then I want the tab with the same name to be selected, but is does not.  Where the Enumberated ring labeled "2aryProcCmd" does select the correct tab control.  I left the tabs showing just so you can see which tab is really selected.  Its part of a user interface where the user can select the combo box selection and the correct tab is selected with instructions and controls to execute a specific command.  It seemed to be a clean way of doing the user interface.  Right now to get it to work I have to have a multiple case statement in the event structure that has the correct constant driving the tab control.  So when I want to add or edit a command I have to go through all 35 cases and change the constant.  Very time consuming and not very elegant. 

What you indicated as the solution, I think would change the combo box from the tab control and not the other way around.

Thanks.

0 Kudos
Message 3 of 8
(3,217 Views)
Actually, what I showed you was a generic string->enum conversion. You could use this with tabs if you were going to stick with the tab controls. Since you want to stick with those humongous tabs, you just need to get the array of tab captions at the start of the program, and in your event case lookup the combo box text in this array to get your tab index. See attached for a modification to your VI that implements this method.
0 Kudos
Message 4 of 8
(3,206 Views)
Perfect solution, didn't know you could do such a thing...  Thanks much....
0 Kudos
Message 5 of 8
(3,202 Views)
Why don't you simply change the values of the combo box to match the values of the different tab controls? For example, the value of the tab labeled 'Set Single EP Ch Freq (R54-33)' is 1. If you set the combo value of 'Set Single EP Ch Freq (R54-33)' to one, the tab will change to 1 with your program. The  way you've got it now, you are trying to apply a value of the combo box to the label of a tab control and the label of an item is not the same as the value
0 Kudos
Message 6 of 8
(3,198 Views)
The way the top level VI is written the number in the combo box also drives a case statement that executes various commands by number, I woulld have to change all those case statements to names.  The numbers in this case have meaning in the larger application.
0 Kudos
Message 7 of 8
(3,192 Views)
thats what dennis is saying. Organize the tab # to corespond to the combo box # that way everything is done with #'s and not labels.



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 8 of 8
(3,185 Views)