LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Enum vs List

I'd like to know how I can handle all the lists into enum.
 
I'd like show all the lists in the Front Panel using listbox, and I'd like them to connect to the case structure. However, I'd like to show all the names in the structure case. I know Enum can do it, but enum does not show all the names in the Front panel. Pls advise me.
0 Kudos
Message 1 of 16
(3,504 Views)
One thing you can do:
- create enums
- read the strings property of the enum and populate the listbox with it
- typecast the output of the listbox to the enum
- wire the typecasted signal to the case structure

See attached image for some (meaningless) code that shows how to do it.

Hope this helps
Daniel
Message 2 of 16
(3,493 Views)
Can LV 6.0 create Enum property node?
0 Kudos
Message 3 of 16
(3,481 Views)
Uh, I don't know... just give it a try. I only have LV 7.1 and newer here.
0 Kudos
Message 4 of 16
(3,474 Views)
Could you pls explain how you created Property node of Enum?
I looked at LV 6, 7, and 8 and I don't think it's a version issue.
0 Kudos
Message 5 of 16
(3,465 Views)
As I did for the Listbox: right-click the terminal in the block diagram and select 'Create' > 'Property Node' > desired property.
0 Kudos
Message 6 of 16
(3,459 Views)

How about Enum?

When I looked at your pict file, there is Enum property node and I believe it's required to properly perform.

0 Kudos
Message 7 of 16
(3,453 Views)

Nice Idea Dan.  I have never bothered to think about how to do that, but that is a quick and easy way to make the front panel more user friendly.  I have an application where I can implement that right now and I'm sure the users will appreciate it!

 

Tom

0 Kudos
Message 8 of 16
(3,444 Views)

I ended up creating property node of Enum. However, I can't still control the strings in the listbox. It always performs the first string in the listbox. I'm getting there...just a few extra work...pls advise me.

By the way, what is U16 in bwn listbox and typecast? Is it just comment or actual command line?

0 Kudos
Message 9 of 16
(3,435 Views)
@Tom: yes, it's much easier to read the block diagram when the case structures have enum strings in the case. I use it often.

@radar_can: The conversion is required because typecasting a 32 bit integer to a 16 bit integer will cut it and values can be incorrect. So the integer coming from the listbox must be converted to the representation (data type) of the enum to avoid incorrect results.

EDIT:
I attached a sample VI. It's in 8.20. Still, it's just to demonstrate, not really useful code. To test, select the desired listbox item before running the VI.

Message Edited by dan_u on 03-30-2007 04:50 PM

Message 10 of 16
(3,429 Views)