[Gambas-user] TreeView.Count value differs using qt rather than gtk

Doriano Blengino doriano.blengino at ...1909...
Tue Jan 26 11:35:07 CET 2010


Kadaitcha Man ha scritto:
> 2010/1/26 Doriano Blengino <doriano.blengino at ...1909...>:
>
>   
>> Actually I expressed myself badly. Example:
>>     
>
> Actually, I express myself badly quite often. Example:
>
> [CENSORED] [CENSORED] [CENSORED] [CENSORED]!
>
> :)
>
> As for this:
>
> [QUOTE]
> Tree1:
>  - item0
>  - item1
>    - item1.0
>
> Tree1.count is  3      (global count)
> [QUOTE]
>
> Unless you expressed yourself badly again I disagree. :)
>
> The count is one. One root. One tree.
>   
Tree1 is a TreeView, not a node. Its Count property counts all the 
items. Tree1.Children is another property which lets you gain access to 
the... children (but not grandchildren).

item1.count counts up all the children and grandchildren; 
item1.children.count counts the immediate children and not 
grandchildren. See the logical parallelism with Tree1, which is not a 
node but can be seen as it was - in fact, the TreeView is the root node 
of every other item.

This syntax lets you know and navigate everything in a treeview without 
iterators; it is consistent and logical and easy to use. By saying 
"Children", children (and not grandchildren) is meant. By saying 
"Count", count of elements (not only children) is meant.
What do you want more? Some beer? :-)

This is a more general problem of gambas syntax. Is Listbox1[5] the 
sixth element of an array of listboxes, or the sixth element of 
Listbox1? I never tried to make array of listboxes, but wonder if 
Listbox1[5][2] works... and Listbox1[5,2] would be even worse.

So, TreeView1.Children[0] would be a coherent way to address the first 
children, and MyTreeView[0].Children[0] would be the first children of 
the first treeview of my array.

Regards,
Doriano




More information about the User mailing list