Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Tree.setTopItem fails?(Checking the top item after a call to Tree.setTopItem results in different items)
Tree.setTopItem fails? [message #502515] Tue, 08 December 2009 16:15 Go to next message
Steffen Harbich is currently offline Steffen HarbichFriend
Messages: 7
Registered: September 2009
Location: Germany
Junior Member
Hi,

found something strange with the tree widget:

1.) If I set a tree item as top item that can't be the top item because there are not enough items below it (for example the last item visible) then the tree jumps to the top root item, i.e. it scrolls to the top. Is this a bug or feature? I think it would be more logical to scroll to the end of the tree.

2.) I call Tree.setTopItem and thereafter the method Tree.getTopItem and sometimes the items differ. The tree item I want to have as top item wasn't set as desired. This occurs even when the tree item is at the middle of the large tree, i.e. there are enough tree items below it such that it should be possible to set it as top item. (note: setting the top item is done after a refresh and a reveal of that item in the tree viewer)

The behavior is observed under Windows 2k and Eclipse 3.2 in a large tree which is managed by TreeViewer, scroll bars are both shown.

Any ideas what's the problem?

Regards,
Steffen
Re: Tree.setTopItem fails? [message #502672 is a reply to message #502515] Wed, 09 December 2009 11:16 Go to previous messageGo to next message
Steffen Harbich is currently offline Steffen HarbichFriend
Messages: 7
Registered: September 2009
Location: Germany
Junior Member
Observed also for SWT 3.4.1.

And I found a possible reason for this: If I do not use Control.setRedraw enclosing the setTopItem method, then it works as aspected!

Unfortunately, I can't provide a clean example that shows the issue because my clean example does not show the wrong behavoir.

Hope this helps to find out what's going wrong here.

Steffen
Re: Tree.setTopItem fails? [message #503064 is a reply to message #502672] Thu, 10 December 2009 12:58 Go to previous message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2151
Registered: July 2009
Senior Member
Hi Steffen,

It should be safe to enclose invocations like these within
setRedraw(false/true) and still get the correct results. I've tried with
swt's 3.4.2 release and cannot make a case of this that fails either, so
it's difficult to investigate further. Maybe the use of TreeViewer is
somehow involved? Are you able to hack your application that shows the
problem to not use the TreeViewer and see if this makes a difference?

Grant


"Steffen Harbich" <raubvogel87@googlemail.com> wrote in message
news:hfo0us$ovp$1@build.eclipse.org...
> Observed also for SWT 3.4.1.
>
> And I found a possible reason for this: If I do not use Control.setRedraw
enclosing the setTopItem method, then it works as aspected!
>
> Unfortunately, I can't provide a clean example that shows the issue
because my clean example does not show the wrong behavoir.
>
> Hope this helps to find out what's going wrong here.
>
> Steffen
Previous Topic:SWT widget not displayed
Next Topic:Help to build SWT JNI libraries
Goto Forum:
  


Current Time: Thu Nov 27 02:12:10 GMT 2014

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

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