Framework Locking Service to Handle Unsaved Changes

In VLF-ONE applications use your own custom Framework manager logic instead. See Using a VLF-ONE Custom Framework Manager 

The VLF-WIN Framework manager provides a locking service that signals there are unsaved changes in a command handler or filter, and locks the Framework until the user has taken action to accept or cancel the changes.


A simple example of the use of a Framework lock is where a business object's details have been changed and the user then clicks on another instance of the same business object or invokes any other action in the Framework that would cause the changed details to be lost.

You can use the service to notify the user about unsaved changes and to lock the Framework when the business objects details change. A message is issued and the user has the choice of returning to the business object details to save them or continue with the requested action:

See the employee details command handler, DF_DET1, and the section details command handler, DF_DET8, for complete examples of the use of the Framework locking service in Windows applications.

Framework locking is implemented through two Framework properties that are exposed to filters and command handlers, uLocked and uLockedMessage.



USER means that the Framework is locked, but that the user can elect to end the lock.

PROGRAM means that the Framework is locked and only a program can unlock it by setting this property to FALSE.

PROGRAM_EXIT means that the Framework is locked except when exiting or closing down and only a program can unlock it by setting this property to FALSE.


This is the message to be shown to the user if they attempt to do something that would violate the lock state.


For example you could put this code in the Changed event of fields on a command handler to lock the Framework until the user has saved changes:

Set #avFrameworkManager uLocked(USER) uLockedMessage('Details for the current Employee not saved. Would you like to return to the details command to save.')

Note: Framework locks apply within the scope of each main Framework window. If the Allow this Object to be Opened in a New Window option is used to open a new main Framework window, the new window and all its child windows get their own (new) locking scope that is independent of all others.