Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Turning Toolbar Items off
Message
 
 
À
11/06/2002 18:55:30
Information générale
Forum:
Visual FoxPro
Catégorie:
CodeMine
Divers
Thread ID:
00658374
Message ID:
00668114
Vues:
26
Gary,

I have another question about this:

>>If you are trying to disable standard toolbar buttons, the form.IsEnabled method is still an OK place to do this, just as it is when you add a new record. If you want to do this when a record is in a "changed" state, the simplest way to determine this state is to test for "Thisform.lChanged" (being True). The instant a change is made to form bound data, the form's lChanged property is set True. This property is dynamically added in the form's load event so, you will not see it if you look in the form's property sheet at design time.<<

Using the following code, everything works perfectly when adding or changing a record - as far as disabling the Toolbar items. However, I have now placed a New, Delete, and Save button on the form. When pressing New, all the bottoms are disabled perfectly - the ones in the Toolbar and also the ones on the form. However, when a change is made to a field, the Toolbar buttons are disabled correctly, but the ones I placed on the form are not. Am I missing something here? The code I am using is:
FUNCTION frmdataform.isenabled

LPARAMETERS cMethod, cWorkArea

* Was taken from UT suggestion to turn off items when we are adding records.
if proper(m.cMethod) + "," $ 'Next,Last,Prior,First,Find,List,Delete,New,Report,'
   * The statemanager is checking a navigational button state.
   * But wait, do we have a New record?
   if thisform.cmDataManager.IsNew('Catcode')
      * Yes we have a new record, so return False which will disable the "state".
      return .F. 
   endif
   * But wait, do we have a Changed record? Check for it with lChange.
   if thisform.lChanged
      * Yes we have a changed record, so return False which will disable the "state".
      return .F. 
   endif
endif

* If we are here, we haven't got a New record in the cursor.
return dodefault(cMethod, cWorkarea)
Thanks,
Mel Cummings
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform