Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 318306 - Unable to scroll down using scroll bar when a tree has large number of TreeItems
Summary: Unable to scroll down using scroll bar when a tree has large number of TreeItems
Status: RESOLVED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.0   Edit
Hardware: PC Windows Server 2003
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-29 08:46 EDT by Janash CLA
Modified: 2019-09-02 15:08 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Janash CLA 2010-06-29 08:46:57 EDT
Build Identifier: 20100218-1602

When a Tree constains large number (>75000) of TreeItems, the scroll bar is not scrollable beyond approxinmately 10000 rows, since the thumb element of the scroll bar is positioned at the maximum. Tree is not scrollable using the scroll bar after this point. 



Reproducible: Always

Steps to Reproduce:
Please try the following cod to reproduce the issue:

	public static void main(String[] args) {
		Display display = new Display();
	    Shell shell = new Shell(display);
	    
	    shell.setLayout(new FillLayout());
	    final Tree tree = new Tree(shell, SWT.MULTI);	    
	    shell.setSize(300, 300);

	    TreeItem root = new TreeItem(tree, 0);
	    root.setText("Root Node");
	    for (int i = 0; i < 75000; i++) {
	      TreeItem item = new TreeItem(root, 0);
	      item.setText("Child Node " + i);	        
	    }
	    
	    tree.addSelectionListener(new SelectionListener() {
			
			@Override
			public void widgetSelected(SelectionEvent e) {
				System.out.println(((TreeItem[])tree.getSelection())[0].getText());
			}
			
			@Override
			public void widgetDefaultSelected(SelectionEvent e) {				
			}
		});

	    shell.open();
	    while (!shell.isDisposed()) {
	      if (!display.readAndDispatch())
	        display.sleep();
	    }
	    display.dispose();

	}


Steps:
1) Run the SWT application using the above code
2) Expand the node "Root Node" in the Tree. 
3) Scroll down using the scroll bar

Bug:
Unable to scroll down beyond "Child Node 9463", since the scroll bar thumb element is at the maximum position for this node.
Comment 1 jan CLA 2010-11-02 06:23:05 EDT
I think the bug is closely related to the bug 

https://bugs.eclipse.org/bugs/show_bug.cgi?id=307727

But I don't agree with the conclusion.

I used the enclosed sample and observed that the bar is working fine for 65333. But if the number is higher than the control behaves unexpectedly, see below. I am using Windows XP SP3.

My observations are
a) 65535 nodes - bar is not visible.
b) 100000 nodes - bar is visible but the tree is not working correctly. I can't see all nodes and if I use SW.VIRTUAL I am not getting the event SWT.SetData.

I used following example from the related bug

/*******************************************************************************
 * Copyright (c) 2000, 2004 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation

 *******************************************************************************/

/*
 * Tree example snippet: create a tree
 *
 * For a list of all SWT example snippets see
 * http://www.eclipse.org/swt/snippets/
 */
import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.layout.*;

public class Snippet15 {

	public static void main(String[] args) {
		Display display = new Display();
		Shell shell = new Shell(display);
		shell.setLayout(new FillLayout());
		final Tree tree = new Tree(shell, SWT.BORDER);

		System.out.println("Tree is starting to be built");
		TreeItem item1 = new TreeItem(tree, SWT.NULL);
		item1.setText("Node 1");

		long ms = System.currentTimeMillis();
		int i;
//		for (i = 0; i < 65533; i++) {
//		for (i = 0; i < 65535; i++) {
		for (i = 0; i < 100000; i++) {
			TreeItem item11 = new TreeItem(item1, SWT.NULL);
			item11.setText("Node " + i);
		}
		ms = System.currentTimeMillis() - ms;
		System.out.println("Bulding tree no = " + i + ", time = " + ms);

		TreeItem item2 = new TreeItem(tree, SWT.NULL);
		item2.setText("Node 2");

		for (i = 0; i < 1; i++) {
			TreeItem item21 = new TreeItem(item2, SWT.NULL);
			item21.setText("Node " + i);
		}

		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
	}
}
Comment 2 jan CLA 2010-11-02 06:28:39 EDT
To what control is tree mapped?

I found some note on web that ComCtrl32.tree has limit of 65K nodes.
Comment 3 Felipe Heidrich CLA 2010-11-02 09:17:00 EDT
(In reply to comment #2)
> To what control is tree mapped?
TreeView
http://msdn.microsoft.com/en-us/library/bb759988(v=VS.85).aspx
Comment 4 Eclipse Genie CLA 2019-01-15 16:35:30 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 5 Lars Vogel CLA 2019-09-02 15:07:55 EDT
This bug has been marked as stalebug a while ago without any further interaction.

If this report is still relevant for the current release, please reopen and remove the stalebug whiteboard flag.
Comment 6 Lars Vogel CLA 2019-09-02 15:08:48 EDT
This bug was marked as stalebug a while ago. Marking as worksforme.

If this report is still relevant for the current release, please reopen and remove the stalebug whiteboard tag.