Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » [Draw2D] Text figure with getLocationAtOffset
[Draw2D] Text figure with getLocationAtOffset [message #249605] Tue, 14 July 2009 00:44 Go to next message
Kai Schlamp is currently offline Kai SchlampFriend
Messages: 344
Registered: July 2009
Senior Member
Hello.

Is there a text figure that supports something like getLocationAtOffset?
I provide the character offset as parameter and want the x and y coordinates.
Or any other solutions to get a specific text position inside a figure that supports text?

Regards,
Kai
Re: [Draw2D] Text figure with getLocationAtOffset [message #249610 is a reply to message #249605] Tue, 14 July 2009 00:58 Go to previous messageGo to next message
Kai Schlamp is currently offline Kai SchlampFriend
Messages: 344
Registered: July 2009
Senior Member
A solution could be TextFlow.getCarePlacement if I understand the API documentation correctly.
What I want to do is to mark up specific strings inside a text, like StyledText with it StyleRange's
does. Is this possible with Draw2D?
Are there any examples how to use the stuff in org.eclipse.draw2d.text?

Regards,
Kai

Kai Schlamp wrote:
> Hello.
>
> Is there a text figure that supports something like getLocationAtOffset?
> I provide the character offset as parameter and want the x and y
> coordinates.
> Or any other solutions to get a specific text position inside a figure
> that supports text?
>
> Regards,
> Kai
Re: [Draw2D] Text figure with getLocationAtOffset [message #249618 is a reply to message #249610] Tue, 14 July 2009 11:28 Go to previous messageGo to next message
Kai Schlamp is currently offline Kai SchlampFriend
Messages: 344
Registered: July 2009
Senior Member
> A solution could be TextFlow.getCarePlacement if I understand the API
> documentation correctly.

No, getCaretPlacement did not help. Any other way to get the positions coordinates of an offset
inside a TextFlow?

Regards,
Kai
Re: [Draw2D] Text figure with getLocationAtOffset [message #249623 is a reply to message #249618] Tue, 14 July 2009 19:49 Go to previous message
Kai Schlamp is currently offline Kai SchlampFriend
Messages: 344
Registered: July 2009
Senior Member
Ok, I solved that problem by adding a layout listener to the TextFlow. After the TextFlow was layout
(method postLayout) I can use the getCaretPlacement method and get the correct offset locations (but
strangely only when the text ends with \n).

Kai Schlamp wrote:
>> A solution could be TextFlow.getCarePlacement if I understand the API
>> documentation correctly.
>
> No, getCaretPlacement did not help. Any other way to get the positions
> coordinates of an offset inside a TextFlow?
>
> Regards,
> Kai
Previous Topic:Exporting RCP GEF Editor
Next Topic:[Draw2D] TextFlow an setSelection
Goto Forum:
  


Current Time: Wed Feb 05 06:52:10 GMT 2025

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

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

Back to the top