Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Scrollable List
Scrollable List [message #445270] Mon, 01 November 2004 11:21 Go to next message
Eclipse UserFriend
Originally posted by: guru.prasad.exaltec.com

Hi,

I am having problems implementing scrollable List. Has any one experienced
same problem.

I am extending standard Dialog functionality for simple selection (as per
documentation).

here is the snippit of code

protected Control createDialogArea(Composite parent) {
Composite composite = (Composite)super.createDialogArea(parent);

list = new List(composite,
SWT.BORDER|SWT.SINGLE|SWT.V_SCROLL|SWT.H_SCROLL);

try{
for (int i = 0; i < 100; i++) {
String listElement = "test String";
list.add(listElement);
}

}catch(CoreException ex){
}

viewer = new ListViewer(list);

return composite;
}

no scrollbars appears!

Guru Prasad
Re: Scrollable List [message #445277 is a reply to message #445270] Mon, 01 November 2004 14:39 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
Did you set the size of the list? Assuming you are using a layout, the list
will be resized such that no scroll bars are necessary. Check out the width
and height hints for layout to set the size.

"Guru Prasad" <guru.prasad@exaltec.com> wrote in message
news:cm566s$uut$1@eclipse.org...
> Hi,
>
> I am having problems implementing scrollable List. Has any one
experienced
> same problem.
>
> I am extending standard Dialog functionality for simple selection (as per
> documentation).
>
> here is the snippit of code
>
> protected Control createDialogArea(Composite parent) {
> Composite composite = (Composite)super.createDialogArea(parent);
>
> list = new List(composite,
> SWT.BORDER|SWT.SINGLE|SWT.V_SCROLL|SWT.H_SCROLL);
>
> try{
> for (int i = 0; i < 100; i++) {
> String listElement = "test String";
> list.add(listElement);
> }
>
> }catch(CoreException ex){
> }
>
> viewer = new ListViewer(list);
>
> return composite;
> }
>
> no scrollbars appears!
>
> Guru Prasad
>
>
Re: Scrollable List [message #445279 is a reply to message #445277] Mon, 01 November 2004 15:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: guru.prasad.exaltec.com

Thanks Steve,

I want to create simple dialog based list control. Unfortunately the dialog
implementation is supporting scroll feature. (I have tried all possibilities
of setting size, none worked). the work around is instard of using default
dialog initialization (createDialogArea Method) and creaging
ScrolledComposite instand of Composite. Is there any otherway sompler than
that?

Kind Regards,
Guru PRasad

"Steve Northover" <steve_northover@ca.ibm.com> wrote in message
news:cm5hqk$it6$1@eclipse.org...
> Did you set the size of the list? Assuming you are using a layout, the
list
> will be resized such that no scroll bars are necessary. Check out the
width
> and height hints for layout to set the size.
>
> "Guru Prasad" <guru.prasad@exaltec.com> wrote in message
> news:cm566s$uut$1@eclipse.org...
> > Hi,
> >
> > I am having problems implementing scrollable List. Has any one
> experienced
> > same problem.
> >
> > I am extending standard Dialog functionality for simple selection (as
per
> > documentation).
> >
> > here is the snippit of code
> >
> > protected Control createDialogArea(Composite parent) {
> > Composite composite = (Composite)super.createDialogArea(parent);
> >
> > list = new List(composite,
> > SWT.BORDER|SWT.SINGLE|SWT.V_SCROLL|SWT.H_SCROLL);
> >
> > try{
> > for (int i = 0; i < 100; i++) {
> > String listElement = "test String";
> > list.add(listElement);
> > }
> >
> > }catch(CoreException ex){
> > }
> >
> > viewer = new ListViewer(list);
> >
> > return composite;
> > }
> >
> > no scrollbars appears!
> >
> > Guru Prasad
> >
> >
>
>
Re: Scrollable List [message #445568 is a reply to message #445279] Mon, 08 November 2004 14:46 Go to previous message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
Chances are, the parent for your List has a GridLayout. You can verify this
by calling:

System.out.println(parent.getLayout());

Assuming the parent has a GridLayout, you can fix the height of the List by
setting the GridData.heightHint:

GridData data = new GridData();
data.heightHint = 150;
myList.setLayoutData(data);

See:
http://www.eclipse.org/articles/Understanding%20Layouts/Unde rstanding%20Layouts.htm

"Guru Prasad" <guru.prasad@exaltec.com> wrote in message
news:cm5j8s$lqh$1@eclipse.org...
> Thanks Steve,
>
> I want to create simple dialog based list control. Unfortunately the
> dialog
> implementation is supporting scroll feature. (I have tried all
> possibilities
> of setting size, none worked). the work around is instard of using default
> dialog initialization (createDialogArea Method) and creaging
> ScrolledComposite instand of Composite. Is there any otherway sompler than
> that?
>
> Kind Regards,
> Guru PRasad
>
> "Steve Northover" <steve_northover@ca.ibm.com> wrote in message
> news:cm5hqk$it6$1@eclipse.org...
>> Did you set the size of the list? Assuming you are using a layout, the
> list
>> will be resized such that no scroll bars are necessary. Check out the
> width
>> and height hints for layout to set the size.
>>
>> "Guru Prasad" <guru.prasad@exaltec.com> wrote in message
>> news:cm566s$uut$1@eclipse.org...
>> > Hi,
>> >
>> > I am having problems implementing scrollable List. Has any one
>> experienced
>> > same problem.
>> >
>> > I am extending standard Dialog functionality for simple selection (as
> per
>> > documentation).
>> >
>> > here is the snippit of code
>> >
>> > protected Control createDialogArea(Composite parent) {
>> > Composite composite =
>> > (Composite)super.createDialogArea(parent);
>> >
>> > list = new List(composite,
>> > SWT.BORDER|SWT.SINGLE|SWT.V_SCROLL|SWT.H_SCROLL);
>> >
>> > try{
>> > for (int i = 0; i < 100; i++) {
>> > String listElement = "test String";
>> > list.add(listElement);
>> > }
>> >
>> > }catch(CoreException ex){
>> > }
>> >
>> > viewer = new ListViewer(list);
>> >
>> > return composite;
>> > }
>> >
>> > no scrollbars appears!
>> >
>> > Guru Prasad
>> >
>> >
>>
>>
>
>
Previous Topic:Detachable Composite
Next Topic:Cannot drag from SWT, drop on Swing/AWT in certain linux configurations
Goto Forum:
  


Current Time: Fri Apr 26 09:42:32 GMT 2024

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

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

Back to the top