| 
| Create a new Figure where the Drop occurs [message #53526] | Fri, 10 January 2003 11:30  |  | 
| Eclipse User  |  |  |  |  | Originally posted by: sy_cheung2.yahoo.com 
 Hi,
 
 I want to create a new Figure in my Diagram where the Drop occurs. In order
 to do that I change the NativeDropRequest to save the (x,y) of the drop
 event and in my TextTransferDropTargetListener, I call the getCurrentEvent()
 and get the (x,y) of that event.
 
 But what I find out is the (x,y) co-ordinate of the getCurrentEvent() is
 different from what i expected. I drop the text in the top left side of my
 diagram, the (x,y) co-ordinate of the getCurrentEvent() is (357, 369).  I
 expect x, y-coordinate  should be in the range of 100. So even I drop in in
 the top lef side of my diagram, the figure is created in the bottom right
 side of my diagram.
 
 Could someone please tell me if my approach is correct? If not, please tell
 me what did I miss.
 
 Thank you.
 
 Changes I made in the TextTransferDropTargetListener:
 
 protected Request createTargetRequest() {
 
 DropTargetEvent event = getCurrentEvent();
 
 NativeDropRequest dropRequesgetCurrentEventt = new NativeDropRequest();
 
 System.out.println("x" + event.x + "y"+event.y);
 
 dropRequest.setX(event.x);
 
 dropRequest.setY(event.y);
 
 return dropRequest;
 
 }
 
 protected void updateTargetRequest(){
 
 DropTargetEvent event = getCurrentEvent();
 
 System.out.println("x" + event.x + "y"+event.y);
 
 getNativeDropRequest().setX(event.x);
 
 getNativeDropRequest().setY(event.y);
 
 getNativeDropRequest().setData(getCurrentEvent().data);
 
 }
 |  |  |  | 
| 
| Re: Create a new Figure where the Drop occurs [message #53553 is a reply to message #53526] | Thu, 09 January 2003 11:46   |  | 
| Eclipse User  |  |  |  |  | No time to check this now, but try AbstractTransferDropTargetListener.getDropLocation()
 
 
 "Sam Cheung" <sy_cheung2@yahoo.com> wrote in message
 news:avmrj2$8gp$1@rogue.oti.com...
 > Hi,
 >
 > I want to create a new Figure in my Diagram where the Drop occurs. In
 order
 > to do that I change the NativeDropRequest to save the (x,y) of the drop
 > event and in my TextTransferDropTargetListener, I call the
 getCurrentEvent()
 > and get the (x,y) of that event.
 >
 > But what I find out is the (x,y) co-ordinate of the getCurrentEvent() is
 > different from what i expected. I drop the text in the top left side of my
 > diagram, the (x,y) co-ordinate of the getCurrentEvent() is (357, 369).  I
 > expect x, y-coordinate  should be in the range of 100. So even I drop in
 in
 > the top lef side of my diagram, the figure is created in the bottom right
 > side of my diagram.
 >
 > Could someone please tell me if my approach is correct? If not, please
 tell
 > me what did I miss.
 >
 > Thank you.
 >
 > Changes I made in the TextTransferDropTargetListener:
 >
 > protected Request createTargetRequest() {
 >
 > DropTargetEvent event = getCurrentEvent();
 >
 > NativeDropRequest dropRequesgetCurrentEventt = new NativeDropRequest();
 >
 > System.out.println("x" + event.x + "y"+event.y);
 >
 > dropRequest.setX(event.x);
 >
 > dropRequest.setY(event.y);
 >
 > return dropRequest;
 >
 > }
 >
 > protected void updateTargetRequest(){
 >
 > DropTargetEvent event = getCurrentEvent();
 >
 > System.out.println("x" + event.x + "y"+event.y);
 >
 > getNativeDropRequest().setX(event.x);
 >
 > getNativeDropRequest().setY(event.y);
 >
 > getNativeDropRequest().setData(getCurrentEvent().data);
 >
 > }
 >
 >
 |  |  |  | 
| 
| Re: Create a new Figure where the Drop occurs [message #58627 is a reply to message #53553] | Tue, 28 January 2003 10:18  |  | 
| Eclipse User  |  |  |  |  | Originally posted by: none.us.ibm.com 
 "Manfred Goetz" <xgoetz@de.ibm.com> wrote in message
 news:avmsm9$9du$1@rogue.oti.com...
 > No time to check this now, but try
 > AbstractTransferDropTargetListener.getDropLocation()
 
 Yes, I think that one is EditPartViewer-relative.
 
 SWT sends a Display-relative coordinate.
 
 >
 >
 > "Sam Cheung" <sy_cheung2@yahoo.com> wrote in message
 > news:avmrj2$8gp$1@rogue.oti.com...
 > > Hi,
 > >
 > > I want to create a new Figure in my Diagram where the Drop occurs. In
 > order
 > > to do that I change the NativeDropRequest to save the (x,y) of the drop
 > > event and in my TextTransferDropTargetListener, I call the
 > getCurrentEvent()
 > > and get the (x,y) of that event.
 > >
 > > But what I find out is the (x,y) co-ordinate of the getCurrentEvent() is
 > > different from what i expected. I drop the text in the top left side of
 my
 > > diagram, the (x,y) co-ordinate of the getCurrentEvent() is (357, 369).
 I
 > > expect x, y-coordinate  should be in the range of 100. So even I drop in
 > in
 > > the top lef side of my diagram, the figure is created in the bottom
 right
 > > side of my diagram.
 > >
 > > Could someone please tell me if my approach is correct? If not, please
 > tell
 > > me what did I miss.
 > >
 > > Thank you.
 > >
 > > Changes I made in the TextTransferDropTargetListener:
 > >
 > > protected Request createTargetRequest() {
 > >
 > > DropTargetEvent event = getCurrentEvent();
 > >
 > > NativeDropRequest dropRequesgetCurrentEventt = new NativeDropRequest();
 > >
 > > System.out.println("x" + event.x + "y"+event.y);
 > >
 > > dropRequest.setX(event.x);
 > >
 > > dropRequest.setY(event.y);
 > >
 > > return dropRequest;
 > >
 > > }
 > >
 > > protected void updateTargetRequest(){
 > >
 > > DropTargetEvent event = getCurrentEvent();
 > >
 > > System.out.println("x" + event.x + "y"+event.y);
 > >
 > > getNativeDropRequest().setX(event.x);
 > >
 > > getNativeDropRequest().setY(event.y);
 > >
 > > getNativeDropRequest().setData(getCurrentEvent().data);
 > >
 > > }
 > >
 > >
 >
 >
 |  |  |  | 
Powered by 
FUDForum. Page generated in 0.03526 seconds