Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
TABLEUPDATE(.T.) bombs with uncommitted changes
Message
De
01/10/2003 07:47:34
 
 
À
30/09/2003 22:20:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00833421
Message ID:
00833770
Vues:
28
Hello Luis.

Your solution doesn't work when the textbox is in a grid. Do you know how to solve this case?

What I do is add a method called WriteBuffer to my data aware form class. The save button in the tool bar calls _Screen.ActiveForm.Save() which, in turn, calls WriteBuffer(). This code in WriteBuffer():
LOCAL loColumn, loActiveControl, loControl, llRetVal

llRetVal = .T.
IF TYPE( 'Thisform.ActiveControl.Name' ) = 'C'
  loActiveControl = Thisform.ActiveControl
  IF UPPER( loActiveControl.BaseClass ) # 'GRID'
    *** If there is code in the valid method of the active control
    *** And the entry is invalid, the error message will display
    *** But the rest of the code code will continue to run and save
    *** the bad data anyway. So we cannot just issue a SetFocus()
    IF NOT EMPTY( loActiveControl.Valid() )
      *** We still have to cause the Valid to fire to update the data
      *** from what is in the buffer because the previous line
      *** does not cause the Valid to fire, it merely runs any code
      *** in that method
      loActiveControl.SetFocus()
      llRetVal = .T.
    ELSE
      llretVal = .F.
    ENDIF
  ELSE
    FOR EACH loColumn IN loActiveControl.Columns
      IF loActiveControl.ActiveColumn = loColumn.ColumnOrder
        loControl = EVAL( 'loColumn.'+ loColumn.CurrentControl )
        IF NOT EMPTY( loControl.Valid() )
          loControl.SetFocus()
          llRetVal = .T.
        ELSE
          llRetVal = .F.
        ENDIF
        EXIT
      ENDIF
    ENDFOR
  ENDIF      
ENDIF

RETURN llRetVal
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform