Page 1 of 1

Browsing arrays

Posted: Fri Nov 11, 2005 5:07 pm
by claudio.driussi
Is possible to browse arrays?

Best Regards.
Claudio

Re: Browsing arrays

Posted: Fri Nov 11, 2005 9:02 pm
by Enrico Maria Giordano
Hi Claudio, I'm happy to see you here! This is a working sample:

Code: Select all

#include "Fwce.ch"


FUNCTION MAIN()

    LOCAL oWnd, oBrw

    LOCAL aArray := { "Test1", "Test2", "Test3" }

    LOCAL nCur := 1

    DEFINE WINDOW oWnd;
           TITLE "Browsing array"

    @ 0, 0 LISTBOX oBrw FIELDS aArray[ nCur ];
           HEADERS "Test data"

    oBrw:bLogicLen = { || Len( aArray ) }
    oBrw:bGoTop    = { || nCur := 1 }
    oBrw:bGoBottom = { || nCur := Len( aArray ) }
    oBrw:bSkip     = { | nSkip | Skipper( aArray, @nCur, nSkip ) }
    oBrw:cAlias    = "ARRAY"

    oBrw:SetFocus()

    ACTIVATE WINDOW oWnd

    RETURN NIL


STATIC FUNCTION SKIPPER( aArray, nCur, nSkip )

    LOCAL nOld := nCur

    nCur += nSkip

    IF nCur > LEN( aArray ); nCur = LEN( aArray ); ENDIF
    IF nCur < 1; nCur = 1; ENDIF

    RETURN nCur - nOld
EMG

Re: Browsing arrays

Posted: Sun Nov 13, 2005 4:43 pm
by claudio.driussi
EnricoMaria wrote:Hi Claudio, I'm happy to see you here! This is a working sample:

[snip]

EMG
Thanks, i try immediatly.
I'm here because our frend Andrea convinced me :) , i'm happy too.

Claudio.