LockScreen

This property lets you make a bunch of changes to a form at once without the user seeing each change as it happens. Not only that, it speeds up the process. However, be careful because it can make it look like the system is hung.

Usage

frmForm.LockScreen = lBatchChanges
lBatchChanges = frmForm.LockScreen
Some changes aren't batched, even when LockScreen is .T. It appears that the ones that affect the form window itself, like the form's Caption, BorderStyle, MaxButton, MinButton, ControlBox, and the like, and the ones controlling the form's position, like Left and Top, happen anyway. Changes that affect the interior of the form appear to be batched.Don't change WindowState while LockScreen is .T. The borders change, but the interior doesn't get repainted.Setting LockScreen can speed up the process of making changes because the form is repainted only once instead of multiple times. Even if wasn't really faster, it would probably look faster because the changes "snap" into place instead of being executed one at a time. (However, we should add that we've heard a few people argue that LockScreen actually slows things down. So, as always, test in your application for definitive answers.)OLE Controls typically are not affected by LockScreen because, even though we consider them to be "on" our forms, they are actually individual Windows windows, and they don't know from LockScreen. To make changes more quickly to some OLE Controls, turn LockScreen on for the form, then move the OLE Control to a position off-screen, say, -1000, -1000. Make the changes to the OLE Control, then put it back where it was. Set LockScreen to .F. and the form repaints. This trick can speed up the process of making a lot of changes to an OLE Control, in cases where each change normally would cause the entire control to repaint. A smart control recognizes that it is not in the visible area of the display, and doesn't bother with the relatively slow repainting.To make your heart stop, try setting LockScreen .T. for the active form, then Alt+Tab over to another application and back to Visual FoxPro. See how the box identifying Visual FoxPro doesn't go away? Imagine this happening to your user. How long would it take her to hit Ctrl+Alt+Delete? Make sure you don't leave LockScreen .T. for too long.

Example

ThisForm.LockScreen = .T.
ThisForm.BackColor = RGB(0,0,255)
ThisForm.Text1.Left = ThisForm.Text1.Left+10
ThisForm.SetAll("FontName", "Arial")
ThisForm.LockScreen = .F.

See Also

Paint, Refresh


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .