ScrolledComposite and width of its content... [message #453614] |
Fri, 08 April 2005 02:07  |
Eclipse User |
|
|
|
Hi,
is it somehow possible to let the ScrolledComposite control the width of
its content?
Imagine a thumbnail viewer where the amount of thumbnails visible in a row
are depending on the width of the thumbnails an the width of the container
in which they are.
Or in other words, the composite containing the thumbnails should be alway
as wide as the ScrolledComposite. Only the hight should change.
My idea was to add a composite having the RowLayout in a ScrolledComposite
but ist seems not to work this way.
In Swing I would place all those controls on a JPanel (with FlowLayout set)
, add the JPanel in a JScrollPane and everything works as expected.
Here an example what I was trying
-----
ScrolledComposite scrollPanel = new ScrolledComposite(parent, SWT.BORDER |
SWT.V_SCROLL);
Composite thumbPanel = new Composite(scrollPanel, SWT.NONE);
scrollPanel.setContent(thumbPanel);
thumbPanel.setLayout(new RowLayout());
for(int i=0; i<100; i++)
{
Canvas canvas = new Canvas(thumbPanel, SWT.BORDER);
canvas.setBackground(BLACK);
canvas.setSize(150,200);
}
-----
Any help would be appreciated,
Michael
|
|
|
|
Re: ScrolledComposite and width of its content... [message #454221 is a reply to message #453905] |
Tue, 19 April 2005 07:29  |
Eclipse User |
|
|
|
Hi,
thank you. ;)
Regards,
Michael
Am Wed, 13 Apr 2005 13:27:16 -0400 hat Veronika Irvine
<veronika_irvine@oti.com> geschrieben:
> The following snippet uses a RowLayout with wrapping in a
> ScrolledComposite:
>
> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet166.java?rev=HEAD& amp;content-
>
>
> type=text/vnd.viewcvs-markup
>
>
> "Michael" <seimic@tiscali.de> wrote in message
> news:opsowgmocgaak1pz@localhost...
>> Hi,
>>
>> is it somehow possible to let the ScrolledComposite control the width of
>> its content?
>> Imagine a thumbnail viewer where the amount of thumbnails visible in a
>> row are depending on the width of the thumbnails an the width of the
>> container in which they are.
>> Or in other words, the composite containing the thumbnails should be
>> alway as wide as the ScrolledComposite. Only the hight should change.
>>
>> My idea was to add a composite having the RowLayout in a
>> ScrolledComposite but ist seems not to work this way.
>> In Swing I would place all those controls on a JPanel (with FlowLayout
>> set) , add the JPanel in a JScrollPane and everything works as expected.
>>
>> Here an example what I was trying
>> -----
>> ScrolledComposite scrollPanel = new ScrolledComposite(parent, SWT.BORDER
>> | SWT.V_SCROLL);
>> Composite thumbPanel = new Composite(scrollPanel, SWT.NONE);
>> scrollPanel.setContent(thumbPanel);
>> thumbPanel.setLayout(new RowLayout());
>>
>> for(int i=0; i<100; i++)
>> {
>> Canvas canvas = new Canvas(thumbPanel, SWT.BORDER);
>> canvas.setBackground(BLACK);
>> canvas.setSize(150,200);
>> }
>> -----
>>
>> Any help would be appreciated,
>> Michael
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.04620 seconds