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

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


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






More information about the User mailing list