Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Scrollable views
Scrollable views [message #466156] Tue, 03 January 2006 23:45 Go to next message
Dhiresh Patel  is currently offline Dhiresh Patel Friend
Messages: 86
Registered: July 2009
Member
I am completely new to Eclipse - How do we make a Scrollable view?
Re: Scrollable views [message #466193 is a reply to message #466156] Wed, 04 January 2006 19:06 Go to previous messageGo to next message
Luis Reyes is currently offline Luis ReyesFriend
Messages: 14
Registered: July 2009
Junior Member
in the createCrontol() change the parent to a scrollcomposite. create a
regular composite, and set the scroll composite to listen for changes in
composite. use the regular composite to draw everything on it.

EXAMPLE
public void createPartControl(Composite parent) {

new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
Composite container = new Composite(scrolledComposite, SWT.NONE);

ScrolledComposite scrolledComposite;
scrolledComposite.setExpandVertical(true);
scrolledComposite.setExpandHorizontal(true);

/*set the size, that when the view is this size,
the scrollbars should appear
NOTE: the next two lines are only use if expand
horizontal or vertical are used.*/
scrolledComposite.setMinHeight(600);
scrolledComposite.setMinWidth(350);

/*now we need to the tell the scrollbarcontainer
* to listen for changes in the size of container
* NOTE:if you call this method before setting the
* above params, the widget will not show, until after
* the view is manually resized by the user*/

scrolledComposite.setContent(container);

Button button = new Button(container, SWT.NONE);
button.setText("Test Button");
..
....
......

you get the idea, i guess. Good luck.
Re: Scrollable views [message #466214 is a reply to message #466193] Wed, 04 January 2006 23:03 Go to previous messageGo to next message
Dhiresh Patel  is currently offline Dhiresh Patel Friend
Messages: 86
Registered: July 2009
Member
Thank you very much- the above seems to work with only one problem-the
first time I bring up the view-the content does not show- but once I
maximize the window then the content does show up and it works(scroll
bars)-

What do I do to show content when I show the view first time?
Re: Scrollable views [message #466218 is a reply to message #466214] Wed, 04 January 2006 23:24 Go to previous message
Dhiresh Patel  is currently offline Dhiresh Patel Friend
Messages: 86
Registered: July 2009
Member
I moved scrolledComposite.setContent(container); at the end - meaning
after laying widgets on container and it seems to work

Thanks
Previous Topic:Launching a standalone swt application from within eclipse
Next Topic:SWT InputBox
Goto Forum:
  


Current Time: Thu Jun 20 04:52:32 GMT 2019

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

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

Back to the top