StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Default properties on designer changed on...Expand / Collapse
Author
Message
Posted 09/10/2007 11:13:25 AM


StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 08/27/2008 2:42:57 PM
Posts: 112, Visits: 665
I see that If I set a "default" property (example: the "cursor" property of a form set to "default"), the designer don't put code on designer, and the property not are "Bold"

I like to inherit "control1" with some default property on the base, but that property on base are inherited of some Base2 and If I change the default property of the base2 don't like that this change the base and "control1" property... (that are set to default) I have to change it programmatically? (because if I set it on base to the default value, it not overwrite the base2 property)

I think that a better question is: ¿can I set a property to a default value without the base can change that?

more graphically:
Control1 : Base : Base2

something like a default property "Color = RED" on base 2

and I like that control1 and Base have the property "RED" still if base2 change it

I can do it editing the designer or I have to set any "default" property (to me) on load or something else? thanks!!
Post #11402
Posted 09/10/2007 1:26:40 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 5:02:56 PM
Posts: 2,682, Visits: 1,882
Aha, here comes the problem with inheriting controls and using the designer.  If you set a property in a base class, the designer adds it to the code of the InitializeComponent() method, which gets called by the inherited controls as well.  Then, if you set the property back to its default, the subclass designer thinks that it doesn't need to generate code for it, so it does not serialize it (bold it).  But, since no code was generated to set it back to the default, the base class's code to set the property takes over. 

Kind of a pain if you ask me.  The problem is being able to control the ShouldSerializePropertyName and ResetPropertyName methods, which are defined in the class that defines the property.  Since the property was defined in the base class, it controls whether the value should be serialized. 

Long story short, the only way to fix it is to set the proper value within the subclass, programmatically.  If component designers were smart, they would make the ShouldSerializeX and ResetX methods overridable, but I've never seen a control where they were.


www.bungie.net
Post #11408
Posted 09/10/2007 2:32:02 PM


StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 08/27/2008 2:42:57 PM
Posts: 112, Visits: 665
I'm still very Visual FoxPro - Minded and some things like that on .net not are implemented.
In VFP if you select the default property and "set" it on the designer, it will be overwriten. and with the right mouse button you can default it again :/

I think that it can be done on .Net with hard difficulty coding and some weird and strange logic

Thanks for the Clear answers that you give to me on every post.


Post #11410
Posted 09/11/2007 1:14:32 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 5:02:56 PM
Posts: 2,682, Visits: 1,882
Thanks for the Clear answers that you give to me on every post.

Thanks, I wouldn't say I'm always clear, but I try to explain things as much as possible


www.bungie.net
Post #11431
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 7:04pm

Powered by InstantForum.NET v4.1.4 © 2008
Execution: 0.063. 10 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.