PDA

View Full Version : Regarding Doubt


Anusha
03-24-2004, 02:33 AM
Hi all

I've given a code here I'm trying to bring a button dynamically in onclick event of another button..but i'm not able to do it..it's showing some compilation errors..i.e button cannot be created inside methods..so how to carry on this work???.any solutions from anybody...

<canvas height="100">
<button name="My button" text="RootButton" onclick="this.popupbutton()">
<method name="popupbutton">
<button name="b1" text="Correct">
</button>
</method>
</button>
</canvas>


--Anush

antun
03-24-2004, 08:55 AM
Everything inside of a <method> is supposed to be JavaScript. To dynamically create a view in script, you have to use its constructor function. To create a button, it would be something like:


<canvas debug="true">
<button name="My button" text="RootButton" onclick="this.popupbutton()">
<method name="popupbutton">
var foo = new button ( canvas, {name:'popupbutton', y:25} );
</method>
</button>
</canvas>


You can also apply and remove states that contain your new button.

-Antun