On Dec 15, 2:42 pm, HarryClaymore <[email protected]> wrote:
> Hi. I wonder how could i fire an simple OnChangeEvent for Widget ?
> It implements interface HasChangeHandlers.
> I just want to fireEvent to mark widget as "changed"

ChangeEvent is a DomEvent, which is mostly aimed at making onchange=
available in GWT. For new widgets, moreover composites, you should use
"logical" events, which are lighter-weight; either use one from
com.google.gwt.event.logical.client or create one (that's not
difficult, read the code the ones in the "logical" package, you only
need an "XxxHandler extends EventHandler" and "XxxEvent extends
GwtEvent<XxxHandler>", and optionally an HasXxxHandlers if you intend
to reuse your event in many places and/or don't want to reference the
widget class directly in your code, for instance if you follow the
same MVP rules as Ray Ryan in his Google I/O '09 talk)

Firing a ChangeEvent programmatically is possible though:

> 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 );
>                                 }

DomEvent.fireNativeEvent(Document.get().createChangeEvent(),
SearchFieldAttrIn.this);

--

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