From: Bart B. <ba...@ho...> - 2000-11-25 11:11:08
|
Well as I wrote it is done the same way that dynlayer will initialize function widget(){ this.construct(arguments) // rest of your code } -----Ursprungligt meddelande----- Från: Pascal Bestebroer <pa...@dy...> Till: dyn...@li... <dyn...@li...> Datum: den 24 november 2000 18:17 Ämne: RE: Re: SV: [Dynapi-Dev] Widget constructor >but how would you want to handle widget-specific initialisation? > > >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 11:35 >> Aan: dyn...@li... >> Onderwerp: Re: Re: SV: [Dynapi-Dev] Widget constructor >> >> >> 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 >> > >> > At 2000-11-24 06:20 , you wrote: >> > >For that particular case, use the array's join() method. >> > > >> > >function widget(argarray) { >> > > this.DynLayer = DynLayer >> > > this.DynLayer(argarray.join(",")) >> > >} >> > >widget.prototype = new DynLayer >> > > >> > >/Lunna >> > > >> > >At 2000-11-24 02:07 , you wrote: >> > >>Hmm... does not seem to work at all. >> > >>IE4 says it doesn't support the property or method. >> > >>Could you elaborate, or send me an example of this >> being used somewhere? >> > >>Another problem: DynLayer treats objects sent as the >> first argument as a >> > >>DynLayer object to setStyle after. >> > >>And as arrays(the array arguments in this case) are >> objects and >> > >>correspondingly are identified as such, the setStyle >> method will be called, >> > >>which is not the intent. >> > >> >> > >>/Bart >> > >> >> > >>-----Ursprungligt meddelande----- >> > >>Från: Dan Steinman <dy...@fu...> >> > >>Till: dyn...@li... <dynapi- >> de...@li...> >> > >>Datum: den 24 november 2000 01:37 >> > >>Ämne: Re: [Dynapi-Dev] Widget constructor >> > >> >> > >> >> > >>>Just make your widget constructor call the DynLayer as >> a method: >> > >>> >> > >>>function widget(arguments) { >> > >>> this.DynLayer = DynLayer >> > >>> this.Dynlayer(arguments) >> > >>>} >> > >>>widget.prototype = new DynLayer >> > >>> >> > >>>Dan >> > >>> >> > >>>On Fri, Nov 24, 2000 at 12:39:05AM +0100, Bartek wrote: >> > >>>> I was wondering whether it is a good idea to have >> some inheritible >> > >>constructor functionality for DynLayer. >> > >>>> I want to be able to create a widget object that >> extends the DynLayer and >> > >>inherits its initialization, i.e so I wouldn't have to >> rewrite the >> > >>initialization code for the widget but instead do >> something like this: >> > >>>> >> > >>>> ------------------------------------------ >> > >>>> >> > >>>> function WidgetLayer(){ >> > >>>> this.construct(arguments) >> > >>>> } >> > >>>> WidgetLayer.prototype=new DynLayer >> > >>>> >> > >>>> ----------------------------------------------------- >> - >> > >>>> >> > >>>> and it would look something like this for dynlayer: >> > >>>> >> > >>>> ----------------------------------------------------- >> ---------------- >> > >>>> >> > >>>> function DynLayer(){ this.construct(arguments) } >> > >>>> DynLayer.prototype.construct=function(){ >> > >>>> alert() >> > >>>> var a=arguments >> > >>>> if (a.length==1 && a[0]!=null && typeof(a[0]) >> =="object") >> > >>this.setStyle(a[0]) >> > >>>> else { >> > >>>> this.id=a[0]||"JSDynLayer"+ >> (DynLayer.nullCount++) >> > >>>> this.x=a[1]||0 >> > >>>> .......etc... >> > >>>> } >> > >>>> } >> > >>>> >> > >>>> >> > ---------------------------------------------------------- >> ----------------- >> > >>>> >> > >>>> I am trying to implent this as I write, to test it >> out, and I'm having >> > >>some problems. >> > >>>> Maybe there is a better way of doing this... If so , >> please let me >> > know. :) >> > >>>> Or am I on the right track? >> > >>>> >> > >>>> >> > >>>> /Bart >> > >>>_______________________________________________ >> > >>>Dynapi-Dev mailing list >> > >>>Dyn...@li... >> > >>>http://lists.sourceforge.net/mailman/listinfo/dynapi- >> dev >> > >> >> > >>_______________________________________________ >> > >>Dynapi-Dev mailing list >> > >>Dyn...@li... >> > >>http://lists.sourceforge.net/mailman/listinfo/dynapi-dev >> > > >> > > >> > >_______________________________________________ >> > >Dynapi-Dev mailing list >> > >Dyn...@li... >> > >http://lists.sourceforge.net/mailman/listinfo/dynapi-dev >> > >> > >> > _______________________________________________ >> > Dynapi-Dev mailing list >> > Dyn...@li... >> > http://lists.sourceforge.net/mailman/listinfo/dynapi-dev >> >> >> _______________________________________________ >> Dynapi-Dev mailing list >> Dyn...@li... >> http://lists.sourceforge.net/mailman/listinfo/dynapi-dev >> > >_______________________________________________ >Dynapi-Dev mailing list >Dyn...@li... >http://lists.sourceforge.net/mailman/listinfo/dynapi-dev |