From bdf054fdb4530dcd5925d0b3beb4b3dd5cf7bc53 Mon Sep 17 00:00:00 2001 From: Walter Negro Date: Mon, 14 Oct 2002 20:17:00 +0000 Subject: [PATCH] 2002-10-14 17:10 UTC-0300 Walter Negro * source/rtl/tget.prg ! fixed get (value and display) involving negative with decimal number whose value is less than 1, in some pictures. --- harbour/source/rtl/tget.prg | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/harbour/source/rtl/tget.prg b/harbour/source/rtl/tget.prg index b2383da43a..6ae2f743ca 100644 --- a/harbour/source/rtl/tget.prg +++ b/harbour/source/rtl/tget.prg @@ -156,6 +156,7 @@ CLASS Get DATA cPicMask, cPicFunc, nMaxLen, lEdit, lDecRev, lPicComplex DATA nDispLen, nDispPos, nOldPos, lCleanZero, cDelimit, nMaxEdit + DATA lMinusPrinted METHOD DeleteAll() METHOD IsEditable( nPos ) @@ -206,6 +207,7 @@ METHOD New( nRow, nCol, bVarBlock, cVarName, cPicture, cColorSpec ) CLASS Get ::nOldPos := 0 ::lCleanZero := .f. ::cDelimit := if( SET(_SET_DELIMITERS), SET(_SET_DELIMCHARS), NIL ) + ::lMinusPrinted := .f. ::Picture := cPicture #ifdef HB_COMPAT_C53 @@ -353,12 +355,12 @@ return Self METHOD Display( lForced ) CLASS Get local nOldCursor := SetCursor( SC_NONE ) - local xbuffer := ::buffer + local xBuffer := ::buffer DEFAULT lForced TO .t. - if !Empty(::DecPos ) .and. ::minus .and. !( "-" $ xbuffer ) - xbuffer := space(::DecPos-2) + "-." + substr(::buffer,::Decpos+1) + if !::lMinusPrinted .and. !Empty( ::DecPos ) .and. ::minus .and. substr( xBuffer, ::DecPos-1, 1 ) == "0" + xBuffer := substr( xBuffer, 1, ::DecPos-2 ) + "-." + substr( xBuffer, ::DecPos+1 ) endif if ::HasScroll() .and. ::Pos != NIL @@ -412,8 +414,6 @@ METHOD End() CLASS Get ::Display( .f. ) endif - ::minus := NIL - return Self //---------------------------------------------------------------------------// @@ -479,13 +479,12 @@ METHOD SetFocus() CLASS Get if ::type == "N" ::decpos := At( iif( ::lDecRev .or. "E" $ ::cPicFunc, ",", "." ), ::buffer ) - if !::minus - ::minus := ( ::VarGet() < 0 ) - endif + ::minus := ( ::VarGet() < 0 ) else ::decpos := NIL ::minus := .f. endif + ::lMinusPrinted := ::minus if ::type == "D" ::BadDate := IsBadDate( ::buffer, ::cPicFunc ) @@ -580,9 +579,7 @@ METHOD Untransform( cBuffer ) CLASS Get case ::type == "N" - if !::minus - ::minus := .f. - endif +* ::minus := .f. if "X" $ ::cPicFunc if Right( cBuffer, 2 ) == "DB" ::minus := .t. @@ -1133,6 +1130,12 @@ METHOD PutMask( xValue, lEdit ) CLASS Get !( "X" $ cPicFunc .and. "C" $ cPicFunc ) cBuffer += " " endif + + if xValue < 0 + ::lMinusPrinted := .t. + else + ::lMinusPrinted := .f. + endif endif /*