[Gambas-user] TreeView internal cursor

Timothy Marshal-Nichols timothy.marshal-nichols at ...247...
Tue Oct 17 14:55:04 CEST 2006


> -----Original Message-----
> From: gambas-user-bounces at lists.sourceforge.net [mailto:gambas-user-
> bounces at lists.sourceforge.net] On Behalf Of Christopher Brian Jack
> Sent: 17 October 2006 07:10
> To: Gambas-Users List
> Subject: [Gambas-user] TreeView internal cursor
> 
> 
> In my workings with this control I discovered it would be really
useful to
> be able to store/retrieve internal cursor states such as in recursive
code
> to visit every item in the tree either in breadth-first or depth-first
> recursive traversal routines.  The virtual TreeViewItem won't work for
> this so perhaps a way to store/retrieve the cursor would be helpful.
> 
> In the abscence of something like that how about an iterator operation
> that guarantees just to hit every object in the TreeView when
> niether hierarchy nor order is important.  The hierarchical operations
> are, without being able to save/recover the internal cursor methods
are
> awkward to work with.
> 

It already does - at least for the gb.qt TreeView. Though it might not
be very well documented. Use MoveBelow() as in this example:

  ' Go to the first item
  IF TreeView1.MoveFirst() THEN
    REPEAT
      ' Do what you need with the tree view item

    ' Next item in the TreeView
    UNTIL TreeView1.MoveBelow()
  END IF

This will visit every item in the TreeView. (Not sure if it works with
Gambas 1.0.xx)

Thanks

8-) Timothy Marshal-Nichols
<mailto: timothy.marshal-nichols at ...247...>








More information about the User mailing list