Tuesday, September 14, 2010

Re: clearing or preventing double-click selection

This will disable text selection altogether:

protected native static void disableTextSelectInternal(Element e,
boolean disable)
/*-{
if (disable) {
e.ondrag = function () { return false; };
e.onselectstart = function () { return false; };
e.style.MozUserSelect="none"
} else {
e.ondrag = null;
e.onselectstart = null;
e.style.MozUserSelect="text"
}
}-*/;

/dmc
http://turbomanage.wordpress.com

On Sep 12, 3:29 pm, decitrig <rws...@gmail.com> wrote:
> I'm working on an application that responds to double clicks on text
> labels, and I'd like to either disable double-click text selection or
> clear it from within the event handler. I tried $doc.selection.clear()
> in a native method, but apparently $doc.selection is "not an object" -
> it may be that the selection isn't occurring until after the double-
> click handler is getting called. I did try stopPropagation and
> preventDefault, neither helped.
>
> Any pointers?
>
> --
> decitrig

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment