[Gambas-user] TreeView does not expand

Benoit Minisini gambas at ...1...
Thu May 15 21:00:35 CEST 2008


On jeudi 15 mai 2008, Rolf-Werner Eilert wrote:
> This is on Gambas 2.6
>
> There is a TreeView, and I want the very first entry to expand. The rest
> may stay collapsed. The TreeView is called "baum" ;-)
>
> So I start like
>
>    bild = Picture["Icons/16x16/folder_green.png"]
>    baum.Add("CONTAINER", "Aktuelle Container", bild)
>    baum.Current.Expanded = TRUE
>
> but it doesn't expand.
>
> On Gambas 1 this worked as expected. Is this a bug or a feature?
>
> Thanks for your ideas.
>
> Rolf
>

Adding a treeview item does not make it "current" necessarily. But it should 
move the internal cursor to the newly added item, so you must do:

baum.Add("CONTAINER", "Aktuelle Container", bild)
baum.Item.Expanded = TRUE

Another method:

baum.Add("CONTAINER", "Aktuelle Container", bild).Expanded = True

As Add() returns the newly created item (as specified in the documentation!)

Regards,

-- 
Benoit Minisini




More information about the User mailing list