[Gambas-user] Listview.movenext question

Stephen Bungay sbungay at ...981...
Tue Mar 25 03:26:58 CET 2008


OK, not sure what it is you are having trouble with... but to iterate 
down through a listview and pull back each item is a simple matter. Try 
this..
   Create a test program with just FMain, put a button on it and two 
listview boxes. Leave the names of these things as their defaults (i.e. 
ListView1, ListView2, Button1). Now paste this code into your form.

PUBLIC SUB Form_Open()

   WITH ListView1
        .Add("A", "Item A")
        .Add("B", "Item B")
        .Add("C", "Item C")
        .Add("D", "Item D")
        .Add("E", "Item E")
   END WITH

END


PUBLIC SUB Button1_Click()
   DIM X AS Integer

   WITH Listview1
        .MoveFirst
        FOR X = 1 TO Listview1.Count
            Listview2.Add(Listview1.Item.Key, Listview1.Item.Text)
            .MoveNext
        NEXT
   END WITH

END


   Hope this helps you out.

Steve.


   When you click on the button it will copy the contents of Listview1 
to Listview2.

richard terry wrote:
> Below is from the docs:
> 
> ListView.MoveNext (gb.qt)
> Syntax
> FUNCTION MoveNext ( ) AS Boolean
>  Moves the internal cursor to the next child item. 
>  Returns TRUE if there is no child item left.
> 
> How does one implement this in code, if one does a movement, I'd normally put:
> 
> listview.movement on a line, but how does one 'get back' the result here ie 
> the flag.
> 
> I tried bresult=listview.movenext  but get error message.
> 
> Thanks.
> 
> Richard
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> 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