|
|
|
|
Re: Expandable Text widget [message #550035 is a reply to message #550008] |
Wed, 28 July 2010 15:56  |
Eclipse User |
|
|
|
Thank you very much. I based my code on yours and it works perfectly.
I ended up with this (maybe It will help someone):
text.addListener(SWT.Modify, new Listener() {
public void handleEvent(Event event) {
//compute new Text field size
Point size = text.computeSize(text.getSize().x, SWT.DEFAULT);
//compute the difference between new and old Text field height
int diff = size.y - text.getSize().y;
if( expandItem != null )
{
//add diff to ExpandItems' height
expandItem.setHeight(expandItem.getHeight() + diff);
}
//'reset' the layout if you are using one
box.getParent().layout();
}
});
Calling layout() makes most of the work, the only problem is with ExpandItem. It doesn't change its height automatically (I don't have any idea why) - you have to set it up every time in the modify listener.
|
|
|
Powered by
FUDForum. Page generated in 0.04908 seconds