How can I define a control’s property to be read-only (as the docs would put it) where you can set it in the IDE but not at runtime?
#IF debugBuild const myVar as Integer=10 #else dim myVar as integer=20 #endif
Create a Computed Property, but only fill in the Get part. Leave the Set part blank.
More like if one is creating a custom control and the property can be set in the IDE but should not be changed at runtime.
Like PopupMenu.InitialValue. I’m hoping for an official answer similar to the way we can deprecate our own methods in controls
Paul, that sounds like it would work but is there a means for it to throw a compile error?
A computed variable with just a “GET” is the same as a “constant” with the exception is can contain an equation (result is still immutable)… .but it will exist at both design time and compile/run time…
If you want it to exist only at design -OR- compile time… you need to use #IF
You can’t set a Constant in the IDE inspector in Layout View. This is for a custom control property.
not sure why you want asomething that exists in one mode, but does not exist in another
Because. Just like for PopupMenu.InitialValue - it makes sense in this case. It’s an option available at design time, but should not be changed in code at runtime. It’s easier to flip a switch in the Layout Editor than it is to dig around inside the control and find a constant. Especially if the control were to be encrypted.
Pauls idea turns out not to work, because it doesn’t end up getting set even by the IDE.
Ok… so you want it to EXIST at design and runtime… but to be READ-ONLY at runtime…
Thats not what I understood