Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Using a ScrolledComposite with Nebula Grid
Using a ScrolledComposite with Nebula Grid [message #642358] Wed, 01 December 2010 00:38 Go to next message
Jon Svede is currently offline Jon SvedeFriend
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 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
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
Re: Using a ScrolledComposite with Nebula Grid [message #642517 is a reply to message #642379] Wed, 01 December 2010 16:19 Go to previous message
Jon Svede is currently offline Jon SvedeFriend
Messages: 83
Registered: July 2009
Member
Thanks, Tom. I don't know why I didn't remember that. It's working now.

Jon
Previous Topic:RCP product crashes on Mac OS X 10.5.8 with JVM HotSpot 1.6.0_22 64 Bit
Next Topic:Increasing the size of a drop down of a combo
Goto Forum:
  


Current Time: Thu Apr 25 17:08:27 GMT 2024

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

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

Back to the top