-
16 Feb 2011 5:54 AM #1
How can I do to fire a button click event?
How can I do to fire a button click event?
Hi everyone!!!
I'm trying to fire a button click event, but I'm afraid to do something bad, because my listener never catches the event (I never see the alert
).
This is what I wrote:
Could you please give a clue to me?Code:final Button myButton= new Button(); myButton.setSize("90px", "45px"); myButton.setText("PRESS ME"); myButton.addSelectionListener(new SelectionListener<ButtonEvent>() { public void componentSelected(ButtonEvent ce) { } public void handleEvent(ButtonEvent e) { MessageBox.alert("", "HELLO", null); } }); EventType et = new EventType(Event.ONCLICK); myButton.fireEvent(et);
Thanks a lot!!!
Regards,Luca
-
17 Feb 2011 7:26 AM #2
-
17 Feb 2011 8:10 AM #3
-
18 Feb 2011 2:29 AM #4
You never ever want to do this. Its one of the worst practices you can do. You should create a method that the listener calls and you can also call manually.
-
18 Feb 2011 4:55 AM #5
Yes I've already done so, but I was curious how dispatching events
-
29 Jun 2012 4:38 AM #6
-
29 Jun 2012 4:49 AM #7
-
29 Jun 2012 4:54 AM #8
-
1 Nov 2012 10:49 AM #9
If you only call the button's handler then you miss the styling update that an actual button press would provide.
Similar Threads
-
fire click event on an element
By flamant in forum Ext 3.x: Help & DiscussionReplies: 5Last Post: 7 Nov 2010, 8:04 AM -
Ext.Button fire more than once when continually click
By yuncong8 in forum Ext 2.x: Help & DiscussionReplies: 6Last Post: 28 Nov 2008, 1:37 AM -
Cannot fire click event on Ext.Button
By fermo111 in forum Ext 2.x: Help & DiscussionReplies: 9Last Post: 11 Dec 2007, 6:24 PM -
how to fire button click
By runnersixty in forum Ext 2.x: Help & DiscussionReplies: 2Last Post: 3 Nov 2007, 7:59 AM -
addKeyListener to fire click event on button
By dotnetCarpenter in forum Ext 1.x: Help & DiscussionReplies: 1Last Post: 16 May 2007, 10:14 AM


Reply With Quote
this "only premium can see that" is a new "feature".