Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » how to get current cursor location relative to current editor
how to get current cursor location relative to current editor [message #463341] Thu, 03 November 2005 19:49 Go to next message
Patrick is currently offline Patrick
Messages: 55
Registered: July 2009
Member
I need to get the current cursor location relative within the current
editor. I can get the absolute cursor location from
Display.getCurrent().getCursorLocation() . Can I use this somehow or is
there somewhere else I should look? Thanks.
Re: how to get current cursor location relative to current editor [message #463367 is a reply to message #463341] Fri, 04 November 2005 13:22 Go to previous message
Philipp is currently offline Philipp
Messages: 49
Registered: July 2009
Member
This is a multipart message in MIME format.
--=_alternative 00496EC0C12570AF_=
Content-Type: text/plain; charset="US-ASCII"

Yes you can use that one,

However, the location you will get is absolute and not relative to the
current active control.

If you need the position relative to your control you can use the
following:

Point absolutePosition = Display.getCurrent().getCursorLocation();
Point relativePosition = yourControl.toControl(absolutePosition);

hth
Philipp
--=_alternative 00496EC0C12570AF_=
Content-Type: text/html; charset="US-ASCII"


<br><font size=2 face="sans-serif">Yes you can use that one, </font>
<br>
<br><font size=2 face="sans-serif">However, the location you will get is
absolute and not relative to the current active control.</font>
<br>
<br><font size=2 face="sans-serif">If you need the position relative to
your control you can use the following:</font>
<br>
<br><font size=2 face="sans-serif">Point absolutePosition = Display.getCurrent().getCursorLocation();</font>
<br><font size=2 face="sans-serif">Point relativePosition = yourControl.toControl(absolutePosition);</font>
<br>
<br><font size=2 face="sans-serif">hth </font>
<br><font size=2 face="sans-serif">Philipp</font>
--=_alternative 00496EC0C12570AF_=--
Previous Topic:Toolbar and SWT.FLAT
Next Topic:How to detect double mouse click in table cell?
Goto Forum:
  


Current Time: Thu Sep 18 01:56:21 GMT 2014

Powered by FUDForum. Page generated in 0.01624 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software