| [news.eclipse.platform.swt] Re: Coordinate mapping |
You would need to do something like this:
Point p = display.getCursorLocation();
Rectangle bounds = myControl.getBounds();
if (bounds.contains(myControl.toControl(p))) {
........
}Duong
Jan Kohnert wrote:
Hello List,
I've added a mouse move filter to my display. Inside this filter I receive the current cursor location using Display.
public void handleEvent(Event event) {
if (event.type == SWT.MouseMove){
Point p = getDisplay().getCursorLocation();
...
Inside my application if've several areas on which I want to check if the mouse if over one of them ot not. That for I get their bounds calling getBounds().
To check if point p is inside a bound I've to map the coordinates. The Display class offers severeal map() functions.
On that point it is unclear for me how I can map the screen coorinate system to the one used by the above descibed areas. the map() functions expects two controls as parameters (beside other paramters). Any idea?
Thanks, Jan