Problem with ScrolledComposite drawing a long list of Labels [message #499552] |
Mon, 23 November 2009 10:21 |
Eclipse User |
|
|
|
Originally posted by: stefan.noebauer.kgu-consulting.de
Hi,
I Have a problem with the Scrolled Composite listing a long list of labels.
I used the snippet166 with small changes to verify that same phenomenon. I
tried to add 2000 Labels to the Composite but only about 1800 where drawn.
Is there a limit on the scrolled Composite?
I use RCP 3.3.2.
My Code Sample:
public class Snippet166 {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
final ScrolledComposite scrollComposite = new
ScrolledComposite(shell,
SWT.V_SCROLL | SWT.BORDER);
final Composite parent = new Composite(scrollComposite, SWT.NONE);
for (int i = 0; i <= 2000; i++) {
Label label = new Label(parent, SWT.BORDER);
label.setText(String.valueOf(i));
}
parent.pack();
RowLayout layout = new RowLayout(SWT.VERTICAL);
layout.wrap = true;
parent.setLayout(layout);
scrollComposite.setContent(parent);
scrollComposite.setExpandVertical(true);
scrollComposite.setExpandHorizontal(true);
scrollComposite.addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
Rectangle r = scrollComposite.getClientArea();
scrollComposite.setMinSize(parent.computeSize(r.width,
SWT.DEFAULT));
}
});
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}
--
Erstellt mit Operas revolutionärem E-Mail-Modul: http://www.opera.com/mail/
|
|
|
|
Re: Problem with ScrolledComposite drawing a long list of Labels [message #499792 is a reply to message #499640] |
Tue, 24 November 2009 07:48 |
Eclipse User |
|
|
|
Originally posted by: stefan.noebauer.kgu-consulting.de
I tryed the Gallary Composite of Eclipse Nebula. Why is that Composite
working with a very long list of items? Or is that component not using the
scrolled Composite?
Am 23.11.2009, 16:23 Uhr, schrieb Grant Gayed <grant_gayed@ca.ibm.com>:
> Hi,
>
> Yes, there is a width/height limit of 32767, and
> "parent.computeSize(SWT.DEFAULT, SWT.DEFAULT)" indicates that the
> snippet's
> height is exceeding this. Unfortunately this limit is imposed by the OS,
> and there's no workaround other than to re-work the UI layout to not
> require
> as much height or height.
>
> Grant
>
>
> "Stefan Nöbauer" <stefan.noebauer@kgu-consulting.de> wrote in message
> news:op.u3ue1pmg011itz@kgu04.kgu-intern.local...
>> Hi,
>>
>> I Have a problem with the Scrolled Composite listing a long list of
> labels.
>>
>> I used the snippet166 with small changes to verify that same
>> phenomenon. I
>> tried to add 2000 Labels to the Composite but only about 1800 where
>> drawn.
>> Is there a limit on the scrolled Composite?
>>
>> I use RCP 3.3.2.
>>
>>
>> My Code Sample:
>>
>> public class Snippet166 {
>>
>> public static void main(String[] args) {
>> Display display = new Display();
>> Shell shell = new Shell(display);
>> shell.setLayout(new FillLayout());
>>
>> final ScrolledComposite scrollComposite = new
>> ScrolledComposite(shell,
>> SWT.V_SCROLL | SWT.BORDER);
>>
>> final Composite parent = new Composite(scrollComposite,
> SWT.NONE);
>> for (int i = 0; i <= 2000; i++) {
>> Label label = new Label(parent, SWT.BORDER);
>> label.setText(String.valueOf(i));
>> }
>>
>> parent.pack();
>>
>> RowLayout layout = new RowLayout(SWT.VERTICAL);
>> layout.wrap = true;
>> parent.setLayout(layout);
>>
>> scrollComposite.setContent(parent);
>> scrollComposite.setExpandVertical(true);
>> scrollComposite.setExpandHorizontal(true);
>> scrollComposite.addControlListener(new ControlAdapter() {
>> @Override
>> public void controlResized(ControlEvent e) {
>> Rectangle r = scrollComposite.getClientArea();
>> scrollComposite.setMinSize(parent.computeSize(r.width,
>> SWT.DEFAULT));
>> }
>> });
>>
>> shell.open();
>> while (!shell.isDisposed()) {
>> if (!display.readAndDispatch()) {
>> display.sleep();
>> }
>> }
>> display.dispose();
>> }
>> }
>>
>>
>>
>> --
>> Erstellt mit Operas revolutionärem E-Mail-Modul:
> http://www.opera.com/mail/
>
>
--
Erstellt mit Operas revolutionärem E-Mail-Modul: http://www.opera.com/mail/
|
|
|
|
Powered by
FUDForum. Page generated in 0.01533 seconds