FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour TSBROWSE - Manuel Mercado - METHOD TSBrowse:EditExit()
Posts: 1286
Joined: Mon Feb 25, 2008 02:54 PM
TSBROWSE - Manuel Mercado - METHOD TSBrowse:EditExit()
Posted: Fri Apr 08, 2011 06:02 PM

Sr. Manuel,

1) Onde posso baixar a versão mais recente de tsbrowse 9.0?

2) method editexit - browse com array ao sair da edição estava ficando louca a tela, resolvi assim:

METHOD TSBrowse:EditExit()
...
Após ::SetMsg( cMsg )
adicionei ::Refresh(.f.)

Existe algum estrutural nesta alteração?

ex:

  • ============================================================================
  • METHOD TSBrowse:EditExit() Version 9.0 Nov/30/2009
  • ============================================================================

METHOD EditExit( nCol, nKey, uVar, bValid, lLostFocus ) CLASS TSBrowse

Local uValue, cType, oCol, lCombo, cMsg, lAuxFixKey

Default lLostFocus := .F., ;
::lPostEdit := .F., ;
nCol := ::nCell

oCol := ::aColumns[ nCol ]
lCombo := ValType( oCol:oEdit ) == "O" .and. "COMBO" $ Upper( oCol:oEdit:ClassName() )
lAuxFixKey := !lLostFocus .and. nKey > 0 .and. nKey != VK_ESCAPE .and. ValType( oCol:oEdit ) == "O" //bira

If ! lLostFocus .and. nKey > 0 .and. nKey != VK_ESCAPE .and. ValType( oCol:oEdit ) == "O" .or. (!lAuxFixKey .and. !empty(::nFixKey)) //bira

  ::lPostEdit := .T.
  HideCaret( oCol:oEdit:hWnd )

  If lCombo

     cType := If( oCol:cDataType != Nil, oCol:cDataType, ValType( uVar ) )

     If cType == "L"
        uValue := oCol:oEdit:nAt == 1
        uVar := If( ValType( uVar ) == "C", AScan( oCol:aItems, uVar ) == 1, ;
                If( ValType( uVar ) == "N", uVar == 1, uVar ) )
     Else

        If oCol:aData != Nil
           uValue := oCol:aData[ oCol:oEdit:nAt ]
           If ValType( uValue ) == "N" .and. ValType( uVar ) == "C"
              uVar := AScan( oCol:aData, uVar )
           EndIf
        Else
           uValue := If( cType == "N", oCol:oEdit:nAt, ;
                         oCol:oEdit:aItems[ oCol:oEdit:nAt ] )

           If cType == "N"
              uValue := oCol:oEdit:nAt
           Else
              uValue := Substr( uValue, 1, Len( uVar ) )
           EndIf

        EndIf

        ::lChanged    := uValue != uVar
        ::lHasChanged := If( ::lChanged, .T., ::lHasChanged )

     EndIf

     ::oWnd:nLastKey := nKey

     If oCol:bEditEnd != Nil
        Eval( oCol:bEditEnd, uValue, Self, .T. )
     EndIf

     ::lAppendMode := oCol:oEdit:lAppend
     ::lEditing := .F.
     oCol:oEdit:Hide()
     oCol:oEdit:End()
     oCol:oEdit := Nil
     ::PostEdit( uValue, nCol, bValid )
     ::oWnd:bValid := ::oGet
     cMsg := If( ! Empty( oCol:cMsg ), oCol:cMsg, ::cMsg )
     cMsg := If( Valtype( cMsg ) == "B", Eval( cMsg, Self, ::nCell ), cMsg )
     ::SetMsg( cMsg )
     Return Nil
  EndIf

  uValue := oCol:oEdit:VarGet()

  If oCol:bCustomEdit != Nil
     uValue := Eval( oCol:bCustomEdit, uValue, oCol:oEdit, Self )
  EndIf

  If ::lAppendMode .and. Empty( oCol:oEdit:VarGet() ) .and. nKey != VK_RETURN
     bValid := {||.F.}
  EndIf

  If oCol:bEditEnd != Nil
     Eval( oCol:bEditEnd, uValue, Self, .T. )
  EndIf

  ::lChanged      := ValType( uValue ) != ValType( uVar ) .or. uValue != uVar
  ::lHasChanged   := If( ::lChanged, .T., ::lHasChanged )
  ::oWnd:nLastKey := nKey
  oCol:oEdit:Hide()
  oCol:oEdit:End()
  oCol:oEdit    := Nil
  ::oWnd:bValid := ::oGet
  ::PostEdit( uValue, nCol, bValid )
  cMsg := If( ! Empty( oCol:cMsg ), oCol:cMsg, ::cMsg )
  cMsg := If( Valtype( cMsg ) == "B", Eval( cMsg, Self, ::nCell ), cMsg )
  ::SetMsg( cMsg )
  ::Refresh(.f.)
  if ::nFixKey#0 .and. nKey == ::nFixKey  .or. !lAuxFixKey  //bira
     return Super:KeyDown( if(!lAuxFixKey,0,::nFixKey), 0 )
  endif

Else

  If ::lPostEdit
     Return Nil
  EndIf

  If oCol:bEditEnd != Nil .and. ValType( oCol:oEdit ) == "O"
     Eval( oCol:bEditEnd, uValue, Self, .F. )
  EndIf

  If lCombo
     ::lAppendMode := oCol:oEdit:lAppend
  EndIf

  ::oWnd:bValid := ::oGet

  If ValType( oCol:oEdit ) == "O"
     ::lEditing := .F.
     oCol:oEdit:Hide()
     oCol:oEdit:End()
     oCol:oEdit := Nil
  EndIf

  ::oWnd:nLastKey := VK_ESCAPE
  ::lChanged := .F.
  ::SetMsg( oCol:cMsg )
  ::lEditing := .F.

  If ::lAppendMode

     ::lAppendMode := .F.
     ::lHitBottom  := .F.
     ::lNoPaint    := .F.

     If ::nLen <= ::nRowCount()
        ::Refresh( .T. )
        ::GoBottom()
     Else
        ::GoBottom()
     EndIf

  EndIf

  cMsg := If( ! Empty( oCol:cMsg ), oCol:cMsg, ::cMsg )
  cMsg := If( Valtype( cMsg ) == "B", Eval( cMsg, Self, ::nCell ), cMsg )
  ::SetMsg( cMsg )
  ::Refresh(.f.)

EndIf

Return Nil

ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin

Continue the discussion