Files
harbour-core/harbour/tests/brwpos.prg
Viktor Szakats 232f180695 2012-07-19 10:23 UTC+0200 Viktor Szakats (harbour syenar.net)
* tests/arrayidx.prg
  * tests/brwpos.prg
  * tests/clasinit.prg
  * tests/clsicast.prg
  * tests/clsscast.prg
  * tests/clsscope.prg
  * tests/codebl.prg
  * tests/codebloc.prg
  * tests/cpinfo.prg
  * tests/db_brows.prg
  * tests/destruct.prg
  * tests/dynobj.prg
  * tests/flink.prg
  * tests/fortest.prg
  * tests/fsplit.prg
  * tests/inherit.prg
  * tests/keywords.prg
  * tests/multiarg.prg
  * tests/newrdd.prg
  * tests/onidle.prg
  * tests/overload.prg
  * tests/rto_get.prg
  * tests/setkeys.prg
  * tests/speedtst.prg
  * tests/stripem.prg
  * tests/tb1.prg
  * tests/testbrw.prg
  * tests/testdbf.prg
  * tests/testhtml.prg
  * tests/testwarn.prg
  * tests/tstblock.prg
  * tests/tstmacro.prg
  * tests/wvtext.prg
    * more cleanups
2012-07-19 08:26:32 +00:00

71 lines
1.7 KiB
Plaintext

/*
* $Id$
*/
/* TEST BROWSE ROWPOS FOR COMPILER IN CLIPPER AND HARBOUR */
STATIC s_nRecNo := 1
STATIC s_nLastRec := 100
STATIC s_lFixPos := .F.
PROCEDURE Main()
LOCAL nRow := 1
CLS
@ 0, 4 SAY "Is current RecNo but not repositioned until FixPos .T. <F2> Change FixPos"
@ MaxRow(), 1 SAY "Please press <Intro> to select or <Esc> to exit and <F2> to FixPos is "
WHILE LastKey() != 27
@ 0, 0 SAY s_nRecNo PICTURE "###"
@ MaxRow(), 68 SAY iif( s_lFixPos, ".T.", ".F." )
nRow := TestBrw( nRow )
ENDDO
RETURN
FUNCTION TestBrw( nRowIni )
LOCAL nKey, oBrw := TBRowseNew( 1, 0, MaxRow() - 1, MaxCol() )
oBrw:SkipBlock := {| n | n := iif( n < 0, Max( n, 1 - s_nRecNo ), ;
Min( s_nLastRec - s_nRecNo, n ) ), ;
s_nRecNo += n, n }
oBrw:GoTopBlock := {|| s_nRecNo := 1 }
oBrw:GoBottomBlock := {|| s_nRecNo := s_nLastRec }
oBrw:AddColumn( TBColumnNew( "RecNo #", {|| s_nRecNo } ) )
IF s_lFixPos .AND. nRowIni > 1
Eval( oBrw:skipBlock, 1 - nRowIni )
ENDIF
oBrw:rowPos := nRowIni
WHILE .T.
WHILE ! oBrw:stabilize()
ENDDO
nKey := Inkey( 0 )
IF nKey == 27 .OR. nKey == 13
EXIT
ELSEIF nKey == -1
s_lFixPos := iif( s_lFixPos, .F. , .T. )
EXIT
ELSEIF nKey == 24
oBrw:Down()
ELSEIF nKey == 5
oBrw:Up()
ELSEIF nKey == 3
oBrw:pageDown()
ELSEIF nKey == 18
oBrw:pageUp()
ELSEIF nKey == 29 .OR. nKey == 31
oBrw:goTop()
ELSEIF nKey == 23 .OR. nKey == 30
oBrw:goBottom()
ELSEIF nKey == 1
oBrw:rowPos := 1
ELSEIF nKey == 6
oBrw:rowPos := s_nLastRec
ENDIF
ENDDO
RETURN oBrw:rowPos