How to make my tree control wider? [message #451924] |
Fri, 11 March 2005 06:16 |
Eclipse User |
|
|
|
Originally posted by: zc.ssc.stn.sh.cn
I design a new preference page, and I want to display a tree on it:
protected Control createContents(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout(1, false));
Group TestCase = new Group(composite,SWT.NONE);
TestCaseTree1 = new Tree(TestCase, SWT.NONE);
TestCaseTreeItem1 = new TreeItem(TestCaseTree1,SWT.NONE);
TestCaseTreeItem1.setText("domain1");
TestCaseTreeItem3 = new TreeItem(TestCaseTreeItem1,SWT.NONE);
TestCaseTreeItem3.setText("product11");
TestCaseTreeItem2 = new TreeItem(TestCaseTree1,SWT.NONE);
TestCaseTreeItem2.setText("domain2");
initLayoutAndData(TestCase,1);
return composite;
}
But in my preference page, the tree control is very narrow, how to make it
wider?
|
|
|
Re: How to make my tree control wider? [message #451943 is a reply to message #451924] |
Fri, 11 March 2005 15:19 |
Grant Gayed Messages: 2150 Registered: July 2009 |
Senior Member |
|
|
You can specify a width hint for the Tree by setting a GridData layout data
object into it, for example:
TestCaseTree1.setLayoutData (new GridData (150,SWT.DEFAULT));
....requests a width of 150 pixels and does not try to influence the height.
Grant
"zc" <zc@ssc.stn.sh.cn> wrote in message
news:d0rd43$ig8$1@www.eclipse.org...
> I design a new preference page, and I want to display a tree on it:
> protected Control createContents(Composite parent) {
> Composite composite = new Composite(parent, SWT.NONE);
> composite.setLayout(new GridLayout(1, false));
>
> Group TestCase = new Group(composite,SWT.NONE);
> TestCaseTree1 = new Tree(TestCase, SWT.NONE);
> TestCaseTreeItem1 = new TreeItem(TestCaseTree1,SWT.NONE);
> TestCaseTreeItem1.setText("domain1");
> TestCaseTreeItem3 = new TreeItem(TestCaseTreeItem1,SWT.NONE);
> TestCaseTreeItem3.setText("product11");
> TestCaseTreeItem2 = new TreeItem(TestCaseTree1,SWT.NONE);
> TestCaseTreeItem2.setText("domain2");
> initLayoutAndData(TestCase,1);
>
> return composite;
> }
>
> But in my preference page, the tree control is very narrow, how to make it
> wider?
>
|
|
|
Re: How to make my tree control wider? [message #452029 is a reply to message #451943] |
Mon, 14 March 2005 04:01 |
Eclipse User |
|
|
|
Originally posted by: zc.ssc.stn.sh.cn
Thank you! I made it with your help.
Grant Gayed wrote:
> You can specify a width hint for the Tree by setting a GridData layout data
> object into it, for example:
> TestCaseTree1.setLayoutData (new GridData (150,SWT.DEFAULT));
> ....requests a width of 150 pixels and does not try to influence the height.
> Grant
> "zc" <zc@ssc.stn.sh.cn> wrote in message
> news:d0rd43$ig8$1@www.eclipse.org...
>> I design a new preference page, and I want to display a tree on it:
>> protected Control createContents(Composite parent) {
>> Composite composite = new Composite(parent, SWT.NONE);
>> composite.setLayout(new GridLayout(1, false));
>>
>> Group TestCase = new Group(composite,SWT.NONE);
>> TestCaseTree1 = new Tree(TestCase, SWT.NONE);
>> TestCaseTreeItem1 = new TreeItem(TestCaseTree1,SWT.NONE);
>> TestCaseTreeItem1.setText("domain1");
>> TestCaseTreeItem3 = new TreeItem(TestCaseTreeItem1,SWT.NONE);
>> TestCaseTreeItem3.setText("product11");
>> TestCaseTreeItem2 = new TreeItem(TestCaseTree1,SWT.NONE);
>> TestCaseTreeItem2.setText("domain2");
>> initLayoutAndData(TestCase,1);
>>
>> return composite;
>> }
>>
>> But in my preference page, the tree control is very narrow, how to make it
>> wider?
>>
|
|
|
Powered by
FUDForum. Page generated in 0.03642 seconds