all groups > dotnet windows forms designtime > january 2005 >
You're in the

dotnet windows forms designtime

group:

TypeConverter in a form property



TypeConverter in a form property João Santa Bárbara
1/19/2005 9:31:42 AM
dotnet windows forms designtime: Hi all,

i´m doing a form to be Inherited, and inside it has a property that i
create.
that property is one class with several propertys ( simple ones integers and
strings )

And in my Inherited form, the property appears there :D so far so good.

but i need to edit it. so i have create an typeconverter, so that property
to be explandable in design time.

now the problems start.

this property is similar to the font property, every time i change in the
base form it changes in every derived form. except if the derived form has
already changed that property.

But in my class it not works like that. every time i change in the base form
the other forms seems to be changed, but when i do some kind of modification
in a derived form ( ex: move a button and save ) it saves the property
with the parent values ?

can someone help me ???

thks
JSB

Re: TypeConverter in a form property João Santa Bárbara
1/20/2005 9:39:48 AM
thks for the help.

Please see the zip file, i will try to explain the problem that i have.(
that is a project that i have made )

so, let´s start.

if you see i have a base form with a public property. (Public Property
MyClassTest() As ClassTest ) ) that property is the problem

now i have a second form called configuration form, which is a base form
too, is inhrited from the frist base form. so in this form ( configuration
form ) i will do the changes to the ihnrited property MyClassTest, i will
set the color and the text.

and now in the 3 form wich is the application form, i will have the same as
the other 2 forms, but with one exception, i don not need to change the
property MyClassTest, unless i need to changed it explicity but this is not
the case.

so when i change any thing in the 3 form (ex resize the form), VS will save
the changes, including the values in that property.

can you assist me ???

thks
JSB






[quoted text, click to view]


begin 666 TestApplication.zip
M4$L#! H``````#9+-#(````````````````@````5&5S=$%P<&QI8V%T:6]N
M+U1E<W1!<'!L:6-A=&EO;B]02P,$% ````@`-$@T,N*<[/OM`0``% 0``"\`
M``!497-T07!P;&EC871I;VXO5&5S=$%P<&QI8V%T:6]N+T%S<V5M8FQY26YF
M;RYV8GU278_:,!!\/XG_L.+EZ$E$<+K2@JI*?!P(J==6!ZW41R?9D+TZ=F2O
MH?GWM4..@'HE+_&NQ[.SN[,N2FW8PJ:RC$7G9GT11\^824R8M/KWRBFF`J.U
M8C2ZW*#94X*V<].YN845*C1"PEIEVA0B$("(M6,0_F M%K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P_'1;8Q@K&S)"%;6_T!
MI'YI%:'&-OF,[+F ] "XKT!!T+M7BK.\_IT(M@C;G613,V^*_G+6-02;1(8J
MYHJ(6X3'S8PBAW<:1SW"2=CX&9 %QUSBNAXK4=H(M H']H"]BJ9/A^L/S6%)
MQ&EU59PB;IPBE7&2*^8PO>^-7F,._Q#YRI>A>@Y;`[X9.N +<%_Z_7V2N_60
MSR=[X[WQ;5NWB$\50IA `/P=#OK:#P,<P?9)/-:*M)#G.+^&C4;QO/;N-+S1
M)+[16'OX;GZK\!;B%U#UVCZ\-7#'"E'IGF7/B[N>'TI;:5)3[^\%$7^:8_2]
Re: TypeConverter in a form property joeycalisay
1/20/2005 11:49:21 AM
[quoted text, click to view]

You are having some problem with code generation. Perhaps you need to
provide default values for the sub-properties using either the
DefaultValueAtrribute or the Reset<propertyname> -
ShouldSerialize<propertyname> method pair. Can you provide additional info
with some code? For the mean time read on the following links which can be
helpful in your development:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/custcodegen.asp
http://www.awprofessional.com/articles/printerfriendly.asp?p=169528

--
Joey Calisay
http://spaces.msn.com/members/joeycalisay/


[quoted text, click to view]

Re: TypeConverter in a form property João Santa Bárbara
1/20/2005 2:45:06 PM
hi there thks for the help.
i already understand the serializer but try to do one thing, perhaps you can
see what i´m try todo.

try this
create a
formBase
the font property is ( Microsoft Sans Serif; 8,25pt..... )
after create another form inherited from the first and change the font
property
if you see the code there is an entry some thing like this
Me.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.25!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,
Byte))
now create another form inherited from the 2 form.
you will see in the property page, that the font has the same value as
the previous form, and if you see the InitializeComponent method, you will
see that is nothing written to change the font in form3. what i want to do
is the same with my class. :)

can you help me with the sample that i send to the news groups.

thks
JSB

PS: i allready tried the serializer, it works in the 2 and 3 form very well
( it only writes the changed property ), but when i do the resize on the
form3 it writes the changed property again. witch i don not need because it
was changed by the form2 .. :(







[quoted text, click to view]

Re: TypeConverter in a form property joeycalisay
1/20/2005 7:11:59 PM
VS by default serializes all non-default values of the properties of the
components. And since you have not provided any default property values,
any change on your Form1 (resizing will do) will force the Form Designer to
re-serialize or generate the code (codegen) for all the non-default values
of the components involved, in this case the form.

Having a default value set for your properties will minimize the codes
generated on the InitializeComponent of your Forms. With this, you can
attain Visual Inheritance (which is very buggy IMO). This can be attained
by attaching DefaultValueAttribute on simple properties or providing the
Reset<propertyname> -
and ShouldSerialize<propertyname> method pair as I've said earlier. This is
clearly illustrated in Burke's article that I provided on my last post. Try
to read it, it will help a lot.

If it's still unclear after you've read the links, just re-post so we can
help you further...

--
Joey Calisay
http://spaces.msn.com/members/joeycalisay/


[quoted text, click to view]

AddThis Social Bookmark Button