Prevent Default TextSelection / Highlighting

165 views
Skip to first unread message

melody

unread,
Jan 29, 2008, 11:09:50 AM1/29/08
to Google Web Toolkit
What is the best way to prevent panels/widgets etc from executing the
default browser text selection when you try to use SHIFT + CLICK.
I have a list control created from a FlexTable and I wish to be able
to use shift click to do multiple row selection. The problem is that
as soon as I start moving my mouse after pressing the SHIFT-KEY down,
the browser starts highlight everythig in dark blue.

I have used the following JSNI code to disable text selection.

<code>
public static native void disableTextSelection(Element element) /*-{
element.onselectstart = function() {
return false;
}
element = null;
}-*/;
</code>


This works just fine in IE but does not work in firefox. What is the
most appropriate browser independent method to stop default browser
behavior as relates to text selection.


Thanks,

Melody

Peter Blazejewicz

unread,
Feb 1, 2008, 6:56:06 PM2/1/08
to Google Web Toolkit
Reply all
Reply to author
Forward
0 new messages