John,
There is a flexibility given at the document object level for us to
create custom events using which we can fire the same on any source
object. The API looks as follows
        NativeEvent ne = Document.get ().create<EventType>Event ();
        <EventType>Event.fireNativeEvent (ne, this);
As you wanted to fire change event on the textbox, you will have to
create change native event and have it fired on the textbox. For e.g.
        NativeEvent ne = Document.get ().createChangeEvent ();
        ChangeEvent.fireNativeEvent (ne, textBox);

On Dec 24, 10:38 pm, John Gilbrough <[email protected]> wrote:
> 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 <[email protected]> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.


Reply via email to