_SCREEN System Variable
Specifies properties and methods for the main Visual FoxPro window. You can use _SCREEN to manipulate the main Visual FoxPro window as an object. There are two versions of the syntax.
You cannot create events procedures for _SCREEN. However, you can use the BINDEVENT( ) Function to bind _SCREEN events to other object events and methods. _SCREEN is an object type system variable.
In versions of Visual FoxPro 7.0 and later, the Top, Height, Left, Width, and hWnd properties of _SCREEN apply only to the Visual FoxPro client area, which is the area that can display text. In versions prior to Visual FoxPro 7.0, the Top and Left properties reference the entire Visual FoxPro application window.
CLEAR WINDOWS or RELEASE WINDOWS sets the ReleaseType property for _SCREEN to 1. Closing the Windows operating system sets ReleaseType to 2. For more information, see CLEAR Commands and RELEASE WINDOWS Command.
The value returned by ReleaseType for _SCREEN can differ from the value returned by ReleaseType for forms because it is the main Visual FoxPro window.
The following example demonstrates the use of _SCREEN to customize the main Visual FoxPro window. The following lines of code declare local variables for storing the current settings:
Local oldScreenLeft Local oldScreenTop Local oldScreenHeight Local oldScreenWidth Local oldScreenColor
The following code saves the current settings of the main Visual FoxPro window:
WITH _SCREEN oldScreenLeft=.Left oldScreenTop=.Top oldScreenHeight=.Height oldScreenWidth=.Width oldScreenColor = .Backcolor
The following codes disable redrawing of the window, change the background color to grey, changes the border style, sets properties for the window's control buttons, makes the window movable at run time, specifies the height and width of the window, sets a caption for the window, and enables redrawing of the screen:
.LockScreen=.T. .BackColor=rgb(192,192,192) .BorderStyle=2 .Closable=.F. .ControlBox=.F. .MaxButton=.F. .MinButton=.T. .Movable=.T. .Height=285 .Width=550 .Caption="Custom Screen" .LockScreen=.F. ENDWITH =MESSAGEBOX("Return to normal ",48,WTITLE())
The following code sets the properties of the window to its original settings:
WITH _SCREEN .Left = oldScreenLeft .Top = oldScreenTop .Height = oldScreenHeight .Width = oldScreenWidth .BackColor=oldScreenColor .LockScreen=.T. .BorderStyle=3 .Closable=.T. .ControlBox=.T. .MaxButton=.T. .MinButton=.T. .Movable=.T. .Caption="Microsoft Visual FoxPro" .LockScreen=.F. ENDWITH