Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Edit Mode no more?
Message
De
29/10/1999 13:28:43
 
 
À
29/10/1999 13:06:30
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00283324
Message ID:
00283933
Vues:
9
Very interesting, Doug. So, in essence, the toolbar is managing it's own behavior by querying the form IsRecordChanged method.

What I did once, when I was getting all hot and bothered about the new VFP6 Access and Assign events, is create a public Custom class called OpenFormState. Since it was public, it was always available. Changes in a Form to indicate it was being edited or whatnot would be stored in a Form property. This property had an Assign which would change OpenFormState properties. OpenFormState had assigns to set toolbar and other app object features which would, with more Assigns, make the enabled/visible changes as the object level. Since each object set it's own attributes via it's own assigns, dependencies were minimized.


>
>>But how do you solve the "irrelevent enabled controls" problem? For example, is your Undo and/or Cancel button always enabled?
>
>I do this with a timer associated with the toolbar containing the buttons. The timer fires every couple of seconds and refreshes the toolbar. The Refresh method of each button class does whatever is necessary to enable or disable the button. For example, the Refresh method of my Cancel Changes button class looks like this (simplified slightly):
local llOK, ;
>    llOK2
>if type('_screen.ActiveForm.Name') = 'C'
>    llOK  = pemstatus(_screen.ActiveForm, 'Cancel', 5)
>    llOK2 = pemstatus(_screen.ActiveForm, 'IsRecordChanged', 5)
>    This.Enabled = llOK and llOK2 and ;
>        _screen.ActiveForm.IsRecordChanged()
>else
>    This.Enabled = .F.
>endif type('_screen.ActiveForm.Name') = 'C'
(The two PEMSTATUS tests are on separate lines on purpose as a workaround for a VFP bug that holds an object reference when more than one PEMSTATUS call is used in the same statement).
>
>This ensures the cancel button is only enabled if a form is open, if it has Cancel and IsRecordChanged methods (my base class for data entry forms has these methods), and the IsRecordChanged method of the form returns .T. That method uses GETFLDSTATE() (and some other convoluted code) to determine if something has changed.
>
>Doug
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform