Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » need a good way for calculating composite's size with a text widget inside
need a good way for calculating composite's size with a text widget inside [message #550629] Tue, 03 August 2010 23:17 Go to next message
Sheip Dargutev is currently offline Sheip DargutevFriend
Messages: 1
Registered: August 2010
Junior Member
Hello there,

i have a problem with dynamically calculating the size of a SWT composite which contains a StyledText widget. The widget has wordWrap on and the text inside it is basically a single line text. My problem is that i cant find a good way to recalculate the composite's height (as precisely as possible) so that the whole text of the widget is visible. i used GC's getAverageCharWidth but it doesnt seem to work that good... on widgets with less text it still cuts a little from bellow and with widgets with a lot of text there is still empty space below.
Can anyone help me find a good way for achieving my goal?

thanks and best regards
Re: need a good way for calculating composite's size with a text widget inside [message #551195 is a reply to message #550629] Thu, 05 August 2010 14:50 Go to previous message
Lakshmi P ShanmugamFriend
Messages: 279
Registered: July 2009
Location: India
Senior Member
Hi,

Here is an example of Text widget that grows/shrinks as its content changes . Same should work fine with Styled Text.
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet342.java?view=co

Please note that this is not the right place for SWT related questions, they should be asked in the SWT newsgroup.

HTH,


Lakshmi P Shanmugam
Previous Topic:Refactoring menu entry
Next Topic:Creating a new customized Outline-View
Goto Forum:
  


Current Time: Sat Apr 27 04:30:57 GMT 2024

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

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

Back to the top