|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Accessing callstack or similarHi All,
I'm trying to do something but keep running into a problem :( I am working on a solution to easily create complicated window layouts in a large application. The idea is to have a static member of each window called "design" which describes the layout of each window. I can do this OK, the problem is inheritance. We have a base window that we derive all of our windows from. I would like to be able to call custom.io.FormReader.read() in the base class I want to be able to read the static properties for that class and for the descendants aswell. I can acccess our base class and the superclass returns qx.legacy.ui.window.Window but i won't to be able to go the other way and return the descendant. Hope that makes sence, it's all very confusing! Thanks, Matthew ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@... https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel |
|
|
Re: Accessing callstack or similar> I'm trying to do something but keep running into a problem :(
> I am working on a solution to easily create complicated window > layouts in a large application. The idea is to have a static member > of each window called "design" which describes the layout of each > window. I can do this OK, the problem is inheritance. We have a > base window that we derive all of our windows from. I would like to > be able to call custom.io.FormReader.read() in the base class I > want to be able to read the static properties for that class and > for the descendants aswell. > > I can acccess our base class and the superclass returns > qx.legacy.ui.window.Window but i won't to be able to go the other > way and return the descendant. > > Hope that makes sence, it's all very confusing! I think you will have to pass the instance class through to the base function as the links are just one way - from derived class to base class. A base class can have many derived classes, in different trees of classes. Therefore it would be impossible to know which leaf to go for if you don't give some help to the base function. Something like: In derived class function: MyBaseClass.getDesign(this.self) this.self is set up as the current class. It has a superclass entry which refers to the parent class. So in the getDesign function, implemented in your base class, you can just walk the classes gathering up the designs: getDesign : function(clazz) { lDesign = [] while (clazz) { lDesign.push[clazz.design]; clazz = clazz.superclass; } return lDesign; } You will probably have to play with the details in a debugger to see exactly what works. I've just read through qx.Class to work out how it's done. Hugh ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@... https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel |
|
|
Re: Accessing callstack or similarThanks,
I guess only having the function called from the base class isn't possible then :( I can get the same behaviour by adding custom.io.FormReader.read() to each constructor for a class that has design data but it is just one more thing to remember. Ah well! Thanks! Matthew Hugh Gibson wrote: >> I'm trying to do something but keep running into a problem :( >> I am working on a solution to easily create complicated window >> layouts in a large application. The idea is to have a static member >> of each window called "design" which describes the layout of each >> window. I can do this OK, the problem is inheritance. We have a >> base window that we derive all of our windows from. I would like to >> be able to call custom.io.FormReader.read() in the base class I >> want to be able to read the static properties for that class and >> for the descendants aswell. >> >> I can acccess our base class and the superclass returns >> qx.legacy.ui.window.Window but i won't to be able to go the other >> way and return the descendant. >> >> Hope that makes sence, it's all very confusing! > > > Something like: > > In derived class function: > > MyBaseClass.getDesign(this.self) > > this.self is set up as the current class. It has a superclass entry which > refers to the parent class. So in the getDesign function, implemented in > your base class, you can just walk the classes gathering up the designs: > > getDesign : function(clazz) > { > lDesign = [] > while (clazz) > { > lDesign.push[clazz.design]; > clazz = clazz.superclass; > } > return lDesign; > } > > You will probably have to play with the details in a debugger to see > exactly what works. I've just read through qx.Class to work out how it's > done. > > Hugh > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@... https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel |
| Free Forum Powered by Nabble | Forum Help |