Control refnum

what are control refnum, applications and advantages. is there any tutorial on control refnum.

A contol's refnum allows you to have access to the control from anywhere you want - another loop, another VI, even another computer.
The advantage of using programmatic control is when you want to manipulate your UI, control things remotely or control things dynamically. The main disadvantages are a performance hit which comes from using property nodes and the breaking of the dataflow. Using property nodes to change the values of control remotely can be very hard to debug, because unlike local or global variables, you have no way of searching for it. 
You can start by reading chapter 17 of the LV user manual (Help>>Search the LabVIEW Bookshelf) and by having a look at this tutorial about class hierarchies in LV.
Try to take over the world!

Similar Messages

  • Is there a way to save data accessed through Control Refnum?

    Hi,
    I am controlling 4 instruments, each from its own VI. (LabVIEW 7.1)  I have built a seperate VI which calls all the instrument VIs as subVIs and displays all the readings.  I would like to save the data I am displaying in the main VI.  In the subVIs, I use loops to continuously read data, so I use Control Refnums in the main program to access and display the changing readings.  Is there a way for me to save the data from the Control Refnums in my main VI, preferably all in the same file?
    Thanks!
    Jessica

    Mike,
    Thanks for replying so quickly.  I've attached a screenshot of my block diagram. 
    I've worked on it a little more since my post, and now the data is being saved, but it doesn't make sense.  I am saving it as a .lvm file and opening it in Excel.  I'm new to LabVIEW, so I may simply be struggling with the syntax and logic.  From my experience coding, it makes sense to have the data stored inside the while loop.  However, in this program, it seems that the data doesn't start saving until after I've stopped the subVIs. 
    Attachments:
    screenshot of Control.doc ‏72 KB

  • LabVIEW 8.2 control refnum type descriptor missing

    In LabVIEW 7.1, the control refnum had a type descriptor property, I do not see it in LabVIEW 8.2.1?  How do you get the type descriptor from a control refnum in LabVIEW 8.2.1?
    Respectfully,
    Robert

    Matthew Kelton wrote:
    The problem I have is that I have a generic control reference, so I don't know the type.  That is why I was using the descriptor to determine the type to properly use variant to data on the Value Property.  As it stands now, 8.5 still supports the Type Descriptor if it exists in VI I upgrade, but how long before it disappears?  I use this in a generic VI that is used in every project I do, saving me hours per project.
    The least NI could have done was just name is TypeDescr16 and TypeDescr32 or something.
    TypeDescr32 is NOT exposed and on purpose too so there can't be such a property. And yes there is a chance that the old TypeDesc property disappears at some point. However it won't be tomorrow. The 4.x compatibility mode for the Typecast function (necessary for the boolean size change from 4.x to 5.x) is still there but for the Flatten/Unflatten it had to make place for the 7.x compatibility flag. And it might disappear with LabVIEW 9.x since as I have found out today, LabVIEW 8.5 is the first version that refuses to load 4.x VIs directly.
    So the TypeDesc property will probably work until around LabVIEW 12.x when it will cease to support loading LabVIEW 7.x VIs. (Note, this prediction is just a very wild guess and should be taken with a big grain of salt).
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Difference control refnum and control reference

    Hi guys.
    I am new on labview reference, can you explain difference between control refnum and control reference. 
    Gary Wang

    Are you sure you don't mean "refnum control"? That is a front panel control that can be selected as a reference to any one of several data types such as application, VI (including strictly typed), control or indicator. Whereas the "control reference" is a block diagram object that points to a specific control on your front panel (it can also be "linked" to other objects so it is similar to a "refnum control" in that respect).
    “A child of five could understand this. Send someone to fetch a child of five.”
    ― Groucho Marx

  • Creating a type defined control refnum cluster?

    Hello -
    Is it possible to create control refnums for front panel objects and make a type defined cluster out of them?  I don't seem to be having any luck, but I could swear I've seen it done before.
    I am trying to pass a cluster of control references into sub-vis that will be called dynamically (using call by reference).  I want to create a standard cluster for use in all of the sub-vi's without having to go back and edit the cluster in every VI if anything is changed or added.
    If not, is there a better way?
    Thanks,
    Mike
    Solved!
    Go to Solution.

    Once I created that type def (look at my Mini Nugget to see how I did that) the type def was used as shown below to update control from a sub-VI.
    I had an app with hundereds of controls and indicators that needed updated.
    So I bundled refes for all of the control into logical groups.
    Then passed these refs to the sub-VI
    And the sub-VI used those named refs to do the updates.
    I hope that help,
    Ben
    Message Edited by Ben on 03-25-2009 10:41 AM
    Message Edited by Ben on 03-25-2009 10:43 AM
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction
    Attachments:
    FP.PNG ‏88 KB
    Bundle_refs.PNG ‏92 KB
    Pass_to_SubVI.PNG ‏82 KB

  • Using control refnums in srtict typedef cluster

    I'm having a small problem using control refnums. I've not used them much so this could just be me doing something wrong!
    I'm building an application with a GUI which will need updating with data from within various subVIs and a couple of parallel loops. So, what I wanted to do was "build" a strict typedef cluster of references to the front panel objects I want to update, then I can pass this cluster to any subvi or structure which may need to update a FP object. So far so good...
    The problem:
    On my main GUI I have a strict typedef'd tab control, which I want to be able to reference. When I build my cluster of refnum's I duly create one for this typedef'd tab control. The problem is, if I modify the tab control in anyway, the cluster of refnum's breaks.
    Anyone tell me why this is happening?
    I've attached an example VI I created which shows the problem. Basically, open the typedef to the tab control and change anything, you'll see the cluster of refnums break... you can see a video of it here:  Video
    Any thoughts would be gratefully appreciated!
    Thanks
    Paul
    Attachments:
    refnums.zip ‏15 KB

    Hai,
    Just went through the post
    The strict typd controls automatically gets updated when the parent control changes.  But the refnums that are created out of the strictly typed controls needs manual updation coz there is no linkage between refnum that was created and the strict type control.
    You just create a strict type refnum that carries the properties of a strict type control and in no way a linkage exists between these two.  Hopefully if there is an option to link the refnum and control with "Update from typedef" will solve the problems
    With regards,
    JK
    (Certified LabVIEW Developer)
    Give Kudos for Good Answers, and Mark it a solution if your problem is solved.

  • How do I apply properties to a control refnum from another VI and whose type I know?

    Hi,
    I have programmatically retrieved the Control refnum of a Table running on a separate VI. I search for its name and when match ocurrs I would like to use its control refnum to change som cell values in it by either the Invoke node or Property node. Nevertheless even though I know it is a Table I am not allowed to wire the control refnum to a property node with "Active cell", "BG color" et.c. I am not either allowed to wire it to an Invoke node with the method "Set Cell Value".
    Is there a work around for this?
    Solved!
    Go to Solution.

    Well, i assume that Santhosh solution works too (i hope he tested it before ). So no mistake here. Still, if you like, you can take the "solution" flag back from a post and redistribute it....
    Norbert 
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • Control refnum for a typedef

    I have a typedef on a VI front panel and I would like to programmatically resave it to a new path/name.
    with a VI I would open a reference to the VI and use the method "Save.Instrument" save a copy: true, and input a path.
    What I have tried was to open a reference to the VI that uses the typedef, got a property node reference to it's panel,  then a property of array of control references - but generally controls can't be 'saved-as' but a typedef could - only there is no method for this.
    Is there a way to do this? 
    Lawrence M. David Jr.
    Certified LabVIEW Architect
    cell: 516.819.9711
    http://www.aleconsultants.com
    [email protected]
    Solved!
    Go to Solution.
    Attachments:
    saveCtlAs.JPG ‏63 KB

    The control class has a property called TypedefVI which returns a reference to the VI of the typedef which you can then save. The only catch is that this method seems to be a scripting method, so you will need to install scripting first.
    Another alternative, if you don't want to use scripting stuff, is to use the Callees property on the VI. This will return the names of all the typedefs it uses (which you can then use with the Open VI Reference primitive), but you should note that this doesn't give you a way of associating a specific control with a specific typedef.
    Try to take over the world!

  • Difference between Shared Variable Refnum and Control

    Dabbing my toes in Shared Variables for another project.  Glad to see A LOT more support from NI in terms of Shared Variables (especially now that built executables can be set to automatically deploy shared variable libraries...thats a big help).
    In the Shared Variable block diagram palette (under Data Communication) there are a number of VIs that can be used to progmatically access and consume shared variables.  Awesome.  One thing that I have noticed is there is a difference between a "Shared Variable Control" (from the I/O front panel palette) and the "Shared Variable Refnum In" that you obtain from right-clicking one of the VIs from the Shared Variable palette and selected "Create Control".
    My first thought was that these two were one and the same, but they are not.  Visually they look different:
    Also, the reference input to the VIs in the Shared Variable palette only take the "shared variable refnum" control as input.  The control from the "I/O" palette does not work.
    This wouldn't be much of a problem, but I prefer the look of the Silver Shared Variable Control much more to the control I get from the "Create->Control".  Also, the variable browser in the Shared Variable Control is A LOT nicer than the control refnum gives me.
    Here is the Shared Variable refnum variable browser:
    Here is the much nicer looking browser that pops up from the Shared Variable Control:
    So I guess my questions are:
    Why are there two reference data types that seemingly perform the same function but are incompatible with one another in LabVIEW?
    How can I use the Shared Variable Control with the Shared Variable palette VIs?
    Thanks for your input.

    Hello Nickerbocker,
    You actually want to use the Shared Variable Control in the context of Alarms, I/O Servers and other categories inside the DSC Module. Like you already saw, to use the basic functionality of a Shared Variable, such as programmatically reading / writing to it, you need to use a refnum.
    Regards,
    Daniel REDS
    RF Systems Engineer
    Help us grow.
    If a post solves your question, mark it as The Solution.
    If a post helps, give Kudos to it.

  • Control references/refnums: general info

    Please forgive this question, I am a relatively new LV programmer and the help files & manual seem quite poor to me!
    I am after some basic information about control references & refnums as I am sure they would be of help to me.
    1. What are the main advantages in using them? (i.e. what they can achieve)
    2. How are they implemented?
    3. How is a control refnum/reference passed from one VI to another programmatically?
    Huge thanks to anyone who may be able to shed some light on this topic.
    Dan

    > 1. What are the main advantages in using them? (i.e. what they can
    > achieve)
    The references let you access properties and methods of controls on a
    front panel. Previously, the access was limited to the diagram of that
    panel, and each property node accessed a single particular control.
    With control refnums, you can have one property node access an arbitrary
    control with the refnum parameter controlling which one. You can also
    send the refnums to subVIs meaning that the code can be abstracted to
    simpolify your diagram and shared with other panels.
    > 2. How are they implemented?
    I assume you want to know how to use them. You right click on the
    control or its terminal and under the create menu, next to where you can
    create an implicit property node, you can also create a Reference node.
    The datatype of this node is unique to the type of control that you
    created it from, and when wired to a property node, the property node
    will show the same properties as an implicit one. As an example, if you
    have 8 Boolean buttons on your panel that need to be enabled, disabled,
    hidden, colored, labeled, or whatever based upon the state of your
    application. You can right click on the eight buttons creating
    Reference nodes and build an array of the references. You can now loop
    through your array and with one property node, set the properties of the
    buttons based upon whatever logic or table of information that you need.
    You can also do this in a subVI by passing the array of references to
    the subVI.
    It is also possible to get control refnums/references from other
    properties. For example, a slider will give the reference to its
    digital display, a graph will give references to its cursors, etc. It
    is also possible to loop through the references of all objects on the
    panel inspecting names or types rather than using the Create Reference
    popup, but this is more advanced and requires casting the references.
    If you really want to know how they are implemented, it is much like
    file refnums or VISA refnums. I can give more info if you ask a more
    specific question.
    > 3. How is a control refnum/reference passed from one VI to another
    > programmatically?
    >
    In the refnum palette there is a Control/VI refnum control. You drop it
    on your subVI and right click to set the class. Note that there are
    lots of classes arranged from basic to very specific. Class refnums
    will convert to more basic automatically, but will not wire if they are
    incompatible. So, if you are careful, you can select the class from the
    menu and create the control refnum that you can wire to the connector
    pane allowing you to pass refnums into the VI. A shortcut that is a bit
    simpler is to draw the reference from the diagram to the subVI panel.
    It will make the correctly typed control refnum for you, ready to wire
    to the connector pane.
    That is sort of the basic overview. You probably want to look at the
    example -- general/cntrlref.llb/Property Nodes.vi. I also suspect that
    the devzone contains other examples showing how they can be used.

  • Can strictly type refnum control do type coercion?

    Hi all,
    Can strictly type refnum control do type coercion? NI says yes:
    A control refnum terminal that is strictly typed can only accept control references that are strictly typed to a compatible type. For example, if a subVI expects a control refnum of type Slide(Int32), you can wire a control reference of type Slide(Int32), Slide(Int8), or Slide(DBL), but not of type Slide(Cluster of DBLs). Wiring in the Slide(Int8) or Slide(DBL) will result in type coercion (no error) and thus a coercion dot as these representations are being coerced to Int32. Wiring the Slide(Cluster of DBLs) will result in a type conflict (error) and thus a broken wire. This is because the Int8 and DBL are numerics like the Int32 and can thus be coerced to be of Int32 representation. The Cluster of DBLs however, is not a numeric, but a totally different data type. Therefore, a cluster being of different data type than the numeric will result in a type conflict if wired together. Strictly typed references are most beneficial when you know exactly what type of data you will be using.
    http://zone.ni.com/devzone/cda/tut/p/id/3159
    I have seen this help file for long time, and been confused by it for long time. I don't think strictly type refnum control can do type coercion. If I put a U8 Enum refnum control on subvi's front panel, I can't connect it with a U16 Enum refnum control.
    I don't know if I am right. 

    What is an "enum refum control"? Can you attach a small VI containing the various controls?
    steady wrote:
    Besides, I don't know what Slide(Cluster of DBLs) is. I can't generate such data type.
    A slide control with multiple sliders is a cluster datatype. One cluster element per slider.
    Just place a slide, right-click it...add slider. Voila!
    LabVIEW Champion . Do more with less code and in less time .

  • How to create a strictly typed refnum control using LabVIEW scripting

    I wish to use LabVIEW scripting to create a strictly-typed refnum control that is bound to my custom control (a type-defined cluster), but I'm unfamiliar with scripting and can't see how to do it.
    If I create a New VI Object, using Control Refnum as the Style, how do I provide my custom control to the VI Object Class terminal? When I try using a reference to my custom control.ctl file (using Open VI reference) I get an error: "Error 1057 occurred... Type mismatch: Object cannot be cast to the specified type."
    Or, if I create a new Control Refnum as above, using a standard Cluster as the VI Object Class, how do I then convert this refnum control to a strictly typed refnum that is bound to my custom cluster control type?
    Thanks in advance for any advice,
    Thoric (CLA, CLED, CTD and LabVIEW Champion)
    Solved!
    Go to Solution.

    Here we go...
    You have to create a new Control VI and then specify the VI Type as Typedef.
    Regards,
    Da Helmut
    Attachments:
    example.vi ‏22 KB

  • Get Specific References for all Controls

    Using slightly modified code from here, I am generating an array of all control references on my main front panel which is then passed through to a number of subVIs. Although this functionality does work, it would be preferable to get specific references to the controls (for example, Boolean RefNum instead of Control RefNum). 
    Getting these specific references seems possible using To More Specific Class and Class Specifier constants. However, data storage becomes an issue because I can no longer use arrays (as they are a different data type). I am not sure if there is another way to pass this data on. I have experimented casting the RefNums to Variants, but to get the data from the variant, I have to know what RefNum type I am expecting which sort of defeats the purpose of doing this in the first place.
    A secondary problem is keeping the names of the references. The Control RefNums do not have names associated with them nor do I know how to assign names to them. I've again tried using variants and using the OpenG Set Data Name function, but this crashes LabVIEW without any indication of why.
    I've attached a version of my code that tries assign names using OpenG Set Data Name and build a variant array. To run it, simple add the VI as a subVI to a VI that has some boolean controls on the Front Panel. Apologies for the rough state of the code - I'm still in the process of figuring out how to make it work so things are a bit messy.
    Solved!
    Go to Solution.
    Attachments:
    Get Specific Control Refs.vi ‏28 KB

    I don't know if you'll get much better.  There is really no way I know of to have some fully flexible way of building named clusters of references based on any given front panel set you feed to it.
    I tend to do things the manual way (as there are also a bunch of references to front panel elements I wouldn't need).  I would do all the bundling work in a subVI.
    I'm attaching a zip file that contains the key VI's (unless I missed something) on the first project where I really tried to abstract out the reference building.  The files are LV9.
    On my main VI, I have the subVI called Build UI References early in the VI during an initialization phase.  I pass the reference to the main VI into that subVI that builds all the references.  I worked it as a master cluster that contains elements that are arrays of references of related controls.  It uses another subVI called Get References and Label Names that I created to help find controls.  I still need to use More Specific Class to get the property references, but I don that only once at the beginning.  I then pass that cluster wire out and to anywhere in my VI that would need access to the references for front panel elements.
    I use arrays of strings to supply the names I need to build and bundle the references.  This lets me ignore controls I don't care about.  The disadvantages to my system is that if I change the name of any control, I need to update the name within this subVI.  And if I want to add any controls, not only do I need to add the label names for the searching functions, I also need to update my typedef cluster (and you definitely want this to be a typedef) to add a spot to store the new reference.
    I hope this gives you some ideas.  It worked for me and I will likely use the scheme on another project (or even rewrite past projects using this scheme.)  If there are any ideas for improvements, I'd be happy to hear them.
    Attachments:
    Build UI refs.zip ‏83 KB

  • How do I find the typedef for a control?

    I have several VI's (350+) which make use of a number of typedef and strict typedef controls. I want to automatically generate some documentation but I would like to insert the name of the typedef as the data type but I cannot see how to make the link between a control from Controls[] to the control VI's listed in Callees[]. I suspect that there may be something in the Type Descriptor of the control but I cannot find anything that explains how I can map this to one of the Callees[].
    Thanks
    Bill

    One way is to use an otherwise unused property of all your TYPEDEFS to store the name in. You could use CAPTION, DESCRIPTION, or TIP.
    If you set the CAPTION property of your TYPEDEF to "My TypeDef", then your doc generator can use a contol refnum and a property node to get at the caption.
    On second thought, that might only work for STRICT TYPEDEFS, since the caption may be independent otherwise.
    Even if that works, it means going back and editing your 350+ files.
    < UGLY HACK ALERT >
    Another way is to compare the TYPE DESCRIPTORS to a known set of type descriptors.
    Suppose your doc gen app has a cluster of 350+ instances (one instance of each) of your typedefs. You set the caption or label of each one of these to the text you want to see.
    Use the CONTROLS[] property of the cluster to get an array of control refnums. When you have a control you want to find the type of, get its TYPE DESCRIPTOR.
    Search thru your reference control refnum array, getting the TYPE DESCRIPTOR of each, and comparing it to the TYPE DESCRIPTOR of the control in question. When you find a match, extract the CAPTION of the reference control and use it.
    Be aware that the TYPE DESCRIPTORS may be 100+ words long.
    You might have to include the basic types (I16, U32, STR) in your reference cluster, or deal with them separately if not found in your table.
    < /UGLY HACK ALERT >
    The type descriptors are meant as an internal structure, with good reason, I suppose. NI can change them at any time. Still, comparing them for equality shuold always be valid.
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • What kind of refnum to use

    I am nearing completion of my VI...thanks to those of you who have helped.  I've run into what I hope is one of my final issues.
    Brief refresh - I parse a text file then create a bunch of boolean/numeric controls/indicators accordingly.  All of the data that comes out of the text file gets put into arrays in a particular format.  All of this data is saved in a new VI that I can then open and use independently.  All of that is working.
    One of the final things I'm trying to do is as follows...I want to create an array of references to the controls that I create.  Let's take the example of the boolean control.  First I initialize an array using the Boolean class specifier constant:
    Then as I am parsing the text file and creating the controls, I grab a refnum from the control I create and put it into the array (the entry at the top left of the case structure is the refnum):
    When the loop is complete, I take the modified array and assign it as the value to the array I want created in my output/final VI:
    This new array shows up in the output VI, but I am having a really hard time testing its contents.  All of its contents are of type control refnum, which is obviously because that's how I create it in the final picture above.  So I've yet to find a way to read out the value assigned to one of those refnums.  Here's an example of what I tried (again, just trying to read the true/false value of the control associated with the reference in the array):
    The reason for the broken wire there is that it says the Value output is of type variant.  This doesn't make sense to me...if I cast it as a boolean (which obviously works because the property node is interpreting it as type Bool), then why does the Value property output a variant instead of a boolean?  I also tried Varient to Data, but had no luck.
    Perhaps there's an easier way to do this, I don't know.  Ultimately I have 2 questions:
    1. assuming I'm trying to create an array of boolean refnums, is Control Refnum the correct 'style' to use when I create the new VI Object, and if not, what is?
    2. assuming control refnum is correct, how do I then read out the value of the control in the newly created VI?  In other words, the final array I'm trying to read (in my final picture above)?
    Thanks

    Hi bmishoe,
    why the hell are you creating 2D arrays of refnums?
    You collect refnums of different types in that array, so they became "more generic". To get back the specific properties of the controls you need to convert them "to more specifc class" - or you convert that variant back to a boolean value.
    For both conversion you need to know the type of the control belonging to that refnum…
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

Maybe you are looking for

  • User having all authentication but unable to login in planning why  ?

    user having all authentication but unable to login why in planning ?

  • How to fire outbound plugs of a window?

    I have a component which I want to re-use in applications. The component should have 2 outbound (interface) plugs which can be wired into parent applications. When the user clicks buttonA in the component it should fire outboundPlugA, likewise for bu

  • Connected to wifi but can't access internet

    My MacBook connects to the internet through wifi, but ipod, iphone and ipad only connect.  Even though the bars are there indicating connection, I can't access the internet on any of the 3 devices.     When I reset the router it the devices can acces

  • Roll out project for QATAR

    Hi Experts,                   I am new to sdn community , i just need your assistance to start working on rollout project for one of the top mnc of QATAR , and i got selected to work as sap fico consultant for this project , so my question is how to

  • NLS support in JPDK

    Hello world ! I've written some portlets in jsp and OC4J (iAS R2). When i try load jsp throught oc4j server i see russian, but when i load the same portlet (i.e. some jsp) in portal environment i see ???????. What is my problem ? tnx