01-29-2015 11:27 AM
Hello guys,
I'm working on an application that, at stat-up, read some basic config values from a file and passes it to a ring text control, like a ini file.
The ring text control is perfect to use in diagram blocks because I can select a specific text and I have the value associated with it, in a very clear way, but... I can't use duplicated values, and my application have more than two duplicated values!
There are an alternative way or control that replaces the ring control and maintains these good qualities?
Thanks a lot
Solved! Go to Solution.
01-29-2015 11:53 AM
You seem to say that you are using the ring mostly on the diagram side. Is it also an indocator or control that the user sees? If not, you could e.g. use an array of clusters, each cluster element containing a string and a numeric. You could also use variant attributes for name/value pairs.
If you also need it as a real ring control, just use sequential values and use an array lookup table and index into it and get the real values.
Can you show us a mode defined example where what you are trying to do seems like a good solution?
01-29-2015 12:18 PM
Duplicates?
How do you tell which one is which?
Can you append an index # to the duplicates?
01-29-2015 12:41 PM
Lets be clear. do you have duplicate String elements or Value elements.
Duplcate Strings are allowed but will really annoy users and cause surprizing bugs unless you disable all but one duplicate selection and I wouldn't even try that. About the only time dup strings make any sense is "-" which is an unsetectable seperator and the item editor does not implement support for the feature. For rings, enums and combo-boxes values must be unique.
A custom control with a looser set of rules (possibly an X-Control) would be the work around but, you will have serious user, developer and maintainance issues with this.
if you have mutiple "Conditions" that should have the same effect there are better ways. Can you show a use case example? The use case would help us guide you to select a better method.
01-29-2015 01:02 PM
01-29-2015 01:44 PM
@altenbach wrote:
Well, he said "duplicate values", not items. One possible use case would be a sorted list of items, where some are synonyms and should map to the same value.
With that in mind, Variant Attributes would be the best way to go.
01-30-2015 07:19 AM
Hi,
I'll try to clarify some details.
All of itens in the ring are used only in block diagram, if needed, there are some VIs that change the values.
There are no duplicated strings, only values.
I'm using the text ring as a list of constants, the size is fixed and well defined. All of values came from a config.ini file that is read at start-up moment.
This ring have informations about my instruments and procedure, for example, number of measurements per cycle, number of cycles, instrument curve adjustments, etc. These values will change only when the instrument is calibrated or when the procedure is updated, so, I change the config.ini file and the LabVIEW code is always the same.
I attached a small part of my code that shows the ring text and where some elements are used for one instrument (I can have more than one instrument).
Right now, I had an ideia, I can use global variables, so I can use one global VI to procedures constants, one to Instrument1, one to Instrument2, and so on. This is a good approach?
01-30-2015 07:35 AM
Ah, I see where you are going with this. Global Variables actually work very well as "constants". So if they are written to at the very beginning from reading a configuration file and only written rarely, I think the global variable is a good approach.
01-30-2015 07:47 AM
01-30-2015 07:52 AM
The benefits of a ring is to group constants of same family, like, parameters of instrument, parameters of process, general parameters, etc.