Hi Jan
First a small sidetrack:
Even though it is possible to change the access modifier of
the controls, either through the designer or the code I
still argue that any code that is inherited must be designed
for inhertence for inheritence to make any sence. (Mr. Don
Box argues that MS did a misstake when they didn't make
C#/VB classes sealed by deafult; and I partly agree)
Back to your problem;
You could keep your user interfaces as simple as possible.
(There are a few patterns for this, check out MVC or MVP) If
you design them for inheritence from the start or not
depends on your problem domain, customer requirement and
development process. I prefer to develop XP style and
therefore do the redesign for inheritence when needed; but
no sooner. Another slightly different approach is to use an
application framework like CAB, Composite Application Block
from MS Patterns&Practices. Using such a framework makes
it easier to create customized applications but it requires
some effort to get started. (If you earn your money on
customized applications you could even create a software
factory for this purpose; P&P has examples on the web
site)
Best Regards,
Daniel
Daniel.Petersson cefalo.se
+46 <mailto aniel.Pe
tersson cefalo.se+46> (0)70-1815724
________________________________
Från: Discussion of development on the .NET platform using
any managed language genom Jan Dropczynski
Skickat: ti 2006-11-21 16:21
Till: DOTNET-CLR DISCUSS.DEVELOP.COM
Ämne: Re: [DOTNET-CLR] SV: [DOTNET-CLR] Changing default
modifier for controls
Hi Daniel,
I'm following your opinion as far as the fields are not
controls in a GUI.
What if you have a form or a user control with several
controls on it and
you want to allow to change the GUI because of a customer
request? That
means for me, create a new form/user control that inherit
from
the "original" form/user control and reposition
the controls using the
designer in VS2005 (and add some additional logic if
necessary).
However, if the controls are not protected or public you
cannot use the
VS2005 designer to change the GUI.
Which way you are going here? Do you leave the modifiers of
the control set
as Friend, create properties for the controls and force the
guy who
inherits from your form/user control to write code to
reposition the
controls manually?
I guess that is not user-friendly for all which want to
change your GUI.
Ok, the weak point in my solution is that the
customer-specific
implemenation has a problem if you change the GUI in the
base form/user
control but in my opinion this is better than force other
programmers to
write a lot of code to change the GUI.
Best Regards,
Jan
On Tue, 21 Nov 2006 09:30:17 +0100, Daniel Petersson
<daniel.petersson CEFALO.SE> wrote:
>Hi Jan
>
>I prefer to explicitly expose the extendable controls
through protected
properties that I add by hand after the user interface has
been designed.
There are two main reasons not to use protected fields:
>
>1. the feature isn't CLS Compliant
>2. it exposes your internal implementation and makes it
harder to change
in future releases.
>
>Best Regards,
>Daniel
>
>Daniel.Petersson cefalo.se
>+46 (0)70-1815724
>
>________________________________
>
>Från: Discussion of development on the .NET platform
using any managed
language genom Jan Dropczynski
>Skickat: ti 2006-11-21 09:00
>Till: DOTNET-CLR DISCUSS.DEVELOP.COM
>Ämne: [DOTNET-CLR] Changing default modifier for
controls
>
>
>
>Hello world!
>
>In my company we're developping software with a GUI that
should be
>extendable or better inheritable. However, if you are
using the forms
>designer of VS2005 with VB.NET - we're using this
language mostly,
>unfortunately - all controls added to a form have the
modifier "Friend" for
>default but this is not usable if you want be
inheritable!
>Therefore, my question is: Is there an option to change
the default
>modifier so we can set it to "Protected"? That
will save us the work to
>change the modifier each time you're adding a control to
a form.
>
>If there's no such option, I say: Hello Microsoft, I
have a change request
>for the next version of VS.Net. ;)
>
>Thanks in advance and best regards,
>Jan
>
>===================================
>This list is hosted by DevelopMentor® http://www.develop.com
<http://www.develop.com>
>
>View archives and manage your subscription(s) at http://discuss.develop.com
<http://discuss.develop
.com>
>
>
>
>===================================
>This list is hosted by DevelopMentor® http://www.develop.com
<http://www.develop.com>
>
>View archives and manage your subscription(s) at http://discuss.develop.com
<http://discuss.develop
.com>
===================================
This list is hosted by DevelopMentor® http://www.develop.com
<http://www.develop.com>
View archives and manage your subscription(s) at http://discuss.develop.com
<http://discuss.develop
.com>
===================================
This list is hosted by DevelopMentor® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
|