M
Marco Jez
Hi everyone,
should I do something special to define the default value of a property in a
Managed C++ component or control class? Here is how I'm trying to do it:
[
DescriptionAttribute("Blah"),
CategoryAttribute("Behavior"),
DefaultValueAttribute(false)
]
__property bool get_Value() { return !internal_; }
__property void set_Value(bool v) { internal_ = !v; }
the field internal_ is initialized to true in the constructor so that
calling get_Value() would return false, which is the default value.
Well, this doesn't work... Whenever I add this component to a form in the
designer and look at the property browser, I notice that the above property
is displayed in bold style as if it was modified (but it isn't); trying to
restore the default value by menu results in an error message being
displayed.
What am I missing?
Cheers,
Marco
should I do something special to define the default value of a property in a
Managed C++ component or control class? Here is how I'm trying to do it:
[
DescriptionAttribute("Blah"),
CategoryAttribute("Behavior"),
DefaultValueAttribute(false)
]
__property bool get_Value() { return !internal_; }
__property void set_Value(bool v) { internal_ = !v; }
the field internal_ is initialized to true in the constructor so that
calling get_Value() would return false, which is the default value.
Well, this doesn't work... Whenever I add this component to a form in the
designer and look at the property browser, I notice that the above property
is displayed in bold style as if it was modified (but it isn't); trying to
restore the default value by menu results in an error message being
displayed.
What am I missing?
Cheers,
Marco