Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » autosize Text-GA
autosize Text-GA [message #686026] Tue, 21 June 2011 12:37 Go to next message
Christian Waniek is currently offline Christian WaniekFriend
Messages: 50
Registered: May 2010
Member
Hi everybody

I want to autosize the width of a Text. Then I want to use this width to build a border around the text.
I can I do this?

background info:
I want to represent a package which looks like:

+------------+--------+
|package name|        |
+------------+        |
|                     |
|                     |
+---------------------+


the border (Rectangle) around the package name should always fit the width of the package name string.

Thanks in advance
Chris

[Updated on: Tue, 21 June 2011 12:38]

Report message to a moderator

Re: autosize Text-GA [message #686405 is a reply to message #686026] Wed, 22 June 2011 07:32 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1923
Registered: July 2009
Location: Walldorf, Germany
Senior Member
You should have a look at GraphitiUi.getUiLayoutService().calculateTextSize(...). The method will return the pixel lenght of a given text, this can then be used to draw the inner rectangle in the correct size.

HTH,
Michael
Re: autosize Text-GA [message #686414 is a reply to message #686405] Wed, 22 June 2011 07:46 Go to previous message
Christian Waniek is currently offline Christian WaniekFriend
Messages: 50
Registered: May 2010
Member
Thanks a lot!
This solves my problem.

Previous Topic:F2 Edit on Pictogram Element
Next Topic:Graphiti Release 0.8.0 is available for download
Goto Forum:
  


Current Time: Fri Dec 04 15:45:46 GMT 2020

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

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

Back to the top