SaveDeferStateUpdate method (WinStudio scripts)

Applies To

IWSIDOCollection interface

Definition

Saves objects in a collection but does not perform subsequent operations that WinStudio normally performs after a save. Returns a Boolean value indicating whether the objects were saved successfully.

Syntax

object.SaveDeferStateUpdate( )

  Part   Description
object Required. A reference to a valid IDO collection object.

Remarks

A return value of:

  • TRUE indicates that objects in the collection were saved successfully.
  • FALSE indicates that the objects were not saved successfully.

After a Save operation, WinStudio normally performs the following tasks:

  • It deletes any objects in the collection that were marked for deletion.
  • It refreshes all modified objects and new objects and updates components bound to the refreshed data.
  • It resets the status of objects in the collection and of each individual property value as well as the status of components bound to the properties:
    • The New state is set to "not new."
    • The Modified state is set to "not modified."
    • The Save button is disabled.
    • All property values are marked as valid.

This method saves objects in a collection but does not perform the three subsequent tasks. In some cases, you might need to perform other actions after a Save has occurred but before the three tasks are performed. If your actions fail, you can then rollback the effects of the Save operation. This method allows you to do this.

This method is designed to be used in conjunction with the UpdateStatesPostSave method, which performs the three operations that WinStudio normally performs following a Save action.

Example

Sub Main()
  ' This sample shows a scheme for an event handler
  ' that replaces the default implementation of the StdFormSave
  ' event.
  Dim bSuccess As Boolean
        Dim ReturnValue As String
  bSuccess = ThisForm.CurrentIDOCollection.SaveDeferStateUpdate()
  If (bSuccess) Then
    ' Some custom processing that returns bSuccess
    ' for successful completion -- that is, a method call.
  End If
    ' Either complete or rollback the transaction based on bSuccess.
  If (bSuccess) Then
    ThisForm.CurrentIDOCollection.UpdateStatesPostSave()
  Else
    ' Process to rollback the transaction.
  End If
  ' Cancel the default processing.
  ReturnValue = "-1"
End Sub
相关主题