Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to make my tree control wider?
How to make my tree control wider? [message #451924] Fri, 11 March 2005 06:16 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
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 Go to previous message
Eclipse UserFriend
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?
>>
Previous Topic:Menu Mnemonics not visible ?
Next Topic:JNI callback exception from custom SWT widget
Goto Forum:
  


Current Time: Sat Apr 20 01:47:05 GMT 2024

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

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

Back to the top