PDA

View Full Version : Simulate button click using code



ssdesign
2 Aug 2010, 11:03 PM
Hi,
I have a button in the top left corner of the screen an dtapping it creates a overlay near it.

The button looks like this:


var myBlackButton2 = new Ext.Button({
minWidth: '44',
cls: 'mybutton black',
text: '+',
id: "black2",
handler: tapMe
})

Now what I want to do is, on launching the app, this overlay should automatically trigger without the need to press the button.

So my question is, is there a way to simulate a button click using code?

Thanks

evant
2 Aug 2010, 11:16 PM
Why not just call the method?

ssdesign
2 Aug 2010, 11:45 PM
because the handler expects a button reference:


var tapMe = function(btn, event){
}

evant
3 Aug 2010, 12:26 AM
tapMe(myButton);