+ contrib/hbgt/tests
+ contrib/hbgt/tests/test.prg
+ contrib/hbmisc/tests/rtfclass.prg
- tests/rtfclass.prg
- tests/test10.prg
- tests/testgt.prg
* tests/ac_test.prg
* tests/alias.prg
* tests/begin.prg
* tests/boxtest.prg
* tests/cdow.prg
* tests/clasinh.prg
* tests/dates.prg
* tests/dates2.prg
* tests/dates3.prg
* tests/dates4.prg
* tests/ddate.prg
* tests/debugtst.prg
* tests/delimtst.prg
* tests/devtest.prg
* tests/disptest.prg
* tests/foreach.prg
* tests/gtstdtst.prg
* tests/ipclnt.prg
* tests/ipsvr.prg
* tests/langapi.prg
* tests/memtst.prg
* tests/memvar.prg
* tests/menutest.prg
* tests/mousetst.prg
* tests/multiarg.prg
* tests/newrdd.prg
* tests/nums.prg
* tests/objarr.prg
* tests/objasign.prg
* tests/objects.prg
* tests/omacro.prg
* tests/onidle.prg
* tests/os.prg
* tests/output.prg
* tests/overload.prg
* tests/parexpr.prg
* tests/passref.prg
* tests/procline.prg
* tests/procname.prg
* tests/recursiv.prg
* tests/returns.prg
* tests/round.prg
* tests/say.prg
* tests/sbartest.prg
* tests/scroll.prg
* tests/sdf_test.prg
* tests/seconds.prg
* tests/server.prg
* tests/set_num.prg
* tests/set_test.prg
* tests/setkeys.prg
* tests/sound.prg
* tests/speed.prg
* tests/statfun.prg
* tests/statics.prg
* tests/statics1.prg
* tests/statics2.prg
* tests/statinit.prg
* tests/strdelim.prg
* tests/stripem.prg
* tests/switch.prg
* tests/symbolt.prg
* tests/t1.prg
* tests/tb1.prg
* tests/testbrdb.prg
* tests/testbrw.prg
* tests/testcdx.prg
* tests/testcls.prg
* tests/testdbf.prg
* tests/testdecl.prg
* tests/testerro.prg
* tests/testfor.prg
* tests/testget.prg
* tests/testhrb.prg
* tests/testhtml.prg
* tests/testidle.prg
* tests/testmem.prg
* tests/testpers.prg
* tests/testtok.prg
* tests/testwarn.prg
* tests/tstalias.prg
* tests/tstasort.prg
* tests/tstblock.prg
* tests/tstdbi.prg
* tests/tstmacro.prg
* tests/varparam.prg
* tests/wvt_fs.prg
* cleaning up tests
113 lines
2.5 KiB
Plaintext
113 lines
2.5 KiB
Plaintext
/*
|
|
* $Id$
|
|
*/
|
|
|
|
/*
|
|
* ScrollBar class test
|
|
*
|
|
* Harbour Project source code
|
|
* http://harbour-project.org/
|
|
*
|
|
* Example donated by Diego Pego,
|
|
* modified by Alejandro de Garate
|
|
*/
|
|
|
|
#include "directry.ch"
|
|
#include "achoice.ch"
|
|
#include "inkey.ch"
|
|
|
|
#define B_THIN ( Chr( 219 ) + Chr( 223 ) + Chr( 219 ) + Chr( 219 ) + ;
|
|
Chr( 219 ) + Chr( 220 ) + Chr( 219 ) + Chr( 219 ) )
|
|
|
|
PROCEDURE Main()
|
|
|
|
InitScrlBar()
|
|
|
|
RETURN
|
|
|
|
FUNCTION InitScrlBar()
|
|
|
|
LOCAL tmpFileList := {}, i
|
|
MEMVAR aFileList, filesScroll
|
|
PRIVATE aFileList := {}, filesScroll
|
|
|
|
CLS
|
|
SetBlink( .F. )
|
|
@ 0, 0, 24, 79 BOX REPLIC( Chr( 178 ), 9 ) COLOR "GR+/W*"
|
|
@ 4, 28 SAY " Directory " COLOR "W+/B"
|
|
@ 5, 28, 15, 60 BOX B_THIN + " " COLOR "W/W*"
|
|
|
|
// get the current folder files to display on the aChoice menu
|
|
tmpFileList := Directory()
|
|
|
|
FOR i := 1 TO Len( tmpFileList )
|
|
AAdd( aFileList, tmpFileList[ i ][ F_NAME ] )
|
|
NEXT
|
|
|
|
filesScroll := ScrollBar( 06, 14, 60, NIL, 1 )
|
|
|
|
filesScroll:total := Len( aFileList )
|
|
|
|
filesScroll:SetColor( "W+/W, W+/W" ) // New method!
|
|
SET COLOR TO "N/W*, W+/B,,,W/N"
|
|
|
|
filesScroll:display()
|
|
|
|
i := AChoice( 06, 29, 14, 59, aFileList, , "updateFilesScroll" )
|
|
|
|
@ 23, 0 SAY iif( i < 1, "", aFileList[ i ] ) COLOR "N/W*"
|
|
SET COLOR TO
|
|
@ 24, 0
|
|
|
|
RETURN 0
|
|
|
|
// function used to update scrollbar
|
|
|
|
FUNCTION updateFilesScroll( modo )
|
|
|
|
LOCAL newPos, valRet := AC_CONT // Default to continue
|
|
LOCAL ultTecla := LastKey()
|
|
|
|
MEMVAR filesScroll
|
|
|
|
newPos := filesScroll:current
|
|
|
|
DO CASE
|
|
CASE ultTecla == K_CTRL_PGUP
|
|
newPos := 1
|
|
CASE ultTecla == K_CTRL_PGDN
|
|
newPos := filesScroll:total
|
|
CASE ultTecla == K_CTRL_HOME
|
|
newPos := newPos - ( filesScroll:barLength + 1 )
|
|
CASE ultTecla == K_CTRL_END
|
|
newPos := newPos + ( filesScroll:barLength + 1 )
|
|
CASE ultTecla == K_PGUP
|
|
newPos := newPos - ( filesScroll:barLength + 1 )
|
|
CASE ultTecla == K_PGDN
|
|
newPos := newPos + ( filesScroll:barLength + 1 )
|
|
CASE ultTecla == K_UP
|
|
newPos--
|
|
CASE ultTecla == K_DOWN
|
|
newPos++
|
|
CASE modo == AC_EXCEPT
|
|
DO CASE
|
|
CASE ultTecla == K_RETURN
|
|
valRet := AC_SELECT
|
|
CASE ultTecla == K_ESC
|
|
valRet := AC_ABORT
|
|
OTHERWISE
|
|
valRet := AC_GOTO
|
|
ENDCASE
|
|
ENDCASE
|
|
|
|
IF newPos < 1
|
|
newPos := 1
|
|
ELSEIF newPos >= filesScroll:total
|
|
newPos := filesScroll:total
|
|
ENDIF
|
|
|
|
filesScroll:current := newPos
|
|
filesScroll:update()
|
|
|
|
RETURN valRet
|