[Gambas-user] How to read keys from a TreeView in Gambas2?

Rolf-Werner Eilert eilert-sprachen at ...221...
Mon Jan 12 16:16:30 CET 2009


Yes it does work - no idea why I didn't see it's so simple...

And what do you think about Benoit's way? It disposes of the BREAK thing 
and seems much more "tailored" to the TreeView class to me than my own code.

Rolf


Gareth Bult schrieb:
>> MoveBelow doesn't seem to exist anymore (Gambas2 won't show an 
> 
> Is MoveBelow (and MoveChild etc..) not a method of "TreeView" rather than "TreeViewItem" .. ?
> 
> Does it work if you use;
> 
>      FOR i = 1 TO baum.Current.Children
> ==>    baum.MoveBelow
>        IF Left$(baum.Item.Key, 1) = "#" THEN
>          namenKeys.Add(baum.Item.Key)
>        ELSE
>          BREAK
>        END IF
>      NEXT
> 
> ??
> 
> Gareth.
> 
> ----- Original Message -----
> From: "Rolf-Werner Eilert" <eilert-sprachen at ...221...>
> To: "mailing list for gambas users" <gambas-user at lists.sourceforge.net>
> Sent: Thursday, 8 January, 2009 10:44:20 AM GMT +00:00 GMT Britain, Ireland, Portugal
> Subject: [Gambas-user] How to read keys from a TreeView in Gambas2?
> 
> Proceeding to convert a Gambas1 app to Gambas2, I found that reading key 
> values or stepping through the values is different now.
> 
> The TreeView shows names of persons sorted under groups/classes/filters 
> sorted under years sorted under a root header, in brief:
> 
> Root1
> 	2004
> 	2005
> 	2006
> 		Group1
> 		Group2 <-- Cursor
> 			John
> 			Benoit
> 			Michael
> 			Rolf
> 		Group3
> 	2007
> 	2008
> Root2
> 
> What I want is when the cursor is on Group2 and I call my function, it 
> expands and reads all keys of the names within this group.
> 
> This is the code in Gambas1:
> 
>      baum.Current.Expanded = TRUE
> 
>      namenKeys.Clear
> 
>      FOR i = 1 TO baum.Current.Children
>        baum.Item.MoveBelow
>        IF Left$(baum.Item.Key, 1) = "#" THEN
>          namenKeys.Add(baum.Item.Key)
>        ELSE
>          BREAK
>        END IF
>      NEXT
> 
> "baum" is the TreeView, "namenKeys" is an array that should return the 
> keys which were found. The idea was to read the keys either up to the 
> number of children or until the next key doesn't have a "#".
> 
> This doesn't run in Gambas2 this way, but I didn't find a way to make it 
> run. MoveBelow doesn't seem to exist anymore (Gambas2 won't show an 
> error, however), and I tried any possible combination of using 
> MoveAfter() with Item and Current, but to no avail.
> 
> So, can anybody help here?
> 
> Thanks so much!
> 
> Rolf
> 
> ------------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It is the best place to buy or sell services for
> just about anything Open Source.
> http://p.sf.net/sfu/Xq1LFB
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
> 





More information about the User mailing list