Re: Doubleclick event handling

2009-06-04 Thread Liv

Don't know, if it's the correct way, but for me (and extending
ListBox) this was the only thing I had to do to make DoubleClick-
handling work:

...extends ListBox implements HasDoubleClickHandlers...

public HandlerRegistration addDoubleClickHandler(DoubleClickHandler
handler) {
 return addDomHandler(handler, DoubleClickEvent.getType());
}


as far as I understood HandlerManager is already an instance in
Widget, so you don't need to create your own, when you extend an
existing widget.


On 4 Jun., 08:00, nina  wrote:
> Could I please get some clarification on how to use the double click
> event handling? The classes are there 
> (e.g.http://google-web-toolkit.googlecode.com/svn/javadoc/1.6/com/google/g...)
> but don't seem to be implemented anywhere.
>
> I would like to add double click handling to an Image, could someone
> please give me some example snippet of code on how to do this? I've
> tried simple things like extending Image and implementing
> HasDoubleClickHandlers, e.g.
>
> private class CommandButton extends Image implements
> DoubleClickHandler, HasDoubleClickHandlers {
>
>                 private HandlerManager clickHandlers = new 
> HandlerManager(this);
>
>                 public CommandButton(){
>                         super("images/favicon-2.png");
>                         addDoubleClickHandler(this);
>                 }
>
>                 @Override
>                 public void onDoubleClick(DoubleClickEvent event) {
>                         Log.debug("doubleclicked command button");
>                 }
>
>                 @Override
>                 public HandlerRegistration 
> addDoubleClickHandler(DoubleClickHandler
> handler) {
>                         return 
> clickHandlers.addHandler(DoubleClickEvent.getType(),
> handler);
>                 }
>
>                 @Override
>                 public void fireEvent(GwtEvent event){
>                         handlers.fireEvent(event);
>                 }
>         }
>
> but of course this doesn't handle double click events.
>
> 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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Doubleclick event handling

2009-06-03 Thread nina

Could I please get some clarification on how to use the double click
event handling? The classes are there (e.g.
http://google-web-toolkit.googlecode.com/svn/javadoc/1.6/com/google/gwt/event/dom/client/HasDoubleClickHandlers.html)
but don't seem to be implemented anywhere.

I would like to add double click handling to an Image, could someone
please give me some example snippet of code on how to do this? I've
tried simple things like extending Image and implementing
HasDoubleClickHandlers, e.g.

private class CommandButton extends Image implements
DoubleClickHandler, HasDoubleClickHandlers {

private HandlerManager clickHandlers = new HandlerManager(this);

public CommandButton(){
super("images/favicon-2.png");
addDoubleClickHandler(this);
}

@Override
public void onDoubleClick(DoubleClickEvent event) {
Log.debug("doubleclicked command button");
}

@Override
public HandlerRegistration 
addDoubleClickHandler(DoubleClickHandler
handler) {
return 
clickHandlers.addHandler(DoubleClickEvent.getType(),
handler);
}

@Override
public void fireEvent(GwtEvent event){
handlers.fireEvent(event);
}
}

but of course this doesn't handle double click events.

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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---