03-09-2012 09:16 AM
I need to know the index of the ring box that is currently displayed on the Front Panel during runtime.
The values of the ring box don't necessarily correspond to their indices so I can't just wire the ring box itself to the DisabledItems[] property.
The way I am having to get the index of the "currently displayed" item of the ring control is by doing the following:
A read to the Strings[] Property returns an array of Strings of the "Items" of the ring control.
A read to the RingtText.Text returns the string value of the current Item displayed in the ring control.
I use the search function to search the Strings array for the current text and it gives me the index of the current item displayed in the ring control.
Is there a way to get the index of the currently shown index of the ring control directly?
Solved! Go to Solution.
03-09-2012 09:50 AM
In one word NO.
the method you are using is the easiest. If the srtings are very long you could unbudle Values[] from strings and values property and search that array just to save some (really minor) memory. Bear in mind, System controls properties are dependant on the OS
03-09-2012 10:05 AM
I am confused about this thread so it must mean thre is something here that I am missing.
Good!
Why not just use the value from the terminal?
Standing by to learn something,
Ben
03-09-2012 10:10 AM
Thanks for the quick response.
This implementation seems to work fine, I'm just nitpicking at bits of code right now trying to debug a bigger issue.
Life is pain.
I'll keep in mind the Values[] tip if I notice any lag time at any point.
03-09-2012 10:12 AM - edited 03-09-2012 10:13 AM
Ah, I think I see the issue. The problem is that you can assign non-sequential values to a ring control so index 0 might have a value of 128 but index 1 could have a value of 42 (which in case you forgot is the meaning of life, the universe and everything...). Therefore, the index isn't necessarily the same as the terminal value - though the way most people use them, it often is.
Mike...
03-09-2012 10:12 AM
Ben - "Why not just use the value from the terminal?"
Because I am not using sequential values in the ring control.
If the value of the object in the first index is 0 and the value of the object in the second index is 9000,
using the value from the terminal will work for the first value but not the second.
03-09-2012 10:13 AM
My apologies, everyone. It seems like I'm a little off today on my reply timing, haha
03-09-2012 11:46 AM
@mikeporter wrote:
Ah, I think I see the issue. The problem is that you can assign non-sequential values to a ring control so index 0 might have a value of 128 but index 1 could have a value of 42 (which in case you forgot is the meaning of life, the universe and everything...). Therefore, the index isn't necessarily the same as the terminal value - though the way most people use them, it often is.
Mike...
My favorite use for a ring uses values like 0xFF0000, 0x0000FF, ect.... (Now if the silly items editor was updated I could just drop color constants into value)
Status changed 3 days ago !! WoooHooo!