From: Scott A. L. <sc...@sc...> - 2000-10-29 19:06:24
|
I like that idea, and it seems to work. I would propose some standard syntax: function Widget() { this.superClass = DynLayer this.superClass() ... } I think that's easier to understand than "this.DynLayer=DynLayer"...what DynLayer? :-) -----Original Message----- From: Pascal Bestebroer <pa...@dy...> To: dyn...@li... <dyn...@li...> Date: Sunday, October 29, 2000 4:49 AM Subject: RE: [Dynapi-Dev] (no subject) >I think there's another way of solving this.. By slightly changing the >way widgets are created (still using the same inheriting methods) > >here's an example: > > >function CoreButton(x,y,w,h,caption,flat) { > this.DynLayer = DynLayer > this.DynLayer() > > this.id = "CoreButton"+(CoreButton.Count++) > > this.moveTo(x||0,y||0) > this.setSize(w||128,h||36) > > this.caption=caption||'' > > this.lcaption=new DynLayer(null,2,2) > this.levents=new DynLayer(null,0,0) > > this.lcaption.setVisible(true) > this.levents.setVisible(true) > > this.setFlat(flat||false) > this.setVisible(true) > > this.style=new CoreStyle() > > this.children=[] > > return this >} >CoreButton.Count=0 >CoreButton.prototype = new DynLayer() > >The first lines in the constructor show the main change, I actually think >somebody >else had already mentioned this a while back but I didn't look at it then :( > >This is actually the way Netscape is talking about creating objects on the >tutorial sites. > >I think this solves the problem with the children array, so that no changes >are needed to >the dynlayer constructor. The widget will still be an "enhancded" dynlayer. > >I've also been working on benchmark / test code and I'll try to post it so >that people >can look at it and run some tests in other browsers. > >Pascal Bestebroer >pa...@dy... >http://www.dynamic-core.net > > > > >_______________________________________________ >Dynapi-Dev mailing list >Dyn...@li... >http://lists.sourceforge.net/mailman/listinfo/dynapi-dev > |