[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] "Relative to display" To "Relative to TableItem"

Hello,

To make a long story short, I've got coordinates that are relative to the display. I want to find out which TableItem in a table this coordinate is refering to.

Here's the long story: I've implemented some drag and drop functionality between two tables on my UI. You can drag a row from one table and drop it into the other table. When you drop it, I need to figure out where the mouse was when the user released the mouse's button. This is how I will figure out *where* to insert the item that was dragged. I tried adding a mouse adapter on the target, but mouseup() doesn't get triggered from a (drag and) drop.

The DropTargetEvent does come with a .x and a .y that are filled with coordinates but they are relative to the display. I can go through every tableitem and use getBounds to get it's coordinates but these coordinates will be relative to the table, not the display.

It seems insanely hard/impossible to accomplish this. How do i convert "Relative to Display" coordinates into "Relative to some-part-of-the-UI" coordinates and/or vice versa?

Thanks for the help,
Dan