dh_harshal
04-15-2009, 10:24 PM
Hi...
I have written a class which extends 'window'.
In that class I have a method which creates another instance of this class.
Now i want to assign, calling instance as parent as called instance as child.
Or simply maintain parent-child relationship across these instances.
How can I maintain parent(or its id) in the scope of called(newly created) instance of this class? I want to position these instances according to position of their parent. If position of parent changes, child should also move.
Code snippet is as follows -
<canvas>
<script>
var c = new lz.myclass(canvas, {name:......});
</script>
<class name="myclass" extends="window" height=....>
<attribute ...../>
.....
.....
<view resource="button.png" onclick=''this.parent.addNew()"/>
.....
<method name="addnew">
var c = new lz.myclass(canvas, {title:.....});
</method>
</class>
</canvas>
Now, my instances of this class should be positioned according to their parent(instance on which this new instance is created) position.
Also, I want to maintain certain space between 2 any two instances, so layout help is also needed.
Thanks in advance !!
I have written a class which extends 'window'.
In that class I have a method which creates another instance of this class.
Now i want to assign, calling instance as parent as called instance as child.
Or simply maintain parent-child relationship across these instances.
How can I maintain parent(or its id) in the scope of called(newly created) instance of this class? I want to position these instances according to position of their parent. If position of parent changes, child should also move.
Code snippet is as follows -
<canvas>
<script>
var c = new lz.myclass(canvas, {name:......});
</script>
<class name="myclass" extends="window" height=....>
<attribute ...../>
.....
.....
<view resource="button.png" onclick=''this.parent.addNew()"/>
.....
<method name="addnew">
var c = new lz.myclass(canvas, {title:.....});
</method>
</class>
</canvas>
Now, my instances of this class should be positioned according to their parent(instance on which this new instance is created) position.
Also, I want to maintain certain space between 2 any two instances, so layout help is also needed.
Thanks in advance !!