Results 1 to 4 of 4

Thread: Simulate button click using code

  1. #1
    Sencha User
    Join Date
    Jun 2010
    Posts
    132

    Default Simulate button click using code

    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:

    Code:
    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

  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258

    Default

    Why not just call the method?
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  3. #3
    Sencha User
    Join Date
    Jun 2010
    Posts
    132

    Default

    because the handler expects a button reference:

    Code:
    var tapMe = function(btn, event){
    }

  4. #4
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258

    Default

    Code:
    tapMe(myButton);
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

Similar Threads

  1. Simulate TreeNode click in TreePanel programmatically?
    By wgpubs in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 9 Sep 2014, 6:25 AM
  2. Simulate click on DOM element
    By dvuja2 in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 11 Nov 2009, 5:02 AM
  3. simulate click on tab
    By joefox in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 26 Jun 2009, 12:22 PM
  4. simulate button click of FileUploadField?
    By balin in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 26 Mar 2009, 8:05 AM
  5. simulate an event button click
    By zeta28 in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 4 Jan 2008, 10:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •