Hi Rahul,

A couple of options:

Option 1:
Extend TextBox and use the native DoubleClickEvent as follows:

import com.google.gwt.event.dom.client.DoubleClickEvent;
import com.google.gwt.event.dom.client.DoubleClickHandler;
import com.google.gwt.event.dom.client.HasDoubleClickHandlers;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.ui.TextBox;

public class CustomTextBox extends TextBox implements
HasDoubleClickHandlers {

    public CustomTextBox() {
        super();
    }

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

To to test your requirement:

        final CustomTextBox textBox = new CustomTextBox();
        textBox.addDoubleClickHandler(new DoubleClickHandler() {

            @Override
            public void onDoubleClick(final DoubleClickEvent event) {
                textBox.setText("");
            }
        });


Option 2:
Increment a clickCount variable inside a ClickHandler. Start a Timer
on the first click which resets the clickCount after a certain
timeout. If the click count is >= 2 on any click then you have a
double click. Obviously this is not as good as Option 1 since you have
to use your own double click timeout which may be different to the
user's operating system setting.

Hope this helps.

Cheers,
Paul.

On Jul 26, 2:39 pm, Hussain Cutpiecewala <[email protected]>
wrote:
> HI Rahul..
> This is hussain.
> can you tell me whether you are looking for solution in web development or
> desktop development?
>
> On Fri, Jul 24, 2009 at 8:28 PM, Rahul <[email protected]> wrote:
>
> > Hi
> > i would like the functionality that when a user double clicks on the
> > textbox, the existing text on the textbox deletes itself
>
> > how should i proceed to do that so ?

--~--~---------~--~----~------------~-------~--~----~
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