11-11-2010 09:47 AM
I'm using a ring indicator both as a feedback to the user to indicate what stage a program is at and as an input to a case structure within a while loop.
The idea is that the text will tell the user what the program does & the program executes whatever case number that text corrosponds to. In some of the cases, I am using property nodes for the ring indicator to select which case gets executed on the next loop iteration. To acomplish this I make set the value property of the ring indicator to read & create a constant for it. These constants are like a dropdown menu with all the text values for the ring. It works find until I need to add extra cases. When I do that, the drop down constants do not update to reflect the changes, although if I remove the constant & replace it with a new one, the changes are there.
I have many of these in my program, so doing this would not be a great option. Is there any way of ensuring these constants get updated when the indicator is changed or are the values set in stone when the constant is created?
I tried making the indicator a typedef (strict), but that was just desperation 🙂
Thanks for any help.
Joe
11-11-2010 09:56 AM
Did you try a search? This has been brought up many times. The typedef defines the datatype, not the properties. A ring is a numeric value and hence the strings are not part of the datatype. What you want is an enum.
11-11-2010 10:29 AM
I did try a search but did not find anything to help my situation. I just tried replacing a ring with an enum now. All that does is show a broken wire on the block diagram between the constant and the property node for the emum when I add extra items in the typedef & apply the changes.
I feel it should work but that I'm missing somthing.
Joe
11-11-2010 10:36 AM
make a constant from your typedef enum. Then they will update as well... But you will have to do this EVERYPLACE that you have used a constant.
11-11-2010 10:38 AM
And that is exactly what I'm trying not to do. I've got quite a few constants to update otherwise....
Joe
11-11-2010 10:38 AM
@PJS wrote:
make a constant from your typedef enum. Then they will update as well... But you will have to do this EVERYPLACE that you have used a constant.
But if he plans to change the values at run time, we have to forget about type defs and explicitly code up all instances of the ring.
Ben
11-11-2010 10:53 AM
@Ben wrote:
@PJS wrote:
make a constant from your typedef enum. Then they will update as well... But you will have to do this EVERYPLACE that you have used a constant.
But if he plans to change the values at run time, we have to forget about type defs and explicitly code up all instances of the ring.
Ben
He has run into the issue of ADDING things to the ring as he has programmed along. I do not see an 'easy' way of doing this without making the changes he is avoided. Painful, but lesson learned. I try to avoid rings UNLESS I am modifying at run time. And even then I usually load my rings from a configuration manager. But I learned this lesson much the same as everyone else has at somepoint in their labview programming experience.... Get bitten then don't do that again!
11-11-2010 10:56 AM
@Joe McC wrote:
And that is exactly what I'm trying not to do. I've got quite a few constants to update otherwise....
Joe
You would only need to do this once if you use a typedef. PJS was referring to the initial replacement of your ring constants with instances of the typedef enum. Once this is done, updating the enum will automatically update all instances of it, whether they're controls, indicators, or constants
01-19-2011 07:33 AM
The use of an enum solves the problem in terms of updates from the type def, but it is not programmable during run time. Hence, we are still stuck with this one.
01-19-2011 07:51 AM
Maybe better to start a new thread but off-hand I'd think and AE could be developed to update all ring instances at run time.
Ben