Charan,

Most web developers don't seem to bother disabling general text
selection behavior in the browser, although admittedly it can appear
to be a nuisance at times.

GWT event handling (including previewing) isn't really designed for
unconstrained inclusion/exclusion use, as you are finding out.

Less elegant, but maybe you should concentrate on subclassing a subset
of the stuff on your page where you *don't* want to allow text
selection, handling those events in onBrowserEvent and avoiding using
the global previewer.  Although this is more coding (and therefore
less elegant) I think it leaves you more in control.  Once you get
event previewers fighting over correct behavior, I consider the design
to have failed.

Walden

On Sep 30, 12:59 am, Charan <[EMAIL PROTECTED]> wrote:
> I have disabled the default mouseEvents of browser by using the
> following code
>
> DOM.addEventPreview(new EventPreview()
>                 {
>                         public boolean onEventPreview(Event event)
>                         {
>                                 switch (DOM.eventGetType(event))
>                                 {
>                                 case Event.ONMOUSEDOWN:
>                                 case Event.ONMOUSEMOVE:
>                                 case Event.ONMOUSEUP:
>                                         DOM.eventPreventDefault(event);
>                                 }
>                                 return true;
>                         }
>                 });
>
> I have a several widgets in a FlexTable, one of widget is HTML widget
> (in ScrollPanel) which displays static html data in it.
> Now i need to enable text selection only on this HTML widget not all
> widgets on browser.
>
> i tried some ways which are enabling on the whole browser widgets.
> This code enables for all browser
> DOM.addEventPreview(new EventPreview()
>                 {
>                         public boolean onEventPreview(Event event)
>                         {
>                                 switch (DOM.eventGetType(event))
>                                 {
>                                         case Event.ONMOUSEDOWN:
>                                         case Event.ONMOUSEMOVE:
>                                         case Event.ONMOUSEUP:
>                                                 
> //DOM.eventCancelBubble(event, true);
>                                                 
> //DOM.eventGetToElement(event);
>                                                 
> //disableTextSelect(getBodyElement(), false);
>                                                 
> //DOM.setElementProperty(getBodyElement(), "onselectstart",
> "null");
>                                 }
>
>                                 return true;
>                         }
>                 });
>
> My requirement is to enable only for HTML widget.
>
> Thanks in advance
> Regards,
> S.charan Kumar
--~--~---------~--~----~------------~-------~--~----~
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