Condividi tramite


_SCREEN System Variable

Specifies properties and methods for the main Visual FoxPro window.

_SCREEN.PropertyName [= eValue]

-or-

_SCREEN.MethodName

Parameters

  • PropertyName
    Specifies a property for the main Visual FoxPro window.
  • eValue
    Specifies a value for the property.
  • MethodName
    Specifies a method to execute for the main Visual FoxPro window.

Remarks

_SCREEN allows the main Visual FoxPro window to be manipulated as an object. Events procedures cannot be created for _SCREEN. _SCREEN is an object type system variable.

Beginning with Visual FoxPro 7, the Top, Height, Left, Width, and hWnd properties of _SCREEN apply only to the Visual FoxPro client area (the area where text can be displayed). In prior versions, the Top and Left properties referenced the entire Visual FoxPro application window. CLEAR WINDOWS or RELEASE WINDOWS also sets ReleaseType to 1. Closing the Windows Operating System will set ReleaseType to 2.

Note   The value returned by _SCREEN.ReleaseType can differ from the value returned by other forms because it is the main Visual FoxPro window.

Examples

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

See Also

_SCREEN System Variable Properties, Methods and Events | MODIFY WINDOW | Form Object