Using a ScrolledComposite with Nebula Grid [message #642358] |
Wed, 01 December 2010 00:38 |
Jon Svede Messages: 83 Registered: July 2009 |
Member |
|
|
I have a WizardPage that needs to display table of checkboxes. I was able to create the table easily using the Nebula Grid widget. The grid will vary in size depending on what the user selects earlier in the wizard flow. This results in the possibility that grid will have more columns than the wizard has space for. I thought the way to solve this is to use a ScrolledComposite. However, no matter what I try, nothing seems to work.
Essentially, I think I need to do something like this to set up the Grid in a ScrolledComposite:
ScrolledComposite scComposite = new ScrolledComposite( parent, SWT.H_SCROLL | SWT.V_SCROLL ) ;
Composite childComposite = new Composite( scComposite, SWT.NONE ) ;
childComposite.setLayout( new FillLayout() ) ;
Grid grid = new Grid( childComposite, SWT.NONE ) ;
Then later, when I am done adding GridColumn and GridItem to the Grid, I can do this:
childComposite.setSize( 400, 200 ) ;
scComposite.setContent( childComposite ) ;
or I could do something like this:
scComposite.setContent( childComposite ) ;
scComposite.setMinSize( 400, 200 ) ;
scComposite.SetExpandHorizontal( true ) ;
scComposite.setExpandVertical( true ) ;
The thing is that neither of these seem to work. No matter what I've tried, I don't get scrollbars when the grid size exceeds the wizard window.
I thought that maybe it was something with JFace/RCP, so I created a standalong SWT app that exhibits the same behavior - and the one thing all these have in common is me.
So am I doing something wrong? This seems to be how the examples in the snippets work as well as an SWT/JFace book I have. Clearly I am doing something wrong, I just don't see what it is.
One more item: I am on a Mac but the same issue is present when I run this code on windows. I am using Eclipse 3.5.2 as my target platform for the RCP app.
Thanks in advance for any pointers or suggestions.
Jon
|
|
|
Re: Using a ScrolledComposite with Nebula Grid [message #642379 is a reply to message #642358] |
Wed, 01 December 2010 06:38 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
The grid will show scrollbars itself if the content the content is
overlowing the available size.
Probably you need to pass SWT.H_SCROLL and SWT.V_SCROLL.
Tom
Am 01.12.10 01:38, schrieb Jon Svede:
> I have a WizardPage that needs to display table of checkboxes. I was
> able to create the table easily using the Nebula Grid widget. The grid
> will vary in size depending on what the user selects earlier in the
> wizard flow. This results in the possibility that grid will have more
> columns than the wizard has space for. I thought the way to solve this
> is to use a ScrolledComposite. However, no matter what I try, nothing
> seems to work.
>
> Essentially, I think I need to do something like this to set up the Grid
> in a ScrolledComposite:
>
> ScrolledComposite scComposite = new ScrolledComposite( parent,
> SWT.H_SCROLL | SWT.V_SCROLL ) ;
> Composite childComposite = new Composite( scComposite, SWT.NONE ) ;
> childComposite.setLayout( new FillLayout() ) ;
> Grid grid = new Grid( childComposite, SWT.NONE ) ;
>
> Then later, when I am done adding GridColumn and GridItem to the Grid, I
> can do this:
>
> childComposite.setSize( 400, 200 ) ;
> scComposite.setContent( childComposite ) ;
>
> or I could do something like this:
>
> scComposite.setContent( childComposite ) ;
> scComposite.setMinSize( 400, 200 ) ;
> scComposite.SetExpandHorizontal( true ) ;
> scComposite.setExpandVertical( true ) ;
>
> The thing is that neither of these seem to work. No matter what I've
> tried, I don't get scrollbars when the grid size exceeds the wizard window.
>
> I thought that maybe it was something with JFace/RCP, so I created a
> standalong SWT app that exhibits the same behavior - and the one thing
> all these have in common is me.
>
> So am I doing something wrong? This seems to be how the examples in the
> snippets work as well as an SWT/JFace book I have. Clearly I am doing
> something wrong, I just don't see what it is.
>
> One more item: I am on a Mac but the same issue is present when I run
> this code on windows. I am using Eclipse 3.5.2 as my target platform
> for the RCP app.
>
> Thanks in advance for any pointers or suggestions.
>
> Jon
|
|
|
|
Powered by
FUDForum. Page generated in 5.03766 seconds