Partilhar via


Data Session Manager Foundation Class

Category Application
Default Catalog Visual FoxPro Catalog\Foundation Classes\Application
Class _datassession
Base Class Custom
Class Library _app.vcx
Parent Class _custom
Sample ...\Samples\Solution\Ffc\environ.scx

Remarks

This class is used to manage data sessions and handle data updates in all forms or formsets in the current data session. It enables an Application object to easily iterate through sessions to provide Windows-closing behavior during Exit or Shutdown. It also provides generic QueryUnload behavior for forms and formsets, and generic session-wide Update and Revert code. You can use it to evaluate whether any data has been changed in a session before you use your own conflict handling procedure.

This class works with free tables as well as tables in databases. Observe the transactions limit (5).

To use, drop the class on a project or form or, from the Component Gallery Item Shortcut Menu, select Add to Project or Add to Form. When you add the class to a form, Visual FoxPro places the class on the form. You can then specify the appropriate property values and provide any necessary input and output objects. When you drop the class on a project, you can choose between adding the class or creating a subclass.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods Description
iDataChangedMode property Specifies the type of data change
performed.

0 - Everything changed.
1 - Ignore view fields not in
Updatefields list.
2- Ignore views not set to send
updates.

Default: 0

iSavedSessionID property Specifies integer value representing the ID
of the saved session.
Default: 1
lSuccess property Specifies whether the data operation
(update) was successful.
Default: .T.
lUseTransactions property Specifies whether to wrap the updating
routine in a transaction.

Note   Only tables in a database
container (.dbc) are affected in
transactions.

Default: .T.

DataChanged method Checks if data has changed.
Syntax: DataChanged( )
Return: none
Arguments: none
DataFlush method Ensures that the active control will have
its current contents "recognized" even if
you choose to update from a toolbar
button while a grid has the focus.
Syntax: DataFlush( )
Return: none
Arguments: none
GetActiveControlRef method Returns the truly active control,
loRealActiveControl, in cases where the
current active control is a Grid.
Syntax: GetActiveControlRef(toActiveControl)
Return:loRealActiveControl
Arguments:
toActiveControl specifies the current
control.
GetMessageBoxTitle method Returns a portion of the titlebar text
specifying the name of the message.
Syntax: GetMessageBoxTitle( )
Return:cTitlebarText
Arguments: none
QueryUnload method Provides dialog boxes to manage data change decisions.
Syntax: QueryUnload(tlDataChangeAlreadyConfirmed, toForm, tlNoShow)
Return:liResult
Arguments:
tlDataChangeAlreadyConfirmed specifies whether data has been changed toForm specifiesthe form.
tlNoShow specifies whether to display the form.
liResult specifies the MESSAGEBOX or
value.
RestoreSessionID method Restores the data session.
Syntax: RestoreSessionID
Return: none
Arguments: none
Revert method Reverts the session to original data.
Syntax: Revert(tlUserChoiceAlreadyConfirmed, tlDataChangeAlreadyConfirmed, toForm, tlNoShow)
Return: none
Arguments: tlUserChoiceAlreadyConfirmed specifies whether to display a confirmation dialog box.
tlDataChangeAlreadyConfirmed specifies whether to display a confirmation dialog box.
toForm specifiesthe form.
tlNoShow specifies whether to display the form.
SetSessionID method Sets the data session.
Syntax: SetSessionID( )
Return: none
Arguments: none
Update method Updates data.
Syntax: Update(tlUserChoiceAlreadyConfirmed,
tlDataChangeAlreadyConfirmed, toForm,

tlNoShow)
Return: none
Arguments: tlUserChoiceAlreadyConfirmed
specifies whether to display a confirmation
dialog box.
tlDataChangeAlreadyConfirmed specifies
whether to display a confirmation dialog box.
toForm specifiesthe form.
tlNoShow specifies whether to display the
form.

See Also

Guidelines for Using Visual FoxPro Foundation Classes | Visual FoxPro Foundation Classes A-Z | Visual FoxPro Foundation Classes