From 7c8bc37bdde6bb65fbe7c3e2fa93c619a8d2fd78 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Thu, 16 Oct 2008 11:08:37 +0000 Subject: [PATCH] 2008-10-16 13:08 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/debug/debugger.prg + added __dbgAChoice() - simple AChoice() replacement which uses internally HBDbBrowser() class * replaced AChoice() with __dbgAChoice() * replaced @ ... SAY ... by hb_dispOutAt() --- harbour/ChangeLog | 7 +++++ harbour/source/debug/debugger.prg | 51 ++++++++++++++++++++++++++----- 2 files changed, 51 insertions(+), 7 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 8a4818bc06..1fa87e53c7 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,13 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2008-10-16 13:08 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/debug/debugger.prg + + added __dbgAChoice() - simple AChoice() replacement which uses + internally HBDbBrowser() class + * replaced AChoice() with __dbgAChoice() + * replaced @ ... SAY ... by hb_dispOutAt() + 2008-10-16 08:42 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * include/common.ch * contrib/hbziparc/hbziparc.prg diff --git a/harbour/source/debug/debugger.prg b/harbour/source/debug/debugger.prg index f7a1e87ea4..063e59f215 100644 --- a/harbour/source/debug/debugger.prg +++ b/harbour/source/debug/debugger.prg @@ -1696,7 +1696,6 @@ METHOD ListBox( cCaption, aItems ) CLASS HBDebugger LOCAL nRight LOCAL oWndList LOCAL cSelected := "" - LOCAL cColors LOCAL n nItems := Len( aItems ) @@ -1713,11 +1712,10 @@ METHOD ListBox( cCaption, aItems ) CLASS HBDebugger oWndList:lShadow := .T. oWndList:Show() - cColors := SetColor( ::aColors[ 8 ] + "," + ::aColors[ 10 ] ) - n := AChoice( nTop + 1, nLeft + 1, nBottom - 1, nRight - 1, aItems ) - SetColor( cColors ) - + n := __dbgAChoice( nTop + 1, nLeft + 1, nBottom - 1, nRight - 1, aItems, ; + ::aColors[ 8 ] + "," + ::aColors[ 10 ] ) oWndList:Hide() + RETURN n @@ -3407,8 +3405,8 @@ STATIC FUNCTION getdbginput( nTop, nLeft, uValue, bValid, cColor ) ENDIF DO WHILE .T. - @ nTop, nLeft SAY Space( Len( uTemp ) ) - @ nTop, nLeft SAY "" + hb_dispOutAt( nTop, nLeft, Space( Len( uTemp ) ), cColor ) + SetPos( nTop, nLeft ) ACCEPT TO uTemp @@ -3425,9 +3423,47 @@ STATIC FUNCTION getdbginput( nTop, nLeft, uValue, bValid, cColor ) #endif + +FUNCTION __dbgAchoice( nTop, nLeft, nBottom, nRight, aItems, cColors ) + LOCAL oBrw + LOCAL oCol + LOCAL nRow + LOCAL nKey + LOCAL nLen + + oBrw := HBDbBrowser():New( nTop, nLeft, nBottom, nRight ) + oBrw:colorSpec := IIF( ISCHARACTER( cColors ), cColors, SetColor() ) + nLen := nRight - nLeft + 1 + nRow := 1 + oCol := HBDbColumnNew( "", {|| PadR( aItems[ nRow ], nLen ) } ) + oBrw:AddColumn( oCol ) + oBrw:goTopBlock := {|| nRow := 1 } + oBrw:goBottomBlock := {|| nRow := Len( aItems ) } + oBrw:skipBlock := {| n | n := IIF( n < 0, Max( n, 1 - nRow ), ; + Min( Len( aItems ) - nRow, n ) ), ; + nRow += n, n } + WHILE .T. + oBrw:forceStable() + nKey := Inkey( 0 ) + SWITCH nKey + CASE K_UP; oBrw:up(); EXIT + CASE K_DOWN; oBrw:down(); EXIT + CASE K_PGUP; oBrw:pageUp(); EXIT + CASE K_PGDN; oBrw:pageDown(); EXIT + CASE K_HOME; oBrw:goTop(); EXIT + CASE K_END; oBrw:goBottom(); EXIT + CASE K_ESC; nRow := 0 + CASE K_ENTER; RETURN nRow + ENDSWITCH + ENDDO + + RETURN 0 + + FUNCTION __dbgAlert( cMessage ) RETURN hb_gtAlert( cMessage, { "Ok" }, "W+/R", "W+/B" ) + FUNCTION __dbgValToStr( uVal ) LOCAL cType := ValType( uVal ) @@ -3447,6 +3483,7 @@ FUNCTION __dbgValToStr( uVal ) RETURN "U" + /* NOTE: This is a copy of hb_CStr() */ FUNCTION __dbgCStr( xVal )