Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Tableupate doesn't work for grid
Message
From
03/06/2003 12:03:25
 
 
To
03/06/2003 11:31:30
Victor Verheij
International Film Festival Rotterdam
Rotterdam, Netherlands
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00795710
Message ID:
00795736
Views:
10
Hello Victor.

Is my assumption a correct one, and can anyone tell me how to fix this.

You need to add a method to your form class and call that method before you execute the code in its save method. If it returns false, you should abort the save because that means that a validation has failed somewhere along the line.

This code in the WriteBuffer() method:
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
Previous
Reply
Map
View

Click here to load this message in the networking platform