Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Select text by position
Select text by position [message #452382] Fri, 18 March 2005 19:59 Go to next message
Eclipse UserFriend
Originally posted by: doug-list.threepenny.net

Is there any way to set the caret in a text widget based on a position
(x,y coordinate)?

The setSelection(Point) method seems to treat the Point as (start, end)
so no use there.

I'm looking for something to match the Windows:
EM_CHARFROMPOS message.

Thanks,

Doug
Re: Select text by position [message #452495 is a reply to message #452382] Mon, 21 March 2005 15:12 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
Hi Doug,

Text does not do what you want, but you could use a StyledText instead,
which has:
- getOffsetAtLocation(Point)
- setCaretOffset(int)

Grant

"Doug Pearson" <doug-list@threepenny.net> wrote in message
news:d1fbtb$p4f$1@www.eclipse.org...
> Is there any way to set the caret in a text widget based on a position
> (x,y coordinate)?
>
> The setSelection(Point) method seems to treat the Point as (start, end)
> so no use there.
>
> I'm looking for something to match the Windows:
> EM_CHARFROMPOS message.
>
> Thanks,
>
> Doug
>
Re: Select text by position [message #452604 is a reply to message #452495] Wed, 23 March 2005 04:49 Go to previous message
Eclipse UserFriend
Originally posted by: doug-list.threepenny.net

That's excellent Grant -- just what I needed.

Many thanks (I'd been rolling my own by adding EM_CHARFROMPOS
messages...not exactly cross platform :)

Many thanks,

Doug

Grant Gayed wrote:
> Hi Doug,
>
> Text does not do what you want, but you could use a StyledText instead,
> which has:
> - getOffsetAtLocation(Point)
> - setCaretOffset(int)
>
> Grant
>
> "Doug Pearson" <doug-list@threepenny.net> wrote in message
> news:d1fbtb$p4f$1@www.eclipse.org...
>
>>Is there any way to set the caret in a text widget based on a position
>>(x,y coordinate)?
>>
>>The setSelection(Point) method seems to treat the Point as (start, end)
>>so no use there.
>>
>>I'm looking for something to match the Windows:
>>EM_CHARFROMPOS message.
>>
>>Thanks,
>>
>>Doug
>>
>
>
>
Previous Topic:Table Resize when parent resize
Next Topic:UI layout help
Goto Forum:
  


Current Time: Thu Apr 25 09:15:57 GMT 2024

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

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

Back to the top