Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
To lock screen or not
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01507393
Message ID:
01507455
Vues:
59
>Hi,
>
>When I started developing in VFP (I think around 1998) I read somewhere that it is a good idea to call .LockScreen .T. before calling form.refresh(). So I have in a lot of places in my application call to method Thisform.MyRefresh(). And the code in the MyRefresh() is
>
>
>thisform.Lockscreen = .T.
>thisform.refresh()
>thisform.Lockscreen= .F.
>
>
>Does it still make sense to keep this code? Or with the hardware we have today the refresh is just as fast with or without Lockscreen?

I still use Lockscreen in some places, it still happens that is is necessary.

However I advice to make use of the memento pattern which will solve a lot of your trouble and makes your code much more generic. Since I started implementing this I found many other situations where this technique can be used and makes your life easier.

Create a class which stores the initial setting in Init and restores the setting in Destroy().

Then you can instantiate the class and when the object gets released it reset's the state to it's original value.
LOCAL loLockscreen AS LockscreenState OF Utils_State
loLockscreen = NEWOBJECT("LockscreenState","Utils_State","",THISFORM)
THISFORM.Lockscreen = .T.
Anytime when you need to reset lockscreen, you release the object:
RELEASE loLockscreen
Or at the end of the method it releases automatically.
Christian Isberner
Software Consultant
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform