Scrollable List [message #445270] |
Mon, 01 November 2004 06:21  |
Eclipse User |
|
|
|
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 #445568 is a reply to message #445279] |
Mon, 08 November 2004 09:46  |
Eclipse User |
|
|
|
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
>> >
>> >
>>
>>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.06295 seconds