03-30-2022 05:11 AM
Hi!
I'd like to use references for my numeric controls, but I just realized that there are many sub-control types. Now I imagine the differences between some of them, but I'm struggling a bit with the difference between "numeric" and "digital".
If I create a numeric control and then create a reference, it will specify "digital". Why not "numeric"? Will it cause any issues if I put the wrong type for a specific reference?
My guess is that it won't (might not have access to exactly the same properties) but I am very curious why no elements in the "Numeric palette" generates a Numeric control type reference.
Thank you for your clarifications 🙂
- Vinny.
03-30-2022 05:51 AM
Hi,
I must admit that I never thought about it much.
Since there is no need to select the right one manually, I never felt the need to know! I just get the right typ from the control I'm actually using.
Selecting the wrong type manually may cause errors when you then try to use mismatched properties.
What are you planning on using the references for?
Best regards
Florian
03-30-2022 06:28 AM - edited 03-30-2022 06:30 AM
Digital is a more specific version of a Numeric. Other Numerics include enums and rings.
03-30-2022 06:41 AM
@Florian.Ludwig wrote:
What are you planning on using the references for?
Simply access values (set+get) as well as other "normal" properties (Visible; enabled state; Caption string etc.) nothing too specific.
I just found it easier to create them all in a cluster typedef rather than doing R.Click-->Create-->Ref-->Create constant and place it in a cluster.
Now I have it all here and I can easily add/remove them as my software goes 🙂
03-30-2022 06:43 AM
@crossrulz wrote:
Digital is a more specific version of a Numeric. Other Numerics include enums and rings.
So I would only have issues if I happen to load a reference of a Numeric into my cluster which has a reference of Digital; but not the other way around, right?
03-30-2022 07:03 AM
The properties you listed shouldn't be an issue since even the most generic control references will allow them.
Values might be an issue though.
If I need a ref constant I will usually:
Drop a control refnum with quick drop (cr) -> drag the control on it -> change to constant.
I don't do that much anymore nowadays because I do set / get values with Set Control Values by Index.
03-30-2022 07:23 AM
@Florian.Ludwig wrote:
I don't do that much anymore nowadays because I do set / get values with Set Control Values by Index.
What's that? 🤔
03-30-2022 07:34 AM
The vis can be found in Programming -> Application control.
Basically you can set/get value not by the reference to the element, but by a reference to the owning vi and an index number corresponding to the element. It is a much faster read/write (which may not be relevant). You cannot manipulate other properties that way though.
03-30-2022 07:45 AM
@VinnyAstro wrote:
@crossrulz wrote:
Digital is a more specific version of a Numeric. Other Numerics include enums and rings.
So I would only have issues if I happen to load a reference of a Numeric into my cluster which has a reference of Digital; but not the other way around, right?
Coercion can only go up the hierarchy. So a Digital reference can be coerced to a Numeric reference. To go from Numeric to Digital, you will need to use the To More Specific Class function and possibly handle the error if it can't (for instance if the reference is to an Enum).
03-31-2022 09:54 AM
@Florian.Ludwig wrote:
The vis can be found in Programming -> Application control.
Basically you can set/get value not by the reference to the element, but by a reference to the owning vi and an index number corresponding to the element. It is a much faster read/write (which may not be relevant). You cannot manipulate other properties that way though.
Is this globally what you are suggesting?
If yes, how is it different/faster than this (what I am pretty much doing currently).