WCOLS( ) Function

JavaScript Editor js editor     Web development 



Main Page

Returns the number of columns within the active or specified window.

WCOLS([WindowName])

Parameters

WindowName


Specifies the window for which WCOLS(В ) returns the number of columns. In Visual FoxPro, you can also specify the name of a toolbar. If you do not specify a window, the number of columns in the active output window is returned. If no window is active, WCOLS(В ) returns the number of columns in the main Visual FoxPro window. You can specify the name of a system window (the Command window, the Data Session window, a Browse window, and so on) in WCOLS(В ) if the system window has been activated and is visible or hidden. In Visual FoxPro, you can specify the name of a toolbar (the Standard toolbar, the Color Palette toolbar, and so on) in WCOLS(В ) if the toolbar has been activated and is visible or hidden. If you specify the name of a system window or toolbar that has not been activated, Visual FoxPro generates an error message. The Debug window is an exception. Once the Debug window has been opened, its name can be included in WCOLS(В ) if it is visible, hidden or closed. You can also include the empty string as the window name to return the number of columns in the main Visual FoxPro window. The empty string can be used to specify the main Visual FoxPro window in functions such as WLCOL(В ), WLROW(В ), and WROWS(В ), which return window locations or sizes.

Return Value

Numeric

Remarks

In Visual FoxPro, the value returned by WCOLS(В ) depends on the font specified for the window. Many fonts can be displayed in a wide variety of sizes, and some are proportionally spaced. A column corresponds to the average width of a letter in the current font. For more information, see the Fonts Overview topic.

Example

The following example centers a short output message in the last row of a window of unknown size.

В Copy Code
CLEAR
DO SendMesg WITH 'Message', WCOLS( ), WROWS( ) –1

*** SendMesg ***

PROCEDURE SendMesg
PARAMETERS gcMsg, gnCol, gnRow
STORE (gnCol – LEN(gcMsg))/2 TO gnCol
@ gnRow, gnCol SAY gcMsg
RETURN

See Also



JavaScript Editor js editor     Web development