Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Edit Mode no more?
Message
De
29/10/1999 13:06:30
 
 
À
28/10/1999 15:33:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00283324
Message ID:
00283921
Vues:
11
Hi John.

>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform