From 2502e5b0bf0d5aaf7f9e83834fe5f2f1bbc6c087 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Fri, 17 Oct 2008 10:41:48 +0000 Subject: [PATCH] 2008-10-17 12:41 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/debug/debugger.prg * changed __dbgInput() to return logical value and set edit value in variable passed by reference * harbour/source/debug/dbgtobj.prg * harbour/source/debug/dbgthsh.prg * harbour/source/debug/dbgtarr.prg ! fixed typo in VALID block declaration - it was array by mistake * removed unnecessary code related to GET behavior * use new __dbgInput() format --- harbour/ChangeLog | 12 ++++++++++++ harbour/source/debug/dbgtarr.prg | 13 ++----------- harbour/source/debug/dbgthsh.prg | 13 ++----------- harbour/source/debug/dbgtobj.prg | 13 ++----------- harbour/source/debug/debugger.prg | 31 ++++++++++++++----------------- 5 files changed, 32 insertions(+), 50 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 578c219f04..7d0ab08397 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,18 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2008-10-17 12:41 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/debug/debugger.prg + * changed __dbgInput() to return logical value and set edit value in + variable passed by reference + + * harbour/source/debug/dbgtobj.prg + * harbour/source/debug/dbgthsh.prg + * harbour/source/debug/dbgtarr.prg + ! fixed typo in VALID block declaration - it was array by mistake + * removed unnecessary code related to GET behavior + * use new __dbgInput() format + 2008-10-17 10:16 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * source/debug/dbgtobj.prg * source/debug/dbgthsh.prg diff --git a/harbour/source/debug/dbgtarr.prg b/harbour/source/debug/dbgtarr.prg index 72d3c8834b..a228992758 100644 --- a/harbour/source/debug/dbgtarr.prg +++ b/harbour/source/debug/dbgtarr.prg @@ -157,7 +157,6 @@ METHOD addWindows( aArray, nRow ) CLASS HBDbArray METHOD doGet( oBrowse, pItem, nSet ) CLASS HBDbArray - LOCAL nKey LOCAL oErr LOCAL cValue := PadR( __dbgValToStr( pItem[ nSet ] ),; oBrowse:nRight - oBrowse:nLeft - oBrowse:GetColumn( 1 ):width ) @@ -166,10 +165,8 @@ METHOD doGet( oBrowse, pItem, nSet ) CLASS HBDbArray oBrowse:forceStable() // if confirming new record, append blank - cValue := __dbgInput( Row(), oBrowse:nLeft + oBrowse:GetColumn( 1 ):width + 1,, cValue, ; - { iif( Type( cValue ) == "UE", ( __dbgAlert( "Expression error" ), .F. ), .T. ) } ) - - IF LastKey() == K_ENTER + IF __dbgInput( Row(), oBrowse:nLeft + oBrowse:GetColumn( 1 ):width + 1,, @cValue, ; + { | cValue | iif( Type( cValue ) == "UE", ( __dbgAlert( "Expression error" ), .F. ), .T. ) } ) BEGIN SEQUENCE WITH {|oErr| break( oErr ) } pItem[ nSet ] := &cValue RECOVER USING oErr @@ -177,12 +174,6 @@ METHOD doGet( oBrowse, pItem, nSet ) CLASS HBDbArray END SEQUENCE ENDIF - // check exit key from get - nKey := LastKey() - IF nKey == K_UP .OR. nKey == K_DOWN .OR. nKey == K_PGUP .OR. nKey == K_PGDN - KEYBOARD Chr( nKey ) - ENDIF - RETURN NIL METHOD SetsKeyPressed( nKey, oBrwSets, oWnd, cName, aArray ) CLASS HBDbArray diff --git a/harbour/source/debug/dbgthsh.prg b/harbour/source/debug/dbgthsh.prg index c376b066b1..4fa05d84ae 100644 --- a/harbour/source/debug/dbgthsh.prg +++ b/harbour/source/debug/dbgthsh.prg @@ -162,7 +162,6 @@ METHOD addWindows( hHash, nRow ) CLASS HBDbHash METHOD doGet( oBrowse, pItem, nSet ) CLASS HBDbHash - LOCAL nKey LOCAL oErr LOCAL cValue := PadR( __dbgValToStr( HB_HValueAt( pItem, nSet ) ),; oBrowse:nRight - oBrowse:nLeft - oBrowse:GetColumn( 1 ):width ) @@ -171,10 +170,8 @@ METHOD doGet( oBrowse, pItem, nSet ) CLASS HBDbHash oBrowse:forceStable() // if confirming new record, append blank - cValue := __dbgInput( Row(), oBrowse:nLeft + oBrowse:GetColumn( 1 ):width + 1,, cValue, ; - { iif( Type( cValue ) == "UE", ( __dbgAlert( "Expression error" ), .F. ), .T. ) } ) - - IF LastKey() == K_ENTER + IF __dbgInput( Row(), oBrowse:nLeft + oBrowse:GetColumn( 1 ):width + 1,, @cValue, ; + { | cValue | iif( Type( cValue ) == "UE", ( __dbgAlert( "Expression error" ), .F. ), .T. ) } ) BEGIN SEQUENCE WITH {|oErr| break( oErr ) } HB_HValueAt( pItem, nSet, &cValue ) RECOVER USING oErr @@ -182,12 +179,6 @@ METHOD doGet( oBrowse, pItem, nSet ) CLASS HBDbHash END SEQUENCE ENDIF - // check exit key from get - nKey := LastKey() - IF nKey == K_UP .OR. nKey == K_DOWN .OR. nKey == K_PGUP .OR. nKey == K_PGDN - KEYBOARD Chr( nKey ) - ENDIF - RETURN NIL METHOD SetsKeyPressed( nKey, oBrwSets, oWnd, cName, hHash ) CLASS HBDbHash diff --git a/harbour/source/debug/dbgtobj.prg b/harbour/source/debug/dbgtobj.prg index d4c7c94b04..d84d6125e6 100644 --- a/harbour/source/debug/dbgtobj.prg +++ b/harbour/source/debug/dbgtobj.prg @@ -177,7 +177,6 @@ METHOD addWindows( aArray, nRow ) CLASS HBDbObject METHOD doGet( oBrowse, pItem, nSet ) CLASS HBDbObject LOCAL column - LOCAL nKey LOCAL cValue LOCAL lCanAcc LOCAL oErr @@ -197,10 +196,8 @@ METHOD doGet( oBrowse, pItem, nSet ) CLASS HBDbObject ENDIF cValue := PadR( __dbgValToStr( cValue ), column:Width ) - cValue := __dbgInput( Row(), oBrowse:nLeft + oBrowse:GetColumn( 1 ):width + 1,, cValue, ; - { iif( Type( cValue ) == "UE", ( __dbgAlert( "Expression error" ), .F. ), .T. ) } ) - - IF LastKey() == K_ENTER + IF __dbgInput( Row(), oBrowse:nLeft + oBrowse:GetColumn( 1 ):width + 1,, @cValue, ; + { | cValue | iif( Type( cValue ) == "UE", ( __dbgAlert( "Expression error" ), .F. ), .T. ) } ) BEGIN SEQUENCE WITH {|oErr| break( oErr ) } __dbgObjSetValue( ::TheObj, pitem[ nSet, 1 ], &cValue ) RECOVER USING oErr @@ -208,12 +205,6 @@ METHOD doGet( oBrowse, pItem, nSet ) CLASS HBDbObject END SEQUENCE ENDIF - // check exit key from get - nKey := LastKey() - IF nKey == K_UP .OR. nKey == K_DOWN .OR. nKey == K_PGUP .OR. nKey == K_PGDN - KEYBOARD Chr( nKey ) - ENDIF - RETURN NIL METHOD SetsKeyPressed( nKey, oBrwSets, nSets, aArray ) CLASS HBDbObject diff --git a/harbour/source/debug/debugger.prg b/harbour/source/debug/debugger.prg index f35685b61e..ab1611fd5c 100644 --- a/harbour/source/debug/debugger.prg +++ b/harbour/source/debug/debugger.prg @@ -1092,12 +1092,10 @@ METHOD EditColor( nColor, oBrwColors ) CLASS HBDebugger oBrwColors:RefreshCurrent() oBrwColors:ForceStable() - cColor := __dbgInput( Row(), Col() + 15,, cColor, ; - { | cColor | iif( Type( cColor ) != "C", ; - ( __dbgAlert( "Must be string" ), .F. ), .T. ) }, ; - SubStr( ::ClrModal(), 5 ) ) - - IF LastKey() != K_ESC + IF __dbgInput( Row(), Col() + 15,, @cColor, ; + { | cColor | iif( Type( cColor ) != "C", ; + ( __dbgAlert( "Must be string" ), .F. ), .T. ) }, ; + SubStr( ::ClrModal(), 5 ) ) ::aColors[ nColor ] := &cColor ENDIF @@ -1114,12 +1112,10 @@ METHOD EditSet( nSet, oBrwSets ) CLASS HBDebugger oBrwSets:RefreshCurrent() oBrwSets:ForceStable() - cSet := __dbgInput( Row(), Col() + 13,, cSet, ; - { | cSet | iif( Type( cSet ) != cType, ; - ( __dbgAlert( "Must be of type '" + cType + "'" ), .F. ), .T. ) }, ; - SubStr( ::ClrModal(), 5 ) ) - - IF LastKey() != K_ESC + IF __dbgInput( Row(), Col() + 13,, @cSet, ; + { | cSet | iif( Type( cSet ) != cType, ; + ( __dbgAlert( "Must be of type '" + cType + "'" ), .F. ), .T. ) }, ; + SubStr( ::ClrModal(), 5 ) ) Set( nSet, &cSet ) ENDIF @@ -1518,8 +1514,8 @@ METHOD InputBox( cMsg, uValue, bValid, lEditable ) CLASS HBDebugger IF cType != "C" .OR. Len( uValue ) < nWidth uTemp := PadR( uValue, nWidth ) ENDIF - uTemp := __dbgInput( nTop + 1, nLeft + 1, nWidth, uTemp, bValid, ; - __DbgColors()[ 5 ], Max( Max( nWidth, Len( uTemp ) ), 256 ) ) + __dbgInput( nTop + 1, nLeft + 1, nWidth, @uTemp, bValid, ; + __DbgColors()[ 5 ], Max( Max( nWidth, Len( uTemp ) ), 256 ) ) SWITCH cType CASE "C" ; uTemp := AllTrim( uTemp ) ; EXIT CASE "D" ; uTemp := CToD( uTemp ) ; EXIT @@ -3309,7 +3305,7 @@ STATIC FUNCTION strip_path( cFileName ) FUNCTION __dbgInput( nRow, nCol, nWidth, cValue, bValid, cColor, nSize ) LOCAL nOldCursor := SetCursor( SC_NORMAL ) - LOCAL cTemp := cValue + LOCAL lOK := .F. LOCAL nKey LOCAL oGet @@ -3325,7 +3321,8 @@ FUNCTION __dbgInput( nRow, nCol, nWidth, cValue, bValid, cColor, nSize ) EXIT ELSEIF nKey == K_ENTER IF bValid == NIL .OR. Eval( bValid, oGet:getValue() ) - cTemp := oGet:getValue() + cValue := oGet:getValue() + lOK := .T. EXIT ENDIF ELSE @@ -3335,7 +3332,7 @@ FUNCTION __dbgInput( nRow, nCol, nWidth, cValue, bValid, cColor, nSize ) SetCursor( nOldCursor ) - RETURN cTemp + RETURN lOK FUNCTION __dbgAchoice( nTop, nLeft, nBottom, nRight, aItems, cColors )