Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] (programmatically) resizing composite widget children

Call layout(true) on the parent o fthe line count STyledText widget.

If this does not work, please post a snippet.
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-swt-home/faq.html#whatisasnippet





"Donnie" <eclipse@xxxxxxxxxxx>
Sent by: platform-swt-dev-admin@xxxxxxxxxxx
09/18/2003 01:26 AM
Please respond to platform-swt-dev
 
        To:     <platform-swt-dev@xxxxxxxxxxx>
        cc: 
        Subject:        [platform-swt-dev] (programmatically) resizing 
composite widget children


Howdy-
 
So I am writing a text editor using SWT and I want to implement a line 
count pane similar to that in the workbench java editor.  I figured I 
could use two StyledText objects, one for the line count and one for the 
text editing.  The problem is that I can’t get the line count StyledText 
widget to resize itself correctly when I add another digit to the line 
count (like going from 9 to 10 or 99 to 100).  I am using a FormLayout 
with a margineWidth of 2 pixels to space the line count from the editor 
(there are some other complicated FormAttachments but I don’t think they 
matter).  When I add another digit to the line count, I changed the width 
of the StyledText widget through the setBounds method.  This causes the 
line count StyledText pane to overlap the editor pane… :-(  What’s 
interesting is that when I resize (with the mouse) the shell that contains 
this composite widget it corrects the overlap and everything looks 
perfect.  I’ve tried a lot of monkey-ing around with various methods like 
redraw() and layout() but nothing has worked.  Any help would be greatly 
appreciated! 
 
While I am here I would also like to know how one can align text in a 
StyledText widget.  I would like to align my line count to the right but 
haven’t been able to find anything close…
 
 
Thanks,
-Donnie


Back to the top