From: Pascal B. <pa...@dy...> - 2000-11-24 17:20:22
|
I've been doing it like this: myWidget.prototype._myWidgetSetSize=DynLayer.prototype.setSize myWidget.prototype.setSize=function(w,h) { // do your own code here this._myWidgetSetSize(w,h) } Pascal Bestebroer pa...@dy... http://www.dynamic-core.net > -----Oorspronkelijk bericht----- > Van: dyn...@li... > [mailto:dyn...@li...]Namens Barre Bizon > Verzonden: vrijdag 24 november 2000 17:32 > Aan: dyn...@li... > Onderwerp: [Dynapi-Dev] Widget method extending > > > Another thing... > Is there a way of extending methods? > Have been struggling with this a couple of hours now... and > I can't get past the fact that when you create a widget > that "extends" DynLayer and you want it to extend various > methods,it seems that you have to rewrite the methods in > full. > There should be a better way of doing this also. > > /Bart > > > > hmm seems kindof obscure.. > > It strikes me as having a construct method to be a > cleaner > > way of doing initialization.. almost like calling super() > > in Java... hm? > > (The code below should work) > > > > function DynLayer() { this.construct(arguments) } > > DynLayer.prototype.construct=function(){ > > var a=arguments[0] > > ........etc....... > > > > function widget(){ > > this.construct(arguments) > > } > > widget.prototype=new DynLayer > > > > > > > Forget what I wrote.... it should be this instead: > > > > > > function widget(argarray) { > > > this.DynLayer = DynLayer > > > eval("this.DynLayer("+argarray.join(",")+")") > > > } > > > widget.prototype = new DynLayer > > > > > > /Lunna > > _______________________________________________ > Dynapi-Dev mailing list > Dyn...@li... > http://lists.sourceforge.net/mailman/listinfo/dynapi-dev > |