Table of Contents

CENTER method (Window)

Description

Centers a window on the desktop or its parent.

Syntax

NewSize = Exec_Method( WindowID,     
                       "CENTER",     
                       CenterParent, 
                       WindowSize,   
                       CalcOnly,     
                       ParentSize,   
                       Options )

Parameters

NameRequiredDescription
CenterParentNoIf TRUE$ then the window is centered on its parent, otherwise it is centered on the desktop. Defaults to FALSE$.
WindowSizeNoThis is an @fm-delimited array specifying the desired coordinates and size to move the window to:

<1> Left-position (if -1 then the window is centered on the X-axis)
<2> Top-position (if -1 then the window is centered on the Y-axis)
<3> Width (-1 means do not adjust the window width)
<4> Height (-1 means do not adjust the window height)

All of these values default to -1.
They must be in the same scale units as the window being centered.
CalcOnlyNoIf TRUE$ then the window is not moved or resized, but the resulting coordinates are returned instead. Defaults to FALSE$.
ParentSizeNoThis is an @fm-delimited array that can be used to override the size of the parent (if CenterParent is TRUE$), or the Desktop (if CenterParent is FALSE$).

<1> Left-position
<2> Top-position
<3> Width
<4> Height

They must be in the same scale units as the window begin centered.
OptionsNoThis is an @fm-delimited array of options structured like so:

<1> Force boundary check. If this is TRUE$ then the window is kept within the boundary of the desktop even if the WindowSize Top and Left positions have been explicitly specified.
<2> Desktop "anchor" window. Contains the name of a window to use when deciding which monitor to center the window on. The window is centered on the same desktop as the anchor window.

Returns

The new size of the window in the same format as the standard SIZE property.

Remarks

N/A

Example

 
// Center a window on the desktop

   Call Exec_Method( @Window. "CENTER" )

   

   // Center a window on its parent window

   Call Exec_Method( @Window. "CENTER", TRUE$ )

   

   // Center a window on the desktop with a specific size of 800x600

   WinSize = -1 : @Fm : -1 : @Fm : 800 : @Fm : 600

   Call Exec_Method( @Window. "CENTER", FALSE$, WinSize )

   

   // Center a window on the desktop with a specific size of 800x600

   // but only return the coordinates - do not update the window.

   WinSize = -1 : @Fm : -1 : @Fm : 800 : @Fm : 600

   NewSize = Exec_Method( @Window. "CENTER", FALSE$, WinSize, TRUE$ )

   

   // Center a window on the same desktop as the RTI_IDE window and

   // ensure it stays within the desktop boundary.

   WinSize    = -20 : @Fm : 10 : @Fm : 800 : @Fm : 600

   Options    = TRUE$

   Options<2> = "RTI_IDE"

   Call Exec_Method( @Window. "CENTER", FALSE$, WinSize, FALSE$, "", Options )
 
 
 

See Also

SIZE common property, SYSTEM MONITORLIST property.