LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

managing Enum items whith an other Enum

Solved!
Go to solution
bonjour à tous.

voici ce que je voudrais faire :

je dois contrôller un apareil effectuant des mesures de courant et de tension, j'ai créé un objet Enum1 dans lequel l'utilisateur renseigne s'il veut faire une mesure de tension ou de courant, et un objet Enum2 dans lequel il renseigne le range pour la mesure (par défaut a auto).
Or les possibilités de range ne doivent pas être les même en fonction du type de mesure demandé :

1100 V
20V
2V
200mV
pour une mesure de tension

1A
100mA
..
1uA
pour une mesure de courant

j'ai trouvé la propriété disabledItems[] qui permet de griser les items souhaités, mais ils renstent toujours visibles, et cela est un peu gênant car j'ai beaucoup d'Items (tension et courant réunis).
(il disparaissent si on utilise un enum basique mais je souhaite utiliser un Enum sytem (type menu déroulant)).

Savez vous s'il existe un moyen de masquer totalement les Items désirés ?
ou s'il y a un autre moyen de faire ceci...

(je pense que c'est possible car dans LabTracer ils l'ont fait, et ce logiciel est fait sous LV)...

merci !
 
 
 
 
English version :
 
Hi all !
 
I'm designing an application which controls a Multimeter, the user indicates wether he wants to measure a current or a voltage with the objet "Enum1", and he indicates the range of this measure with the object "Enum2"
But the range choices are not the same for a current or a voltage measurement :
 
voltage :
1100 V
20V
2V
200mV

current :
1A
100mA
..
1uA
So I'd like to modify the Items of Enum2 depending on Enum1, is it posible ?
 
I found the property disabledItems[] which grays the desired items, but they're still visible (I'm using the system enum).
 
(I think this is possible because in Labtracer something similar has been designed).
 
 
thanks 😉
0 Kudos
Message 1 of 12
(3,163 Views)

You'll need to use a ring or combo box instead of an enum if you want to hide items.  The combo box may be more useful, as it would be easy to convert into your master enum using a scan from string.

0 Kudos
Message 2 of 12
(3,156 Views)

English: You can't use an enum. Use a menu ring instead. You can change the list of items in a menu ring at run-time. An enum's values cannot be changed in the run-time environment, since that requires recompilation.

 

French (c/o Google Translate): Vous ne pouvez pas utiliser une énumération. Utiliser un anneau de menu au lieu. Vous pouvez modifier la liste des éléments dans un anneau de menu lors de l'exécution. Un enum valeurs ne peuvent pas être modifiés dans l'environnement d'exécution, car cela nécessite une recompilation.

0 Kudos
Message 3 of 12
(3,155 Views)

okay I'll try with both (combobox and ring),

 

thanks a lot for answering 😜

 

[edit] I'm trying with the ring, but can't find a property node which allows to add or remove items... ?

0 Kudos
Message 4 of 12
(3,149 Views)
Solution
Accepted by topic author yoz'st

Both the ring and combo box have the Strings [] property and the Strings and Values [] property.

 

For the ring, if you leave it as the same representation as the enum, you can use Strings and Values to have the ring skip values.  This way, you can typecast it to the enum to get your original enum back.

0 Kudos
Message 5 of 12
(3,131 Views)

now everything is working fine, thanks a lot guys !

0 Kudos
Message 6 of 12
(3,127 Views)

actualy I've got a situation :

 

the parameters of each measure are bundled in a cluster, and all the clusters (one for each measure) are bundled in an other cluster, which is sent to a SubVI which performs the measurements.

Since i changed the Enum of "range" to a Ring, it is properly recognised as a ring in my main VI (representation "Vlb"), but in my SubVI it is still recognised as an Enum (representation "<>") although I replaced the input cluster of the SubVI by the new one...

 

does someone has an explanation ?

 

I hope my English is understandable...

0 Kudos
Message 7 of 12
(3,107 Views)

You'll probably need to post some code and/or screen captures.

0 Kudos
Message 8 of 12
(3,094 Views)

Replacing the input cluster should have taken care of the problem, but you may also need to change every place inside the subVI where the enum was used.

 

If you have not yet learned about customizing controls, in particular creating typedefed controls, this is a good time to learn.  If you had made your cluster a typedef before using it all over your program, then when you change it, the change automaically is applied to all instances of your cluster.

 

As Matthew said, please post your code.

 

Lynn

0 Kudos
Message 9 of 12
(3,081 Views)

okay here are 2 screenshots (I can't post all my code, I think the company I'm working for won't like it ^^).

 

you'll probably think that my code is not well done (that's what I think.. the parameters in clusters in an other cluster ... my VI does'nt fit in the window ^^) but I didn't find any other solution to do it...

Download All
0 Kudos
Message 10 of 12
(3,063 Views)