Information générale
Catégorie:
Programmation Orientée Object
>PROC Refresh
>WITH This
> DO CASE
> CASE ISNULL(.xyz)
> * nothing to do
> CASE .xyz = .T.
> * set enabled state to the same value of forms editmode
> .Enabled = ThisForm.lEditMode
> CASE .xyz = .F.
> * set enabled state to the opposite value of forms editmode
> .Enabled = (NOT ThisForm.lEditMode)
>ENDWITH
>ENDPROC
>
>
>Now the question: What is a good, proper, correct name of the property "xyz"?
I go with what some others have aluded to ... Have a "mode" property.
I think you're off on the wrong foot with "THISFORM.lEditMode"; this basically implies that the form can only have 2 modes ("editing" and "not editing"). I can think of several:
1) Browsing
2) Editing (or updating, or replacing)
3) Deleting
4) Adding (or Inserting, or Appending)
5) Initializing
6) Terminating
The button(s) are enabled/disabled based on the form's "mode".
A given "mode" doesn't always have to be obvious: pressing Delete while Browsing causes a mode change to "Deleting" and then back to "Browsing".
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement