an example would be this
@Override
protected void onAttach() {
super.onAttach();
setStyleName(getElement(), "my-no-selection", true);
CUtil.disableTextSelectInternal(getElement(), true);
}
@Override
protected void onDetach() {
super.onDetach();
setStyleName(getElement(), "my-no-selection", false);
CUtil.disableTextSelectInternal(getElement(), false);
}
Then add
final public static native void disableTextSelectInternal(Element e,
boolean disable)/*-{
if (disable) {
e.ondrag = function() {
return false;
};
e.onselectstart = function() {
return false;
};
} else {
e.ondrag = null;
e.onselectstart = null;
}
}-*/;
to your util class of your project
any ui widget or panel should allow you to override the attach and detach
methods, which is where you should stick these methods. you can also call
them dynamically if you wish to enable it at a later point.
On Wednesday, February 20, 2008 10:10:50 AM UTC-5, melody wrote:
>
> Darrel
>
> Can you please show an example usage, particularly what the CSS (style
> setStyleName(elem, "my-no-selection", disable)) my_no_selection
> entails and how it contributes to the whole no selection thing.
>
> Why do you need both GWT style setStyleName and then the native JSNI
> code to for it to work?
>
> Does it work in all browsers.
>
> I use a similar function as shown in this thread
>
> http://groups.google.com/group/Google-Web-Toolkit/browse_frm/thread/baecd1619301b09e/cf74f1495dbb47ce?lnk=gst&q=melody#cf74f1495dbb47ce
>
>
> which works just fine in IE but does not quite work in FireFox (have
> not tried Opera and Safari).
>
> Thanks,
>
> Melody
>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-web-toolkit/-/w9HXuNJ3I5sJ.
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.