Try this eg:
*public* *class* Home *extends* AbsolutePanel *implements* EntryPoint {
*public* *void* onModuleLoad() {
init();
}
*private* *void* init() {
RootPanel.*get*().add(*this*);
setHeight(Window.*getClientHeight*()+"px");
DOM.*setStyleAttribute*(getElement(), "background", "#ADDFFF");
Label lbl = *new* Label();
DOM.*setStyleAttribute*(lbl.getElement(), "color", "blue");
DOM.*setStyleAttribute*(lbl.getElement(), "font-weight", "bold"
);
DOM.*setStyleAttribute*(lbl.getElement(), "font-size", "16px");
lbl.setText("Right Click OR Double Click anywhere");
*this*.add(lbl);
sinkEvents(Event.*ONMOUSEDOWN*);
sinkEvents(Event.*ONDBLCLICK*);
}
*public* *void* onBrowserEvent(Event event) {
*super*.onBrowserEvent(event);
*switch* (DOM.*eventGetType*(event)) {
*case* Event.*ONMOUSEDOWN*:
*if*(DOM.*eventGetButton*(event) == Event.*BUTTON_RIGHT*)
Window.*alert*("You RIGHT CLICKED");
*break*;
*case* Event.*ONDBLCLICK*:
Window.*alert*("You DOUBLE CLICKED");
*break*;
}
}
}
- Litty
On Wed, Feb 4, 2009 at 2:07 PM, arun <[email protected]> wrote:
>
>
> i tried this..but event.getTypeInt() is not capturing the doubleclick
> event.is there any other way to capture double click?
>
>
>
> On Feb 4, 1:22 pm, Jason Morris <[email protected]> wrote:
> > It doesn't matter that they have the same value, they are returned from 2
> different fields in Event:
> >
> > if(event.getButton() == Event.BUTTON_RIGHT)
> >
> > if(event.getTypeInt() == Event.ONDBLCLICK)
> >
> > Hope that helps
> > //J
> >
> >
> >
> > arun wrote:
> > > no...actually i m mentioning about event.BUTTON_RIGHT and
> > > event.ONDBLCLICK
> > > Both having same value i.e.2 and i m using both in my application.
> > > On Feb 4, 12:38 pm, Litty Preeth <[email protected]> wrote:
> > >> No the constants for both are different... Event.ONCLICK and Event.
> > >> ONDBLCLICK
> >
> > >> On Wed, Feb 4, 2009 at 12:44 PM, arun <[email protected]>
> wrote:
> >
> > >>> i have a requirement to catch the double click event. i am catching
> > >>> right click too. but both event are getting mixed up. only right
> click
> > >>> is working fine. Thsi may be because both event have same constant
> > >>> field values. is ther eany way to distinguish these two?
> > >>> Any help would be appreciated.- Hide quoted text -
> > >> - Show quoted text -- Hide quoted text -
> >
> > - Show quoted text -
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---