Help with XBrowse

Help with XBrowse

Postby Enrico Maria Giordano » Fri Feb 05, 2010 5:52 pm

In the following sample, if I click on a row (ie. the last row) the clicked row moves up. Why?

Code: Select all  Expand view
#include "Fivewin.ch"
#include "XBrowse.ch"


FUNCTION MAIN()

    LOCAL oDlg, oBrw

    LOCAL aArray := { { "Row1-Col1", "Row1-Col2", "Row1-Col3" },;
                      { "Row2-Col1", "Row2-Col2", "Row2-Col3" },;
                      { "Row3-Col1", "Row3-Col2", "Row3-Col3" },;
                      { "Row4-Col1", "Row4-Col2", "Row4-Col3" } }

    LOCAL nCur := 1

    DEFINE DIALOG oDlg;
           SIZE 800, 600

    @ 0, 0 XBROWSE oBrw FIELDS aArray[ nCur, 1 ],;
                               aArray[ nCur, 2 ],;
                               aArray[ nCur, 3 ];
           HEADERS "COL1", "COL2", "COL3";
           ARRAY aArray

    oBrw:CreateFromCode()

    oBrw:bGoTop    = { || nCur := 1 }
    oBrw:bGoBottom = { || nCur := Len( aArray ) }
//    oBrw:bBof      = { || nCur = 1 }
//    oBrw:bEof      = { || nCur = Len( aArray ) }
//    oBrw:bKeyCount = { || Len( aArray ) }
//    oBrw:bPastEof  = { || nCur > Len( aArray ) }
    oBrw:bBookMark = { | nBkm | If( nBkm == nil, nCur, nCur := nBkm ) }
    oBrw:bSkip     = { | nSkip | Skipper( aArray, @nCur, nSkip ) }

    ACTIVATE DIALOG oDlg;
             ON INIT oDlg:SetControl( oBrw );
             CENTER

    RETURN NIL


STATIC FUNCTION SKIPPER( aArray, nCur, nSkip )

    LOCAL nOld := nCur

    DEFAULT nSkip := 1

    nCur += nSkip

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

    RETURN nCur - nOld


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Help with XBrowse

Postby Enrico Maria Giordano » Fri Feb 05, 2010 5:54 pm

And, by the way, how to activate autosort in all the column while browsing an array? Any better array browsing sample than mine?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Help with XBrowse

Postby anserkk » Fri Feb 05, 2010 6:16 pm

I beleive that xBrowse does all the settings automatically

@0.0 XBROWSE oBrw ARRAY aArray

oBrw:CreateFromCode()

Rest it will set automatically

Regards
Anser
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Help with XBrowse

Postby nageswaragunupudi » Fri Feb 05, 2010 6:21 pm

This is the code
Code: Select all  Expand view
#include "Fivewin.ch"
#include "XBrowse.ch"


FUNCTION MAIN()

    LOCAL oDlg, oBrw

    LOCAL aArray := { { "Row1-Col1", "Row1-Col2", "Row1-Col3" },;
                      { "Row2-Col1", "Row2-Col2", "Row2-Col3" },;
                      { "Row3-Col1", "Row3-Col2", "Row3-Col3" },;
                      { "Row4-Col1", "Row4-Col2", "Row4-Col3" } }




    DEFINE DIALOG oDlg;
           SIZE 800, 600


    @ 10,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
         COLUMNS 1, 2, 3 ;
         HEADERS 'COL1', 'COL2', 'COL3' ;
         ARRAY aArray ;
         AUTOSORT ; // for auto-sorting
         CELL LINES NOBORDER // optinal

    oBrw:CreateFromCode()

    ACTIVATE DIALOG oDlg CENTERED

return nil
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10627
Joined: Sun Nov 19, 2006 5:22 am
Location: India



Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 87 guests