LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Combo Box

How how do I get the text of the item in a Combo Box and the index of the item while scrolling through each item using the arrow up or down key.

I have created a event structure on key press but had know success.

Attached is my example.


Thanks,
Paul
0 Kudos
Message 1 of 11
(4,219 Views)
I don't see any way to detect the "selection" as you're scrolling as it hasn't registered as a change or selection until you press enter or click outside the combo box. To get the index of the selection I just output the strings[] and search for the match (see attached)

P.M.
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 2 of 11
(4,199 Views)
Please find attached VI for your reference and hope you will find it useful.
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
Message 3 of 11
(4,187 Views)
See what happens when you get so wrapped up in the newer "tools"? Remove the "event structure" and Bang! there is the answer. Thanks Ian.


P.M.
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 4 of 11
(4,174 Views)
Thank you for all your inputs. The ideas are great unfortunately they will not work in my application because I will have duplicate items. I am filling the combo box with all the available test results of a particular unit from a database and in the event of a retest the serial number that goes in the combo box may repeat. I was hoping the operator could scroll through the serial numbers and in real time I would update the test date, operator and description beside the combo box. In Visual basic this was extremely simple (see below).

Private Sub Combo1_Click()
Label1.Caption = Combo1.Text
Label2.Caption = Combo1.ListIndex
End Sub

Private Sub Form_Load()
Combo1.AddItem "one"
Combo1.AddItem "two"
Combo1.AddItem "two"
Combo1.AddItem "four"
End Sub

I have programmed in VB for 10 years and am very use to the event driven language and was hoping labview would have similar functionality without tying up resources.

I appreaciate all the support that I have been given from this form as I make the transition into this LabView graphical programing.

Thanks,
Paul
0 Kudos
Message 5 of 11
(4,166 Views)
🙂 Thanks to you too, P.M! Cheers!
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 Kudos
Message 6 of 11
(4,152 Views)
Maybe a Combo box is not what you need! 🙂 (I don't like combo boxes!)

Personally, I'd use a listbox. It's much easier on the operator and works just fine for this purpose. See attached.
Message 7 of 11
(4,148 Views)
Thank you for all the suggestions. I have just finished what I am trying to accomplish using a table and the event structure. It is not as nice as some stuff I have done in VB but it will due.

Thanks again for all the ideas.
Paul
0 Kudos
Message 8 of 11
(4,138 Views)
Any changes for us to share your accomplishment? No obligation, however 🙂

Cheers!
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 Kudos
Message 9 of 11
(4,110 Views)
I have attached my work around to show the basis of what I am doing. I have saved data in the table since the database is not available.

You will notice as you click on a table item the test identifier is given as well you can scroll through the data with the up/down arrow keys. All actions are event driven therefore not tying up resources.

A neater version of this VI will be called up from the main program and the operator will have the ability to reload data.

Thanks for all the help,
Paul
Message 10 of 11
(4,100 Views)