* 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)
150 lines
3.6 KiB
Plaintext
150 lines
3.6 KiB
Plaintext
/*
|
|
* $Id$
|
|
*/
|
|
|
|
/* UTF-8 */
|
|
|
|
// Harbour Class TBrowse and TBColumn sample
|
|
|
|
#include "inkey.ch"
|
|
|
|
PROCEDURE Main()
|
|
|
|
LOCAL oBrowse := TBrowseNew( 5, 5, 16, 30 )
|
|
LOCAL aTest0 := { "This", "is", "a", "browse", "on", "an", "array", "test", "with", "a", "long", "data" }
|
|
LOCAL aTest1 := { 1, 2, 3, 4, 5, 6, 7, 8, 10000, - 1000, 54, 456342 }
|
|
LOCAL aTest2 := { Date(), Date() + 4, Date() + 56, Date() + 14, Date() + 5, Date() + 6, Date() + 7, Date() + 8, Date() + 10000, Date() - 1000, Date() - 54, Date() + 456342 }
|
|
LOCAL aTest3 := { .T., .F., .T., .T., .F., .F., .T., .F., .T., .T., .F., .F. }
|
|
LOCAL n := 1
|
|
LOCAL nCursor
|
|
LOCAL cColor
|
|
LOCAL nRow, nCol
|
|
#ifndef HB_COMPAT_C53
|
|
LOCAL nKey
|
|
LOCAL nTmpRow, nTmpCol
|
|
LOCAL lEnd := .F.
|
|
#endif
|
|
|
|
oBrowse:colorSpec := "W+/B, N/BG"
|
|
oBrowse:ColSep := hb_UTF8ToStrBox( "│" )
|
|
oBrowse:HeadSep := hb_UTF8ToStrBox( "╤═" )
|
|
oBrowse:FootSep := hb_UTF8ToStrBox( "╧═" )
|
|
oBrowse:GoTopBlock := {|| n := 1 }
|
|
oBrowse:GoBottomBlock := {|| n := Len( aTest0 ) }
|
|
oBrowse:SkipBlock := {| nSkip, nPos | nPos := n, ;
|
|
n := iif( nSkip > 0, Min( Len( aTest0 ), n + nSkip ), ;
|
|
Max( 1, n + nSkip ) ), n - nPos }
|
|
|
|
oBrowse:AddColumn( TBColumnNew( "First", {|| n } ) )
|
|
oBrowse:AddColumn( TBColumnNew( "Second", {|| aTest0[ n ] } ) )
|
|
oBrowse:AddColumn( TBColumnNew( "Third", {|| aTest1[ n ] } ) )
|
|
oBrowse:AddColumn( TBColumnNew( "Forth", {|| aTest2[ n ] } ) )
|
|
oBrowse:AddColumn( TBColumnNew( "Fifth", {|| aTest3[ n ] } ) )
|
|
oBrowse:GetColumn( 1 ):Footing := "Number"
|
|
oBrowse:GetColumn( 2 ):Footing := "String"
|
|
|
|
oBrowse:GetColumn( 2 ):Picture := "@!"
|
|
|
|
oBrowse:GetColumn( 3 ):Footing := "Number"
|
|
oBrowse:GetColumn( 3 ):Picture := "999,999.99"
|
|
oBrowse:GetColumn( 4 ):Footing := "Dates"
|
|
oBrowse:GetColumn( 5 ):Footing := "Logical"
|
|
// needed since I've changed some columns _after_ I've added them to TBrowse object
|
|
oBrowse:Configure()
|
|
|
|
Alert( oBrowse:ClassName() )
|
|
Alert( oBrowse:GetColumn( 1 ):ClassName() )
|
|
|
|
oBrowse:Freeze := 1
|
|
nCursor := SetCursor( 0 )
|
|
cColor := SetColor( "W+/B" )
|
|
nRow := Row()
|
|
nCol := Col()
|
|
hb_DispBox( 4, 4, 17, 31, hb_UTF8ToStrBox( "┌─┐│┘─└│ " ) )
|
|
#ifdef HB_COMPAT_C53
|
|
oBrowse:SetKey( 0, {| ob, nkey | Defproc( ob, nKey ) } )
|
|
WHILE .T.
|
|
oBrowse:ForceStable()
|
|
IF oBrowse:applykey( Inkey( 0 ) ) == -1
|
|
EXIT
|
|
ENDIF
|
|
ENDDO
|
|
#else
|
|
WHILE !lEnd
|
|
oBrowse:ForceStable()
|
|
|
|
nKey := Inkey( 0 )
|
|
|
|
DO CASE
|
|
CASE nKey == K_ESC
|
|
SetPos( 17, 0 )
|
|
lEnd := .T.
|
|
|
|
CASE nKey == K_DOWN
|
|
oBrowse:Down()
|
|
|
|
CASE nKey == K_UP
|
|
oBrowse:Up()
|
|
|
|
CASE nKey == K_LEFT
|
|
oBrowse:Left()
|
|
|
|
CASE nKey == K_RIGHT
|
|
oBrowse:Right()
|
|
|
|
CASE nKey == K_PGDN
|
|
oBrowse:pageDown()
|
|
|
|
CASE nKey == K_PGUP
|
|
oBrowse:pageUp()
|
|
|
|
CASE nKey == K_CTRL_PGUP
|
|
oBrowse:goTop()
|
|
|
|
CASE nKey == K_CTRL_PGDN
|
|
oBrowse:goBottom()
|
|
|
|
CASE nKey == K_HOME
|
|
oBrowse:home()
|
|
|
|
CASE nKey == K_END
|
|
oBrowse:end()
|
|
|
|
CASE nKey == K_CTRL_LEFT
|
|
oBrowse:panLeft()
|
|
|
|
CASE nKey == K_CTRL_RIGHT
|
|
oBrowse:panRight()
|
|
|
|
CASE nKey == K_CTRL_HOME
|
|
oBrowse:panHome()
|
|
|
|
CASE nKey == K_CTRL_END
|
|
oBrowse:panEnd()
|
|
|
|
CASE nKey == K_TAB
|
|
hb_DispOutAt( 0, 0, Time() )
|
|
|
|
ENDCASE
|
|
|
|
ENDDO
|
|
#endif
|
|
SetPos( nRow, nCol )
|
|
SetColor( cColor )
|
|
SetCursor( nCursor )
|
|
|
|
RETURN
|
|
|
|
#ifdef HB_COMPAT_C53
|
|
|
|
FUNCTION defproc( ob, nkey )
|
|
|
|
IF nKey == K_TAB
|
|
hb_DispOutAt( 0, 0, Time() )
|
|
ob:Refreshall()
|
|
ENDIF
|
|
|
|
RETURN 1
|
|
|
|
#endif
|