Hi Ewald,

I guess it selects the whole of the html once you are out of it, as
you are only preventing default on the html widget, once outside the
html widget normal browser functionality is back in play.

One way you could consider solving your issue is to have the elements
you want to link together held within another panel and have the
default events on that outer panel prevented; or you could look at
previewing the event instead (so you trap the event before anything in
your application gets to use it ) - this is what the DialogBox class
in GWT does, so you could look at that to see how to use
PreviewNativeEvent.

(alternatively, maybe the gwt-diagrams library gives the functionality
similar to what you want? (http://kolos.math.uni.lodz.pl/~balon/gwt-
diagrams-demo/pl.balon.gwt.diagramsexample.GwtDiagramsExample/
GwtDiagramsExample.html))

//Adam

On 23 Juli, 10:06, Ewald Pankratz <ewald.pankr...@gmail.com> wrote:
> Hi Adam
> I did something and it works partly. The text will not be selected as
> before but when I press the mouse and go out of the widget the full
> text will be selected again.
> Any idea?
>
> Regards,
> Ewald
>
> package g26v01.client;
>
> import com.google.gwt.dom.client.Element;
> import com.google.gwt.event.dom.client.MouseDownEvent;
> import com.google.gwt.event.dom.client.MouseDownHandler;
> import com.google.gwt.event.dom.client.MouseMoveEvent;
> import com.google.gwt.event.dom.client.MouseMoveHandler;
> import com.google.gwt.event.dom.client.MouseOutEvent;
> import com.google.gwt.event.dom.client.MouseOutHandler;
> import com.google.gwt.user.client.ui.HTML;
>
> public class MyHTML extends HTML {
>
>         public MyHTML() {
>                 super();
>                 // TODO Auto-generated constructor stub
>         }
>
>         public MyHTML(Element element) {
>                 super(element);
>                 // TODO Auto-generated constructor stub
>         }
>
>         public MyHTML(String html, boolean wordWrap) {
>                 super(html, wordWrap);
>                 // TODO Auto-generated constructor stub
>         }
>
>         public MyHTML(String html) {
>
>                 super(html);
>                 // TODO Auto-generated constructor stub
>
>                 MyMouseDownHandler ha = new MyMouseDownHandler();
>                 this.addMouseDownHandler(ha);
>
>                 MyMouseMoveHandler ha2 = new MyMouseMoveHandler();
>                 this.addMouseMoveHandler(ha2);
>
>                 MyMouseOutHandler ha3 = new MyMouseOutHandler();
>                 this.addMouseOutHandler(ha3);
>
>         }
>
>         class MyMouseOutHandler implements MouseOutHandler {
>                 @Override
>                 public void onMouseOut(MouseOutEvent event) {
>                         // TODO Auto-generated method stub
>                         event.preventDefault();
>                 }
>         }
>
>         class MyMouseDownHandler implements MouseDownHandler {
>                 @Override
>                 public void onMouseDown(MouseDownEvent event) {
>                         // TODO Auto-generated method stub
>                         event.preventDefault();
>                 }
>         }
>
>         class MyMouseMoveHandler  implements MouseMoveHandler {
>                 @Override
>                 public void onMouseMove(MouseMoveEvent event) {
>                         // TODO Auto-generated method stub
>                         event.preventDefault();
>                 }
>         }
>
> }
>
> On 23 Jul., 07:56, Adam T <adam.t...@gmail.com> wrote:
>
> > Hi Ewald,
>
> > Sounds like you want to prevent the default event handling of the
> > browser.  You'll need to add some event handlers to your HTML widget
> > and the call the preventDefault() method in them.  For example:
>
> >                 HTML widget = new HTML();
> >                 widget.addMouseDownHandler(new MouseDownHandler(){
> >                         public void onMouseDown(MouseDownEvent event) {
> >                                 event.preventDefault();
> >                         }
> >                 });
>
> > (you might get away with just handling the mouse down event, you might
> > have to also handle mouse move - I can't remember without building a
> > full example myself, but you get the point, hopefully).
>
> > Regards,
>
> > Adam
>
> > On 22 Juli, 22:37, Ewald Pankratz <ewald.pankr...@gmail.com> wrote:
>
> > > Hi
> > > When I create a widget e.g. a HTML widget and go with the mouse over
> > > the widget and press the left mouse button and move the mouse
> > > somewhere else the widget or part of the widget will be selected. How
> > > can I get rid of this selection. I don't want any selection instead I
> > > want to draw a line from the widget to my current mouse pointer. Any
> > > ideas how to do that? I am a newbie.
> > > Thanks!!!
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to