|
From: Pascal B. <pa...@dy...> - 2000-10-29 12:21:31
|
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
|