How to Use Data Sessions in a Toolbar to Show ChangesID: Q131017 3.00 WINDOWS The information in this article applies to:
SUMMARYThis article describes two methods you can use to use data sessions in a toolbar to reflect changes among multiple instances of both parent and child forms. Multiple instances of both parent and child forms can be reflected in the toolbar and menu as focus shifts from one form to another.
MORE INFORMATIONThe main reason the DataSessionID property is read/write is so you can set non-databound forms or toolbars to link up with another private data session's form, formset, or toolbar. The toolbar can query the _Screen.Activeform property to determine which form is currently active. Each form can have a property identifying whether it's in the process of an edit or not.
Method OneMake sure the toolbox class has DataSessions=2. Then within a method of a toolbox subclass, try the following logic to manipulate data of the active form:
Method TwoUse a timer to determine the status of the active form, enabling or disabling controls on the toolbar as appropriate. In the toolbar's INIT event, add a Timer to the screen as follows:
If you want the toolbar and the form to share data sessions, place the
following code in the Timer event method:
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 ; ELSE
ENDIF
NOTE: Make sure your toolbar does not contain any bound controls. Changing the datasession of a bound form is not recommended. Additional reference words: 3.00 VFoxWin KBCategory: KBSubcategory: FxprgGeneral
|
Last Reviewed: May 22, 1998 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |