how to set a maximum width to a Text component ? [message #647893] |
Mon, 10 January 2011 10:28 |
Gary Long Messages: 2 Registered: January 2011 |
Junior Member |
|
|
Hi :)
I created a small GUI which contains a SashForm and, inside this sf, a
tree on the left side and a Text on the right side. I would like the
tree to be resizable and the Text to have a fixed width.
At the moment, when I write some text in the Text component and when it
comes to the Text's right border, the text does not return to the next
line...
Here is my current code :
public void createPartControl(Composite parent) {
/*
* Create the main view grid
*/
parent.setLayout(new GridLayout(1,true));
parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
/*
* Create container grid for composition and comment controls
*/
Composite dataContainer = new Composite(parent, SWT.NONE);
dataContainer.setLayout(new GridLayout(4, false));
dataContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
/*
* Create controls for Composition part
*/
SashForm sf = new SashForm(dataContainer, SWT.HORIZONTAL);
gridData = new GridData();
gridData.horizontalSpan = 4;
gridData.horizontalAlignment = GridData.FILL;
gridData.grabExcessHorizontalSpace = true;
gridData.verticalAlignment = GridData.FILL;
gridData.grabExcessVerticalSpace = true;
sf.setLayoutData(gridData);
compoTree = new Tree(sf, SWT.BORDER);
compoTree.setLinesVisible(true);
gridData = new GridData();
gridData.horizontalAlignment = GridData.FILL;
gridData.horizontalSpan = 4;
compoTree.setLayoutData(gridData);
TreeItem item = new TreeItem(compoTree, SWT.NONE);
item.setText("Composition");
compoTree.update();
commentArea = new Text(sf, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL );
gridData = new GridData();
gridData.widthHint = 150;
commentArea.setLayoutData(gridData);
commentArea.setText("You can enter comments here...");
...
}
I tried to set the gridData widthHint for the Text component
(commentArea) but it didn't change its behaviour.
I don't know what to try next =(
Regards,
Gary Long
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02881 seconds