From: Scott A. L. <sc...@sc...> - 2000-10-28 21:54:01
|
Yes, a boolean could do the same trick. Maybe removeChild/deleteChild can set it to true/false if the length becomes zero. My point is that when you define an object's prototype structure with another object, as in WidgetX, all of the properties of that base DynLayer instance are shared with each Widget. Widget.prototype=new DynLayer() <-- Widget.prototype is a new DynLayer *instance* This is generally okay in DynAPI2 because the shared properties are eventually overwritten with unique ones. For example, all WidgetX model widgets share the *same* css, elm and doc object when first constructed. But when you add them to a parent object, the assignElement method overwrites them with *unique* values. But children[] is never overwritten anywhere, so it remains a reference to the children array of the shared base DynLayer instance. So we either have to 1) always remember to assign it "manually" in our widget code, or 2) find a better place in the DynLayer code to assign it to ensure it is unique. I'm not trying to undermine the WidgetX model, because it's an easy way to achieve a sort of inheritance, but this issue needs to be addressed. Who knows what kind of memory leaks this may cause in the long run: Widget1.prototype = new DynLayer(); Widget2.prototype = new Widget1(); Widget3.prototype = new Widget2(); etc. scottandrew -----Original Message----- From: Robert Rainwater <rai...@us...> To: Scott Andrew LePera <dyn...@li...> Date: Saturday, October 28, 2000 2:13 PM Subject: Re: [Dynapi-Dev] (no subject) > >There's also a bit of inconsistency with making the children array >null. Because once you remove all the children, the array is not >null, but has a length of 0. So, in your widget, you will have to >check for a null array and a array of length 0. I don't understand >why the array can't be initialized to an empty array. > > >Later, >Robert <rai...@us...> > >> I think I've found a fix for the problem with children arrays being shared >> between widgets made with the widgetX model. >> >> The problem: >> >> Widget.prototype = new DynLayer() >> >> When this is done, the properties of the base DynLayer are *shared* with >> every Widget made with the constructor. >> >> Most of these shared properties are reassigned to unique ones when >> createElement is called on the Widget. However, the children array is not, >> and it gives the effect that all Widgets share the same children array. >> >> So I've posted a patch for DynLayer and DynDocument that assigns the >> this.children array only when you use addChild. DynLayer-based widgets >> won't have a children array until you add at least one child. >> >> I also made changes to removeChild, removeAllChildren, etc. that check for >> the existence of the child array before proceeding. >> >> This should ensure that the children array is a unique object for each >> widget, and not the common one in the Widget prototype. Then you can safely >> use WidgetX to simulate inheritance without the shared-properties problem. >> >> The only consideration is if you build a widget that manipulates the >> children array, you should test it it exists first (it's initially set to >> null until you use addChild). >> >> I've only tested it on a few IBS and GUI widgets, but it seems to work >> across the board. I've posted the patch for review. >> >> scottandrew >> >> >> >> >> >> >> ------ >> Scott Andrew LePera >> DHTML / Scripting / CGI and other neat stuff >> sc...@sc... >> http://www.scottandrew.com > > >_______________________________________________ >Dynapi-Dev mailing list >Dyn...@li... >http://lists.sourceforge.net/mailman/listinfo/dynapi-dev > |
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 > |
From: Pascal B. <pa...@dy...> - 2000-10-29 20:37:22
|
Ok, I'll update the widget tutorial part so that it uses this syntax for the widgets (using superClass) Pascal Bestebroer pa...@dy... http://www.dynamic-core.net -----Oorspronkelijk bericht----- Van: dyn...@li... [mailto:dyn...@li...]Namens Scott Andrew LePera Verzonden: zondag 29 oktober 2000 20:07 Aan: dyn...@li... Onderwerp: Re: [Dynapi-Dev] (no subject) 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 > _______________________________________________ Dynapi-Dev mailing list Dyn...@li... http://lists.sourceforge.net/mailman/listinfo/dynapi-dev |
From: Strolia-Davis C. C. M. M. <Chr...@wp...> - 2001-10-02 13:00:35
|
This translates to something like : The e-mail address you have written to no longer exists or is = incorrect, please make sure the address is correct, and if the problem = persists make contact with us at e-mail: <mailto:ar...@ar...> = ar...@ar... =20 This is the best I can tell, my spanish is pretty limited. =20 Later, =20 Chris Strolia-Davis =20 -----Original Message----- From: Dougal Campbell [ <mailto:do...@gu...> = mailto:do...@gu...] Sent: Monday, October 01, 2001 3:46 PM To: dyn...@li... Subject: RE: [Dynapi-Dev] (no subject) I don't speak Spanish, but best I can tell, this is a "this email address is invalid" message. Who here has authority to remove this address from the mailing list? On Mon, 1 Oct 2001, Pascal Bestebroer wrote: > OEH! I know! try english! > > Pascal Bestebroer > pa...@dy... > <http://www.dynamic-core.net> http://www.dynamic-core.net > > > -----Oorspronkelijk bericht----- > > Van: dyn...@li... > > [ <mailto:dyn...@li...> = mailto:dyn...@li...]Namens ar...@ar... > > Verzonden: maandag 1 oktober 2001 21:29 > > Aan: dyn...@li... > > Onderwerp: [Dynapi-Dev] (no subject) > > > > > > La direcci=F3n de correo a la que ha escrito no existe o es = incorrecta, > > por favor compruebe que la direcci=F3n es correcta, y si el > > problema persiste > > pongase en contacto con nosotros en el e-mail: ar...@ar... > > > > > > _______________________________________________ > > Dynapi-Dev mailing list > > Dyn...@li... > > <https://lists.sourceforge.net/lists/listinfo/dynapi-dev> = https://lists.sourceforge.net/lists/listinfo/dynapi-dev > > > _______________________________________________ > Dynapi-Dev mailing list > Dyn...@li... > <https://lists.sourceforge.net/lists/listinfo/dynapi-dev> = https://lists.sourceforge.net/lists/listinfo/dynapi-dev > -- Ernest MacDougal Campbell III, MCP+I, MCSE <do...@gu...> <http://dougal.gunters.org/> http://dougal.gunters.org/ = <http://spam.gunters.org/> http://spam.gunters.org/ Lumber Cartel Unit #1654 (tinlc): <http://come.to/the.lumber.cartel/> = http://come.to/the.lumber.cartel/ This message is guaranteed to be 100% eror frea! _______________________________________________ Dynapi-Dev mailing list Dyn...@li... <https://lists.sourceforge.net/lists/listinfo/dynapi-dev> = https://lists.sourceforge.net/lists/listinfo/dynapi-dev |
From: Quang N. <ye...@ho...> - 2001-12-06 18:32:45
|
It is really slow. Some of my last email tooks a few days to be sent. ----Original Message Follows---- From: "Doug Melvin" <do...@cr...> To: <dyn...@li...> Subject: [Dynapi-Dev] (no subject) Date: Thu, 6 Dec 2001 12:26:17 -0500 heloooo... is this thing on? _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp |
From: Robert R. <rai...@us...> - 2000-10-29 00:05:17
|
I added a hasChildren method to the dynlayer and dyndocument to make it easier to check for children, since there are two different states that the children array can have that mean there are no children. DynLayer.prototype.hasChildren=function() { return !this.children||!this.children.length?false:true } DynDocument.prototype.hasChildren=function() { return !this.children||!this.children.length?false:true } Later, Robert <rai...@us...> > Yes, a boolean could do the same trick. Maybe removeChild/deleteChild can > set it to true/false if the length becomes zero. > > My point is that when you define an object's prototype structure with > another object, as in WidgetX, all of the properties of that base DynLayer > instance are shared with each Widget. > > Widget.prototype=new DynLayer() <-- Widget.prototype is a new DynLayer > *instance* > > This is generally okay in DynAPI2 because the shared properties are > eventually overwritten with unique ones. > > For example, all WidgetX model widgets share the *same* css, elm and doc > object when first constructed. But when you add them to a parent object, > the assignElement method overwrites them with *unique* values. > > But children[] is never overwritten anywhere, so it remains a reference to > the children array of the shared base DynLayer instance. So we either have > to 1) always remember to assign it "manually" in our widget code, or 2) find > a better place in the DynLayer code to assign it to ensure it is unique. > > I'm not trying to undermine the WidgetX model, because it's an easy way to > achieve a sort of inheritance, but this issue needs to be addressed. Who > knows what kind of memory leaks this may cause in the long run: > > Widget1.prototype = new DynLayer(); > Widget2.prototype = new Widget1(); > Widget3.prototype = new Widget2(); etc. > > scottandrew > > > > -----Original Message----- > From: Robert Rainwater <rai...@us...> > To: Scott Andrew LePera <dyn...@li...> > Date: Saturday, October 28, 2000 2:13 PM > Subject: Re: [Dynapi-Dev] (no subject) |
From: Jordi 'I. M. <jmi...@or...> - 2000-10-30 09:14:47
|
I've been thinking about this for some tome now and our main problem here is having all our widgets to share the DynLayer functionalities without sharing any properties. We need some sort of initialization code such as: myWidget = function() { // Init code // Assign id this.id = ... // Widget stuff starts here } // Maybe not anymore myWidget.prototype However hard-coding it into all our widgets is a pain and when we need to change something then we have to edit all of your widgets and we force people to 'remember' whet has to be placed at the beggining of each constructor. I thing this can be solved by having this method (this is the idea, I haven't been able to code it) DynAPI.makeWidget = function(constructor) { var code = window[constructor].toString() // now we have the code var header = code.substring(0,code.indexOf("{")) var rest = code.substring(code.indexOf("{")) var newcode = header + have all the common init stuff in a String here + rest eval(constructor+" = "+newcode) // If needed attach prototying, assign variables, etc. } This way your widget code should be independent of the inheritance method adopted. This I presume, I haven't tested. Tell me what you think |
From: Robert R. <rra...@ya...> - 2000-10-30 18:10:45
|
I'm not quite sure I follow your DynAPI.makeWidget. Could you explain that in a little more detail. I don't understand what makeWidget is trying to do there. Robert -- Email: <mailto:rra...@ya...> PGP Key ID: 0x703D7F7C > I've been thinking about this for some tome now and our main problem here is > having all our widgets to share the DynLayer functionalities without sharing any > properties. We need some sort of initialization code such as: > > myWidget = function() { > // Init code > > // Assign id > this.id = ... > > // Widget stuff starts here > > } > > // Maybe not anymore > myWidget.prototype > > > However hard-coding it into all our widgets is a pain and when we need to change > something then we have to edit all of your widgets and we force people to > 'remember' whet has to be placed at the beggining of each constructor. I thing > this can be solved by having this method (this is the idea, I haven't been able > to code it) > > DynAPI.makeWidget = function(constructor) { > var code = window[constructor].toString() > // now we have the code > var header = code.substring(0,code.indexOf("{")) > var rest = code.substring(code.indexOf("{")) > var newcode = header + have all the common init stuff in a String here + rest > eval(constructor+" = "+newcode) > > // If needed attach prototying, assign variables, etc. > } > > > This way your widget code should be independent of the inheritance method > adopted. This I presume, I haven't tested. Tell me what you think > |
From: Jordi 'I. M. <jmi...@or...> - 2000-10-31 09:13:24
|
What is trying to do is, given that the toString method of a function return its source code, is to add lines just after "function() {" and before the source, and then eval the new function. So the function passed as parameter is rewriten. This way we can have clean widget constructors and automatically add all the initializations code that make a widget a widget. If this code is to be changed we don't have to bother editing th widget sources because that inheriting code is added by the API and not hard-coded into each constructor. The idea is turn method to string, split into to strings: until { and after }, insert our code between them and eval everything. Robert Rainwater wrote: > I'm not quite sure I follow your DynAPI.makeWidget. Could you explain > that in a little more detail. I don't understand what makeWidget is > trying to do there. > > Robert > > -- > Email: <mailto:rra...@ya...> > PGP Key ID: 0x703D7F7C > > > I've been thinking about this for some tome now and our main problem here is > > having all our widgets to share the DynLayer functionalities without sharing any > > properties. We need some sort of initialization code such as: > > > > myWidget = function() { > > // Init code > > > > // Assign id > > this.id = ... > > > > // Widget stuff starts here > > > > } > > > > // Maybe not anymore > > myWidget.prototype > > > > > > However hard-coding it into all our widgets is a pain and when we need to change > > something then we have to edit all of your widgets and we force people to > > 'remember' whet has to be placed at the beggining of each constructor. I thing > > this can be solved by having this method (this is the idea, I haven't been able > > to code it) > > > > DynAPI.makeWidget = function(constructor) { > > var code = window[constructor].toString() > > // now we have the code > > var header = code.substring(0,code.indexOf("{")) > > var rest = code.substring(code.indexOf("{")) > > var newcode = header + have all the common init stuff in a String here + rest > > eval(constructor+" = "+newcode) > > > > // If needed attach prototying, assign variables, etc. > > } > > > > > > This way your widget code should be independent of the inheritance method > > adopted. This I presume, I haven't tested. Tell me what you think > > > > _______________________________________________ > Dynapi-Dev mailing list > Dyn...@li... > http://lists.sourceforge.net/mailman/listinfo/dynapi-dev |
From: Scott A. L. <sc...@sc...> - 2000-10-31 17:02:37
|
I think what's being overlooked in your idea is that prototype methods won't be inherited. makeWidget creates a string of the contents of the *constructor*; but it doesn't include the prototype properties. It looks like makeWidget creates an entire new constructor. If you passed DynLayer to makeWidget it would return a completely new object identical to DynLayer constructor as your widget base, plus any modifications you made. Is this a good approach? scottandrew Jordi 'IlMaestro' Ministral wrote: > > What is trying to do is, given that the toString method of a function return its > source code, is to add lines just after "function() {" and before the source, and then > eval the new function. So the function passed as parameter is rewriten. > > This way we can have clean widget constructors and automatically add all the > initializations code that make a widget a widget. If this code is to be changed we > don't have to bother editing th widget sources because that inheriting code is added > by the API and not hard-coded into each constructor. > > The idea is turn method to string, split into to strings: until { and after }, insert > our code between them and eval everything. > > Robert Rainwater wrote: > > > I'm not quite sure I follow your DynAPI.makeWidget. Could you explain > > that in a little more detail. I don't understand what makeWidget is > > trying to do there. > > > > Robert > > > > -- > > Email: <mailto:rra...@ya...> > > PGP Key ID: 0x703D7F7C > > > > > I've been thinking about this for some tome now and our main problem here is > > > having all our widgets to share the DynLayer functionalities without sharing any > > > properties. We need some sort of initialization code such as: > > > > > > myWidget = function() { > > > // Init code > > > > > > // Assign id > > > this.id = ... > > > > > > // Widget stuff starts here > > > > > > } > > > > > > // Maybe not anymore > > > myWidget.prototype > > > > > > > > > However hard-coding it into all our widgets is a pain and when we need to change > > > something then we have to edit all of your widgets and we force people to > > > 'remember' whet has to be placed at the beggining of each constructor. I thing > > > this can be solved by having this method (this is the idea, I haven't been able > > > to code it) > > > > > > DynAPI.makeWidget = function(constructor) { > > > var code = window[constructor].toString() > > > // now we have the code > > > var header = code.substring(0,code.indexOf("{")) > > > var rest = code.substring(code.indexOf("{")) > > > var newcode = header + have all the common init stuff in a String here + rest > > > eval(constructor+" = "+newcode) > > > > > > // If needed attach prototying, assign variables, etc. > > > } > > > > > > > > > This way your widget code should be independent of the inheritance method > > > adopted. This I presume, I haven't tested. Tell me what you think > > > > > > > _______________________________________________ > > 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 |
From: Jordi 'I. M. <jmi...@or...> - 2000-10-31 18:26:16
|
Yes I know but makeDynLayer could also assign the prototype ... eval(method+".prototype = new DynLayer") .. .. Still speaking in theory Scott Andrew LePera wrote: > I think what's being overlooked in your idea is that prototype methods > won't be inherited. makeWidget creates a string of the contents of the > *constructor*; but it doesn't include the prototype properties. > > It looks like makeWidget creates an entire new constructor. If you > passed DynLayer to makeWidget it would return a completely new object > identical to DynLayer constructor as your widget base, plus any > modifications you made. Is this a good approach? > > scottandrew > > Jordi 'IlMaestro' Ministral wrote: > > > > What is trying to do is, given that the toString method of a function return its > > source code, is to add lines just after "function() {" and before the source, and then > > eval the new function. So the function passed as parameter is rewriten. > > > > This way we can have clean widget constructors and automatically add all the > > initializations code that make a widget a widget. If this code is to be changed we > > don't have to bother editing th widget sources because that inheriting code is added > > by the API and not hard-coded into each constructor. > > > > The idea is turn method to string, split into to strings: until { and after }, insert > > our code between them and eval everything. > > > > Robert Rainwater wrote: > > > > > I'm not quite sure I follow your DynAPI.makeWidget. Could you explain > > > that in a little more detail. I don't understand what makeWidget is > > > trying to do there. > > > > > > Robert > > > > > > -- > > > Email: <mailto:rra...@ya...> > > > PGP Key ID: 0x703D7F7C > > > > > > > I've been thinking about this for some tome now and our main problem here is > > > > having all our widgets to share the DynLayer functionalities without sharing any > > > > properties. We need some sort of initialization code such as: > > > > > > > > myWidget = function() { > > > > // Init code > > > > > > > > // Assign id > > > > this.id = ... > > > > > > > > // Widget stuff starts here > > > > > > > > } > > > > > > > > // Maybe not anymore > > > > myWidget.prototype > > > > > > > > > > > > However hard-coding it into all our widgets is a pain and when we need to change > > > > something then we have to edit all of your widgets and we force people to > > > > 'remember' whet has to be placed at the beggining of each constructor. I thing > > > > this can be solved by having this method (this is the idea, I haven't been able > > > > to code it) > > > > > > > > DynAPI.makeWidget = function(constructor) { > > > > var code = window[constructor].toString() > > > > // now we have the code > > > > var header = code.substring(0,code.indexOf("{")) > > > > var rest = code.substring(code.indexOf("{")) > > > > var newcode = header + have all the common init stuff in a String here + rest > > > > eval(constructor+" = "+newcode) > > > > > > > > // If needed attach prototying, assign variables, etc. > > > > } > > > > > > > > > > > > This way your widget code should be independent of the inheritance method > > > > adopted. This I presume, I haven't tested. Tell me what you think > > > > > > > > > > _______________________________________________ > > > 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 |
From: Pascal B. <pa...@dy...> - 2000-10-31 19:29:55
|
what exactly would be the standard constructor code? just the this.DynLayer.. (new widgets) and this.id='...' lines, right? not sure what other code you would want in there.. Pascal Bestebroer pa...@dy... http://www.dynamic-core.net -----Oorspronkelijk bericht----- Van: dyn...@li... [mailto:dyn...@li...]Namens Jordi 'IlMaestro' Ministral Verzonden: dinsdag 31 oktober 2000 19:25 Aan: dyn...@li... Onderwerp: Re: [Dynapi-Dev] Widgets (was [no subject]) Yes I know but makeDynLayer could also assign the prototype ... eval(method+".prototype = new DynLayer") .. .. Still speaking in theory Scott Andrew LePera wrote: > I think what's being overlooked in your idea is that prototype methods > won't be inherited. makeWidget creates a string of the contents of the > *constructor*; but it doesn't include the prototype properties. > > It looks like makeWidget creates an entire new constructor. If you > passed DynLayer to makeWidget it would return a completely new object > identical to DynLayer constructor as your widget base, plus any > modifications you made. Is this a good approach? > > scottandrew > > Jordi 'IlMaestro' Ministral wrote: > > > > What is trying to do is, given that the toString method of a function return its > > source code, is to add lines just after "function() {" and before the source, and then > > eval the new function. So the function passed as parameter is rewriten. > > > > This way we can have clean widget constructors and automatically add all the > > initializations code that make a widget a widget. If this code is to be changed we > > don't have to bother editing th widget sources because that inheriting code is added > > by the API and not hard-coded into each constructor. > > > > The idea is turn method to string, split into to strings: until { and after }, insert > > our code between them and eval everything. > > > > Robert Rainwater wrote: > > > > > I'm not quite sure I follow your DynAPI.makeWidget. Could you explain > > > that in a little more detail. I don't understand what makeWidget is > > > trying to do there. > > > > > > Robert > > > > > > -- > > > Email: <mailto:rra...@ya...> > > > PGP Key ID: 0x703D7F7C > > > > > > > I've been thinking about this for some tome now and our main problem here is > > > > having all our widgets to share the DynLayer functionalities without sharing any > > > > properties. We need some sort of initialization code such as: > > > > > > > > myWidget = function() { > > > > // Init code > > > > > > > > // Assign id > > > > this.id = ... > > > > > > > > // Widget stuff starts here > > > > > > > > } > > > > > > > > // Maybe not anymore > > > > myWidget.prototype > > > > > > > > > > > > However hard-coding it into all our widgets is a pain and when we need to change > > > > something then we have to edit all of your widgets and we force people to > > > > 'remember' whet has to be placed at the beggining of each constructor. I thing > > > > this can be solved by having this method (this is the idea, I haven't been able > > > > to code it) > > > > > > > > DynAPI.makeWidget = function(constructor) { > > > > var code = window[constructor].toString() > > > > // now we have the code > > > > var header = code.substring(0,code.indexOf("{")) > > > > var rest = code.substring(code.indexOf("{")) > > > > var newcode = header + have all the common init stuff in a String here + rest > > > > eval(constructor+" = "+newcode) > > > > > > > > // If needed attach prototying, assign variables, etc. > > > > } > > > > > > > > > > > > This way your widget code should be independent of the inheritance method > > > > adopted. This I presume, I haven't tested. Tell me what you think > > > > > > > > > > _______________________________________________ > > > 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 |