Files
harbour-core/harbour/tests/brwpos.prg
Viktor Szakats 7d17a485e2 2012-10-15 12:20 UTC+0200 Viktor Szakats (harbour syenar.net)
* contrib/hbformat/hbfmtcls.prg
    * new TOFIX:
        ".T.," / ".F.," gets wrongly corrected to ".T. ," / ".F. ,"

  * contrib/hbct/tests/atrepl.prg
  * contrib/hbct/tests/ctwtest.prg
  * contrib/hbct/tests/datetime.prg
  * contrib/hbgd/gdbar.prg
  * contrib/hbgd/gdbarcod.prg
  * contrib/hbgd/tests/barms.prg
  * contrib/hbgd/tests/bartest.prg
  * contrib/hbgd/tests/gdtestcl.prg
  * contrib/hbgd/tests/test_out.prg
  * contrib/hbhpdf/tests/harupdf.prg
  * contrib/hbmisc/fcomma.prg
  * contrib/hbnf/calendar.prg
  * contrib/hbnf/dispmsg.prg
  * contrib/hbnf/floptst.prg
  * contrib/hbnf/ftround.prg
  * contrib/hbnf/mouse1.prg
  * contrib/hbnf/pegs.prg
  * contrib/hbnf/popadder.prg
  * contrib/hbnf/tempfile.prg
  * contrib/hbnf/tests/aading.prg
  * contrib/hbnf/tests/calendar.prg
  * contrib/hbnf/tests/clrsel.prg
  * contrib/hbnf/tests/dispmsg.prg
  * contrib/hbnf/tests/findith.prg
  * contrib/hbnf/tests/menu1.prg
  * contrib/hbnf/tests/tbwhile.prg
  * contrib/hbnf/tests/vertmenu.prg
  * contrib/hbsqlit3/tests/authoriz.prg
  * contrib/hbsqlit3/tests/backup.prg
  * contrib/hbsqlit3/tests/hooks.prg
  * contrib/hbsqlit3/tests/metadata.prg
  * contrib/hbsqlit3/tests/pack.prg
  * contrib/hbsqlit3/tests/sl3_test.prg
  * contrib/hbtip/sendmail.prg
  * contrib/hbtip/tests/base64.prg
  * contrib/hbtip/tests/httpadv.prg
  * contrib/hbtip/thtml.prg
  * contrib/hbtpathy/telepath.prg
  * contrib/hbwin/tests/testole.prg
  * contrib/rddads/tests/datad.prg
  * contrib/rddads/tests/testmg.prg
  * contrib/rddsql/tests/arrayrdd.prg
  * contrib/sddmy/tests/test1.prg
  * contrib/sddoci/tests/test1.prg
  * contrib/sddodbc/tests/test1.prg
  * contrib/sddodbc/tests/test2.prg
  * contrib/sddsqlt3/tests/test1.prg
  * contrib/xhb/dumpvar.prg
  * contrib/xhb/hblog.prg
  * contrib/xhb/trpc.prg
  * contrib/xhb/trpccli.prg
  * contrib/xhb/ttable.prg
  * contrib/xhb/xcstr.prg
  * contrib/xhb/xhberr.prg
  * contrib/xhb/xhbtedit.prg
  * extras/gtwvw/tests/cbtest6.prg
  * extras/gtwvw/tests/drawimg.prg
  * extras/gtwvw/tests/ebtest7.prg
  * extras/gtwvw/tests/maximize.prg
  * extras/gtwvw/tests/prog0.prg
  * extras/gtwvw/tests/prog1.prg
  * extras/gtwvw/tests/prog2.prg
  * extras/gtwvw/tests/wvwtest9.prg
  * extras/hbvpdf/hbvpdf.prg
  * extras/hbvpdf/tests/pdf_demo.prg
  * extras/httpsrv/modules/info.prg
  * extras/httpsrv/modules/showcounter.prg
  * tests/ac_test2.prg
  * tests/adirtest.prg
  * tests/and_or.prg
  * tests/brwpos.prg
  * tests/clasname.prg
  * tests/extend1.prg
  * tests/newrdd.prg
  * tests/testbrw.prg
  * tests/testcdx.prg
  * tests/testdbf.prg
  * tests/transtst.prg
  * tests/tstasort.prg
  * tests/usrrdd/exarr.prg
  * tests/usrrdd/exhsx.prg
    * formatting (mostly fixing one formatting error by hbformat)
2012-10-15 10:24:57 +00:00

73 lines
1.7 KiB
Plaintext

/*
* $Id$
*/
/* TEST BROWSE ROWPOS FOR COMPILER IN CLIPPER AND HARBOUR */
#include "inkey.ch"
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() != K_ESC
@ 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