Article ID: 131017
Article Last Modified on 2/15/2000
Thisform.DataSessionID=_screen.ActiveForm.DataSessionID
_Screen.AddObject("ToolBartimer" MyTimerClass)
If you want the toolbar and the form to share data sessions, place the
following code in the Timer event method:
MyToolBar.DataSessionID = IIF(TYPE("_Screen.ActiveForm") == "O",;
_Screen.ActiveForm.DataSessionID,1)
In the Timer event code, use the GETFLDSTATE(-1) function to determine
if the data on the active form has been changed or deleted as in this
example code:
IF ( ("2" $ GETFLDSTATE(-1)) OR ;
("3" $ GETFLDSTATE(-1)) OR ;
("4" $ GETFLDSTATE(-1)) )
MyToolBar.cmdNewButton.Enabled = .F.
MyToolBar.cmdSaveButton.Enabled = .T.
MyToolBar.cmdUndoButton.Enabled = .T.
ELSE
MyToolBar.cmdNewButton.Enabled = .T.
MyToolBar.cmdSaveButton.Enabled = .F.
MyToolBar.cmdUndoButton.Enabled = .F.
ENDIF
NOTE: Make sure your toolbar does not contain any bound controls. Changing
the datasession of a bound form is not recommended.
Additional query words: VFoxWin
Keywords: kbcode KB131017