WONTOP( ) Function

Determines whether the active or specified window is in front of all other windows.

WONTOP([WindowName])

Return Values

Character or Logical

Parameters

  • WindowName
    Specifies the name of the window WONTOP( ) evaluates. You can specify the name of a user-defined window created with DEFINE WINDOW or a system window (the Command window, the Data Session window, a Browse window, and so on). If you omit WindowName, WONTOP( ) returns the name of the "frontmost" or active window. You can also include the empty string in WindowName to specify the main Visual FoxPro window.

    If the Debug, Trace, or Command window is active and you don't specify a window name, WONTOP( ) returns the name of the window most recently in front. When you are debugging a program that uses WONTOP( ), program execution isn't affected by bringing these windows forward.

Remarks

WONTOP( ) returns true (.T.) if the specified window is active. It returns false (.F.) if the window isn't active or doesn't exist.

Historically in prior versions of Visual FoxPro, the Data Session window has always been referred to as the View window. Additionally, language used to control this window, such as HIDE WINDOW, ACTIVATE WINDOW, WONTOP( ), also refers to this window as the View window. Visual FoxPro continues to refer to the View window for the WONTOP( ) function.

Example

The following example uses WONTOP( ) to display the name of the active window. Before you run this program, open some windows (Browse windows, the Data Session window, and so on), then run the example.

IF NOT EMPTY(WONTOP( ))
   WAIT WINDOW 'Frontmost window: ' + WONTOP( )
ELSE
   WAIT WINDOW 'No windows are open'
ENDIF

See Also

ACTIVATE WINDOW | DEFINE WINDOW | WEXIST( ) | WOUTPUT( ) | WVISIBLE( )