[Gambas-user] TreeView does not expand

Rolf-Werner Eilert eilert-sprachen at ...221...
Fri May 16 11:56:50 CEST 2008


Benoit Minisini schrieb:
> On vendredi 16 mai 2008, Rolf-Werner Eilert wrote:
>> Benoit Minisini schrieb:
>>> 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,
>> Sorry, but this doesn't help either. Everything remains collapsed until
>> you double-click it or click its + sign.
>>
>>
>> Any other idea?
>>
>> Rolf
>>
>>
> 
> Note that if your item does not have any child, it will not expand.
> 

Yes, logically! (In contrary to the old Gambas 1 behaviour, it seems)

Now I found a solution: At the end of all adding items I jump back and 
expand it:

   baum.MoveFirst
   baum.item.Expanded = TRUE

This way it'r running smoothly.

Thanks

Rolf





More information about the User mailing list