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

Kadaitcha Man nospam.nospam.nospam at ...626...
Tue Jan 26 09:30:52 CET 2010


On 26 January 2010 18:58, Doriano Blengino
<doriano.blengino at ...1909...> wrote:
> Benoît Minisini ha scritto:
>>> Benoît,
>>>
>>> Just for that you should go with the GTK+ way :P
>>>
>>> Regards,
>>> Dimitris
>>>
>>>
>>
>> But is it really useful? We need to know how many root items a TreeView or a
>> ColumnView has, too!
>>
>>
> What about using two different properties: .Count (all the items) and
> .Children.Count (only the children of a specific node)?
> Note that by using only the second property it is possible to calculate
> the first one by scanning the children and summing up; if only one
> property has to be in existence, then the second one is more versatile
> and probably more needed in common situations.

A better idea might be to add a Nodes property.

' Count root nodes only:
NodesCount = tvMine.Nodes.Count
'Count a node's child nodes by passing the node as a parameter:
NodesCount = tvMine.Nodes[SomeHigherNode].Count

As for having two properties, the only other reason I could imagine
needing another count property is to count how many items _could_ be
visible within the current object's immediate display area. Could be,
not are.




More information about the User mailing list