Home » Eclipse Projects » Standard Widget Toolkit (SWT) » questions about laying out widgets
questions about laying out widgets [message #466323] |
Fri, 06 January 2006 15:34 |
Aleksandr Kravets Messages: 55 Registered: July 2009 |
Member |
|
|
Hi,
I'm writing SWT application, here is a screenshot:
http://public.fotki.com/akravets/life/random_stuff/clientsql .html
The problems I am having are marked in red. The widget are not starting
at 0,0 of the tab, I don't want to have gray space around my widgets (if
possible). Below the tab folder there is no blue border, however if I
start resizing the right sash, then the border appears. Here is a
screenshot of when border is visible:
http://public.fotki.com/akravets/life/random_stuff/clientsql 2.html
I appreciate any help. Here is the layout code:
Label resultLabel = new Label(this, SWT.LEFT | SWT.BORDER);
table = new Table(this, SWT.BORDER | SWT.MULTI |
SWT.FULL_SELECTION | SWT.VIRTUAL);
final GridData gd = new GridData(GridData.FILL_BOTH);
table.setLayoutData(gd);
table.setHeaderVisible(true);
table.setLinesVisible(true);
setLayout(new GridLayout(1,true));
GridData labelData = new GridData(GridData.FILL_HORIZONTAL);
resultLabel.setLayoutData(labelData);
GridData resultData = new GridData(GridData.FILL_BOTH);
table.setLayoutData(resultData);
|
|
|
Re: questions about laying out widgets [message #466334 is a reply to message #466323] |
Fri, 06 January 2006 16:52 |
Veronika Irvine Messages: 1272 Registered: July 2009 |
Senior Member |
|
|
GridLayout has a defualt margin all around of 5 pixels. You can override
this as follows:
GridLayout layout= new GridLayout(1,true);
layout.marginWidth = layout.marginHeight = 0;
setLayout(layout);
"Aleksandr Kravets" <akravets@klgerweiss.com> wrote in message
news:dpm2p1$pre$1@utils.eclipse.org...
> Hi,
>
> I'm writing SWT application, here is a screenshot:
> http://public.fotki.com/akravets/life/random_stuff/clientsql .html
>
> The problems I am having are marked in red. The widget are not starting at
> 0,0 of the tab, I don't want to have gray space around my widgets (if
> possible). Below the tab folder there is no blue border, however if I
> start resizing the right sash, then the border appears. Here is a
> screenshot of when border is visible:
> http://public.fotki.com/akravets/life/random_stuff/clientsql 2.html
>
> I appreciate any help. Here is the layout code:
>
> Label resultLabel = new Label(this, SWT.LEFT | SWT.BORDER);
> table = new Table(this, SWT.BORDER | SWT.MULTI |
> SWT.FULL_SELECTION | SWT.VIRTUAL);
> final GridData gd = new GridData(GridData.FILL_BOTH);
> table.setLayoutData(gd);
> table.setHeaderVisible(true);
> table.setLinesVisible(true);
>
> setLayout(new GridLayout(1,true));
>
> GridData labelData = new GridData(GridData.FILL_HORIZONTAL);
> resultLabel.setLayoutData(labelData);
>
> GridData resultData = new GridData(GridData.FILL_BOTH);
> table.setLayoutData(resultData);
|
|
|
Re: questions about laying out widgets [message #466336 is a reply to message #466323] |
Fri, 06 January 2006 16:57 |
Veronika Irvine Messages: 1272 Registered: July 2009 |
Senior Member |
|
|
Not quite sure how you are missing part of the blue border - is "this" a
child of CTabFolder?
"Aleksandr Kravets" <akravets@klgerweiss.com> wrote in message
news:dpm2p1$pre$1@utils.eclipse.org...
> Hi,
>
> I'm writing SWT application, here is a screenshot:
> http://public.fotki.com/akravets/life/random_stuff/clientsql .html
>
> The problems I am having are marked in red. The widget are not starting at
> 0,0 of the tab, I don't want to have gray space around my widgets (if
> possible). Below the tab folder there is no blue border, however if I
> start resizing the right sash, then the border appears. Here is a
> screenshot of when border is visible:
> http://public.fotki.com/akravets/life/random_stuff/clientsql 2.html
>
> I appreciate any help. Here is the layout code:
>
> Label resultLabel = new Label(this, SWT.LEFT | SWT.BORDER);
> table = new Table(this, SWT.BORDER | SWT.MULTI |
> SWT.FULL_SELECTION | SWT.VIRTUAL);
> final GridData gd = new GridData(GridData.FILL_BOTH);
> table.setLayoutData(gd);
> table.setHeaderVisible(true);
> table.setLinesVisible(true);
>
> setLayout(new GridLayout(1,true));
>
> GridData labelData = new GridData(GridData.FILL_HORIZONTAL);
> resultLabel.setLayoutData(labelData);
>
> GridData resultData = new GridData(GridData.FILL_BOTH);
> table.setLayoutData(resultData);
|
|
|
Re: questions about laying out widgets [message #466338 is a reply to message #466334] |
Fri, 06 January 2006 17:33 |
Aleksandr Kravets Messages: 55 Registered: July 2009 |
Member |
|
|
thanks a lot!
Veronika Irvine wrote:
> GridLayout has a defualt margin all around of 5 pixels. You can override
> this as follows:
>
> GridLayout layout= new GridLayout(1,true);
> layout.marginWidth = layout.marginHeight = 0;
> setLayout(layout);
>
> "Aleksandr Kravets" <akravets@klgerweiss.com> wrote in message
> news:dpm2p1$pre$1@utils.eclipse.org...
>
>>Hi,
>>
>>I'm writing SWT application, here is a screenshot:
>> http://public.fotki.com/akravets/life/random_stuff/clientsql .html
>>
>>The problems I am having are marked in red. The widget are not starting at
>>0,0 of the tab, I don't want to have gray space around my widgets (if
>>possible). Below the tab folder there is no blue border, however if I
>>start resizing the right sash, then the border appears. Here is a
>>screenshot of when border is visible:
>> http://public.fotki.com/akravets/life/random_stuff/clientsql 2.html
>>
>>I appreciate any help. Here is the layout code:
>>
>> Label resultLabel = new Label(this, SWT.LEFT | SWT.BORDER);
>> table = new Table(this, SWT.BORDER | SWT.MULTI |
>>SWT.FULL_SELECTION | SWT.VIRTUAL);
>> final GridData gd = new GridData(GridData.FILL_BOTH);
>> table.setLayoutData(gd);
>> table.setHeaderVisible(true);
>> table.setLinesVisible(true);
>>
>> setLayout(new GridLayout(1,true));
>>
>> GridData labelData = new GridData(GridData.FILL_HORIZONTAL);
>> resultLabel.setLayoutData(labelData);
>>
>> GridData resultData = new GridData(GridData.FILL_BOTH);
>> table.setLayoutData(resultData);
>
>
>
|
|
|
Re: questions about laying out widgets [message #466339 is a reply to message #466336] |
Fri, 06 January 2006 17:36 |
Aleksandr Kravets Messages: 55 Registered: July 2009 |
Member |
|
|
I am not sure what do you mean by child of CTabFolder. It's a CTabItem,
and the top border is there, only it's visible when I make my sash
wider. If you look at first screenshot, you'll see what I mean.
Veronika Irvine wrote:
> Not quite sure how you are missing part of the blue border - is "this" a
> child of CTabFolder?
>
> "Aleksandr Kravets" <akravets@klgerweiss.com> wrote in message
> news:dpm2p1$pre$1@utils.eclipse.org...
>
>>Hi,
>>
>>I'm writing SWT application, here is a screenshot:
>> http://public.fotki.com/akravets/life/random_stuff/clientsql .html
>>
>>The problems I am having are marked in red. The widget are not starting at
>>0,0 of the tab, I don't want to have gray space around my widgets (if
>>possible). Below the tab folder there is no blue border, however if I
>>start resizing the right sash, then the border appears. Here is a
>>screenshot of when border is visible:
>> http://public.fotki.com/akravets/life/random_stuff/clientsql 2.html
>>
>>I appreciate any help. Here is the layout code:
>>
>> Label resultLabel = new Label(this, SWT.LEFT | SWT.BORDER);
>> table = new Table(this, SWT.BORDER | SWT.MULTI |
>>SWT.FULL_SELECTION | SWT.VIRTUAL);
>> final GridData gd = new GridData(GridData.FILL_BOTH);
>> table.setLayoutData(gd);
>> table.setHeaderVisible(true);
>> table.setLinesVisible(true);
>>
>> setLayout(new GridLayout(1,true));
>>
>> GridData labelData = new GridData(GridData.FILL_HORIZONTAL);
>> resultLabel.setLayoutData(labelData);
>>
>> GridData resultData = new GridData(GridData.FILL_BOTH);
>> table.setLayoutData(resultData);
>
>
>
|
|
|
Re: questions about laying out widgets [message #466341 is a reply to message #466339] |
Fri, 06 January 2006 20:17 |
Veronika Irvine Messages: 1272 Registered: July 2009 |
Senior Member |
|
|
When you create a widget to be displayed inside a CTabItem, it is created
as a child of the CTabFolder and then associated with the CTabItem using
CTabItem.setControl(). For example :
CTabFolder folder = new CTabFolder(shell, SWT.BORDER);
CTabItem item = new CTabItem(folder, SWT.CLOSE);
item.setText("Item "+i);
item.setImage(image);
Text text = new Text(folder, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
text.setText("Text for item "+i+"\n\none, two, three\n\nabcdefghijklmnop");
item.setControl(text);
In your code snippet below, is "this" a subclass of Composite and do you
call setControl() on the CTabItem with "this"?
"Aleksandr Kravets" <akravets@klgerweiss.com> wrote in message
news:dpm9ss$6rs$1@utils.eclipse.org...
>I am not sure what do you mean by child of CTabFolder. It's a CTabItem, and
>the top border is there, only it's visible when I make my sash wider. If
>you look at first screenshot, you'll see what I mean.
>
>
> Veronika Irvine wrote:
>> Not quite sure how you are missing part of the blue border - is "this" a
>> child of CTabFolder?
>>
>> "Aleksandr Kravets" <akravets@klgerweiss.com> wrote in message
>> news:dpm2p1$pre$1@utils.eclipse.org...
>>
>>>Hi,
>>>
>>>I'm writing SWT application, here is a screenshot:
>>> http://public.fotki.com/akravets/life/random_stuff/clientsql .html
>>>
>>>The problems I am having are marked in red. The widget are not starting
>>>at 0,0 of the tab, I don't want to have gray space around my widgets (if
>>>possible). Below the tab folder there is no blue border, however if I
>>>start resizing the right sash, then the border appears. Here is a
>>>screenshot of when border is visible:
>>> http://public.fotki.com/akravets/life/random_stuff/clientsql 2.html
>>>
>>>I appreciate any help. Here is the layout code:
>>>
>>> Label resultLabel = new Label(this, SWT.LEFT | SWT.BORDER);
>>> table = new Table(this, SWT.BORDER | SWT.MULTI |
>>> SWT.FULL_SELECTION | SWT.VIRTUAL);
>>> final GridData gd = new GridData(GridData.FILL_BOTH);
>>> table.setLayoutData(gd);
>>> table.setHeaderVisible(true);
>>> table.setLinesVisible(true);
>>>
>>> setLayout(new GridLayout(1,true));
>>>
>>> GridData labelData = new GridData(GridData.FILL_HORIZONTAL);
>>> resultLabel.setLayoutData(labelData);
>>>
>>> GridData resultData = new GridData(GridData.FILL_BOTH);
>>> table.setLayoutData(resultData);
>>
>>
|
|
|
Re: questions about laying out widgets [message #466346 is a reply to message #466341] |
Fri, 06 January 2006 21:11 |
Aleksandr Kravets Messages: 55 Registered: July 2009 |
Member |
|
|
Yes, "this" is a Class that extends Composite, and in the calling class
I setControl thru this Class.
Veronika Irvine wrote:
> When you create a widget to be displayed inside a CTabItem, it is created
> as a child of the CTabFolder and then associated with the CTabItem using
> CTabItem.setControl(). For example :
>
> CTabFolder folder = new CTabFolder(shell, SWT.BORDER);
> CTabItem item = new CTabItem(folder, SWT.CLOSE);
> item.setText("Item "+i);
> item.setImage(image);
> Text text = new Text(folder, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
> text.setText("Text for item "+i+"\n\none, two, three\n\nabcdefghijklmnop");
> item.setControl(text);
>
> In your code snippet below, is "this" a subclass of Composite and do you
> call setControl() on the CTabItem with "this"?
>
>
> "Aleksandr Kravets" <akravets@klgerweiss.com> wrote in message
> news:dpm9ss$6rs$1@utils.eclipse.org...
>
>>I am not sure what do you mean by child of CTabFolder. It's a CTabItem, and
>>the top border is there, only it's visible when I make my sash wider. If
>>you look at first screenshot, you'll see what I mean.
>>
>>
>>Veronika Irvine wrote:
>>
>>>Not quite sure how you are missing part of the blue border - is "this" a
>>>child of CTabFolder?
>>>
>>>"Aleksandr Kravets" <akravets@klgerweiss.com> wrote in message
>>>news:dpm2p1$pre$1@utils.eclipse.org...
>>>
>>>
>>>>Hi,
>>>>
>>>>I'm writing SWT application, here is a screenshot:
>>>> http://public.fotki.com/akravets/life/random_stuff/clientsql .html
>>>>
>>>>The problems I am having are marked in red. The widget are not starting
>>>>at 0,0 of the tab, I don't want to have gray space around my widgets (if
>>>>possible). Below the tab folder there is no blue border, however if I
>>>>start resizing the right sash, then the border appears. Here is a
>>>>screenshot of when border is visible:
>>>> http://public.fotki.com/akravets/life/random_stuff/clientsql 2.html
>>>>
>>>>I appreciate any help. Here is the layout code:
>>>>
>>>>Label resultLabel = new Label(this, SWT.LEFT | SWT.BORDER);
>>>> table = new Table(this, SWT.BORDER | SWT.MULTI |
>>>>SWT.FULL_SELECTION | SWT.VIRTUAL);
>>>> final GridData gd = new GridData(GridData.FILL_BOTH);
>>>> table.setLayoutData(gd);
>>>> table.setHeaderVisible(true);
>>>> table.setLinesVisible(true);
>>>>
>>>> setLayout(new GridLayout(1,true));
>>>>
>>>> GridData labelData = new GridData(GridData.FILL_HORIZONTAL);
>>>> resultLabel.setLayoutData(labelData);
>>>>
>>>> GridData resultData = new GridData(GridData.FILL_BOTH);
>>>> table.setLayoutData(resultData);
>>>
>>>
>
|
|
|
Goto Forum:
Current Time: Tue Dec 10 15:05:37 GMT 2024
Powered by FUDForum. Page generated in 0.03932 seconds
|