Ring -- typedef enum

Hi all!
   after years of inactivity on this board.... here I come again!
   I have some "typedef enum", and I'd like to tie them at develop time to Ring controls.  Is it possible?
   Thanks!
Graziano

Graziano:
Welcome back!
Do you mean that you want to assign enum values to your ring items?
You can do that if you build the list for your ring in code, not in the UI editor.  In the UI editor, just put down an empty ring, then in your code, before you display the panel, build the ring list using InsertListItem(), specifying an enum as the value.  An enum is basically an int, which is the default data type for items in a ring control.  See the CVI Help topic titled Programming with ring controls for more details.

Similar Messages

  • Programmatically controlling strings in typedef enum

    Hi there,
    on an user interface I want to offer a typedef enum as a pulldown menu to select plugins that are dynamically loaded from a subdirectory. Whenever a new plugin is copied into this directory, the enum menu shall be updated automatically. Yes, I have already searched the forum and found an older thread where they write that enums cannot be altered programmatically. Isn't there really any workaround?
    See the attached example vi. I want to use the enum instead of a ring menu because with the typedef enum the case structures are automatically extended if the enum itself grows.
    Any hint on how to program such "auto update features" most elegantly?
    Thanks,
    Peter
    Attachments:
    autoupdate_of_enum2.zip ‏20 KB

    Hi Peter,
    i think it is not possible in this way. Who should insert the new function into your case structure?
    Use a combobox/ring and an event strucure. If the user change the value of the combobox/ring, build the path to the selected vi.
    See the attached example.
    Mike
    Message Edited by MikeS81 on 06-02-2008 02:03 PM
    Attachments:
    main_LV80.vi ‏16 KB

  • Apply changes for ring typedefs ...

    Hello,
    I have recently to update a Ring typedef, (Update of Ring text) and i had the bad surprise that my modifications 
    didn't applyed on the VI's which use it. (Constants are not updated, and controls of that typedef keep the old values)
    Exemple : Ring typedef item XXXX value 1 updated to item YYYY value 1.
    I also tryed to do the following update : Ring typedef item XXXX value 1 updated to item XXXX value 2.
    And this also doesn't work.
    The updates didn't work even if i forced temporally my type to "strict typedef".
    Is this behaviour normal ?
    Did i make something wrong ?
    What do i have to do to make it work ?
    PS : I am using LV2012 SP1.
    I am using Rings in place of enums when i have to use "non continuous" values.
    When i do the same updates with enum typedefs, there is no problem !
    Thanks for your help.
    (And sorry for my bad english)
    Manu.net.
    Manu.net

    I think you can workaround the issue by replacing the ring with an enum and apply changes, then ctrl-z to get back to the ring.
    It would ofc not be an issue if you had sparse enums ... (i've kudoed that idea)
    /Y
    LabVIEW 8.2 - 2014
    "Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
    G# - Free award winning reference based OOP for LV

  • How can a block/free​ze a ring or enum control element when I Boolean signal is set?

    Hello! I am still a starter with LabView (working with 6.1).
    On the Front Panel of my VI the operator can use a ring control element to choose some (6) options. I am searching a way to block the scroll down menu of this ring element when a Boolean Signal is set. Only when this Boolean Signal is false, my operator should have the possibility to chance the ring or enum element.
    Is this possible?
    Hopefully
    Lars

    What Gerd meant was that you need to create a property node. Right click on the control or the terminal and select Create>>Property Node. Then, select the Disabled property, right click it and change to write and set the value you want (0, 1 or 2). You can change the boolean to a number by using Boolean to 0:1 from the Boolean palette. This property is common to all controls, not just rings.
    To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
    In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).
    Try to take over the world!

  • Just checking on another odd feature: Typedef enum Property Node "Value" not reflecting changes in the Typedef?

    Just encountered this odd behavior in LV 2011 which I reduced to the following example:
    - create a new VI and drop an enum control on te FP.
    - make this control a typedef and open the corresponding typedef
    - create a "case 1" item and a "case 2" item
    - save the typedef (I used the name Typedef Control 1) and CLOSE it (this is to allow updating of the original control).
    - drop a case structure on the diagram and connect the enum to it:
    So far so good. Now create a "Value" Property node for the enum and use it instead of the terminal:
    If I now go back to the typedef and add a "case 3" item, save the typedef and close it, the control is updated, but the Property node is not.
    How do I know that? For one, the Case Structure contextual menu does not offer to create a case for every value. Also, if I add a "case 3" case manually, it turns red.
    Luckily, the magic Ctrl-R key stroke actually does solve this problem.
    Tested in LV 2011.

    By Ctrl-R trick do you simply mean running the VI?  That is one way to force a recompile, but if you hold down Ctrl while pressing the run button you can recompile without running.  This should not be "dangerous" in any situation.
    As you have drawn your example, I see no reason not to use a local in that situation (ok, maybe for vanity).  Still, I view the behavior you describe as a bug, and it should certainly be fixed for the benefit of local haters out there.  You have to be a little careful where you draw the line between what gets handled in real time and what gets handled only at compile time.

  • Scripting Crash- "Create from Data Type" on Typedef Enum

    I just encountered a crash that I can duplicate in both LabVIEW 2013 and 2012 (student).
    Attached is a project that contains the code I used on 2012. Run the target VI.
    (I can get the project I had in 2013, if needed, sometime next week)
    Basic steps:
    Create a type def enum
    Place it on a VI
    Use scripting to get ahold of the Control Terminal and get the data type
    "Create from Data Type"

    Haha, I saved your code and ran it while I still had another project open... didn't really think that one through. Thank you, Auto-save.
    So it looks like the crash happens at the Create node. I can get rid of the crash by removing the Type Def link from the enum.
    I'm not at all an expert in scripting and have only used it a few times. Could a workaround be to get a reference to all of the Controls on the FP and copy the Control with the same Label "Enum" (instead of loading the terminal and creaing a new terminal)? Maybe creating a typedef by data type is what's causing the crash, but copying an already existing control will work.

  • How to convert ring to enum

    Hello all,
    I would like to convert the ring out of (DAQmx Channel Property node>>ChanType) for example, to an enum to later use with a case structure.
    I saw a previous post going the ohter way (enum to ring)
    any help will be appreaciated.

    If you perform that programmatically, the case structure will not update programmatically.
    So, you would either need to continue to use the ring input (relying on the numeric value for the cases) or you would have to create an enum, populate the case structure with those values and make sure the programmatic values are handled at edit time even if they are going to change.
    It doesn't seem as though you gain much performing the conversion programmatically.
    CLD | CTD
    LabVIEW 2011 SP1 | TestStand 4.5

  • Export typedef struct / typedef enum

    Hi,
    Is there any way to export typedef struct from a C DLL to LabVIEW (so that it is refered to under 'type' when using the Call Library function?
    Also, is there a way to export typedef struct?
    Thanks.

    Probably not.
    Not sure if it's an issue anymore, but at one time the number one issue was the endian-ness. 
    On top of that is fundamentally different handling of arrays: C arrays are just pointers, while LabVIEW arrays are smarter, containing the size of the dimension(s) within them.
    Strings are likewise.
    The configuration panel in CAL LIBRARY can handle some of these issues, but it has to be broken down into fundamental parts.
    No way I know of to match an arbitrary structure in both languages. 
    Message Edited by CoastalMaineBird on 06-19-2009 05:27 AM
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • Problem with TypeDef and Ring constants

    Hi folks!
    I've got a problem with my Ring-TypeDef.
    I defined a ring control as a Strict TypeDef, hoping that all constants of this Ring will be updated when I change the definition as it does with Enums.
    This does not work. Changes of the TypeDef take effect on the Ring control but not on the constants.
    Has anyone an idea how to fix or workaround this?
    TIA
    Kevin.

    Mark, as I understand it the idea with ring control/constants is that you can make pairs like the ones described:
    yes: 1
    no: 99
    cancel: -1
    but when you create a ring constant say, this feature is turned off, it behaves like a enum. In order to use this non continous numbering you need to uncheck "Sequential values" in propeties/Edit items. This took me some  time to find the first time, and today I again looked a good half hour for it again!
    Hope this was what you were asking.
    Ola

  • Expanding a ring control or enum

    I have rings and enums on my front panel that are disabled and greyed.  When I click on one of them I enable it.  However, because it was disabled to begin with the dropdown box does not open up.  I would the box to open on this click, rather than having to click again.  I've searched through the properties and nothing has jumped out at me. 
    Anyone know of a solution?
    Thanks.
    Tim Elsey
    LabVIEW 2010, 2012
    Certified LabVIEW Architect
    Solved!
    Go to Solution.

    Hello,
    I have taken a look at your problem and I believe that this does what you want. After your first mouse click, the event structure creates a programmatic mouse click in the same location in order to open the menu items. This is done by calling into the user32.dll and generating a mouse click. After the first mouse click, the event structure sends another up click, then initiates the down and up sequence.
    -Zach
    Certified LabVIEW Developer
    Attachments:
    Programmatic Mouse Click.vi ‏16 KB

  • Xcontrol for ring constant as enum

    Is it possible to turn a ring constant to operation similiar to enum using xcontrol?  Because with enum, you can't directly program it to include a list unless you manually do it in the front panel or creating another VI and manually calling to it (very twisted method).  Just wondering if there is a way to trick a ring constant into operating like enum so that whenever I connect an xcontrolled ring constant to a case statement, I get access directly to its case string instead of numerical index?  thanks

    You might consider just using string constants as your case selector instead of a ring or enum. There are some definite draw-backs, such as possible typo errors, but you can help account for this by creating a Default case that should never execute that simply pops up a dialog warning the developer about the typo.
    I use strings all the time when using Queued State Machines to define the cases. To me it's easier than dealing with an enum, especially because enum array constants on a block diagram always resize to a small size when you add new enum items! This makes code quite unreadable.  Also, when you add a new element in a enum array constant, it defaults to the first enum value, which is visually confusing for me. Seeing an empty string pop up in the array constant is much easier on the eyes.
    Strings will offer you the maximum flexibility, but the previous posters are still correct in asserting that the cases of the Case Structure need to be defined at edit time. You can't dynamically change these while the program runs.
    Is your main problem with enums that using the Edit Items dialog for an enum is very slow and not user-friendly (which I agree with)? 
    Message Edited by Jarrod S. on 01-26-2010 11:57 AM
    Jarrod S.
    National Instruments

  • How does LabView 8 handle Ring constants?

    Hi all,
    This is probably more for NI guys, but I am wondering how LabView 8 handles text rings?  In the past, constants dropped into a VI that are of type "enum" will be updated when the typedef is updated, however, ring text constants will not.  Has this changed in LabView 8?
    Thanks,
    Jason

    Part 1 of 2
    Hi Chris,
    Please forgive me for differing on this point but you should have written
    When a control is strictly typed it will force all  [front panel] instances to be identical to the strict type definition and update all of the text constants.
    The "strict" part only takes care of the appearence and those changes only affect instance were they are seen by a user. The strings associated with the enum do not affect block diagram constants.
    The attached image and zip illustrates that the representation of an enum and a ring a very different. An enum has the defined strings "hidden" in the wire and the numeric value can only be one of the valid indexes of the defined strings. In this example I have shown three different constructs that illustrate the fundemental difference between rings and enums.
    1) Case Structures - An enum driven case will pickup the valid choices as defined by the enum's definition. A ring does not carry this info in the wire so it is NOT possible to label the cases to match the ring. This brings up another compliation. If the case structure does not have a default case defined there must be a case for each possible selection value. The strings of an ring can be defined at run-time. Is LV supposed to re-compile the case structures code every time the ring is re-populated? In the case of an enum driven case, this is not an issue because enums that are used in a VI that is running or reserved to run can not be editied.
    2) The "Format into string" can pick-up the valid enum strings by decoding the type descriptor of the enum wire. This is not the case with a ring because the ring is just a number.
    3) The "Flatten into string" function will return the type destriptor of whatever is wired to it. The typed descriptor contents of a enum shows that every valid selection for that enum is defined in the enum wire. Please note that the type descriptor for a ring has no information about any strings.
    End of part 1 of 2
    Ben
    Message Edited by Ben on 10-15-2005 10:41 AM
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction
    Attachments:
    ring vs enum.JPG ‏78 KB

  • Equivalent to C Defines / sparse enums

    Hi,
    I'm looking for a way to implement defines / sparse enums in Labview easily. For example if I use Labview to communicate with a device that has a set of commands, I want to define the possible commands in a central location and if new commands are added or the numbers change or whatever, I want this to be propagated to all places where it is used.
    I already searched in the forums a little but didn't find a satisfying solution.
    An enum doesn't really do the job if the values are not sequential. One way I could do it is by using a case structure or an array additionally but this means always keeping two places up-to-date. A text ring would be the better solution (though I still miss the possibility to map different names to the same value, which I need in some cases) but the big letdown is that constants of a text ring strict typedef are not updated so it is useless for what I want.
    Actually I just want something like
    typedef enum
        FOO = 0,
        BAR = 0,
        FOOBAR = 10
    } foobar;
    or 
    #define FOO       0
    #define BAR        0
    #define FOOBAR 10
    which is standard in C but seems unnecessary complicated and not straight-forward in LabView. Is there an elegant and easy solution? If not, are the LabView developers aware of this shortcoming and will it be implemented in future releases?
    Thanks,
    Tobias

    Hi, Tobias,
    There are many different ways how to implement this, depends from your needs and architecture.
    In some cases just Globals may be useful (they are not always bad).
    You can also create SubVIs like containers for your #defines, or using universal Functional Global VI, where these values will be stored - this is most flexible way. See examples:
    Andrey.
    Attachments:
    Defines.zip ‏30 KB

  • Item names in a strictly typed ring control do not update.

    I have a custom control (strict typedef) that contains one ring control. When I added item names to the strict type def, they do not get updated on the instances where I am using it.
    S G
    Certified LabVIEW Architect, Certified TestStand Developer, Certified Professional Instructor

    Thanks for your response. However, I found the following sentence in the link LabVIEW custom controls ...
    "A strict type definition forces almost everything about the control or indicator to be identical, including cosmetic properties such as size, color, and appearance. Strict type definitions also define other values, such as range checking on numeric controls and the item names in ring controls."
    It turns out that the item names get updated if the ring control has sequential values associated with the items, but does not get updated if the values associated with the items are not sequential.
    I chose text rings over enums
    because I wanted the value associated with the items to be non-sequential for this particular control.
    Once again, thanks for your response.
    Regards,
    Sudhir Gopinath
    S G
    Certified LabVIEW Architect, Certified TestStand Developer, Certified Professional Instructor

  • Can I use multiple type def enums in 1 VI?

    Is it possible to use multiple type def enums each having its own states? In the larger scope of things I want to use it in a QSM.
    Thanks
    mhaque
    Solved!
    Go to Solution.

    Sure you can have multiple type def enums.  I don't know what you mean by "in 1 VI".  Each typedef enum will have its own .ctl file.

Maybe you are looking for