Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
To lock screen or not
Message
From
15/04/2011 08:57:16
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01507393
Message ID:
01507455
Views:
58
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform