Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » ScrolledComposite and width of its content...
ScrolledComposite and width of its content... [message #453614] Fri, 08 April 2005 06:07 Go to next message
Michael is currently offline MichaelFriend
Messages: 43
Registered: July 2009
Member
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 #453905 is a reply to message #453614] Wed, 13 April 2005 17:27 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
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
Re: ScrolledComposite and width of its content... [message #454221 is a reply to message #453905] Tue, 19 April 2005 11:29 Go to previous message
Michael is currently offline MichaelFriend
Messages: 43
Registered: July 2009
Member
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
>
>
>
Previous Topic:sorting org.eclipse.swt.widgets.List
Next Topic:How to launch a dialog in syncExec?
Goto Forum:
  


Current Time: Tue Mar 09 07:34:56 GMT 2021

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

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

Back to the top