Thursday, December 24, 2009

Re: How to fire event

Firing a change event turns out being simple:

package simple.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;

class OurChangeEvent extends ChangeEvent {}

public class Simple implements EntryPoint {

public void onModuleLoad() {
TextBox textBox = new TextBox();
RootPanel.get().add(textBox);

textBox.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
Window.alert("got change event on textBox");
}
});
textBox.fireEvent(new OurChangeEvent());
}
}


On Dec 15, 5:42 am, HarryClaymore <dekadanced...@gmail.com> wrote:
> Hi. I wonder how could i fire an simple OnChangeEvent for Widget ?
> It implements interface HasChangeHandlers.
> I just want tofireEventto mark widget as "changed"
>
> exapmple:
>
> selectAllButton = DasUtils.mkButton( GenericStrings.SELECT_ALL.toString
> (), new Runnable() {
>                         public void run() {
>                                 for ( int i = 0; i < lbRef[0].getItemCount(); i++ ) {
>                                         lbRef[0].setItemSelected( i, true );
>                                 }
> //                              SearchFieldAttrIn.this.fireEvent(  ); i dont know what to do
> here.
> //                              SearchFieldAttrIn.this.onBrowserEvent( new ChangeEvent() );
>                         }
>                 } );
>
> Thanks !

--

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate