Bug 270931 - Tree.setTopItem does not work with SWT.NO_SCROLL
Summary: Tree.setTopItem does not work with SWT.NO_SCROLL
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.4.1   Edit
Hardware: PC Windows XP
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Felipe Heidrich CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-02 05:02 EDT by Martin W CLA
Modified: 2019-09-06 16:08 EDT (History)
2 users (show)

See Also:


Attachments
Bug demo (1.35 KB, text/x-java)
2009-04-02 05:02 EDT, Martin W CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin W CLA 2009-04-02 05:02:58 EDT
Created attachment 130661 [details]
Bug demo

Build ID: M20080911-1700

Steps To Reproduce:
1. Create a tree with style SWT.NO_SCROLL
2. Call Tree.setTopItem (e.g. by a button)


More information:
The method for tables (Table.setTopIndex) is working for tables with SWT.NO_SCROLL.
Comment 1 Felipe Heidrich CLA 2009-04-02 11:37:23 EDT
Steve, on windows the SWT.NO_SCROLL Tree doesn't scroll at all (arrow down moves the selection but doesn't scroll to ensure the selection is visible).

Is that by design ?
(note, GTK behaves differently)

Apparently, 
OS.SendMessage (handle, OS.TVM_SELECTITEM, OS.TVGN_FIRSTVISIBLE, hItem);
is a no-op when OS.TVS_NOSCROLL is set.

I was able the fix setItemCount() using this:
OS.SetWindowLong(handle, OS.GWL_STYLE, style & ~OS.TVS_NOSCROLL);
OS.SendMessage (handle, OS.TVM_SELECTITEM, OS.TVGN_FIRSTVISIBLE, hItem);
OS.SetWindowLong(handle, OS.GWL_STYLE, style);

Maybe the same fix is needed in all places we send OS.TVM_SELECTITEM.
Comment 2 Steve Northover CLA 2009-04-02 11:59:58 EDT
This is not by design.
Comment 3 Eclipse Webmaster CLA 2019-09-06 16:08:19 EDT
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.