NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to set the comment solely on an alias of another property

Hi folks,

 

Let's say I create two properties:

FileGlobals.NewSubProperty( "NewProperty", PropValType_String,False,"",PropOption_DoNothingIfExists)

,FileGlobals.NewSubProperty( "SomeOldProperty", PropValType_String, False, "", PropOption_DoNothingIfExists )

 

NewProperty is a property that I want my users to refer to, whereas SomeOldProperty is deprecated.

 

I add a comment to the new property:

FileGlobals.NewProperty.Comment = "Developers, use this property now."

 

I don't want to break people's code, so I'm leaving SomeOldProperty intact, and I'm making it an alias of NewProperty.

FileGlobals.SetPropertyObject( "SomeOldProperty", PropOption_NotOwning | PropOption_ReferToAlias, FileGlobals.NewProperty )

 

Then I want to comment SomeOldProperty so that people know it's deprecated and they shouldn't use it:

FileGlobals.GetPropertyObject( "SomeOldProperty", PropOption_ReferToAlias ).Comment = "This property is deprecated"

 

The issue I'm running into is that both NewProperty and SomeOldProperty both get the commented as "This property is deprecated"

 

Is there any way to set the comments on these two properties separately once SomeOldProperty is an alias of NewProperty?

 

Thanks very much,

 

Mr. Jim

 

 

0 Kudos
Message 1 of 2
(1,216 Views)

Hi Jim,

 

I am not completely positive on this, but since noone else is replying, a second opinion is better than none, right...

 

I have done some similar tests that yours, except I have used the FileGlobalDefaults instead of the Runtime FileGlobals.

After creating NewProperty and SomeOldProperty as it's alias in the FileGlobalsDefaults, I have messed around by manually editing the FileGlobals in the Sequence File.

Still whatever I input into the value or comment of one variable, the other one immediately mirrors it.

 

To me this shows that the TS engine always sets an alias to be a complete mirror of the original object it references. This includes not only the value, but also the comment. However you assign a comment to NewProperty or SomeOldProperty, the TS engine will immediately assign the same value to the other variable. That would also mean that it does not matter if you set the comment before or after making it an alias. 

 

Which unfortunately would lead to the answer, that you cannot set comments on the two properties separately, because the comment of an alias cannot be anything but it's referring property's comment.

 

Stefan

 

 

0 Kudos
Message 2 of 2
(1,106 Views)