Home » Eclipse Projects » GEF » problem wrapping a FigureCanvas with a DragSource
problem wrapping a FigureCanvas with a DragSource [message #82822] |
Mon, 09 June 2003 22:00 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: aroberts.bowstreet.com
I wrapped a FigureCanvas with an org.eclipse.swt.dnd.DragSource, and the
drag and drop part works OK. However, after dragging from the FigureCanvas,
and dropping on a DropTarget, the FigureCanvas stops getting subsequent
mouseMotion events like mouseEntered - that is, until the user clicks on the
FigureCanvas again. At that point, the FigureCanvas starts getting these
events.
Any ideas what I might be doing wrong?
If I remove the DragSource code, then the FigureCanvas gets mouseMotion
events as I would expect.
Andy Roberts
|
|
|
Re: problem wrapping a FigureCanvas with a DragSource [message #82837 is a reply to message #82822] |
Mon, 09 June 2003 23:25 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: none.us.ibm.com
SWT sends a mouse down event and not a mouse up. See SWTEventDispatcher,
which dispatches these events. You need to tell the dispatcher that a
native drag has started, in which case the mouse up needs to be faked, or
perhaps implied, but not actually sent to any figures. If you have figures
waiting for a mouse up, you'll have issues. You would then need a way to
tell the figure that a native drag has started, so it wouldn't rely on
mouseUp event.
"Andy Roberts" <aroberts@bowstreet.com> wrote in message
news:bc303p$4ip$1@rogue.oti.com...
> I wrapped a FigureCanvas with an org.eclipse.swt.dnd.DragSource, and the
> drag and drop part works OK. However, after dragging from the
FigureCanvas,
> and dropping on a DropTarget, the FigureCanvas stops getting subsequent
> mouseMotion events like mouseEntered - that is, until the user clicks on
the
> FigureCanvas again. At that point, the FigureCanvas starts getting these
> events.
>
> Any ideas what I might be doing wrong?
>
> If I remove the DragSource code, then the FigureCanvas gets mouseMotion
> events as I would expect.
>
> Andy Roberts
>
>
|
|
|
Re: problem wrapping a FigureCanvas with a DragSource [message #82982 is a reply to message #82837] |
Tue, 10 June 2003 14:29 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: aroberts.bowstreet.com
Hi Randy;
Trying to understand what's going here. Stepping through the code, when I
click on a draw2d Figure in the FigureCanvas, the LWS is responding to the
mouseDown and invokes the SWTEventDispatcher to do a dispatchMousePressed on
the draw2D figure inside the figureCanvas. This trickles down to a button
model. But then, back at the LWS, the swt DragSource kicks in and does a
bunch of drag start stuff. At the end of the day, the figureCanvas and the
figures inside it all stop receiving mouse motion events.
You indicated in your message that SWT does not send a mouse up. I can see
this, but I don't follow how this chain of events causes the figures in the
figureCanvas to stop getting mouse events after the drag - at least until
the user clicks on the figureCanvas again.
It looks like the DragSource is responsible for creating this disconnect
between the SWT events and the figures receiving these events. How would I
correct this? In general, I'm looking for advice on how to use
swt.DragSource and swt.DropTarget with a FigureCanvas containing figures.
Thanks;
Andy Roberts
"Randy Hudson" <none@us.ibm.com> wrote in message
news:bc351e$7dr$1@rogue.oti.com...
> SWT sends a mouse down event and not a mouse up. See SWTEventDispatcher,
> which dispatches these events. You need to tell the dispatcher that a
> native drag has started, in which case the mouse up needs to be faked, or
> perhaps implied, but not actually sent to any figures. If you have
figures
> waiting for a mouse up, you'll have issues. You would then need a way to
> tell the figure that a native drag has started, so it wouldn't rely on
> mouseUp event.
>
> "Andy Roberts" <aroberts@bowstreet.com> wrote in message
> news:bc303p$4ip$1@rogue.oti.com...
> > I wrapped a FigureCanvas with an org.eclipse.swt.dnd.DragSource, and the
> > drag and drop part works OK. However, after dragging from the
> FigureCanvas,
> > and dropping on a DropTarget, the FigureCanvas stops getting subsequent
> > mouseMotion events like mouseEntered - that is, until the user clicks on
> the
> > FigureCanvas again. At that point, the FigureCanvas starts getting
these
> > events.
> >
> > Any ideas what I might be doing wrong?
> >
> > If I remove the DragSource code, then the FigureCanvas gets mouseMotion
> > events as I would expect.
> >
> > Andy Roberts
> >
> >
>
>
|
|
|
Re: problem wrapping a FigureCanvas with a DragSource [message #82997 is a reply to message #82982] |
Tue, 10 June 2003 15:48 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: none.us.ibm.com
See setCaptured and the captured flag in SWTEventDispatcher.
This is why you need to fake the mouseup, or send some other event to reset
the captured flag.
"Andy Roberts" <aroberts@bowstreet.com> wrote in message
news:bc4q2v$jgr$1@rogue.oti.com...
> Hi Randy;
>
> Trying to understand what's going here. Stepping through the code, when I
> click on a draw2d Figure in the FigureCanvas, the LWS is responding to the
> mouseDown and invokes the SWTEventDispatcher to do a dispatchMousePressed
on
> the draw2D figure inside the figureCanvas. This trickles down to a button
> model. But then, back at the LWS, the swt DragSource kicks in and does a
> bunch of drag start stuff. At the end of the day, the figureCanvas and
the
> figures inside it all stop receiving mouse motion events.
>
> You indicated in your message that SWT does not send a mouse up. I can
see
> this, but I don't follow how this chain of events causes the figures in
the
> figureCanvas to stop getting mouse events after the drag - at least until
> the user clicks on the figureCanvas again.
>
> It looks like the DragSource is responsible for creating this disconnect
> between the SWT events and the figures receiving these events. How would
I
> correct this? In general, I'm looking for advice on how to use
> swt.DragSource and swt.DropTarget with a FigureCanvas containing figures.
>
> Thanks;
>
> Andy Roberts
>
>
>
> "Randy Hudson" <none@us.ibm.com> wrote in message
> news:bc351e$7dr$1@rogue.oti.com...
> > SWT sends a mouse down event and not a mouse up. See
SWTEventDispatcher,
> > which dispatches these events. You need to tell the dispatcher that a
> > native drag has started, in which case the mouse up needs to be faked,
or
> > perhaps implied, but not actually sent to any figures. If you have
> figures
> > waiting for a mouse up, you'll have issues. You would then need a way
to
> > tell the figure that a native drag has started, so it wouldn't rely on
> > mouseUp event.
> >
> > "Andy Roberts" <aroberts@bowstreet.com> wrote in message
> > news:bc303p$4ip$1@rogue.oti.com...
> > > I wrapped a FigureCanvas with an org.eclipse.swt.dnd.DragSource, and
the
> > > drag and drop part works OK. However, after dragging from the
> > FigureCanvas,
> > > and dropping on a DropTarget, the FigureCanvas stops getting
subsequent
> > > mouseMotion events like mouseEntered - that is, until the user clicks
on
> > the
> > > FigureCanvas again. At that point, the FigureCanvas starts getting
> these
> > > events.
> > >
> > > Any ideas what I might be doing wrong?
> > >
> > > If I remove the DragSource code, then the FigureCanvas gets
mouseMotion
> > > events as I would expect.
> > >
> > > Andy Roberts
> > >
> > >
> >
> >
>
>
|
|
| |
Re: problem wrapping a FigureCanvas with a DragSource [message #83074 is a reply to message #83012] |
Tue, 10 June 2003 19:10 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: aroberts.bowstreet.com
How's this sound;
I created a specialized SWTEventDispatcher for the FigureCanvas. This
dispatcher has a method that lets you release its captured state. Keep in
mind, the FigureCanvas is assigned as the DragSource, meaning that it has a
DragSource wrapped around it. Next, in the DragSourceListener.dragStart()
method, I release the captured state of dispatcher that's associated with
the FigureCanvas. So, when the drag-and-drop is done, the FigureCanvas'
event dispatcher doesn't still think it's in a captured state. So, the
figureCanvas processes mouse events as it should. It seems to work OK, but
I haven't thought about the potential side effects. Do you see any?
Thanks for the insight on this. I've made progress!!!
Andy Roberts
"Randy Hudson" <none@us.ibm.com> wrote in message
news:bc4ull$p1b$1@rogue.oti.com...
> Also, you could prevent native drags from happening altogether when the
user
> clicks on a clickable. This is what GEF does. If a draw2d MOuseEvent is
> consumed, the dragStart is aborted.
>
>
|
|
|
Re: problem wrapping a FigureCanvas with a DragSource [message #83127 is a reply to message #83074] |
Tue, 10 June 2003 19:18 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: none.us.ibm.com
The only problem would be figures that never received a mouse up, such as a
clickable button.
"Andy Roberts" <aroberts@bowstreet.com> wrote in message
news:bc5ahl$65q$1@rogue.oti.com...
> How's this sound;
>
> I created a specialized SWTEventDispatcher for the FigureCanvas. This
> dispatcher has a method that lets you release its captured state. Keep in
> mind, the FigureCanvas is assigned as the DragSource, meaning that it has
a
> DragSource wrapped around it. Next, in the DragSourceListener.dragStart()
> method, I release the captured state of dispatcher that's associated with
> the FigureCanvas. So, when the drag-and-drop is done, the FigureCanvas'
> event dispatcher doesn't still think it's in a captured state. So, the
> figureCanvas processes mouse events as it should. It seems to work OK,
but
> I haven't thought about the potential side effects. Do you see any?
>
> Thanks for the insight on this. I've made progress!!!
>
> Andy Roberts
>
>
>
> "Randy Hudson" <none@us.ibm.com> wrote in message
> news:bc4ull$p1b$1@rogue.oti.com...
> > Also, you could prevent native drags from happening altogether when the
> user
> > clicks on a clickable. This is what GEF does. If a draw2d MOuseEvent
is
> > consumed, the dragStart is aborted.
> >
> >
>
>
|
|
|
Re: problem wrapping a FigureCanvas with a DragSource [message #83178 is a reply to message #83127] |
Tue, 10 June 2003 21:28 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: aroberts.bowstreet.com
Hi Randy;
OK - what would be the way to tell a clickable button that it shouldn't rely
upon a mouseUp for a certain case? That was the other part of the
implementation you referred to in your first response.
Andy Roberts.
"Randy Hudson" <none@us.ibm.com> wrote in message
news:bc5au2$6i8$1@rogue.oti.com...
> The only problem would be figures that never received a mouse up, such as
a
> clickable button.
>
> "Andy Roberts" <aroberts@bowstreet.com> wrote in message
> news:bc5ahl$65q$1@rogue.oti.com...
> > How's this sound;
> >
> > I created a specialized SWTEventDispatcher for the FigureCanvas. This
> > dispatcher has a method that lets you release its captured state. Keep
in
> > mind, the FigureCanvas is assigned as the DragSource, meaning that it
has
> a
> > DragSource wrapped around it. Next, in the
DragSourceListener.dragStart()
> > method, I release the captured state of dispatcher that's associated
with
> > the FigureCanvas. So, when the drag-and-drop is done, the FigureCanvas'
> > event dispatcher doesn't still think it's in a captured state. So, the
> > figureCanvas processes mouse events as it should. It seems to work OK,
> but
> > I haven't thought about the potential side effects. Do you see any?
> >
> > Thanks for the insight on this. I've made progress!!!
> >
> > Andy Roberts
> >
> >
> >
> > "Randy Hudson" <none@us.ibm.com> wrote in message
> > news:bc4ull$p1b$1@rogue.oti.com...
> > > Also, you could prevent native drags from happening altogether when
the
> > user
> > > clicks on a clickable. This is what GEF does. If a draw2d MOuseEvent
> is
> > > consumed, the dragStart is aborted.
> > >
> > >
> >
> >
>
>
|
|
|
Goto Forum:
Current Time: Fri Aug 16 19:17:10 GMT 2024
Powered by FUDForum. Page generated in 0.04380 seconds
|