[Gambas-user] How to search for an item in a treeview

Benoit Minisini gambas at ...1...
Wed Mar 26 21:00:03 CET 2008


On mercredi 26 mars 2008, jbskaggs wrote:
> I would have the program movenext thru each item starting at movefirst and
> run the instr function on each string for each treeview.item until you get
> a hit.
>
> I do this to search for specific key words in text, keys, images in my
> treeview.  Im  newbie so this may not work exactly right but this worked
> for me.
>
> sample:
>
> dim j as string
> dim i as integer
> j="yoursearchstring"
> yourtreeview.movefirst
> for i = 1 to yourtreeview.count
>      yourtreeview.item.selected=true
>         if instr(yourtreeview.item.text, j)>0
>         do your code here
>         endif
>      yourtreeview.movenext
> next
>
> JB SKaggs
>

It does not work if any item has child item. You must replace MoveNext by 
MoveBelow, and use the next 2.5 version. :-)

Regards,

-- 
Benoit Minisini




More information about the User mailing list