LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
Hooovahh

Create a Picture Ring Constant

Status: New

I feel like in a few cases, my code could be more readable, if a picture ring constant existed.  By that I mean if I could have a block diagram object, that showed an image, and clicking it would allow me to select one of the other images in the ring, which correspond to a numeric value, just like the picture ring control does.

 

I've come into a few cases were I want to know if my picture ring on the front panel is equal to some case.  So I will use the equal primitive and compare my picture ring control value to a constant.  Problem is my constant is just a numeric, because that is what the data type of the picture ring is.  I then usually need to put down a comment explaining what the value of 2 or 3 is supposed to be.  I feel like a better solution for readability would be to have an equal function, and wired to it, is another instance of that picture ring type def, where you can see the image that the value is being compared to.

 

Now sure this doesn't come up often, and in most cases it is recommended you convert that ring into an enum, and then you get a bunch more benefits, but in a few cases I feel like adding a picture ring constant would only make the code more readable.

 

Picture Ring Constant.png

9 Comments
crossrulz
Knight of NI

Or an alternative might be a Picture Enum that also works on the block diagram.  Might have to give this one a little thought, but I do like the general idea.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Hooovahh
Proven Zealot

A picture enum is also another good idea, or tweak on this idea.  In my case my ring had non-sequential values, so I really did want a ring.  I guess an enum could have been used with "8 N/A", "9 N/A" values that weren't used.  Having non-sequential (sparse) enums is another issue all together. 

cyro
Member

Something like this?

 

PicRing.png

 

There are some small cosmetic bugs but it works...

AristosQueue (NI)
NI Employee (retired)

A picture enum would necessitate some interesting contortions in the Case Structure, but it would solve the problem of enums not being localizable. I have no idea how a picture enum would interact with the Format Into String node with %s. Ascii art?

Hooovahh
Proven Zealot

@AQ

I'm not the scientist you are, FIGURE IT OUT!!!

 

Just kidding, these types of issues would probably be up for debate, but I'm betting you could have it be like a picture ring is today.  It has an image, but that image still has a numeric value associated with it.  Well in this case you could have your picture enum, where it has enum values for each picture, then things like case structures and format into strings can behave like they do today with enums.

AristosQueue (NI)
NI Employee (retired)

Hooovahh: The idea overall is fine. I was just contemplating the issues of the enum variation specifically.

paul_cardinale
Trusted Enthusiast

Ya mean like this?

Pict Ring Const.png

But not too useful without being linked to a typedef (I haven't dug into it to figure out if that's possible).

"If you weren't supposed to push it, it wouldn't be a button."
Hooovahh
Proven Zealot

Yeah I think the type def part is sorta importat.  Setting it to strict type would (hopefully) mean updating it in one place updates it in all the places that is used.

mikep395
Member

You can kinda do this currently starting with the "Listbox Symbol Ring Constant", and then remove/add items and replace with your own images.  The catch is, you can't turn it into a type-def without loosing the image data.

 

To extend on your idea, i'd like it if the front panel picture ring Control was linked to the block diagram constant version, such that Right Click > change to constant/control/indicator maintaned the images.  This way you could have a subVI with a Pict Ring Control linked to the terminal panel, and then right click > create constant on the terminal of this subVI would add the pict ring constant to match on your parent VI block diagram.