Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » TreeItem expansion strategy
TreeItem expansion strategy [message #454682] Wed, 27 April 2005 13:32 Go to next message
Max Rotvel is currently offline Max RotvelFriend
Messages: 21
Registered: July 2009
Junior Member
I have a two-layered Tree where I want all the topitems to be expanded
at creation time.

If I call setExpanded(true) on the topitems, before adding the subitems,
they are not expanded. If I call setExpanded(true) after adding the
subitems, the topitems are expanded properly.

Is this behaviour intentional? unavoidable? a bug?

Regards
--
Max - rotvel AT bolignet-aarhus DOT dk
Re: TreeItem expansion strategy [message #454787 is a reply to message #454682] Thu, 28 April 2005 17:00 Go to previous messageGo to next message
Emil Crumhorn is currently offline Emil CrumhornFriend
Messages: 169
Registered: July 2009
Senior Member
Sound like correct behavior to me. If the parent has no children, how can it
expand to show what it doesn't have?

I realize you want setExpanded to end up like a flag on the folder so when
stuff is added to it, it knows it's supposed to be expanded and does so.

If you use a TreeViewer with content providers and such, you could create
your own listeners on the treenode objects that could do it the way you
wanted. Simply store an expanded boolean flag on the node, and when children
get added you check to see if it's true, and then expand.

Hope that helps.

Emil

"Max Rotvel" <rotvel@bolignet-aarhus.dk> wrote in message
news:op.spv7wzkp94ko3h@trixie.katlan...
>I have a two-layered Tree where I want all the topitems to be expanded
> at creation time.
>
> If I call setExpanded(true) on the topitems, before adding the subitems,
> they are not expanded. If I call setExpanded(true) after adding the
> subitems, the topitems are expanded properly.
>
> Is this behaviour intentional? unavoidable? a bug?
>
> Regards
> --
> Max - rotvel AT bolignet-aarhus DOT dk
Re: TreeItem expansion strategy [message #454844 is a reply to message #454787] Sun, 01 May 2005 08:51 Go to previous message
Max Rotvel is currently offline Max RotvelFriend
Messages: 21
Registered: July 2009
Junior Member
Ok, thanks for the clarification. It would be nice with the described
'flaglike'
behavior, but it's no big deal working around it in my project.

On Thu, 28 Apr 2005 19:00:53 +0200, Emil Crumhorn <crumhorn@speakeasy.net>
wrote:

> Sound like correct behavior to me. If the parent has no children, how
> can it
> expand to show what it doesn't have?
>
> I realize you want setExpanded to end up like a flag on the folder so
> when
> stuff is added to it, it knows it's supposed to be expanded and does so.
[snip]

> "Max Rotvel" <rotvel@bolignet-aarhus.dk> wrote in message
> news:op.spv7wzkp94ko3h@trixie.katlan...
>> I have a two-layered Tree where I want all the topitems to be expanded
>> at creation time.
>>
>> If I call setExpanded(true) on the topitems, before adding the subitems,
>> they are not expanded. If I call setExpanded(true) after adding the
>> subitems, the topitems are expanded properly.
[snip]

Regards
--
Max - rotvel AT bolignet-aarhus DOT dk
Previous Topic:Use swt's progressbar during long period operation accurately?
Next Topic:Problem launching Eclipse Help system from SWT app
Goto Forum:
  


Current Time: Fri Apr 19 21:22:22 GMT 2024

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

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

Back to the top