Syntax Conventions

The following typographic conventions are used:

Example	Convention
SET HELP TO	Capital letters denote commands and keywords, acronyms, constants, and device names.
Press the TAB key. Press SHIFT+F1.	Small capital letters denote the names of keys on the keyboard. A plus sign (+) indicates a combination of keys.
BUTTONS.VCX	Capital letters indicate file names.
C:\WINDOWS	Capital letters with separating backslashes are used for paths.
FontSize	Initial capital letters indicate the names of objects, properties, events, and methods. If the name consists of more than one word, the initial-capital words are concatenated.
event-driven	Italic letters denote defined terms the first time they occur in text.
IF StatusText() = "Test" = MESSAGEBOX( "OK" ) ENDIF	Monospace font indicates command lines you type, code examples, and references in text to the code examples.
USE customer	Lowercase letters indicate table and field names.
nTotal, cName	Lowercase letters prefix variable names and placeholders. The prefix indicates the data type of the variable: c for Character, n for Numeric, l for Logical, d for Date, t for DateTime, y for Currency, o for Object, and e for any expression.
In syntax, the following conventions are used:

Example	Convention
DELETE VIEW ViewName	In syntax, words in italics are placeholders for information you supply.
[STYLE cStyleName]	In syntax, brackets enclose optional items.
SET BELL ON | OFF	In syntax, a vertical bar separates two mutually exclusive choices.
[, WindowName2 …]	In syntax, an ellipsis indicates that an item can be repeated in a list any number of times. A comma separates the list items.


Character Functions

$ Operator

ALLTRIM( ) Function

ASC( ) Function

AT( ) Function

AT_C( ) Function

ATC( ) Function

ATCC( ) Function

ATCLINE( ) Function

ATLINE( ) Function

BETWEEN( ) Function

CHR( ) Function

CHRTRAN( ) Function

CHRTRANC( ) Function

CPCONVERT( ) Function

CTOD( ) Function

DIFFERENCE( ) Function

DTOC( ) Function

EMPTY( ) Function

EVALUATE( ) Function

INLIST( ) Function

ISALPHA( ) Function

ISDIGIT( ) Function

ISLEADBYTE( )

ISLOWER( ) Function

ISUPPER( ) Function

LEFT( ) Function

LEFTC( ) Function

LEN( ) Function

LENC( ) Function

LIKE( ) Function

LIKEC( ) Function

LOWER( ) Function

LTRIM( ) Function

MAX( ) Function

MIN( ) Function

NORMALIZE( ) Function

OCCURS( ) Function

PADC( ) Function

PADL( ) Function

PADR( ) Function

PROPER( ) Function

RAT( ) Function

RATC( ) Function

RATLINE( ) Function

REPLICATE( ) Function

RIGHT( ) Function

RIGHTC( ) Function

RTRIM( ) Function

SOUNDEX( ) Function

SPACE( ) Function

STR( ) Function

STRCONV( ) Function

STRTRAN( ) Function

STUFF( ) Function

STUFFC( ) Function

SUBSTR( ) Function

SUBSTRC( ) Function

SYS(10) Function - String From Day Number

SYS(15) Function - Character Translation

SYS(2007) Function - Check Sum Value

TRANSFORM( ) Function

TRIM( ) Function

TXTWIDTH( ) Function

TYPE( ) Function

UPPER( ) Function


Data Conversion Functions

CHR( ) Function

CTOD( ) Function

CURVAL( ) Function

DTOC( )

MTON( ) Function

NTOM( ) Function

NVL( ) Function

STR( )

SYS(10) Function - String From Day Number

SYS(15) Function - Character Translation

TRANSFORM( ) Function

TTOC( ) Function

TTOD( ) Function

VAL( ) Function


Date and Time Functions

BETWEEN( ) Function

CDOW( ) Function

CMONTH( ) Function

CTOD( ) Function

CTOT( ) Function

DATE( ) Function

DATETIME( ) Function

DAY( ) Function

DMY( ) Function

DOW( ) Function

DTOC( ) Function

DTOS( ) Function

DTOT( ) Function

EMPTY( ) Function

FDATE( ) Function

FTIME( ) Function

GOMONTH( ) Function

HOUR( ) Function

INLIST( ) Function

MAX( ) Function

MDY( ) Function

MIN( ) Function

MINUTE( ) Function

MONTH( ) Function

SEC( ) Function

SECONDS( ) Function

SET HOURS Command

SET MARK TO Command

SET SECONDS Command

SYS(1) Function - Julian System Date

SYS(2) Function - Seconds Since Midnight

SYS(10) Function - String From Day Number

SYS(11) Function - Julian Day Number

TIME( ) Function

TTOC( ) Function

TTOD( ) Function

WEEK( ) Function

YEAR( ) Function


Numeric Functions

% Operator

ABS( ) Function

ACOS( ) Function

ASIN( ) Function

ATAN( ) Function

ATN2( ) Function

BETWEEN( ) Function

BITAND( ) Function

BITCLEAR( ) Function

BITLSHIFT( ) Function

BITNOT( ) Function

BITOR( ) Function

BITRSHIFT( ) Function

BITSET( ) Function

BITTEST( ) Function

BITXOR( ) Function

CALCULATE Command

CEILING( ) Function

COS( ) Function

DTOR( ) Function

EMPTY( ) Function

EXP( ) Function

FLOOR( ) Function

FV( ) Function

INLIST( ) Function

INT( ) Function

LOG( ) Function

LOG10( ) Function

MAX( ) Function

MIN( ) Function

MOD( ) Function

PAYMENT( ) Function

PI( ) Function

PV( ) Function

RAND( ) Function

ROUND( ) Function

RTOD( ) Function

SET DECIMALS Command

SIGN( ) Function

SIN( ) Function

SQRT( ) Function

TAN( ) Function

VAL( ) Function


Database Manipulation

ADATABASES( ) Function

ADD TABLE Command

APPEND PROCEDURES Command

AUSED( ) Function

CLOSE TABLES Command

COMPILE DATABASE Command

COPY PROCEDURES Command

CREATE CONNECTION Command

CREATE DATABASE Command

CREATE SQL VIEW Command

CREATE TRIGGER Command

CREATEOFFLINE( ) Function

DROPOFFLINE( ) Function

CURSORGETPROP( ) Function

CURSORSETPROP( ) Function

CURVAL( ) Function

DATETIME( ) Function

DBC( ) Function

DBGETPROP( ) Function

DBSETPROP( ) Function

DBUSED( ) Function

DELETE - SQL Command

DELETE CONNECTION Command

DELETE DATABASE Command

DELETE TRIGGER Command

DELETE VIEW Command

DISPLAY CONNECTIONS Command

DISPLAY DATABASE Command

DISPLAY PROCEDURES Command

DISPLAY TABLES Command

DISPLAY VIEWS Command

FREE TABLE Command

GETFLDSTATE( ) Function

GETNEXTMODIFIED( ) Function

INDBC( ) Function

ISEXCLUSIVE( ) Function

LIST CONNECTIONS Command

LIST DATABASE Command

LIST PROCEDURES Command

LIST TABLES Command

LIST VIEWS Command

MODIFY CONNECTION Command

MODIFY DATABASE Command

MODIFY PROCEDURE Command

MODIFY VIEW Command

OLDVAL( ) Function

OPEN DATABASE Command

PACK DATABASE Command

REFRESH( ) Function

REMOVE TABLE Command

RENAME CONNECTION Command

RENAME TABLE Command

RENAME VIEW Command

REQUERY( ) Function

SET DATABASE Command

SET DATASESSION Command

SETFLDSTATE( ) Function

SQLCANCEL( ) Function

SQLCOLUMNS( ) Function

SQLCOMMIT( ) Function

SQLCONNECT( ) Function

SQLDISCONNECT( ) Function

SQLEXEC( ) Function

SQLGETPROP( ) Function

SQLMORERESULTS( ) Function

SQLROLLBACK( ) Function

SQLSETPROP( ) Function

SQLSTRINGCONNECT( ) Function

SQLTABLES( ) Function

TABLEREVERT( ) Function

TABLEUPDATE( ) Function

_TRIGGERLEVEL System Memory Variable

VALIDATE DATABASE Command


Field Manipulation

AFIELDS( ) Function

BLANK Command

DELETED( ) Function

FCOUNT( ) Function

FIELD( ) Function

FLDLIST( ) Function

FSIZE( ) Function

GATHER Command

ISBLANK( ) Function

LUPDATE( ) Function

NDX( ) Function

SCATTER Command

SET BLOCKSIZE Command

SET EXACT Command

SET NOCPTRANS Command

SET TEXTMERGE Command

SET TEXTMERGE DELIMITERS Command

SYS(14) Function - Index Expression


Indexes

CANDIDATE( ) Function

CDX( ) Function

CLOSE Commands

COPY INDEXES Command

COPY TAG Command

DESCENDING( ) Function

DELETE TAG Command

FOR( ) Function

IDXCOLLATE( ) Function

INDEX Command

KEY( ) Function

KEYMATCH( ) Function

MDX( ) Function

NDX( ) Function

ORDER( ) Function

PRIMARY( ) Function

REINDEX Command

SET COLLATE Command

SET INDEX Command

SET KEY Command

SET ORDER Command

SET UNIQUE Command

SYS(14) Function - Index Expression

SYS(21) Function - Controlling Index Number

SYS(2021) Function - Filtered Index Expression

TAG( ) Function

TAGCOUNT( ) Function

TAGNO( ) Function

UNIQUE( ) Function


Record Manipulation

APPEND FROM Command

APPEND MEMO Command

BLANK Command

CONTINUE Command

DELETE - SQL Command

FILTER( ) Function

GO|GOTO Commands

INSERT Command

INSERT - SQL Command

ISBLANK( ) Function

KEYMATCH( ) Function

LOCATE Command

LOOKUP( ) Function

REPLACE FROM ARRAY Command

SEEK Command

SEEK( ) Function

SET COLLATE Command

SET FILTER Command

SET KEY Command

SET NEAR Command

SET RELATION Command

SKIP Command

UPDATE - SQL Command


Relations

RELATION( ) Function

SELECT - SQL Command

SET RELATION Command

SET RELATION OFF Command

SET SKIP Command

TARGET( ) Function


Table Manipulation

ADD TABLE Command

ALTER TABLE - SQL Command

APPEND Command

AUSED( ) Function

AVERAGE Command

BEGIN TRANSACTION Command

BROWSE Command

CHANGE Command

CLOSE TABLES Command

COPY MEMO Command

COPY STRUCTURE Command

COPY STRUCTURE EXTENDED Command

COPY TO Command

COUNT Command

CPCURRENT( ) Function

CPDBF( ) Function

CREATE Command

CREATE FROM Command

CREATE QUERY Command

CREATE TABLE - SQL Command

CURVAL( ) Function

DELETE Command

DELETE - SQL Command

DELETED( ) Function

DISPLAY STRUCTURE Command

DISPLAY TABLES Command

EDIT Command

END TRANSACTION Command

EXPORT Command

FLUSH Command

GETFLDSTATE( ) Function

GETNEXTMODIFIED( ) Function

IMPORT Command

ISEXCLUSIVE( ) Function

ISREADONLY( ) Function

LIST TABLES Command

MEMLINES( ) Function

MLINE( ) Function

MODIFY GENERAL Command

MODIFY MEMO Command

MODIFY QUERY Command

MODIFY STRUCTURE Command

OLDVAL( ) Function

PACK Command

RECALL Command

REFRESH( ) Function

REMOVE TABLE Command

REPLACE Command

REPLACE FROM ARRAY Command

RENAME TABLE Command

ROLLBACK Command

SELECT Command

SELECT - SQL Command

SET ANSI Command

SET AUTOSAVE Command

SET DATASESSION Command

SET DELETED Command

SET FIELDS Command

SET NULL Command

SET OLEOBJECT Command

SET OPTIMIZE Command

SORT Command

SUM Command

SYS(2029) - Table Type

TABLEREVERT( ) Function

TABLEUPDATE( ) Function

TOTAL Command

TXNLEVEL( ) Function

UPDATE Command

UPDATE - SQL Command

USE Command

USED( ) Function

ZAP Command


Environment

ADIR( ) Function

ASSIST Command

_BROWSER System Memory Variable

_BUILDER System Memory Variable

CAPSLOCK( ) Function

COL( ) Function

CREATE COLOR SET Command

CREATE VIEW Command

DECLARE - DLL Command

DIR or DIRECTORY Command

DISKSPACE( ) Function

DISPLAY DLLS Command

DISPLAY STATUS Command

FKLABEL( ) Function

FKMAX( ) Function

FONTMETRIC( ) Function

GETCOLOR( ) Function

GETCP( ) Function

GETENV( ) Function

GETFILE( ) Function

GETFONT( ) Function

GETPEM( ) Function

HOME( ) Function

HELP Command

IMESTATUS( ) Function

INKEY( ) Function

INSMODE( ) Function

ISCOLOR( ) Function

ISMOUSE( ) Function

LIST DLLS Command

LIST STATUS Command

LOCFILE( ) Function

MEMORY( ) Function

MESSAGE( ) Function

NUMLOCK( ) Function

OBJTOCLIENT( ) Function

OS( ) Function

PCOL( ) Function

PEMSTATUS( ) Function

PROW( ) Function

PUTFILE( ) Function

QUIT Command

READKEY( ) Function

RGB( ) Function

ROW( ) Function

SCHEME( ) Function

_SCREEN System Memory Variable

SET( ) Function

SET Command

SET ANSI Command

SET BELL Command

SET BLOCKSIZE Command

SET CENTURY Command

SET CLEAR Command

SET CLOCK Command

SET CPDIALOG Command

SET COLOR OF Command

SET COLOR OF SCHEME Command

SET COLOR SET Command

SET COMPATIBLE Command

SET CURRENCY Command

SET DATE Command

SET DEBUG Command

SET DEFAULT Command

SET DISPLAY Command

SET FDOW Command

SET FIXED Command

SET FUNCTION Command

SET FWEEK Command

SET HELP Command

SET HELPFILTER Command

SET INTENSITY Command

SET KEYCOMP Command

SET LIBRARY Command

SET MARK TO Command

SET NOTIFY Command

SET PATH Command

SET POINT Command

SET RESOURCE Command

SET SEPARATOR Command

SET STATUS BAR Command

SET SYSFORMATS Command

SET TALK Command

SET TEXTMERGE Command

SET TEXTMERGE DELIMITERS Command

SET TOPIC Command

SET TOPIC ID Command

SET TYPEAHEAD Command

SET VIEW Command

SYS(3) - Legal File Name

SYS(5) Function - Default Drive

SYS(6) Function - Current Printer Device

SYS(7) Function - Current Format File

SYS(9) Function - Visual FoxPro Serial Number

SYS(12) Function - Available Memory in Bytes

SYS(16) Function - Executing Program File Name

SYS(17) Function - Processor in Use

SYS(18) Function - Current Control

SYS(24) Function - EMS Memory Limit

SYS(100) Function - Console Setting

SYS(101) Function - Device Setting

SYS(102) Function - Printer Setting

SYS(103) Function - Talk Setting

SYS(1001) Function - Visual FoxPro Memory

SYS(1016) Function - User Object Memory Use

SYS(1023) - Enable Help Diagnostic Mode

SYS(1024) - Disable Help Diagnostic Mode

SYS(1269) - Property Information

SYS(1270) - Object Location

SYS(1271) - Object's .SCX File

SYS(1272) - Object Hierarchy

SYS(2001) Function - SET ... Command Status

SYS(2003) Function - Current Directory

SYS(2004) Function - Visual FoxPro Start Directory

SYS(2005) Function - Current Resource File

SYS(2006) Function - Current Graphics Card

SYS(2010) Function - CONFIG.SYS File Settings

SYS(2013) Function - System Menu Name String

SYS(2016) Function - SHOW GETS WINDOW Name

SYS(2017) Function - Display Startup Screen

SYS(2019) Function - Configuration File Name and Location

SYS(2020) Function - Default Disk Size

SYS(2022) - Disk Cluster (Block) Size

SYS(2023) Function - Temporary File Drive

SYS(3004) - Return Locale ID

SYS(3005) - Set Locale ID

SYS(3006) - Set Language and Locale IDs

SYS(3050) - Set Buffer Memory Size

SYS(3053) - ODBC Environment Handle

SYSMETRIC( ) Function

TXTWIDTH( ) Function

VERSION( ) Function

WFONT( ) Function

_WIZARD System Memory Variable


File Management

ADIR( ) Function

ASSIST Command

CD | CHDIR Command

CLOSE ALL Command

CLOSE ALTERNATE Command

CLOSE DATABASES Command

CLOSE FORMAT Command

CLOSE INDEXES Command

CLOSE PROCEDURE Command

COPY FILE Command

CREATE VIEW Command

CURDIR( ) Function

DELETE FILE Command

DIR or DIRECTORY Command

DISPLAY FILES Command

DISKSPACE( ) Function

ERASE Command

FDATE( ) Function

FTIME( ) Function

FILE( ) Function

FLUSH Command

FULLPATH( ) Function

GETFILE( ) Function

GETPICT( ) Function

ISNULL( ) Function

LIST FILES Command

LOCFILE( ) Function

MD | MKDIR Command

MODIFY COMMAND Command

MODIFY FILE Command

NVL( ) Function

OPEN DATABASE Command

PUTFILE( ) Function

RD | RMDIR Command

RENAME Command

SET ALTERNATE Commands

SET DEFAULT Command

SET FULLPATH Command

SET PATH Command

SET SAFETY Command

SET VIEW Command

SYS(3) - Legal File Name

SYS(2000) Function - File Name Wildcard Match

SYS(2014) Function - Minimum Path

TYPE Command


Shared Access to Data


Shared Access to Data

CURSORSETPROP( ) Function

CURVAL( ) Function

FLOCK( ) Function

LOCK( ) Function

OLDVAL( ) Function

RLOCK( ) Function

SET EXCLUSIVE Command

SET LOCK Command

SET MULTILOCKS Command

SET REFRESH Command

SET REPROCESS Command

SYS(3051) - Set Lock Retry Interval

SYS(3052) - Override SET REPROCESS Locking

TABLEREVERT( ) Function

TABLEUPDATE( ) Function

UNLOCK Command


Commands that Scope to a Data Session

SET ANSI

SET AUTOSAVE

SET BLOCKSIZE

SET CARRY

SET CENTURY

SET COLLATE

SET CONFIRM

SET CURRENCY

SET DATABASE

SET DATE

SET DECIMALS

SET DELETED

SET DELIMITERS

SET EXACT

SET EXCLUSIVE

SET FIELDS

SET FIXED

SET LOCK

SET MARK TO

SET MEMOWIDTH

SET MULTILOCKS

SET NEAR

SET NULL

SET PATH

SET POINT

SET REFRESH

SET REPROCESS

SET SAFETY

SET SEPARATOR

SET TALK

SET UNIQUE

To find out more about controlling input and output from your applications, choose one of the following sections.

•	Data Formatting

•	Keyboard and Mouse Input

•	Menus and Menu Bars

•	Printing

•	Reports and Labels

•	Windows


Data Formatting

\ | \\ Commands

? | ?? Commands

@ ... BOX Command

@ ... CLEAR Command

@ ... EDIT - Edit Boxes Command

@ ... FILL Command

@ ... GET - Check Boxes Command

@ ... GET - Combo Boxes Command

@ ... GET - Command Buttons Command

@ ... GET - List Boxes Command

@ ... GET - Option Buttons Command

@ ... GET - Spinners Command

@ ... GET - Text Boxes Command

@ ... GET - Transparent Buttons Command

@ ... SAY Command

@ ... TO Command

ACTIVATE SCREEN Command

APPEND Command

BROWSE Command

CHANGE Command

CLEAR Commands

CLEAR READ Command

CLOSE FORMAT Command

COL( ) Function

COMPILE FORM Command

CREATE FORM Command

CREATE SCREEN Command

DISPLAY Command

EDIT Command

FUNCTION Command

INKEY( ) Function

LIST Commands

MESSAGEBOX( ) Function

MODIFY FORM Command

MODIFY SCREEN Command

OBJNUM( ) Function

OBJTOCLIENT( ) Function

OBJVAR( ) Function

RDLEVEL( ) Function

READ Command

READKEY( ) Function

RESTORE SCREEN Command

ROW( ) Function

SAVE SCREEN Command

SCOLS( ) Function

SCROLL Command

SET CARRY Command

SET CLEAR Command

SET COLOR OF Command

SET COLOR OF SCHEME Command

SET COLOR SET Command

SET COLOR TO Command

SET CONFIRM Command

SET CONSOLE Command

SET CURSOR Command

SET DECIMALS Command

SET DEVICE Command

SET FIXED Command

SET FORMAT Command

SET HEADINGS Command

SET MARK TO Command

SET MEMOWIDTH Command

SET MESSAGE Command

SET ODOMETER Command

SET SPACE Command

SET TEXTMERGE Command

SET TEXTMERGE DELIMITERS Command

SHOW GET Command

SHOW GETS Command

SHOW OBJECT Command

SROWS( ) Function

SYS(7) Function - Current Format File

SYS(100) Function - Console Setting

SYS(101) Function - Device Setting

SYS(2002) Function - Turn Insertion Point On or Off

TEXT ... ENDTEXT Command

TRANSFORM( ) Function

UPDATED( ) Function


Menus and Menu Bars

\ | \\ Command

ACTIVATE POPUP Command

BAR( ) Function

BARPROMPT( ) Function

CLEAR MENUS Command

CLEAR POPUPS Command

CNTBAR( ) Function

CNTPAD( ) Function

CREATE MENU Command

DEACTIVATE MENU Command

DEACTIVATE POPUP Command

DEFINE BAR Command

DEFINE MENU Command

DEFINE PAD Command

DEFINE POPUP Command

GETBAR( ) Function

GETPAD( ) Function

HIDE MENU Command

HIDE POPUP Command

MODIFY MENU Command

MOVE POPUP Command

MRKBAR( ) Function

MRKPAD( ) Function

ON BAR Command

ON EXIT BAR Command

ON EXIT MENU Command

ON EXIT PAD Command

ON EXIT POPUP Command

ON PAD Command

ON SELECTION BAR Command

ON SELECTION MENU Command

ON SELECTION PAD Command

ON SELECTION POPUP Command

PAD( ) Function

POP MENU Command

POP POPUP Command

POPUP( ) Function

PRMBAR( ) Function

PRMPAD( ) Function

PROMPT( ) Function

PUSH MENU Command

PUSH POPUP Command

RELEASE BAR Command

RELEASE MENUS Command

RELEASE PAD Command

RELEASE POPUPS Command

SET BORDER Command

SET MARK OF Command

SET SKIP OF Command

SIZE POPUP Command

SKPBAR( ) Function

SKPPAD( ) Function

SHOW MENU Command

SHOW POPUP Command

SYS(2013) Function - System Menu Name String


Printing

_ASCIICOLS System Memory Variable

_ASCIIROWS System Memory Variable

\ | \\ Command

? | ?? Command

??? Command

@ ... SAY Command

APRINTERS( ) Function

CLOSE ALTERNATE Command

DEFINE BOX Command

DISPLAY Command

EJECT Command

EJECT PAGE Command

GETPRINTER( ) Function

LIST Commands

ON PAGE Command

PCOL( ) Function

PRINTJOB ... ENDPRINTJOB Command

PRINTSTATUS( ) Function

PROW( ) Function

PRTINFO( ) Function

SET MARGIN Command

SET PDSETUP Command

SET PRINTER Commands

SYS(6) Function - Current Printer Device

SYS(13) Function - Printer Status

SYS(102) Function - Printer Setting

SYS(1037) - Page Setup Dialog Box

TYPE Command


Reports and Labels

_ASCIICOLS System Memory Variable

_ASCIIROWS System Memory Variable

\ | \\ Command

CREATE LABEL Command

CREATE REPORT Command

LABEL Command

MODIFY LABEL Command

MODIFY REPORT Command

REPORT Command


Keyboard and Mouse Input

CAPSLOCK( ) Function

CHRSAW( ) Function

CLEAR MACROS Command

CLEAR TYPEAHEAD Command

INSMODE( ) Function

KEYBOARD Command

LASTKEY( ) Function

MCOL( ) Function

MDOWN( ) Function

MOUSE Command

MROW( ) Function

NUMLOCK( ) Function

ON KEY Command

ON KEY LABEL Command

PLAY MACRO Command

POP KEY Command

PUSH KEY Command

RESTORE MACROS Command

SAVE MACROS Command

SET FUNCTION Command

SET KEYCOMP Command

SET MACKEY Command

SET TYPEAHEAD Command


Windows

ACTIVATE WINDOW Command

CLEAR WINDOWS Command

CREATE SCREEN Command

DEACTIVATE WINDOW Command

DEFINE WINDOW Command

HIDE WINDOW Command

MODIFY SCREEN Command

MODIFY WINDOW Command

MOVE WINDOW Command

RELEASE WINDOWS Command

RESTORE WINDOW Command

SAVE WINDOWS Command

SET BORDER Command

SET WINDOW OF MEMO Command

SHOW WINDOW Command

SIZE WINDOW Command

SYS(2016) Function - SHOW GETS WINDOW Name

WBORDER( ) Function

WCHILD( ) Function

WCOLS( ) Function

WEXIST( ) Function

WFONT( ) Function

WLAST( ) Function

WLCOL( ) Function

WLROW( ) Function

WMAXIMUM( ) Function

WMINIMUM( ) Function

WONTOP( ) Function

WOUTPUT( ) Function

WPARENT( ) Function

WREAD( ) Function

WROWS( ) Function

WTITLE( ) Function

WVISIBLE( ) Function

ZOOM WINDOW Command

Find the programming information you want by choosing one of the following sections:

•	Array Manipulation

•	Debugging and Error Handling

•	Event Handlers

•	Low-Level File Functions

•	Object-Oriented Programming

•	Program Execution

•	Structured Programming

•	Variable Manipulation


Array Manipulation

ACOPY( ) Function

ADEL( ) Function

ADIR( ) Function

AELEMENT( ) Function

AFIELDS( ) Function

AINS( ) Function

ALEN( ) Function

APPEND FROM ARRAY Command

ASCAN( ) Function

ASORT( ) Function

ASUBSCRIPT( ) Function

COPY TO ARRAY Command

DECLARE Command

DIMENSION Command

GATHER Command

SCATTER Command


Debugging and Error Handling

* Command

&& Command

AERROR( ) Function

CLEAR EVENTS Command

DEBUG Command

DEBUGOUT Command

ERROR Command

ERROR( ) Function

EXTERNAL Command

LINENO( ) Function

MESSAGE( ) Function

NOTE Command

ON ERROR Command

ON READERROR Command

ON( ) Function

PROGRAM( ) Function

RETRY Command

SET DEBUG Command

SET DEVELOPMENT Command

SET ECHO Command

SET TALK Command

SET TRBETWEEN Command

SYS(16) Function - Executing Program File Name

SYS(18) Function - Current Control

SYS(2018) Function - Error Message Parameter

VARREAD( ) Function

WAIT Command


Event Handlers

ON ERROR Command

ON ESCAPE Command

ON KEY Command

ON KEY LABEL Command

ON PAD Command

ON SELECTION PAD Command

ON SELECTION POPUP Command

ON SHUTDOWN Command

ON( ) Function

READ EVENTS Command


Low-Level File Functions

FCHSIZE( ) Function

FCLOSE( ) Function

FCREATE( ) Function

FEOF( ) Function

FERROR( ) Function

FFLUSH( ) Function

FGETS( ) Function

FOPEN( ) Function

FPUTS( ) Function

FREAD( ) Function

FSEEK( ) Function

FWRITE( ) Function

HEADER( ) Function


Object-Oriented Programming

:: Scope Resolution Operator

@ ... CLASS Command

_WIZARD System Memory Variable

ACLASS( ) Function

ADATABASES( ) Function

ADBOBJECTS( ) Function

ADD CLASS Command

AINSTANCE( ) Function

AMEMBERS( ) Function

ASELOBJ( ) Function

_BUILDER System Memory Variable

COMPOBJ( ) Function

CREATE CLASS Command

CREATE CLASSLIB Command

CREATEOBJECT( ) Function

DEFINE CLASS Command

DISPLAY OBJECTS Command

GETOBJECT( ) Function

LIST OBJECTS Command

LOADPICTURE( ) Function

MODIFY CLASS Command

RELEASE CLASSLIB Command

REMOVE CLASS Command

RENAME CLASS Command

SAVEPICTURE( ) Function

_SCREEN System Memory Variable

SET CLASSLIB Command

SET OLEOBJECT Command

WITH ... ENDWITH Command


Program Execution

BUILD APP Command

BUILD DLL Command

BUILD EXE Command

BUILD PROJECT Command

CALL Command

CANCEL Command

CLEAR PROGRAM Command

CLOSE ALL Command

CLOSE PROCEDURE Command

COMPILE Command

CREATE PROJECT Command

#DEFINE ... #UNDEF Preprocessor Directive

DO Command

DO FORM Command

FUNCTION Command

#IF ... #ENDIF Preprocessor Directive

#INCLUDE Preprocessor Directive

LOAD Command

LPARAMETERS Command

MESSAGEBOX( ) Function

MODIFY PROJECT Command

PARAMETERS Command

PARAMETERS( ) Function

PROCEDURE Command

RELEASE PROCEDURE Command

RESUME Command

RETURN Command

RUN | ! Command

SET ESCAPE Command

SET LIBRARY Command

SET LOGERRORS Command

SET PROCEDURE Command

SET SYSMENU Command

SET UDFPARMS Command

SUSPEND Command

SYS(2015) Function - Unique Procedure Name

WAIT Command


Structured Programming

DO CASE ... ENDCASE Command

DO WHILE ... ENDDO Command

EXIT Command

FOR ... ENDFOR Command

#IF ... #ENDIF Preprocessor Directive

#IFDEF | #IFNDEF ... #ENDIF Preprocessor Directive

IF ... ENDIF Command

IIF( ) Function

SCAN ... ENDSCAN Command


Variable Manipulation

& Command

= Command

ACOPY( ) Function

ADEL( ) Function

ADIR( ) Function

AELEMENT( ) Function

AFIELDS( ) Function

AINS( ) Function

LEN( ) Function

ASCAN( ) Function

ASORT( ) Function

ASUBSCRIPT( ) Function

AVERAGE Command

CLEAR ALL Command

CLEAR MEMORY Command

COUNT Command

DISPLAY MEMORY Command

GETEXPR Command

LIST MEMORY Command

LOCAL Command

PARAMETERS Command

PRIVATE Command

PUBLIC Command

REGIONAL Command

RELEASE Command

RESTORE FROM Command

SAVE TO Command

STORE Command

SUM Command

WAIT Command


#DEFINE ... #UNDEF Preprocessor Directive

Syntax         Arguments         Remarks         Example         See Also

Creates and releases compile-time constants.

Syntax

#DEFINE ConstantName eExpression
...

#UNDEF ConstantName

Arguments

ConstantName   Specifies a compile-time constant name. The constant name must be a legitimate Visual FoxPro name that begins with a letter or an underscore and consists of up to 254 letters, digits, or underscores. To improve program readability and simplify debugging, capitalize your constant names and use a standard naming convention for them.

Important     Do not use Visual FoxPro keywords for constant names.

To stop text substitution for a constant created with #DEFINE, issue #UNDEF ConstantName.

eExpression   Specifies the value of the compile-time constant. eExpression can be a name or an expression that evaluates to a character, numeric, currency, date, datetime, or logical value.

Important     Do not use system variables for eExpression. System variables are not evaluated until run time.

Remarks

The #DEFINE and #UNDEF preprocessor directives are used to create compile-time constants in programs. By creating constants with #DEFINE instead of using variables, you can reduce memory consumption, increase performance, and simplify programs.

To create a constant with #DEFINE, specify the constant’s name with ConstantName and its value with eExpression. When the program is compiled, text substitution is performed and the constant value expression is substituted for the constant name wherever it appears in the program. You can stop the substitution for the constant by issuing #UNDEF.

Substitution occurs only in program lines that follow the #DEFINE statement that creates the constant and that precede the #UNDEF statement for that constant. The constant is available only to the program that creates the constant.

If #DEFINE is placed within an event or method procedure in a form, the #DEFINE compile time constant is available only within the event or method procedure. To make #DEFINE compile time constants available to all event and method procedures in a form, choose the Include File menu item from the Form menu and specify a header file containing the #DEFINE compile time constants.


DEFINE ... #UNDEF Preprocessor Directive Example

The following program creates a compile-time constant named MAXITEMS. This constant is used in a FOR ... NEXT loop to display the numbers 1 through 10.

#DEFINE MAXITEMS 10

CLEAR

FOR gnCount = 1 TO MAXITEMS

? gnCount

NEXT


See Also

COMPILE
#IF ... #ENDIF
#IFDEF | #IFNDEF ... #ENDIF


#IF ... #ENDIF Preprocessor Directive

Syntax         Arguments         Remarks         Example         See Also

Conditionally includes source code at compile time.

Syntax

#IF nExpression1 | lExpression1
Commands
[#ELIF nExpression2 | #ELIF lExpression2
Commands
 ...
#ELIF nExpressionN | #ELIF lExpressionN
Commands]
[#ELSE
Commands]
#ENDIF

Arguments

#IF nExpression1 | lExpression1
Commands   nExpression1 specifies the numeric expression that is evaluated.

•	If the expression is nonzero, the commands immediately following #IF are included in the compiled code. The #IF ... #ENDIF structure is exited, and the first program line following #ENDIF is then compiled.

•	If the expression is 0, the commands immediately following #IF are not included in the compiled code. Any following #ELIF directives are evaluated.

lExpression1 specifies the logical expression that is evaluated.

•	If the expression is true (.T.), the commands immediately following #IF are included in the compiled code. The #IF ... #ENDIF structure is exited, and the first program line following #ENDIF is then compiled.

•	If the expression is false (.F.), the commands immediately following #IF are not included in the compiled code. Any following #ELIF directives are evaluated.

Note   Do not specify system variables for nExpression1 or lExpression1. System variables are not evaluated until run time.

#ELIF nExpression2 | #ELIF lExpression2
Commands
 ...

#ELIF nExpressionN | #ELIF lExpressionN
Commands   If nExpression1 is 0 or lExpression1 is false (.F.), the #ELIF directives are evaluated. The first #ELIF expression nExpression2 or lExpression2, if present, is evaluated. If nExpression2 is nonzero or lExpression2 is true (.T.), the commands following #ELIF are included in the compiled code. The #IF ... #ENDIF structure is exited, and the first program line following #ENDIF is then compiled.

If nExpression2 is 0 or lExpression2 is false (.F.), the commands following #ELIF are not included in the compiled code. The next #ELIF directive is evaluated.

#ELSE Commands   If no #ELIF directives are included, or if those that are included evaluate to 0 or false (.F.), the presence or absence of #ELSE determines whether any additional commands are included in the compiled code:

•	If #ELSE is included, the commands following #ELSE are included in the compiled code.

•	If #ELSE is not included, none of the commands between #IF and #ENDIF are included in the compiled code. The #IF ... #ENDIF structure is exited, and compilation continues on the first program line following #ENDIF.

#ENDIF   Indicates the end of the #IF statement.

Remarks

#IF ... #ENDIF can improve the readability of source code, reduce compiled program size, and, in some cases, improve performance.

When the #IF ... #ENDIF structure is compiled, successive logical or numeric expressions within the structure are evaluated. The evaluation results determine which set of Visual FoxPro commands (if any) are included in the compiled code.


IF ... #ENDIF Preprocessor Directive Example

In the following example, the #IF ... #ENDIF structure determines which version of Visual FoxPro compiles the program and then displays the appropriate message.

#IF 'WINDOWS' $ UPPER(VERSION( ))

? 'This was compiled under Visual FoxPro for Windows'

#ELIF 'MAC' $ UPPER(VERSION( ))

? 'This was compiled under Visual FoxPro for Macintosh'

#ELIF 'UNIX' $ UPPER(VERSION( ))

? 'This was compiled under FoxPro for UNIX'

#ELSE

? 'This was compiled under FoxPro for MS-DOS'

#ENDIF


See Also

COMPILE
#DEFINE ... #UNDEF
#IFDEF | #IFNDEF ... #ENDIF


#IFDEF | #IFNDEF ... #ENDIF Preprocessor Directive

Syntax         Arguments         Remarks         Example         See Also

Conditionally includes a set of commands at compile time if a compile time constant is defined.

Syntax

#IFDEF | #IFNDEF ConstantName
Commands
[#ELSE
Commands]
#ENDIF

Arguments

#IFDEF   Specifies that a set of commands is included at compile time when the ConstantName is defined.

The following describe how a set of commands is included at compile time when you include #IFDEF:

•	If ConstantName is defined, the set of commands following #IFDEF and preceding #ELSE or #ENDIF (whichever occurs first) is included at compile time.

•	If ConstantName is not defined and #ELSE is included, the set of commands following #ELSE and preceding #ENDIF is included at compile time.

•	If ConstantName is not defined and #ELSE is not included, no commands within the #IFDEF ... #ENDIF structure are included at compile time.

#IFNDEF   Specifies that a set of commands is included at compile time when the ConstantName is not defined.

The following describe how a set of commands is included at compile time when you include #IFNDEF:

•	If ConstantName is not defined, the set of commands following #IFNDEF and preceding #ELSE or #ENDIF (whichever occurs first) is included at compile time.

•	If ConstantName is defined and #ELSE is included, the set of commands following #ELSE and preceding #ENDIF is included at compile time.

•	If ConstantName is defined and #ELSE is not included, no commands within the #IFNDEF ... #ENDIF structure are included at compile time.

ConstantName   Specifies the compile time constant whose existence determines whether a set of commands is included at compile time. Compile time constants are defined with #DEFINE.

Commands   Specifies the set of commands that is included at compile time.

Remarks

You can nest an #IFDEF | #IFNDEF ... #ENDIF structure within another #IFDEF | #IFNDEF ... #ENDIF structure.

Comments can be placed on the same line after #IFDEF, #IFNDEF, #ELSE, and #ENDIF. These comments are ignored during compilation and program execution.


IFDEF | #IFNDEF ... #ENDIF Preprocessor Directive Example

The following example creates a compile time constant named MYDEFINE. #IFDEF ... #ENDIF displays a message if the compile time constant has been defined.

#DEFINE MYDEFINE 1

#IFDEF MYDEFINE

WAIT WINDOW "MYDEFINE exists"

#ELSE

WAIT WINDOW "MYDEFINE does not exist"

#ENDIF


See Also

COMPILE
#DEFINE ... #UNDEF
#IF ... #ENDIF
#INCLUDE


#INCLUDE Preprocessor Directive

Syntax         Arguments         Remarks         Example         See Also

Tells the Visual FoxPro preprocessor to treat the contents of a specified header file as if it appeared in a Visual FoxPro program.

Syntax

#INCLUDE FileName

Arguments

FileName   Specifies the name of the header file that is merged into the program during compilation.

You can include a path with the header file name. When you include a path with the header file name, Visual FoxPro searches for the header file only in the specified location.

If you do not include a path with the header file name, Visual FoxPro searches for the header file in the default Visual FoxPro directory, and then along the Visual FoxPro path. The Visual FoxPro path is specified with SET PATH.

Remarks

You can create header files containing preprocessor directives and then use #INCLUDE to merge the contents of the header file into a program when the program is compiled. The contents of the header file are inserted into the program during compilation at the point where #INCLUDE appears in the program.

Only the #DEFINE ... #UNDEF and #IF ... #ENDIF preprocessor directives are recognized in a header file. Comments and Visual FoxPro commands included in a header file are ignored.

A program can contain any number of #INCLUDE directives. These directives can appear anywhere within the program. #INCLUDE directives can also appear in header files, allowing you to nest #INCLUDE directives.

Header files typically have an .H extension, although they can have any extension. A Visual FoxPro header file, FOXPRO.H, is included. It contains many of the constants described throughout this documentation.


INCLUDE Preprocessor Directive Example

In the following example, two files are used: CONST.H, a header file, and MYPROG.PRG, a program file. The header file contains several #DEFINE directives that create compile time constants. The program file uses #INCLUDE to merge the CONST.H header file at compilation, making the compile time constants in the header file available to the program.

*** Header file CONST.H ***

#DEFINE ERROR_NODISK	    1

#DEFINE ERROR_DISKFULL  2

#DEFINE ERROR_UNKNOWN  3

*** Program file MYPROG.PRG ***

#INCLUDE CONST.H

FUNCTION chkerror

PARAMETER errcode

  DO CASE

    CASE errcode = ERROR_NODISK

      ?"Error - No Disk"

    CASE errcode = ERROR_DISKFULL

      ?"Error - Disk Full"

    CASE errcode = ERROR_UNKNOWN

      ?"Unknown Error"

  ENDCASE

RETURN


See Also

#DEFINE ... #UNDEF
#IF ... #ENDIF
#IFDEF | #IFNDEF ... #ENDIF


:: Scope Resolution Operator

Syntax         Remarks         Example         See Also

Runs a parent class method from within a subclass method.

Syntax

cClassName::cMethod

Remarks

The :: operator is used to execute a parent class method from within a subclass method. When you create a subclass, the subclass methods are automatically inherited from the parent class. The :: operator lets you execute the parent class method in the subclass method and then perform additional processing for the subclass method. The subclass definitions in the example demonstrate how the :: operator is used to execute the parent class method within a subclass method.

For additional information about the :: scope resolution operator, see Chapter 3, “Object-Oriented Programming” in the Developer’s Guide.


:: Scope Resolution Operator Examples

The following example creates a form and adds two command buttons to the form. By clicking either button, you can exit the form – the second button, cmdAnotherButton, calls the Click procedure from cmdQuit. This action is possible because of subclassing. The scope resolution operator calls the parent class code for the subclassed object.

frmMyForm = CREATEOBJECT("Form")

frmMyForm.Width      = 450

frmMyForm.Height     = 100

frmMyForm.Caption    = "Scope Resolution Example"

frmMyForm.AutoCenter =.T.

frmMyForm.AddObject("cmdQuit","cmdQuitButton")

frmMyForm.AddObject("cmdAnother","cmdAnotherButton")

frmMyForm.SHOW                   && Display the form

READ EVENTS                      && Start event processing

The following example defines two command buttons. The first button will be used to subclass the second button. The subclassing can be seen by the FontBold and ForeColor properties which are defined for cmdQuit, but never explicitly set for the cmdAnotherButton.We are defining cmdAnotherButton to be a subclass of the cmdQuitButton. As a result, this button will pick up all the attributes defined above for cmdQuitButton.

DEFINE CLASS cmdQuitButton AS CommandButton

    Caption    = "\<Quit"       && Caption on command button

    Left       = 175            && Left edge of button

    Top        = 60             && Position for top of button

    Height     = 25             && Button height

    Visible    = .T.            && Show button on form

    FontItalic = .T.            && Turn on italic text

    ForeColor  = RGB(0,0,255)   && Change button text color

    PROCEDURE Click

      WAIT WINDOW "Executing the CLICK procedure for cmdQuit." TIMEOUT 1

      CLEAR EVENTS           && Stop event processing, close Form

ENDDEFINE

DEFINE CLASS cmdAnotherButton AS cmdQuitButton

    Caption = "Click to quit"

    Left    = 175

    Top     = 30

    Height  = 25

    PROCEDURE Click

      WAIT WINDOW "Click event for button: cmdAnotherButton" TIMEOUT 1

      cmdQuitButton::Click

ENDDEFINE


See Also

ADD CLASS
CREATE CLASS
CREATE CLASSLIB
CREATEOBJECT( )
DEFINE CLASS
GETOBJECT( )
MODIFY CLASS
RELEASE CLASSLIB
SET CLASSLIB
WITH ... ENDWITH


$ Operator

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns true (.T.) if a character expression is contained in another character expression; otherwise, returns false (.F.).

Syntax

cSearchFor $ cSearchIn

Returns

Logical

Arguments

cSearchFor   Specifies the expression looked for within cSearchIn.

cSearchIn   Specifies the expression that is searched to see if it contains cSearchFor.

If cSearchFor is found in cSearchIn, $ returns true (.T.); otherwise, it returns false (.F.). cSearchFor and cSearchIn can be Character-type variables or array elements, Character-type fields, character string literals, or memo fields of any length.

Memo fields can be manipulated like character expressions, fields in tables, variables, or array elements. For example, if MEMO_FLD is a memo field, the following is acceptable:

LIST FOR 'FOX' $ UPPER(memo_fld)

Remarks

If the character expression isn’t found, false (.F.) is returned. The $ operator is case-sensitive and is not Rushmore optimizable.


$ Operator Example

The following example creates a table called memotest containing one memo field. Three records are appended to the table. LIST is used to display the three records. The dollar sign ($) is used to list the records that contain the string “FOX”. The files created for the example are then deleted.

CLOSE DATABASES

CLEAR

CREATE TABLE memotest (Text C(3), Memo M)

INSERT INTO  memotest (Text, Memo) VALUES ('Fox', 'Fox')

INSERT INTO  memotest (Text, Memo) VALUES ('Cat', 'Cat')

INSERT INTO  memotest (Text, Memo) VALUES ('FOX', 'FOX')

LIST FIELDS  Memo, Text FOR 'FOX' $ UPPER(Memo)

USE

DELETE FILE memotest.dbf

DELETE FILE memotest.fpt


See Also

AT( )


% Operator

Syntax         Arguments         Remarks         Example         See Also

Returns the remainder (modulus) obtained by dividing one numeric expression into another.

Syntax

nDividend % nDivisor

Arguments

nDividend   Specifies the dividend (numeric expression being divided). The number of decimal places in nDividend determines the number of decimal places in the result.

nDivisor   Specifies the divisor (the numeric expression dividing the dividend nDividend). A positive number is returned if nDivisor is positive; a negative number if nDivisor is negative. nDivisor cannot be zero.

Remarks

The modulus operator (%) and MOD( ) return identical results.

The modulus operator (%) is an arithmetic operator. Other arithmetic operators are: + (addition), - (subtraction), * (multiplication), / (division), and ^ (exponentiation). When these operators are combined in a numeric expression, % has the same precedence as * and /.


% Operator Example

? 36 % 10	&& Displays 6

? (4*9) % (90/9)	&& Displays 6

? 25.250 % 5.0	&& Displays 0.250

? IIF(YEAR(DATE( )) % 4 = 0, 'Summer Olympics this year';

, 'No Summer Olympics this year')


See Also

MOD( )


& Command

Syntax         Arguments         Remarks         Example         See Also

Performs macro substitution.

Syntax

& VarName[.cExpression]

Arguments

& VarName   Specifies the name of the variable or array element to reference in the macro substitution. Do not include the M. prefix that distinguishes variables from fields. Such inclusion causes a syntax error. The macro should not exceed the maximum statement length permitted in Visual FoxPro.

A variable cannot reference itself recursively in macro substitution. For example, the following generates an error message:

STORE '&gcX' TO gcX

? &gcX

Macro substitution statements that appear in DO WHILE, FOR, and SCAN are evaluated only at the start of the loop and are not reevaluated on subsequent iterations. Any changes to the variable or array element that occur within the loop are not recognized.

.cExpression   The optional period (.) delimiter and .cExpression are used to append additional characters to a macro. cExpression appended to the macro with .cExpression can also be a macro. If cExpression is a property name, include an extra period (cExpression..PropertyName).

Remarks

Macro substitution treats the contents of a variable or array element as a character string literal. When an ampersand (&) precedes a Character-type variable or array element, the contents of the variable or element replace the macro reference. You can use macro substitution in any command or function that accepts a character string literal.

Tip   Whenever possible, use a name expression instead of macro substitution. A name expression operates like macro substitution. However, a name expression is limited to passing character strings as names. Use a name expression for significantly faster processing if a command or function accepts a name (a file name, window name, menu name, and so on).

While the following commands are acceptable:

STORE 'customer' TO gcTableName

STORE 'company'  TO gcTagName

USE &gcTableName ORDER &gcTagName

use a name expression instead:

USE (gcTableName) ORDER (gcTagName)

Macro substitution is useful for substituting a keyword in a command. In the following example, the TALK setting is saved to a variable so the setting can be restored later in the program. The original TALK setting is restored with macro substitution.


& Command Example

STORE SET('TALK') TO gcSaveTalk

SET TALK OFF

*

*  Additional program code

*

SET TALK &gcSaveTalk  && Restore original TALK setting


See Also

STORE


&& Command

Syntax         Arguments         Remarks         Example         See Also

Indicates the beginning of a nonexecuting inline comment in a program file.

Syntax

&& [Comments]

Arguments

Comments   Indicates that inline comments follow. For example:

STORE (20*12) TO gnPayments  && 20 years of monthly payments

Inserting inline comments to denote the end of the IF ... ENDIF, DO, and FOR ... ENDFOR structured programming commands greatly improves the readability of programs.

Remarks

Place a semicolon (;) at the end of each comment line that continues to a following line. You cannot place && and a comment after the semicolon used to continue a command line to an additional line.


&& Command Example

NOTE  Initialize the page number;

variable.

STORE 1 to gnPageNum

* Set up the loop

DO WHILE gnPageNum <= 25  && loop 25 times

gnPageNum = gnPageNum + 1

ENDDO  && DO WHILE gnPageNum <= 25


See Also

*
MODIFY COMMAND
MODIFY FILE
NOTE


* Command

Syntax         Arguments         Remarks         Example         See Also

Indicates the beginning of a nonexecuting comment line in a program file.

Syntax

* [Comments]

Arguments

Comments   Specifies the comment in the comment line. For example:

*	This is a comment

Remarks

Place a semicolon (;) at the end of each comment line that continues to a following line.


* Command Example

* Initialize the page number;

variable.

STORE 1 to gnPageNum

* Set up the loop

DO WHILE gnPageNum <= 25  && loop 25 times

gnPageNum = gnPageNum + 1

ENDDO  && DO WHILE gnPageNum <= 25


See Also

&&
MODIFY COMMAND
MODIFY FILE
NOTE


= Command

Syntax         Arguments         Remarks         See Also

Evaluates one or more expressions.

Syntax

= Expression1 [, Expression2 ...]

Arguments

Expression1 [, Expression2 ...]   Specifies the expression or expressions that the = command evaluates.

Remarks

The = command evaluates one or more expressions, Expression1, Expression2 ..., and discards the return values. This option is particularly useful when a Visual FoxPro function or a user-defined function has a desired effect, but there is no need to assign the function’s return value to a variable, array element, or field.

For example, to turn insert mode on, you can issue the command:

= INSMODE(.T.)

INSMODE normally returns a true (.T.) or false (.F.) value. In the example above, the function is executed but the return value is discarded.

If only one expression (Expression1) is included, the equal sign is optional.

Note   There are two unrelated uses for the equal sign (=). It can be used as an operator in logical expressions to make a comparison, or to assign values to variables and array elements. In these two cases, the equal sign (=) is an operator and not a command.


See Also

EVALUATE


\ | \\ Command

Syntax         Arguments         Remarks         Example         See Also

Prints or displays lines of text.

Syntax

\TextLine

 – Or –

\\TextLine

Arguments

 \TextLine   When you use \, the text line is preceded by a carriage return and a linefeed.

 \\TextLine   When you use \\, the text line is not preceded by a carriage return and linefeed.

Any spaces preceding \ and \\ are not included in the output line, but spaces following \ and \\ are included.

You can embed an expression in the text line. If the expression is enclosed in the text merge delimiters (<<  >> by default) and SET TEXTMERGE is ON, the expression is evaluated and its value is output as text.

Remarks

The \ and \\ commands facilitate text merge in Visual FoxPro. Text merge lets you output text to a file to create form letters or programs.

Use \ and \\ to output a text line to the current text-merge output file and the screen. SET TEXTMERGE is used to specify the text merge output file. If text merge isn’t directed to a file, the text line is output only to the main Visual FoxPro window or the active user-defined output window. SET TEXTMERGE NOSHOW suppresses output to the main Visual FoxPro window or the active user-defined window.


\ | \\ Command Example

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE Customer	  && Open customer table

SET TEXTMERGE ON

SET TEXTMERGE TO letter.txt

\<<CDOW(DATE( ))>>, <<CMONTH(DATE( ))>>

\\ <<DAY(DATE( ))>>, <<YEAR(DATE( ))>>

\

\

\Dear <<contact>>

\Additional text

\

\Thank you,

\

\XYZ Corporation

CLOSE ALL

MODIFY FILE letter.txt NOEDIT


See Also

_PRETEXT
SET TEXTMERGE
SET TEXTMERGE DELIMITERS
_TEXT
TEXT ... ENDTEXT


? | ?? Command

Syntax         Arguments         Remarks         Example         See Also

Evaluates expressions and displays the results.

Syntax

? | ?? Expression1
[PICTURE cFormatCodes] | [FUNCTION cFormatCodes] | [VnWidth]
[AT nColumn]
[FONT cFontName [, nFontSize] [STYLE cFontStyle | Expression2]]
[, Expression3] ...

Arguments

? Expression1   Evaluates the expression specified by Expression1 and sends a carriage return and linefeed before the expression results. The results are displayed on the next line of the main Visual FoxPro window or the active user-defined window and printed at the left margin of a page, unless a function code cFormatCodes or the _ALIGNMENT system variable specifies otherwise.

If you omit the expressions, a blank line is displayed or printed. A space is placed between expression results when multiple expressions are included.

?? Expression1   Evaluates the expression specified by Expression1 and displays the expression results on the current line at the current position of the main Visual FoxPro window, an active user-defined window, or the printer. A carriage return and linefeed are not sent before the results.

PICTURE cFormatCodes   Specifies a picture format in which the result of Expression1 is displayed. cFormatCodes can consist of function codes, picture codes, or a combination of both. You can use the same picture and function codes available in the Format and InputMask properties.

Function codes affect the overall format of the result; picture codes act on individual characters in the result. If function codes are used in cFormatCodes, they must appear before the picture codes and they must be preceded by @. Multiple function codes with no embedded spaces can immediately follow @. The last function code must be followed by one or more spaces. The space or spaces signal the end of the function codes and the start of the picture codes.

FUNCTION cFormatCodes   Specifies a function code to include in ? and ?? output. If the function clause is included, do not precede the function codes with @. Function codes must be preceded by @ when included in PICTURE.

VnWidth   Specifies a special function code that enables the results of a character expression to stretch vertically within a limited number of columns. nWidth specifies the number of columns in the output.

? 'This is an example of how the V function code works.' ;

FUNCTION 'V10'

AT nColumn   Specifies the column number where the output is displayed. This option lets you align output in columns to create a table. The numeric expression nColumn can be a user-defined function that returns a numeric value.

FONT cFontName [, nFontSize]   Specifies a font for ? | ?? output. cFontName specifies the name of the font, and nFontSize specifies the point size. For example, the following command displays the system date in 16-point Courier font:

? DATE( ) FONT 'Courier',16

If you include the FONT clause but omit the point size nFontSize, a 10-point font is used.

If you omit the FONT clause and ? | ?? output is placed in the main Visual FoxPro window, the main Visual FoxPro window font is used for the output. If you omit the FONT clause and ? | ?? output is placed in a user-defined window, the user-defined window font is used for the output.

•	If the font you specify is not available, a font with similar font characteristics is substituted.

STYLE cFontStyle   Specifies a font style for ? | ?? output. If you omit the STYLE clause, the Normal font style is used.  If the font style you specify is not available, a font style with similar characteristics is substituted.

Note   You must include the FONT clause when you specify a font style with the STYLE clause.

The font styles you can specify with cFontStyle are as follows:

Character	Font style
B	Bold
I	Italic
N	Normal
O	Outline
Q	Opaque
S	Shadow
-	Strikeout
T	Transparent
U	Underline
You can include more than one character to specify a combination of font styles. For example, the following command displays the system date in Courier Bold Italic:

? DATE( ) FONT 'COURIER' STYLE 'BI'

Remarks

? and ?? evaluate expressions and send the results to the main Visual FoxPro window, an active user-defined window, or the printer.

If SET PRINTER is ON, the expression results are directed to the printer and the main Visual FoxPro window or an active user-defined window. If SET PRINTER is ON and SET CONSOLE is OFF, the results are directed only to the printer.


? | ?? Command Example

? 15 * (10+10)

? 'Welcome to ' PICTURE '@!'

?? 'Visual FoxPro'


See Also

???
@ ... SAY
SET MEMOWIDTH
SET PRINTER


??? Command

Syntax         Arguments         Remarks         See Also

Sends output directly to the printer.

Syntax

??? cExpression

Arguments

cExpression   Specifies the characters that are sent to the printer.

Remarks

A group of three question marks bypasses the printer driver and sends the contents of cExpression directly to the printer. cExpression must contain valid printer codes.

Printer control codes allow you to reset the printer, change type styles and sizes, and enable or disable boldface printing. These codes can consist of any combination of printable or non-printable characters that are specific to the printer you’re using. You can direct control codes to the printer in several different ways:

•	Use combinations of CHR( ) and quoted strings concatenated with + to send ASCII characters directly to the printer.

•	Use quotation marks to send a string containing printer codes or ASCII characters.

•	Codes can be sent to the printer before printing begins and after printing ends with the _PSCODE and _PECODE system variables. For more information, see _PSCODE and _PECODE.

Printer control codes vary from printer to printer. The best source for information about printer control codes is the manual that came with your printer.


See Also

? | ??
@ ... SAY
CHR( )
Print Dialog Box


@ ... BOX Command

Included for backward compatibility. Use the Shape control instead.


@ ... CLASS Command

Syntax         Arguments         Remarks         Example         See Also

Creates a control or object that can be activated with READ.

Syntax

@ nRow, nColumn CLASS ClassName NAME ObjectName

Arguments

@ nRow, nColumn   Specifies the position of the control or object. The height and width of the control or object is determined by the class default height and width values.

Rows are numbered from top to bottom. The first row is number 0 in the main Visual FoxPro window or in a user-defined window. Row 0 is the row immediately beneath the Visual FoxPro system menu bar.

Columns are numbered from left to right. The first column is number 0 in the main Visual FoxPro window or in a user-defined window. When a control or object is placed in a user-defined window, the row and column coordinates are relative to the user-defined window, not to the main Visual FoxPro window.

A position in the main Visual FoxPro window or in a user-defined window is determined by the font of the window. Most fonts can be displayed in a wide variety of sizes; some are proportionally spaced. A row corresponds to the height of the current font; a column corresponds to the average width of a letter in the current font.

You can position the control or object using decimal fractions for row and column coordinates.

CLASS ClassName   Specifies the class of the control or object. ClassName can be a Visual FoxPro base class or a user-defined class. The following table lists the Visual FoxPro base classes you can specify for ClassName.

Base class names
CheckBox	Line
Column	ListBox
ComboBox	OLEControl
CommandButton	OLEBoundControl
CommandGroup	OptionButton
Container	OptionGroup
Control	Page
Cursor	PageFrame
Custom	Relation
DataEnvironment	Separator
EditBox	Shape
Grid	Spinner
Header	TextBox
Image	Timer
Label
NAME ObjectName   Specifies the name of the object reference variable to create. The object-oriented properties, events, and methods of the control or object can be manipulated by referencing this variable.

Remarks

@ ... CLASS provides an intermediate step for converting programs and applications created in earlier versions of FoxPro to the preferred object-oriented programming methods of Visual FoxPro. For additional information about backward compatibility with FoxPro 2.x controls, see Controls and Objects.

For information about object-oriented programming in Visual FoxPro, see Chapter 3, “Object-Oriented Programming,” in the Developer’s Guide.


@ ... CLASS Command Example

The following example demonstrates how @ ... CLASS can be used with programming techniques used in earlier FoxPro versions (in this example, use of READ to activate controls). @ ... CLASS is used to create a text box whose properties can be changed with the Visual FoxPro object-oriented programming techniques.

ON KEY LABEL is used to display the Windows Color dialog box when you press . The TextBox is placed on the main Visual FoxPro window using @ ... CLASS, and READ activates the text box.

CLEAR

ON KEY LABEL CTRL+I _SCREEN.PageFrame1.Page1.goFirstName.BackColor;

 = GETCOLOR( )

@ 2,2 SAY 'Press Ctrl+I to change the background color'

@ 4,2 CLASS TextBox NAME goFirstName

READ

CLEAR


See Also

CREATEOBJECT( )
DEFINE CLASS
READ
_SCREEN


@ ... CLEAR Command

Syntax         Arguments         Remarks         Example         See Also

Clears a portion of the main Visual FoxPro window or a user-defined window.

Syntax

@ nRow1, nColumn1 [CLEAR | CLEAR TO nRow2, nColumn2]

Arguments

@ nRow1, nColumn1 CLEAR   Clears a rectangular area whose upper-left corner begins at nRow1 and nColumn1 and continues to the lower-right corner of the main Visual FoxPro window or a user-defined window.

CLEAR TO nRow2, nColumn2   Clears a rectangular area whose upper-left corner is at nRow1 and nColumn1 and whose lower-right corner is at nRow2 and nColumn2.

Remarks

If you omit CLEAR or CLEAR TO, Visual FoxPro clears nRow1 from nColumn1 to the end of the row.


@ ... CLEAR Command Example

The following example clears the screen, main Visual FoxPro window, or user-defined window from the second row to the bottom of the window.

@ 2,0 CLEAR

The following example clears a rectangular region. The area from row 10 and column 0 to row 20 and column 20 is cleared.

@ 10,0 CLEAR TO 20,20


See Also

CLEAR


@ ... EDIT - Edit Boxes Command

Included for backward compatibility. Use the EditBox control instead.


@ ... FILL Command

Syntax         Arguments         Remarks         Example         See Also

Changes the colors of existing text within an area of the screen.

Syntax

@ nRow1, nColumn1 FILL TO nRow2, nColumn2
[COLOR SCHEME nSchemeNumber | COLOR ColorPairList]

Arguments

@ nRow1, nColumn1   Specifies the upper-left corner of the area to change.

FILL TO nRow2, nColumn2   Specifies the lower-right corner of the area to change.

COLOR SCHEME nSchemeNumber   Specifies the color of the area. Only the first color pair in the specified color scheme determines the color of the area.

COLOR ColorPairList   Specifies the color of the area. Only the first color pair in the specified color pair list determines the color of the area.

If you omit the COLOR SCHEME or COLOR clauses, the rectangular portion is cleared. An area can also be cleared with @ ... CLEAR.

For information about color schemes and color pairs, see the Colors Overview topic.

Remarks

This command changes the colors of text within a rectangular area of the main Visual FoxPro window or the active user-defined window. You can set the foreground and background color attributes for existing text only. Any text output to the same area after you issue @ ... FILL appears in the default screen or window colors.


@ ... FILL Command Example

The following example clears the main Visual FoxPro window and fills an area with color.

ACTIVATE SCREEN

CLEAR

@ 4,1 FILL TO 10, 8 COLOR GR+/B


See Also

@ ... SAY
Colors Overview


@ ... GET - Check Boxes Command

Included for backward compatibility. Use the CheckBox control instead.


@ ... GET - Combo Boxes Command

Included for backward compatibility. Use the ComboBox control instead.


@ ... GET - Command Buttons Command

Included for backward compatibility. Use the CommandButton control instead.


@ ... GET - List Boxes Command

Included for backward compatibility. Use the ListBox control instead.


@ ... GET - Option Buttons Command

Included for backward compatibility. Use the OptionGroup control instead.


@ ... GET - Spinners
@ ... GET - Spinners Command

Included for backward compatibility. Use the Spinner control instead.


@ ... GET - Text Boxes Command

Included for backward compatibility. Use the TextBox control instead.


@ ... GET - Transparent Buttons Command

Included for backward compatibility. Use the CommandButton control instead.


@ ... MENU Command

Included for backward compatibility. Use the Menu Designer and CREATE MENU instead.


@ ... PROMPT Command

Included for backward compatibility. Use the Menu Designer and CREATE MENU instead.


@ ... SAY Command

Included for backward compatibility. Use the Label control to display text and the TextBox control to display the contents of fields and variables.


@ ... SAY - Pictures & OLE Objects Command

Included for backward compatibility. Use the Image, OLE Bound and OLE Container controls instead.


@ ... SCROLL Command

Syntax         Arguments         See Also

Moves an area of the main Visual FoxPro window or a user-defined window up, down, left, or right.

Syntax

@ nRow1, nColumn1 TO nRow2, nColumn2 SCROLL
[UP | DOWN | LEFT | RIGHT]
[BY nMoveAmount]

Arguments

@ nRow1, nColumn1 TO nRow2, nColumn2 SCROLL   Moves a rectangular area whose upper-left corner is at nRow1, nColumn1 and lower-right corner is at nRow2, nColumn2.

UP | DOWN | LEFT | RIGHT   Specifies the direction in which rectangular area is moved. If you omit a direction clause, the area is moved upward.

BY nMoveAmount   Specifies the number of rows or columns the rectangular area is moved. If you omit BY nMoveAmount, the region is moved by one row or column.


See Also

SCROLL


@ ... TO Command

Included for backward compatibility. Use the Shape control instead.


ABS( )
ABS( ) Function

Syntax         Returns         Arguments         Example         See Also

Returns the absolute value of the specified numeric expression.

Syntax

ABS(nExpression)

Returns

Numeric

Arguments

nExpression   Specifies the numeric expression whose absolute value ABS( ) returns.


ABS( ) Function Example

? ABS(-45)    && Displays 45

? ABS(10-30)	  && Displays 20

? ABS(30-10)	  && Displays 20

STORE 40 TO gnNumber1

STORE 2 TO gnNumber2

? ABS(gnNumber2-gnNumber1)	  && Displays 38


See Also

INT( )
ROUND( )
SIGN( )


ACCEPT Command

Included for backward compatibility. Use the TextBox control instead.


ACLASS( )
ACLASS( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Places an object’s class name and its ancestor class names into a variable array.

Syntax

ACLASS(ArrayName, oExpression)

Returns

Numeric

Arguments

ArrayName   Specifies the name of the array into which the class names are placed. If you specify the name of an array that doesn’t exist, Visual FoxPro automatically creates the array. If you specify the name of an existing array that isn’t large enough to hold all the parent names, Visual FoxPro automatically increases the size of the array. If the array is larger than necessary, the array size is truncated. If you specify the name of an existing two-dimensional array, the array is redimensioned to a one-dimensional array.

oExpression   Specifies an object whose class name and ancestor class names are placed into the array. oExpression can be any object expression, such as an object reference, an object variable, or an object array element.

Remarks

ACLASS( ) creates a one-dimensional array containing the class name of the specified object and its ancestor class names. The first array element contains the class name of the object, the second element contains the name of the object’s parent class, the third element contains the name of the object’s grandparent class, and so on.

ACLASS( ) returns the number of class names in the array. ACLASS( ) returns 0 if the array cannot be created.


ACLASS( ) Function Example

The following example creates two custom classes named FormChild and FormGrandChild from the Visual FoxPro Form base class. ACLASS( ) is used to create an array named gaNewarray containing the class names, which are then displayed.

CLEAR

frmMyForm = CREATEOBJECT("FormGrandChild")

FOR nCount = 1 TO ACLASS(gaNewarray, frmMyForm) 	&& Creates an array

? gaNewarray(nCount)  && Displays the names of the classes

ENDFOR

RELEASE frmMyForm

DEFINE CLASS FormChild AS FORM

ENDDEFINE

DEFINE CLASS FormGrandChild AS FormChild

ENDDEFINE


See Also

ADD CLASS
AMEMBERS( )
CREATE CLASS
CREATE CLASSLIB
CREATEOBJECT( )
DEFINE CLASS


ACOPY( )
ACOPY( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Copies elements from one array to another array.

Syntax

ACOPY(SourceArrayName, DestinationArrayName
[, nFirstSourceElement [, nNumberElements [, nFirstDestElement ]]])

Returns

Numeric

Arguments

SourceArrayName, DestinationArrayName   Specifies the source array SourceArrayName from which elements are copied one-to-one to the destination array DestinationArrayName. The elements in the source array replace the elements in the destination array.

The arrays can be one- or two-dimensional. If the destination array doesn’t exist, Visual FoxPro automatically creates it. In such a case, the size of the destination array will be the same as that of the source array.

Note   You can refer to an element in a two-dimensional variable array in two ways: The first uses two subscripts to specify the row and column position of the element in the array; the other uses a single-element number. This function and others that manipulate two-dimensional arrays require single-element numbers (here, nFirstSourceElement and nFirstDestElement). Use AELEMENT( ) to return the proper element number for a two-dimensional array from its row and column subscripts.

nFirstSourceElement   Specifies the first element number in the source array to be copied; inclusive (element number nFirstSourceElement is included in the copying). If nFirstSourceElement isn’t included, copying begins with the first element in the source array.

nNumberElements   Specifies the number of elements copied from the source array. If nNumberElements is –1, all elements of the source array beginning with element nFirstSourceElement are copied.

nFirstDestElement   Specifies the first element in the destination array to be replaced.

Remarks

ACOPY( ) returns the number of elements copied to the destination array.


ACOPY( ) Function Example

The following example creates an array from selected records in the customer table and then uses ACOPY( ) to create a new array.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer	  && Open customer table

SELECT DISTINCT company ;

FROM customer ;

ORDER BY company ;

WHERE country = 'Germany';

INTO ARRAY gaCompanies

= ACOPY(gaCompanies, gaCompaniesTemp)  && Make a copy of the array

CLEAR

DISPLAY MEMORY LIKE gaCompaniesTemp


See Also

ADEL( )
AELEMENT( )
AINS( )
ASCAN( )
ASORT( )
DIMENSION


ACOS( )
ACOS( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the arc cosine of a specified numeric expression.

Syntax

ACOS(nExpression)

Returns

Numeric

Arguments

nExpression   Specifies a numeric expression whose arc cosine ACOS( ) returns. The value of nExpression can range from –1 through +1. The value returned by ACOS( ) ranges from 0 through pi (3.141592). The number of decimal places ACOS( ) returns is determined by SET DECIMALS.

Use RTOD( ) to convert radians to degrees.

Remarks

The arc cosine is returned in radians.


ACOS( ) Function Example

CLEAR

? RTOD(ACOS(0))  && Displays 90.00

STORE -1 to gnArcAngle

? RTOD(ACOS(gnArcAngle))  && Displays 180.00

? RTOD(ACOS(SQRT(2)/2))  && Displays 45.00


See Also

ASIN( )
ATAN( )
ATN2( )
COS( )
DTOR( )
RTOD( )
SET DECIMALS
SIN( )
TAN( )


Activate Event

Syntax         Remarks        Applies To         See Also

Occurs when a Form, FormSet, or Page object becomes active or when a Toolbar object is shown.

Syntax

PROCEDURE Object.Activate

Remarks

Triggers for this event depend on the type of object:

•	A FormSet object is activated when a form in the form set receives the focus or when the Show method for the form set is called.

•	A Form object is activated by a user action, such as clicking a form or a control or when the Show method for the Form object is called.

•	A Page object is activated by user action, such as clicking the tab of the page or clicking a control contained in the page, or if the ActivePage property of the page frame containing it is set to the page’s number.

•	A ToolBar object is activated when the Show method for the ToolBar is called.

If you use the Show method for a form set, all forms with their Visible property set to true (.T.) are shown. The Activate event is triggered first for the form set, then for the form, and then for the page.


Applies To

Form, FormSet, Page, ToolBar


See Also

ActivePage Property
Deactivate Event
GotFocus Event
LostFocus Event
SetFocus Method
Show Method
Visible Property


ACTIVATE MENU
ACTIVATE MENU Command

Syntax         Arguments         Remarks         Example         See Also

Displays and activates a menu bar.

Syntax

ACTIVATE MENU MenuBarName
[NOWAIT]
[PAD MenuTitleName]

Arguments

MenuBarName   Specifies the name of the menu bar to activate.

NOWAIT   Specifies that at run time the program should not wait for the user to choose a menu from the active menu bar or to press ESC. Instead, the program continues to execute. A menu activated with the NOWAIT option does not return program execution to the line following the ACTIVATE MENU command when DEACTIVATE MENU is issued.

PAD MenuTitleName   Specifies the menu title name that is automatically selected when the menu bar is activated. If you don’t specify a menu title name, the first menu title name in the activated menu bar is activated by default.

Remarks

Displays and activates the menu bar specified with MenuBarName. This command works in conjunction with DEFINE MENU and DEFINE PAD.

Tip   When you include the Visual FoxPro system menu bar (_MSYSMENU) in an application, there is no need to activate the menu. Instead, issue SET SYSMENU AUTOMATIC.


ACTIVATE MENU Command Example

The following example uses ACTIVATE MENU to display and activate a user-defined menu system. The current system menu bar is first saved to memory with SET SYSMENU SAVE, and then all system menu titles are removed with SET SYSMENU TO.

Two menu titles are created with DEFINE PAD; DEFINE POPUP is used to create a drop-down menu for each menu title. DEFINE BAR is used to create menu items on each of the menus. When a menu title is chosen, ON PAD uses ACTIVATE POPUP to activate the corresponding menu. ACTIVATE MENU displays and activates the menu bar.

When a menu item is chosen from a menu, the CHOICE procedure is executed. CHOICE displays the name of the chosen item and the name of the menu containing the item.

*** Name this program ACTIMENU.PRG ***

CLEAR

SET SYSMENU SAVE

SET SYSMENU TO

ON KEY LABEL ESC KEYBOARD CHR(13)

DEFINE MENU example BAR AT LINE 1

DEFINE PAD convpad OF example PROMPT '\<Conversions' COLOR SCHEME 3 ;

KEY ALT+C, ''

DEFINE PAD cardpad OF example PROMPT 'Card \<Info' COLOR SCHEME 3 ;

KEY ALT+I, ''

ON PAD convpad OF example ACTIVATE POPUP conversion

ON PAD cardpad OF example ACTIVATE POPUP cardinfo

DEFINE POPUP conversion MARGIN RELATIVE SHADOW COLOR SCHEME 4

DEFINE BAR 1 OF conversion PROMPT 'Ar\<ea' ;

KEY CTRL+E, '^E'

DEFINE BAR 2 OF conversion PROMPT '\<Length' ;

KEY CTRL+L, '^L'

DEFINE BAR 3 OF conversion PROMPT 'Ma\<ss' ;

KEY CTRL+S, '^S'

DEFINE BAR 4 OF conversion PROMPT 'Spee\<d' ;

KEY CTRL+D, '^D'

DEFINE BAR 5 OF conversion PROMPT '\<Temperature' ;

KEY CTRL+T, '^T'

DEFINE BAR 6 OF conversion PROMPT 'T\<ime' ;

KEY CTRL+I, '^I'

DEFINE BAR 7 OF conversion PROMPT 'Volu\<me' ;

KEY CTRL+M, '^M'

ON SELECTION POPUP conversion DO choice IN actimenu;

WITH PROMPT( ), POPUP( )

DEFINE POPUP cardinfo MARGIN RELATIVE SHADOW COLOR SCHEME 4

DEFINE BAR 1 OF cardinfo PROMPT '\<View Charges' ;

KEY ALT+V, ''

DEFINE BAR 2 OF cardinfo PROMPT 'View \<Payments' ;

KEY ALT+P, ''

DEFINE BAR 3 OF cardinfo PROMPT 'Vie\<w Users' ;

KEY ALT+W, ''

DEFINE BAR 4 OF cardinfo PROMPT '\-'

DEFINE BAR 5 OF cardinfo PROMPT '\<Charges ' ;

KEY ALT+C, ''

ON SELECTION POPUP cardinfo;

DO choice IN actimenu WITH PROMPT( ), POPUP( )

ACTIVATE MENU example

DEACTIVATE MENU example

RELEASE MENU example EXTENDED

SET SYSMENU TO DEFAULT

ON KEY LABEL ESC

PROCEDURE choice

PARAMETERS mprompt, mpopup

WAIT WINDOW 'You chose ' + mprompt + ' from popup ' + mpopup NOWAIT


See Also

CLEAR MENUS
CREATE MENU
DEACTIVATE MENU
DEFINE MENU
DEFINE PAD
HIDE MENU
SET SYSMENU
SHOW MENU


ACTIVATE POPUP
ACTIVATE POPUP Command

Syntax         Arguments         Remarks         Example         See Also

Displays and activates a menu.

Syntax

ACTIVATE POPUP MenuName
[AT nRow, nColumn]
[BAR nMenuItemNumber]
[NOWAIT]
[REST]

Arguments

MenuName   Specifies the name of the menu to activate.

AT nRow, nColumn   Specifies the position of the menu on the screen or in a user-defined window. The row and column coordinate applies to the upper-left corner of the menu. The position you specify with this argument takes precedence over a position you specify with the FROM argument in DEFINE POPUP.

BAR nMenuItemNumber   Specifies the item in the menu that is selected when the menu is activated. For example, if nMenuItemNumber is 2, the second item is selected. The first item is selected if you omit BAR nMenuItemNumber or if nMenuItemNumber is greater than the number of items in the menu.

NOWAIT   Specifies that, at run time, a program does not wait for the user to choose an item from the menu before continuing program execution. Instead, the program continues to execute.

REST   A menu created with the PROMPT FIELD clause of DEFINE POPUP places records from a field into the menu. When the menu is activated, the first item in the menu is initially selected, even if the record pointer in the table containing the field is positioned on a record other than the first record.

Include REST to specify that the item selected when the menu is activated corresponds to the current record pointer position in the table.

Remarks

ACTIVATE POPUP works in conjunction with DEFINE POPUP, used to create the menu, and DEFINE BAR, used to create the items on the menu.


ACTIVATE POPUP Command Example

This example uses ACTIVATE POPUP with ON PAD to activate a menu when a menu title is chosen. The current system menu bar is first saved to memory with SET SYSMENU SAVE, and then all system menu titles are removed with SET SYSMENU TO.

Two new system menu titles are created with DEFINE PAD; DEFINE POPUP is used to create a menu for each menu title. DEFINE BAR is used to create menu items on each of the menus. When a menu title is chosen, ON PAD uses ACTIVATE POPUP to activate the corresponding menu.

When an item is chosen from a menu, the CHOICE procedure is executed. CHOICE displays the name of the chosen item and the name of the menu containing the item. If the Exit item is chosen from the Card Info menu, the original Visual FoxPro system menu is restored.

*** Name this program ACTIPOP.PRG ***

CLEAR

SET SYSMENU SAVE

SET SYSMENU TO

DEFINE PAD convpad OF _MSYSMENU PROMPT '\<Conversions' COLOR SCHEME 3 ;

KEY ALT+C, ''

DEFINE PAD cardpad OF _MSYSMENU PROMPT 'Card \<Info' COLOR SCHEME 3 ;

KEY ALT+I, ''

ON PAD convpad OF _MSYSMENU ACTIVATE POPUP conversion

ON PAD cardpad OF _MSYSMENU ACTIVATE POPUP cardinfo

DEFINE POPUP conversion MARGIN RELATIVE SHADOW COLOR SCHEME 4

DEFINE BAR 1 OF conversion PROMPT 'Ar\<ea' KEY CTRL+E, '^E'

DEFINE BAR 2 OF conversion PROMPT '\<Length' ;

KEY CTRL+L, '^L'

DEFINE BAR 3 OF conversion PROMPT 'Ma\<ss' ;

KEY CTRL+S, '^S'

DEFINE BAR 4 OF conversion PROMPT 'Spee\<d' ;

KEY CTRL+D, '^D'

DEFINE BAR 5 OF conversion PROMPT '\<Temperature' ;

KEY CTRL+T, '^T'

DEFINE BAR 6 OF conversion PROMPT 'T\<ime' ;

KEY CTRL+I, '^I'

DEFINE BAR 7 OF conversion PROMPT 'Volu\<me' ;

KEY CTRL+M, '^M'

ON SELECTION POPUP conversion;

DO choice IN actipop WITH PROMPT(), POPUP()

DEFINE POPUP cardinfo MARGIN RELATIVE SHADOW COLOR SCHEME 4

DEFINE BAR 1 OF cardinfo PROMPT '\<View Charges' ;

KEY ALT+V, ''

DEFINE BAR 2 OF cardinfo PROMPT 'View \<Payments' ;

KEY ALT+P, ''

DEFINE BAR 3 OF cardinfo PROMPT 'Vie\<w Users' ;

KEY ALT+W, ''

DEFINE BAR 4 OF cardinfo PROMPT '\-'

DEFINE BAR 5 OF cardinfo PROMPT '\<Charges' ;

KEY ALT+C, ''

DEFINE BAR 6 OF cardinfo PROMPT '\-'

DEFINE BAR 7 OF cardinfo PROMPT 'E\<xit';

KEY ALT+X, ''

ON SELECTION POPUP cardinfo;

DO choice IN actipop WITH PROMPT(),POPUP()

PROCEDURE choice

PARAMETERS mprompt, mpopup

WAIT WINDOW 'You chose ' + mprompt + ;

' from popup ' + mpopup NOWAIT

IF mprompt = 'Exit'

SET SYSMENU TO DEFAULT

ENDIF


See Also

CLEAR POPUPS, CREATE MENU, DEACTIVATE POPUP, DEFINE BAR, DEFINE POPUP, HIDE POPUP, MOVE POPUP, ON SELECTION POPUP, POP POPUP, POPUP( ), PROMPT( ), PUSH POPUP, SHOW POPUP


ACTIVATE SCREEN Command

Syntax         Remarks         See Also

Sends all subsequent output to the main Visual FoxPro window instead of to the active user-defined window.

Syntax

ACTIVATE SCREEN

Remarks

Use ACTIVATE WINDOW to direct output to a user-defined window.


See Also

ACTIVATE WINDOW
DEACTIVATE WINDOW
DEFINE WINDOW
HIDE WINDOW
SHOW WINDOW


ACTIVATE WINDOW Command

Syntax         Arguments         Remarks         Example         See Also

Displays and activates one or more user-defined windows or Visual FoxPro system windows.

Syntax

ACTIVATE WINDOW WindowName1 [, WindowName2 ...]
| ALL
[IN [WINDOW] WindowName3 | IN SCREEN]
[BOTTOM | TOP | SAME]
[NOSHOW]

Arguments

WindowName1 [, WindowName2 ...]   Specifies the name of each window to activate. Separate the window names with commas. In Visual FoxPro, you can specify the name of a toolbar to activate. See SHOW WINDOW for a list of Visual FoxPro toolbar names.

ALL   Specifies that all windows are activated. The last window activated is the active output window.

IN [WINDOW] WindowName3   Specifies the name of the parent window within which the window is placed and activated. The activated window becomes a child window. A parent window can have multiple child windows. A child window activated inside a parent window cannot be moved outside the parent window. If the parent window is moved, the child window moves with it.

Note   The parent window must be visible for any of its child windows to be visible.

IN SCREEN   Places and activates a window in the main Visual FoxPro window. A window can be placed in a parent window by including IN WINDOW in DEFINE WINDOW when the window is created. Including the IN SCREEN clause in ACTIVATE WINDOW overrides the IN WINDOW clause in DEFINE WINDOW.

BOTTOM | TOP | SAME   Specifies where windows are activated with respect to other previously activated windows. By default, a window becomes the frontmost window when it is activated. Including BOTTOM places a window behind all other windows. TOP places it in front of all other windows. SAME activates a window without affecting its front-to-back placement.

NOSHOW   Activates and directs output to a window without displaying the window.

Remarks

User-defined windows are created with DEFINE WINDOW.

Activating a window makes it the frontmost window and directs all output to that window. Output can be directed to only one window at a time. A window remains the active output window until it is deactivated or released, or until another window or the main Visual FoxPro window is activated.

The names of user-defined windows appear in the bottom section of the Window menu. The name of the active user-defined window is marked with a check mark.

More than one window can be placed in the main Visual FoxPro window at one time, but output is directed only to the last window activated. When more than one window is open, deactivating the active output window removes it from the main Visual FoxPro window and sends subsequent output to another window. If there is no active output window, output is directed to the main Visual FoxPro window.

To ensure output is directed to a specific window when you deactivate the active output window, you must explicitly activate the window you want to send output to with ACTIVATE WINDOW.

All activated windows are displayed until DEACTIVATE WINDOW or HIDE WINDOW is issued to remove them from view. Issuing either command removes windows from view but not from memory. Windows can be redisplayed by issuing ACTIVATE WINDOW or SHOW WINDOW.

To remove windows from view and from memory, use CLEAR WINDOWS, RELEASE WINDOWS, or CLEAR ALL. Windows that are removed from memory must be redefined to place them back in the main Visual FoxPro window.

You can use ACTIVATE WINDOW to place Visual FoxPro system windows in the main Visual FoxPro window or in a parent window.

The following system windows can be opened with ACTIVATE WINDOW:

•	Command

•	Call Stack

•	Data Session

•	Debug

•	Debug Output

•	Locals

•	Trace

•	Watch

To activate a system window and or a toolbar, enclose the entire system window or toolbar name in quotation marks. For example, to activate the Call Stack debugging window in Visual FoxPro, issue the following command:

ACTIVATE WINDOW “Call Stack”

Use HIDE WINDOW or RELEASE WINDOW to remove a system window from the main Visual FoxPro window or a parent window.


ACTIVATE WINDOW Command Example

The following example defines a window named output and activates it, placing it in the main Visual FoxPro window. The WAIT command pauses execution, the window is hidden, and then redisplayed.

CLEAR

DEFINE WINDOW output FROM 2,1 TO 13,75 TITLE 'Output' ;

CLOSE FLOAT GROW SHADOW ZOOM

ACTIVATE WINDOW output

WAIT WINDOW 'Press any key to hide window output'

HIDE WINDOW output

WAIT WINDOW 'Press any key to show window output'

SHOW WINDOW output

WAIT WINDOW 'Press any key to release window output'

RELEASE WINDOW output


See Also

CLEAR WINDOWS
DEACTIVATE WINDOW
DEFINE WINDOW
HIDE WINDOW
RELEASE WINDOWS
SHOW WINDOW


ActivateCell Method

Syntax         Arguments         Applies To         See Also

Activates a cell in a Grid control.

Syntax

Grid.ActivateCell(nRow, nCol)

Arguments

nRow, nCol   Specifies the row and the column that contain the active cell.


Applies To

Grid


See Also

ActiveColumn Property
ActiveRow Property


ActiveColumn Property

Syntax         Applies To         See Also

Returns the column that contains the active cell in a Grid control. Not available at design time; read-only at run time.

Syntax

Grid.ActiveColumn


Applies To

Grid


See Also

ActivateCell Method
ActiveRow Property


ActiveControl Property

Syntax         Settings         Remarks         Applies To         See Also

References the active control on an object. Not available at design time; read-only at run time.

Syntax

Object.ActiveControl.Property[ = Value]

Settings

Property   The property to return or set.

Value   The current or new property value.

Remarks

This property is not available if all controls on the specified object are invisible or disabled.

If the object is active, the ActiveControl property references the control that has the focus. If the object is not active, an error occurs.


Applies To

Form, Page, _SCREEN, ToolBar


See Also

ActiveForm Property


ActiveForm Property

Syntax         Settings         Remarks         Applies To         See Also

References the active Form object in a form set or the _SCREEN object. Not available at design time; read-only at run time.

Syntax

Object.ActiveForm.Property [ = Setting]
 –  or –

Object.ActiveForm.Method

Settings

Property   Specifies any property of the active form contained in the form set; for example, the Caption property.

Setting   The existing or new setting of the Property.

Method   Specifies any method of the active form contained in the form set; for example, the Move method.

Remarks

If the containing FormSet object is active, ActiveForm references the Form object that has the focus. If the containing FormSet object is not active, an error occurs.

Use the ActiveForm property to access the active Form object’s properties and methods.


Applies To

Form, FormSet, _SCREEN


See Also

Activate Event
Deactivate Event


ActivePage Property

Syntax         Applies To         See Also

Returns the number of the active Page in a PageFrame object. Available at design time; read-write at run time.

Syntax

PageFrame.ActivePage


Applies To

PageFrame


See Also

Activate Event
GotFocus Event


ActiveRow Property

Syntax         Remarks         Applies To         See Also

Specifies the row that contains the active cell in a Grid control. Not available at design time; read-only at run time.

Syntax

Grid.ActiveRow

Remarks

The ActiveRow property does not return the same value as RECNO( ) in an indexed table.


Applies To

Grid


See Also

ActivateCell Method
ActiveColumn Property
RECNO( )


ADATABASES( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Places the names of all open databases and their paths into a variable array.

Syntax

ADATABASES(ArrayName)

Returns

Numeric

Arguments

ArrayName   Specifies the name of the array. If the array you specify doesn’t exist, Visual FoxPro automatically creates the array. If the array exists and isn’t large enough to contain all the database information, Visual FoxPro automatically increases the size of the array to accommodate the information. If the array is larger than necessary, Visual FoxPro truncates the array. If the array exists and ADATABASES( ) returns 0 because no databases are open, an existing array remains unchanged. If the array doesn’t exist, and ADATABASES( ) returns 0, the array is not created.

Remarks

The names of all open databases in the current data session are placed into a variable array.

ADATABASES( ) creates a two-dimensional array. The first column of the array contains the names of the open databases, and the second column contains the paths to the databases.

ADATABASES( ) returns the number of database names (rows) in the array. If no databases are open, ADATABASES( ) returns 0 and the array isn’t created.


ADATABASES( ) Function Example

The following example opens the testdata database, and then uses ADATABASES( ) to create an array named gaDatabase containing the names of all open databases.

SET PATH TO (HOME( ) + 'samples\data\')	  && Sets path to database

OPEN DATABASE testdata   && Opens the database

CLEAR

? ADATABASES(gaDatabase)	  && Creates an array of open databases

DISPLAY MEMORY LIKE gadatabase  && Displays the contents of the array

CLOSE DATABASES


See Also

CREATE DATABASE
DISPLAY DATABASE
LIST DATABASE
MODIFY DATABASE
OPEN DATABASE


ADBOBJECTS( ) Function

Syntax         Arguments         Remarks         Example         See Also

Places the names of named connections, relations, tables, or SQL views in the current database into a variable array.

Syntax

ADBOBJECTS(ArrayName, cSetting)

Returns

Numeric

Arguments

ArrayName   Specifies the name of the array in which the names are placed. If the array you specify doesn’t exist, Visual FoxPro automatically creates the array. If the array exists and isn’t large enough to contain all the names, Visual FoxPro automatically increases the size of the array to accommodate the names. If the array is larger than necessary, Visual FoxPro truncates the array. If the array exists and ADBOBJECTS( ) returns 0 because no names are found, the array remains unchanged. If the array doesn’t exist, and ADBOBJECTS( ) returns 0, the array is not created.

A one-dimensional array is created when you specify CONNECTION, TABLE, or VIEW for cSetting. Each row in the one-dimensional array contains the name of a connection, table, or view in the database.

A two-dimensional array is created when you specify RELATION for cSetting. Each row in the two-dimensional array corresponds to a relationship in the database. The first column in an array row contains the name of the child table and the second column in an array row contains the name of the parent table. The third column contains the name of the index tag for the child table and the fourth column contains the name of the index tag for the parent table.

The fifth column in an array row contains referential integrity information. This column is empty if the relation has no referential integrity rules. If the relationship does have referential integrity rules, the column contains characters corresponding to the type of referential integrity rules for updates, deletions, and insertions.

The first character indicates the type of update rule, the second character indicates the type of deletion rule, and the third character indicates the type of insertion rule.

Possible values for updates and deletions are “C” for cascade, “R” for restrict, and “I” for ignore. Possible values for insertions are “R” for restrict, and “I” for ignore. For example, if a relation has cascaded updates, restricted deletions, and ignores insertion referential integrity rules, the column contains “CRI”.

cSetting   Specifies the names to place in the variable array. The following table lists the values for cSetting and the corresponding names placed in the array:

cSetting	Names
CONNECTION	Connection names
RELATION	Table relationships
TABLE	Table names
VIEW	View names
The CONNECTION, RELATION, TABLE, and VIEW settings cannot be abbreviated.

Remarks

A database must be open and current when ADBOBJECTS( ) is issued; otherwise Visual FoxPro generates an error message.


ADBOBJECTS( ) Function Example

The following example opens the testdata database and uses ADBOBJECTS( ) to create an array named gaTables containing names of tables in the database. The tables names are then displayed.

* Close any open databases

CLOSE DATABASES

* Clear desktop to prepare for displaying the array

CLEAR

* Open sample testdata database

OPEN DATABASE SYS(2004)+"samples\data\testdata"

* Function call with cSetting for table names

=ADBOBJECTS(gaTables, "TABLE")

* Displays array gaTables created by ADBOBJECTS( ) function

DISPLAY MEMORY LIKE gaTables


See Also

ADATABASES( )
CREATE
CREATE CONNECTION
CREATE DATABASE
CREATE SQL VIEW
CREATE TABLE - SQL
DISPLAY DATABASE
INDBC( )
LIST DATABASE
MODIFY DATABASE
SET DATABASE


ADD CLASS Command

Syntax         Arguments         Remarks         See Also

Adds a class definition to a .VCX visual class library.

Syntax

ADD CLASS ClassName [OF ClassLibraryName1] TO ClassLibraryName2
[OVERWRITE]

Arguments

ClassName   Specifies the name of the class definition added to the .VCX visual class library ClassLibraryName2.

If you omit the optional OF ClassLibraryName1 clause, Visual FoxPro searches for the class definition in any .VCX visual class libraries opened with SET CLASSLIB.

Visual FoxPro generates an error if the class definition cannot be located or a class definition with the name you specify already exists in ClassLibraryName2.

OF ClassLibraryName1   Specifies a .VCX visual class library from which the class definition is copied.

TO ClassLibraryName2   Specifies the .VCX visual class library to which the class definition is added. If you specify a .VCX visual class library that does not exist, Visual FoxPro creates the visual class library and adds the class definition to the library.

OVERWRITE   Specifies that a class definition with the same name as the class definition you specify with ClassName is overwritten. An error message is generated if you omit OVERWRITE and a class definition with the same name as ClassName already exists in the .VCX visual class library.

Remarks

Use ADD CLASS to add a class definition to a class library, or to copy a class definition from one .VCX visual class library to another. A class definition cannot be added from a Visual FoxPro program or application (.PRG or .APP), or a procedure file.


See Also

ACLASS( )
AMEMBERS( )
CREATE CLASS
CREATE CLASSLIB
DEFINE CLASS
MODIFY CLASS
RELEASE CLASSLIB
RENAME CLASS
SET CLASSLIB


ADD TABLE Command

Syntax         Arguments         Remarks         Example         See Also

Adds a free table to the current database.

Syntax

ADD TABLE TableName | ?
[NAME LongTableName]

Arguments

TableName   Specifies the name of the table added to the database.

?   Displays the Open dialog box from which you can choose a table to add to the database.

NAME LongTableName   Specifies a long name for the table. Long names can contain up to 128 characters and can be used in place of short file names that have a .DBF extension.

Remarks

After the table is added to the database, you can perform the same operations on it as you can on any other table.

Once the table is added to the database, it is no longer free. However, any table in the database can be made free by issuing REMOVE TABLE.

The table you are adding:

•	Must be a valid .DBF file.

•	Cannot have the same name as an existing table in the open database, unless you assign the table a unique long name.

•	Cannot exist in another database. Use REMOVE TABLE to remove the table from another database.

The database to which you are adding a table cannot be involved in a transaction.


ADD TABLE Command Example

The following example creates two databases named mydbc1 and mydbc2, and a table named table1. The table is added to mydbc1 when it is created. The table is then closed and removed from mydbc1. ADD TABLE is then used to add the table to mydbc2. RENAME TABLE is used to change the name of the table from table1 to table2.

CREATE DATABASE mydbc1

CREATE DATABASE mydbc2

SET DATABASE TO mydbc1

CREATE TABLE table1 (cField1 C(10), n N(10))  && Adds table to mydbc1

CLOSE TABLES	  && A table must be closed to remove it from a database

REMOVE TABLE table1

SET DATABASE TO mydbc2

ADD TABLE table1

RENAME TABLE table1 TO table2


See Also

CLOSE DATABASES
CREATE DATABASE
DISPLAY TABLES
FREE TABLE
OPEN DATABASE
REMOVE TABLE


AddColumn Method

Syntax         Arguments         Remarks         Applies To         See Also

Adds a Column object to a Grid control.

Syntax

Grid.AddColumn(nIndex)

Arguments

nIndex   Specifies a number representing the position in the grid where the new Column is added.

Remarks

When AddColum( ) is called, existing columns are moved to the right, and their ColumnOrder properties are incremented accordingly. The grid's ColumnCount property is also increased.

The grid's Controls property array is enlarged by one element, and a reference to the new column is placed in the new element. The new column is assigned a unique name.

For example, to add a new column, then assign a new name to that column, you could do the following.

THISFORM.Grid1.AddColumn(1)         && Insert column at left.

THISFORM.Grid1.Columns(THISFORM.Grid1.ColumnCount).Name = "NewColumn"

THISFORM.Grid1.NewColumn.ControlSource = "Customer.CustID"


Applies To

Grid


See Also

AddObject Method
ColumnCount Property
DeleteColumn Method


AddItem Method

Syntax         Arguments         Remarks         Applies To         See Also

Adds a new item to a ComboBox or ListBox control, optionally allowing you to specify the item’s index.

Syntax

Control.AddItem(cItem [, nIndex] [, nColumn])

Arguments

cItem   Specifies the string expression to add to the control.

nIndex   Specifies the position where the item is placed in the control. If you supply a valid value for the optional nIndex, cItem is placed at that position within the control. If you specify an nIndex that already exists, the item is inserted at that position and all items below that item are moved down one position in the list portion of the ComboBox or ListBox control.

If you omit nIndex and the Sorted property is set to true (.T.), cItem is added in alphabetic sort order. If you omit nIndex and the Sorted property is set to false (.F.), cItem is added to the end of the list portion of the ComboBox or ListBox control.

nColumn   Specifies the column of the control to which the new item is added. The default is 1.

Remarks

Use the AddItem method or AddListItem method when the RowSourceType property is set to 0 (None).

Each item added to a ComboBox or ListBox has two identification numbers assigned to it:

•	nItemID, an integer corresponding to the unique ID of the item in the control: the first item corresponds to nItemID = 1, unless another nItemID is specified.

•	nIndex, an integer corresponding to the order in which items are displayed by the control: the first item in the control corresponds to nIndex = 1.


Applies To

ComboBox, ListBox


See Also

AddListItem Method, Clear Method, ListIndex Property, ListItemID Property, RowSourceType Property, RemoveItem Method, Sorted Property


AddListItem Method

Syntax         Arguments         Remarks         Applies To         See Also

Adds a new item to a ComboBox or ListBox control, optionally allowing you to specify the item’s item ID.

Syntax

Control.AddListItem(cItem [, nItemID] [, nColumn])

Arguments

cItem   Specifies the item to add to the control.

nItemID   Specifies an integer representing the unique ID of the item in the control.

If you omit nItemID and the Sorted property is set to true (.T.), cItem is added in alphabetic sort order. If you omit nItemID and the Sorted property is set to false (.F.), cItem is added to the end of the list of the ComboBox or ListBox.

nColumn   Specifies the column of the control to add the new item to. The default is 1.

Remarks

Use the AddItem method or AddListItem method when the RowSourceType property is set to 0 (None).

Each item added to a ComboBox or ListBox has two identification numbers assigned to it:

•	nItemID, an integer corresponding to the unique ID of the item in the control: the first item corresponds to nItemID = 1, unless another nItemID is specified.

•	nIndex, an integer corresponding to the order in which items are displayed by the control: the first item in the control corresponds to nIndex = 1.


Applies To

ComboBox, ListBox


See Also

AddItem Method
Clear Method
ListIndex Property
ListItemID Property
RowSourceType Property
RemoveItem Method
Sorted Property


AddObject Method

Syntax         Arguments         Remarks         Example         Applies To         See Also

Adds an object to a Container object at run time.

Syntax

Object.AddObject(cName, cClass [, cOLEClass] [, aInit1, aInit2 ...])

Arguments

cName   Specifies the name used to reference the new object.

cClass   Specifies the class of the object to add.

cOLEClass   Specifies the OLE class of the object to add.

aInit1, aInit2   Specifies parameters passed to the Init event of the new object.

Remarks

Calling the AddObject method triggers the Init event of the object being added. When a form is added to a form set, the Load event occurs before the Init event.

When you use AddObject to add an object to a container, the object’s Visible property is set to false (.F.) so you can set the properties of the object without any awkward visual effects as the object’s appearance changes.


AddObject Method Example

The following example demonstrates how the AddObject method can be used to add objects or controls to a form. AddObject is used to add a Line control and three command buttons to the form.

The Visible property is set to true (.T.) for the Line control and the command buttons. By default, objects and controls are not visible when they are added to a form.

frmMyForm = CREATEOBJECT('Form')  && Create a Form

frmMyForm.Closable = .F.  && Disable the Control menu box

frmMyForm.AddObject('shpLine','Line')  && Add a Line control to the form

frmMyForm.AddObject('cmdCmndBtn1','cmdMyCmndBtn1')  && Up Cmnd button

frmMyForm.AddObject('cmdCmndBtn2','cmdMyCmndBtn2')  && Down Cmnd button

frmMyForm.AddObject('cmdCmndBtn3','cmdMyCmndBtn3')  && Quit Cmnd button

frmMyForm.shpLine.Visible = .T.  && Make Line control visible

frmMyForm.shpLine.Top = 20  && Specify Line control row

frmMyForm.shpLine.Left = 125  && Specify Line control column

frmMyForm.cmdCmndBtn1.Visible =.T.  && Up Command button visible

frmMyForm.cmdCmndBtn2.Visible =.T.  && Down" Command button visible

frmMyForm.cmdCmndBtn3.Visible =.T.  && Quit Command button visible

frmMyForm.SHOW  && Display the form

READ EVENTS  && Start event processing

DEFINE CLASS cmdMyCmndBtn1 AS COMMANDBUTTON  && Create Command button

Caption = 'Slant \<Up'  && Caption on the Command button

Left = 50  && Command button column

Top = 100  && Command button row

Height = 25  && Command button height

PROCEDURE Click

ThisForm.shpLine.Visible = .F.  && Hide the Line control

ThisForm.shpLine.LineSlant ='/'  && Slant up

ThisForm.shpLine.Visible = .T.  && Show the Line control

ENDDEFINE

DEFINE CLASS cmdMyCmndBtn2 AS CommandButton  && Create Command button

Caption = 'Slant \<Down'  && Caption on the Command button

Left = 200  && Command button column

Top = 100  && Command button row

Height = 25  && Command button height

PROCEDURE Click

ThisForm.shpLine.Visible = .F.  && Hide the Line control

ThisForm.shpLine.LineSlant ='\'  && Slant down

ThisForm.shpLine.Visible = .T.  && Show the Line control

ENDDEFINE

DEFINE CLASS cmdMyCmndBtn3 AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 150  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close Form

ENDDEFINE


Applies To

Column, CommandGroup, Container Object, Custom, DataEnvironment, Form, FormSet, Grid, OptionGroup, Page, PageFrame, _SCREEN, ToolBar


See Also

Init Event
Load Event
RemoveObject Method
Visible Property


ADEL( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Deletes an element from a one-dimensional array, or a row or column from a two-dimensional array.

Syntax

ADEL(ArrayName, nElementNumber [, 2])

Returns

Numeric

Arguments

ArrayName   Specifies the array from which the element, row, or column is deleted.

nElementNumber   Specifies the number of the element, row, or column to delete from the array. You must include the optional 2 argument to delete a column from the array.

For more information on how to reference elements in an array, see DIMENSION.

2   Deletes a column from the array.

Remarks

Deleting an element, row, or column from an array doesn’t change the size of the array; instead, the trailing elements, rows, or columns are moved towards the start of the array, and the last element, row, or column in the array is set to false (.F.).

If the element, row, or column is successfully deleted, 1 is returned.


ADEL( ) Function Example

The following example creates and fills an array, then searches for a particular company name, which, if found, is removed from the array.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer	  && Open customer table

SELECT company FROM customer ;

WHERE country = 'UK' ;

INTO ARRAY gaCompanies

gnCount = _TALLY

gcName = 'Seven Seas Imports'

CLEAR

DISPLAY MEMORY LIKE gaCompanies

gnPos = ASCAN(gaCompanies, gcName)	&& Search for company

IF gnPos != 0

* Company found, remove it from the array

= ADEL(gaCompanies, gnPos)

gnCount = gnCount - 1

ENDIF

DISPLAY MEMORY LIKE gaCompanies


See Also

ACOPY( )
ADIR( )
AELEMENT( )
AFIELDS( )
AINS( )
ALEN( )
ASCAN( )
ASORT( )
ASUBSCRIPT( )
DIMENSION


ADIR( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Places information about files into an array and then returns the number of files.

Syntax

ADIR(ArrayName [, cFileSkeleton [, cAttribute]])

Returns

Numeric

Arguments

ArrayName   Specifies the name of the array. If the array you include doesn’t exist, Visual FoxPro automatically creates the array. If the array exists and isn’t large enough to contain all the information, Visual FoxPro automatically increases the size of the array to accommodate the information. If the array is larger than necessary, Visual FoxPro truncates the array. If the array exists and ADIR( ) returns 0 because no matching files are found, the array remains unchanged. If the array doesn’t exist and ADIR( ) returns 0, the array isn’t created.

The following table describes the contents and data type of each column in the array:

Column	Array contents	Data type
1	File names	Character
2	File sizes	Numeric
3	Dates last modified	Date
4	Times last modified	Character
5	File attributes	Character
The last array column contains the file attributes of the matching files. Each file attribute is expressed by a letter; a file can have more than one attribute. The following table indicates the file attribute represented by each letter:

Letter	Attribute
A	Archive - Read/Write
H	Hidden
R	Read-only
S	System
D	Directory or folder
cFileSkeleton   Specifies a file skeleton so you can store information about files with names or extensions that match a search criterion. For example, the criterion can be all tables, all text files, all files with names that have A as their first letter, and so on. Such general searches are done by including the wildcards * and ? in cFileSkeleton. A question mark represents a single character; an asterisk represents any number of characters. You can use any number of wildcards in any position within the file skeleton.

You can specify a drive and/or directory to search in for matching file names. If you don’t specify a drive and directory, Visual foxPro places information about files in the current directory into the array.

cAttribute   Specifies the inclusion of subdirectories and hidden or system files.

cAttribute can contain any combination of D, H, and S. Including D returns subdirectory names of the current directory in addition to file names that match the file skeleton specified in cFileSkeleton. Including H returns information about hidden files that match the file skeleton specified in cFileSkeleton. Including S returns information about system files that match the file skeleton specified in cFileSkeleton.

Include an empty string in cFileSkeleton to return just subdirectory names, hidden files or system files.

Remarks

For each file, ADIR( ) places into the array the file name, size, date last modified, time last modified, and attributes.


ADIR( ) Function Example

The following example uses ADIR( ) to create an array containing database information. The names of the databases are then displayed.

CLOSE DATABASES

SET PATH TO (HOME( ) + 'samples\data')

gnDbcnumber = ADIR(gaDatabase, '*.DBC')  && Create array

CLEAR

FOR nCount = 1 TO gnDbcnumber  && Loop for number of databases

? gaDatabase(nCount,1)  && Display database names

ENDFOR

SET PATH TO HOME( )  && Set path to Visual FoxPro directory


See Also

ADEL( )
AELEMENT( )
AFIELDS( )
AINS( )
ALEN( )
ASCAN( )
ASORT( )
ASUBSCRIPT( )
DIMENSION
DIR or DIRECTORY


AELEMENT( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns the number of an array element from the element’s subscripts.

Syntax

AELEMENT(ArrayName, nRowSubscript [, nColumnSubscript])

Returns

Numeric

Arguments

ArrayName   Specifies the name of the array whose element number you want to return.

nRowSubscript   Specifies the row subscript. If the array is one-dimensional, AELEMENT( ) identically returns nRowSubscript.

If you include just nRowSubscript, and it is greater than the number of rows in the array, Visual FoxPro generates an error message.

nColumnSubscript   Specifies the column subscript. If the array is two-dimensional, include both nRowSubscript and nColumnSubscript.

Remarks

You can refer to an element in a two-dimensional array in one of two ways. The first method uses two subscripts to specify the row and column position of the element in the array, and the second method uses a single-element number. AELEMENT( ) returns the element number when supplied with an element’s row and column subscripts.

The Visual FoxPro functions ADEL( ), ADIR( ), AFIELDS( ), AINS( ), ALEN( ), ASCAN( ), ASORT( ), and ASUBSCRIPT( ) can manipulate two-dimensional arrays, and require that elements be referred to by their element number. AELEMENT( ) facilitates conversion from subscripts to an element number for use by these functions. The corresponding row and column subscripts can be returned from an element number with ASUBSCRIPT( ).

The following example illustrates the creation of an array with two rows and three columns. DISPLAY MEMORY shows the contents of the elements of the array listed in element number order.

DIMENSION gaMyArray(2,3)

DISPLAY MEMORY LIKE gaMyArray

gaMyArray     Pub    A

  (   1,   1)     L  .F. (element number 1)

  (   1,   2)     L  .F. (element number 2)

  (   1,   3)     L  .F. (element number 3)

  (   2,   1)     L  .F. (element number 4)

  (   2,   2)     L  .F. (element number 5)

  (   2,   3)     L  .F. (element number 6)

An element can be referred to by its subscripts or its element number. The commands STORE 'INVOICE' TO gaMyArray(2, 1) and STORE 'INVOICE' TO gaMyArray(4) both store the character string INVOICE to the same array element.

In one-dimensional arrays, an element number is identical to its single-row subscript. It isn’t necessary to use AELEMENT( ) with one-dimensional arrays.


See Also

ADEL( )
ADIR( )
AFIELDS( )
AINS( )
ALEN( )
ASCAN( )
ASORT( )
ASUBSCRIPT( )
DIMENSION
DISPLAY MEMORY


AERROR( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Creates a variable array containing information about the most recent Visual FoxPro, OLE, or ODBC error.

Syntax

AERROR(ArrayName)

Returns

Numeric

Arguments

ArrayName   Specifies the name of the array that AERROR( ) creates.

Remarks

AERROR( ) creates an array with six columns and returns the number of rows in the array. The type of error that occurred determines the number of rows in the array.

The following table describes the contents of each element when a Visual FoxPro error occurs. When a Visual FoxPro error occurs, the array contains one row.

Element number	Description
1	Numeric. The number of the error. Identical to the value returned by ERROR( ).
2	Character. The text of the error message. Identical to the value returned by MESSAGE( ).
3	The null value. However, if the error has an additional error parameter, contains the text of the error parameter. Identical to the value returned by SYS(2018).
4	The null value. However, as appropriate, contains the number of the work area in which the error occurred.
5	The null value. However, if a trigger failed (error 1539), contains one of the following numeric values: 1 - Insert trigger failed. 2 - Update trigger failed. 3 - Delete trigger failed.
6	The null value.
7	The null value.
The following table describes the contents of each element when OLE errors numbered 1427 or 1429 occur. When these OLE errors occur, the array contains one row.

Element number	Description
1	Numeric. Contains 1427 or 1429.
2	Character. The text of the Visual FoxPro error message.
3	Character. The text of the OLE error message.
4	Character. The application name (for example, Microsoft Excel).
5	The null value or Character. Contains the name of the application’s Help file where more information about the error can be found if the information is available from the application; otherwise contains the null value.
6	The null value or Character. Contains the Help context ID for the appropriate Help topic if the information is available from the application; otherwise contains the null value.
7	Numeric. An OLE 2.0 exception number.
The following table describes the contents of each element when an ODBC error numbered 1526 occurs. When an ODBC error occurs, the array contains two or more rows; one row for each ODBC error.

Element number	Description
1	Numeric. Contains 1526.
2	Character. The text of the error message.
3	Character. The text of the ODBC error message.
4	Character. The current ODBC SQL state.
5	Numeric. The error number from the ODBC data source.
6	Numeric. The ODBC connection handle.
7	The null value.


AERROR( ) Function Example

The following example uses ON ERROR to specify an error handling routine named errhand. An error is generated by issuing a misspelled command (BRWS). The errhand error handling routine uses AERROR( ) to create an array containing error information, and this information is then displayed.

ON ERROR DO errhand	  && errhand is the error handler procedure

BRWS  && Causes a syntax error

ON ERROR  && Restore system error handler

PROCEDURE errhand

= AERROR(aErrorArray)  && Data from most recent error

CLEAR

? 'The error provided the following information'  && Display message

FOR n = 1 TO 7  && Display all elements of the array

? aErrorArray(n)

ENDFOR


See Also

CREATE TRIGGER
ERROR( )
MESSAGE( )
ON ERROR
SYS(2018) - Error Message Parameter


AFIELDS( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Places information about the structure of the current table into an array and returns the number of fields in the table.

Syntax

AFIELDS(ArrayName [, nWorkArea | cTableAlias])

Returns

Numeric

Arguments

ArrayName   Specifies an array into which information about the table structure is placed. If the array you include in AFIELDS( ) doesn’t exist, Visual FoxPro automatically creates it. If the array exists and isn’t large enough to contain all the information returned by AFIELDS( ), the size of the array is automatically increased to accommodate the information.

nWorkArea   Specifies the work area of the table for which structure information is placed into an array.

cTableAlias   Specifies the alias of the table for which structure information is placed into an array.

If you omit nWorkArea and cTableAlias, structure information is placed in an array for the table in the currently selected work area.

The following table describes the content of each column in the array and the data type of the information stored in each column. One row is created for each field in the table.

Column number	Field info	Data type
1	Field name	Character
2	Field type: C = Character D = Date L = Logical M = Memo N = Numeric F = Float I = Integer B = Double Y = Currency T = DateTime G = General	Character
3	Field width	Numeric
4	Decimal places	Numeric
5	Null values allowed	Logical
6	Code page translation not allowed	Logical
7	Field validation expression	Character
8	Field validation text	Character
9	Field default value	Character
10	Table validation expression	Character
11	Table validation text	Character
12	Long table name	Character
13	Insert trigger expression	Character
14	Update trigger expression	Character
15	Delete trigger expression	Character
16	Table comment	Character
Remarks

AFIELDS( ) returns the number of fields in the table. The array contains 11 columns and the same number of rows as fields in the table.

You can use COPY STRUCTURE EXTENDED to place similar information into a table instead of an array.


AFIELDS( ) Function Example

The following example creates an array named gaMyArray containing information about the fields in the customer table. The names of the fields are displayed.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE Customer	  && Open customer table

gnFieldcount = AFIELDS(gaMyArray)  && Create array

CLEAR

FOR nCount = 1 TO gnFieldcount

? gaMyArray(nCount,1)  && Display field names

ENDFOR


See Also

ADEL( )
ADIR( )
AELEMENT( )
AINS( )
ALEN( )
ALTER TABLE - SQL
ASCAN( )
ASORT( )
ASUBSCRIPT( )
COPY STRUCTURE
CREATE
CREATE TABLE
DIMENSION


AFONT( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Places information about available fonts into an array.

Syntax

AFONT(ArrayName [, cFontName [, nFontSize]])

Returns

Logical

Arguments

ArrayName   Specifies the variable array into which the names of available fonts are placed. If the array is not large enough to contain all the fonts, Visual FoxPro automatically increases the size of the array. If you specify an existing two-dimensional array, Visual FoxPro changes the array to a one-dimensional array.

If the array is successfully created, AFONT( ) returns true (.T.); otherwise, AFONT( ) returns false (.F.).

cFontName   Specifies a font for which information is placed into the array.

If the font you specify supports only discrete font sizes (8-point, 10-point, ...), the font sizes are stored to the array and AFONT( ) returns true (.T.). If the font you specify in cFontName is scalable (supports fractional font-size values), the array has a single element containing –1 and AFONT( ) returns true (.T.).

If the font you specify is not available, the array isn’t created and AFONT( ) returns false (.F.).

nFontSize   Specifies a size for the font specified in cFontName.

If the font size nFontSize is available for the font specified in cFontName, the array has a single element containing a true (.T.) value and AFONT( ) returns true (.T.). If the font size is not available for the specified font, the array is not created and AFONT( ) returns false (.F.).

Remarks

AFONT( ) places the names of available fonts into an array. It can also be used to determine available font sizes or if a font is scalable. Use GETFONT( ) to display a dialog containing available fonts, font sizes, and styles.


AFONT( ) Function Example

The following example uses AFONT( ) to create an array containing the names of all available fonts. The name of each font is displayed, along with an example of the font. If there are more than 10 fonts installed, only the first 10 are displayed.

CLEAR

=AFONT(gaFontArray)  && Array containing font names

gnNumFonts = ALEN(gaFontArray)  && Number of fonts

IF gnNumFonts > 10

gnNumFonts = 10  && Display first 10 fonts

ENDIF

FOR nCount = 1 TO gnNumFonts

? ALLTRIM(gaFontArray(nCount))  && Display font name

?? '  This is an example of ' ;

+ ALLTRIM(gaFontArray(nCount)) FONT gaFontArray(nCount), 8

ENDFOR


See Also

FONTMETRIC( )
GETFONT( )
TXTWIDTH( )
SYSMETRIC( )
WFONT( )


AfterCloseTables Event

Syntax         Remarks         Applies To         See Also

Occurs after the tables or views specified in the data environment for a form, form set, or report are released.

Syntax

PROCEDURE DataEnvironment.AfterCloseTables

Remarks

For a form or form set, the AfterCloseTables event occurs after the form set’s or form’s Unload event occurs and after any tables or views that were opened by the data environment are closed.

For a report, the AfterCloseTables event occurs after any tables or views that were opened by the data environment are closed.

The AfterCloseTables event occurs whenever the CloseTables method is called. The Destroy event of the data environment and its associated objects occurs after the AfterCloseTables event.


Applies To

DataEnvironment


See Also

CloseTables Method
Destroy Event
Unload Event


AfterDock Event

Syntax         Arguments         Remarks         Applies To         See Also

Occurs after a ToolBar object is docked.

Syntax

PROCEDURE ToolBar.AfterDock
[LPARAMETERS nIndex]

Arguments

nIndex   Uniquely identifies a control if it is in a control array.

Remarks

The AfterDock event occurs when the user docks a ToolBar or when the Dock method is invoked.


Applies To

ToolBar


See Also

BeforeDock Event
Dock Method
Undock Event


AfterRowColChange Event

Syntax         Parameters         Remarks         Applies To         See Also

Occurs when the user moves to another row or column in the Grid, after the new cell gets the focus, and after the When event of the object in the new row or column. The AfterRowColChange event doesn’t fire unless the When event of the object in the new row or column returns true (.T.).

Syntax

PROCEDURE Grid.AfterRowColChange
LPARAMETERS nColIndex

Parameters

nColIndex   Returns the index of the newly selected row or column.

Remarks

AfterRowColChange is triggered interactively by the mouse or keyboard, or programmatically, such as by calling the ActivateCell method.


Applies To

Grid


See Also

ActivateCell Method
BeforeRowColChange Event
When Event


AINS( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Inserts an element into a one-dimensional array, or a row or column into a two-dimensional array.

Syntax

AINS(ArrayName, nElementNumber [, 2])

Returns

Numeric

Arguments

ArrayName   Specifies the name of the array into which the element is inserted.

nElementNumber   Specifies where the new element, row, or column is inserted into the array.

To insert an element into a one-dimensional array, include ArrayName and the element nElementNumber where the insertion occurs. The new element is inserted just before element nElementNumber. To insert a row into a two-dimensional array, include ArrayName and the number of the row nElementNumber where the insertion occurs. The new row is inserted just before row nElementNumber.

For more information on referencing an array element by its subscripts, see DIMENSION.

2   Inserts a column into a two-dimensional array. The new column is inserted just before the column specified with nElementNumber.

Remarks

Inserting an element, row, or column into an array does not change the size of the array. The trailing elements, rows, or columns are shifted toward the end of the array and the last element, row, or column in the array is dropped from it. The newly inserted element, row, or column is initialized to false (.F.).

AINS( ) returns 1 if the element, row, or column is successfully inserted.


AINS( ) Function Example

The following example creates and fills an array with company names and scans the array for a specific company name. If the company name isn’t found, it adds the missing company name to the array.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer	  && Open customer table

SELECT company FROM customer ;

WHERE country = 'Germany' ;

INTO ARRAY gaCompanies

gnCount = _TALLY

gcName = 'Seven Seas Imports'

CLEAR

DISPLAY MEMORY LIKE gaCompanies

IF ASCAN(gaCompanies, gcName) = 0  && Search for company

*** Company not found-add it ***

DIMENSION gaCompanies[gnCount+1,1]

= AINS(gaCompanies, gnCount+1)

gaCompanies[gnCount+1] = gcName

ENDIF

DISPLAY MEMORY LIKE gaCompanies


See Also

ACOPY( )
ADEL( )
ADIR( )
AELEMENT( )
AFIELDS( )
ALEN( )
ASCAN( )
ASORT( )
ASUBSCRIPT( )
DIMENSION


AINSTANCE( ) Function

Syntax         Returns         Arguments         Example         See Also

Places instances of a class into a variable array and returns the number of instances placed in the array.

Syntax

AINSTANCE(ArrayName, cClassName)

Returns

Numeric

Arguments

ArrayName   Specifies the name of the array into which the instances are placed. If the array you specify doesn’t exist, Visual FoxPro automatically creates the array. If the array exists and isn’t large enough to contain all the instances, Visual FoxPro automatically increases the size of the array to accommodate the instances. If the array is larger than necessary, Visual FoxPro truncates the array. If the array exists and AINSTANCE( ) returns 0 because no instances are found, the array remains unchanged. If the array doesn’t exist and AINSTANCE( ) returns 0, the array is not created.

Only class instances assigned to variables and array elements with CREATEOBJECT( ) are placed into the array.

cClassName   Specifies a Visual FoxPro base class name or a user-defined class name. The following table lists the Visual FoxPro base classes you can specify for cClassName:

Base class names
CheckBox	Label
Column	Line
ComboBox	ListBox
CommandButton	OLEControl
CommandGroup	OLEBoundControl
Container	OptionButton
Control	OptionGroup
Cursor	Page
Custom	PageFrame
DataEnvironment	Relation
EditBox	Separator
Form	Shape
FormSet	Spinner
Grid	TextBox
Header	Timer
Image	ToolBar


AINSTANCE( ) Function Example

In the following example, CREATEOBJECT( ) is used to create two instances of the Visual FoxPro Form base class. AINSTANCE( ) is used to create an array named gaMyArray that contains the variable references (goINSTANCE1 and goINSTANCE2) for each form instance. The contents of the array are then displayed.

CLEAR ALL

goINSTANCE1 = CREATEOBJECT('Form')

goINSTANCE2 = CREATEOBJECT('Form')

CLEAR

? AINSTANCE(gaMyArray, 'Form')  && Returns 2, two form instances

DISPLAY MEMORY LIKE gaMyArray  && Displays the references


See Also

ADD CLASS
AMEMBERS( )
CREATE CLASS
CREATE CLASSLIB
CREATEOBJECT( )
DEFINE CLASS


ALEN( ) Function

Syntax         Returns         Arguments         Example         See Also

Returns the number of elements, rows, or columns in an array.

Syntax

ALEN(ArrayName [, nArrayAttribute])

Returns

Numeric

Arguments

ArrayName   Specifies the name of the array. If you include only the array name, ALEN( ) returns the number of elements in the array.

nArrayAttribute   Determines whether ALEN( ) returns the number of elements, rows or columns in the array according to the following values for nArrayAttribute:

0	Returns the number of elements in the array. Omitting nArrayAttribute is identical to specifying 0.
1	Returns the number of rows in the array.
2	Returns the number of columns in the array. If the array is a one-dimensional array, ALEN( ) returns 0 (no columns).


ALEN( ) Function Example

The following example uses AFONT( ) to create an array containing the names of all available fonts. ALEN( ) is used to detemine the number of rows in the array. The name of each font is displayed, along with an example of the font. If more than 10 fonts are installed, only the first 10 are displayed.

CLEAR

=AFONT(gaFontArray)  && Array containing font names

gnNumFonts= ALEN(gaFontArray)  && Number of fonts

IF gnNumFonts > 10

gnNumFonts = 10  && Display first 10 fonts

ENDIF

FOR nCount = 1 TO gnNumFonts

? ALLTRIM(gaFontArray(nCount))  && Display font name

?? '  This is an example of ' ;

+ ALLTRIM(gaFontArray(nCount)) FONT gaFontArray(nCount), 8

ENDFOR


See Also

ADEL( )
ADIR( )
AELEMENT( )
AFIELDS( )
AINS( )
ASCAN( )
ASORT( )
ASUBSCRIPT( )
DIMENSION
STORE


Alias Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the alias used for each table or view associated with a Cursor object. Available at design time and run time.

Syntax

DataEnvironment.Cursor.Alias[ = cText]

Settings

cText   Specifies the alias used for the table or view associated with the Cursor object.

Remarks

When the data environment is loaded, each table or view associated with a Cursor object is assigned an alias that is, by default, the same as the table or view name. Use the Alias property to override the default alias name.

The Alias property mimics the behavior of the USE command’s ALIAS clause.


Applies To

Cursor


See Also

USE


ALIAS( ) Function

Syntax         Returns         Arguments         Example         See Also

Returns the table alias of the current or specified work area.

Syntax

ALIAS([nWorkArea | cTableAlias])

Returns

Character

Arguments

nWorkArea   Specifies the work area number for which ALIAS( ) returns the table alias.

cTableAlias   Specifies the table alias for which ALIAS( ) returns the table alias.

If you omit nWorkArea or cTableAlias, ALIAS( ) returns the alias of the table open in the current work area. An empty string is returned if a table isn’t open in the current or specified work area.


ALIAS( ) Function Example

The following example opens the customer table and displays its alias. The customer table is opened again in another work area, is assigned an alias of MyCustomer, and the alias is displayed.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer	  && Open customer table

CLEAR

? ALIAS( )  && Display the alias

SELECT 0

USE customer AGAIN ALIAS MyCustomer  && Different alias

? ALIAS( )  && Display the alias


See Also

DBF( )
SELECT( )


Align Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the alignment of an ActiveX™ control (.OCX) on a form. Available at design time and run time.

Syntax

OLEContainerControl.Align[ = nAlign]

Settings

nAlign   The settings for the Align property are:

Setting	Description
0	Standard alignment. The ActiveX control is placed in the same position as the OLE Container control on the form.
1	Top. The ActiveX control is placed at the top of the form.
2	Bottom. The ActiveX control is placed at the bottom of the form.
3	Left. The ActiveX control is placed at the left edge of the form.
4	Right. The ActiveX control is placed at the right edge of the form.
Remarks

An ActiveX control (.OCX file) is placed in OLE Container control.

The Align property is only available for ActiveX controls that support changes to their alignment. Insertable OLE objects such as Microsoft Excel worksheets do not support the Align property.

The Align property is available only for ActiveX controls that are placed on a form.

If two or more ActiveX controls have the same Align property setting, the controls are stacked on top of each other.


Applies To

OLE Container Control


See Also

OLE Container Control


Alignment Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the alignment of text associated with a control. Available at design time and run time.

Syntax

Control.Alignment[ = nAlign]

Settings

nAlign   For a CheckBox or OptionButton control, the settings for the Alignment property are:

Setting	Description
0	(Default) Left. Aligns control to the left with text on the right.
1	(Default for Middle Eastern versions of Windows) Right. Aligns control to the right with text on the left.
For a ComboBox, EditBox, Header, Label, or Spinner control, the settings for the Alignment property are:

Setting	Description
0	(Default) Left. Aligns text flush left.. The default for combo boxes, edit boxes, headers, and labels.
1	(Default for Middle Eastern versions of Windows) Right. Aligns text flush right.. The default for spinners.
2	Center. Aligns the text in the middle with equal spaces to the right and left..
3	Automatic. Aligns text based on the data type of the control source.
For a TextBox control, the settings for the Alignment property are:

Setting	Description
0	Left. Aligns the text flush left..
1	Right. Aligns the text flush right..
2	Center. Aligns the text in the middle with equal spaces to the right and left..
3	(Default) Automatic. For a TextBox control not contained in a Column, aligns text based on the data type of the control source. Numeric types (numeric, double, float, currency, integer) are right-aligned; controls with other data types are left-aligned. For a TextBox control contained in a column, the Alignment setting for the column determines alignment of text in the text box.
For a column, the settings for the Alignment property are:

Setting	Description
0	Middle Left. Aligns the text flush left and centers it vertically.
1	Middle Right. Aligns the text flush right and centers it vertically.
2	Middle Center. Aligns the text in the middle with equal spaces to the right and left and centers it vertically.
3	(Default) Automatic. Aligns text based on the data type of the control source. Numeric types (numeric, double, float, currency, integer) are right-aligned; controls with other data types are left-aligned.
4	Top Left. Aligns the text flush left at the top of the column.
5	Top Right. Aligns the text flush right at the top of the column.
6	Top Center. Aligns the text in the middle with equal spaces to the right and left, at the top of the column.
7	Bottom Left. Aligns the text flush left at the bottom of the column.
8	Bottom Right. Aligns the text flush right at the bottom of the column.
9	Bottom Center. Aligns the text in the middle with equal spaces to the right and left, at the bottom of the column.
Remarks

For a ComboBox, the Alignment property applies only when the Style property is set to 0.


Applies To

CheckBox, Column, ComboBox, EditBox, Header, Label, OptionButton, Spinner, TextBox


See Also

AutoSize Property
Caption Property


_ALIGNMENT System Memory Variable
_ALIGNMENT System Variable

Included for backward compatibility. Use the Report Designer instead.


AllowAddNew Property

Syntax         Settings         Remarks         Applies To          See Also

Specifies whether new records can be added to a table from within a grid. Available at design time and run time.

Syntax

Grid.AllowAddNew[ = lExpr]

Settings

lExpr   One of the following:

Setting	Description
True (.T.)	New records can be added to a table from within a grid.
False (.F.)	(Default) New records cannot be added to a table from within a grid.
Remarks

If AllowAddNew is set to true (.T.), you can add a new record to a table in a grid by pressing the down arrow while positioned on the last record in the grid, as long as the grid is read-write. New records cannot be added from within the grid if the grid is read-only (if the RecordSourceType is a query, a table is read-only, and so on).


Applies To

Grid


See Also

APPEND


AllowHeaderSizing Property

Syntax         Settings         Applies To          See Also

Specifies whether the height of a grid’s header can be changed at run time. Available at design time and run time.

Syntax

Grid.AllowHeaderSizing[ = lExpr]

Settings

lExpr   One of the following:

Setting	Description
True (.T.)	(Default) The height of the grid’s header can be changed by dragging the header at run time.
False (.F.)	The height of the grid’s header cannot be changed by dragging the header at run time.


Applies To

Grid


See Also

AllowRowSizing Property


AllowRowSizing Property

Syntax         Settings         Applies To          See Also

Specifies whether the height of records in a grid can be changed at run time. Available at design time and run time.

Syntax

Grid.AllowRowSizing[ = lExpr]

Settings

lExpr   One of the following:

Setting	Description
True (.T.)	(Default) The height of records in the grid can be changed by dragging at run time.
False (.F.)	The height of records in the grid cannot be changed by dragging at run time.


Applies To

Grid


See Also

AllowHeaderSizing Property


AllowTabs Property

Syntax         Settings         Applies To         See Also

Specifies whether tabs are allowed in an EditBox control.

Syntax

EditBox.AllowTabs[ = lExpr]

Settings

lExpr   The settings for the AllowTabs property are:

Setting	Description
True (.T.)	Tabs are allowed; press CTRL+TAB to exit the field.
False (.F.)	(Default) Tabs are not allowed in the EditBox; pressing the TAB key moves the focus to the next control in the tab order.


Applies To

EditBox


See Also

TabIndex Property
TabStop Property


ALLTRIM( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Removes leading and trailing blanks from the specified character expression and returns the trimmed expression as a character string.

Syntax

ALLTRIM(cExpression)

Returns

Character

Arguments

cExpression   Specifies the character expression from which leading and trailing blanks are removed.

Remarks

ALLTRIM( ) can be used to ensure that blanks are removed from data entered by a user.


ALLTRIM( ) Function Example

The following example uses AFONT( ) to create an array containing the names of all available fonts. ALLTRIM( ) is used to remove leading and trailing spaces from the font names. The trimmed name of each font is displayed, along with an example of the font. If more than 10 fonts are installed, only the first 10 are displayed.

CLEAR

=AFONT(gaFontArray)  && Array containing font names

gnNumFonts= ALEN(gaFontArray)  && Number of fonts

IF gnNumFonts > 10

gnNumFonts = 10  && Display first 10 fonts

ENDIF

FOR nCount = 1 TO gnNumFonts

? ALLTRIM(gaFontArray(nCount))  && Display font name

?? '  This is an example of ' ;

+ ALLTRIM(gaFontArray(nCount)) FONT gaFontArray(nCount), 8

ENDFOR


See Also

LTRIM( )
RTRIM( )
TRIM( )


ALTER TABLE - SQL Command

Syntax         Arguments         Remarks         Example         See Also

Programmatically modifies the structure of a table.

Syntax

ALTER TABLE TableName1
ADD | ALTER [COLUMN] FieldName1
FieldType [(nFieldWidth [, nPrecision])]
[NULL | NOT NULL]
[CHECK lExpression1 [ERROR cMessageText1]]
[DEFAULT eExpression1]
[PRIMARY KEY | UNIQUE]
[REFERENCES TableName2 [TAG TagName1]]
[NOCPTRANS]
 – Or –
ALTER TABLE TableName1
ALTER [COLUMN] FieldName2
[NULL | NOT NULL]
[SET DEFAULT eExpression2]
[SET CHECK lExpression2 [ERROR cMessageText2]]
[DROP DEFAULT]
[DROP CHECK]
 – Or –
ALTER TABLE TableName1
[DROP [COLUMN] FieldName3]
[SET CHECK lExpression3 [ERROR cMessageText3]]
[DROP CHECK]
[ADD PRIMARY KEY eExpression3 TAG TagName2]
[DROP PRIMARY KEY]
[ADD UNIQUE eExpression4 [TAG TagName3]]
[DROP UNIQUE TAG TagName4]
[ADD FOREIGN KEY [eExpression5] TAG TagName4
REFERENCES TableName2 [TAG TagName5]]
[DROP FOREIGN KEY TAG TagName6 [SAVE]]
[RENAME COLUMN FieldName4 TO FieldName5]
[NOVALIDATE]

Arguments

TableName1   Specifies the name of the table whose structure is modified.

ADD [COLUMN] FieldName1   Specifies the name of the field to add. A single table can contain up to 255 fields. If one or more fields allow null values, the limit is reduced by one to 254 fields.

ALTER [COLUMN] FieldName1   Specifies the name of an existing field to modify.

FieldType [(nFieldWidth [, nPrecision])]   Specifies the field type, field width, and field precision (number of decimal places) for a new or modified field.

FieldType is a single letter indicating the field’s data type. Some field data types require that you specify nFieldWidth or nPrecision or both.

The following table lists the values for FieldType and indicates whether nFieldWidth and nPrecision are required:

FieldType	nFieldWidth	nPrecision	Description
C	n	-	Character field of width n
D	-	-	Date
T	-	-	DateTime
N	n	d	Numeric field of width n with d decimal places
F	n	d	Floating numeric field of width n with d decimal places
I	-	-	Integer
B	-	d	Double
Y	-	-	Currency
L	-	-	Logical
M	-	-	Memo
G	-	-	General
P	-	-	Picture
nFieldWidth and nPrecision are ignored for D, T, I, Y, L, M, G, and P types. nPrecision defaults to zero (no decimal places) if nPrecision isn’t included for the N, F, or B types.

NULL | NOT NULL   Allows or precludes null values in the field. If one or more fields can contain null values, the maximum number of fields the table can contain is reduced by one, from 255 to 254.

If you omit NULL and NOT NULL, the current setting of SET NULL determines whether null values are allowed in the field. However, if you omit NULL and NOT NULL and include the PRIMARY KEY or UNIQUE clause, the current setting of SET NULL is ignored and the field defaults to NOT NULL.

CHECK lExpression1   Specifies a validation rule for the field. lExpression1 must evaluate to a logical expression, it can be a user-defined function or a stored procedure. When a blank record is appended, the validation rule is checked. An error is generated if the validation rule doesn’t allow for a blank field value in an appended record.

ERROR cMessageText1   Specifies the error message displayed when the field validation rule generates an error. The message is displayed only when data is changed within a Browse or Edit window.

DEFAULT eExpression1   Specifies a default value for the field. The data type of eExpression1 must be the same as the data type for the field.

PRIMARY KEY   Creates a primary index tag. The index tag has the same name as the field.

UNIQUE   Creates a candidate index tag with the same name as the field.

For more information about candidate indexes, see Chapter 7, “Working with Tables,” in the Developer’s Guide.

Note   Candidate indexes (created by including the UNIQUE option, provided for ANSI compatibility in ALTER TABLE or CREATE TABLE) are not the same as indexes created with the UNIQUE option in the INDEX command. An index created with UNIQUE in the INDEX command allows duplicate index keys; candidate indexes do not allow duplicate index keys.

Null values and duplicate records are not permitted in a field used for a primary or candidate index.

If you are creating a new field with ADD COLUMN, Visual FoxPro will not generate an error if you create a primary or candidate index for a field that supports null values. However, Visual FoxPro will generate an error if you attempt to enter a null or duplicate value into a field used for a primary or candidate index.

If you are modifying an existing field and the primary or candidate index expression consists of fields in the table, Visual FoxPro checks the fields to see if they contain null values or duplicate records. If they do, Visual FoxPro generates an error and the table is not altered.

REFERENCES TableName2 TAG TagName1   Specifies the parent table to which a persistent relationship is established. TAG TagName1 specifies the parent table’s index tag on which the relationship is based. Index tag names can contain up to 10 characters.

NOCPTRANS   Prevents translation to a different code page for character and memo fields. If the table is converted to another code page, the fields for which NOCPTRANS has been specified are not translated. NOCPTRANS can only be specified for character and memo fields.

The following example creates a table named MYTABLE containing two character fields and two memo fields. The second character field char2 and the second memo field memo2 include NOCPTRANS to prevent translation.

CREATE TABLE mytable (char1 C(10), char2 C(10) NOCPTRANS,;

memo1 M, memo2 M NOCPTRANS)

ALTER [COLUMN] FieldName2   Specifies the name of an existing field to modify. Note that multiple ALTER COLUMN clauses are required to change more than one property of a field in a single ALTER TABLE command. See the ALTER TABLE examples to see how the ALTER COLUMN clauses are structured.

SET DEFAULT eExpression2   Specifies a new default value for an existing field. The data type of eExpression2 must be the same as the data type for the field.

SET CHECK lExpression2   Specifies a new validation rule for an existing field. lExpression2 must evaluate to a logical expression, and may be a user-defined function or a stored procedure.

ERROR cMessageText2   Specifies the error message displayed when the field validation rule generates an error. The message is displayed only when data is changed within a Browse or Edit window.

DROP DEFAULT   Removes the default value for an existing field.

DROP CHECK   Removes the validation rule for an existing field.

DROP [COLUMN] FieldName3   Specifies a field to remove from the table. Removing a field from the table also removes the field’s default value setting and field validation rule.

If index key or trigger expressions reference the field, the expressions become invalid when the field is removed. In this case, an error isn’t generated when the field is removed, but the invalid index key or trigger expressions will generate errors at run time.

SET CHECK lExpression3   Specifies the table validation rule. lExpression3 must evaluate to a logical expression; it may be a user-defined function or a stored procedure.

ERROR cMessageText3   Specifies the error message displayed when the table validation rule generates an error. The message is displayed only when data is changed within a Browse or Edit window.

DROP CHECK   Removes the table’s validation rule.

ADD PRIMARY KEY eExpression3 TAG TagName2   Adds a primary index to the table. eExpression3 specifies the primary index key expression; TagName2 specifies the name of the primary index tag. Index tag names can contain up to 10 characters. If TAG TagName2 is omitted and eExpression3 is a single field, the primary index tag has the same name as the field specified in eExpression3.

DROP PRIMARY KEY   Removes the primary index and its index tag. Because a table can have only one primary key, it isn’t necessary to specify the name of the primary key. Removing the primary index also deletes any persistent relations based on the primary key.

ADD UNIQUE eExpression4 [TAG TagName3]   Adds a candidate index to the table. eExpression4 specifies the candidate index key expression,; TagName3 specifies the name of the candidate index tag. Index tag names can contain up to 10 characters. If you omit TAG TagName3, and if eExpression4 is a single field, the candidate index tag has the same name as the field specified in eExpression4.

DROP UNIQUE TAG TagName4   Removes the candidate index and its index tag. Because a table can have multiple candidate keys, you must specify the name of the candidate index tag.

ADD FOREIGN KEY [eExpression5] TAG TagName4   Adds a foreign (non-primary) index to the table. eExpression5 specifies the foreign index key expression and TagName4 specifies the name of the foreign index tag. Index tag names can contain up to 10 characters.

REFERENCES TableName2 [TAG TagName5]   Specifies the parent table to which a persistent relationship is established. Include TAG TagName5 to establish a relationship based on an existing index tag for the parent table. Index tag names can contain up to 10 characters. If you omit TAG TagName5, the relationship is established using the parent table’s primary index tag.

DROP FOREIGN KEY TAG TagName6 [SAVE]   Deletes a foreign key whose index tag is TagName6. If you omit SAVE, the index tag is deleted from the structural index. Include SAVE to prevent the index tag from being deleted from the structural index.

RENAME COLUMN FieldName4 TO FieldName5   Allows you to change the name of a field in the table. FieldName4 specifies the name of the field that is renamed. FieldName5 specifies the new name of the field.

Caution   Exercise care when renaming table fields — index expressions, field and table validation rules, commands, functions, and so on may reference the original field names.

NOVALIDATE   Specifies that Visual FoxPro allows changes to be made to the structure of the table that may violate the integrity of the data in the table. By default, Visual FoxPro prevents ALTER TABLE from making changes to the structure of the table that violate the integrity of the data in the table. Include NOVALIDATE to override this default behavior.

Remarks

ALTER TABLE can be used to modify the structure of a table that has not been added to a database. However, Visual FoxPro generates an error if you include the DEFAULT, FOREIGN KEY, PRIMARY KEY, REFERENCES, or SET clauses when modifying a free table.

ALTER TABLE may rebuild the table by creating a new table header and appending records to the table header. For example, changing a field’s type or width may cause the table to be rebuilt.

After a table is rebuilt, field validation rules are executed for any fields whose type or width is changed. If you change the type or width of any field in the table, the table rule is executed.

If you modify field or table validation rules for a table that has records, Visual FoxPro tests the new field or table validation rules against the existing data and issues a warning on the first occurrence of a field or table validation rule or of a trigger violation.


ALTER TABLE - SQL Command Examples

Example 1 adds a field called fax to the customer table and allows the field to have null values.

Example 2 makes the cust_id field the primary key of the customer table.

Example 3 adds a field validation rule to the quantity field of the orders table so that values in the quantity field must be non-negative.

Example 4 adds a one-to-many persistent relation between the customer and orders tables based on the primary key cust_id in the customer table and a new foreign key index cust_id in the orders table.

Example 5 removes the field validation rule from the quantity field in the orders table.

Example 6 removes the persistent relation between the customer and orders tables, but keeps the cust_id index tag in the orders table.

Example 7 adds a field called fax2 to the customer table and prevents the field from containing null values. The new structure of the table is displayed. Two ALTER COLUMN clauses are used to allow the field to have null values and set the default value for the field to the null value. Note that multiple ALTER COLUMN clauses are required to change more than one property of a field in a single ALTER TABLE command. The new field is then removed from the table to restore the table to its original state.

* Example 1

SET PATH TO (HOME( ) + 'samples\data\')	  && Sets path to table

ALTER TABLE customer ADD COLUMN fax c(20) NULL

* Example 2

ALTER TABLE customer ADD PRIMARY KEY cust_id TAG cust_id

ALTER TABLE customer ALTER COLUMN cust_id c(5) PRIMARY KEY

* Example 3

ALTER TABLE orders;

 ALTER COLUMN quantity SET CHECK quantity >= 0;

 ERROR "Quantities must be non-negative"

* Example 4

ALTER TABLE orders;

ADD FOREIGN KEY cust_id TAG cust_id REFERENCES customer

* Example 5

ALTER TABLE orders ALTER COLUMN quantity DROP CHECK

* Example 6

ALTER TABLE orders DROP FOREIGN KEY TAG cust_id SAVE

* Example 7

CLEAR

ALTER TABLE customer ADD COLUMN fax2 c(20) NOT NULL

DISPLAY STRUCTURE

ALTER TABLE customer;

ALTER COLUMN fax2 NULL;

ALTER COLUMN fax2 SET DEFAULT .NULL.

ALTER TABLE customer DROP COLUMN fax2


See Also

CREATE TABLE - SQL
INDEX
MODIFY STRUCTURE
OPEN DATABASE


AlwaysOnTop Property

Syntax         Settings         Applies To         See Also

Prevents other windows from covering the form’s window. Available at design time; read-write at run time.

Syntax

Object.AlwaysOnTop[ = lExpr]

Settings

lExpr   The settings for the AlwaysOnTop property are:

Setting	Description
True (.T.)	The form is always on top (only another window with the AlwaysOnTop property set to true (.T.) can be on top of the form).
False (.F.)	(Default) The form can be covered by another window.


Applies To

Form, _SCREEN


See Also

ZOrder Method


AMEMBERS( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Places the names of properties, procedures, and member objects for an object into a variable array.

Syntax

AMEMBERS(ArrayName, ObjectName | cClassName [, 1 | 2])

Returns

Numeric

Arguments

ArrayName   Specifies the array into which the names of the member properties for ObjectName are placed. If you specify the name of an array that doesn’t exist, the array is automatically created. If the array isn’t large enough to contain all the names, Visual FoxPro automatically increases the size of the array.

ObjectName   Specifies the object whose member properties are placed in the variable array specified with ArrayName. ObjectName can be any expression that evaluates to an object, such as an object reference, an object variable, or an object array element.

cClassName   Specifies the class whose member properties are placed in the variable array specified with ArrayName.

1   Specifies that the array contains the properties of the object as well as the methods and member objects. The resulting array is two-dimensional with the second column specifying what type of member is listed in the first column. The possible values for the second column are Property, Event, Method, or Object.

2   Specifies that the array contains the names of the objects that are members of the object specified with ObjectName. The resulting array is one-dimensional.

This option provides a method to determine the names of all Form objects in a form set or controls in a form.

Remarks

AMEMBERS( ) returns the number of objects, properties, and procedures for the object, or 0 if the array cannot be created. If you omit the optional 1 and 2 arguments, a one-dimensional array is created containing the properties for ObjectName.


AMEMBERS( ) Function Example

The following example uses CREATEOBJECT( ) to create a Form object named goForm1. AMEMBERS( ) is used to create an array named gaPropArray containing the properties available for the form; the properties are then displayed.

CLEAR

goForm1 = CREATEOBJECT("Form")  && Creates a Form

= AMEMBERS(gaPropArray, goForm1, 1)  && Array containing Form properties

DISPLAY MEMORY LIKE gaPropArray  && Display the Form properties


See Also

ADD CLASS
AINSTANCE( )
CREATE CLASS
CREATE CLASSLIB
CREATEOBJECT( )
DEFINE CLASS


ANSITOOEM( ) Function

Included for backward compatibility. Use GETCP( ) instead.


APPEND Command

Syntax         Arguments         Remarks         Example         See Also

Adds one or more new records to the end of a table.

Syntax

APPEND [BLANK]
[IN nWorkArea | cTableAlias]
[NOMENU]

Arguments

BLANK   Adds one blank record to the end of the current table. Visual FoxPro does not open an editing window when you issue APPEND BLANK.

You can edit the new record with BROWSE, CHANGE, or EDIT.

IN nWorkArea   Specifies the work area of the table to which a new record is appended.

IN cTableAlias   Specifies the alias of the table to which a new record is appended.

If you omit nWorkArea and cTableAlias, a new record is appended to the table in the currently selected work area. If you issue APPEND, a blank record is added to the table you specify with nWorkArea or cTableAlias and the table is automatically selected. If you issue APPEND BLANK, a blank record is added to the the table you specify with nWorkArea or cTableAlias and the table is not selected.

NOMENU   Specifies that the Table menu title is removed from the system menu bar, preventing changes to the format of the editing window.

Remarks

When you issue APPEND or APPEND BLANK and a table isn’t open in the currently selected work area, the Open dialog appears so that you can choose a table to which you can append records.

APPEND opens an editing window so you can enter data into one or more new records. When you add a new record, Visual FoxPro updates any indexes that are open.


APPEND Command Example

The following example uses APPEND BLANK to create a table with 10 records containing random values, then displays the maximum and minimum values in the table.

CLOSE DATABASES

CREATE TABLE Random (cValue N(3))

FOR nItem = 1 TO 10  && Append 10 records

APPEND BLANK

REPLACE cValue WITH 1 + 100 * RAND( )  && Insert random values

ENDFOR

CLEAR

LIST  && Display the values

gnMaximum = 1  && Initialize minimum value

gnMinimum = 100  && Initialize maximum value

SCAN

gnMinimum = MIN(gnMinimum, cValue)

gnMaximum = MAX(gnMaximum, cValue)

ENDSCAN

? 'The minimum value is: ', gnMinimum  && Display minimum value

? 'The maximum value is: ', gnMaximum  && Display maximum value


See Also

APPEND FROM ARRAY, BROWSE, CHANGE, EDIT, INSERT - SQL, REPLACE


APPEND FROM Command

Syntax         Arguments         Remarks         Example         See Also

Adds records to the end of the currently selected table from another file.

Syntax

APPEND FROM FileName | ?
[FIELDS FieldList]
[FOR lExpression]
[[TYPE] [DELIMITED [WITH Delimiter | WITH BLANK | WITH TAB
| WITH CHARACTER Delimiter]
| DIF | FW2 | MOD | PDOX | RPD | SDF | SYLK
| WK1 | WK3 | WKS | WR1 | WRK | XLS | XL5]]
[AS nCodePage]

Arguments

FileName   Specifies the name of the file to append from. If you don’t include a file name extension, a Visual FoxPro table and a default extension .DBF is assumed. If you are appending from a Visual FoxPro table, records in the table that are marked for deletion are appended, regardless of the SET DELETED setting.

?   Displays the Open dialog box, from which you can choose a table to append from.

FIELDS FieldList   Specifies to which fields data is appended.

FOR lExpression   Appends a new record for each record in the currently selected table for which lExpression evaluates to true (.T.). Records are appended until the end of the currently selected table is reached. If you omit FOR, the entire source file is appended to the currently selected table.

TYPE   Specifies the source file type of the file you are appending from. Although you must specify a file type if the file you are appending from isn’t a Visual FoxPro table, you need not include the TYPE key word. You can append from a wide variety of different file types including delimited ASCII text files, in which you can specify a field delimiter.

If the source file you are appending from doesn’t have the usual default file extension for that type of file, the source file name must include the file’s extension. For example, Microsoft Excel worksheets normally have an .XLS extension. If the Excel worksheet you append from has an extension other than the expected .XLS, be sure to specify the extension.

Note   When you are appending from a worksheet, the data in the worksheet must be stored in a row-major order rather than a column-major order. This allows the appended worksheet data to match the table structure.

DELIMITED   Specifies that the source file from which data is appended to the current Visual FoxPro table is a delimited file. A delimited file is an ASCII text file in which each record ends with a carriage return and linefeed. Field contents are by default assumed to be separated from each other by commas (do not include extra spaces before or after the commas), and character field values to be additionally delimited by double quotation marks. For example:

"Smith",9999999,"TELEPHONE"

The file extension is assumed to be .TXT for all delimited files.

You can import dates from delimited files if the dates are in proper date format. The date format defaults to mm/dd/yy. Including the century portion of a date is optional. Visual FoxPro will import a date, such as 12/25/95, that doesn’t include the century and assumes the date is in the twentieth century. Date delimiters can be any non-numeric character except the delimiter that separates the fields in the delimited file.

Dates in other formats can be imported if their formats match date formats available in SET DATE. To import dates that are not in the default format, issue SET DATE with the proper date format before using APPEND FROM. To test whether a date format can be successfully imported, use it with CTOD( ). If the date is acceptable to CTOD( ), the date will import properly.

DELIMITED WITH Delimiter   Indicates that character fields are separated by a character other than the quotation mark.

DELIMITED WITH BLANK   Specifies files that contain fields separated by spaces instead of commas.

DELIMITED WITH TAB   Specifies files that contain fields separated by tabs rather than commas.

DELIMITED WITH CHARACTER Delimiter   Specifies files that contain fields all separated by the character specified with Delimiter. If Delimiter is a semicolon (the character used in Visual FoxPro to indicate command line continuation), enclose the semicolon in quotation marks. You can also specify the BLANK and TAB keywords for Delimiter.

The WITH Delimiter clause can be combined with the WITH CHARACTER clause. For example, the following command adds records from a text file with character fields delimited with underscores and all fields delimited with asterisks:

APPEND FROM mytxt.txt DELIMITED WITH _ ;
WITH CHARACTER *

DIF   Include DIF to import data from a VisiCalc .DIF (Data Interchange Format) file. Vectors (columns) become fields in the currently selected table and tuples (rows) become records. DIF file names are assumed to have a .DIF extension.

FW2   Include FW2 to import data from a file created by Framework II. FW2 file names are assumed to have a .FW2 extension.

MOD   Include MOD to import data from a Microsoft Multiplan version 4.01 file. MOD files are created by Microsoft Multiplan version 4.01, and are assumed to have a .MOD extension.

PDOX   Include PDOX to import data from a Paradox version 3.5 or 4.0 database file. Paradox file names are assumed to have a .DB extension.

RPD   Include RPD to import data from a file created by RapidFile version 1.2. RapidFile file names are assumed to have an .RPD extension.

SDF   Include SDF to import data from a System Data Format file. An SDF file is an ASCII text file in which records have a fixed length and end with a carriage return and linefeed. Fields are not delimited. The file name extension is assumed to be .TXT for SDF files.

SYLK   Include SYLK to import data from a SYLK (Symbolic Link) interchange format file. SYLK files are used in Microsoft MultiPlan. Columns in the SYLK file become fields in the Visual FoxPro table and rows become records. SYLK file names have no extension.

WK1   Include WK1 to import data from a Lotus 1-2-3 version 2.x spreadsheet. Each column from the spreadsheet becomes a field in the table; each spreadsheet row becomes a record in the table. A .WK1 file name extension is assigned to a spreadsheet created in Lotus 1-2-3 revision 2.x.

WK3   Include WK3 to import data from a Lotus 1-2-3 spreadsheet. Each column from the spreadsheet becomes a field in the table; each spreadsheet row becomes a record in the table. A .WK3 file name extension is assigned to a spreadsheet created in Lotus 1-2-3 revision 3.x.

WKS   Include WKS to import data from a Lotus 1-2-3 revision 1-A spreadsheet. Each column from the spreadsheet becomes a field in the table; each spreadsheet row becomes a record in the table. A .WKS file name extension is assigned to a spreadsheet created in Lotus 1-2-3 revision 1-A.

WR1   Include WR1 to import data from a Lotus Symphony version 1.1 or 1.2 spreadsheet. Each column from the spreadsheet becomes a field in the table and each spreadsheet row becomes a record in the table. A .WR1 file name extension is assigned to a spreadsheet created in Symphony versions 1.1 or 1.2.

WRK   Include WRK to import data from a Lotus Symphony version 1.0 spreadsheet. Each column from the spreadsheet becomes a field in the table and each spreadsheet row becomes a record in the table. A .WRK file name extension is assigned to a spreadsheet created in Symphony version 1.0.

XLS   Include XLS to import data from a Microsoft Excel worksheet. Each column from the worksheet becomes a field in the table and each worksheet row becomes a record in the table. Worksheet files created in Microsoft Excel are given an .XLS file name extension.

XL5   Include XL5 to import data from Microsoft Excel version 5.0. Columns from the worksheet become fields in the table; the worksheet rows become records in the table. Worksheet files created in Microsoft Excel have an .XLS extension.

AS nCodePage   Specifies the code page of the source table or file. Visual FoxPro copies the contents of the source table or file and, as it copies the data, automatically converts the data to the code page of the current table.

If you specify a value for nCodePage that is not supported, Visual FoxPro generates an error message. You can use GETCP( ) for nCodePage to display the Code Page dialog box, allowing you to specify a code page for the appended table or file.

If you omit AS nCodePage and Visual FoxPro cannot determine the code page of the source table or file, Visual FoxPro copies the contents of the source table or file. As it copies the data, it automatically converts the data to the current Visual FoxPro code page. If SET CPDIALOG is ON, the table in the currently selected work area is marked with a code page. If you’re appending from a table not marked with a code page, the Code Page dialog is displayed, allowing you to choose the code page of the table from which you’re appending. The current Visual FoxPro code page can be determined with CPCURRENT( ).

If you omit AS nCodePage and Visual FoxPro can determine the code page of the table or file being appended, Visual FoxPro copies the contents of the appended table or file. As it copies the data, it automatically converts the data to the code page of the currently selected table.

If nCodePage is 0, Visual FoxPro assumes that the code page of the table or file being appended is the same as the code page of the currently selected table. No conversion to the current Visual FoxPro code page occurs.

Remarks

If the file from which you append is a Visual FoxPro table or a table created in an earlier version of FoxPro, a .DBF extension is assumed. If the Visual FoxPro table or the table created in an earlier version of FoxPro doesn’t have a .DBF extension, you must specify its extension. If the file is not a Visual FoxPro table or a table created in an earlier version of FoxPro, you must specify the type of file from which you append.

Before you can append from a table created in dBASE IV or dBASE V that contains a memo field, you must first open the table in Visual FoxPro with USE. When you are prompted to convert the file, choose Yes.

If you append from a Visual FoxPro table or a table created in an earlier version of FoxPro, the table you append from can be open in another work area. Records marked for deletion in the table you are appending from are unmarked once the records are appended.


APPEND FROM Command Example

In the following example, the customer table is opened, its structure is copied to a table called backup, and backup is then opened. Visual FoxPro then appends all records from Finland from the customer table. These records are then copied to a new delimited file called TEMP.TXT.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Open customer table

COPY STRUCTURE TO backup

USE backup

APPEND FROM customer FOR country = 'Finland'

COPY TO temp TYPE DELIMITED

MODIFY FILE temp.txt

USE

DELETE FILE backup.dbf

DELETE FILE temp.txt


See Also

COPY FILE
COPY TO
EXPORT
GETCP( )
IMPORT


APPEND FROM ARRAY Command

Syntax         Arguments         Remarks         Example         See Also

Adds one record to the currently selected table for each row in an array and fills each record with data from the corresponding array row.

Syntax

APPEND FROM ARRAY ArrayName
[FOR lExpression]
[FIELDS FieldList]

Arguments

ArrayName   Specifies the name of the array that contains the data to be copied to the new records. New records are added to the table until all rows in the array are appended.

FOR lExpression   Specifies a condition for appending records from the array. lExpression must contain the name of a target field in its conditional expression.

Before a row of the array is appended to a record in the table, the array element corresponding to the target field specified in lExpression is checked to determine whether that array element meets the condition in lExpression. If the array element satisfies the condition, a record is appended.

If the array element does not satisfy the condition, the array row is not appended and the next row in the array is checked to determine whether it meets the condition.

FIELDS FieldList   Specifies that only the fields in FieldList are updated from the array. The first field in the list is updated with the contents of the first element in the array, the second field is updated from the second element, and so on.

Remarks

Memo and general fields are ignored in APPEND FROM ARRAY. When a table is open for shared use, APPEND FROM ARRAY locks the table header while records are being added.

If the array is one-dimensional, APPEND FROM ARRAY adds one record to the table. The contents of the first array element fill the first field of the newly added record, the contents of the second element of the array fill the second field of the record, and so on.

If the one-dimensional array has more elements than the table has fields, the additional elements are ignored. If the table has more fields than the array has elements, the additional fields are initialized to the default empty value. Here are the default empty values for each field type:

Field type	Default value
Character	Spaces
Numeric	0
Currency	0
Float	0
Integer	0
Double	0
Date	Empty Date (e.g. CTOD(“”))
DateTime	Empty DateTime (e.g. CTOT(“”))
Logical	False (.F.)
Memo	Empty (no contents)
If the array is two-dimensional, APPEND FROM ARRAY adds a new record to the table for each row in the array. For example, if the array has four rows, four new records are appended to the table.

The contents of the first array column fill the first field of the newly added records, the second array column fills the second field of the new records, and so on. For example, if the array has four rows and three columns, elements from the first array column fill the first field in each of the four new records appended to the table.

If the two-dimensional array has more columns than the table has fields, the additional columns are ignored. If the table has more fields than the array has columns, the additional fields are initialized to empty values.

APPEND FROM ARRAY can fill a field even if the data type of the corresponding array element doesn’t match the data type of the field, provided that the array element data is compatible with the data type of the corresponding field. If the data isn’t compatible, the field is initialized to an empty value.


Data Type Mismatches Example

This example creates a table and then uses APPEND FROM ARRAY to append a record to the new table.

LOCAL ARRAY aNewRec(3)

* Create the table

CREATE TABLE Test FREE  (Object C(10), Color C(16), SqFt n(6,2))

SCATTER TO aNewRec BLANK      && Create a new array from the table

aNewRec[1]="Box"	              && Fill the the array

aNewRec[2]="Red"

aNewRec[3]=12.5

APPEND FROM ARRAY aNewRec     && Add record containing array contents

                              && to the table


See Also

APPEND
COPY TO ARRAY
DIMENSION
GATHER
SCATTER


APPEND GENERAL Command

Syntax         Arguments         Remarks         Example         See Also

Imports an OLE object from a file and places it into a general field.

Syntax

APPEND GENERAL GeneralFieldName
[FROM FileName]
[DATA cExpression]
[LINK]
[CLASS OLEClassName]

Arguments

GeneralFieldName   Specifies the name of the general field in which the OLE object is placed. You can specify a general field in a table open in a noncurrent work area by including the table alias with the field name.

FROM FileName   Specifies the file containing the OLE object. You must include the entire file name, including its extension. If the file is located in a directory other than the current default directory, include the path with the file name.

DATA cExpression   Specifies a character expression that is evaluated and passed as a character string to the OLE object in the general field. The OLE object must be capable of receiving and processing the string. For example, you cannot send a character string to a graphics object such as one created using Paintbrush.

LINK   Creates a link between the OLE object and the file that contains the object. The OLE object appears in the general field but the object’s definition remains in the file. If you omit LINK, the OLE object is embedded in the general field.

CLASS OLEClassName   Specifies an OLE class for an OLE object other than the default class.

Tip   You can determine the class for an OLE object by running REGEDIT and double-clicking the OLE object. The class name is listed under Identifier.

You can specify a class name when the file extension for the file containing the OLE object is different from the default extension and you want to force the behavior for the class. If the default extension can be used by multiple OLE servers, include the class to specify a particular server.

Remarks

If an OLE object already exists in the general field, it is replaced with the OLE object from the file.

For additional information about OLE objects in Visual FoxPro, see Chapter 16, “Adding OLE,” in the Developer’s Guide.


APPEND GENERAL Command Example

The following example imports a Microsoft Excel chart in the Excel directory or folder to a general field named mygenfield.

CREATE TABLE MyGenTbl (mygenfield G)

APPEND BLANK  && Add a blank record

APPEND GENERAL mygenfield FROM C:\EXCEL\BOOK1.XLS CLASS EXCELCHART


See Also

@ ... SAY - Pictures & OLE Objects
MODIFY GENERAL
OLE Bound Control


APPEND MEMO Command

Syntax         Arguments         Remarks         Example         See Also

Copies the contents of a text file to a memo field.

Syntax

APPEND MEMO MemoFieldName FROM FileName
[OVERWRITE] [AS nCodePage]

Arguments

MemoFieldName   Specifies the name of the memo field to which the file is appended.

FROM FileName   Specifies the text file whose contents are copied to the memo field. You must include the entire text file name, including its extension.

OVERWRITE   Replaces the current contents of the memo field with the contents of the file.

AS nCodePage   Specifies the code page of the text file copied to the memo field. Visual FoxPro copies the contents of the text file and, as it copies the data to the memo field, automatically converts the data from the code page you specify to the code page of the table containing the memo field. If the table containing the memo field is not marked with a code page, Visual FoxPro automatically converts the data from the code page you specify to the current Visual FoxPro code page.

If you specify a value for nCodePage that is not supported, Visual FoxPro generates an error message. You can use GETCP( ) for nCodePage to display the Code Page dialog box, allowing you to specify a code page for the appended table or file.

If you omit the AS nCodePage clause or specify 0 for nCodePage, no code page conversion occurs for the text file.

Remarks

The entire text file is appended to the contents of the specified memo field in the current record if overwrite is omitted.


APPEND MEMO Command Example

In the following example, the contents of the memo field notes are copied to a file called TEST.TXT. TEST.TXT is then appended to the contents of the memo field. Finally, the contents of TEST.TXT replace the current contents of the memo field.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE employee  && Open Employee table

WAIT WINDOW 'Employee notes memo field - press ESC' NOWAIT

MODIFY MEMO notes NOEDIT  && Open the notes memo field

COPY MEMO notes TO test.txt  && Create test file from memo field

WAIT WINDOW 'TEST.TXT text file - press ESC' NOWAIT

MODIFY FILE test.txt NOEDIT && Open the text file

WAIT WINDOW 'Employee notes now appended - press ESC' NOWAIT

APPEND MEMO notes FROM test.txt  && Add contents of text file

MODIFY MEMO notes NOEDIT  && Display memo field again

WAIT WINDOW 'Overwrite Employee notes- press ESC' NOWAIT

APPEND MEMO notes FROM test.txt OVERWRITE  && Replace notes

MODIFY MEMO notes NOEDIT NOWAIT

DELETE FILE test.txt


See Also

COPY MEMO
GETCP( )


APPEND PROCEDURES Command

Syntax         Arguments         Remarks         Example         See Also

Appends stored procedures in a text file to the stored procedures in the current database.

Syntax

APPEND PROCEDURES FROM FileName
[AS nCodePage] [OVERWRITE]

Arguments

FileName   Specifies the name of a text file from which the stored procedures are appended.

AS nCodePage   Specifies the code page of the text file from which the stored procedures are appended. Visual FoxPro copies the contents of the text file and, as it does so, automatically converts the contents of the text file to the code page you specify.

If you specify a value for nCodePage that is not supported, Visual FoxPro generates an error message. You can use GETCP( ) for nCodePage to display the Code Page dialog box, allowing you to specify a code page for the text file from which the stored procedures are appended.

If you omit AS nCodePage, Visual FoxPro copies the contents of the text file from which the stored procedures are appended and, as it does so, automatically converts the contents of the text file to the current Visual FoxPro code page. The current Visual FoxPro code page can be determined with CPCURRENT( ).

If nCodePage is 0, Visual FoxPro assumes that the code page of the text file from which the stored procedures are appended is the same as the code page of the current database, and that no conversion to the current Visual FoxPro code page occurs.

OVERWRITE   Specifies that the current stored procedures in the database are overwritten by those in the text file. If you omit OVERWRITE, the current stored procedures in the database are not overwritten, and the stored procedures in the text file are appended to the current stored procedures.

Remarks

Use APPEND PROCEDURES to programatically modify stored procedures in a database. A database must be open and current when APPEND PROCEDURES is issued; otherwise Visual FoxPro generates an error message.


APPEND PROCEDURES Command Example

The following example opens the testdata database. A temporary table named mytable with a single memo field is created, and REPLACE is used to place a stored procedure named MyProcedure in the memo field. COPY MEMO is used to create a temporary text file named MYTEMP.TXT that contains the contents of the memo field.

APPEND PROCEDURES is used to append the stored procedure from the temporary text file to the database. DISPLAY PROCEDURES displays the stored procedures in the database and then the temporary table and text file are erased.

Note:   To view or edit stored procedures through the user interface, use the Database Designer.

CLOSE DATABASES

* Open the testdata database

OPEN DATABASE SYS(2004)+"\samples\data\testdata"

* Create a free, temporary table with one memo field called mProcedure

CREATE TABLE mytable FREE (mProcedure M)

APPEND BLANK                          && Add a blank record to mytable

* Add PROCEDURE command, name, and carriage return/linefeed to

* memo field

REPLACE mProcedure WITH "PROCEDURE MyProcedure" + CHR(13) + CHR(10)

* Copy contents of memo field to temporary file

COPY MEMO mProcedure TO mytemp.txt

USE                                   && Close the temporary table

APPEND PROCEDURES FROM mytemp.txt     && Copy procedure to the database

CLEAR

* Display the procedures associated with the current database

DISPLAY PROCEDURES

DELETE FILE mytable.dbf               && Erase temporary table

DELETE FILE mytable.fpt               && Erase temporary table memo file

DELETE FILE mytemp.txt                && Erase temporary text file


See Also

COPY PROCEDURES
CREATE TRIGGER
DISPLAY PROCEDURES
MODIFY PROCEDURE
OPEN DATABASE
PROCEDURE
SET DATABASE


Application Object

Syntax         Arguments         Remarks         Properties         Methods         Example          See Also

An object created for each instance of Visual FoxPro that exposes a set of Visual FoxPro properties and methods.

Syntax

Application.PropertyName[ = eValue]

– Or –

Application.Method

Arguments

PropertyName   Specifies a property for the application object.

eValue   Specifies a value for the property.

Method   Specifies a method to execute for the application object.

Remarks

Visual FoxPro version 4.0 is an automation server, allowing other applications such as Microsoft Excel or Visual Basic to remotely start and manipulate Visual FoxPro through properties and methods. The Application object is also available from within an instance of Visual FoxPro.

The syntax used by an application to create an instance of an automation server such as Visual FoxPro is typically unique to the application. Consult the application’s documentation for the proper syntax to create an instance of an automation server and then manipulate the instance through the properties and methods.


Properties

ActiveForm	Application	AutoYield
Caption	DefaultFilePath	FullName
Height Property	Left	Name
OLERequestPendingTimeout	OLEServerBusyRaiseError	OLEServerBusyTimeout
Parent	StartMode	StatusBar
Top	Version	Visible
Width


Methods

DataToClip	DoCmd	Eval	Help
Quit	RequestData


Application Object Example

You can start another instance of Visual FoxPro from within Visual FoxPro with the following command:

oNewInstance = CREATEOBJECT('VisualFoxPro.Application')

A new instance of Visual FoxPro is not visible when it is created; the following command makes the new instance visible:

oNewInstance.Visible = .T.


See Also

CREATEOBJECT( )


Application Property

Syntax         Settings         Remarks         Applies To          See Also

Provides a reference to the Application object containing an object. Not available at design time; read-only at run time.

Syntax

Object.Application.Property [ = Setting]

–or–

Object.Application.Method

Settings

Property   Specifies any property of the Application object or the _VFP system variable; for example, the Caption property.

Setting   The existing or new setting of the Property.

Method   Specifies any method of the Application object or the _VFP system variable; for example, the DoCmd method.

Remarks

Use the Application property to access an Application object’s properties and methods from an object contained by the application. The Application property can also be used with the _VFP system variable to access properties and methods for the current instance of Visual FoxPro.


Applies To

CheckBox, Column, ComboBox, CommandButton, CommandGroup, Container, Control, Custom, EditBox, Form, FormSet, Grid, Header, Image, Label, Line, ListBox, OLE Bound Control OLE Container Control OptionButton, OptionGroup, Page, PageFrame, Separator, Shape, Spinner, TextBox, Timer, ToolBar


See Also

CREATEOBJECT( )


APRINTERS( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Places the names of printers currently installed in the Windows Print Manager into a variable array.

 Syntax

APRINTERS(ArrayName)

 Returns

Numeric

 Arguments

ArrayName   Specifies the name of the array containing the names of the installed printers and their ports. If the array you include doesn’t exist, Visual FoxPro automatically creates the array. If the array exists and isn’t large enough to contain all the printer information, Visual FoxPro automatically increases the size of the array to accommodate the information. If the array is larger than necessary, Visual FoxPro truncates the array. If the array exists and APRINTERS( ) returns 0 because no printers are installed, the array remains unchanged. If the array doesn’t exist and APRINTERS( ) returns 0, the array isn’t created.

 Remarks

APRINTERS( ) creates a two-dimensional array. The first column of the array contains the names of the currently installed printers, and the second column contains the ports to which the printers are connected.

APRINTERS( ) returns the number of installed printers. If no printer is installed, it returns 0.

Visual FoxPro obtains the names of the installed printers and their ports from Windows. However, Visual FoxPro doesn’t check to see if the printers are actually connected to your machine.


 APRINTERS( ) Function Example

The following example uses APRINTERS( ) to create an array named gaPrinters that contains the names and ports of installed printers. The printers and their ports are then displayed. If no printer is installed, a message is displayed.

IF APRINTERS(gaPrinters) > 0  && If there are installed printer drivers

CLEAR  && Clear the main Visual FoxPro window

DISPLAY MEMORY LIKE gaPrinters && Display the printers and ports

ELSE  && Otherwise, no printer are installed

WAIT WINDOW 'No printers installed.'

ENDIF


 See Also

GETPRINTER( )
PRINTSTATUS( )
PRTINFO( )
SET PRINTER


ASC( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the ANSI value for the leftmost character in a character expression.

Syntax

ASC(cExpression)

Returns

Numeric

Arguments

cExpression   Specifies the character expression containing the character whose ANSI value ASC( ) returns. Any characters after the first character in cExpression are ignored by ASC( ).

Remarks

ASC( ) returns the position of the character in the character table of the current code page. Every character has a unique ANSI value in the range from 0 to 255.


ASC( ) Function Example

The following example displays the characters A through J and uses ASC( ) to display their corresponding ANSI values.

STORE 'ABCDEFGHIJ' TO gcANSI  && 10 characters

CLEAR

FOR nCOUNT = 1 TO 10

? SUBSTR(gcANSI, nCount,1)  && Display a character

?? ASC(SUBSTR(gcANSI, nCount)) && Display ANSI value

ENDFOR


See Also

CHR( )


ASCAN( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Searches an array for an element containing the same data and data type as an expression.

Syntax

ASCAN(ArrayName, eExpression [, nStartElement [, nElementsSearched]])

Returns

Numeric

Arguments

ArrayName   Specifies the name of the array to search.

eExpression   Specifies the general expression to search for.

nStartElement   Specifies the element number at which the search begins. The element number you specify is included in the search. If you omit nStartElement, the entire array is searched by default.

nElementsSearched   Specifies the number of elements that are searched. If you omit nStartElement and nElementsSearched, the search begins with the first array element and continues to the last array element.

Note   You can refer to an element in a two-dimensional variable array in one of two ways. The first method uses two subscripts to specify the row and column position of the element in the array; the other method uses an element number. This function and others that manipulate two-dimensional arrays require element numbers (nStartElement and nElementsSearched). Use AELEMENT( ) to return the element number from row and column subscripts in a two-dimensional array.

Remarks

If a match is found, ASCAN( ) returns the number of the element containing the expression. If a match cannot be found, ASCAN( ) returns 0.

The criteria for a successful match of character data are determined by the setting of SET EXACT. If SET EXACT is ON, an element must match the search expression character for character and have the same length. If SET EXACT is OFF, and an element and search expression match until the end of the expression is reached, the match is successful. For more information on match criteria for character strings, see the string comparison table in the SET EXACT topic.


ASCAN( ) Function Example

The following example creates and fills an array with company names, then uses ASCAN( ) to search for a particular company name. If the company name is found, it is removed from the array.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer	  && Open customer table

SELECT company FROM customer ;

WHERE country = 'UK' ;

INTO ARRAY gaCompanies

gnCount = _TALLY

gcName = 'Seven Seas Imports'

CLEAR

DISPLAY MEMORY LIKE gaCompanies*

gnPos = ASCAN(gaCompanies, gcName) && Search for company

IF gnPos != 0

*** Company found, remove it from the array ***

= ADEL(gaCompanies, gnPos)

gnCount = gnCount - 1

ENDIF

DISPLAY MEMORY LIKE gaCompanies


See Also

ACOPY( )
ADEL( )
ADIR( )
AELEMENT( )
AFIELDS( )
AINS( )
ASORT( )
ASUBSCRIPT( )
DIMENSION
SET EXACT


_ASCIICOLS System Variable

Syntax         Arguments         Remarks         See Also

Specifies the number of columns in a text file created with REPORT ... TO FILE ASCII.

Syntax

_ASCIICOLS = nExpression

Arguments

nExpression   Specifies the number of columns in the text file. The default value is 80.

Remarks

Include the TO FILE ASCII clause in REPORT to create a text file.


See Also

_ASCIIROWS
CREATE REPORT
MODIFY REPORT
REPORT


_ASCIIROWS System Variable

Syntax         Arguments         Remarks         See Also

Specifies the number of rows in a text file created with REPORT ... TO FILE ASCII.

Syntax

_ASCIIROWS = nExpression

Arguments

nExpression   Specifies the number of rows in the text file. The default value is 63.

Remarks

Include the TO FILE ASCII clause in REPORT to create a text file.


See Also

_ASCIICOLS
CREATE REPORT
MODIFY REPORT
REPORT


ASELOBJ( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Places object references to currently selected controls in the active Form Designer into a variable array.

Syntax

ASELOBJ(ArrayName, [1 | 2])

Returns

Numeric

Arguments

ArrayName   Specifies the name of the array containing the object references of the currently selected controls. If the array you specify doesn’t exist, Visual FoxPro automatically creates the array. If the array exists and isn’t large enough to contain all the control information, Visual FoxPro automatically increases the size of the array to accommodate the information. If the array is larger than necessary, Visual FoxPro truncates the array. If the array exists and ASELOBJ( ) returns 0 because no controls are currently selected, the array remains unchanged. If the array doesn’t exist and ASELOBJ( ) returns 0, the array isn’t created.

1   Creates a one-element array containing an object reference to the container for the currently selected control. For example, if the currently selected control is a spinner on a form, the array contains an element with the value “FORM.” Include 1 when issuing ASELOBJ( ) from within the Command window. Note that if a page frame is selected, ASELOBJ( ) returns the name of the current page.

2   Specifies that Visual FoxPro creates a one-element array containing an object reference to the DataEnvironment object for the form. The DataEnvironment object allows you to determine the data environment properties for the form.

Remarks

ASELOBJ( ) creates a one-dimensional array containing object references to the currently selected controls in the active Form Designer and returns the number of currently selected controls. If no controls are currently selected and the optional 1 argument is omitted, ASELOBJ( ) returns 0 and the array isn’t created. ASELOBJ( ) does not recognize the form as the selected control if there are no controls on the form. If no controls are currently selected and the optional 1 argument is included, ASELOBJ( ) returns 1.

You can use ASELOBJ( ) to create your own control builders.


ASELOBJ( ) Function Example

Before running the following example, open a new form in the Form Designer and add one or more controls with Caption properties, such as a Label or CommandButton, to the form. Select a number of these controls and then run the example. ASELOBJ( ) displays the names of  the selected controls, and then changes the captions of the selected controls.

gnobjects = ASELOBJ(gaSelected)	  && Create array of control names

IF gnobjects > 0  && 0 indicates no controls selected

CLEAR

DISPLAY MEMORY LIKE gaSelected	  && Displays selected controls

FOR nCnt = 1 TO gnobjects

? gaSelected(nCnt).Caption + ' => New Caption ' ;

+ LTRIM(STR(nCnt))  && Display old and new caption

gaSelected(nCnt).Caption = 'New Caption ' ;

+ ALLTRIM(STR(nCnt))  && Assign new caption

NEXT

ENDIF


See Also

CREATE FORM
DataEnvironment Object


ASIN( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns in radians the arc sine of a numeric expression.

Syntax

ASIN(nExpression)

Returns

Numeric

Arguments

nExpression   Specifies the numeric expression whose arc sine ASIN( ) returns. The value of nExpression can range from +1 through –1, and the value ASIN( ) returns can range from –pi/2 through +pi/2 ( –1.57079 to 1.57079). The number of decimal places in the display of the result can be specified with SET DECIMALS.

Remarks

Use RTOD( ) to convert radians to degrees.


ASIN( ) Function Example

CLEAR

? RTOD(ASIN(0))  && Returns 0.00

STORE 1 to gnArcAngle

? RTOD(ASIN(gnArcAngle))  && Returns 90.00

? RTOD(ASIN(SQRT(2)/2))  && Returns 45.00


See Also

RTOD( )
SET DECIMALS
SIN( )


ASORT( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Sorts elements in an array in ascending or descending order.

Syntax

ASORT(ArrayName [, nStartElement [, nNumberSorted [, nSortOrder]]])

Returns

Numeric

Arguments

ArrayName   Specifies the name of the array to sort.

nStartElement   Specifies the starting element of the sort. If you omit nStartElement, the array is sorted starting with the first array element by default. If the array is one-dimensional, the sort includes nStartElement. If the array is two-dimensional, the starting element nStartElement determines both the row where the sort begins and the column that determines the sort order of the rows.

Note   You can refer to an element in a two-dimensional array in one of two ways. The first method uses two subscripts to specify the row and column position of the element in the array; the other method uses an element number. This function and others that manipulate two-dimensional arrays require element numbers (in ASORT( ) the numeric expressions nStartElement and nNumberSorted). You can use AELEMENT( ) to return the element number from row and column subscripts in a two-dimensional array.

The following example illustrates that the starting element nStartElement determines how the rows in a two-dimensional array are sorted. A small array named gaArray is created and sorted twice. The first sort begins with the first element of gaArray; the rows are sorted based on the values contained in the first column of the array. The second sort begins with the fourth element of gaArray; the rows are sorted based on the values contained in the second column.

The first sort begins with the first row. The second sort begins with the second row. You can use DISPLAY MEMORY to display the contents of the array; in these examples tables are used to graphically display the results of the sorts.

These commands create the array named gaArray:

DIMENSION gaArray(3,2)

gaArray(1) = 'G'

gaArray(2) = 'A'

gaArray(3) = 'C'

gaArray(4) = 'Z'

gaArray(5) = 'B'

gaArray(6) = 'N'

gaArray looks like this:

	Column 1	Column 2
Row 1	G	A
Row 2	C	Z
Row 3	B	N
The array is then sorted by ASORT( ) starting with the first element (1,1) in the array. The elements in the first column are placed in ascending order by rearranging the rows of the array.

=ASORT(gaArray,1)

Note the new order of the rows:

	Column 1	Column 2
Row 1	B	N
Row 2	C	Z
Row 3	G	A
The array is then sorted starting with the fourth element (2,2) in the array. The elements in the second column are placed in order by rearranging the array rows.

=ASORT(gaArray,4)

Note the difference in the order of the rows:

	Column 1	Column 2
Row 1	B	N
Row 2	G	A
Row 3	C	Z
nNumberSorted   Specifies the number of elements that are sorted in a one-dimensional array, or the number of rows that are sorted in a two-dimensional array. For example, if the array is one-dimensional and nStartElement is 2, indicating that the sort starts with the second array element, and nNumberSorted is 3, indicating that the sort should include three elements, the second, third and fourth array elements are sorted. If nNumberSorted is –1 or is omitted, all array elements from the starting element nStartElement through the last element in the array are sorted.

If the array is two-dimensional, nNumberSorted designates the number of rows to sort, beginning with the row containing the starting element nStartElement. For example, if nStartElement is 2 and nNumberSorted is 3, the row containing the second array element and the following two rows are sorted. If nNumberSorted is –1 or is omitted, all array rows beginning with the row containing the starting element nStartElement through the last array row are sorted.

nSortOrder   Specifies the sort order (ascending or descending) for the elements in the array. By default, array elements are sorted in ascending order. If nSortOrder is 0 or is omitted, the array elements are sorted in ascending order. If nSortOrder is 1 or any nonzero value, the array elements are sorted in descending order.

Remarks

All elements included in the sort must be of the same data type. One-dimensional arrays are sorted by their elements; two-dimensional arrays are sorted by their rows. When a two-dimensional array is sorted, the order of the rows in the array is changed so that the elements in a column of the array are in ascending or descending order.

If the sort is successful, 1 is returned; otherwise –1 is returned.


ASORT( ) Function Example

The following example copies the contact field from the customer table to an array named gaContact. The first 20 contacts in the array are displayed, the array is sorted, and the contacts are displayed again in sorted order.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE Customer  && Open customer table

COUNT TO gnCount  && Number of contacts

DIMENSION gaContact(gnCount,1)  && Create a contact array

COPY TO ARRAY gaContact FIELD contact	  && Fill the array

CLEAR

? 'Contact names:'

?

FOR nCount = 1 TO 20

? gaContact(nCount)  && Display first 20 contacts

ENDFOR

= ASORT(gaContact)	  && Sort the array

?

? 'Sorted Contact names:'

?

FOR nCount = 1 TO 20

? gaContact(nCount)  && Display first 20 contacts, sorted

ENDFOR


See Also

ACOPY( )
ADEL( )
ADIR( )
AELEMENT( )
AFIELDS( )
AINS( )
ALEN( )
ASCAN( )


ASSERT Command

Syntax         Arguments         Remarks          See Also

Displays a message box when a logical expression evaluates to false (.F.).

Syntax

ASSERT lExpression [MESSAGE cMessageText]

Arguments

lExpression   Specifies the logical expression that is evaluated. If lExpression evaluates to a logical false (.F.), a debugging dialog box is displayed. If lExpression evaluates to a logical true (.T.), the dialog box is not displayed.

cMessageText   Specifies the text displayed in the debugging dialog box. If you omit cMessageText, the default text is displayed, indicating the line number on which the assertion failed and procedure containing the assertion.

Remarks

This command is ignored if the SET ASSERTS command is set to OFF.

The message box contains Cancel, Debug, Ignore and Ignore All buttons. The following table describes the action performed when each button is chosen.

Button	Action
Debug	Program execution is suspended and the Debugger window is displayed with the Trace window active.
Cancel	Program execution is ended.
Ignore	Program execution continues with the line following the ASSERT command.
Ignore All	Program execution continues with the line following the ASSERT command and ASSERTS is set to OFF. Subsequent ASSERT commands are ignored until ASSERTS is set to ON.


See Also

Debugger Window, SET ASSERTS


ASSIST Command

Included for backward compatibility. Use the DO Command command instead.


_ASSIST System Variable

Included for backward compatibility. Use the DO Command instead.


ASUBSCRIPT( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns the row or column subscript of an element from the element’s number.

Syntax

ASUBSCRIPT(ArrayName, nElementNumber, nSubscript)

Returns

Numeric

Arguments

ArrayName   Specifies the name of the array.

nElementNumber   Specifies the element number.

nSubscript   Determines if the row or column subscript is returned.

If the array is one-dimensional, include the element number in nElementNumber and 1 in nSubscript. ASUBSCRIPT( ) identically returns nElementNumber.

If the array is two-dimensional, include both the element number nElementNumber and a value of 1 or 2 in nSubscript. Specifying 1 in nSubscript returns the row subscript of the element, and specifying 2 returns the column subscript.

For more information on how to reference elements in an array, see DIMENSION.

Remarks

You can refer to elements in two-dimensional variable arrays in one of two ways. The first method uses two subscripts to specify the row and column position of the element in the array. The second method uses an element number. Use ASUBSCRIPT( ) to obtain an element’s row or column subscript from the element’s number.

In the following example, an array with two rows and three columns is created. DISPLAY MEMORY shows the contents of the elements of the array listed in element number order.

DIMENSION gaMyArray(2,3)

DISPLAY MEMORY LIKE gaMyArray

GAMYARRAY  Pub    A

  (   1,   1)     L  .F. (element number 1)

  (   1,   2)     L  .F. (element number 2)

  (   1,   3)     L  .F. (element number 3)

  (   2,   1)     L  .F. (element number 4)

  (   2,   2)     L  .F. (element number 5)

  (   2,   3)     L  .F. (element number 6)

Each of these commands store the character string INVOICE to the same array element:

STORE 'INVOICE' TO gaMyArray(2, 1)

STORE 'INVOICE' TO gaMyArray(4)

In one-dimensional arrays, an element’s number is identical to its single row subscript. It isn’t necessary to use ASUBSCRIPT( ) with one-dimensional arrays.


See Also

ADEL( )
ADIR( )
AELEMENT( )
AFIELDS( )
AINS( )
ALEN( )
ASCAN( )
ASORT( )
DIMENSION
DISPLAY MEMORY


AT( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the beginning numeric position of the first occurrence of a character expression or memo field within another character expression or memo field, counting from the leftmost character.

Syntax

AT(cSearchExpression, cExpressionSearched [, nOccurrence])

Returns

Numeric

Arguments

cSearchExpression   Specifies the character expression that AT( ) searches for in cExpressionSearched.

cExpressionSearched   Specifies the character expression cSearchExpression searches for.

Both cSearchExpression and cExpressionSearched can be memo fields of any size.

nOccurrence   Specifies which occurrence (first, second, third, and so on) of cSearchExpression is searched for in cExpressionSearched. By default, AT( ) searches for the first occurrence of cSearchExpression (nOccurrence = 1). Including nOccurrence lets you search for additional occurrences of cSearchExpression in cExpressionSearched. AT( ) returns 0 if nOccurrence is greater than the number of times cSearchExpression occurs in cExpressionSearched.

Remarks

AT( ) searches the second character expression for the first occurrence of the first character expression. It then returns an integer indicating the position of the first character in the character expression found. If the character expression isn’t found, AT( ) returns 0.

The search performed by AT( ) is case-sensitive. To perform a search that isn’t case-sensitive, use ATC( ).


AT( ) Function Example

STORE 'Now is the time for all good men' TO gcString

STORE 'is the' TO gcFindString

CLEAR

? AT(gcFindString,gcString)  && Displays 5

STORE 'IS' TO gcFindString

? AT(gcFindString,gcString)  && Displays 0, case-sensitive


See Also

AT_C( )
ATC( )
ATCLINE( )
ATLINE( )
LEFT( )
RAT( )
RATLINE( )
RIGHT( )
SUBSTR( )


AT_C( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns the beginning numeric position of the first occurrence of a character expression or memo field within another character expression or memo field, counting from the leftmost character.

Syntax

AT_C(cSearchExpression, cExpressionSearched [, nOccurrence])

Returns

Numeric

Arguments

cSearchExpression   Specifies the character expression that AT_C( ) searches for in cExpressionSearched.

cExpressionSearched   Specifies the character expression cSearchExpression searches for.

Both cSearchExpression and cExpressionSearched can be memo fields of any size.

nOccurrence   Specifies which occurrence (first, second, third, and so on) of cSearchExpression is searched for in cExpressionSearched. By default, AT_C( ) searches for the first occurrence of cSearchExpression (nOccurrence = 1). Including nOccurrence lets you search for additional occurrences of cSearchExpression in cExpressionSearched. AT_C( ) returns 0 if nOccurrence is greater than the number of times cSearchExpression occurs in cExpressionSearched.

Remarks

AT_C( ) searches the second character expression for the first occurrence of the first character expression. It then returns an integer indicating the position of the first character in the character expression found. If the character expression isn't found, AT_C( ) returns 0.

AT_C( ) is designed for expressions containing double-byte characters. If the expression contains only single-byte characters, AT_C( ) is equivalent to AT( ).

The search performed by AT_C( ) is case-sensitive. To perform a search that isn't case-sensitive, use ATCC( ).


See Also

ATCC( )
LEFTC( )
RATC( )
RIGHTC( )
SUBSTRC( )


ATAN( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns in radians the arc tangent of a numeric expression.

Syntax

ATAN(nExpression)

Returns

Numeric

Arguments

nExpression   Specifies a numeric expression whose arc tangent ATAN( ) returns. nExpression can be any value. The value returned by ATAN( ) can range from –pi/2 through +pi/2 (–1.57079 to 1.57079). The number of decimal places displayed in the value returned by ATAN( ) is determined by SET DECIMALS.

Remarks

Use RTOD( ) to convert radians to degrees.


ATAN( ) Function Example

CLEAR

? ATAN(0)  && Displays 0.00

STORE PI( )/2 to gnAngle

? ATAN(gnAngle)  && Displays 1.00

? ATAN(PI( )/2)  && Displays 1.00

? ATAN(DTOR(90))  && Displays 1.00


See Also

ATN2( )
RTOD( )
SET DECIMALS
TAN( )


ATC( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the beginning numeric position of the first occurrence of a character expression or memo field within another character expression or memo field, without regard for the case of these two expressions.

Syntax

ATC(cSearchExpression, cExpressionSearched [, nOccurrence])

Returns

Numeric

Arguments

cSearchExpression   Specifies the character expression that ATC( ) searches for in cExpressionSearched.

cExpressionSearched   Specifies the character expression cSearchExpression searches for.

Both cSearchExpression and cExpressionSearched can be memo fields of any size.

nOccurrence   Specifies which occurrence (first, second, third, and so on) of cSearchExpression is searched for in cExpressionSearched. By default, ATC( ) searches for the first occurrence of cSearchExpression (nOccurrence = 1). Including nOccurrence lets you search for additional occurrences of cSearchExpression in cExpressionSearched.

Remarks

ATC( ) searches the second character expression for the occurrence of the first character expression, without concern for the case (upper or lower) of the characters in either expression. Use AT( ) to perform a case-sensitive search.

ATC( ) returns an integer corresponding to the position where the first character of the character expression is found. If the character expression isn’t found, ATC( ) returns 0.


ATC( ) Function Example

STORE 'Now is the time for all good men ... ' TO gcString

STORE 'IS THE' TO gcFindString

CLEAR

? ATC(gcFindString, gcString)  && Displays 5

STORE 'is' TO gcFindString

? ATC(gcFindString, gcString)  && Displays 5

? ATC('now',gcString)  && Displays 1


See Also

AT( )
ATCC( )
ATCLINE( )
ATLINE( )
LEFT( )
RAT( )
RATLINE( )
RIGHT( )
SUBSTR( )


ATCC( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns the beginning numeric position of the first occurrence of a character expression or memo field within another character expression or memo field, without regard for the case of these two expressions.

Syntax

ATCC(cSearchExpression, cExpressionSearched [, nOccurrence])

Returns

Numeric

Arguments

cSearchExpression   Specifies the character expression that ATCC( ) searches for in cExpressionSearched.

cExpressionSearched   Specifies the character expression cSearchExpression searches for.

Both cSearchExpression and cExpressionSearched can be memo fields of any size.

nOccurrence   Specifies which occurrence (first, second, third, and so on) of cSearchExpression is searched for in cExpressionSearched. By default, ATCC( ) searches for the first occurrence of cSearchExpression (nOccurrence = 1). Including nOccurrence lets you search for additional occurrences of cSearchExpression in cExpressionSearched.

Remarks

ATCC( ) is designed for expressions containing double-byte characters. If the expression contains only single-byte characters, ATCC( ) is equivalent to ATC( ).

ATCC( ) searches the second character expression for the occurrence of the first character expression, without concern for the case (upper or lower) of the characters in either expression. Use AT_C( ) to perform a case-sensitive search.

ATCC( ) returns an integer corresponding to the position where the first character of the character expression is found. If the character expression isn't found, ATCC( ) returns 0.


See Also

AT_C( )
LEFTC( )
RATC( )
RIGHTC( )
SUBSTRC( )


ATCLINE( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the line number of the first occurrence of a character expression or memo field within another character expression or memo field, without regard for the case (upper or lower) of the characters in either expression.

Syntax

ATCLINE(cSearchExpression, cExpressionSearched)

Returns

Numeric

Arguments

cSearchExpression   Specifies the character expression that ATCLINE( ) searches for in cExpressionSearched.

cExpressionSearched   Specifies the character expression cSearchExpression searches for.

Both cSearchExpression and cExpressionSearched can be memo fields of any size. Use MLINE( ) to return the line containing the matching character expression.

Tip   ATCLINE( ) offers a convenient way to search memo fields.

Remarks

If the search is successful, ATCLINE( ) returns the number of the line containing the first character expression. If the search is unsuccessful, ATCLINE( ) returns 0.

The line number that ATCLINE( ) returns is determined by the value of SET MEMOWIDTH, even if cExpressionSearched isn’t a memo field. For more information, see SET MEMOWIDTH.

Use ATLINE( ) to perform a case-sensitive search.


ATCLINE( ) Function Examples

Example 1 locates the first time a character string occurs in a memo field, and displays the first and last names of the employee, and line of the memo containing the character string.

Example 2 demonstrates how the memo width affects ATCLINE( ).

* Example 1

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE employee  && Open employee table

CLEAR

STORE 'JAPANESE' TO gcFindString  && Case insensitive

LOCATE FOR ATCLINE(gcFindString, notes) != 0

? First_Name

?? Last_Name

? MLINE(notes, ATCLINE(gcFindString, notes))

* Example 2

STORE '1234567890ABCDEFGHIJ' TO gcString

SET MEMOWIDTH TO 20

? ATCLINE('AB', gcString)  && Displays 1

SET MEMOWIDTH TO 10

? ATCLINE('AB', gcString)  && Displays 2


See Also

AT( )
ATC( )
ATLINE( )
MLINE( )
RAT( )
RATLINE( )
SET MEMOWIDTH


ATLINE( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the line number of the first occurrence of a character expression or memo field within another character expression or memo field, counting from the first line.

Syntax

ATLINE(cSearchExpression, cExpressionSearched)

Returns

Numeric

Arguments

cSearchExpression   Specifies the character expression that Visual FoxPro looks for in cExpressionSearched.

cExpressionSearched   Specifies the character expression that cSearchExpression searches for.

Both cSearchExpression and cExpressionSearched can be memo fields of any size.

Use MLINE( ) to return the line containing the matching character expression as a character string.

Tip   ATLINE( ) offers a convenient way to search memo fields.

Remarks

ATLINE( ) searches the second character expression for the occurrence of the first character expression. ATLINE( ) searches without regard to the case (upper or lower) of the characters in either expression. Use ATCLINE( ) to perform a search that isn’t case sensitive.

If the search is successful, ATLINE( ) returns the number of the line where the match occurs. If the search is unsuccessful, ATLINE( ) returns 0.

The line number that ATLINE( ) returns is determined by the value of SET MEMOWIDTH, even if cExpressionSearched isn’t a memo field. For more information, see SET MEMOWIDTH.


ATLINE( ) Function Examples

Example 1 locates the first time a character string occurs in a memo field, and displays the first and last names of the employee, and line of the memo containing the character string.

Example 2 demonstrates how the memo width affects ATLINE( ).

* Example 1

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE employee  && Open employee table

CLEAR

STORE 'Japanese' TO gcFindString  && Case sensitive

LOCATE FOR ATLINE(gcFindString, notes) != 0

? First_Name

?? Last_Name

? MLINE(notes, ATLINE(gcFindString, notes))

* Example 2

STORE '1234567890ABCDEFGHIJ' TO gcString

SET MEMOWIDTH TO 20

? ATLINE('AB', gcString)  && Displays 1

SET MEMOWIDTH TO 10

? ATLINE('AB', gcString)  && Displays 2


See Also

AT( )
ATC( )
ATCLINE( )
MLINE( )
RAT( )
RATLINE( )
SET MEMOWIDTH


ATN2( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the arc tangent in all four quadrants from specified values.

Syntax

ATN2(nYCoordinate, nXCoordinate)

Returns

Numeric

Arguments

nYCoordinate   Specifies the y coordinate.

nXCoordinate   Specifies the x coordinate.

Remarks

ATN2( ) returns the angle (in radians) between the line y = 0 and the line connecting the specified coordinates and the origin (0, 0) of the coordinate system.

ATN2( ) returns a value between  – pi/2 and +pi/2.

You can convert the value returned by ATN2( ) to degrees with RTOD( ). You can specify the number of decimal places that are displayed in the result  with SET DECIMALS.


ATN2( ) Function Example

CLEAR

? PI( )  && Displays 3.14

? ATN2(0,-1)  && Displays 3.14

STORE COS(PI( )) TO gnXCoord

STORE SIN(PI( )) TO gnYCoord

? ATN2(gnYCoord,gnXCoord)  && Displays 3.14

? ATN2(gnYCoord,gnXCoord)/PI( )  && Displays 1.00


See Also

ATAN( )
DTOR( )
RTOD( )
SET DECIMALS
TAN( )


AUSED( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Places table aliases and work areas for a data session into a  variable array.

Syntax

AUSED(ArrayName [, nDataSessionNumber])

Returns

Numeric

Arguments

ArrayName   Specifies the name of the array containing the table aliases and work areas for a data session. If the array you specify doesn’t exist, Visual FoxPro automatically creates the array. If the array exists and isn’t large enough to contain all the table aliases and work areas, Visual FoxPro automatically increases the size of the array. If the array is larger than necessary, Visual FoxPro truncates the array. If the array exists and AUSED( ) returns 0 because no tables are open in the data session, the array remains unchanged. If the array doesn’t exist and AUSED( ) returns 0, the array isn’t created.

nDataSessionNumber   Specifies the data session number for which AUSED( ) returns the table aliases and work areas. If you omit nDataSessionNumber, AUSED( ) returns information about the current data session. Use SET DATASESSION to specify the current data session.

Remarks

AUSED( ) returns the number of rows in the array, which is identical to the number of tables open in the data session.

AUSED( ) creates a two-dimensional array and places the aliases of tables open for the data session in the first column of the array. The second column of the array contains the tables’ corresponding work area numbers.


AUSED( ) Function Example

The following example uses AUSED( ) to create an array named gaInuse that contains the table aliases and work areas for tables open in the current data session. The number of open tables for the current data session is displayed, and the table aliases and work areas are then displayed.

OPEN DATABASE (SYS(2004) + 'samples\data\testdata') EXCLUSIVE

USE Customer IN 0

CLEAR

? AUSED(gaInuse)

DISPLAY MEMORY LIKE gaInuse

CLOSE DATABASES


See Also

ALIAS( )
SET DATASESSION
USE


AutoActivate Property

Syntax         Settings         Remarks         Applies To         See Also

Determines how an OLE Container control can be activated. Available at design time and run time.

Syntax

Control.AutoActivate[ = nValue]

Settings

nValue   The settings for the AutoActivate property are:

Setting	Description
0	Manual. The control isn’t automatically activated. You can activate a control programmatically using the DoVerb method.
1	GotFocus. If the control contains an object, the application that provides the object is activated when the control receives the focus.
2	(Default) DoubleClick. If the control contains an object, the application that provides the object is activated when the user double-clicks the control or presses ENTER when the control has the focus.
3	Automatic. If the control contains an object, the application that provides the object is activated based on the object’s normal method of activation (when the control receives the focus or when the user double-clicks the control).
Remarks

If an embedded object supports in-place activation, you can set AutoActivate to 1 (GotFocus) to activate an object when the control receives the focus.

Note   When AutoActivate is set to 2 (Double-Click), the DblClick event does not occur.


Applies To

OLE Bound Control, OLE Container Control


See Also

DoVerb Method


AutoCenter Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether the form object is automatically centered in the main Visual FoxPro window or on the desktop the first time it is displayed. Available at design time and run time.

Syntax

Object.AutoCenter [ = lExpr]

Settings

lExpr   Specifies whether the Form object is centered or placed according to the settings of the Top and Left properties. The settings for the AutoCenter property are:

Setting	Description
True (.T.)	The Form object is centered and the values of the Top and Left properties are set to the new position.
False (.F.)	(Default) The Form object is not centered and is placed at the coordinates specified by the Top and Left properties.
Remarks

Forms are displayed in the main window, so setting AutoCenter to true (.T.) centers the form within the main window.

Note   Resetting AutoCenter to false (.F.) after it has been sett to true (.T.) will not return the form to the original Top and Left position.


Applies To

Form, _SCREEN


See Also

Desktop Property
Left Property
Top Property


AutoCloseTables Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether the tables or views specified by the data environment are closed when the form set, form, or report is released. Available at design time; read-only at run time.

Syntax

DataEnvironment.AutoCloseTables[ = lExpr]

Settings

lExpr   The settings for the AutoCloseTables property are:

Setting	Description
True (.T.)	(Default) Closes the tables and views when the form set, form, or report is released.
False (.F.)	Tables and views remain open when the form set, form, or report is released.
Remarks

If AutoCloseTables is set to false (.F.) and the form set, form, or report is not running in a private data session, the tables and views associated with Cursors in the data environment remain open after the form set, form, or report is released. In all other cases, the tables and views associated with Cursors in the data environment are closed.


Applies To

DataEnvironment


See Also

AutoOpenTables Property
DataSession Property
DataSessionID Property


AutoOpenTables Property

Syntax         Settings         Remarks         Applies To         See Also

Determines whether the tables or views associated with a form set, form, or report’s data environment are loaded automatically. Available at design time; read-only at run time.

Syntax

DataEnvironment.AutoOpenTables[ = lExpr]

Settings

lExpr   The settings for the AutoOpenTables property are:

Setting	Description
True (.T.)	(Default) The form set, form, or report’s tables and views are opened automatically.
False (.F.)	The tables and views are not opened automatically.
Remarks

If AutoOpenTables is set to false (.F.), you can call the data environment’s OpenTables method to programmatically load the data environment.


Applies To

DataEnvironment


See Also

BeforeOpenTables Event
OpenTables Method
OpenViews Property


AutoRelease Property

Syntax         Settings         Applies To         See Also

Determines whether a form set is released when the last form in the form set is released. Available at design time; read-write at run time.

Syntax

FormSet.AutoRelease[ = lExpr]

Settings

lExpr   The settings for the AutoRelease property are:

Setting	Description
True (.T.)	The default in the Form Designer. The form set is released when the last form in the form set is released.
False (.F.)	The default in program code. The form set is not released when the last form in the form set is released.


Applies To

FormSet


See Also

Release Method
ReleaseType Property


AutoSize Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether a control is automatically resized to fit its contents. Available at design time and run time.

Syntax

Control.AutoSize[ = lExpr]

Settings

lExpr   Specifies whether a control is resized to fit its contents. The settings for the AutoSize property are:

Setting	Description
True (.T.)	The control is automatically resized to fit its contents.
False (.F.)	(Default) The contents are clipped when they exceed the area of the control. The size of the control remains constant.
Remarks

For OLE Container controls, Autosize applies only to OLE objects that support in-place editing. The Sizable property must be set to true (.T.) to change the size of an OLE object during in-place editing.


Applies To

CheckBox, CommandButton, CommandGroup, Label, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup


See Also

Alignment Property
Height Property
Width Property


AutoVerbMenu Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether a shortcut menu containing an OLE object’s verbs is displayed when the OLE object is clicked with the right mouse button. Available at run time only.

Syntax

Control.AutoVerbMenu[ = lExpr]

 Settings

lExpr   One of the following:

Setting	Description
True (.T.)	(Default) The shortcut menu containing the OLE object’s verbs is displayed when the OLE object is right clicked.
False (.F.)	The shortcut menu containing the OLE object’s verbs is not displayed when the OLE object is right clicked.
 Remarks

At run time, if the AutoVerbMenu and Enabled properties are set to true (.T.), right-clicking the OLE object displays the shortcut menu containing the verbs supported by the OLE object. If the AutoVerbMenu and Enabled properties are set to false (.F.) or the OLE object does not support verbs, the shortcut menu isn’t displayed when you right click the OLE object.


 Applies To

Enabled Property, OLE Bound Control, OLE Container Control


 See Also

DoVerb Method


AutoYield Property

Syntax        Settings         Remarks         Applies To         See Also

Specifies whether an instance of Visual FoxPro processes pending Windows events between execution of each line of user program code.

 Syntax

ApplicationObject.AutoYield[ = lExpr]

 Settings

lExpr   Specifies whether an instance of Visual FoxPro processes Windows events between each line of user program code. lExpr can be one of the following logical values:

lExpr	Description
True (.T.)	(Default) The instance of Visual FoxPro processes pending Windows events between execution of each line of user program code. If lExpr to is set to true (.T.), the instance of Visual FoxPro processes pending Windows events in the same manner as earlier versions of Visual FoxPro.
False (.F.)	The instance of Visual FoxPro does not process pending Windows events between each line of user program code. All pending Windows events are placed in a queue, and the events in the queue are processed when DOEVENTS is issued or a wait state occurs. A wait state occurs when Visual FoxPro is waiting for input from the user. The WAIT command does not create a wait state.
 Remarks

The AutoYield property should be set to false (.F.) when a form contains an ActiveX control. Setting AutoYield to false (.F.) prevents events for an ActiveX control from executing between lines of user program code. For example, if AutoYield is set to true (.T.), clicking an ActiveX control while user program code is executing may cause an event for the ActiveX control to execute, ignoring the user program code for the event, producing undesirable or unpredictable results.

The following occurs when the AutoYield property is set to false (.F.):

•	ActiveX controls cannot process events until a wait state occurs, so clicking an ActiveX control has no effect while user program code is executing. This is the same behavior for Visual FoxPro controls such as the Grid.

•	ON KEY LABEL commands and mouse events are ignored while user program code is executing. The ON KEY LABEL commands and mouse events are placed in a queue and processed at the next wait state.

•	Pressing Esc does not interrupt program execution. This is identical to setting ESCAPE to OFF. In this case you cannot exit infinite loops without shutting down the instance of Visual FoxPro.

•	Queries cannot be interrupted.

•	Switching to other applications is supported, but you cannot switch back to Visual FoxPro while Visual FoxPro user program code is executing.


 Applies To

Application Object, _VFP System Variable


 See Also

DOEVENTS Command


AVERAGE Command

Syntax         Arguments         Remarks         Example         See Also

Computes the arithmetic mean of numeric expressions or fields.

Syntax

AVERAGE [ExpressionList]
[Scope] [FOR lExpression1] [WHILE lExpression2]
[TO VarList | TO ARRAY ArrayName]
[NOOPTIMIZE]

Arguments

ExpressionList   Specifies the expressions to average. ExpressionList can be a list of fields from the table separated by commas, or numeric expressions involving fields from the table.

Scope   Specifies the record or range of records to include in the average. Only the records that fall within the range of records specified by the scope are averaged. The scope clauses are: ALL, NEXT nRecords, RECORD nRecordNumber, and REST. The default scope for AVERAGE is ALL records.

 Commands that include Scope operate only on the table in the active work area.

FOR lExpression1   Specifies a condition whereby only the records that satisfy the logical condition lExpression are included. This argument allows you to filter out undesired records.

Rushmore optimizes an AVERAGE FOR query if lExpression is an optimizable expression. For best performance, use an optimizable expression in the FOR clause. For information on Rushmore optimizable expressions, see SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

WHILE lExpression2   Specifies that as long as the logical expression lExpression2 evaluates to true (.T.), records are included in the average.

TO VarList   Specifies the list of variables or array elements to which the results of the average are stored.

TO ARRAY ArrayName   Specifies the one-dimensional array to which the results of the average are stored. The one-dimensional array can be created before the execution of AVERAGE.

If the array you include in AVERAGE doesn’t exist, Visual FoxPro automatically creates it. If the array exists and isn’t large enough to contain all the results, Visual FoxPro increases the size of the array automatically to accommodate the information.

NOOPTIMIZE   Disables Rushmore optimization of AVERAGE. For more information, see SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

Remarks

All numeric fields in the selected table are averaged unless you include an optional expression list. The result is displayed on the screen if SET TALK is ON. If SET HEADINGS is ON, the field names or expression involving the field names are displayed above the results.


AVERAGE Command Example

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE orders  && Open order table

CLEAR

AVERAGE Order_Amt  && Calcuate averages of all orders

AVERAGE Order_Amt TO gnAvg  && Store average to memory variable

? 'Average order amount: '

?? gnAvg  && Display the average again


See Also

CALCULATE
DIMENSION
SET HEADINGS
SUM


BackColor, ForeColor Properties

Syntax         Settings         Remarks         Example         Applies To         See Also

Specifies the background or foreground color used to display text and graphics in an object. Available at design time and run time.

Syntax

Object.BackColor[ = nColor]

Object.ForeColor[ = nColor]

Settings

nColor   Specifies a single color value.

The following table lists typical color values.

Color	RGB Values	nColor  Value
White	255, 255, 255	16777215
Black	0, 0, 0	0
Gray	192, 192, 192	12632256
Dark gray	128, 128, 128	8421504
Red	255, 0, 0	255
Dark red	128, 0, 0	128
Yellow	255, 255, 0	65535
Dark yellow	128, 128, 0	32896
Green	0, 255, 0	65280
Dark green	0, 128, 0	32768
Cyan	0, 255, 255	16776960
Dark cyan	0, 128, 128	8421376
Blue	0, 0, 255	16711680
Dark blue	0, 0, 128	8388608
Magenta	255, 0 ,255	16711935
Dark magenta	128, 0, 128	8388736
Remarks

Visual FoxPro uses a red-green-blue (RGB) color scheme for colors. The red, green, and blue components are each represented by a number between 0 and 255. Use the RGB( ) function to convert the three component colors into one composite nColor.

The BackColor property is ignored if the BackStyle property is set to 0 (Transparent).


BackColor, ForeColor Properties Example

The following example demonstrates how the Shape control can be used to display a circle, ellipse, or square on a form, and how the BackColor property can be used to specify the color of each shape.

A form is created, and a set of option buttons and a command button are placed on the form. When you choose one of the option buttons, the corresponding shape is displayed on the form. The BackColor property is used to specify the color of each shape. The Height, Width, and Curvature properties of each shape determine the type of shape created.

frmMyForm = CREATEOBJECT('Form')  && Create a Form

frmMyForm.Closable = .F.  && Disable the Control menu box

frmMyForm.AddObject('cmdCommand1','cmdMyCmndBtn')  && Add Command button

frmMyForm.AddObject('opgOptionGroup1','opgMyOptGrp') && Add Option Group

frmMyForm.AddObject('shpCircle1','shpMyCircle')  && Add Circle Shape

frmMyForm.AddObject('shpEllipse1','shpMyEllipse')  && Add Ellipse Shape

frmMyForm.AddObject('shpSquare','shpMySquare')  && Add Box Shape

frmMyForm.cmdCommand1.Visible =.T.  && "Quit" Command button visible

frmMyForm.opgOptionGroup1.Buttons(1).Caption = "\<Circle"

frmMyForm.opgOptionGroup1.Buttons(2).Caption = "\<Ellipse"

frmMyForm.opgOptionGroup1.Buttons(3).Caption = "\<Square"

frmMyForm.opgOptionGroup1.SetAll("Width", 100) && Set Option group width

frmMyForm.opgOptionGroup1.Visible = .T.  && Option Group visible

frmMyForm.opgOptionGroup1.Click  && Show the circle

frmMyForm.SHOW  && Display the form

READ EVENTS  && Start event processing

DEFINE CLASS opgMyOptGrp AS OptionGroup  && Create an Option Group

ButtonCount = 3  && Three Option buttons

Top = 10

Left = 10

Height = 75

Width = 100

PROCEDURE Click

ThisForm.shpCircle1.Visible = .F.  && Hide the circle

ThisForm.shpEllipse1.Visible = .F.  && Hide the ellipse

ThisForm.shpSquare.Visible = .F.  && Hide the square

DO CASE

CASE ThisForm.opgOptionGroup1.Value = 1

ThisForm.shpCircle1.Visible = .T. && Show the circle

CASE ThisForm.opgOptionGroup1.Value = 2

ThisForm.shpEllipse1.Visible = .T.  && Show the ellipse

CASE ThisForm.opgOptionGroup1.Value = 3

ThisForm.shpSquare.Visible = .T.  && Show the square

ENDCASE

ENDDEFINE

DEFINE CLASS cmdMyCmndBtn AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 210  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close Form

ENDDEFINE

DEFINE CLASS shpMyCircle AS SHAPE  && Create a circle

Top = 10

Left = 200

Width = 100

Height = 100

Curvature = 99

BackColor = RGB(255,0,0)  && Red

ENDDEFINE

DEFINE CLASS shpMyEllipse AS SHAPE  && Create an ellipse

Top = 35

Left = 200

Width = 100

Height = 50

Curvature = 99

BackColor = RGB(0,128,0)  && Green

ENDDEFINE

DEFINE CLASS shpMySquare AS SHAPE  && Create a square

Top = 10

Left = 200

Width = 100

Height = 100

Curvature = 0

BackColor = RGB(0,0,255)  && Blue

ENDDEFINE


Applies To

CheckBox, Column, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, EditBox, Form, Grid, Header, Label, OptionButton, OptionGroup, Page, _SCREEN, Shape, Spinner, TextBox, ToolBar

Note   The BackColor property does not apply to the CommandButton control. The ForeColor property does not apply to the CommandGroup, OptionGroup, or Shape controls.


See Also

BackStyle Property
ColorScheme Property
Colors Overview
DisabledBackColor
DisabledForeColor Properies
FillColor Property
FillStyle Property
GETCOLOR( )
RGB( )


BackStyle Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether the background of an object is transparent or opaque. Available at design time and run time.

Syntax

Object.BackStyle[ = nStyle]

Settings

nStyle   The settings for the BackStyle property are:

Setting	Description
0	Transparent. Anything behind the object is visible. The BackColor property is ignored.
1	(Default) Opaque. The object’s BackColor fills the control and obscures any color or graphics behind it.
Remarks

You can use the BackStyle property to create transparent controls when you are using a background color on a Form object or when you want to place a control over a graphic. Use an opaque control when you want it to stand out on a busy background.

An object’s BackColor property is ignored if the BackStyle property is set to 0 (Transparent).

For a Page object, the BackStyle property is read-only when the Tabs property is set to true (.T.) for the PageFrame containing the Page.


Applies To

CheckBox, CommandGroup, Container Object, Control Object, EditBox, Image, Label, OptionButton, OptionGroup, Page, Shape, TextBox


See Also

BackColor
ForeColor Properties


BAR( ) Function

Syntax         Returns         Remarks         Example         See Also

Returns the number of the most recently chosen item from a menu defined with DEFINE POPUP or a menu item chosen from a Visual FoxPro menu.

Syntax

BAR( )

Returns

Numeric

Remarks

Each item on a menu is assigned a number with DEFINE BAR. When a menu item is chosen from the menu, BAR( ) returns the number assigned to that item. A program can branch to other routines based on the value that BAR( ) returns.

BAR( ) returns 0 if there is no active menu or if the user presses ESC to exit the menu.


BAR( ) Function Example

The following example uses BAR( ) to pass the number of a menu item to a procedure. The current system menu bar is saved to memory with SET SYSMENU SAVE, and then all system menu titles are removed with SET SYSMENU TO.

Two menu titles are created with DEFINE PAD; DEFINE POPUP is used to create a menu for each menu title. DEFINE BAR is used to create items on each menu. When you choose a menu title, ON PAD uses ACTIVATE POPUP to activate the corresponding menu.

When you choose an item from a menu, ON SELECTION POPUP uses BAR( ) and POPUP( ) to pass the item number and menu title to the choice procedure. The choice procedure displays the number of the chosen item and the name of the menu containing the item, and the original Visual FoxPro system menu is restored with SET SYSMENU TO DEFAULT.

*** Name this program BAR_EXAM.PRG ***

CLEAR

SET SYSMENU SAVE

SET SYSMENU TO

DEFINE PAD padConv OF _MSYSMENU ;

PROMPT '\<Conversions' COLOR SCHEME 3 ;

KEY ALT+C, ''

DEFINE PAD padCard OF _MSYSMENU ;

PROMPT 'Card \<Info' COLOR SCHEME 3 ;

KEY ALT+I, ''

ON PAD padConv OF _MSYSMENU ACTIVATE POPUP popConv

ON PAD padCard OF _MSYSMENU ACTIVATE POPUP popCard

DEFINE POPUP popConv MARGIN RELATIVE SHADOW COLOR SCHEME 4

DEFINE BAR 1 OF popConv PROMPT 'Ar\<ea' KEY CTRL+E, '^E'

DEFINE BAR 2 OF popConv PROMPT '\<Length' ;

KEY CTRL+L, '^L'

DEFINE BAR 3 OF popConv PROMPT 'Ma\<ss' ;

KEY CTRL+S, '^S'

DEFINE BAR 4 OF popConv PROMPT 'Spee\<d' ;

KEY CTRL+D, '^D'

DEFINE BAR 5 OF popConv PROMPT '\<Temperature' ;

KEY CTRL+T, '^T'

DEFINE BAR 6 OF popConv PROMPT 'T\<ime' ;

KEY CTRL+I, '^I'

DEFINE BAR 7 OF popConv PROMPT 'Volu\<me' ;

KEY CTRL+M, '^M'

*** Here is where the POPCONV menu uses the BAR( ) function

*** to pass a bar number to the procedure called choice below.

ON SELECTION POPUP popConv;

DO choice IN bar_exam WITH BAR( ), POPUP( )

DEFINE POPUP popCard MARGIN RELATIVE SHADOW COLOR SCHEME 4

DEFINE BAR 1 OF popCard PROMPT '\<View Charges' ;

KEY ALT+V, ''

DEFINE BAR 2 OF popCard PROMPT 'View \<Payments' ;

KEY ALT+P, ''

DEFINE BAR 3 OF popCard PROMPT 'Vie\<w Users' ;

KEY ALT+W, ''

DEFINE BAR 4 OF popCard PROMPT '\-'

DEFINE BAR 5 OF popCard PROMPT '\<Charges ';

KEY ALT+C

DEFINE BAR 6 OF popCard PROMPT '\-'

DEFINE BAR 7 OF popCard PROMPT 'E\<xit ';

KEY ALT+X

*** Here is where the POPCARD menu uses the BAR( ) function

*** to pass a bar number to the procedure called choice below.

ON SELECTION POPUP popCard;

DO choice IN bar_exam WITH BAR( ), POPUP( )

*** The procedure choice uses the gnBar parameter

*** to contain the value passed by the BAR( ) function.

PROCEDURE choice

PARAMETERS gnBar, gcPopup

WAIT WINDOW 'You chose bar #' + LTRIM(STR(gnBar)) + ;

' from popup ' + gcPopup NOWAIT

SET SYSMENU TO DEFAULT


See Also

ACTIVATE POPUP
CNTBAR( )
DEFINE BAR
DEFINE POPUP
GETBAR( )
MRKBAR( )
ON BAR
ON SELECTION BAR
PRMBAR( )


BARCOUNT( ) Function

Included for compatibility with dBASE.


BARPROMPT( ) Function

Included for compatibility with dBASE.


BaseClass Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the name of the Visual FoxPro base class on which the referenced object is based. Read-only at design time and run time.

Syntax

Object.BaseClass[ = cBaseClass]

Settings

cBaseClass   Specifies the Visual FoxPro base class on which the object is based.

Remarks

For a list of Visual FoxPro base classes, see Controls and Objects.


Applies To

CheckBox, Column, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, Custom, EditBox, Form, FormSet, Grid, Header, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, Page, PageFrame, _SCREEN, Shape, Spinner, TextBox, Timer, ToolBar


See Also

Class Property


_BEAUTIFY System Variable

Included for backward compatibility. Use the Documenting Wizard instead.


BeforeDock Event

Syntax         Parameters         Remarks         Applies To         See Also

Occurs before the ToolBar object is docked.

Syntax

PROCEDURE ToolBar.BeforeDock
LPARAMETERS [nIndex] , nLocation

Parameters

nIndex   Uniquely identifies a control if it is in a control array.

nLocation   Specifies where the ToolBar will be docked.

 The values for nLocation are:

Value	FOXPRO.H Constant	Description
– 1	TOOL_NOTDOCKED	ToolBar will be undocked.
0	TOOL_TOP	ToolBar will be docked at the top of the main Visual FoxPro window.
1	TOOL_LEFT	ToolBar will be docked at the left side of the main Visual FoxPro window.
2	TOOL_RIGHT	ToolBar will be docked at the right side of the main Visual FoxPro window.
3	TOOL_BOTTOM	ToolBar will be docked at the bottom of the main Visual FoxPro window.
Remarks

The BeforeDock event occurs when the ToolBar is dragged to a docking region or when the Dock method is invoked.

BeforeDock is triggered before the ToolBar is redrawn, so you can change the appearance of the toolbar. This is useful if the ToolBar has a control, such as a ComboBox, that you want to replace with a control of different proportions, such as a CommandButton, when the ToolBar is docked.


Applies To

ToolBar


See Also

AfterDock Event
Dock Method
Undock Event


BeforeOpenTables Event

Syntax         Remarks         Applies To         See Also

Occurs just before the tables and views associated with the data environment for a form set, form, or report are opened.

Syntax

PROCEDURE DataEnvironment.BeforeOpenTables

Remarks

For a form set or form, the BeforeOpenTables event occurs before the form set’s or form’s Load event.


Applies To

DataEnvironment


See Also

AfterCloseTables Event
CloseTables Method
Load Event
OpenTables Method
Unload Event


BeforeRowColChange Event

Syntax         Parameters         Remarks         Applies To         See Also

Occurs when the user changes the active row or column, before the new cell gets the focus. It also occurs before the Valid event of the current object in the grid column and any rules in the database. Use NODEFAULT to prevent the active row and column in the grid from changing.

Syntax

PROCEDURE Grid.BeforeRowColChange
LPARAMETERS nColIndex

Parameters

nColIndex   Returns the index of the newly active row or column.

Remarks

BeforeRowColChange is triggered interactively using the mouse or keyboard or programmatically, such as calling the ActivateCell method.


Applies To

Grid


See Also

ActivateCell Method
AfterRowColChange Event
DEFINE CLASS [NODEFAULT]
Valid Event


BEGIN TRANSACTION Command

Syntax         Remarks         Example         See Also

Begins a transaction. Transactions are supported only for tables in a database. See CREATE DATABASE and ADD TABLE for information on how to create and add tables to a database.

Syntax

BEGIN TRANSACTION

Remarks

To save any modifications you made and end the transaction, issue END TRANSACTION. If the transaction fails (the server fails, the workstation fails, or you exit Visual FoxPro without committing the transaction) or if you issue ROLLBACK, the file or files in the transaction are restored to their original state.

Transactions can be nested five levels deep. An error is generated if you attempt a sixth level of nesting.

When you modify records in a database that is part of a transaction, other users on the network do not have access (read or write) to the records until you end the transaction.

When other users on the network try to access records you have modified, they must wait until you end your transaction. They receive the message “Record not available ... please wait” until the records become available. Because of this, it is important to keep the length of the transaction to a minimum or conduct the transaction during times when others do not need access.

The following commands and functions are not supported during a transaction:

Commands and Functions
APPEND PROCEDURES	CREATE SQL VIEW
CLEAR ALL	DELETE CONNECTION
CLOSE ALL1	DELETE DATABASE
CLOSE DATABASES1	DELETE TRIGGER
COPY INDEXES	DELETE VIEW
COPY PROCEDURES	MODIFY CONNECTION
CREATE CONNECTION	MODIFY DATABASE
CREATE DATABASE	MODIFY PROCEDURE
CREATE TRIGGER	MODIFY VIEW
CREATE VIEW	REQUERY( )
1 If CLOSE ALL is issued while a transaction is in progress, all tables in all open databases are closed. However, the databases remain open. Issuing CLOSE DATABASES within a transaction closes all tables in the current database, but the database remains open.
Also, the following commands and functions cannot be issued for a specific table participating in a transaction:

Commands and Functions
ALTER TABLE	MODIFY STRUCTURE
CREATE TABLE	PACK
CURSORSETPROP( )	REINDEX
DELETE TAG	TABLEREVERT( )
INDEX	ZAP
INSERT


BEGIN TRANSACTION Command Example

In the following example, the customer table in the testdata database is opened. BEGIN TRANSACTION is issued to start a transaction. The contents of the cust_id and company fields are displayed, and then the contents of the company field are replaced. The new contents are displayed, and ROLLBACK is issued to restore the original contents of the company field. The cust_id and company fields are displayed again with the company field containing its original values.

CLOSE DATABASES

OPEN DATABASE SYS(2004)+"samples\data\testdata"

BEGIN TRANSACTION

USE customer  && Transactions only supported within a DBC

CLEAR

LIST FIELDS cust_id, company NEXT 20

WAIT WINDOW "Press a key to change the company field"

REPLACE ALL company WITH "***"  && Change field contents

CLEAR

GO TOP

LIST FIELDS cust_id, company NEXT 20

WAIT WINDOW "Press a key to restore the company field"

ROLLBACK  && Restore original field contents

CLEAR

GO TOP

LIST FIELDS cust_id, company NEXT 20

WAIT WINDOW "Press a key to exit"

CLOSE ALL

CLEAR


See Also

END TRANSACTION
ROLLBACK
TXNLEVEL( )


BETWEEN( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Determines whether the value of an expression lies between the values of two other expressions of the same data type.

Syntax

BETWEEN(eTestValue, eLowValue, eHighValue)

Returns

Logical or null value

Arguments

eTestValue   Specifies the expression whose value BETWEEN( ) tests. If the value of eTestValue is greater than or equal to the value of eLowerValue and less than or equal to the value of eHighValue, BETWEEN( ) returns true (.T.). Otherwise, BETWEEN( ) returns false (.F.). BETWEEN( ) returns the null value if either eLowValue or eHighValue are the null value.

eLowValue   Specifies the lower value in the range BETWEEN( ) evaluates.

eHighValue   Specifies the upper value in the range BETWEEN( ) evaluates.

Remarks

BETWEEN( ) returns a value of true (.T.) if the value of a character, date, datetime, numeric, float, integer, double, or currency expression lies between the values of two other expressions of the same data type. If the value of the expression doesn’t lie between the values of two other expressions, BETWEEN( ) returns false (.F.). BETWEEN( ) returns the null value if either eLowValue or eHighValue is the null value.


BETWEEN( ) Function Example

The following example scans the orders table for all records in the order_amt field with values between 950 and 1000 inclusive and displays the cust_id field and the order_amt field.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE orders  && Open order table

CLEAR

SCAN FOR BETWEEN(order_amt,950,1000)

? cust_id, order_amt

ENDSCAN


See Also

MAX( )
MIN( )


BINTOC( ) Function

Syntax         Returns         Arguments         Remarks          See Also

Converts an integer value to a binary character representation.

Syntax

BINTOC(nExpression [, nSize])

Returns

Character

Arguments

nExpression   Specifies the integer value to convert.

nSize   Specifies the length in characters of the returned character string.

nSize also determines the value you can specify for nExpression. The following table lists the permissible values for nSize and the corresponding range of values for nExpression:

nSize	nExpression Range
1	-128 to 127
2	-32,768 to 32,767
4 (default)	-2,147,483,648 to 2,147,483,647
If nSize is omitted, BINTOC( ) returns a character string composed of four characters.

Remarks

BINTOC( ) can be used to reduce the size of indexes for numeric fields containing integer data. For example, a numeric field named iPartCode might contain an integer value from 1 to 127 which corresponds to a parts classification code. BINTOC( ) lets you convert the value in the numeric field to a single character representation. For example, the following command creates an index with a one-character index key:

INDEX ON BINTOC(nPartCode,1) TAG PartCode


See Also

CTOBIN( ) Function


BITAND( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the result of a bitwise AND operation performed on two numeric values.

Syntax

BITAND(nExpression1, nExpression2)

Returns

Numeric

Arguments

nExpression1, nExpression2   Specifies the numeric values on which the bitwise AND operation is performed. If nExpression1 and nExpression2 are not integers, they are converted to integers before the bitwise AND operation is peformed.

Remarks

BITAND( ) compares each bit in nExpression1 to the corresponding bit in nExpression2. If the bits in nExpression1 and nExpression2 are both 1, the corresponding result bit is set to 1; otherwise, the corresponding result bit is set to 0.

The following table shows the result of a bitwise AND operation on corresponding nExpression1 and nExpression2 bits:

nExpression1 bit	nExpression2 bit	Resulting bit
0	0	0
0	1	0
1	1	1
1	0	0


BITAND( ) Function Example

x = 3  && 0011 binary

y = 6  && 0110 binary

? BITAND(x,y) && Returns 2, 0010 binary


See Also

BITCLEAR( )
BITLSHIFT( )
BITNOT( )
BITOR( )
BITRSHIFT( )
BITSET( )
BITTEST( )
BITXOR( )


BITCLEAR( ) Function

Syntax         Returns         Arguments         Example         See Also

Clears a specified bit (sets it to 0) in a numeric value and returns the resulting value.

Syntax

BITCLEAR(nExpression1, nExpression2)

Returns

Numeric

Arguments

nExpression1   Specifies the numeric value in which a bit is cleared. If nExpression1 is not an integer, it is converted to an integer before its bit is set.

nExpression2   Specifies the bit position in nExpression1 that is cleared. nExpression2 can range from 0 to 31; 0 is the rightmost bit.


BITCLEAR( ) Function Example

x = 7  && 0111 binary

y = 1  && 2nd bit position (0 = 1st bit position)

? BITCLEAR(x,y) && Returns 5, 0101 binary


See Also

BITAND( )
BITLSHIFT( )
BITNOT( )
BITOR( )
BITRSHIFT( )
BITSET( )
BITTEST( )
BITXOR( )


BITLSHIFT( ) Function

Syntax         Returns         Arguments         Example         See Also

Returns the result of shifting the bits of a numeric value to the left a specified number of positions.

Syntax

BITLSHIFT(nExpression1, nExpression2)

Returns

Numeric

Arguments

nExpression1   Specifies the numeric value whose bits are shifted to the left. If nExpression1 is not an integer, it is converted to an integer before its bits are shifted.

nExpression2   Specifies the number of bit positions to shift. If nExpression2 is not an integer, it is converted to an integer.


BITLSHIFT( ) Function Example

x = 5  && 0101 binary

y = 1  && Shift bits 1 position left

? BITLSHIFT(x,y) && Returns 10, 1010 binary


See Also

BITAND( )
BITCLEAR( )
BITNOT( )
BITOR( )
BITRSHIFT( )
BITSET( )
BITTEST( )
BITXOR( )


BITNOT( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the result of a bitwise NOT operation performed on a numeric value.

Syntax

BITNOT(nExpression)

Returns

Numeric

Arguments

nExpression   Specifies the numeric value on which the bitwise NOT operation is performed. If nExpression is not an integer, it is converted to an integer before its bits are shifted.

Remarks

BITNOT( ) returns the bitwise complement of nExpression. The numeric value returned by BITNOT( ) represents nExpression with each bit of value 0 switched to 1 and each bit of value 1 switched to 0.

The following table shows the result of a bitwise NOT operation on nExpression:

nExpression bit	Resulting bit
0	1
1	0


BITNOT( ) Function Example

x = 5  && 0101 binary

? BITNOT(x) && Returns -6


See Also

BITAND( )
BITCLEAR( )
BITLSHIFT( )
BITOR( )
BITRSHIFT( )
BITSET( )
BITTEST( )
BITXOR( )


BITOR( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the result of a bitwise inclusive OR operation performed on two numeric values.

Syntax

BITOR(nExpression1, nExpression2)

Returns

Numeric

Arguments

nExpression1, nExpression2   Specifies the numeric values on which the bitwise inclusive OR operation is performed. If nExpression1 and nExpression2 are not integers, they are converted to integers before the bitwise inclusive OR operation is peformed.

Remarks

BITOR( ) compares each bit in nExpression1 to the corresponding bit in nExpression2. If either bit in nExpression1 or nExpression2 is 1, the corresponding result bit is set to 1; otherwise, the corresponding result bit is set to 0.

The following table shows the result of an inclusive OR operation on corresponding nExpression1 and nExpression2 bits:

nExpression1 bit	nExpression2 bit	Resulting bit
0	0	0
0	1	1
1	0	1
1	1	1


BITOR( ) Function Example

x = 5  && 0101 binary

y = 6  && 0110 binary

? BITOR(x,y) && Returns 7, 0111 binary


See Also

BITAND( )
BITCLEAR( )
BITLSHIFT( )
BITNOT( )
BITRSHIFT( )
BITSET( )
BITTEST( )
BITXOR( )


BITRSHIFT( ) Function

Syntax         Returns         Arguments         Example         See Also

Returns the result of shifting the bits of a numeric value to the right a specified number of positions.

Syntax

BITRSHIFT(nExpression1, nExpression2)

Returns

Numeric

Arguments

nExpression1   Specifies the numeric value whose bits are shifted to the right. If nExpression1 is not an integer, it is converted to an integer before its bits are shifted.

nExpression2   Specifies the number of bit positions to shift. If nExpression2 is not an integer, it is converted to an integer.


BITRSHIFT( ) Function Example

x = 5  && 0101 binary

y = 1  && Shift bits 1 position right

? BITRSHIFT(x,y) && Returns 2, 0010 binary


See Also

BITAND( )
BITCLEAR( )
BITLSHIFT( )
BITNOT( )
BITOR( )
BITSET( )
BITTEST( )
BITXOR( )


BITSET( ) Function

Syntax         Returns         Arguments         Example         See Also

Sets the bit to 1 in a numeric value and returns the resulting value.

Syntax

BITSET(nExpression1, nExpression2)

Returns

Numeric

Arguments

nExpression1   Specifies the numeric value in which a bit is set. If nExpression1 is not an integer, it is converted to an integer before its bit is set.

nExpression2   Specifies the bit position in nExpression1 that is set to 1. nExpression2 can range from 0 to 31; 0 is the rightmost bit.


BITSET( ) Function Example

x = 5  && 0101 binary

y = 1  && 2nd bit position (0 = 1st bit position)

? BITSET(x,y) && Returns 7, 0111 binary


See Also

BITAND( ), BITCLEAR( ), BITLSHIFT( ), BITNOT( ), BITOR( ), BITRSHIFT( ), BITTEST( ), BITXOR( )


BITTEST( ) Function

Syntax         Returns         Arguments         Example         See Also

Returns true (.T.) if a specified bit in a numeric value is set to 1; otherwise returns false (.F.).

Syntax

BITTEST(nExpression1, nExpression2)

Returns

Logical

Arguments

nExpression1   Specifies the numeric value in which a bit is checked. If nExpression1 is not an integer, it is converted to an integer before its bit is checked.

nExpression2   Specifies the bit position in nExpression1 that is checked. nExpression2 can range from 0 to 31; 0 is the rightmost bit.


BITTEST( ) Function Example

The following example uses BITTEST( ) to determine whether a series of integers are even. If an integer is even, the function IsEven returns true (.T.); otherwise it returns false (.F.).

CLEAR

? '2 even? '

?? IsEven(2)  && Even, .T. returned

? '3 even? '

?? IsEven(3)  && Not even, .F. returned

? '0 even? '

?? IsEven(0)  && Even, .T. returned

? '-13 even? '

?? IsEven(-13)  && Not even, .F. returned

Function IsEven

PARAMETER nInteger

RETURN NOT BITTEST(nInteger, 0)


See Also

BITAND( )
BITCLEAR( )
BITLSHIFT( )
BITNOT( )
BITOR( )
BITRSHIFT( )
BITSET( )
BITXOR( )


BITXOR( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the result of a bitwise exclusive OR operation performed on two numeric values.

Syntax

BITXOR(nExpression1, nExpression2)

Returns

Numeric

Arguments

nExpression1, nExpression2   Specifies the numeric values on which the bitwise exclusive OR operation is performed. If nExpression1 and nExpression2 are not integers, they are converted to integers before the bitwise exclusive OR operation is peformed.

Remarks

BITXOR( ) compares each bit in nExpression1 to the corresponding bit in nExpression2. If one bit is 0 and the other bit is 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is set to 0.

The following table shows the result of an exclusive OR operation on corresponding nExpression1 and nExpression2 bits:

nExpression1 bit	nExpression2 bit	Result bit
0	0	0
0	1	1
1	0	1
1	1	0


BITXOR( ) Function Example

x = 5  && 0101 binary

y = 6  && 0110 binary

? BITXOR(x,y) && Returns 3, 0011 binary


See Also

BITAND( )
BITCLEAR( )
BITLSHIFT( )
BITNOT( )
BITOR( )
BITRSHIFT( )
BITSET( )
BITTEST( )


BLANK Command

Syntax         Arguments         Remarks         Example         See Also

Clears data from all fields in the current record when issued without additional arguments.

Syntax

BLANK
[FIELDS FieldList]
[Scope]
[FOR lExpression1]
[WHILE lExpression2]
[NOOPTIMIZE]

Arguments

FIELDS FieldList   Clears only the fields you specify with FieldList. If you omit the FIELDS clause, all fields in a record are cleared by default. Any field you specify in an unselected work area must be prefaced with the alias of the work area.

Important   BLANK does not clear field data of a record in another related work area if the record pointer is at the end of the file in the current work area. The record pointer must be on a record in the current work area in order for BLANK to act on the fields in the related record.

Scope   Specifies a range of records to clear. Only the records that fall within the range are cleared. The scope clauses are: ALL, NEXT nRecords, RECORD nRecordNumber, and REST.

For more information on scope clauses, see Scope Clauses. Commands which include Scope operate only on the table in the active work area.

The default scope for BLANK is the current record (NEXT 1).

FOR lExpression1   Clears field data in records for which lExpression1 evaluates to true (.T.). Rushmore optimizes BLANK FOR if lExpression1 is an optimizable expression. A discussion of Rushmore optimization appears in “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

WHILE lExpression2   Specifies a condition whereby field data in records is cleared as long as the logical expression lExpression2 evaluates to true (.T.).

NOOPTIMIZE   Prevents Rushmore optimization of BLANK. For more information see SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

Remarks

Use APPEND BLANK to add a new blank record to the end of a table. Use ISBLANK( ) to determine if a field in a record is blank.


BLANK Command Example

The following example opens the customer table in the testdata database. The contents of the first record are displayed. SCATTER is used to save the contents of the record to an array. The record is cleared with BLANK, and the contents of the record are displayed again. GATHER is used to restore the original record contents, and the restored record contents are displayed again.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Open customer table

CLEAR

DISPLAY  && Displays the current record

SCATTER TO gaCustomer  && Create array with record contents

BLANK  && Clear the record

DISPLAY  && Displays the blank record

GATHER FROM gaCustomer  && Restore original record contents

DISPLAY  && Display the restored record


See Also

APPEND
EMPTY( )
ISBLANK( )
REPLACE
SET OPTIMIZE


BOF( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Determines whether the record pointer is positioned at the beginning of a table.

Syntax

BOF([nWorkArea | cTableAlias])

Returns

Logical

Arguments

nWorkArea   Specifies the work area number for a table open in another work area.

cTableAlias   Specifies the table alias for a table open in another work area.

If the table you want to test for a beginning-of-file condition is open in a work area other than the currently selected work area, use these optional arguments to specify the work area number or table alias for the table. If a table isn’t open in the work area you specify, BOF( ) returns false (.F.).

Remarks

Use BOF( ) to test for a beginning-of-file condition for a table. BOF( ) returns true (.T.) if you have tried to move the record pointer to a position before the first record in the table.


BOF( ) Function Example

The following example opens the customer table and lists the company name one page at a time starting with the last record in the table. The listing continues until the beginning of the file is reached or until you choose Cancel.

CLOSE DATABASES

CLEAR

OPEN DATABASE (HOME() + "samples\data\testdata")

USE customer

GO BOTTOM

local recCtr, btnValue

recCtr = 0

btnValue = 1

DO WHILE btnValue = 1 AND NOT BOF()

   ? "Company : " + company

   recCtr = recCtr + 1

   if (recCtr % 20) = 0 then

      btnValue =MESSAGEBOX ("Click OK to continue, Cancel to quit.",33)

      clear

   endif

   Skip -1          && Move up one record

ENDDO

=MESSAGEBOX("Listing complete.",48)


See Also

EOF( )


BorderColor Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the border color of an object. Available at design time and run time.

Syntax

Object.BorderColor[ = nColor]

Settings

nColor   Specifies the border color value.

The following table lists typical color values:

Color	RGB values	nColor  value
White	255, 255, 255	16777215
Black	0, 0, 0	0
Gray	192, 192, 192	12632256
Dark gray	128, 128, 128	8421504
Red	255, 0, 0	255
Dark red	128, 0, 0	128
Yellow	255, 255, 0	65535
Dark yellow	128, 128, 0	32896
Green	0, 255, 0	65280
Dark green	0, 128, 0	32768
Cyan	0, 255, 255	16776960
Dark cyan	0, 128, 128	8421376
Blue	0, 0, 255	16711680
Dark blue	0, 0, 128	8388608
Magenta	255, 0 ,255	16711935
Dark magenta	128, 0, 128	8388736
Remarks

BorderColor applies only to a text box or edit box when the SpecialEffect property is set to 1 - Plain.

Use the RGB( ) function to convert the three component colors into one composite nColor.


Applies To

ComboBox, CommandGroup, Container Object, Control Object, EditBox, Image, Line, ListBox, OptionGroup, PageFrame, Shape, TextBox


See Also

BackColor Property
Colors Overview
GetColor( )
RGB( )
SpecialEffect Property


BorderStyle Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the border style of an object. Available at design time and run time.

Syntax

Object.BorderStyle[ = nStyle]

Settings

nStyle   For a CommandGroup, EditBox, Image, Label, OptionGroup, or TextBox control, the settings for the BorderStyle property are:

Setting	Description
0	None. Default for Image and Label controls.
1	Fixed Single. Default for CommandGroup, EditBox, OptionGroup, and TextBox controls.
For a line or shape, the settings for the BorderStyle property are:

Setting	Description
0	Transparent
1	(Default) Solid. The outer edge of the border is the outer edge of the Shape control.
2	Dash
3	Dot
4	Dash-Dot
5	Dash-Dot-Dot
For a Form object, the settings for the BorderStyle property are:

Setting	Description
0	No border
1	Fixed Single
2	Fixed Dialog
3	(Default) Sizable
Remarks

If the BorderWidth property setting is greater than 1, regardless of the BorderStyle setting, a solid border is drawn. If BorderWidth is set to 1, BorderStyle produces the effects described in the tables above.


Applies To

ComboBox, CommandGroup, EditBox, Form, Image, Label, Line, OptionGroup, _SCREEN, Shape, TextBox, Spinner


See Also

BorderColor Property
BorderWidth Property
DrawStyle Property
DrawWidth Property


BorderWidth Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the width of a control’s border. Available at design time and run time.

Syntax

Control.BorderWidth[ = nWidth]

Settings

nWidth   Specifies the width, which can range from 0 to 8192.

Note   If the BorderWidth setting is greater than 1, the BorderStyle property setting is ignored.

Remarks

When BorderWidth is set to 0, the control appears to have no border. You cannot change the BorderWidth setting for the PageFrame control.


Applies To

Container Object, Control Object, Line, PageFrame, Shape


See Also

BorderStyle Property


Bound Property

Syntax         Settings         Remarks         Applies To         See Also

Determines whether a control in a Column object is bound to the control source for the Column. Available at design time and run time.

Syntax

Column.Bound[ = lExpr]

Settings

lExpr   The settings for the Bound property are:

Setting	Description
True (.T.)	(Default) The control is bound to the column’s control source.
False (.F.)	The control is not bound to the column’s control source.
Remarks

If a column’s Bound property is set to true (.T.), the column’s ControlSource property setting applies to the column and any controls contained in it. If you attempt to set the contained control’s ControlSource property, an error occurs. If a column’s Bound property is set to false (.F.), you can set the ControlSource property of a contained control directly. If you subsequently set the ControlSource setting of the column, it overrides the ControlSource setting of the contained control.

Typically, the following controls are bound to the corresponding data types:

Column control base class	Typical Column data types
CheckBox	Logical, Numeric
ComboBox	Character, Numeric
CommandButton	Character, Numeric
EditBox	Character
ListBox	Character, Numeric
OptionButton	Character, Numeric
Spinner	Currency, Numeric
TextBox	Any data type except General or Memo
Note   You cannot bind a control to a column whose data type is General or Memo.


Applies To

Column


See Also

AddObject Method
ControlSource Property
CurrentControl Property
Sparse Property


BoundColumn Property

Syntax         Settings         Remarks         Applies To         See Also

Determines which column of a multicolumn list box or combo box is bound to the Value property of the control. Available at design time and run time.

Syntax

Control.BoundColumn[ = nCol]

Settings

nCol   Specifies the number of the column that is bound to the Value property. The default for nCol is 1.

Remarks

Use BoundColumn when the list box or combo box has multiple columns and when you want the data in a column other than the first column to be stored in the control’s Value property.


Applies To

ComboBox, ListBox


See Also

Value Property


BoundTo Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether the Value property of a combo box or list box is determined by the List or the ListIndex properties. Available at design time and run time.

Syntax

[Form.]Control.BoundTo[ = lExpression]

Settings

lExpression   The settings for the BoundTo property are:

Setting	Description
.T.	The Value property is determined by the List property.
.F.	(Default) The Value property is determined by data type of the variable or field specified in the ControlSource property. If the variable or field specified in the ControlSource property setting is of character type, the Value property is determined by the List property. If the variable or field specified in the ControlSource property setting is of numeric type, the Value property uses the index number from the ListIndex property. This setting provides compatibility with Visual FoxPro 3.0 and 2.x versions of FoxPro.
Remarks

In Visual FoxPro 3.0, if the ControlSource property for a combo box or list box is numeric, the ListIndex property value of the selected item is stored in the variable or field to which the control is bound. Set the BoundTo property to true (.T.) to store the value of the List property in the variable or field to which the control is bound.


Applies To

ComboBox, ListBox


See Also

ControlSource Property
ListIndex Property
Value Property


Box Method

Syntax         Arguments         Remarks         Applies To         See Also

Draws a rectangle on a Form object.

Syntax

Object.Box(nXCoord1, nYCoord1, nXCoord2, nYCoord2)
 – Or –

Object.Box(nXCoord2, nYCoord2)

Arguments

nXCoord1, nYCoord1   Specifies the coordinates of the starting point for the rectangle. The ScaleMode method of the form determines the unit of measurement used. If you omit these arguments, the value of CurrentX and CurrentY are used.

nXCoord2, nYCoord2   Specifies the endpoint of the rectangle.

Remarks

The width of the lines drawn depends on the DrawWidth property setting. How a rectangle is drawn on the background depends on the settings of the DrawMode and DrawStyle properties. When the Box method is called, the CurrentX and CurrentY properties are set to the endpoint specified by the last two arguments.


Applies To

Form, _SCREEN


See Also

CurrentX
CurrentY Properties
DrawMode Property
DrawStyle Property
DrawWidth Property
ScaleMode Property


_BOX System Variable

Included for backward compatibility. Use the Report Designer instead.


BROWSE Command

Syntax         Arguments         Remarks         See Also

Opens the Browse window and displays records from the current or selected table.

Syntax

BROWSE
[FIELDS FieldList]
[FONT cFontName [, nFontSize]]
[STYLE cFontStyle]
[FOR lExpression1 [REST]]
[FORMAT]
[FREEZE FieldName]
[KEY eExpression1 [, eExpression2]]
[LAST | NOINIT]
[LOCK nNumberOfFields]
[LPARTITION]
[NAME ObjectName]
[NOAPPEND]
[NODELETE]
[NOEDIT | NOMODIFY]
[NOLGRID] [NORGRID]
[NOLINK]
[NOMENU]
[NOOPTIMIZE]
[NOREFRESH]
[NORMAL]
[NOWAIT]
[PARTITION nColumnNumber [LEDIT] [REDIT]]
[PREFERENCE PreferenceName]
[SAVE]
[TIMEOUT nSeconds]
[TITLE cTitleText]
[VALID [:F] lExpression2 [ERROR cMessageText]]
[WHEN lExpression3]
[WIDTH nFieldWidth]
[WINDOW WindowName1]
[IN [WINDOW] WindowName2 | IN SCREEN]
[COLOR SCHEME nSchemeNumber]

Arguments

FIELDS FieldList   Specifies the fields that appear in the Browse window. The fields are displayed in the order specified in FieldList. You can include fields from other related tables in the field list. When you include a field from a related table, preface the field name with its table alias and a period.

If you omit FIELDS, all the fields in the table are displayed in the order they appear in the table structure.

FONT cFontName [, nFontSize]   Specifies the Browse window’s font and font size. The character expression cFontName specifies the name of the font, and the numeric expression nFontSize specifies the font size. For example, the following clause specifies 16-point Courier font for the fields displayed in a Browse window:

FONT 'Courier',16

If you include the FONT clause but omit the font size nFontSize, a 10-point font is used in the Browse window. If you omit the FONT clause, 8-point MS Sans Serif is used.

If the font you specify is not available, a font with similar font characteristics is substituted.

STYLE cFontStyle   Specifies the Browse window’s font style. If you omit the STYLE clause, the Normal font style is used

If the font style you specify is not available, a font style with similar characteristics is substituted or the Normal font style is used.

Character	Font style
B	Bold
I	Italic
N	Normal
O	Outline
Q	Opaque
S	Shadow
-	Strikeout
T	Transparent
U	Underline
You can include more than one character to specify a combination of font styles. The following example opens a Browse window and uses an underlined font:

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Open customer table

IF _WINDOWS

BROWSE FIELDS contact FONT 'System', 15  STYLE 'NU'

ENDIF

IF _MAC

BROWSE FIELDS contact FONT 'Geneva', 14  STYLE 'NU'

ENDIF

FOR lExpression1   Specifies a condition whereby only records for which lExpression1 is true are displayed in the Browse window.

Rushmore optimizes a query specified with a BROWSE FOR if lExpression1 is an optimizable expression. For best performance, use an optimizable expression in the FOR clause. For information on Rushmore optimizable expressions, see SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

Include FOR to move the record pointer to the first record meeting the condition. Include REST to keep the record pointer at its current position.

REST   Prevents the record pointer from being moved from its current position to the top of the table when a Browse window is opened with the FOR clause. Otherwise, BROWSE positions the record pointer at the top of the table by default.

FORMAT   Specifies the use of a format file to control the display and data-entry format in a Browse window. The format file must first be opened with SET FORMAT. The following information is extracted from the format file and applied to the Browse window:

•	The list of fields to browse

•	All VALID clauses

•	All WHEN clauses

•	All RANGE clauses

•	Field sizes (as specified in PICTURE clauses)

•	All SAY expressions (included as calculated BROWSE fields)

The following example uses a format file to validate data entered into a Browse window. Positions specified with @ ... GET are ignored.

The first line creates a BROWSE field (cust_id) that is 5 characters wide and allows the entry of letters and digits only. The second line creates a BROWSE field (company) that cannot contain a blank value and can contain a maximum of 20 alphabetic characters.

The third line creates a BROWSE field (contact) into which you enter data only when the field is blank.

Here are the contents of the CUSTENTR.FMT format file, which is used to validate data entered into the customer table:

@ 3,0 GET cust_id PICTURE 'NNNNN'

@ 3,0 GET company VALID company != SPACE(40) ;

PICTURE 'AAAAAAAAAAAAAAAAAAAA'

@ 3,0 GET contact WHEN contact = SPACE(40)

* This is the program that uses the format file

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Open customer table

SET FORMAT TO custentr.fmt

BROWSE FORMAT

FREEZE FieldName   Permits changes to be made to only one field in the Browse window. You specify this field with FieldName. The remaining fields are displayed but cannot be edited.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Open customer table

BROWSE FIELDS phone :H = 'Phone Number:' , ;

company :H = 'Company:' ;

FREEZE phone

KEY eExpression1 [, eExpression2]   Limits the scope of records that are displayed in the Browse window. With KEY you can specify an index key value (eExpression1) or a range of key values (eExpression1, eExpression2) for the records that are displayed in the Browse window. The table you browse must be indexed, and the index key value or values included in the KEY clause must be the same data type as the index expression of the master index file or tag.

For example, the customer table includes a character field containing postal codes. If the table is indexed on the postal code field, you can specify a range of postal codes in the KEY clause.

In the following example, only records with postal codes falling within the range of 10,000 to 30,000 are displayed in the Browse window:

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Open customer table

SET ORDER TO postalcode

BROWSE KEY '10000', '30000'

LAST | NOINIT   Saves any configuration changes made to the appearance of a Browse window. The changes are saved in the FOXUSER file and can include changes to the field list, the size of each field, and the location and size of the Browse window.

If you issue BROWSE with the LAST or NOINIT clause, the Browse window opens in the same configuration that was last saved in the FOXUSER file if SET RESOURCE is ON. This restores the Browse window configuration created with the last BROWSE command. If the last BROWSE issued in the Command window included a long list of clauses, issue BROWSE with the LAST or NOINIT option to avoid having to retype the command. For more information on the FOXUSER file, see SET RESOURCE.

If the last Browse window was opened with a BROWSE that included a PREFERENCE clause, BROWSE LAST won’t restore the preference.

Any Browse window configuration changes you make in the current session aren’t saved if you exit BROWSE by pressing  CTRL+Q.

The LAST and NOINIT clauses are identical; NOINIT provides dBASEcompatibility.

LOCK nNumberOfFields   Specifies the number of fields you can see in the left partition of the Browse window without tabbing or scrolling. The left partition sizes automatically to be able to display the number of fields you specify with nNumberOfFields.

LPARTITION   Specifies that the cursor is placed in the first field in the left Browse window partition. By default, the cursor is placed in the first field in the right partition when the Browse window is opened.

NAME ObjectName   Creates an object reference for the Browse window, allowing you to manipulate the Browse window with object-oriented properties available for the Grid control. For additional information about object-oriented programming in Visual FoxPro, see Chapter 3, “Object-Oriented Programming,” in the Developer’s Guide. For additional information about the Grid control properties that you can specify for a Browse window created with the NAME clause, see the Grid Control topic.

NOAPPEND   Prevents the user from adding records to the table by pressing CTRL+Y or by choosing Append Record from the Table menu.

Important   Including NOAPPEND doesn’t prevent you from appending a record from within a routine (created with VALID, WHEN, or ON KEY LABEL) while in the Browse window.

NODELETE   Prevents records from being marked for deletion from within a Browse window. By default, a record can be marked for deletion by pressing CTRL+T, choosing Toggle Delete from the Table menu or by clicking in the leftmost column of the record to be deleted.

Important   Including NODELETE doesn’t prevent you from marking a record for deletion from within a routine (created with VALID, WHEN, or ON KEY LABEL) while in the Browse window.

NOEDIT | NOMODIFY   Prevents a user from modifying the table. NOEDIT and NOMODIFY are identical. If you include either clause, you can browse or search the table, but you cannot edit it. However, you can append and delete records.

NOLGRID   Removes the field gridlines in the left partition of the Browse window.

NORGRID   Removes the field gridlines in the right partition of the Browse window.

NOLINK   Unlinks the partitions in a Browse window. By default, the left and right partitions of the Browse window are linked together so that when you scroll through one partition, the other partition scrolls.

NOMENU   Removes the Table menu title from the system menu bar, preventing access to the Browse menu.

NOOPTIMIZE   Disables Rushmore optimization of BROWSE. For more information, see SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Appllications” in the Developer’s Guide.

NOREFRESH   Prevents the Browse window from being refreshed. Browse windows are refreshed at the rate determined by SET REFRESH. NOREFRESH is useful with read-only files and improves performance.

NORMAL   Opens the Browse window with its normal default settings, such as its colors, size, position, title, and control options (GROW, FLOAT, ZOOM, and so on). If you omit NORMAL and the current output window is a user-defined window with its own settings, the Browse window assumes those user-defined settings also.

NOWAIT   Continues program execution immediately after the Browse window is opened. The program doesn’t wait for the Browse window to be closed but continues executing on the program line immediately following the program line containing BROWSE NOWAIT. If you omit NOWAIT when BROWSE is issued from within a program, a Browse window is opened and program execution pauses until the Browse window is closed.

NOWAIT is available only from within a program. Including NOWAIT when issuing BROWSE from the Command window has no effect.

PARTITION nColumnNumber   Splits a Browse window into left and right partitions with nColumnNumber specifying the column number of the split bar. For example, if nColumnNumber is 20, the split bar is placed in column 20 of the Browse window.

LEDIT   Specifies that the left partition of the Browse window appears in Edit mode.

REDIT   Specifies that the right partition of the Browse window appears in Edit mode. This example opens a Browse window with the split bar placed in column 20 and the right partition open in Edit mode.

Include both keywords to open both partitions in Edit mode.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Open customer table

BROWSE PARTITION 20 REDIT

PREFERENCE PreferenceName   Saves a Browse window’s attributes and options for later use. Unlike LAST, which restores the Browse window as it appeared in the previous session, PREFERENCE saves a Browse window’s attributes indefinitely in the FOXUSER resource file. Preferences can be retrieved at any time.

Issuing BROWSE with the specified preference name for the first time creates an entry in the FOXUSER file that saves the Browse window configuration. Issuing BROWSE later with the same preference name restores the Browse window to that preference state. When the Browse window is closed, the preference is updated.

Preference names can be up to 10 characters long, must begin with a letter or an underscore, and can contain any combination of letters, numbers and underscores.

Once you have a preference the way you like it, you can prevent it from being changed. Close the Browse window, issue SET RESOURCE OFF, open the FOXUSER file as a table, and change the record containing the preference to read-only by changing the value of the logical field READONLY to true (.T.).

For more information about the FOXUSER resource file, see SET RESOURCE.

If you exit a Browse window by pressing CTRL+Q, no Browse window changes are saved to the resource file.

SAVE   Keeps the Browse window and any of its memo field text-editing windows active and visible (open). You can then return to the Browse window after cycling through other open windows with the keyboard or the mouse.

SAVE is available only from within a program. SAVE has no effect when included with BROWSE in the Command window because BROWSE SAVE is always the default in the interactive mode.

TIMEOUT nSeconds   Specifies how long a Browse window waits for input. The numeric expression nSeconds specifies how many seconds can elapse without any input before the Browse window automatically closes.

TIMEOUT is available only from within a program; it has no effect when you issue BROWSE from the Command window. In the following example, the Browse window is closed if no input occurs in 10 seconds.

DEFINE WINDOW wBrowse FROM 1,1 TO 24,40 ;

CLOSE ;

GROW ;

COLOR SCHEME 10

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Open customer table

BROWSE WINDOW wBrowse ;

FIELDS phone :H = 'Phone Number:' , ;

company :H = 'Company:' ;

TIMEOUT 10

RELEASE WINDOW wBrowse

TITLE cTitleText   Overrides the default table name or alias that appears in the Browse window title bar with the title you specify with cTitleText. Otherwise, the name or alias of the table being browsed appears in the title bar.

If you issue BROWSE WINDOW to place the Browse window in a user-defined window, the Browse window’s title replaces the user-defined window’s title.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Open customer table

BROWSE;

TITLE 'My Browse Window' ;

FIELDS phone :H = 'Phone Number' , ;

company :H = 'Company:'

VALID lExpression2   Performs record-level validation in a Browse window. The VALID clause is executed only if a change is made to the record and you attempt to move the cursor to another record. The VALID clause is not executed if the only change is to a memo field.

If VALID returns a value that is true (.T.), the user can move the cursor to another record. If VALID returns a false value (.F.), the cursor remains in the current field and Visual FoxPro generates an error message. If VALID returns 0, the cursor remains in the current field, and an error message isn’t displayed.

The VALID clause shouldn’t be confused with the verify option (:V), which enables field-level validation.

:F   Forces the VALID clause to execute before the user moves the cursor to the next record. In this case, VALID is executed even if the record isn’t changed.

ERROR cMessageText   Specifies an error message that overrides the system default error message. Visual FoxPro displays cMessageText when VALID returns false (.F.).

WHEN lExpression3   Evaluates a condition when the user moves the cursor to another record. If lExpression3 evaluates to true (.T.) the user can modify the record moved to. If lExpression3 evaluates to false (.F.) or 0, the record the user moves to becomes read-only and cannot be modified.

The WHEN clause isn’t executed when another window is activated.

WIDTH nFieldWidth   Limits the number of characters displayed for all fields in a Browse window to nFieldWidth. The contents of a field can be scrolled horizontally using the Left and Right Arrow keys or the horizontal scroll bar. Including the WIDTH clause doesn’t change the size of fields in the table; it alters only the way the fields are displayed in the Browse window. If a width has been specified for an individual field with the FIELDS clause, it overrides the width specified with the WIDTH clause for that field.

WINDOW WindowName1   Specifies a user-defined window whose characteristics the Browse window assumes. For example, if the user-defined window is created with the FLOAT clause, the Browse window can be moved. The specified window doesn’t have to be active or visible, but it must be defined.

IN [WINDOW] WindowName2   Specifies the parent window within which the Browse window is opened. The Browse window doesn’t assume the characteristics of the parent window. A Browse window activated inside a parent window cannot be moved outside the parent window. If the parent window is moved, the Browse window moves with it.

To access the Browse window, the parent window must first be defined with DEFINE WINDOW and must be active and visible.

IN SCREEN   Explicitly places a Browse window on the main Visual FoxPro window when a user-defined window is active.

COLOR SCHEME nSchemeNumber   Specifies the number of a color scheme used for the Browse window’s colors.

The Browse window assumes the color scheme established using the Windows Color Control Panel.

Remarks

A Browse window allows you to view records in a table, edit those records, and append additional records. Visual FoxPro allows you to have several Browse windows open at the same time.

If you press ESC to exit a Browse window, changes made to the last field you modified are discarded. However, if you move to another record after modifying a field, your changes to the field are saved.

For information on navigating in the Browse window, see Chapter 2, “Creating Tables and Indexes,” in the User’s Guide.

The field list can specify any combination of fields or calculated fields.

The syntax of the field list is:

FieldName1

[:R]

[:nColumnWidth]

[:V = lExpression1 [:F] [:E = cMessageText]]

[:P = cFormatCodes]

[:B = eLowerBound, eUpperBound [:F]]

[:H = cHeadingText]

[:W = lExpression2]

[, FieldName2 [:R]...]

Calculated Fields… The field list can contain statements for creating calculated fields. A calculated field contains read-only data created with an expression. The expression can take any form, but it must be a valid Visual FoxPro expression.

The format of the statement you use to create a calculated field is:

CalculatedFieldName = eExpression

This example creates a calculated field called location:

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Open customer table

BROWSE FIELDS location = ALLTRIM(city) + ', ' + country

city and country are the names of fields from the currently selected table.

The FIELDS clause field list includes options that enable special handling of fields displayed in a Browse window:

:R   Specifies that the field is read-only. The data it contains can be viewed but not edited.

In the following example, a Browse window is opened with the cust_id and company fields. The cust_id field is read-only and cannot be changed.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Open customer table

BROWSE FIELDS cust_id:R, company

:nColumnWidth   Specifies the display size for a field in columns. The value of :nColumnWidth doesn’t affect the size of the field in the table; it only alters the way the field appears in the Browse window.

:V = lExpression1 [:F] [:E = cMessageText]   Lets you perform field-level data validation within the Browse window. If lExpression1 evaluates to true (.T.) when you move the cursor from a field, the data input into the field is considered correct and the cursor moves to the next field.

If lExpression1 evaluates to false (.F.), the data input is considered incorrect, the cursor remains in the field and a message appears. If lExpression1 evaluates to 0, the data input is considered incorrect and the cursor remains in the field but no error message appears.

The verify option is not executed for memo fields.

By default, lExpression1 is evaluated only when the field is modified. To force verification, include the :F option.

You can display your own error message by including the :E option described below.

:F   Determines whether the expression in the verify option is evaluated when you move the cursor out of a field or another window is activated. If :F is not included, lExpression1 is evaluated only if changes are made to the field. If :F is included, lExpression1 is evaluated even if the field isn’t modified.

:E = cMessageText   If the validation expression :V = lExpression1 evaluates to true (.T), the cursor leaves the field normally. If the expression evaluates to false (.F.), the cursor remains in the field, and Visual FoxPro generates an error message.

If the error option (:E) is included, cMessageText appears instead of the system error message. cMessageText appears only if SET NOTIFY is ON. The bell is sounded if SET BELL is ON.

If :V = lExpression1 evaluates to 0, no message appears and the cursor remains in the field being validated. This option lets you display your own error messages in validation routines.

The following example opens the products table and displays the product_id and prod_name fields. The product_id field is a numeric field that will accept up to five numbers. For purposes of this example, we consider a product_id greater than 100 to be invalid.

:V specifies the validation criteria. :F forces the validation check to be performed whether the data is changed or not. :E replaces the Visual FoxPro system error message with a user-defined error message. In Visual FoxPro, the error message appears in the status bar at the bottom of the main Visual FoxPro window.

Press ESC to close the Browse window.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE products  && Open products table

IF _WINDOWS OR _MAC

SET STATUS BAR ON

ENDIF

USE products

BROWSE FIELDS in_stock :V = in_stock < 100 ;

:F ;

:E = 'The stock amount must be less than 100'

:P = cFormatCodes   If you include a FIELDS clause, you can also specify a picture option (:P) for each field in the list. The picture option lets you create a list of codes that controls the display and input of data for each field in a Browse window. cFormatCodes is the list of codes.

The following example uses the picture option to allow only numeric data in a specific format to be entered in the unit_price field:

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE products  && Open products table

BROWSE FIELDS unit_price :P = '99,999.99'

See the Format and InputMask properties for more information about picture option codes.

:B = eLowerBound, eUpperBound [:F]   Specifies a set of boundaries between which data in a field must fall. The boundary expressions eLowerBound and eUpperBound must match the data type of the field. They cannot be user-defined functions. If the data entered doesn’t fall between eLowerBound and eUpperBound, a system error message appears indicating the range within which the data must fall.

By default, the data you enter is checked against the boundary values only if you make a change to the contents of the field. To force checking against the boundary values, include the forced validation option (:F).

The following example ensures that the value in the in_stock field falls between 1 and 100. Press ESC to close the Browse window.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE products  && Open products table

BROWSE FIELDS in_stock :B = 1, 100 	:F

:H = cHeadingText   Replaces the default field names with your own headings, which you specify with cHeadingText. By default, field names are used as the column headings in the Browse window.

The following example provides user-defined headings for the displayed fields.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE products  && Open products table

BROWSE FIELDS prod_name :H = 'Product Name:', ;

unit_price :H = 'Price per Unit:'

:W = lExpression2   Determines whether the cursor can be moved to a field. If lExpression2 evaluates to false (.F.), moving the cursor to the field is prohibited. If lExpression2 evaluates to true (.T.), the cursor can be moved to the field. User-defined functions are supported in lExpression2.

If moving the cursor to all fields is prohibited, the current record is marked read-only. This occurs only when every field contains a WHEN clause that evaluates to false.

SET SKIP Support… SET SKIP lets you establish a one-to-many relationship between two tables. For each record in the parent table, there can be multiple related records in the child table. If you create a one-to-many relationship, you may use BROWSE to view records from both the parent and child tables.

The parent record appears once, along with the first matching record from the child table. Any subsequent matching records are displayed in the rows following the parent record and first matching child record. The fill character for repeated parent information depends on the current Browse window font.

If the record pointer is positioned on a parent record, you can move the pointer through the parent records in the Browse window by pressing CTRL+DOWN ARROW to move to the next parent record or CTRL+UP ARROW to move to the previous parent record. For more information on creating one-to-many relationships, see SET SKIP.

The following example uses SET SKIP to create a one-to-many relationship between two tables. There is a single record in the parent table (customer). The child table (orders) contains multiple records for each record in the parent table. After the relationship is created, a Browse window displaying records from both the parent and child tables is opened.

The FIELDS clause field list contains records from both the parent and child tables. The names of fields are prefaced with their table alias (orders or customer) and a period.

CLEAR

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer ORDER cust_id IN 0	&& Parent table

USE orders ORDER cust_id IN 0  && Child table

SELECT customer	  && Back to parent work area

SET RELATION TO cust_id INTO orders  	&& Establish relationship

SET SKIP TO orders  && One-to-many relationship

WAIT WINDOW 'Scroll to see shipping dates for each customer' NOWAIT

BROWSE FIELDS customer.cust_id :H='Customer Number', ;

customer.city :H='Customer City', orders.shipped_on

Useful Functions… Several Visual FoxPro functions return useful information about a Browse window.

Function	Description
VARREAD( )	Returns the name of the field the cursor is in for the active Browse window.
RECNO( )	Returns the record number of the selected record in the active Browse window.


See Also

CHANGE
EDIT
Grid Control
SET SKIP
WTITLE( )


_BROWSER System Variable

Syntax         Arguments         Remarks         See Also

Contains the name of the class browser application.

Syntax

_BROWSER = cProgramName

Arguments

cProgramName   Specifies a class browser application. _BROWSER contains BROWSER.APP if you have installed the class browser application.

If the class browser is in a directory other than the current default, include a path with the class browser application name.

If the class browser is in a  folder other than the current default, include a path with the class browser application name.

IYou can also specify a class browser application in your Visual FoxPro configuration file by including a line using this syntax:

_BROWSER = cProgramName

A different class browser application can be specified by storing the new application name in _BROWSER from within the Command window or a program.

Remarks

BROWSER.APP displays the relationships between classes in a visual class library (.VCX) and is installed by default in the directory in which Visual FoxPro is installed.

You can run the class browser by issuing the following command:

DO (_BROWSER)

Issuing this command adds a class browser menu item in the Tools menu and starts the class browser. The class browser can be run again by choosing the class browser menu item.

To add the class browser menu item to the Tools menu without starting the class browser, issue the following command:

DO (_BROWSER) WITH 0

You can also run the class browser for a specific visual class library or an object reference, and you can optionally include the name of a class that is initially selected. For example, the following command starts the class browser, opens the Buttons visual class library, and selects the VCR class:

DO (_BROWSER) WITH HOME( ) + '\SAMPLES\CONTROLS\BUTTONS.VCX', 'VCR'

For additional information about the Visual FoxPro Class Browser, see Managing Classes with the Class Browser topic.


See Also

CREATE CLASS
CREATE CLASSLIB
CREATE FORM
CREATEOBJECT( )
DEFINE CLASS
System Variables Overview


BufferMode Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether records are updated pessimistically or optimistically. Available at design time and run time.

Syntax

Object.BufferMode[ = nValue]

Settings

nValue   The settings for the BufferMode property are:

Setting	Description
0	(Default) None. Records are locked when editing begins and fields are written when the record pointer moves. Mimics FoxPro 2.x behavior.
1	Pessimistic. Records are locked when editing begins and fields are written when the record pointer moves. You can use TABLEREVERT( ) to undo your changes to the current record.
2	Optimistic. Records are not locked when edited and Visual FoxPro attempts to lock the records when they are written to disk with TABLEUPDATE( ).
Remarks

If BufferMode is set to 1 or 2, any cursor used by a Grid control is enabled for table buffering. Any other control bound to data uses row buffering.


Applies To

Form, FormSet, _SCREEN


See Also

BufferModeOverride Property
TABLEREVERT( )
TABLEUPDATE ( )


BufferModeOverride Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether to override the BufferMode property set at the form or form set level. Available at design time and run time.

Syntax

DataEnvironment.Cursor.BufferModeOverride[ = nValue]

Settings

nValue   The settings for the BufferModeOverride property are listed in the following table:

Setting	Description
0	None. No buffering is done.
1	(Default) Use form Setting. Uses the BufferMode property set at the form or form set level.
2	Pessimistic row buffering. Locks the record and buffers the changes until the record pointer moves. You can use TABLEREVERT( ) to undo your changes.
3	Optimistic row buffering. Allows edits to a single record and locks the record only when it is written to disk. You can use TABLEREVERT( ) to undo your changes.
4	Pessimistic table buffering. Locks each record edited, but records are not written to disk until TABLEUPDATE( ) is called. You can use TABLEREVERT( ) to undo your changes.
5	Optimistic table buffering. Allows edits to all records and does not lock them until the records are written to disk with TABLEUPDATE( ). You can use TABLEREVERT( ) to undo your changes.
Remarks

If the cursor is based on a local or remote view, the only BufferModeOverride settings available are 3 and 5. If the form set or form’s BufferMode property is set to 1 (Pessimistic), the default setting for BufferModeOverride is 3 (Optimistic row buffering) for cursors based on views.


Applies To

Cursor


See Also

BufferMode Property
TABLEREVERT( )
TABLEUPDATE ( )


BUILD APP Command

Syntax         Arguments         Remarks         See Also

Creates an application file with an .APP file name extension using information from a project file.

Syntax

BUILD APP APPFileName FROM ProjectName [RECOMPILE]

Arguments

APPFileName   Specifies the file name of the application to build. The default file name extension is .APP.

FROM ProjectName   Specifies the name of the project from which the application is built.

RECOMPILE   Specifies that the project is compiled before the application file is built. All program and format files; form, label, report, and visual class library source code; and stored procedures in databases in the project are compiled.

Remarks

You create a project file with CREATE PROJECT or MODIFY PROJECT. A project file is a table that uses the file extensions .PJX (table file) and .PJT (memo file).

Before using BUILD APP, be sure that the project file contains all of the files needed in the application. If required files are missing during the build, Visual FoxPro generates an error. These and other compile-time errors are stored in an error file with an .ERR file extension. The first eight characters of the error file name are the same as the first eight characters of your project name.

For more information on building projects, see Chapter 13, “Compiling an Application,” in the Developer’s Guide.


See Also

BUILD EXE
BUILD PROJECT
CREATE PROJECT
MODIFY PROJECT


BUILD DLL Command

Syntax         Arguments         Remarks         See Also

Creates a Dynamic Link Library (DLL) with a .DLL file name extension using class information from a project file.

Syntax

BUILD DLL DLLFileName FROM ProjectName [RECOMPILE]

Arguments

DLLFileName   Specifies the file name of the dynamic link library to build. The default file name extension is .DLL.

FROM ProjectName   Specifies the name of the project from which the dynamic link library is built.

The project must contain a class designated as OLEPUBLIC or an error message is displayed. To designate a class as OLEPUBLIC in program code, include the OLEPUBLIC keyword in DEFINE CLASS. To designate a class as OLEPUBLIC in the Class Designer, choose Class Info from the Class Menu and select the OLE Public check box.

RECOMPILE   Specifies that the project is compiled before the dynamic link library is built. All program and format files; form, label, report, and visual class library source code; and stored procedures in databases in the project are compiled.

Remarks

BUILD DLL automatically registers the servers in the Server Classes list box on the Servers tab of the Project Information dialog box.

For more information about creating dynamic link libraries, see “Creating Custom OLE Servers” in Chapter 16, “Adding OLE” in the Developer’s Guide.


See Also

BUILD EXE
BUILD PROJECT
CREATE PROJECT
MODIFY PROJECT


BUILD EXE Command

Syntax         Arguments         Remarks         See Also

Creates an executable file from a project.

Syntax

BUILD EXE EXEFileName FROM ProjectName [RECOMPILE]

Arguments

EXEFileName   Specifies the name of the executable file to create. If an .APP application file with the same root file name as the stand-alone executable file exists, it is deleted. If an executable file exists and you create an .APP file with the same name, the executable file is deleted.

FROM ProjectName   Specifies the name of the project from which the executable file is built.

RECOMPILE   Specifies that the project is compiled before the executable file is built. All program and format files; form, label, report, and visual class library source code; and stored procedures in databases in the project are compiled.

Remarks

For additional information about creating executable files, see Chapter 25, “Building an Application for Distribution,” in the Developer’s Guide.

An executable file created with BUILD EXE requires two support files: VFP500.DLL and VFP5ENU.DLL (EN denotes the English version). These files must be placed in the same directory as the executable file or along the MS-DOS path.

If the executable file contains OLEPUBLIC class definitions, BUILD EXE automatically registers the OLEPUBLIC class definitions in the system registry. OLEPUBLIC class definitions appear in the Server Classes list box on the Servers tab of the Project Information dialog box.

BUILD EXE also creates .VBR (registration) and .TLB (type library) files with the same name as the executable file. The .VBR file allow you to register the class definitions in the system registry when the executable file is moved to a different computer. The .TLB file is for use with object browsers.

For more information about registering OLEPUBLIC class definitions in an executable file, see “Creating Custom OLE Servers” in Chapter 16, “Adding OLE” in the Developer’s Guide.


See Also

BUILD APP
BUILD PROJECT


BUILD PROJECT Command

Syntax         Arguments         Remarks         See Also

Creates and builds a project file.

Syntax

BUILD PROJECT ProjectFileName
FROM ProgramName1 | MenuName1 | ReportName1 | LabelName1
| FormName1 | LibraryName1
[, ProgramName2 | MenuName2 | ReportName2 | LabelName2
| FormName2 | LibraryName2 ...]

Arguments

ProjectFileName   Specifies the name of the project table to be created.

FROM ProgramName1 | MenuName1 | ReportName1 | LabelName1
| FormName1 | LibraryName1   Specifies the files to include in the project. You can specify one or more program, menu, report, label, form, or library files and the project will keep track of these files, as well as the dependencies, references, and connections among them.

The first executable program or menu file in the FROM clause is the master program file in the project by default.

Remarks

BUILD PROJECT automatically creates a project table with a .PJX file name extension by opening and processing one or more program, menu, report, label, form, or library files that you specify. You can use the project file to create one of two program types: an application file with an .APP extension or an executable file with an .EXE extension. The project table keeps track of all the files required to create an application, as well as the dependencies, references, and connections among the files. Once you specify the pieces in the project, Visual FoxPro makes sure that the application is based on the latest source files.

For more information on building projects, see Chapter 13, “Compiling an Application,” in the Developer’s Guide.

When Visual FoxPro encounters a program, menu, or form file while creating a project file from BUILD PROJECT, it finds its compiled file and compares the time and date stamp of the two files. If the time and date stamp of the source file is later than that of the compiled file, Visual FoxPro recompiles the source file.

Each project file contains a time and date stamp so you can refresh the project file when you make changes to files in the project or when dependencies change. This practice helps to guarantee that any applications created from a project file will always use the most recent source files. To refresh a project file, issue BUILD PROJECT without the optional FROM clause. Visual FoxPro then updates the specified project.

When you issue BUILD PROJECT, unresolved references and other errors are reported but do not prevent the project file from being created. This enables you to build a project even when all the necessary pieces aren’t actually created or available at the time the project is built. Unresolved references or other problems can be corrected by refreshing the project file at a later date, or by manually modifying the information stored in the project file with MODIFY PROJECT.


See Also

BUILD APP
BUILD EXE
CREATE PROJECT
EXTERNAL
MODIFY PROJECT


_BUILDER System Variable

Syntax         Arguments         Remarks         See Also

Contains the name of the Visual FoxPro builder application.

Syntax

_BUILDER = cProgramName

Arguments

cProgramName   Specifies a builder application. If your builder application is in a directoryother than the current Visual FoxPro default directory, include a path with the application name.

You can also specify a builder application in your Visual FoxPro configuration file by including a line using this syntax:

_BUILDER = cProgramName

Remarks

The _BUILDER system variable contains the name of the application that Visual FoxPro uses when you choose a builder in the Form Designer. By default, _BUILDER contains BUILDER.APP, installed in your Visual FoxPro directory. You can specify a different name for the builder application.


See Also

System Variables Overview


ButtonCount Property

Syntax         Settings         Remarks         Example         Applies To         See Also

Specifies the number of buttons in a CommandGroup or OptionGroup. Available at design time and run time.

Syntax

Control.ButtonCount[ = nNumber]

Settings

nNumber   Specifies the number of buttons for the control.

Remarks

Use the ButtonCount property to dynamically set the number of buttons contained in a CommandGroup or OptionGroup.

If you change the number of buttons at run time, names are automatically assigned to the new buttons. The buttons are assigned the name CommandN for a CommandGroup or OptionN for an OptionGroup where N is the number of the button added. For example, if there are four buttons in the CommandGroup and the Buttons property setting is changed to 5, the new button is named Command5.


ButtonCount Property Example

The following example creates an OptionGroup control and places the control on a form. The OptionGroup control has three buttons; depending on the option button you click, a circle, ellipse, or square appears. The ButtonCount property is used to specify the number of buttons in the OptionGroup. The Buttons and Caption properties specify the text displayed next to each option button.

The Shape control is used to create the circle, ellipse, and square. The OptionGroup control’s Click event uses a DO CASE ... ENDCASE structure and the Value property to display the appropiate shape when you click an option button.

frmMyForm = CREATEOBJECT('Form')  && Create a Form

frmMyForm.Closable = .F.  && Disable the Control menu box

frmMyForm.AddObject('cmdCommand1','cmdMyCmndBtn')  && Add Command button

frmMyForm.AddObject('opgOptionGroup1','opgMyOptGrp') && Add Option Group

frmMyForm.AddObject('shpCircle1','shpMyCircle')  && Add Circle Shape

frmMyForm.AddObject('shpEllipse1','shpMyEllipse')  && Add Ellipse Shape

frmMyForm.AddObject('shpSquare','shpMySquare')  && Add Box Shape

frmMyForm.cmdCommand1.Visible =.T.  && "Quit" Command button visible

frmMyForm.opgOptionGroup1.Buttons(1).Caption = "\<Circle"

frmMyForm.opgOptionGroup1.Buttons(2).Caption = "\<Ellipse"

frmMyForm.opgOptionGroup1.Buttons(3).Caption = "\<Square"

frmMyForm.opgOptionGroup1.SetAll("Width", 100) && Set Option group width

frmMyForm.opgOptionGroup1.Visible = .T.  && Option Group visible

frmMyForm.opgOptionGroup1.Click  && Show the circle

frmMyForm.SHOW  && Display the form

READ EVENTS  && Start event processing

DEFINE CLASS opgMyOptGrp AS OptionGroup  && Create an Option Group

ButtonCount = 3  && Three Option buttons

Top = 10

Left = 10

Height = 75

Width = 100

PROCEDURE Click

ThisForm.shpCircle1.Visible = .F.  && Hide the circle

ThisForm.shpEllipse1.Visible = .F.  && Hide the ellipse

ThisForm.shpSquare.Visible = .F.  && Hide the square

DO CASE

CASE ThisForm.opgOptionGroup1.Value = 1

ThisForm.shpCircle1.Visible = .T. && Show the circle

CASE ThisForm.opgOptionGroup1.Value = 2

ThisForm.shpEllipse1.Visible = .T.  && Show the ellipse

CASE ThisForm.opgOptionGroup1.Value = 3

ThisForm.shpSquare.Visible = .T.  && Show the square

ENDCASE

ENDDEFINE

DEFINE CLASS cmdMyCmndBtn AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 210  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close Form

ENDDEFINE

DEFINE CLASS shpMyCircle AS SHAPE  && Create a circle

Top = 10

Left = 200

Width = 100

Height = 100

Curvature = 99

BackColor = RGB(255,0,0)  && Red

ENDDEFINE

DEFINE CLASS shpMyEllipse AS SHAPE  && Create an ellipse

Top = 35

Left = 200

Width = 100

Height = 50

Curvature = 99

BackColor = RGB(0,128,0)  && Green

ENDDEFINE

DEFINE CLASS shpMySquare AS SHAPE  && Create a square

Top = 10

Left = 200

Width = 100

Height = 100

Curvature = 0

BackColor = RGB(0,0,255)  && Blue

ENDDEFINE


Applies To

CommandGroup, OptionGroup


See Also

Buttons Property


Buttons Property

Syntax         Settings         Remarks         Example         Applies To         See Also

An array for accessing every button in a group. Not available at design time.

Syntax

Control.Buttons (nIndex).Property = Value
 – Or –

Control.Buttons (nIndex).Method

Settings

nIndex   An integer between 1 and the number of buttons specified in the ButtonCount property for Control.

Property   A property of a CommandButton or OptionButton.

Value   The value of Property.

Method   A method of a CommandButton or OptionButton.

Remarks

You can use the Buttons property to set properties and call methods for all the buttons in the group. The Buttons property is an array that is created when the button group is created.


Applies To

CommandGroup, OptionGroup


See Also

ButtonCount Property
SetAll Method


Buttons Property Example

The following example creates an OptionGroup control and places the control on a form. The OptionGroup control has three buttons; depending on the option button you click, a circle, ellipse, or square appears. The ButtonCount property specifies the number of buttons in the OptionGroup. The Buttons and Caption properties specify the text displayed next to each option button.

The Shape control is used to create the circle, ellipse, and square. The OptionGroup control’s Click event uses a DO CASE ... ENDCASE structure and the Value property to display the appropiate shape when you click an option button.

frmMyForm = CREATEOBJECT('Form')  && Create a Form

frmMyForm.Closable = .F.  && Disable the Control menu box

frmMyForm.AddObject('cmdCommand1','cmdMyCmndBtn')  && Add Command button

frmMyForm.AddObject('opgOptionGroup1','opgMyOptGrp') && Add Option Group

frmMyForm.AddObject('shpCircle1','shpMyCircle')  && Add Circle Shape

frmMyForm.AddObject('shpEllipse1','shpMyEllipse')  && Add Ellipse Shape

frmMyForm.AddObject('shpSquare','shpMySquare')  && Add Box Shape

frmMyForm.cmdCommand1.Visible =.T.  && "Quit" Command button visible

frmMyForm.opgOptionGroup1.Buttons(1).Caption = "\<Circle"

frmMyForm.opgOptionGroup1.Buttons(2).Caption = "\<Ellipse"

frmMyForm.opgOptionGroup1.Buttons(3).Caption = "\<Square"

frmMyForm.opgOptionGroup1.SetAll("Width", 100) && Set Option group width

frmMyForm.opgOptionGroup1.Visible = .T.  && Option Group visible

frmMyForm.opgOptionGroup1.Click  && Show the circle

frmMyForm.SHOW  && Display the form

READ EVENTS  && Start event processing

DEFINE CLASS opgMyOptGrp AS OptionGroup  && Create an Option Group

ButtonCount = 3  && Three Option buttons

Top = 10

Left = 10

Height = 75

Width = 100

PROCEDURE Click

ThisForm.shpCircle1.Visible = .F.  && Hide the circle

ThisForm.shpEllipse1.Visible = .F.  && Hide the ellipse

ThisForm.shpSquare.Visible = .F.  && Hide the square

DO CASE

CASE ThisForm.opgOptionGroup1.Value = 1

ThisForm.shpCircle1.Visible = .T. && Show the circle

CASE ThisForm.opgOptionGroup1.Value = 2

ThisForm.shpEllipse1.Visible = .T.  && Show the ellipse

CASE ThisForm.opgOptionGroup1.Value = 3

ThisForm.shpSquare.Visible = .T.  && Show the square

ENDCASE

ENDDEFINE

DEFINE CLASS cmdMyCmndBtn AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 210  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close Form

ENDDEFINE

DEFINE CLASS shpMyCircle AS SHAPE  && Create a circle

Top = 10

Left = 200

Width = 100

Height = 100

Curvature = 99

BackColor = RGB(255,0,0)  && Red

ENDDEFINE

DEFINE CLASS shpMyEllipse AS SHAPE  && Create an ellipse

Top = 35

Left = 200

Width = 100

Height = 50

Curvature = 99

BackColor = RGB(0,128,0)  && Green

ENDDEFINE

DEFINE CLASS shpMySquare AS SHAPE  && Create a square

Top = 10

Left = 200

Width = 100

Height = 100

Curvature = 0

BackColor = RGB(0,0,255)  && Blue

ENDDEFINE


_CALCMEM System Variable

Syntax         Arguments         Remarks         Example         See Also

Contains the numeric value that Visual FoxPro stores in the Calculator’s memory.

Syntax

_CALCMEM = nCalculatorValue

Arguments

nCalculatorValue   Specifies the numeric value that _CALCMEM stores in memory.

Remarks

You can save the result of a calculation in the Calculator’s memory and return the result to a program, or you can place a specific value in the Calculator’s memory before using the Calculator.

To initialize the Calculator’s memory, store a numeric value to _CALCMEM with STORE or the = assignment operator. When you use the Calculator, its memory contains the value you specified.


_CALCMEM System Variable Example

The following program example stores the numeric constant 1234 to _CALCMEM. The program then displays the Calculator and stuffs the keyboard with the letter R. The keystroke R displays the value stored in the Calculator’s memory.

STORE 1234 TO _CALCMEM

ACTIVATE WINDOW calculator

CLEAR TYPEAHEAD

KEYBOARD CHR(82)


See Also

ACTIVATE WINDOW
_CALCVALUE
STORE


CALCULATE Command

Syntax         Arguments         Remarks         Example         See Also

Performs financial and statistical operations on fields in a table or on expressions involving fields.

Syntax

CALCULATE eExpressionList
[Scope] [FOR lExpression1] [WHILE lExpression2]
[TO VarList | TO ARRAY ArrayName]
[NOOPTIMIZE]

Arguments

eExpressionList   Specifies the expressions that can contain any combination of the following functions:

AVG(nExpression)

CNT( )

MAX(eExpression)

MIN(eExpression)

NPV(nExpression1, nExpression2 [, nExpression3])

STD(nExpression)

SUM(nExpression)

VAR(nExpression)

Functions in the expression list eExpressionList are separated by commas. These functions are specific to CALCULATE and are described in detail later in this section. They should not be confused with similarly named independent functions. For example, CALCULATE MIN( ) is not the same as MIN( ).

Scope   Specifies a range of records used in the calculation. Only the records that fall within the range of records are included in the calculation. The scope clauses are: ALL, NEXT nRecords, RECORD nRecordNumber, and REST. For more information on scope clauses, see the Scope Clauses topic. Commands that include Scope operate only on the table in the active work area.

The default scope for CALCULATE is ALL records.

FOR lExpression1   Specifies that only the records that satisfy the logical condition lExpression1 are included in the calculation. Including a FOR clause conditionally includes records in the calculation, filtering out undesired records.

Rushmore optimizes a CALCULATE ... FOR query if lExpression1 is an optimizable expression. For best performance, use an optimizable expression in the FOR clause. For information on Rushmore optimizable expressions, see SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

WHILE lExpression2   Specifies a condition whereby records are included in the calculation as long as the logical expression lExpression2 evaluates to true (.T.).

TO VarList   Specifies one or more variables to which the results of the calculation are stored. If a variable you specify does not exist, Visual FoxPro automatically creates the variable with the name you specify.

TO ARRAY ArrayName   Specifies an array name to which the results of the calculation can be stored. If the array name you specify does not exist, Visual FoxPro automatically creates an array with the name you specify. If the array exists and isn’t large enough to contain all the results of the calculation, Visual FoxPro automatically increases the size of the array to accommodate the information. If an existing array is larger than necessary, additional elements are left unchanged. Results are stored to the array elements in the order they are specified in the CALCULATE command.

NOOPTIMIZE   Disables Rushmore optimization of CALCULATE. For more information, see SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

AVG(nExpression)   Computes the arithmetic mean of nExpression. Only records meeting the Scope and/or optional FOR or WHILE conditions are included in the result.

CNT( )   Returns the number of records in the table. Only records meeting the Scope and/or optional FOR or WHILE conditions are included in the result.

MAX(eExpression)   Returns the highest or latest value of eExpression. Within the MAX( ) clause, you can specify any character, date, datetime, numeric, float, integer, double, or currency field, or any expression using fields of these types. Only records meeting the Scope and/or optional FOR or WHILE conditions are included in the result.

MIN(eExpression)   Returns the lowest or earliest value of eExpression. Any character, date, datetime, numeric, float, integer, double, or currency field, or any valid expression using fields of these types can be included in eExpression. Only records meeting the Scope and/or optional FOR or WHILE conditions are included in the result.

NPV(nExpression1, nExpression2 [, nExpression3])   Computes the net present value of a series of future cash flows discounted at a constant periodic interest rate.

nExpression1 specifies the interest rate expressed as a decimal value.

nExpression2 specifies a field, field expression, or a numeric expression representing a series of cash flows. Each cash flow can be either positive or negative. In cases where nExpression2 is a field, the value for each record in the field is considered a cash flow.

nExpression3 specifies an optional initial investment. If the initial investment isn’t included, then the initial investment is assumed to occur at the end of the first period. This initial investment is the first record in the field and is negative to represent a cash outflow.

Only records meeting the Scope and/or optional FOR or WHILE conditions are included in the result.

STD(nExpression)   Computes the standard deviation of nExpression. The standard deviation measures the degree to which the values of fields or expressions involving fields differ from the average of all the values. The smaller the standard deviation, the less the values vary from the average. Only records meeting the Scope and/or optional FOR or WHILE conditions are included in the result.

SUM(nExpression)   Totals the values of nExpression. Only records meeting the Scope and/or optional FOR or WHILE conditions are included in the result.

VAR(nExpression)   Computes the variance from the average of nExpression. The variance is the standard deviation squared. The smaller the variance, the less the values vary from the average. Only records meeting the Scope and/or optional FOR or WHILE conditions are included in the result.

Remarks

Records containing the null value are not included in the operations that CALCULATE performs.


CALCULATE Command Example

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE orders  && Open Orders table

SET TALK ON

CLEAR

CALCULATE AVG(order_amt), MIN(order_amt), MAX(order_amt)

CALCULATE STD(order_amt), VAR(order_amt) TO gnStd, gnVar


See Also

AVERAGE
COUNT
DIMENSION
FV( )
MAX( )
MIN( )
PAYMENT( )
PV( )
SUM


_CALCVALUE System Variable

Syntax         Arguments         Remarks         Example         See Also

Contains the numeric value that the Calculator displays.

Syntax

_CALCVALUE = nCalculatorDisplayValue

Arguments

nCalculatorDisplayValue   Specifies the numeric value that the Calculator displays.

Remarks

You can return the result of a calculation to a program or you can place a specific value in the Calculator’s display before using the Calculator.

To initialize the Calculator’s display, store a numeric value to _CALCVALUE with STORE or the = assignment operator. When you use the Calculator, it displays the value you specified.


_CALCVALUE System Variable Example

In the following example, the numeric value 1234 is stored to _CALCVALUE. The Calculator then displays the value 1234.

STORE 1234 TO _CALCVALUE

ACTIVATE WINDOW calculator


See Also

ACTIVATE WINDOW
_CALCMEM
STORE


CALL Command

Included for backward compatibility. Use SET LIBRARY instead.


CANCEL Command

Syntax         Remarks         Example         See Also

Ends execution of the current Visual FoxPro program file.

Syntax

CANCEL

Remarks

Control returns to the Command window when Visual FoxPro is being used interactively. If a distributed run-time application is running, CANCEL terminates the application and control returns to Windows. If a program is executing in Visual FoxPro during design time, CANCEL terminates the program and control returns to the Command window.

Executing CANCEL releases all private variables.


CANCEL Command Example

The following example simulates a program execution loop. Each time through the loop you are asked if you want to continue. If you press the Cancel button, CANCEL stops program execution.

DO WHILE .T.

IF MESSAGEBOX("Do you want to continue?",36) <> 6

CANCEL

ENDIF

ENDDO


See Also

QUIT
RESUME
RETURN
SUSPEND


Cancel Property

Syntax        Settings          Remarks         Example         Applies To         See Also

Specifies whether a CommandButton or OLE Container control is the Cancel button; that is, if the user pressed the ESC key, the Cancel button’s Click event would occurs. Available at design time and run time.

Syntax

Object.Cancel[ = lExpr]

Settings

lExpr   The settings for the Cancel property are:

Setting	Description
True (.T.)	The CommandButton or OLE Container control is the Cancel button.
False (.F.)	(Default) The CommandButton or OLE Container control is not the Cancel button.
Remarks

The Cancel property applies only to an OLE Container control that contains an “Acts like a Button” OLE control (.OCX).


Cancel Property Example

The following example creates a command button and an OptionGroup control and places them on a form. The Cancel property is used to assign the command button as the Cancel button. If the the ESC key is pressed, the Command button’s Click event occurs and the Click event procedure executes CLEAR EVENTS to close the form and stop event processing.

The OptionGroup control has three buttons; depending on the option button you click, a circle, ellipse, or square is displayed. The Shape Control is used to create the circle, ellipse, and square. The OptionGroup control’s Click event uses a DO CASE ... ENDCASE structure and the Value property to display the appropriate shape when you click an option button.

frmMyForm = CREATEOBJECT('Form')  && Create a Form

frmMyForm.Closable = .F.  && Disable the Control menu box

frmMyForm.AddObject('cmdCommand1','cmdMyCmndBtn')  && Add Command button

frmMyForm.AddObject('opgOptionGroup1','opgMyOptGrp') && Add Option Group

frmMyForm.AddObject('shpCircle1','shpMyCircle')  && Add Circle Shape

frmMyForm.AddObject('shpEllipse1','shpMyEllipse')  && Add Ellipse Shape

frmMyForm.AddObject('shpSquare','shpMySquare')  && Add Box Shape

frmMyForm.cmdCommand1.Visible =.T.  && "Quit" Command button visible

frmMyForm.opgOptionGroup1.Buttons(1).Caption = "\<Circle"

frmMyForm.opgOptionGroup1.Buttons(2).Caption = "\<Ellipse"

frmMyForm.opgOptionGroup1.Buttons(3).Caption = "\<Square"

frmMyForm.opgOptionGroup1.SetAll("Width", 100) && Set Option group width

frmMyForm.opgOptionGroup1.Visible = .T.  && Option Group visible

frmMyForm.opgOptionGroup1.Click  && Show the circle

frmMyForm.SHOW  && Display the form

READ EVENTS  && Start event processing

DEFINE CLASS opgMyOptGrp AS OptionGroup  && Create an Option Group

ButtonCount = 3  && Three Option buttons

Top = 10

Left = 10

Height = 75

Width = 100

PROCEDURE Click

ThisForm.shpCircle1.Visible = .F.  && Hide the circle

ThisForm.shpEllipse1.Visible = .F.  && Hide the ellipse

ThisForm.shpSquare.Visible = .F.  && Hide the square

DO CASE

CASE ThisForm.opgOptionGroup1.Value = 1

ThisForm.shpCircle1.Visible = .T. && Show the circle

CASE ThisForm.opgOptionGroup1.Value = 2

ThisForm.shpEllipse1.Visible = .T.  && Show the ellipse

CASE ThisForm.opgOptionGroup1.Value = 3

ThisForm.shpSquare.Visible = .T.  && Show the square

ENDCASE

ENDDEFINE

DEFINE CLASS cmdMyCmndBtn AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 210  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close Form

ENDDEFINE

DEFINE CLASS shpMyCircle AS SHAPE  && Create a circle

Top = 10

Left = 200

Width = 100

Height = 100

Curvature = 99

BackColor = RGB(255,0,0)  && Red

ENDDEFINE

DEFINE CLASS shpMyEllipse AS SHAPE  && Create an ellipse

Top = 35

Left = 200

Width = 100

Height = 50

Curvature = 99

BackColor = RGB(0,128,0)  && Green

ENDDEFINE

DEFINE CLASS shpMySquare AS SHAPE  && Create a square

Top = 10

Left = 200

Width = 100

Height = 100

Curvature = 0

BackColor = RGB(0,0,255)  && Blue

ENDDEFINE


 Applies To

CommandButton, OLE Container Control


 See Also

Click Event, Default Property


CANDIDATE( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns true (.T.) if an index tag is a candidate index tag; otherwise, returns false (.F.).

Syntax

CANDIDATE([nIndexNumber] [, nWorkArea | cTableAlias])

Returns

Logical

Arguments

nIndexNumber   Specifies the number of the index tag for which CANDIDATE( ) returns the candidate status. CANDIDATE( ) returns the candidate status in the following order as nIndexNumber increases from 1 to the total number of structural compound and independent compound index tags:

1. Candidate status for each tag in the structural compound index (if one is present) is returned first. The candidate status is returned for the tags in the order in which the tags are created in the structural index.

2. Candidate status for each tag in any open independent compound indexes is returned last. The candidate status is returned for the tags in the order in which the tags are created in the independent compound indexes.

If you omit nIndexNumber, CANDIDATE( ) checks the master controlling index tag to see if it’s a candidate index tag. If there is no master controlling index tag, CANDIDATE( ) returns false (.F.).

nWorkArea   Specifies the work area of the index tag specified with nIndexNumber.

cTableAlias   Specifies the work area of the index tag specified with nIndexNumber.

If you omit nWorkArea and cTableAlias, CANDIDATE( ) checks the index tag in the currently selected work area to see if it’s a candidate index tag.

Remarks

A candidate index tag is an index tag that can become the primary index tag because it doesn’t contain null or duplicate values.


CANDIDATE( ) Function Example

The following example opens the customer table in the testdata database. FOR ... ENDFOR is used to create a loop in which the candidate status of each index tag in the customer structural index is checked. The name of each structural index tag is displayed with its candidate status.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer	  && Open customer table

FOR nCount = 1 TO 254

IF !EMPTY(TAG(nCount))  && Checks for tags in the index

? TAG(nCount)  && Display tag name

? CANDIDATE(nCount)  && Display candidate status

ELSE

EXIT  && Exit the loop when no more tags are found

ENDIF

ENDFOR


See Also

ALTER TABLE - SQL
CREATE TABLE - SQL
INDEX
PRIMARY( )


CAPSLOCK( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the current mode of the CAPS LOCK key or sets the CAPS LOCK key mode on or off.

Syntax

CAPSLOCK([lExpression])

Returns

Logical

Arguments

lExpression   Include to turn the CAPS LOCK key on or off. CAPSLOCK(.T.) turns CAPS LOCK on and CAPSLOCK(.F.) turns CAPS LOCK off. A logical value is returned corresponding to the CAPS LOCK setting before CAPSLOCK(.T.) or CAPSLOCK(.F.) is issued.

Remarks

Issuing CAPSLOCK( ) with no argument returns true (.T.) if CAPS LOCK is on, or false (.F.) if CAPS LOCK is off.


CAPSLOCK( ) Function Example

The following code stores the state of CAPSLOCK( ) to a system variable. The = command executes the CAPSLOCK( ) function to set CAPS LOCK on. Then the = command executes the CAPSLOCK( ) function to set CAPS LOCK to its previous state.

glOldLock = CAPSLOCK( )	  && Save original setting

= CAPSLOCK(.T.)	  && Turn CAPS LOCK on

*** Perform any number of statements ***

= CAPSLOCK(glOldLock)  && Return to original setting

*** or, toggle CapsLock to the opposite value and back ***

= CAPSLOCK(!CAPSLOCK( ))

WAIT WINDOW

= CAPSLOCK(!CAPSLOCK( ))

WAIT WINDOW

= CAPSLOCK(glOldLock)  && Return to original setting


See Also

INSMODE( )
NUMLOCK( )


Caption Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the text displayed in an object’s caption. Available at design time and run time.

Syntax

Object.Caption[ = cText]

Settings

cText   Specifies text displayed with an object.

Remarks

Captions are displayed differently depending on the object:

•	For forms, the Caption property specifies the text displayed in the form’s title bar. When the form is minimized, this text is displayed below the form’s icon.

•	For pages of a PageFrame object, the Caption property specifies the text displayed on the tab of each page.

•	For controls, the Caption property specifies the text displayed on or next to a control.

•	For controls with the Style property set to 1 (Graphical), and for forms that are minimized, the caption is displayed under the icon.

When you create a new form or control, its default caption is the same as the default Name property setting. This default caption includes the object class and an integer, such as Command1, Combo1, or Form1.

The Name property is the way to refer to an object in code; the Caption property is what appears on the screen to identify the control. These two properties start out with the same value, but are set independently thereafter.

If there is no Width property setting specified for the control, the control is automatically sized to hold the caption.

For CommandGroup and OptionGroup objects, the caption is displayed only if the BorderStyle property is set to 1 (Fixed Single).

For a Label control, set the AutoSize property to true (.T.) to automatically resize the control to fit its caption. 256 is the maximum number of characters for the Caption property for a Label control.

To assign an access key to a control, include a backslash and a less-than sign (\<) in the caption immediately preceding the character you want to designate as the access key. A user can then press ALT and the specified character to move the focus to that control. If the control is a command button, check box, or option button, pressing ALT and the specified character also has the effect of clicking the control.


Applies To

CheckBox, CommandButton, Form, Header, Label, OptionButton, Page, _SCREEN, ToolBar


See Also

AutoSize Property
BorderStyle Property
Name Property
Style Property
Width Property


CD | CHDIR Command

Syntax         Arguments         Remarks         Example         See Also

Changes the default Visual FoxPro directory to the directory you specify.

Syntax

CD cPath | CHDIR cPath

Arguments

cPath   Specifies one of the following:

•	A drive designator.

•	A drive designator with a directory.

•	A child directory.

•	Any of the above using MS-DOS shorthand notation ( \ or ..). When you include .. to change to the parent directory, you must include a space between CD or CHDIR and the two periods.

Remarks

Use CD or CHDIR to specify the default Visual FoxPro directory. Visual FoxPro searches for files in the default Visual FoxPro directory. If Visual FoxPro cannot find a file in the default directory, it then searches the Visual FoxPro path if one has been specified. Use SET PATH to specify the Visual FoxPro path.

If you create a file and don’t specify where to place it, the file is placed in the default Visual FoxPro directory.


CD | CHDIR Command Example

The following example uses MKDIR to create a new directory named mytstdir, then CHDIR is used to change to the new directory. GETDIR( ) 	is used to display the directory structure, and then RMDIR is used to remove the newly created directory GETDIR( ) is used to display the directory structure again.

SET DEFAULT TO HOME( )  && Restore Visual FoxPro directory

MKDIR mytstdir  && Create a new directory

CHDIR mytstdir  && Change to the new directory

= GETDIR( )  && Display the Select Directory dialog box

SET DEFAULT TO HOME( )  && Restore Visual FoxPro directory

RMDIR mytstdir  && Remove the new directory

= GETDIR( )  && Display the Select Directory dialog box


See Also

GETDIR( )
HOME( )
MD | MKDIR
RD | RMDIR
SET DEFAULT
SET PATH
SYS(5) - Default Drive
SYS(2003) - Current Directory
SYS(2004) - Visual FoxPro Start Directory


CDOW( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the day-of-the-week from a given Date or DateTime expression.

Syntax

CDOW(dExpression | tExpression)

Returns

Character

Arguments

dExpression   Specifies the date from which CDOW( ) returns the day.

tExpression   Specifies the datetime from which CDOW( ) returns the day.

Remarks

CDOW( ) returns the name of the day of the week as a string in proper noun format.


CDOW( ) Function Example

STORE {02/16/95} TO gdDate && Displays Thursday

CLEAR

? CDOW(gdDate)


See Also

DAY( )
DOW( )
SET FDOW
SET FWEEK
SYS( ) Functions Overview


CDX( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the names of the open compound index (.CDX) file that has the specified index position number.

Syntax

CDX(nIndexNumber [, nWorkArea | cTableAlias])

Returns

Character

Arguments

nIndexNumber   The following apply to a table with a structural compound index and one or more compound indexes:

nIndexNumber	Description
1	Returns the name of the structural index file(which is always the same as the name of the table).
2	Returns the first compound index file name specified in the INDEX clause of USE or in SET INDEX.
3	Returns the second compound index file name, if any, and so on.
Greater than the number of open .CDX files	Returns the empty string.
The following apply to a table with no structural compound index and one or more compound indexes:

nIndexNumber	Description
1	Returns the first compound index file name specified in the INDEX clause of USE or in SET INDEX.
2	Returns the second compound index file name, if any, and so on.
Greater than the number of open .CDX files	Returns the empty string.
nWorkArea   Specifies the work area number of a table whose open compound index file names you want CDX( ) to return.

cTableAlias   Specifies the alias of a table whose open compound index file names you want CDX( ) to return.

If you omit nWorkArea and cTableAlias, names of compound index files are returned for the table in the currently selected work area.

Remarks

The CDX( ) function is identical to the MDX( ) function.

A .CDX (compound) index consists of one physical file containing many index tags. Each index tag is an index order reference for the associated table.

There are two types of .CDX files: standard compound index (.CDX) and structural .CDX. A standard compound index (.CDX) may have a different name from its associated table and can reside in a different directory from its associated table. A table can have multiple compound index files. You open a compound index with the INDEX clause of USE or with SET INDEX.

A structural .CDX must have the same name as its associated table and reside in the same directory. A table can have only one structural index file. Structural .CDX files are automatically opened and updated when the associated table is opened with USE.

CDX( ) ignores any .IDX (FoxBASE+ and FoxPro 1.0 compatible index) files specified in USE or SET INDEX.

Use TAG( ) to return individual tag names contained in a .CDX, and NDX( ) to return the name of open .IDX files.

When SET FULLPATH is ON, CDX( ) returns the path and name of the .CDX. When SET FULLPATH is OFF, CDX( ) returns the drive and name of the .CDX.


CDX( ) Function Example

The following example opens the customer table in the testdata database. FOR ... ENDFOR is used to create a loop in which the name of each structural index is displayed.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer	  && Open customer table

CLEAR

FOR nCount = 1 TO 254

IF !EMPTY(TAG(nCount))  && Checks for tags in the index

? CDX(nCount)	  && Display structural index names

ELSE

EXIT  && Exit the loop when no more tags are found

ENDIF

ENDFOR


See Also

INDEX
MDX( )
NDX( )
SET FULLPATH
SET INDEX
SYS(14) - Index Expression
SYS(21) - Controlling Index Number
SYS(22) - Controlling Tag or Index Name
SYS(2021) - Filtered Index Expression
TAG( )
USE


CEILING( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the next highest integer that is greater than or equal to the specified numeric expression.

Syntax

CEILING(nExpression)

Returns

Numeric

Arguments

nExpression   Specifies the number whose next highest integer CEILING( ) returns.

Remarks

CEILING rounds a number with a fractional portion to the next highest integer.


CEILING( ) Function Example

STORE 10.1 TO num1

STORE -10.9 TO num2

? CEILING(num1)  && Displays 11

? CEILING(num2)  && Displays -10

? CEILING(10.0)  && Displays 10

? CEILING(-10.0) && Displays -10


See Also

FLOOR( )
ROUND( )


Century Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether the century portion of a date is displayed in a text box. Available at design time and run time.

Syntax

Object.Century[ = nValue]

Settings

nValue   One of the following settings:

Setting	Description
0	Off. The century portion of the date is not displayed.
1	On. The century portion of the date is displayed.
2	(Default) The SET CENTURY setting determines if the century portion of the date is displayed. If SET CENTURY is ON, the century portion of the date is displayed. If SET CENTURY is OFF, the century portion of the date is not displayed.
Remarks

The Century property setting is ignored if the DateFormat property is set to Short or Long.


Applies To

TextBox


See Also

DateFormat Property, DateMark Property, Hours Property, Seconds Property, SET CENTURY, StrictDateEntry Property


CHANGE Command

Syntax         Arguments         Remarks         See Also

Displays fields for editing.

Syntax

CHANGE
[FIELDS FieldList]
[Scope] [FOR lExpression1] [WHILE lExpression2]
[FONT cFontName [, nFontSize]]
[STYLE cFontStyle]
[FREEZE FieldName]
[KEY eExpression1 [, eExpression2]]
[LAST | NOINIT]
[LPARTITION]
[NAME ObjectName]
[NOAPPEND]
[NOCLEAR]
[NODELETE]
[NOEDIT | NOMODIFY]
[NOLINK]
[NOMENU]
[NOOPTIMIZE]
[NORMAL]
[NOWAIT]
[PARTITION nColumnNumber [LEDIT] [REDIT]]
[PREFERENCE PreferenceName]
[REST]
[SAVE]
[TIMEOUT nSeconds]
[TITLE cTitleText]
[VALID [:F] lExpression3 [ERROR cMessageText]]
[WHEN lExpression4]
[WIDTH nFieldWidth]
[WINDOW WindowName1]
[IN [WINDOW] WindowNam2 | IN SCREEN | IN MACDESKTOP]]
[COLOR SCHEME nSchemeNumber
| COLOR ColorPairList]

Arguments

The arguments for CHANGE are the same as those for EDIT. See EDIT for a description of arguments.

Remarks

CHANGE works just like EDIT.


See Also

BROWSE
EDIT
WTITLE( )


CheckBox Control

Syntax         Remarks         Properties         Events         Methods         See Also

Creates a check box.

Syntax

CheckBox

Remarks

A check box is used to toggle between two states, such as true (.T.) and false (.F.) or yes and no. When a condition is true, an X appears in the check box.

Use the Caption property to specify the text that appears next to a check box. Use the Picture property to specify a picture for a check box.

For additional information about CheckBox controls, see Chapter 10, “Using Controls,” in the Developer’s Guide.


Properties

Alignment	AutoSize	BackColor
BackStyle	BaseClass	Caption
Class	ClassLibrary	ColorScheme
ColorSource	Comment	ControlSource
DisabledBackColor	DisabledForeColor	DisabledPicture
DownPicture	DragIcon	DragMode
Enabled	FontBold	FontCondense
FontExtend	FontItalic	FontName
FontOutline	FontShadow	FontSize
FontStrikeThru	FontUnderline	ForeColor
Height	HelpContextID	Left
MousePointer	Name	Parent
ParentClass	Picture	RightToLeft
SpecialEffect	StatusBarText	Style
TabIndex	TabStop	Tag
TerminateRead	ToolTipText	Top
Value	Visible	Width


Events

Click	DblClick	Destroy
DragDrop	DragOver	Error
ErrorMessage	GotFocus	Init
InteractiveChange	KeyPress	LostFocus
Message	MiddleClick	MouseDown
MouseMove	MouseUp	MouseWheel
ProgrammaticChange	RightClick	UIEnable
Valid	When


Methods

CloneObject	Drag	Move
ReadExpression	ReadMethod	Refresh
ResetToDefault	SaveAsClass	SetFocus
WriteExpression	WriteMethod	ZOrder


See Also

CREATE CLASS
CREATE FORM
DEFINE CLASS


ChildAlias Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the alias of the child table. Read-only at design time and run time.

Syntax

DataEnvironment.Relation.ChildAlias[ = cText]

Settings

cText   Specifies the alias of the child table in the relation.

Remarks

The ChildAlias property setting must be the same name as the Alias property setting for the Cursor object that represents the child table.


Applies To

Relation


See Also

Alias Property
ParentAlias Property


ChildOrder Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the index tag for the record source of the Grid control or Relation object. Available at design time and read-only at run time.

Syntax

Object.ChildOrder[ = cTagName]

Settings

cTagName   Specifies an existing index tag name.

Remarks

If the ChildOrder property is set, the Order property of the Cursor for the child table is ignored.

Use this property to link two tables that have a one-to-many relationship. For example, a customer table containing one record per customer links to an order table containing multiple orders per customer. For this one-to-many relationship, set the ChildOrder property to the customer ID index tag field.

The ChildOrder property mimics the behavior of SET ORDER.


Applies To

Grid, Relation


See Also

ControlSource Property
LinkMaster Property
SET ORDER


CHR( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the character associated with the specified numeric ANSI code.

Syntax

CHR(nANSICode)

Returns

Character

Arguments

nANSICode   Specifies a number between 0 and 255 whose equivalent ANSI character CHR( ) returns.

Use ASC( ) to return the ANSI value for a specified character.

Remarks

CHR( ) returns a single character corresponding to the numeric position of the character in the character table of the current code page. CHR( ) can be used to send printer control codes to a printer.


CHR( ) Function Example

The following example displays the numbers 65 through 75 and uses CHR( ) to display their corresponding character values A through K.

CLEAR

FOR nCOUNT = 65 TO 75

? nCount && Display numeric value

?? ' ' + CHR(nCount) && Display character

ENDFOR


See Also

ASC( )
INKEY( )


CHRSAW( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Determines whether or not a character is present in the keyboard buffer.

Syntax

CHRSAW([nSeconds])

Returns

Logical

Arguments

nSeconds   Specifies the time in seconds that CHRSAW( ) waits before checking the keyboard buffer. The keyboard buffer is checked immediately if you omit nSeconds.

Including nSeconds lets you use CHRSAW( ) for a variety of timed activities. For example, your program can close an application if a key hasn’t been pressed for a specific number of seconds.

Remarks

CHRSAW( ) returns true (.T.) if a character is present in the keyboard buffer, and false (.F.) if not. CHRSAW( ) doesn’t affect the keyboard buffer contents.


CHRSAW( ) Function Example

In the following example, the system displays a window containing input fields created with @ ... GET commands, and waits 5 seconds for keyboard input. If a key isn’t pressed in this time period, CHRSAW( ) returns false (.F.) and the program terminates.

SET TALK OFF

DEFINE WINDOW wEnter FROM 7,10 to 13,70 PANEL

ACTIVATE WINDOW wEnter

@ 1,3 SAY 'Customer: '	GET gcCustomer  DEFAULT SPACE(40)

@ 3,3 SAY 'Address:  '	GET gcAddress  DEFAULT SPACE(40)

WAIT WINDOW 'Waiting for input' NOWAIT

IF NOT CHRSAW(5)

DEACTIVATE WINDOW wEnter

CLEAR GETS

ELSE

READ

DEACTIVATE WINDOW wEnter

ENDIF

RELEASE WINDOW wEnter

WAIT

CLEAR


See Also

INKEY( )
KEYBOARD
READKEY( )


CHRTRAN( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Replaces each character in a character expression that matches a character in a second character expression with the corresponding character in a third character expression.

Syntax

CHRTRAN(cSearchedExpression, cSearchExpression, cReplacementExpression)

Returns

Character

Arguments

cSearchedExpression   Specifies the expression in which CHRTRAN( ) replaces characters.

cSearchExpression   Specifies the expression containing the characters CHRTRAN( ) looks for in cSearchedExpression.

cReplacementExpression   Specifies the expression containing the replacement characters.

If a character in cSearchExpression is found in cSearchedExpression, the character in cSearchedExpression is replaced by a character from cReplacementExpression that’s in the same position in cReplacementExpression as the respective character in cSearchExpression.

If cReplacementExpression has fewer characters than cSearchExpression, the additional characters in cSearchExpression are deleted from cSearchedExpression. If cReplacementExpression has more characters than cSearchExpression, the additional characters in cReplacementExpression are ignored.

Remarks

CHRTRAN( ) translates the character expression cSearchedExpression using the translation expressions cSearchExpression and cReplacementExpression and returns the resulting character string.


CHRTRAN( ) Function Example

? CHRTRAN('ABCDEF', 'ACE', 'XYZ')  && Displays XBYDZF

? CHRTRAN('ABCD', 'ABC', 'YZ')  && Displays YZD

? CHRTRAN('ABCDEF', 'ACE', 'XYZQRST')  && Displays XBYDZF


See Also

CHRTRANC( )
SYS(15) - Character Translation


CHRTRANC( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Replaces each character in a character expression that matches a character in a second character expression with the corresponding character in a third character expression.

Syntax

CHRTRANC(cSearched, cSearchFor, cReplacement)

Returns

Character

Arguments

cSearched   Specifies the expression in which CHRTRANC( ) replaces characters.

cSearchFor   Specifies the expression containing the characters CHRTRANC( ) looks for in cSearched.

cReplacement   Specifies the expression containing the replacement characters.

If a character in cSearchFor is found in cSearched, the character in cSearched is replaced by a character from cReplacement that's in the same position in cReplacement as the respective character in cSearchFor.

If cReplacement has fewer characters than cSearchFor, the additional characters in cSearchFor are deleted from cSearched. If cReplacement has more characters than cSearchFor, the additional characters in cReplacement are ignored.

Remarks

CHRTRANC( ) is designed to facilitate working with expressions that contain double-byte characters. Use CHRTRANC( ) to replace single-byte characters with double-byte characters or double-byte characters with single-byte characters. If the expressions contains only single-byte characters, CHRTRANC( ) is equivalent to CHRTRAN( ) .


See Also

CHRTRAN( )
STRCONV( )


Circle Method

Syntax         Arguments         Remarks         Applies To         See Also

Draws a circle or ellipse on a form.

Syntax

Object.Circle (nRadius [, nXCoord, nYCoord [, nAspect]])

Arguments

nRadius   Specifies the radius of the circle or ellipse. The ScaleMode property of the form determines the unit of measurement used.

nXCoord, nYCoord   Specifies the coordinates for the center point of the circle or ellipse. The ScaleMode property of the form determines the units of measurement used.

nAspect   Specifies the aspect ratio of the circle. The default value is 1.0, which produces a perfect (nonelliptical) circle. Values greater than 1.0 produce a vertical ellipse; values less than 1.0 produce a horizontal ellipse.

Remarks

To control the width of the line used to draw the circle or ellipse, set the DrawWidth property.

To control the way the circle is drawn in the background, set the DrawMode and DrawStyle properties.

To fill a circle, set the FillColor and FillStyle properties of the form.

When the Circle method is invoked, CurrentX and CurrentY are set to the center point arguments, nXCoord, nYCoord.


Applies To

Form, _SCREEN


See Also

BackColor Property
CurrentX
CurrentY Properties
DrawMode Property
DrawStyle Property
DrawWidth Property
FillColor Property
FillStyle Property
ForeColor Property
ScaleMode Property


Class Property

Syntax         Remarks         Applies To         See Also

Returns the name of the class on which an object is based. Read-only at design time and run time.

Syntax

Object.Class

Remarks

In the Class Designer, the Class property returns the actual name of the class.


Applies To

CheckBox, Column, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, Custom, EditBox, Form, FormSet, Grid, Header, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, Page, PageFrame, Shape, _SCREEN, Spinner, TextBox, Timer, ToolBar


See Also

AddObject Method
BaseClass Property


ClassLibrary Property

Syntax         Remarks         Applies To         See Also

Specifies the file name of the user-defined class library that contains the object’s class. Read-only at design time and run time.

Syntax

Object.ClassLibrary

Remarks

Visual FoxPro base class objects are built into the product and have no ClassLibrary setting.


Applies To

CheckBox, Column, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, Custom, EditBox, Form, FormSet, Grid, Header, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, Page, PageFrame, _SCREEN, Shape, Spinner, TextBox, Timer, ToolBar


See Also

BaseClass Property


CLEAR Commands

Syntax         Arguments         Remarks         See Also

Releases the specified item or items from memory.

Syntax

CLEAR
[ALL | CLASS ClassName | CLASSLIB ClassLibraryName | DEBUG
| DLLS | EVENTS | FIELDS | GETS | MACROS | MEMORY
| MENUS | POPUPS	| PROGRAM | PROMPT | READ [ALL]
| RESOURCES [FileName] | TYPEAHEAD | WINDOWS]

Arguments

ALL   Releases from memory all variables and arrays and the definitions of all user-defined menu bars, menus, and windows. CLOSE ALL also closes any tables, including all associated index, format and memo files, and selects work area 1. CLEAR ALL also releases  from memory all external shared library functions registered with DECLARE - DLL.

CLEAR ALL does not release system variables, and does not clear the compiled program buffer. Use CLEAR PROGRAM to clear the compiled program buffer.

Issuing CLEAR ALL within an event or method for an active control or object generates a Visual FoxPro error message. An object type variable cannot be released from memory when its associated control or object is active.

CLASS ClassName   Clears a class definition from memory. When an instance of a class is created, Visual FoxPro keeps the class definition in memory after the instance is released. Use CLEAR CLASS to clear a class definition from memory after its instance is released.

CLASSLIB ClassLibraryName   Clears from memory all class definitions contained in a visual class library. If instances of classes in the class library exist, the class definitions are not cleared from memory. However, all class definitions that do not have instances are cleared from memory.

DEBUG   Clears all breakpoints in the Debugger and restores the Debugger windows (Call Stack, Trace, Watch, etc.) to their default positions.

If Clear Debug is issued when the Debugger is closed, the Debugger is opened with the Debugger windows in their default positions.

Works in either fox or debugger frame mode.

DLLS   Clears from memory all external shared libraries registered with DECLARE - DLL. See DECLARE -DLL for more information about registering external shared library functions.

EVENTS   Stops event processing started with READ EVENTS. When CLEAR EVENTS is executed, program execution continues on the program line immediately following READ EVENTS.

FIELDS   Releases a list created with SET FIELDS and executes SET FIELDS OFF. CLEAR FIELDS differs from SET FIELDS TO in that it releases all field lists for all work areas, not just the field list for the current work area. Also, SET FIELDS TO does not implicitly issue a SET FIELDS OFF.

GETS   Releases all pending @ ... GET controls. Issuing CLEAR also releases all pending @ ... GET controls.

MACROS   Releases from memory all keyboard macros, including any SET FUNCTION key assignments. Macros can be saved to a macro file or to a memo field with SAVE MACROS and restored later with RESTORE MACROS. You can also restore the default macros with RESTORE MACROS.

MEMORY   Releases from memory all public and private memory variables and arrays. System variables aren’t released.

MENUS   Releases all menu bar definitions from memory.

POPUPS   Releases from memory all menu definitions created with DEFINE POPUP.

PROGRAM   Clears the compiled program buffer. Visual FoxPro keeps a buffer of the most recently executed programs. In rare cases, Visual FoxPro might not recognize changes made to program files on disk. CLEAR PROGRAM forces Visual FoxPro to read the programs from disk, rather than from the program buffer. The most common reason Visual FoxPro might not recognize changes made to program files is your using an external or terminate-and-stay-resident (TSR) editor to modify a program file. With this exception, you should not have to use CLEAR PROGRAM.

PROMPT   Releases menu items created with @ ... PROMPT.

READ [ALL]   Included for backward compatibility. Use CLEAR EVENTS instead.

RESOURCES [FileName]   Specifies the name of a cached bitmap, picture, font, cursor, or icon file to be cleared from memory. If no file name is specified, all bitmap, picture, font, cursor and icon files are removed from memory.

When Visual FoxPro displays a bitmap, picture, cursor, icon, or font resource, the resource is cached to optimized performance. If a resource of the same name is used (for example, a different bitmap with the same name as one already cached), Visual FoxPro does not reload the resource.

Clearing a resource file is therefore particularly useful for removing a graphic image from memory and forcing Visual FoxPro to reload an image of the same name from disk. For example, a report might display graphic images from a database, all of which are named TEMP; however, because they all have the same name, Visual FoxPro will not reload each new graphic unless the existing one has been cleared from memory using the CLEAR RESOURCES command.

TYPEAHEAD   Clears the keyboard type-ahead buffer. CLEAR TYPEAHEAD is useful when you want to prevent input into a field or prevent a response to a prompt before the field or prompt is displayed.

WINDOWS   Releases from memory all user-defined window definitions and clears the windows from the main Visual FoxPro window or the active user-defined window. Use SAVE WINDOW to save window definitions in a file or memo field for later use.

Issuing CLEAR WINDOWS releases any system variable references to forms. For example, the following commands create a system variable reference for a form, and then displays information about the variable:

goMyForm = CREATEOBJECT('FORM')

DISPLAY MEMORY LIKE goMyForm  && Displays GOMYFORM  O  FORM

Issuing CLEAR WINDOWS releases the system variable reference and the variable now contains the null value:

CLEAR WINDOWS

DISPLAY MEMORY LIKE goMyForm  && Displays GOMYFORM  O  .NULL.

Remarks

CLEAR erases the main Visual FoxPro window or the current user-defined window, and releases from memory all pending @ ... GET controls. You can include CLEAR in format files.


See Also

@ ... CLEAR
CLOSE
DECLARE -DLL
READ
READ EVENTS
RELEASE
RELEASE CLASSLIB
RELEASE WINDOWS


Clear Method

Syntax         Remarks         Applies To         See Also

Clears the contents of a ComboBox or ListBox control.

Syntax

Object.Clear

Remarks

For the Clear method to have an effect, the RowSourceType property must be set to 0 (None).


Applies To

ComboBox, ListBox


See Also

AddItem Method
RemoveItem Method


Click Event

Syntax         Arguments         Remarks         Example         Applies To         See Also

Occurs when you include code in a program that triggers the event, or when the user presses and releases the left mouse button while the pointer is over a control, changes the value of certain controls, or clicks in a blank area of a form.

Syntax

PROCEDURE Object.Click
[LPARAMETERS nIndex]

Arguments

nIndex   Uniquely identifies a control if it is in a control array.

Remarks

The Click event occurs when the user:

•	Clicks a check box, command button, combo box, list box, or option button with the left mouse button.

•	Selects an item in a combo box or list box, either by using the arrow keys or by pressing the mouse button.

•	Presses the SPACEBAR when a command button, option button, or check box has the focus.

•	Presses ENTER when a form has a command button with its Default property set to true (.T.).

•	Presses the access key for a control. For example, if the caption of a command button is “\<Go”, pressing ALT+G triggers the Click event.

•	Clicks a blank area of a form. Click events on a form do not occur when the pointer is over the title bar, the Control-menu box, or the window borders.

•	Clicks the text entry area of a spinner.

•	Clicks a disabled control. The Click event occurs for the form on which the disabled control is placed.

The Click event also occurs as a result of code you include that issues the MOUSE command.


Click Event Example

The following example creates an OptionGroup control and places the control on a form. The OptionGroup control has three buttons, and depending on the option button you click, a circle, ellipse, or square appears. The ButtonCount property is used to specify the number of buttons in the OptionGroup. The Buttons and Caption properties are used to specify the text displayed next to each option button.

The Shape control is used to create the circle, ellipse, and square. The OptionGroup control’s Click event uses a DO CASE ... ENDCASE structure and the Value property to display the appropiate shape when you click an option button.

frmMyForm = CREATEOBJECT('Form')  && Create a Form

frmMyForm.Closable = .F.  && Disable the Control menu box

frmMyForm.AddObject('cmdCommand1','cmdMyCmndBtn')  && Add Command button

frmMyForm.AddObject('opgOptionGroup1','opgMyOptGrp') && Add Option Group

frmMyForm.AddObject('shpCircle1','shpMyCircle')  && Add Circle Shape

frmMyForm.AddObject('shpEllipse1','shpMyEllipse')  && Add Ellipse Shape

frmMyForm.AddObject('shpSquare','shpMySquare')  && Add Box Shape

frmMyForm.cmdCommand1.Visible =.T.  && "Quit" Command button visible

frmMyForm.opgOptionGroup1.Buttons(1).Caption = "\<Circle"

frmMyForm.opgOptionGroup1.Buttons(2).Caption = "\<Ellipse"

frmMyForm.opgOptionGroup1.Buttons(3).Caption = "\<Square"

frmMyForm.opgOptionGroup1.SetAll("Width", 100) && Set Option group width

frmMyForm.opgOptionGroup1.Visible = .T.  && Option Group visible

frmMyForm.opgOptionGroup1.Click  && Show the circle

frmMyForm.SHOW  && Display the form

READ EVENTS  && Start event processing

DEFINE CLASS opgMyOptGrp AS OptionGroup  && Create an Option Group

ButtonCount = 3  && Three Option buttons

Top = 10

Left = 10

Height = 75

Width = 100

PROCEDURE Click

ThisForm.shpCircle1.Visible = .F.  && Hide the circle

ThisForm.shpEllipse1.Visible = .F.  && Hide the ellipse

ThisForm.shpSquare.Visible = .F.  && Hide the square

DO CASE

CASE ThisForm.opgOptionGroup1.Value = 1

ThisForm.shpCircle1.Visible = .T. && Show the circle

CASE ThisForm.opgOptionGroup1.Value = 2

ThisForm.shpEllipse1.Visible = .T.  && Show the ellipse

CASE ThisForm.opgOptionGroup1.Value = 3

ThisForm.shpSquare.Visible = .T.  && Show the square

ENDCASE

ENDDEFINE

DEFINE CLASS cmdMyCmndBtn AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 210  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close Form

ENDDEFINE

DEFINE CLASS shpMyCircle AS SHAPE  && Create a circle

Top = 10

Left = 200

Width = 100

Height = 100

Curvature = 99

BackColor = RGB(255,0,0)  && Red

ENDDEFINE

DEFINE CLASS shpMyEllipse AS SHAPE  && Create an ellipse

Top = 35

Left = 200

Width = 100

Height = 50

Curvature = 99

BackColor = RGB(0,128,0)  && Green

ENDDEFINE

DEFINE CLASS shpMySquare AS SHAPE  && Create a square

Top = 10

Left = 200

Width = 100

Height = 100

Curvature = 0

BackColor = RGB(0,0,255)  && Blue

ENDDEFINE


Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, EditBox, Form, Grid, Header, Image, Label, Line, ListBox, OptionButton, OptionGroup, Page, PageFrame, Shape, Spinner, TextBox, ToolBar


See Also

DblClick Event
MiddleClick Event
MOUSE
MouseDown Event
MouseUp Event
MouseWheel Event
Value Property


ClipControls Property

Syntax         Settings         Applies To         See Also

Determines whether graphics methods in Paint events repaint the entire object or only newly exposed areas. Also determines whether the graphical operating environment creates a clipping region that excludes nongraphical controls contained by the object. Available at design time and run time.

Syntax

Object.ClipControls[ = lExpr]

Settings

lExpr   The settings for the ClipControls property are:

Setting	Description
True (.T.)	(Default) Graphics methods in Paint events repaint the entire object. A clipping region is created around nongraphical controls on a form before a Paint event.
False (.F.)	Graphics methods in Paint events repaint only newly exposed areas. A clipping region is not created around nongraphical controls.


Applies To

Form, _SCREEN


See Also

Paint Event


_CLIPTEXT System Memory Variable
_CLIPTEXT System Variable

Syntax         Arguments         Remarks         See Also

Contains the contents of the Clipboard.

Syntax

_CLIPTEXT = cExpression

Arguments

cExpression   Specifies the character expression to store in the Clipboard.

Remarks

You can place a character expression cExpression on the Clipboard with STORE or the = assignment operator.


See Also

PRIVATE
PUBLIC
STORE


CloneObject Method

Syntax         Arguments         Applies To         See Also

Duplicates an object, including all the object’s properties, events, and methods. Available only at design time.

Syntax

Object.CloneObject(NewName)

Arguments

NewName   Specifies the name of the new, or duplicate, object.


Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, Custom, EditBox, Grid, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, Page, PageFrame, Shape, Spinner, TextBox, Timer, ToolBar


See Also

SaveAs Method
SaveAsClass Method


Closable Property

Syntax         Settings         Example         Applies To         See Also

Specifies whether the form can be closed by double-clicking the Control-menu box or choosing Close from the Control menu. Available at design time and run time.

Syntax

Object.Closable[ = lExpr]

Settings

lExpr   The settings for the Closable property are:

Setting	Description
True (.T.)	(Default) The Close menu command is added to the Control menu.
False (.F.)	The form cannot be closed using the Control menu, and the Close menu command is removed from the Control menu.


Closable Property Example

The following example demonstrates how the Closable property is used to prevent a form from being closed with the Control menu. The form’s Closable property is set to false (.F.), preventing the form from being closed with the Control menu. If the form’s Closable property is set to true (.T.) and the form is closed with the Control menu, CLEAR EVENTS must be issued to stop event processing and exit the program.

frmMyForm = CREATEOBJECT('Form')  && Create a Form

frmMyForm.Closable = .F.  && Disable the Control menu box

frmMyForm.AddObject('shpLine','Line')  && Add a Line control to the form

frmMyForm.AddObject('cmdCmndBtn1','cmdMyCmndBtn1')  && Up Cmnd button

frmMyForm.AddObject('cmdCmndBtn2','cmdMyCmndBtn2')  && Down Cmnd button

frmMyForm.AddObject('cmdCmndBtn3','cmdMyCmndBtn3')  && Quit Cmnd button

frmMyForm.shpLine.Visible = .T.  && Make Line control visible

frmMyForm.shpLine.Top = 20  && Specify Line control row

frmMyForm.shpLine.Left = 125  && Specify Line control column

frmMyForm.cmdCmndBtn1.Visible =.T.  && Up Command button visible

frmMyForm.cmdCmndBtn2.Visible =.T.  && Down" Command button visible

frmMyForm.cmdCmndBtn3.Visible =.T.  && Quit Command button visible

frmMyForm.SHOW  && Display the form

READ EVENTS  && Start event processing

DEFINE CLASS cmdMyCmndBtn1 AS COMMANDBUTTON  && Create Command button

Caption = 'Slant \<Up'  && Caption on the Command button

Left = 50  && Command button column

Top = 100  && Command button row

Height = 25  && Command button height

PROCEDURE Click

ThisForm.shpLine.Visible = .F.  && Hide the Line control

ThisForm.shpLine.LineSlant ='/'  && Slant up

ThisForm.shpLine.Visible = .T.  && Show the Line control

ENDDEFINE

DEFINE CLASS cmdMyCmndBtn2 AS CommandButton  && Create Command button

Caption = 'Slant \<Down'  && Caption on the Command button

Left = 200  && Command button column

Top = 100  && Command button row

Height = 25  && Command button height

PROCEDURE Click

ThisForm.shpLine.Visible = .F.  && Hide the Line control

ThisForm.shpLine.LineSlant ='\'  && Slant down

ThisForm.shpLine.Visible = .T.  && Show the Line control

ENDDEFINE

DEFINE CLASS cmdMyCmndBtn3 AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 150  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close Form

ENDDEFINE


Applies To

Form, _SCREEN


See Also

ControlBox Property


CLOSE Commands

Syntax         Arguments         See Also

Closes various file types.

Syntax

CLOSE
[ALL | ALTERNATE | DATABASES [ALL] | DEBUGGER
| FORMAT | INDEXES | PROCEDURE | TABLES [ALL]]

Arguments

ALL   Closes all open databases, tables, and indexes in all work areas and selects work area 1. CLOSE ALL also closes any files opened with the FCREATE( ) and FOPEN( ) low-level file functions. CLOSE ALL does not close a file opened with SET PRINT.

CLOSE ALL also closes the following:

•	Form Designer

•	Project Manager

•	Label Designer

•	Report Designer

•	Query Designer

CLOSE ALL does not close these:

•	Command window

•	Debug window

•	Help

•	Trace window

CLOSE ALTERNATE   Closes an alternate file opened with SET ALTERNATE.

CLOSE DATABASES [ALL]   Closes the current database and its tables. If there is no current database, all open free tables, indexes, and format files in all work areas are closed and work area 1 is selected.

ALL

Specifies that the following are closed:

All open databases and their tables.

All open free tables.

All indexes and format files in all work areas.

Work area 1 is selected.

CLOSE DEBUGGER   Closes the Visual FoxPro debugger.

CLOSE FORMAT   Closes a format file in the current work area opened with SET FORMAT.

CLOSE INDEXES   Closes all open index files (both single-entry .IDX and independent compound .CDX files) in the current work area. A structural compound index (a .CDX file automatically opened with the table) is not closed.

CLOSE PROCEDURE   Closes a procedure file opened with SET PROCEDURE.

CLOSE TABLES [ALL]   Closes all tables in all open databases while leaving the databases open. CLOSE TABLES closes all free tables in all work areas if a database isn’t open.

CLOSE TABLES should not be issued when a transaction is in progress; Visual FoxPro will generate an error message.

ALL

Specifies that all tables, including free tables, are closed in all work areas. All databases remain open.


See Also

ADD TABLE
CLOSE MEMO
CREATE DATABASE


CLOSE MEMO Command

Syntax         Arguments         Remarks         See Also

Closes one or more memo editing windows.

Syntax

CLOSE MEMO MemoFieldName1 [, MemoFieldName2 ...] | ALL

Arguments

MemoFieldName1 [, MemoFieldName2 ...]   Specifies the name of the memo field whose memo editing window you want to close. To close a set of memo editing windows, include a list of memo field names with the field names separated by commas.You can close the memo editing window of a memo field in a table open in another work area by including the table alias.

ALL   Closes all memo editing windows for all memo fields in any open tables.

Remarks

CLOSE MEMO closes memo editing windows opened with MODIFY MEMO, or opened from a Browse window or Edit window. CLOSE MEMO saves any changes you made to the memo fields.

Closing a table containing the memo field or fields also saves any changes you made and closes the memo windows.


See Also

BROWSE
MODIFY MEMO


CloseTables Method

Syntax         Remarks         Applies To         See Also

Causes the tables and views associated with the data environment to close.

Syntax

DataEnvironment.CloseTables

Remarks

Closes the tables and views associated with Cursor objects in the data environment. You can reopen the tables and views by calling the OpenTables method.


Applies To

DataEnvironment


See Also

AfterCloseTables Event
AutoCloseTables Property
BeforeOpenTables Event
OpenTables Method


Cls Method

Syntax         Remarks         Applies To         See Also

Clears graphics and text from a form.

Syntax

Object.Cls

Remarks

Cls clears text and graphics generated at run time with graphics and printing statements. Background bitmaps created using the Picture property and controls placed on the form at design time are not affected by the Cls method.

The Cls method resets the CurrentX and CurrentY properties to 0.


Applies To

Form, _SCREEN


See Also

Circle Method
CurrentX
CurrentY Properties
Line Method
Picture Property


CMONTH( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the name of the month from a given date or DateTime expression.

Syntax

CMONTH(dExpression | tExpression)

Returns

Character

Arguments

dExpression   Specifies the date expression from which CMONTH( ) returns the name of the month.

tExpression   Specifies the DateTime expression from which CMONTH( ) returns the name of the month.

Remarks

CMONTH( ) returns the name of the month as a string in proper noun format.


CMONTH( ) Function Example

? CMONTH(DATE( ))

STORE {02/16/95} TO gdDueDate

? 'Your payment was due in ', CMONTH(gdDueDate)

STORE gdDueDate+60 TO gdFinalDate

? 'You must pay by ', CMONTH(gdFinalDate)


See Also

DMY( )
MDY( )
MONTH( )


CNTBAR( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the number of menu items on a user-defined menu or the Visual FoxPro system menu.

Syntax

CNTBAR([cMenuName])

Returns

Numeric

Arguments

cMenuName   Specifies the name of the menu for which CNTBAR( ) returns the number of menu items. For a list of the Visual FoxPro system menu names, see the System Menu Names topic.

If you omit cMenuName, CNTBAR( ) returns the number of menu items on an active menu created with DEFINE POPUP.

Remarks

If a user-defined menu is created with the PROMPT option in DEFINE POPUP, Visual FoxPro evaluates the number of menu items when you issue ACTIVATE POPUP. For such a menu, CNTBAR( ) returns a meaningful value only after you activate the menu. However, if the menu items in the menu are created with DEFINE BAR, CNTBAR( ) can determine the number of menu items before you issue ACTIVATE POPUP.


CNTBAR( ) Function Example

In the following program example, named CNTBAR.PRG, a menu title is added to the system menu. The menu popEnv is created with four menu items. The program places a mark character by each item when the item is selected. CNTBAR( ) is used within a loop to initially display marks next to the appropriate menu items.

*** You must name this program CNTBAR.PRG ***

CLEAR

SET TALK OFF

DEFINE PAD padEnv OF _MSYSMENU PROMPT 'E\<nvironment';

KEY ALT+R, 'ALT+R'

ON PAD padEnv OF _MSYSMENU ACTIVATE POPUP popEnv

DEFINE POPUP popEnv MARGIN RELATIVE SHADOW COLOR SCHEME 4

DEFINE BAR 1 OF popEnv PROMPT '\<Status Bar'

DEFINE BAR 2 OF popEnv PROMPT '\<Clock'

DEFINE BAR 3 OF popEnv PROMPT '\<Extended Video'

DEFINE BAR 4 OF popEnv PROMPT 'St\<icky'

ON SELECTION POPUP popEnv DO enviropop IN cntbar.prg

FOR i = 1 TO CNTBAR('popEnv')

DO CASE

CASE PRMBAR('popEnv', i) = 'Status Bar'

SET MARK OF BAR i OF popEnv TO  SET('STATUS') = 'ON'

CASE PRMBAR('popEnv', i) = 'Clock'

SET MARK OF BAR i OF popEnv TO  SET('CLOCK') = 'ON'

CASE PRMBAR('popEnv', i) = 'Extended Video'

SET MARK OF BAR i OF popEnv TO  SROW( ) > 25

CASE PRMBAR('popEnv', i) = 'Sticky'

SET MARK OF BAR i OF popEnv TO  SET('STICKY') = 'ON'

ENDCASE

ENDFOR

PROCEDURE enviropop

DO CASE

CASE PROMPT() = 'Status'

IF mrkbar('popEnv', bar( ))

DO CASE

CASE _WINDOWS OR _MAC

SET STATUS BAR OFF

CASE _DOS

SET STATUS OFF

OTHERWISE

ENDCASE

SET MARK OF BAR bar( ) OF popEnv TO .F.

ELSE

DO CASE

CASE _WINDOWS OR _MAC

SET STATUS BAR ON

CASE _DOS

SET STATUS ON

OTHERWISE

ENDCASE

SET MARK OF BAR bar( ) OF popEnv TO .T.

ENDIF

CASE PROMPT( ) = 'Clock'

IF mrkbar('popEnv', bar( ))

SET CLOCK OFF

SET MARK OF BAR bar( ) OF popEnv TO .F.

ELSE

DO CASE

CASE _WINDOWS OR _MAC

SET STATUS BAR ON

SET CLOCK STATUS

CASE _DOS

SET CLOCK ON

OTHERWISE

ENDCASE

SET MARK OF BAR bar( ) OF popEnv TO .T.

ENDIF

CASE PROMPT( ) = 'Extended Video'

IF MRKBAR('popEnv', bar( ))

SET DISPLAY TO VGA25

SET MARK OF BAR bar( ) OF popEnv TO .F.

ELSE

SET DISPLAY TO VGA50

SET MARK OF BAR bar( ) OF popEnv TO .T.

ENDIF

CASE PROMPT( ) = 'Sticky'

IF MRKBAR('popEnv', bar( ))

DO CASE

CASE _WINDOWS OR _MAC

WAIT WINDOW 'STICKY is always on in this Visual FoxPro version'

CASE _DOS

SET STICKY OFF

OTHERWISE

ENDCASE

SET MARK OF BAR bar( ) OF popEnv TO .F.

ELSE

DO CASE

CASE _WINDOWS OR _MAC

WAIT WINDOW 'STICKY is always ON in Visual FoxPro'

CASE _DOS

SET STICKY ON

OTHERWISE

ENDCASE

   	SET MARK OF BAR bar( ) OF popEnv TO .T.

ENDIF

ENDCASE


See Also

ACTIVATE POPUP
CNTPAD( )
CREATE MENU
DEFINE BAR
DEFINE POPUP
GETBAR( )
MRKBAR( )
ON BAR
ON SELECTION BAR
PRMBAR( )


CNTPAD( ) Function

Syntax         Returns         Arguments         Example         See Also

Returns the number of menu titles on a user-defined menu bar or the Visual FoxPro system menu bar.

Syntax

CNTPAD(cMenuBarName)

Returns

Numeric

Arguments

cMenuBarName   Specifies the name of the menu bar for which CNTPAD( ) returns the number of menu titles.


CNTPAD( ) Function Example

The following command uses CNTPAD( ) to display the number of menu titles in the Visual FoxPro system menu bar.

? CNTPAD('_MSYSMENU')


See Also

ACTIVATE MENU
CNTBAR( )
CREATE MENU
DEFINE PAD
DEFINE MENU
GETPAD( )
MRKPAD( )
ON PAD
ON SELECTION PAD
PRMPAD( )


COL( ) Function

Included for backward compatibility. Use the CurrentX property.


Colors Overview

See Also

Visual FoxPro offers a sophisticated set of commands for full control of colors.

By default, Visual FoxPro takes its colors from the operating system’s Control Panel settings. At startup, the Control Panel colors are mapped to the Visual FoxPro default color schemes. You can set colors directly with the SET COLOR commands or interactively in the Control Panel. Refer to your Windows documentation for more information about setting colors with the Control Panel.

Not all Visual FoxPro interface elements can be controlled by color schemes — for example, system elements such as the Data Session window and Command window, the system menu bar, and so on.

Colors Terms

The following color terms are used throughout the FoxPro documentation.

Color Pair

A color pair contains two color codes that specify the foreground and background colors. A color pair consists of a set of two letters separated by a forward slash; the first letter specifying the foreground color and the second letter specifying the background color.

For example, the following color pair specifies a red foreground on a white background:

R/W

The following table lists the available colors and their codes.

Color	Code
Black	N
Blank	X
Blue	B
Brown	GR
Cyan	BG
Green	G
Inverse	I
Magenta	RB
Red	R
White	W
Yellow	GR+
Underlined	U
An asterisk (*) placed immediately after a color code can be used to denote blinking or bright (depending on your video hardware and the setting for SET BLINK) for the background color. In Visual FoxPro, including an asterisk makes the background bright rather than blinking. A plus sign (+) placed immediately after a color code can be used to denote high intensity for the foreground color.

On monochrome monitors, only four colors are available: white (W), black (N), underlined (U), and inverse video (I). The blank (X) color is useful for entering passwords.

RGB Color Pairs

A color pair can also be specified with a set of six RGB (red, green, and blue) color values separated by commas. These values range from 0 (lowest intensity or no color) to 255 (high intensity or bright color). Each foreground and background color requires three values, one for red, one for green, and one for blue. A color pair, therefore, requires six values, three for the foreground and three for the background.

Here is the RGB color code for red on dark gray (high intensity black):

RGB(255,0,0,64,64,64)

The first three values in the RGB expression above set the foreground color to red and the second three values set the background color to dark gray.

The following is a table of the colors that are available in Visual FoxPro, including the color codes and the corresponding RGB values.

Color	Color code	RGB value
White	W+	255,255,255
Black	N	0,0,0
Dark Gray	N+	64,64,64 (25% gray)
Gray	W	192,192,192
Red	R+	255,0,0
Dark Red	R	128,0,0
Yellow	GR+	255,255,0
Dark Yellow	GR	128,128,0
Green	G+	0,255,0
Dark Green	G	0,128,0
Cyan	BG+	0,255,255
Dark Cyan	BG	0,128,128
Blue	B+	0,0,255
Dark Blue	B	0,0,128
Magenta	RB+	255,0,255
Dark Magenta	RB	128,0,128
Blank	X	N/A
When using RGB values, the following rules determine the color:

•	When all three color values (R, G or B) are below 32, the color is black.

•	When all three color values (R, G or B) are between 32 and 64, the character code is dark gray.

•	When all three color values (R, G or B) are between 65 and 191, the character code is gray.

•	When any of the three color values (R, G or B) are above 191, the color is high intensity (+ or *).

Color Pair List

A color-pair list consists of one to ten color pairs separated by commas. For example:

W+/B, W+/BG, GR+/B, GR+/B, R+/B, W+/GR, GR+/RB, N+/N, GR+/B, R+/B

A color-pair list for a monochrome monitor might look like this:

W/N, N+/W, W+/N, W+/N, W/N, U+/N, W+/N, -, W+/N, W/N

Color-pair lists for monochrome monitors might have a dash (-) in the eighth color-pair location to indicate that a shadow isn’t present.

Color pairs can also be specified as a set of RGB (red, green, and blue) values. A set of RGB color values looks like this:

RGB(0,255,0,255,0,0), RGB(127,255,0,0,0,0), ...

Color Scheme

A color scheme is a set of 10 color pairs. Use SCHEME( ) or RGBSCHEME( ) to return the color pairs for a color scheme.

Color schemes control the colors of interface elements such as system windows, user-defined windows, menus, and so on. In Visual FoxPro, the color of some interface elements are not controlled by a color scheme. For example, the colors of the Data Session window and Command window, the system menu bar, and so on cannot be controlled by a color scheme.

In your configuration file, you can specify your own startup color schemes. Include the following line for each color scheme you want to change:

COLOR OF SCHEME nScheme = Colorpairlist

Note   In Visual FoxPro, color schemes 13 through 15 are reserved for internal use. In FoxPro for Windows, color schemes 13 and 14 are reserved for internal use. In FoxPro for Macintosh, color schemes 13 through 16 are reserved for internal use. Do not use these color schemes.

Color Set

A color set consists of 24 color schemes. You can save the complete color environment in a color set. Color sets are not supported in FoxPro for Macintosh.

Color sets, like keyboard macros and memory variables, can be saved for later use. A color set can be saved with CREATE COLOR SET. Color sets are stored in the FOXUSER.DBF resource file.

You can load a color set with SET COLOR SET.

When Visual FoxPro is first started, the Control Panel color settings are loaded into the default color set.To specify a startup color set in your configuration file, include the following line:

COLOR SET = ColorSetName


See Also

CREATE COLOR SET, GETCOLOR( ), RGB( ), RGBSCHEME( ), SET COLOR OF SCHEME, SET COLOR SET, SET COLOR TO


ColorScheme Property

Included for backward compatibility. Use the BackColor, ForeColor properties instead.


ColorSource Property

Syntax         Settings         Remarks         Applies To         See Also

Determines how a control’s colors are set. Available at design time and run time.

Syntax

Object.ColorSource[ = nSource]

Settings

nSource   The settings for nSource are:

Setting	Description
0	Object’s Color Properties. The control uses its color property settings (ForeColor, BackColor, and so on).
1	Form’s Color Scheme. The control uses the color scheme of the form in which it is placed.
2	ColorScheme Property Scheme. The control uses the color scheme specified in its ColorScheme property.
3	Default Scheme. The control uses its default color scheme. For most controls, the default color scheme is the form’s color scheme; for EditBoxes and ListBoxes, the default color scheme is Scheme 2, User Menus.
4	Windows Control Panel (3D Colors) (Default). The control uses the 3D color settings specified in the Windows Control Panel.
5	Windows Control Panel (Windows Colors). The control uses the color settings specified in the Windows Control Panel.
Remarks

Setting a color property (ForeColor, BackColor, SelectedForeColor, and so on) for an object overrides the ColorSource property setting. If a color property is not set for an object, the object’s colors are determined by the ColorSource property setting.


Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, Container, Control, EditBox, Form, Image, Label, Line, ListBox, OptionButton, OptionGroup, Page, PageFrame, Shape, Spinner, TextBox, Toolbar


See Also

ColorScheme Property


Column Object

Syntax         Remarks         Properties         Events         Methods         See Also

Creates a Column in a Grid.

Syntax

Column

Remarks

The number of Columns in a Grid is specified with the Grid’s ColumnCount property.

A Column in a Grid can contain data from a field in a table, or the value of an expression. Use the DataSource property to specify the data that appears in the Column.

A Column can also contain controls. Controls are added to a Column in a Grid with the AddObject method in the Init event for the form containing the Grid. Use the column’s CurrentControl property to set the active control in the Grid’s column. Set the control’s ControlSource property to specify the source of the control’s data.

Note that headers and controls for a Column cannot be accessed until the Init event for the Grid occurs.

For additional information about creating Columns in a Grid, see the Grid Control topic and Chapter 10, “Using Controls,” in the Developer’s Guide.


Properties

Alignment	BackColor	BaseClass
Bound	Class	ClassLibrary
ColumnOrder	ControlCount	Controls
ControlSource	CurrentControl	DynamicAlignment
DynamicBackColor	DynamicCurrentControl	DynamicFontBold
DynamicFontItalic	DynamicFontName	DynamicFontOutline
DynamicFontShadow	DynamicFontSize	DynamicFontStrikeThru
DynamicFontUnderline	DynamicForeColor	DynamicInputMask
Enabled	FontBold	FontCondense
FontExtend	FontItalic	FontName
FontOutline	FontShadow	FontSize
FontStrikeThru	FontUnderline	ForeColor
Format	InputMask	Movable
Name	Parent	ParentClass
ReadOnly	Resizable	SelectOnEntry
Sparse	Visible	Width


Events

MouseMove	MouseWheel	Moved
Resize


Methods

AddObject	Move	ReadExpression
ReadMethod	Refresh	RemoveObject
ResetToDefault	SetAll	SetFocus
WriteExpression	WriteMethod	ZOrder


See Also

CREATE CLASS
CREATE FORM
DEFINE CLASS
Grid Control
Header Object


ColumnCount Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the number of Column objects in a Grid, ComboBox, or ListBox control. For a grid, available at design time and read-write at run time. For a combo box or list box, available at design time and run time.

Syntax

Object.ColumnCount[ = nCol]

Settings

nCol   For a Grid control, specifies the number of columns to display. The default is –1, which specifies that the Grid control should contain enough columns to accommodate all the fields in the grid’s record source. If you create a specific number of columns by setting nCol to a positive value, specify the data to display in a particular column by setting that column’s ControlSource property. (If ControlSource is not specified for a column, the Grid control displays the next available undisplayed field of the grid’s record source.)

For a ComboBox or ListBox control, nCol specifies the number of columns the control contains. If you set ColumnCount to 0, the first column is displayed based on the RowSource property or on the items added with the AddItem method.

Remarks

For a grid, use the AddColumn method to increase the number of columns.


Applies To

ComboBox, Grid, ListBox


See Also

AddColumn Method
Order Property


ColumnLines Property

Syntax         Settings         Applies To         See Also

Shows or hides the lines between columns. Available at design time and run time.

Syntax

Control.ColumnLines[ = lExpr]

Settings

lExpr   Specifies whether lines separating columns are displayed. The settings for the ColumnLines property are:

Setting	Description
True (.T.)	(Default) The lines between columns are visible.
False (.F.)	The lines between columns are hidden.


Applies To

ComboBox, ListBox


See Also

ColumnWidths Property


ColumnOrder Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the relative order of column objects in a Grid control. Available at design time and run time.

Syntax

Column.ColumnOrder[ = nExpr]

Settings

nExpr   Specifies the order of a column relative to other columns in the grid.

Remarks

If a Grid contains five columns and you want the third column displayed last, set the ColumnOrder property of the third column to 5. The ColumnOrder setting for the fourth column becomes 3, the ColumnOrder setting for the fifth column becomes 4, and so on.

Note   ColumnOrder settings do not have to be sequential. There can be gaps. For example, if a Grid contains three columns, you can add a fourth and set its ColumnOrder property to 10.


Applies To

Column


See Also

Activate Event
Deactivate Event
ZOrder Method


Columns Property

Syntax         Settings         Remarks         Applies To         See Also

An array for accessing individual Column objects in the Grid control by column number. Available at design time and read-only at run time.

Syntax

Grid.Columns(nCol).Property [ = Setting]

Settings

nCol   Specifies the column in agGrid whose property is referenced. The far left Column is number 1.

Property   Specifies the column’s property to access.

Setting   Specifies the new property setting for all cells specified with nCol.

Remarks

Use the Columns property to access the properties of a particular Column in a Grid. For example, SpecialGrid.Column(1).BackColor = RGB(255,0,0) changes the BackColor property of all the cells in Column 1 to bright red.


Applies To

Grid


See Also

Column Object
ColumnCount Property
SetAll Method


ColumnWidths Property

Syntax         Settings         Applies To         See Also

Specifies the width of columns for a ComboBox or ListBox control. Available at design time and run time.

Syntax

Control.ColumnWidths[ = “cCol1Width, cCol2Width, ... cColnWidth”]

Settings

“cCol1Width, cCol2Width, ... cColnWidth”   Specifies the width of a column or series of columns in the ComboBox or ListBox. For example, cColumnWidths = “5, 7, 9” specifies that the first column is 5 units wide, the second column is 7 units wide, and the third column is 9 units wide, in the unit of measurement specified by the ScaleMode property of the form. Use commas to separate each width number. You can specify the number of columns with the ColumnCount property.


Applies To

ComboBox, ListBox


See Also

ColumnCount Property
ScaleMode Property
Width Property


ComboBox Control

Syntax         Remarks         Properties         Events         Methods         See Also

Creates a combo box.

Syntax

ComboBox

Remarks

When selected, the ComboBox control opens, displaying a list of items from which you can choose one. A ComboBox control combines the features of a TextBox control and a ListBox control. You can enter information in the text box portion or select an item from the list box portion of the control.

An item in a ComboBox control can be disabled by placing a backslash (\) before the item. If the item begins with a backslash and should not be disabled, add an additional backslash.

The Style property determines the ComboBox control type. If the Style property is set to 0, a drop-down ComboBox control is created. If the Style property is set to 2, a drop-down list box is created.

For additional information about ComboBox controls, see the Form Designer topic and Chapter 10, “Using Controls,” in the Developer’s Guide.


Properties

Alignment	BackColor	BaseClass
BorderColor	BorderStyle	BoundColumn
BoundTo	Class	ClassLibrary
ColorScheme	ColorSource	ColumnCount
ColumnLines	ColumnWidths	Comment
ControlSource	DisabledBackColor	DisabledForeColor
DisabledItemBackColor	DisabledItemForeColor	DisplayValue
DragIcon	DragMode	Enabled
FirstElement	FontBold	FontCondense
FontExtend	FontItalic	FontName
FontOutline	FontShadow	FontSize
FontStrikeThru	FontUnderline	ForeColor
Format	Height	HelpContextID
HideSelection	IncrementalSearch	InputMask
ItemBackColor	ItemData	ItemForeColor
ItemIDData	Left	List
ListCount	ListIndex	ListItem
ListItemID	Margin	MousePointer
Name	NewIndex	NewItemID
NumberOfElements	Parent	ParentClass
ReadOnly	RightToLeft	RowSource
RowSourceType	Selected	SelectedBackColor
SelectedForeColor	SelectedID	SelectedItemBackColor
SelectedItemForeColor	SelLength	SelStart
SelText	Sorted	SpecialEffect
StatusBarText	Style	TabIndex
TabStop	Tag	Text Property
TerminateRead	ToolTipText	Top
TopIndex	TopItemID	Value
Visible	Width


Events

Click	DblClick	Destroy
DownClick	DragDrop	DragOver
DropDown	Error	ErrorMessage
GotFocus	Init	InteractiveChange
KeyPress	LostFocus	Message
MiddleClick Event	MouseDown	MouseMove
MouseUp	MouseWheel	ProgrammaticChange
RangeHigh	RangeLow	RightClick
UIEnable	UpClick	Valid
When


Methods

AddItem	AddListItem	Clear
CloneObject	Drag	IndexToItemID
ItemIDToIndex	Move	ReadExpression
ReadMethod	Refresh	RemoveItem
RemoveListItem	Requery	ResetToDefault
SaveAsClass	SetFocus	UIEnable
WriteExpression	WriteMethod	ZOrder


See Also

CREATE CLASS
CREATE FORM
DEFINE CLASS


CommandButton Control

Syntax         Remarks         Properties         Events         Methods         Example         See Also

Creates a single command button.

Syntax

CommandButton

Remarks

A command button is typically used to start an event that performs an action such as closing a form, moving to a different record, printing a report, and so on. Use the CommandGroup control to create a set of command buttons that you can manipulate individually or as a group.

Use the Caption property to specify the text that appears on a command button. Use the Picture property to specify a picture for a command button.

You can choose a command button by clicking it, and, if the Default property is set to true (.T.), by pressing the ENTER key when the command button is selected. If the Cancel property of the command button is set to true (.T.), you can choose the command button by pressing the ESC key.

For additional information about command buttons, see the Form Designer topic and Chapter 10, “Using Controls,” in the Developer’s Guide.


Properties

AutoSize	BaseClass	Cancel
Caption	ClassLibrary	Class
ColorScheme	ColorSource	Comment
Default	DisabledForeColor	DisabledPicture
DownPicture	DragIcon	DragMode
Enabled	FontBold	FontCondense
FontExtend	FontItalic	FontName
FontOutline	FontShadow	FontSize
FontStrikeThru	FontUnderline	ForeColor
Height	HelpContextID	Left
MousePointer	Name	Parent
ParentClass	Picture	RightToLeft
SpecialEffect	StatusBarText	Style
TabIndex	TabStop	Tag
TerminateRead	ToolTipText	Top
Visible	Width	WordWrap Property


Events

Click	Destroy	DragDrop
DragOver	Error	ErrorMessage
GotFocus	Init	InteractiveChange
KeyPress	LostFocus	Message
MiddleClick Event	MouseDown	MouseMove
MouseUp	MouseWheel	RightClick
UIEnable	Valid	When


Methods

CloneObject	Drag	Move
ReadExpression	ReadMethod	Refresh
ResetToDefault	SaveAsClass	SetFocus
WriteExpression	WriteMethod	ZOrder


CommandButton Control Example

The following example demonstrates how command buttons can be added to a form. The Caption property is used to specify the text on the command buttons and the text indicating each button’s access key sequence. The Cancel property is used to specify a button that is chosen when you press ESC.

The AddObject method is used to add three command buttons to the form, allowing you to change the direction in which a Line control slants or to close the form.

frmMyForm = CREATEOBJECT('Form')  && Create a Form

frmMyForm.Closable = .F.  && Disable the Control menu box

frmMyForm.AddObject('shpLine','Line')  && Add a Line control to the form

frmMyForm.AddObject('cmdCmndBtn1','cmdMyCmndBtn1')  && Up Cmnd button

frmMyForm.AddObject('cmdCmndBtn2','cmdMyCmndBtn2')  && Down Cmnd button

frmMyForm.AddObject('cmdCmndBtn3','cmdMyCmndBtn3')  && Quit Cmnd button

frmMyForm.shpLine.Visible = .T.  && Make Line control visible

frmMyForm.shpLine.Top = 20  && Specify Line control row

frmMyForm.shpLine.Left = 125  && Specify Line control column

frmMyForm.cmdCmndBtn1.Visible =.T.  && Up Command button visible

frmMyForm.cmdCmndBtn2.Visible =.T.  && Down" Command button visible

frmMyForm.cmdCmndBtn3.Visible =.T.  && Quit Command button visible

frmMyForm.SHOW  && Display the form

READ EVENTS  && Start event processing

DEFINE CLASS cmdMyCmndBtn1 AS CommandButton  && Create Command button

Caption = 'Slant \<Up'  && Caption on the Command button

Left = 50  && Command button column

Top = 100  && Command button row

Height = 25  && Command button height

PROCEDURE Click

ThisForm.shpLine.Visible = .F.  && Hide the Line control

ThisForm.shpLine.LineSlant ='/'  && Slant up

ThisForm.shpLine.Visible = .T.  && Show the Line control

ENDDEFINE

DEFINE CLASS cmdMyCmndBtn2 AS CommandButton  && Create Command button

Caption = 'Slant \<Down'  && Caption on the Command button

Left = 200  && Command button column

Top = 100  && Command button row

Height = 25  && Command button height

PROCEDURE Click

ThisForm.shpLine.Visible = .F.  && Hide the Line control

ThisForm.shpLine.LineSlant ='\'  && Slant down

ThisForm.shpLine.Visible = .T.  && Show the Line control

ENDDEFINE

DEFINE CLASS cmdMyCmndBtn3 AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 150  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close Form

ENDDEFINE


See Also

CommandGroup Control
CREATE CLASS
CREATE FORM
DEFINE CLASS


CommandGroup Control

Syntax         Remarks         Properties         Events         Methods         See Also

Creates a group of command buttons.

Syntax

CommandGroup

Remarks

Use the CommandGroup control to create a set of command buttons that you can manipulate individually or as a group. Use the CommandButton control to create an individual command button.

Use the ButtonCount property to specify the number of command buttons in the group, and the Caption property to specify a label for the command button group.

For additional information about command button groups, see the Form Designer topic and Chapter 10, “Using Controls,” in the Developer’s Guide.


Properties

AutoSize	BackColor	BackStyle
BaseClass	BorderColor	BorderStyle
ButtonCount	Buttons	Class
ClassLibrary	ColorSource	Comment
ControlSource	DragIcon	DragMode
Enabled	Height	HelpContextID
Left	MousePointer	Name
Parent	ParentClass	SpecialEffect
TabIndex	Tag	TerminateRead
Top	Value	Visible
Width


Events

Click	DblClick	DragDrop
DragOver	Error	ErrorMessage
Init	InteractiveChange	Message
MiddleClick Event	MouseDown	MouseMove
MouseUp	MouseWheel	ProgrammaticChange
RightClick	UIEnable	Valid
When


Methods

AddObject	CloneObject	Drag
Move	ReadExpression	ReadMethod
Refresh	RemoveObject	ResetToDefault
SaveAsClass	SetAll	WriteExpression
WriteMethod	ZOrder


See Also

CommandButton Control
CREATE CLASS
CREATE FORM
DEFINE CLASS


Comment Property

Syntax         Settings         Remarks         Applies To         See Also

Stores information about an object. Available at design time and run time.

Syntax

Object.Comment[ = cTextString]

Settings

cTextString   Specifies a text string.

Remarks

Unlike other properties, the value of the Comment property is not used by Visual FoxPro; you can use this property to identify or describe objects.

You can use this property to assign an identification string to an object without affecting any of its other property settings. The Comment property is useful for checking the identity of a control or form that is passed as a variable to a procedure.

By default, the Comment property is set to a zero-length string ("").

Tip   When you create a new instance of a form, assign a unique value to the Comment property.


Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, Custom, EditBox, Form, FormSet, Grid, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, Page, PageFrame, _SCREEN, Shape, Spinner, TextBox, Timer, ToolBar


See Also

Caption Property
Name Property


COMPILE Command

Syntax         Arguments         Remarks         See Also

Compiles one or more source files and creates an object file for each source file.

Syntax

COMPILE [CLASSLIB | LABEL | REPORT] FileName | FileSkeleton | ?
[ENCRYPT] [NODEBUG]
[AS nCodePage]

Arguments

CLASSLIB   Specifies that the file to compile is a visual class library (.VCX). Visual class library source code is stored in memo fields in the visual class library table. COMPILE CLASSLIB compiles these memo fields into object code that is stored in an additional memo field.

LABEL   Specifies that the file to compile is a label definition file (.LBX). Source code for the data environment saved with the label definition file is compiled and stored in an additional memo field.

REPORT   Specifies that the file to compile is a report definition file (.FRX). Source code for the data environment saved with the report definition file is compiled and stored in an additional memo field.

FileName | FileSkeleton   Specifies for compilation a single file FileName or a set of files that match a file skeleton FileSkeleton containing wildcards such as * and ?. For example, to compile all program files with the extension .PRG in the current directory or folder, issue COMPILE *.PRG.

?   Displays the Compile dialog box, allowing you to choose a file to compile.

ENCRYPT   Encrypts your compiled Visual FoxPro programs. Cannot be used with the CLASSLIB, LABEL, and REPORT keywords. This keyword prevents any access to your original source programs. For additional source code protection, always include this option when compiling programs intended for distribution.

NODEBUG   Reduces the size of your compiled file by 2 bytes per source file line. Cannot be used with the CLASSLIB, LABEL, and REPORT keywords. The two bytes in the compiled file are a reference to the corresponding line in the source file. Removing these two bytes doesn’t affect the program’s performance, but it does reduce your compiled file size, and conserves disk space.

When you include NODEBUG, you cannot view a program’s execution in the Trace window or use MESSAGE(1) to return the source code for a line that causes an error.

AS nCodePage   Specifies the code page for which the program is compiled. Cannot be used with the CLASSLIB, LABEL, and REPORT keywords. The compilation code page you specify with this clause overrides the global compilation code page specified with SET CPCOMPILE.

Remarks

Visual FoxPro executes only object files, so if a source file hasn’t been compiled it is automatically compiled when you run the program. The source file remains unchanged. A separate compiled file is created with the same root name as the source file, but with a different extension. The following table lists the source and compiled file extensions for each file type:

File type	Source extension	Compiled extension
Program file	PRG	FXP
Form code	SPR	SPX
Menu code	MPR	MPX
Query	QPR	QPX
Format	FMT	PRX
The compiler detects any syntax errors in the source file. Compilation error messages are saved to a text file if SET LOGERRORS is ON when the file is compiled. The error log file has the same root name as the compiled file, and has an .ERR extension. If SET LOGERRORS is OFF, the error log file isn’t created.


See Also

BUILD APP
BUILD PROJECT
#DEFINE ... #UNDEF
#IF ... #ENDIF
#IFDEF | #IFNDEF ... #ENDIF
#INCLUDE
MODIFY COMMAND
MODIFY PROJECT
SET CPCOMPILE
SET LOGERRORS


COMPILE DATABASE Command

Syntax         Arguments         Remarks         Example         See Also

Compiles stored procedures in a database.

Syntax

COMPILE DATABASE DatabaseName

Arguments

DatabaseName   Specifies the name of the database containing the stored procedures to compile. You can compile stored procedures in a database that is not open.

Remarks

Use COMPILE DATABASE to compile stored procedures outside the Database Designer. Stored procedures can be created and modified interactively with MODIFY PROCEDURES, or programmatically with APPEND PROCEDURES.

COMPILE DATABASE requires exclusive use of the database. To open a database for exclusive use, include EXCLUSIVE in OPEN DATABASE.


COMPILE DATABASE Command Example

The following example compiles all stored procedures in the testdata database.

CLOSE DATABASES

COMPILE DATABASE (SYS(2004) + 'samples\data\testdata')


See Also

APPEND PROCEDURES
COPY PROCEDURES
CREATE TRIGGER
DISPLAY PROCEDURES
MODIFY PROCEDURE
OPEN DATABASE


COMPILE FORM Command

Syntax         Arguments         Remarks         See Also

Compiles one or more Form objects.

Syntax

COMPILE FORM FormName | cFileSkeleton [ALL]

Arguments

FormName   Specifies the name of the form to compile.

cFileSkeleton   Specifies a subset of form files to compile. cFileSkeleton is a file specification skeleton that supports wildcards. For example, to compile all Form objects that begin with A, use the following command:

COMPILE FORM A*

ALL   Compiles all records for all Visual FoxPro platforms in the Form table. If you omit ALL, only records for the current Visual FoxPro platform are compiled.

Remarks

Forms are automatically compiled when they are saved in the Form Designer. Use COMPILE FORM to compile a form outside the Form Designer.

Form source code is stored in memo fields in the Form table. COMPILE FORM compiles these memo fields into object code that is stored in an additional memo field. The object code in this additional field is executed when you issue DO FORM.

Note that if a form has an include (.H) file and the include file is moved from its original directory, a compilation error occurs and is listed in the .ERR error log file. The form can be run, but cannot be saved if modified until you correct the path to the include file. To correct the path to the include file, open the form with MODIFY FORM, choose Include File from the Form menu, and specify the include file with its new path in the Include File dialog box.


See Also

CREATE FORM
DO FORM
MODIFY FORM


COMPOBJ( ) Function

Syntax         Arguments         Returns         Remarks         Example         See Also

Compares the properties of two objects and returns true (.T.) if their properties and property values are identical.

Syntax

COMPOBJ(oExpression1, oExpression2)

Arguments

oExpression1, oExpression2   Specifies the objects to compare. oExpression1 and oExpression2 can be any expressions that evaluate to objects, such as object references, object variables, or object array elements.

Returns

Logical

Remarks

COMPOBJ( ) returns false (.F.) if an object has a property that the other object doesn’t have, or if the objects have identical properties but the values of one or more properties differ.


COMPOBJ( ) Function Example

In the following example, two ListBoxes named lstMyList1 and lstMyList2 and a ComboBox named cmbMyCombo are created. The Name property of each ListBox is displayed.

COMPOBJ( ) is used to compare the properties of the first ListBox with the properties of the ComboBox. Because many of the properties are different, .F. is displayed. COMPOBJ( ) is then used to compare the properties of the first ListBox with the properties of the second ListBox. Because the Names properties are different, .T. is displayed. The second ListBox lstMyList2 is replaced with the first ListBox lstMyList1, and COMPOBJ( ) is used to compare the properties. Because their properties are identical, .T. is displayed.

lstMyList1 = CREATEOBJ('ListBox')  && Creates a ListBox

lstMyList2 = CREATEOBJ('ListBox')  && Creates a second ListBox

cmbMyCombo = CREATEOBJ('ComboBox')  && Creates a ComboBox

CLEAR

? lstMyList1.Name  && Displays List1 Name property

? lstMyList2.Name  && Displays List2 Name property

? COMPOBJ(lstMyList1, cmbMyCombo)	  && Displays .F.

? COMPOBJ(lstMyList1, lstMyList2)	  && Displays .F., different Names

lstMyList2.Name = lstMyList1.Name

? COMPOBJ(lstMyList1, lstMyList2)	  && Displays .T., same properties


See Also

CREATEOBJECT( )
DEFINE CLASS
GETOBJECT( )
SET CLASSLIB


Container Object

Syntax         Remarks         Properties         Events         Methods         See Also

Creates an object that can contain other objects.

Syntax

Container

Remarks

Container objects can contain other objects and allow access to the objects contained within them. For example, if you create a container object that contains two list boxes and two command buttons, and then add the container object to a form, the list boxes and command buttons can be manipulated at design time and at run time.

For more information about container objects and how they differ from other objects and controls, see Chapter 3, “Object-Oriented Programming,” in the Developer’s Guide.

For additional information about adding objects to a container, see “Adding Objects” to a Container Class in Chapter 3, “Object-Oriented Programming” in the Developer’s Guide.


Properties

BackColor	BackStyle	BaseClass
BorderColor	BorderWidth	Class
ClassLibrary	ColorSource	Comment
ControlCount	Controls	DragIcon
DragMode	Enabled	ForeColor
Height	HelpContextID	Left
MousePointer	Name	ParentClass
Picture	SpecialEffect	TabIndex
TabStop	Top	Visible
Width


Events

Click	DblClick	Destroy
DragDrop	DragOver	Error
GotFocus	Init	LostFocus
MiddleClick Event	MouseDown	MouseMove
MouseUp	MouseWheel	Moved
Resize	RightClick	UIEnable


Methods

AddObject	Drag	Draw
Move	Refresh	RemoveObject
ResetToDefault	SaveAsClass	SetAll
SetFocus	ZOrder


See Also

CREATE CLASS
CREATE FORM
DEFINE CLASS


CONTINUE Command

Syntax         Remarks         Example         See Also

Continues the previous LOCATE.

Syntax

CONTINUE

Remarks

CONTINUE is used after LOCATE succeeds in finding a record, to continue the LOCATE operation. CONTINUE moves the record pointer to the next record for which the logical expression specified in the previous LOCATE evaluates to true (.T.).

CONTINUE can be repeated until the end of the file is encountered, or until the end of the scope you specified with LOCATE is reached.

If CONTINUE succeeds in finding a record, RECNO( ) returns the record number of the record, FOUND( ) returns a value of true (.T.), and EOF( ) returns a value of false (.F.).

If CONTINUE doesn’t succeed in finding a record, RECNO( ) returns the number of records in the table plus one, FOUND( ) returns false (.F.), and EOF( ) returns true (.T.).


CONTINUE Command Example

In the following example, all customers from France are counted and the total is displayed. All records are found using one LOCATE command followed by a CONTINUE command within a loop.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

SET TALK OFF

STORE 0 TO gnCount

LOCATE FOR ALLTRIM(UPPER(country)) = 'FRANCE'

DO WHILE FOUND( )

gnCount = gnCount + 1

CONTINUE

ENDDO

? 'Total customers from France: '+ LTRIM(STR(gnCount))


See Also

EOF( )
FOUND( )
LOCATE
SEEK


Control Object

Syntax         Remarks         Properties         Events         Methods         See Also

Creates a control object that can contain other protected objects.

Syntax

Control

Remarks

Control objects can contain other objects, but, unlike container objects, do not allow access to the objects contained within them. For example, if you create a control object that consists of two ListBoxes and two CommandButtons, and then add the control object to a form, the ListBoxes and CommandButtons cannot be manipulated individually at design time or at run time.

For more information about control objects and how they differ from other objects and controls, see Chapter 3, “Object-Oriented Programming,” in the Developer’s Guide.


Properties

BackColor	BackStyle	BaseClass
BorderColor	BorderWidth	Class
ClassLibrary	ColorSource	Comment
ControlCount	Controls	DragIcon
DragMode	Enabled	ForeColor
Height	HelpContextID	Left
MousePointer	Name	ParentClass
Picture	SpecialEffect	TabIndex
TabStop	Top	Visible
Width


Events

Click	DblClick	Destroy
DragDrop	DragOver	Error
GotFocus	Init	LostFocus
MiddleClick Event	MouseDown	MouseMove
MouseUp	MouseWheel	Moved
Resize	RightClick	UIEnable


Methods

Drag	Draw	Move
Refresh	ResetToDefault	SaveAsClass
SetFocus	ZOrder


See Also

CREATE CLASS
CREATE FORM
DEFINE CLASS


ControlBox Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether a Control-menu box appears in the upper-left corner of a form or toolbar at run time. Available at design time and run time.

Syntax

Object.ControlBox[ = lExpr]

Settings

lExpr   The settings for the ControlBox property are:

Setting	Description
True (.T.)	(Default) Displays a Control-menu box.
False (.F.)	Does not display a Control-menu box.
Remarks

Both modal and modeless forms and toolbars can include a Control-menu box. The menu commands available at run time depend on the settings for related properties. For example, setting MaxButton and MinButton to false (.F.) disables the Maximize and Minimize menu commands on the Control menu, but the Move and Close menu commands remain available.

Settings you specify for ControlBox, BorderStyle, MaxButton, and MinButton are not reflected in the form’s appearance until run time.


Applies To

Form, _SCREEN, ToolBar


See Also

BorderStyle Property
Closable Property
MaxButton Property
MinButton Property


ControlCount Property

Syntax         Remarks         Applies To         See Also

Specifies the number of controls in a container object. Not available at design time; read-only at run time.

Syntax

Object.ControlCount

Remarks

You can use this property to cycle through all the controls on a container and perform an operation on each.


Applies To

Column, Container Object, Control Object, Form, Page, _SCREEN, ToolBar


See Also

Controls Property


Controls and Objects

See Also

This topic describes support for controls and objects created in earlier FoxPro versions and new controls added to Visual FoxPro.

The easiest way to create controls and objects is by using the Form Designer. For more information about creating controls with the Form Designer, see Chapter 9, “Creating Forms,” in the Developer’s Guide.

You can also create controls and objects programmatically. See DEFINE CLASS for more information about creating controls programmatically from the Visual FoxPro base classes, and Chapter 3, “Object-Oriented Programming,” in the Developer’s Guide.

Compatibility with FoxPro 2.x Controls

The following table lists the controls available in earlier FoxPro versions and the base class you can use to programatically create the same control in Visual FoxPro.

FoxPro 2.x controls	Equivalent Visual FoxPro controls	Visual FoxPro base class names
@ ... GET - Check Boxes	CheckBox Control	CheckBox
@ ... GET - Lists	ListBox Control	ListBox
@ ... GET - Popups	ComboBox Control	ComboBox
@ ... GET - Push Buttons	CommandButton Control	CommandButton
@ ... GET - Radio Buttons	OptionButton Control	OptionButton
@ ... GET - Spinners	Spinner Control	Spinner
@ ... GET - Text Boxes	TextBox Control	TextBox
@ ... EDIT - Text Edit Regions	EditBox Control	EditBox
Visual FoxPro Base Classes

In addition, the following controls and objects are new to Visual FoxPro and can be created programatically only from their Visual FoxPro base classes.

Controls and objects	Base class names	Description
Column Object	Column	Creates a column in a grid.
CommandGroup Control	CommandGroup	Creates a group of command buttons.
Container Object	Container	Creates an object that can contain other objects.
Control Object	Control	Creates a control object that can contain other protected objects.
Cursor Object	Cursor	Created when a table or view is added to the data environment for a form, form set, or report.
Custom Object	Custom	Creates a custom, user-defined object.
DataEnvironment Object	DataEnvironment	Created when a form, form set, or report is opened.
Form Object	Form	Creates a form.
FormSet Object	FormSet	Creates a form set.
Grid Control	Grid	Creates a Grid control.
Header Object	Header	Creates a Header for a Column in a Grid.
Image Control	Image	Creates an Image control that displays a .BMP or PICT picture.
Label Control	Label	Creates a Label control that displays text.
Line Control	Line	Creates a Line control that displays a horizontal, vertical, or diagonal line.
OLE Container Control	OLEControl	Creates an OLE Container control.
OLE Bound Control	OLEBoundControl	Creates an OLE Bound control.
OptionGroup Control	OptionGroup	Creates a group of option buttons.
Page Object	Page	Creates a page in a page frame.
PageFrame Control	PageFrame	Creates a page frame to contain pages.
Relation Object	Relation	Created when you establish relationships from within the Data Environment Designer for a form, form set, or report.
Separator Object	Separator	Creates a Separator object that places space between controls in a toolbar.
Shape Control	Shape	Creates a Shape control that displays a box, circle, or ellipse.
Timer Control	Timer	Creates a Timer control that can execute code at regular intervals.
ToolBar Object	Toolbar	Creates a toolbar on which controls can be placed.


 See Also

CREATE CLASS, CREATE FORM, DEFINE CLASS


Controls Property

Syntax         Settings         Remarks         Applies To         See Also

An array for accessing the controls in a container object. Available at run time.

Syntax

ContainerObject.Controls(Index).Property[ = Expr]

Settings

Expr   Specifies a property value for a control contained in ContainerObject.

Remarks

Use the Controls property to access the properties of contained objects.


Applies To

Column, Container Object, Control Object, Form, Page, _SCREEN, ToolBar


See Also

ControlCount Property


ControlSource Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the source of data to which an object is bound. Available at design time and run time.

Syntax

Object.ControlSource[ = cName]

Settings

cName   For controls, cName is a variable or field.

Remarks

Once the ControlSource property is set to a field or variable, the Value property always has the same data value and the same data type as the variable or field to which the ControlSource property is set.

For TextBox controls, cName is typically a field.

In a Grid control, if you do not specify a ControlSource setting for a column, the column displays the next available undisplayed field of the grid’s record source.

If a Column’s Bound property is set to true (.T.), the Column’s ControlSource property setting applies to the column and any controls contained in it. If you attempt to set the contained control’s ControlSource property, an error occurs. If a Column’s Bound property is set to false (.F.), you can set the ControlSource property of a contained control directly. If you subsequently set the ControlSource setting of the Column, it overrides the ControlSource setting of the contained control.


Applies To

CheckBox, Column, ComboBox, CommandGroup, EditBox, ListBox, OLE Bound Control, OptionButton, OptionGroup, Spinner, TextBox


See Also

Bound Property
Order Property
RecordSourceType Property
Value Property


_CONVERTER System Variable

Syntax         Arguments         Remarks         See Also

Contains the name of the Visual FoxPro converter application.

Syntax

_CONVERTER = cProgramName

Arguments

cProgramName   Specifies a converter application. If your converter application is in a directory or folder other than the current Visual FoxPro default directory or folder, include a path with the application name.

You can also specify a converter application in your Visual FoxPro configuration file by including a line using the following syntax:

_CONVERTER = cProgramName

Remarks

The _CONVERTER system memory variable contains the name of the application that Visual FoxPro uses when you attempt to open a screen, report, or project created in an earlier FoxPro version. By default, _CONVERTER contains CONVERT.APP, installed in your Visual FoxPro directory or folder. You can specify a different name for the converter application.


See Also

System Variables Overview


COPY FILE Command

Syntax         Remarks         See Also

Duplicates any type of file.

Syntax

COPY FILE FileName1 TO FileName2

Remarks

COPY FILE creates a duplicate of the file whose name is specified in FileName1. You can use COPY FILE to copy any type of file. The file to be copied cannot be open. You must include the extensions for both the source file name FileName1 and destination file name FileName2.

FileName1 and FileName2 can contain wildcard characters such as * and ?. For example, to create backup copies of all program files with the extension .PRG in the current directory or folder, issue COPY FILE *.PRG TO *.BAK.

If you use COPY FILE to create a backup of a table that has a memo field, a structural index or both, be sure to copy the .FPT and .CDX files as well.


See Also

DELETE FILE
RENAME
RENAME TABLE


COPY INDEXES Command

Syntax         Arguments         Remarks         See Also

Creates compound index tags from single-entry .IDX index files.

Syntax

COPY INDEXES IndexFileList | ALL
[TO CDXFileName]

Arguments

IndexFileList   Specifies the single-entry .IDX index files whose index expressions are used to create the tags. Separate the index file names with commas. The name assigned to each tag is the root name of the corresponding single-entry index file. If you create a tag from an index file that has the same name as an existing tag, a dialog is displayed (if SAFETY is ON) asking if you would like to overwrite the tag.

ALL   Specifies to create index tags from all open single-entry index files.

TO CDXFileName   Creates tags in a non-structural compound index file. Specify the name of the non-structural compound index file with CDXFileName. If a non-structural compound index file with the specified name doesn’t exist, Visual FoxPro automatically creates it.

Remarks

A compound index file is an index file containing separate index entries called tags. Each tag is identified by its unique tag name. The default extension for a compound index file is .CDX.

You must first open the table and single-entry index files before using COPY INDEXES. The index expressions from the single-entry index files are used to create the new tags.

If you omit the TO clause, the new tags are added to the structural compound index file that is automatically opened with the table. If a structural compound index file doesn’t exist for the table, COPY INDEXES creates one.

Use COPY TAG to create a single-entry index file from compound index file tags.


See Also

CDX( )
COPY TAG
DELETE TAG
INDEX
TAG( )
USE


COPY MEMO Command

Syntax         Arguments         Example         See Also

Copies the contents of the specified memo field in the current record to a text file.

Syntax

COPY MEMO MemoFieldName TO FileName
[ADDITIVE]
[AS nCodePage]

Arguments

MemoFieldName   Specifies the name of the memo field copied to the text file.

TO FileName   Specifies the name of a new or existing text file to which the memo field is copied. If you do not provide an extension in FileName, a .TXT extension is assigned. You can also include a path with the file name.

ADDITIVE   Appends the contents of the memo field to the end of the specified text file. If you omit ADDITIVE, the memo field contents replace the contents of the text file.

AS nCodePage   Specifies the code page for the text file COPY MEMO creates. Visual FoxPro copies the contents of the specified memo field, and, as it copies the data, automatically converts the data to the code page you specify for the text file.

If you specify a value for nCodePage that is not supported, Visual FoxPro generates an error message. You can use GETCP( ) for nCodePage to display the Code Page dialog box, allowing you to specify a code page for the file Visual FoxPro creates.

If AS nCodePage is omitted or is 0, no code page conversion occurs.


COPY MEMO Command Example

In the following example, the contents of the memo field named notes are copied to a file called TEST.TXT. The memo field is then copied again and appended to the end of the text file.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE employee && Opens Employee table

COPY MEMO notes TO test.txt

WAIT WINDOW 'Memo contents now in test.txt' NOWAIT

MODIFY FILE test.txt

COPY MEMO notes TO test.txt ADDITIVE

WAIT WINDOW 'Memo contents added again to test.txt' NOWAIT

MODIFY FILE test.txt

DELETE FILE test.txt


See Also

APPEND MEMO
COPY FILE
COPY TO
MODIFY MEMO


COPY PROCEDURES Command

Syntax         Arguments         Remarks         Example         See Also

Copies stored procedures in the current database to a text file.

Syntax

COPY PROCEDURES TO FileName
[AS nCodePage] [ADDITIVE]

Arguments

FileName   Specifies the name of a text file to which the stored procedures are copied. If the file doesn’t exist, Visual FoxPro automatically creates it.

AS nCodePage   Specifies the code page for the text file to which the stored procedures are copied. Visual FoxPro copies the stored procedures, and, as it does so, automatically converts the stored procedures to the code page you specify.

If you specify a value for nCodePage that is not supported, Visual FoxPro generates an error message. You can use GETCP( ) for nCodePage to display the Code Page dialog box, allowing you to specify a code page for the text file to which the stored procedures are copied.

If you omit AS nCodePage or if AS nCodePage is 0, no code page conversion occurs.

ADDITIVE   Appends the stored procedures to the end of the specified text file. If you omit ADDITIVE, the stored procedures replace the contents of the text file.

Remarks

Use COPY PROCEDURES with APPEND PROCEDURES to programatically modify stored procedures in a database. A database must be open and current when COPY PROCEDURES is issued; otherwise Visual FoxPro generates an error message.


COPY PROCEDURES Command Example

The following example opens the testdata database, and uses COPY PROCEDURES to copy the procedures to a temporary text file named MYPROC.TXT. MODIFY FILE is used to open the temporary text file, which will be empty if there are no stored procedures in the database.

If there are no stored procedures in the database, you can run the example for APPEND PROCEDURES to add a procedure to database.

CLOSE DATABASES

OPEN DATABASE (SYS(2004) + 'samples\data\testdata')

COPY PROCEDURES TO myproc.txt && Copy stored procedures to a file

MODIFY FILE myproc.txt  && Open the file

DELETE FILE myproc.txt  && Erase the file


See Also

APPEND PROCEDURES
CREATE TRIGGER
DISPLAY PROCEDURES
MODIFY PROCEDURE
SET DATABASE


COPY STRUCTURE Command

Syntax         Arguments         Example         See Also

Creates a new, empty free table with the same structure as the currently selected table.

Syntax

COPY STRUCTURE TO FileName
[FIELDS FieldList]
[[WITH] CDX | [WITH] PRODUCTION]

Arguments

FileName   Specifies the name of the new, empty table to create.

In Visual FoxPro, null value support and the code page for the new, free table are identical to the currently selected table.

FIELDS FieldList   Specifies that only the fields whose names are specified in the FieldList are copied to the new table. If you omit FIELDS FieldList, all fields are copied to the new table.

[WITH] CDX | [WITH] PRODUCTION   Creates a structural index file for the new table that is identical to the structural index file of the existing table. The tags and index expressions from the original structural index file are copied to the new structural index file.

The CDX and PRODUCTION clauses are identical.

In Visual FoxPro, a primary index for the currently selected table is converted to a candidate index for the new empty table.


COPY STRUCTURE Command Example

In the following example, the customer table is opened, its structure is copied to a table called backup and backup is opened. APPEND FROM then appends records to the backup table from the customer table, and a Browse window is opened for the backup table.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

COPY STRUCTURE TO backup

USE backup

APPEND FROM customer FOR country = 'UK'

BROWSE FIELDS contact, country

USE

DELETE FILE backup.dbf


See Also

COPY STRUCTURE EXTENDED
CREATE
DISPLAY STRUCTURE


COPY STRUCTURE EXTENDED Command

Syntax         Arguments         Remarks         Example         See Also

Creates a new table with fields containing the structure of the currently selected table.

Syntax

COPY STRUCTURE EXTENDED TO FileName
[DATABASE DatabaseName [NAME LongTableName]]
[FIELDS FieldList]

Arguments

FileName   Specifies the new table to create.

DATABASE DatabaseName   Specifies a database to which the new table is added.

NAME LongTableName   Specifies a long name for the new table. Long names can contain up to 128 characters and can be used in place of short file names in the database.

FIELDS FieldList   Specifies that only the fields specified in FieldList are included in a record in the new table. If you omit FIELDS FieldList, all fields have a record in the new table.

Remarks

Information about each field in the currently selected table is copied to a record in the new table. The structure of the new table is fixed in format and consists of sixteen fields. The following table lists the names of the sixteen fields and their contents.

Field	Field type	Contents
FIELD_NAME	Character	Field names from selected table (128 characters wide)
FIELD_TYPE	Character	Field types: C = Character Y = Currency N = Numeric F = Float I = Integer B = Double D = Date T = DateTime L = Logical M = Memo G = General
FIELD_LEN	Numeric	Field widths
FIELD_DEC	Numeric	Number of decimal places in numeric fields
FIELD_NULL	Logical	Field null value support
FIELD_NOCP	Logical	Code page translation not allowed (character and memo fields only)
FIELD_DEFA	Memo	Field default values
FIELD_RULE	Memo	Field validation rules
FIELD_ERR	Memo	Field validation text
TABLE_RULE	Memo	Table validation rule
TABLE_ERR	Memo	Table validation text
TABLE_NAME	Character	Long table name (first record only)
INS_TRIG	Memo	Insert trigger expression (first record only)
UPD_TRIG	Memo	Update trigger expression (first record only)
DEL_TRIG	Memo	Delete trigger expression (first record only)
TABLE_CMT	Memo	Table comment (first record only)
You can modify the newly created table and then use CREATE FROM to create a new table with a different structure. COPY STRUCTURE and CREATE FROM allow you to programatically change the structure of a table.

The width of the FIELD_NAME field is 10 characters in previous versions of Visual FoxPro, FoxPro for Windows, and FoxPro for MS-DOS. To use CREATE FROM with a table created by COPY STRUCTURE EXTENDED in Visual FoxPro 4.0, you must change the width of the FIELD_NAME field to 10 characters.


COPY STRUCTURE EXTENDED Command Example

The following example displays the structure of the orders table, copies the structure extended to a temp table, browses temp, creates a backup table from temp, and displays the structure of backup.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE orders  && Opens Orders table

CLEAR

DISPLAY STRUCTURE

WAIT WINDOW 'Structure of the orders table' NOWAIT

COPY STRUCTURE EXTENDED TO temp

USE temp

WAIT WINDOW 'The temp table - 1 row per field in orders' NOWAIT

BROWSE

CREATE backup FROM temp

USE backup

DISPLAY STRUCTURE

WAIT WINDOW 'Backup.dbf has the same structure as orders' NOWAIT

USE

DELETE FILE temp.dbf

DELETE FILE backup.dbf


See Also

CREATE FROM


COPY TAG Command

Syntax         Arguments         Remarks         See Also

Creates a single-entry index (.IDX) file from a tag in a compound index file.

Syntax

COPY TAG TagName [OF CDXFileName]
TO IndexFileName

Arguments

TagName   Specifies the tag used to create the single-entry .IDX file.

OF CDXFileName   Specifies the compound index file containing the tag. Include this clause if there are tags with the same names in the open compound index files. If you omit OF CDXFileName, Visual FoxPro looks for the tag first in the structural index file. If it isn’t found there, Visual FoxPro searches all the open non-structural compound index files.

TO IndexFileName   Specifies the name of the single-entry .IDX file to create.

Remarks

Use COPY TAG to create a new single-entry .IDX file from a tag in a .CDX compound index file.

The compound index file from which you create the single-entry .IDX file must be open. Structural compound index files are automatically opened when you open a table. Non-structural compound indexes must be explicitly opened with USE ... INDEX or SET INDEX. For more information about compound index files, see INDEX.

Use COPY INDEX to create tags in compound index files from single-entry .IDX files.


See Also

CDX( )
COPY INDEXES
DELETE TAG
INDEX
TAG( )
USE


COPY TO Command

Syntax         Arguments         Remarks         Example         See Also

Creates a new file from the contents of the currently selected table.

Syntax

COPY TO FileName
[DATABASE DatabaseName [NAME LongTableName]]
[FIELDS FieldList
| FIELDS LIKE Skeleton
| FIELDS EXCEPT Skeleton]
[Scope] [FOR lExpression1] [WHILE lExpression2]
[[WITH] CDX] | [[WITH] PRODUCTION]
[NOOPTIMIZE]
[[TYPE] [FOXPLUS | FOX2X | DIF | MOD
| SDF | SYLK | WK1 | WKS | WR1 | WRK | XLS | XL5
| DELIMITED [WITH Delimiter | WITH BLANK | WITH TAB
| WITH CHARACTER Delimiter]]]
[AS nCodePage]

Arguments

FileName   Specifies the name of the new file COPY TO creates. If you do not include an extension with the file name, the default extension for the specified file type is assigned. If you do not specify a file type, COPY TO creates a new Visual FoxPro table and assigns the table file name the default extension .DBF.

DATABASE DatabaseName   Specifies a database to which the new table is added.

NAME LongTableName   Specifies a long name for the new table. Long names can contain up to 128 characters and can be used in place of short file names in the database.

FIELDS FieldList   Specifies which fields are copied to the new file. If you omit FIELDS FieldList, all fields are copied to the file. If the file you are creating is not a table, memo fields are not copied to the new file, even if memo field names are included in the field list.

FIELDS LIKE Skeleton   Specifies that fields from the original table that match the field skeleton Skeleton are included in the new file that COPY TO creates.

FIELDS EXCEPT Skeleton   Specifies that all fields except those that match the field skeleton Skeleton are included in the new file that COPY TO creates.

The field skeleton Skeleton supports wildcards. For example, to specify that all fields that begin with the letters A and P are included in the new file, use:

COPY TO mytable FIELDS LIKE A*,P*

The LIKE clause can be combined with the EXCEPT clause:

COPY TO mytable FIELDS LIKE A*,P* EXCEPT PARTNO*

Scope   Specifies a range of records to copy to a file. Only the records within the range are copied. The scope clauses are: ALL, NEXT nRecords, RECORD nRecordNumber, and REST. For more information on scope clauses, see the Scope Clauses topic.

FOR lExpression1   Specifies that only the records for which the logical condition lExpression1 evaluates to true (.T.) are copied to the file. Include FOR lExpression1 to conditionally copy records, filtering out undesired records.

Rushmore™ optimizes COPY TO with a FOR lExpression1 clause if lExpression1 is an optimizable expression. For best performance, use an optimizable expression in the FOR lExpression1 clause.

For information on Rushmore optimizable expressions, see SET OPTIMIZElngSET_OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

For information on Rushmore optimizable expressions, see SET OPTIMIZElngSET_OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, Optimizing ApplicationsdgOptimizing_Applications, in the Developer’s Guide.

WHILE lExpression2   Specifies a condition whereby records are copied for as long as the logical expression lExpression2 evaluates to true (.T.).

[WITH] CDX | [WITH] PRODUCTION   Creates a structural index file for the new table that is identical to the structural index file of the existing table. The tags and index expressions from the original structural index file are copied to the new structural index file. The CDX and PRODUCTION clauses are identical.

Do not include CDX or PRODUCTION if you are copying to a file other than a new Visual FoxPro table.

NOOPTIMIZE   Disables Rushmore optimization of COPY TO.

 For more information, see SET OPTIMIZE and  “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

TYPE   Specifies the file type if the file you create isn’t a Visual FoxPro table. Although you must specify a file type, you need not include the TYPE keyword.

FOXPLUS   Visual FoxPro memo files have a different structure than FoxBASE+™ memo files. If your source Visual FoxPro table contains a memo field, include the FOXPLUS clause to create a table that can be used in FoxBASE+. The Visual FoxPro memo field cannot contain binary data because FoxBASE+ does not support binary data in memo fields.

FOX2X   Creates a new table that can be opened in earlier versions of FoxPro (versions 2.0, 2.5, and 2.6).

For Numeric, Float, Integer, Double, and Currency type fields, null values in the source table are converted to zero in the new table. For other field types, null values in the source table are converted to blanks in the new table. For further information about blank values, see ISBLANK( ).

The following table lists the Visual FoxPro fields types that are converted to different field types in the new table when the FOX2X argument is included.

Visual FoxPro field type	FoxPro 2.x field type
Currency	Float
DateTime	Date
Double	Float
Integer	Numeric
DIF   Creates a VisiCalc® .DIF (Data Interchange Format) file. Fields from the Visual FoxPro table become vectors (columns) and records become tuples (rows). The new file name is assigned a .DIF extension if you do not include an extension in FileName.

MOD   Creates a Microsoft Multiplan® version 4.01 file. The new Microsoft Multiplan file name is assigned an .MOD extension if an extension isn’t included.

SDF   Creates an SDF (System Data Format) file. An SDF file is an ASCII text file in which records have a fixed length and end with a carriage return and linefeed. Fields aren’t delimited. The SDF file name is assigned a .TXT file extension if you do not include an extension.

SYLK   Creates a SYLK (Symbolic Link) interchange file. SYLK files are used in Microsoft MultiPlan. Each field from the currently selected table becomes a column in the spreadsheet and each record becomes a row. SYLK file names have no extension.

WK1   Creates a Lotus® 1-2-3® version 2.x spreadsheet file. Each field from the currently selected table becomes a column in the spreadsheet and each record becomes a row. A .WK1 file name extension is assigned to the new spreadsheet.

WKS   Creates a Lotus 1-2-3 version 1a spreadsheet file. Each field from the currently selected table becomes a column in the spreadsheet and each record becomes a row. A .WKS file name extension is assigned to the new spreadsheet.

WR1   Creates a Lotus Symphony® version 1.1 or 1.2 spreadsheet file. Each field from the currently selected table becomes a column in the spreadsheet and each record becomes a row. A .WR1 file name extension is assigned to the new spreadsheet.

WRK   Creates a Lotus Symphony version 1.0 spreadsheet file. Each field from the currently selected table becomes a column in the spreadsheet and each record becomes a row. A .WR1 file name extension is assigned to the new spreadsheet.

XLS   Creates a Microsoft Excel version 2.0 worksheet file. Each field from the currently selected table becomes a column in the spreadsheet and each record becomes a row. An .XLS extension is assigned to the new worksheet if you do not include a file extension.

XL5   Creates a Microsoft Excel version 5.0 worksheet file. Each field from the currently selected table becomes a column in the spreadsheet and each record becomes a row. An .XLS extension is assigned to the new worksheet if you do not include a file extension.

DELIMITED   Creates a delimited file. A delimited file is an ASCII text file in which each record ends with a carriage return and linefeed. The default field separator is a comma. Since character data may include commas, character fields are additionally delimited with double quotation marks.

Unless you specify otherwise, a .TXT extension is assigned to all newly created DELIMITED files.

DELIMITED WITH Delimiter   Creates a delimited file with character fields delimited by a character other than a quotation mark. The character that delimits character fields is specified with Delimiter.

DELIMITED WITH BLANK   Creates a delimited file with fields separated by spaces instead of commas.

DELIMITED WITH TAB   Creates a delimited file with fields separated by tabs instead of commas.

DELIMITED WITH CHARACTER Delimiter   Creates a delimited file with all fields delimited by the character specified with Delimiter. If Delimiter is a semicolon (the character used in Visual FoxPro to indicate command line continuation), enclose the semicolon in quotation marks. You can also specify the BLANK and TAB keywords for Delimiter.

Note that the WITH Delimiter clause can be combined with the WITH CHARACTER clause. For example, the following command creates a text file with character fields delimited with underscores and all fields delimited with semicolons:

COPY TO mytxt.txt DELIMITED WITH _ WITH CHARACTER ‘;’

AS nCodePage   Specifies the code page for the table or file COPY TO creates. Visual FoxPro copies the contents of the currently selected table, and, as it copies the data, automatically converts the data to the code page you specify for the new table or file. If possible, Visual FoxPro marks the newly created table or file with the code page you specify.

If you specify a value for nCodePage that is not supported, Visual FoxPro generates an error message. You can use GETCP( ) for nCodePage to display the Code Page dialog box, allowing you to specify a code page for the table or file Visual FoxPro creates.

If you omit AS nCodePage, the newly created table or file is converted to the current Visual FoxPro code page.

If nCodePage is 0, no code page conversion occurs and the newly created table or file is not marked with a code page.

Remarks

If an index order is set, records are copied in master index order.


COPY TO Command Example

In the following example, the customer table is opened and the next three records are copied to a new DELIMITED data file called TEMP.TXT.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

COPY NEXT 3 TO temp TYPE DELIMITED

WAIT WINDOW 'This is the delimited text file' NOWAIT

MODIFY FILE temp.txt

DELETE FILE temp.txt


See Also

APPEND FROM
COPY FILE
GETCP( )
EXPORT
IMPORT
RENAME TABLE


COPY TO ARRAY Command

Syntax         Arguments         Remarks         Example         See Also

Copies data from the currently selected table to an array.

Syntax

COPY TO ARRAY ArrayName
[FIELDS FieldList]
[Scope] [FOR lExpression1] [WHILE lExpression2]
[NOOPTIMIZE]

Arguments

ArrayName   Specifies the array to which data from the table is copied.

FIELDS FieldList   Specifies that only the fields specified in FieldList are copied to the array. If you omit FIELDS FieldList, all fields are copied to the array if the array has enough columns.

Scope   Specifies a range of records copied to the array. Only the records within the range are copied. The scope clauses are: ALL, NEXT nRecords, RECORD nRecordNumber, and REST.

For more information on scope clauses, see the Scope Clauses topic.

The default scope for COPY TO ARRAY is ALL records.

FOR lExpression1   Specifies that only the records that satisfy the logical condition lExpression1 are copied to the array. Including FOR lets you conditionally copy records to the array, filtering out undesired records.

Rushmore optimizes a COPY TO ARRAY query that includes FOR lExpression1 if lExpression1 is an optimizable expression. For best performance, use an optimizable expression in the FOR clause.

For information on Rushmore optimizable expressions, see SET OPTIMIZEand “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

For information on Rushmore optimizable expressions, see SET OPTIMIZElngSET_OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, Optimizing Applications

WHILE lExpression2   Specifies a condition whereby records are copied to the array as long as the logical expression lExpression2 evaluates to true (.T.).

NOOPTIMIZE   Disables Rushmore optimization of COPY TO ARRAY. For more information, see SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

Remarks

COPY TO ARRAY and SCATTER are similar. COPY TO ARRAY copies multiple records to an array while SCATTER copies just one record into an array or a set of memory variables. Both COPY TO ARRAY and SCATTER create a new array if an array with the name you specify doesn’t exist.

To copy a single record to an array you can specify a one-dimensional array. The one-dimensional array you specify should have the same number of elements as fields in the table, not counting memo fields. Memo fields are ignored in COPY TO ARRAY.

If you specify a one-dimensional array, the first field of a record is stored to the first element of the array, the second field is stored to the second element of the array, and so on. If the one-dimensional array has more elements than the table has fields, any remaining elements remain unchanged. If the array has fewer elements than the table has fields, any remaining fields are ignored.

To copy multiple records or an entire table to an array, specify a two-dimensional array. The number of rows in the array is the number of records the array can hold, and the number of columns in the array is the number of fields the array can hold.

Each record is stored in one row of the array, and each field of the record is stored in one column of the array. For each record, the first field is stored to the first column of the array, the second field is stored to the second column of the array, and so on. If the array has more columns than the table has fields, any remaining columns aren’t changed. If the array has fewer columns than the table has fields, any remaining fields aren’t stored to the array.

Each successive row in the array is filled with the contents of the next record in the table. If the array has more rows than the table has records, any remaining rows aren’t changed. If the array has fewer rows than the table has records, any remaining records aren’t stored to the array.

Data can be copied from arrays to new table records with APPEND FROM ARRAY. Data can also be copied from either an array or a set of memory variables to records in a table with GATHER.


COPY TO ARRAY Command Example

In the following example, the customer table is opened. A two-dimensional array is then created and the first three records from customer are copied to the array. DISPLAY MEMORY shows the data stored in the array.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

DIMENSION gaTemp(3,10)

COPY NEXT 3 TO ARRAY gaTemp

DISPLAY MEMORY LIKE gaTemp


See Also

APPEND FROM ARRAY
DECLARE
DIMENSION
GATHER
PUBLIC
SCATTER
STORE


COS( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the cosine of a numeric expression.

Syntax

COS(nExpression)

Returns

Numeric

Arguments

nExpression   Specifies a numeric expression whose cosine COS( ) returns. nExpression can be any value.

Remarks

COS( ) returns the cosine of nExpression in radians. Use DTOR( ) to convert an angle from degrees to radians. The number of decimal places that COS( ) returns can be specified with SET DECIMALS. The value COS( ) returns ranges between –1 and 1.


COS( ) Function Example

CLEAR

? COS(0)  && Displays 1.00

? COS(PI( ))  && Displays -1.00

? COS(DTOR(180))  && Displays -1.00

STORE PI( ) * 3 TO gnAngle

? COS(gnAngle)  && Displays -1.00


See Also

ACOS( )
DTOR( )
RTOD( )
SET DECIMALS
SIN( )


COUNT Command

Syntax         Arguments         Remarks         Example         See Also

Counts table records.

Syntax

COUNT
[Scope] [FOR lExpression1] [WHILE lExpression2]
[TO VarName]
[NOOPTIMIZE]

Arguments

Scope   Specifies a range of records to be included in the count. The scope clauses are: ALL, NEXT nRecords, RECORD nRecordNumber, and REST. Commands that include Scope operate only on the table in the active work area.

The default scope for COUNT is ALL records.

FOR lExpression1   Specifies that only the records that satisfy the logical condition lExpression1 are counted. Including FOR lets you conditionally count records, filtering out undesired records.

Rushmore will optimize a COUNT FOR query if lExpression1 is an optimizable expression. For best performance, use an optimizable expression in the FOR clause.

For more information on optimizable expressions, see SET OPTIMIZE, and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

WHILE lExpression2   Specifies a condition whereby records are counted for as long as the logical expression lExpression2 evaluates to true (.T.).

TO VarName   Specifies the variable or array to which the the record count is stored. If the variable you specify doesn’t exist, Visual FoxPro creates it.

NOOPTIMIZE   Disables Rushmore optimization of COUNT. For more information see SET OPTIMIZE, and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

Remarks

COUNT counts the records within a scope of records for which the FOR or WHILE conditions are true. If SET TALK is ON, the record count is displayed.

Records marked for deletion are included in the count if SET DELETE is OFF.


COUNT Command Example

The following example counts and displays the number of customers in Paris.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

CLEAR

COUNT FOR UPPER(city) = 'PARIS'

DISPLAY FIELDS company, contact FOR UPPER(city) = 'PARIS'


See Also

CALCULATE
SET DELETED
SET TALK


_COVERAGE System Variable

Syntax         Arguments         Remarks          See Also

Contains the name of the Visual FoxPro application that creates the Debugger coverage and profiler output.

Syntax

_COVERAGE = cProgramName

Arguments

cProgramName   Specifies a coverage output application. If your coverage output application is in a directory other than the current Visual FoxPro default directory, include a path with the application name.

You can also specify a coverage output application in your Visual FoxPro configuration file by including a line using this syntax:

_COVERAGE = cProgramName

Remarks

By default, _COVERAGE contains COVERAGE.APP, installed in your Visual FoxPro directory. You can specify a different name for the coverage output application.


See Also

SET COVERAGE
SET EVENTTRACKING Command


CPCONVERT( ) Function

Syntax         Arguments         Remarks         See Also

Converts character or memo fields or character expressions to another code page.

Syntax

CPCONVERT(nCurrentCodePage, nNewCodePage, cExpression)

Arguments

nCurrentCodePage   Specifies the code page that cExpression is being converted from.

nNewCodePage   Specifies the code page to which cExpression is converted.

cExpression   Specifies the character expression that’s converted.

Remarks

Note that CPCONVERT( ) isn’t required for normal cross-platform functioning of the product. It is used strictly to access the underlying translation facilities of Visual FoxPro.

For example, if the variable gcCharExpr contains a character that looks like ä on the Macintosh (in code page 10000) then CPCONVERT( ) will return a character that looks like ä in Microsoft Windows (code page 1252):

CPCONVERT(10000, 1252, gcCharExpr)

For additional information on code pages and Visual FoxPro’s international support, see Chapter 18, “Developing International Applications,” in the Developer’s Guide.


See Also

CPCURRENT( )
CPDBF( )
MODIFY COMMAND
MODIFY FILE
SET NOCPTRANS


CPCURRENT( ) Function

Syntax         Remarks         See Also

Returns the code page setting (if any) in your Visual FoxPro configuration file, or returns the current operating system code page.

Syntax

CPCURRENT([1 | 2])

Remarks

CPCURRENT( ) returns one of the following:

•	In Visual FoxPro, the current operating system code page if the CODEPAGE configuration item isn’t included in your configuration file. In previous versions of FoxPro, 0 is returned if the CODEPAGE configuration item isn’t included in your configuration file

•	The code page number specified in the CODEPAGE configuration item. For example, CPCURRENT( ) returns 852 if the following line is included in your configuration file:

CODEPAGE = 852

•	The current operating system code page if you have included the following line in your configuration file:

CODEPAGE = AUTO

In Visual FoxPro, CPCURRENT(1) returns the current operating system code page, regardless of your configuration CODEPAGE setting.

CPCURRENT(2) always returns the underlying operating system code page, regardless of your configuration CODEPAGE setting. For example, if you’re running Windows, CPCURRENT(2) returns the MS-DOS code page.

For additional information on code pages and Visual FoxPro’s international support, see Chapter 18, “Developing International Applications,” in the Developer’s Guide.


See Also

CPCONVERT( )
CPDBF( )
MODIFY COMMAND
MODIFY FILE
SET NOCPTRANS


CPDBF( ) Function

Syntax         Arguments         Remarks         See Also

Returns the code page with which an open table has been marked.

Syntax

CPDBF([nWorkArea | cTableAlias])

Arguments

nWorkArea   Specifies the work area number.

cTableAlias   Specifies the table alias.

Include nWorkArea or cTableAlias to specify a table open in a work area other than the current work area. CPDBF( ) returns 0 if a table isn’t open in the work area you specify. If a table doesn’t have the alias you specify with cTableAlias, Visual FoxPro generates an error message.

Remarks

DISPLAY STRUCTURE also displays the code page with which an open table has been marked.

For additional information on code pages and Visual FoxPro’s international support, see Chapter 18, “Developing International Applications,” in the Developer’s Guide.


See Also

CPCONVERT( )
CPCURRENT( )
MODIFY COMMAND
MODIFY FILE
SET NOCPTRANS


CREATE Command

Syntax         Arguments         Remarks         See Also

Builds a new Visual FoxPro table.

Syntax

CREATE [FileName | ?]

Arguments

FileName   Specifies the name of the table to create.

?   Displays the Create dialog box that prompts you to name the table being created.

Remarks

In Visual FoxPro, if a database is open when you create a table, the table is automatically added to the database.

When running on the Windows operating system, you cannot create a table with the name of an MS-DOS device, such as CON, NUL, PRN, and COM1. You should avoid using hyphens in a table name because hyphenated table names don’t appear in the Data Session window, and can cause confusion with the alias pointer (->).

A table is created by defining the name, type, and size of each field. Once the structure of the table is created, you can then add records to the table. For more information on tables, see Chapter 3, “Creating Tables,” in the User’s Guide.


See Also

ADD TABLE
ALTER TABLE - SQL
CREATE DATABASE
CREATE TABLE - SQL
MODIFY STRUCTURE


CREATE CLASS Command

Syntax         Arguments         Remarks         See Also

Opens the Class Designer, allowing you to create a new class definition.

Syntax

CREATE CLASS ClassName | ? [OF ClassLibraryName1 | ?]
[AS cBaseClassName [FROM ClassLibraryName2]] [NOWAIT]

Arguments

ClassName   Specifies the name of the class definition to create.

?   Displays the New Class dialog box, from which you can specify the name of the class definition to create.

OF ClassLibraryName1   Specifies the name of the .VCX visual class library to create. If the .VCX visual class library already exists, the class definition is added to it.

A .VCX file extension is assumed for the visual class library. Be sure to include the file extension if the visual class library you specify has a file extension other than .VCX.

?   Displays the New Class dialog box, from which you can specify the name of a new or existing .VCX visual class library to which the class definition is added.

AS cBaseClassName   Specifies the class on which the class definition is based. cBaseClassName can be any Visual FoxPro base class except Column, Cursor, DataEnvironment, Header, Page, and Relation. You can also specify a user-defined class for cBaseClassName if you include the FROM ClassLibraryName2 clause that specifies the name of the .VCX visual class library containing the user-defined class.

If you omit AS cBaseClassName, the class definition is based on the Visual FoxPro FormSet base class.

FROM ClassLibraryName2   Specifies the name of the .VCX visual class library containing the user-defined class specified with cBaseClassName.

NOWAIT   Continues program execution after the Class Designer has been opened. The program doesn’t wait for the Class Designer to be closed, but continues execution on the program line immediately following the line that contains CREATE CLASS NOWAIT. If you omit NOWAIT, when CREATE CLASS is issued in a program, the Class Designer is opened and program execution pauses until the Class Designer is closed.

Including NOWAIT has no effect on CREATE CLASS when it is issued in the Command window.

Remarks

Use CREATE CLASS to create a class definition and save it in a .VCX visual class library. You can open the .VCX visual class library with SET CLASSLIB, allowing you to access the class definitions within the .VCX visual class library.


See Also

ADD CLASS
_BROWSER
CREATE CLASSLIB
DEFINE CLASS
MODIFY CLASS
RELEASE CLASSLIB
SET CLASSLIB


CREATE CLASSLIB Command

Syntax         Arguments         Remarks         Example         See Also

Creates a new, empty visual class library (.VCX) file.

Syntax

CREATE CLASSLIB ClassLibraryName

Arguments

ClassLibraryName   Specifies the name of the visual class library to create. If a visual class library with the name you specify already exists and SET SAFETY is ON, Visual FoxPro asks if you’d like to overwrite the existing visual class library. If SET SAFETY is OFF, the existing file is automatically overwritten.

If you don’t specify an extension for the file name, Visual FoxPro automatically assigns a .VCX extension.

Remarks

Class definitions can be added to a visual class library with ADD CLASS and CREATE CLASS.


CREATE CLASSLIB Command Example

The following example uses CREATE CLASSLIB to create a visual class library named myclslib. A class named myform based on the Visual FoxPro Form base class is created and is stored in the myclslib visual class library. SET CLASSLIB is used to open the myclslib visual class library so that classes within it can be used.

CREATE CLASSLIB myclslib  	&& Creates a new .VCX visual class library

CREATE CLASS myform OF myclslib AS "Form"  && Creates new class

SET CLASSLIB TO myclslib ADDITIVE 	 && Opens MyClsLib.VCX


See Also

ADD CLASS
_BROWSER
CREATE CLASS
DEFINE CLASS
MODIFY CLASS
RELEASE CLASSLIB
SET CLASS


CREATE COLOR SET Command

Syntax         Arguments         Remarks         See Also

Creates a color set from the current color settings.

Syntax

CREATE COLOR SET ColorSetName

Arguments

ColorSetName   Specifies the name of the color set to create.

Remarks

Color sets are not supported in Visual FoxPro for Macintosh; CREATE COLOR SET is ignored.

Every color pair in every color scheme is saved in the color set you create. A color set name can be up to 24 characters long in Visual FoxPro, (10 characters in earlier FoxPro versions) and can contain numbers and underscores, but it cannot begin with a number.

Once you have created a color set, you can load it with SET COLOR SET.

Color sets are saved in the Visual FoxPro resource file. If a color set exists with the same name you specify, it is overwritten.

For more information on color schemes and color pairs, see the Colors Overview topic.


See Also

SET COLOR OF SCHEME
SET COLOR SET
SET COLOR TO


CREATE CONNECTION Command

Syntax         Arguments         Remarks         Example         See Also

Creates a named connection and stores it in the current database.

Syntax

CREATE CONNECTION [ConnectionName | ?]
[DATASOURCE cDataSourceName]
[USERID cUserID] [PASSWORD cPassWord]
[DATABASE cDatabaseName]
| CONNSTRING cConnectionString]

Arguments

ConnectionName   Specifies the name of the connection to create.

?   Displays the Connection Designer from which you can create and save a connection.

DATASOURCE cDataSourceName   Specifies the name of the ODBC data source for the connection.

USERID cUserID   Specifies your user identification for the ODBC data source.

PASSWORD cPassWord   Specifies your password for the ODBC data source.

DATABASE cDatabaseName   Specifies a database on the server to which the connection is made.

CONNSTRING cConnectionString   Specifies a connection string for the ODBC data source. The connection string can be used instead of explicitly including the ODBC data source, the user identification, and password.

Remarks

If you omit the optional arguments, the Connection Designer appears, allowing you to interactively create a connection.


CREATE CONNECTION Command Example

The following example assumes an ODBC data source called MyFoxSQLNT is available, and the user ID for the data source is “sa.” The testdata database is opened, and a connection named Myconn is created. DISPLAY CONNECTIONS is used to display the named connections in the database. The connection is then removed from the database with DELETE CONNECTION.

CLOSE DATABASES

OPEN DATABASE (SYS(2004) + 'samples\data\testdata')

CREATE CONNECTION Myconn DATASOURCE "MyFoxSQLNT" USERID "sa"

CLEAR

DISPLAY CONNECTIONS  && Displays named connections in the database

DELETE CONNECTION Myconn  && Removes the connection just created


See Also

DELETE CONNECTION
DBGETPROP( )
DISPLAY CONNECTIONS
LIST CONNECTIONS
MODIFY CONNECTION
OPEN DATABASE
RENAME CONNECTION


CREATE CURSOR - SQL Command

Syntax         Arguments         Remarks         Example         See Also

Creates a temporary table.

Syntax

CREATE CURSOR alias_name
(fname1 type [(precision [, scale])
[NULL | NOT NULL]
[CHECK lExpression [ERROR cMessageText]]
[DEFAULT eExpression]
[UNIQUE]
[NOCPTRANS]]
[, fname2 ...])
| FROM ARRAY ArrayName

Arguments

alias_name   Specifies the name of the temporary table to create. alias_name can be a name expression.

fname   Specifies the name of a field in the temporary table. Each fname can be a name expression.

type   Specifies a single letter indicating the data type for the field.

precision   Specifies the width of the field specified with fname. Some data types require that you specify a precision.

scale   Specifies the number of decimal places for the specified data type. Some data types require that you specify a scale.

The following table shows what type, precision, and scale can be:

FieldType	nFieldWidth	nPrecision	Description
C	n	-	Character field of width n
D	-	-	Date
T	-	-	Datetime
N	n	d	Numeric field of width n with d decimal places
F	n	d	Floating numeric field of width n with d decimal places
I	-	-	Integer
B	-	d	Double
Y	-	-	Currency
L	-	-	Logical
M	-	-	Memo
G	-	-	General
P	-	-	Picture
nFieldWidth and nPrecision are ignored for D, T, Y, L, M, G, and P types. nPrecision defaults to zero (no decimal places) if nPrecision isn’t included for the N, F, or B types.

NULL   Allows null values in the field.

NOT NULL   Prevents null values in the field.

If you omit NULL and NOT NULL, the current setting of SET NULL determines if null values are allowed in the field. However, if you omit NULL and NOT NULL and include the PRIMARY KEY or UNIQUE clause, the current setting of SET NULL is ignored and the field defaults to NOT NULL.

CHECK lExpression   Specifies a validation rule for the field. lExpression can be a user-defined function.

ERROR cMessageText   Specifies the error message Visual FoxPro displays when the field validation rule generates an error. The message is displayed only when data is changed within a Browse window or Edit window.

DEFAULT eExpression   Specifies a default value for the field. The data type of eExpression must be the same as the field’s data type.

UNIQUE   Creates a candidate index for the field. The candidate index tag has the same name as the field.

For more information about candidate indexes, see “Using Indexes” in Chapter 7, “Working with Tables,” in the Developer’s Guide.

Note   Candidate indexes (created by including the UNIQUE option) are not the same as indexes created with the UNIQUE option in the INDEX command. An index created with the UNIQUE option in the INDEX command allows duplicate index keys; candidate indexes do not allow duplicate index keys.

Null values and duplicate records are not permitted in a field used for a candidate index. However, Visual FoxPro will not generate an error if you create a candidate index for a field that supports null values. Visual FoxPro will generate an error if you attempt to enter a null or duplicate value into a field used for a candidate index.

NOCPTRANS   Prevents translation to a different code page for character and memo fields. If the cursor is converted to another code page, the fields for which NOCPTRANS has been specified are not translated. NOCPTRANS can be specified only for character and memo fields.

The following example creates a cursor named MYCURSOR containing two character fields and two memo fields. The second character field CHAR2 and the second memo field MEMO2 include NOCPTRANS to prevent translation.

CREATE CURSOR mycursor (char1 C(10), char2 C(10) NOCPTRANS,;

memo1 M, memo2 M NOCPTRANS)

FROM ARRAY ArrayName   Specifies the name of an existing array whose contents are the name, type, precision, and scale for each field in the temporary table. See AFIELDS( )  for the proper format for the contents of the array.

Remarks

CREATE CURSOR creates a temporary table that exists only until it is closed. A temporary table created with CREATE CURSOR can be manipulated like any other table — it can be browsed and indexed, and you can append and modify records.

The temporary table is opened in the lowest available work area, and can be accessed by its alias. Each field in the temporary table is defined with a name, type, precision, and scale. These definitions can be obtained from the command itself or from an array. The temporary table is opened exclusively regardless of the setting of SET EXCLUSIVE.


CREATE CURSOR - SQL Command Example

The following example creates a cursor with the alias employee. A blank record is appended, filled, and displayed with the BROWSE command.

CLOSE DATABASES

CLEAR

CREATE CURSOR employee ;

   (EmpID N(5), Name C(20), Address C(30), City C(30), ;

    PostalCode C(10), OfficeNo C(8) NULL, Specialty M)

DISPLAY STRUCTURE

WAIT WINDOW "Press a key to add a record."

INSERT INTO employee (EmpId, Name, Address, City, PostalCode, ;

                      OfficeNo, Specialty);

   VALUES (1002, "Dr. Bonnie Doren", "University of Oregon", "Eugene", ;

           "98403", "", "Secondary Special Education")

BROWSE

* At this point you could copy this record to a permanent table

CLOSE ALL     && Once the cursor is closed, all data is flushed

              && from memory

CLEAR


See Also

AFIELDS( )
CREATE
CREATE QUERY
CREATE TABLE - SQL
INSERT - SQL
MODIFY QUERY
SELECT - SQL


CREATE DATABASE Command

Syntax         Arguments         Remarks         Example         See Also

Creates a database and opens it.

Syntax

CREATE DATABASE [DatabaseName | ?]

Arguments

DatabaseName   Specifies the name of the database to create.

If SAFETY is set to ON and the database name you specify has the same path and name as an existing database, Visual FoxPro displays a warning dialog box that prompts you to specify a new path or name for the database.

?   Displays the Create dialog box from which you can specify the name of the database to create.

Remarks

A database file has a .DBC extension. The associated database memo files have a .DCT extension, and the associated index files have a .DCX extension.

The database is opened exclusively, regardless of the setting of SET EXCLUSIVE. Because CREATE DATABASE opens the database after it has been created, you do not have to issue a subsequent OPEN DATABASE command.

If CREATE DATABASE is issued without any of its optional arguments, the Create dialog box is displayed, allowing you to specify a name for the database.


CREATE DATABASE Command Example

This example creates a database named people. A table named friends is created and is automatically added to the database. DISPLAY TABLES is used to display the tables in the database, and DISPLAY DATABASES is used to display information about the tables in the database.

CREATE DATABASE people

CREATE TABLE friends (FirstName C(20), LastName C(20))

CLEAR

DISPLAY TABLES  && Displays tables in the database

DISPLAY DATABASES  && Displays table information


See Also

ADD TABLE
CLOSE DATABASES
DBC( )
DBGETPROP( )
DBSETPROP( )
DELETE DATABASE
DISPLAY TABLES
FREE TABLE
MODIFY DATABASE
OPEN DATABASE
PACK DATABASE
REMOVE TABLE
SET DATABASE
VALIDATE DATABASE


CREATE FORM Command

Syntax         Arguments         Remarks         See Also

Opens the Form Designer.

Syntax

CREATE FORM [FormName | ?]
[NOWAIT] [SAVE] [DEFAULT]
[[WINDOW WindowName1]
[IN [WINDOW] WindowName2 | IN SCREEN]]

Arguments

FormName   Specifies the file name for the form. If you don’t specify an extension for the file name, Visual FoxPro automatically assigns an .SCX extension. If a form file with the name you specify already exists, you are asked if you want to overwrite the existing file (if SET SAFETY is set to ON).

?   Displays the Create dialog box from which you can choose a form or enter the name of a new form to create.

NOWAIT   Continues program execution after the Form Designer has been opened. The program doesn’t wait for the Form Designer to be closed, but continues execution on the program line immediately following the line that contains CREATE FORM NOWAIT. If you omit NOWAIT, when CREATE FORM is issued in a program, the Form Designer is opened and program execution pauses until the Form Designer is closed.

Including NOWAIT has no effect on CREATE FORM when it is issued in the Command window.

SAVE   When issued in a program, leaves the Form Designer open after another window is brought forward. Including the SAVE option has no effect when issued from the Command window.

DEFAULT   Specifies that the Form Designer is opened with the default Visual FoxPro form template, overriding a default form template specified on the Forms tab of the Options dialog.

For additional information about form templates, see “Using Form and Form Set Templates” and Chapter 9, “Creating Forms,” in the Developer’s Guide.

WINDOW WindowName1   Specifies a window whose characteristics the Form Designer takes on. For example, if the window is created with the FLOAT option of DEFINE WINDOW, the Form Designer can be moved. The window need not be active or visible, but it must be defined.

The Form Designer has a default size that can be larger than the window from which it takes its characteristics. In this case, the Form Designer still assumes the characteristics of the window in which it is placed. The upper-left corner of the Form Designer is placed at the same coordinates as the upper-left corner of the window, and extends beyond the window’s borders.

IN [WINDOW] WindowName2   Specifies a parent window in which the Form Designer is opened. The Form Designer doesn’t assume the characteristics of the parent window and cannot be moved outside the parent window. If the parent window is moved, the Form Designer moves with it.

The parent window must first be defined with DEFINE WINDOW, and must be visible, to access the Form Designer.

IN SCREEN   Specifies that the Form Designer is explicitly opened in the main Visual FoxPro window, after the Form Designer has been placed in a parent window. The Form Designer is placed in a parent window by including the IN WINDOW clause.

Remarks

Issuing CREATE FORM without any additional arguments opens a new form in the Form Designer. When you exit the Form Designer, you are prompted to save the form with a different name.


See Also

_BROWSER
COMPILE FORM
DO FORM
GETPEM( )
MODIFY FORM
PEMSTATUS( )
SYS(1269) - Property Information
SYS(1270) - Object Location
SYS(1271) - Object's .SCX File
SYS(1272) - Object Hierarchy


CREATE FROM Command

Syntax         Arguments         Remarks         Example         See Also

Creates a table from a COPY STRUCTURE EXTENDED file.

Syntax

CREATE

[FileName1 [DATABASE DatabaseName [NAME LongTableName]]]
FROM [FileName2]

Arguments

FileName1   Specifies the name of the new table to create.

DATABASE DatabaseName   Specifies a database to which the new table is added.

NAME LongTableName   Specifies a long name for the new table. Long names can contain up to 128 characters and can be used in place of short file names in the database.

FileName2   Specifies the table (created either with COPY STRUCTURE EXTENDED or manually) from which the new table is created.

Remarks

This variation of CREATE assumes that the table specified in FileName2 has been created either with COPY STRUCTURE EXTENDED or manually. A new table FileName1 is created with the structure described in FileName2. The newly created table becomes the active table.

If you don’t include either FileName1 or FileName2 or both, a dialog box is displayed. In this dialog, you can specify the file to be created, or the FROM file, or both.

Note that all records in FileName2, including those marked for deletion, are used to created FileName1.


CREATE FROM Command Example

The following example displays the structure of the orders table, copies the structure extended to the temp table, browses temp, creates a table called backup from temp, and displays the structure of backup.

CLOSE DATABASES

CLEAR

SET PATH TO (HOME( ) + 'samples\data\')  	&& Sets path to database

USE orders

DISPLAY STRUCTURE

WAIT WINDOW 'Structure of the orders table' NOWAIT

COPY STRUCTURE EXTENDED TO temp

USE temp

WAIT WINDOW 'Temp table has 1 row per field in ORDERS' NOWAIT

BROWSE

CREATE backup FROM temp

USE backup

DISPLAY STRUCTURE

WAIT WINDOW 'Backup.dbf has the same structure as ORDERS' NOWAIT

USE

DELETE FILE temp.dbf

DELETE FILE backup.dbf


See Also

COPY STRUCTURE EXTENDED


CREATE LABEL Command

Syntax         Arguments         Remarks         See Also

Opens the Label Designer so you can create a label.

Syntax

CREATE LABEL [FileName | ?]
[NOWAIT] [SAVE]
[WINDOW WindowName1]
[IN [WINDOW] WindowName2 | IN SCREEN]

Arguments

FileName   Specifies the file name for the label. If you don’t specify an extension for the file name, Visual FoxPro automatically assigns an .LBX extension.

?   Displays the Create dialog box that prompts you to name the label being created.

NOWAIT   Continues program execution after the Label Designer is opened. The program doesn’t wait for the Label Designer to be closed, but continues execution on the program line immediately following the line that contains CREATE LABEL NOWAIT. If you omit NOWAIT when CREATE LABEL is issued in a program, the Label Designer is opened and program execution pauses until the Label Designer is closed.

Including the NOWAIT option has no effect on the CREATE LABEL command when issued from the Command window.

SAVE   Leaves the Label Designer open after another window is activated. If you omit SAVE, the Label Designer is closed when another window is activated.

Including SAVE has no effect when issued from the Command window.

WINDOW WindowName1   Specifies a window whose characteristics the Label Designer takes on. For example, if the window is created with the FLOAT option of DEFINE WINDOW, the Label Designer can be moved. The window doesn’t have to be active or visible, but it must be defined.

The Label Designer has a default size that can be larger than the window from which it takes its characteristics. In this case, the Label Designer still assumes the characteristics of the window in which it is placed. The upper-left corner of the Label Designer is placed at the same coordinates as the upper-left corner of the window, and extends beyond the window’s borders.

IN [WINDOW] WindowName2   Specifies a parent window in which the Label Designer is opened. The Label Designer doesn’t assume the characteristics of the parent window and cannot be moved outside the parent window. If the parent window is moved, the Label Designer moves with it.

The parent window must first be defined with DEFINE WINDOW, and must be visible to access the Label Designer.

IN SCREEN   Specifies that the Label Designer is explicitly opened in the main Visual FoxPro window, after the Label Designer has been placed in a parent window. A Label Designer is placed in a parent window by including the IN WINDOW clause.

Remarks

CREATE LABEL lets you create labels in standard label formats or design your own custom labels. You can also use the Label Wizard to create labels.

For more information on creating labels, see Designing Reports and Labels in the Using Visual FoxPro section, and Chapter 7, “Designing Reports and Labels,” in the User’s Guide.


See Also

LABEL
MODIFY LABEL


CREATE MENU Command

Syntax         Arguments         Remarks         See Also

Opens the Menu Designer in Visual FoxPro.

Syntax

CREATE MENU [FileName | ?]
[NOWAIT] [SAVE]
[WINDOW WindowName1]
[IN [WINDOW] WindowName2 | IN SCREEN]

Arguments

FileName   Specifies the file name for the menu table. If you don’t specify an extension for the file name, Visual FoxPro automatically assigns an .MNX extension.

?   Displays the Create dialog box that prompts you to name the menu being created.

NOWAIT   Continues program execution after the Menu Designer is opened. The program doesn’t wait for the Menu Designer to be closed, but continues execution on the program line immediately following the line that contains CREATE MENU NOWAIT. If you omit NOWAIT, when CREATE MENU is issued in a program, the Menu Designer is opened and program execution pauses until the Menu Designer is closed.

If you issue CREATE MENU from the Command window and include NOWAIT, the New Menu dialog is not displayed. The New Menu dialog lets you specify the type of menu (standard or shortcut) created.

SAVE   Leaves the Menu Designer open after another window is activated. If you omit SAVE, the Menu Designer is closed when another window is activated. Including SAVE has no effect when issued from the Command window.

WINDOW WindowName1   Specifies a window whose characteristics the Menu Designer takes on. For example, if the window is created with the FLOAT option of DEFINE WINDOW, the Menu Designer can be moved. The window need not be active or visible, but it must be defined.

The Menu Designer has a default size that can be larger than the window from which it takes its characteristics. In this case, the Menu Designer still assumes the characteristics of the window in which it is placed. The upper-left corner of the Menu Designer is placed at the same coordinates as the upper-left corner of the window, and extends beyond the window’s borders.

IN [WINDOW] WindowName2   Specifies a parent window in which the Menu Designer is opened. The Menu Designer doesn’t assume the characteristics of the parent window and cannot be moved outside the parent window. If the parent window is moved, the Menu Designer moves with it.

The parent window must first be defined with DEFINE WINDOW, and must be visible, to access the Menu Designer.

IN SCREEN   Specifies that the Menu Designer is opened explicitly in the main Visual FoxPro window, after the Menu Designer has been placed in a parent window. The Menu Designer is placed in a parent window by including the IN WINDOW clause.

Remarks

Issuing CREATE MENU without any additional arguments opens the Menu Designer within which you can define a menu system. The name MENU1 is temporarily assigned to the menu definition table. When you exit the Menu Designer, you can save the menu definition under a different name.

For more information on creating menus, see “Creating a Menu System” and Chapter 11, “Designing Menus and Toolbars,” in the Developer’s Guide.


See Also

DEFINE MENU
MODIFY MENU


CREATE PROJECT Command

Syntax         Arguments         Remarks         See Also

Opens the Project Manager so you can create a project.

Syntax

CREATE PROJECT [FileName | ?]
[NOWAIT] [SAVE]
[WINDOW WindowName1]
[IN [WINDOW] WindowName2 | IN SCREEN]

Arguments

FileName   Specifies the file name for the project table. If you don’t specify an extension for the file name, Visual FoxPro automatically assigns a .PJX extension.

?   Displays the Create dialog box that prompts you to name the project being created.

NOWAIT   Continues program execution after the Project Manager is opened. The program doesn’t wait for the Project Manager to be closed, but continues execution on the program line immediately following the line that contains CREATE PROJECT NOWAIT. If you omit NOWAIT when CREATE PROJECT is issued in a program, the Project Manager is opened and program execution pauses until the Project Manager is closed.

Including NOWAIT has no effect on CREATE PROJECT when it is issued in the Command window.

SAVE   Leaves the Project Manager open after another window is activated. If you omit SAVE, the Project Manager is closed when another window is activated.

Including SAVE has no effect when issued from the Command window.

WINDOW WindowName1   Specifies a window whose characteristics the Project Manager takes on. For example, if the window is created with the FLOAT option of DEFINE WINDOW, the Project Manager can be moved. The window need not be active or visible, but it must be defined.

The Project Manager has a default size that can be larger than the window from which it takes its characteristics. In this case, the Project Manager still assumes the characteristics of the window in which it is placed. The upper-left corner of the Project Manager is placed at the same coordinates as the upper-left corner of the window, and extends beyond the window’s borders.

IN [WINDOW] WindowName2   Specifies a parent window in which the Project Manager is opened. The Project Manager doesn’t assume the characteristics of the parent window and cannot be moved outside the parent window. If the parent window is moved, the Project Manager moves with it.

The parent window must first be defined with DEFINE WINDOW, and must be visible, to access the Project Manager.

IN SCREEN   Specifies that the Project Manager is explicitly opened in the main Visual FoxPro window, after the Project Manager has been placed in a parent window. The Project Manager is placed in a parent window by including the IN WINDOW clause.

Remarks

A project is a table that keeps track of all files that are required to create an application, as well as all dependencies, references, and connections among the files. A project table has a .PJX extension and an associated memo file with a .PJT extension. In a project, you specify all the pieces that are required for an application, and Visual FoxPro ensures that compiled files are based on the latest source files.

A project table can be opened with USE and manipulated like any other Visual FoxPro table.

Issuing the command CREATE PROJECT without any additional arguments displays the Create dialog, allowing you to specify a name for the project.

For more information on building projects, see Chapter 13, “Compiling an Application,” in the Developer’s Guide.


See Also

BUILD APP
BUILD PROJECT
MODIFY PROJECT


CREATE QUERY Command

Syntax         Arguments         Remarks         See Also

Opens the Query Designer.

Syntax

CREATE QUERY [FileName | ?]
[NOWAIT]

Arguments

FileName   Specifies the file name for the query. If you don’t specify an extension for the file name, Visual FoxPro automatically assigns a .QPR extension.

?   Displays the Create dialog box that prompts you to name the query being created.

NOWAIT   Continues program execution after the Query Designer is opened. The program doesn’t wait for the Query Designer to be closed, but continues execution on the program line immediately following the line that contains CREATE QUERY NOWAIT. If you omit NOWAIT when CREATE QUERY is issued in a program, the Query Designer is opened and program execution pauses until the Query Designer is closed.

NOWAIT is effective only from within a program. It has no effect on CREATE QUERY when issued from the Command window.

Remarks

CREATE QUERY opens the Query Designer so you can interactively create a query.

A SQL SELECT command is used to retrieve data from tables. SELECT is very powerful and can replace a series of Visual FoxPro commands. Because one SQL SELECT performs the function of a series of Visual FoxPro commands, SELECT optimizes program performance.

Think of SELECT as a way to pose a query to Visual FoxPro to obtain information from tables. SELECT allows you to specify the information you want without telling Visual FoxPro how to retrieve the information. Visual FoxPro determines the best way to retrieve the information.

After you create a query, the query is stored as a Visual FoxPro program file with a .QPR extension. A query program can be executed with DO. You must include the query file extension when executing a query with DO, as shown in the following example.

DO my_query.qpr

Issuing the command CREATE QUERY without any additional arguments opens a new query window. The name QUERY1 is assigned to the query. When you exit the Query window, you can save the query with a different name.

For more information about creating queries, see “Creating a Query” in Chapter 4, “Retrieving Data,” in the User’s Guide.


See Also

MODIFY QUERY
SELECT - SQL


CREATE REPORT Command

Syntax         Arguments         Remarks         See Also

Opens a report in a Report Designer.

Syntax

CREATE REPORT [FileName | ?]
[NOWAIT] [SAVE]
[WINDOW WindowName1]
[IN [WINDOW] WindowName2 | IN SCREEN]

Arguments

FileName   Specifies the file name for the report. If you don’t specify an extension for the file name, Visual FoxPro automatically assigns an .FRX extension. If a report file with the name you specify already exists, you are asked if you want to overwrite the existing file (if SET SAFETY is ON).

?   Displays the Create dialog box that prompts you to name the report being created.

NOWAIT   Continues program execution after the Report Designer is opened. The program doesn’t wait for the Report Designer to be closed, but continues execution on the program line immediately following the line that contains CREATE REPORT NOWAIT. If you omit NOWAIT when CREATE REPORT is issued in a program, the Report Designer is opened and program execution pauses until the Report Designer is closed.

Including NOWAIT has no effect on CREATE REPORT when it is issued in the Command window.

SAVE   Leaves the Report Designer open after another window is activated. If you omit SAVE, the Report Designer is closed when another window is activated.

Including SAVE has no effect when issued from the Command window.

WINDOW WindowName1   Specifies a window whose characteristics the Report Designer takes on. For example, if the window is created with the FLOAT option of DEFINE WINDOW, the Report Designer can be moved. The window need not be active or visible, but it must be defined.

The Report Designer has a default size that can be larger than the window from which it takes its characteristics. In this case, the Report Designer still assumes the characteristics of the window in which it is placed. The upper-left corner of the Report Designer is placed at the same coordinates as the upper-left corner of the window, and extends beyond the window’s borders.

IN [WINDOW] WindowName2   Specifies a parent window in which the Report Designer is opened. The Report Designer doesn’t assume the characteristics of the parent window and cannot be moved outside the parent window. If the parent window is moved, the Report Designer moves with it.

The parent window must first be defined with DEFINE WINDOW, and must be visible, to access the Report Designer.

IN SCREEN   Specifies that the Report Designer is opened explicitly in the main Visual FoxPro window, after the Report Designer has been placed in a parent window. The Report Designer is placed in a parent window by including the IN WINDOW clause.

Remarks

Issuing CREATE REPORT without any additional arguments opens a new Report Designer. The name REPORT1 is assigned to the report definition. When you exit the Report Designer, you are prompted to save the report definition with a different name.

CREATE REPORT can also be used to generate a quick report without opening the Report Designer. For more information, see CREATE REPORT - Quick Report.

For additional information on reports and labels, see Designing Reports and Labels in the Using Visual FoxPro section, and Chapter 7, “Designing Reports and Labels,” in the User’s Guide.


See Also

ASCIICOLS
_ASCIIROWS
CREATE REPORT - Quick Report
MODIFY REPORT
REPORT


CREATE REPORT - Quick Report Command

Syntax         Arguments         Remarks         See Also

Programmatically creates a report.

Syntax

CREATE REPORT FileName1 | ? FROM FileName2
[FORM | COLUMN] [FIELDS FieldList] [ALIAS]
[NOOVERWRITE] [WIDTH nColumns]

Arguments

FileName1   Specifies the file name for the report. If you don’t specify an extension for the file name, Visual FoxPro automatically assigns an .FRX extension.

?   Displays the Create dialog box that prompts you to name the report being created.

FROM FileName2   Specifies the name of the table from which the report is created. The table doesn't have to be open.

FORM   Specifies that the report is created with the fields and their names arranged from top to bottom in the Detail band.

COLUMN   Specifies that the report is created with the fields arranged from left to right across the page in the Detail band. The field names are placed in the Page Header band. If you omit FORM and COLUMN, the report defaults to the COLUMN format.

FIELDS FieldList   Specifies the fields from the table that appear in the report. Separate the fields in FieldList with commas.

ALIAS   Specifies that the table alias is added to the field names in the report.

NOOVERWRITE   Specifies that an existing report isn’t overwritten. If a report already exists with the name specified with FileName1, the report isn't created.

WIDTH nColumns   Specifies the width of the report page in columns.

Remarks

This form of CREATE REPORT creates a quick report without opening the Report Designer. The report is created as if you chose Quick Report from the Report menu.

Another form of CREATE REPORT, discussed in the previous topic, opens the Report Designer to let you interactively create a report.

For additional information on reports and labels, see Designing Reports and Labels in the Using Visual FoxPro section, and Chapter 7, “Designing Reports and Labels,” in the User’s Guide.


See Also

CREATE REPORT
MODIFY REPORT
REPORT


CREATE SCREEN - Quick Screen Command

Included for backward compatibility. Use the Form Designer instead.


CREATE SCREEN Command

Included for backward compatibility. Use CREATE FORM instead.


CREATE SQL VIEW Command

Syntax         Arguments         Remarks         Example         See Also

Displays the View Designer, allowing you to create a SQL view.

Syntax

CREATE SQL VIEW [ViewName ] [REMOTE]
[CONNECTION ConnectionName [SHARE]
| CONNECTION DataSourceName]
[AS SQLSELECTStatement]

Arguments

ViewName   Specifies the name of the view to create.

REMOTE   Specifies that a remote view using remote tables is created. If you omit REMOTE, you can create a view using local tables.

CONNECTION ConnectionName [SHARE]   Specifies a named connection to establish when the view is opened. If you include the SHARE clause, Visual FoxPro will use a shared connection if one is available. If a shared connection isn’t available, a unique connection is created when the view is opened and cannot be shared with other views.

CONNECTION DataSourceName   Specifies an existing datasource to which a connection is established.

AS SQLSELECTStatement   Specifies the view definition. SQLSELECTStatement must be a valid SQL SELECT statement, and should not be enclosed in quotation marks. For local views, preface the view or table name with the name of the database and an exclamation point (!). For example, the following command creates a SQL view called mysqlview that selects all fields in the orders table in the customer database:

CREATE SQL VIEW mysqlview AS SELECT * FROM customer!orders

For additional information about SQL SELECT statements, see SELECT - SQL.

You can limit the scope of a view without creating a separate view for each subset of records by creating a parameterized view. A parameterized view uses a WHERE clause that limits the records downloaded to only those records by supplying a value as a parameter.

For example, you can create a SQL view that allows you to download records for any country, simply by supplying the country’s name when you use the view.

The parameter you supply is evaluated as a Visual FoxPro expression. If the evaluation fails, Visual FoxPro prompts for the parameter value. For example, if the customer table from the Testdata database is located on a remote server, the following example creates a parameterized remote view that limits the view to those customers whose country matches the value supplied for the ?cCountry parameter:

OPEN DATABASE testdata

CREATE SQL VIEW customer_remote_view CONNECTION remote_01 ;

AS SELECT * FROM customer WHERE customer.country = ?cCountry

Tip   If your parameter is an expression, enclose the parameter expression in parentheses. This allows the entire expression to be evaluated as part of the parameter.

For additional information about parameterized views, see Chapter 8, “Creating Views,” in the Developer’s Guide.

Remarks

An SQL view allows you to extract specific fields and records from one or more related tables, and treat the resulting data set as a table that you can update. Views are a powerful means of providing customized access to selected portions of your database, combining the flexibility of a query with the ability to update data.

For details about creating and using views, see Chapter 8, “Creating Views” in the Developer’s Guide.


CREATE SQL VIEW Command Example

The following example opens the testdata database. CREATE SQL VIEW is used to create a local SQL view named myview which is created from a SELECT - SQL statement that selects all records from the customer table. The View Designer is displayed, allowing you to modify the SQL view. After the View Designer is closed, the SQL view is erased.

CLOSE DATABASES

* Open testdata database

OPEN DATABASE SYS(2004)+"samples\data\testdata"

* Create view with initial select criteria from customer table

CREATE SQL VIEW myview AS SELECT * FROM testdata!customer;

WHERE country="Mexico"

* Activate View Designer to modify or run query

MODIFY VIEW myview  &&Activates View Designer

* Delete view after View Designer closes

DELETE VIEW myview


See Also

CREATE DATABASE
CREATE VIEW
DELETE VIEW
DISPLAY VIEWS
LIST VIEWS
MODIFY VIEW
OPEN DATABASE
RENAME VIEW
SELECT - SQL
USE


CREATE TABLE - SQL Command

Syntax         Arguments         Remarks         Example         See Also

Creates a table having the specified fields.

Syntax

CREATE TABLE | DBF TableName1 [NAME LongTableName] [FREE]
(FieldName1 FieldType [(nFieldWidth [, nPrecision])]
[NULL | NOT NULL]
[CHECK lExpression1 [ERROR cMessageText1]]
[DEFAULT eExpression1]
[PRIMARY KEY | UNIQUE]
[REFERENCES TableName2 [TAG TagName1]]
[NOCPTRANS]
[, FieldName2 ...]
[, PRIMARY KEY eExpression2 TAG TagName2
|, UNIQUE eExpression3 TAG TagName3]
[, FOREIGN KEY eExpression4 TAG TagName4 [NODUP]
REFERENCES TableName3 [TAG TagName5]]
[, CHECK lExpression2 [ERROR cMessageText2]])
| FROM ARRAY ArrayName

Arguments

TableName1   Specifies the name of the table to create. The TABLE and DBF options are identical.

NAME LongTableName   Specifies a long name for the table. A long table name can be specified only when a database is open because long table names are stored in databases.

Long names can contain up to 128 characters and can be used in place of short file names in the database.

FREE   Specifies that the table will not be added to an open database. FREE isn’t required if a database isn’t open.

(FieldName1 FieldType [(nFieldWidth [, nPrecision])]   Specifies the field name, field type, field width, and field precision (number of decimal places), respectively.

A single table can contain up to 255 fields. If one or more fields allow null values, the limit is reduced by one to 254 fields.

FieldType is a single letter indicating the field’s data type. Some field data types require that you specify nFieldWidth or nPrecision, or both.

The following table lists the values for FieldType and whether nFieldWidth and nPrecision are required.

FieldType	nFieldWidth	nPrecision	Description
C	n	-	Character field of width n
D	-	-	Date
T	-	-	DateTime
N	n	d	Numeric field of width n with d decimal places
F	n	d	Floating numeric field of width n with d decimal places
I	-	-	Integer
B	-	d	Double
Y	-	-	Currency
L	-	-	Logical
M	-	-	Memo
G	-	-	General
nFieldWidth and nPrecision are ignored for D, T, I, Y, L, M, G, and P types. nPrecision defaults to zero (no decimal places) if nPrecision isn’t included for the N or F types. nPrecision defaults to the number of decimal places specified by the SET DECIMAL setting if nPrecision isn’t included for the B type.

NULL   Allows null values in the field. If one or more fields can contain null values, the maximum number of fields the table can contain is reduced by one, from 255 to 254.

NOT NULL   Prevents null values in the field.

If you omit NULL and NOT NULL, the current setting of SET NULL determines if null values are allowed in the field. However, if you omit NULL and NOT NULL and include the PRIMARY KEY or UNIQUE clause, the current setting of SET NULL is ignored and the field defaults to NOT NULL.

CHECK lExpression1   Specifies a validation rule for the field. lExpression1 can be a user-defined function. Note that when a blank record is appended, the validation rule is checked. An error is generated if the validation rule doesn’t allow for a blank field value in an appended record.

ERROR cMessageText1   Specifies the error message Visual FoxPro displays when the validation rule specified with CHECK generates an error. The message is displayed only when data is changed within a Browse window or Edit window.

DEFAULT eExpression1   Specifies a default value for the field. The data type of eExpression1must be the same as the field’s data type.

PRIMARY KEY   Creates a primary index for the field. The primary index tag has the same name as the field.

UNIQUE   Creates a candidate index for the field. The candidate index tag has the same name as the field. For more information about candidate indexes, see “Using Indexes” in Chapter 7, “Working with Tables,” in the Developer’s Guide.

Note   Candidate indexes (created by including the UNIQUE option in CREATE TABLE or ALTER TABLE - SQL) are not the same as indexes created with the UNIQUE option in the INDEX command. An index created with the UNIQUE option in the INDEX command allows duplicate index keys; candidate indexes do not allow duplicate index keys. See INDEX for additional information on its UNIQUE option.

Null values and duplicate records are not permitted in a field used for a primary or candidate index. However, Visual FoxPro will not generate an error if you create a primary or candidate index for a field that supports null values. Visual FoxPro will generate an error if you attempt to enter a null or duplicate value into a field used for a primary or candidate index.

REFERENCES TableName2 [TAG TagName1]   Specifies the parent table to which a persistent relationship is established. If you omit TAG TagName1, the relationship is established using the primary index key of the parent table. If the parent table does not have a primary index, Visual FoxPro generates an error.

Include TAG TagName1 to establish a relation based on an existing index tag for the parent table. Index tag names can contain up to 10 characters.

The parent table cannot be a free table.

NOCPTRANS   Prevents translation to a different code page for character and memo fields. If the table is converted to another code page, the fields for which NOCPTRANS has been specified are not translated. NOCPTRANS can only be specified for character and memo fields.

The following example creates a table named MYTABLE containing two character fields and two memo fields. The second character field CHAR2 and the second memo field MEMO2 include NOCPTRANS to prevent translation.

CREATE TABLE mytable (char1 C(10), char2 C(10) NOCPTRANS,;

memo1 M, memo2 M NOCPTRANS)

PRIMARY KEY eExpression2 TAG TagName2   Specifies a primary index to create. eExpression2 specifies any field or combination of fields in the table. TAG TagName2 specifies the name for the primary index tag that is created. Index tag names can contain up to 10 characters.

Because a table can have only one primary index, you cannot include this clause if you have already created a primary index for a field. Visual FoxPro generates an error if you include more than one PRIMARY KEY clause in CREATE TABLE.

UNIQUE eExpression3 TAG TagName3   Creates a candidate index. eExpression3 specifies any field or combination of fields in the table. However, if you have created a primary index with one of the PRIMARY KEY options, you cannot include the field that was specified for the primary index. TAG TagName3 specifies a tag name for the candidate index tag that is created. Index tag names can contain up to 10 characters.

A table can have multiple candidate indexes.

FOREIGN KEY eExpression4 TAG TagName4 [NODUP]   Creates a foreign (non-primary) index, and establishes a relationship to a parent table. eExpression4 specifies the foreign index key expression and TagName4 specifies the name of the foreign index key tag that is created. Index tag names can contain up to 10 characters. Include NODUP to create a candidate foreign index.

You can create multiple foreign indexes for the table, but the foreign index expressions must specify different fields in the table.

REFERENCES TableName3 [TAG TagName5]   Specifies the parent table to which a persistent relationship is established. Include TAG TagName5 to establish a relation based on an index tag for the parent table. Index tag names can contain up to 10 characters. If you omit TAG TagName5, the relationship is established using the parent table’s primary index key by default.

CHECK eExpression2 [ERROR cMessageText2]   Specifies the table validation rule. ERROR cMessageText2 specifies the error message Visual FoxPro displays when the table validation rule is executed. The message is displayed only when data is changed within a Browse window or Edit window.

FROM ARRAY ArrayName   Specifies the name of an existing array whose contents are the name, type, precision, and scale for each field in the table. The contents of the array can be defined with the AFIELDS( ) function.

Remarks

The new table is opened in the lowest available work area, and can be accessed by its alias. The new table is opened exclusively, regardless of the current setting of SET EXCLUSIVE.

If a database is open and you don’t include the FREE clause, the new table is added to the database. You cannot create a new table with the same name as a table in the database.

If a database is open, CREATE TABLE -SQL requires exclusive use of the database. To open a database for exclusive use, include EXCLUSIVE in OPEN DATABASE.

If a database isn’t open when you create the new table, including the NAME, CHECK, DEFAULT, FOREIGN KEY, PRIMARY KEY, or REFERENCES clauses generates an error.

Note that the CREATE TABLE syntax uses commas to separate certain CREATE TABLE options. Also, the NULL, NOT NULL, CHECK, DEFAULT, PRIMARY KEY and UNIQUE clause must be placed within the paratheses containing the column definitions.


CREATE TABLE - SQL Command Example

The following example creates a new database named Mydata1. CREATE TABLE is used to create three tables (Salesman, Customer, and Orders). The FOREIGN KEY and REFERENCES clauses in the second CREATE TABLE command create a persistent one-to-many relationship between the Salesman and Customer tables. The DEFAULT clauses in the third CREATE TABLE command establish default values, and  the CHECK and ERROR clauses establish business rules for entering data into specific fields. The MODIFY DATABASE is used to display the relationship between the three tables.

CLOSE DATABASES

CLEAR

* Create mydata database in the current directory or folder

CREATE DATABASE mydata1

* Create a salesman table with a primary key

CREATE TABLE salesman ;

(SalesID c(6) PRIMARY KEY, ;

SaleName C(20))

* Create a customer table and relate it to the salesman table.

CREATE TABLE customer ;

(SalesID c(6), ;

CustId i PRIMARY KEY, ;

CustName c(20) UNIQUE,	;

SalesBranch c(3), ;

FOREIGN KEY SalesId TAG SalesId REFERENCES salesman)

* Create an orders table related to customer with its own primary

* key and some business rules such as defaults & checks.

CREATE TABLE orders ;

(OrderId i PRIMARY KEY, ;

CustId i REFERENCES customer TAG CustId, ;

OrderAmt y(4), ;

OrderQty i ;

DEFAULT 10 ;

CHECK (OrderQty > 9) ;

ERROR "Order Quantity must be at least 10", ;

DiscPercent n(6,2) NULL ;

DEFAULT .NULL., ;

CHECK (OrderAmt > 0) ERROR "Order Amount Must be > 0" )

* Display new database, tables, and relationships

MODIFY DATABASE

* Delete example files

SET SAFETY OFF   && To suppress verification message

CLOSE DATABASES	  && Close database before deleting

DELETE DATABASE mydata1 DELETETABLES


See Also

AFIELDS( )
ALTER TABLE - SQL
CREATE
CREATE QUERY
INSERT - SQL
MODIFY QUERY
MODIFY STRUCTURE
OPEN DATABASE
SELECT - SQL
SET NOCPTRANS
SQL Commands Overview


CREATE TRIGGER Command

Syntax         Arguments         Remarks         Example         See Also

Creates a Delete, Insert, or Update trigger for a table.

Syntax

CREATE TRIGGER ON TableName
FOR DELETE | INSERT | UPDATE AS lExpression

Arguments

TableName   Specifies the table in the current database for which a trigger is created.

FOR DELETE | INSERT | UPDATE   Specifies the type of trigger Visual FoxPro creates.

If a trigger of the type you specify already exists and SET SAFETY is ON, Visual FoxPro asks you if you’d like to overwrite the existing trigger. If SET SAFETY is OFF, the existing trigger is automatically overwritten.

AS lExpression   Specifies the logical expression evaluated when the trigger occurs. lExpression can be a user-defined function or a stored procedure that returns a logical value. Stored procedures are created for a table with MODIFY PROCEDURE.

A user-defined function or a stored procedure can use AERROR( ) to determine the name of the table for which the trigger occurred and the trigger type.

If lExpression evaluates to true (.T.), the command or event that caused the trigger to occur is executed.

If lExpression evaluates to false (.F.), the command or event that caused the trigger to occur isn’t executed. If an ON ERROR procedure is in effect, the ON ERROR procedure is executed instead of the command or event. If an ON ERROR procedure is not in effect, the command or event isn’t executed and Visual FoxPro generates an error message.

Remarks

Use CREATE TRIGGER to trap for events that cause records in a table to be deleted, added, or changed. Delete, Insert, or Update triggers can be created only for a table that has been added to a database. Use CREATE DATABASE to create a database, and ADD TABLE to add a table to a database.

The following lists describe the events that cause a Delete, Insert, or Update trigger to occur.

Delete Trigger

•	DELETE is issued.

•	A record is marked for deletion from the Table Menu in a Browse window or Edit window.

Insert Trigger

•	APPEND FROM is issued.

•	APPEND FROM ARRAY is issued.

•	APPEND BLANK is issued.

•	A record is appended from the Table Menu in a Browse window or Edit window.

•	IMPORT is issued.

•	INSERT - SQL is issued.

•	RECALL is issued.

•	A record is recalled from the Table Menu in a Browse window or Edit window.

Update Trigger

•	GATHER is issued.

•	REPLACE is issued.

•	REPLACE FROM ARRAY is issued.

•	UPDATE – SQL is issued.

•	other event that causes a record to be modified, such when a Form changes the contents of a field.

The following rules apply to triggers created with CREATE TRIGGER:

•	INSERT cannot be issued for a table with a trigger. However, INSERT - SQL can be used.

•	Issuing PACK doesn’t cause any triggers to occur.

•	Issuing ZAP doesn’t cause a Delete trigger to occur.

•	No trigger occurs if you update a record marked for deletion.

•	A trigger may not occur immediately, depending on the current buffering mode:


CREATE TRIGGER Command Example

The following examples creates an Update trigger which prevents values greater than 50 from being entered in the maxordamt field in the customer table. An error message is generated when the first REPLACE command is executed because the value for the maxordamt field is greater than 50. The second REPLACE command does not generate an error because the value for the maxordamt field is less than or equal to 50.

CLOSE DATABASES

OPEN DATABASE SYS(2004)+"samples\data\testdata"

USE customer  && Open customer table

* Set trigger on maxordamt field to fail with values <= 50

CREATE TRIGGER ON customer FOR UPDATE AS maxordamt <= 50

ON ERROR  && Restore the system error handler

WAIT WINDOW "Press a key to test trigger with value of 60"+CHR(13);

   +"When you get the error message, press Ignore."

REPLACE maxordamt WITH 60        && Displays an error message

? maxordamt

WAIT WINDOW "Press a key to test with value of 50."

REPLACE maxordamt WITH 50        && Value is accepted

? maxordamt

DELETE TRIGGER ON customer FOR UPDATE  && Remove the trigger


See Also

ADD TABLE
AERROR( )
CREATE DATABASE
DELETE TRIGGER
DISPLAY DATABASE
LIST DATABASE
OPEN DATABASE


CREATE VIEW Command

Syntax         Arguments         Remarks         See Also

Creates a view file from the Visual FoxPro environment.

Syntax

CREATE VIEW FileName

Arguments

FileName   Specifies the name of the view file to create.

Remarks

CREATE VIEW builds a new view file containing information about the Visual FoxPro environment. SET VIEW restores the environment saved to a view file by CREATE VIEW. View files created with CREATE VIEW are assigned a .VUE extension.

The information saved in a view file includes:

•	All tables, index, alternate files, and format files currently open in all work areas

•	All fields contained in the SET FIELDS list

•	All established relations between open tables

•	All filters in effect for open tables

•	The DEFAULT and PATH settings

•	The procedure file setting

•	The current Help file

•	The current resource file

•	The SET SKIP status

•	The status bar state (ON or OFF)

View files are useful both in programs and while debugging. Only one command, SET VIEW TO FileName, needs to be executed to restore the entire environment. While debugging, the environment settings can be saved in a view file, testing can be performed, and the environment can be restored to continue program execution.


See Also

CREATE SQL VIEW
SET VIEW


CREATEBINARY( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Converts character type data created in Visual FoxPro to a binary type character string you can pass to an ActiveX control or automation object.

Syntax

CREATEBINARY(cExpression)

Returns

Character

Arguments

cExpression   Specifies the character expression for which a binary type character string is returned.

Remarks

Visual FoxPro character strings can contain binary data. However, an ActiveX control or automation object character string (OLE VT_BSTR type data) cannot contain binary data. An ActiveX control or automation object passes binary data to applications such as Visual FoxPro as an array of VT_UI1 type data.

Visual FoxPro automatically converts binary data passed from an ActiveX control or automation object as an array of VT_UI1 type data to a Visual FoxPro character string. Visual FoxPro internally marks this character string as binary data passed from an ActiveX control or automation object. When the character string is passed back to an ActiveX control or automation object, Visual FoxPro automatically converts the character string to an array of VT_UI1 type data the ActiveX control or automation object expects.

Use CREATEBINARY( ) to convert character type data created in Visual FoxPro to a binary type character string you can pass to an ActiveX control or automation object. The minimum number of characters to which CREATEBINARY( ) can be abbreviated is 7.

For more information about ActiveX controls and automation objects, see Chapter 16, “Adding OLE,” in the Developer’s Guide.


See Also

OLE Bound Control
OLE Container Control


CREATEOBJECT( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Creates an object from a class definition or an OLE-enabled application.

Syntax

CREATEOBJECT(ClassName [, eParameter1, eParameter2, ...])

Returns

Object

Arguments

ClassName   Specifies the class or OLE object from which the new object is created. Visual FoxPro searches for the class or OLE object in the following order:

1.   Visual FoxPro base classes.

2.   User-defined class definitions in memory in the order they were loaded.

3.   Classes in the current program.

4.   Classes in .VCX class libraries opened with SET CLASSLIB.

5.   Classes in procedure files opened with SET PROCEDURE.

6.   Classes in the Visual FoxPro program execution chain.

7.   The OLE Registry.

OLE objects are created using the following syntax for ClassName:

ApplicationName.Class

For example, to create a Microsoft Excel worksheet (which supports OLE automation), you can use the following syntax:

x = CREATEOBJECT('Excel.Sheet')

When this code is run, Microsoft Excel is started (if not already running), and a new worksheet is created.

A class library can have an alias. To specify an object in a class library with an alias, include the class library alias followed by a period and the object name.

eParameter1, eParameter2, ...   These optional parameters are used to pass values to the Init event procedure for the class. The Init event is executed when you issue CREATEOBJECT( ) and allows you to initialize the object.

Remarks

Use CREATEOBJECT( ) to create an object from a class definition or an application that supports OLE automation, and assign a reference to the object to a system variable or array element.

Before you can create an object from a user-defined class, the user-defined class must first be created with DEFINE CLASS, or it must be available in a .VCX visual class library opened with SET CLASSLIB.

Use = or STORE to assign a reference to the object to a system variable or array element. If an object assigned to a system variable or array element is released, the system variable or array element contains the null value. Use RELEASE to remove the system variable or array element from memory.


CREATEOBJECT( ) Function Example

The following example uses DEFINE CLASS and CREATEOBJECT( ) to create two custom classes named FormChild and FormGrandChild from the Visual FoxPro Form base class. ACLASS( ) is used to create an array named gaNewarray containing the class names, which are then displayed.

CLEAR

* Verify current class library setting

cCurClassLib=SET("CLASSLIB")

IF LEN(ALLTRIM(cCurClassLib))=0

cCurClassLib="None"

ENDIF

WAIT WINDOW "Current class library is: " + cCurClassLib + CHR(13);

+ "Press any key to continue..."

frmMyForm = CREATEOBJECT("FormGrandChild")

* Create an array

FOR nCount = 1 TO ACLASS(gaNewarray, frmMyForm)

? gaNewarray(nCount)  && Display the names of the classes

ENDFOR

RELEASE frmMyForm

* Create FormChild from FORM baseclass

DEFINE CLASS FormChild AS FORM

ENDDEFINE

* Create FormGrandChild from user-defined FormChild class

DEFINE CLASS FormGrandChild AS FormChild

ENDDEFINE


See Also

_BROWSER
DEFINE CLASS
GETOBJECT( )
RELEASE
SET CLASSLIB
SET OLEOBJECT


CREATEOFFLINE( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Takes an existing view offline.

Syntax

CREATEOFFLINE(ViewName [, cPath])

Returns

Logical

Arguments

ViewName   Specifies the name of the existing view to take offline. The database containing the existing view must be open before you can take the existing view offline.

cPath   Specifies the directory in which the offline view is placed and the name of the offline view. If you include just a directory, the directory contains the offline view’s temporary tables. If you include a directory and a name for the offline view, the directory contains the offline view’s temporary tables with the name you specify.

Remarks

CREATEOFFLINE( ) returns a logical true (.T.) if the existing view is successfully taken offline; otherwise false (.F.) is returned.

An offline view is opened with USE. When an offline view is open, you can append records or make changes to records in the offline view. However, you cannot use the CREATE TRIGGER, INSERT, PACK or ZAP commands in an offline view. After making changes to the offline view, you can update the data on the server with your changes by opening the offline view with USE and including the ONLINE clause.

You cannot refresh the contents of an offline view with data from the server until the offline view has been opened with USE and the ONLINE clause.

Use DROPOFFLINE( ) to take the offline view back online.


See Also

DROPOFFLINE( )
USE


CTOD( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Converts a character expression to a date expression.

Syntax

CTOD(cExpression)

Returns

Date

Arguments

cExpression   Specifies a character expression for which CTOD( ) returns a Date-type value. cExpression must evaluate to a valid date from 1/1/100 to 12/31/9999.

The default format for cExpression is mm/dd/yy. You can use SET DATE and SET CENTURY to change the default format. If the century isn’t specified when entering a date (as in the character expression 1/1/95), the twentieth century is assumed.

Remarks

CTOD( ), the character-to-date function, returns a Date-type value from a character expression.


CTOD( ) Function Example

STORE '7/4/1776' TO gcthe_4th

CLEAR

? CTOD(gcthe_4th)

STORE DATE( ) TO gdtoday

STORE CTOD('12/25/95') TO gdchristmas

STORE STR(gdchristmas - gdtoday, 4) TO gddays_left

? 'There are', gddays_left, 'days until Christmas'


See Also

DTOC( )
SET CENTURY
SET DATE
SYS(1) - Julian System Date
SYS(10) - String from Day Number
SYS(11) - Julian Day Number


CTOBIN( ) Function

Syntax         Returns         Arguments         Remarks          See Also

Converts a binary character representation to an integer value.

Syntax

CTOBIN(cExpression)

Returns

Numeric

Arguments

cExpression   Specifies the binary character representation to convert.

Remarks

Use CTOBIN( ) to convert a binary character representation created with BINTOC( ) back to its integer value.


See Also

BINTOC( ) Function


CTOT( ) Function

Syntax         Returns         Arguments         Example         See Also

Returns a DateTime value from a character expression.

Syntax

CTOT(cCharacterExpression)

Returns

DateTime

Arguments

cCharacterExpression   Specifies the character expression from which a DateTime value is returned. The proper format for cCharacterExpression is determined by the current settings of SET DATE, SET HOURS, and SET MARK. cCharacterExpression must evaluate to a recognizable DateTime value or Visual FoxPro generates an error.

The following are examples of valid character expressions:

02/16/95 2:00:00pm

02/16/95 2:00pm

02/16/95 14:00

02/16/95

14:00

If only a date or time portion is specified in cCharacterExpression, Visual FoxPro automatically adds a default time of midnight (12:00:00 A.M.) or a default date of 12/30/1899 to cCharacterExpression.

A century can be included in cCharacterExpression, but the century is returned only if SET CENTURY is ON. If a century is not included, the twentieth century is assumed.


CTOT( ) Function Example

The following example uses CTOT( ) to convert a character string to a DateTime value. Note that CTOT( ) automatically adds the time of midnight (12:00:00 A.M.) to the character string.

? BETWEEN(CTOT('02/16/95'), {02/15/95 11:00pm}, {02/16/95 1:00am})

? CTOT('02/16/95')


See Also

DATE( )
DATETIME( )
DTOT( )
HOUR( )
MINUTE( )
SEC( )
SECONDS( )
SET SECONDS
TIME( )


CURDIR( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the current directory.

Syntax

CURDIR([cExpression])

Returns

Character

Arguments

cExpression   Specifies the drive or volume for which CURDIR( ) returns the current directory or folder. If you omit cExpression, the current default drive or volume is assumed. The empty string is returned if the drive or volume you specify in cExpression doesn’t exist.

Remarks

CURDIR( ) returns, as a character string, the current MS-DOS directory on a specified drive.


CURDIR( ) Function Example

The following example stores the current directory to a variable, sets the default to the directory Visual FoxPro was started in, displays the new directory, returns the default to the original directory,and displays the original directory.

CLEAR

? 'Current directory: ', CURDIR( )

gcOldDir = SET('DEFAULT') + SYS(2003)

SET DEFAULT TO (HOME( ))

? 'Visual FoxPro directory: ', CURDIR( )

SET DEFAULT TO (gcOldDir)

? 'Current directory: ', CURDIR( )


See Also

FULLPATH( )
HOME( )


_CUROBJ System Variable

Included for backward compatibility. Use the ActiveControl property for new forms instead.


CurrentControl Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies which control contained in a Column object is used to display the values of the active cell. Available at design time; read-write at run time.

Syntax

Column.CurrentControl[ = cName]

Settings

cName   Specifies the name of the control that displays and accepts data for the active cell in a Column object.

Remarks

The default control is a TextBox having Text1 as the Name property. Use the AddObject method to add other controls.

If the Column’s Sparse property is set to true (.T.), only the active cell in the Column uses the object specified in the CurrentControl property; the other cells display data using a TextBox. If the Sparse property is set to false (.F.), all cells in the Column use the CurrentControl property to display data.

Note   You can add an unlimited number of controls to a Column object using the AddObject method. However, you can set the CurrentControl property for only one control at any given time.


Applies To

Column


See Also

AddObject Method
Bound Propety
RemoveObject Method
Sparse Property


CurrentX, CurrentY Properties

Syntax         Settings         Remarks         Applies To         See Also

Specifies the horizontal (X) and vertical (Y) coordinates for the next drawing method. Not available at design time; read-write at run time.

Syntax

Object.CurrentX[ = nXCoord]

Object.CurrentY[ = nYCoord]

Settings

nXCoord   Specifies the horizontal coordinate of the form, in the unit of measurement specified by the ScaleMode property of the form.

nYCoord   Specifies the vertical coordinate of the form, in the unit of measurement specified by the ScaleMode property of the form.

Remarks

Coordinates are measured from the upper-left corner of an object. CurrentX is 0 at an object’s left edge and CurrentY is 0 at its top edge. Coordinates are expressed in foxels or the current unit of measurement defined by the ScaleMode property.

When you use the following graphics methods, the CurrentX and CurrentY settings are changed as indicated.

Method	CurrentX, CurrentY set to
Box	The endpoint of the box as specified by the last two arguments.
Circle	The center of the object.
Cls	0, 0.
Line	The endpoint of the line.
Print	The next print position.
PSet	The point drawn.


Applies To

Form, _SCREEN


See Also

Box Method
Circle Method
Cls Method
DrawMode Property
DrawStyle Property
Left Property
Line Method
PSet Method
ScaleMode Property
SYS(1270) - Object Location
Top Property


Cursor Object

Syntax         Remarks         Properties         Events         Methods         See Also

Created when a table or view is added to the data environment for a form, form set, or report.

Syntax

Cursor

Remarks

The cursor object allows you to specify or determine properties for the table or view when the form, FormSet or report is run.

Note that setting a cursor object property at run time generates an error (with the exception of the Filter and Order properties, which can be set at run time). For a new property setting to take effect, you must call the CloseTables and OpenTables methods for the data environment. Also, if you change the Order property at run time of a cursor that is involved in a one-to-many relationship, the one-to-many relationship is broken.

For more information about the data environment for forms and form sets, see “Setting the Data Environment” in Chapter 9, “Creating Forms,” in the Developer’s Guide.

For more information about the data environment for reports, see Chapter 12, “Adding Queries and Reports,” in the Developer’s Guide.


Properties

Alias	BufferModeOverride	CursorSource
Database	Exclusive	Filter
Name	NoDataOnLoad	Order
ReadOnly


Events

Destroy	Error	Init


Methods

ResetToDefault


See Also

DataEnvironment Object
Relation Object


CURSORGETPROP( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the current property settings for a Visual FoxPro table or a cursor.

Syntax

CURSORGETPROP(cProperty [, nWorkArea | cTableAlias])

Returns

Character, Numeric, or Logical

Arguments

cProperty   Specifies the property setting to return.

The following table includes a list of properties whose settings can be returned, the data type of the return value, and a description of the return value.

cProperty	Type	Description
BatchUpdateCount*	N	The number of update statements sent to the remote data source for buffered tables. 1 is the default. Adjusting this value can greatly increase update performance. Read-Write.
Buffering	N	1 – (Default) Row and table buffering is off. 2 – Pessimistic row buffering is on. 3 – Optimistic row buffering is on. 4 – Pessimistic table buffering is on. 5 – Optimistic table buffering is on. Read-Write.
CompareMemo	L	Contains true (.T.) (default) if memo fields (of type Memo, General, or Picture) are included in the WHERE clause for updates; otherwise, contains false (.F.). For views only. Read-Write.
ConnectHandle	N	The connection handle. This property is valid only when the data source contains a remote table. Read-Only.
ConnectName	C	The named connection used when the cursor is created. This property is valid only when the data source contains a remote table Read-Only.
Database	C	The name of the database in which the table or view is contained. If a table is a free table, contains the empty string. Read-Only.
FetchAsNeeded	L	Contains true (.T.) if data is fetched as needed; otherwise, contains false (.F.) (default). For views only. Read-Write.
FetchMemo*	L	Contains true (.T.) if memo fields are fetched with the view results; otherwise, contains false (.F.) (default). Read-Write.
FetchSize*	N	The number of rows progressively fetched from the table result set. 100 rows is the default. Setting FetchSize to -1 retrieves the complete result set (limited by the MaxRecords setting). Read-Write.
KeyFieldList	C	Comma delimited list of primary fields for the cursor. Read-Write.
MaxRecords*	N	The maximum number of rows fetched when result sets are returned. The default is  – 1 (all rows are returned). A value of 0 specifies that the view is executed but no results are fetched. Read-Write.
Prepared	L	Contains true (.T.) if SQL statements are prepared for subsequent REQUERY( ) function calls;otherwise, contains false (.F.) (default). REQUERY( ) is used to retrieve data again for a SQL view. See SQLPREPARE( ) for additional information about preparing SQL statements. For views only. Read-Write.
SendUpdates	L	Contains true (.T.) if a SQL update query is sent to update tables when an update is made using the view; otherwise, contains false (.F.) (default). Read-Write.
SourceName	C	Contains the long name for a SQL view or a table in a database, or the file path and table name for a free table. Read-Only.
SourceType	N	1 – Specifies that the data source is a local SQL view. 2 – Specifies that the data source is a remote SQL view. 3 – Specifies that the data source is a table. Read-Only.
SQL	C	The SQL statement executed when the cursor is created. Read-Only.
Tables	C	A comma delimited list of the names of tables. Read-Write.
UpdatableFieldList	C	Comma delimited list of field names and the local field names assigned to the cursor.  Use this option to specify valid Visual FoxPro names for fields in the cursor that have invalid Visual FoxPro field names. Read-Write.
UpdateNameList	C	Comma delimited list of fields in the view. This list can include fields from local and remote tables. Read-Write.
UpdateType	N	1 – Specifies that old data is updated with the new data (the default). 2 – Specifies that updates occur by deleting the old data and inserting the new data. Read-Write.
UseMemoSize*	N	The minimum size (in bytes) for which result columns are returned in memo fields. For example, if the width of a column result is greater than the value of UseMemoSize, the column result is stored in a memo field. UseMemoSize may vary from 1 to 255; the default value is 255. Read-Write.
WhereType	N	The WHERE clause for updates to tables. WhereType may assume the following values: 1 or DB_KEY (from FOXPRO.H). The WHERE clause used to update tables consists of only the primary fields specified with the KeyFieldList property. 2 or DB_KEYANDUPDATABLE (from FOXPRO.H). The WHERE clause used to update tables consists of the primary fields specified with the KeyFieldList property and any updatable fields. 3 or DB_KEYANDMODIFIED (from FOXPRO.H) (default). The WHERE clause used to update tables consists of the primary fields specified with the KeyFieldList property and any other fields that are modified. 4 or DB_KEYANDTIMESTAMP (from FOXPRO.H). The WHERE clause used to update tables consists of the primary fields specified with the KeyFieldList property and a comparison of the time stamps. Read-Write.
* The value returned by this property is significant only for remote views; if you get this property for local views, the CURSORGETPROP function returns the default value.
nWorkArea   Specifies the work area of the table or cursor from which the property setting is returned. If you specify 0 for nWorkArea, CURSORGETPROP( ) returns the environment setting.

cTableAlias   Specifies the alias of the table or cursor from which the property setting is returned.

Remarks

Use CURSORSETPROP( ) to set a specific property for a Visual FoxPro table or a cursor. See CURSORSETPROP( ) for additional information about each of the properties and their settings.

The current property settings are returned for the table or cursor open in the currently selected work area if CURSORGETPROP( ) is issued without the optional cTableAlias or nWorkArea arguments.


CURSORGETPROP( ) Function Example

The following example opens the customer table in the testdata database. CURSORGETPROP( ) is then used to display the buffering mode for the table and the name of the database in which the table is contained.

CLOSE DATABASES

CLEAR

OPEN DATABASE SYS(2004)+"samples\data\testdata"

USE customer	  && Open customer table

? CURSORGETPROP("Buffering")   && Displays buffering mode

? CURSORGETPROP("Database")    && Displays database name


See Also

CURSORSETPROP( )
SQLGETPROP( )
SQLSETPROP( )


CURSORSETPROP( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Specifies property settings for a Visual FoxPro table or a cursor.

Syntax

CURSORSETPROP(cProperty [, eExpression] [, cTableAlias | nWorkArea])

Returns

Logical

Arguments

cProperty   Specifies the table or cursor property to set. Note that Buffering is the only property you can specify for a Visual FoxPro table.

eExpression   Specifies the value for the property you specify with cProperty. If you omit eExpression, the property is set to its default value.

The following table lists the properties you can specify for cProperty and a description of the values eExpression can assume.

Property	eExpression values
BatchUpdateCount*	The number of update statements sent to the remote data source for buffered tables. 1 is the default. Adjusting this value can greatly increase update performance.
Buffering	1 – Sets row and table buffering off. Record locking and data writing are identical to earlier FoxPro versions. (the default).. 2 – Sets pessimistic row buffering on. 3 – Sets optimistic row buffering on. 4 – Sets pessimistic table buffering on. 5 – Sets optimistic table buffering on. SET MULTILOCKS must be ON for all Buffering modes except 1 (off).
CompareMemo	.T. - Memo fields (of type Memo, General, or Picture) are included in the WHERE clause for updates. .F. - Memo fields are not included in the WHERE clause for updates.
FetchAsNeeded	.T. - Records are fetched as needed. .F. - For remote views, the number of records fetched is determined by the MaxRecord property. For local views, all records are fetched.
FetchMemo*	.T. – Memo fields are fetched with the view results. .F. – Memo fields are not fetched with the view results.
FetchSize*	Number of rows progressively fetched from the remote table result set. The default is 100 rows. Setting FetchSize to -1 retrieves the complete result set (limited by the MaxRecords setting).
KeyFieldList	Comma delimited list of primary fields for the cursor. No default. You must include a list of field names for updates to work.
MaxRecords*	The maximum number of rows fetched when result sets are returned. The default is  – 1 (all rows are returned). A value of 0 specifies that the view is executed but no results are fetched.
Prepared	Specify true (.T.) to prepare SQL statements for subsequent REQUERY( ) function calls. REQUERY( ) is used to retrieve data again for a SQL view. See SQLPREPARE( ) for additional information about preparing SQL statements. The default is false (.F.).
SendUpdates	.T. – Specifies that a SQL update query is sent to update tables when an update is made using the view. .F. – Specifies that a SQL update query is not sent to update tables.
Tables	Comma delimited list of the names of remote tables. No default. You must include a list of table names for updates to work.
UpdatableFieldList	Comma delimited list of remote field names and the local field names assigned to the cursor.  Use this option to specify valid Visual FoxPro names for fields in the cursor that have invalid Visual FoxPro field names.
UpdateNameList	Comma delimited list of fields in the view.This list can include fields from local and remote tables. You must include a list of fields for updates to work.
UpdateType	1 – Specifies that old data is updated with the new data (the default). 2 – Specifies that updates occur by deleting the old data and inserting the new data.
UseMemoSize*	Specifies the minimum size (in bytes) for which result columns are returned in memo fields. For example, if the width of a column result is greater than the value of UseMemoSize, the column result is stored in a memo field. UseMemoSize may vary from 1 to 255; the default value is 255.
WhereType	The WHERE clause for updates to remote tables. WhereType may assume the following values: 1 or DB_KEY (from FOXPRO.H). The WHERE clause used to update remote tables consists of only the primary fields specified with the KeyFieldList property. 2 or DB_KEYANDUPDATABLE (from FOXPRO.H). The WHERE clause used to update remote tables consists of the primary fields specified with the KeyFieldList property and any updatable fields. 3 or DB_KEYANDMODIFIED (from FOXPRO.H) (default). The WHERE clause used to update remote tables consists of the primary fields specified with the KeyFieldList property and any other fields that are modified. 4 or DB_KEYANDTIMESTAMP (from FOXPRO.H). The WHERE clause used to update remote tables consists of the primary fields specified with the KeyFieldList property and a comparison of the time stamps.

* This property is primarily used for remote views; setting it has no effect on local views. However, you can preset this property for local views that will be upsized.

cTableAlias   Specifies the alias of the table or cursor for which the property is set.

nWorkArea   Specifies the work area of the table or cursor for which the property is set. If you specify 0 for nWorkArea, CURSORSETPROP( ) sets the environment setting used for all subsequent tables or cursors.

Remarks

CURSORSETPROP( ) returns true (.T.) if Visual FoxPro successfully sets the property you specify. Visual FoxPro generates an error if the property you specify cannot be set.

The setting of the CURSORSETPROP( ) Buffering property determines how Visual FoxPro performs record locking and update buffering. For additional information on record locking and update buffering, see Buffering Data in Chapter 17, “Programming for Shared Access,” in the Developer’s Guide.

The setting of the CURSORSETPROP( ) WhereType property determines how updates are performed on remote tables. For additional information about remote table updates, see Chapter 6, “Creating Databases,” in the Developer’s Guide.

You can use CURSORSETPROP( ) to override the FetchSize SQLSETPROP( ) property for a cursor. This property is inherited from the cursor’s connection handle by default.

Use CURSORGETPROP( ) to return the current property settings for a Visual FoxPro table or a cursor created for a table.

The property setting is specified for the table or cursor open in the currently selected work area if CURSORSETPROP( ) is issued without the optional cTableAlias or nWorkArea arguments.


CURSORSETPROP( ) Function Example

The following example demonstrates how you can enable optimistic table buffering with CURSORSETPROP( ). MULTILOCKS is set to ON, a requirement for table buffering. The customer table in the testdata database is opened, and CURSORSETPROP( ) is then used to set the buffering mode to optimistic table buffering (5). A message box is displayed showing the result of the operation.

CLOSE DATABASES

CLEAR

SET MULTILOCKS ON

OPEN DATABASE SYS(2004)+"samples\data\testdata"

USE customer	  && Open customer table

* Set buffering mode and store logical result

lSuccess=CURSORSETPROP("Buffering", 5, "customer")

IF lSuccess = .T.

=MESSAGEBOX("Operation successful!",0,"Operation Status")

ELSE

=MESSAGEBOX("Operation NOT successful!",0,"Operation Status")

ENDIF


See Also

CURSORGETPROP( )
SET MULTILOCKS
SQLGETPROP( )
SQLSETPROP( )


CursorSource Property

Syntax         Settings         Applies To         See Also

Specifies the name of the table or view associated with a Cursor object. Read-only at design time; read-write at run time.

Syntax

DataEnvironment.Cursor.CursorSource[ = cText]

Settings

cText   For views, specifies the name of the view in a database. For tables in a database, specifies the long table name. For free tables, specifies the full path to the free table.


Applies To

Cursor Object


See Also

Database Property


CURVAL( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns field values directly from disk for a table or a remote data source.

Syntax

CURVAL(cExpression [, cTableAlias | nWorkArea])

Returns

Character, Currency, Date, DateTime, Double, Float, Logical, Numeric, or Memo

Arguments

cExpression   Specifies an expression whose value CURVAL( ) returns from a table or a remote data source. cExpression is typically a field or an expression consisting of a set of fields from the table or remote data source.

cTableAlias   Specifies the alias of the table from which the field values are returned from disk for a table or a remote data source.

nWorkArea   Specifies the work area of the table from which the field values are returned from disk for a table or a remote data source.

Remarks

The field values returned by CURVAL( ) and OLDVAL( ) can be compared to determine if another user on a network changed the field values while the fields were being edited. CURVAL( ) and OLDVAL( ) can only return different values when optimistic row or table buffering is enabled. Optimistic row or table buffering is enabled with CURSORSETPROP( ).

Note   If you are working with a view in a multiuser environment, the values returned by CURVAL( ) might not be up to date unless you call the REFRESH( ) function first. Data returned by a view is buffered, and the CURVAL( ) function reads values from the buffer. However, if other users have changed data in the underyling tables for the view, the buffered data is not updated until the REFRESH( ) function is called.

CURVAL( ) returns field values for the current record, and the return value data type is determined by the expression you specify with cExpression.

The value is returned for the table or cursor open in the currently selected work area if CURVAL( ) is issued without the optional cTableAlias or nWorkArea arguments.


CURVAL( ) Function Example

This example creates a free table named mytable, and a value of “One” is inserted into the cDigit field. Optimistic table buffering is enabled with SET MULTILOCKS ON and CURSORSETPROP( ).

A value of “Two” is then inserted into the cDigit field, and CURVAL( ) and OLDVAL( ) are used to display the original cDigit values. TABLEUPDATE( ) is used to commit the changes to the table, and CURVAL( ) and OLDVAL( ) are used to display the new cDigit values. Note that because this is a single user example, CURVAL( ) and OLDVAL( ) return the identical values.

CLOSE DATABASES

CLEAR

CREATE TABLE mytable FREE (cDigit C(10))

* Store original value

INSERT INTO mytable (cDigit) VALUES ("One")

SET MULTILOCKS ON                    && Allow optimistic table buffering

= CURSORSETPROP("Buffering",5)       && Optimistic table buffering on

REPLACE cDigit WITH "Two"            && New value

? "Current value: " + CURVAL("cDigit", "mytable")

? "Old value: " + OLDVAL("cDigit", "mytable")

= TABLEUPDATE(.T.)                   && Commit changes made to table

? "Table changes committed"

? "New current value: " + CURVAL("cDigit", "mytable")

? "New old value: " + OLDVAL("cDigit", "mytable")


See Also

GETFLDSTATE( )
OLDVAL( )
TABLEREVERT( )
TABLEUPDATE( )
CURSORSETPROP( )


Curvature Property

Syntax         Settings         Example         Applies To         See Also

Specifies the curvature of a Shape control’s corners. Available at design time and run time.

Syntax

Shape.Curvature[ = nCurve]

Settings

nCurve   The settings for the Curvature property are:

Setting	Description
0	Specifies no curvature, creating square corners.
1 through 98	Specifies progressively rounded corners. A higher number increases the curvature.
99	Specifies maximum curvature and creates a circle or ellipse.


Curvature Property Example

The following example demonstrates how the Curvature property can be used with the Shape control to display a circle, ellipse, or square on a form.

A form is created, and a set of option buttons and a command button are placed on the form. When you click one of the option buttons, the corresponding shape is displayed on the form. The Height, Width, and Curvature properties of each shape determine the type of shape (circle, ellipse, or square) created. The Curvature property is set to 99 to create the circle and ellipse.

frmMyForm = CREATEOBJECT('Form')  && Create a Form

frmMyForm.Closable = .F.  && Disable the Control menu box

frmMyForm.AddObject('cmdCommand1','cmdMyCmndBtn')  && Add Command button

frmMyForm.AddObject('opgOptionGroup1','opgMyOptGrp') && Add Option Group

frmMyForm.AddObject('shpCircle1','shpMyCircle')  && Add Circle Shape

frmMyForm.AddObject('shpEllipse1','shpMyEllipse')  && Add Ellipse Shape

frmMyForm.AddObject('shpSquare','shpMySquare')  && Add Box Shape

frmMyForm.cmdCommand1.Visible =.T.  && "Quit" Command button visible

frmMyForm.opgOptionGroup1.Buttons(1).Caption = "\<Circle"

frmMyForm.opgOptionGroup1.Buttons(2).Caption = "\<Ellipse"

frmMyForm.opgOptionGroup1.Buttons(3).Caption = "\<Square"

frmMyForm.opgOptionGroup1.SetAll("Width", 100) && Set Option group width

frmMyForm.opgOptionGroup1.Visible = .T.  && Option Group visible

frmMyForm.opgOptionGroup1.Click  && Show the circle

frmMyForm.SHOW  && Display the form

READ EVENTS  && Start event processing

DEFINE CLASS opgMyOptGrp AS OptionGroup  && Create an Option Group

ButtonCount = 3  && Three Option buttons

Top = 10

Left = 10

Height = 75

Width = 100

PROCEDURE Click

ThisForm.shpCircle1.Visible = .F.  && Hide the circle

ThisForm.shpEllipse1.Visible = .F.  && Hide the ellipse

ThisForm.shpSquare.Visible = .F.  && Hide the square

DO CASE

CASE ThisForm.opgOptionGroup1.Value = 1

ThisForm.shpCircle1.Visible = .T. && Show the circle

CASE ThisForm.opgOptionGroup1.Value = 2

ThisForm.shpEllipse1.Visible = .T.  && Show the ellipse

CASE ThisForm.opgOptionGroup1.Value = 3

ThisForm.shpSquare.Visible = .T.  && Show the square

ENDCASE

ENDDEFINE

DEFINE CLASS cmdMyCmndBtn AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 210  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close Form

ENDDEFINE

DEFINE CLASS shpMyCircle AS SHAPE  && Create a circle

Top = 10

Left = 200

Width = 100

Height = 100

Curvature = 99

BackColor = RGB(255,0,0)  && Red

ENDDEFINE

DEFINE CLASS shpMyEllipse AS SHAPE  && Create an ellipse

Top = 35

Left = 200

Width = 100

Height = 50

Curvature = 99

BackColor = RGB(0,128,0)  && Green

ENDDEFINE

DEFINE CLASS shpMySquare AS SHAPE  && Create a square

Top = 10

Left = 200

Width = 100

Height = 100

Curvature = 0

BackColor = RGB(0,0,255)  && Blue

ENDDEFINE


Applies To

Shape


See Also

Shape Control


Custom Object

Syntax         Remarks         Properties         Events         Methods         See Also

Creates a custom, user-defined object.

Syntax

Custom

Remarks

A custom, user-defined class can be created with DEFINE CLASS, or with the Class Designer. Issue CREATE CLASS to display the class designer.

Custom, user-defined classes are classes with properties, events, and methods, but with no visual representation. The same general rules that apply to defining other types of classes apply to defining custom classes.

See Chapter 3, “Object-Oriented Programming,” in the Developer’s Guide for additional information about creating custom objects as non-visual classes.


Properties

BaseClass	Class	ClassLibrary
Comment	Height	Left
Name	Parent	ParentClass
Picture	Top	Width


Events

Destroy	Error	Init


Methods

AddObject	ReadExpression	ReadMethod
RemoveObject	ResetToDefault	SaveAsClass
ShowWhatsThis	WriteExpression Method	WriteMethod Method


See Also

CREATE CLASS
CREATE FORM
DEFINE CLASS


Database Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the path to the database that contains the table or view associated with the Cursor object. Read-only at design time; read-write at run time.

Syntax

DataEnvironment.Cursor.Database[ = cPath]

Settings

cPath   Specifies the full path to the database (.DBC) file.

Remarks

Note   When the Cursor object is accessed using CURSORSETPROP( ), the Database property is read-only at run time.

If the Cursor is based on a free table, this property returns an empty string ("").


Applies To

Cursor


See Also

CursorSource Property


DataEnvironment Object

Syntax         Remarks         Properties         Events         See Also

Created when a form, form set, or report is created.

Syntax

DataEnvironment

Remarks

The DataEnvironment object is a container object for the Cursor and Relation objects associated with the form, form set, or report.

Note that setting a DataEnvironment object property at run time generates an error. For a new property setting to take effect, you must call the CloseTables and OpenTables methods for the DataEnvironment object.

For more information about the data environment for forms and form sets, see Chapter 9, “Creating Forms,” in the Developer’s Guide.

For more information about the data environment for reports, see Chapter 12, “Adding Queries and Reports,” in the Developer’s Guide.


Properties

AutoCloseTables	AutoOpenTables	InitialSelectedAlias
Name	OpenViews


Events

AfterCloseTables	BeforeOpenTables	Destroy
Error	Init


Methods

AddObject	CloseTables	OpenTables
RemoveObject	ResetToDefault


See Also

Cursor Object
Relation Object


DataEnvironment Property

Syntax         Applies To         See Also

Provides a reference to the object’s data environment. Read-only at design time and run time.

Syntax

Object.DataEnvironment


Applies To

Form, FormSet


See Also

DataEnvironment Object


DataSession Property

Syntax         Settings         Applies To         See Also

Specifies whether a form, form set, or toolbar can run in its own data session and has a separate data environment. Available at design time; read-only at run time.

Syntax

Object.DataSession[ = nSession]

Settings

nSession   The settings for the DataSession property are:

Setting	Description
1	(Default) Default data session.
2	Private data session. Creates a new data session for each instance of the form, form set, or toolbar that is created.


Applies To

Form, FormSet, _SCREEN, ToolBar


See Also

DataSessionID Property


DataSessionID Property

Syntax         Remarks         Applies To         See Also

Returns the data session ID that identifies the private data session for the form set, form, or toolbar. Read-only at design time; read-write at run time.

If the DataSession property of the form, form set, or toolbar is set to 1 (Default Data Session), returns the default data session ID.

Syntax

Object.DataSessionID

Remarks

Available only if the form set, form, or toolbar’s DataSession property is set to 2 (Private data session).

You can use SET DATASESSION with the DataSessionID property to change data sessions.

When you set DataSessionID, the setting affects the working data session for the object and all the objects it contains. The DataSessionID property setting does not affect noncontained objects or objects created using CREATEOBJECT( ).

Changing the DataSessionID property setting increments the reference count of the data session changed to and decrements the reference count of the data session changed from. However, if a data session is created by setting the DataSession property to 2 (Private data session), changing the DataSessionID property setting does not release the initial data session. In such case, the object must be released to free the initial session.

For more information on multiple data sessions, see Chapter 17, “Programming for Shared Access,” in the Developer’s Guide.

Caution   Changing the DataSessionID property setting of an object that contains data-bound controls causes the controls to lose their original data sources. In general, use DataSessionID on objects that do not contain data-bound controls.


Applies To

Form, FormSet, _SCREEN, ToolBar


See Also

CREATEOBJECT( )
DataSession Property
SET DATASESSION


DataToClip Method

Syntax         Settings         Remarks         Applies To          See Also

Copies a set of records as text to the Clipboard.

Syntax

ApplicationObject.DataToClip([nWorkArea | cTableAlias]
[, nRecords] [, nClipFormat])

Settings

nWorkArea   Specifies the work area number of the table for which records are copied to the Clipboard. If you omit cTableAlias and nWorkArea, records are copied to the Clipboard for the table open in the current work area.

cTableAlias   Specifies the alias of the table for which the records are copied to the Clipboard.

nRecords   Specifies the number of records copied to the Clipboard. If nRecords is greater than the number of remaining records in the table, all the remaining records are copied to the Clipboard. If nRecords and nClipFormat are omitted, the current record and all remaining records are copied to the Clipboard.

nClipFormat   Specifies how fields are delimited. The settings for nClipFormat are:

nClipFormat	Description
1	(Default) Fields delimited with spaces
3	Fields delimited with tabs
If nClipFormat is omitted, fields are delimited with spaces.

Remarks

The field names appear as the first line of the text copied to the Clipboard, followed by a separate line for each record.


Applies To

Application Object, _VFP System Variable


See Also

Eval Method, SetVar Method


DATE( ) Function

Syntax         Returns         Remarks         Example         See Also

Returns the current system date, which is controlled by the operating system.

Syntax

DATE( )

Returns

Date

Remarks

No Visual FoxPro commands or functions can directly change the system date.

The format of the character string returned by DATE( ) can be changed with SET CENTURY, SET DATE, and SET MARK TO.


DATE( ) Function Example

The following example displays the current system date with and without the century.

CLEAR

SET CENTURY OFF

? DATE( )  && Displays today's date without the century

SET CENTURY ON

? DATE( )  && Displays today's date with the century


See Also

SET CENTURY
SET DATE
SET MARK TO
SYS( ) Functions Overview


DateFormat Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the format for Date and DateTime values displayed in a text box. Available at design time and run time.

Syntax

Object.DateFormat[ = nValue]

Settings

nValue   One of the following settings:

Setting	Description	Format
0	(Default) The displayed date format is determined by the setting of SET DATE.	Determined by SET DATE
1	American	mm/dd/yy
2	ANSI	yy.mm.dd
3	British	dd/mm/yy
4	Italian	dd-mm-yy
5	French	dd/mm/yy
6	German	dd.mm.yy
7	Japan	yy/mm/dd
8	Taiwan	yy/mm/dd
9	USA	mm-dd-yy
10	MDY	mm/dd/yy
11	DMY	dd/mm/yy
12	YMD	yy/mm/dd
13	Short	Determined by the Windows Control Panel short date setting
14	Long	Determined by the Windows Control Panel long date setting
Remarks

A Date or DateTime value displayed in a text box may be displayed in a different format when the text box does not have the focus. Certain short and long date formats that you can specify in the Windows Control Panel do not correspond to valid Visual FoxPro formats, and are displayed in a default format.

The Format property overrides the DateFormat property when the YS, YL, E, or D settings are specified for the Format property.


Applies To

TextBox


See Also

Century Property, DateMark Property, Hours Property, Seconds Property, SET DATE, StrictDateEntry Property


DateMark Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the delimiter for Date and DateTime values displayed in a text box. Available at design time and run time.

Syntax

Object.DateMark[ = cDateMarkCharacter]

Settings

cDateMarkCharacter   Specifies the Date and DateTime value delimiter. If cDateMarkCharacter is the empty string, the delimiter is determined by the setting of SET MARK. If cDateMarkCharacter is a space, the delimiter for the current setting of the text box’s DateFormat property is used.

In the Properties window, use the = command to specify the empty string (= “”) or a space (= “ “) for the DateMark property.

Remarks

The DateMark property setting is ignored if the DateFormat property is set to Short or Long.


Applies To

TextBox


See Also

Century Property, DateFormat Property, Hours Property, Seconds Property, SET MARK TO, StrictDateEntry Property


DATETIME( ) Function

Syntax         Returns         Remarks         Example         See Also

Returns the current date and time as a DateTime value.

Syntax

DATETIME( )

Returns

DateTime

Remarks

The format of the DateTime value returned by DATETIME( ) depends on the current settings of SET DATE, SET MARK, SET CENTURY, SET HOURS, and SET SECONDS. The format is also dependent on the settings made in the Control panel of the operating system.


DATETIME( ) Function Example

This example stores the Datetime for the New Year to a variable named tNewyear, and stores the current Datetime to a variable named tToday. The number of seconds between the current Datetime and the New Year is then displayed.

tNewyear = {01/01/96 12:00am}  	&& New Year 1996

tToday = DATETIME( )

nSecondstonewyear = tNewyear - tToday

CLEAR

? "There are " + ALLTRIM (STR(nSecondstonewyear)) ;

+ " seconds to the New Year."


See Also

CTOT( )
DATE( )
DTOT( )
HOUR( )
SEC( )
SECONDS( )
SET SECONDS
SET SYSFORMATS
TIME( )


DAY( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the numeric day-of-the-month for a given Date or DateTime expression.

Syntax

DAY(dExpression | tExpression)

Returns

Numeric

Arguments

dExpression   Specifies a date from which DAY( ) returns a day-of-the-month. dExpression can be a date literal, a Date-type variable, an array element, or a date field.

tExpression   Specifies a date or time from which DAY( ) returns a day-of-the-month. dExpression can be a DateTime literal, a DateTime-type variable, an array element, or a DateTime field.

Remarks

DAY( ) returns a number from 1 through 31.


DAY( ) Function Example

STORE {03/05/95} TO gdBDate

CLEAR

? CDOW(gdBDate)  && Displays Sunday

? DAY(gdBDate)   && Displays 5

? 'That date is ', CMONTH(gdBDate),STR(DAY(gdBDate),2)


See Also

CDOW( )
DOW( )
SET FDOW
SET FWEEK
SYS( ) Functions Overview


DBC( ) Function

Syntax         Returns         Remarks         Example         See Also

Returns the name and path of the current database.

Syntax

DBC( )

Returns

Character

Remarks

DBC( ) returns the empty string if there is no current database.

Use SET DATABASE to specify the current database.


DBC( ) Function Example

The following example opens the testdata database and uses DBC( ) to display information about the database.

CLOSE DATABASES

OPEN DATABASE (SYS(2004) + "samples\data\testdata")  && Opens the DBC.

CLEAR

? DBC( )  && Displays the path and name of the database


See Also

ADD TABLE
CLOSE DATABASES
CREATE DATABASE
DISPLAY TABLES
OPEN DATABASE
REMOVE TABLE
SET DATABASE


DBF( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the name of a table open in a specified work area or a table name from a table alias.

Syntax

DBF([cTableAlias | nWorkArea])

Returns

Character

Arguments

cTableAlias   Specifies the table alias.

nWorkArea   Specifies the work area number.

If you omit cTableAlias and nWorkArea, DBF( ) returns the name of the table open in the current work area. DBF( ) returns an empty string if a table isn’t open in the work area you specify. If a table doesn’t have the alias you specify with cTableAlias, Visual FoxPro generates an error message.

For information on creating an alias for a table, see USE.

Remarks

When SET FULLPATH is ON, DBF( ) returns the path to the table with the table name. When SET FULLPATH is OFF, DBF( ) returns the drive on which the table resides with the table name.


DBF( ) Function Example

The following example returns the name of a table from its work area and its alias, and returns the empty string after all tables have been closed.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer IN 2 ALIAS mycust

CLEAR

? DBF(2)  && Displays customer.dbf with its path

? DBF('mycust')  && Displays customer.dbf with its path

CLOSE DATABASES

? DBF( )	&& Displays the empty string


See Also

CDX( )
FIELD( )
NDX( )
SET FULLPATH
USE


DBGETPROP( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns a property for the current database or for fields, named connections, tables, or views in the current database.

Syntax

DBGETPROP(cName, cType, cProperty)

Returns

Character, Numeric, or Logical

Arguments

cName   Specifies the name of the database, field, named connection, table, or view for which DBGETPROP( ) returns information.

To return information about a field in a table or a view, preface the name of the field with the name of the table or view containing the field. For example, to return information about the custid field in the customer table, specify the following for cName:

customer.custid

cType   Specifies whether cName is the current database, or a field, named connection, table, or view in the current database.

 The following table lists the values you can specify for cType:

cType	Description
CONNECTION	cName is a named connection in the current database.
DATABASE	cName is the current database.
FIELD	cName is a field in the current database.
TABLE	cName is a table in the current database.
VIEW	cName is a view in the current database.
cProperty   Specifies the name of the property for which DBGETPROP( ) returns information.

 The following tables list the values you can specify for cProperty, the return value types, and descriptions of each property. Each description includes the read and write privileges for each property. If a property is read-only, its value cannot be changed with DBSETPROP( ). For more information about changing property values, see DBSETPROP( ).

Connection properties

cProperty	Type	Description
Asynchronous	L	The connection mode. (Default) False (.F.) specifies a synchronous connection. True (.T.) specifies an asynchronous connection. Read-Write.
BatchMode	L	The batch processing mode. (Default) True (.T.) specifies the connection that operates in batch mode. Read-Write.
Comment	C	The text of the connection comment. Read-Write.
ConnectString	C	The login connection string. Read-Write.
ConnectTimeout	N	The connection timeout interval in seconds. The default is 0 (wait indefinitely). Read-Write.
Database	C	The name of the server database specified with the DATABASE clause in the CREATE CONNECTION command or in the Connection Designer. Read-Write.
DataSource	C	The name of the data source as defined in the ODBC.INI file. Read-Write.
DispLogin	N	Contains a numeric value that determines when the ODBC Login dialog box is displayed. DispLogin may assume the following values: 1 or DB_PROMPTCOMPLETE (from FOXPRO.H). 1 is the default. 2 or DB_PROMPTALWAYS (from FOXPRO.H). 3 or DB_PROMPTNEVER (from FOXPRO.H). If 1 or DB_PROMPTCOMPLETE is specified, Visual FoxPro displays the ODBC Login dialog box only if any required information is missing. If 2 or DB_PROMPTALWAYS is specified, the ODBC Login dialog box is always displayed, allowing you to change settings before connecting. If 3 or DB_PROMPTNEVER is specified, the ODBC Login dialog box is not displayed and Visual FoxPro generates an error if the required login information isn’t available. Read-Write.
DispWarnings	L	Contains a logical value that determines if non-trappable warnings from the remote table, ODBC, or Visual FoxPro are displayed. (Default) True (.T.) specifies that non-trappable errors are displayed. Read-Write.
IdleTimeout	N	The idle timeout interval in seconds. Active connections are deactivated after the specified time interval. The default value is 0 (wait indefinitely). Read-Write.
PacketSize	N	The size of the network packet used by the connection. Adjusting this value can improve performance. The default value is 4096 bytes (4K). Read-Write
PassWord	C	The connection password. Read-Write.
QueryTimeout	N	The query timeout interval in seconds. The default value is 0 (wait indefinitely). Read-Write.
Transactions	N	Contains a numeric value that determines how the connection manages transactions on the remote table. Transactions may assume the following values: 1 or DB_TRANSAUTO (from FOXPRO.H). 1 is the default. Transaction processing for the remote table is handled automatically. 2 or DB_TRANSMANUAL (from FOXPRO.H). Transaction processing is handled manually through SQLCOMMIT( ) and SQLROLLBACK( ). Read-Write.
UserId	C	The user identification. Read-Write.
WaitTime	N	The amount of time in milliseconds that elapses before Visual FoxPro checks whether the SQL statement has completed executing. The default is 100 milliseconds. Read-Write.
Database properties

cProperty	Type	Description
Comment	C	The text of the database comment. Read-Write.
Version	N	The database version number. Read-Only.
Field properties for tables

cProperty	Type	Description
Caption	C	The field caption. Read-Write.
Comment	C	The text of the field comment. Read-Write.
DefaultValue	C	The field default value. Read-Only.
DisplayClass	C	Name of the class used for field mapping. Read-Write.
DisplayClassLibrary	C	Path to the class library specified with the DisplayClass property. Read-Write.
Format	C	The field display format. See the Format Property for a list of format settings. Read-Write.
InputMask	C	The field input format. See the InputMask Property for a list of input mask settings. Read-Write.
RuleExpression	C	The field rule expression. Read-Only.
RuleText	C	The field rule error text. Read-Only.
Field properties for views

cProperty	Type	Description
Caption	C	The field caption. Read-Write.
Comment	C	The text of the field comment. Read-Write.
DataType	C	The data type for a field in a view. Initially set to the data type for the field in the data source. To specify a different data type for a field with DBSETPROP( ), use the syntax for creating fields in CREATE TABLE - SQL. For example, to change the data type of an integer field named iCost in a table named Mytable to numeric type with width 4 and 2 decimal places, use DBSETPROP('mytable.icost', 'field', ;     'DataType', 'N(4,2)') You can also include the NOCPTRANS clause to prevent translation of character and memo fields to a different code page.  Read-Write for remote views. Ignored for local views.
DefaultValue	C	The field default value. Read-Write.
KeyField	L	Contains true (.T.) if the field is specified in an index key expression; otherwise, contains false (.F.). Read-Write.
RuleExpression	C	The field rule expression. Read-Write.
RuleText	C	The field rule error text. Read-Write.
Updatable	L	Contains true (.T.) if the field can be updated; otherwise, contains false (.F.). Read-Write.
UpdateName	C	The name of the field used when data in the field is updated to the remote table. By default, the remote table field name. Read-Write.
Table properties

cProperty	Type	Description
Comment	C	The text of the table comment. Read-Write.
DeleteTrigger	C	The Delete trigger expression. Read-Only.
InsertTrigger	C	The Insert trigger expression. Read-Only.
Path	C	The path to the table. Read-Only.
PrimaryKey	C	The tag name of the primary key. Read-Only.
RuleExpression	C	The row rule expression. Read-Only.
RuleText	C	The row rule error text. Read-Only.
UpdateTrigger	C	The Update trigger expression. Read-Only.
View properties

cProperty	Type	Description
BatchUpdateCount	N	The number of update statements sent to the backend for views. 1 is the default. Adjusting this value can greatly increase update performance. Read-Write.
Comment	C	The text of the view comment. Read-Write.
CompareMemo	L	Contains true (.T.) (default) if memo fields (of type Memo, General, or Picture) are included in the WHERE clause for updates; otherwise, contains false (.F.). Read-Write.
ConnectName	C	The named connection used when the view is opened. Read-Only.
FetchAsNeeded	L	Contains true (.T.) if data is fetched as needed; otherwise, contains false (.F.) (default). Read-Write.
FetchMemo	L	Contains true (.T.) (the default) if memo and general fields are fetched with the view results; otherwise, contains false (.F.). Read-Write.
FetchSize	N	The number of records fetched at a time from the remote tables (when progressive fetches are enabled). The default is 100 records. Setting FetchSize to -1 retrieves the complete result set (limited by the MaxRecords setting). Read-Write.
MaxRecords	N	The maximum number of records fetched when result sets are returned. The default is  – 1 (all rows are returned). A value of 0 specifies that the view is executed but no results are fetched. Read-Write.
Offline	L	Contains true (.T.) if the view is an offline view. Read-only.
ParameterList	C	The WHERE clause parameters. The format for the parameters is ''ParameterName1, 'Type1'; ParameterName2, 'Type2'; ...'' where Type is a one of the following characters specifying the parameter type: C - Character D - Date T - DateTime N - Numeric F - Floating B - Double I - Integer Y - Currency L - Logical For example, ''MyParam1, 'C' '' specifies a single character type parameter named MyParam1. For more information about creating parameterized views, see Chapter 8, “Creating Views,” in the Developer’s Guide. Read-Write.
Prepared	L	Contains true (.T.) if SQL statements are prepared for subsequent REQUERY( ) function calls. REQUERY( ) is used to retrieve data again for a SQL view. See SQLPREPARE( ) for additional information about preparing SQL statements. The default is false (.F.). Read-Write.
RuleExpression	C	The row rule expression. Read-Write.
RuleText	C	The rule text expression displayed when an error occurs when data is edited in a Browse or Edit window. Read-Write.
SendUpdates	L	Contains true (.T.) if a SQL update query is sent to update remote tables; otherwise, contains false (.F.) (default). Read-Write.
ShareConnection	L	Contains true (.T.) if the view can share its connection handle with other connections; otherwise, contains false (.F.). Read-Write.
SourceType	N	The view source. SourceType may assume the following values: 1. The view uses local tables. 2. The view uses remote tables. Read-Only.
SQL	C	The SQL statement executed when the view is opened. Read-Only.
Tables	C	A space-delimited list of the names of the tables. Read-Write.
UpdateType	N	The update type. Valid values are: 1 or DB_UPDATE (from FOXPRO.H). The old data is updated with the new data (default). 2 or DB_DELETEINSERT (from FOXPRO.H). The old data is deleted and the new data is inserted. Read-Write.
UseMemoSize	N	The minimum size (in bytes) for which result columns are returned in memo fields. For example, if the width of a column result is greater than the value of UseMemoSize, the column result is stored in a memo field. UseMemoSize may vary from 1 to 255; the default value is 255. Read-Write.
WhereType	N	The WHERE clause for updates to remote tables. WhereType may assume the following values: 1 or DB_KEY (from FOXPRO.H). The WHERE clause used to update remote tables consists of only the primary fields specified with the KeyFieldList property. 2 or DB_KEYANDUPDATABLE (from FOXPRO.H). The WHERE clause used to update remote tables consists of the primary fields specified with the KeyFieldList property and any updatable fields. 3 or DB_KEYANDMODIFIED (from FOXPRO.H) (default). The WHERE clause used to update remote tables consists of the primary fields specified with the KeyFieldList property and any other fields that are modified. 4 or DB_KEYANDTIMESTAMP (from FOXPRO.H). The WHERE clause used to update remote tables consists of the primary fields specified with the KeyFieldList property and a comparison of the time stamps. For more information about the WhereType property, see Chapter 8, “Creating Views,” in the Developer’s Guide. Read-Write.
Remarks

A database must be opened before you can get its properties or those of its connections, tables, views, or fields. You do not need to execute the USE command to open a table or view before gettings its properties.

For more details about the properties you can get for connections, databases, fields, tables, and views, refer to the topics listed in the following table.

For details about	Refer to this section	In this chapter of the Developer’s Guide
Database properties	“Viewing and Setting Database Properties”	Chapter 7, “Working with Tables”
Connections	“Accessing Remote Data”	Chapter 8, “Creating Views”
Views		Chapter 8, “Creating Views”
Triggers	“Using Triggers”	Chapter 7, “Working with Tables”
Captions	“Creating Captions for Fields”	Chapter 7, “Working with Tables”
Default values	“Creating Default Field Values”	Chapter 7, “Working with Tables”
	“Creating Default Values for View Fields”	Chapter 8, “Creating Views”
Comments	“Adding Comments to Fields”	Chapter 7, “Working with Tables”
	“Viewing and Setting Database Properties”	Chapter 6, “Creating Databases”
Primary key	“Controlling Duplicate Values”	Chapter 7, “Working with Tables”
Rules	“Enforcing Business Rules”	Chapter 7, “Working with Tables”
	“Setting or Changing Field-level or Table Rules”	Chapter 7, “Working with Tables”
	“Creating Rules on View Fields and Rows”	Chapter 8, “Creating Views”


DBGETPROP( ) Function Example

The following example displays the name of the primary key field for the customer table. It then displays the field comments for the cust_id field in the customer table. If there are no comments for the field, a message is displayed indicating there are no field comments. To add comments, see the example for DBSETPROP( ).

CLOSE DATABASES

CLEAR

OPEN DATABASE SYS(2004)+"samples\data\testdata"

* Displays the primary key field

cResults = DBGETPROP("customer", "Table", "PrimaryKey")

=MESSAGEBOX(cResults)       && Displays 	'cust_id'

* Displays comments for the field 'cust_id'

cResults = DBGETPROP("customer.cust_id", "Field", "Comment")

IF LEN(ALLTRIM(cResults)) = 0

     =MESSAGEBOX("No Comment for this field." + CHR(13) + ;

           CHR (13) + "Use DBSETPROP( ) to add comments.")

ELSE

     =MESSAGEBOX("Cust_id field comments: " + cRESULTS)

ENDIF


See Also

ADD TABLE
CREATE CONNECTION
CREATE DATABASE
CREATE SQL VIEW
CURSORGETPROP( )
CURSORSETPROP( )
DBSETPROP( )
DISPLAY DATABASE
LIST DATABASE
RENAME CONNECTION
SQLCOMMIT( )
SQLROLLBACK( )


DblClick Event

Syntax         Arguments         Remarks         Applies To         See Also

Occurs when the user presses and releases the mouse button twice in quick succession.

Syntax

PROCEDURE Object.DblClick
[LPARAMETERS nIndex]

Arguments

nIndex   Uniquely identifies a control if it is in a control array.

Remarks

The DblClick event also occurs when you select an item in a list box or a combo box and press ENTER.

If DblClick doesn’t occur within the system’s double-click time limit, the object recognizes another Click event. Therefore, when you attach procedures for these related events, make sure that their actions do not conflict. Controls that don’t receive DblClick events may receive two single clicks instead of a double-click.

Note   If the mouse has more than one button, you can distinguish between the left, right, and middle mouse buttons using the MouseDown and MouseUp events.


Applies To

CheckBox, ComboBox, CommandGroup, Container Object, Control Object, EditBox, Form, Grid, Header, Image, Label, Line, ListBox, OptionButton, OptionGroup, Page, PageFrame, Shape, Spinner, TextBox, ToolBar


See Also

Click Event
MouseDown Event
MouseUp Event


_DBLCLICK System Variable

Syntax         Arguments         Remarks         See Also

Specifies the time interval between double and triple mouse clicks.

Syntax

_DBLCLICK = nTicks

Arguments

nTicks   Specifies the time interval in seconds. Internal timing is measured in clock “ticks,” which are each about 1/18th of a second. If you store an integer or decimal value to _DBLCLICK, Visual FoxPro may store it as a slightly different value due to rounding to ticks. The default value for _DBLCLICK is 0.5 seconds. _DBLCLICK can range from 0.05 to 5.5 seconds (1 to 100 ticks).

Remarks

The _DBLCLICK setting overrides the setting specified in the Mouse dialog box in the Window Control Panel.

_DBLCLICK contains a numeric value that determines the time interval Visual FoxPro uses to check for a double or triple mouse click. _DBLCLICK is the time interval between mouse clicks. For example, if _DBLCLICK is set to 0.5 seconds, you have a 1/2 second to click twice for a double-click, and 1 second to click three times for a triple-click.

The larger the value of _DBLCLICK, the longer you can wait between the first and second click for Visual FoxPro to interpret the two clicks as a double-click. If _DBLCLICK is set to a very small value, even quick double (or triple) clicks may be interpreted as two (or three) single clicks.


See Also

INKEY( )


DBSETPROP( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Sets a property for the current database or for fields, named connections, tables, or views in the current database.

Syntax

DBSETPROP(cName, cType, cProperty, ePropertyValue)

Returns

Logical

Arguments

cName   Specifies the name of the database, field, named connection, table, or view for which a property is set.

To set a property for a field in a table or a view, preface the name of the field with the name of the table or view containing the field. For example, to set a property for the custid field in the customer table, specify the following for cName:

customer.custid

cType   Specifies whether cName is the current database or for a field, named connection, table, or view in the current database.

 The following table lists the values you can specify for cType:

cType	Description
CONNECTION	cName is a named connection in the current database.
DATABASE	cName is the current database.
FIELD	cName is a field in the current database.
TABLE	cName is a table in the current database.
VIEW	cName is a view in the current database.
cProperty   Specifies the name of the property to set. If a property is read-only, its value cannot be changed with DBSETPROP( ). If you attempt to set a property that is read-only, Visual FoxPro generates an error message.

For more information on properties you can specify with cProperty, including their data types, see DBGETPROP( ).

ePropertyValue   Specifies the value to which cProperty is set. ePropertyValue must be the same data type as the property’s data type.

Caution   Visual FoxPro does not verify that the value you specify is valid for the property. Thus, it is possible to set a property to an invalid value with DBSETPROP( ). For example, DBSETPROP( ) can be used to set a field rule expression to an expression that isn’t valid for the field, and Visual FoxPro will not generate an error.

Remarks

Use DBSETPROP( ) to set properties for the current database, or fields, named connections, tables, or views in the current database. Use DBGETPROP( ) to determine the current property values.

DBSETPROP( ) returns true (.T.) if Visual FoxPro successfully sets the property you specify. Visual FoxPro generates an error if the property you specify cannot be set.

For more details about the properties you can set for connections, databases, fields, tables, and views, refer to the topics listed in the following table.

For details about	Refer to this Topic	In this chapter of the Developer’s Guide
Database properties	“Viewing and Setting Database Properties”	Chapter 7, “Working with Tables”
Connections	“Accessing Remote Data”	Chapter 8, “Creating Views”
Views		Chapter 8, “Creating Views”
Triggers	“Using Triggers”	Chapter 7, “Working with Tables”
Captions	“Creating Captions for Fields”	Chapter 7, “Working with Tables”
Default values	“Creating Default Field Values”	Chapter 7, “Working with Tables”
	“Creating Default Values for View Fields”	Chapter 8, “Creating Views”
Comments	“Adding Comments to Fields”	Chapter 7, “Working with Tables”
	“Viewing and Setting Database Properties”	Chapter 6, “Creating Databases”
Primary key	“Controlling Duplicate Values”	Chapter 7, “Working with Tables”
Rules	“Enforcing Business Rules”	Chapter 7, “Working with Tables”
	“Setting or Changing Field-level or Table Rules”	Chapter 7, “Working with Tables”
	“Creating Rules on View Fields and Rows”	Chapter 8, “Creating Views”


DBSETPROP( ) Function Example

The following example uses DBSETPROP( ) to specify a comment for the cust_id field in the customer table. DBGETPROP( ) is used to display the comment.

CLOSE DATABASES

CLEAR

OPEN DATABASE SYS(2004)+"samples\data\testdata"

USE customer	  && Open customer table

= DBSETPROP("customer.cust_id", "Field", "Comment", ;

    "Property has been set by DBSETPROP.")  && New field comments

cRESULTS = DBGETPROP("customer.cust_id", "Field", "Comment")

WAIT WINDOW "Cust_id field comments: "+ cRESULTS  && Display comments


See Also

ADD TABLE
CREATE DATABASE
CURSORGETPROP( )
CURSORSETPROP( )
DBGETPROP( )
DISPLAY DATABASE
LIST DATABASE
OPEN DATABASE
SQLCOMMIT( )
SQLROLLBACK( )


DBUSED( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns true (.T.) if the specified database is open.

Syntax

DBUSED(cDatabaseName)

Returns

Logical

Arguments

cDatabaseName   Specifies the name of the database for which DBUSED( ) returns a logical value indicating whether or not the database is open.

Remarks

DBUSED( ) returns true (.T.) if the specified database is open; otherwise, it returns false (.F.).


DBUSED( ) Function Example

The following example opens the TESTDATA database, and then uses DBUSED( ) to determine if the TESTDATA database and a database named TEST are open.

CLOSE DATABASES

OPEN DATABASE (SYS(2004) + "samples\data\testdata")

CLEAR

? 'Testdata database open? '

?? DBUSED('testdata')	  && Displays .T.

? 'Test database open? '

?? DBUSED('test')	  && Displays .F.


See Also

CLOSE DATABASES
CREATE DATABASE
OPEN DATABASE


DDE Functions

Remarks         See Also

Exchange data between Visual FoxPro and other Microsoft Windows-based applications.

Remarks

Visual FoxPro can act as both a server and a client to send and receive data to and from other Microsoft Windows-based applications.

The following naming conventions are used in applications that support DDE (dynamic data exchange).

Name	Description
Service Name	A name that the server responds to when a client tries to access the server. A server can support many service names.
Topic Name	A name that specifies a logical set of data. For file-based applications, topic names are usually file names. In other applications, topic names are application-specific. To access the server, the client must specify a topic name in addition to the server’s service name.
Item Name	A name that specifies a unit of data that the server can pass to the client requesting the data.
To request data from another application, create a Visual FoxPro program that establishes Visual FoxPro as a client. Here is a brief outline for creating a simple Visual FoxPro program that requests data from another application:

•	Establish a link to the server application with DDEInitiate( ).

•	If the link is successfully established, use DDERequest( ) to request data from the server application. DDERequest( ) can be issued repeatedly to request additional data.

•	After the data has been received, issue DDETerminate( ) to terminate the link to the server application to free up system resources.

The functions above establish a cold link. A cold link exists when the client initiates all the communications between the applications. For a discussion of other types of links, see DDEAdvise( ).

The following is a brief outline for a program that establishes Visual FoxPro as a server:

•	Use DDESetService( ) to create a service and specify the type of service.

•	Use DDESetTopic( ) to create a service topic and specify the procedure to execute when the topic is specified in a client request.

•	Create the procedure specified in DDESetTopic( ) to accept the parameters passed to the procedure.

•	Within the procedure, process the request and, if appropriate, return the requested data to the client.

Note that these DDE functions differ from previous Visual FoxPro function conventions in the following ways:

•	The first four characters of these functions are not unique.

•	The function names exceed 10 characters and cannot be abbreviated.

DDE Function	Description
DDEAbortTrans( )	Ends an asynchronous DDE transaction.
DDEAdvise( )	Creates a notify link or an automatic link used in DDE.
DDEEnabled( )	Enables or disables DDE processing or returns the status of DDE processing.
DDEExecute( )	Using DDE, sends a command to another application.
DDEInitiate( )	Establishes a DDE channel between Visual FoxPro and another Microsoft Windows-based application.
DDELastError( )	Returns an error number for the last DDE function.
DDEPoke( )	Sends data between client and server applications in a DDE conversation.
DDERequest( )	Requests data from a server application in a dynamic DDE conversation.
DDESetOption( )	Changes or returns DDE settings.
DDESetService( )	Creates, releases or modifies service names and settings in Visual FoxPro.
DDESetTopic( )	In a DDE conversation, creates or releases a topic name from a service name.
DDETerminate( )	Closes a DDE channel established with DDEInitiate( ).


See Also

DDEAbortTrans( )
DDEAdvise( )
DDEEnabled( )
DDEExecute( )
DDEInitiate( )
DDELastError( )
DDEPoke( )
DDERequest( )
DDESetOption( )
DDESetService( )
DDESetTopic( )
DDETerminate( )


DDEAbortTrans( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Ends an asynchronous dynamic data exchange (DDE) transaction.

Syntax

DDEAbortTrans(nTransactionNumber)

Returns

Logical

Arguments

nTransactionNumber   Specifies the transaction number returned by DDEExecute( ), DDEPoke( ), or DDERequest( ) when the transaction is sent to the server application.

Remarks

An asynchronous transaction allows Visual FoxPro program execution to continue without waiting for the server application to respond to a data request.

DDEExecute( ), DDEPoke( ), and DDERequest( ) wait for the period specified by DDESetOption( ) for a server application to respond, unless you specify a user-defined function to execute when the server application responds. Specifying a user-defined function to execute in these functions creates an asynchronous transaction.

If DDEAbortTrans( ) is called before the server has processed the request, the user-defined function won’t be called for the transaction.

DDEAbortTrans( ) returns true (.T.) if the asynchronous transaction is successfully ended and returns false (.F.) if the asynchronous transaction cannot be ended. Use DDELastError( ) to determine why the transaction couldn’t be ended.


See Also

DDEExecute( )
DDELastError( )
DDEPoke( )
DDERequest( )


DDEAdvise( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Creates a notify link or an automatic link used in a dynamic data exchange (DDE).

Syntax

DDEAdvise(nChannelNumber, cItemName, cUDFName, nLinkType)

Returns

Logical

Arguments

nChannelNumber   Specifies the channel number.

cItemName   Specifies the item name. For example, Microsoft Excel uses row and column notation to refer to cells in a worksheet. The item name R1C1 designates the cell in the first row and first column of the worksheet.

cUDFName   Specifies the user-defined function that is executed when a notify link or an automatic link is established and the item cItemName is modified. When the user-defined function is executed, it is passed the following six parameters in the order given below:

Parameter	Contents
Channel Number	The channel number of the server application
Action	ADVISE or TERMINATE
Item	The item name; for example, R1C1 for a Microsoft Excel worksheet cell
Data	The new data (automatic link) or the empty string (notify link)
Format	The data format; for example, CF_TEXT
Advise Status	The link type (0 = manual, 1 = notify, 2 = automatic)
The user-defined function should have six parameters in its LPARAMETER or PARAMETER statement to accept the values passed from the server application. If a notify link is established, the user-defined function is executed and the empty string is passed in the Data parameter. You can issue DDERequest( ) later to retrieve the data. If an automatic link is established, the user-defined function is executed and the data is passed in the Data parameter.

The Action parameter contains ADVISE when the link is being updated by the server. The user-defined function is called, and the Action parameter contains TERMINATE when the link is closed by the client or server.

Any value returned by the user-defined function is ignored.

nLinkType   Specifies the link type in the following way:

nLinkType	Link type
0	Manual
1	Notify
2	Automatic
You can turn off notification from the server application by specifying 0 for nLinkType. If the item changes, the user-defined function isn’t executed.

Remarks

DDEAdvise( ) is used to create a notify link or an automatic link to an item name in a server application. When a notify link is created with DDEAdvise( ), the server application notifies Visual FoxPro that the item name has been modified. If an automatic link is created, the server application notifies Visual FoxPro that the item name has been modified and passes the new data to Visual FoxPro.

Before you can create a link, you must establish a channel to the server application with DDEInitiate( ).

You can also use DDEAdvise( ) to turn off notification from the server.

DDEAdvise( ) returns a true value (.T.) if it executes successfully; otherwise, it returns false (.F.).


DDEAdvise( ) Function Example

The following example demonstrates how you can establish a DDE channel to a Microsoft Excel worksheet named Sheet1. DDEAdvise( ) is used to establish two links to data in two worksheet cells (R1C1 and R1C2). The user-defined function NEWDATA is executed when data in either of the cells changes. The user-defined function tests the item and advise parameters to determine which item changed and what kind of link has been established.

PUBLIC mchannum

mchannum = DDEInitiate('Excel', 'Sheet1')

IF mchannum != -1

= DDEAdvise(mchannum, 'R1C1', 'newdata', 1)	  && Notify link

= DDEAdvise(mchannum, 'R1C2', 'newdata', 2)	  && Automatic link

WAIT WINDOW 'Enter data in first two cells in Excel.'

ENDIF

PROCEDURE newdata

PARAMETERS channel, action, item, data, format, advise

IF action = 'ADVISE'

DO CASE

CASE item = 'R1C1'	&& Notify link

newvalue = DDERequest(channel, item)

? 'R1C1 notify link: ' + newvalue

CASE item = 'R1C2'	&& Automatic link

newvalue = data

? 'R1C2 automatic link: ' + newvalue

ENDCASE

ELSE

IF action != "TERMINATE"

= DDETerminate(mchannum)

   ENDIF

ENDIF


See Also

DDEInitiate( )
DDELastError( )
DDESetOption( )
DDETerminate( )


DDEEnabled( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Enables or disables dynamic data exchange (DDE) processing or returns the status of DDE processing.

Syntax

DDEEnabled([lExpression1 | nChannelNumber [, lExpression2]])

Returns

Logical

Arguments

lExpression1   Specify true (.T.) or false (.F.) to globally enable or disable DDE processing. DDEEnabled( ) returns true (.T.) if DDE processing is successfully enabled or disabled; otherwise false (.F.) is returned.

nChannelNumber   Specifies the channel number for the channel whose DDE processing status DDEEnabled( ) returns. DDEEnabled( ) returns true (.T.) if DDE processing is enabled for the specified channel and returns false (.F.) if DDE processing is disabled.

lExpression2   To enable DDE processing for a specific channel, include the channel number (nChannelNumber) and specify true (.T.) for lExpression2. To disable DDE processing for a specific channel, include the channel number (nChannelNumber) and specify false (.F.) for lExpression2.

Remarks

Using DDEEnabled( ), you can globally enable or disable processing. You can also enable or disable DDE processing for specific channels.

DDEEnabled( ) can be used to protect critical code or disable links for short periods. When DDE processing is disabled, client requests are queued until DDE processing is enabled.

If DDEEnabled( ) is issued without any of its optional arguments, the global DDE processing status is returned. DDEEnabled( ) returns true (.T.) if DDE processing has been globally enabled and false (.F.) if DDE processing has been globally disabled.


See Also

DDEAbortTrans( )
DDEAdvise( )
DDEExecute( )
DDEInitiate( )
DDELastError( )
DDEPoke( )
DDERequest( )
DDESetOption( )
DDESetService( )
DDESetTopic( )
DDETerminate( )


DDEExecute( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Sends a command to another application, using dynamic data exchange (DDE).

Syntax

DDEExecute(nChannelNumber, cCommand [, cUDFName])

Returns

Logical

Arguments

nChannelNumber   Specifies the channel number.

cCommand   Specifies the command you want to send to the other application. The format of the command is determined by the application you are sending it to. Consult the application’s documentation for the correct syntax.

cUDFName   Allows asynchronous command execution requests. If you omit cUDFName, a client application waits for the period specified with DDESetOption( ). If you specify a user-defined function with cUDFName, client program execution continues immediately after the command execution request is made.

When the server application finishes executing the command, the user-defined function you specify with cUDFName is executed. The user-defined function is passed six parameters in the order shown in the following table.

Parameter	Contents
Channel Number	The channel number of the server application
Action	XACTCOMPLETE (successful execution) XACTFAIL (failed command execution)
Item	The item name; for example, R1C1 for a Microsoft Excel worksheet cell
Data	The new data (REQUEST) or data passed (POKE or EXECUTED)
Format	The data format; for example, CF_TEXT
Transaction Number	The transaction number returned by DDEExecute( )
Use DDEAbortTrans( ) to cancel an uncompleted transaction. If the transaction fails, you can use DDELastError( ) to determine why it failed.

When you include cUDFName, DDEExecute( ) doesn’t return a logical value. Instead, a transaction number is returned; if an error occurs, –1 is returned.

Remarks

The command sent with DDEExecute( ) must be understood by the application. Before you can execute the command, you must establish a channel to the server application with DDEInitiate( ).

For example, Microsoft Excel has an extensive set of macro commands, including DDE commands that let you request data from Visual FoxPro from within Microsoft Excel. If you establish a channel to Microsoft Excel, you can then use DDEExecute( ) to send macro commands to Microsoft Excel from within Visual FoxPro.

If the receiving application successfully executes the command, DDEExecute( ) returns true (.T.). If the receiving application cannot successfully execute the command or if the channel number you include is not valid, DDEExecute( ) returns false (.F.). If the optional asynchronous user-defined function cUDFName is included, a transaction number is returned. If an error occurs, DDEExecute( ) returns –1.


 DDEExecute( ) Function Example

The following example uses DDEInitiate( ) to establish a DDE channel between Visual FoxPro and the Microsoft Excel worksheet Sheet1. DDEExecute( ) is used to execute a Microsoft Excel command that maximizes the Microsoft Excel window.

gnChanNum = DDEInitiate('Excel', 'Sheet1')

IF gnChanNum != -1

glExecute = DDEExecute(gnChanNum, '[App.Maximize]')

IF glExecute != .F.

WAIT WINDOW 'EXCEL window has been zoomed out.'

ENDIF

= DDETerminate(gnChanNum)	&& Close the channel

ENDIF


 See Also

DDEAbortTrans( )
DDEInitiate( )
DDELastError( )
DDESetOption( )
DDETerminate( )


DDEInitiate( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Establishes a dynamic data exchange (DDE) channel between Visual FoxPro and another Microsoft Windows-based application.

Syntax

DDEInitiate(cServiceName, cTopicName)

Returns

Numeric

Arguments

cServiceName   Specifies the service name of the server application which, in most cases, is the name of the executable file without its extension. The default service name for Visual FoxPro is Visual FoxPro. If you are establishing a channel to Microsoft Excel, cServiceName is Excel.

cTopicName   Specfies the topic name. The topic is application-specific and must be understood by the application. For example, one topic supplied by most DDE servers is the System topic. See the application documentation for the service and topic names supported by the application.

Remarks

DDEInitiate( ) establishes a DDE channel between Visual FoxPro and a DDE server application. Once a channel is established, Visual FoxPro can request data from the server by referring to the channel in subsequent DDE functions. Visual FoxPro acts as the client, requesting data from the server application through the channel.

If the channel is successfully established, DDEInitiate( ) returns the channel number. Channel numbers are non-negative, and the number of channels you can establish is limited only by your system resources.

DDEInitiate( ) returns –1 if the channel cannot be established. If the server application isn’t open, Visual FoxPro asks if you would like to open it. If you choose Yes, Visual FoxPro attempts to open the application. (You can use DDELastError( ) to determine why a channel cannot be established.)

To avoid being asked whether you want to open the application, set the DDESetOption( ) SAFETY option. You can also use RUN with the /N option to start the application.

A channel can be closed with DDETerminate( ).


 DDEInitiate( ) Function Example

The following example uses DDEInitiate( ) to establish a DDE channel between Visual FoxPro and a Microsoft Excel worksheet named Sheet1. ‘Excel’ is the service name, and ‘Sheet1’ is the topic name. The channel number is stored to the memory variable mchannum for use in subsequent DDE functions.

mchannum = DDEInitiate('Excel', 'Sheet1')

IF mchannum != -1

* Process client actions

= DDETerminate(mchannum)  && Close the channel

ENDIF


 See Also

DDEAdvise( )
DDEEnabled( )
DDEExecute( )
DDELastError( )
DDEPoke( )
DDERequest( )
DDESetOption( )
DDETerminate( )
RUN | !


DDELastError( ) Function

Syntax         Returns         Remarks         See Also

Returns an error number for the last dynamic data exchange (DDE) function.

Syntax

DDELastError( )

Returns

Numeric

Remarks

You can use DDELastError( ) to help determine the cause of an error when a DDE function doesn’t execute successfully.

DDELastError( ) returns 0 if the last DDE function executed successfully. It returns a nonzero value if the last DDE function was unsuccessful. The following table lists the error numbers and their descriptions.

Error number	Description
1	Service busy
2	Topic busy
3	Channel busy
4	No such service
5	No such topic
6	Bad channel
7	Insufficient memory
8	Acknowledge timeout
9	Request timeout
10	No DDEInitiate( )
11	Client attempted server transaction
12	Execute timeout
13	Bad parameter
14	Low memory
15	Memory error
16	Connect failure
17	Request failure
18	Poke timeout
19	Could not display message
20	Multiple synchronous transactions
21	Server died
22	Internal DDE error
23	Advise timeout
24	Invalid transaction identifier
25	Unknown


See Also

DDEAbortTrans( )
DDEAdvise( )
DDEEnabled( )
DDEExecute( )
DDEInitiate( )
DDEPoke( )
DDERequest( )
DDESetOption( )
DDESetService( )
DDESetTopic( )
DDETerminate( )


DDEPoke( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Sends data between client and server applications in a dynamic data exchange (DDE) conversation.

Syntax

DDEPoke(nChannelNumber, cItemName, cDataSent
[, cDataFormat [, cUDFName]])

Returns

Logical

Arguments

nChannelNumber   Specifies the channel number of the application data is sent to. If the channel number is a server channel, DDEPoke( ) sends the data in response to a request or a previously established notify or automatic link.

cItemName   Specifies the item name to which data is sent. The item name is application-specific and must be understood by the application. For example, Microsoft Excel supports R1C1 as a valid item name that refers to the first cell in a worksheet.

cDataSent   Specifies the data sent to the item name specified with cItemName.

cDataFormat   Specifies the format used to send the data. The default format is CF_TEXT. In this format, fields are delimited with tabs and records are delimited with a carriage return and a linefeed.

cUDFName   Allows asynchronous data transfer. If cUDFName is omitted, a client waits for the period specified with DDESetOption( ). If you specify the name of a user-defined function with cUDFName, client program execution continues immediately after the request is made.

When the data is available from the server application, the user-defined function specified with cUDFName is executed. The user-defined function is passed six parameters in this order:

Parameter	Contents
Channel Number	The channel number of the server application
Action	XACTCOMPLETE (successful transaction) XACTFAIL (failed transaction)
Item	The item name; for example, R1C1 for a Microsoft Excel worksheet cell
Data	The new data (REQUEST) or data passed (POKE or EXECUTED)
Format	The data format; for example, CF_TEXT
Transaction Number	The transaction number returned by DDEPoke( )
Use DDEAbortTrans( ) to cancel an uncompleted transaction. If the transaction fails, you can use DDELastError( ) to determine why it failed.

When you include cUDFName, DDEPoke( ) returns a transaction number if successful or –1 if an error occurs.

Remarks

DDEPoke( ) sends data as a character string to the item name in the application specified by the channel number.

If the data is successfully sent, DDEPoke( ) returns true (.T.). If the data cannot be sent, DDEPoke( ) returns false (.F.). If the asynchronous user-defined function cUDFName is included, DDEPoke( ) returns a transaction number; if an error occurs, DDEPoke( ) returns –1.


 See Also

DDEAbortTrans( )
DDEInitiate( )
DDELastError( )
DDESetOption( )
DDETerminate( )


DDERequest( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Requests data from a server application in a dynamic data exchange (DDE) conversation.

Syntax

DDERequest(nChannelNumber, cItemName [, cDataFormat [, cUDFName]])

Returns

Character

Arguments

nChannelNumber   Specifies the channel number of the server application.

cItemName   Specifies the item name. The item name is application-specific and must be understood by the application. For example, Microsoft Excel uses row and column notation to refer to cells in a worksheet. The item name R1C1 designates the cell in the first row and first column of the worksheet.

cDataFormat   Specifies a format for the data requested. The default format is CF_TEXT. In this format, fields are delimited with tabs and records are delimited with a carriage return and a linefeed.

cUDFName   Allows an asynchronous data transfer. If you omit cUDFName, Visual FoxPro waits for the data from the server for the period specified with DDESetOption( ). If you specify the name of a user-defined function with cUDFName, Visual FoxPro continues program execution immediately after the request is made.

When the data is available from the server application, the user-defined function specified with cUDFName is executed. The user-defined function is passed six parameters in this order:

Parameter	Contents
Channel Number	The channel number of the server application
Action	XACTCOMPLETE (successful transaction) XACTFAIL (failed transaction)
Item	The item name; for example, R1C1 for a Microsoft Excel worksheet cell
Data	The new data (REQUEST) or data passed (POKE or EXECUTED)
Format	The data format; for example, CF_TEXT
Transaction Number	The transaction number returned by DDERequest( )
Use DDEAbortTrans( ) to cancel an uncompleted transaction. If the transaction fails, you can use DDELastError( ) to determine why it failed.

When you include cUDFName, DDERequest( ) returns a transaction number equal to or greater than 0 if successful, or –1 if an error occurs.

Remarks

Before you can request data using DDERequest( ), you must establish a channel to the server application with DDEInitiate( ).

If the request for data is successful, DDERequest( ) returns the data as a character string. If the request fails, DDERequest( ) returns an empty string and DDELastError( ) returns a nonzero value. If you include the asynchronous user-defined function cUDFName, DDERequest( ) returns a transaction number if successful, or –1 if an error occurs.


DDERequest( ) Function Example

The following example uses DDEInitiate( ) to establish a DDE channel between Visual FoxPro and a Microsoft Excel worksheet named Sheet1. ‘Excel’ is the service name, and ‘Sheet1’ is the topic name. The channel number is stored to the memory variable mchannum for use in subsequent DDE functions.

DDERequest( ) requests the item name R1C1, the data in the first row and column of the Sheet1 spreadsheet.

mchannum = DDEInitiate('Excel', 'Sheet1')

IF mchannum != -1

mrequest = DDERequest(mchannum, 'R1C1')

IF !EMPTY(mrequest) AND DDELastError( ) = 0	&& Successful

WAIT WINDOW 'R1C1 contents: ' + mrequest

ENDIF

= DDETerminate(mchannum)	&& Close the channel

ENDIF


See Also

DDEAbortTrans( )
DDEInitiate( )
DDELastError( )
DDESetOption( )
DDETerminate( )


DDESetOption( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Changes or returns dynamic data exchange (DDE) settings.

Syntax

DDESetOption(cOption [, nTimeoutValue | lExpression])

Returns

Logical or Numeric

Arguments

cOption   Specifies the setting options.

cOption	Setting	Default	Description
TIMEOUT	nTimeoutValue (number of milliseconds)	2000	The number of milliseconds DDE functions wait for the server application to respond; the current TIMEOUT value is returned if you omit nTimeoutValue.
SAFETY	lExpression (true (.T.)  or false (.F.))	.T.	Specifies whether a dialog is displayed when you use DDEInitiate( ) to establish a channel to a server application and the application doesn’t respond; the current SAFETY setting is returned if you omit lExpression.
nTimeoutValue   Specifies the timeout value.

lExpression   Enables or disables dialog display.

Remarks

Use DDESetOption( ) to change or return DDE settings. Two options, TIMEOUT and SAFETY, are available.


 See Also

DDEAdvise( )
DDEEnabled( )
DDEExecute( )
DDEInitiate( )
DDEPoke( )
DDERequest( )
DDESetService( )
DDETerminate( )


DDESetService( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Creates, releases, or modifies DDE service names and settings.

Syntax

DDESetService(cServiceName, cOption [, cDataFormat | lExpression])

Returns

Logical

Arguments

cServiceName   Specifies the service name to create, release, modify, or return information about.

cOption   Specifies to create, release or modify a service name or to return information about a service name. The following table lists the options you can specify with cOption, the default values for the options and a description of each option.

Option	Default value	Description
DEFINE	-	Creates a new service name
RELEASE	-	Releases an existing service name
ADVISE	.F.	Enables or disables client notification of changes to item names
EXECUTE	.F.	Enables or disables command execution
POKE	.F.	Enables or disables client pokes to the service
REQUEST	.T.	Enables or disables requests to the service name
FORMATS	CF_TEXT	Specifies supported data formats
DEFINE   Creates a new service name. For example, the following command creates the service name myservice:

glNewService = DDESetService('myservice', 'DEFINE')

RELEASE   Releases an existing service name to free up system resources. When a service name is released, all of the service’s topic names are also released.

The following command releases the service name created in the previous example:

glRelease = DDESetService('myservice', 'RELEASE')

To release the default Visual FoxPro service, issue this command:

glRelFox = DDESetService('FoxPro', 'RELEASE')

ADVISE   Specifies whether a client is notified when data changes in an item name or specifies to return the current advise status for a service name. Refer to DDEAdvise( ) for additional information about advising clients.

To enable client notification, specify true (.T.) for lExpression. Specifying false (.F.) for lExpression disables client notification.

To return the current client notification status for the service name, omit lExpression. DDESetService( ) returns true if client notification is enabled for the service name; it returns false if client notification is disabled.

EXECUTE   Allows you to enable or disable command execution requests to a service name or to determine the current execute status for a service name.

To enable client requests to execute a command, specify true (.T.) for lExpression. Specifying false (.F.) for lExpression disables client requests to execute a command. .F. is the default value.

To return the current command execution status for the service name, omit lExpression. DDESetService( ) returns true if client command execution requests are enabled for the service name; otherwise, it returns false.

The following commands enable command execution and disable data requests from client applications for the service name myservice. The current command execution status for myservice is then displayed:

glExecute = DDESetService('myservice', 'EXECUTE', .T.)

glRequest = DDESetService('myservice', 'REQUEST', .F.)

? DDESetService('myservice', 'EXECUTE')

POKE   Allows you to enable or disable poke requests to the service name. You can also determine the current poke status for a service name. Refer to DDEPoke( ) for additional information about poking data to a server or a client.

To enable client poke requests, specify true (.T.) for lExpression. Specifying false (.F.) for lExpression disables client poke requests. .F. is the default value.

To return the current poke status for the service name, omit lExpression. DDESetService( ) returns true if poke requests are enabled for a service name; it returns false if poke requests are disabled.

REQUEST   Use REQUEST to enable or disable client requests to a service name or to return the current request status for the service name.

To enable client requests to the service name, specify true (.T.) for lExpression. Specifying false (.F.) disables client requests to the service name. True (.T.) is the default value.

To return the current request status for a service name, omit lExpression. DDESetService( ) returns true if client requests are enabled for the service name; it returns false if client requests are disabled.

The following commands disable requests from client applications to the service name myservice and display the current request status for myservice:

glRequest = DDESetService('myservice', 'REQUEST', .F.)

? DDESetService('myservice', 'REQUEST')

FORMATS [cDataFormat]   Specifies the data formats supported by the service name. Server requests for formats not specified with cDataFormat are rejected. When specifying data formats, include a list of the supported formats separated by commas. For example:

=DDESetService('myservice', 'FORMATS', 'CF_TEXT, CF_SYLK')

If you omit cDataFormat, only the CF_TEXT format is supported.

lExpression   Specifies the state of the REQUEST, EXECUTE, POKE, or ADVISE options. Specify true (.T.) for lExpression to enable the option or false (.F.) to disable it.

 Remarks

Visual FoxPro can act as a dynamic data exchange (DDE) server to send data to client Microsoft Windows-based applications. DDESetService( ) is used to create, release, or modify service names and settings in Visual FoxPro. Each service name can have a set of topic names created with DDESetTopic( ). Client applications request data from DDE topic names.

DDESetService( ) returns true (.T.) if the service name is successfully created, released or modified. If the service name cannot be created, released or modified, DDESetService( ) returns false (.F.).

DDESetService( ) can also be used to return information about a service name. Visual FoxPro has the default service name FoxPro. The Visual FoxPro service name has one topic name called System. The following table lists all the item names supported by the System topic.

Item name	Item
Topics	A list of available topic names
Formats	A list of supported formats
Status	Busy or Ready
SysItems	A list of item names
You can use DDESetTopic( ) to modify the FoxPro service name or to release it. For information about manipulating Visual FoxPro service name, see the DDESetTopic( ) options.


 See Also

DDEEnabled( )
DDELastError( )
DDEPoke( )
DDESetTopic( )


DDESetTopic( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Creates or releases a topic name from a service name in a dynamic data exchange (DDE) conversation.

Syntax

DDESetTopic(cServiceName, cTopicName [, cUDFName])

Returns

Logical

Arguments

cServiceName   Specifies the service name. Additional service names can be created with DDESetService( ).

cTopicName   Specifies the topic name to create or release. If you include cUDFName, DDESetTopic( ) creates the topic name cTopicName. If you omit cUDFName, the topic name cTopicName is released. If cTopicName is an empty string, the user-defined function specified with cUDFName is executed for any topic name that isn’t explicitly declared.

cUDFName   Specifies the name of the user-defined function executed when a client application makes a request to the topic name. If you omit cUDFName, the topic name cTopicName is released from the service name.

When the user-defined function is executed, it is passed the following six parameters in the order given below:

Parameter	Contents
Channel Number	The client channel number
Action	ADVISE, EXECUTE, INITIATE, POKE, REQUEST, or TERMINATE
Item	The item name; for example, R1C1 for a Microsoft Excel worksheet cell
Data	Data from the client
Format	The data format; for example, CF_TEXT
Advise Status	The link type (0 = manual, 2 = notify or automatic)
The values of the Item, Data, and Advise Status parameters depend on the Action parameter. The following table lists the Action parameter values and the values contained in the Item, Data, and Advise Status parameters. A dash (-) indicates that the parameter value is the empty string.

Action value	Item value	Data value	Advise status
INITIATE	-	Topic name	-
TERMINATE	-	-	-
POKE	Item name	New data	-
REQUEST	Item name	-	-
EXECUTE	-	New command	-
ADVISE	Item name	-	Link type
If the user-defined function successfully handles the client request, the user-defined function should return true (.T.). If the request can’t be handled or an error occurs, the user-defined function should return false (.F.). If false is returned when the Action parameter value is INITIATE, the client topic name request is rejected. If false is returned when the value is POKE, REQUEST, or EXECUTE, the request is ignored. If false is returned when the value is ADVISE, the client request for a notify or automatic link is rejected.

Remarks

After a topic name is created, any client requests to the topic name cause Visual FoxPro to execute the user-defined function specified with cUDFName. The user-defined function is passed a set of parameters whose values are determined by the client request. The user-defined function return value is passed to the client with DDEPoke( ). The return value is a logical value indicating whether the topic name can provide the service requested by the client.

DDESetTopic( ) returns true (.T.) if it successfully creates or releases the topic name. It returns false (.F.) if the topic name cannot be created or released. Use DDELastError( ) to determine why a topic name cannot be created or released.


 DDESetTopic( ) Function Example

The following example creates a basic sample server called myserver that supports Visual FoxPro command execution from a client application. The client application makes requests to myserver through the DO topic, and macro substitution is used to execute the client’s command.

*** Set Visual FoxPro up as a DDE server ***

= DDESetService('myserver', 'DEFINE')

= DDESetService('myserver', 'EXECUTE', .T.)

= DDESetTopic('myserver', 'DO', 'DOTOPIC')

WAIT WINDOW 'Server portion service setup ... ' NOWAIT

*** Use Visual FoxPro as a DDE client ***

gnChannel = DDEInitiate('myserver','DO')

=DDEExecute(gnChannel, 'WAIT WINDOW "Command Executed ... "')

=DDETerminate(gnChannel)

PROCEDURE dotopic

PARAMETERS gnChannel, gcAction, gcItem, gData, gcFormat, gnAdvise

glResult = .F.

*** It's necessary to return .T. from an     ***

*** INITIATE action or no connection is made ***

IF gcAction = 'INITIATE'

glResult = .T.

ENDIF

IF gcAction = 'EXECUTE'

&gData

glResult = .T.

ENDIF

IF gcAction = 'TERMINATE'

WAIT WINDOW 'Goodbye ... ' NOWAIT

glResult = .T.

ENDIF

RETURN glResult

After running this example program, you have set up Visual FoxPro service, which other applications can access. If you have Microsoft Excel, you can run the following Excel macro:

gnMyChan = INITIATE("myserver","DO")

=EXECUTE(MyChan,"WAIT WINDOW 'Hi, this is EXCEL speaking'")

=RETURN( )


 See Also

DDEEnabled( )
DDELastError( )
DDEPoke( )
DDESetService( )


DDETerminate( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Closes a dynamic data exchange (DDE) channel established with DDEInitiate( ).

Syntax

DDETerminate(nChannelNumber | cServiceName)

Returns

Logical

Arguments

nChannelNumber   Specifies the channel number to close.

cServiceName   Specifies the service name to close.

 Remarks

If the channel is successfully closed, DDETerminate( ) returns true (.T.). If the channel cannot be closed, DDETerminate( ) returns false (.F.).

Be sure to close channels as soon as they are no longer needed to conserve system resources.

All channels are automatically closed if you exit Visual FoxPro by choosing Exit from the File menu or by issuing QUIT in the Command window or from within a program.


 See Also

DDEAbortTrans( )
DDEAdvise( )
DDEExecute( )
DDEInitiate( )
DDELastError( )
DDEPoke( )
DDERequest( )
DDESetOption( )


Deactivate Event

Syntax         Remarks         Applies To         See Also

Occurs when a container object, such as a form, is no longer active because none of its contained objects has the focus. For a toolbar, occurs when the toolbar is hidden using the Hide method.

Syntax

PROCEDURE Object.Deactivate

Remarks

The Activate and Deactivate events occur only when you are moving the focus within an application. Moving the focus to or from a form in another application doesn't trigger either event. The Deactivate event doesn't occur when unloading a form.

Whenever a new object is activated, either programmatically or interactively, the Deactivate event for the object previously active is triggered and the Activate event for the new object is triggered.


Applies To

Form, FormSet, Page, ToolBar


See Also

Activate Event
Hide Method
LostFocus Event
Show Method
Visible Property


DEACTIVATE MENU Command

Syntax         Arguments         Remarks         Example         See Also

Deactivates a user-defined menu bar and removes it from the screen; but doesn’t remove the menu-bar definition from memory.

Syntax

DEACTIVATE MENU MenuName1 [, MenuName2 ...] | ALL

Arguments

MenuName1 [, MenuName2 ...]   Specifies the names of the menu bars to deactivate. You can deactivate a set of menu bars by including a list of menu bar names separated by commas.

ALL   Deactivates all active menus.

Remarks

DEACTIVATE MENU removes an active menu bar or set of menu bars from the main Visual FoxPro window or a user-defined window without removing the menu bar definition from memory. A menu bar can be reactivated with ACTIVATE MENU and the menu bar name.

Tip   When you include the system menu bar (_MSYSMENU) in an application, you don’t need to define, activate, or deactivate the menu bar. Instead, issue SET SYSMENU AUTOMATIC.

To release a specific menu bar or a set of menu bars from memory, use RELEASE MENUS. You can release all menu bars from memory with CLEAR MENUS or CLEAR ALL.

Program control is returned to the program line immediately following the line that activated the menu bar unless DEFINE MENU BAR is used to create the menu bar or ACTIVATE MENU NOWAIT is used to activate the menu bar.


DEACTIVATE MENU Command Example

The following example uses DEACTIVATE MENU to deactivate a menu and remove it from the screen. The current system menu bar is saved to memory with SET SYSMENU SAVE, and all the system menu titles are removed with SET SYSMENU TO.

Two menu titles are created with DEFINE PAD, and DEFINE POPUP creates a menu for each menu title. DEFINE BAR creates menu items on each of the menus. When a menu title is chosen, ON PAD uses ACTIVATE POPUP to activate the corresponding menu. ACTIVATE MENU displays and activates the menu bar.

When an item is chosen from a menu, the CHOICE procedure is executed. CHOICE displays the name of the chosen item and the name of the menu containing the item. Program control continues on the line after ACTIVATE MENU.

Finally, the menu is deactivated and removed from the screen and is then released from memory with RELEASE MENUS EXTENDED.

*** Name this program DEACMENU.PRG ***

CLEAR

SET SYSMENU SAVE

SET SYSMENU TO

ON KEY LABEL ESC KEYBOARD CHR(13)

DEFINE MENU example BAR AT LINE 1

DEFINE PAD convpad OF example PROMPT '\<Conversions' COLOR SCHEME 3 ;

KEY ALT+C, ''

DEFINE PAD cardpad OF example PROMPT 'Card \<Info' COLOR SCHEME 3 ;

KEY ALT+I, ''

ON PAD convpad OF example ACTIVATE POPUP conversion

ON PAD cardpad OF example ACTIVATE POPUP cardinfo

DEFINE POPUP conversion MARGIN RELATIVE SHADOW COLOR SCHEME 4

DEFINE BAR 1 OF conversion PROMPT 'Ar\<ea' ;

KEY CTRL+E, '^E'

DEFINE BAR 2 OF conversion PROMPT '\<Length' ;

KEY CTRL+L, '^L'

DEFINE BAR 3 OF conversion PROMPT 'Ma\<ss' ;

KEY CTRL+S, '^S'

DEFINE BAR 4 OF conversion PROMPT 'Spee\<d' ;

KEY CTRL+D, '^D'

DEFINE BAR 5 OF conversion PROMPT '\<Temperature' ;

KEY CTRL+T, '^T'

DEFINE BAR 6 OF conversion PROMPT 'T\<ime' ;

KEY CTRL+I, '^I'

DEFINE BAR 7 OF conversion PROMPT 'Volu\<me' ;

KEY CTRL+M, '^M'

ON SELECTION POPUP conversion DO choice IN deacmenu WITH PROMPT( ), POPUP( )

DEFINE POPUP cardinfo MARGIN RELATIVE SHADOW COLOR SCHEME 4

DEFINE BAR 1 OF cardinfo PROMPT '\<View Charges' ;

KEY ALT+V, ''

DEFINE BAR 2 OF cardinfo PROMPT 'View \<Payments' ;

KEY ALT+P, ''

DEFINE BAR 3 OF cardinfo PROMPT 'Vie\<w Users' ;

KEY ALT+W, ''

DEFINE BAR 4 OF cardinfo PROMPT '\-'

DEFINE BAR 5 OF cardinfo PROMPT '\<Charges '

ON SELECTION POPUP cardinfo;

DO choice IN deacmenu WITH PROMPT( ), POPUP( )

ACTIVATE MENU example

DEACTIVATE MENU example

RELEASE MENU example EXTENDED

SET SYSMENU NOSAVE

SET SYSMENU TO DEFAULT

ON KEY LABEL ESC

PROCEDURE choice

PARAMETERS mprompt, mpopup

WAIT WINDOW 'You chose ' + mprompt + ;

' from popup ' + mpopup NOWAIT


See Also

ACTIVATE MENU
CLEAR ALL
CLEAR MENUS
CREATE MENU
DEFINE MENU
HIDE MENU
RELEASE
SHOW MENU


DEACTIVATE POPUP Command

Syntax         Arguments         Remarks         See Also

Deactivates a menu created with DEFINE POPUP.

Syntax

DEACTIVATE POPUP MenuName1 [, MenuName2 ...] | ALL

Arguments

MenuName1 [, MenuName2 ...]   Specifies the names of the menu or menus to deactivate. You can deactivate a set of menus by including a list of menu names separated by commas.

ALL   Deactivates all active menus.

Remarks

DEACTIVATE POPUP removes an active menu or set of menus from the main Visual FoxPro window or a user-defined window without removing the menu definition from memory. A menu can be reactivated by using ACTIVATE POPUP and the menu name.

Use RELEASE POPUPS with the menu name to release a specific menu or a set of menus from memory. You can release all menus from memory with CLEAR POPUPS or CLEAR ALL.

Program control is returned to the line immediately following the line that activated the menu unless ACTIVATE POPUP NOWAIT is used to activate the menu.


See Also

ACTIVATE POPUP
CLEAR ALL
CLEAR POPUPS
CREATE MENU
DEFINE POPUP
HIDE POPUP
RELEASE POPUPS
SHOW POPUP


DEACTIVATE WINDOW Command

Syntax         Arguments         Remarks         Example         See Also

Deactivates user-defined windows or Visual FoxPro system windows and removes them from the screen, but not from memory.

Syntax

DEACTIVATE WINDOW WindowName1 [, WindowName2 ...] | ALL

Arguments

WindowName1 [, WindowName2 ...]   Specifies one or more windows to deactivate. You can specify Visual FoxPro system windows such as the Command window or a Browse window.

ALL   Deactivates all active windows.

Remarks

More than one user-defined window can be placed in the main Visual FoxPro window at the same time, but output is directed only to the most recently activated user-defined window. When more than one user-defined window is present, deactivating the current user-defined output window clears the contents of the window, removes the window from the screen and sends subsequent output to the previously activated user-defined window. If there is no output window, output is directed to the main Visual FoxPro window.

Use CLEAR WINDOWS or RELEASE WINDOWS to remove windows from both the screen and memory.

To deactivate a system window and or a toolbar (in Visual FoxPro), enclose the entire system window or toolbar name in quotation marks. For example, to deactivate the Report Controls toolbar in Visual FoxPro, issue the following command:

DEACTIVATE WINDOW "Report Controls"


DEACTIVATE WINDOW Command Example

In the following example, a window named wOutput1 is defined and activated. After a record from the customer table is displayed, the program waits for the user to press a key and then deactivates the window.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

CLEAR

DEFINE WINDOW wOutput1 FROM 2,1 TO 13,75 TITLE 'Output' ;

CLOSE FLOAT GROW SHADOW ZOOM

ACTIVATE WINDOW wOutput1

DISPLAY

WAIT WINDOW 'Press a key to deactivate the window'

DEACTIVATE WINDOW wOutput1

RELEASE WINDOW wOutput1


See Also

ACTIVATE WINDOW
CLEAR WINDOWS
DEFINE WINDOW
HIDE WINDOW
RELEASE WINDOWS
SHOW WINDOW


DEBUG Command

Syntax         Remarks         See Also

Opens the Visual FoxPro debugger.

Syntax

DEBUG

Remarks

The debugger Environment setting (FoxPro Frame or Debugger Frame) determines if the debugger is placed on the Visual FoxPro desktop or in a separate window. Toggle this setting in the Debugging tab of the Options dialog box.

If you issue DEBUG when the debugger is open, the debugger becomes the active window.


See Also

CLOSE DEBUGGER, Debugging Tab
Options Dialog Box, DEBUGOUT, SET DEBUG


DEBUGOUT Command

Syntax         Arguments         Remarks         See Also

Directs the result of an expression to the Debug Output window.

Syntax

DEBUGOUT eExpression

Arguments

eExpression   Specifies an expression to evaluate and display in the Debug Output window.

Remarks

Use DEBUGOUT to identify when a procedure or function is executed. For example, you can place DEBUGOUT at the beginning of a procedure to display a message in the Debug Output window, indicating that the procedure has begun executing.

Note that you can only abbreviate DEBUGOUT to a minimum of 6 characters, distinguishing it from the DEBUG command.


See Also

DEBUG, Debug Output Window, SET DEBUG


DECLARE Command

Syntax         Remarks         See Also

Creates a one- or two-dimensional array.

Syntax

DECLARE ArrayName1 (nRows1 [, nColumns1])
[, ArrayName2 (nRows2 [, nColumns2])] ...

Remarks

DECLARE is identical in operation and syntax to DIMENSION. For more information, see DIMENSION.


See Also

APPEND FROM ARRAY
COPY TO ARRAY
DIMENSION
GATHER
PRIVATE
PUBLIC
SCATTER
SET COMPATIBLE
STORE


DECLARE - DLL Command

Syntax         Arguments         Remarks         Example         See Also

Registers a function in an external shared library. Libraries are 32-bit dynamic link library (.DLL) files.

Syntax

DECLARE [cFunctionType] FunctionName IN LibraryName [AS AliasName]
[cParamType1 [@] ParamName1,
cParamType2 [@] ParamName2, ...]

Arguments

cFunctionType   Indicates the data type of the return value from the shared library, if any. If the function does not return a value, omit cFunctionType.

cFunctionType can assume the following values:

cFunctionType	Description
SHORT	16-bit integer
INTEGER	32-bit integer
SINGLE	32-bit floating point
DOUBLE	64-bit floating point
LONG	32-bit long integer
STRING	Character string
FunctionName   Specifies the name of the shared library function to register in Visual FoxPro. Function names passed in this parameter are case-sensitive.

Note   A DLL function name may not be the same as stated in the Win32 API manual. For example, the MessageBox function should be named MessageBoxA (for single-byte character), and MessageBoxW (for UNICODE). If Visual FoxPro cannot locate the DLL function you specify with FunctionName, the letter A is appended to the end of the function name and Visual FoxPro searches again for the function with the new name.

If the shared library function you specify has the same name as a Visual FoxPro function or is not a legal Visual FoxPro name, use the AS clause to assign an alias to the function when you register it, as described later in this topic.

IN LibraryName   Specifies the name of the external shared library containing the function specified with FunctionName.

If you specify WIN32API for the LibraryName, Visual FoxPro searches for the 32-bit Windows .DLL function in KERNEL32.DLL, GDI32.DLL, USER32.DLL, MPR.DLL, and ADVAPI32.DLL.

AS AliasName   Specifies an alias name for a shared library function name that has the same name as a Visual FoxPro function or is not a legal Visual FoxPro name. AliasName should not be a Visual FoxPro reserved word or the name of a shared library function already registered with Visual FoxPro.

If you assign alias to the function, use the alias when calling the shared library function. AliasName is not case-sensitive.

cParameterType1 [@] ParamName1, cParameterType2 [@] ParamName2, ...   Specifies the parameter types passed to the shared library function.

cParameterType is required and specifies the data type of any parameters that the shared library function expects to have passed to it. cParameterType may be one of the following:

cParameterType	Description
INTEGER	32-bit integer
SINGLE	32-bit floating point
DOUBLE	64-bit floating point
LONG	32-bit long integer
STRING	Character string
Visual FoxPro generates an error if the parameters are not of the type the shared library function expects. Null values can be passed as emtpy character strings.

To pass a parameter by reference when you call the function, you must include @ after the parameter cParameterType in this command, and before the corresponding variable in the calling function. If you don’t include @ in DECLARE, in the calling function, or in both, the parameter is passed by value. For information about shared library functions that require @ to pass parameters by reference, see the programmer’s guide for your operating system or environment (for example, refer to the Microsoft Win32 Programmer’s Guide for information on passing parameters to Windows DLLs).

Note   The parameter names ParamName1, ParamName2, and so on, are optional, and are not used by Visual FoxPro or the shared library function. You can include them as a reminder of the names and types of parameters the function receives.

Remarks

Before you can call a shared library function from within Visual FoxPro, you must issue DECLARE with the name of the function, the name of the shared library containing the function, and the parameter types the function expects to receive.

For backward compatibility, Visual FoxPro allows calls to external API libraries using the SET LIBRARY command. (Using SET LIBRARY, you can access functions in FOXTOOLS.FLL in Visual FoxPro for Windows and FOXTOOLS.MLB in Visual FoxPro for Macintosh). However, using DECLARE is the preferred method to register shared library functions.

If you are developing Visual FoxPro applications for multiple platforms, note that the same system-level shared libraries might not be available in Windows and on the Macintosh. For example, in Windows, you can access graphics functions by registering functions from the GDI32.DLL shared library. No exact, operating-system equivalent of this library is available on the Macintosh, though similar functions might be available in CFM shared libraries.

For further information about calling shared library functions, see the programmer’s guide for your operating system orf environment (for example, refer to the Microsoft Win32 Programmer’s Guide for information on calling DLLs).

Issue DISPLAY STATUS or LIST STATUS to display the names of registered functions. Issue CLEAR ALL or CLEAR DLLS to remove registered functions from memory.


DECLARE - DLL Command Example

This example for Windows displays the window handle for the currently active Windows application. When the WAIT window is displayed, you have 5 seconds to press ALT+TAB to switch to a different Windows application, or you can leave Visual FoxPro as the active application.

CLEAR

DECLARE INTEGER GetActiveWindow IN win32api

WAIT WINDOW "You can switch to another application now" TIMEOUT 5

? GetActiveWindow( )


See Also

CALL
CLEAR
DISPLAY DLLS
DISPLAY STATUS
LIST DLLS
LOAD
SET LIBRARY


Default Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies which command button or OLE Container control responds to the ENTER key being pressed when there are two or more command buttons on an active form. Available at design time and run time.

Syntax

Object.Default[ = lExpr]

Settings

lExpr   The settings for the Default property are:

Setting	Description
True (.T.)	When the button’s Default property is set to true (.T.) and its parent form is active, the user can execute the button’s command by pressing ENTER. (If the focus is in an edit box, the user can press CTRL+ENTER.) If KEYCOMP is set to WINDOWS, the default button’s command is not executed if the focus has been moved to another command button. In that case, pressing ENTER affects the button with the focus instead of the default button.
False (.F.)	(Default) The button is not the default button.
Remarks

The Default property only applies to an OLE Container control that contains an “Acts like a Button” ActiveX control (.OCX).

Only one command button or OLE Container control on a form can be the default command button. When the Default property is set to true (.T.) for one command button or OLE Container control, it is automatically set to false (.F.) for all other command buttons or OLE Container controls on the form. You cannot create a default command button or OLE Container control in a toolbar.


Applies To

CommandButton, OLE Container Control


See Also

Enabled Property
KeyPress Event


DefaultFilePath Property

Syntax         Settings         Remarks        Applies To          See Also

Specifies the default drive and directory used by an Application object. Available at run time.

Syntax

ApplicationObject.DefaultFilePath[ = cPath]

Settings

cPath   Specifies one of the following:

•	A drive designator.

•	A drive designator with a directory or folder name.

•	A child directory or folder name.

•	Any of the above using MS-DOS® shorthand notation ( \ or ..).

Remarks

The DefaultFilePath property is similar to SET DEFAULT.

Visual FoxPro searches for a file in the default Visual FoxPro directory or folder. The default directory or folder is the one from which you start Visual FoxPro. However, you can use the DefaultFilePath property to specify a different default directory. If Visual FoxPro cannot find a file in the default directory, it then searches the Visual FoxPro path if one has been specified. Use SET PATH to specify the Visual FoxPro path.


Applies To

Application Object, _VFP System Variable


See Also

SET DEFAULT SET PATH


DEFINE BAR Command

Syntax         Arguments         Remarks         Example         See Also

Creates a menu item on a menu created with DEFINE POPUP.

Syntax

DEFINE BAR nMenuItemNumber1 | SystemItemName
OF MenuName PROMPT cMenuItemText
[BEFORE nMenuItemNumber2 | AFTER nMenuItemNumber3]
[FONT cFontName [, nFontSize]]
[STYLE cFontStyle]
[KEY KeyLabel [, cKeyText]]
[MARK cMarkCharacter]
[MESSAGE cMessageText]
[SKIP [FOR lExpression]]
[COLOR SCHEME nSchemeNumber
| COLOR ColorPairList]

Arguments

nMenuItemNumber1   Specifies the menu item number. The menu item number allows you to reference the menu item in other commands and functions.

SystemItemName   Specifies a menu item on the Visual FoxPro system menu. For example, to provide access to the Print menu item, issue the following:

DEFINE BAR _MFI_PRINT OF popMyPopup PROMPT "Print..."

Not all Visual FoxPro system menu items are available. Use SYS(2013) to return a list of the Visual FoxPro system menu names that are available.

OF MenuName   Specifies the name of the menu on which the menu items are placed.

PROMPT cMenuItemText   Specifies the caption that appears on the menu item.

You can create a separator bar by specifying a backslash and a dash (\-) for cMenuItemText. A separator bar is used to separate item groups on a menu. For example, including the following command in a menu definition creates a separator bar between the third and fifth menu items:

DEFINE BAR 4 OF popMyPopup PROMPT '\-'

You can create an access key for a menu item by placing a backslash and a less-than sign (\<) before the character to be the access key. For example:

DEFINE POPUP popReceive

DEFINE BAR 1 OF popReceive PROMPT '\<Invoices'

DEFINE BAR 2 OF popReceive PROMPT 'In\<quiry'

ACTIVATE POPUP popReceive

The user can press the I key to choose Invoices from the Receive menu and press the Q key to choose Inquiry from the same menu.

BEFORE nMenuItemNumber2   Places a menu item before the menu item specified with nMenuItemNumber2.

AFTER nMenuItemNumber3   Places a menu item after the menu item specified with nMenuItemNumber3.

Note   In order for BEFORE or AFTER to have an effect, you must include the RELATIVE clause when you create the menu with DEFINE POPUP.

You can also include _MFIRST and _MLAST in the BEFORE and AFTER clauses. If you include_MFIRST in the BEFORE clause, the menu item is the first item on the menu. If you include_MFIRST in the AFTER clause, the menu item is the second item on the menu. If you include_MLAST in the AFTER clause, the menu item is the last item on the menu. If you include_MLAST in the BEFORE clause, the menu item is the next-to-last item on the menu.

Menus created with DEFINE POPUP RELATIVE don’t reserve space for undefined menu items. For example, if you define items 1, 2, 4, and 5 on a menu, a space for item 3 is not reserved. You can later insert item 3. The menu expands to accommodate it.

Run the following program examples and note the differences in the order and placement of the items on each menu:

*** RELATIVE Example ***

DEFINE POPUP popRelatYes RELATIVE FROM 1,1

DEFINE BAR 4  OF popRelatYes PROMPT '4444'

DEFINE BAR 3  OF popRelatYes PROMPT '3333'

DEFINE BAR 2  OF popRelatYes PROMPT '2222'

DEFINE BAR 1  OF popRelatYes PROMPT '1111'

DEFINE BAR 6  OF popRelatYes PROMPT '6666' BEFORE 4

ACTIVATE POPUP popRelatYes

*** NON-RELATIVE Example ***

DEFINE POPUP popRelatNo FROM 1,10

DEFINE BAR 4 OF popRelatNo PROMPT '4444'

DEFINE BAR 3 OF popRelatNo PROMPT '3333'

DEFINE BAR 2 OF popRelatNo PROMPT '2222'

DEFINE BAR 1 OF popRelatNo PROMPT '1111'

DEFINE BAR 6 OF popRelatNo PROMPT '6666'

ACTIVATE POPUP popRelatNo

FONT cFontName [, nFontSize]   Specifies a font for the menu item. cFontName specifies the name of the font, and nFontSize specifies the point size. For example, the following command creates a menu item in 12-point Courier font:

DEFINE BAR 1 OF popReceive PROMPT '\<Invoices' FONT 'Courier', 12

If the font you specify is not available, a font with similar font characteristics is substituted. If you include the FONT clause but omit the point size nFontSize, a 10-point font is used.

STYLE cFontStyle   Specifies a font style for the menu item. If you omit the STYLE clause, the normal font style is used. If the font style you specify is not available, the normal font style is used.

The font styles you can specifiy with cFontStyle are as follows:

Character	Font style
B	Bold
I	Italic
N	Normal
Q	Opaque
-	Strikeout
T	Transparent
U	Underline
You can include more than one character to specify a combination of font styles. For example, the following command specifies Bold Italic:

DEFINE BAR 1 OF popReceive PROMPT '\<Invoices' STYLE 'BI'

KEY KeyLabel [, cKeyText]   Specifies an access key or key combination for a menu item. The menu does not have to be activated in order for the menu item to be chosen, unlike when you assign an access key using a backslash and a less-than sign (\<).

For a list of available keys and key combinations and their key label names, see ON KEY LABEL.

Note   If a keyboard macro is already defined with the same key label, the keyboard macro takes precedence, and the menu item cannot be chosen with the specified key or key combination.

Include cKeyText to replace the key label with your own text. You can use any character in the cKeyText parameter; for example, you can use the text “^B” to indicate a key label of CTRL+B. For example, including KEY CTRL+B places the text CTRL+B on the menu to the right of the menu item name, but specifying KEY CTRL+B, “^B” places the text ^+B on the menu. You can suppress the display of a key label by specifying an empty string for cKeyText.

MARK cMarkCharacter   Specifies a mark character that appears to the left of the menu item. MARK can be included to change the default mark character to a character specified with cMarkCharacter. If cMarkCharacter includes more than one character, only the first character is used as the mark character.

The default mark character is  a check.

The MARK clause is ignored and the default mark character is used if the menu containing the menu item is integrated into the Visual FoxPro system menu. Also, the MARK clause is ignored if FoxFont isn’t the font for the main Visual FoxPro window or the user-defined window in which the menu containing the menu item is placed.

Note   Specifying a mark character doesn’t mark a menu item. Use SET MARK OF to mark a menu item.

Mark characters specified in DEFINE BAR take precedence over mark characters specified with MARK in DEFINE POPUP. SET MARK OF is used to toggle mark characters on or off, and can also be used to specify a mark character for an individual menu item or for all menu items.

MESSAGE cMessageText   Displays a message when the user selects a menu item. The message is placed in the graphical status bar. If the graphical status bar is turned off with SET STATUS BAR OFF, the message is centered on the last line of the main Visual FoxPro window.

SKIP [FOR lExpression]   Specifies a condition whereby if lExpression evaluates to true (.T.), the menu item is disabled, preventing the user from choosing it; if false (.F.), the menu item is enabled. A disabled menu item appears in the disabled colors.

You can also disable a menu item by placing a backslash (\) before the text of the prompt. For example:

DEFINE BAR 1 OF popReceive PROMPT '\Invoices'

A menu item disabled with SKIP or \ cannot be selected. Menus you create that include SKIP FOR expressions may not behave properly when the spelling checker or wizards are active.

SKIP FOR expressions typically depend on the value of skip variables, but the skip variables are not visible to your menus when the spelling checker or wizards are active. In the initialization code of the spelling checker and wizard applications (SPELLCHK.APP and GENGRAPH.APP respectively), PRIVATE ALL is intentionally issued. This hides skip variables from user-defined menus and causes an error message when you choose a menu.

To correct this situation, the following code is placed at the beginning of the spelling checker and wizard applications:

IF TYPE("_memvarmask") = "C" and !EMPTY(_memvarmask)

PRIVATE ALL EXCEPT &_memvarmask

ELSE

PRIVATE ALL

ENDIF

Suppose a certain menu item should be skipped when the variable named “skipvar” evaluates to true. You should include the following lines in your menu startup code to take advantage of the _MEMVARMASK variable:

PUBLIC _memvarmask

_memvarmask = "skipvar"

STORE .T. TO skipvar             && Skip initially.

To create a set of skip variables, include the following lines in your menu startup code:

PUBLIC _memvarmask

_memvarmask = "skip*"

STORE .T. TO skipthis, skipthat  && Skip initially.

When you run the spelling checker and wizards, they don’t hide variables in SKIP FOR expressions, preventing the error messages you may experience when the spelling checker or wizards are active.

Note that _MEMVARMASK isn’t a system variable.

COLOR SCHEME nSchemeNumber   Specifies the colors for an individual menu item, overriding the default colors or the colors specified with DEFINE POPUP.

COLOR ColorPairList   Specifies the colors for an individual menu item, overriding the default colors or the colors specified with DEFINE POPUP. You can specify the colors of all menu items, mark characters, and messages.

By default, the colors of menu items are determined by color scheme 2 of the current color set.

For more information on color schemes and color pairs, see the Colors Overview topic.

Remarks

DEFINE BAR is used with DEFINE POPUP to create menus. A menu is created and assigned a name with DEFINE POPUP. Menu items are placed on the menu with a series of DEFINE BAR commands.

If you use the Menu Designer to create your menu, you may not have to use these commands at all. The Menu Designer automatically creates the commands for your menu. The Menu Designer uses the Visual FoxPro system menu, which you can then modify by adding your own menu items. For more information on creating menus, see “Creating a Menu System” in Chapter 11, “Designing Menus and Toolbars,” in the Developer’s Guide.

You can also create a menu that contains records or fields from a table or a list of files available on disk. For more information, see the PROMPT FIELD, PROMPT STRUCTURE and PROMPT FILES clauses in DEFINE POPUP.

Use ON BAR to create a cascading submenu for a menu item.


DEFINE BAR Command Example

The following example uses DEFINE BAR to create items on menus. The current system menu bar is first saved to memory with SET SYSMENU SAVE, and then all system menu titles are removed with SET SYSMENU TO.

Two new system menu titles are created with DEFINE PAD, and DEFINE POPUP is used to create a drop-down menu for each menu title. DEFINE BAR is used to create items on each of the menus. When a menu title is chosen, ON PAD uses ACTIVATE POPUP to activate the corresponding menu.

When an item is chosen from a menu, ON SELECTION POPUP uses PROMPT( ) and POPUP( ) to pass the item number and menu name to the CHOICE procedure. CHOICE displays the prompt of the chosen item and the name of the menu containing the item. If Exit is chosen from the Card Info menu, the original Visual FoxPro system menu is restored.

*** Name this program DEFINBAR.PRG ***

CLEAR

SET SYSMENU SAVE

SET SYSMENU TO

DEFINE PAD convpad OF _MSYSMENU PROMPT '\<Conversions' COLOR SCHEME 3 ;

KEY ALT+C, ''

DEFINE PAD cardpad OF _MSYSMENU PROMPT 'Card \<Info' COLOR SCHEME 3 ;

KEY ALT+I, ''

ON PAD convpad OF _MSYSMENU ACTIVATE POPUP conversion

ON PAD cardpad OF _MSYSMENU ACTIVATE POPUP cardinfo

DEFINE POPUP conversion MARGIN RELATIVE SHADOW COLOR SCHEME 4

DEFINE BAR 1 OF conversion PROMPT 'Ar\<ea' KEY CTRL+E, '^E'

DEFINE BAR 2 OF conversion PROMPT '\<Length' ;

KEY CTRL+L, '^L'

DEFINE BAR 3 OF conversion PROMPT 'Ma\<ss' ;

KEY CTRL+S, '^S'

DEFINE BAR 4 OF conversion PROMPT 'Spee\<d' ;

KEY CTRL+D, '^D'

DEFINE BAR 5 OF conversion PROMPT '\<Temperature' ;

KEY CTRL+T, '^T'

DEFINE BAR 6 OF conversion PROMPT 'T\<ime' ;

KEY CTRL+I, '^I'

DEFINE BAR 7 OF conversion PROMPT 'Volu\<me' ;

KEY CTRL+M, '^M'

ON SELECTION POPUP conversion;

DO choice IN definbar WITH PROMPT( ), POPUP( )

DEFINE POPUP cardinfo MARGIN RELATIVE SHADOW COLOR SCHEME 4

DEFINE BAR 1 OF cardinfo PROMPT '\<View Charges' ;

KEY ALT+V, ''

DEFINE BAR 2 OF cardinfo PROMPT 'View \<Payments' ;

KEY ALT+P, ''

DEFINE BAR 3 OF cardinfo PROMPT 'Vie\<w Users' KEY ALT+W, ''

DEFINE BAR 4 OF cardinfo PROMPT '\-'

DEFINE BAR 5 OF cardinfo PROMPT '\<Charges '

DEFINE BAR 6 OF cardinfo PROMPT '\-'

DEFINE BAR 7 OF cardinfo PROMPT 'E\<xit '

ON SELECTION POPUP cardinfo;

DO choice IN definbar WITH PROMPT( ), POPUP( )

PROCEDURE choice

PARAMETERS mprompt, mpopup

WAIT WINDOW 'You chose ' + mprompt + ;

' from popup ' + mpopup NOWAIT

IF mprompt = 'Exit'

SET SYSMENU TO DEFAULT

ENDIF


See Also

ACTIVATE POPUP
DEACTIVATE POPUP
DEFINE POPUP
HIDE POPUP
RELEASE BAR
SET MESSAGE
SHOW POPUP


DEFINE BOX Command

Included for backward compatibility. Use the Report Designer instead.


DEFINE CLASS Command

Syntax         Arguments         Remarks         Example         See Also

Creates a user-defined class or subclass and specifies the properties, events, and methods for the class or subclass.

Syntax

DEFINE CLASS ClassName1 AS ParentClass [OLEPUBLIC]
[[PROTECTED | HIDDEN PropertyName1, PropertyName2 ...]
[Object.]PropertyName = eExpression ...]
[ADD OBJECT [PROTECTED] ObjectName AS ClassName2 [NOINIT]
[WITH cPropertylist]]...
[[PROTECTED | HIDDEN] FUNCTION | PROCEDURE Name
[NODEFAULT]
cStatements
[ENDFUNC | ENDPROC]]...
ENDDEFINE

Arguments

ClassName1   Specifies the name of the class to create.

AS ParentClass   Specifies the parent class on which a class or subclass is based. The parent class can be a Visual FoxPro base class, such as the Form class, or another user-defined class or subclass.

The following table lists the Visual FoxPro base classes:

Base class names
CheckBox	Label
Column	Line
ComboBox	ListBox
CommandButton	OLEControl
CommandGroup	OLEBoundControl
Container	OptionButton
Control	OptionGroup
Cursor	Page
Custom	PageFrame
DataEnvironment	Relation
EditBox	Separator
Form	Shape
FormSet	Spinner
Grid	TextBox
Header	Timer
Image	ToolBar
A non-visual user-defined class is created by specifying Custom for ParentClass.

In the following example, a subclass named MyForm is created, based on the Form base class. A Click method is created that displays a dialog box when MyForm is clicked.

DEFINE CLASS MyForm AS Form

PROCEDURE Click

= MESSAGEBOX('MyForm has been clicked!')

ENDPROC

ENDDEFINE

OLEPUBLIC   Specifies that the class in an custom OLE server can be accessed by an OLE automation client.

If a program containing an OLEPUBLIC class definition is added to a project, an executable (.EXE) file or a dynamic link library (.DLL) containing the class can be created interactively in the Project Manager or with BUILD EXE or BUILD DLL. The EXE or DLL is automatically registered with the operating system, and becomes available to any OLE automation client.

For more information about creating custom OLE servers, see “Creating Custom OLE Servers” in Chapter 16, “Adding OLE” in the Developer’s Guide.

[PROTECTED | HIDDEN PropertyName1, PropertyName2 ...]
[Object.]PropertyName = eExpression ... Creates a class or subclass property and assigns a default value to the property. Properties are named attributes of the class and define characteristics and behaviors for the class. Classes and subclasses can have multiple properties.

Use = to assign a value to the property. The following example creates a user-defined class named MyClass and creates two properties called Name and Version. The Name property is initialized to the empty string and the Version property is initialized to the character string 1.0.

DEFINE CLASS MyClass AS Custom

Name = ''

Version = '1.0'

ENDDEFINE

A property can be accessed outside the class or subclass definition after the object is created with CREATEOBJECT( ):

MyOjbect = CREATEOBJECT('MyClass')

Properties are accessed with the following syntax:

ObjectName.Property

The .Object keyword indicates to Visual FoxPro that the property value should be applied when the ActiveX control is created.

The following example adds the Outline ActiveX control to a form. The Object keyword is used to specify a property for the Outline control before it is created.

PUBLIC frmOLETest

frmOLETest = CREATEOBJECT('Form')

frmOLETest.Visible = .T.

frmOLETest.ADDOBJECT('OCXTest', 'BlueOLEControl', ;

'MSOutl.Outline')

frmOLETest.OCXTest.AddItem('Item One')

frmOLETest.OCXTest.AddItem('Item Two')

DEFINE CLASS BlueOLEControl AS OLEControl

* Set a property of the ActiveX control

.Object.Backcolor = 16776960

* Set properties of the OLE Container Control

Visible = .T.

Height = 100

Width = 200

ENDDEFINE

Include PROTECTED and a list of property names to prevent access and changes to the properties from outside of the class or subclass definition. Methods and events within the class or subclass definition can access the protected properties.

In the following example, the Version property is protected, preventing it from being accessed and changed outside of the class definition. However, the Name property is not protected and can be accessed and changed.

DEFINE CLASS MyClass AS Custom

PROTECTED Version

Name = ''

Version = '1.0'

ENDDEFINE

Include HIDDEN and a list of property names to prevent access and changes to the properties from outside of the class definition. Only methods and events within the class definition can access the hidden properties. While protected properties can be accessed by subclasses of the class definition, hidden properties can only be accessed from with the class definition.

ADD OBJECT   Adds an object to a class or subclass definition from a Visual FoxPro base class, user-defined class or subclass, or ActiveX custom control.

PROTECTED   Prevents access and changes to the object’s properties from outside the class or subclass definition. The PROTECTED keyword must be placed immediately before ObjectName or FoxPro generates a syntax error.

ObjectName   Specifies the name of the object and is used to reference the object from within the class or subclass definition after an object is created from the class or subclass definition.

AS ClassName2   Specifies the name of the class or subclass containing the object you add to the class definition. For example, the following class definition adds a command button from the CommandButton base class and a list box from the ListBox base class.

DEFINE CLASS MyClass AS Custom

ADD OBJECT CB1 AS CommandButton

ADD OBJECT LIST1 AS ListBox

ENDDEFINE

NOINIT   Specifies that an object’s Init method is not executed when the object is added.

WITH cPropertyList   Specifies a list of properties and property values for the object you add to the class or subclass definition. For example, the following class definition creates a class called MyClass, adds a command button to the class definition, and specifies the Caption and BackColor properties for the command button.

DEFINE CLASS MyClass AS CUSTOM

ADD OBJECT CB1 AS CommandButton;

WITH Caption = 'Cancel', BackColor = 2

ENDDEFINE

FUNCTION Name or PROCEDURE Name   Create events and methods for the class or subclass. Events and methods are created as a set of functions or procedures.

You can create an event function or procedure within a class or subclass definition to respond to an event. An event is an action such as a mouse click that is recognized by an object created with a class or subclass definition. For additional information about Visual FoxPro event processing, see “The Core Events” in Chapter 4, “Understanding the Event Model,” in the Developer’s Guide.

Events are called with the following syntax:

ObjectName.Event

You can also create a method function or procedure within a class or subclass definition. A method is a procedure that acts upon the object created with the class or subclass definition. Methods are called with this syntax:

ObjectName.Method

NODEFAULT   Prevents Visual FoxPro from performing its default event or method processing for Visual FoxPro events and methods. For example, if the KeyPress event occurs, including NODEFAULT in the KeyPress procedure or function prevents Visual FoxPro from placing the key press into the Visual FoxPro keyboard buffer. This allows you to create a KeyPress procedure that lets you test which key is pressed before the key is sent to the keyboard buffer.

NODEFAULT may be placed anywhere within the event or method procedure. Note that NODEFAULT may also be placed within an event or method procedure in the Form Designer.

cStatements are the Visual FoxPro commands that are executed when an event or method is executed.

Event and method functions and procedures can accept values by including a PARAMETERS or LPARAMETERS statement as the first executable line of the function or procedure.

Unlike most Visual FoxPro keywords, you cannot abbreviate ENDFUNC and ENDPROC. This prevents conflicts with the ENDFOR and ENDPRINTJOB keywords.

The following example demonstrates how to create an event procedure that displays a message when the command button is clicked. This event procedure overrides the default command button Click event.

DEFINE CLASS MyClass AS Custom

ADD OBJECT MyButton AS CommandButton

ADD OBJECT MyList AS ListBox

PROCEDURE MyButton.Click

= MESSAGEBOX('This is my click event procedure')

ENDPROC

ENDDEFINE

Remarks

User-defined classes are a set of commands placed in a program file, similar to a procedure. The commands that follow the class or subclass definition define the properties, events, and methods for the class or subclass.

You cannot have normal executable program code included in a program file after procedures; only class definitions, procedures, and user-defined functions can follow the first DEFINE CLASS, PROCEDURE or FUNCTION command in the file.

Class and subclass definitions created with DEFINE CLASS cannot be placed within structured programming commands, such as IF ... ENDIF or DO CASE ... ENDCASE. Nor can they be placed in loops, such as DO WHILE ... ENDDO or FOR ... ENDFOR.

To create an object from a class or subclass definition, issue CREATEOBJECT( ) with the class or subclass name.


DEFINE CLASS Command Example

The following example uses DEFINE CLASS and CREATEOBJECT( ) to create two custom classes named FormChild and FormGrandChild from the Visual FoxPro Form base class. ACLASS( ) is used to create an array named gaNewarray containing the class names, which are then displayed.

CLEAR

frmMyForm = CREATEOBJECT("FormGrandChild")

FOR nCount = 1 TO ACLASS(gaNewarray, frmMyForm) 	&& Creates an array

? gaNewarray(nCount)  && Displays the names of the classes

ENDFOR

RELEASE frmMyForm

DEFINE CLASS FormChild AS FORM

ENDDEFINE

DEFINE CLASS FormGrandChild AS FormChild

ENDDEFINE


See Also

:: Scope Resolution Operator
ADD CLASS
_BROWSER
CREATE CLASS
CREATE CLASSLIB
CREATEOBJECT( )
GETOBJECT( )
MODIFY CLASS
RELEASE CLASSLIB
SET CLASSLIB
WITH ... ENDWITH


DEFINE MENU Command

Syntax         Arguments         Remarks         Example         See Also

Creates a menu bar.

Syntax

DEFINE MENU MenuBarName
[BAR [AT LINE nRow]]
[IN [WINDOW] WindowName | IN SCREEN]
[FONT cFontName [, nFontSize]]
[STYLE cFontStyle]
[KEY KeyLabel]
[MARK cMarkCharacter]
[MESSAGE cMessageText]
[NOMARGIN]
[COLOR SCHEME nSchemeNumber
| COLOR ColorPairList]

Arguments

MenuBarName   Specifies the name of the menu bar to create. The menu bar name allows you to reference the menu bar in other commands and functions.

BAR [AT LINE nRow]   Creates a menu bar that behaves like the Visual FoxPro system menu bar. The menu bar has these characteristics:

•	A horizontal menu bar one line high is drawn across the width of the main Visual FoxPro window or the user-defined window it is placed in.

•	The placement of the menu titles on the menu bar is handled automatically.

•	If the size or number of menu titles you define exceeds the size of the screen or a window in which the menu bar is placed, the menu bar scrolls.

The row number is specified with nRow.

IN [WINDOW] WindowName   Places a menu bar in a user-defined window. Specify the name of the window in which you want to place the menu bar with WindowName. If you omit IN WINDOW, the menu bar is placed in the main Visual FoxPro window by default unless there is an active user-defined window. If there is an active user-defined window, the menu bar is placed in the active window.

IN SCREEN   Explicitly places the menu bar in the main Visual FoxPro window.

FONT cFontName [, nFontSize]   Specifies a default font for all menu titles in the menu bar. You can override the default font for an individual menu title by including the FONT clause in DEFINE PAD.

cFontName specifies the name of the font, and nFontSize specifies the point size. For example, the following command creates a menu bar with menu titles in 12-point Courier font:

DEFINE MENU mnuExample FONT 'Courier', 12

If the font you specify is not available, a font with similar font characteristics is substituted. If you include the FONT clause but omit the point size nFontSize, a 10-point font is used.

The FONT clause is ignored for menu titles added to the Visual FoxPro system menu _MSYSMENU. Note that the Menu Designer uses the Visual FoxPro system menu.

STYLE cFontStyle   Specifies a default font style for all the menu titles in the menu bar. You can override the default style for individual menu titles by including the STYLE clause in DEFINE PAD.

If you omit the STYLE clause, or if the font style you specify is not available, the Normal font style is used.

The font styles you can specifiy with cFontStyle are as follows:

Character	Font style
B	Bold
I	Italic
N	Normal
Q	Opaque
-	Strikeout
T	Transparent
U	Underline
You can include more than one character to specify a combination of font styles. For example, the following command specifies Bold Italic:

DEFINE MENU mnuExample STYLE 'BI'

The STYLE clause is ignored for menu titles added to the Visual FoxPro system menu _MSYSMENU. The Menu Designer uses the Visual FoxPro system menu.

KEY KeyLabel   Specifies the key or key combination used to activate the menu bar. For a list of available keys and key combinations and their key label names, see ON KEY LABEL.

Including the KEY clause is equivalent to issuing the following command:

ON KEY LABEL KeyLabel ACTIVATE MENU MenuName

Note   If a keyboard macro is already defined with the same key label, the keyboard macro takes precedence, and the menu bar cannot be activated with the specified key or key combination.

MARK cMarkCharacter   Specifies a mark character that appears to the left of the menu titles on the menu bar. MARK can be included to change the default mark character to a character specified with cMarkCharacter. If cMarkCharacter includes more than one character, only the first character is used as the mark character.

The default mark character is a check. The MARK clause is ignored and the default mark character is used if the menu bar is the Visual FoxPro system menu. Also, the MARK clause is ignored if FoxFont isn’t the font for the main Visual FoxPro window or the user-defined window in which the menu bar is placed.

Note   Specifying a mark character doesn’t mark the menu names on a menu bar. Use SET MARK OF to mark the menu titles on a menu bar with the character you specify.

Mark characters specified with DEFINE PAD take precedence over mark characters specified with the MARK clause in DEFINE MENU. SET MARK OF is used to toggle mark characters on or off, and can also be used to specify a mark character for an individual menu item or for all menu items.

MESSAGE cMessageText   Displays a message when the user selects a menu title. The message is placed in the graphical status bar. If the graphical status bar is turned off with SET STATUS BAR OFF, the message is centered on the last line of the main Visual FoxPro window.

NOMARGIN   Removes the spaces that are placed to the left and right of each menu name by default.

COLOR SCHEME nSchemeNumber   Specifies the colors for an individual menu bar.

COLOR ColorPairList   Specifies the colors for an individual menu bar. By default, the colors of menu items are determined by color scheme 2 of the current color set.

For more information on color schemes and color pairs, see the Colors Overview topic.

Remarks

Use DEFINE MENU to create the menu bar for your application’s menu system. Use DEFINE PAD to create each of the menu titles (pads) on the menu bar. Use ON PAD ... ACTIVATE to specify which menu is displayed under each menu title. Use DEFINE POPUP to create the menus under each menu title. Use ACTIVATE MENU to activate the entire menu system.

If you use the Menu Designer to create your menu, you may not have to use these commands at all. The Menu Designer automatically creates the commands for your menu. The Menu Designer uses the Visual FoxPro system menu, which you can then modify by adding your own menu items.

For more information on creating menus, see “Creating a Menu System” in Chapter 11, “Designing Menus and Toolbars,” in the Developer’s Guide.


DEFINE MENU Command Example

The following example uses DEFINE MENU to create a user-defined menu system. The current system menu bar is first saved to memory with SET SYSMENU SAVE, and then the system menu titles are cleared with SET SYSMENU TO.

DEFINE MENU creates the menu bar, and two menu titles are created with DEFINE PAD. DEFINE POPUP creates a menu for each menu title. DEFINE BAR creates items on each of the menus. When a menu title is chosen, ON PAD uses ACTIVATE POPUP to activate the corresponding menu. ACTIVATE MENU displays and activates the menu bar.

When an item is chosen from a menu, the CHOICE procedure is executed. CHOICE displays the name of the chosen item and the name of the menu containing the item.

*** Name this program DEFIMENU.PRG ***

CLEAR

SET SYSMENU SAVE

SET SYSMENU TO

ON KEY LABEL ESC KEYBOARD CHR(13)

DEFINE MENU example BAR AT LINE 1

DEFINE PAD convpad OF example PROMPT '\<Conversions' COLOR SCHEME 3 ;

KEY ALT+C, ''

DEFINE PAD cardpad OF example PROMPT 'Card \<Info' COLOR SCHEME 3 ;

KEY ALT+I, ''

ON PAD convpad OF example ACTIVATE POPUP conversion

ON PAD cardpad OF example ACTIVATE POPUP cardinfo

DEFINE POPUP conversion MARGIN RELATIVE COLOR SCHEME 4

DEFINE BAR 1 OF conversion PROMPT 'Ar\<ea' ;

KEY CTRL+E, '^E'

DEFINE BAR 2 OF conversion PROMPT '\<Length' ;

KEY CTRL+L, '^L'

DEFINE BAR 3 OF conversion PROMPT 'Ma\<ss' ;

KEY CTRL+S, '^S'

DEFINE BAR 4 OF conversion PROMPT 'Spee\<d' ;

KEY CTRL+D, '^D'

DEFINE BAR 5 OF conversion PROMPT '\<Temperature' ;

KEY CTRL+T, '^T'

DEFINE BAR 6 OF conversion PROMPT 'T\<ime' ;

KEY CTRL+I, '^I'

DEFINE BAR 7 OF conversion PROMPT 'Volu\<me' ;

KEY CTRL+M, '^M'

ON SELECTION POPUP conversion DO choice IN defimenu WITH PROMPT( ), POPUP( )

DEFINE POPUP cardinfo MARGIN RELATIVE COLOR SCHEME 4

DEFINE BAR 1 OF cardinfo PROMPT '\<View Charges' ;

KEY ALT+V, ''

DEFINE BAR 2 OF cardinfo PROMPT 'View \<Payments' ;

KEY ALT+P, ''

DEFINE BAR 3 OF cardinfo PROMPT 'Vie\<w Users' ;

KEY ALT+W, ''

DEFINE BAR 4 OF cardinfo PROMPT '\-'

DEFINE BAR 5 OF cardinfo PROMPT '\<Charges '

ON SELECTION POPUP cardinfo;

DO choice IN defimenu WITH PROMPT( ), POPUP( )

ACTIVATE MENU example

DEACTIVATE MENU example

RELEASE MENU example EXTENDED

SET SYSMENU TO DEFAULT

ON KEY LABEL ESC

PROCEDURE choice

PARAMETERS mprompt, mpopup

WAIT WINDOW 'You chose ' + mprompt + ;

 	' from popup ' + mpopup NOWAIT


See Also

ACTIVATE MENU
CNTPAD( )
CREATE MENU
DEACTIVATE MENU
DEFINE PAD
GETPAD( )
HIDE MENU
MRKPAD( )
ON PAD
ON SELECTION PAD
PRMPAD( )
RELEASE PAD
SET MARK OF
SET SYSMENU
SHOW MENU


DEFINE PAD Command

Syntax         Arguments         Remarks         Example         See Also

Creates a menu title (pad) on a user-defined menu bar or the Visual FoxPro system menu bar.

Syntax

DEFINE PAD MenuTitle1 OF MenuBarName PROMPT cMenuTitleText
[AT nRow, nColumn]
[BEFORE MenuName2 | AFTER MenuName3]
[NEGOTIATE LEFT | NEGOTIATE MIDDLE | NEGOTIATE RIGHT]
[FONT cFontName [, nFontSize]]
[STYLE cFontStyle]
[KEY KeyLabel [, cKeyText]]
[MARK cMarkCharacter]
[SKIP [FOR lExpression]]
[MESSAGE cMessageText]
[COLOR SCHEME nSchemeNumber
| COLOR ColorPairList]

Arguments

MenuTitle1   Specifies the menu title to create. The menu title allows you to reference the menu title in other commands and functions.

OF MenuBarName   Specifies the name of the menu bar in which the menu title is placed.

PROMPT cMenuTitleText   Specifies the text that appears in the menu title.

You can create an access key for a menu title by placing a backslash and a less-than sign (\<) before the character you would like to be the access key. In the following example, the user can press the I key to choose Invoices from the Receive menu and press the Q key to choose Inquiry from the same menu:

DEFINE MENU mnuReceive

DEFINE PAD padInvoice OF mnureceive PROMPT "\<Invoices"

DEFINE PAD padInquire OF mnureceive PROMPT "In\<quiry"

ACTIVATE MENU mnuReceive

AT nRow, nColumn   Specifies where the menu title appears on the menu bar. nRow, nColumn are the coordinates of the left side of the menu title in the main Visual FoxPro window or in a user-defined window.

If you omit the AT clause, the left side of the first menu title is placed in row 0 of the main Visual FoxPro window or user-defined window. The next menu title is placed to the right of the first name on row 0, and so on.

Note   You cannot include AT to specify a location for menu titles in menu bars created with the BAR clause in DEFINE MENU.

BEFORE MenuName2   Places the menu title on the menu bar to the left of the menu title specified with MenuName2. The order the menu titles are accessed from the keyboard corresponds to the location of the menu titles in the menu bar.

AFTER MenuName3   Places the menu title on the menu bar to the right of the menu title specified with MenuName3. The order the menu titles are accessed from the keyboard corresponds to the location of the menu titles in the menu bar.

You must first create the menu title you specify in a BEFORE or AFTER clause. If you don’t create the menu title first, the placement of the menu title on the menu bar is determined by the order in which it is created or by a location specified with the AT clause.

For menu bars created without BAR, BEFORE or AFTER determines the order the menu titles are accessed from the keyboard. The location of a menu title is determined by the location specified with the AT clause.

Run the following two examples and note the differences in menu title placement and access order when menu titles are defined with and without the AT clause:

*** Program Example 1 without ATs ***

DEFINE MENU mnuBefAft

DEFINE PAD padOne   OF mnuBefAft PROMPT '1111'

DEFINE PAD padTwo   OF mnuBefAft PROMPT '2222'

DEFINE PAD padThree OF mnuBefAft PROMPT '3333'

DEFINE PAD padFour  OF mnuBefAft PROMPT '4444' BEFORE padTwo

ACTIVATE MENU mnuBefAft

*** Program Example 2 with ATs ***

DEFINE MENU mnuBefAft

DEFINE PAD padOne   OF mnuBefAft PROMPT '1111' AT 1,5

DEFINE PAD padTwo   OF mnuBefAft PROMPT '2222' AT 1,15

DEFINE PAD padThree OF mnuBefAft PROMPT '3333' AT 1,25

DEFINE PAD padFour  OF mnuBefAft PROMPT '4444' BEFORE padTwo AT 1,35

WAIT WINDOW 'Press ESC to erase menu' NOWAIT

ACTIVATE MENU mnuBefAft

NEGOTIATE LEFT | NEGOTIATE MIDDLE | NEGOTIATE RIGHT   Specifies the location of the menu title in the Visual FoxPro menu bar when OLE visual editing occurs.

NEGOTIATE LEFT specifies that the menu title is placed to the left of the File Group.

NEGOTIATE MIDDLE specifies that the menu title is placed to the left of the the Container Group, after the Edit menu.

NEGOTIATE RIGHT specifies that the menu title is placed to the left of the Window Group.

If you omit the NEGOTIATE clause, the menu title is removed from the menu bar when OLE visual editing occurs.

FONT cFontName [, nFontSize]   Specifies a font for the menu title. cFontName specifies the name of the font, and nFontSize specifies the point size. For example, the following command creates a menu title in 12-point Courier font:

DEFINE PAD padPageAccts OF mnuReceive FONT 'Courier', 12

If the font you specify is not available, a font with similar font characteristics is substituted. If you include the FONT clause but omit the point size nFontSize, a 10-point font is used.

The FONT clause is ignored for menu titles added to the Visual FoxPro system menu _MSYSMENU. Note that the Menu Designer uses the Visual FoxPro system menu.

STYLE cFontStyle   Specifies a font style for the menu title. If you omit the STYLE clause,or if the font style you specify is not available, the Normal font style is used.

The font styles you can specifiy with cFontStyle are as follows:

Character	Font style
B	Bold
I	Italic
N	Normal
Q	Opaque
-	Strikeout
T	Transparent
U	Underline
You can include more than one character to specify a combination of font styles. For example, the following command specifies Bold Italic:

DEFINE PAD padPageAccts OF mnuReceive STYLE 'BI'

The STYLE clause is ignored for menu titles added to the Visual FoxPro system menu _MSYSMENU. Note that the Menu Designer uses the Visual FoxPro system menu.

KEY KeyLabel [, cKeyText]   Specifies an access key or key combination for a menu title. For a list of available keys and key combinations and their key label names, see ON KEY LABEL.

Note   If a keyboard macro is already defined with the same key label, the keyboard macro takes precedence, and the menu title cannot be chosen with the specified key or key combination.

The key label is placed to the right of menu titles in menu bars created without the BAR clause. The key label isn’t displayed in menu bars created with the BAR clause or for menu titles in the Visual FoxPro system menu bar.

Include cKeyText to replace the key label with your own text. You can use any character in the cKeyText parameter; for example, you can use the text “^B” to indicate a key label of CTRL+B. For example, including KEY CTRL+B places the text CTRL+B on the menu to the right of the menu item name, but specifying KEY CTRL+B, “^B” places the text ^+B on the menu. You can suppress the display of a key label by specifying an empty string for cKeyText.

MARK cMarkCharacter   Specifies a mark character that appears to the left of the menu title. MARK can be included to change the default mark character to a character specified with cMarkCharacter. If cMarkCharacter includes more than one character, only the first character is used as the mark character.

The default mark character is a check. The MARK clause is ignored and the default mark character is used if the menu bar containing the menu title is the Visual FoxPro system menu. Also, the MARK clause is ignored if FoxFont isn’t the font for the main Visual FoxPro window or the user-defined window in which the menu bar containing the menu title is placed.

Mark characters specified with DEFINE PAD take precedence over mark characters specified with the MARK clause in DEFINE MENU. SET MARK OF is used to toggle marks on or off and can also be used to specify a mark character for an individual menu title or for all menu titles.

Note   Specifying a mark character doesn’t mark the menu title. Use SET MARK OF to mark a menu title with the character you specify.

SKIP [FOR lExpression]   Specifies a condition whereby if lExpression evaluates to true (.T.), the menu title is disabled, preventing the user form choosing it. If lExpression evaluates to false (.F.), the menu title is enabled.

You can also disable a menu item by placing a backslash (\) before the text of the menu title text. For example:

DEFINE PAD padPageAccts OF mnuReceive PROMPT '\Age Accounts'

The menu title padPageAccts is displayed dimmed, indicating that it cannot be chosen.

A disabled menu title can be displayed but can’t be selected. However, a message specified with the MESSAGE clause is displayed.

MESSAGE cMessageText   Displays a message when the user selects a menu title. The message is placed in the graphical status bar. If the graphical status bar is turned off with SET STATUS BAR OFF, the message is centered on the last line of the main Visual FoxPro window.

COLOR SCHEME nSchemeNumber   Specifies the colors for an individual menu title, overriding the default colors or the colors specified with DEFINE MENU.

COLOR ColorPairList   Specifies the colors for an individual menu title, overriding the default colors or the colors specified with DEFINE MENU.

By default, the colors of menu titles in menu bars are determined by color scheme 2 of the current color set.

For more information on color schemes and color pairs, see the Colors Overview topic.

Remarks

You must create each menu title placed on the menu bar with its own DEFINE PAD command. A menu bar must be defined with DEFINE MENU before you can place menu titles on it, and you must include the menu bar name in DEFINE PAD.

If you use the Menu Designer to create your menu, you may not have to use these commands at all. The Menu Designer automatically creates the commands for your menu. The Menu Designer uses the Visual FoxPro system menu, which you can then modify by adding your own menu items. For more information on creating menus, see “Creating a Menu System” in Chapter 11, “Designing Menus and Toolbars,” in the Developer’s Guide.


DEFINE PAD Command Example

The following example uses DEFINE PAD to place menu titles in the Visual FoxPro system menu bar. The current system menu bar is first saved to memory with SET SYSMENU SAVE, and then all system menu titles are removed with SET SYSMENU TO.

Several system menu titles are created with DEFINE PAD. When a menu title is chosen, the CHOICE procedure is executed. CHOICE displays the name of the chosen menu title and the name of the menu bar, and toggles the menu titles's mark character on and off.  If the Exit menu title is chosen, the original Visual FoxPro system menu is restored.

*** Name this program DEFINPAD.PRG ***

CLEAR

SET TALK OFF

SET SYSMENU SAVE

SET SYSMENU TO

PUBLIC markpad

markpad = .T.

DEFINE PAD syspad    OF _MSYSMENU PROMPT '\<System'  COLOR SCHEME 3 ;

KEY ALT+S, ''

DEFINE PAD editpad   OF _MSYSMENU PROMPT '\<Edit'    COLOR SCHEME 3 ;

KEY ALT+E, ''

DEFINE PAD recordpad OF _MSYSMENU PROMPT '\<Record'  COLOR SCHEME 3 KEY ALT+R, ''

DEFINE PAD windowpad OF _MSYSMENU PROMPT '\<Window'  COLOR SCHEME 3 ;

KEY ALT+W, ''

DEFINE PAD reportpad OF _MSYSMENU PROMPT 'Re\<ports' COLOR SCHEME 3 ;

KEY ALT+P, ''

DEFINE PAD exitpad   OF _MSYSMENU PROMPT 'E\<xit'    COLOR SCHEME 3 ;

KEY ALT+X, ''

ON SELECTION MENU _MSYSMENU ;

DO choice IN definpad WITH PAD( ), MENU( )

PROCEDURE choice

PARAMETER mpad, mmenu

WAIT WINDOW 'You chose ' + mpad + ;

' from menu ' + mmenu NOWAIT

SET MARK OF PAD (mpad) OF _MSYSMENU TO ;

! MRKPAD('_MSYSMENU', mpad)

markpad = ! markpad

IF mpad = 'EXITPAD'

SET SYSMENU TO DEFAULT

ENDIF


See Also

ACTIVATE MENU
CREATE MENU
DEACTIVATE MENU
DEFINE MENU
GETPAD( )
HIDE MENU
MRKPAD( )
ON PAD
ON SELECTION PAD
PRMPAD( )
SET MARK OF
SET MESSAGE
SET SYSMENU
SHOW MENU


DEFINE POPUP Command

Syntax         Arguments         Remarks         Example         See Also

Creates a menu.

Syntax

DEFINE POPUP MenuName
[FROM nRow1, nColumn1]
[TO nRow2, nColumn2]
[IN [WINDOW] WindowName | IN SCREEN]
[FONT cFontName [, nFontSize]]
[STYLE cFontStyle]
[FOOTER cFooterText]
[KEY KeyLabel]
[MARGIN]
[MARK cMarkCharacter]
[MESSAGE cMessageText]
[MOVER]
[MULTISELECT]
[PROMPT FIELD FieldName | PROMPT FILES [LIKE FileSkeleton]
| PROMPT STRUCTURE]
[RELATIVE]
[SCROLL]
[SHORTCUT]
[TITLE cMenuTitleText]
[COLOR SCHEME nSchemeNumber
| COLOR ColorPairList]

Arguments

MenuName   Specifies the name of the menu to create.

FROM nRow1, nColumn1 TO nRow2, nColumn2   Specifies where the menu is placed. nRow1, nColumn1 specifies coordinates for the upper-left corner of the menu. If you omit the FROM clause, Visual FoxPro places the upper-left corner of the menu in the first row and first column of the main Visual FoxPro window or a user-defined window.

To create a menu with a specific size, you can also include TO nRow2, nColumn2 to specify the location of the lower-right corner of the menu. If you include FROM nRow1, nColumn1 and omit TO nRow2, nColumn2, Visual FoxPro automatically sizes the menu. The menu is as wide as the longest menu item in it (if the items are created with DEFINE BAR) and as long as needed to display all of the menu items. The menu length is limited by the size of the main Visual FoxPro window or user-defined window in which the menu is placed. If a menu isn’t large enough to contain all of the menu items, a scroll bar appears so that you can scroll through the menu items.

IN [WINDOW] WindowName   Places a menu in a user-defined window you specify with WindowName. If you omit this clause, the menu is placed on the main Visual FoxPro window by default unless there is an active user-defined window. If there is an active user-defined window, the menu is placed in the active window.

IN SCREEN   Explicitly places a menu in the main Visual FoxPro window.

FONT cFontName [, nFontSize]   Specifies a default font for the menu. You can override the default font for an individual menu item by including the FONT clause in DEFINE BAR.

cFontName specifies the name of the font, and nFontSize specifies the point size. For example, the following command creates a menu in 12-point Courier font:

DEFINE POPUP popMyPopup FONT 'Courier', 12

If the font you specify is not available, a font with similar font characteristics is substituted. If you include the FONT clause but omit the point size nFontSize, a 10-point font is used.

STYLE cFontStyle   Specifies a default font style for the menu. You can override the default style for an individual menu item by including the FONT clause in DEFINE BAR.

If you omit the STYLE clause, or if the font style you specify is not available, the Normal font style is used.

The font styles you can specifiy with cFontStyle are listed in the following table:

Character	Font style
B	Bold
I	Italic
N	Normal
Q	Opaque
-	Strikeout
T	Transparent
U	Underline
You can include more than one character to specify a combination of font styles. For example, the following command specifies Bold Italic:

DEFINE MENU popMyPopup STYLE 'BI'

FOOTER cFooterText   Creates a footer with the text specified with cFooterText centered in the bottom border of the menu.

KEY KeyLabel   Specifies an access key or key combination for a menu. For a list of available keys and key combinations and their key label names, see ON KEY LABEL.

Including KEY is equivalent to issuing the following command:

ON KEY LABEL KeyLabel ACTIVATE POPUP MenuName

Note   If a keyboard macro is already defined with the same key label, the keyboard macro takes precedence, and the menu cannot be activated with the specified key or key combination.

MARGIN   Places an extra space to the left and right of each menu item. Mark characters are displayed in the space to the left of an item, and arrows indicating additional cascading submenus are available and are displayed to the right of menu items. If you omit MARGIN, the mark characters overwrite the first character of the menu item names; hierarchical arrows overwrite the last character of the menu items.

MARK cMarkCharacter   Specifies a character that appears to the left of an item on the menu. The default mark character is a check mark. The MARK clause is ignored and the default mark character is used if the menu is integrated into the Visual FoxPro system menu. Also, the MARK clause is ignored if FoxFont isn’t the font for the main FoxPro window or the user-defined window in which the menu is placed.

MARK can be included to change the default mark character to a character specified with cMarkCharacter. If cMarkCharacter includes more than one character, only the first character is used as the mark character.

Note   Specifying a mark character doesn’t mark a menu item. Use SET MARK OF to mark a menu item.

The MARK clause sets the mark character for all items on the menu. Mark characters specified with DEFINE BAR commands take precedence over mark characters specified with the MARK clause in DEFINE POPUP. SET MARK OF is used to toggle mark characters on or off and can also be used to specify a mark character for an individual menu item or for all menu items.

MESSAGE cMessageText   Displays a message when you select a menu item. The message is placed in the graphical status bar. If the character-based status bar is turned on with SET STATUS ON, the message is centered on the last line of the main Visual FoxPro window.

MOVER   Places a double-headed arrow ( [image]) in the Mover box to the left of the selected item in the menu. You can drag the double-headed arrow to move an item to another position on the menu. GETBAR( ) can be used to determine where each item is positioned on the menu.

You cannot rearrange items in a menu created with a PROMPT clause.

MULTISELECT   Allows the user to select multiple items from a menu at the same time. When the user chooses an item from a menu, the mark character is placed to the left of the item.

You cannot make multiple selections from a menu created with a PROMPT clause.

MRKBAR( ) can be used to determine which items are chosen from the menu.

If you include MULTISELECT in DEFINE POPUP, you can include MARGIN to reserve space in each item for the mark character.

In the following example, a menu named popFruits is created. MULTISELECT is included to create a menu that allows multiple items to be chosen.

Each of the four items has a different mark character. When a user chooses items from the menu, the items are marked and a routine named yourchoice displays the chosen items.

CLEAR

IF NOT _DOS

MODIFY WINDOW SCREEN FONT 'foxfont', 12

ENDIF

ACTIVATE SCREEN

DEFINE POPUP popFruits FROM 5,5 ;

MULTISELECT MARGIN	&& Create multi-choice menu

DEFINE BAR 1 OF popFruits ;

PROMPT '\<Apples'  MARK CHR(3) 	&& First item

DEFINE BAR 2 OF popFruits ;

PROMPT '\<Bananas' MARK CHR(4) 	&& Second item

DEFINE BAR 3 OF popFruits ;

PROMPT '\<Grapes'  MARK CHR(5) && Third item

DEFINE BAR 4 OF popFruits ;

PROMPT '\<Lemons'  MARK CHR(6)	 && Fourth item

@ 12,5 SAY 'Your choices:'

ON SELECTION POPUP popFruits DO yourchoice 	&& Choice routine

ACTIVATE POPUP popFruits

PROCEDURE yourchoice	&& Executed when choice is made

@ 13,5 CLEAR

FOR gnCount = 1 TO CNTBAR('popFruits')	&& Loop for # of items

IF MRKBAR('popFruits', gnCount) = .T.	&& Option is marked,

? PRMBAR('popFruits', gnCount) AT 5	&& display caption

ENDIF

NEXT

PROMPT FIELD FieldName   Specifies the field name from an open table whose records become the items on the menu. The menu contains an item for each record in the table. When the menu is activated, the tables’s work area is selected.

Tip   You can take advantage of Rushmore optimization if you set a filter on the field specified with PROMPT FIELD used in the menu.

For more information on Rushmore optimization, see SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

FieldName can also contain multiple field names and expressions concatenated with the addition operator (+). FieldName can also be the name of the field in a table open in another work area or a user-defined function.

There is no limit to the number of entries that can appear in a menu created with PROMPT FIELD.

PROMPT FILES [LIKE FileSkeleton]   Creates a menu that displays the names of files available in the current directory or folder.

LIKE FileSkeleton allows you to specify the files that ared displayed in the menu using wildcards. For example, to create a menu that displays the names of tables in the default drive and directory, include the following command:

PROMPT FILES LIKE *.DBF

You can create a menu that displays the names of files on other drives and in other directories or folders by including a drive or volume specification, a directory or folder specification, or both. For example, to create a menu that displays the names of program files in a directorycalled PROGRAMS on drive C, include the following command:

PROMPT FILES LIKE C:\PROGRAMS\*.PRG

PROMPT STRUCTURE   Displays the names of the fields in the current table on the menu according to the table’s field structure. When the menu is activated, the table’s work area is selected.

RELATIVE   Specifies the order in which items are placed on a menu. If you create a menu without the RELATIVE clause, an item is positioned on a menu in an order dictated by the item’s bar number. Space on the menu is reserved for undefined items. For example, if the first and third items are defined and the menu is activated, a blank line reserved for the second item is placed on the menu.

If you create a menu with RELATIVE, the items appear on the menu in the order in which they are defined. Space in the menu isn’t reserved for undefined items.

Defining a menu with RELATIVE also lets you make use of BEFORE and AFTER clauses in DEFINE BAR to position items on a menu relative to other items. If a menu is created without RELATIVE, including BEFORE or AFTER in DEFINE BAR generates an error.

Run the following two program examples and compare the placement of the items on each menu.

*** RELATIVE Example  ***

DEFINE POPUP popRelatYes RELATIVE FROM 1,1

DEFINE BAR 4  OF popRelatYes PROMPT '4444'

DEFINE BAR 3  OF popRelatYes PROMPT '3333'

DEFINE BAR 2  OF popRelatYes PROMPT '2222'

DEFINE BAR 1  OF popRelatYes PROMPT '1111'

DEFINE BAR 6  OF popRelatYes PROMPT '6666' BEFORE 4

ACTIVATE POPUP popRelatYes

*** NON-RELATIVE Example ***

DEFINE POPUP popRelatNo FROM 1,1

DEFINE BAR 4  OF popRelatNo PROMPT '4444'

DEFINE BAR 3  OF popRelatNo PROMPT '3333'

DEFINE BAR 2  OF popRelatNo PROMPT '2222'

DEFINE BAR 1  OF popRelatNo PROMPT '1111'

DEFINE BAR 6  OF popRelatNo PROMPT '6666'

ACTIVATE POPUP popRelatNo

SCROLL   Places a scroll bar to the right of the menu you create. The scroll bar is displayed only when there are more items than can fit on the menu, or if the menu is too long to fit in the main Visual FoxPro window or the user-defined window in which it is placed.

SHORTCUT   Creates a shortcut menu. A shortcut menu typically appears when a selection, toolbar, or taskbar button is clicked with the right mouse button. The shortcut menu lists commands that pertain to the screen region on which the mouse was right-clicked.

You can include MROW( ) and MCOL( ) in the FROM clause to activate the popup at the location where the mouse is clicked.

TITLE cMenuTitleText   Displays a title in the center of the top border of the menu. cTitleText specifies the menu title.

COLOR SCHEME nSchemeNumber   Specifies the colors for all elements of a menu. By default, the colors of menus created with DEFINE POPUP are controlled by color scheme 2.

COLOR ColorPairList   Specifies the colors for all elements of a menu.

For more information on color schemes and color pairs, see the Colors Overview topic.

Remarks

To place a set of menu items that you define on a menu, use a series of DEFINE BAR commands. To place records, files, or fields in a menu, use the PROMPT FIELD, PROMPT FILES, or PROMPT STRUCTURE options of DEFINE POPUP.

When the menu is displayed and activated with ACTIVATE POPUP, you can choose one of the items on the menu. Depending on the item chosen, a routine can be executed or another menu can be displayed and activated. A menu that displays another menu when an item is chosen is called a cascading submenu. For more information on creating submenus, see ON BAR.

If you use the Menu Designer to create your menu, you may not have to use these commands at all. The Menu Designer automatically creates the commands for your menu. The Menu Designer uses the Visual FoxPro system menu, which you can then modify by adding your own menu items.

For more information on creating menus, see “Creating a Menu System” in Chapter 11, “Designing Menus and Toolbars,” in the Developer’s Guide.


DEFINE POPUP Command Example

The following example uses DEFINE POPUP to create menus that are activated when a menu title in the menu bar is chosen. The current system menu bar is first saved to memory with SET SYSMENU SAVE, and then all system menu titles are removed with SET SYSMENU TO.

Two new system menu titles are created with DEFINE PAD, and DEFINE POPUP creates a drop-down menu for each menu title. DEFINE BAR creates items on each of the menus. When a menu title is chosen, ON PAD uses ACTIVATE POPUP to activate the corresponding menu.

When an item is chosen from a menu, ON SELECTION POPUP uses PROMPT( ) and POPUP( ) to pass the item number and menu name to the CHOICE procedure. CHOICE displays the text of the chosen item and the name of the menu containing the item. If the Exit item is chosen from the Card Info menu, the original Visual FoxPro system menu is restored.

*** Name this program DEFINPOP.PRG ***

CLEAR

SET SYSMENU SAVE

SET SYSMENU TO

DEFINE PAD convpad OF _MSYSMENU PROMPT '\<Conversions' COLOR SCHEME 3 ;

KEY ALT+C, ''

DEFINE PAD cardpad OF _MSYSMENU PROMPT 'Card \<Info' COLOR SCHEME 3 ;

KEY ALT+I, ''

ON PAD convpad OF _MSYSMENU ACTIVATE POPUP conversion

ON PAD cardpad OF _MSYSMENU ACTIVATE POPUP cardinfo

DEFINE POPUP conversion MARGIN RELATIVE COLOR SCHEME 4

DEFINE BAR 1 OF conversion PROMPT 'Ar\<ea' KEY CTRL+E, '^E'

DEFINE BAR 2 OF conversion PROMPT '\<Length' ;

KEY CTRL+L, '^L'

DEFINE BAR 3 OF conversion PROMPT 'Ma\<ss' ;

KEY CTRL+S, '^S'

DEFINE BAR 4 OF conversion PROMPT 'Spee\<d' ;

KEY CTRL+D, '^D'

DEFINE BAR 5 OF conversion PROMPT '\<Temperature' ;

KEY CTRL+T, '^T'

DEFINE BAR 6 OF conversion PROMPT 'T\<ime' ;

KEY CTRL+I, '^I'

DEFINE BAR 7 OF conversion PROMPT 'Volu\<me' ;

KEY CTRL+M, '^M'

ON SELECTION POPUP conversion;

DO choice IN definpop WITH PROMPT( ), POPUP( )

DEFINE POPUP cardinfo MARGIN RELATIVE COLOR SCHEME 4

DEFINE BAR 1 OF cardinfo PROMPT '\<View Charges' ;

KEY ALT+V, ''

DEFINE BAR 2 OF cardinfo PROMPT 'View \<Payments' ;

KEY ALT+P, ''

DEFINE BAR 3 OF cardinfo PROMPT 'Vie\<w Users' ;

KEY ALT+W, ''

DEFINE BAR 4 OF cardinfo PROMPT '\-'

DEFINE BAR 5 OF cardinfo PROMPT '\<Charges '

DEFINE BAR 6 OF cardinfo PROMPT '\-'

DEFINE BAR 7 OF cardinfo PROMPT 'E\<xit '

ON SELECTION POPUP cardinfo;

DO choice IN definpop WITH PROMPT( ), POPUP( )

PROCEDURE choice

PARAMETERS mprompt, mpopup

WAIT WINDOW 'You chose ' + mprompt + ;

' from popup ' + mpopup NOWAIT

IF mprompt = 'Exit'

SET SYSMENU TO DEFAULT

ENDIF


See Also

ACTIVATE POPUP
CNTBAR( )
CREATE MENU
DEFINE BAR
GETBAR( )
HIDE POPUP
MOVE POPUP
MRKBAR( )
ON BAR
ON SELECTION BAR
POPUP( )
PRMBAR( )
PROMPT( )
SET MARK OF
SET MESSAGE
SIZE POPUP
SHOW POPUP


DEFINE WINDOW Command

Syntax         Arguments         Remarks         Example         See Also

Creates a window and specifies its attributes.

Syntax

DEFINE WINDOW WindowName1
FROM nRow1, nColumn1 TO nRow2, nColumn2
| AT nRow3, nColumn3 SIZE nRow4, nColumn4
[IN [WINDOW] WindowName2 | IN SCREEN | IN DESKTOP

[NAME ObjectName]
[FONT cFontName [, nFontSize]]
[STYLE cFontStyle]
[FOOTER cFooterText]
[TITLE cTitleText]
[HALFHEIGHT]
[DOUBLE | PANEL | NONE | SYSTEM | cBorderString]
[CLOSE | NOCLOSE]
[FLOAT | NOFLOAT]
[GROW | NOGROW]
[MDI | NOMDI]
[MINIMIZE | NOMINIMIZE]
[ZOOM | NOZOOM]
[ICON FILE FileName1]
[FILL cFillCharacter | FILL FILE FileName2]
[COLOR SCHEME nSchemeNumber
| COLOR ColorPairList]

Arguments

WindowName1   Specifies the name of the window to create. Window names can be up to 254 characters long in Visual FoxPro. They must begin with a letter or underscore, and cannot begin with a number. They can contain any combination of letters, numbers and underscores.

FROM nRow1, nColumn1 TO nRow2, nColumn2   Specifies the position and size of the user-defined window on the main Visual FoxPro window. FROM nRow1, nColumn1 specifies the position of the upper-left corner of the user-defined window on the main Visual FoxPro window. TO nRow2, nColumn2 specifies the position of the lower-right corner of the user-defined window on the main Visual FoxPro window.

A window can be defined with coordinates that lie outside the Visual FoxPro window border and can be larger than the main Visual FoxPro window.

The window’s location and size are determined by the font of the window’s parent. The window’s parent can be another user-defined window or the main Visual FoxPro window.

AT nRow3, nColumn3 SIZE nRow4, nColumn4   Specifies the position and size of a user-defined window.

AT nRow3, nColumn3 specifies the position of the upper-left corner of the user defined window on the main Visual FoxPro window. This position is determined by the current font of the window’s parent. Because the AT clause is identical to the FROM clause in all respects, the two clauses can be used interchangeably.

SIZE nRow4, nColumn4 specifies in rows and columns the size of the user-defined window and ensures that text displayed in a specific font will fit in the window you create.

You can specify a font and font style for a user-defined window by including the FONT and STYLE clauses. If you specify a font for the window and include the SIZE clause, its size is determined by the window’s font height and width. If you don’t specify a font for a window, the window’s font is the default system font, 10-point FoxFont.

IN [WINDOW] WindowName2   Places a user-defined window in a parent window. The user-defined window becomes a child window and cannot be moved outside the parent window. If the parent window is moved, the child window moves with it.

When a child window is placed in a parent window, the child window coordinates specified with the FROM and TO clauses or the AT and SIZE clauses are relative to the parent window, not the main Visual FoxPro window.

In the following example, a parent window, wParent, is created. A child window, wChild, is placed in the parent window.

CLEAR

DEFINE WINDOW wParent ;

FROM 1, 1 TO 20, 30 ;

TITLE "Parent"	&& Parent window.

ACTIVATE WINDOW wParent

DEFINE WINDOW wChild ;

FROM 1, 1 TO 20, 20 ;

TITLE "Child" ;

IN WINDOW wParent 	&& Child window.

ACTIVATE WINDOW wChild

ACTIVATE SCREEN

WAIT WINDOW 'Press a key to clear the windows'

RELEASE WINDOW wParent, wChild

CLEAR

IN SCREEN   Explicitly places a user-defined window on the main Visual FoxPro window. If you omit IN SCREEN, the user-defined window is placed on the main Visual FoxPro window by default.

You can include the IN WINDOW clause in ACTIVATE WINDOW to place the window in another user-defined window and override this IN SCREEN clause.

IN DESKTOP   Places a user-defined window on the Microsoft Windows desktop, outside the main Visual FoxPro window. The position of the window is relative to the Windows desktop, and the current font of the main Visual FoxPro window.

NAME ObjectName   Creates an object reference for the window, allowing you to manipulate the window with object-oriented properties available for the form object.

For additional information about object-oriented programming in Visual FoxPro, see Chapter 3, “Object-Oriented Programming,” in the Developer’s Guide. For additional information about the form object properties you can specify for a window created with the NAME clause, see the Form Object topic.

For additional information about object-oriented programming in Visual FoxPro, see Chapter 3, “Object-Oriented Programming,” in the Developer’s Guide. For additional information about the form object properties you can specify for a window created with the NAME clause, see the Form Object topic.

FONT cFontName [, nFontSize]   Specifies a font for text placed in the window. cFontName specifies the name of the font and nFontSize specifies the point size. If you omit nFontSize, a 9-point font is used.

For example, this command creates a window that displays output directed to the window in a 16-point Courier font:

DEFINE WINDOW wDisplayFont FROM 2,2 TO 12,22 FONT 'Courier', 16

If you omit the FONT clause, a 10-point FoxFont is used. If the font you specify is not available, a font with similar font characteristics is substituted.

STYLE cFontStyle   Specifies a font style for text placed in the window. cFontStyle specifies the font. If you omit the STYLE clause, or if the font style you specify is not available, the Normal font style is used.

The following table lists font styles and their corresponding characters.

Character	Font style
B	Bold
I	Italic
N	Normal
Q	Opaque
-	Strikeout
T	Transparent
U	Underline
You can include more than one character to specify a combination of font styles. In Visual FoxPro, the following commands specify the style Bold Italic:

DEFINE WINDOW wDisplayStyle FROM 2, 2 TO 12, 22 STYLE 'BI'

TITLE cTitleText   Assigns a title with the TITLE clause. cTitleText specifies the title’s text and is centered in the top border of the window. If the title is wider than the window, the title is truncated.

HALFHEIGHT   Creates a window with a half-height title bar. This provides compatibility for windows created in previous versions of FoxPro that are imported into Visual FoxPro.

When you use DEFINE WINDOW to create a window, a half-height title bar is used, unless you include the SYSTEM keyword or you include a FONT clause.

If you include the HALFHEIGHT keyword, a half-height title bar is used regardless of whether the SYSTEM or FONT clause is included.

DOUBLE | PANEL | NONE | SYSTEM | cBorderString   Specifes a border style for a user-defined window. The default border is a single line.

Argument	Description
DOUBLE	Specifies a double-line border around the window.
PANEL	Specifies a wide border around the window.
NONE	Suppresses the border entirely.
SYSTEM	Specifies the user-defined window to look like a system window. When you include certain other clauses (GROW, ZOOM, and so on), the appropriate window controls are placed in the window’s border.
cBorderString	Specifies a custom border. For more information on defining a custom border, see SET BORDER.
Including DOUBLE or a custom border string creates a window with the PANEL border. Including the CLOSE, FLOAT, GROW, ZOOM, or MINIMIZE clauses places the appropriate controls on the window even if the SYSTEM window definition clause is not included.

CLOSE   Allows the user to close a user-defined window using the keyboard or mouse. Closing a window removes it from the main Visual FoxPro window or a parent user-defined window and removes its definition from memory. If you omit CLOSE, you cannot close the window using the interface; the window must be closed using a command in a program or in the Command window.

NOCLOSE   Prevents the window from being closed except by a command in a program or in the Command window.

FLOAT   Allows the window to be moved using the keyboard or mouse. If you omit FLOAT, you cannot move the window except using the MOVE WINDOW command in a program or in the Command window.

NOFLOAT   Prevents the window from being moved except by using the MOVE WINDOW command in a program or in the Command window.

GROW   Allows you to resize a user-defined window using the keyboard or mouse. If you omit GROW, you cannot size the window except using the SIZE WINDOW command in a program or in the Command window.

NOGROW   Prevents the window from being resized except by the SIZE WINDOW command in a program or in the Command window.

MDI   Creates a user-defined window that is MDI-compliant. MDI (multiple document interface) is a specification that allows multiple document windows and determines their structure and behavior. If you omit MDI, the window you create isn’t MDI-compliant.

When an MDI-compliant window is maximized:

•	The window assumes the size of the main Visual FoxPro window. The window’s controls disappear and its Control-menu box appears in the Visual FoxPro system menu bar. The window’s Restore button is also placed in the Visual FoxPro system menu bar.

•	The window title is placed in the Visual FoxPro title bar and is separated from the Visual FoxPro title by a hyphen.

•	If you activate another MDI-compliant window, it is automatically maximized.

NOMDI   Creates a window that isn’t MDI-compliant.

MINIMIZE   Allows you to minimize a user-defined window using the keyboard or mouse.

NOMINIMIZE   Prevents the window from being minimized.

ZOOM   Allows the window to be maximized using the keyboard or mouse. You can also restore the window to its original size.

NOZOOM   Prevents the window from being maximized.

ICON FILE FileName   Specifies the icon that displays when the window is minimized. You must include the MINIMIZE keyword in DEFINE WINDOW. You can specify only an icon (.ICO) file; you cannot specify a bitmap (.BMP) file.

FILL FILE FileName2   Specifies a wallpaper (the background) for the window. The window is tiled with the specified FileName2. You specify a .BMP bitmap file.

COLOR SCHEME nSchemeNumber   Specifies the colors for the user-defined window. By default, the colors of windows created with DEFINE WINDOW are controlled by color scheme 1.

COLOR ColorPairList   Specifies the colors for the user-defined window.

For more information on color schemes and color pairs, see the Colors Overview topic.

Remarks

After user-defined windows are created with DEFINE WINDOW, they can be displayed in the main Visual FoxPro window with ACTIVATE WINDOW or SHOW WINDOW. The number of user-defined windows you can create is limited only by the amount of available memory and system resources.

Activated windows remain in the main Visual FoxPro window until DEACTIVATE WINDOW or HIDE WINDOW is issued. DEACTIVATE WINDOW and HIDE WINDOW remove windows from the main Visual FoxPro window but don’t remove the window definitions from memory. Windows can be placed back in the main Visual FoxPro window with ACTIVATE WINDOW or SHOW WINDOW.

Use CLEAR WINDOWS or RELEASE WINDOWS to remove windows from the main Visual FoxPro window and window definitions from memory. Windows whose definitions have been removed from memory must be recreated with DEFINE WINDOW in order to be redisplayed.


DEFINE WINDOW Command Example

In the following example, a window named output is created and activated. The program waits for you to press a key and then hides the window. The program waits for you to press a key again and then redisplays the window.

CLEAR

DEFINE WINDOW output FROM 2,1 TO 13,75 TITLE 'Output' ;

CLOSE FLOAT GROW ZOOM

ACTIVATE WINDOW output

WAIT WINDOW 'press any key to hide window output'

HIDE WINDOW output

WAIT WINDOW 'press any key to show window output'

SHOW WINDOW output

WAIT WINDOW 'press any key to release window output'

RELEASE WINDOW  output


See Also

ACTIVATE WINDOW
DEACTIVATE WINDOW
Fonts Overview
Form Object
HIDE WINDOW
MODIFY WINDOW
MOVE WINDOW
RELEASE WINDOWS
SET BORDER
SHOW WINDOW


DefOLELCID Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the default OLE Locale ID for a form or the main Visual FoxPro window. Available at design time and run time.

Syntax

Form.DefOLELCID[ = nValue]

Settings

nValue   Specifies a default OLE Locale ID value for a form or the main Visual FoxPro window. This default value determines the Locale ID for OLE Bound controls and OLE Container controls when they are placed on the form or the main Visual FoxPro window.

Remarks

If the default OLE Locale ID value for a form or the main Visual FoxPro window is changed to a new value, OLE Bound controls and OLE Container controls placed on the form or the main Visual FoxPro window after the new default Locale ID value is in effect use the new value.

If DefOLELCID is set to zero for a form or the main Visual FoxPro window, SYS(3004) determines the default Locale ID for OLE Bound controls and OLE Container controls placed on the form or the main Visual FoxPro window.

See SYS(3005) for a listing of Locale IDs.

Note   The DefOLELCID property only affects the language of the user interface, which OLE controls display, and not the language of the OLE automation commands. The OLE automation command language is affected only by the Global LocaleID, set with SYS(3005).


Applies To

Form, _SCREEN


See Also

OLELCID Property
SYS(3005) - Set Locale ID


DELETE Command

Syntax         Arguments         Remarks         Example         See Also

Marks records for deletion.

Syntax

DELETE
[Scope] [FOR lExpression1] [WHILE lExpression2]
[IN nWorkArea | cTableAlias]
[NOOPTIMIZE]

Arguments

Scope   Specifies a range of records to mark for deletion. The scope clauses are: ALL, NEXT nRecords, RECORD nRecordNumber, and REST.

For more information on scope clauses, see the Scope Clauses topic.

The default scope for DELETE is the current record (NEXT 1).

FOR lExpression1   Specifies a condition whereby only the records that satisfy the logical condition lExpression1 are marked for deletion.

Rushmore optimizes a query created with DELETE ... FOR if lExpression1 is an optimizable expression and the table is indexed on DELETED( ). For best performance, use an optimizable expression in the FOR clause.

For information on Rushmore optimizable expressions, see SET OPTIMIZEand “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

WHILE lExpression2   Specifies a condition whereby records are marked for deletion for as long as lExpression2 evaluates to true (.T.).

IN nWorkArea   Specifies the work area of the table in which records are marked for deletion.

IN cTableAlias   Specifies the alias of the table in which records are marked for deletion.

If you omit nWorkArea and cTableAlias, records are marked for deletion in the table in the currently selected work area.

NOOPTIMIZE   Disables Rushmore optimization of DELETE.

For more information, see SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

Remarks

Records marked for deletion aren’t physically removed from the table until PACK is issued. Records marked for deletion can be recalled (unmarked) with RECALL.


DELETE Command Example

The following example opens the customer table in the testdata database. DELETE is used to mark all records for deletion where the country field contains USA. All the records marked for deletion are displayed. RECALL ALL is used to unmark all the records marked for deletion.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

DELETE FOR country = 'USA'  && Mark for deletion

CLEAR

LIST FIELDS company, country FOR DELETED( ) && List marked records

RECALL ALL  && Unmark all records marked for deletion


See Also

DELETE - SQL
DELETED( )
PACK
RECALL
SET DELETED


DELETE - SQL Command

Syntax         Arguments         Remarks         Example         See Also

Marks records for deletion.

Syntax

DELETE FROM [DatabaseName!]TableName
[WHERE FilterCondition1 [AND | OR FilterCondition2 ...]]

Arguments

FROM [DatabaseName!]TableName   Specifies the table in which records are marked for deletion.

DatabaseName! specifies the name of a non-current database containing the table. You must include the name of a database containing the table if the database is not the current database. Include the exclamation point (!) delimiter after the database name and before the table name.

WHERE FilterCondition1 [AND | OR FilterCondition2 ...]   Specifies that Visual FoxPro marks only certain records for deletion.

FilterCondition specifies the criteria that records must meet to be marked for deletion. You can include as many filter conditions as you like, connecting them with the AND or OR operator. You can also use the NOT operator to reverse the value of a logical expression, or use EMPTY( ) to check for an empty field.

Remarks

Records marked for deletion aren’t physically removed from the table until PACK is issued. Records marked for deletion can be recalled (unmarked) with RECALL.

If SET DELETED is set to ON, records marked for deletion are ignored by all commands that include a scope.

Unlike DELETE, DELETE - SQL uses record locking when marking multiple records for deletion in tables opened for shared access. This reduces record contention in multiuser situations, but may reduce performance. For maximum performance, open the table for exclusive use or use FLOCK( ) to lock the table.


DELETE - SQL Command Example

The following example opens the customer table in the testdata database. DELETE - SQL is used to mark all records for deletion where the country field contains USA. All the records marked for deletion are displayed. RECALL ALL is used to unmark all the records marked for deletion.

CLOSE DATABASES

CLEAR

OPEN DATABASE SYS(2004)+"samples\data\testdata"

USE customer  && Open Customer table

DELETE FROM customer WHERE country = "USA"       && Mark for deletion

CLEAR

LIST FIELDS company, country FOR DELETED( )      && List marked records

* If the file were packed at this point the records would be deleted

WAIT WINDOW "Records currently marked for deletion"+CHR(13) + ;

     "Press any key to revert..."

* Unmark all records marked for deletion

RECALL ALL

CLEAR

* Verify reverted records

COUNT FOR DELETED( )=.T. TO nDeleted

* Convert nDeleted to a character string and display information

WAIT WINDOW ALLTRIM(STR(nDeleted)) + " records marked for deletion."


See Also

DELETE
DELETED( )
PACK
RECALL
SET DELETED


DELETE CONNECTION Command

Syntax         Arguments         Remarks         Example         See Also

Deletes a named connection from the current database.

Syntax

DELETE CONNECTION ConnectionName

Arguments

ConnectionName   Specifies the name of the named connection to delete from the current database.

Remarks

Deleting a named connection definition does not close any active connections.

DELETE CONNECTION requires exclusive use of the database. To open a database for exclusive use, include EXCLUSIVE in OPEN DATABASE.


DELETE CONNECTION Command Example

The following example assumes an ODBC data source called MyFoxSQLNT is available, and the user ID for the data source is “sa.” The testdata database is opened, and a connection named Myconn is created. DISPLAY CONNECTIONS is used to display the named connections in the database. The connection is then removed from the database with DELETE CONNECTION.

CLOSE DATABASES

OPEN DATABASE (SYS(2004) + 'samples\data\testdata')

CREATE CONNECTION Myconn DATASOURCE "MyFoxSQLNT" USERID "sa"

DISPLAY CONNECTIONS	 && Displays named connections in the database

DELETE CONNECTION Myconn  && Removes the connection just created


See Also

CREATE CONNECTION
MODIFY CONNECTION
RENAME CONNECTION


DELETE DATABASE Command

Syntax         Arguments         Remarks         Example         See Also

Deletes a database from disk.

Syntax

DELETE DATABASE DatabaseName | ?
[DELETETABLES] [RECYCLE]

Arguments

DatabaseName   Specifies the name of the database to delete from disk. The database you specify cannot be open. DatabaseName can include the path to the database with the database name.

?   Displays the Delete dialog box from which you can specify the name of the database to delete from disk.

DELETETABLES   Deletes the tables contained in the database from disk and the database containing the tables.

RECYCLE   Specifies that the database isn’t immediately deleted from disk and is placed in the Windows 95 Recycle Bin.

Remarks

Always use DELETE DATABASE to delete a database from disk. Unlike the file manipulation utility of the operating system, DELETE DATABASE removes references to the database from the tables in the database.

If SET SAFETY is ON, Visual FoxPro asks if you’d like to delete the database you specify. If SET SAFETY is OFF, the database is automatically deleted from disk.


DELETE DATABASE Command Example

This example creates a database named people. A table named friends is created and is automatically added to the database. DISPLAY TABLES is used to display the tables in the database, and DISPLAY DATABASES is used to display information about the tables in the database.

DELETE DATABASE is used with the DELETETABLES option to remove the database and its friends table from disk.

CLOSE ALL

CREATE DATABASE people

CREATE TABLE friends (FirstName C(20), LastName C(20))

CLEAR

DISPLAY TABLES  && Displays tables in the database

DISPLAY DATABASES  && Displays table information

CLOSE ALL

DELETE DATABASE people DELETETABLES


See Also

ADD TABLE
CLOSE DATABASES
DBC( )
DBGETPROP( )
DBSETPROP( )
DISPLAY TABLES
OPEN DATABASE
REMOVE TABLE


DELETE FILE Command

Syntax         Arguments         Remarks         Example         See Also

Deletes a file from a disk.

Syntax

DELETE FILE [FileName | ?] [RECYCLE]

Arguments

FileName   Specifies the file to delete. FileName can contain wildcard characters such as * and ?. For example, to delete backup files with the extension .BAK in the current directory or folder, issue DELETE FILE *.BAK.

?   Displays the Delete dialog from which you can choose a file to delete.

RECYCLE   Specifies that the file isn’t immediately deleted from disk and is placed in the Windows 95 Recycle Bin.

Caution   Any file deleted with this command cannot be retrieved. Even if SET SAFETY is ON, you are not warned before the file is deleted.

Remarks

The file you want to delete cannot be open when DELETE FILE is issued. The file name must include a path if it is on a different drive or volume, or in a different directory or folder from the default, and the file name extension must be included. The file name cannot contain wildcards.

Before you delete a table in a database, issue REMOVE TABLE with the table name to remove references to the table from the database. If you delete a table that has an associated .FPT memo file, be sure to delete the memo file.


DELETE FILE Command Example

In the following example, the structure of CUSTOMER.DBF and all records in which the country is USA are copied to a table named backup. The data in backup is then copied to a text file, temp, which is opened and then deleted when it is closed.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

COPY STRUCTURE TO backup

USE backup

APPEND FROM customer FOR country = 'USA'

COPY TO temp TYPE DELIMITED

WAIT WINDOW 'Press Esc to close and erase temp.txt' NOWAIT

MODIFY FILE temp.txt NOEDIT

DELETE FILE temp.txt

? IIF(FILE('temp.txt'),'File not deleted','File deleted')

USE

DELETE FILE backup.dbf


See Also

ERASE
REMOVE TABLE
SET SAFETY


DELETE TAG Command

Syntax         Arguments         Remarks         See Also

Removes a tag or tags from a compound index (.CDX) file.

Syntax

DELETE TAG TagName1 [OF CDXFileName1]
[, TagName2 [OF CDXFileName2]] ...

 – Or –

DELETE TAG ALL [OF CDXFileName]

Arguments

TagName1 [OF CDXFileName1] [, TagName2 [OF CDXFileName2]] ...    Specifies a tag to remove from a compound index file. You can delete multiple tags with one DELETE TAG by including a list of tag names separated by commas. If two or more tags with the same name exist in the open index files, you can remove a tag from a specific index file by including OF CDXFileName.

ALL [OF CDXFileName]   Removes every tag from a compound index file. If the current table has a structural compound index file, all tags are removed from the index file, the index file is deleted from the disk, and the flag in the table’s header indicating the presence of an associated structural compound index file is removed. Use ALL with OF CDXFileName to remove all tags from an open compound index file other than the structural compound index file.

Remarks

Compound index files, created with INDEX, contain tags corresponding to index entries. DELETE TAG is used to remove a tag or tags from open compound index files. You can delete only tags from compound index files open in the current work area. If you remove all the tags from a compound index file, the file is deleted from the disk.

Visual FoxPro looks first for a tag in the structural compound index file (if one is open). If the tag isn’t in the structural compound index file, Visual FoxPro then looks for the tag in the other open compound index files.

Visual FoxPro issues a warning if you attempt to delete a primary or candidate index tag and SET SAFETY is ON.


See Also

COPY INDEXES
COPY TAG
INDEX
TAG( )


DELETE TRIGGER Command

Syntax         Arguments         Remarks         Example         See Also

Removes a Delete, Insert, or Update trigger for a table from the current database.

Syntax

DELETE TRIGGER ON TableName FOR DELETE | INSERT | UPDATE

Arguments

TableName   Specifies the name of table for which the trigger is deleted.

FOR DELETE | INSERT | UPDATE   Specifies the trigger to delete. Include FOR DELETE to remove the Delete trigger, FOR INSERT to remove the Insert trigger, and FOR UPDATE to remove the Update trigger.

Remarks

Use CREATE TRIGGER to create a Delete, Insert, or Update trigger for a table.


DELETE TRIGGER Command Example

The following examples creates an Update trigger which prevents values greater than 50 from being entered in the maxordamt field in the customer table. DISPLAY DATABASE is used to display the Update trigger. DELETE TRIGGER is then used to remove the Update trigger, and DISPLAY DATABASE is issued again to verify the removal of the Update trigger.

CLOSE DATABASES

OPEN DATABASE SYS(2004) + 'samples\data\testdata'  && Open testdata database

USE CUSTOMER  && Open customer table

CREATE TRIGGER ON customer FOR UPDATE AS maxordamt <= 50

CLEAR

DISPLAY DATABASE

DELETE TRIGGER ON customer FOR UPDATE

DISPLAY DATABASE


See Also

ADD TABLE
AERROR( )
CREATE DATABASE
CREATE TRIGGER
DISPLAY DATABASE
LIST DATABASE
OPEN DATABASE


DELETE VIEW Command

Syntax        Arguments        Remarks        Example         See Also

Deletes a SQL view from the current database.

Syntax

DELETE VIEW ViewName

Arguments

ViewName   Specifies the name of the view deleted from the current database.

Remarks

Use CREATE SQL VIEW to create a SQL view and add the view to the current database. If a SQL view is opened and then deleted, the cursors containing the SQL view results are not closed.

DELETE VIEW requires exclusive use of the database. To open a database for exclusive use, include EXCLUSIVE in OPEN DATABASE.


DELETE VIEW Command Example

The following example opens the testdata database. CREATE SQL VIEW is used to create a local SQL view named myview. The View Designer is displayed, allowing you to specify tables and conditions for the SQL view. After you save the SQL view, DISPLAY DATABASE is used to display information about the SQL view. DELETE VIEW is then used to delete the local SQL view named myview.

CLOSE DATABASES

OPEN DATABASE (SYS(2004) + 'samples\data\testdata')

CREATE SQL VIEW myview

CLEAR

DISPLAY DATABASE

DELETE VIEW myview


See Also

CREATE SQL VIEW
OPEN DATABASE


DeleteColumn Method

Syntax         Arguments        Applies To         See Also

Removes a Column object from a Grid control.

Syntax

Grid.DeleteColumn[(nIndex)]

Arguments

nIndex   Specifies a number referencing the order of Columns in a Grid. If nIndex is not specified, the last Column in the Grid is removed.


Applies To

Grid


See Also

AddColumn Method
AddObject Method
RemoveObject Method


Deleted Event

Syntax         Arguments         Applies To         See Also

Occurs when the user marks a record for deletion, unmarks a record marked for deletion, or when DELETE is issued.

Syntax

PROCEDURE Grid.Deleted
LPARAMETERS nRecNo

Arguments

nRecNo   Returns the record number of the row being deleted.


Applies To

Grid


See Also

DELETE
DeleteMark Property


DELETED( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns a logical value that indicates whether the current record is marked for deletion.

Syntax

DELETED([cTableAlias | nWorkArea])

Returns

Logical

Arguments

cTableAlias | nWorkArea   You can check the status of the current record in a table open in another work area by specifying the work area number with nWorkArea or the table alias with cTableAlias. If a table isn’t open in the work area you specify, DELETED( ) returns false.

If you omit cTableAlias and nWorkArea, the deleted status is returned for the current record in the current work area.

Remarks

If the record is marked for deletion, DELETED( ) returns true (.T.); otherwise, DELETED( ) returns false (.F.).

Records can be marked for deletion with DELETE and DELETE - SQL, and they can be unmarked with RECALL.

Rushmore optimizes queries that test the deleted status of records if the table is indexed on DELETED( ).

For information on using Rushmore to optimize queries, see SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.


DELETED( ) Function Example

The following example opens the customer table in the testdata database. DELETE - SQL is used to mark all records for deletion where the country field contains USA. DELETED( ) is used to display all the records marked for deletion. RECALL ALL is used to unmark all the records marked for deletion.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

DELETE FROM customer WHERE country = 'USA'  && Mark for deletion

CLEAR

LIST FIELDS company, country FOR DELETED( ) && List marked records

RECALL ALL  && Unmark all records marked for deletion


See Also

DELETE
DELETE - SQL
PACK
RECALL
SET DELETED


DeleteMark Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether the delete mark column appears in a Grid control. Available at design time and run time.

Syntax

Grid.DeleteMark[ = lExpr]

Settings

lExpr   The settings for the DeleteMark property are:

Setting	Description
True (.T.)	(Default) The delete mark column appears on the Grid at the far left column.
False (.F.)	The delete mark column does not appear.
Remarks

The delete mark column enables the user to mark records for deletion. The user clicks in the delete column at the record to delete.


Applies To

Grid


See Also

DELETE
Deleted Event


DESCENDING( ) Function

Syntax         Returns        Arguments         Remarks         Example         See Also

Returns a logical value that indicates whether an index tag was created with the DESCENDING keyword or whether the DESCENDING keyword was included in USE, SET INDEX, or SET ORDER.

Syntax

DESCENDING([CDXFileName,] nIndexNumber [, nWorkArea | cTableAlias])

Returns

Logical

Arguments

CDXFileName   Specifies the name of a compound index file with CDXFileName. The compound index file you specify can be the structural compound index file automatically opened with the table or an independent compound index file.

nIndexNumber   Specifies which index tag or index file DESCENDING( ) tests. nIndexNumber is typically an integer that starts at 1 and is increased by 1 to return additional values for each index tag.

If nIndexNumber is 1, a value for the master single-entry .IDX index file or master index tag (if one is present) is returned.

As nIndexNumber increases, values for each tag in the structural compound index (if one is present) are returned. The values are returned for the tags in the order in which the tags were created in the structural compound index.

After values for all the tags in the structural compound index are returned, values for each tag in any open independent compound indexes are then returned. The values are returned from the tags in the order in which the tags are created in the independent compound indexes.

The empty string is returned if nIndexNumber is greater than the total number of open, single-entry .IDX files and structural compound and independent compound index tags.

nWorkArea | cTableAlias   Returns values for index files or tags open in a work area other than the current work area. nWorkArea specifies the work area number and cTableAlias specifies the table alias.

If no table has the alias you specify, Visual FoxPro generates an error message.

Remarks

You can order records in a table in descending order in two ways:

•	You can include the DESCENDING keyword in the INDEX command to create a descending order index tag in a compound .CDX.

•	You can include the DESCENDING keyword in USE, SET INDEX or SET ORDER to specify a descending order for the master index tag or the master single-entry index (.IDX) file.

DESCENDING( ) can determine if an index tag was created in descending order. DESCENDING( ) returns true (.T.) if the index tag you specify was created with the DESCENDING keyword.

DESCENDING( ) can also determine if the master index tag or master index file is in descending order. DESCENDING( ) returns true (.T.) if the DESCENDING keyword was included in USE, SET INDEX, or SET ORDER for the master index tag or a single-entry index (.IDX) file you specify.

If you don’t include any of the optional arguments, DESCENDING( ) returns a value for the master index tag or master index file. If you don’t include any of the optional arguments and a master index tag or .IDX file isn’t in effect (for example, you’ve issued SET ORDER TO to place the table in physical record order), DESCENDING( ) returns false (.F.).


DESCENDING( ) Function Example

The following example opens the customer table in the testdata database. FOR ... ENDFOR is used to create a loop in which the descending status of each index tag in the customer structural index is checked. The name of each structural index tag is displayed with its descending status.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE Customer	  && Open customer table

CLEAR

FOR nCount = 1 TO 254

IF !EMPTY(TAG(nCount))  && Checks for tags in the index

? TAG(nCount) + ' Descending? ' && Display tag name

?? DESCENDING(nCount)  && Display descending status

ELSE

EXIT  && Exit the loop when no more tags are found

ENDIF

ENDFOR


See Also

INDEX
SET INDEX
SET ORDER
USE


Desktop Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether a form can appear anywhere on the Windows desktop or is contained in the main Visual FoxPro window. Available at design time; read-only at run time.

Syntax

Object.Desktop[ = lExpr]

Settings

lExpr   The settings for the Desktop property are:

Setting	Description
True (.T.)	The form can be anywhere on the Windows desktop.
False (.F.)	(Default) The form is contained in the main Visual FoxPro window.
Remarks

The Desktop property is ignored if the ShowWindow property is set to 2 - As Top-Level form.


Applies To

Form, _SCREEN


See Also

AlwaysOnTop Property
AutoCenter Property
MaxHeight Property
MaxLeft Property
MaxTop Property
MaxWidth Property
MinHeight Property
MinWidth Property
ShowWindow Property


Destroy Event

Syntax         Parameters         Remarks         Applies To         See Also

Occurs when an object is released.

Syntax

PROCEDURE Object.Destroy
[LPARAMETERS nIndex]

Parameters

nIndex   Uniquely identifies a control if it is in a control array.

Remarks

The Destroy event for a container object triggers before the Destroy event for any of its contained objects; the container’s Destroy event can refer to its contained objects before they are released.


Applies To

CheckBox, ComboBox, CommandButton, Container Object, Control Object, Cursor, Custom, DataEnvironment, EditBox, Form, FormSet, Grid, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, Page, PageFrame, Relation, Shape, Spinner, TextBox, Timer, ToolBar


See Also

AddObject Method
CREATEOBJECT( )
Init Event
RELEASE


_DIARYDATE System Memory Variable
_DIARYDATE System Variable

Syntax         Arguments         Remarks         Example         See Also

Contains the current date in the Calendar/Diary.

Syntax

_DIARYDATE = dExpression

Arguments

dExpression   Specifies the date for the Calendar/Diary.

Remarks

With _DIARYDATE, you can display the Calendar/Diary with a specific date selected, or you can return the selected Calendar/Diary date.

By default, the current date is stored in _DIARYDATE. When you open the Calendar/Diary, the current date is selected. You can store a different date to _DIARYDATE so that the Calendar/Diary opens with this new date selected.

Selecting a new date when the Calendar/Diary is open causes the new date to be stored to _DIARYDATE. When you close the Calendar/Diary, _DIARYDATE contains the last selected date.


_DIARYDATE System Variable Example

In the following program example, the Calendar/Diary opens with March 28, 2001, selected and the value of _DIARYDATE appears below. July 4, 1776, is then stored to _DIARYDATE and _DIARYDATE displays again. The program then uses the DATE( ) function to select the current date, and displays _DIARYDATE.

SET CENTURY ON

STORE {03/28/2001} TO _DIARYDATE

=MESSAGEBOX(DTOC(_DIARYDATE),64)

ACTIVATE WINDOW calendar

=MESSAGEBOX("Change date to July 4, 1776",48))

STORE {07/04/1776} TO _DIARYDATE

=MESSAGEBOX(DTOC(_DIARYDATE),64)

=MESSAGEBOX("Change date to today’s date",48)

STORE DATE() TO _DIARYDATE

=MESSAGEBOX( DTOC(_DIARYDATE),64)

RELEASE WINDOW calendar


See Also

STORE


DIFFERENCE( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns an integer, 0 through 4, which represents the relative phonetic difference between two character expressions.

Syntax

DIFFERENCE(cExpression1, cExpression2)

Returns

Numeric

Arguments

cExpression1, cExpression2   Specifies the character expressions that DIFFERENCE( ) compares.

Remarks

DIFFERENCE( ) is useful for searching tables when the exact spelling of an entry isn’t known.

The more alike the two expressions are spelled, the higher the number DIFFERENCE( ) returns. If the character expressions are spelled very similarly, DIFFERENCE( ) returns 4. For two character expressions with little in common phonetically, DIFFERENCE( ) returns 0.


DIFFERENCE( ) Function Example

STORE 'Smith'   TO gcName1

STORE 'Smythe'  TO gcName2

STORE 'Smittie' TO gcName3

STORE '' TO gcName4

CLEAR

? DIFFERENCE(gcName1, gcName2)  && Displays 4

? DIFFERENCE(gcName1, gcName3)  && Displays 4

? DIFFERENCE(gcName1, gcName4)  && Displays 1


See Also

SOUNDEX( )


DIMENSION Command

Syntax         Arguments         Remarks         Example         See Also

Creates a one- or two-dimensional array of variables.

Syntax

DIMENSION ArrayName1(nRows1 [, nColumns1])
[, ArrayName2(nRows2 [, nColumns2])] ...

Arguments

ArrayName1   Specifies the name of the array. Multiple arrays can be created with a single DIMENSION command by including additional array names (ArrayName2, ArrayName3, and so on).

nRows1 [, nColumns1]   Specifies the size of the array to create. If you include just nRows1, a one-dimensional array is created. One-dimensional arrays have one column and nRows1 rows. For example, the following command creates a one-dimensional array named gaArrayOne that contains one column and ten rows.

DIMENSION gaArrayOne(10)

 To create a two-dimensional array, include both nRows1 and nColumns1. nRows1 specifies the number of rows in the array, and nColumns1 specifies the number of columns. The following example creates a two-dimensional array named gaArrayTwo containing two rows and four columns:

DIMENSION gaArrayTwo(2,4)

You must specify a size for each array you create with DIMENSION. In the following example, three arrays are created: gaArrayOne and gaArrayTwo from the previous examples and a third array called gaArrayThree:

DIMENSION gaArrayOne(10), gaArrayTwo(2,4), gaArrayThree(3,3)

You can use either brackets or parentheses to enclose the expressions in DIMENSION or DECLARE. For example, the following two commands create identical arrays:

DIMENSION gaArrayOne(10), gaArrayTwo[2,4], gaArrayThree(3,3)

DIMENSION gaArrayOne[10], gaArrayTwo(2,4), gaArrayThree[3,3]

Remarks

DIMENSION is identical in operation and syntax to DECLARE.

Array Elements…The size of an array determines how many elements it can contain. Each element in an array can store a single piece of information. To determine how many elements an array contains and how much information it can store, multiply the number of rows (nRows1) in the array by the number of columns (nColumns1) in the array.

Array elements can contain any type of data and are initialized to false (.F.) when the array is first created. You can initialize all the elements in an array to the same value with STORE if SET COMPATIBLE is FOXPLUS or OFF (the default setting). For example:

DIMENSION gaArray(10,3)

STORE 'initial' TO gaArray

Array Subscripts…Elements in an array are referenced by their subscripts. Each array element has a unique numeric subscript that identifies it. If the array is one-dimensional, an element’s subscript is the same as its row number. For example, the subscript for the element in the third row of a one-dimensional array is 3.

Elements in two-dimensional arrays are referenced by two subscripts. The first subscript indicates the row location of the element, and the second subscript indicates the column location. For example, the subscripts for the element in the third row and fourth column of a two-dimensional array are 3,4. For a further discussion of array element subscripts, see ASUBSCRIPT( ).

The subscript or subscripts for the first element in an array always start with 1. If an array is two-dimensional, it can also be referenced by a single subscript. Use AELEMENT( ) to return the single subscript from a pair of array row and column subscripts. Use ASUBSCRIPT( ) to return the row and column subscripts from a single subscript.

Redimensioning Arrays…You can change the size and dimensions of an array by issuing DIMENSION again. The size of an array can be increased or decreased, one-dimensional arrays can be converted to two dimensions, and two-dimensional arrays can be reduced to one dimension.

If the number of elements in an array is increased, the contents of all the elements in the original array are copied to the newly redimensioned array. The additional array elements are initialized to false (.F.).


Redimensioning Arrays Example

Example 1 demonstrates the result of increasing the size of a one-dimensional array. (Note that if you type these commands in the Command window the array will be PUBLIC, but it will be PRIVATE if you copy them into a program and run it.)

If the number of elements in an array is decreased, the elements and any data they contain are deleted. When a one-dimensional array is redimensioned to two dimensions, the contents of the original one-dimensional array are copied to the new array in an element-to-row order.

In Example 2, a one-dimensional array is converted to a two-dimensional array. The contents of the elements of the one-dimensional array are copied  to the first row of the new array, followed by the second row and so on. The additional elements are initialized to false (.F.).

When a two-dimensional array is converted to one dimension, the contents of the original two-dimensional array are copied to the new array in a row-to-element order. The first element in the first row becomes the first element in the one-dimensional array, the second element in the first row becomes the second element, and so on.

Use ADEL( ) or AINS( ) to delete or insert array elements, rows and columns. Use APPEND FROM ARRAY, COPY TO ARRAY, SCATTER and GATHER to transfer data between table records and arrays.

In Example 3, a two-dimensional array is created and loaded with data. The array elements and the data they contain are displayed.

* Example 1

DIMENSION marray(2)

STORE 'A' TO marray(1)

STORE 'B' TO marray(2)

CLEAR

DISPLAY MEMORY LIKE marray

DIMENSION marray(4)

DISPLAY MEMORY LIKE marray

WAIT WINDOW

* Example 2

DIMENSION marrayone(4)

STORE 'E' TO marrayone(1)

STORE 'F' TO marrayone(2)

STORE 'G' TO marrayone(3)

STORE 'H' TO marrayone(4)

CLEAR

DISPLAY MEMORY LIKE marrayone

DIMENSION marrayone(2,3)

DISPLAY MEMORY LIKE marrayone

WAIT WINDOW

* Example 3

DIMENSION sample(2,3)

STORE 'Goodbye' TO sample(1,2)

STORE 'Hello' TO sample(2,2)

STORE 99 TO sample(6)

STORE .T. TO sample(1)

CLEAR

DISPLAY MEMORY LIKE sample


See Also

ACOPY( )
ADEL( )
ADIR( )
AELEMENT( )
AFIELDS( )
AFONT( )
AINS( )
ALEN( )
APPEND FROM ARRAY
ASCAN( )
ASORT( )
ASUBSCRIPT( )
COPY TO ARRAY
DECLARE
EXTERNAL
GATHER
PRIVATE
PUBLIC
SCATTER
SET COMPATIBLE
STORE


DIR or DIRECTORY Command

Syntax         Arguments         Remarks         Example         See Also

Displays information about the files in a directory or folder.

Syntax

DIR | DIRECTORY [ON Drive]
[[LIKE] [Path] [FileSkeleton]]
[TO PRINTER [PROMPT] | TO FILE FileName]

Arguments

ON Drive   Specifies the name of the drive or volume on which the directory or folder is located.

[LIKE] [Path] [FileSkeleton]   Specifies the path to the directory or folder containing the files. The path can include the drive or volume name if you omit ON Drive.

Include FileSkeleton to display information about file types other than tables. FileSkeleton is a file specification skeleton that supports wildcards. For example, to list all program files in the current directory or folder, issue the following command:

DIR *.PRG

In Visual FoxPro, you can issue the following command to list all files without extensions:

DIR *.

TO PRINTER [PROMPT]   Directs output from DIRECTORY to a printer.

In Visual FoxPro, you can include the optional PROMPT clause to display a print dialog box before printing starts. In this dialog box you can adjust printer settings, including the number of copies and page numbers to print. The printer settings that you can adjust depend on the currently installed printer driver. Place the PROMPT keyword immediately after TO PRINTER.

TO FILE FileName   Directs output from DIRECTORY to the file specified with FileName. If the file already exists and SET SAFETY is ON, you are asked if you want to overwrite the file.

Remarks

Use DIR to display information about files.

DIR without the LIKE clause or a skeleton displays the following:

•	Names of all tables in the directory or folder.

•	Number of records in each table.

•	Date each table was last updated.

•	Size of each table in bytes (tables in the original FoxBASE format are noted as such).

•	If each table is part of a database.

•	The total size in bytes the tables occupy on disk (not including associated .FPT memo files).

•	Number of tables displayed.

•	Total number of bytes remaining on the disk.

The table information for the default drive or volume and directory or folder is displayed unless otherwise specified with Drive or Path or both.


DIR or DIRECTORY Command Example

CLEAR

DIR  && Display tables in the current directory or folder

DIR *.CDX   && Display index files in the current directory or folder

DIR A*.DBF  && Display tables that begin with A

DIR *.*  && Display all files, including those without extensions


See Also

DISPLAY FILES


DIRECTORY( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns true (.T.) if the specified directory is found on disk.

Syntax

DIRECTORY(cDirectoryName)

Returns

Logical

Arguments

cDirectoryName   Specifies the name of the directory to locate. If you do not include an absolute path for the directory you specify, Visual FoxPro searches for the directory relative to the Visual FoxPro default directory.

Remarks

The Visual FoxPro default directory is specified with SET DEFAULT.


See Also

FILE( ), GETDIR( ), GETFILE( ), SET DEFAULT


DisabledBackColor, DisabledForeColor Properties

Syntax         Settings         Remarks         Applies To         See Also

Specifies the background and foreground colors for a disabled control. Available at design time and run time.

Syntax

Control.DisabledBackColor[ = nColor]

 – Or –

Control.DisabledBackColor = RGB(nRedValue, nGreenValue, nBlueValue)

Control.DisabledForeColor[ = nColor]

 – Or –

Control.DisabledForeColor = RGB(nRedValue, nGreenValue, nBlueValue)

Settings

nColor   Specifies a single number to represent the color.

nRedValue, nGreenValue, nBlueValue   Specifies three separate color intensities that compose the control’s foreground color or background color; must be used with RGB( ) to consolidate the three color components into one number.

Remarks

The color you specify is dithered with gray.

Note   In the Properties window, you can double-click any of the color properties to display the Color dialog box. You can choose or define colors from this dialog box. The red, green, and blue intensities that correspond to the color you choose become the settings for these properties after you close the Color dialog box.


Applies To

CheckBox, ComboBox, CommandButton, EditBox, Label, ListBox, OptionButton, Spinner, TextBox

Note   The DisabledBackColor property does not apply to CommandButton controls.


See Also

BackColor
ForeColor Properties
Colors Overview


DisabledItemBackColor, DisabledItemForeColor Properties

Syntax         Settings         Applies To         See Also

Specifies the background or foreground color for the disabled items in a ComboBox or ListBox control. Available at design time and run time.

Syntax

Control.DisabledItemBackColor[ = nColor]

 – Or –

Control.DisabledItemBackColor RGB(nRedValue, nGreenValue, nBlueValue)

Control.DisabledItemForeColor[ = nColor]

 – Or –

Control.DisabledItemForeColor RGB(nRedValue, nGreenValue, nBlueValue)

Settings

nColor   Specifies a single number to represent the color.

Note   In the Properties window, you can double-click any of the color properties to display the Color dialog box. You can choose or define colors from this dialog box. The red, green, and blue intensities that correspond to the color you choose become the settings for these properties after you close the Color dialog box.

For more information, see the color table in the BackColor, ForeColor Properties topic.


Applies To

ComboBox, ListBox


See Also

BackColor
ForeColor Properties
DisabledForeColor
DisabledBackColor Properties
RGB( )
SelectedBackColor
SelectedForeColor Properties
SelectedItemBackColor
SelectedItemForeColor Properties


DisabledPicture Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the graphic to display when the control is disabled. Available at design time and run time.

Syntax

Control.DisabledPicture[ = cPicture]

Settings

cPicture   Specifies either a complete path and file name of a bitmap or the name of a general field in a database table.

Remarks

If you set the DisabledPicture property at design time and the file you specify does not exist, Visual FoxPro displays an error message, but the property remains set to the file you specified. Visual FoxPro ignores the DisabledPicture property at run time if it is set to a file that does not exist.

If you do not set the DisabledPicture property, Visual FoxPro uses the Picture property setting to determine the graphic displayed when the control is disabled.

For CommandButton controls, the Style property must be set to 0 (Standard) for the bitmap to be displayed on the control; For CheckBox and OptionButton controls, the Style property must be set to 1 (Graphical).


Applies To

CheckBox, CommandButton, OptionButton


See Also

DownPicture Property
Enabled Property
Picture Property
Style Property


DISKSPACE( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the number of bytes available on the default or specified disk drive or volume.

Syntax

DISKSPACE([cVolumeName])

Returns

Numeric

Arguments

cVolumeName   Specifies the name of the disk drive or volume for which the available space is returned. If cVolumeName is omitted, the available space is returned for the default disk drive or volume.

Remarks

This function is useful for determining whether sufficient space is available to back up files or to execute commands such as SORT that require additional disk space for temporary work files.

The default disk drive or volume is specified with SET DEFAULT.

DISKSPACE( ) returns -1 if there is an error reading the disk drive or volume. On some networks, the value returned by DISKSPACE( ) may not be accurate for large network drives.


DISKSPACE( ) Function Example

The following example uses DISKSPACE( ) to determine whether sufficient disk space is available to perform a sort.

*** Check DISKSPACE before sort ***

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

*** Get size of table header ***

gnTableHead = HEADER( )

*** Calculate size of table ***

gnFileSize = gnTableHead + (RECSIZE( ) * RECCOUNT( ) + 1)

IF DISKSPACE( ) > (gnFileSize * 3)

WAIT WINDOW 'Sufficient diskspace to sort.'

ELSE

WAIT WINDOW 'Insufficient diskspace. Sort cannot be done.'

ENDIF


See Also

HEADER( )
RECSIZE( )
SET DEFAULT


DISPLAY Command

Syntax         Arguments         Remarks         Example         See Also

Displays information about the current table in the main Visual FoxPro window or in the user-defined window.

Syntax

DISPLAY
[[FIELDS] FieldList]
[Scope] [FOR lExpression1] [WHILE lExpression2]
[OFF]
[NOCONSOLE]
[NOOPTIMIZE]
[TO PRINTER [PROMPT] | TO FILE FileName]

Arguments

FIELDS FieldList   Specifies the fields to display. If you omit FIELDS FieldList, all fields from the table are displayed by default.

Memo field contents aren’t displayed unless the memo field name is explicitly included in the field list. The displayed width of memo fields is determined by SET MEMOWIDTH.

Scope   Specifies the range of records to display. Only the records that fall within the range are displayed. The scope clauses are: ALL, NEXT nRecords, RECORD nRecordNumber, and REST. Commands that include Scope operate only on the table in the active work area.

For more information on scope clauses, see the Scope Clauses topic.

The default scope for DISPLAY is the current record (NEXT 1).

FOR lExpression1   Specifies that only the records that satisfy the logical condition lExpression1 are displayed. This allows you to filter out undesired records.

Rushmore optimizes a query created with DISPLAY ... FOR if lExpression1 is an optimizable expression. For best performance, use an optimizable expression in the FOR clause.

For more information, see SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

WHILE lExpression2   Specifies a condition whereby records are displayed for as long as the logical expression lExpression2 evaluates to true (.T.).

OFF   Suppresses the display of record numbers. If you omit OFF, the record number is displayed before each record.

NOCONSOLE   Suppresses output to the main Visual FoxPro window or to the active user-defined window.

NOOPTIMIZE   Disables Rushmore optimization of DISPLAY.

For more information, see SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

TO PRINTER [PROMPT]   Directs output from DISPLAY to a printer.

In Visual FoxPro you can include the optional PROMPT clause to display a dialog box before printing starts. In this dialog box, you can adjust printer settings, including the number of copies and page numbers to print. The printer settings that you can adjust depend on the currently installed printer driver. Place PROMPT immediately after TO PRINTER.

TO FILE FileName   Directs output from DISPLAY to the file specified with FileName. If the file already exists and SET SAFETY is ON, you are asked if you want to overwrite the file.

Remarks

DISPLAY displays the contents of records and the results of expressions for the current table. If there is more information than can be displayed in the window, the first screen of information is displayed and Visual FoxPro pauses. Press any key or click anywhere to see the next screen of information. DISPLAY is similar to LIST, except that LIST displays the same information in a continuous stream without pausing.

DISPLAY can also be used to display the results of expressions, which can consist of combinations of literals, memory variables, array elements, fields, and memo fields. Field names and expressions are displayed if SET HEADINGS is ON.


DISPLAY Command Example

The following example opens the customer table in the testdata database. The contents of the first record are displayed.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

CLEAR

DISPLAY FIELD cust_id, company, contact OFF NEXT 10


See Also

LIST
SET HEADINGS
SET MEMOWIDTH


DISPLAY CONNECTIONS Command

Syntax         Arguments         Remarks         Example         See Also

Displays information about the named connections in the current database.

Syntax

DISPLAY CONNECTIONS
[TO PRINTER [PROMPT] | TO FILE FileName]
[NOCONSOLE]

Arguments

TO PRINTER [PROMPT]   Directs output from DISPLAY CONNECTIONS to a printer.

In Visual FoxPro, you can include the optional PROMPT clause to display a Print dialog box before printing starts. Place PROMPT immediately after TO PRINTER.

TO FILE FileName   Directs output from DISPLAY CONNECTIONS to the file specified with FileName. If the file already exists and SET SAFETY is ON, Visual FoxPro displays a prompt asking if you want to overwrite the file.

NOCONSOLE   Suppresses output to the main Visual FoxPro window or to the active user-defined window.

Remarks

DISPLAY CONNECTIONS displays the connection names, datasource, and connection string in the current database. Use DBGETPROP( ) to return additional information about connections in the current database.


DISPLAY CONNECTIONS Command Example

The following example assumes an ODBC data source called MyFoxSQLNT is available, and the user ID for the data source is “sa.” The testdata database is opened, and a connection named Myconn is created. DISPLAY CONNECTIONS is used to display the named connections in the database.

CLOSE DATABASES

OPEN DATABASE (SYS(2004) + 'samples\data\testdata')

CREATE CONNECTION Myconn DATASOURCE "MyFoxSQLNT" USERID "sa"

CLEAR

DISPLAY CONNECTIONS	  && Displays named connections in the database


See Also

CREATE CONNECTION
DELETE CONNECTION
DBGETPROP( )
LIST CONNECTIONS
RENAME CONNECTION


DISPLAY DATABASE Command

Syntax         Arguments         Remarks         Example         See Also

Displays information about the current database or fields, named connections, tables, or views in the current database.

Syntax

DISPLAY DATABASE
[TO PRINTER [PROMPT] | TO FILE FileName]
[NOCONSOLE]

Arguments

TO PRINTER [PROMPT]   Directs output from DISPLAY DATABASE to a printer.

In Visual FoxPro, you can include the optional PROMPT clause to display a Print dialog box before printing starts. Place PROMPT immediately after TO PRINTER.

TO FILE FileName   Directs output from DISPLAY DATABASE to the file specified with FileName. If the file already exists and SET SAFETY is ON, Visual FoxPro displays a prompt asking if you want to overwrite the file.

NOCONSOLE   Suppresses output to the main Visual FoxPro window or to the active user-defined window.

Remarks

Use DBGETPROP( ) to return additional information about the current database.


DISPLAY DATABASE Command Example

The following example creates a database named people. A table named friends is created and is automatically added to the database. DISPLAY TABLES is used to display the tables in the database, and DISPLAY DATABASES is used to display information about the tables in the database.

CREATE DATABASE people

CREATE TABLE friends (FirstName C(20), LastName C(20))

CLEAR

DISPLAY TABLES  && Displays tables in the database

DISPLAY DATABASES  && Displays table information


See Also

LIST DATABASE


DISPLAY DLLS Command

Syntax         Arguments         See Also

Displays information about shared library functions registered in Visual FoxPro with DECLARE - DLL.

Syntax

DISPLAY DLLS
[TO PRINTER [PROMPT] | TO FILE FileName]
[NOCONSOLE]

Arguments

TO PRINTER [PROMPT]   Directs output from DISPLAY DLLS to a printer.

In Visual FoxPro, you can include the optional PROMPT clause to display a Print dialog box before printing starts. Place PROMPT immediately after TO PRINTER.

TO FILE FileName   Directs output from DISPLAY DLLS to the file specified with FileName. If the file already exists and SET SAFETY is ON, Visual FoxPro displays a prompt asking if you want to overwrite the file.

NOCONSOLE   Suppresses output to the main Visual FoxPro window or to the active user-defined window.


See Also

DECLARE - DLL
LIST DLLS


DISPLAY FILES Command

Syntax         Arguments         Remarks         Example         See Also

Displays information about files.

Syntax

DISPLAY FILES
[ON Drive]
[LIKE FileSkeleton]
[TO PRINTER [PROMPT] | TO FILE FileName]

Arguments

ON Drive   Specifies the drive or volume on which the files reside.

LIKE FileSkeleton   Specifies a condition whereby Visual FoxPro displays information only about files that match the skeleton pattern FileSkeleton. The skeleton pattern can contain wildcards such as ? and *.

TO PRINTER [PROMPT]   Directs output from DISPLAY FILES to a printer.

In Visual FoxPro, you can include the optional PROMPT clause to display a dialog box before printing starts. In this dialog box, you can adjust printer settings, including the number of copies and page numbers to print. The printer settings that you can adjust depend on the currently installed printer driver. Place the PROMPT keyword immediately after TO PRINTER.

TO FILE FileName   Directs output from DISPLAY FILES to the file specified with FileName. If the file already exists and SET SAFETY is ON, you are asked if you want to overwrite the file.

Remarks

Use DISPLAY FILES to display information about files residing on a disk. You can display information about all files on a specified drive, volume, directory, or folder, or only files that match a skeleton pattern containing wildcards such as ? and *.

Issuing DISPLAY FILES without any arguments displays information about tables in the current directory or folder. The information displayed includes the following:

•	Table name

•	Number of records in the table

•	Date and time of the last update to the table

•	The size of each table in bytes.

•	If each table is part of a database.


DISPLAY FILES Command Example

The following example displays the names of the databases in the SAMPLES\DATA directory.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

CLEAR

DISPLAY FILES LIKE *.DBC


See Also

DIR or DIRECTORY
LIST


DISPLAY MEMORY Command

Syntax         Arguments         Remarks         Example         See Also

Displays the current contents of variables and arrays.

Syntax

DISPLAY MEMORY
[LIKE FileSkeleton]
[TO PRINTER [PROMPT] | TO FILE FileName]
[NOCONSOLE]

Arguments

LIKE FileSkeleton   Displays information about variables and arrays that match the skeleton pattern FileSkeleton. If you include LIKE FileSkeleton, Visual FoxPro displays only the contents of variables and arrays that match FileSkeleton. FileSkeleton supports wildcards such as ? and *. For example, to display all variables that begin with the letter A, issue:

DISPLAY MEMORY LIKE A*

TO PRINTER [PROMPT]   Directs output from DISPLAY MEMORY to a printer.

You can include the optional PROMPT clause to display a dialog box before printing starts. In this dialog box, you can adjust printer settings, including the number of copies and page numbers to print. The printer settings that you can adjust depend on the currently installed printer driver. Place the PROMPT keyword immediately after TO PRINTER.

TO FILE FileName   Directs output from DISPLAY MEMORY to the file specified with FileName. If the file already exists and SET SAFETY is ON, you are asked if you want to overwrite the file.

NOCONSOLE   Suppresses output to the main Visual FoxPro window or to the active user-defined window.

Remarks

DISPLAY MEMORY shows the name, type, contents, and status of all currently defined variables and variable arrays. It also displays the number of variables defined, the number of bytes used, and the number of additional variables available. Note that the number of bytes used represents memory used by character type variables. Character type variables are the only type of variables that require additional memory beyond that allocated by the variable count specified with the MVCOUNT configuration item.

Information about system variables, menus, menu bars, menu titles, and windows is also displayed.


DISPLAY MEMORY Command Example

In the following example, several variables are created and assigned values. DISPLAY MEMORY first displays all variables that begin with “sam” and then displays all variables that contain five letters and end with “exit.”

STORE 'Goodbye' TO sample1

STORE 'Hello' TO sample2

STORE .T. TO texit

STORE .F. TO mexit

CLEAR

DISPLAY MEMORY LIKE sam*

DISPLAY MEMORY LIKE ?exit


See Also

DECLARE
DIMENSION
LIST
STORE


DISPLAY OBJECTS Command

Syntax         Arguments         Remarks         Example         See Also

Displays information about an object or a group of objects.

Syntax

DISPLAY OBJECTS
[LIKE cObjectSkeleton]
[TO PRINTER [PROMPT] | TO FILE FileName]
[NOCONSOLE]

Arguments

LIKE cObjectSkeleton   Displays information about a subset of objects. cObjectSkeleton is an object specification skeleton that supports wildcards (* and ?). For example, to display all objects that begin with A, use the following command:

DISPLAY OBJECTS LIKE A*

TO PRINTER [PROMPT]   Directs output from DISPLAY OBJECTS to a printer.

You can include the optional PROMPT clause to display a Print dialog box before printing starts. Place the PROMPT keyword immediately after TO PRINTER.

TO FILE FileName   Directs output from DISPLAY OBJECTS to the file specified with FileName. If the file already exists and SET SAFETY is ON, Visual FoxPro displays a prompt asking if you want to overwrite the file.

NOCONSOLE   Suppresses output to the main Visual FoxPro window or to the active user-defined window.

Remarks

DISPLAY OBJECTS displays the following information about all existing objects:

•	Properties and their values

•	Methods

•	Member objects and the class or subclass on which they are based

•	Class or subclass on which objects are based

•	Class hierarchy for the objects

DISPLAY OBJECTS fills the entire main Visual FoxPro window or user-defined window with information and then pauses. Press any key or click anywhere to see the next set of information. DISPLAY is similar to LIST, except that LIST displays the same information in a continuous stream without pausing.


DISPLAY OBJECTS Command Example

The following example uses DEFINE CLASS and CREATEOBJECT( ) to create two custom classes named FormChild and FormGrandChild from the Visual FoxPro Form base class. DISPLAY OBJECTS displays information about the objects and their properties.

CLEAR

frmMyForm = CREATEOBJECT("FormGrandChild")

DISPLAY OBJECTS LIKE frm*

RELEASE frmMyForm

DEFINE CLASS FormChild AS FORM

ENDDEFINE

DEFINE CLASS FormGrandChild AS FormChild

ENDDEFINE


See Also

LIST OBJECTS


DISPLAY PROCEDURES Command

Syntax         Arguments         Remarks         Example         See Also

Displays the names of procedures stored in the current database.

Syntax

DISPLAY PROCEDURES
[TO PRINTER [PROMPT] | TO FILE FileName]
[NOCONSOLE]

Arguments

TO PRINTER [PROMPT]   Directs information returned from DISPLAY PROCEDURES to a printer.

You can include PROMPT to display a Print dialog box before printing starts. Place the PROMPT keyword immediately after TO PRINTER.

TO FILE FileName   Directs output from DISPLAY PROCEDURES to the file specified with FileName. If the file already exists and SET SAFETY is ON, Visual FoxPro displays a prompt asking if you want to overwrite the file.

NOCONSOLE   Suppresses output to the main Visual FoxPro window or to the active user-defined window.

Remarks

Stored procedures are created with APPEND PROCEDURES, COPY PROCEDURES, or MODIFY PROCEDURE.


DISPLAY PROCEDURES Command Example

The following example opens the testdata database, and uses DISPLAY PROCEDURES to display the stored procedures (if any) in the database. If there are no stored procedures in the database, you can run the example for APPEND PROCEDURES to add a procedure to database.

CLOSE DATABASES

OPEN DATABASE (SYS(2004) + 'samples\data\testdata')

CLEAR

DISPLAY PROCEDURES  && Displays stored procedures in the database


See Also

APPEND PROCEDURES
COPY PROCEDURES
CREATE DATABASE
DISPLAY DATABASE
LIST PROCEDURES
MODIFY PROCEDURE


DISPLAY STATUS Command

Syntax         Arguments         Remarks         See Also

Displays the status of the Visual FoxPro environment.

Syntax

DISPLAY STATUS
[TO PRINTER [PROMPT] | TO FILE FileName]
[NOCONSOLE]

Arguments

TO PRINTER [PROMPT]   Directs output from DISPLAY STATUS to a printer.

You can include the optional PROMPT clause to display a print dialog box before printing starts. In this dialog box, you can adjust printer settings, including the number of copies and page numbers to print. The printer settings that you can adjust depend on the currently installed printer driver. Place the PROMPT keyword immediately after TO PRINTER.

TO FILE FileName   Directs output from DISPLAY STATUS to the file specified with FileName. If the file already exists and SET SAFETY is ON, you are asked if you want to overwrite the file.

NOCONSOLE   Suppresses output to the main Visual FoxPro window or to the active user-defined window.

Remarks

This form of DISPLAY lists information about the current Visual FoxPro environment. The categories of information and the information in each category are as follows.

Table and index file information:

•	Open tables

•	Open memo files

•	Table aliases

•	Table code pages

•	Table relations

•	Active indexes

•	Index file keys

•	The controlling index file or tag

•	Open structural compound files

•	Open compound index tags

•	The shared attribute status of each open table

•	The currently locked records in each table

•	The EXCLUSIVE use setting

•	The LOCK setting

•	The MULTILOCKS setting

•	The SET REFRESH value

•	The SET REPROCESS value

Open low-level file information:

•	Open low-level files

•	The file handle number for each low-level file

•	The file pointer position for each low-level file

•	Read-write attributes for each low-level file

Additional Visual FoxPro environment information:

•	The procedure file in use

•	The processor type

•	The Visual FoxPro path

•	The Visual FoxPro default directory or folder

•	The print destination

•	The margin setting

•	The current work area

•	SET command settings

•	Binary modules currently loaded

•	DDE information in Visual FoxPro

•	Current code page

•	Current collating sequence

•	Compiler code page

•	Current date format

•	Keyboard macro key combination

•	How UDF parameters are passed

•	Textmerge options

•	External registered shared library functions, such as those from Windows dynamic link libraries (DLLs) or Macintosh Apple Shared Library Manager (ASLM) or Code Fragment Manager (CFM) libraries.


See Also

LIST


DISPLAY STRUCTURE Command

Syntax         Arguments         Remarks         Example         See Also

Displays the structure of a table file.

Syntax

DISPLAY STRUCTURE
[IN nWorkArea | cTableAlias]
[TO PRINTER [PROMPT] | TO FILE FileName]
[NOCONSOLE]

Arguments

IN nWorkArea | cTableAlias   Displays the structure of the table in a work area other than the current work areas. nWorkArea specifies the work area number and cTableAlias specifies the table alias.

TO PRINTER [PROMPT]   Directs output from DISPLAY STRUCTURE to a printer.

You can include the optional PROMPT clause to display a dialog box before printing starts. In this dialog box, you can adjust printer settings, including the number of copies and page numbers to print. The printer settings that you can adjust depend on the currently installed printer driver. Place the PROMPT keyword immediately after TO PRINTER.

TO FILE FileName   Directs output from DISPLAY STRUCTURE to the file specified with FileName. If the file already exists and SET SAFETY is ON, you are asked if you want to overwrite the file.

NOCONSOLE   Suppresses output to the main Visual FoxPro window or to the active user-defined window.

Remarks

Use DISPLAY STRUCTURE to display the field structure of a table. The name of each field in the table is displayed with its type and width. If a field is a Numeric, Double, or Float type field, the number of decimal places in the field is displayed. Null value support for each field is also displayed.

DISPLAY STRUCTURE also displays the current number of records in the table and the date it was last updated. If the table has an associated memo field, the memo field block size is shown. The total width of all fields is also displayed, as is the table’s code page.

The table can have a structural compound index that is opened with the table. If a tag in the structural compound index has the same name as a field in the table, the order of the tag (ascending or descending) and the tag’s collation sequence is displayed next to the field name.

If SET FIELDS is used to limit access to fields in the table, an angle bracket (>) appears beside the names of fields that can be accessed.


DISPLAY STRUCTURE Command Example

In the following example, the customer table in the testdata database is opened. DISPLAY STRUCTURE is used to display the table structure.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

CLEAR

DISPLAY STRUCTURE


See Also

LIST


DISPLAY TABLES Command

Syntax         Arguments         Remarks         Example         See Also

Displays names and information about all the tables contained in the current database.

Syntax

DISPLAY TABLES
[TO PRINTER [PROMPT] | TO FILE FileName]
[NOCONSOLE]

Arguments

TO PRINTER [PROMPT]   Directs output from DISPLAY TABLES to a printer.

You can include PROMPT to display a Print dialog box before printing starts. Place the PROMPT keyword immediately after TO PRINTER.

TO FILE FileName   Directs output from DISPLAY TABLES to the file specified with FileName. If the file already exists and SET SAFETY is ON, Visual FoxPro displays a prompt asking if you want to overwrite the file.

NOCONSOLE   Suppresses output to the main Visual FoxPro window or to the active user-defined window.

Remarks

The information returned is a subset of the information shown using DISPLAY STATUS. However, the information displayed using DISPLAY TABLES contains only table-related information and displays the information regardless of whether the tables are open or not.

The following information is displayed:

•	Table name

•	Table path


DISPLAY TABLES Command Example

The following example opens the customer table in the testdata database. DISPLAY TABLES is used to display information about the tables in the database.

CLOSE DATABASES

SET PATH TO (SYS(2004) + 'samples\data\')	&& Sets path to database

OPEN DATABASE testdata  && Open testdata database

CLEAR

DISPLAY TABLES  && Displays information about tables in the database


See Also

ADD TABLE
CLOSE DATABASES
CREATE DATABASE
LIST TABLES
OPEN DATABASE
REMOVE TABLE


DISPLAY VIEWS Command

Syntax         Arguments         Remarks         Example         See Also

Displays information about SQL views in the current database and indicates whether the SQL views are based on local or remote tables.

Syntax

DISPLAY VIEWS
[TO PRINTER [PROMPT] | TO FILE FileName]
[NOCONSOLE]

Arguments

TO PRINTER [PROMPT]   Directs output from DISPLAY VIEWS to a printer.

You can include PROMPT to display the Print dialog box before printing starts. Place the PROMPT keyword immediately after TO PRINTER.

TO FILE FileName   Directs output from DISPLAY VIEWS to the file specified with FileName. If the file already exists and SET SAFETY is ON, Visual FoxPro displays a prompt asking if you want to overwrite the file.

NOCONSOLE   Suppresses output to the main Visual FoxPro window or to the active user-defined window.

Remarks

Use DBGETPROP( ) to return additional information about SQL views in the current database.

SQL views are created with CREATE SQL VIEW.


DISPLAY VIEWS Command Example

The following example opens the testdata database. CREATE SQL VIEW is used to create a local SQL view named myview. The View Designer is displayed, allowing you to specify tables and conditions for the SQL view. After you save the SQL view you create, information about the SQL views in the database is displayed.

CLOSE DATABASES

OPEN DATABASE (SYS(2004) + 'samples\data\testdata')

CREATE SQL VIEW myview

CLEAR

DISPLAY VIEWS


See Also

CREATE DATABASE
CREATE SQL VIEW
DBGETPROP( )
DISPLAY DATABASE
LIST VIEWS


DisplayValue Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the contents of the first column of the selected item in a ListBox or ComboBox control. Available at design time and run time.

Syntax

[Form.]Control.DisplayValue[ = Expr]

Settings

Expr   If DisplayValue is a character string, specifies the value of the first column of the selected item. If DisplayValue is numeric, specifies the index of the selected item.

Remarks

Use the DisplayValue property when a ComboBox or ListBox has more than one column and the control’s BoundColumn property is set to a value greater than 1. The text displayed in the text box portion of the ComboBox is specified by DisplayValue when DisplayValue is a character string.

Note   When a ComboBox or ListBox has only one column, the DisplayValue property and Value property of the control have the same setting if both contain character strings.


Applies To

ComboBox, ListBox


See Also

BoundColumn Property
Value Property


DMY( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns a character expression in day-month-year format (for example, 31 May 1996) from a Date or DateTime expression. The month name isn’t abbreviated.

Syntax

DMY(dExpression | tExpression)

Returns

Character

Arguments

dExpression   Specifies the Date expression from which DMY( ) returns a character string in day-month-year format.

tExpression   Specifies the DateTime expression from which DMY( ) returns a character string in day-month-year format.

Remarks

If SET CENTURY is OFF, DMY( ) returns a character string in a dd Month yy format (for example, 16 February 96). If SET CENTURY is ON, the format is dd-Month-yyyy (for example, 16 February 1996).


DMY( ) Function Example

CLEAR

SET CENTURY OFF

? DMY(DATE( ))

SET CENTURY ON

? DMY(DATE( ))


See Also

MDY( )
SET CENTURY
SET DATE


DO Command

Syntax         Arguments         Remarks         See Also

Executes a Visual FoxPro program or procedure.

Syntax

DO ProgramName1 | ProcedureName
[IN ProgramName2]
[WITH ParameterList]

Arguments

ProgramName1   Specifies the name of the program to execute.

If you don’t include an extension with the program you execute, Visual FoxPro looks for and executes these versions of the program in the following order:

•	.EXE (executable version)

•	.APP (an application)

•	.FXP (compiled version)

•	.PRG (program)

To use DO to execute a specific menu program, form program, or query, you must include its extension (.MPR, .SPR, or .QPR).

ProcedureName   Specifies the name of the procedure to execute. Visual FoxPro first looks for the procedure in the currently executing program. If the procedure is not located there, Visual FoxPro then looks for the procedure in the procedure files opened with SET PROCEDURE.

You can include the IN ProgramName2 clause to tell Visual FoxPro to look for the procedure in a file you specify.

Multiple procedures within an executable (.EXE) version or an application (.APP) can have the same name. When you use DO to start a procedure in an executable version or in an application, Visual FoxPro searches only the main program of the executable version or application for the specified procedure.

IN ProgramName2   Executes a procedure in the program file specified with ProgramName2.

When the file is located, the procedure is executed. If the program file cannot be located, the message “File does not exist” appears. If the program file is located but the specified procedure isn’t in the program file, the message “Procedure is not found” appears.

WITH ParameterList   Specifies parameters to pass to the program or procedure. The parameters listed in ParameterList can be expressions, memory variables, literals, fields, or user-defined functions. By default, parameters are passed to programs and procedures by reference. You can pass a parameter by value by placing it in parentheses.

See SET UDFPARMS for a discussion of passing parameters by value or reference. The maximum number of parameters you can pass to a program or procedure is 27. For more information on parameter passing, see LPARAMETERS and PARAMETERS.

Remarks

DO executes a Visual FoxPro program or procedure in a program or procedure file. A program file can itself contain additional DO commands, allowing you to nest DO commands up to 128 levels.

When you use DO to run a program, the commands contained in the program file are executed until one of the following occurs:

•	RETURN is encountered.

•	CANCEL is executed.

•	Another DO is issued.

•	The end of the file is reached.

•	QUIT is executed.

When program execution is complete, control is returned to one of the following:

•	The calling program.

•	The Command window.

•	The operating system.

If you choose Do from the Program menu and execute a program in a directory on a drive other than the current directory or drive, Visual FoxPro automatically changes the default directory  and drive to the directory  and drive containing the program.

If you choose Do from the Program menu and execute a program in a folder in a volume other than the current folder or volume, Visual FoxPro automatically changes the default folder and volume to the folder and volume containing the program.


See Also

CLEAR
LPARAMETERS
PARAMETERS
PARAMETERS( )
PRIVATE
PROCEDURE
PUBLIC
SET DEFAULT
SET DEVELOPMENT
SET PATH
SET PROCEDURE


DO CASE ... ENDCASE Command

Syntax         Arguments         Remarks         Example         See Also

Executes the first set of commands whose conditional expression evaluates to true (.T.).

Syntax

DO CASE
CASE lExpression1
Commands
[CASE lExpression2
Commands
 ...
CASE lExpressionN
Commands]
[OTHERWISE
Commands]
ENDCASE

Arguments

CASE lExpression1 Commands ...   When the first true (.T.) CASE expression is encountered, the set of commands following it is executed. Execution of the set of commands continues until the next CASE or ENDCASE is reached. Execution then resumes with the first command following ENDCASE.

If a CASE expression is false (.F.), the set of commands following it up to the next CASE clause is ignored.

Only one set of commands is executed. These are the first commands whose CASE expression evaluates to true (.T.). Any succeeding true (.T.) CASE expressions are ignored.

OTHERWISE Commands   If all of the CASE expressions evaluate to false (.F.), OTHERWISE determines if an additional set of commands is executed.

•	If you include OTHERWISE, the commands following OTHERWISE are executed and execution skips to the first command following ENDCASE.

•	If you omit OTHERWISE, execution skips to the first command following ENDCASE.

Remarks

DO CASE is used to execute a set of Visual FoxPro commands based on the value of a logical expression. When DO CASE is executed, successive logical expressions are evaluated; the values of the expressions determine which set of commands is executed.

Comments can be placed after DO CASE and ENDCASE on the same line. The comments are ignored during program compilation and execution.


DO CASE ... ENDCASE Command Example

In this example, Visual FoxPro evaluates each CASE clause until the MONTH variable is found in one of the lists. The appropriate string is stored  to the variable rpt_title and the DO CASE structure is exited.

STORE CMONTH(DATE( )) TO month  && The month today

DO CASE  && Begins loop

CASE INLIST(month,'January','February','March')

STORE 'First Quarter Earnings' TO rpt_title

CASE INLIST(month,'April','May','June')

STORE 'Second Quarter Earnings' TO rpt_title

CASE INLIST(month,'July','August','September')

STORE 'Third Quarter Earnings' TO rpt_title

OTHERWISE

STORE 'Fourth Quarter Earnings' TO rpt_title

ENDCASE  && Ends loop

WAIT WINDOW rpt_title NOWAIT


See Also

DO WHILE ... ENDDO
EXIT
FOR ... ENDFOR
IF ... ENDIF
IIF( )
SCAN ... ENDSCAN


DoCmd Method

Syntax         Settings         Remarks          See Also

Executes a Visual FoxPro command for an instance of the Visual FoxPro application automation server.

Syntax

ApplicationObject.DoCmd(cCommand)

Settings

cCommand   Specifies the Visual FoxPro command to execute.

Remarks

cCommand must evaluate to a legal Visual FoxPro command.


Applies To

Application Object, _VFP System Variable


See Also

DO, Eval Method, SetVar Method


DODEFAULT( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Executes, from within a subclass, the parent class event or method of the same name.

Syntax

DODEFAULT([eParameter1 [, eParameter2] …])

Returns

Character, Numeric, Currency, Date, DateTime, Logical, or Memo

Arguments

eParameter1 [, eParameter2] …   Specifies parameters that are passed to the parent class event or method.

Remarks

DODEFAULT( ) executes, from within a subclass, the parent class event or method of the same name. For example, if DODEFAULT( ) is placed in the Click event of a subclass, the Click event of the parent class is executed. The :: scope resolution operator, unlike DODEFAULT( ), executes a parent class event or method of a different name.

The value DODEFAULT( ) returns is detemined by the return value of the event or method.

Note that DODEFAULT( ) can be placed only within an event or method.


See Also

:: Scope Resolution Operator


DOEVENTS Command

Syntax         Remarks          See Also

Executes all pending Windows events.

Syntax

DOEVENTS

Remarks

Window events are placed in a queue when the AutoYield property is set to false (.F.) and program code is executing. DOEVENTS executes all pending Windows events and processes any user code associated with the Windows events.


See Also

AutoYield Property


DO FORM Command

Syntax         Arguments         Remarks         Example         See Also

Runs a compiled form or form set created with the Form Designer.

Syntax

DO FORM FormName | ?
[NAME VarName [LINKED]]
[WITH cParameterList]
[TO VarName]
[NOREAD] [NOSHOW]

Arguments

FormName   Specifies the name of the form or form set to run.

?   Displays the Do dialog box from which you can choose a form or form set to run.

NAME VarName [LINKED]   Specifies a variable or array element with which you can reference the form or form set. If you specify a variable that doesn’t exist, Visual FoxPro automatically creates it. If you specify an array element, the array must exist before you issue DO FORM. If the variable or array element you specify already exists, its contents are overwritten.

If you omit the NAME clause, Visual FoxPro creates an object type variable with the same name as the form or form set file.

Include LINKED to link the form to the variable associated with it so that the form is released when the variable goes out of scope. If you don’t include LINKED, a form can still be active, even though there is no object variable associated with the form.

WITH cParameterList   Specifies the parameters passed to the form or form set.

If a form is run, the parameters are passed to the form’s Init method.

If a form set is run, the parameters are passed to the form set’s Init method if the form set’s WindowType property is set to ModeLess (0) or Modal (1). The parameters are passed to the Setup1 method if the form set’s WindowType property is set to Read (2) or ReadModal (3).

TO VarName   Specifies a variable to hold a value returned from the form. If the variable doesn’t exist, Visual FoxPro automatically creates it. Use the RETURN command in the Unload event procedure of the form to specify the return value. If you do not include a return value, the default value of true (.T.) is returned. If you use TO, the WindowType property of the form must be set to 1 (Modal).

NOREAD   Specifies that the form set is created and displayed, even though controls are not activated until READ is issued. NOREAD is ignored if the form set object’s WindowType property is not set to 2 (Read).

NOSHOW   Specifies that the form’s Show method isn’t called when the form is run. When you include NOSHOW and run the form, the form is not visible until the form’s Visible property is set to true (.T.) or the form’s Show method is called.

Remarks

DO FORM executes the Show method for the form or form set.


DO FORM Command Example

The following example runs the stop watch (SWATCH.SCX) control sample.

DO FORM (HOME( ) + 'samples\solution\controls\timer\swatch.scx')


See Also

COMPILE FORM
CREATE FORM
MODIFY FORM


DO WHILE ... ENDDO Command

Syntax         Arguments         Remarks         Example         See Also

Executes a set of commands within a conditional loop.

Syntax

DO WHILE lExpression
Commands
[LOOP]
[EXIT]
ENDDO

Arguments

lExpression   Specifies a logical expression whose value determines whether the commands between DO WHILE and ENDDO are executed. As long as lExpression evaluates to true (.T.), the set of commands are executed.

Commands   Specifies the set of Visual FoxPro commands to be executed as long as lExpression evaluates to true (.T.).

LOOP   Returns program control directly back to DO WHILE. LOOP can be placed anywhere between DO WHILE and ENDDO.

EXIT   Transfers program control from within the DO WHILE loop to the first command following ENDDO. EXIT can be placed anywhere between DO WHILE and ENDDO.

Remarks

Commands between DO WHILE and ENDDO are executed for as long as the logical expression lExpression remains true (.T.). Each DO WHILE statement must have a corresponding ENDDO statement.

Comments can be placed after DO WHILE and ENDDO on the same line. The comments are ignored during program compilation and execution.


DO WHILE ... ENDDO Command Example

In the following example, the number of products in stock priced over $20 is totaled in the DO WHILE loop until the end of the file (EOF) is encountered. The DO WHILE loop is exited and the total is displayed.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE products  && Opens Products table

SET TALK OFF

gnStockTot = 0

DO WHILE .T.    && Begins loop

IF EOF( )

EXIT

ENDIF

IF unit_price < 20

SKIP

LOOP

ENDIF

gnStockTot = gnStockTot + in_stock

SKIP

ENDDO           && Ends loop

CLEAR

? 'Total items in stock valued over 20 dollars:'

?? gnStockTot


See Also

DO CASE ... ENDCASE
FOR ... ENDFOR
IF ... ENDIF
IIF( )
SCAN ... ENDSCAN


Dock Method

Syntax         Arguments         Remarks         Applies To         See Also

Docks the ToolBar object along a border of the main Visual FoxPro window or along a side of the desktop.

Syntax

ToolBar.Dock(nLocation [, X, Y])

Arguments

nLocation   Specifies where the toolbar is docked. The values for nLocation are:

Value	Constant	Description
– 1	TOOL_NOTDOCKED	Undocks the toolbar.
0	TOOL_TOP	Docks the toolbar at the top of the main Visual FoxPro window.
1	TOOL_LEFT	Docks the toolbar at the left side of the main Visual FoxPro window.
2	TOOL_RIGHT	Docks the toolbar at the right side of the main Visual FoxPro window.
3	TOOL_BOTTOM	Docks the toolbar at the bottom of the main Visual FoxPro window.
X, Y   Specifies the horizontal and vertical coordinates respectively of the docked position of the toolbar.

Remarks

Toolbars are docked along the borders of the main window. When a toolbar is docked, its title bar is hidden and its border is changed to a single line. The toolbar is also resized to a single row of buttons. The window is resized so that the toolbar does not obscure any information on the screen. For example, if the toolbar is docked at the top, the screen is moved down by the height of the toolbar.

Use the Move method to undock a toolbar. When using the Move method, the coordinates specified must be outside the dock area.


Applies To

ToolBar


See Also

AfterDock Event
BeforeDock Event
Docked Property
Undock Event


Docked Property

Syntax         Settings         Applies To         See Also

Contains a logical value indicating whether a user-defined ToolBar object is docked. Read-only at design time and run time.

Syntax

ToolBar.Docked[ = lExpr]

Settings

lExpr   The settings for the Docked property are:

Setting	Description
True (.T.)	The toolbar is docked.
False (.F.)	The toolbar is not docked.


Applies To

ToolBar


See Also

DockPosition Property


DockPosition Property

Syntax         Settings         Applies To         See Also

Specifies the position where a user-defined ToolBar object is docked. Read-only at design time and run time.

Syntax

ToolBar.DockPosition[= nPosition]

Settings

nPosition   The values for nPosition are:

Setting	Position
– 1	Undocked
0	Top
1	Left
2	Right
3	Bottom


Applies To

ToolBar


See Also

Docked Property


DocumentFile Property

Syntax         Settings         Remarks         Example         Applies To         See Also

Returns the name of the file from which a linked OLE object was created. At design time, specifies the name of the linked file. Read-only at design time and run time for an existing object, but can be set for an object when creating it.

Syntax

Object.DocumentFile[ = cFileName]

Settings

cFileName   The name of the file to which the object is linked. The name includes the full path of the file.

Remarks

DocumentFile contains the empty string for embedded (not linked) objects.

You set the DocumentFile property of a linked OLE object using the Insert Object dialog box when you initially add an OLE container to a form. You can also set this property when creating an OLE object using the APPEND GENERAL command or when defining the object in code as part of a class definition.

Before specifying the contents of an OLE object using the DocumentFile property, specify the OLE server application by setting the object’s OLEClass.


DocumentFile Property Example

The following example adds an OLE Container control to a form, and uses the DocumentFile and OleClass properties to specify an Excel worksheet as the file to edit and Excel as the OLE server.

The DocumentFile property specifies a worksheet named BOOK1.XLS in the EXCEL directory on drive C. This example will not work properly if the file and directory specified in the DocumentFile property do not exist; it may be necessary to modify the DocumentFile property to specify an existing directory and worksheet file.

The DoVerb method is used to activate the worksheet for editing.

frmMyForm = CREATEOBJECT('form')  && Create a form

frmMyForm.Closable = .F.  && Disable the Control menu box

frmMyForm.AddObject('cmdCommand1','cmdMyCmdBtn')  && Add Command button

frmMyForm.AddObject("oleObject","oleExcelObject")  && Add OLE object

frmMyForm.cmdCommand1.Visible=.T.  && Display the "Quit" Command button

frmMyForm.oleObject.Visible=.T.  && Display the OLE control

frmMyForm.oleObject.Height = 50  && OLE control height

frmMyForm.Show  && Display the form

frmMyForm.oleObject.DoVerb(-1)  && -1 for Edit

READ EVENTS  && Start event processing

DEFINE CLASS oleExcelObject as OLEControl

OleClass ="Excel.Sheet"  && Server name

DocumentFile = "C:\EXCEL\BOOK1.XLS"  && This file must exist

ENDDEFINE

DEFINE CLASS cmdMyCmdBtn AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 210  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close form

ENDDEFINE


Applies To

OLE Bound Control, OLE Container Control


See Also

APPEND GENERAL
CREATEOBJECT( )
OLEClass


_DOS System Memory Variable
_DOS System Variable

Syntax         Remarks         See Also

Contains true (.T.) if you are using FoxPro for MS-DOS. Contains false (.F.) if you are using a different platform version of FoxPro or Visual FoxPro.

Syntax

_DOS = lExpression

Remarks

The value contained in _DOS cannot be changed with STORE or =.


See Also

_MAC
_UNIX
VERSION( )
_WINDOWS


DoScroll Method

Syntax         Arguments         Remarks         Applies To         See Also

Scrolls the Grid control to simulate a user clicking the scroll bars.

Syntax

Grid.DoScroll(nDirection)

Arguments

nDirection   The settings for nDirection are:

Scroll command	Scroll action
0	Scroll up
1	Scroll down
2	Scroll page up
3	Scroll page down
4	Scroll left
5	Scroll right
6	Scroll page left
7	Scroll page right
Remarks

The Scrolled event is triggered after the DoScroll method.


Applies To

Grid


See Also

Scrolled Event


DoVerb Method

Syntax         Arguments         Remarks         Example         Applies To         See Also

Executes a verb on the specified object.

Syntax

Object.DoVerb[(Verb)]

Arguments

Verb   The verb to execute on the object within the OLE container control. If not specified, the default verb is executed. The value of this argument can be one of the standard verbs supported by all objects or an index of the ObjectVerbs property array. Each object can support its own set of verbs.

The following values represent standard verbs supported by every object:

Value	Action
0	The default action for the object.
– 1	Activates the object for editing. If the application that created the object supports in-place activation, the object is activated within the OLE container control.
– 2	Opens the object in a separate application window. If the application that created the object supports in-place activation, the object is activated in its own window.
– 3	For embedded objects, hides the application that created the object.
– 4	If the object supports in-place activation, activates the object for in-place activation and shows any user interface tools. If the object doesn't support in-place activation, the object doesn't activate, and an error occurs.
– 5	If the user moves the focus to the OLE container control, creates a window for the object and prepares the object to be edited. An error occurs if the object doesn't support activation on a single mouse click.
– 6	Used when the object is activated for editing to discard all record of changes that the object's application can undo.
Remarks

If you set the AutoActivate property to 2 (DoubleClick), the OLE container control automatically activates the current object when the user double-clicks the control.

Tip   Although you can use the name of the verb (edit, open, play, and so on) to specify the verb to use with DoVerb, it is much faster to use the index (0, 1, 2, and so on).


DoVerb Method Example

The following example adds an OLE Container control to a form, and uses the OleClass and DocumentFile properties to specify Excel as the OLE server and an Excel worksheet as the file to edit.

The DocumentFile property specifies a worksheet named BOOK1.XLS in the EXCEL directory on drive C. This example will not work properly if the file and directoryspecified in the DocumentFile property do not exist; it may be necessary to modify the DocumentFile property to specify an existing directory and worksheet file.

* The DoVerb method is used to activate the worksheet for editing.

*frmMyForm = CREATEOBJECT('form')  && Create a form

*frmMyForm.Closable = .F.  && Disable the Control menu box

frmMyForm.AddObject('cmdCommand1','cmdMyCmdBtn')  && Add Command button

frmMyForm.AddObject("oleObject","oleExcelObject")  && Add OLE object

frmMyForm.cmdCommand1.Visible=.T.  && Display the "Quit" Command button

frmMyForm.oleObject.Visible=.T.  && Display the OLE control

frmMyForm.oleObject.Height = 50  && OLE control height

frmMyForm.Show  && Display the form

frmMyForm.oleObject.DoVerb(-1)  && -1 for Edit

READ EVENTS  && Start event processing

DEFINE CLASS oleExcelObject as OLEControl

OleClass ="Excel.Sheet"  && Server name

DocumentFile = "C:\EXCEL\BOOK1.XLS"  && This file must exist

ENDDEFINE

DEFINE CLASS cmdMyCmdBtn AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 210  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close form

ENDDEFINE


Applies To

OLE Bound Control, OLE Container Control


See Also

OLE Bound Control
OLE Container Control


DOW( ) Function

Syntax         Returns         Arguments         Example         See Also

Returns a numeric day-of-the-week value from a Date or DateTime expression.

Syntax

DOW(dExpression | tExpression [, nFirstDayOfWeek])

Returns

Numeric

Arguments

dExpression   Specifies the Date expression from which DOW( ) returns the day number.

tExpression   Specifies the DateTime expression from which DOW( ) returns the day number.

nFirstDayOfWeek   Specifies the first-day-of-the-week.

 nFirstDayOfWeek may be one of the following values.

nFirstDayOfWeek	Description
0	DOW( ) uses whatever day is currently selected in the Week Starts On list box, which appears on the Regional Tab in the Options dialog box.
1	Sunday. This is the default when nFirstDayOfWeek is omitted, and is the first-day-of-the-week used in earlier FoxPro versions.
2	Monday
3	Tuesday
4	Wednesday
5	Thursday
6	Friday
7	Saturday


DOW( ) Function Example

STORE DATE( ) TO gdDayNum

CLEAR

? DOW(gdDayNum)

? CDOW(gdDayNum)


See Also

CDOW( )
DAY( )
SET FDOW
SET FWEEK
SYS( ) Functions Overview
WEEK( )


DownClick Event

Syntax         Arguments         Applies To         See Also

Occurs when the down arrow on a control is clicked.

Syntax

PROCEDURE Control.DownClick
[LPARAMETERS nIndex]

Arguments

nIndex   Uniquely identifies a control if it is in a control array.


Applies To

ComboBox, ListBox, Spinner


See Also

UpClick Event


DownPicture Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the graphic displayed when the control is selected. Available at design time and run time.

Syntax

Control.DownPicture[ = cPicture]

Settings

cPicture   Specifies either a complete path and file name of a bitmap or the name of a general field in a table.

Remarks

If you set the DownPicture property at design time and the file you specify does not exist, Visual FoxPro displays an error message, but the property remains set to the file you specified. Visual FoxPro ignores the DownPicture property at run time if it is set to a file that does not exist.

If you do not specify a setting for the DownPicture property, Visual FoxPro uses the graphic specified by the Picture property when the control is selected.

For CommandButton controls, the Style property must be set to 0 (Standard) for the bitmap to be displayed on the control; For CheckBox and OptionButton controls, the Style property must be set to 1 (Graphical).


Applies To

CheckBox, CommandButton, OptionButton


See Also

DisabledPicture Property
Enabled Property
Picture Property
Style Property


Drag Method

Syntax         Arguments         Remarks         Applies To         See Also

Begins, ends, or cancels a drag operation.

Syntax

Control.Drag [(nAction)]

Arguments

nAction   Indicates the action to perform. If you omit nAction, nAction is set to 1.

The settings for the Drag method are:

Setting	Description
0	Cancel drag operation; restore original position of control.
1	(Default) Begin dragging the control.
2	End dragging—that is, drop the control.
Remarks

Usually, the MouseDown event procedure calls the Drag method to begin the dragging operation.

It’s necessary to use the Drag method to control dragging only when the DragMode property of the control is set to 0 (Manual). You can use Drag on a control whose DragMode property is set to 1 (Automatic), but the MouseDown and MouseUp events are not triggered.

If you want the mouse pointer to change while the control is being dragged, use either the DragIcon property or the MousePointer property to define the pointer. The MousePointer property only has an effect if the DragIcon property is not set.


Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, EditBox, Grid, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, Page, PageFrame, Shape, Spinner, TextBox


See Also

DragDrop Event
DragIcon Property
DragMode Property
MousePointer Property
Move Method


DragDrop Event

Syntax         Arguments         Remarks         Applies To         See Also

Occurs when a drag-and-drop operation is completed.

Syntax

PROCEDURE Object.DragDrop
LPARAMETERS [nIndex,] oSource, nXCoord, nYCoord

Arguments

You must include an LPARAMETERS or PARAMETERS statement in the event procedure and specify a name for each parameter. Visual FoxPro passes the DragDrop event three or four parameters in the following order:

nIndex   Uniquely identifies a control if it is in a control array.

oSource   References the control being dragged. You can refer to properties and methods of the control with this parameter.

nXCoord, nYCoord   Contains the current horizontal (nXCoord) and vertical (nYCoord) coordinates of the mouse pointer within the target form or control. These coordinates are always expressed in terms of the target’s coordinate system in the unit of measurement determined by the ScaleMode property.

Remarks

A drag-and-drop operation is completed when a control is dragged over another control or form and the mouse button is released, or when the Drag method with its nAction argument set to 2 (Drop) is called for the control.

Use a DragDrop event to control what happens after a drag operation is complete. For example, you can move the source control to a new location or copy a file from one location to another.

Note   The DragDrop event involves two objects, a control being dragged and a target object. The DragDrop event is triggered for the target object, not the control being dragged.

Use the DragMode property and Drag method to specify how dragging is to be initiated. Once dragging is initiated, you can handle events that precede a DragDrop event with a DragOver event.


Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, EditBox, Form, Grid, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, Page, PageFrame, Shape, Spinner, TextBox, ToolBar


See Also

Drag Method
DragIcon Property
DragMode Property
DragOver Event
MouseDown Event
MouseUp Event
MouseMove Event


DragIcon Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the icon displayed as the pointer during a drag-and-drop operation. Available at design time and run time.

Syntax

Control.DragIcon[ = cIcon]

Settings

cIcon   Specifies the file that contains the icon to use as the mouse pointer. Typically, you specify the icon file using the Properties window at design time. The file you specify must have the .CUR extension and be saved in VGA-Mono 2-Color 32x32 format. If you try to use a color .CUR file, an error message is generated. You can use ImageEdit, to create a two color .CUR file.. If you omit cIcon, an arrow pointer inside a rectangle is used.

Remarks

DragIcon is useful for providing visual feedback during a drag operation — for instance, to indicate that the source control is over an appropriate target. DragIcon takes effect when the user initiates dragging. Typically, you set DragIcon during a MouseDown or DragOver event.

If you set the DragIcon property at design time and the file you specify does not exist, Visual FoxPro displays an error message, but the property remains set to the file you specified. Visual FoxPro ignores the DragIcon property at run time if it is set to a file that does not exist.


Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, EditBox, Grid, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, Page, Shape, Spinner, TextBox


See Also

Drag Method
DragDrop Event
DragMode Property
MouseDown Event
 MouseMove Event MousePointer Property
MouseUp Event


DragMode Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies manual or automatic drag mode for a drag-and-drop operation. Available at design time and run time.

Syntax

Control.DragMode[ = nMode]

Settings

nMode   The settings for the DragMode property are:

Setting	Description
0	(Default) Manual. Requires using the Drag method to initiate dragging of the source control.
1	Automatic. Clicking the source control automatically initiates dragging.
Remarks

When DragMode is set to 0 (Manual), the control responds to mouse events and the Drag method must be used to begin drag operations.

When DragMode is set to 1 (Automatic), the control does not respond to mouse events, and drag operations begin automatically when the user presses and holds the primary (left) mouse button over the control.

Releasing the mouse button while the mouse pointer is over a target control or form during a drag operation generates a DragDrop event for the target object and ends the drag operation. Dragging can also trigger a DragOver event.

Note   While a control is being dragged, it does not receive other user-initiated mouse or keyboard events (KeyPress, MouseDown, MouseMove, or MouseUp).


Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, EditBox, Grid, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, Page, PageFrame, Shape, Spinner, TextBox


See Also

DragDrop Event
DragIcon Property
DragOver Event
KeyPress Event
MouseDown Event
MouseMove Event
MouseUp Event


DragOver Event

Syntax         Arguments         Remarks         Applies To         See Also

Occurs when a control is being dragged over a target object.

Syntax

PROCEDURE Object.DragOver
LPARAMETERS [nIndex,] oSource, nXCoord, nYCoord, nState

Arguments

You must include an LPARAMETERS or PARAMETERS statement in the event procedure and specify a name for each parameter; otherwise an error occurs. Visual FoxPro passes the DragOver event four or five parameters in the following order:

nIndex   Uniquely identifies a control if it is in a control array.

oSource   Contains a reference to the control being dragged. You can refer to properties and methods of the control with this parameter.

nXCoord, nYCoord   Contains the current horizontal (nXCoord) and vertical (nYCoord) position of the mouse pointer within the target form or control. The coordinates are always expressed in terms of the target’s coordinate system in the unit of measurement determined by the ScaleMode property.

nState   Contains a number that represents the transition state of the control being dragged in relation to the target object:

Setting	Description
0	Enter. The control is being dragged within the range of a target.
1	Leave. The control is being dragged out of the range of a target.
2	Over. The control has moved from one position in the target to another.
Use nState to determine actions at key transition points. For example, you can highlight a possible target on nState = 0 (Enter) and restore the object’s appearance on nState = 1 (Leave).

When an object receives a DragOver event with nState = 0 (Enter):

•	A DragDrop event is triggered if the source control is dropped on a target object.

•	Another DragOver event is triggered with nState = 1 (Leave) if the source control is not dropped on a valid target.

Remarks

The object under the drag icon is the target object and responds to the DragOver event. You can use this event to monitor when the mouse pointer enters, leaves, or is directly over a target object.

Use a DragOver event to determine what happens after dragging is initiated and before a control is dropped onto a target. For example, you can verify a valid target range by highlighting the target by setting the BackColor or ForeColor property or by displaying a special pointer.


Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, Control Object, EditBox, Form, Grid, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, Page, PageFrame, Shape, Spinner, TextBox, ToolBar


See Also

Drag Method
DragDrop Event
DragIcon Property
DragMode Property
MouseDown Event
MouseUp Event
MouseMove Event


Draw Method

Syntax         Applies To         See Also

Repaints a Form object.

Syntax

Object.Draw


Applies To

Form, _SCREEN


See Also

Paint Event


DrawMode Property

Syntax         Settings         Remarks         Applies To         See Also

Determines, in conjunction with the color properties, how a shape or line is displayed on screen. Available at design time and run time.

Syntax

Object.DrawMode[ = nMode]

Settings

nMode   The settings for the DrawMode property are:

Setting	Description
1	Blackness Pen. Shape is drawn black.
2	NotMerge Pen. Inverse of setting 15.
3	Mask Not Pen. Combination of the colors common to the BackColor and the inverse of the ForeColor.
4	Not Copy Pen. Inverse of setting 13.
5	Mask Pen Not. Combination of the colors common to both the ForeColor and the inverse of the BackColor.
6	Invert. Inverse of the BackColor.
7	XOR Pen. Combination of the colors in the ForeColor and in the BackColor, but not in both.
8	Not Mask Pen. Inverse of setting 9.
9	Mask Pen. Combination of the colors common to both the ForeColor and the BackColor.
10	Not XOR Pen. Inverse of setting 7.
11	NOP. No operation. Output remains unchanged. In effect, this setting turns drawing off.
12	Merge Not Pen. Combination of the BackColor and the inverse of the ForeColor.
13	(Default). Copy Pen. Color specified by the ForeColor property.
14	Merge Pen Not. Combination of the ForeColor and the inverse of the BackColor.
15	Merge Pen. Combination of the ForeColor and the BackColor.
16	Whiteness Pen. Shape is drawn white.
Remarks

Use the DrawMode property to produce visual effects with Shape or Line controls or when drawing with graphics methods. As a new shape is drawn, Visual FoxPro compares each pixel in the pattern with the corresponding pixel in the existing background and then applies bit-wise operations. For example, setting 7 uses the exclusive OR operator (XOR) to combine a drawing pattern pixel with the background pixel.

The exact effect of the DrawMode property setting depends on how the color of a line drawn at run time combines with colors already on the screen. Settings 1, 6, 7, 11, 13, and 16 yield the most predictable results.


Applies To

Form, Line, _SCREEN, Shape


See Also

Box Method
Circle Method
DrawWidth Property
DrawStyle Property
FillColor Property
FillStyle Property
Line Method
Pset Method


DrawStyle Property

Syntax         Settings         Applies To         See Also

Specifies the line style to use when drawing with graphics methods. Available at design time and run time.

Syntax

Object.DrawStyle[ = nStyle]

Settings

nStyle   The settings for the DrawStyle property are:

Setting	Description
0	(Default) Solid
1	Dash
2	Dot
3	Dash-Dot
4	Dash-Dot-Dot
5	Transparent
6	Inside Solid
Note   If DrawWidth is set to 1, DrawStyle produces the effect described in the preceding table for each setting. But if DrawWidth is set to a value greater than 1, settings 1 through 4 produce a solid line.


Applies To

Form, _SCREEN


See Also

Circle Method
DrawMode Property
DrawWidth Property
FillColor Property
FillStyle Property
ForeColor Property
Line Method
PSet Method


DrawWidth Property

Syntax         Settings         Applies To         See Also

Specifies the line width for output from graphics methods. Available at design time and run time.

Syntax

Object.DrawWidth[ = nSize]

Settings

nSize   Specifies the width of the line in pixels. You can set DrawWidth to a value of 1 through 32,767. The default value is 1 pixel wide.

Increase the value of this property to increase the width of the line.


Applies To

Form, _SCREEN


See Also

Circle Method
DrawMode Property
DrawStyle Property
FillColor Property
FillStyle Property
ForeColor Property


DROP TABLE Command

Syntax         Settings         Remarks          See Also

Removes a table from the current database and deletes it from disk.

Syntax

DROP TABLE TableName | FileName | ? [RECYCLE]

Settings

TableName   Specifies the table to remove from the current database and delete from disk.

FileName   Specifies a free table to delete from disk.

?   Displays the Remove dialog from which you can choose a table to remove from the current database and delete from disk.

RECYCLE   Specifies that the table isn’t immediately deleted from disk and is placed in the Windows 95 Recycle Bin.

Remarks

When DROP TABLE is issued, all primary indexes, default values, and validation rules associated with the table are also removed. DROP TABLE also affects other tables in the current database if those tables have rules or relations associated with the table being removed. The rules and relations are no longer valid when the table is removed from the database.

Any table deleted with this command cannot be retrieved. Even if SET SAFETY is set to ON, you are not warned before the table is deleted.


See Also

ADD TABLE, CLOSE DATABASES, CREATE DATABASE, FREE TABLE, OPEN DATABASE, OPEN DATABASE


DROP VIEW Command

Syntax         Settings         Remarks          See Also

Deletes a SQL view from the current database.

Syntax

DROP VIEW ViewName

Settings

ViewName   Specifies the name of the view deleted from the current database.

Remarks

DROP VIEW is identical to DELETE VIEW; DROP VIEW is the ANSI SQL standard syntax for deleting a SQL view.

Use CREATE SQL VIEW to create a SQL view and add the view to the current database. If a SQL view is opened and then deleted, the cursors containing the SQL view results are not closed.


See Also

CREATE SQL VIEW, DELETE VIEW, OPEN DATABASE


DropDown Event

Syntax         Arguments         Remarks         Applies To         See Also

Occurs when the list portion of a ComboBox control is about to drop down after the drop-down arrow is clicked.

Syntax

PROCEDURE ComboBox.DropDown
[LPARAMETERS nIndex]

Arguments

You must include an LPARAMETERS or PARAMETERS statement in the event procedure and specify a name for each parameter; otherwise an error occurs. Visual FoxPro passes the DropDown event the following parameter:

nIndex   Contains a number that uniquely identifies a control if it is in a control array.

Remarks

Use a DropDown event procedure to make final updates to the list portion of a ComboBox before the user makes a selection. This enables you to add or remove items from the list using the AddItem or RemoveItem method. This flexibility is useful if you want controls to interact at run time. For example, what you want to appear in the list portion of a ComboBox depends on what the user chooses in an OptionGroup.


Applies To

ComboBox


See Also

AddItem Method
DownClick Event
RemoveItem Method


DROPOFFLINE( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Discards all changes made to an offline view and takes the offline view back online.

Syntax

DROPOFFLINE(cViewName)

Returns

Logical

Arguments

cViewName   Specifies the name of the offline view to take back online.

Remarks

DROPOFFLINE( ) returns a logical true (.T.) if the offline view is successfully taken back online; otherwise it returns false (.F.).


See Also

CREATEOFFLINE( )
DROP VIEW
USE


DTOC( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns a Character-type date from a Date or DateTime expression.

Syntax

DTOC(dExpression | tExpression [, 1])

Returns

Character

Arguments

dExpression   Specifies a Date-type variable, array element, or field for which DTOC( ) returns a Character-type date.

tExpression   Specifies a DateTime-type variable, array element, or field for which DTOC( ) returns a Character-type date.

1   Returns the date in a format suitable for indexing. This is particularly useful for maintaining the table records in chronological sequence.

For example, to order table records in entry sequence, you could issue this command:

INDEX ON DTOC(gdInvDate, 1) + gnInvTime TAG Timeindx

gdInvDate and gnInvTime are fields containing the date and time when the data was entered in the record.

Remarks

DTOC( ) returns a character string corresponding to a Date or DateTime expression. The date format is determined by SET CENTURY and SET DATE.


DTOC( ) Function Example

STORE CTOD('10/31/95') TO gdThisDate

CLEAR

? DTOC(gdThisDate)

STORE DTOC({10/31/95}+90) TO gcExpireDate

? 'Your 90-day warranty expires ', gcExpireDate

? DTOC({10/31/95},1)


See Also

CTOD( )
SET CENTURY
SET DATE
SYS( ) Functions Overview


DTOR( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Converts degrees to radians.

Syntax

DTOR(nExpression)

Returns

Numeric

Arguments

nExpression   Specifies the numeric expression whose value you want to convert to radians. An angle expressed in a degree:minute:second format should be converted to its decimal equivalent.

Remarks

DTOR( ) converts the value of a numeric expression given in degrees to an equivalent value in radians. DTOR( ) is useful for working with the Visual FoxPro trigonometric functions: ACOS( ), ASIN( ), COS( ), SIN( ), TAN( ).

Use RTOD( ) to convert radians to degrees.


DTOR( ) Function Example

CLEAR

? DTOR(0)    && Displays 0.00

? DTOR(45)   && Displays 0.79

? DTOR(90)   && Displays 1.57

? DTOR(180)  && Displays 3.14

? COS(DTOR(90))  && Displays 0.00


See Also

ACOS( )
ASIN( )
COS( )
RTOD( )
SIN( )
TAN( )


DTOS( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns a character-string date in a yyyymmdd format from a specified Date or DateTime expression.

Syntax

DTOS(dExpression | tExpression)

Returns

Character

Arguments

dExpression   Specifies the Date expression DTOS( ) converts to an eight-digit character string.

tExpression   Specifies the DateTime expression DTOS( ) converts to an eight-digit character string.

Remarks

This function is useful for indexing tables on a Date or DateTime field. It is equivalent to DTOC( ) when its optional 1 argument is included.

The character string returned by DTOS( ) isn’t affected by SET DATE or SET CENTURY.


DTOS( ) Function Example

CLEAR

? DTOS(DATE( ))


See Also

DATE( )
DATETIME( )
CTOD( )
DTOC( )


DTOT( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns a DateTime value from a Date expression.

Syntax

DTOT(dDateExpression)

Returns

DateTime

Arguments

dDateExpression   Specifies the Date expression from which a DateTime value is returned.

Remarks

The format of the DateTime value DTOT( ) returns depends on the current SET DATE and SET MARK settings. If a century isn’t supplied, the twentieth century is assumed.

DTOT( ) adds a default time of midnight (12:00:00 A.M.) to the date to produce a valid DateTime value.


DTOT( ) Function Example

? DTOT({02/16/95}) && Displays 02/16/95 12:00:00am


See Also

CTOT( )
DATE( )
SEC( )
SECONDS( )
SET SECONDS
TIME( )


DynamicAlignment Property

Syntax         Settings         Applies To         See Also

Specifies the alignment of text and controls in a Column object. The alignment is re-evaluated at run time each time the Grid control is refreshed. Available at design time; read-write at run time.

Syntax

Column.DynamicAlignment[ = cAlign]

Settings

cAlign   Specifies a character string expression that is re-evaluated at run time and results in one of the following values:

Setting	Description
0	Middle Left. Aligns the text flush left and centered vertically.
1	Middle Right. Aligns the text flush right and centered vertically.
2	Middle Center. Aligns the text in the middle with equal spaces to the right and left and centered vertically.
3	(Default) Automatic. Aligns text based on the data type of the control source. Numeric types (numeric, double, float, currency, integer) are right-aligned; controls with other data types are left-aligned.
4	Top Left. Aligns the text flush left and at the top of the column.
5	Top Right. Aligns the text flush right and at the top of the column.
6	Top Center. Aligns the text in the middle with equal spaces to the right and left and at the top of the column.
7	Bottom Left. Aligns the text flush left and at the bottom of the column.
8	Bottom Right. Aligns the text flush right and at the bottom of the column.
9	Bottom Center. Aligns the text in the middle with equal spaces to the right and left and at the bottom of the column.


Applies To

Column


See Also

Alignment Property


DynamicBackColor, DynamicForeColor Properties

Syntax         Settings         Remarks         Example         Applies To         See Also

Specifies the background and foreground colors of a Column object. The colors are re-evaluated at run time each time the Grid control is refreshed. Available at design time; read-write at run time.

Syntax

Column.DynamicBackColor[ = cExpression]

Column.DynamicForeColor[ = cExpression]

Settings

cExpression   Specifies an expression in quotation marks that is re-evaluated at run time whenever the Grid control is refreshed. The run-time evaluation must result in a single color value.

Remarks

You can use the DynamicBackColor and DynamicForeColor properties to create special effects, such as displaying the odd-numbered rows in green and the even-numbered rows in gray.


DynamicBackColor, DynamicForeColor Properties Example

The following example uses the DynamicBackColor property and the SetAll method to specify the background colors for the records in a Grid  control. If the number of a record displayed in the Grid is even, the record’s DynamicBackColor is white, otherwise its DynamicBackColor is green.

A Grid control is placed on a form, and the customer table is opened and its contents displayed in the Grid. The Caption property is used to specify a different header caption (Customer ID) for the CUST_ID field. A command button is placed on the form to close the form.

CLOSE ALL  && Close tables and databases

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  IN 0  && Opens Customer table

frmMyForm = CREATEOBJECT('Form')  && Create a Form

frmMyForm.Closable = .f.  && Disable the Control menu box

frmMyForm.AddObject('cmdCommand1','cmdMyCmdBtn')  && Add Command button

frmMyForm.AddObject('grdGrid1','Grid')  && Add Grid control

frmMyForm.grdGrid1.Left = 25    && Adjust Grid position

frmMyForm.grdGrid1.SetAll("DynamicBackColor", ;

"IIF(MOD(RECNO( ), 2)=0, RGB(255,255,255) ;

, RGB(0,255,0))", "Column")  && Alternate white and green records

frmMyForm.grdGrid1.Visible = .T.  && Grid control visible

frmMyForm.cmdCommand1.Visible =.T.  && "Quit" Command button visible

frmMyForm.grdGrid1.Column1.Header1.Caption = 'Customer ID'

frmMyForm.SHOW  && Display the form

READ EVENTS  && Start event processing

DEFINE CLASS cmdMyCmdBtn AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 210  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close Form

CLOSE ALL  && Close table and database

ENDDEFINE


Applies To

Column


See Also

BackColor
ForeColor Properties


DynamicCurrentControl Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies which control contained in a Column object is used to display the values of the active cell. The name of the control is re-evaluated each time the Grid control is refreshed. Available at design time; read-write at run time.

Syntax

Column.DynamicCurrentControl[ = cExpression]

Settings

cExpression   Evaluates at run time to the name of the control that displays and accepts data for the active cell in Column.

Remarks

The default control is a TextBox having Text1 as the Name property. Use the AddObject method to add other controls.

If the Column’s Sparse property is set to true (.T.), only the active cell in the Column uses the object specified in the DynamicCurrentControl property setting to display data; the other cells display data using a TextBox. If the Sparse property is set to false (.F.), all cells in the Column use the object specified in the DynamicCurrentControl property setting to display data.


Applies To

Column


See Also

AddObject Method
CurrentControl Property


DynamicFontBold, DynamicFontItalic, DynamicFontStrikethru, DynamicFontUnderline Properties

Syntax         Settings         Remarks         Applies To         See Also

Specifies that text displayed in a Column object has one or more of the following styles: Bold, Italic, Strikethru, or Underline. The logical expression is re-evaluated each time the Grid control is refreshed. Available at design time; read-write at run time.

Syntax

Column.DynamicFontBold[ = "lExpr"]

Column.DynamicFontItalic[ = "lExpr"]

Column.DynamicFontStrikeThru[ = "lExpr"]

Column.DynamicFontUnderline[ = "lExpr"]

Settings

"lExpr"   Evaluates to either true (.T.) or false (.F.). The settings for the dynamic font properties are:

Setting	Description
True (.T.)	Font style is bold, italic, strikethru, or underline.
False (.F.)	(Default except for DynamicFontBold) Font style is not bold, italic, strikethru, or underline.
Remarks

Use these properties to control the appearance of text based on data values at run time. For example, you can set DynamicFontUnderline to indicate names of new members in an organization.


Applies To

Column


See Also

DynamicFontSize Property


DynamicFontName Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the name of the font used to display text in a Column object. The logical expression is re-evaluated at run time each time the Grid control is refreshed. Available at design time; read-write at run time.

Syntax

Column.DynamicFontName[ = cName]

Settings

cName   Evaluates to the name of a font.

Remarks

At design time, a list of available fonts is displayed when you select the FontName property in the Properties window and click the down arrow to the right of the Properties Settings box.


Applies To

Column


See Also

FontName Property


DynamicFontOutline Property

Syntax         Settings         Applies To         See Also

Specifies whether the text associated with a Column object is outlined. The logical expression is re-evaluated at run time each time the Grid control is refreshed. Available at design time and run time.

Syntax

Column.DynamicFontOutline[ = "lExpr"]

Settings

"lExpr"   Evaluates to either true (.T.) or false (.F.). The settings for the DynamicFontOutline property are:

Setting	Description
True (.T.)	The text is outlined.
False (.F.)	(Default) The text is not outlined.


Applies To

Column


See Also

FontOutline Property
DynamicFontShadow Property


DynamicFontShadow Property

Syntax         Settings         Applies To         See Also

Specifies whether the text associated with a Column object is shadowed. The logical expression is re-evaluated at run time each time the Grid control is refreshed. Available at design time and run time.

Syntax

Column.DynamicFontShadow[ = "lExpr"]

Settings

"lExpr"   Evaluates to either true (.T.) or false (.F.). The settings for the DynamicFontShadow property are:

Setting	Description
True (.T.)	The text is shadowed.
False (.F.)	(Default) The text is not shadowed.


Applies To

Column


See Also

FontShadow Property
DynamicFontOutline Property


DynamicFontSize Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the font size of text displayed in a Column object. The font size is re-evaluated at run time each time the Grid control is refreshed. Available at design time; read-write at run time.

Syntax

Column.FontSize[ = "nSize"]

Settings

"nSize"   Evaluates to a font size. The default font size is 10 points.

Remarks

The maximum value for nSize is 2048 points. There are 72 points in 1 inch.

Use this property to change the font size of a row.


Applies To

Column


See Also

DynamicAlignment Property
DynamicFontName Property


DynamicInputMask Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies how data is entered and displayed in a Column object. Re-evaluated at run time each time the Grid control is refreshed. Available at design time; read-write at run time.

Syntax

Column.DynamicInputMask[ = cInputMask]

Settings

cInputMask   Specifies the dynamic format of text and controls in a column. cInputMask must evaluate to a character string of the following format:

[@cFunction] [cMask]

The following demonstrates a typical format for cInputMask:

Column1.DynamicInputMask = "@R$ ###,###,###.##"

For additional information about the format of cFunction and cMask, see the Format and InputMask properties.

Remarks

The DynamicInputMask property takes precedence over the Format and InputMask properties.

If the control specified by the column's CurrentControl property is a text box, spinner, or combo box, the Format and InputMask portions of the DynamicInputMask expression are passed to the Format and InputMask properties for the text box, spinner, or combo box.


Applies To

Column


See Also

Format Property, InputMask Property


EDIT Command

Syntax         Arguments

Displays fields for editing.

Syntax

EDIT
[FIELDS FieldList]
[Scope] [FOR lExpression1] [WHILE lExpression2]
[FONT cFontName [, nFontSize]]
[STYLE cFontStyle]
[FREEZE FieldName]
[KEY eExpression1 [, eExpression2]]
[LAST | NOINIT]
[LPARTITION]
[NAME ObjectName]
[NOAPPEND]
[NODELETE]
[NOEDIT | NOMODIFY]
[NOLINK]
[NOMENU]
[NOOPTIMIZE]
[NORMAL]
[NOWAIT]
[PARTITION nColumnNumber [LEDIT] [REDIT]]
[PREFERENCE PreferenceName]
[REST]
[SAVE]
[TIMEOUT nSeconds]
[TITLE cTitleText]
[VALID [:F] lExpression3 [ERROR cMessageText]]
[WHEN lExpression4]
[WIDTH nFieldWidth]
[WINDOW WindowName1]
[IN [WINDOW] WindowName2 | IN SCREEN]
[COLOR SCHEME nSchemeNumber]

Arguments

FIELDS FieldList   Specifies the fields that appear in the Edit window. The fields are displayed in the order specified in FieldList. You can include fields from other related tables in the field list. When you include a field from a related table, preface the field name with its table alias and a period.

If you omit FIELDS, all fields in the table are displayed in the order they appear in the table structure.

The field list can specify any combination of fields or calculated fields, including fields from tables open in other work areas. The syntax of the field list is:

FieldName1

[:R]

[:nColumnWidth]

[:V = lExpression1 [:F] [:E = cMessageText]]

[:P = cFormatCodes]

[:B = eLowerBound, eUpperBound [:F]]

[:H = cHeadingText]

[:W = lExpression2]

[, FieldName2 [:R]...]

Calculated Fields

The field list can contain statements for creating calculated fields. A calculated field contains read-only data created with an expression. This expression may take any form but it must be a valid Visual FoxPro expression.

The syntax of the statement you use to create a calculated field is:

CalculatedFieldName = eExpression

This example creates a calculated field called location:

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Open customer table

EDIT FIELDS location = ALLTRIM(city) + ', ' + country

The FIELDS clause field list includes eight options, which enable special handling of fields displayed in the Edit window.

:nColumnWidth   Specifies the display size for a field in columns. The value of :nColumnWidth doesn’t affect the size of the field in the table; it alters only the way the field appears in the Edit window.

:R   In the following example, an Edit window is opened with the cust_id and company fields. The cust_id field is read-only and cannot be changed.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Open customer table

EDIT FIELDS cust_id:R, company

:V = lExpression1   Specifies a verify option that performs field-level data validation within the Edit window. If lExpression1 evaluates to true (.T.) when you move the cursor from the field, the data input into the field is considered correct and the cursor moves to the next field.

If lExpression1 evaluates to false (.F.), the data input is considered incorrect, the cursor remains in the field and a message is displayed. If lExpression1 evaluates to 0, the data input is considered incorrect and the cursor remains in the field, but no error message is displayed.

By default, lExpression1 is evaluated only when the field is modified. To force verification, include the :F option.

You can display your own error message by including the :E option.

The verify option isn’t executed for memo fields.

:F   Specifies a forced validation option that determines if the expression in the verify option (lExpression1) is evaluated when you move the cursor from a field or another window is activated. If :F is not included, lExpression1 is evaluated only if changes are made to the field. If :F is included, lExpression1 is evaluated, even if the field isn’t modified.

:E = cMessageText   Displays an error message specified with cMessageText instead of the default system message.

If the validation expression :V = lExpression1 evaluates to true (.T.), the cursor leaves the field normally. If the expression evaluates to false (.F.), the cursor remains in the field and the error message appears.

If the validation expression :V = lExpression1 evaluates to 0, no message is displayed and the cursor remains in the field being validated. This lets you display your own error messages in validation routines.

The error message is displayed only if SET NOTIFY is ON. The bell is sounded if SET BELL is ON.

The following example opens the products table and displays the product_id and prod_name fields. Enter a value greater than 100 in the product_id field to perform the field validation.

:V specifies the validation criteria. :F forces the validation check to be performed whether the data is changed or not. :E replaces the Visual FoxPro system error message with a user-defined error message.

In Visual FoxPro, the error message is displayed in the status bar at the bottom of the main Visual FoxPro window.

Press ESC to close the Edit window.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE products  && Open products table

IF _WINDOWS OR _MAC

SET STATUS BAR ON

ENDIF

USE products

EDIT FIELDS in_stock :V = in_stock < 100 ;

:F ;

:E = 'The stock amount must be less than 100'

:P = cFormatCodes   Specifies a picture option that lets you create an editing template specified with cFormatCodes that controls the display and input of data for each field in an Edit window.

For more information on using picture editing codes, see the Format and InputMask properties.

The following example uses the picture option to allow only numeric data in a specific format to be entered in the unit_price field:

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE products  && Open products table

EDIT FIELDS unit_price :P = '99,999.99'

:B = eLowerBound, eUpperBound [:F]   Specifies a set of boundaries between which data must fall. The boundary expressions eLowerBound and eUpperBound must match the data type of the field and cannot be the names of user-defined functions. If the data entered doesn’t fall between eLowerBound and eUpperBound, a system message is displayed indicating the range between which the data must fall.

By default, the data you enter is checked against the boundary values only if you make a change to the contents of the field. To force checking against the boundary values, include the forced validation option (:F).

The following example ensures that the value in the in_stock field is between 1 and 100. Press ESC to close the Edit window.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE products  && Open products table

EDIT FIELDS in_stock :B = 1, 100 :F

:H = cHeadingText   Specifies a heading option (:H) that allows you to replace the default field names with your own headings, which you specify with cHeadingText. By default, field names are placed to the left side of the fields in the Edit window.

The following example provides user-defined headings for the displayed fields.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE products  && Open products table

EDIT FIELDS prod_name :H = 'Product Name:', ;

unit_price :H = 'Price per Unit:'

:W = lExpression2   Specifies a WHEN option that allows you to conditionally prohibit the cursor from being moved to a field based on the value of the logical expression lExpression. (:W) evaluates lExpression. If lExpression2 evaluates to false (.F.), you can’t move the cursor to the field. If lExpression2 evaluates to true (.T.), you can move the cursor to the field. User-defined functions are supported in lExpression2.

Moving the cursor to all fields is prohibited if the current field is marked read-only. This occurs only when every field contains a WHEN clause that evaluates to false.

Scope   Specifies a range of records that are displayed in the Edit window. The scope clauses are: ALL, NEXT nRecords, RECORD nRecordNumber, and REST. Commands that include Scope operate only on the table in the active work area. The default scope for EDIT is ALL records.

For more information, see Scope Clauses.

FOR lExpression1   Specifies that only the records that satisfy the logical condition lExpression1 are displayed in the Edit window. Using this argument allows you to filter out undesired records.

Rushmore optimizes an EDIT FOR query if lExpression1 is an optimizable expression. For best performance, use an optimizable expression in the FOR clause.

For more information, see SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

WHILE lExpression2   Specifies a condition whereby records are displayed in the Edit window for as long as the logical expression lExpression2 evaluates to true (.T.).

FONT cFontName [, nFontSize]   Specifies the Edit window’s font and font size. The character expression cFontName specifies the name of the font, and the numeric expression nFontSize specifies the font size. For example, the following clause specifies 16-point Courier font for the fields displayed in an Edit window:

FONT 'Courier',16

If you include the FONT clause but omit the font size nFontSize, a 10-point font is used in the Edit window.

If you omit the FONT clause, 8-point MS Sans Serif is used. If the font you specify is not available, a font with similar font characteristics is substituted.

STYLE cFontStyle   Specifies the Edit window’s font style in Visual FoxPro. If you omit the STYLE clause, the Normal font style is used.

If the font style you specify is not available, a font style with similar characteristics is substituted.

Character	Font style
B	Bold
I	Italic
N	Normal
O	Outline
Q	Opaque
S	Shadow
-	Strikeout
T	Transparent
U	Underline
You can include more than one character to specify a combination of font styles. The following example opens an Edit window and uses an underlined font:

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens customer table

IF _WINDOWS

EDIT FIELDS contact FONT 'System', 15  STYLE 'NU'

ENDIF

IF _MAC

EDIT FIELDS contact FONT 'Geneva', 14  STYLE 'NU'

ENDIF

FREEZE FieldName   Allows changes to be made to only one field specified with FieldName in the Edit window. The remaining fields are displayed and cannot be edited.

KEY eExpression1 [, eExpression2]   Limits the scope of records that are displayed in the Edit window. With KEY, you can specify an index key value (eExpression1) or a range of key values (eExpression1 , eExpression2) for the records displayed in the Edit window. The table must be indexed, and the index key value or values included in the KEY clause must be the same data type as the index expression of the master index file or master tag.

In the following example, only records with postal codes falling within the range of 10,000 to 30,000 are displayed in the Edit window:

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Open customer table

SET ORDER TO postalcode

EDIT KEY '10000', '30000'

LAST | NOINIT   Saves any configuration changes made to the appearance of an Edit window. The changes are saved in the FOXUSER file and can include changes to the field list, the size of each field, and the location and size of the Edit window. For more information on this file, see SET RESOURCE.

If you issue EDIT with the LAST clause, the Edit window opens in the same configuration that was last saved in the FOXUSER file. This restores the previous Edit window configuration created with the last EDIT. If the last EDIT command issued in the Command window included a long list of clauses, issue EDIT LAST to avoid having to retype the command.

Any Edit window configuration changes you make in the current session aren’t saved if you exit EDIT by pressing CTRL+Q.

LPARTITION   Places the cursor in the first field in the left partition of the Edit window. An Edit window can be split into left and right partitions by including the PARTITION clause. By default, the cursor is placed in the first field in the right partition when the Edit window is opened.

The cursor is placed in the right partition of the Edit window if you include LPARTITION without the PARTITION clause.

NAME ObjectName   Creates an object reference for the Edit window, allowing you to manipulate the Edit window with object-oriented properties available for the Grid control.

For additional information about object-oriented programming in Visual FoxPro, see Chapter 3, “Object-Oriented Programming,” in the Developer’s Guide. For additional information about the Grid control properties that you can specify for an Edit window created with the NAME clause, see the Grid Control topic.

NOAPPEND   Prevents the user from adding records to the table by pressing CTRL+Y or choosing Append Mode from the View menu.

Important   Including NOAPPEND doesn’t prevent you from appending a record from within a routine (created with VALID, WHEN, or ON KEY LABEL) while in the Edit window.

NODELETE   Prevents records from being marked for deletion from within an Edit window. By default, a record can be marked for deletion by pressing CTRL+T, choosing Toggle Deletion Mark from the Table menu or clicking in the leftmost column of the record to be deleted.

Important   Including NODELETE doesn’t prevent you from marking a record for deletion from within a routine (created with VALID, WHEN or ON KEY LABEL) while in the Edit window.

NOEDIT | NOMODIFY   Prevents a user from modifying the table. NOEDIT and NOMODIFY are identical. If you include either clause, you can browse or search the table, but you cannot edit it. However, you can append and delete records.

NOLINK   Unlinks partitions in the Edit window. By default, the left and right partitions of the Edit window are linked; when you scroll through one partition, the other partition scrolls.

NOMENU   Removes the Table menu title in Visual FoxPro from the system menu bar, preventing access to the Edit menu.

NOOPTIMIZE   Disables Rushmore optimization of EDIT.

For more information, see SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

NORMAL   Opens the Edit window with its normal default settings, such as its colors, size, position, title, and control options (GROW, FLOAT, ZOOM, and so on). If you omit NORMAL and the current output window is a user-defined window with its own settings, the Edit window assumes those user-defined settings as well.

NOWAIT   Continues program execution immediately after the Edit window is opened. The program doesn’t wait for the Edit window to be closed but continues executing on the program line immediately following the program line containing EDIT NOWAIT. If you omit NOWAIT, when EDIT is issued from within a program, an Edit window is opened and program execution pauses until the Edit window is closed.

NOWAIT is available only from within a program. Including NOWAIT when issuing EDIT from the Command window has no effect.

PARTITION nColumnNumber   Splits an Edit window into left and right partitions with nColumnNumber specifying the column number of the split bar. For example, if nColumnNumber is 20, the split bar is placed in column 20 of the Edit window.

LEDIT   Specifies that the left partition of the Edit window appears in Browse mode.

REDIT   Specifies that the right partition of the Edit window appears in Browse mode. The following examples opens an Edit window with the split bar placed in column 20 and the right partition open in Browse mode.

Include both keywords to open both partitions in Browse mode.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens customer table

EDIT PARTITION 30 REDIT

PREFERENCE PreferenceName   Saves an Edit window’s attributes and options for later use. Unlike LAST, which restores the Edit window as it appeared in the previous session, PREFERENCE saves an Edit window’s attributes indefinitely in the FOXUSER resource file. Preferences can be retrieved at any time. For more information about the FOXUSER resource file, see SET RESOURCE.

Issuing EDIT with the specified preference name PreferenceName for the first time creates an entry in the FOXUSER file that saves the Edit window configuration. Issuing EDIT later with the same preference name restores the Edit window to that preference state. When the Edit window is closed, the preference state is updated.

Preference names can be up to 10 characters long, must begin with a letter or an underscore, and can contain any combination of letters, numbers, and underscores.

Once you have a preference the way you like it, you can prevent it from being changed. Close the Edit window, issue SET RESOURCE OFF, open the FOXUSER file as a table, and change the field containing the preference to read-only by changing the value of the logical field READONLY to true (.T.).

For more information about the FOXUSER resource file, see SET RESOURCE.

REST   Prevents the record pointer from being moved from its current position to the top of the table. By default, EDIT positions the record pointer at the top of the table.

SAVE   Keeps the Edit window and any of its memo field text-editing windows active and visible (open). You can then return to the Edit window after cycling through other open windows with the keyboard or the mouse.

SAVE is available only from within a program. SAVE has no effect when included with EDIT in the Command window because EDIT SAVE is always the default in the interactive mode.

TIMEOUT nSeconds   Specifies how long an Edit window waits for input. The numeric expression nSeconds specifies how many seconds can elapse without any input before the Edit window automatically closes.

TIMEOUT is available only from within a program; it has no effect when you issue EDIT from the Command window. In the following example, the Edit window is closed if no input occurs in 10 seconds.

DEFINE WINDOW wEdit FROM 1,1 TO 24,40 ;

CLOSE ;

GROW ;

COLOR SCHEME 10

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Open customer table

EDIT WINDOW wEdit ;

FIELDS phone :H = 'Phone Number:' , ;

company :H = 'Company:' ;

TIMEOUT 10

RELEASE WINDOW wEdit

TITLE cTitleText   Overrides the default table name or alias that appears in the Edit window title bar with the title you specify with cTitleText. Otherwise, the name or alias of the table being browsed appears in the title bar.

If you issue EDIT WINDOW to place the Edit window in a user-defined window, the Edit window’s title replaces the user-defined window’s title.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Open customer table

EDIT;

TITLE 'My Edit Window' ;

FIELDS phone :H = 'Phone Number' , ;

company :H = 'Company:'

VALID lExpression3   Performs record-level validation in an Edit window. The VALID clause is executed only if a change is made to the record and you move the cursor to another record. The VALID clause is not executed if the only change is to a memo field.

If VALID returns true (.T.), you can move the cursor to another record. If VALID returns false (.F.), the cursor remains in the current field and Visual FoxPro displays an error message. You can display your own error message when VALID returns false by including the ERROR clause. The character expression cMessageText is displayed as the error message. If VALID returns 0, the cursor remains in the current field, and an error message isn’t displayed.

The VALID clause shouldn’t be confused with the verify option (:V), which enables field-level validation.

:F   Forces the VALID clause to execute before the user moves the cursor to the next record. In this case, VALID is executed even if the record isn’t changed.

ERROR cMessageText   Specifies an error message that overrides the system default and whose contents you define with cMessageText. Visual FoxPro displays your error message when VALID returns false (.F.).

WHEN lExpression4   Evaluates a condition when the user moves the cursor to another record. If lExpression4 evaluates to true (.T.), the user can modify the record moved to. If lExpression4 evaluates to false (.F.) or 0, the record the user moves to becomes read-only and cannot be modified.

The WHEN clause isn’t executed when another window is activated.

WIDTH nFieldWidth   Limits the number of characters displayed for all fields in a partition of the Edit window to nFieldWidth. Including the WIDTH clause doesn’t change the size of fields in the table itself; it alters only the way the fields are displayed in the Edit window. If a width has been specified for an individual field with the FIELDS clause, it overrides the width specified with the WIDTH clause for that field.

WINDOW WindowName1   Specifies a user-defined window whose characteristics the Edit window assumes. For example, if the user-defined window is created with the FLOAT clause, the Edit window can be moved. The specified window doesn’t have to be active or visible, but it must be defined.

IN [WINDOW] WindowName2   Specifies the parent window within which the Edit window is opened. The Edit window doesn’t assume the characteristics of the parent window. An Edit window activated inside a parent window cannot be moved outside the parent window. If the parent window is moved, the Edit window moves with it.

To access the Edit window, the parent window must first be defined with DEFINE WINDOW and must be active and visible.

IN SCREEN   Explicitly places an Edit window in the main Visual FoxPro window when a user-defined window is active.

COLOR SCHEME nSchemeNumber   Specifies the number of a color scheme used for the Edit window’s colors. In Visual FoxPro, the Edit window assumes the color scheme established using the Color Control Panel.

Remarks

EDIT allows you to edit the selected table within a window. EDIT behaves identically to CHANGE.

If you press ESC to exit the Edit window, changes made to the last field you modified are discarded. However, if you move to another record after modifying a field, your changes to the field are saved.

In a program, use DEACTIVATE WINDOW to save your changes and close an Edit window. Include the name of the Edit window in DEACTIVATE WINDOW. For more information on Edit window names, see WTITLE( ).

SET SKIP Support

SET SKIP lets you establish a one-to-many relationship between two tables (see the example). For each record in the parent table, there can be multiple related records in the child table. If you create a one-to-many relationship, you can use EDIT to view records from both the parent and child tables.

The parent record appears once, along with the first matching record from the child table. Any subsequent matching records are displayed in the rows following the parent record and first matching child record. In FoxPro for MS-DOS, shaded blocks are displayed in any column containing information from the parent table beyond the first matching record. In Visual FoxPro, the fill character for repeated parent information depends on the current Edit window font.

For more information, see SET SKIP.

COL( ) and ROW( ) Support

Use COL( ) and ROW( ) to return the current screen row and column position of the cursor in an Edit window. If an Edit window is opened in the main Visual FoxPro window, the returned cursor position is relative to the main Visual FoxPro window, not to the Edit window itself. If an Edit window is opened in a user-defined window, COL( ) and ROW( ) return the cursor position relative to the user-defined window.


Calculated Fields Example

The following example uses SET SKIP to create a one-to-many relationship between two tables. There is a single record in the parent table (customer) for each invoice created. The child table (orders) contains multiple records for each record in the parent table.

After the relationship is created, an Edit window displaying records from both the parent and child tables is opened.

CLEAR

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer ORDER cust_id IN 0	&& Parent table

USE orders ORDER cust_id IN 0  && Child table

SELECT customer	  && Back to parent work area

SET RELATION TO cust_id INTO orders	  && Establish relationship

SET SKIP TO orders  && One-to-many relationship

WAIT WINDOW 'Scroll to see shipping dates for each customer' NOWAIT

EDIT FIELDS customer.cust_id :H='Customer Number', ;

customer.city :H='Customer City', orders.shipped_on


See Also

BROWSE
Grid Control
SET SKIP
WTITLE( )


EditBox Control

Syntax         Remarks         Properties         Events         Methods         See Also

Creates an edit box.

Syntax

EditBox

Remarks

Use the EditBox control for editing a Character-type variable, array element, field, or memo field.

All standard Visual FoxPro editing features, such as cut, copy, and paste, are available for the edit box. The text in the edit box scrolls vertically and words are wrapped horizontally.

For additional information about creating edit boxes, see Chapter 10, “Using Controls,” in the Developer’s Guide.


Properties

Alignment	AllowTabs	BackColor
BackStyle	BaseClass	BorderColor
BorderStyle	Class	ClassLibrary
ColorScheme	ColorSource	Comment
ControlSource	DisabledBackColor	DisabledForeColor
DragIcon	DragMode	Enabled
FontBold	FontCondense	FontExtend
FontItalic	FontName	FontOutline
FontShadow	FontSize	FontStrikeThru
FontUnderline	ForeColor	Format
Height	HelpContextID	HideSelection
Left	Margin	MaxLength
MousePointer	Name	Parent
ParentClass	ReadOnly	RightToLeft
ScrollBars	SelectedBackColor	SelectedForeColor
SelectOnEntry	SelLength	SelStart
SelText	SpecialEffect	StatusBarText
TabIndex	TabStop	Tag
TerminateRead	Text	ToolTipText
Top	Value	Visible
Width


Events

Click	DblClick	Destroy
DragDrop	DragOver	Error
ErrorMessage	GotFocus	Init
InteractiveChange	KeyPress	LostFocus
Message	MiddleClick Event	MouseDown
MouseMove	MouseUp	MouseWheel
ProgrammaticChange	RightClick	UIEnable
Valid	When


Methods

CloneObject	Drag	Move
ReadExpression	ReadMethod	Refresh
ResetToDefault	SaveAsClass	SetFocus
WriteExpression	WriteMethod	ZOrder


See Also

CREATE CLASS
CREATE FORM
DEFINE CLASS


EJECT Command

Syntax         Remarks         Example         See Also

Sends a formfeed to the printer.

Syntax

EJECT

Remarks

EJECT advances the printer to the top of the next page. EJECT sends a formfeed to the printer if the _PADVANCE system memory variable is set to FORMFEED. If _PADVANCE is set to LINEFEEDS, EJECT issues linefeeds to advance to the top of the next page.

EJECT resets PCOL( ) and PROW( ) values to the current column and row position of the printer's print head, but doesn't affect the value of the _PAGENO or _PLINENO system variables.


EJECT Command Example

In the following example, the company and phone fields in the customer table are printed. (Make sure a printer is attached and turned on for this example.) When the number of rows printed is greater than 62, the page is ejected.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens customer table

SET DEVICE TO PRINTER

SET PRINT ON

DO WHILE NOT EOF( )

@ PROW( )+1,10 SAY 'Company: ' + company

@ PROW( )+1,10 SAY 'Phone: ' + phone

@ PROW( )+1,1  SAY ''

IF PROW( ) > 62

EJECT

ENDIF

SKIP

ENDDO

SET PRINT OFF

SET DEVICE TO SCREEN


See Also

EJECT PAGE
ON PAGE
SET DEVICE
SET PRINTER
PCOL( )
PROW( )
System Variables Overview


EJECT PAGE Command

Syntax         Remarks         See Also

Sends a conditional page advance to the printer.

Syntax

EJECT PAGE

Remarks

Use EJECT PAGE to advance streaming output. The advance depends on the value of _PADVANCE and if an ON PAGE routine is in effect.

If _PADVANCE is set to FORMFEED and an ON PAGE routine isn't in effect, EJECT PAGE performs the following:

•	Sends a formfeed to the printer if the printer is online.

•	Sends linefeeds, as determined by the system memory variables _PLENGTH and _PLINENO, to the screen or to an alternate file or to both.

•	Increments _PAGENO by 1.

•	Sets _PLINENO to 0.

•	If the system memory variable _PADVANCE is set to LINEFEEDS, and if an ON PAGE routine is in effect and _PLINENO is less than the page line number specified in the ON PAGE routine, EJECT PAGE sends to the printer, to the main Visual FoxPro window, or to an alternate file or to both, as many linefeeds as needed to advance to the top of the next page.

If an ON PAGE routine is not in effect, or if _PADVANCE is set to LINEFEEDS and _PLINENO is greater than the page line number specified with ON PAGE, EJECT PAGE does the following:

•	Sends linefeeds, as determined by the system memory variables _PLENGTH and _PLINENO, to the printer, the main Visual FoxPro window, or to the alternate file or to both.

•	Increments _PAGENO by 1.

•	Sets _PLINENO to 0.


See Also

EJECT
ON PAGE
SET ALTERNATE
SET DEVICE
SET PRINTER
PCOL( )
PROW( )
System Variables Overview


EMPTY( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Determines whether an expression evaluates to empty.

Syntax

EMPTY(eExpression)

Returns

Logical

Arguments

eExpression   Specifies the expression that EMPTY( ) evaluates.

The expression you include can be a character, numeric, date, or logical expression, or the name of a memo or general field in an open table. EMPTY( ) returns true (.T.) when expressions evaluate to the following:

Expression type	Evaluates to
Character	The empty string, spaces, tabs, carriage returns, linefeeds, or any combination of these.
Numeric	0
Currency	0
Float	0
Integer	0
Double	0
Date	Empty (e.g. CTOD(''))
DateTime	Empty (e.g. CTOT(''))
Logical	False (.F.)
Memo	Empty (no contents)
General	Empty (no OLE object)
Picture	Empty (no picture)
EMPTY( ) cannot be used to determine if a variable object reference is empty. For example, a variable can contain an object reference for a form. If the form is closed from the form’s Control-menu box or with CLEAR WINDOWS, the variable contains the null value.

The following program example demonstrates how to use TYPE( ) and ISNULL( ) to determine if a variable object reference is valid.

goMyForm = CREATEOBJECT('Form')

WAIT WINDOW IIF(TYPE('goMyForm') = 'O' AND !ISNULL(goMyForm), ;

'goMyForm has valid object reference',;

'goMyForm does not have valid object reference')

Remarks

EMPTY( ) returns true (.T.) if the expression eExpression evaluates to empty; otherwise, EMPTY( ) returns false (.F.).


EMPTY( ) Function Example

The following example opens the customer table in the testdata database. FOR ... ENDFOR is used to create a loop in which EMPTY( ) s used to determine if TAG( ) returns the empty string. The name of each structural index tag is displayed with its candidate status.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer	  && Open customer table

FOR nCount = 1 TO 254

IF !EMPTY(TAG(nCount))  && Checks for empty string

? TAG(nCount)  && Display tag name

? CANDIDATE(nCount)  && Display candidate status

ELSE

EXIT  && Exit the loop when no more tags are found

ENDIF

ENDFOR


See Also

LEN( )


Enabled Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether an object can respond to user-generated events. Available at design time and run time.

Syntax

Object.Enabled[ = lExpr]

Settings

lExpr   The settings for the Enabled property are:

Setting	Description
True (.T.)	(Default) An object responds to events.
False (.F.)	An object does not respond to events.
Remarks

The Enabled property allows objects to be enabled or disabled at run time. For example, you can disable objects that do not apply to the current state of the application. You can also disable a control to restrict its use — for example, an edit box can be disabled to display read-only information. If a control is disabled, it cannot be selected.

When a container object has its enabled property set to false (.F.), all of its contained controls are disabled, too. If the user clicks on any of the controls contained in a disabled Form, for example, no events are triggered.

Disabling a Timer control by setting Enabled to false (.F.) cancels the countdown specified by the Timer control’s Interval property.


Applies To

CheckBox, Column, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, EditBox, Form, Grid, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, Page, PageFrame, _SCREEN, Shape, Spinner, TextBox, Timer, ToolBar


See Also

Click Event
DblClick Event
DragDrop Event
DragOver Event
DropDown Event
KeyPress Event
MouseDown Event
MouseMove Event
MouseUp Event
RightClick Event
Scrolled Event
Undock Event


END TRANSACTION Command

Syntax         Remarks         See Also

Ends the current transaction and saves any changes made to tables, table memo files, or index files included in a transaction.

Syntax

END TRANSACTION

Remarks

Any updates to the database that were made between the previous BEGIN TRANSACTION and the END TRANSACTION are committed. If the transaction is the first or only transaction (that is, the transaction isn’t nested), the changes are written to disk.

If a transaction is nested, END TRANSACTION causes all cached updates to be folded into the next higher transaction level. Nesting transactions has the potential to overwrite changes made to data at a higher transaction level.

If END TRANSACTION generates an error (for example, there is insufficient disk space to write changes to disk), changes made during the transaction are cancelled and the transaction ends.


See Also

BEGIN TRANSACTION
ROLLBACK
TXNLEVEL( )


EOF( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Determines whether the record pointer is positioned past the last record in the current or specified table.

Syntax

EOF([nWorkArea | cTableAlias])

Returns

Logical

Arguments

nWorkArea   Specifies the work area number of the table.

cTableAlias   Specifies the alias of the table.

EOF( ) returns false (.F.) if a table isn't open in the work area you specify.

If you do not specify a work area or alias, the table that is open in the currently selected work area is tested for the end of the table condition.

Remarks

EOF( ) returns true (.T.) if the record pointer reaches the end of the table file (EOF). The end of the table is reached when the record pointer passes the last record in the table. For example, when a FIND, LOCATE, or SEEK is unsuccessful, Visual FoxPro moves the record pointer past the last record, and EOF( ) returns true (.T.). EOF( ) returns false (.F.) if the record pointer isn't at the end of the table.


EOF( ) Function Example

The following example opens the customer table and lists the company name one page at a time until the end of the file is reached or you until you choose Cancel.

CLOSE DATABASES

CLEAR

OPEN DATABASE (HOME() + "samples\data\testdata")

USE customer

GO TOP

local recCtr, btnValue

recCtr = 0

btnValue = 1

DO WHILE btnValue = 1 AND NOT EOF()

    ? "Company : " + company

    recCtr = recCtr + 1

    if (recCtr % 20) = 0 then

        btnValue =MESSAGEBOX ("Click OK to continue, ;

             Cancel to quit.",33)

        clear

    endif

    Skip 1          && Move down one record

ENDDO

=MESSAGEBOX("Listing complete.",48)


See Also

BOF( )
GO | GOTO
SKIP


ERASE Command

Syntax         Arguments         Example         See Also

Erases a file from disk.

Syntax

ERASE FileName | ? [RECYCLE]

Arguments

FileName   Specifies the file to be erased. Include the path with the file name if the file is on a different drive or directory from the current drive or directory.

FileName can contain wildcard characters such as * and ?. For example, to erase backup files with ERASE *.BAK.

?   Displays the Delete dialog box, from which you can choose a file to erase.

RECYCLE   Specifies that the file isn’t immediately deleted from disk and is placed in the Windows 95 Recycle Bin.

Caution   Exercise caution when using ERASE. Any file erased with this command cannot be retrieved. You aren't warned before the file is erased, even if SET SAFETY is ON.


ERASE Command Example

In the following example, the structure of CUSTOMER.DBF and all records in which the country is USA are copied to a table named backup. The data in backup is then copied to a text file, temp, which is opened and then deleted when it is closed.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens customer table

COPY STRUCTURE TO backup

USE backup

APPEND FROM customer FOR country = 'USA'

COPY TO temp TYPE DELIMITED

WAIT WINDOW 'Press Esc to close and erase temp.txt' NOWAIT

MODIFY FILE temp.txt NOEDIT

ERASE temp.txt

? IIF(FILE('temp.txt'),'File not deleted','File deleted')

USE

ERASE backup.dbf


See Also

DELETE FILE


ERROR Command

Syntax         Arguments         Remarks         Example         See Also

Generates a Visual FoxPro error.

Syntax

ERROR nErrorNumber
| nErrorNumber, cMessageText1
| [cMessageText2]

Arguments

nErrorNumber   Specifies the number of the error to generate. The standard Visual FoxPro error message is used when an error number is specified.

For a list of Visual FoxPro error messages and their error numbers, see “Error Messages” in the Technical Reference section.

cMessageText1   Specifies the text displayed in an error message that supplies additional information about the error. For example, if you reference a memory variable that doesn’t exist, Visual FoxPro supplies the name of the memory variable in the error message.

cMessageText2   Specifies the text displayed in the error message. When cMessageText2 is specified instead of nErrorNumber, Visual FoxPro error number 1098 (user-defined error) is generated. Use a carriage return (CHR(13)) in cMessageText2 to move a portion of the error message to the next line.

Remarks

ERROR can be used to test error handling routines or to display custom error messages.

If an ON ERROR error handling routine is in effect when ERROR is issued, Visual FoxPro executes the ON ERROR routine. If an error occurs for an object, the object’s Error event is executed.

If you issue ERROR from the Command window and an ON ERROR error handling routine is not in effect, Visual FoxPro displays the error message. If ERROR is issued in a program and an ON ERROR error handling routine is not in effect, Visual FoxPro displays the error message and allows you to cancel or suspend the program or ignore the error.


ERROR Command Example

The following example generates three error messages. The first error message is the Visual FoxPro error message “Variable not found” (error number 12). The second error message again generates error 12, and includes a variable name of Myvariable. The last error message is a user-defined error message (error number 1089) “My error message.”

ERROR 12  && Generates the Visual FoxPro error "Variable not found"

ERROR 12, 'Myvariable'  && Variable 'Myvariable' not found error

ERROR 'My error message'  && Generates 'My error message' error


See Also

ON ERROR


Error Event

Syntax         Parameters         Remarks         Applies To         See Also

Occurs when there is a run-time error in a method.

Syntax

PROCEDURE Object.Error
LPARAMETERS [nIndex,] nError, cMethod, nLine

Parameters

Visual FoxPro passes the Error event three or four parameters in the following order:

nIndex   Uniquely identifies a control if it is in a control array.

nError   Contains the Visual FoxPro error number. For a numerical listing of errors, see Error Messages in the Technical Reference section.

cMethod   Contains the name of the method that caused the error. However, if a method calls a user-defined function, and an error occurs within that function, cMethod contains the name of the user-defined function, rather than the name of the method that called the function.

nLine   Contains the line number within the method or user-defined function that caused the error.

Remarks

The Error event allows an object to handle errors.This event overrides the current ON ERROR routine and allows each object to trap and handle errors internally.

Important     The Error event is called only when the error occurs in code.


Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, Cursor, Custom, DataEnvironment, EditBox, Form, FormSet, Grid, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, Page, PageFrame, Relation, Shape, Spinner, TextBox, Timer, ToolBar


See Also

ON ERROR


ERROR( ) Function

Syntax         Returns         Remarks         Example         See Also

Returns the error number for the error that triggered an ON ERROR routine.

Syntax

ERROR( )

Returns

Numeric

Remarks

ERROR( ) returns the number of the most recent error. An ON ERROR routine must be active for ERROR( ) to return a value other than 0.

When an error is trapped during program execution, the error type can be returned by ERROR( ) in an ON ERROR routine. The corresponding error message can be returned by MESSAGE( ).

The value ERROR( ) returns is reset by RETURN or RETRY.

For a numerical listing of each error number and the corresponding error message, see “Error Messages” in the Technical Reference section.


ERROR( ) Function Example

The following example demonstrates a simple error-handling routine that displays a message when an error occurs.

CLEAR

ON ERROR DO errhand WITH ERROR( ), MESSAGE( )

*** The next line generates an error - there is no BRWSE command

BRWSE

ON ERROR

RETURN

*** Error handler ***

PROCEDURE errhand

PARAMETER errnum,message

? Message

? 'Error number: '+ ALLTRIM(STR(Errnum))

RETURN


See Also

MESSAGE( )
ON ERROR
RETRY
RETURN


ErrorMessage Event

Included for backward compatibility with FoxPro 2.x. Use the Valid Event instead.


Eval Method

Syntax         Returns         Settings         Remarks        Applies To          See Also

Evaluates an expression and returns the result for an instance of the Visual FoxPro application automation server.

Syntax

ApplicationObject.Eval(cExpression)

Returns

Character, Numeric, Currency, Date, DateTime, Logical, or Memo

Settings

cExpression   Specifies the expression to evaluate. cExpression can be a literal character string, or a valid Visual FoxPro expression, variable, array element, or field of any data type, enclosed in quotation marks.

Remarks

cExpression must be a legal Visual FoxPro character expression.


Applies To

Application Object, _VFP System Variable


See Also

DoCmd Method, SetVar Method


EVALUATE( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Evaluates a character expression and returns the result.

Syntax

EVALUATE(cExpression)

Returns

Character, Numeric, Currency, Date, DateTime, Logical, or Memo

Arguments

cExpression   Specifies the expression to evaluate. cExpression can be a literal character string, or a valid Visual FoxPro expression, variable, array element, or field of any data type, enclosed in quotation marks. cExpression cannot exceed 255 characters.

Whenever possible, use EVALUATE( ) or a name expression to replace macro substitution using &. EVALUATE and name expressions execute faster than macro substitution.

Remarks

EVALUATE( ) is similar to TYPE( ) but returns the result of an expression instead of the expression type. An expression containing EVALUATE( ) cannot be optimized by Rushmore.


See Also

TYPE( )


Exclusive Property

Syntax         Settings         Remarks         See Also

Specifies whether a table associated with a Cursor object is opened exclusively. Available at design time; read-write at run time.

Syntax

DataEnvironment.Cursor.Exclusive[ = lExpr]

Settings

lExpr   The settings for the Exclusive property are:

Setting	Description
True (.T.)	(Default) The table associated with the Cursor is opened exclusively when the data environment is loaded.
False (.F.)	The table associated with the cursor is not opened exclusively when the data environment is loaded.
Remarks

Note   When the Cursor object is accessed using CURSORSETPROP( ), the Exclusive property is read-only at run time.

When the data environment is loaded, each table associated with a Cursor can be opened exclusively (no other user in a multiuser environment can access the table) or in shared mode. Use the Exclusive property to specify how the table is accessed.

Note   If you set the DataSession property to 2 (Private Data Session), the default setting of the Exclusive property for all Cursor objects in the data environment is changed to false (.F.).

For views, the View object itself is always opened in shared mode. However, the tables that define the view are affected by the Exclusive property. For local views, the Visual FoxPro tables that define the view are opened in exclusive or shared mode, depending on the setting of the Exclusive property. The Exclusive property has no effect on remote views.

The Exclusive property mimics the behavior of the USE command’s EXCLUSIVE and SHARE clauses.


Applies To

Cursor


See Also

DataSession Property
SET EXCLUSIVE
USE


EXIT Command

Syntax         Remarks         Example         See Also

Exits a DO WHILE, FOR, or SCAN loop.

Syntax

EXIT

Remarks

EXIT transfers control from within a DO WHILE ... ENDDO, FOR ... ENDFOR, or SCAN ... ENDSCAN loop to the command immediately following ENDDO, ENDFOR, or ENDSCAN.


EXIT Command Example

In the following example, the number of products in stock priced over 20 dollars is totaled in the DO WHILE loop until the end of the file (EOF) is encountered. The DO WHILE loop is exited and the total is displayed.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE products  && Opens Products table

SET TALK OFF

gnStockTot = 0

DO WHILE .T.	  && Beginning of loop

IF EOF( )

EXIT

ENDIF

IF unit_price < 20

SKIP

LOOP

ENDIF

gnStockTot = gnStockTot + in_stock

SKIP

ENDDO  && End of loop

CLEAR

? 'Total items in stock valued over 20 dollars:'

?? gnStockTot


See Also

DO WHILE ... ENDDO
FOR ... ENDFOR
SCAN ... ENDSCAN


EXP( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the value of e^x where x is a specified numeric expression.

Syntax

EXP(nExpression)

Returns

Numeric

Arguments

nExpression   Specifies the exponent, x, in the exponential expression e^x.

Remarks

The value of e, the base of natural logarithms, is approximately 2.71828. The number of decimal places returned by EXP( ) is specified with SET DECIMALS.


EXP( ) Function Example

? EXP(0)  && Displays 1.00

? EXP(1)  && Displays 2.72


See Also

LOG( )
SET DECIMALS


EXPORT Command

Syntax         Arguments         Remarks         See Also

Copies data from a Visual FoxPro table to a file in a different format.

Syntax

EXPORT TO FileName
[TYPE] DIF | MOD | SYLK | WK1 | WKS | WR1 | WRK | XLS | XL5
[FIELDS FieldList]
[Scope]
[FOR lExpression1]
[WHILE lExpression2]
[NOOPTIMIZE]
[AS nCodePage]

Arguments

FileName   Specifies the name of the file to which Visual FoxPro exports data. If you do not include an extension with the file name, the default extension for the specified file type is assigned.

TYPE   Specifies the type of file to be created. The TYPE keyword is optional, but you must specify one of the following file types.

File type	Description
DIF	Each field from a Visual FoxPro table becomes a vector (column) and each record becomes a tuple (row) in a DIF (Data Interchange Format) file, used by VisiCalc. The new file name is assigned a .DIF extension if an extension isn't included in FileName.
MOD	Use the MOD clause to export to a file in Microsoft Multiplan version 4.01 MOD format. The new file name is assigned a .MOD extension if you don't include an extension in FileName.
SYLK	A Symbolic Link interchange format (used by Microsoft Multiplan) in which each field from a Visual FoxPro table becomes a column in the spreadsheet and each record becomes a row. By default, SYLK file names have no extension.
WK1	Include this option to create a Lotus 1-2-3 spreadsheet from a Visual FoxPro table. A .WK1 extension is assigned to the spreadsheet file name for use with Lotus 1-2-3 revision 2.x. Each field from the table becomes a column in the new spreadsheet, and each record in the table becomes a spreadsheet row.
WKS	Include this option to create a Lotus 1-2-3 spreadsheet from a Visual FoxPro table. A .WKS extension is assigned to the spreadsheet file name for use with Lotus 1-2-3 revision 1-A. Each field from the table becomes a column in the new spreadsheet, and each record becomes a row in the spreadsheet.
WR1	Include this option to create a Lotus Symphony spreadsheet from a Visual FoxPro table. A .WR1 extension is assigned to the spreadsheet for use with Symphony version 1.01. Each field from the table becomes a column in the new spreadsheet, and each record in the table becomes a row in the spreadsheet.
WRK	Include this option to create a Lotus Symphony spreadsheet from a Visual FoxPro table. A .WRK extension is assigned to the spreadsheet file name for use with Symphony version 1.10. Each field from the table becomes a column in the new spreadsheet, and each record in the table becomes a row in the spreadsheet.
XLS	Include this option to create a Microsoft Excel worksheet from a Visual FoxPro table. Each field in the selected table becomes a column in the worksheet, and each table record becomes a row. An .XLS file name extension is assigned to the newly created worksheet file unless you specify a different extension.
XL5	Include this option to create a Microsoft Excel version 5.0 worksheet file from a Visual FoxPro table. Each field from the currently selected table becomes a column in the spreadsheet and each record becomes a row. An .XLS extension is assigned to the new worksheet if you do not include a file extension.
FIELDS FieldList   Specifies which fields are copied to the new file. If you omit the FIELDS clause, all fields are copied to the new file. Memo and general fields are not copied to the new file even if their names are included in the field list.

Scope   Specifies a range of records to copy to the new file. Scope   Specifies a range of records to copy to the new file. Only the records that fall within the range are copied to the new file. The scope clauses are: ALL, NEXT nRecords, RECORD nRecordNumber, and REST.

For more information on scope clauses, see Scope Clauses. Commands that include Scope operate only on the table in the active work area.

The default scope for EXPORT is all records.

FOR lExpression1   Specifies that only records that satisfy the logical condition lExpression1 are copied to the new file. Using this argument allows you to filter out undesired records.

Rushmore optimizes an EXPORT ... FOR lExpression1 command if lExpression1 is an optimizable expression. For best performance, use an optimizable expression in the FOR clause.

For more information, see SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

WHILE lExpression2   Specifies a condition whereby records are copied to the new file for as long as the logical expression lExpression2 evaluates to true (.T.).

NOOPTIMIZE   Disables Rushmore optimization of EXPORT.

For more information, see SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

AS nCodePage   Specifies the code page for the file EXPORT creates. Visual FoxPro copies the contents of the currently selected table, and, as it copies the data, automatically converts the data to the code page you specify for the new file. If possible, Visual FoxPro marks the newly created file with the code page you specify.

If you specify a value for nCodePage that is not supported, Visual FoxPro generates an error message. You can use GETCP( ) for nCodePage to display the Code Page dialog box, allowing you to specify a code page for the file Visual FoxPro creates.

If you omit AS nCodePage, no code page conversion occurs. If possible, Visual FoxPro marks the newly created file with the code page of the table from which the data is copied.

If nCodePage is 0, no code page conversion occurs and the newly created file is not marked with a code page.

Remarks

Use EXPORT to use Visual FoxPro data in other software packages.

If the table you are exporting from is indexed, the new file is created in the indexed order.


See Also

APPEND FROM
COPY TO
GETCP( )
IMPORT


EXTERNAL Command

Syntax         Arguments         Remarks         See Also

Alerts the Project Manager to an undefined reference.

Syntax

EXTERNAL FILE FileList | ARRAY ArrayList
| CLASS | FORM | LABEL | LIBRARY | MENU
| PROCEDURE | QUERY | REPORT | SCREEN | TABLE

Arguments

FILE FileList   Specifies that the file you include in an indirect file reference or macro substitution is a stand-alone file, such as a text file, .BMP bitmap file, and so on. FileList may contain a list of file names separated by commas.

ARRAY ArrayList   When an array is created in a program and then used in a lower-level program, include ARRAY with the array name in the lower-level program. ArrayList may contain a list of array names separated by commas.

In the following example, the first program creates an array named gaInvoice. The array is initialized and a lower-level program named dispinvo is called. dispinvo displays the contents of the array created in the higher-level program. The command EXTERNAL ARRAY GAINVOICE is included to alert the Project Manager.

DIMENSION gaInvoice(4)

STORE 'Paid' TO gaInvoice

DO dispinvo

*** Program dispinvo ***

PROCEDURE dispinvo

EXTERNAL ARRAY gaInvoice

? gaInvoice(1)

? gaInvoice(2)

? gaInvoice(3)

? gaInvoice(4)

RETURN

*** End of dispinvo program ***

When an array is passed to a user-defined function or procedure, the corresponding array in the user-defined function or procedure must be identified to the Project Manager. Include the ARRAY option with the name of the array included in the PARAMETER statement.

DIMENSION gaArrayOne(2)	&& Create an array

EXTERNAL ARRAY gaArrayTwo	&& Name of the array used in the UDF

SET TALK OFF

STORE 10 TO gaArrayOne(1)

STORE  2 TO gaArrayOne(2)

= ADDTWO(@gaArrayOne)	&& Pass the array by reference to a UDF

FUNCTION ADDTWO

PARAMETER gaArrayTwo

CLEAR

gaArrayTwo(1) = gaArrayTwo(1) + 2

gaArrayTwo(2) = gaArrayTwo(2) + 2

? gaArrayTwo(1)

? gaArrayTwo(2)

CLASS   Specifies that the file you include in an indirect file reference or macro substitution is a visual class library.

EXTERNAL CLASS myvclass  && CLASS myvclass must exist

STORE 'myvclass' TO gcClassFile

MODIFY CLASS (gcClassFile)

FORM   If a Form definition file is included in an indirect file reference or macro substitution, include FORM and the Form file name. FORM is identical to SCREEN.

EXTERNAL FORM dataentr  && FORM dataentr must exist

STORE 'dataentr' TO gcFormFile

DO FORM (gcFormFile)

LABEL   Specifies that the file you include in an indirect file reference or macro substitution is a label definition file.

EXTERNAL LABEL Maillabl	  && LABEL FORM Maillabl must exist

STORE 'Maillabl' TO gcLabelFile

LABEL FORM (gcLabelFile) PREVIEW

LIBRARY   Include LIBRARY when a library file is referenced by indirect file referencing or macro substitution in SET LIBRARY.

EXTERNAL LIBRARY regress  && LIBRARY regress must exist

STORE 'regress' TO gcStatFunc

SET LIBRARY TO (gcStatFunc)

MENU   If a menu definition file is included in an indirect file reference or macro substitution, include MENU and the menu file name.

EXTERNAL MENU pickfile  && MENU pickfile must exist

STORE 'pickfile' TO gcSysMenPad

MODIFY MENU (gcSysMenPad)

PROCEDURE   Identifies an external procedure or user-defined function.

EXTERNAL PROCEDURE delblank	  && PROCEDURE delblank must exist

STORE 'delblank' TO gcTrimBlanks

DO (gcTrimBlanks) WITH 'A B C D E'

QUERY   Specifies that the file you include in an indirect file reference or macro substitution is a query file.

EXTERNAL QUERY sales  && QUERY sales must exist

STORE 'sales.qpr' TO gcSalesFile

DO (gcSalesFile)

REPORT   Specifies that the file you include in an indirect file reference or macro substitution is a report definition file.

EXTERNAL REPORT overdue	  && REPORT overdue must exist

STORE 'overdue' TO gcReportFile

REPORT FORM (gcReportFile) PREVIEW

SCREEN   If a form definition file is included in an indirect file reference or macro substitution, include SCREEN and the screen file name. SCREEN is identical to FORM.

EXTERNAL SCREEN dataentr  && SCREEN dataentr must exist

STORE 'dataentr' TO gcScreenFile

MODIFY SCREEN (gcScreenFile)

TABLE   Specifies that the file you include in an indirect file reference or macro substitution is a Visual FoxPro table.

EXTERNAL TABLE customer && Table customer must exist

STORE 'customer' TO gcMyTable

USE (gcMyTable)

Remarks

Use EXTERNAL to include files and to resolve undefined references in a project created by the Project Manager. EXTERNAL is used only by the Project Manager and is ignored during program execution.

For more information on creating projects with the Project Manager, see “Using the Project Manager” in Chapter 15, “Compiling an Application,” in the Developer's Guide.

Files whose names you specify with EXTERNAL are included in a project by the Project Manager. You must include CLASS, FILE, FORM, LABEL, LIBRARY, MENU, PROCEDURE, QUERY, REPORT, SCREEN, or TABLE before the file name or a set of file names separated with commas to tell the Project Manager the type of files to include in the project.

The Project Manager must also be alerted to file names contained in a name expression or macro substitution. This ensures that all necessary files are included in a project when the project is built. It must also be alerted to arrays that are created in another procedure or user-defined function.

For more information on name expressions and macro substitution, see the & command. Whenever possible, use a name expression instead of macro substitution to improve performance.


See Also

BUILD APP
BUILD PROJECT


FCHSIZE( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Changes the size of a file opened with a low-level file function.

Syntax

FCHSIZE(nFileHandle, nNewFileSize)

Returns

Numeric

Arguments

nFileHandle   Specifies the file handle of the file whose size you wish to change. The file handle is returned by FOPEN( ) when you open the file or by FCREATE( ) when you create the file. If a file is opened with FOPEN( ), it must be opened with write or read-write privileges to be able to change its size.

nNewFileSize   Specifies the new file size in bytes. If nNewFileSize is less than the original file size, the file is truncated. If nNewFileSize is greater than the original file size, the file size is increased.

Remarks

Use FCHSIZE( ) to increase the file’s size or truncate the file after a specified byte.

When a file’s size is increased, Visual FoxPro allocates sectors for the file on the drive where the file is opened. Since FCHSIZE( ) doesn’t initialize the new file space, the space can contain previous data. Be sure to manage the new file space.

The final size of the file in bytes is returned. Visual FoxPro returns –1 if FCHSIZE( ) is unable to change the file size, if, for example, an invalid file handle is specified because of insufficient disk space, or if the file is read-only.

Tip   This function can be used to truncate a file to length 0.


See Also

FCLOSE( )
FCREATE( )
FEOF( )
FFLUSH( )
FGETS( )
FOPEN( )
FPUTS( )
FREAD( )
FSEEK( )
FWRITE( )


FCLOSE( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Flushes and closes a file or communication port opened with a low-level file function.

Syntax

FCLOSE(nFileHandle)

Returns

Logical

Arguments

nFileHandle   Specifies the file handle of the low-level file to close. The numeric file handle is returned when you create the file with FCREATE( ) or open the file with FOPEN( ).

Remarks

If the file is successfully closed, FCLOSE( ) returns true (.T.) and releases the file handle. If the file cannot be closed, FCLOSE( ) returns false (.F.).

CLOSE ALL also closes low-level files.


See Also

CLOSE ALL
FCHSIZE( )
FCREATE( )
FEOF( )
FFLUSH( )
FGETS( )
FOPEN( )
FPUTS( )
FREAD( )
FSEEK( )
FWRITE( )


FCOUNT( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the number of fields in a table.

Syntax

FCOUNT([nWorkArea | cTableAlias])

Returns

Numeric

Arguments

nWorkArea   Specifies the work area of the table for which FCOUNT( ) returns the number of fields.

FCOUNT( ) returns 0 if a table isn’t open in the work area you specify.

cTableAlias   Specifies the alias of the table for which FCOUNT( ) returns the number of fields.

Visual FoxPro generates an error message if you specify a table alias that doesn’t exist.

Remarks

If you omit the optional arguments, FCOUNT( ) returns the number of fields in the table open in the currently selected work area.


FCOUNT( ) Function Example

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

SELECT 0

USE employee  && Opens employee table

CLEAR

? FCOUNT('CUSTOMER')	  && Displays 13, # of fields in Customer

? FCOUNT('EMPLOYEE')  && Displays 22, # of fields in Employee


See Also

DBF( )
FIELD( )
FSIZE( )


FCREATE( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Creates and opens a low-level file.

Syntax

FCREATE(cFileName [, nFileAttribute])

Returns

Numeric

Arguments

cFileName   Specifies the name of the file to create. You can include a drive designator and path with the file name. If a drive designator or path isn’t included, the file is created in the default directory.

Note   Visual FoxPro will not recognize a path name properly if a disk or directory name contains an exclamation point (!).

nFileAttribute   Specifies the attributes of the file created. The following table lists the file attributes you can specify.

nFileAttribute	File attributes
0	(Default) Read-Write
1	Read-Only
2	Hidden
3	Read-Only/Hidden
4	System
5	Read-Only/System
6	System/Hidden
7	Read-Only/Hidden/System
Note that a file created with nFileAttribute other than 0 cannot be written to with FPUTS( ) or FWRITE( ) until the file is closed and opened again.

Use DISPLAY STATUS or LIST STATUS to display or print information about files created and opened with FCREATE( ). DISPLAY STATUS and LIST STATUS give the following information about each file opened or created with a low-level file function:

•	   The drive, directory, and file name

•	The file handle number

•	The file pointer position

•	The read-write attributes

Remarks

If a file with the name you specify already exists, it is overwritten without warning.

FCREATE( ) assigns a file handle number to the file, which you can use to identify the file in other Visual FoxPro low-level file functions. FCREATE( ) returns the file handle number when a file is created, or returns –1 if the file cannot be created.

Tip   Assign the file handle number to a memory variable so you can access the file by the variable in other low-level file functions.

You cannot open a communication port with FCREATE( ). Use FOPEN( ) to open a communication port.


FCREATE( ) Function Example

IF FILE('errors.txt')  && Does file exist?

gnErrFile = FOPEN('errors.txt',12)  	&& If so, open read-write

ELSE

gnErrFile = FCREATE('errors.txt')  && If not create it

ENDIF

IF gnErrFile < 0	  && Check for error opening file

WAIT 'Cannot open or create output file' WINDOW NOWAIT

ELSE  && If no error, write to file

=FWRITE(gnErrFile , 'Error information to be written here')

ENDIF

=FCLOSE(gnErrFile )	  && Close file

IF gnErrFile > 0

MODIFY FILE errors.txt NOWAIT  && Open file in edit window

ENDIF


See Also

CLOSE ALL
FCHSIZE( )
FCREATE( )
FEOF( )
FFLUSH( )
FGETS( )
FOPEN( )
FPUTS( )
FREAD( )
FSEEK( )
FWRITE( )


FDATE( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the last modification date for a file.

Syntax

FDATE(cFileName)

Returns

Date

Arguments

cFileName   Specifies the name of the file whose last modification date FDATE( ) returns. cFileName can include a path with the file name. If a path is not included with the file name, Visual FoxPro searches for the file in the default directory or folder and in any directories or folders specified with SET PATH.

Remarks

The date that FDATE( ) returns is assigned to the file by the operating system. The format of the value returned by FDATE( ) is determined by the current settings of SET DATE, SET MARK, and SET CENTURY.

Use LUPDATE( ) to determine the last modification date for an open table.


FDATE( ) Function Example

The following example uses FDATE( ) to display the last modification date for FOXUSER.DBF, the Visual FoxPro resource file.

? FDATE('FOXUSER.DBF')  && Displays the last modification date


See Also

FTIME( )
LUPDATE( )


FEOF( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Determines whether the file pointer is positioned at the end of a file.

Syntax

FEOF(nFileHandle)

Returns

Logical

Arguments

nFileHandle   Specifies the file handle number of the file to check for the end-of-file condition. FEOF( ) always returns true (.T.) if you specify a file handle number of a communication port opened with FOPEN( ).

Remarks

This low-level file function returns true (.T.) if the file pointer is positioned at the end of a file opened with a low-level file function. FEOF( ) returns false (.F.) if the file pointer isn’t at the end of the file.


FEOF( ) Function Example

*** Open the file test.txt ***

gnFileHandle = FOPEN('test.txt')

*** Move the file pointer to BOF ***

gnPosition = FSEEK(gnFileHandle, 0)

*** If file pointer is at BOF and EOF, the file is empty ***

*** Otherwise the file must have something in it ***

IF FEOF(gnFileHandle)

WAIT WINDOW 'This file is empty!' NOWAIT

ELSE

WAIT WINDOW 'This file has something in it!' NOWAIT

ENDIF

= FCLOSE(gnFileHandle)


See Also

FCHSIZE( )
FCLOSE( )
FCREATE( )
FGETS( )
FOPEN( )
FPUTS( )
FREAD( )
FSEEK( )
FWRITE( )


FERROR( ) Function

Syntax         Returns         Remarks         See Also

Returns a number corresponding to the most recent low-level file function error.

Syntax

FERROR( )

Returns

Numeric

Remarks

FERROR( ) returns 0 if a low-level file function executes successfully. A positive value is returned if a function doesn’t execute successfully. The following table lists each error number returned by FERROR( ) and the cause of the error.

Error number	Error cause
2	File not found
4	Too many files open (out of file handles)
5	Access denied
6	Invalid file handle given
8	Out of memory
25	Seek error (can’t seek before the start of a file)
29	Disk full
31	Error opening file


See Also

FCHSIZE( )
FCLOSE( )
FCREATE( )
FEOF( )
FFLUSH( )
FGETS( )
FOPEN( )
FPUTS( )
FREAD( )
FSEEK( )
FWRITE( )


FFLUSH( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Flushes to disk a file opened with a low-level function.

Syntax

FFLUSH(nFileHandle)

Returns

Logical

Arguments

nFileHandle   Specifies the file handle of the file to flush to disk.

Remarks

FFLUSH( ) also releases the memory used by the file’s buffer.

FLUSH is different from the FFLUSH( ) function. FLUSH doesn’t operate on low-level files but rather on tables and indexes.


FFLUSH( ) Function Example

The following example opens and writes to a file named INPUT.DAT. After writing the first two strings, the program flushes the buffers to ensure that the strings are written to disk. It then writes the next two strings, flushes the buffers again and closes the file.

IF FILE('input.dat')

gnTestFile = FOPEN('input.dat',2)

ELSE

gnTestFile = FCREATE('input.dat')

ENDIF

gnIOBytes = FWRITE(gnTestFile,'Test output')

gnIOBytes = FWRITE(gnTestFile,' for low-level file I/O')

glFlushOk = FFLUSH(gnTestFile)

gnIOBytes = FWRITE(gnTestFile,'Test output2')

gnIOBytes = FWRITE(gnTestFile,' for low-level file I/O')

glFlushOk = FFLUSH(gnTestFile)

glCloseOk = FCLOSE(gnTestFile)

MODIFY FILE input.dat NOWAIT NOEDIT


See Also

FCHSIZE( )
FCLOSE( )
FCREATE( )
FEOF( )
FGETS( )
FOPEN( )
FPUTS( )
FREAD( )
FSEEK( )
FWRITE( )


FGETS( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns a series of bytes from a file or a communication port opened with a low-level file function until it encounters a carriage return.

Syntax

FGETS(nFileHandle [, nBytes])

Returns

Character

Arguments

nFileHandle   Specifies the numeric file handle of the file or communication port from which FGETS( ) returns data.

nBytes   Specifies the number of bytes FGETS( ) returns. FGETS( ) returns nBytes bytes unless a carriage return is encountered first. FGETS( ) returns data between the starting file-pointer position and the carriage return if a carriage return is encountered within nBytes bytes.

If you omit nBytes, FGETS( ) returns a maximum of 254 bytes by default.

Remarks

You can read a file line-by-line by issuing a series of FGETS( ).

FGETS( ) returns a series of bytes as a character string. Data is returned starting from the current file’s pointer position and continuing until a carriage return is encountered. The file pointer is then positioned on the byte immediately following the carriage return. The carriage return isn’t returned as part of the string, and linefeeds are discarded.


FGETS( ) Function Example

*** TEST.TXT must exist ***

STORE FOPEN('test.txt') TO gnFileHandle 	&& Open the file

STORE FSEEK(gnFileHandle, 0, 2) TO gnEnd	 && Move pointer to EOF

STORE FSEEK(gnFileHandle, 0) TO gnTop  	&& Move pointer to BOF

IF gnEnd <= 0  && Is file empty?

WAIT WINDOW 'This file is empty!' NOWAIT

ELSE  && If not

gcString = FGETS(gnFileHandle, gnEnd)  && Store contents

? gcString

ENDIF

= FCLOSE(gnFileHandle)  && Close the file


See Also

FCHSIZE( )
FCLOSE( )
FCREATE( )
FEOF( )
FFLUSH( )
FOPEN( )
FPUTS( )
FREAD( )
FSEEK( )
FWRITE( )


FIELD( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the name of a field, referenced by number, in a table.

Syntax

FIELD(nFieldNumber [, nWorkArea | cTableAlias])

Returns

Character

Arguments

nFieldNumber   Specifies the field number. If nFieldNumber is 1, the name of the first field in the table is returned; if nFieldNumber is 2, the name of the second field is returned, and so on. The empty string is returned if nFieldNumber is greater than the number of fields. Field names are returned in upper-case.

nWorkArea   Specifies the work area of the table for which FIELD( ) returns field names.

FIELD( ) returns the empty string if a table isn’t open in the work area you specify.

cTableAlias   Specifies the alias of the table for which FIELD( ) returns field names.

Visual FoxPro generates an error message if you specify a table alias that doesn’t exist.

Remarks

If you omit the optional arguments, FIELD( ) returns the names of the fields in the table open in the currently selected work area.


FIELD( ) Function Example

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

CLEAR

FOR gnCount = 1 TO FCOUNT( )  && Loop for number of fields

? FIELD(gnCount)  && Display each field

NEXT

?

? 'Number of fields: ' + ALLTRIM(STR(gnCount -1))


See Also

DISPLAY STRUCTURE
FCOUNT( )
FSIZE( )


FILE( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns true (.T.) if the specified file is found on disk.

Syntax

FILE(cFileName)

Returns

Logical

Arguments

cFileName   Specifies the name of the file to locate. cFileName must include the file’s extension. Visual FoxPro looks in the default directory or folder for the file. If the file cannot be found in the default directory or folder, Visual FoxPro searches along the Visual FoxPro path which is established with SET PATH.

You can include a path with the file name to search for a file in a directory or on a drive other than the current directory or drive.

Remarks

Use FILE( ) to find a file on disk. FILE( ) returns true (.T.) if the file can be found; otherwise FILE( ) returns false (.F.).


FILE( ) Function Example

The following example displays a message indicating if the Visual FoxPro resource file is present in the Visual FoxPro start up directory or folder.

SET PATH TO HOME( )

CLEAR

IF FILE('foxuser.dbf')

WAIT WINDOW 'Visual FoxPro resource file present'

ELSE

WAIT WINDOW 'Visual FoxPro resource file not present'

ENDIF


See Also

FULLPATH( )
GETFILE( )
LOCFILE( )


FillColor Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the color used to fill shapes drawn on an object by graphics routines. Available at design time and run time.

Syntax

Object.FillColor[ = nColor ]

Object.FillColor[ = RGB(nRedValue, nGreenValue, nBlueValue) ]

Settings

nColor   Specifies a single number to represent the color. By default, FillColor is set to 0 (Black). For more information on color settings, see the BackColor, ForeColor Properties topic.

nRedValue, nGreenValue, nBlueValue   Specifies three separate color intensities that compose the fill color; must be used with the RGB( ) function to consolidate the three color components into one number, which is what the FillColor property is.

Note   In the Properties window, you can double-click any of the color properties to display the Color dialog box. You can choose or define colors from this dialog box. The red, green, and blue intensities that correspond to the color you choose become the settings for these properties after you close the Color dialog box.

Remarks

When the FillStyle property is set to its default, 1 (Transparent), the FillColor setting is ignored.

Only an enclosed shape, such as a circle, box, or ellipse can be filled.

Shape objects use the BackColor property to specify the fill color.


Applies To

Form, _SCREEN, Shape


See Also

BackColor Property
BorderColor Property
Box Method
Circle Method
FillStyle Property
ForeColor Property
GETCOLOR( )
RGB( )


FillStyle Property

Syntax         Settings         Applies To         See Also

Specifies the pattern used to fill shapes and figures created with the Circle and Box graphics methods. Available at design time and run time.

Syntax

Object.FillStyle[ = nStyle]

Settings

nStyle   Specifies the pattern used to fill a shape or figure. The settings for the FillStyle property are:

Setting	Description
0	Solid.
1	(Default) Transparent. The FillColor property is ignored.
2	Horizontal Line.
3	Vertical Line.
4	Upward Diagonal. Upward diagonal lines from upper left to lower right.
5	Downward Diagonal. Downward diagonal from lower left to upper right.
6	Cross. Crossed vertical and horizontal lines forming squares.
7	Diagonal Cross.


Applies To

Form, _SCREEN, Shape


See Also

BorderStyle Property
Box Method
Circle Method
DrawMode Property
DrawStyle Property
DrawWidth Property
FillColor Property


Filter Property

Syntax         Settings         Remarks         Applies To         See Also

Excludes records that do not meet the criteria in the specified expression. Available at design time; read-write at run time.

Syntax

DataEnvironment.Cursor.Filter[ = cExpr]

Settings

cExpr   Any Visual FoxPro expression, typically an expression that operates on a set of records.

Remarks

Mimics the behavior of SET FILTER.

Note   When the Cursor object is accessed using CURSORSETPROP( ), the Filter property is read-only at run time.


Applies To

Cursor


See Also

SET FILTER


FILTER( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the table filter expression specified in SET FILTER.

Syntax

FILTER([nWorkArea | cTableAlias])

Returns

Character

Arguments

nWorkArea   Specifies the work area of the table for which FILTER( ) returns the filter expression.

FILTER( ) returns the empty string if a table isn’t open in the work area you specify.

cTableAlias   Specifies the alias of the table for which FILTER( ) returns the filter expression.

Visual FoxPro generates an error message if you specify a table alias that doesn’t exist.

Remarks

If you omit the optional arguments, FILTER( ) returns the filter expression for the table open in the currently selected work area. For more information about creating a filter, see SET FILTER.


FILTER( ) Function Example

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

SET TALK ON

SET FILTER TO SUBSTR(cust_id,1) = 'B'

CLEAR

? FILTER( )  && Display filter expression

STORE FILTER('customer') TO gcOldFilter 	&& Save filter expression

SET FILTER TO country = 'USA'

? FILTER( )  && Display filter expression

SET FILTER TO &gcOldFilter	 && Restore filter expression

? FILTER( )  && Display filter expression

LIST FIELDS cust_id, contact  && Demonstrate filter condition


See Also

SET FILTER


FIND Command

Included for backward compatibility. Use SEEK instead.


FirstElement Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the first element of an array to display in a ComboBox or ListBox control. Available at design time and run time.

Syntax

Control.FirstElement[ = nElement]

Settings

nElement   Specifies which element in the array is displayed as the first element in the list.

Remarks

This property is available only when the RowSource is an array (RowSourceType = 5).


Applies To

ComboBox, ListBox


See Also

NumberOfElements Property
RowSource Property


FKLABEL( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the name of the function key (F1, F2, F3 ...) from the key’s corresponding function key number.

Syntax

FKLABEL(nFunctionKeyNumber)

Returns

Character

Arguments

nFunctionKeyNumber   Specifies the function key number. The value of nFunctionKeyNumber should be from 0 through the number of function keys minus 1. FKLABEL( ) returns the empty string if nFunctionKeyNumber is greater than the number of function keys minus 1. The number of function keys can be determined with FKMAX( ).

Remarks

Function keys can be programmed with SET FUNCTION.

The value returned by FKLABEL( ) is affected by SET COMPATIBLE. When COMPATIBLE is set to FOXPLUS (the default), FKLABEL( ) returns the function keys. When COMPATIBLE is set to DB4, FKLABEL( ) returns the function key and function key combinations (F1, CTRL+F1, SHIFT+F1, F2, CTRL+F2, SHIFT+F2, ...).


FKLABEL( ) Function Example

CLEAR

SET COMPATIBLE OFF

? 'COMPATIBLE OFF'

?

FOR nCount = 1 TO FKMAX( )  && Loop for # of function keys

? FKLABEL(nCount)  && Display programmable function keys

ENDFOR

SET COMPATIBLE ON

?

? 'COMPATIBLE ON'

?

FOR nCount = 1 TO FKMAX( )  && Loop for # of function keys

? FKLABEL(nCount)  && Display programmable function keys

ENDFOR


See Also

FKMAX( )
SET COMPATIBLE
SET FUNCTION


FKMAX( ) Function

Syntax         Returns         Remarks         Example         See Also

Returns the number of programmable function keys or function key combinations on your keyboard.

Syntax

FKMAX( )

Returns

Numeric

Remarks

The value returned by FKMAX( ) is affected by SET COMPATIBLE. When SET COMPATIBLE is set to FOXPLUS (the default), FKMAX( ) returns the number of function keys. When SET COMPATIBLE is set to DB4, FKMAX( ) returns the number of function key and function key combinations (F1, CTRL+F1, SHIFT+F1, F2, CTRL+F2, SHIFT+F2, ...).


FKMAX( ) Function Example

CLEAR

SET COMPATIBLE OFF

? 'COMPATIBLE OFF'

?

FOR nCount = 1 TO FKMAX( )  && Loop for # of function keys

? FKLABEL(nCount)  && Display programmable function keys

ENDFOR

SET COMPATIBLE ON

?

? 'COMPATIBLE ON'

?

FOR nCount = 1 TO FKMAX( )  && Loop for # of function keys

? FKLABEL(nCount)  && Display programmable function keys

ENDFOR


See Also

FKLABEL( )
SET COMPATIBLE
SET FUNCTION


FLDLIST( ) Function

Included for compatibility with dBASE.


FLOCK( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Attempts to lock the current or specified table.

 Syntax

FLOCK([nWorkArea | cTableAlias])

 Returns

Logical

 Arguments

nWorkArea   Specifies the work area of the table that FLOCK( ) attempts to lock.

FLOCK( ) returns false (.F.) if a table isn’t open in the work area you specify.

cTableAlias   Specifies the alias of the table that FLOCK( ) attempts to lock.

Visual FoxPro generates an error message if you specify a table alias that doesn’t exist.

 Remarks

FLOCK( ) returns true (.T.) if the table is successfully locked and returns false (.F.) if the table or a record in the table is already locked by another user.

If you omit the optional arguments, FLOCK( ) attempts to lock the table open in the currently selected work area.

Note   If FLOCK( ) fails to lock a table, it returns false (.F.) and does not generate an error. As a result, you can’t use FLOCK( ) to trigger an ON ERROR routine.

When a table is locked, the table is available for both read and write access by the user who placed the lock. Other users on the network have read-only access to the table. For information on how to lock a table and prevent access to it by other users, see SET EXCLUSIVE and USE.

A table remains locked until it is unlocked by the user who placed the lock. The table can be unlocked by issuing UNLOCK, closing the table, or quitting Visual FoxPro. Tables can be closed with USE, CLEAR ALL, or CLOSE DATABASES.

By default, FLOCK( ) attempts to lock a table once. Use SET REPROCESS to automatically retry a table lock when the first attempt fails. SET REPROCESS determines the number of lock attempts, or the length of time during which lock attempts are made when the initial lock attempt is unsuccessful. For more information, see SET REPROCESS.

You can establish relations between two or more tables with SET RELATION. Placing a file lock on a table that is related to one or more tables doesn’t place a file lock on the related tables. You must explicitly place and remove locks on the related tables.

For additional information about record and file locking and sharing tables on a network, see Chapter 17, “Programming for Shared Access,” in the Developer’s Guide.


 FLOCK( ) Function Example

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE products  && Opens products table

SET REPROCESS TO 3 SECONDS

SELECT * FROM products INTO TABLE newprods

IF FLOCK( )

*** New product initialization ***

REPLACE ALL in_stock  WITH 0.00

REPLACE ALL on_order WITH 0.00

WAIT 'Initialization Complete' WINDOW NOWAIT

ELSE

*** File is locked, warn user ***

WAIT WINDOW 'Unable to open products file; try again later!' NOWAIT

ENDIF

BROWSE FIELDS in_stock, on_order && Displays newprods table

USE

ERASE newprods.dbf


 See Also

LOCK( )
RLOCK( )
SET REPROCESS
SET RELATION
UNLOCK
USE
SET EXCLUSIVE


FLOOR( ) Function

Syntax         Returns         Arguments         Example         See Also

Returns the nearest integer that is less than or equal to the specified numeric expression.

 Syntax

FLOOR(nExpression)

 Returns

Numeric

 Arguments

nExpression   Specifies the numeric expression for which FLOOR( ) returns the nearest integer that is less than or equal to the numeric expression.


 FLOOR( ) Function Example

STORE  10.9 TO gnNumber1

STORE -10.1 TO gnNumber2

CLEAR

? FLOOR(gnNumber1)  && Displays 10

? FLOOR(gnNumber2)  && Displays -11

? FLOOR(10.0)  && Displays 10

? FLOOR(-10.0)  && Displays -10


 See Also

CEILING( )
INT( )
ROUND( )


FLUSH Command

Syntax         Remarks         See Also

Saves table and index modifications to disk.

 Syntax

FLUSH

 Remarks

FLUSH ensures that modifications you make to all open tables and indexes are saved to disk.

Visual FoxPro automatically saves changes to disk when:

•	You close a table with USE, CLOSE ALL, or CLOSE DATABASES. Only information for the file or files you close is flushed to disk.

•	You unlock a record or file. Only information for the record or file unlocked is flushed to disk.


 See Also

CLOSE DATABASES
FFLUSH( )
SET AUTOSAVE


Fonts Overview

See Also

Visual FoxPro can use the fonts you have installed. Fonts determine the appearance of displayed or printed text. In addition, fonts determine the position and size of controls.

Control Size and Position

In Visual FoxPro, the ScaleMode property for the Form on which a control is placed determines the control’s size and position. If ScaleMode is set to Pixels (3), the size of a control is specified in pixels. If ScaleMode is set to Foxels (0), the size of a control is determined by the Form’s current font and font size.

Foxel is a Visual FoxPro term that corresponds to the maximum height and average width of a character in the current font. The row height corresponds to the maximum height of a letter in the current font; the column width corresponds to the average width of a letter in the current font.

In Visual FoxPro, you can use decimal fractions for row and column coordinates to facilitate precise positioning of controls and output. In FoxPro for MS-DOS, fractional portions of row and column coordinates are ignored.

In Visual FoxPro, to determine or change the font for the main Visual FoxPro window, press SHIFT while you display the Format menu, then choose the Screen Font option. The font for a user-defined window can be specified by including the FONT clause when you create the window with DEFINE WINDOW.

Font Substitution

If you specify a font that is not available, Windows substitutes a font with similar font characteristics. Windows considers the point size, serif characteristics and the pitch of the font you request. A TrueType font is typically substituted. A raster or vector font is only substituted when the characteristics of the font you request closely match those of the raster or vector font.

Font Functions

Several functions can be used to return information about fonts and text in a specific font.

These functions include:

Function	Description
AFONT( )	Places information about available fonts into an array.
FONTMETRIC( )	Returns font attributes for installed fonts.
GETFONT( )	Displays the Font dialog and returns the name of the font you choose.
SYSMETRIC( )	Returns the size of a display element.
SCOLS( )	Returns the number of columns available in the main Visual FoxPro window.  Useful when centering text or controls in the main Visual FoxPro window.
SROWS( )	Returns the number of rows available in the main Visual FoxPro window. Useful when centering text or controls in the main Visual FoxPro window.
WCOLS( )	Returns the number of columns within the specified window. Useful when centering text or controls in a user-defined window.
WFONT( )	Returns the name, size or style of the current font for a window.
WROWS( )	Returns the number of columns within the specified window. Useful when centering text or controls in a user-defined window.


 See Also

AFONT( )
FONTMETRIC( )
GETFONT( )
SYSMETRIC( )
ScaleMode Property
SCOLS( )
SROWS( )
WCOLS( )
WFONT( )
WROWS( )


FontBold, FontItalic, FontStrikethru, FontUnderline Properties

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether text has one or more of the following styles: Bold, Italic, Strikethru, or Underline. Available at design time and run time.

 Syntax

Object.FontBold[ = lExpr]

Object.FontItalic[ = lExpr]

Object.FontStrikeThru[ = lExpr]

Object.FontUnderline[ = lExpr]

 Settings

lExpr   The settings for the font properties are:

Setting	Description
True (.T.)	Font style is bold, italic, strikethru, or underline.
False (.F.)	(Default except for FontBold) Font style is not bold, italic, strikethru, or underline.
 Remarks

In general, change the FontName property before you set size and style attributes with the FontSize, FontBold, FontItalic, FontStrikethru, and FontUnderline properties. However, when you set TrueType fonts to smaller than 8 points, you should set the point size with the FontSize property, then set the FontName property, and then set the size again with the FontSize property. Windows uses a different font for TrueType fonts that are smaller than 8 points.

Note   Fonts that are available vary according to your system configuration, display devices, and printing devices. Font-related properties can be set only to values for which actual fonts exist.


 Applies To

CheckBox, Column, ComboBox, CommandButton, EditBox, Form, Grid, Header, Label, ListBox, OptionButton, Page, _SCREEN, Spinner, TextBox

Note   The FontBold property does not apply to the Page object.


 See Also

FontCondense
FontExtend Properties
FontName Property
FontSize Property
SetAll Method


FontCondense, FontExtend Properties

Syntax         Settings         Applies To         See Also

Specifies whether text has a condensed or extended style.

 Syntax

Object.FontCondense[ = lExpr]

Object.FontExtend[ = lExpr]

 Settings

lExpr   The settings for the FontCondense property are:

Setting	Description
True (.T.)	The text associated with the control is displayed with less space than normal between individual characters.
False (.F.)	(Default) The text associated with a control is not condensed.
The settings for the FontExtend property are:

Setting	Description
True (.T.)	The text associated with the control is displayed with more space than normal between individual characters.
False (.F.)	(Default) The text associated with a control is not extended.
Setting both properties to .T. (True) is equivalent to setting both to .F. (False).


 Applies To

CheckBox, Column, ComboBox, CommandButton, EditBox, Form, Grid, Header, ListBox, OptionButton, Page, Spinner, TextBox


 See Also

FontBold
FontItalic
FontStrikethru
FontUnderline Properties
FontName Property
FontSize Property
SetAll Method


FONTMETRIC( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns font attributes for the current installed operating system fonts.

 Syntax

FONTMETRIC(nAttribute [, cFontName, nFontSize [, cFontStyle]])

 Returns

Numeric

 Arguments

nAttribute   Determines the font attribute FONTMETRIC( ) returns. If you omit cFontName, nFontSize, and cFontStyle, FONTMETRIC( ) returns the attribute for the current font in the active output window.

The following table lists values for nAttribute and the corresponding font attributes returned.

NAttribute	Attribute
1	Character height in pixels
2	Character ascent (units above baseline) in pixels
3	Character descent (units below baseline) in pixels
4	Leading (space between lines) in pixels
5	Extra leading in pixels
6	Average character width in pixels
7	Maximum character width in pixels
8	Font weight.
9	Italic (0 =no, nonzero=yes)
10	Underlined (0 = no, nonzero = yes)
11	Strikeout (0 = no, nonzero = yes)
12	First character defined in font
13	Last character defined in font
14	Default character (substituted for characters not in font)
15	Word-break character.
16	Pitch and family
17	Character set
18	Overhang (extra added width)
19	Horizontal aspect for font device
20	Vertical aspect for font device
*These attributes are not available in Visual FoxPro for Macintosh, and always return 0.
For more information about the numeric values returned by FONTMETRIC( ), see the TEXTMETRIC function in the Microsoft Windows Programmer’s Reference.

cFontName   Specifies the name of an installed font.

nFontSize   Specifies the point size of the font specified with cFontName.

cFontStyle   Specifies a font style code for the font specified with cFontName. If you omit cFontStyle, FONTMETRIC( ) returns the attribute for the Normal font style.

cFontStyle can be a character or a combination of characters listed in the following font style table. For example, the combination BI specifies the Bold Italic font style.

Character	Font style
B	Bold
I	Italic
N	Normal
O	Outline
Q	Opaque
S	Shadow
-	Strikeout
T	Transparent
U	Underline
 Remarks

FONTMETRIC( ) returns font attributes for the current font for the active output window. WFONT( ) can be used to determine the current window font.

For additional information on installing or removing fonts, see the “Control Panel” chapter in your Microsoft Windows User’s Guide.


 See Also

AFONT( )
Fonts Overview
GETFONT( )
SYSMETRIC( )
TXTWIDTH( )
WFONT( )


FontName Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the name of the font used to display text. Available at design time and run time.

 Syntax

Object.FontName[ = cName]

 Settings

cName   Specifies the name of the font. The default is Arial.

 Remarks

The default FontSize property setting is 10 points. Available fonts vary according to your system configuration. Font-related properties can be set only to values for which fonts exist. At design time, a list of available fonts is displayed when you select the FontName property in the Properties window and click the down arrow to the right of the Property Settings box.

In general, change FontName before setting size and style attributes with the FontSize, FontBold, FontItalic, FontStrikethru, and FontUnderline properties.


 Applies To

CheckBox, Column, ComboBox, CommandButton, EditBox, Form, Grid, Header, Label, ListBox, OptionButton, Page, _SCREEN, Spinner, TextBox


 See Also

FontBold Property
FontItalic Property
FontStrikethru Property
FontUnderline Property
FontSize Property


FontOutline Property

Included for compatibility with the Macintosh.


FontShadow Property

Included for compatibility with the Macintosh.


FontSize Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the font size for text displayed with an object. Available at design time and run time.

 Syntax

Object.FontSize[ = nSize]

 Settings

nSize   Specifies the size of the font in points. The default font size is 10 points.

 Remarks

The maximum value for nSize is 2048 points. There are 72 points in 1 inch.

In general, you should change the FontName property before you set size and style attributes with the FontSize, FontBold, FontItalic, FontStrikethru, and FontUnderline properties. However, when you set TrueType fonts to smaller than 8 points, you should set the point size with the FontSize property, then set the FontName property, and then set the size again with the FontSize property. The Windows environment uses a different font for TrueType fonts that are smaller than 8 points.

Note   Available fonts vary according to your system configuration and printing devices. Font-related properties can be set only to values for which fonts exist.


 Applies To

CheckBox, Column, ComboBox, CommandButton, EditBox, Form, Grid, Header, Label, ListBox, OptionButton, Page, _SCREEN, Spinner, TextBox


 See Also

FontBold Property
FontCondense Property
FontExtend Property
FontItalic Property
FontStrikethru Property
FontUnderline Property


FOPEN( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Opens a file or communication port for use with low-level file functions.

 Syntax

FOPEN(cFileName [, nAttribute])

 Returns

Numeric

 Arguments

cFileName   Specifies the name of the file or communication port to open. If cFileName is a file name, it can include a path to open files in directories, folders, drives, or volumes not in the current Visual FoxPro search path. If a path isn’t included, Visual FoxPro searches for the file in the following locations:

•	Default directory or folder

•	Path established with SET PATH

Note   Visual FoxPro will not recognize a path name properly if a disk or directory name contains an exclamation point (!).

nAttribute   Specifies read-write privileges or a buffering scheme for the file you open. The following table lists each number you can include in nAttribute, and the read-write file privileges and buffering scheme it establishes.

nAttribute	Read-Write privileges	Buffered/unbuffered
0	(Default) Read Only	Buffered
1	Write-Only	Buffered
2	Read and Write	Buffered
10	Read-Only	Unbuffered
11	Write-Only	Unbuffered
12	Read and Write	Unbuffered
If nAttribute isn’t included, or if nAttribute evaluates to 0, the file is opened as read-only and is buffered. Communication ports should always be opened unbuffered.

Note   Visual FoxPro will not recognize a path name properly if a disk or directory name contains an exclamation point (!).

 Remarks

If FOPEN( ) successfully opens the file or communication port, the file handle number of the file or port is returned. FOPEN( ) returns –1 if the file or port cannot be opened.

Tip   Assign the file handle number to a memory variable so you can access the file or communication port by the memory variable in other low-level file functions.

The following information about files opened with FOPEN( ) can be displayed or sent to a printer with DISPLAY STATUS or LIST STATUS.

•	Drive and directory or volume and folder, and file name

•	File handle number

•	File pointer position

•	Read-write attributes


 FOPEN( ) Function Example

IF FILE('errors.txt')  && Does file exist?

gnErrFile = FOPEN('errors.txt',12)  && If so, open read-write

ELSE

gnErrFile = FCREATE('errors.txt')  && If not, create it

ENDIF

IF gnErrFile < 0  && Check for error opening file

WAIT 'Cannot open or create output file' WINDOW NOWAIT

ELSE  && If no error, write to file

=FWRITE(gnErrFile, 'Error information to be written here')

ENDIF

=FCLOSE(gnErrFile)  && Close file

MODIFY FILE errors.txt NOWAIT  && Open file in edit window


 See Also

CLOSE ALL
FCHSIZE( )
FCLOSE( )
FCREATE( )
FEOF( )
FFLUSH( )
FGETS( )
FPUTS( )
FREAD( )
FSEEK( )
FWRITE( )


FOR ... ENDFOR Command

Syntax         Arguments         Remarks         Example         See Also

Executes a set of commands a specified number of times.

 Syntax

FOR Var = nInitialValue TO nFinalValue [STEP nIncrement]
Commands
[EXIT]
[LOOP]
ENDFOR | NEXT

 Arguments

Var   Specifies a variable or an array element that acts as the counter. The variable or array element doesn’t have to exist before FOR ... ENDFOR is executed.

nInitialValue TO nFinalValue   nInitialValue is the initial value of the counter; nFinalValue is the final value of the counter.

STEP nIncrement   nIncrement is the amount the counter is incremented or decremented. If nIncrement is negative, the counter is decremented. If you omit STEP, the counter is incremented by 1.

Commands   Specifies the Visual FoxPro commands to be executed. Commands can include any number of commands.

EXIT   Transfers control from within the FOR ... ENDFOR loop to the command immediately following ENDFOR. You can place EXIT anywhere between FOR and ENDFOR.

LOOP   Returns control directly back to the FOR clause without executing the statements between LOOP and ENDFOR. The counter is incremented or decremented as if ENDFOR were reached. LOOP can be placed anywhere between FOR and ENDFOR.

 Remarks

A variable or an array element is used as a counter to specify how many times the Visual FoxPro commands inside the FOR ... ENDFOR loop are executed.

The Visual FoxPro commands after FOR are executed until ENDFOR or NEXT is reached. The counter MemVarName is then incremented by the value of nIncrement. If you omit the STEP clause, the counter is incremented by 1. The counter is then compared with nFinalValue. If the counter is less than or equal to nFinalValue, the commands following the FOR clause are executed again. If the counter is greater than nFinalValue, the FOR ... ENDFOR loop is exited and program execution continues with the first command following ENDFOR or NEXT.

Note   The values of nInitialValue, nFinalValue, and nIncrement are only read initially. However, changing the value of the counter MemVarName inside the loop affects the number of times the loop is executed.

If the value of nIncrement is negative and the initial value nInitialValue is greater than the final value nFinalValue, the counter is decremented each time through the loop.


 FOR ... ENDFOR Command Example

In Example 1, the numbers 1 through 10 are displayed.

Example 2 uses memory variables for the initial, final, and STEP values to display all even-numbered records from 2 through 10 in customer.

* Example 1

CLEAR

FOR gnCount = 1 TO 10

? gnCount

ENDFOR

* Example 2

SET TALK OFF

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

STORE 2 TO gnI  && Initial value

STORE 10 TO gnJ  && Final value

STORE 2 TO K  && Step value

FOR gnCount = gnI TO gnJ STEP K

GOTO gnCount  && Move record pointer

DISPLAY company && Display company name

ENDFOR


 See Also

DO CASE ... ENDCASE
DO WHILE ... ENDDO
IF ... ENDIF
SCAN ... ENDSCAN


FOR EACH Command
FOR EACH … ENDFOR Command

Syntax         Settings         Example          See Also

Executes a set of commands for each element in a Visual FoxPro array or collection.

 Syntax

FOR EACH Var IN Group

Commands

[EXIT]

[LOOP]

ENDFOR | NEXT [Var]

 Settings

Var    A variable or array element used to iterate through the elements of Group.

Group    A Visual FoxPro array, an OLE array, a Visual FoxPro collection or an OLE collection.

Commands    Specifies the Visual FoxPro commands to be executed for each element in Group. Commands can include any number of commands.

EXIT   Transfers control from within the FOR EACH ... ENDFOR loop to the command immediately following ENDFOR. You can place EXIT anywhere between FOR EACH and ENDFOR.

LOOP   Returns control directly back to the FOR EACH clause without executing the statements between LOOP and ENDFOR. LOOP can be placed anywhere between FOR EACH and ENDFOR.


 Examples

The following examples demonstrate how FOR EACH is used to enumerate elements in a Visual FoxPro array, an OLE array, and a set command buttons assigned to an object array.

In the following example, a Visual FoxPro variable array is created and FOR EACH is used to display the contents of each element in the array.

DIMENSION cMyArray(3)

cMyArray[1] = ‘A’

cMyArray[2] = ‘B’

cMyArray[3] = ‘C’

FOR EACH cMyVar IN cMyArray

? cMyVar

ENDFOR

In the following example, an instance of Microsoft Excel is created, and a new workbook is added. FOR EACH is used to display the name of each worksheet in the workbook. This example requires that Microsoft Excel be properly installed on the machine on which the example is run.

oExcel = CREATE("Excel.Application")

oExcel.Workbooks.ADD

FOR EACH oMyVar IN oExcel.sheets

? oMyVar.name

NEXT oMyVar

In the following example, five command buttons are placed on a form. FOR EACH is used to display the buttons on the form and specify the captions, font styles and positions of each button.

PUBLIC oMyObject

oMyObject = CREATEOBJECT("frmTest")

oMyObject.SHOW

DEFINE CLASS frmTest AS FORM

Height = 200

DIMENSION MyArray[5]

PROCEDURE Init

FOR i = 1 to 5

THIS.AddObject('THIS.MyArray[i]',;

'COMMANDBUTTON')

ENDFOR

****** FOR EACH - NEXT ******

FOR EACH oButton IN THIS.MyArray

oButton.Visible = .T.

NEXT

****** FOR EACH - NEXT element  ******

FOR EACH oButton IN THIS.MyArray

oButton.FontBold = .T.

NEXT obutton

j = 1

****** FOR EACH - ENDFOR ******

FOR EACH oButton IN THIS.MyArray

oButton.top = j * 30

j = j + 1

ENDFOR

****** FOR EACH - ENDFOR element ******

FOR EACH oButton IN THIS.MyArray

oButton.FontItalic = .T.

ENDFOR obutton

j = 1

****** EXIT  ******

FOR EACH oButton IN THIS.MyArray

oButton.Caption = "test" + str(j)

j = j+1

IF j > 3

EXIT

ENDIF

NEXT

j = 1

****** LOOP  ******

FOR EACH oButton IN THIS.MyArray

IF j > 3

LOOP

ENDIF

j = j + 1

oButton.Left = 25

NEXT

ENDPROC

ENDDEFINE


 See Also

FOR ... ENDFOR


FOR( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns the index filter expression of an open single-entry index (.IDX) file or an index tag.

 Syntax

FOR([nIndexNumber [, nWorkArea | cTableAlias]])

 Returns

Character

 Arguments

If you don’t include any of the optional arguments, FOR( ) returns the index filter expression for the master index file or index tag. If a master index file or index tag isn’t in effect (for example, you’ve issued SET ORDER TO to place the table in physical record order), FOR( ) returns the empty string.

nIndexNumber   Specifies the index file or tag for which the filter expression is returned. FOR( ) returns filter expressions in the following order as nIndexNumber increases from 1 to the total number of open single-entry files and structural compound and independent compound index tags:

1.	Filter expressions from single-entry index files (if any are open) are returned first. The order the single-entry index files are included in USE or SET INDEX determines the order in which the filter expressions are returned.

2.	Filter expressions for each tag in the structural compound index (if one is present) are returned next. The filter expressions are returned from the tags in the order the tags are created in the structural index.

3.	Filter expressions for each tag in any open independent compound indexes are returned last. The filter expressions are returned from the tags in the order in which the tags are created in the independent compound indexes.

The empty string is returned if an index or index tag is created without a FOR clause or if nIndexNumber is greater than the total number of open single-entry files and structural compound and independent compound index tags.

nWorkArea   Specifies the work area of the table for which FOR( ) returns the index filter expressions.

FOR( ) returns the empty string if a table isn’t open in the work area you specify.

cTableAlias   Specifies the alias of the table for which FOR( ) returns the index filter expressions.

Visual FoxPro generates an error message if you specify a table alias that doesn’t exist.

 Remarks

You can create filtered indexes in Visual FoxPro. If you include the optional FOR lExpression clause in INDEX, the index file acts as a filter on the table. Only records that match the filter expression lExpression are available for display and access. Index keys are created in the index file for just those records matching the filter expression.

USE and SET INDEX both support an index file name list that lets you open multiple index files for a table. Any combination of single-entry index file names, structural compound, or independent compound index file names can be included in the index file name list. FOR( ) is identical to SYS(2021) and is provided for compatibility with dBASE IV.


 See Also

INDEX


Form Object

Syntax         Remarks         Properties         Events         Methods         See Also

Creates a form.

 Syntax

Form

 Remarks

Use the Form object to create a form to which you can add controls. You can also use the Form Designer. Forms have properties that determine their appearance, such as position, size, and color, as well as aspects of their behavior, such as whether they are sizable.

Forms can also respond to events initiated by a user or triggered by the system. For example, you can write code in a form’s Click event procedure that changes the color of the form when you click it.

In addition to properties and events, you can use methods to manipulate Forms. For example, you can use the Move method to change a form’s location and size.

When designing Forms, use the BorderStyle property to specify a form’s border, and the Caption property to specify the text in the title bar. Setting BorderStyle to 0 removes the border. From within a program, you can use the Hide and Show methods to make Forms transparent or visible at run time.

For additional information about creating Forms, see Chapter 9, “Creating Forms,” in the Developer’s Guide.


 Properties

ActiveControl	ActiveForm	AlwaysOnTop
AutoCenter	BackColor	BaseClass
BorderStyle	BufferMode	Caption
Class	ClassLibrary	ClipControls
Closable	ColorSource	Comment
ControlBox	ControlCount	Controls
CurrentX	CurrentY	DataEnvironment
DataSession	DataSessionID	DefOLELCID Property
Desktop	DrawMode	DrawStyle
DrawWidth	Enabled	FillColor
FillStyle	FontBold	FontCondense
FontExtend	FontItalic	FontName
FontOutline	FontShadow	FontSize
FontStrikeThru	FontUnderline	ForeColor
HalfHeightCaption	Height	HelpContextID
Icon	KeyPreview	Left
LockScreen	MaxButton	MaxHeight
MaxLeft	MaxTop	MaxWidth
MDIForm	MinButton	MinHeight
MinWidth	MousePointer	Movable
Name	Parent	ParentClass
Picture	ReleaseType	RightToLeft
ScaleMode	ShowTips	ShowWindow
SizeBox	TabIndex	TabStop
Tag	Top	Visible
Width	WindowType	WindowState
ZoomBox


 Events

Activate	Click	DblClick
Deactivate	Destroy	DragDrop
DragOver	Error	GotFocus
Init	KeyPress	Load
LostFocus	MiddleClick Event	MouseDown
MouseMove	MouseUp	MouseWheel
Moved	Paint	QueryUnload
Resize	RightClick	Unload


 Methods

AddObject	Box	Circle
Cls	Draw	Hide
Line	Move	Point
Print	PSet	ReadExpression
ReadMethod	Refresh	Release
RemoveObject	ResetToDefault	SaveAs
SaveAsClass	SetAll	Show
TextHeight	TextWidth	WriteExpression
WriteMethod	ZOrder


 See Also

CREATE CLASS
CREATE FORM
DEFINE CLASS
FormSet Object


Format Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the input and output formatting of a control’s Value property. Available at design time and run time.

 Syntax

Control.Format[ = cFunction]

 Settings

cFunction   Specifies the character constraints for data entry and formatting for display.

The valid cFunction settings for an EditBox control are:

Setting	Description
K	Selects all the text when the control gets the focus.
The valid cFunction settings for a Spinner control are:

Setting	Description
$	Displays the currency symbol.
^	Displays numeric data using scientific notation.
K	Selects all the text when the control gets the focus.
L	Displays leading zeros (instead of spaces) in the text box.
R	Displays the format mask for the text box that is specified in the InputMask property. The mask formats data for easier entry and clearer display (for example, if the mask is 99-999, the number 12345 is displayed as 12-345), but is not stored as part of the data. Use only with character or numeric data.
Z	Displays the value as blank if it is 0 except when the control has the focus.
The valid cFunction settings for a TextBox control and Column object are:

Setting	Description
!	Converts alphabetic characters to uppercase. Use with Character data only.
$	Displays the currency symbol. The ControlSource property must specify a numeric source for the textbox.
^	Displays numeric data using scientific notation. The ControlSource property must specify a numeric source for the textbox.
A	Allows alphabetic characters only (no spaces or punctuation marks).
D	Uses the current SET DATE format.
E	Edits Date values as British dates.
K	Selects all the text when the control gets the focus.
L	Displays leading zeros (instead of spaces) in the text box. The ControlSource property must specify a numeric source for the textbox.
M	Included for backward compatibility.
R	Displays the format mask for the text box that is specified in the InputMask property. The mask formats data for easier entry and clearer display (for example, if the mask is 99-999, the number 12345 is displayed as 12-345), but is not stored as part of the data. Use only with character or numeric data.
T	Trims leading and trailing blanks from the input field.
YS	Displays Date values in a short date format determined by the Windows Control Panel short date setting.
YL	Displays Date values in a long date format determined by the Windows Control Panel long date setting.
 Remarks

The Format property mimics the behavior of the FUNCTION clause for the @ ... GET and @ ... EDIT commands.

The Format property specifies a behavior for the entire input field. You can mix several Format codes, but they always affect everything in the input field. This property contrasts to the InputMask property in which each entry in the input mask corresponds to an entry in the input field.


 Applies To

Column, ComboBox, EditBox, Spinner, TextBox


 See Also

DynamicInputMask Property
InputMask Property


FormCount Property

Syntax         Remarks         Applies To         See Also

Contains the number of forms in a form set. Not available at design time; read-only at run time.

 Syntax

Object.FormCount

 Remarks

You can use this property to cycle through all the forms in a form set and do some action.


 Applies To

FormSet, _SCREEN


 See Also

Forms Property


Forms Property

Syntax         Settings         Remarks         Applies To         See Also

An array to access individual forms in a form set. Not available at design time; read-only at run time.

 Syntax

Object.Forms( nIndex)

 Settings

nIndex   Uniquely identifies a form in a form set.

 Remarks

Use the Forms property to change the property settings of forms in a form set without using the Name property of the forms. You can use the Forms property in conjunction with the FormCount property to step through all the forms in a form set and perform an action. For example, the following code changes the captions of all the forms in a form set:

FOR x = 1 TO THISFORMSET.FormCount

THISFORMSET.Forms(x).Caption = THISFORMSET.Forms(x).Caption;

+ "[Read Only]"

ENDFOR


 Applies To

FormSet, _SCREEN


 See Also

FormCount Property


FormSet Object

Syntax         Remarks         Properties         Events         Methods         See Also

Creates a form set.

 Syntax

FormSet

 Remarks

A form set is a container object that contains a set of forms. Form sets are similar to screen sets used in previous FoxPro versions.

For additional information about creating form sets, see “Creating a New Form Set” in Chapter 9, “Creating Forms,” in the Developer’s Guide.


 Properties

ActiveForm	AutoRelease	BaseClass
Buffermode	Class	ClassLibrary
Comment	DataEnvironment	DataSession
DataSessionID	FormCount	Forms
Name	ParentClass	ReadBackColor
ReadCycle	ReadForeColor	ReadLock
ReadMouse	ReadSave	ReadTimeOut
Visible	WindowList	WindowType


 Events

Activate	Deactivate	Destroy
Error	Init	Load
ReadActivate	ReadDeactivate	ReadShow
ReadValid	ReadWhen	Unload


 Methods

AddObject	Hide	Init
ReadExpression	ReadMethod	Refresh
Release	RemoveObject	ResetToDefault
SaveAs	SaveAsClass	SetAll
Show	WriteExpression	WriteMethod


 See Also

CREATE CLASS
CREATE FORM
DEFINE CLASS
Form Object


FOUND( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns true (.T.) if CONTINUE, FIND, LOCATE, or SEEK is successful.

 Syntax

FOUND([nWorkArea | cTableAlias])

 Returns

Logical

 Arguments

nWorkArea   Specifies the work area of the table for which FOUND( ) returns a value indicating the success of the last CONTINUE, FIND, LOCATE, or SEEK.

FOUND( ) returns false (.F.) if a table isn’t open in the work area you specify.

cTableAlias   Specifies the alias of the table for which FOUND( ) returns a value indicating the success of the last CONTINUE, FIND, LOCATE, or SEEK.

Visual FoxPro generates an error message if you specify a table alias that doesn’t exist.

 Remarks

FOUND( ) returns a logical value that indicates whether the most recently executed CONTINUE, FIND, LOCATE, or SEEK was successful, or if the record pointer was moved in a related table. FOUND( ) returns true (.T.) if the search is successful; otherwise FOUND( ) returns false (.F.).

If you omit the optional arguments, FOUND( ) returns a value indicating the success of the last CONTINUE, FIND, LOCATE, or SEEK for the table open in the currently selected work area.

Tip   This function can be used to determine if a child table has a record that matches the parent record.


 FOUND( ) Function Examples

In the following example, all customers from Germany are counted.

SET TALK OFF

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

STORE 0 TO gnCount

LOCATE FOR UPPER(country) = 'GERMANY'

DO WHILE FOUND( )

gnCount = gnCount + 1

CONTINUE

ENDDO

WAIT WINDOW 'Total customers from Germany: ' ;

+ LTRIM(STR(gnCount)) NOWAIT


 See Also

CONTINUE
EOF( )
FIND
LOCATE
SEEK


_FOXDOC System Memory Variable
_FOXDOC System Variable

Included for backward compatibility. Use the Documenting Wizard instead.


FPUTS( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Writes a character string, carriage return, and linefeed to a file or a communication port opened with a low-level file function.

 Syntax

FPUTS(nFileHandle, cExpression [, nCharactersWritten])

 Returns

Numeric

 Arguments

nFileHandle   Specifies the file handle number for the file or communication port to which FPUTS( ) writes data.

cExpression   Specifies the character expression that FPUTS( ) writes to the file or port.

nCharactersWritten   Specifies the number of characters in cExpression to write to the file or port.

FPUTS( ) writes the entire character expression cExpression to the file or port if you omit nCharactersWritten. If you include nCharactersWritten, nCharactersWritten characters are written to the file or port. If nCharactersWritten is less than the number of characters in cExpression, only nCharactersWritten characters are written to the file or port. All of cExpression is written to the file or port if nCharactersWritten is equal to or greater than the number of characters in cExpression.

 Remarks

FPUTS( ) returns the number of bytes written to the file or port. 0 is returned if FPUTS( ) can’t write to the file or port for any reason.


 See Also

FCHSIZE( )
FCLOSE( )
FCREATE( )
FEOF( )
FFLUSH( )
FGETS( )
FOPEN( )
FREAD( )
FSEEK( )
FWRITE( )


FREAD( ) Function

Syntax         Returns         Arguments         Example         See Also

Returns a specified number of bytes from a file or a communication port opened with a low-level function.

 Syntax

FREAD(nFileHandle, nBytes)

 Returns

Character

 Arguments

nFileHandle   Specifies the file handle number for the file or communication port from which FREAD( ) returns data.

nBytes   Specifies the number of bytes returned by FREAD( ). FREAD( ) returns data starting from the current file pointer position and continues until it returns nBytes bytes or until it encounters the end of the file.


 FREAD( ) Function Example

The following example uses FREAD( ) to display the contents of a file. If the file is empty, a message is displayed.

* TEST.TXT must exist -- you can create this file

* using Notepad.

Local gnFileHandle,nSize,cString

gnFileHandle = FOPEN("test.txt")

* Seek to end of file to determine the number of bytes in the file

nSize =  FSEEK(gnFileHandle, 0, 2)           && Move pointer to EOF

IF nSize <= 0

   * If the file is empty, display an error message

   WAIT WINDOW "This file is empty!" NOWAIT

ELSE

   * If file is not empty, the program stores its contents

   * in memory, then displays the text on the main Visual FoxPro window

   = FSEEK(ggnFileHandle, 0, 0)              && Move pointer to BOF

   cString = FREAD(gnFileHandle, nSize)

   ? cString

ENDIF

= FCLOSE(gnFileHandle)                       && Close the file


 See Also

FCHSIZE( )
FCLOSE( )
FCREATE( )
FEOF( )
FFLUSH( )
FGETS( )
FOPEN( )
FPUTS( )
FSEEK( )
FWRITE( )


FREE TABLE Command

Syntax         Arguments         Remarks         See Also

Removes a database reference from a table.

 Syntax

FREE TABLE TableName

 Arguments

TableName   Specifies the name of the table from which the database reference is removed.

 Remarks

If a database is accidentally deleted from disk, references to the database remain in the tables formerly contained in the database. FREE TABLE removes the database references from a table, allowing you to open the table or add the table to a different database.

FREE TABLE should never be issued to remove a table from a database if the database exists on disk. If the database exists on disk, FREE TABLE may render the database unusable. Use REMOVE TABLE instead. Unlike FREE TABLE, REMOVE TABLE removes all references from the database to primary indexes, default values, and validation rules associated with the table.


 See Also

ADD TABLE
CREATE DATABASE
OPEN DATABASE
REMOVE TABLE


FSEEK( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Moves the file pointer in a file opened with a low-level file function.

 Syntax

FSEEK(nFileHandle, nBytesMoved [, nRelativePosition])

 Returns

Numeric

 Arguments

nFileHandle   Specifies the file handle for the file in which FSEEK( ) moves the file pointer. A file handle number is returned by FCREATE( ) or FOPEN( ) when the file is created or opened.

nBytesMoved   Specifies the number of bytes to move the file pointer. The file pointer is moved toward the end of the file if nBytesMoved is positive. The file pointer is moved toward the beginning of the file if nBytesMoved is negative.

nRelativePosition   Moves the file pointer to a relative position in the file. By default, the file pointer is moved relative to the beginning of the file. You can also move the file pointer relative to the current file pointer or the end of the file by including nRelativePosition.

The following table lists values for nRelativePosition and from where the file pointer is moved.

nRelativePosition	Moves the file pointer relative to
0	(Default) The beginning of the file.
1	The current file pointer position
2	The end of the file
 Remarks

After moving the file pointer, FSEEK( ) returns the number of bytes the file pointer is positioned from the beginning of the file. The file pointer can also be moved with FREAD( ) and FWRITE( ).


 FSEEK( ) Function Example

The following user-defined function uses FSEEK( ) to return the size of a file. If you don’t pass parameters to the user-defined function, it returns –2. If the file cannot be found, the user-defined function returns –1.

FUNCTION fsize2

PARAMETERS gcFileName  && File to be checked

PRIVATE pnHandle,pnSize

IF PARAMETERS( ) = 0

RETURN -2  && Return -2 if no parameter passed

ELSE

IF !FILE(gcFileName)

RETURN -1  && Return -1 if file does not exist

ENDIF

ENDIF

pnHandle = FOPEN(gcFileName)	&& Open file

pnSize = FSEEK(pnHandle,0,2)	&& Determine file size, assign to pnSize

=FCLOSE(pnHandle)  && Close file

RETURN pnSize  && Return value


 See Also

FCHSIZE( )
FCLOSE( )
FCREATE( )
FEOF( )
FFLUSH( )
FGETS( )
FOPEN( )
FPUTS( )
FREAD( )
FWRITE( )


FSIZE( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the size in bytes of a specified field or file.

 Syntax

FSIZE(cFieldName [, nWorkArea | cTableAlias] | cFileName)

 Returns

Numeric

 Arguments

cFieldName   Specifies the name of the field.

nWorkArea   Specifies the work area of the table for which FSIZE( ) returns a field size.

FSIZE( ) returns 0 if a table isn’t open in the work area you specify.

cTableAlias   Specifies the alias of the table for which FSIZE( ) returns a field size.

Visual FoxPro generates an error message if you specify a table alias that doesn’t exist.

cFileName   Specifies a file for which FSIZE( ) returns the size in bytes.

 Remarks

The current setting of SET COMPATIBLE determines if FSIZE( ) returns the size of a field or a file. If SET COMPATIBLE is set to OFF or FOXPLUS (the default), FSIZE( ) returns the size of a field. If SET COMPATIBLE is set to ON or DB4, FSIZE( ) returns the size of a file.

The following table shows the default size (in bytes) for each field type.

Field type	Default field size(in bytes)
Currency	8
Date	8
DateTime	14
Double	8
Integer	4
Logical	1
Memo	4
General	4
The size of a field can be displayed with DISPLAY STRUCTURE and LIST STRUCTURE.

If you omit the optional nWorkArea and cTableAlias arguments, FSIZE( ) returns the field size for a field in the current table and work area.


 FSIZE( ) Function Example

The following example uses FSIZE( ) to return the size of two fields in the customer table.

SET COMPATIBLE OFF

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Open Customer table

CLEAR

? FSIZE('contact')  && Displays 30

? FSIZE('cust_id')  && Displays 6


 See Also

DISPLAY STRUCTURE
FCOUNT( )
LIST


FTIME( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the last modification time for a file.

 Syntax

FTIME(cFileName)

 Returns

Character

 Arguments

cFileName   Specifies the name of the file whose last modification time FTIME( ) returns. cFileName can include a path with the file name. If a path is not included with the file name, Visual FoxPro searches for the file in the default directory or folder and in any directories or folders specified with SET PATH.

 Remarks

The time that FTIME( ) returns is assigned to the file by the operating system.


 FTIME( ) Function Example

The following example uses FTIME( ) to display the last modification time for FOXUSER.DBF, the Visual FoxPro resource file.

? FTIME('FOXUSER.DBF')  && Displays the last modification time


 See Also

FDATE( )
LUPDATE( )


FullName Property

Syntax         Remarks         Applies To          See Also

Contains the file name of an instance of Visual FoxPro and the name of the directory from which the instance of Visual FoxPro was started. Read-only at run time.

 Syntax

ApplicationObject.FullName

 Remarks

Use the FullName property to determine the directory from which an instance of Visual FoxPro was started.


 Applies To

Application Object, _VFP System Variable


 See Also

HOME( )


FULLPATH( ) Function

Syntax         Returns         Arguments         See Also

Returns the path to a specified file or the path relative to another file.

 Syntax

FULLPATH(cFileName1 [, nMSDOSPath | cFileName2])

 Returns

Character

 Arguments

cFileName1   Specifies the file for which Visual FoxPro searches. Be sure to include the file name extension.

If the file is located in the Visual FoxPro path, the path is returned with the file name. The Visual FoxPro path can be specified with SET PATH.

nMSDOSPath   Specifies that the MS-DOS path is searched instead of the Visual FoxPro path. nMSDOSPath can have any numeric value. If the file can’t be located in the MS-DOS path, a path and the file name are returned as if the file had been found in the current default directory or folder.

cFileName2   Specifies a second file name to search for. Be sure to include the file name extension. FULLPATH( ) returns the path for the first file relative to the second file.


 See Also

DBF( )
FILE( )
LOCFILE( )
SYS(2014) - Minimum Path


FUNCTION Command

Syntax         Arguments         Remarks         Example         See Also

Identifies the start of a definition for a user-defined function.

 Syntax

FUNCTION FunctionName
Commands
[RETURN [eExpression]]
ENDFUNC

 Arguments

FunctionName   In Visual FoxPro, function names can be up to 254 characters long.

To distinguish a program file name with more than 10 characters from a function beginning with the same 10 characters in these two products, surround the program file name with quotation marks or include an extension after the program file name.

 Remarks

In many programs, certain routines are frequently repeated. Defining commonly used routines as separate functions reduces program size and complexity and facilitates program maintenance.

FUNCTION FunctionName is a statement within a program. It designates the beginning of a function in a program and identifies the function by name.

FUNCTION FunctionName is followed by a series of Visual FoxPro commands that make up the function. You can include RETURN anywhere in the function to return control to the calling program or to another program, and to define a value returned by the user-defined function. If you do not include a RETURN command, an implicit RETURN is automatically executed when the function quits. If the RETURN command does not include a return value (or if an implicit RETURN is executed), Visual FoxPro assigns .T. (True) as the return value.

The function ends with the ENDFUNC command. This command is optional; the function quits when it encounters another FUNCTION command, a PROCEDURE command, or the end of the progam file.

Comments can be placed on the same line after FUNCTION and ENDFUNC. These comments are ignored during compilation and program execution.

You cannot have normal executable program code included in a program file after user-defined functions; only user-defined functions, procedures, and class definitions can follow the first FUNCTION or PROCEDURE command in the file.

When you issue DO with a function name, Visual FoxPro searches for the function in a specific order as follows:

1.   Visual FoxPro searches the file containing the DO command.

2.   If the function isn’t found there, Visual FoxPro searches the open procedure files. Procedure files are opened with SET PROCEDURE.

3.   If the function isn’t found in an open procedure file, Visual FoxPro searches the programs in the execution chain. Program files are searched from the most recently executed program through the first program executed.

4.   If the function is still not found, Visual FoxPro searches for a stand-alone program. If a matching program file is found, the program is executed. Otherwise, Visual FoxPro generates an error message.

Include the IN clause in DO to execute a function in a specific file.

By default, parameters are passed to functions by value. For information on passing parameters to functions by reference, see SET UDFPARMS. A maximum of 27 parameters can be passed to a function. Parameters can be passed to a function by including a PARAMETERS or LPARAMETERS statement in the function, or by placing a list of parameters immediately after FUNCTION FunctionName. Enclose the list of parameters in a set of parentheses, and separate the parameters with commas.


 FUNCTION Command Example

This example creates a custom object class called Hello and adds a function method called SayHello. The SayHello method returns the character string “Hello World” which is displayed by the MESSAGEBOX function. Note: The class definition code is placed after the program code that instantiates the object.

Local oHello

oHello=CREATEOBJECT("Hello")

=MESSAGEBOX(oHello.SayHello(),48)

RELEASE oHello

* Class definition code

DEFINE CLASS Hello AS CUSTOM

   FUNCTION SayHello

      RETURN "Hello World"

   ENDFUNC

ENDDEFINE


 See Also

LPARAMETERS
PARAMETERS
PARAMETERS( )
PRIVATE
PROCEDURE
PUBLIC
RETURN
SET PROCEDURE
SET UDFPARMS


FV( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the future value of a financial investment.

 Syntax

FV(nPayment, nInterestRate, nPeriods)

 Returns

Numeric

 Arguments

nPayment   Specifies the constant periodic payment (which can be negative or positive).

nInterestRate   Specifies the periodic interest rate. If the interest rate is annual but the payments are made monthly, divide the annual interest rate by 12.

nPeriods   Specifies the number of periods over which payments are made. FV( ) assumes that the periodic payments are made at the end of each period.

 Remarks

FV( ) computes the future value of a series of constant periodic payments earning fixed compound interest. The future value is the total of all payments and the interest.


 FV( ) Function Example

STORE 500 TO gnPayment  && Monthly payment

STORE .075/12 TO gnInterest	  && 7.5% annual interest rate

STORE 48 TO gnPeriods  && Four years (48 months)

CLEAR

? FV(gnPayment, gnInterest, gnPeriods) 	&& Displays 27887.93


 See Also

CALCULATE
PV( )


FWRITE( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Writes a character string to a file or a communication port opened with a low-level file function.

 Syntax

FWRITE(nFileHandle, cExpression [, nCharactersWritten])

 Returns

Numeric

 Arguments

nFileHandle   Specifies the file handle number for the file or communication port to which FWRITE( ) writes.

cExpression   Specifies the character expression that FWRITE( ) writes to the file or port specified with nFileHandle.

nCharactersWritten   FWRITE( ) writes the entire character expression to the file or port unless you include nCharactersWritten. When you include nCharactersWritten, nCharactersWritten characters are written to the file or port. If nCharactersWritten is less than the number of characters in cExpression, only nCharactersWritten characters are written to the file or port. All of the characters in cExpression are written to the file or port if nCharactersWritten is equal to or greater than the number of characters in cExpression.

 Remarks

Unlike FPUTS( ), FWRITE( ) doesn’t place a carriage return and a linefeed at the end of the character string.

FWRITE( ) returns the number of bytes written to the file or communication port. If FWRITE( ) can’t write to the file or port for any reason, 0 is returned.


 See Also

FCHSIZE( )
FCLOSE( )
FCREATE( )
FEOF( )
FFLUSH( )
FGETS( )
FOPEN( )
FPUTS( )
FREAD( )
FSEEK( )


GATHER Command

Syntax         Arguments         Example         See Also

Replaces the data in the current record of the currently selected table with data from an array, a set of variables, or an object.

 Syntax

GATHER FROM ArrayName | MEMVAR | NAME ObjectName
[FIELDS FieldList | FIELDS LIKE Skeleton | FIELDS EXCEPT Skeleton]
[MEMO]

 Arguments

FROM ArrayName   Specifies the array whose data replaces the data in the current record. The contents of the elements of the array, starting with the first element, replace the contents of the corresponding fields of the record. The contents of the first array element replace the first field of the record; the contents of the second array element replace the second field, and so on.

If the array has fewer elements than the table has fields, the additional fields are ignored. If the array has more elements than the table has fields, the additional array elements are ignored.

MEMVAR   Specifies the variables or array from which data is copied to the current record. Data is transferred from the variable to the field that has the same name as the variable. The contents of a field are not replaced if a variable doesn’t exist with the same name as the field.

Tip   You can create variables with the same names as fields by including MEMVAR or BLANK in SCATTER.

NAME ObjectName   Specifies an object whose properties have the same names as fields in the table. The contents of each field are replaced by the value of the property with the same names as the fields. The contents of a field are not replaced if a property doesn’t exist with the same name as the field.

FIELDS FieldList   Specifies the fields whose contents are replaced by the contents of the array elements or variables. Only the field specified with FieldList has its contents replaced.

FIELDS LIKE Skeleton | FIELDS EXCEPT Skeleton   You can selectively replace fields with the contents of array elements or variables by including the LIKE or EXCEPT clause or both. If you include LIKE Skeleton, Visual FoxPro replaces the fields that match Skeleton. If you include EXCEPT Skeleton, Visual FoxPro replaces all fields except those that match Skeleton.

Skeleton supports wildcards (* and ?). For example, to replace all fields that begin with the letters A and P, use:

GATHER FROM gamyarray FIELDS LIKE A*,P*

MEMO   Specifies that the contents of memo fields are replaced with the contents or array elements or variables. If you omit MEMO, memo fields are skipped when GATHER replaces the contents of fields with the contents of an array or variable. General and picture fields are always ignored in GATHER, even if you include the MEMO keyword.


 GATHER Command Example

Example 1

This example uses GATHER to copy data to a new record in a table. After the table Test is created, SCATTER is used to create a set of variables based on the fields in the table. Each field is then assigned a value and a new blank record is added to the table.

CREATE TABLE Test FREE ;

(Object C(10), Color C(16), SqFt n(6,2))

SCATTER MEMVAR BLANK

m.Object="Box"

m.Color="Red"

m.SqFt=12.5

APPEND BLANK

GATHER MEMVAR

BROWSE

Example 2

This example uses GATHER along with the NAME clause to copy data to a new record in a table. After the table Test is created, SCATTER is used to create an object with properties based on the fields in the table. The object’s properties are then assigned values and a new blank record is added to the table.

CREATE TABLE Test FREE ;

(Object C(10), Color C(16), SqFt n(6,2))

SCATTER NAME oTest BLANK

oTest.Object="Box"

oTest.Color="Red"

oTest.SqFt=12.5

APPEND BLANK

GATHER NAME oTest

RELEASE oTest

BROWSE


 See Also

APPEND FROM ARRAY
COPY TO ARRAY
DIMENSION
SCATTER


_GENGRAPH System Memory Variable
_GENGRAPH System Variable

Included for backward compatibility. Use the Graph Wizard instead.


_GENMENU System Memory Variable
_GENMENU System Variable

Syntax         Arguments         Remarks         See Also

Specifies a menu generation program.

 Syntax

_GENMENU = ProgramName

 Arguments

ProgramName   Specifies a program that previous versions used to generate menu code from an .MNX menu definition table. If your program is in a directory or folder other than the current default directory or folder, include a path with the program name.

 Remarks

_GENMENU contains GENMENU.PRG by default.


 See Also

CREATE MENU
_GENSCRN


_GENPD System Memory Variable
_GENPD System Variable

Included for backward compatibility. Use the TO FILE ASCII argument in REPORT.


_GENSCRN System Memory Variable
_GENSCRN System Variable

Included for backward compatibility. Use the Form Designer instead.


_GENXTAB System Memory Variable
_GENXTAB System Variable

Included for backward compatibility. Use the Cross-tab Wizard instead.


GETBAR( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the number of an item on a menu defined with DEFINE POPUP or the Visual FoxPro system menu.

 Syntax

GETBAR(MenuItemName, nMenuPosition)

 Returns

Numeric

 Arguments

MenuItemName   Specifies the menu item.

nMenuPosition   Specifies a position on the menu. nMenuPosition can range from 1 through the number of items within the menu. 1 corresponds to the first item on the menu, 2 to the second item, and so on.

 Remarks

Use GETBAR( ) to determine which item occupies a specific position on a menu. This function is useful when items on a menu are added, removed, or rearranged. Use DEFINE BAR to add an item to a menu or RELEASE BAR to remove an item. The position of items in a menu can be changed if MOVER is included when the menu is created with DEFINE POPUP.


 GETBAR( ) Function Example

The following example creates a menu named popDemo. The MOVER keyword is included so the items in the menu can be rearranged. For information about rearranging menu items, see the MOVER clause in DEFINE POPUP.

The menu is activated, and a series of GETBAR( ) functions are used in PRMBAR( ) to return captions of each item. After you rearrange the items, press CTRL+Z to display the new item order.

CLEAR

ON KEY LABEL CTRL+Z DO showorder

WAIT WINDOW "Press CTRL+Z to refresh." NOWAIT

DEFINE POPUP popDemo MOVER FROM 2,2

DEFINE BAR 1 OF popDemo PROMPT 'One'

DEFINE BAR 2 OF popDemo PROMPT 'Two'

DEFINE BAR 3 OF popDemo PROMPT 'Three'

DEFINE BAR 4 OF popDemo PROMPT 'Four'

DO showorder

ACTIVATE POPUP popDemo

PROCEDURE showorder

CLEAR

@ 3,12 SAY  '1 ' + PRMBAR('popDemo', GETBAR('popDemo',1))

@ 4,12 SAY  '2 ' + PRMBAR('popDemo', GETBAR('popDemo',2))

@ 5,12 SAY  '3 ' + PRMBAR('popDemo', GETBAR('popDemo',3))

@ 6,12 SAY  '4 ' + PRMBAR('popDemo', GETBAR('popDemo',4))

RETURN


 See Also

DEFINE BAR
DEFINE POPUP
RELEASE BAR


GETCOLOR( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Displays the Windows Color dialog box and returns the color number of the chosen color.

 Syntax

GETCOLOR([nDefaultColorNumber])

 Returns

Numeric

 Arguments

nDefaultColorNumber   Specifies the color that is initially selected when the Color dialog box is displayed. If nDefaultColorNumber doesn’t correspond to a color in the Color dialog box, the first color in the Color dialog box is selected. If you omit nDefaultColorNumber, black is selected.

 Remarks

GETCOLOR( ) returns  – 1 if you exit the Color dialog box by pressing ESC, choosing the Cancel button, or choosing Close from the Control menu.


 GETCOLOR( ) Function Example

The following example displays the Windows Color dialog box with the color red selected. A number corresponding to the color you choose is displayed when you exit the dialog box.

CLEAR

? GETCOLOR(255)


 See Also

GETPICT( )
RGB( )


GETCP( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Prompts for a code page by displaying the Code Page dialog box, and then returns the number of the code page chosen.

 Syntax

GETCP([nCodePage] [, cText] [, cDialogTitle])

 Returns

Numeric

 Arguments

nCodePage   Specifies the number of the code page that is initially selected when the Code Page dialog box is displayed. If nCodePage is 0 or if you omit nCodePage, a code page isn’t selected when the Code Page dialog box is displayed.

cText   Specifies the text displayed in the Code Page dialog box. If you omit cText, Visual FoxPro displays the following text: “Please select a code page for cross-platform data sharing.”

cDialogTitle   Specifies the title that appears in the Code Page dialog box title bar. If you omit cDialogTitle, the title “Code Page” is displayed.

 Remarks

GETCP( ) returns 0 if you exit the Code Page dialog box by pressing ESC, choosing the Cancel button, or choosing Close from the Control menu.

The code pages listed in the Code Page dialog box are determined by FOXPRO.INT, the Visual FoxPro International code page support file.

You can include GETCP( ) in commands such as MODIFY COMMAND, APPEND FROM, and COPY TO that support the AS nCodePage clause. The Code Page dialog box is displayed, allowing you to specify the code page of the file opened, appended, or created. Because no code page 0 exists, you must trap for 0 in case the user chooses ESC, the Cancel button, or Close from the Control menu.


 GETCP( ) Function Example

The following example displays the Code Page dialog box with code page 1252 (Windows ANSI) selected. “Select a Code Page” is displayed as the caption in the Code Page dialog box, and “Code Page Selection” is displayed in the Code Page dialog box title bar.

? GETCP(1252, "Select a Code Page", "Code Page Selection")


 See Also

APPEND FROM
COPY TO
EXPORT
IMPORT
MODIFY COMMAND
MODIFY FILE
MODIFY QUERY


GETDIR( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Displays the Select Directory or Select Folder dialog box from which you can choose a directory or folder.

 Syntax

GETDIR([cPath [, cText]])

 Returns

Character

 Arguments

cPath   Specifies the directory or folder that is initially displayed in the dialog box. When cDirectory is not specified, the dialog box opens with the Visual FoxPro default directory or folder displayed.

cText   Specifies the text for the directory or folder list in the dialog box. In Windows 3.1, the text appears as the caption in the title bar of the dialog box. In Windows 95, the text appears below the title bar inside the dialog box.

 Remarks

GETDIR( ) returns as a character string the name of the directory or folder you choose.

If you do not choose a directory or folder (you click Cancel, press ESC, or choose Close from the Control menu), GETDIR( ) returns the empty string.


 See Also

GETEXPR
GETFILE( )


GETENV( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the contents of the specified MS-DOS environment variable.

 Syntax

GETENV(cVariableName)

 Returns

Character

 Arguments

cVariableName   Specifies the name of the MS-DOS environment variable. The empty string is returned if the MS-DOS environment variable you specify doesn’t exist.

You can locate the Windows directory with the WINDIR environmental variable, which Windows sets when it starts.

 Remarks

Two environment variables are always available: COMSPEC and PATH. You can create your own environment variables with the MS-DOS SET command.

For additional information on creating environment variables, see your MS-DOS manual.


 GETENV( ) Function Example

CLEAR

? GETENV('PATH')  && Displays the MS-DOS path


 See Also

DISKSPACE( )
OS( )
VERSION( )


GETEXPR Command

Syntax         Arguments         Example         See Also

Displays the Expression Builder dialog box so you can create an expression and store the expression to a variable or array element.

 Syntax

GETEXPR [cCaptionText] TO MemVarName
[TYPE cExpressionType [; cErrorMessageText]]
[DEFAULT cDefaultExpression]

 Arguments

cCaptionText   Specifies the caption that appears in the Expression Builder. The caption can be used to remind the user of what kind of expression to build.

TO MemVarName   Specifies the variable or array element in which the expression is stored. If the variable doesn’t already exist, Visual FoxPro creates it. GETEXPR won’t create an array element.

If you exit the Expression Builder by pressing ESC or by choosing Cancel, the empty string is stored to the variable or array element. If a default expression is created with the DEFAULT clause, the default expression is stored to the variable if you exit the Expression Builder by pressing ESC or choosing Cancel.

TYPE cExpressionType [; cErrorMessageText]   Specifies the expression type. The following table lists the character to specify in cExpressionType for each expression type:

cExpressionType	Expression type
C	Character
D	Date
T	DateTime
N	Numeric
F	Float
I	Integer
B	Double
Y	Currency
L	Logical
You can specify the error message cErrorMessageText to be displayed if the expression isn’t valid. If cErrorMessageText is included with cExpressionType, cExpressionType and cErrorMessageText must be separated by a semicolon (;). The combination of cExpressionType, the semicolon, and cErrorMessageText must be enclosed in single or double quotes in matching pairs.

DEFAULT cDefaultExpression   Allows you to display the initial default expression in the Expression Builder. You can accept the default expression or overwrite it with your own expression specified with cDefaultExpression. cDefaultExpression is stored to the variable or array element if you exit the Expression Builder by pressing ESC or choosing Cancel.


 GETEXPR Command Example

In the following example, GETEXPR is used to get a LOCATE expression of the proper type. If LOCATE is successful, the company name is displayed; otherwise, a message is displayed.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

GETEXPR 'Enter condition to locate ' TO gcTemp;

TYPE 'L' DEFAULT 'COMPANY = ""'

LOCATE FOR &gcTemp

IF FOUND( )

DISPLAY

ELSE

? 'Condition ' + gcTemp + ' was not found '

ENDIF


 See Also

GETFILE( )
GETPICT( )
LOCFILE( )
PUTFILE( )


GETFILE( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Displays the Open dialog box and returns the name of the file you chose.

 Syntax

GETFILE([cFileExtensions] [, cText] [, cOpenButtonCaption]
[, nButtonType])

 Returns

Character

 Arguments

cFileExtensions   Specifies the file extensions of the files displayed in the scrollable list when the All Files menu item isn’t chosen. If passing a value as a literal, enclose it in quotation marks. Do not include a period (.) in front of file extensions.

cFileExtensions can take a variety of forms:

•	If cFileExtensions contains a single extension (for example, “PRG”), only files with that extension are displayed.

•	If cFileExtensions is the empty string, all files in the current directory or folder are displayed if cCreatorType is not included.

•	cFileExtensions can also contain wildcards (* and ?). All files with extensions that meet the wildcard criteria are displayed. For example, if cFileExtensions is “?X?”, all files with the extension .FXP, .EXE, and .TXT are displayed.

•	In Visual FoxPro for Windows, cFileExtensions can contain a file description followed by a file extension or a list of file extensions separated with commas. The file description appears in the Files of Type list box. Separate the file description from the file extension or list of file extensions with a colon (:). Separate multiple file descriptions and their file extensions with a semicolon (;).

For example, if cFileExtensions is “Text:TXT” the file description “Text” appears in the Files of Type list box and all files with a .TXT extension are displayed.

If cFileExtensions is “Tables:DBF; Files:TXT,BAK” the file descriptions “Tables” and “Files” appear in the Files of Type list box. When “Tables” is chosen from the Files of Type list box, all files with a .DBF extension are displayed. When “Files” is chosen from the Files of Type list box, all files with .TXT and .BAK extensions are displayed.

cText   Specifies the text for the directory or folder list in the Open dialog box. In Windows 95, the text appears below the list of files and long text strings may be truncated. On the Macintosh, the text appears inside the dialog box.

cOpenButtonCaption   Specifies a caption for the OK button.

nButtonType   Specifies the number and type of buttons that appear in the Open dialog box. The following buttons appear in the dialog box when nButtonType is 0, 1, or 2.

nButtonType	Buttons
0  (or omitted)	OK Cancel
1	OK New Cancel
2	OK None Cancel
“Untitled” is returned with the path specified in the Open dialog box if nButtonType is 1 and the user chooses the New button. The empty string is returned if nButtonType is 2 and the user chooses the None button.

 Remarks

GETFILE( ) returns the empty string if you exit the Open dialog box by pressing ESC, choosing Cancel, or choosing Close from the Control menu.


 GETFILE( ) Function Example

CLOSE DATABASES

SELECT 0

gcTable = GETFILE('DBF', 'Browse or Create a .DBF:', 'Browse',1)

DO CASE

CASE 'Untitled' $ gcTable

CREATE (gcTable)

CASE EMPTY(gcTable)

RETURN

OTHERWISE

USE (gcTable)

BROWSE

ENDCASE


See Also

FULLPATH( )
GETEXPR
GETPICT( )
LOCFILE( )
PUTFILE( )


GETFLDSTATE( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns a numeric value indicating if a field in a table or cursor has been edited or had a record appended, or if the deleted status of the current record has been changed.

 Syntax

GETFLDSTATE(cFieldName | nFieldNumber [, cTableAlias | nWorkArea])

 Returns

Numeric

 Arguments

cFieldName | nFieldNumber   Specifies the name of the field or the number of the field for which the edit status is returned. The field number nFieldNumber corresponds to the position of the field in the table or cursor structure. DISPLAY STRUCTURE or FIELD( ) can be used to determine a field’s number.

You can specify –1 for nFieldNumber to return a character string consisting of deletion and edit status values for all fields in the table or cursor. For example, if a table has five fields and only the first field has been edited, GETFLDSTATE( ) returns the following:

121111

The 1 in the first position indicates the deletion status has not been changed.

You can also include 0 for nFieldNumber to determine if the deletion status of the current record has changed since the table or cursor was opened.

Note   Using GETFLDSTATE( ) only determines if the deletion status of the current record has changed. For example, if you mark a record for deletion and then recall it, GETFLDSTATE( ) indicates the deletion status has changed even though the record’s deletion status has returned to its original state. Use DELETED( ) to determine the current deletion status of a record.

cTableAlias   Specifies the alias of the table or cursor for which the field edit or record deletion status is returned.

nWorkArea   Specifies the work area of the table or cursor for which the field edit or record deletion status is returned.

If you do not specify an alias or work area, GETFLDSTATE( ) returns a value for a field in the currently selected table or cursor.

 Remarks

The following table lists the character return values and the corresponding edit or deletion status.

Return value	Edit or deletion status
1	Field has not been edited or deletion status has not changed.
2	Field has been edited or deletion status has changed.
3	Field in an appended record has not been edited or deletion status has not changed for the appended record.
4	Field in an appended record has been edited or deletion status has changed for the appended record.
Row or table buffering must first be enabled with CURSORSETPROP( ) for GETFLDSTATE( ) to operate on local tables.

The edit or deletion status is returned for the table or cursor open in the currently selected work area if GETFLDSTATE( ) is issued without the optional cTableAlias or nWorkArea arguments.


 GETFLDSTATE( ) Function Example

The following example demonstrates how you can use GETFLDSTATE( ) to determine if the contents of a field have changed. MULTILOCKS is set to ON, a requirement for table buffering. The customer table in the testdata database is opened, and CURSORSETPROP( ) is then used to set the buffering mode to optimistic table buffering (5).

GETFLDSTATE( ) is issued to display a value (1) corresponding to the unmodified state of the cust_id field before it is modified. The cust_id field is modified with REPLACE, and GETFLDSTATE( ) is issued again to display a value (2) corresponding to the modified state of the cust_id field. TABLEREVERT( ) is used to return the table to its original state, and GETFLDSTATE( ) is issued again to display a value (1) corresponding to the original state of the cust_id field.

CLOSE DATABASES

CLEAR

SET MULTILOCKS ON                         && Allow table buffering

OPEN DATABASE SYS(2004)+"samples\data\testdata"

USE Customer	                              && Open customer table

=CURSORSETPROP("Buffering",5,"customer")  && Enable table buffering

* Get field state on original cust_id field and display state

nState=GETFLDSTATE("cust_id")

DO DisplayState WITH nState

* Change field contents and display state

REPLACE cust_id 	WITH "***"

nState=GETFLDSTATE("cust_id")

DO DisplayState WITH nState

* Discard table changes and display state

= TABLEREVERT(.T.)                        && Discard all table changes

nState=GETFLDSTATE("cust_id")

DO DisplayState WITH nState

PROCEDURE DisplayState

PARAMETER nState

DO CASE

CASE nState=1

=MESSAGEBOX("Field has not been modified",0,"Results")

OTHERWISE

=MESSAGEBOX("Field has been modified",0,"Results")

ENDCASE


 See Also

CURVAL( )
DELETED( )
FIELD( )
OLDVAL( )
CURSORSETPROP( )
SETFLDSTATE( )


GETFONT( ) Function

Syntax         Returns         Remarks         See Also

Displays the Font dialog box and returns the name of the font you choose.

 Syntax

GETFONT( )

 Returns

Character

 Remarks

GETFONT( ) returns the name, size, and style of the font you choose. Your choice is returned as a character string with the font name, size, and style separated by commas.

GETFONT( ) returns the empty string if you exit the Font dialog box by choosing Cancel, choosing Close from the Control menu, or pressing ESC.

Note   Visual FoxPro commands and functions can be abbreviated to four characters. In the case of GETFONT( ) and GETFILE( ), which both begin with the same four letters, precedence is given to GETFILE( ). Issuing GETF( ) displays the Open dialog box.


 See Also

FONTMETRIC( )
SYSMETRIC( )
TXTWIDTH( )
WFONT( )


GETNEXTMODIFIED( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the record number for the next modified record in a buffered table or cursor.

 Syntax

GETNEXTMODIFIED(nRecordNumber [, cTableAlias | nWorkArea])

 Returns

Numeric

 Arguments

nRecordNumber   Specifies the record number after which GETNEXTMODIFIED( ) searches for the next modified record. Specify 0 for nRecordNumber to determine the first record in the table or cursor that has been modified.

cTableAlias   Specifies the alias of the table or cursor for which GETNEXTMODIFIED( ) returns the number of the next modified record.

nWorkArea   Specifies the work area of the table or cursor for which GETNEXTMODIFIED( ) returns the number of the next modified record.

If you do not specify an alias or work area, GETNEXTMODIFIED( ) returns the record number for the next modified record in the currently selected table or cursor.

 Remarks

GETNEXTMODIFIED( ) returns 0 if there are no modified records after the record you specify. A record is considered modified if the contents of any of its fields are changed in any way (even if the original field contents are restored) or the record’s deletion status is changed.

GETNEXTMODIFIED( ) can operate only on tables and cursors for which table buffering is enabled. Table buffering is enabled with CURSORSETPROP( ).


 GETNEXTMODIFIED( ) Function Example

The following example demonstrates how you can use GETNEXTMODIFIED( ) to determine which records in a table have been changed. MULTILOCKS is set to ON, a requirement for table buffering. The customer table in the testdata database is opened, and CURSORSETPROP( ) is then used to set the buffering mode to optimistic table buffering (5).

SKIP is issued to move the record pointer to the second record, and the cust_id field is modified with REPLACE. GETNEXTMODIFIED(0) is used to display the record number of the next modified record (2, the second record), starting from the beginning of the table. TABLEREVERT( ) is used to return the table to its original state, and GETNEXTMODIFIED(0) is used again to display the record number of the next modified record (0, indicating that no records have been modified).

CLOSE DATABASES

CLEAR

OPEN DATABASE SYS(2004)+"samples\data\testdata"

SET MULTILOCKS ON  && Allow table buffering

USE Customer	  && Open customer table

=CURSORSETPROP("Buffering", 5, "customer")  && Enable table buffering

SKIP  && Move record pointer to the second record

* Change field contents

REPLACE cust_id WITH "***"

* Call MESSAGEBOX function with results of GETNEXTMODIFIED

=MESSAGEBOX("Record " + ALLTRIM(STR(GETNEXTMODIFIED(0))) + ;

     " has changed.",0,"Results")

* Revert table and display results with MESSAGEBOX

=TABLEREVERT(.T.)  && Discard all table changes

nChange=GETNEXTMODIFIED(0)

IF nChange=0

     =MESSAGEBOX("Record(s) have been reverted.",0,"Results")

ELSE

     =MESSAGEBOX("Record " + ALLTRIM(STR(GETNEXTMODIFIED(0))) + ;

          " has changed.",0,"Results")

ENDIF


 See Also

CURSORSETPROP( )
CURVAL( )
GETFLDSTATE( )
OLDVAL( )


GETOBJECT( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Activates an OLE automation object and creates a reference to the object.

 Syntax

GETOBJECT(FileName [, ClassName])

 Returns

Object

 Arguments

FileName   Specifies the full path and name of the file to activate. The application does not need to be specified, because the OLE dynamic link libraries determine the application to start based on the file name you provide.

For example, the following code launches Microsoft Excel, opens a file named BUDGET.XLS, and creates a reference through an object variable named MBUDVAR:

MBUDVAR = GETOBJECT('C:\EXCEL\WORK\BUDGET.XLS')

ClassName   Specifies the class name of the object to retrieve. Some applications can store more than one object type in the same file, allowing you to use the class name to specify the object to activate. For example, if a word processing application stores its documents, macro definitions, and ToolBar objects in the same file, you can create a reference to the document file with the following command:

MDOCFILE = GETOBJECT('C:\WRDPROC\MYDOC.DOC','WrdProc.Document')

With some server applications, each time you issue GETOBJECT( ), an additional instance of the application is started, using additional memory. If the application is already running, you can prevent additional instances of the application from starting by omitting FileName and including ClassName, as in this example:

oleApp = GETOBJECT(, "Excel.Application")

 Remarks

Use GETOBJECT( ) to activate an OLE automation object from a file and to assign a reference to the object through a memory variable or array element.

If you specify an invalid file or class name, an OLE error is displayed, and the GETOBJECT( ) function returns an empty string.


 See Also

CREATEOBJECT( )
DEFINE CLASS
SET OLEOBJECT


GETPAD( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the menu title for a given position on the menu bar.

 Syntax

GETPAD(cMenuBarName, nMenuBarPosition)

 Returns

Character

 Arguments

cMenuBarName   Specifies the menu bar name.

nMenuBarPosition   Specifies a position on the menu bar. nMenuPosition can range from 1 (the leftmost menu title on the menu bar) through the number of menu titles on the menu bar.

 Remarks

Menu names on a titles bar can be added, removed, or rearranged. Use DEFINE PAD to add a menu name to a title bar or RELEASE PAD to remove a menu title.


 GETPAD( ) Function Example

The following program uses GETPAD( ) to test if the Edit menu name is on the Visual FoxPro system menu bar. If it is, GETPAD( ) returns the menu  name. (To restore the Edit menu bar to its default state, issue the command SET SYSMENU TO DEFAULT.)

FOR gnCount = 1 TO CNTPAD('_msysmenu')	&& Number of pads

IF PRMPAD('_msysmenu', GETPAD('_msysmenu', gnCount)) = 'Edit'

RELEASE PAD (GETPAD('_msysmenu', gnCount)) OF _msysmenu

EXIT

ENDIF

ENDFOR


 See Also

DEFINE MENU
DEFINE PAD
RELEASE PAD


GETPEM( ) Function

Syntax         Returns         Arguments         See Also

Returns the current value for a property or program code for an event or method.

 Syntax

GETPEM(oObjectName | cClassName, cProperty | cEvent | cMethod)

 Returns

Character, Currency, Date, DateTime, Numeric, or Logical

 Arguments

oObjectName   Specifies the object for which a property value or event or method program code is returned. oObjectName can be any expression that evaluates to an object, such as an object reference, an object memory variable, or an object array element.

cClassName   Specifies the class for which a property value or event or method program code is returned.

cProperty   Specifies the property whose value is returned.

cEvent   Specifies the event for which program code is returned.

cMethod   Specifies the method for which program code is returned.


 See Also

CREATE FORM
PEMSTATUS( )
SYS(1269) - Property Information
SYS(1270) - Object Location
SYS(1271) - Object's .SCX File
SYS(1272) - Object Hierarchy


GETPICT( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Displays the Open dialog box and returns the name of the picture file you chose.

 Syntax

GETPICT([cFileExtensions] [, cFileNameCaption] [, cOpenButtonCaption])

 Returns

Character

 Arguments

cFileExtensions   Specifies the file extensions of the picture files displayed in the scrollable list when the All Files menu item isn’t chosen.

cFileExtensions can take the following forms:

•	If cFileExtensions contains a single extension (for example, BMP), only files with that extension are displayed.

•	cFileExtensions can also contain wildcards (* and ?). All files with extensions that meet the wildcard criteria are displayed. For example, if cFileExtensions is ?X?, all files with the extension .FXP, .EXE, and .TXT are displayed.

•	If cFileExtensions contains an empty string (“”), files with the extensions .BMP and .DIB are displayed.

cFileNameCaption   Specifies the caption displayed above the File Name text box. cFileNameCaption replaces “File Name” that appears when cFileNameCaption is omitted.

cOpenButtonCaption   Specifies a caption for the OK button.

 Remarks

GETPICT( ) returns the empty string if you exit the Open dialog box by pressing ESC, choosing Cancel, or choosing Close from the Control menu.


 See Also

GETFILE( )
GETEXPR
LOCFILE( )
PUTFILE( )


GETPRINTER( ) Function

Syntax         Returns         Remarks         Example         See Also

Displays the Print dialog box and returns the name of the printer you select.

 Syntax

GETPRINTER( )

 Returns

Character

 Remarks

GETPRINTER( ) returns an empty string if you exit the Print dialog box by pressing ESC, choosing the Cancel button, or clicking the Close button.


 GETPRINTER( ) Function Example

CLEAR

cPrinter = GETPRINTER( )   && Displays the Windows Printer Dialog

*** Displays the name of the printer chosen ***

WAIT WINDOW IIF(EMPTY(cPrinter), 'No printer chosen', cPrinter)


 See Also

APRINTERS( )
SET PRINTER


GO | GOTO Command

Syntax         Arguments         Remarks        Example         See Also

Moves the record pointer to the specified record number.

 Syntax

GO [RECORD] nRecordNumber [IN nWorkArea | IN cTableAlias]
– Or –

GO TOP | BOTTOM [IN nWorkArea | IN cTableAlias]

– Or –

GOTO [RECORD] nRecordNumber [IN nWorkArea | IN cTableAlias]

– Or –

GOTO TOP | BOTTOM [IN nWorkArea | IN cTableAlias]

 Arguments

RECORD nRecordNumber   Specifies the physical record number to move the record pointer to. You can omit GO or GOTO entirely and specify just the record number. If you specify just the record number, you can move the record pointer only within the current work area.

IN nWorkArea   Specifies the work area of the table in which the record pointer is moved.

IN cTableAlias   Specifies the alias of the table in which the record pointer is moved.

TOP   Positions the record pointer on the first record in the table. If the table has an ascending index in use, the first record is the record with the lowest key value. If the index is in descending order, the first record is the record with the highest key value.

BOTTOM   Positions the record pointer on the last record in the table. If the table has an ascending index in use, the last record is the record with the highest key value. If the index is in descending order, the last record is the record with the lowest key value.

 Remarks

GO and GOTO can be used interchangeably. These commands operate on the table in the current work area unless you specify another work area with the IN clause.


 GO | GOTO Command Example

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE products  && Opens Products table

USE customer IN 0  && Opens Customer table

GO BOTTOM IN products

CLEAR

? RECNO('products')

GO TOP

? RECNO( )           && Displays 1

GO 5

? RECNO( )           && Displays 5


 See Also

RECNO( )
SELECT
SKIP


GOMONTH( ) Function

Syntax         Returns         Arguments         Example         See Also

Returns the date that is a specified number of months before or after a given Date or DateTime expression.

 Syntax

GOMONTH(dExpression | tExpression, nNumberOfMonths)

 Returns

Date

 Arguments

dExpression   Specifies a date expression for which GOMONTH( ) returns the date.

tExpression   Specifies a datetime expression for which GOMONTH( ) returns the date.

nNumberOfMonths   Specifies the number of months from the date or datetime. If nNumberOfMonths is positive, GOMONTH( ) returns a date that is nNumberOfMonths months after the date or datetime. If nNumberOfMonths is negative, GOMONTH( ) returns a date that is nNumberOfMonths months before the date or datetime.


 GOMONTH( ) Function Example

SET CENTURY ON

STORE GOMONTH({08/02/95}, 5) TO gdDeadLine

CLEAR

? gdDeadLine  && Displays 01/02/1996

? GOMONTH({12/31/95}, 2)  && Displays 02/29/1996

? GOMONTH({12/31/95}, -2)  && Displays 10/31/1995


 See Also

CMONTH( )


GotFocus Event

Syntax         Parameters         Remarks         Applies To         See Also

Occurs when an object receives the focus, either by user action or through code.

 Syntax

PROCEDURE Object.GotFocus
[LPARAMETERS nIndex]

 Parameters

nIndex   Uniquely identifies a control if it is in a control array.

 Remarks

Use the GotFocus event to specify actions to occur when an object receives the focus. For example, by attaching a GotFocus event to each control on a Form, you can guide a user by displaying brief instructions or status bar messages. You can also provide visual cues by enabling, disabling, or showing other controls that depend on the control that has the focus.

A control receives the focus by user action, such as a mouse click, or when the SetFocus method is called in code.

A form receives the focus only when the form has no controls or when all its controls are disabled or invisible.

An object can receive the focus only if its Enabled and Visible properties are set to true (.T.). To customize the keyboard interface for moving the focus, set the tab order or specify access keys for controls on a form.

The GotFocus event occurs after the Activate event for the control’s container.


 Applies To

CheckBox, ComboBox, CommandButton, Container Object, Control Object, EditBox, Form, ListBox, OLE Bound Control, OLE Container Control, OptionButton, Spinner, TextBox


 See Also

Activate Event
ActiveControl Property
Click Event
Deactivate Event
Enabled Property
LostFocus Event
SetFocus Method
TabIndex Property
TabStop Property
Visible Property


Grid Control

Syntax         Remarks         Properties         Events         Methods         Example         See Also

Creates a grid.

 Syntax

Grid

 Remarks

A grid is a container object that displays data in rows and columns, and is similar in appearance to a Browse window. A grid is also a container object that contains column objects. A column can contain a Header object and controls. Because a grid and its columns, headers, and controls each have their own set of properties, you have complete control over each element of the grid. You can create a grid interactively using the Grid Builder.

For additional information about creating grids, see Chapter 10, “Using Controls,” in the Developer’s Guide.


 Properties

ActiveColumn	ActiveRow	BackColor
BaseClass	ChildOrder	Class
ClassLibrary	ColumnCount	Columns
Comment	DeleteMark	DragIcon
DragMode	Enabled	FontBold
FontCondense	FontExtend	FontItalic
FontName	FontOutline	FontShadow
FontSize	FontStrikeThru	FontUnderline
ForeColor	GridLineColor	GridLines
GridLineWidth	HeaderHeight	Height
HelpContextID	HighLight	HighLightRow
Left	LeftColumn	LinkMaster
MousePointer	Name	PanelLink
Panel	Parent	ParentClass
Partition	ReadOnly	RecordMark
RecordSourceType	RelationalExpr	RelativeColumn
RelativeRow	RightToLeft	RowHeight
ScrollBars	StatusBarText	TabIndex
TabStop	Tag	ToolTipText
Top	Value	View
Visible	Width


 Events

AfterRowColChange	BeforeRowColChange	Click
DblClick	Deleted	Destroy
DragDrop	DragOver	Error
Init	MiddleClick Event	MouseDown
MouseMove	MouseUp	MouseWheel
Resize	RightClick	Moved
Scrolled	UIEnable	Valid
When


 Methods

ActivateCell	AddColumn	AddObject
CloneObject	DeleteColumn	DoScroll
Drag	Move	ReadExpression
ReadMethod	Refresh	RemoveObject
ResetToDefault	SaveAsClass	SetAll
SetFocus	WriteExpression	WriteMethod
ZOrder


 Grid Control Example

The following example places a Grid control on a form. The customer table is opened and its contents are displayed in the grid. The Caption property is used to specify a different header caption (Customer ID) for the CUST_ID field. A command button is placed on the form to close the form.

The SetAll method is used with the DynamicBackColor property to specify the background colors for the records. If the number of a record displayed in the grid is even, the record’s DynamicBackColor is white, otherwise its DynamicBackColor is green.

CLOSE ALL  && Close tables and databases

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  IN 0  && Opens Customer table

frmMyForm = CREATEOBJECT('Form')  && Create a Form

frmMyForm.Closable = .F.  && Disable  Control-menu box

frmMyForm.AddObject('cmdCommand1','cmdMyCmdBtn')  && Add Command button

frmMyForm.AddObject('grdGrid1','Grid')  && Add Grid control

frmMyForm.grdGrid1.Left = 25    && Adjust Grid position

frmMyForm.grdGrid1.SetAll("DynamicBackColor", ;

"IIF(MOD(RECNO( ), 2)=0, RGB(255,255,255) ;

, RGB(0,255,0))", "Column")  && Alternate white and green records

frmMyForm.grdGrid1.Visible = .T.  && Grid control visible

frmMyForm.cmdCommand1.Visible =.T.  && "Quit" Command button visible

frmMyForm.grdGrid1.Column1.Header1.Caption = 'Customer ID'

frmMyForm.SHOW  && Display the form

READ EVENTS  && Start event processing

DEFINE CLASS cmdMyCmdBtn AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 210  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close form

CLOSE ALL  && Close table and database

ENDDEFINE


 See Also

Column Object
CREATE CLASS
CREATE FORM
DEFINE CLASS
Header Object


GridLineColor Property

Syntax         Settings         Applies To         See Also

Specifies the color of the lines separating cells in a Grid control. Available at design time; read-write at run time.

 Syntax

Grid.GridLineColor[ = nColor]

Grid.GridLineColor = RGB(nRedValue, nGreenValue, nBlueValue)

 Settings

nColor   Specifies a single number to represent the color. By default, GridLineColor is set to 0 (Black).

nRedValue, nGreenValue, nBlueValue   Specifies three separate color intensities that compose the Grid’s line color; must be used with the RGB( ) function to consolidate the three color components into one number, which is what the GridLineColor property is.

Note   In the Properties window, you can double-click any of the color properties to display the Color dialog box. You can choose or define colors from this dialog box. The red, green, and blue intensities that correspond to the color you choose become the settings for these properties after you close the Color dialog box.


 Applies To

Grid


 See Also

GridLines Property
GridLineWidth Property


GridLines Property

Syntax         Settings         Applies To         See Also

Determines whether horizontal and vertical lines are displayed in the Grid control. Available at design time; read-write at run time.

 Syntax

Grid.GridLines[ = nSetting]

 Settings

nSetting   The settings for the GridLines property are:

Setting	Description
0	None. No grid lines.
1	Horizontal. Horizontal grid lines only.
2	Vertical. Vertical grid lines only.
3	(Default) Both. Both horizontal and vertical grid lines.


 Applies To

Grid


 See Also

GridLineColor Property
GridLineWidth Property


GridLineWidth Property

Syntax         Settings         Applies To         See Also

Specifies the thickness, in pixels, of the lines separating cells in a Grid control. Available at design time; read-write at run time.

 Syntax

Grid.GridLineWidth[ = nWidth]

 Settings

nWidth   Specifies the thickness of the line separating cells in a Grid control.


 Applies To

Grid


 See Also

GridLineColor Property
GridLines Property


HalfHeightCaption Property

Syntax         Settings         Applies To         See Also

Specifies whether the caption of a form is half the normal height. Available at design time and run time.

 Syntax

Object.HalfHeightCaption[ = lExpr]

 Settings

lExpr   The settings for the HalfHeightCaption property are:

Setting	Description
True (.T.)	The form’s caption is half the normal height.
False (.F.)	(Default) The form’s caption is normal height.


 Applies To

Form, _SCREEN


 See Also

Caption Property


Header Object

Syntax         Remarks         Properties         Events         Methods         Example         See Also

Creates a header for a column in a Grid control.

 Syntax

Header

 Remarks

Each column in a grid contains a header. A header displays the caption at the top of a column, and can respond to events.

For additional information about creating headers in grids, see Chapter 10, “Using Controls,” in the Developer’s Guide.


 Properties

Alignment	BackColor	BaseClass
Caption	Class	ClassLibrary
FontBold	FontCondense	FontExtend
FontItalic	FontName	FontOutline
FontShadow	FontSize	FontStrikeThru
FontUnderline	ForeColor	Name
Parent	ParentClass


 Events

Click	DblClick	MiddleClick Event
MouseDown	MouseMove	MouseUp
MouseWheel	RightClick


 Methods

ReadExpression	ReadMethod	Refresh
ResetToDefault	WriteExpression	WriteMethod


 Header Object Example

The following example uses the Header object with the Caption property to change the caption of the first header in a grid.

A Grid control is placed on a form and the customer table is opened and its contents displayed in the grid. The Header object and the Caption property are used to specify a different header caption (Customer ID) for the first header in the grid.

The SetAll method is used with the DynamicBackColor property to specify the background colors for the records. If the number of a record displayed in the grid is even, the record’s DynamicBackColor is white, otherwise its DynamicBackColor is green. A command button is placed on the form to close the form.

CLOSE ALL  && Close tables and databases

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  IN 0  && Opens Customer table

frmMyForm = CREATEOBJECT('form')  && Create a form

frmMyForm.Closable = .f.  && Disable the Control-menu box

frmMyForm.AddObject('cmdCommand1','cmdMyCmdBtn')  && Add Command button

frmMyForm.AddObject('grdGrid1','Grid')  && Add Grid control

frmMyForm.grdGrid1.Left = 25    && Adjust Grid position

frmMyForm.grdGrid1.SetAll("DynamicBackColor", ;

"IIF(MOD(RECNO( ), 2)=0, RGB(255,255,255) ;

, RGB(0,255,0))", "Column")  && Alternate white and green records

frmMyForm.grdGrid1.Visible = .T.  && Grid control visible

frmMyForm.cmdCommand1.Visible =.T.  && "Quit" Command button visible

frmMyForm.grdGrid1.Column1.Header1.Caption = 'Customer ID'

frmMyForm.SHOW  && Display the form

READ EVENTS  && Start event processing

DEFINE CLASS cmdMyCmdBtn AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 210  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close form

CLOSE ALL  && Close table and database

ENDDEFINE


 See Also

Column Object
CREATE FORM
CREATE CLASS
DEFINE CLASS
Grid Control


HEADER( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns the number of bytes in the header of the current or specified table file.

 Syntax

HEADER([nWorkArea | cTableAlias])

 Returns

Numeric

 Arguments

nWorkArea | cTableAlias   Returns the header size for a table open in another work area. nWorkArea specifies the work area number and cTableAlias specifies the table alias. If you omit the work area and alias, HEADER( ) returns the size of the header for the table open in the current work area.

HEADER( ) returns 0 if a table isn’t open in the work area you specify. If a table doesn’t have the alias you specify, Visual FoxPro displays an error message.

 Remarks

A table header contains information about the table itself, such as the field names and sizes and the presence of a memo file or structural index.


 See Also

FSIZE( )
RECSIZE( )


HeaderHeight Property

Syntax         Settings         Applies To         See Also

Specifies the height of column headers in the Grid control. Available at design time; read-write at run time.

 Syntax

Header.HeaderHeight[ = nHeight]

 Settings

nHeight   The height of the header, specified in pixels.


 Applies To

Grid


 See Also

ScaleMode Property


Height Property

Syntax         Settings         Remarks         Example         Applies To         See Also

Specifies the height of an object on the screen. Available at design time and run time.

 Syntax

Object.Height[ = nHeight]

 Settings

nHeight   Specifies the object’s height measured in the unit of measurement specified by the ScaleMode property of the form.

 Remarks

For forms, the Height measurement does not include the borders and title bar.

For controls, the height is measured from the outside of the control’s border.

The value for this property changes as the object is sized by the user or by code.

Use the Height and Width properties for calculations based on an object’s total area.

Note   The Height property is read-only when it applies to a control contained in a Column object.


 Height Property Example

The following example demonstrates how the Height property is used specify the height of three command buttons on a form.

The AddObject method is used to add a Line control and three command buttons to a form. The Height property specifies the vertical height of each command button.

frmMyForm = CREATEOBJECT('form')  && Create a form

frmMyForm.Closable = .F.  && Disable the Control menu box

frmMyForm.AddObject('shpLine','Line')  && Add a Line control to the form

frmMyForm.AddObject('cmdCmndBtn1','cmdMyCmndBtn1')  && Up Cmnd button

frmMyForm.AddObject('cmdCmndBtn2','cmdMyCmndBtn2')  && Down Cmnd button

frmMyForm.AddObject('cmdCmndBtn3','cmdMyCmndBtn3')  && Quit Cmnd button

frmMyForm.shpLine.Visible = .T.  && Make Line control visible

frmMyForm.shpLine.Top = 20  && Specify Line control row

frmMyForm.shpLine.Left = 125  && Specify Line control column

frmMyForm.cmdCmndBtn1.Visible =.T.  && Up Command button visible

frmMyForm.cmdCmndBtn2.Visible =.T.  && Down" Command button visible

frmMyForm.cmdCmndBtn3.Visible =.T.  && Quit Command button visible

frmMyForm.SHOW  && Display the form

READ EVENTS  && Start event processing

DEFINE CLASS cmdMyCmndBtn1 AS COMMANDBUTTON  && Create Command button

Caption = 'Slant \<Up'  && Caption on the Command button

Left = 50  && Command button column

Top = 100  && Command button row

Height = 25  && Command button height

PROCEDURE Click

ThisForm.shpLine.Visible = .F.  && Hide the Line control

ThisForm.shpLine.LineSlant ='/'  && Slant up

ThisForm.shpLine.Visible = .T.  && Show the Line control

ENDDEFINE

DEFINE CLASS cmdMyCmndBtn2 AS CommandButton  && Create Command button

Caption = 'Slant \<Down'  && Caption on the Command button

Left = 200  && Command button column

Top = 100  && Command button row

Height = 25  && Command button height

PROCEDURE Click

ThisForm.shpLine.Visible = .F.  && Hide the Line control

ThisForm.shpLine.LineSlant ='\'  && Slant down

ThisForm.shpLine.Visible = .T.  && Show the Line control

ENDDEFINE

DEFINE CLASS cmdMyCmndBtn3 AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 150  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close form

ENDDEFINE


 Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, Custom, EditBox, Form, Grid, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, PageFrame, _SCREEN, Shape, Spinner, TextBox, Timer, ToolBar


 See Also

Left Property
Move Method
ScaleMode Property
Top Property
Width Property


HELP Command

Syntax         Arguments         Remarks         See Also

Opens the Help window.

 Syntax

HELP
[Topic | ID nContextID]
[IN [WINDOW] WindowName | IN [WINDOW] SCREEN
| IN [WINDOW]]
[NOWAIT]

 Arguments

Topic   Specifies the Help topic to display. If you include just a partial spelling of a topic title, Visual FoxPro opens the Help window and displays the topic with the closest matching title.

ID nContextID   Specifies the Help topic to display, based on the topic’s context ID.

When you are using .DBF-style Help, nContextID is a value in the Contextid field of the help table. The Contextid field must be the first field in the table.

When you are using graphical style Help, nContextID is a context number in the MAP section of the help project file.

IN [WINDOW] WindowName   Opens the Help window within a parent window. The Help window doesn’t assume the characteristics of the parent window it is placed in. If the Help window is activated inside a parent window, it cannot be moved outside the parent window. If the parent window is moved, the Help window moves with it. Before you can open the Help window from within a parent window, the parent window must first be defined with DEFINE WINDOW.

IN [WINDOW] SCREEN   Explicitly places the Help window on the main Visual FoxPro window.

NOWAIT   In .DBF-style Help, specifies that program execution should continue after the Help window is opened. If you omit NOWAIT when using .DBF-style Help, program execution is suspended at the line containing the HELP command until the Help window is closed.

In graphical style Help, the NOWAIT argument has no effect, and program execution always continues after the HELP command has been issued.

 Remarks

For more information on creating your own Help system, see Part 7, “Creating Help Files,” in the Developers Guide.


 See Also

SET HELP
SET HELPFILTER
SET TOPIC


Help Method

Syntax         Arguments         Remarks         Applies To          See Also

Opens the Help window.

 Syntax

ApplicationObject.Help([cFileName] [, nContextID] [, cHelpTopic])

 Arguments

cFileName   Specifies the name of the Help file open. Include a path with the Help file name if the Help file isn’t in the default directory.

nContextID   Specifies the Help topic to display, based on the topic’s context ID.nContextID is a context number in the MAP section of the help project file.

cHelpTopic   Specifies the Help topic to display. If you include just a partial spelling of a topic title, Visual FoxPro opens the Help window and displays the topic with the closest matching title.

 Remarks

If none of the optional arguments are included, the main Help topic is displayed. This method does not support .DBF-style Help.


 Applies To

Application Object, _VFP System Variable


 See Also

HELP, SET HELP


HelpContextID Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies a context ID for a topic in a Help file to provide context-sensitive Help for the object. Available at design time and run time.

 Syntax

Object.HelpContextID[ = nContextID]

 Settings

nContextID   Specifies the context ID number of a topic in a graphical-style or .DBF-style Help file. The valid range for context ID numbers is range 0 to 268,435,455.

 Remarks

To create context-sensitive Help for an object in your application, you must assign the same context number to both the object and the associated Help topic when you create the Help file.

If you have created graphical-style or .DBF-style Help for your application, Visual FoxPro calls the Help file and requests the topic identified by the current context ID number. You can specify a Help file with SET HELP TO, and you can specify a key to activate the Help file with ON KEY LABEL. The Help compiler required to create graphical-style help is included with Visual FoxPro.

The current context ID number is the setting of the HelpContextID property for the object that has the focus. If a nonzero current context number is not found, the main contents screen of the Help file is displayed.


 Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, EditBox, Form, Grid, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, Page, _SCREEN, Shape, Spinner, TextBox, ToolBar


 See Also

SET HELP
SET TOPIC


HIDE MENU Command

Syntax         Arguments         Remarks         See Also

Hides one or more active user-defined menu bars.

 Syntax

HIDE MENU MenuBarName1 [, MenuBarName2 ...] | ALL
[SAVE]

 Arguments

MenuBarName1 [, MenuBarName2 ...]   Specifies the name of the menu bar or a list of menu bars (separated by commas) to hide.

ALL   Hides all defined menu bars.

SAVE   Places an image of a menu bar on the screen or in a window. Placing an image of a menu bar on the screen is useful during program development and testing. Menu bar images can be cleared from the main Visual FoxPro window or a user-defined window with CLEAR.

 Remarks

HIDE MENU removes the specified menu bar, a set of menu bars, or all menu bars from the main Visual FoxPro window or from a user-defined window without removing the menu definition from memory. Before a menu bar can be hidden, it must first be created with DEFINE MENU. Hiding a menu bar isn’t the same as deactivating it. When a menu bar is hidden, it stays resident in memory and can be displayed in the main Visual FoxPro window or in a user-defined window with ACTIVATE MENU or SHOW MENU.


 See Also

ACTIVATE MENU
DEFINE MENU
DEFINE PAD
SHOW MENU


Hide Method

Syntax         Remarks         Applies To         See Also

Hides a form, form set, or toolbar by setting the Visible property to false (.F.).

 Syntax

Object.Hide

 Remarks

Controls on a hidden form are not accessible to the user, but are still available and can be accessed in code. Although they are not visible, controls contained in an invisible form retain their own Visible property setting.

When the Visible property of the form set is set to false (.F.), the user cannot see the Forms it contains. Forms in a hidden form set are not accessible to the user, but are still available and can be accessed in code. The Hide method for a form set does not set the Visible property of its child Forms, so when a form is contained in a form set, you must check the Visible property settings of both the form and form set to determine if the form is visible.

After a form set is hidden, Visual FoxPro activates the last active object. If no objects were active before the form set, the main Visual FoxPro window becomes active.

Calling the Hide Method for the _SCREEN system variable has no effect.


 Applies To

Form, FormSet, _SCREEN, ToolBar


 See Also

Activate Event
Deactivate Event
Enabled Property
GotFocus Event
Show Method
Visible Property


HIDE POPUP Command

Syntax         Arguments         Remarks         See Also

Hides one or more active menus created with DEFINE POPUP.

 Syntax

HIDE POPUP MenuName1 [, MenuName2 ...] | ALL
[SAVE]

 Arguments

MenuName1 [, MenuName2 ...]   Specifies the name of the menu or a list of menus (separated by commas) to hide.

ALL   Hides all defined menus.

SAVE   Places an image of a menu in the main Visual FoxPro window or in a user-defined window. Placing an image of a menu on the screen is useful during program development and testing. Menu images can be cleared from the main Visual FoxPro window or from a user-defined window with CLEAR.

 Remarks

HIDE POPUP removes the specified menu, a set of menus, or all menus from the main Visual FoxPro window or from a user-defined window without removing the menu definitions from memory. Before a menu can be hidden, it must first be created with DEFINE POPUP. Hiding a menu isn’t the same as deactivating it. When a menu is hidden, it stays resident in memory and can be displayed in the main Visual FoxPro window or in a user-defined window with ACTIVATE POPUP or SHOW POPUP.


 See Also

ACTIVATE POPUP
DEFINE BAR
DEFINE POPUP
SHOW POPUP


HIDE WINDOW Command

Syntax         Arguments         Remarks         Example         See Also

Hides an active user-defined window or Visual FoxPro system window.

  Syntax

HIDE WINDOW WindowName1 [, WindowName2 ... ] | ALL | SCREEN
[ IN [WINDOW] WindowNameN | IN [WINDOW] SCREEN
| IN [WINDOW]]
[BOTTOM | TOP | SAME]

  Arguments

WindowName1 [, WindowName2 ...]   Specifies the name of the window or a list of windows (separated by commas) to hide. If you issue HIDE WINDOW without any arguments, the active window is hidden. In Visual FoxPro, you can specify the name of a toolbar to hide. See SHOW WINDOW for a list of Visual FoxPro toolbar names.

ALL   Hides all windows.

SCREEN   Hides the main Visual FoxPro window. To display the main Visual FoxPro window again, issue ACTIVATE WINDOW SCREEN or SHOW WINDOW SCREEN.

IN [WINDOW] WindowNameN   Hides the window within a parent window.

IN [WINDOW] SCREEN   Explicitly hides a window in the main Visual FoxPro window.

BOTTOM | TOP | SAME   Specifies where windows are hidden with respect to other windows. BOTTOM places a window behind all other windows. TOP (the default) places a window in front of all other windows. SAME hides a window without affecting its front-to-back placement. To preserve the relative positions of multiple hidden windows when they are redisplayed with SHOW WINDOW ALL, include the SAME keyword when you hide the windows.

  Remarks

HIDE WINDOW removes a window or a set of windows from the main Visual FoxPro window or from a user-defined window. You can use HIDE WINDOW to hide system windows, such as the Command window, the Data Session window, and so on.

Hiding a window isn’t the same as closing it. When a window is hidden, it stays resident in memory and remains active. Output can be sent to a hidden window, but you cannot see it.

Releasing a window removes it from memory. Windows removed from memory must be defined again to be redisplayed. A window can be displayed with ACTIVATE WINDOW or SHOW WINDOW.

To hide a system window and or a toolbar (in Visual FoxPro), enclose the entire system window or toolbar name in quotation marks. For example, to hide the Report Controls toolbar in Visual FoxPro, issue the following command:

HIDE WINDOW “Report Controls”


  HIDE WINDOW Command Example

In the following example, a window named wOutput1 is defined and activated. The program waits for you to press a key and then hides the window. The program waits for you to press a key again and then displays the window. Pressing a key a third time removes the window from the screen and from memory.

DEFINE WINDOW wOutput1 FROM 6,1 TO 19,75 TITLE 'Output' ;

CLOSE FLOAT GROW SHADOW ZOOM

ACTIVATE WINDOW wOutput1

WAIT WINDOW 'Press a key to hide this window'

HIDE WINDOW wOutput1

WAIT WINDOW 'Press a key to see the window again'

SHOW WINDOW wOutput1

WAIT WINDOW 'Press a key to remove the window from memory'

DEACTIVATE WINDOW wOutput1

RELEASE WINDOW wOutput1


  See Also

ACTIVATE WINDOW
DEACTIVATE WINDOW
DEFINE WINDOW
RELEASE WINDOW
SHOW WINDOW


HideSelection Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether selected text appears selected when a control loses focus. Available at design time and run time.

  Syntax

Control.HideSelection[ = lExpr]

  Settings

lExpr   The settings for the HideSelection property are:

Setting	Description
True (.T.)	(Default) Selected text does not appear selected when the control loses the focus.
False (.F.)	Selected text appears selected when the control loses the focus.
  Remarks

You can use this property to indicate the text that is selected while another form or a dialog box has the focus — for example, in a spelling-check routine.


  Applies To

ComboBox, EditBox, Spinner, TextBox


  See Also

DisabledBackColor
DisabledForeColor Properties
GotFocus Event
LostFocus Event


Highlight Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether the cell with the focus in the Grid control appears selected. Available at design time; read-write at run time.

  Syntax

Grid.Highlight[ = lExpr]

  Settings

lExpr   The settings for the Highlight property are:

Setting	Description
True (.T.)	(Default) Selected cell is selected.
False (.F.)	Selected cell is not selected.
  Remarks

If the HighLight property is set to true (.T.), you can use it in conjunction with a Column’s SelectOnEntry property to determine if the entire cell appears selected. If you set the HighLight property to false (.F.), the SelectOnEntry property is ignored.


  Applies To

Grid


  See Also

HighlightRow Property
SelectOnEntry Property


HighlightRow Property

Syntax         Settings         Applies To         See Also

Specifies whether the current row and cell in a Grid control is highlighted. Available at design time; read-write at run time.

  Syntax

Grid.HighlightRow[ = lExpr]

  Settings

lExpr   The settings for the HighlightRow property are:

Setting	Description
True (.T.)	(Default) Current row and cell are highlighted.
False (.F.)	Current row and cell are not highlighted.


  Applies To

Grid


  See Also

Highlight Property


HOME( ) Function

Syntax         Returns         Remarks         Example         See Also

Returns the name of the directory or folder that Visual FoxPro was started from.

  Syntax

HOME( )

  Returns

Character

  Remarks

HOME( ) returns the name of the directory or folder that Visual FoxPro was started from.

HOME( ) is identical to SYS(2004) and is provided for compatibility with dBASE IV.


  HOME( ) Function Example

? 'Visual FoxPro launch directory: ', HOME( )


  See Also

SYS( ) Functions Overview
SYS(2004) - Visual FoxPro Start Directory


HostName Property

Syntax         Settings         Remarks         Applies To         See Also

Returns or sets the user-readable host name of your Visual FoxPro application. Available at design time; read-write at run time.

  Syntax

Control.HostName [ = cName]

  Settings

cName   Returns or sets a string expression specifying the host name.

  Remarks

When editing an object, the HostName property setting can be displayed in the object’s window title. However, some applications that provide objects do not display the HostName.


  Applies To

OLE Bound Control, OLE Container Control


  See Also

DocumentFile Property


HOUR( ) Function

Syntax         Arguments         Returns         Remarks         Example         See Also

Returns the hour portion from a DateTime expression.

  Syntax

HOUR(tExpression)

  Arguments

tExpression   Specifies a DateTime expression from which HOUR( ) returns the hour.

  Returns

Numeric

  Remarks

HOUR( ) returns a numeric value based on a 24 hour format, and is not affected by the current setting of SET HOURS. For example, if SET HOURS is 12 or 24, the following command returns 13:

? HOUR({02/16/95 1:00pm})


  HOUR( ) Function Example

The following example displays the hour portion of the current time and the hour portion of a specific time.

CLEAR

? HOUR(DATETIME( ))

? HOUR({10:42am})  && Displays 10


  See Also

CTOT( )
DATE( )
DATETIME( )
DTOT( )
MINUTE( )
SEC( )
SECONDS( )
SET SECONDS
TIME( )


Hours Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether the hours portion of a DateTime value is displayed in 12- or 24-hour time format. Available at design time and run time.

  Syntax

Object.Hours[ = nValue]

  Settings

nValue   One of the following settings:

Setting	Description
0	(Default) The SET HOURS setting determines whether the hours portion of a DateTime value is displayed in 12- or 24-hour time format. If SET HOURS is 12, the hours portion of a DateTime value is displayed in 12-hour time format. If SET HOURS is 24, the hours portion of a DateTime value is displayed in 24-hour time format.
12	The hour portion of the DateTime value is displayed in a 12-hour time format.
24	The hour portion of the DateTime value is displayed in a 24-hour time format.
  Remarks

The Hours property setting is ignored if the DateFormat property is set to Short or Long.


  Applies To

TextBox


  See Also

Century Property, DateFormat Property, DateMark Property, Seconds Property, SET HOURS, StrictDateEntry Property


Icon Property

See Also

Specifies the icon displayed for a form at run time when the form is minimized. Available at design time and run time.

Syntax

Object.Icon[ = cFileName]

Settings

cFileName   Specifies the file name and path of the icon to display when the form is minimized.

Remarks

Use the Icon property to specify a custom icon for any form that the user can minimize at run time. For example, you can assign a unique icon to a form to indicate the form’s function. Enter the file name of the icon in the Properties window at design time. The file name you enter must have the .ICO extension and icon format. If you do not specify a custom icon, the Visual FoxPro default icon for forms is used.

You can use the Visual FoxPro Icon Library in the SAMPLES\GRAPHICS\ICONS subdirectory as a source for icons.

If you set the Icon property at design time and the file you specify does not exist, Visual FoxPro displays an error message, but the property remains set to the file you specified. Visual FoxPro ignores the Icon property at run time if it is set to a file that does not exist.


Applies To

Form, _SCREEN


See Also

Caption Property
Picture Property


IDXCOLLATE( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the collation sequence for an index or index tag.

Syntax

IDXCOLLATE([cCDXFileName,] nIndexNumber [, nWorkArea | cTableAlias])

Returns

Character

Arguments

cCDXFileName   Specifies the name of the compound index file. The compound index file you specify can be the structural compound index file automatically opened with the table or an independent compound index file.

nIndexNumber   Specifies the index or index tag for which IDXCOLLATE( ) returns the collation sequence. IDXCOLLATE( ) returns the collation sequence for indexes and index tags in the following order as nIndexNumber increases from 1 to the total number of open index files and index tags:

•	1.   Collation sequences for single-entry .IDX index files (if any are open) are returned first. The order in which the single-entry index files are included in USE or SET INDEX determines how the collation sequences are returned.

•	2.   Collation sequences for tags in the structural compound index (if one is present) are returned next. The collation sequences are returned for the tags in the order in which the tags are created in the structural compound index.

•	3.   Collation sequences for tags in any open independent compound indexes are returned last. The collation sequences are returned for the tags in the order in which the tags are created in the independent compound indexes.

The empty string is returned if nIndexNumber is greater than the total number of open single-entry .IDX files and structural compound and independent compound index tags.

nWorkArea   Specifies the work area of the table for which IDXCOLLATE( ) returns index file and index tag collation sequences.

IDXCOLLATE( ) returns the empty string if a table isn’t open in the work area you specify.

cTableAlias   Specifies the alias of the table for which IDXCOLLATE( ) returns index file and index tag collation sequences.

Visual FoxPro generates an error message if you specify a table alias that doesn’t exist.

Remarks

IDXCOLLATE( ) can be used to return the collation sequence for each tag in multiple-entry compound index files, allowing you to completely delete an index file and rebuild it correctly, using a series of SET COLLATE and INDEX commands.

Note that IDXCOLLATE( ) isn’t required for the proper functioning of REINDEX, because the collation sequence information is present in existing indexes and index tags.

For additional information about Visual FoxPro’s international support, see Chapter 18, “Developing International Applications,” in the Developer’s Guide.


IDXCOLLATE( ) Function Example

The following example opens the customer table in the testdata database. FOR ... ENDFOR is used to create a loop in which IDXCOLLATE( ) is used to display the collation sequence of each index tag in the customer structural index. The name of each structural index tag is displayed with its collation sequence.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE Customer	  && Open customer table

CLEAR

FOR nCount = 1 TO 254

IF !EMPTY(TAG(nCount))  && Checks for tags in the index

? TAG(nCount) + ' '  && Display tag name

?? IDXCOLLATE(nCount)  && Display collation sequence

ELSE

EXIT  && Exit the loop when no more tags are found

ENDIF

ENDFOR


See Also

SET COLLATE


IF ... ENDIF Command

Syntax         Arguments         Remarks         Example         See Also

Conditionally executes a set of commands based on the value of a logical expression.

Syntax

IF lExpression [THEN]
Commands
[ELSE
Commands]
ENDIF

Arguments

lExpression   Specifies the logical expression that is evaluated. If lExpression evaluates to true (.T.), any commands following IF or THEN and preceding ELSE or ENDIF (whichever occurs first) are executed.

•	If lExpression is false (.F.) and ELSE is included, any commands after ELSE and before ENDIF are executed.

•	If lExpression is false (.F.) and ELSE isn’t included, all commands between IF and ENDIF are ignored. In this case, program execution continues with the first command following ENDIF.

Remarks

You can nest an IF ... ENDIF block within another IF ... ENDIF block.

Comments preceded by && can be placed on the same line after IF, THEN, ELSE, and ENDIF. These comments are ignored during compilation and program execution.


IF ... ENDIF Command Example

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE Customer	  && Open customer table

GETEXPR 'Enter condition to locate ' TO gcTemp;

TYPE 'L' DEFAULT 'COMPANY = ""'

LOCATE FOR &gcTemp  && Enter LOCATE expression

IF FOUND( )  && Was it found?

DISPLAY  && If so, display the record

ELSE  && If not found

? 'Condition ' + gcTemp + ' was not found '	&& Display a message

ENDIF

USE


See Also

DO CASE ... ENDCASE
DO WHILE ... ENDDO
FOR ... ENDFOR
IIF( )
SCAN ... ENDSCAN


IIF( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns one of two values depending on the value of a logical expression.

Syntax

IIF(lExpression, eExpression1, eExpression2)

Returns

Character, Numeric, Currency, Date, or DateTime

Arguments

lExpression   Specifies the logical expression that IIF( ) evaluates.

eExpression1, eExpression2   If lExpression evaluates to true (.T.), eExpression1 is returned. If lExpression evaluates to false (.F.), eExpression2 is returned.

Remarks

This function, also known as Immediate IF, evaluates a logical expression and then returns one of two expressions. If the logical expression evaluates to true (.T.), IIF( ) returns the first expression. If the logical expression evaluates to false (.F.), IIF( ) returns the second expression.

Tip   This function can be used in place of IF ... ENDIF for simple conditional expressions, and is especially useful in report and label expressions that conditionally specify field contents. The IIF( ) function also executes faster than an equivalent IF ... ENDIF.


IIF( ) Function Example

The following example uses IIF( ) to check if the notes field in the employee table is empty. If it is empty, “No description” is displayed; otherwise, the contents of the memo field are displayed.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE employee  && Open Employee table

CLEAR

SCAN

? IIF(EMPTY(notes), 'No notes', notes) 	&& Empty memo field?

ENDSCAN


See Also

IF ... ENDIF


Image Control

Syntax         Remarks         Properties         Events         Methods         See Also

Creates an Image control that displays a .BMP picture.

Syntax

Image

Remarks

An Image control is a graphical control that displays bitmaps that can't be changed directly. However, because an Image control has a full set of properties, events, and methods that other controls have, an Image control can respond to events and can be changed dynamically at run time.

For additional information about creating Images, see Chapter 10, “Using Controls,” in the Developer’s Guide.


Properties

BackStyle	BaseClass	BorderColor
BorderStyle	Class	ClassLibrary
ColorSource	Comment	DragIcon
DragMode	Enabled	Height
HelpContextID	Left	MousePointer
Name	Parent	ParentClass
Picture	Stretch	Tag
Top	Visible	Width


Events

Click	DblClick	Destroy
DragDrop	DragOver	Error
Init	MiddleClick Event	MouseDown
MouseMove	MouseUp	MouseWheel
RightClick	UIEnable


Methods

CloneObject	Drag	Move
ReadExpression	ReadMethod	ResetToDefault
SaveAsClass	WriteExpression	WriteMethod
ZOrder


See Also

CREATE CLASS
CREATE FORM
DEFINE CLASS


IMEMode Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the Input Method Editor (IME) window setting for an individual control. Available at design time and run time.

Syntax

Object.IMEMode[ = nExpression]

Settings

nExpression   One of the following settings:

nExpression	IME Window Action
0	(Default) No Control. The operating system determines if the IME window is opened when the control has the focus. If the IME window is closed when the control has the focus, the IME window can be opened by pressing the key combination that activate the IME window.
1	Open IME. The IME window is opened when the control has the focus.
2	Close IME. The IME window is closed when the control has the focus. The IME window can be opened by pressing the key combination that activate the IME window.
Remarks

This property is ignored unless you are running a Far East version of Windows 95 or Windows NT.


Applies To

ComboBox, EditBox, TextBox


See Also

IMESTATUS( )


IMESTATUS( ) Function

Syntax         Returns         Arguments         See Also

Turns the IME (Input Method Editor) window on or off or returns the current IME status.

Syntax

IMESTATUS([nExpression])

Returns

Numeric

Arguments

nExpression   Turns the IME window on or off. The following table lists the values for nExpression and the corresponding state of the IME window.

nExpression	IME Window Action
0	Turns the IME window off.
1	Turns the IME window on.
If nExpression is omitted, IMESTATUS( ) returns the current IME status. The following table lists the values returned for the IME status. Use VERSION(3) to determine the current locale.

The following table lists the values returned for the IME status in the Japanese locale.

Return Value	IME Status
0	No IME installed.
1	IME on.
2	IME off.
3	IME disabled.
4	Hiragana mode (double-byte).
5	Katakana mode (double-byte).
6	Katakana mode (single-byte).
7	Alphanumeric mode (double-byte).
8	Alphanumeric mode (single-byte).
The following table lists the values returned for the IME status in the Korean locale.

Return Value	IME Status
0	No IME installed.
1	Hangul mode (single-btye).
2	English mode (single-btye).
11	English mode (double-btye).
15	Hangul mode (double-btye).
23	Hanja conversion mode (Hangul + single-btye mode).
31	Hanja conversion mode (Hangul + double-btye mode).


See Also

IMEMode Property, ISLEADBYTE( ) Function
STRCONV( ) Function


IMPORT Command

Syntax         Arguments         Remarks         See Also

Imports data from an external file format to create a new Visual FoxPro table.

Syntax

IMPORT FROM FileName
[DATABASE DatabaseName [NAME LongTableName]]
[TYPE] FW2 | MOD | PDOX | RPD | WK1
| WK3 | WKS | WR1 | WRK | XLS
| XL5 [SHEET cSheetName]
[AS nCodePage]

Arguments

FileName   Specifies the name of the file from which to import data. If you don’t include an extension with the filename, the default extension for the specified file type is assumed.

DATABASE DatabaseName   Specifies a database to which the new table is added.

NAME LongTableName   Specifies a long name for the new table. Long names can contain up to 128 characters and can be used in place of short file names in the database.

TYPE   The keyword TYPE is optional, but you must include one of the following file types:

File type	Description
FW2	Include FW2 to import FW2 files, created by Framework II.
MOD	Include MOD to import MOD files, created by Microsoft Multiplan version 4.1.
PDOX	Include PDOX to import Paradox files. Database files in Paradox versions 3.5 and 4.0 by Borland can be imported by including the PDOX option.
RPD	Include RPD to import RPD files, created by RapidFile.
WK1 | WK3 | WKS	Include WK1 to import data from a Lotus 1-2-3 spreadsheet. Columns from the spreadsheet become fields in the table and the spreadsheet rows become records in the table. A WK1 extension is assigned to spreadsheets created in Lotus 1-2-3 revision 2.x; a WK3 extension is assigned to spreadsheets created in Lotus 1-2-3 revision 3.x; and a .WKS extension is assigned to spreadsheets created in Lotus 1-2-3 revision 1-A.
WR1 | WRK	Include WR1 to import data from a Lotus Symphony spreadsheet. Columns from the spreadsheet become fields in the table and the spreadsheet rows become records in the table. A WR1 extension is assigned to spreadsheets created in Symphony version 1.10, and a .WRK extension is assigned to spreadsheets created in Symphony version 1.1.
XLS	Include XLS to import data from Microsoft Excel worksheets versions 2.0, 3.0, and 4.0. Columns from the worksheet become fields in the table and the worksheet rows become records in the table. Worksheet files created in Microsoft Excel have an .XLS extension.
XL5 [SHEET cSheetName]	Include XL5 to import data from Microsoft Excel version 5.0. Columns from the worksheet become fields in the table and the worksheet rows become records in the table. Worksheet files created in Microsoft Excel have an .XLS extension. If you omit the SHEET clause, the data in Sheet1 is imported. To import data from a specific sheet, include the SHEET keyword and specify the sheet name with cSheetName.
AS nCodePage   Specifies the code page of the imported file. Visual FoxPro copies the contents of the imported file and, as it copies the data, automatically converts the data to the current Visual FoxPro code page.

If you specify a value for nCodePage that is not supported, Visual FoxPro displays an error message. You can use GETCP( ) for nCodePage to display the Code Page dialog box, allowing you to specify a code page for the imported file.

If you omit AS nCodePage and Visual FoxPro cannot determine the code page of the imported file, Visual FoxPro copies the contents of the imported file and, as it copies the data, automatically converts the data to the current Visual FoxPro code page. If you omit AS nCodePage and Visual FoxPro can determine the code page of the imported file, Visual FoxPro automatically converts the data in the imported file from the data’s code page to the current Visual FoxPro code page. Use CPCURRENT( ) to determine the current Visual FoxPro code page.

If nCodePage is 0, Visual FoxPro assumes the code page of the imported file is the same as the current Visual FoxPro code page and no code page conversion occurs.

Remarks

Most software packages store their data in  file formats that cannot be opened directly in Visual FoxPro. IMPORT creates a new Visual FoxPro table from data stored in file formats that Visual FoxPro cannot directly read.

A new table is created with the same name as the file from which the data is imported. A .DBF extension is assigned to the newly created table.


See Also

APPEND FROM
COPY TO
EXPORT
GETCP( )


Increment Property

Syntax         Settings         Applies To         See Also

Specifies how much the value in the Spinner control increases or decreases when you click the up or down arrow. Available at design time and run time.

Syntax

Spinner.Increment[ = nIncrement]

Settings

nIncrement   Specifies the number to add to the Spinner when the up button is clicked and the number to subtract from the Spinner when the down button is clicked. The default is 1.00.


Applies To

Spinner


See Also

RangeLow Event


IncrementalSearch Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether a control supports an incremental search for keyboard steering. Available at design time and run time.

Syntax

Control.IncrementalSearch[ = lExpr]

Settings

lExpr   The settings for the IncrementalSearch property are:

Setting	Description
True (.T.)	(Default) Supports incremental search.
False (.F.)	Does not support incremental search.
Remarks

An example of an incremental search is if you are searching for the word “ELASTIC,” you can type E-L-A, and so on. As you type, Visual FoxPro incrementally searches for the combination of letters you have typed to match the word you are looking for. Otherwise, it finds the first word that starts with an E, then the first word that starts with an L, and so on.


Applies To

ComboBox, ListBox


See Also

ComboBox
ListBox


INDBC( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns true (.T.) if the specified database object is in the current database; otherwise returns false (.F.).

Syntax

INDBC(cDatabaseObjectName, cType)

Returns

Logical

Arguments

cDatabaseObjectName   Specifies the name of a named connection, field, index, table, or SQL view for which INDBC( ) returns a logical value indicating whether or not the object is in the current database.

cType   Specifies the database object type of cDatabaseObjectName. The following table lists the values for cType and the corresponding database object type.

cType	Database object type
CONNECTION	Named connection
FIELD	Field
INDEX	Index
TABLE	Table
VIEW	SQL View
The CONNECTION, FIELD, INDEX, TABLE, and VIEW settings cannot be abbreviated.

Remarks

A database must be open and current when INDBC( ) is issued; otherwise Visual FoxPro generates an error message.


INDBC( ) Function Example

In the following example, a temporary database named mydbc is created, and a temporary table named mytable is added to the database. INDBC( ) is used to determine if the new table is in the database. The database and table are closed and erased.

CLOSE DATABASES

CREATE DATABASE mydbc  && Creates a new database

CREATE TABLE mytable (field1 C(10)) && Automatically added to database

? 'MyTable in the database? '

?? INDBC('mytable', 'TABLE')  && Returns .T.

CLOSE DATABASES

DELETE DATABASE mydbc DELETETABLES


See Also

ADBOBJECTS( )
CREATE DATABASE
DELETE DATABASE
OPEN DATABASE
SET DATABASE


_INDENT System Memory Variable
_INDENT System Variable

Included for backward compatibility. Use the Report Designer instead.


INDEX Command

Syntax         Arguments         Remarks         Example         See Also

Creates an index file to display and access table records in a logical order.

Syntax

INDEX ON eExpression TO IDXFileName | TAG TagName [OF CDXFileName]
[FOR lExpression]
[COMPACT]
[ASCENDING | DESCENDING]
[UNIQUE | CANDIDATE]
[ADDITIVE]

Arguments

eExpression   Specifies an index expression that can include the name of a field or fields from the current table. An index key based on the index expression is created in the index file for each record in the table. Visual FoxPro uses these keys to display and access records in the table.

Note   Do not use a variable, an array element, or a field or field expression from a table in another work area for eExpression. If you access an index that contains a variable or field that no longer exists or cannot be located, Visual FoxPro generates an error message. Memo fields cannot be used alone in index file expressions; they must be combined with other character expressions.

If you include a field prefaced by a table alias or work area letter in the index expression, Visual FoxPro generates an error message. Even though you can optimize FOR clauses with Rushmore technology if aliased fields are included, it is still highly recommended that you avoid using aliased fields when creating indexes. In several cases (USE ... AGAIN, SQL queries, and so on), a different alias is automatically assigned to a table and the index might not be properly updated or used.

For more information on Rushmore technology, see “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

If you attempt to build an index with a key that varies in length, the key will be padded with spaces. Variable-length index keys aren’t supported in Visual FoxPro.

It is possible to create an index key with 0 length. For example, a 0 length index key is created when the index expression is a substring of an empty memo field. A 0 length index key generates an error message. When Visual FoxPro creates an index, it evaluates fields in the first record in the table. If a field is empty, it may be necessary to enter some temporary data in the field in the first record to prevent a 0 length index key.

The length of an index key for an .IDX index must be between 1 and 100 characters. The length of an index key for a .CDX index must be between 1 and 240 characters.

TO IDXFileName   Creates an .IDX index file. The index file is given the default extension .IDX, which you can override by including a different extension or by changing the default index extension in the Visual FoxPro configuration file. Standard MS-DOS rules for naming files must be observed when creating index files.

TAG TagName [OF CDXFileName]   Creates a compound index file. A compound index file is a single index file that consists of any number of separate tags (index entries). Each tag is identified by its unique tag name. Tag names must begin with a letter or an underscore and can consist of any combination of up to 10 letters, digits, or underscores. The number of tags in a compound index file is limited only by available memory and disk space.

Multiple-entry compound index files are always compact. It isn’t necessary to include COMPACT when creating a compound index file. Names of compound index files are given a .CDX extension.

Two types of compound index files can be created: structural and non-structural.

If you exclude the optional OF CDXFileName clause from TAG TagName, you create a structural compound index file. A structural compound index file always has the same base name as the table and is automatically opened when the table is opened.

If a table’s structural compound index file cannot be located or is deleted or renamed, a dialog box appears when you try to open the table. If you choose the default Cancel push button, the table isn’t opened. Choosing Ignore opens the table and removes the flag in the table’s header that indicates an associated structural compound index file is present.

Tip   To reassociate a structural compound index that has become dissociated from its table, issue the following command:

USE TableName INDEX CDXFileName

If you include the optional OF CDXFileName clause after TAG TagName, you create a non-structural compound index file. Unlike a structural compound index file, a non-structural compound index file must be explicitly opened with SET INDEX or the INDEX clause in USE.

If a compound index file has already been created and opened, issuing INDEX with TAG TagName adds a tag to the compound index file.

CDXFileName is the name of the dissociated structural compound index. Be sure to reindex the table if it has been modified since the structural compound index was dissociated.

FOR lExpression   Specifies a condition whereby only records that satisfy the filter expression lExpression are available for display and access; index keys are created in the index file for just those records matching the filter expression.

Rushmore optimizes an INDEX ... FOR lExpression command if lExpression is an optimizable expression. For best performance, use an optimizable expression in the FOR clause.

For more information, see SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

COMPACT   Creates a compact .IDX file.

ASCENDING   Specifies an ascending order for the .CDX file. By default, .CDX tags are created in ascending order (you can include ASCENDING as a reminder of the index file’s order). A table can be indexed in reverse order by including DESCENDING.

DESCENDING   Specifies a descending order for the .CDX file. You can’t include DESCENDING when creating .IDX index files. You can, however, specify a descending order for an .IDX index file with SET INDEX and SET ORDER.

UNIQUE   Specifies that only the first record encountered with a particular index key value is included in an .IDX file or a .CDX tag. UNIQUE can be used to prevent the display of or access to duplicate records. All records added with duplicate index keys are excluded from the index file. Using the UNIQUE option of INDEX is identical to executing SET UNIQUE ON before issuing INDEX or REINDEX.

When a UNIQUE index or index tag is active and a duplicate record is changed in a manner that changes its index key, the index or index tag is updated. However, the next duplicate record with the original index key cannot be accessed or displayed until you reindex the file using REINDEX.

CANDIDATE   Creates a candidate structural index tag. The CANDIDATE keyword can be included only when creating a structural index tag; otherwise Visual FoxPro generates an error message.

A candidate index tag prevents duplicate values in the field or combination of fields specified in the index expression eExpression. The term “candidate” refers to the type of index; because candidate indexes prevent duplicate values, they qualify as a “candidate” to be a primary index.

Visual FoxPro generates an error if you create a candidate index tag for a field or combination of fields that already contain duplicate values.

For additional information about candidate and primary index tags, see “Setting a Primary or Candidate Index” in Chapter 7, “Working with Tables,” in the Developer’s Guide.

ADDITIVE   Keeps open any previously opened index files. If you omit the ADDITIVE clause when you create an index file or files for a table with INDEX, any previously opened index files (except the structural compound index) are closed.

Remarks

Records in a table that has an index file are displayed and accessed in the order specified by the index expression. The physical order of the records in the table isn’t changed by an index file.

If SET TALK is ON, Visual FoxPro reports how many records are indexed during the indexing process. The record interval displayed during indexing can be specified with SET ODOMETER.

Use DISPLAY STATUS to display more information about open index files. This information includes the names of all open index files, their types (structural, .CDX, .IDX), their index expressions, their collation sequences, and the name of the master index file or master tag.

The number of index files (.IDX or .CDX) you can open is limited only by memory and system resources. In Visual FoxPro, FoxPro for Windows, and FoxPro for MS-DOS, the total number of files you can open is determined by the FILES setting in the MS-DOS CONFIG.SYS configuration file. For more information on the FILES setting, see your MS-DOS manual.

Index Types   Visual FoxPro lets you create two types of index files:

•	Compound .CDX index files containing multiple index entries called tags

•	.IDX index files containing one index entry

You can also create a structural compound index file, which is automatically opened with the table.

Tip   Because structural compound index files are automatically opened when the table is opened, they are the preferred index type.

Include COMPACT to create compact .IDX index files. Compound index files are always compact.

Index Order and Updating   Only one index file (the master index file) or tag (the master tag) controls the order in which the table is displayed or accessed. Certain commands (SEEK, for example) use the master index file or tag to search for records. However, all open .IDX and .CDX index files are updated as changes are made to the table. You can designate the master index file or tag with the INDEX clause of USE or with SET INDEX and SET ORDER.

User-Defined Functions   Although an index expression can contain a user-defined function, you should not use user-defined functions in an index expression. User-defined functions in an index expression increase the time it takes to create or update the index. Also, index updates may not occur when a user-defined function is used for an index expression.

If you use a user-defined function in an index expression, Visual FoxPro must be able to locate the user-defined function. When Visual FoxPro creates an index, the index expression is saved in the index file, but only a reference to the user-defined function is included in the index expression.


Index Examples

Example 1 opens the customer table and creates an index file named complist, which displays and processes records in the alphabetic order of the company field.

In Exampe 2, the customer table is again opened and an index file named citycomp is created from a substring of the first five characters of the city field and the first six characters of the company field. When this index file is used, records in the table are ordered primarily according to the city field and secondarily according to the company field.

In Example 3, index tags are created. The first tag is a structural compound index tag for address. The second tag is created in a non-structural index file named custcdx.

* Example 1

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE Customer	  && Open customer table

INDEX ON company TO complist

CLEAR

DISPLAY STATUS

* Example 2

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE Customer	  && Open customer table

INDEX ON SUBSTR(city,1,5) + SUBSTR(company,1,6) TO citycomp

CLEAR

DISPLAY STATUS

* Example 3

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE Customer	  && Open customer table

INDEX ON address TAG address

INDEX ON company TAG company OF custcdx

CLEAR

DISPLAY STATUS


See Also

ALTER TABLE
COPY INDEXES
COPY TAG
DELETE TAG
REINDEX
SET COLLATE
SET INDEX
SET ODOMETER
SET ORDER
SET TALK
SET UNIQUE
SORT
USE


IndexToItemID Method

Syntax         Arguments         Remarks         Applies To         See Also

Returns an index for a given item ID.

 Syntax

[nItemID =] Control.IndexToItemID(nIndex)

 Arguments

nItemID   Specifies a unique identification number.

nIndex   Specifies a number that represents the position that an item is displayed in a control.

 Remarks

Each item added to a ComboBox or ListBox has two identification numbers assigned to it:

•	The nItemID, a unique identification number.

•	The nIndex, an integer corresponding to the order in which items are displayed by the control: The first item in the list corresponds to nIndex = 1.

Initially, as items are added to the control, these two numbers are identical. But as items are sorted, removed, and added, these numbers are no longer identical.

Use the IndexToItemID method to return the nItemID number for a particular item in the control when you know its nIndex number.


 Applies To

ComboBox, ListBox


 See Also

AddItem Method
AddListItem Method
ItemIDToIndex Method


Init Event

Syntax         Arguments         Remarks         Applies To         See Also

Occurs when an object is created.

 Syntax

PROCEDURE Object.Init
[LPARAMETERS Param1, Param2,...]

 Arguments

Param1, Param2...   Parameters are optional, but if parameters are passed, you must include an LPARAMETERS or PARAMETERS statement that lists each parameter. Otherwise, Visual FoxPro generates an error.

 Remarks

For form sets and other container objects, the Init events for all the contained objects are triggered before the container’s Init event, so you can access the contained objects within the container’s Init event. The Init event for each contained object occurs in the order it was added to the container object.

To prevent a control from being created, return false (.F.) from the Init event. The Destroy event will not be triggered. For example, the following code returns false (.F.) if the Invoice table is not available:

PROCEDURE INIT

    IF NOT FILE("INVOICE.DBF")

      ERROR ‘Initialization Failed: File not found’

      RETURN .F.

    ELSE

      USE INVOICE IN 0 AGAIN

      THIS.WorkArea = SELECT()

    ENDIF

ENDPROC


 Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, Cursor, Custom, DataEnvironment, EditBox, Form, FormSet, Grid, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, Page, PageFrame, Relation, Shape, Spinner, TextBox, Timer, ToolBar


 See Also

AddObject Method
CREATEOBJECT( )
Load Event


InitialSelectedAlias Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies an alias associated with a Cursor object as the current alias when the data environment is loaded. Available at design time; read-only at run time.

 Syntax

DataEnvironment.InitialSelectedAlias[ = cText]

 Settings

cText   Specifies an alias name associated with a Cursor object.

 Remarks

Mimics the behavior of SELECT.


 Applies To

DataEnvironment


 See Also

Alias Property
SELECT


INKEY( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns a number corresponding to the first mouse click or key press in the type-ahead buffer.

 Syntax

INKEY([nSeconds] [, cHideCursor])

 Returns

Numeric

 Arguments

nSeconds   Specifies how many seconds INKEY( ) waits for a keystroke. If nSeconds isn’t included, INKEY( ) immediately returns a value for a keystroke. INKEY( ) waits indefinitely for a keystroke if nSeconds is 0.

cHideCursor   Shows or hides the cursor, or checks for a mouse click. To show the cursor, include S in cHideCursor. To hide the cursor, include H in cHideCursor. If both S and H are included in cHideCursor, the last character in cHideCursor takes precedence.

By default, INKEY( ) doesn’t detect a mouse click. To check for a mouse click, include M in cHideCursor. If M is included in cHideCursor, INKEY( ) returns the value 151 for a single mouse click. Refer to the second example in the following table to see how you can check for a double click.

To check for a mouse click and show the cursor, include both M and S. To check for a mouse click and hide the cursor, include H and M.

When a keyboard macro is assigned to a key or key combination, you can include E in cHideCursor to expand the keyboard macro. When E is included, INKEY( ) returns a value corresponding to the first keystroke assigned to the keyboard macro. You can return successive values for each keystroke in a macro by repeatedly executing INKEY( ) with E included. If you omit E, INKEY( ) returns the value for the key or key combination that triggers the keyboard macro.

Any characters other than H, M, S, and E in cHideCursor are ignored.

The following table lists INKEY( ) function return values for keys alone and in combination with the SHIFT, CTRL, and ALT keys  A dash (—) indicates that the key combination returns no value.

Key	Alone	SHIFT	CTRL	ALT/+OPTION
F1	28	84	94	104
F2	-1	85	95	105
F3	-2	86	96	106
F4	-3	87	97	107
F5	-4	88	98	108
F6	-5	89	99	109
F7	-6	90	100	110
F8	-7	91	101	111
F9	-8	92	102	112
F10	-9	93	103	113
F11	133	135	137	139
F12	134	136	138	140
1	49	33	—	120
2	50	64	—	121
3	51	35	—	122
4	52	36	—	123
5	53	37	—	124
6	54	94	—	125
7	55	38	—	126
8	56	42	—	127
9	57	40	—	128
0	48	41	—	19
a	97	65	1	30
b	98	66	2	48
c	99	67	3	46
d	100	68	4	32
e	101	69	5	18
f	102	70	6	33
g	103	71	7	34
h	104	72	127	35
i	105	73	9	23
j	106	74	10	36
k	107	75	11	37
l	108	76	12	38
m	109	77	13	50
n	110	78	14	49
o	111	79	15	24
p	112	80	16	25
q	113	81	17	16
r	114	82	18	19
s	115	83	19	31
t	116	84	20	20
u	117	85	21	22
v	118	86	22	47
w	119	87	23	17
x	120	88	24	45
y	121	89	25	21
z	122	90	26	44
INS	22	22	146	162
HOME	1	55	29	151
DEL	7	7	147	163
END	6	49	23	159
PAGE UP	18	57	31	153
PAGE DOWN	3	51	30	161
UP ARROW	5	56	141	152
DOWN ARROW	24	50	145	160
RIGHT ARROW	4	52	2	157
LEFT ARROW	19	54	26	155
ESC	27	—/27	—*/27	—*/1
ENTER	13	13	10	—/166
BACKSPACE	127	127	127	14
TAB	9	15	148/*	*
SPACEBAR	32	32	32/—	57
* Keystroke reserved by Windows.
 Remarks

INKEY( ) returns 0 if a key isn’t pressed. If there are several keys in the type-ahead buffer, INKEY( ) returns the value of the first key entered in the buffer.


 See Also

_DBLCLICK
KEYBOARD
KeyPress Event
LASTKEY( )
ON KEY
READKEY( )
SET TYPEAHEAD


INLIST( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Determines whether an expression matches another expression in a set of expressions.

 Syntax

INLIST(eExpression1, eExpression2 [, eExpression3 ...])

 Returns

Logical or null value

 Arguments

eExpression1   Specifies the expression INLIST( ) searches for in the set of expressions.

eExpression2 [, eExpression3 ...]   Specifies the set of expressions to search. You must include at least one expression (eExpression2), and can include up to 24 expressions (eExpression2, eExpression3, and so on).

All the expressions in the set of expressions must be of the same data type.

 Remarks

INLIST( ) returns true (.T.) if it finds the expression in the set of expressions; otherwise INLIST( ) returns false (.F.). The null value is returned if eExpression1 is the null value. The null value is also returned if eExpression1 is not the null value, eExpression1 does not match another expression, and at least one of the other expressions is the null value.


 INLIST( ) Function Example

In this example, INLIST( ) determines the quarter of the year for the current month. The current month is stored to the variable gcMonth. Each CASE statement uses INLIST( ) to determine whether the contents of gcMonth can be found in a list of month names. The name of the quarter returned is stored to the variable gcReporTitle.

SET TALK ON

STORE CMONTH(DATE( )) TO gcMonth

DO CASE

CASE INLIST(gcMonth,'January','February','March')

STORE 'First Quarter' TO gcReporTitle

CASE INLIST(gcMonth,'April','May','June')

STORE 'Second Quarter' TO gcReporTitle

CASE INLIST(gcMonth,'July','August','September')

STORE 'Third Quarter' TO gcReporTitle

OTHERWISE

STORE 'Fourth Quarter' TO gcReporTitle

ENDCASE

WAIT WINDOW gcReporTitle


 See Also

BETWEEN( )


INPUT Command

Included for backward compatibility. Use the TextBox control instead.


InputMask Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies how data is entered and displayed in a control. Available at design time and run time.

 Syntax

Control.InputMask[ = cMask]

 Settings

cMask   The settings for the InputMask property are:

Setting	Description
X	Any character can be entered.
9	Digits and signs, such as a minus ( – ) sign can be entered.
#	Digits, blanks, and signs can be entered.
$	Displays the current currency symbol (specified with SET CURRENCY) in a fixed position.
$$	Displays a floating currency symbol that is always adjacent to the digits in the spinner or text box.
*	Asterisks are displayed to the left of the value.
.	A period specifies the decimal point position.
,	Commas can be included to separate digits to the left of the decimal point.
 Remarks

This property is in contrast to the Format property in which a behavior for the entire input field is specified. You can mix several Format codes, but they always affect everything in the input field.


 Applies To

Column, ComboBox, Spinner, TextBox


 See Also

DynamicInputMask Property
Format Property


INSERT Command

Included for backward compatibility. Use APPEND or INSERT - SQL instead.


INSERT - SQL Command

Syntax         Arguments         Remarks         Example         See Also

Appends a record to the end of a table that contains the specified field values.

 Syntax

INSERT INTO dbf_name [(fname1 [, fname2, ...])]
VALUES (eExpression1 [, eExpression2, ...])
 – Or –

INSERT INTO dbf_name FROM ARRAY ArrayName | FROM MEMVAR

 Arguments

INSERT INTO dbf_name   Specifies the name of the table to which the new record is appended. dbf_name can include a path and can be a name expression.

If the table you specify isn’t open, it is opened exclusively in a new work area and the new record is appended to the table. The new work area isn’t selected; the current work area remains selected.

If the table you specify is open, INSERT appends the new record to the table. If the table is open in a work area other than the current work area, it isn’t selected after the record is appended; the current work area remains selected.

[(fname1 [, fname2 [, ...]])]   Specifies the names of the fields in the new record into which the values are inserted.

VALUES (eExpression1 [, eExpression2 [, ...]])   Specifies the field values inserted into the new record. If you omit the field names, you must specify the field values in the order defined by the table structure. If SET NULL is ON, INSERT - SQL attempts to insert null values into any fields not specified in the VALUES clause.

FROM ARRAY ArrayName   Specifies the array whose data is inserted into the new record. The contents of the elements of the array, starting with the first element, are inserted into the corresponding fields of the record. The contents of the first array element are inserted into the first field of the new record; the contents of the second array element are inserted into the second field, and so on.

FROM MEMVAR   Specifies that the contents of variables are inserted into fields with the same names as the variables. If a variable doesn’t exist with the same name as the field, the field is left empty.

 Remarks

The new record contains the data listed in the VALUES clause or contained in the specified array or variables. The record pointer is positioned on the new record.


 INSERT - SQL Command Examples

The following example opens the employee table and adds one record.

USE employee

INSERT INTO employee (emp_no, fname, lname, officeno) ;

     VALUES (3022, "John", "Smith", 2101)

The following example opens the customer table in the testdata database. The contents of the current record are scattered to variables, and the table’s structure is copied to a new table named cust2. INSERT - SQL is used to insert a new record in the cust2 table, and BROWSE is issued to display the new record.

CLOSE DATABASES

CLEAR

OPEN DATABASE SYS(2004) + "samples\data\testdata"

USE Customer	  && Open customer table

* Scatter current record to memory variables

SCATTER MEMVAR

* Copy structure of current table to example table

COPY STRUCTURE TO cust2

* Insert record from memory variable

INSERT INTO cust2 FROM MEMVAR

SELECT CUST2

BROWSE

* Close and delete example table

USE

DELETE FILE cust2.dbf


 See Also

CREATE QUERY
CREATE TABLE - SQL
MODIFY QUERY
SELECT - SQL


INSMODE( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the current insert mode, or sets the insert mode on or off.

 Syntax

INSMODE([lExpression])

 Returns

Logical

 Arguments

lExpression   Turns the insert mode on or off. INSMODE(.T.) turns the insert mode on and INSMODE(.F.) turns it off. A logical value corresponding to the insert mode setting before INSMODE(.T.) or INSMODE(.F.) was issued is returned.

 Remarks

If you omit the optional argument and the insert mode is on (characters are inserted before the cursor), INSMODE( ) returns true (.T.). If the insert mode is off (characters are overwritten at the insertion point), INSMODE( ) returns false (.F.).


 INSMODE( ) Function Example

The example below uses INSMODE( ) to set the insert mode on, and then toggles the insert mode to the opposite state.

SET TALK ON

=INSMODE(.T.)  && Set insert mode on

? INSMODE( )

= INSMODE(!INSMODE( ))  && Toggle insert mode to opposite state

? INSMODE( )


 See Also

CAPSLOCK( )
NUMLOCK( )


INT( ) Function

Syntax         Returns         Arguments         Example         See Also

Evaluates a numeric expression and returns the integer portion of the expression.

  Syntax

INT(nExpression)

  Returns

Numeric

  Arguments

nExpression   Specifies the numeric expression for which INT( ) returns the integer portion.


  INT( ) Function Example

CLEAR

? INT(12.5)  && Displays 12

? INT(6.25 * 2)  && Displays 12

? INT(-12.5)  && Displays -12

STORE -12.5 TO gnNumber

? INT(gnNumber)  && Displays -12


  See Also

CEILING( )
FLOOR( )
ROUND( )


IntegralHeight Property

Syntax         Settings         Remarks         Applies To          See Also

Specifies that the height of an EditBox or ListBox control is automatically adjusted so the last item in the control is properly displayed. Specifies that the height of a TextBox control is adjusted to accommodate one line of text. Available at design time; read-only at run time.

  Syntax

Object.IntegralHeight[ = lExpr]

  Settings

lExpr   One of the following:

lExpr	Description
True (.T.)	The height an EditBox or ListBox control is adjusted as necessary so the last item in the control is properly displayed. The height of a TextBox is adjusted to accommodate one line of text.
False (.F.)	(Default) The height of an EditBox or ListBox isn’t adjusted, allowing the last item in the control to be improperly displayed. The height of a TextBox isn’t adjusted to accommodate one line of text.
  Remarks

The last line of text in an EditBox or ListBox control might be partially displayed if the control isn’t the proper height. For example, the height of the control may be such that only the top half of the last item is displayed in the control. Set IntergralHeight to true (.T.) to automatically adjust the height of the control so the last item in the control is always properly displayed.

For a TextBox, set IntergralHeight to true (.T.) to ensure that the control automatically adjusts its height when its FontSize property is changed.

When the IntegralHeight property is set to true (.T.), the value of the Height property might not match the actual height of the control.


  Applies To

EditBox, ListBox, TextBox


  See Also

Height Property


InteractiveChange Event

Syntax         Parameters         Remarks         Applies To         See Also

Occurs when the user changes the value of a control using the keyboard or the mouse.

  Syntax

PROCEDURE Control.InteractiveChange
[LPARAMETERS nIndex]

  Parameters

nIndex   Uniquely identifies a control if it is in a control array.

  Remarks

This event occurs each time the object’s value changes interactively. For example, as a user types in a text box, the InteractiveChange event is triggered after each keystroke.


  Applies To

CheckBox, ComboBox, CommandGroup, EditBox, ListBox, OptionGroup, Spinner, TextBox


  See Also

Click Event


Interval Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the number of milliseconds between calls to a Timer control’s Timer event. Available at design time and run time.

  Syntax

Timer.Interval[ = nTime]

  Settings

nTime   Specifies the number of milliseconds between Timer events. The default value is 0, which prevents the Timer event from firing.

  Remarks

For more information about the Interval property, see “Initializing a Timer Control” in Chapter 10, “Using Controls,” in the Developer’s Guide.


  Applies To

Timer


  See Also

Reset Method
Timer Event


ISALPHA( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Determines whether the leftmost character in a character expression is alphabetic.

  Syntax

ISALPHA(cExpression)

  Returns

Logical

  Arguments

cExpression   Specifies the character expression that ISALPHA( ) evaluates. Any characters after the first character in cExpression are ignored.

  Remarks

ISALPHA( ) returns true (.T.) if the leftmost character in the specified character expression is an alphabetic character; otherwise ISALPHA( ) returns false (.F.).


  ISALPHA( ) Function Example

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE Customer	  && Open customer table

CLEAR

DISPLAY contact

? ISALPHA(contact)  && Displays .T.

DISPLAY maxordamt

? ISALPHA(cust_id)  && Displays .F.


  See Also

ISLOWER( )
ISUPPER( )
LOWER( )
UPPER( )


ISBLANK( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Determines whether an expression is blank.

  Syntax

ISBLANK(eExpression)

  Returns

Logical

  Arguments

eExpression   Specifies the expression that ISBLANK( ) evaluates. eExpression can be a field in a table, a variable or array element, or an expression.

For a field, ISBLANK( ) returns true (.T.) if the field contains the following values.

Type	Contents
Character	Empty string, spaces, or no value (newly appended blank record or cleared with BLANK)
Numeric	No value (newly appended blank record or cleared with BLANK)
Float	No value (newly appended blank record or cleared with BLANK)
Date	Blank date ({  /  /  }) or no value (newly appended blank record or cleared with BLANK)
DateTime	Blank datetime ({  /  /   :  :  }) or no value (newly appended blank record or cleared with BLANK)
Logical	No value (newly appended blank record or cleared with BLANK)
Memo	Empty (no memo contents)
General	Empty (no OLE object)
Picture	Empty (no picture)
  Remarks

ISBLANK( ) returns true (.T.) if the expression eExpression is blank; otherwise, ISBLANK( ) returns false (.F.).

APPEND BLANK and BLANK are used to create a blank record. BLANK can also be used to clear data from fields in a record. ISBLANK( ) can determine if a field is blank.

Note that Currency, Integer and Double type expessions are never blank, and ISBLANK( ) always returns false (.F.) for these data types.

ISBLANK( ) differs from EMPTY( ) and ISNULL( ). For example, EMPTY( ) returns true (.T.) if a character expression contains any combination of null values, spaces, tabs, carriage returns, or line feeds; ISBLANK( ) returns true (.T.) if a character expression contains only the empty string or spaces.


  ISBLANK( ) Function Example

In the following example, a table named mytable is created and a blank record is appended. ISBLANK( ) returns true (.T.) because myfield is blank. A value is placed in myfield, and ISBLANK( ) returns false (.F.) because myfield is no longer blank.

CREATE TABLE mytable FREE (myfield C(20))

APPEND BLANK  && Add new blank record

CLEAR

? ISBLANK(myfield)  && Displays .T.

REPLACE myfield WITH 'John Smith'  && Insert a value in the field

? ISBLANK(myfield)  && Displays .F.


  See Also

APPEND
BLANK
EMPTY( )
ISNULL( )
LEN( )


ISCOLOR( ) Function

Syntax         Returns         Remarks         See Also

Determines whether a computer can display color.

  Syntax

ISCOLOR( )

  Returns

Logical

  Remarks

ISCOLOR( ) returns true (.T.) if the computer has color capability (whether or not a color monitor is actually being used). If the computer doesn’t provide color support, ISCOLOR( ) returns false (.F.).


  See Also

Colors Overview
SET DISPLAY
SYS(2006) - Current Graphics Card


ISDIGIT( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Determines whether the leftmost character of the specified character expression is a digit (0 through 9).

  Syntax

ISDIGIT(cExpression)

  Returns

Logical

  Arguments

cExpression   Specifies the character expression that ISDIGIT( ) tests. Any characters after the first character in cExpression are ignored.

  Remarks

ISDIGIT( ) returns true (.T.) if the leftmost character of the specified character expression is a digit (0 through 9); otherwise, ISDIGIT( ) returns false (.F.).


  ISDIGIT( ) Function Example

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE orders  && Open Orders table

CLEAR

DISPLAY cust_id

? ISDIGIT(cust_id)  && Displays .F.

DISPLAY order_dsc

? ISDIGIT(ALLTRIM(STR(order_dsc)))  && Displays .T.


  See Also

ISALPHA( )


ISEXCLUSIVE( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns true (.T.) if a table or database is opened for exclusive use; otherwise, returns false (.F.).

  Syntax

ISEXCLUSIVE([cTableAlias | nWorkArea | cDatabaseName [, nType]])

  Returns

Logical

  Arguments

cTableAlias   Specifies the alias of the table for which the exclusive use status is returned. Visual FoxPro generates an error message if you specify a table alias that doesn’t exist.

nWorkArea   Specifies the work area of the table for which the exclusive use status is returned. ISEXCLUSIVE( ) returns false (.F.) if a table isn’t open in the work area you specify.

cDatabaseName   Specifies the name of the database for which the exclusive use status is returned.

nType   Specifies whether the exclusive status is returned for a table or a database. The following table lists the values for nType and the corresponding status returned.

nType	Exclusive Status Returned
1	Table
2	Database
To determine the exclusive status for a database, you must include nType with a value of 2.

  Remarks

ISEXCLUSIVE( ) returns a value for the table open in the currently selected work area if you omit the optional cTableAlias, nWorkArea, or cDatabaseName arguments.

A table is opened for exclusive use by including the EXCLUSIVE keyword in USE, or by setting SET EXCLUSIVE to ON before the table is opened.

A database is opened for exclusive use by including the EXCLUSIVE keyword in OPEN DATABASE.


  ISEXCLUSIVE( ) Function Example

In the following example, the ISEXCLUSIVE( ) function verifies that the table was opened for exclusive use. The table is not reindexed since the one in the current work are was not opened for exclusive use.

cExclusive = SET('EXCLUSIVE')

SET EXCLUSIVE OFF

SET PATH TO (SYS(2004) + 'SAMPLES\DATA\')

OPEN DATA testdata  && Opens the test databsase

USE customer	  && Not opened exclusively

USE employee IN 0 EXCLUSIVE	 && Opened exclusively in another work area

IF ISEXCLUSIVE( )

   REINDEX  && Can only be done if table opened exclusively

ELSE

    WAIT WINDOW 'The table has to be exclusively opened'

ENDIF

SET EXCLUSIVE &cExclusive


  See Also

OPEN DATABASE
SET EXCLUSIVE
USE


ISFLOCKED( ) Function

Syntax         Returns         Arguments         Remarks          See Also

Returns the table lock status.

  Syntax

ISFLOCKED([nWorkArea | cTableAlias])

  Returns

Logical

  Arguments

nWorkArea   Specifies the work area number of the table for which the lock status is returned. If you omit cTableAlias and nWorkArea, the lock status is returned for the table open in the current work area.

cTableAlias   Specifies the alias of the table for which the lock status is returned.

  Remarks

ISFLOCKED( ) returns a logical true (.T.) if the table is locked; otherwise a logical false (.F.) is returned. ISFLOCKED( ) is similar to SYS(2011), but returns a logical value which does not require localization for international applications.


  See Also

FLOCK( ), ISRLOCKED( ), LOCK( ), RLOCK( ), SYS(2011) - Current Lock Status


ISLEADBYTE( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns true (.T.) if the first byte of the first byte in a character expression is the lead byte of a double-byte character.

  Syntax

ISLEADBYTE(cExpression)

  Returns

Logical

  Arguments

cExpression   Specifies the character expression that ISLEADBYTE( ) evaluates. Any bytes after the first byte in the first character in cExpression are ignored.

  Remarks

ISLEADBYTE( ) returns true (.T.) if the first byte of the first character in a character expression is the lead byte in a double-byte character. If ISLEADBYTE( ) returns false (.F.), the character being tested is a single-byte character.


  See Also

ISALPHA( ) Function
ISDIGIT( ) Function
ISLOWER( ) Function
ISUPPER( ) Function


ISLOWER( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Determines whether the leftmost character of the specified character expression is a lowercase alphabetic character.

  Syntax

ISLOWER(cExpression)

  Returns

Logical

  Arguments

cExpression   Specifies the character expression that ISLOWER( ) tests. ISLOWER( ) ignores any characters after the first character in cExpression.

  Remarks

ISLOWER( ) returns true (.T.) if the leftmost character in the specified character expression is a lowercase alphabetic character; otherwise, ISLOWER( ) returns false (.F.).


  ISLOWER( ) Function Example

CLEAR

? ISLOWER('redmond')  && Displays .T.

? ISLOWER('Redmond')  && Displays .F.


  See Also

ISALPHA( )
ISUPPER( )
LOWER( )
UPPER( )


ISMOUSE( ) Function

Syntax         Remarks         Example         See Also

Returns true (.T.) if mouse hardware is present.

 Syntax

ISMOUSE( )

 Remarks

ISMOUSE( ) returns true (.T.) if mouse hardware is present; otherwise it returns false (.F.).


 ISMOUSE( ) Function Example

The following example displays a true value (.T.) if mouse hardware is present; otherwise, it displays false (.F.).

CLEAR

? 'Mouse hardware present? '

?? ISMOUSE( )


 See Also

MCOL( )
MDOWN( )
MROW( )
SYSMETRIC( )


ISNULL( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns true (.T.) if an expression evaluates to a null value; otherwise, ISNULL( ) returns false (.F.).

 Syntax

ISNULL(eExpression)

 Returns

Logical

 Arguments

eExpression   Specifies the expression to evaluate.

 Remarks

Use ISNULL( ) to determine if the contents of a field, memory variable, or array element contains a null value, or if an expression evaluates to a null value.


 ISNULL( ) Function Example

In the following example, ISNULL( ) is used to check for a null value.

STORE .NULL. TO mNullvalue  && Store a null value to a memory variable

CLEAR

? mNullvalue  && Display the value of the memory variable

? ISNULL(mNullvalue)  && Returns .T., indicating a null value

? TYPE('mNullvalue')	  && Returns L, indicating a logical value

? (mNullvalue = .NULL.)  && Returns .NULL., bad test for null values


 See Also

NVL( )
SET NULL


ISREADONLY( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Determines whether a table is opened read-only.

 Syntax

ISREADONLY([nWorkArea | cTableAlias])

 Returns

Logical

 Arguments

nWorkArea | cTableAlias   Returns the read-only status for a table open in another work area. nWorkArea specifies the work area number and cTableAlias specifies the table or work area alias. ISREADONLY( ) returns false (.F.) if a table isn’t open in the work area you specify.

If you don’t specify a work area number or a table or work area alias, the read-only status is returned for the table open in the current work area.

 Remarks

ISREADONLY( ) returns true (.T.) if a table is opened read-only; otherwise, ISREADONLY( ) returns false (.F.).

A table can be opened read-only by including the NOUPDATE option when opening the table with USE, by checking the Read Only check box when opening the table from the Open dialog box, or by assigning MS-DOS read-only attributes to the table.

A cursor created with the SELECT - SQL command is always read-only.


 ISREADONLY( ) Function Example

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer	 NOUPDATE  && Open customer table read-only

CLEAR

? ISREADONLY('customer')  && Returns .T.


 See Also

USE


ISRLOCKED( ) Function

Syntax         Returns         Arguments         Remarks          See Also

Returns the record lock status.

 Syntax

ISRLOCKED([nRecordNumber, [nWorkArea | cTableAlias]])

 Returns

Logical

 Arguments

nRecordNumber   Specifies the number of the record for which the lock status is returned. If nRecordNumber is omitted, the record lock status is returned for the current record.

nWorkArea   Specifies the work area number of the table for which the record lock status is returned. If you omit cTableAlias and nWorkArea, the record lock status is returned for the table open in the current work area.

cTableAlias   Specifies the alias of the table for which the record lock status is returned.

 Remarks

ISRLOCKED( ) returns a logical true (.T.) if the record is locked; otherwise a logical false (.F.) is returned.


 See Also

FLOCK( ), ISFLOCKED( ), LOCK( ), RLOCK( ), SYS(2011) - Current Lock Status


ISUPPER( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Determines whether the first character in a character expression is an uppercase alphabetic character.

 Syntax

ISUPPER(cExpression)

 Returns

Logical

 Arguments

cExpression   Specifies the character expression that ISUPPER( ) evaluates. Any characters after the first character in cExpression are ignored.

 Remarks

ISUPPER( ) returns true (.T.) if the first character in a character expression is an uppercase alphabetic character; otherwise, ISUPPER( ) returns false (.F.).


 ISUPPER( ) Function Example

? ISUPPER('Redmond')  && Displays .T.

? ISUPPER('redmond')  && Displays .F.


 See Also

ISALPHA( )
ISLOWER( )
LOWER( )
UPPER( )


ItemBackColor, ItemForeColor Properties

Syntax         Settings         Applies To         See Also

Specifies the background or foreground color used to display the text of items in a ComboBox or ListBox control. Available at design time and run time.

 Syntax

Control.ItemBackColor[ = nColor]
 – Or –

Control.ItemBackColor = RGB(nRedValue, nGreenValue, nBlueValue)

Control.ItemForeColor[ = nColor]
 – Or –

Control.ItemForColor = RGB(nRedValue, nGreenValue, nBlueValue)

 Settings

nColor   Specifies an integer that represents the color of the text.

Note   In the Properties window, you can double-click any of the color properties to display the Color dialog box. You can choose or define colors from this dialog box. The red, green, and blue intensities that correspond to the color you choose become the settings for these properties after you close the Color dialog box.

For more information, see the color table in the BackColor, ForeColor Properties topic.


 Applies To

ComboBox, ListBox


 See Also

BackColor
ForeColor Properties
SelectedItemBackColor
SelectedItemForeColor Properties


ItemData Property

Syntax         Settings         Remarks         Applies To         See Also

Uses an index to reference a one-dimensional array that contains the same number of items as a ComboBox or ListBox control’s List property setting. Not available at design time; read-write at run time.

 Syntax

Control.ItemData(nIndex)[ = nData]

 Settings

nIndex   Specifies the index of the item to store or retrieve. The nIndex corresponds to the display order of the items in the list.

nData   The number to store or retrieve from the ItemData list.

 Remarks

Use the ItemData property to associate a specific number with each item in a combo box or list box. You can then use these numbers in code to identify the items in the list. For example, you can use an identification number to identify each employee name in a list box. When you fill the list box, also fill the corresponding elements in the ItemData array with the employee numbers.

Note   When you insert an item into a list with the AddItem method, an item is automatically allocated in the ItemData array as well. However, the value is not initialized; it retains the value that was in that position before you added the item to the list. When you use the ItemData property, be sure to set each element’s value when adding new items to a list.

Also note that the value of the ItemData property is only accurate for combo boxes or list boxes containing less than 60 items.


 Applies To

ComboBox, ListBox


 See Also

AddItem Method
ItemIDToIndex Method
List Property
ListItemID Property
NewItemID Property
RemoveItem Method
Selected Property
TopItemID Property


ItemIDData Property

Syntax         Settings         Remarks         Applies To         See Also

Uses a unique identification number to reference a one-dimensional array that contains the same number of items as a ComboBox or ListBox control’s List property setting. Not available at design time; read-write at run time.

 Syntax

Control.ItemIDData(nItemID)[ = nData]

 Settings

nItemID   Specifies the item ID, a unique identification number.

nData   The number to store or retrieve from the ItemIDData list.

 Remarks

Use the ItemIDData property to associate a specific number with each item in a combo box or list box. You can then use these numbers in code to identify the items. For example, you can use an identification number to identify each employee name in a list box. When you fill the list box, also fill the corresponding elements in the ItemIDData array with the employee numbers.

Note   When you insert an item into a list with the AddItem method, an item is automatically allocated in the ItemIDData array as well. However, the value is not initialized; it retains the value that was in that position before you added the item to the list. When you use the ItemIDData property, be sure to set each element’s value when adding new items to a list. This is the same array that is accessed by the ItemData Property.


 Applies To

ComboBox, ListBox


 See Also

IndexToItemID Method
List Property
ListItemID Property
NewItemID Property
RemoveItem Method
Selected Property
TopItemID Property


ItemIDToIndex Method

Syntax         Arguments         Remarks         Applies To         See Also

Returns the value of nIndex, the position of an item in a control’s list.

 Syntax

[nIndex =]Control.ItemIDToIndex(nItemID)

 Arguments

nItemID   The unique identification number associated with that item.

 Remarks

Each item added to a combo box or list box has two numbers assigned to it:

•	The nItemID, a unique identification number.

•	The nIndex, an integer corresponding to the order in which items are displayed by the control. The first item in the list corresponds to nIndex = 1.

Initially, as items are added to the control, these two numbers are identical. But as items are sorted, removed, and added, these numbers are no longer identical.

Use the ItemIDToIndex method to retrieve the nIndex number for a particular item in the control’s list when you know its nItemID number.


 Applies To

ComboBox, ListBox


 See Also

AddItem Method
AddListItem Method
IndexToItemID Method
ListItemID Property
List Property
ListCount Property


+ ItemTips Property
ItemTips Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether item tips are displayed for items in a combo box or list box. Available at design time; read-write at run time.

 Syntax

Control.ItemTips[= lExpression]

 Settings

lExpression   The settings for the ItemTip property are:

Setting	Description
True (.T.)	Item tips are displayed for items in a combo box or list box.
False (.F.)	(Default) Item tips are not displayed for items in a combo box or list box.
 Remarks

An item tip is a small window that displays an entire combo box or list box item when the mouse pointer is positioned over the item. Set this property to true (.T.) whenever items in a ComboBox or ListBox control are longer than the width of the control.


 Applies To

ComboBox, ListBox


 See Also

ItemData Property


JOIN Command

Included for backward compatibility. Use SELECT - SQL instead.


KEY( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the index key expression for an index tag or index file.

Syntax

KEY([CDXFileName,] nIndexNumber [, nWorkArea | cTableAlias])

Returns

Character

Arguments

CDXFileName   Specifies the name of a compound index file. KEY( ) returns the index key expressions of the .CDX file’s index tag. The compound index file you specify can be the structural compound index file automatically opened with the table, or it can be an independent compound index file.

nIndexNumber   Specifies which index key expression to return.

USE and SET INDEX both support an index file list that lets you open multiple indexes for a table. Any combination of single-entry .IDX index files, structural compound index files, or independent compound index files can be included in the index file list.

The numeric expression nIndexNumber specifies which index expression to return from the open index files. KEY( ) returns index expressions from open index files in the following order as nIndexNumber increases from 1 to the total number of open single-entry .IDX files and structural compound and independent compound index tags:

1.	Index expressions from single-entry .IDX index files (if any are open) are returned first. The order in which the single-entry index files are included in USE or SET INDEX determines how the index expressions are returned.

2.	Index expressions for each tag in the structural compound index (if one is present) are returned next. The index expressions are returned from the tags in the order in which the tags are created in the structural compound index.

3.	Index expressions for each tag in any open independent compound indexes are returned last. The index expressions are returned from the tags in the order in which the tags are created in the independent compound indexes.

The empty string is returned if nIndexNumber is greater than the total number of open single-entry .IDX files and structural compound and independent compound index tags.

nWorkArea   Specifies the work area number of the table whose index key expressions you want KEY( ) to return.

If a table isn’t open in the work area you specify, KEY( ) returns the empty string.

cTableAlias   Specifies the alias of the table whose index key expressions you want KEY( ) to return.

If no table has the alias you specify, Visual FoxPro generates an error message.

If you omit nWorkArea and cTableAlias, the index key expressions are returned for the table open in the current work area.

Remarks

An index key expression is specified when an index tag or index file is created with INDEX. The index key expression determines how a table is displayed and accessed when the index tag or index file is opened as the master controlling index tag or file.

For more information on creating index tags, index files, and index key expressions, see INDEX.


KEY( ) Function Example

The following example opens the customer table in the testdata database. FOR ... ENDFOR is used to create a loop in which KEY( ) is used to display the index expression of each index tag in the customer structural index. The name of each structural index tag is displayed with its index expression.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE Customer	  && Open customer table

CLEAR

FOR nCount = 1 TO 254

IF !EMPTY(TAG(nCount))  && Checks for tags in the index

? TAG(nCount) + ' '  && Display tag name

?? KEY(nCount)  && Display index expression

ELSE

EXIT  && Exit the loop when no more tags are found

ENDIF

ENDFOR


See Also

INDEX
REINDEX
SET INDEX
SYS(14) - Index Expression
USE


KEYBOARD Command

Syntax         Arguments         Remarks         See Also

Places the specified character expression in the keyboard buffer.

Syntax

KEYBOARD cKeyboardValue
[PLAIN] [CLEAR]

Arguments

cKeyboardValue   Specifies the character expression that is placed in the keyboard buffer. The character expression can be a character string, a key label, a set of key labels, or a user-defined function that returns a character expression.

If cKeyboardValue is a key label, it must be enclosed in braces and quotes. For example,

KEYBOARD '{CTRL+LEFTARROW}'

For a listing of key labels, see ON KEY LABEL.

The keyboard buffer can be filled with up to 128 characters. Once the keyboard buffer is full, additional characters are ignored.

PLAIN   If you have keyboard macros defined or active ON KEY LABEL commands, you can include PLAIN to bypass these key assignments. PLAIN fills the keyboard with the literal key character, not the key assignment.

For example, if you have assigned a command to the A key with ON KEY LABEL and A is included in cKeyboardValue, use PLAIN to place the letter A in the keyboard buffer. The ON KEY LABEL command assigned to A isn’t executed.

CLEAR   Empties the keyboard buffer before the keyboard buffer is filled with cKeyboardValue.

Remarks

Use KEYBOARD to place characters in the keyboard buffer. The characters remain in the buffer until Visual FoxPro looks for keyboard input. At that point, the characters are read and acted upon as if they were entered directly from the keyboard.

You can use KEYBOARD to create self-running demonstration systems that showcase your applications.


See Also

CHRSAW( )
ON KEY LABEL
PLAY MACRO
SET FUNCTION


KeyboardHighValue, KeyboardLowValue Properties

Syntax         Settings         Applies To         See Also

Specifies the highest or lowest value that can be entered into a Spinner control text box using the keyboard. Available at design time and run time.

Syntax

Spinner.KeyboardHighValue[ = nHigh]

Spinner.KeyboardLowValue[ = nLow]

Settings

nHigh   Specifies the highest value that can be entered. The default value for nHigh is 2,147,483,647.

nLow   Specifies the lowest value that can be entered. The default value for nLow is – 2,147,483,647.


Applies To

Spinner


See Also

SpinnerHighValue
SpinnerLowValue Properties


KEYMATCH( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Searches an index tag or index file for an index key.

Syntax

KEYMATCH(eIndexKey [, nIndexNumber [, nWorkArea | cTableAlias]])

Returns

Logical

Arguments

eIndexKey   Specifies the index key that KEYMATCH( ) searches for. The index keys in an index file or index tag are determined by the index expression. An index expression is specified when an index file or index tag is created with INDEX. KEY( ) and SYS(14) can be used to return the index expressions for index files and index tags. For more information on creating index files, index expressions, and index keys, see INDEX.

If you don’t include any of the optional parameters, KEYMATCH( ) searches the master index file or master index tag for the index key you specify. If a master index file or index tag isn’t in effect (for example, you’ve issued SET ORDER TO without any parameters to place the table in physical record order), Visual FoxPro generates an error message.

nIndexNumber   Specifies which index file or index tag is searched. nIndexNumber is typically an integer that starts at 1 and is increased by 1 to search additional index tags.

If nIndexNumber is 1, the master single-entry .IDX index file or master index tag (if one is present) is searched.

As nIndexNumber increases, subsequent tags in the structural compound index (if one is present) are searched. The tags are searched in the order in which the tags were created in the structural compound index.

As nIndexNumber continues to increase and all the tags in the structural compound index have been searched, tags in any open independent compound indexes are then searched. The tags are searched in the order in which the tags were created in the independent compound indexes.

An error message is generated if nIndexNumber is greater than the total number of open single-entry .IDX files and structural compound and independent compound index tags.

nWorkArea | cTableAlias   Searches index files or tags open in another work area. nWorkArea specifies the work area number and cTableAlias specifies the table alias. If you omit the work area and alias, KEYMATCH( ) searches index files or tags open for the table in the current work area.

If no table has the alias you specify, Visual FoxPro generates an error message.

Remarks

KEYMATCH( ) searches an index tag or index file for a specific index key and returns true (.T.) if the index key is found; otherwise, KEYMATCH( ) returns false (.F.). KEYMATCH( ) can be used to prevent duplicate index keys.

KEYMATCH( ) returns the record pointer to the record on which it was originally positioned before KEYMATCH( ) was issued.


See Also

INDEX
KEY( )
SET INDEX
SYS(14)
USE


KeyPress Event

Syntax         Parameters         Remarks         Applies To         See Also

Occurs when the user presses and releases a key.

Syntax

PROCEDURE Object.KeyPress
LPARAMETERS [nIndex,] nKeyCode, nShiftAltCtrl
 – Or –
LPARAMETERS nKeyCode, nShiftAltCtrl

Parameters

You must include an LPARAMETERS or PARAMETERS statement in the event procedure and specify a name for each parameter.

nIndex   Uniquely identifies a control if it is in a control array.

nKeyCode   Contains a number which identifies the key pressed. For a list of codes for special keys and key combinations, see INKEY( ).

nShiftAltCtrl   Sets a bit if a modifier key is held down while the key identified in nKeyCode is pressed.

The valid modifier keys are the SHIFT, CTRL, and ALT keys.

The values returned in nShiftAltCtrl for individual modifier keys are listed in the following table.

Modifier key values for nShiftAltCtrl

Key	Value
SHIFT	1
CTRL	2
ALT	4
This parameter is the sum of the bits, with the least-significant bits corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT key (bit 2 ).

These bits correspond to the values 1, 2, and 4, respectively. This parameter indicates the state of these keys. Some, all, or none of the bits can be set, indicating that some, all, or none of the keys is pressed. For example, if both CTRL and ALT are pressed, the value of nShiftAltCtrl is 6.

Remarks

The object with the focus receives the event.

A form can receive the KeyPress event in three special cases:

•	The form contains no controls, or none of its controls is visible and enabled.

•	The form’s KeyPreview property is set to true (.T.). The form receives the KeyPress event first and then the control with focus receives the event.

•	If a control on the form cannot process a keystroke (for example, when Tab is pressed to move the focus to the next control).

A KeyPress event is useful for intercepting keystrokes entered in a control. It enables you to immediately test keystrokes for validity or to format characters as they are typed. Use the KeyPreview property to create global keyboard-handling routines.

The KeyPress event does not occur for any combination of keys with the ALT key.


 Applies To

CheckBox, ComboBox, CommandButton, EditBox, Form, ListBox, OptionButton, Spinner, TextBox


See Also

INKEY( )
KeyPreview Property


KeyPreview Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether a form’s KeyPress event intercepts the KeyPress events of a control. Available at design time and run time.

Syntax

Object.KeyPreview[ = lExpr]

Settings

lExpr   The settings for the KeyPreview property are:

Setting	Description
True (.T.)	The form receives KeyPress events first and then the active control receives KeyPress events.
False (.F.)	(Default) The active control receives Keypress events; the form doesn’t.
Remarks

The KeyPreview property is used to allow the form to handle KeyPress events before the active control processes them.

You can use this property to create a keyboard-handling procedure for a form. For example, when an application uses function keys, you can process the keystrokes at the form level rather than writing code for each control that can receive keystroke events.

If a form has no visible and enabled controls, it automatically receives all keyboard events.


 Applies To

Form, Page, _SCREEN, ToolBar


See Also

Enabled Property
KeyPress Event
Visible Property


LABEL Command

Syntax         Arguments         Remarks         See Also

Prints labels from a table file and a label definition file.

 Syntax

LABEL [FORM FileName1 | FORM ?]
[ENVIRONMENT]
[Scope]
[FOR lExpression1]
[WHILE lExpression2]
[NOCONSOLE]
[NOOPTIMIZE]
[PDSETUP]
[PREVIEW [NOWAIT]]
[NAME ObjectName]
[TO PRINTER [PROMPT] | TO FILE FileName2]

 Arguments

FORM FileName1   Specifies the name of a label definition file whose labels you want to print. The default extension for a label definition file is .LBX. If the label definition file is on a drive or volume other than the default or in a directory other than the current directory, you must also specifiy the drive designator and directory.

FORM ?   Displays the Open dialog box from which you can choose an existing label file.

ENVIRONMENT   Included for backward compatibility with 2.x labels. To restore the data environment associated with a Visual FoxPro label, set the data environment AutoOpenTables property to true (.T.), which is the default. To make sure that the label environment is closed when the label is finished printing, set the data environment AutoCloseTables property to true (.T.), which is also the default.

When you create or modify labels, you can save the current Visual FoxPro data environment with the label definition file. Saving the Visual FoxPro data environment places additional records in the label definition table for all open tables and index files, the index order, and any relationships between the tables.

Scope   Specifies a range of records. Only the records that fall within the range are printed. The scope clauses are: ALL, NEXT nRecords, RECORD nRecordNumber, and REST. Commands that include Scope operate only on the table in the active work area.

The default scope for LABEL is ALL records.

FOR lExpression1   Specifies a condition whereby only the records that satisfy the logical condition lExpression1 are printed. This argument allows you to filter out records you don’t want to print.

Rushmore optimizes a query created with LABEL ... FOR if lExpression1 is an optimizable expression. For best performance, use an optimizable expression in the FOR clause.

For more information, see SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

WHILE lExpression2   Specifies a condition whereby records are printed for as long as the logical expression lExpression2 evaluates to true (.T.).

NOCONSOLE   Suppresses the display of label output to the main Visual FoxPro window or to a user-defined window when labels are being printed or sent to a file.

NOOPTIMIZE   Disables Rushmore optimization of LABEL.

For more information, see SET OPTIMIZE, and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

PDSETUP   Loads a printer driver setup.

In Visual FoxPro, you can include PDSETUP to use a printer driver setup for printing character-based labels created in FoxPro for MS-DOS. PDSETUP is ignored when you print graphics-based labels created in Visual FoxPro.

PREVIEW [NOWAIT]   Displays the labels in a preview window before printing, but doesn’t print the labels. To print the labels, you must issue LABEL again without the PREVIEW clause.

In Visual FoxPro, you can include the optional NOWAIT clause so that at run time Visual FoxPro does not wait for the page preview window to be closed before continuing program execution. Instead, Visual FoxPro continues program execution while the page preview window is open.

NAME ObjectName   Specifies an object variable name for the data environment of a label. The data environment and the objects in the data environment have properties and methods, for example AddObject, that need to be set or called at run time. The object variable provides access to these properties and methods. If you don’t specify a NAME, Visual FoxPro uses as a default the name of the label file that can be referenced in the code associated with the events.

TO PRINTER [PROMPT]   Sends a label to the printer. You can include the optional PROMPT clause to display the Print dialog box before printing starts.

TO FILE FileName2   Sends character-based labels created in FoxPro for MS-DOS to the text file specified with FileName2. The file that is created when you include TO FILE has the default extension .TXT.

 Remarks

Label definition files are created with MODIFY LABEL or CREATE LABEL.

If LABEL is issued without any additional arguments, the Open dialog box appears, displaying a list of existing label files to choose from.


 See Also

CREATE LABEL
MODIFY LABEL


Label Control

Syntax         Remarks         Properties         Events         Methods         See Also

Creates a label that displays text.

 Syntax

Label

 Remarks

A Label control is a graphical control that displays text that can't be changed directly. However, because a Label control has a full set of properties, events, and methods that other controls have, the Label control can respond to events and can be changed dynamically at run time.

To assign an access key to a label, include a backslash and a less-than sign (\<) in the caption immediately preceding the character you want to designate as the access key. When the label is displayed, the character is underlined. Pressing the access key for a label activates the next control in the tab order. Use the TabIndex property to assign a tab order to a label.

Captions are displayed differently depending on the object.

256 is the maximum number of characters for the Caption property for a Label control.

For additional information about creating Label controls, see Chapter 10, “Using Controls,” in the Developer’s Guide.


 Properties

Alignment	AutoSize	BackColor
BackStyle	BaseClass	BorderStyle
Caption	Class	ClassLibrary
ColorScheme	ColorSource	Comment
DisabledBackColor	DisabledForeColor	DragIcon
DragMode	Enabled	FontBold
FontItalic	FontName	FontOutline
FontShadow	FontSize	FontStrikeThru
FontUnderline	ForeColor	Height
HelpContextID	Left	MousePointer
Name	Parent	ParentClass
RightToLeft	TabIndex	Tag
Top	Visible	Width
WordWrap


 Events

Click	DblClick	Destroy
DragDrop	DragOver	Error
Init	MiddleClick Event	MouseDown
MouseMove	MouseUp	MouseWheel
RightClick	UIEnable


 Methods

CloneObject	Drag	Move
ReadExpression	ReadMethod	ResetToDefault
SaveAsClass	UIEnable	WriteExpression
WriteMethod	ZOrder


 See Also

CREATE CLASS
CREATE FORM
DEFINE CLASS


LASTKEY( ) Function

Syntax         Returns         Remarks         See Also

Returns an integer corresponding to the last key pressed.

 Syntax

LASTKEY( )

 Returns

Numeric

 Remarks

The values returned by LASTKEY( ) are the same as the values returned by INKEY( ). See INKEY( ) for a list of keys and their return values.

LASTKEY( ) is updated when you move between controls.


 See Also

CHRSAW( )
INKEY( )
READKEY( )


Left Property

Syntax         Settings         Remarks         Example         Applies To         See Also

Specifies the distance between the left edge of a control or form and its container object. Available at design time and run time.

 Syntax

Object.Left[ = nDist]

 Settings

nDist   Specifies the distance between the left edge of an object or form and the left edge of its container object.

The default container for a form is the main Visual FoxPro window.

 Remarks

The Left property specifies how far from the object’s zero position the object is located. For example, if a form is contained within the Visual FoxPro main window, the zero position is immediately to the right of the main window’s left border. If a toolbar is docked to the left of the main window, the zero position is immediately to the right of the toolbar. In Visual FoxPro for Macintosh, if the form is on the desktop (not contained within the Visual FoxPro main window), the zero position is the left edge of the screen.

Use Left, Top, Height, and Width properties for operations based on an object’s external dimensions, such as moving or resizing. Use the ScaleMode property to change the unit of measurement.

Note   The Left property is read-only when it applies to a control contained in a Column object.


 Left Property Example

The following example demonstrates how the Left property is used to position controls on a form. The AddObject method is used to add a Line control and three command buttons to a form, and the Left property specifies the horizontal placement of each control on the form.

frmMyForm = CREATEOBJECT('Form')  && Create a form

frmMyForm.Closable = .F.  && Disable the Control-menu boxthe close box

frmMyForm.AddObject('shpLine','Line')  && Add a Line control to the form

frmMyForm.AddObject('cmdCmndBtn1','cmdMyCmndBtn1')  && Up Cmnd button

frmMyForm.AddObject('cmdCmndBtn2','cmdMyCmndBtn2')  && Down Cmnd button

frmMyForm.AddObject('cmdCmndBtn3','cmdMyCmndBtn3')  && Quit Cmnd button

frmMyForm.shpLine.Visible = .T.  && Make Line control visible

frmMyForm.shpLine.Top = 20  && Specify Line control row

frmMyForm.shpLine.Left = 125  && Specify Line control column

frmMyForm.cmdCmndBtn1.Visible =.T.  && Up Command button visible

frmMyForm.cmdCmndBtn2.Visible =.T.  && Down" Command button visible

frmMyForm.cmdCmndBtn3.Visible =.T.  && Quit Command button visible

frmMyForm.SHOW  && Display the form

READ EVENTS  && Start event processing

DEFINE CLASS cmdMyCmndBtn1 AS COMMANDBUTTON  && Create Command button

Caption = 'Slant \<Up'  && Caption on the Command button

Left = 50  && Command button column

Top = 100  && Command button row

Height = 25  && Command button height

PROCEDURE Click

ThisForm.shpLine.Visible = .F.  && Hide the Line control

ThisForm.shpLine.LineSlant ='/'  && Slant up

ThisForm.shpLine.Visible = .T.  && Show the Line control

ENDDEFINE

DEFINE CLASS cmdMyCmndBtn2 AS CommandButton  && Create Command button

Caption = 'Slant \<Down'  && Caption on the Command button

Left = 200  && Command button column

Top = 100  && Command button row

Height = 25  && Command button height

PROCEDURE Click

ThisForm.shpLine.Visible = .F.  && Hide the Line control

ThisForm.shpLine.LineSlant ='\'  && Slant down

ThisForm.shpLine.Visible = .T.  && Show the Line control

ENDDEFINE

DEFINE CLASS cmdMyCmndBtn3 AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 150  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close form

ENDDEFINE


 Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, Custom, EditBox, Form, Grid, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, PageFrame, _SCREEN, Shape, Spinner, TextBox, Timer, ToolBar


 See Also

Height Property
Move Method
ScaleMode Property
Top Property
Width Property


LEFT( ) Function

Syntax         Returns         Arguments         Example         See Also

Returns a specified number of characters from a character expression, starting with the leftmost character.

 Syntax

LEFT(cExpression, nExpression)

 Returns

Character

 Arguments

cExpression   Specifies the character expression from which LEFT( ) returns characters.

nExpression   Specifies the number of characters returned from the character expression. If nExpression is greater than the length of cExpression, all of the character expression is returned. The empty string is returned if nExpression is negative or 0.

LEFT( ) is identical to SUBSTR( ) with a starting position of 1.


 LEFT( ) Function Example

CLEAR

? LEFT('Redmond, WA', 4)  && Displays Redm


 See Also

AT( )
LTRIM( )
RIGHT( )
RTRIM( )
SUBSTR( )


LEFTC( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns a specified number of characters from a character expression, starting with the leftmost character.

 Syntax

LEFTC(cExpression, nExpression)

 Returns

Character

 Arguments

cExpression   Specifies the character expression from which LEFTC( ) returns characters.

nExpression   Specifies the number of characters returned from the character expression. If nExpression is greater than the length of cExpression, all of the character expression is returned. The empty string is returned if nExpression is negative or 0.

 Remarks

LEFTC( ) is designed for expressions containing double-byte characters. If the expression contains only single-byte characters, LEFTC( ) is equivalent to LEFT( ).

LEFTC( ) returns a specified number of characters from a character expression containing any combination of single-byte and double-byte characters.

LEFTC( ) is identical to SUBSTRC( ) with a starting position of 1.


 See Also

AT_C( )
LEFT( )
RIGHTC( )
SUBSTRC( )


LeftColumn Property

Syntax         Remarks         Applies To         See Also

Contains the number of the left-most column being displayed by a Grid control. Read-only at design time and run time.

 Syntax

Grid.LeftColumn

 Remarks

Use the LeftColumn property to determine which columns are not visible to the user. For example, if LeftColumn = 3, columns 1 and 2 are not visible.


 Applies To

Grid


 See Also

ActiveColumn Property
ActiveRow Property
ColumnOrder Property
RelativeColumn Property
RelativeRow Property


LEN( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the number of characters in a character expression.

 Syntax

LEN(cExpression)

 Returns

Numeric

 Arguments

cExpression   Specifies the character expression for which LEN( ) returns the number of characters.

 Remarks

Use LEN( ) to determine the length of a character expression.


 LEN( ) Function Example

The following example opens the customer table in the testdata database. LEN( ) is used to display the widths of the cust_id and contact fields.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE Customer	  && Open customer table

CLEAR

? 'Width of contact field: '

?? LEN(contact)

? 'Width of cust_id field: '

?? LEN(cust_id)


 See Also

FSIZE( )
TXTWIDTH( )


LENC( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns the number of characters in a character expression or memo field.

 Syntax

LENC(cExpression)

 Returns

Numeric

 Arguments

cExpression   Specifies the character expression for which LENC( ) returns the number of characters.

 Remarks

LENC( ) is designed for expressions containing double-byte characters. If the expression contains only single-byte characters, LENC( ) is equivalent to LEN( ).

LENC( ) returns the number of characters in a character expression or memo field containing any combination of single-byte and double-byte characters.


 See Also

LEN( )


LIKE( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Determines if a character expression matches another character expression.

 Syntax

LIKE(cExpression1, cExpression2)

 Returns

Logical

 Arguments

cExpression1   Specifies the character expression that LIKE( ) compares with cExpression2. cExpression1 can contain the wildcards such as * and ?. The question mark (?) matches any single character in cExpression2 and the asterisk (*) matches any number of characters. You can mix any number of wildcards in any combination in cExpression1.

cExpression2   Specifies the character expression LIKE( ) compares with cExpression1. cExpression2 must match cExpression1 letter for letter in order for LIKE( ) to return true (.T.).

 Remarks

LIKE( ) returns true (.T.) if cExpression1 matches cExpression2; otherwise, it returns false (.F.).

SET COMPATIBLE determines how LIKE( ) evaluates cExpression1 and cExpression2. If SET COMPATIBLE is set to ON or DB4, cExpression1 and cExpression2 have all trailing blanks removed before they are compared. If SET COMPATIBLE is set to OFF or FOXPLUS, any trailing blanks in cExpression1 and cExpression2 are used in the comparison.


 LIKE( ) Function Example

In the following example, all product names in the products table with the first two letters “Ch” are displayed.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE products  && Open Products table

CLEAR

? 'All product names with first two letters Ch:'

?

SCAN FOR LIKE('Ch*', prod_name)

? prod_name

ENDSCAN

USE


 See Also

$
AT( )
ATC( )
OCCURS( )
RAT( )
SET COMPATIBLE


LIKEC( )
LIKEC( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Determines whether a character expression matches another character expression.

 Syntax

LIKEC(cExpression1, cExpression2)

 Returns

Logical

 Arguments

cExpression1   Specifies the character expression that LIKEC( ) compares with cExpression2. cExpression1 can contain wild cards such as * and ?. A question mark (?) matches any single character in cExpression2 and an asterisk (*) matches any number of characters. You can mix any number of wild cards in any combination in cExpression1.

cExpression2   Specifies the character expression LIKEC( ) compares with cExpression1. cExpression2 must match cExpression1 character for character in order for LIKE( ) to return true (.T.).

 Remarks

LIKEC( ) is designed for expressions containing double-byte characters. If the expression contains only single-byte characters, LIKEC( ) is equivalent to LIKE( ).

LIKEC( ) determines if a character expression matches another character expression. LIKEC( ) returns true (.T.) if cExpression1 matches cExpression2; otherwise, it returns false (.F.).

SET COMPATIBLE determines how LIKEC( ) compares blanks in cExpression1 and cExpression2. If SET COMPATIBLE is set to ON or DB4, all trailing blanks are removed from cExpression1 and cExpression2 before they are compared. If SET COMPATIBLE is set to OFF or FOXPLUS, any trailing blanks in cExpression1 and cExpression2 are used in the comparison.


 See Also

AT_C( )
ATCC( )
LIKEC( )
RATC( )


Line Control

Syntax         Remarks         Properties         Events         Methods         Example         See Also

Creates a control that displays a horizontal, vertical, or diagonal line.

 Syntax

Line

 Remarks

A Line control is a graphical control that displays a horizontal, vertical, or diagonal line that can't be changed directly. However, because a Line control has a full set of properties, events, and methods that other controls have, the Line control can respond to events and can be changed dynamically at run time.

For additional information about creating lines, see the Form Designer topic and Chapter 10, “Using Controls,” in the Developer’s Guide.


 Properties

BaseClass	BorderColor	BorderStyle
BorderWidth	Class	ClassLibrary
ColorSource Property	Comment	DragIcon
DragMode	DrawMode	Enabled
Height	HelpContextID	Left
LineSlant	MousePointer	Name
Parent	ParentClass	Tag
Top	Visible	Width


 Events

Click	DblClick	Destroy
DragDrop	DragOver	Error
Init	MiddleClick Event	MouseDown
MouseMove	MouseUp	MouseWheel
RightClick	UIEnable


 Methods

CloneObject	Drag	Move
ReadExpression	ReadMethod	ResetToDefault
SaveAsClass	WriteExpression	WriteMethod
ZOrder


 Line Control Example

The following example demonstrates how a Line control can be added to a form and how you can use the LineSlant property to specify the direction in which the line slants.

The AddObject method is used to add a Line control to a form. Three command buttons are added to the form, allowing you to change the direction in which the line slants or to close the form.

frmMyForm = CREATEOBJECT('Form')  && Create a Form

frmMyForm.Closable = .F.  && Disable the Control menu box

frmMyForm.AddObject('shpLine','Line')  && Add a Line control to the form

frmMyForm.AddObject('cmdCmndBtn1','cmdMyCmndBtn1')  && Up Cmnd button

frmMyForm.AddObject('cmdCmndBtn2','cmdMyCmndBtn2')  && Down Cmnd button

frmMyForm.AddObject('cmdCmndBtn3','cmdMyCmndBtn3')  && Quit Cmnd button

frmMyForm.shpLine.Visible = .T.  && Make Line control visible

frmMyForm.shpLine.Top = 20  && Specify Line control row

frmMyForm.shpLine.Left = 125  && Specify Line control column

frmMyForm.cmdCmndBtn1.Visible =.T.  && Up Command button visible

frmMyForm.cmdCmndBtn2.Visible =.T.  && Down" Command button visible

frmMyForm.cmdCmndBtn3.Visible =.T.  && Quit Command button visible

frmMyForm.SHOW  && Display the form

READ EVENTS  && Start event processing

DEFINE CLASS cmdMyCmndBtn1 AS COMMANDBUTTON  && Create Command button

Caption = 'Slant \<Up'  && Caption on the Command button

Left = 50  && Command button column

Top = 100  && Command button row

Height = 25  && Command button height

PROCEDURE Click

ThisForm.shpLine.Visible = .F.  && Hide the Line control

ThisForm.shpLine.LineSlant ='/'  && Slant up

ThisForm.shpLine.Visible = .T.  && Show the Line control

ENDDEFINE

DEFINE CLASS cmdMyCmndBtn2 AS CommandButton  && Create Command button

Caption = 'Slant \<Down'  && Caption on the Command button

Left = 200  && Command button column

Top = 100  && Command button row

Height = 25  && Command button height

PROCEDURE Click

ThisForm.shpLine.Visible = .F.  && Hide the Line control

ThisForm.shpLine.LineSlant ='\'  && Slant down

ThisForm.shpLine.Visible = .T.  && Show the Line control

ENDDEFINE

DEFINE CLASS cmdMyCmndBtn3 AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 150  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close Form

ENDDEFINE


 See Also

CREATE CLASS
CREATE FORM
DEFINE CLASS


Line Method

Syntax         Arguments         Remarks         Applies To         See Also

Draws a line on a Form object.

 Syntax

Object.Line(nXCoord2, nYCoord2)
 – Or –

Object.Line(nXCoord1, nYCoord1, nXCoord2, nYCoord2)

 Arguments

nXCoord1, nYCoord1   Specifies the coordinates of the starting point of the line. The unit of measurement is specified by the ScaleMode property of the form.

nXCoord2, nYCoord2   Specifies the coordinates of the endpoint of the line.

 Remarks

The width of the line drawn depends on the setting of DrawWidth property. The way a line is drawn on the background depends on the setting of the DrawMode and DrawStyle properties. After the Line method runs, the CurrentX and CurrentY properties are set to nXCoord2, nYCoord2.


 Applies To

Form, _SCREEN


 See Also

CurrentX
CurrentY Properties
DrawMode Property
DrawStyle Property
DrawWidth Property
ScaleMode Property


LINENO( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the line number of a line being executed in a program relative to the first line of the main program.

 Syntax

LINENO([1])

 Returns

Numeric

 Arguments

1   Returns the line number relative to the first line of the current program or procedure. If you omit the 1 argument, the line number is returned relative to the first line of the main program.

 Remarks

Program lines are counted starting from the top of the program. Comment lines, continuation lines, and blank lines are included in the line number count. If a program is suspended during execution, LINENO( ) returns the number of the program line at which program execution was suspended. LINENO( ) returns 0 if a program is canceled.

By default, line numbers are returned relative to the beginning of the main program. If a procedure is called, line numbering continues from the top of the calling program.

LINENO( ) is useful for debugging programs. You can set a breakpoint to stop program execution at a specific line number by issuing the following command in the Debug window:

LINENO( ) = nExpression

Program execution is suspended when the value of LINENO( ) is equal to nExpression.


 LINENO( ) Function Example

The following example is part of a simple error-handling routine.

ON ERROR DO bug_proc WITH LINENO( )

BRWS  && Causes an error

ON ERROR

*** Bug_Proc error handler ***

PROCEDURE bug_proc

PARAMETERS gnBadLine

WAIT WINDOW 'Error occurred at line: ' + ALLTRIM(STR(gnBadLine))

RETURN


 See Also

ERROR( )
MESSAGE( )
PROGRAM( )
SYS(16) - Executing Program File Name


LineSlant Property

Syntax         Settings         Example         Applies To         See Also

Specifies which way a line slants, from upper left to lower right or lower left to upper right. Available at design time and run time.

 Syntax

Line.LineSlant[ = cSlant]

 Settings

cSlant   The settings for the LineSlant property are:

Setting	Description
\	(Default) Line slants from upper left to lower right.
/	Line slants from lower left to upper right.


 LineSlant Property Example

The following example demonstrates how to use the LineSlant property to specify the direction in which a Line control slants.

A Line control is added to a form. Three command buttons are added to the form, allowing you to change the direction in which the line slants or to close the form.

frmMyForm = CREATEOBJECT('Form')  && Create a Form

frmMyForm.Closable = .F.  && Disable the Control menu box

frmMyForm.AddObject('shpLine','Line')  && Add a Line control to the form

frmMyForm.AddObject('cmdCmndBtn1','cmdMyCmndBtn1')  && Up Cmnd button

frmMyForm.AddObject('cmdCmndBtn2','cmdMyCmndBtn2')  && Down Cmnd button

frmMyForm.AddObject('cmdCmndBtn3','cmdMyCmndBtn3')  && Quit Cmnd button

frmMyForm.shpLine.Visible = .T.  && Make Line control visible

frmMyForm.shpLine.Top = 20  && Specify Line control row

frmMyForm.shpLine.Left = 125  && Specify Line control column

frmMyForm.cmdCmndBtn1.Visible =.T.  && Up Command button visible

frmMyForm.cmdCmndBtn2.Visible =.T.  && Down" Command button visible

frmMyForm.cmdCmndBtn3.Visible =.T.  && Quit Command button visible

frmMyForm.SHOW  && Display the form

READ EVENTS  && Start event processing

DEFINE CLASS cmdMyCmndBtn1 AS COMMANDBUTTON  && Create Command button

Caption = 'Slant \<Up'  && Caption on the Command button

Left = 50  && Command button column

Top = 100  && Command button row

Height = 25  && Command button height

PROCEDURE Click

ThisForm.shpLine.Visible = .F.  && Hide the Line control

ThisForm.shpLine.LineSlant ='/'  && Slant up

ThisForm.shpLine.Visible = .T.  && Show the Line control

ENDDEFINE

DEFINE CLASS cmdMyCmndBtn2 AS CommandButton  && Create Command button

Caption = 'Slant \<Down'  && Caption on the Command button

Left = 200  && Command button column

Top = 100  && Command button row

Height = 25  && Command button height

PROCEDURE Click

ThisForm.shpLine.Visible = .F.  && Hide the Line control

ThisForm.shpLine.LineSlant ='\'  && Slant down

ThisForm.shpLine.Visible = .T.  && Show the Line control

ENDDEFINE

DEFINE CLASS cmdMyCmndBtn3 AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 150  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close Form

ENDDEFINE


 Applies To

Line


 See Also

DrawMode Property
DrawStyle Property


LinkMaster Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the parent table linked to the child table displayed in a Grid control. Available at design time; read-write at run time.

 Syntax

Grid.LinkMaster[ = cName]

 Settings

cName   Specifies the alias of the parent table that drives the display of the child table in a Grid control.

 Remarks

Use the LinkMaster property to set up a one-to-many relationship between the parent, or primary, table of the Form, and the table referenced by the Grid’s RecordSource property.


 Applies To

Grid


 See Also

ChildOrder Property
RelationalExpr Property


LIST Commands

Syntax         Remarks         See Also

Continuously displays table or environment information.

 Syntax

LIST
[FIELDS FieldList]
[Scope] [FOR lExpression1] [WHILE lExpression2]
[OFF]
[NOCONSOLE]
[NOOPTIMIZE]
[TO PRINTER [PROMPT] | TO FILE FileName]
 – Or –
LIST FILES
[ON Drive]
[LIKE FileSkeleton]
[TO PRINTER [PROMPT] | TO FILE FileName]
 – Or –
LIST MEMORY
[LIKE FileSkeleton]
[NOCONSOLE]
[TO PRINTER [PROMPT] | TO FILE FileName]
 – Or –
LIST STATUS
[NOCONSOLE]
[TO PRINTER [PROMPT] | TO FILE FileName]
 – Or –
LIST STRUCTURE
[IN nWorkArea | cTableAlias]
[NOCONSOLE]
[TO PRINTER [PROMPT] | TO FILE FileName]

 Remarks

These LIST commands are identical to the DISPLAY commands except for the following differences:

•	The scope for LIST defaults to ALL records.

•	LIST doesn’t prompt you after filling the main Visual FoxPro window or a user-defined window with information.

•	LIST doesn’t display records flagged for deletion when SET DELETED is ON.

For more information about the LIST commands, see the corresponding commands in DISPLAY.


 See Also

DISPLAY
DISPLAY FILES
DISPLAY MEMORY
DISPLAY STATUS
DISPLAY STRUCTURE
SET DELETED


LIST CONNECTIONS Command

Syntax         Arguments         Remarks         Example         See Also

Continuously displays information about the named connections in the current database.

 Syntax

LIST CONNECTIONS
[TO PRINTER [PROMPT] | TO FILE FileName]
[NOCONSOLE]

 Arguments

TO PRINTER [PROMPT]   Directs output from LIST CONNECTIONS to a printer.

In Visual FoxPro, you can include the optional PROMPT clause to display a Print dialog box before printing starts. Place PROMPT immediately after TO PRINTER.

TO FILE FileName   Directs output from LIST CONNECTIONS to the file specified with FileName. If the file already exists and SET SAFETY is ON, Visual FoxPro displays a prompt asking if you want to overwrite the file.

NOCONSOLE   Suppresses output to the main Visual FoxPro window or to the active user-defined window.

 Remarks

The information displayed includes the names of named connections, datasources, and connection strings in the current database. Use DBGETPROP( ) to return additional information about connections in the current database.


 LIST CONNECTIONS Command Example

The following example assumes an ODBC data source called MyFoxSQLNT is available, and the user ID for the data source is “sa.” The testdata database is opened, and a connection named Myconn is created. LIST CONNECTIONS is used to list the named connections in the database.

CLOSE DATABASES

OPEN DATABASE (SYS(2004) + 'samples\data\testdata')

CREATE CONNECTION Myconn DATASOURCE "MyFoxSQLNT" USERID "sa"

CLEAR

LIST CONNECTIONS	  && Lists named connections in the database


 See Also

CREATE CONNECTION
DELETE CONNECTION
DBGETPROP( )
DISPLAY CONNECTIONS
RENAME CONNECTION


LIST DATABASE Command

Syntax         Arguments         Remarks         Example         See Also

Continuously displays information about the current database.

 Syntax

LIST DATABASE
[TO PRINTER [PROMPT] | TO FILE FileName]
[NOCONSOLE]

 Arguments

TO PRINTER [PROMPT]   Directs output from LIST DATABASE to a printer.

In Visual FoxPro, you can include the optional PROMPT clause to display a Print dialog box before printing starts. Place PROMPT immediately after TO PRINTER.

TO FILE FileName   Directs output from LIST DATABASE to the file specified with FileName. If the file already exists and SET SAFETY is ON, Visual FoxPro displays a prompt asking if you want to overwrite the file.

NOCONSOLE   Suppresses output to the main Visual FoxPro window or to the active user-defined window.

 Remarks

Use DBGETPROP( ) to return additional information about the current database.


 LIST DATABASE Command Example

This example creates a database named people. A table named friends is created and is automatically added to the database. DISPLAY TABLES is used to display the tables in the database, and LIST DATABASES is used to list information about the tables in the database.

CREATE DATABASE people

CREATE TABLE friends (FirstName C(20), LastName C(20))

CLEAR

DISPLAY TABLES  && Displays tables in the database

LIST DATABASE  && Lists table information


 See Also

DISPLAY DATABASE


LIST DLLS Command

Syntax         Arguments         See Also

Continuously displays information about shared library functions registered in Visual FoxPro with DECLARE - DLL.

 Syntax

LIST DLLS
[TO PRINTER [PROMPT] | TO FILE FileName]
[NOCONSOLE]

 Arguments

TO PRINTER [PROMPT]   Directs output from LIST DLLS to a printer.

In Visual FoxPro, you can include the optional PROMPT clause to display a Print dialog box before printing starts. Place PROMPT immediately after TO PRINTER.

TO FILE FileName   Directs output from LIST DLLS to the file specified with FileName. If the file already exists and SET SAFETY is ON, Visual FoxPro displays a prompt asking if you want to overwrite the file.

NOCONSOLE   Suppresses output to the main Visual FoxPro window or the active user-defined window.


 See Also

DECLARE - DLL
DISPLAY DLLS


LIST OBJECTS Command

Syntax         Arguments         Remarks         Example         See Also

Continuously displays information about an object or a group of objects.

 Syntax

LIST OBJECTS
[LIKE cObjectSkeleton]
[TO PRINTER [PROMPT] | TO FILE FileName]
[NOCONSOLE]

 Arguments

LIKE cObjectSkeleton   Displays information about a subset of objects. cObjectSkeleton is an object specification skeleton that supports wildcards (* and ?). For example, to continuously display all objects that begin with A, use the following command:

LIST OBJECTS LIKE A*

TO PRINTER [PROMPT]   Directs output from LIST OBJECTS to a printer.

You can include the optional PROMPT clause to display a Print dialog box before printing starts. Place the PROMPT keyword immediately after TO PRINTER.

TO FILE FileName   Directs output from LIST OBJECTS to the disk file specified with FileName. If the file already exists and SET SAFETY is ON, Visual FoxPro displays a prompt asking if you want to overwrite the file.

NOCONSOLE   Suppresses output to the main Visual FoxPro window or to the active user-defined window.

 Remarks

LIST OBJECTS displays the following information about all existing objects:

•	Properties and their values

•	Methods

•	Member objects and the class or subclass on which they are based

•	Class or subclass on which objects are based

•	Class hierarchy for the objects

LIST OBJECTS fills the entire main Visual FoxPro window without pausing.


 LIST OBJECTS Command Example

The following example uses DEFINE CLASS and CREATEOBJECT( ) to create two custom classes named FormChild and FormGrandChild from the Visual FoxPro Form base class. LIST OBJECTS lists information about the objects and their properties.

CLEAR

frmMyForm = CREATEOBJECT("FormGrandChild")

LIST OBJECTS LIKE frm*

RELEASE frmMyForm

DEFINE CLASS FormChild AS FORM

ENDDEFINE

DEFINE CLASS FormGrandChild AS FormChild

ENDDEFINE


 See Also

DISPLAY OBJECTS


LIST PROCEDURES Command

Syntax         Arguments         Remarks         Example         See Also

Continuously displays the names of stored procedures in the current database.

 Syntax

LIST PROCEDURES
[TO PRINTER [PROMPT] | TO FILE FileName]
[NOCONSOLE]

 Arguments

TO PRINTER [PROMPT]   Directs the information returned from LIST PROCEDURES to a printer.

You can include PROMPT to display a Print dialog box before printing starts. Place the PROMPT keyword immediately after TO PRINTER.

TO FILE FileName   Directs output from LIST PROCEDURES to the disk file specified with FileName. If the file already exists and SET SAFETY is ON, Visual FoxPro displays a prompt asking if you want to overwrite the file.

NOCONSOLE   Suppresses output to the main Visual FoxPro window or to the active user-defined window.

 Remarks

Stored procedures are created with MODIFY PROCEDURES.


 LIST PROCEDURES Command Example

The following example opens the testdata database and uses LIST PROCEDURES to list the stored procedures (if any) in the database.

CLOSE DATABASES

OPEN DATABASE (SYS(2004) + 'samples\data\testdata')

CLEAR

LIST PROCEDURES  && Lists stored procedures in the database


 See Also

APPEND PROCEDURES
COPY PROCEDURES
CREATE DATABASE
DISPLAY DATABASE
DISPLAY PROCEDURES
MODIFY PROCEDURE


List Property

Syntax         Settings         Remarks         Example         Applies To         See Also

A character string array used to access the items in a ComboBox or ListBox control. Not available at design time; read-write at run time.

 Syntax

Control.List(nRow [, nCol])[ = cChar]

 Settings

nRow   Specifies the row of the item to be retrieved using the display order. For example, nRow = 3 specifies the third row shown in the list.

nCol   Specifies the column of the item to be retrieved using the display order. For example, nCol = 2 specifies the second column shown in the list. If nCol is not specified, the List property retrieves the first column by default. Only specify nCol for ComboBox and ListBox controls that have more than one column.

 Remarks

The List property works in conjunction with the ListCount property; enumerating a list from 1 to ListCount returns all items in the list.

You cannot use array functions with the List property. However, if you set the RowSourceType property to 5 (Array) and set the RowSource property to the array of values to be contained in the list, you can use array functions on the array specified in the RowSource property.

Note   When RowSourceType is set to 0 or 1, add items to a combo box or list box using the AddItem method. To remove items, use the RemoveItem method. To keep items in alphabetic order, set the control’s Sorted property to true (.T.) before adding items to the list.


 List Property Example

In the following example, ListCount is used to cycle through all the of the items specified by the List property of the combo box or list box.

The following example creates a list box. The source of the items that appear in the list box items is an array; the array is specified with the RowSourceType and RowSource properties.

The MultiSelect property for the list box is set to true (.T.), allowing you to make multiple selections from the list box. The ListCount property is used within a FOR ... ENDFOR loop to display the item or items you choose in the list box. The Selected property is used to determine the items you chose, and the List property is used to return the items.

CLEAR

DIMENSION gaMyListArray(10)

FOR gnCount = 1 to 10  && Fill the array with letters

STORE REPLICATE(CHR(gnCount+64),6) TO gaMyListArray(gnCount)

ENDFOR

frmMyForm = CREATEOBJECT('Form')  && Create a Form

frmMyForm.Closable = .F.  && Disable the Control menu box

frmMyForm.Move(150,10)  && Move the form

* Add "Quit" command button and list box control

frmMyForm.AddObject('cmbCommand1','cmdMyCmdBtn')

frmMyForm.AddObject('lstListBox1','lstMyListBox')

* && Specifies an array containing listbox items

frmMyForm.lstListBox1.RowSourceType = 5

frmMyForm.lstListBox1.RowSource = 'gaMyListArray'

frmMyForm.cmbCommand1.Visible =.T.  && "Quit" Command button visible

frmMyForm.lstListBox1.Visible =.T.  && "List Box visible

frmMyForm.SHOW  && Display the form

READ EVENTS  && Start event processing

DEFINE CLASS cmdMyCmdBtn AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 210  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close Form

CLEAR  && Clear main Visual FoxPro window

ENDDEFINE

DEFINE CLASS lstMyListBox AS ListBox  && Create ListBox control

Left = 10  && List Box column

Top = 10  && List Box row

MultiSelect = .T.  && Allow selecting more than 1 item

PROCEDURE Click

ACTIVATE SCREEN

CLEAR

? "Selected items:"

? "---------------"

FOR nCnt = 1 TO ThisForm.lstListBox1.ListCount

IF ThisForm.lstListBox1.Selected(nCnt)  && Is item selected?

? SPACE(5) + ThisForm.lstListBox1.List(nCnt) && Show item

ENDIF

ENDFOR

ENDDEFINE


 Applies To

ComboBox, ListBox


 See Also

AddItem Method
IndexToItemID Method
ItemIDToIndex Method
ListCount Property
ListItem Property
ListItemID Property
RowSource
RowSourceType
Sorted Property


LIST TABLES Command

Syntax         Arguments         Remarks         Example         See Also

Displays without pausing all tables and information about the tables contained in the current database.

 Syntax

LIST TABLES
[TO PRINTER [PROMPT] | TO FILE FileName]
[NOCONSOLE]

 Arguments

TO PRINTER [PROMPT]   Directs the information returned from LIST TABLES to a printer.

You can include PROMPT to display a Print dialog box before printing starts. Place the PROMPT keyword immediately after TO PRINTER.

TO FILE FileName   Directs output from LIST TABLES to the disk file specified with FileName. If the file already exists and SET SAFETY is ON, Visual FoxPro displays a prompt asking if you want to overwrite the file.

NOCONSOLE   Suppresses output to the main Visual FoxPro window or to the active user-defined window.

 Remarks

The information returned includes the table names and paths and is a subset of the information shown using LIST STATUS. However, the information displayed using LIST TABLES contains only table-related information and displays the information regardless of whether the tables are open.


 LIST TABLES Command Example

The following example opens the customer table in the testdata database. LIST TABLES is used to list information about the tables in the database.

CLOSE DATABASES

SET PATH TO (SYS(2004) + 'samples\data\')	&& Sets path to database

OPEN DATABASE testdata  && Open testdata database

CLEAR

LIST TABLES  && Lists information about tables in the database


 See Also

ADD TABLE
CLOSE DATABASES
CREATE DATABASE
DISPLAY TABLES
OPEN DATABASE
REMOVE TABLE


LIST VIEWS Command

Syntax         Arguments         Remarks         Example         See Also

Displays without pausing information about SQL views in the current database.

 Syntax

LIST VIEWS
[TO PRINTER [PROMPT] | TO FILE FileName]
[NOCONSOLE]

 Arguments

TO PRINTER [PROMPT]   Directs the information returned from LIST VIEWS to a printer.

You can include PROMPT to display a Print dialog box before printing starts. Place the PROMPT keyword immediately after TO PRINTER.

TO FILE FileName   Directs output from LIST VIEWS to the disk file specified with FileName. If the file already exists and SET SAFETY is ON, Visual FoxPro displays a prompt asking if you want to overwrite the file.

NOCONSOLE   Suppresses output to the main Visual FoxPro window or to the active user-defined window.

 Remarks

LIST VIEWS displays the names of SQL views in the current database, and indicates if the SQL views are based on local or remote tables. Use DBGETPROP( ) to return additional information about SQL views in the current database.

SQL views are created with CREATE SQL VIEW.


 LIST VIEWS Command Example

The following example opens the testdata database. CREATE SQL VIEW is used to create a local SQL view named myview. The View Designer is displayed, allowing you to specify tables and conditions for the SQL  view. After you save the SQL view you create, information about the SQL views in the database is listed.

CLOSE DATABASES

OPEN DATABASE (SYS(2004) + 'samples\data\testdata')

CREATE SQL VIEW myview

CLEAR

LIST VIEWS


 See Also

CREATE DATABASE
CREATE SQL VIEW
DBGETPROP( )
DISPLAY DATABASE
DISPLAY VIEWS


ListBox Control

Syntax         Remarks         Properties         Events         Methods         Example         See Also

Creates a list box.

 Syntax

ListBox

 Remarks

A list box displays a list of items from which you can select one or more items. A list box is similar to a combo box; however, a combo box initially displays a single item.

For additional information about creating ListBox controls, see the Form Designer topic and Chapter 10, “Using Controls,” in the Developer’s Guide.


 Properties

BaseClass	BorderColor	BoundColumn
BoundTo	Class	ClassLibrary
ColorScheme	ColorSource	ColumnCount
ColumnLines	ColumnWidths	Comment
ControlSource	DisabledBackColor	DisabledForeColor
DisabledItemBackColor	DisabledItemForeColor	DisplayValue
DragIcon	DragMode	Enabled
FirstElement	FontBold	FontCondense
FontExtend	FontItalic	FontName
FontOutline	FontShadow	FontSize
FontStrikeThru	FontUnderLine	Height
HelpContextID	IncrementalSearch	ItemBackColor
ItemData	ItemForeColor	ItemIDData
ItemTips	Left	List
ListCount	ListIndex	ListItem
ListItemID	MousePointer	MoverBars
MultiSelect	Name	NewIndex
NewItemID	NumberOfElements	Parent
ParentClass	RightToLeft	RowSource
RowSourceType	Selected	SelectedID
SelectedItemBackColor	SelectedItemForeColor	Sorted
SpecialEffect	StatusBarText	TabIndex
TabStop	Tag	TerminateRead
ToolTipText	Top	TopIndex
TopItemID	Value	Visible
Width


 Events

Click	DblClick	Destroy
DragDrop	DragOver	Error
ErrorMessage	GotFocus	Init
InteractiveChange	KeyPress	LostFocus
Message	MiddleClick Event	MouseDown
MouseMove	MouseUp	MouseWheel
ProgrammaticChange	RangeHigh	RangeLow
RightClick	UIEnable	Valid
When


 Methods

AddItem	AddListItem	Clear
CloneObject	Drag	IndexToItemID
ItemIDToIndex	Move	ReadExpression
ReadMethod	Refresh	RemoveItem
RemoveListItem	Requery	ResetToDefault
SaveAsClass	SetFocus	WriteExpression
WriteMethod	ZOrder


 ListBox Control Example

The following example creates a ListBox control. The source of the items that appear in the list box is an array specified with the RowSourceType and RowSource properties.

The MultiSelect property for the list box is set to true (.T.), allowing you to make multiple selections from the list. The item or items you choose are displayed by using the ListCount, Selected, and List properties (which determine the number of items in the list and the items you chose).

CLEAR

DIMENSION gaMyListArray(10)

FOR gnCount = 1 to 10  && Fill the array with letters

STORE REPLICATE(CHR(gnCount+64),6) TO gaMyListArray(gnCount)

NEXT

frmMyForm = CREATEOBJECT('Form')  && Create a Form

frmMyForm.Closable = .f.  && Disable the Control menu box

frmMyForm.Move(150,10)  && Move the form

frmMyForm.AddObject('cmbCommand1','cmdMyCmdBtn')  && Add "Quit" Command button

frmMyForm.AddObject('lstListBox1','lstMyListBox')  && Add ListBox control

frmMyForm.lstListBox1.RowSourceType = 5  && Specifies an array

frmMyForm.lstListBox1.RowSource = 'gaMyListArray' && Array containing listbox items

frmMyForm.cmbCommand1.Visible =.T.  && "Quit" Command button visible

frmMyForm.lstListBox1.Visible =.T.  && "List Box visible

frmMyForm.SHOW  && Display the form

READ EVENTS  && Start event processing

DEFINE CLASS cmdMyCmdBtn AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 210  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close Form

CLEAR  && Clear main Visual FoxPro window

ENDDEFINE

DEFINE CLASS lstMyListBox AS ListBox  && Create ListBox control

Left = 10  && List Box column

Top = 10  && List Box row

MultiSelect = .T.  && Allow selecting more than 1 item

PROCEDURE Click

ACTIVATE SCREEN

CLEAR

? "Selected items:"

? "---------------"

FOR nCnt = 1 TO ThisForm.lstListBox1.ListCount

IF ThisForm.lstListBox1.Selected(nCnt)  && Is item selected?

? SPACE(5) + ThisForm.lstListBox1.List(nCnt) && Show item

ENDIF

ENDFOR

ENDDEFINE


 See Also

CREATE CLASS
CREATE FORM
DEFINE CLASS


ListCount Property

Syntax         Example         Applies To         See Also

Contains the number of items in the list portion of a ComboBox or ListBox control. Not available at design time; read-only at run time.

 Syntax

Control.ListCount


 ListCount Property Example

The following example creates a list box. The source of the items that appear in the list box items is an array; the array is specified with the RowSourceType and RowSource properties.

ListCount is used to cycle through all the of the items specified by the List property of the ComboBox or list box.

The MultiSelect property for the list box is set to true (.T.), allowing you to make multiple selections from the list box. The ListCount property is used within a FOR ... ENDFOR loop to display the item or items you choose in the list box. The Selected and List properties are used to determine the items you chose.

CLEAR

DIMENSION gaMyListArray(10)

FOR gnCount = 1 to 10  && Fill the array with letters

STORE REPLICATE(CHR(gnCount+64),6) TO gaMyListArray(gnCount)

ENDFOR

frmMyForm = CREATEOBJECT('Form')  && Create a Form

frmMyForm.Closable = .f.  && Disable the Control menu box

frmMyForm.Move(150,10)  && Move the form

frmMyForm.AddObject('cmbCommand1','cmdMyCmdBtn')  && Add "Quit" Command button

frmMyForm.AddObject('lstListBox1','lstMyListBox')  && Add list box control

frmMyForm.lstListBox1.RowSourceType = 5  && Specifies an array

frmMyForm.lstListBox1.RowSource = 'gaMyListArray' && Array containing listbox items

frmMyForm.cmbCommand1.Visible =.T.  && "Quit" Command button visible

frmMyForm.lstListBox1.Visible =.T.  && "List Box visible

frmMyForm.SHOW  && Display the form

READ EVENTS  && Start event processing

DEFINE CLASS cmdMyCmdBtn AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 210  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close Form

CLEAR  && Clear main Visual FoxPro window

ENDDEFINE

DEFINE CLASS lstMyListBox AS ListBox  && Create ListBox control

Left = 10  && List Box column

Top = 10  && List Box row

MultiSelect = .T.  && Allow selecting more than 1 item

PROCEDURE Click

ACTIVATE SCREEN

CLEAR

? "Selected items:"

? "---------------"

FOR nCnt = 1 TO ThisForm.lstListBox1.ListCount

IF ThisForm.lstListBox1.Selected(nCnt)  && Is item selected?

? SPACE(5) + ThisForm.lstListBox1.List(nCnt) && Show item

ENDIF

ENDFOR

ENDDEFINE


 Applies To

ComboBox, ListBox


 See Also

AddItem Method
List Property
ListItemID Property
RemoveItem Method


ListIndex Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the index number of the selected item in a ComboBox or ListBox control. Not available at design time; read-write at run time.

 Syntax

Control.ListIndex[ = nIndex]

 Settings

nIndex   The settings for the ListIndex property are:

Setting	Description
0	(Default) Indicates no items selected. For a combo box, this means that the user has entered a value not in the list.
1 ... ListCount	The index of the selected item.
 Remarks

The following displays the string of the selected item.

? List(MyList.ListIndex)

You can return the same value by using the control’s Value property.


 Applies To

ComboBox, ListBox


 See Also

AddItem Method
AddListItem Method
IndexToItemID Method
ItemIDToIndex Method
List Property
ListItem Property
RemoveItem Method
Value Property


ListItem Property

Syntax         Settings         Remarks         Applies To         See Also

A character string array used to access the items in a ComboBox or ListBox control by item ID. Not available at design time; read-write at run time.

 Syntax

Control.ListItem(nItemID)[ = cChar]

 Settings

nItemID   Specifies the item to retrieve using the item’s unique ID.

 Remarks

The ListItem property works in conjunction with the ListCount property; enumerating a list from 1 to ListCount returns all items in the list. Use the List property to retrieve items in the order they are displayed; use the ListItem property to retrieve items according to their item ID.

Note   To add items to a combo box or list box, use the AddItem or AddListItem method. To remove items, use the RemovetItem method or the RemoveListItem method. To keep items in alphabetic order, set the control’s Sorted property to true (.T.) before adding items to the list.


 Applies To

ComboBox, ListBox


 See Also

AddItem Method
AddListItem Method
IndexToItemID Method
ItemIDToIndex Method
ListCount Property
List Property
ListItemID Property


ListItemID Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the unique ID number for the selected item in a ComboBox or ListBox control. Not available at design time; read-write at run time.

 Syntax

Control.ListItemID[ = nItemID]

 Settings

nItemID   The settings and interpretations for the ListItemID property are:

Setting	Description
– 1	Indicates no items selected. For a combo box, it means that user has entered a value not in the list.
1 (or any number greater than 1)	The item ID of the selected item.
 Remarks

If an item is removed from a list using the RemoveListItem method, all remaining items retain their unique identification numbers. When an item is added to a list using the AddItem method, and the Sorted property is set to false (.F.), nItemID is assigned the lowest number available. When an item is added to a list using the AddListItem method, and the Sorted property is set to false (.F.), you can assign any number to nItemID.


 Applies To

ComboBox, ListBox


 See Also

AddItem Method
AddListItem Method
IndexToItemID Method
ItemIDToIndex Method
ListCount Property
List Property
ListItem Property
RemoveItem Method
RemoveListItem Method


_LMARGIN System Memory Variable
_LMARGIN System Variable

Included for backward compatibility. Use the Report Designer instead.


LOAD Command

Included for backward compatibility. Use SET LIBRARY instead.


Load Event

Syntax         Parameters         Remarks         Applies To         See Also

Occurs just before an object is created.

 Syntax

PROCEDURE Object.Load
[LPARAMETERS nIndex]

 Parameters

nIndex   Uniquely identifies a control if it is in a control array.

 Remarks

The Load event occurs first for the form set and then for the contained forms. The Load event occurs before the Activate and GotFocus events.


 Applies To

Form, FormSet


 See Also

Activate Event
GotFocus Event
Unload Event


LOADPICTURE( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Creates an object reference for a bitmap, icon, or Windows meta file.

 Syntax

LOADPICTURE([cFileName])

 Returns

Object

 Arguments

cFileName   Specifies the bitmap (.BMP), icon (.ICO), or Windows metafile (.WMF) file for which an object reference is created. If cFileName is omitted, the null picture is returned. You can include GETPICT( ) as cFileName to display the Open dialog from which you can choose a bitmap (.BMP) file.

 Remarks

Many presentation properties of ActiveX controls require an object reference for their settings. For example, the ActiveX Outline control supports the PictureOpen property that requires an object reference for its setting.


 See Also

GETPICT( ), SAVEPICTURE( )


LOCAL Command

Syntax         Arguments         Remarks         See Also

Creates local variables and variable arrays.

 Syntax

LOCAL VarList
 – Or –

LOCAL [ARRAY] ArrayName1(nRows1 [, nColumns1])
[, ArrayName2(nRows2 [, nColumns2])] ...

 Arguments

VarList   Specifies one or more local variables to create.

[ARRAY] ArrayName1 (nRows1 [, nColumns1])
[, ArrayName2 (nRows2 [, nColumns2])] ...   Specifies one or more local arrays to create. See DIMENSION for a description of each argument.

 Remarks

Local variables and variable arrays can be used and modified only within the procedure or function in which they are created, and cannot be accessed by higher or lower level programs. Local variables and arrays are released once the procedure or function containing the local variables and arrays completes execution.

Variables and arrays created with LOCAL are initialized to false (.F.). Any variable or array you wish to declare as local must be declared local prior to assigning it a value. Visual FoxPro generates an error message if you assign a value to a variable or array and later declare it local with LOCAL.

Local variables can be passed by reference.

You cannot abbreviate LOCAL because LOCAL and LOCATE have the same first four letters.


 See Also

DIMENSION
FUNCTION
LPARAMETERS
PARAMETERS
PARAMETERS( )
PRIVATE
PUBLIC
RELEASE


LOCATE Command

Syntax         Arguments         Remarks         Example         See Also

Sequentially searches the table for the first record that matches the specified logical expression.

 Syntax

LOCATE FOR lExpression1
[Scope]
[WHILE]
[NOOPTIMIZE]

 Arguments

FOR lExpression1   Sequentially searches the current table for the first record that matches the logical expression lExpression1.

Rushmore optimizes a query created with LOCATE FOR if lExpression1 is an optimizable expression. For best performance, use an optimizable expression in the FOR clause.

For more information, see SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

Scope   Specifies a range of records to locate. Only the records that fall within the range are located. The scope clauses are: ALL, NEXT nRecords, RECORD nRecordNumber, and REST. Commands that include Scope operate only on the table in the active work area.

The default scope for LOCATE is ALL records.

WHILE lExpression2   Specifies a condition whereby records are searched for as long as the logical expression lExpression2 evaluates to true (.T.).

NOOPTIMIZE   Disables Rushmore optimization of LOCATE.

For more information, see SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

 Remarks

The table doesn’t have to be indexed.

If LOCATE finds a matching record, you can use RECNO( ) to return the number of the matching record. If a matching record is found, FOUND( ) returns true (.T.), and EOF( ) returns false (.F.). If SET TALK is ON, the record number of the matching record is displayed.

After LOCATE finds a matching record, you can issue CONTINUE to search the remainder of the table for additional matching records. When CONTINUE is executed, the search process resumes, starting with the record immediately following the matching record. You can issue CONTINUE repeatedly until the end of the scope or the end of the table is reached.

If a match isn’t found, RECNO( ) returns the number of records in the table plus 1, FOUND( ) returns false (.F.), and EOF( ) returns true (.T.).

LOCATE and CONTINUE are specific to the current work area. If another work area is selected, the original search process can be continued when the original work area is reselected.


 LOCATE Command Example

In the following example, records for customers from Germany are located. The total count is then displayed.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Open Customer table

SET TALK OFF

STORE 0 TO gnCount

LOCATE FOR ALLTRIM(UPPER(customer.country)) = 'GERMANY'

DO WHILE FOUND( )

gnCount = gnCount + 1

? company

CONTINUE

ENDDO

? 'Total companies Germany: '+ LTRIM(STR(gnCount))


 See Also

CONTINUE
EOF( )
FIND
FOUND( )
RECNO( )
SEEK
SEEK( )
SET OPTIMIZE


LOCFILE( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Locates a file on disk and returns the file name with its path.

 Syntax

LOCFILE(cFileName [, cFileExtensions] [, cDialogCaption])

 Returns

Character

 Arguments

cFileName   Specifies the name of the file to locate. If cFileName includes only a file name, LOCFILE( ) searches the Visual FoxPro default directory or folder first. If the file isn’t found in the default directory or folder, the Visual FoxPro path is then searched. Use SET PATH to specify the Visual FoxPro path.

If cFileName includes a path and a file name, the specified location is searched. If the file can’t be found in the specified location, LOCFILE( ) searches the Visual FoxPro default directory or folder and then the Visual FoxPro path.

If the file is located, LOCFILE( ) returns the file name and path.

cFileExtensions   Specifies file extensions for the file to locate. If the file name you specify with cFileName doesn’t include an extension, Visual FoxPro applies the file extensions listed in cFileExtensions to the file name and searches for the file again.

cFileExtensions also specifies the file name extensions of the files displayed in the Open dialog box when the file you specified can’t be located.

cFileExtensions can take a variety of forms:

•	If cFileExtensions contains a single extension (for example, PRG), only files with that extension are displayed.

•	cFileExtensions can also contain wildcards (* and ?). All files with extensions that meet the wildcard criteria are displayed. For example, if cFileExtensions is ?X?, all files with the extension .FXP, .EXE, or .TXT are displayed.

•	In Visual FoxPro for Windows, cFileExtensions can contain a file description followed by a file extension or a list of file extensions separated with commas. The file description appears in the Files of Type list box. Separate the file description from the file extension or list of file extensions with a colon (:). Separate multiple file descriptions and their file extensions with a semicolon (;).

For example, if cFileExtensions is “Text:TXT” the file description “Text” appears in the Files of Type list box and all files with a .TXT extension are displayed.

If cFileExtensions is “Tables:DBF; Files:TXT,BAK” the file descriptions “Tables” and “Files” appear in the Files of Type list box. When “Tables” is chosen from the Files of Type list box, all files with a .DBF extension are displayed. When “Files” is chosen from the Files of Type list box, all files with .TXT and .BAK extensions are displayed.

cDialogCaption   Specifies the text you want to use to prompt the user. The text appears in the Open dialog box.

 Remarks

The Open dialog box is displayed if the file can’t be located in the default directory or folder, the Visual FoxPro path, or a specified location. The Open dialog box can be used to locate the file. When a file is chosen from the Open dialog box, the file name is returned with the file’s path.

If you exit the Open dialog box by choosing Cancel, pressing ESC, or choosing Close from the Control menu, Visual FoxPro generates an error message and LOCFILE( ) doesn’t return a value.


 See Also

FILE( )
GETFILE( )
GETPICT( )
PUTFILE( )
SET PATH


LOCK( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Attempts to lock one or more records in a table.

 Syntax

LOCK([nWorkArea | cTableAlias]
| [cRecordNumberList, nWorkArea | cTableAlias])

 Returns

Logical

 Arguments

nWorkArea | cTableAlias   Attempts a lock on the current record in a table open in a specific work area. nWorkArea specifies the work area number and cTableAlias specifies the table alias. If you don’t specify a work area or table alias, LOCK( ) attempts to lock the current record in the table in the current work area.

cRecordNumberList   Specifies a list of one or more record numbers which you must include to attempt to lock multiple records. SET MULTILOCKS must be ON and you must include the work area or alias of the table for which you are attempting to place multiple record locks.

LOCK( ) attempts to lock all of the records you specify. The record numbers specified with cRecordNumberList are separated by commas. For example, to attempt record locks on the first four records in a table, cRecordNumberList must contain 1,2,3,4.

You can also lock multiple records by moving the record pointer to the record you would like to lock, issuing LOCK( ) or RLOCK( ) and then repeating these steps for each additional record.

In Visual FoxPro, you can specify 0 as a record number. Specifying 0 lets you attempt to lock the table header.

Important     Keep the table header locked for as short a time as possible because other users cannot add records to the table when the table header is locked.

Release the table header lock with UNLOCK RECORD 0, UNLOCK or UNLOCK ALL.

If all the records specified in cRecordNumbers are successfully locked, LOCK( ) returns true (.T.). If even one of the records specified with cRecordNumbers can’t be locked, LOCK( ) returns false (.F.) and none of the records are locked. However, any existing record locks remain in place. Multiple record locking is an additive process. Placing additional record locks doesn’t release locks on other records.

The maximum number of records that can be locked in each work area is approximately 8,000. It is always faster to lock the entire table rather than even a small number of records.

 Remarks

LOCK( ) is identical to RLOCK( ).

If the lock or locks are successfully placed, LOCK( ) returns true (.T.). Locked records are available for both read and write access to the user who placed the locks; they are available for read-only access to all other users on the network.

Executing LOCK( ) doesn’t guarantee that the record lock or locks will be successfully placed. A record lock can’t be placed on a record already locked by another user or in a table locked by another user. If the record lock or locks can’t be placed for any reason, LOCK( ) returns false (.F.).

By default, LOCK( ) makes one attempt to lock a record. Use SET REPROCESS to automatically retry a record lock when the first attempt fails. SET REPROCESS determines the number of lock attempts or the length of time during which lock attempts are made when the initial lock attempt is unsuccessful. For more information, see SET REPROCESS.

SET MULTILOCKS determines whether you can lock multiple records in a table. If SET MULTILOCKS is OFF (the default), you can lock only a single record in a table. When SET MULTILOCKS is ON, you can lock multiple records in a table. For more information, see SET MULTILOCKS.

Unlocking Records   A table record can be unlocked only by the user who placed the lock. You can release record locks by issuing UNLOCK, closing the table or exiting Visual FoxPro.

UNLOCK can be used to release record locks in the current work area, a specific work area, or in all work areas. For more information, see UNLOCK.

Switching SET MULTILOCKS from ON to OFF or from OFF to ON implicitly performs UNLOCK ALL — all record locks in all work areas are released.

Tables can be closed with USE, CLEAR ALL, or CLOSE DATABASES.

For more information about record and file locking and sharing tables on a network, see Chapter 17, “Programming for Shared Access,” in the Developer’s Guide.


 LOCK( ) Function Example

The following example locks and unlocks the first four records in the customer and employee tables.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

SET REPROCESS TO 3 AUTOMATIC

STORE '1,2,3,4' TO gcRecList

gcOldExc = SET('EXCLUSIVE')

SET EXCLUSIVE OFF

SELECT 0

USE employee  && Open Employee table

SELECT 0

USE customer  && Open Customer table

? LOCK('1,2,3,4', 'customer')  && Lock 1st 4 records in customer

? RLOCK(gcRecList, 'employee')  && Lock 1st 4 records in employee

UNLOCK IN customer

UNLOCK IN employee

SET EXCLUSIVE &gcOldExc


 See Also

CLEAR
CLOSE
FLOCK( )
RLOCK( )
SET MULTILOCKS
SET REPROCESS
UNLOCK
USE


LockScreen Property

Syntax         Settings         Remarks         Applies To         See Also

Determines whether a form batches all changes to property settings for its contained objects. Available at design time and run time.

 Syntax

Object.LockScreen[ = lExpr]

 Settings

lExpr   The settings for the LockScreen property are:

Setting	Description
True (.T.)	The form’s contained objects reflect changes in property settings only when LockScreen is reset to false (.F.) rather than as soon as the changes are made.
False (.F.)	(Default) The form’s contained objects reflect changes in property settings as soon as the changes are made.
 Remarks

Set LockScreen to true (.T.) to reduce annoying screen refreshes when presentation properties such as BackColor, FontName, and so on are changed during run time.

The LockScreen property does not prevent changes to the form from being reflected immediately. For example, even if LockScreen is set to true, the form is moved if you call its Move method.

Note   If you set LockScreen to false (.F.), the form’s contained controls are repainted immediately.


 Applies To

Form, _SCREEN, ToolBar


 See Also

Paint Event


LOG( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the natural logarithm (base e) of the specified numeric expression.

 Syntax

LOG(nExpression)

 Returns

Numeric

 Arguments

nExpression   Specifies the numeric expression for which LOG( ) returns the value of x in the equation e^x = nExpression. nExpression must be greater than 0.

 Remarks

The base for the natural logarithm is the constant e. The number of decimal places returned in the result is specified with SET DECIMALS.


 LOG( ) Function Example

CLEAR

? LOG(1)  && Displays 0.00

STORE EXP(2) TO gneSquare

? LOG(gneSquare)  && Displays 2.00


 See Also

EXP( )
LOG10( )
SET DECIMALS


LOG10( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the common logarithm (base 10) of the specified numeric expression.

 Syntax

LOG10(nExpression)

 Returns

Numeric

 Arguments

nExpression   Specifies the numeric expression for which LOG10( ) returns the value of x in the equation 10^x = nExpression. nExpression must be greater than 0.

 Remarks

The base for the common logarithm is 10. The number of decimal places returned in the result is specified with SET DECIMALS.


 LOG10( ) Function Example

CLEAR

? LOG10(10)  && Displays 1.00

STORE 100 TO gnBaseTen

? LOG10(gnBaseTen)  && Displays 2.00

? LOG10(gnBaseTen^2)  && Displays 4.00


 See Also

EXP( )
LOG( )
SET DECIMALS


LOOKUP( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Searches a table for the first record with a field matching the specified expression.

 Syntax

LOOKUP(ReturnField, eSearchExpression, SearchedField [, cTagName])

 Returns

Character, Numeric, Currency, Float, Integer, Double, Date, DateTime, or Logical

 Arguments

ReturnField   Specifies the field whose contents LOOKUP( ) returns when the search is successful. If the search is unsuccessful, LOOKUP( ) returns an empty character string of the same length and data type as ReturnField.

eSearchExpression   Specifies the search expression. The search expression is usually the contents of a field in the table, or it can correspond to the index expression of the active index or compound index tag.

SearchedField   Specifies the field to search. If the table doesn’t have an active index, LOOKUP( ) performs a sequential search through the field specified with SearchedField.

If an index file or index tag is open whose index key expression is the search field you specify, LOOKUP( ) uses the index file or index tag to perform a faster search.

cTagName   Specifies the name of a compound index tag for LOOKUP( ) to use in the search. A compound index search is the fastest search LOOKUP( ) can perform.

 Remarks

If the search is successful, LOOKUP( ) moves the record pointer to the matching record and returns the contents of a specified field in the record.

If the search expression isn’t found, LOOKUP( ) returns a blank character string the same length and data type as ReturnField. The record pointer is positioned at the end of the file.

If LOOKUP( ) is used to search a parent table, record pointers in all related child tables are moved to the related records.

This function can’t be optimized with Rushmore.


 LOOKUP( ) Function Example

In the following example, LOOKUP( ) uses the index tag company to search for the first occurrence of the string “Ernst Handel.” If the search is successful, LOOKUP( ) returns the contents of the contact field and @ ... SAY displays the return value.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer ORDER company  && Open Customer table

CLEAR

@ 2,2 SAY LOOKUP(contact, 'Ernst Handel', company, 'company')


 See Also

FIND
INDEX
LOCATE
SEEK
SEEK( )


LostFocus Event

Syntax         Parameters         Remarks         Applies To         See Also

Occurs when an object loses the focus.

 Syntax

PROCEDURE Object.LostFocus
[LPARAMETERS nIndex]

 Parameters

nIndex   Uniquely identifies a control if it is in a control array.

 Remarks

The timing of this event occurs depends on the type of object:

•	A control loses the focus by user action, such as tabbing to or clicking another control, or by changing the focus in code using the SetFocus method. A Grid loses the focus when a user presses CTRL+TAB in Windows or CONTROL+TAB on the Macintosh to exit the Grid.

•	A form loses the focus only when the form has no controls, or all its controls have their Enabled and Visible properties set to false (.F.).

For forms, the LostFocus event occurs before the Deactivate event.


 Applies To

CheckBox, ComboBox, CommandButton, Container Object, Control Object, EditBox, Form, ListBox, OLE Bound Control, OLE Container Control, OptionButton, Spinner, TextBox


 See Also

Deactivate Event
Enabled Property
GotFocus Event
Visible Property


LOWER( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns a specified character expression in lowercase letters.

 Syntax

LOWER(cExpression)

 Returns

Character

 Arguments

cExpression   Specifies the character expression LOWER( ) converts.

 Remarks

LOWER( ) converts all uppercase letters (A – Z) in the character expression to lowercase (a – z). All other characters in the character expression remain unchanged.


 LOWER( ) Function Example

STORE 'FOX' TO gcName

CLEAR

? LOWER(gcName)  && Displays fox


 See Also

ISALPHA( )
ISLOWER( )
ISUPPER( )
PROPER( )
UPPER( )


LPARAMETERS Command

Syntax         Arguments         Remarks         See Also

Assigns data passed from a calling program to local variables or arrays.

 Syntax

LPARAMETERS ParameterList

 Arguments

ParameterList   Specifies the local variable or array names to which the data is assigned.

Parameters within ParameterList are separated by commas. There must be at least as many parameters in the LPARAMETERS statement as in the DO ... WITH statement. If more variables or arrays are listed in the LPARAMETERS statement than are passed by DO ... WITH, the remaining variables or arrays are initialized to false (.F.). A maximum of 27 parameters can be passed.

You can use PARAMETERS( ) to determine the number of parameters passed to the most recently executed program, procedure, or user-defined function.

 Remarks

LPARAMETERS creates local variables or arrays within a called program, procedure, or user-defined function. Use PARAMETERS to create private variables or arrays.

LPARAMETERS must be the first executable statement in the called program, procedure, or user-defined function if you pass values, variables, or arrays to the program, procedure, or user-defined function.

By default, DO ... WITH passes variables and arrays to procedures by reference. When a value is changed in the called procedure, the new value is passed back to the associated variable or array in the calling program. If you want to pass a variable or array to a procedure by value, enclose the variable or array in parentheses in the DO ... WITH parameter list. Any changes made to the parameter in the called procedure are not passed back to the calling program.

Variables are by default passed by reference to a procedure and by value to a user-defined function. Use SET UDFPARMS TO REFERENCE to pass variables to a user-defined function by reference.


 See Also

DO
FUNCTION
LOCAL
PARAMETERS( )
PRIVATE
PROCEDURE
PUBLIC
SET UDFPARMS


LTRIM( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the specified character expression with leading blanks removed.

 Syntax

LTRIM(cExpression)

 Returns

Character

 Arguments

cExpression   Specifies the character expression whose leading blanks LRTRIM( ) removes.

 Remarks

This function is especially useful for removing the leading blanks that are inserted when you use STR( ) to convert a numeric value to a character string.


 LTRIM( ) Function Example

STORE 'Redmond' TO gcCity

STORE '         Washington' TO gcState

CLEAR

? gcCity, gcState  && Displays Redmond         Washington

? gcCity, LTRIM(gcState)  && Displays Redmond Washington


 See Also

ALLTRIM( )
LEFT( )
RIGHT( )
RTRIM( )
SUBSTR( )
TRIM( )


LUPDATE( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the date on which a table was last updated.

 Syntax

LUPDATE([nWorkArea | cTableAlias])

 Returns

Date

 Arguments

nWorkArea | cTableAlias   Returns the last update to a table open in another work area. nWorkArea specifies the work area number and cTableAlias specifies the table alias. LUPDATE( ) returns the date of the last update to the table in the currently selected work area if you omit nWorkArea and cTableAlias.

If no table is open in the work area you specify, LUPDATE( ) returns a blank date. If no table has the alias you specify, Visual FoxPro generates an error message.

 Remarks

This function is useful in update procedures.


 LUPDATE( ) Function Example

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Open Customer table

CLEAR

? LUPDATE( )  && Displays date of last update


 See Also

DIR
FDATE( )
FTIME( )


_MAC System Memory Variable
_MAC System Variable

Syntax         Remarks         See Also

Contains true (.T.) if the user is using FoxPro for Macintosh® or Visual FoxPro for Macintosh.

 Syntax

_MAC = lExpression

 Remarks

_MAC contains false (.F.) for any other platform version of FoxPro (Visual FoxPro for Windows, FoxPro for Windows, FoxPro for MS-DOS, or FoxPro for UNIX).

The value contained in _MAC cannot be changed with STORE or =.


 See Also

_DOS
_UNIX
VERSION( )
_WINDOWS


  MacDesktop Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether a form is placed in the main Visual FoxPro window.

 Syntax

Object.MacDesktop[ = nValue]

 Settings

nValue   The settings for the MacDesktop property are:

Setting	Description
0	(Default) Automatic. The form is contained in the Visual FoxPro main window according to the setting established with the SET MACDESKTOP command. If SET MACDESKTOP is set to ON, the form exists at the level of the Macintosh desktop; if set to OFF, the form is contained within the Visual FoxPro main window.
1	Macintosh Desktop. The form exists at the level of the Macintosh desktop, and can be moved and resized independently of the main Visual FoxPro window.
2	Visual FoxPro Desktop. The form is contained in the Visual FoxPro main window and cannot be moved outside it.
 Remarks

Setting the MacDesktop property enables you to override for individual forms the setting established with the SET MACDESKTOP command. SET MACDESKTOP affects user-defined windows (forms) and system windows such as the Browse, View, and Form Designer windows. By default, user-defined windows behave according to the SET MACDESKTOP setting.

The MacDesktop property enables you to control whether your applications resemble Macintosh applications or Windows applications.


 Applies To

Form


 See Also

SET KEYCOMP


Margin Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the margin width created in the text portion of the control. Available at design time and run time.

 Syntax

Control.Margin[ = nValue]

 Settings

nValue   Specifies the margin created in the text portion of the control.

 Remarks

Use the Margin property to specify the position of text on the control. The Margin property creates a margin in the interior portion of the control; it doesn't affect the size of the control.


 Applies To

ComboBox, EditBox, Spinner, TextBox


 See Also

Alignment Property


MAX( ) Function

Syntax         Returns         Arguments         Example         See Also

Evaluates a set of expressions and returns the expression with the maximum value.

 Syntax

MAX(eExpression1, eExpression2 [, eExpression3 ...])

 Returns

Character, Numeric, Currency, Double, Float, Date, or DateTime

 Arguments

eExpression1, eExpression2 [, eExpression3 ...]   Specify the expressions from which you want MAX( ) to return the expression with the highest value. All the expressions must be of the same data type.


 MAX( ) Function Example

The following example uses APPEND BLANK to create a table with 10 records containing random values, then uses MIN( ) and MAX( ) to display the maximum and minimum values in the table.

CLOSE DATABASES

CREATE TABLE Random (cValue N(3))

FOR nItem = 1 TO 10  && Append 10 records,

APPEND BLANK

REPLACE cValue WITH 1 + 100 * RAND( )  && Insert random values

ENDFOR

CLEAR

LIST  && Display the values

gnMaximum = 1  && Initialize minimum value

gnMinimum = 100  && Initialize maximum value

SCAN

gnMinimum = MIN(gnMinimum, cValue)

gnMaximum = MAX(gnMaximum, cValue)

ENDSCAN

? 'The minimum value is: ', gnMinimum  && Display minimum value

? 'The maximum value is: ', gnMaximum  && Display maximum value


 See Also

CALCULATE
MIN( )
SELECT - SQL


MaxButton Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether a form has a Maximize button. Available at design time and run time.

 Syntax

Object.MaxButton[ = lExpr]

 Settings

lExpr   The settings for the MaxButton property are:

Setting	Description
True (.T.)	(Default) The form has a Maximize button.
False (.F.)	The form doesn't have a Maximize button.
 Remarks

A Maximize button enables a user to enlarge a form to full-screen size.

A Maximize button automatically becomes a Restore button when a window is maximized. Minimizing, or restoring, a window automatically changes the Restore button back to a Maximize button.

The settings you specify for MaxButton, MinButton, BorderStyle, and ControlBox are not reflected in the form’s appearance until run time.

Maximizing a form at run time triggers the Resize event.

The WindowState property reflects the current state of the window. If you set the WindowState property to 2 (Maximized), the form is maximized independently of whatever settings are in effect for the MaxButton and BorderStyle properties.


 Applies To

Form, _SCREEN


 See Also

BorderStyle Property
ControlBox Property
MinButton Property
Resize Event
WindowState Property


MaxHeight Property

Syntax         Settings         Remarks         Applies To         See Also

Determines the maximum height to which a form can be sized. Available at design time and run time.

 Syntax

Object.MaxHeight[ = nHeight]

 Settings

nHeight   The maximum height, in the unit of measurement specified by the ScaleMode property of the form.

 Remarks

When the user sizes a form by choosing either the Size command from the Control menu or by dragging the borders of the form, the form doesn't exceed the height specified in the MaxHeight property setting.

The default setting for the MaxHeight property is  – 1; no maximum height is specified.


 Applies To

Form, _SCREEN


 See Also

ScaleMode Property


MaxLeft Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the distance a maximized form is from the left edge of the main Visual FoxPro window. Available at design time and run time.

 Syntax

Object.MaxLeft[ = nMaxLeft]

 Settings

nMaxLeft   Specifies the distance from the left edge of the main Visual FoxPro window to the left edge of the maximized form, in the unit of measurement specified by the ScaleMode property of the form.

 Remarks

Use the MaxLeft property to ensure that a maximized form doesn't get moved too far to the left in the main Visual FoxPro window at run time.


 Applies To

Form, _SCREEN


 See Also

MaxTop Property
MaxWidth Property
MinHeight Property
Scalemode Property


MaxLength Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the maximum length (in characters) that can be entered in an EditBox or TextBox control. Available at design time and run time.

 Syntax

Control.MaxLength[ = nMaxLength]

 Settings

nMaxLength   The maximum number of characters that can be entered in an edit box or text box. If nMaxLength is set to 0, there is no limit to the number of characters that can be entered into an edit box. The number of characters that can be entered into a text box when nMaxLength is set to 0 is determined by the size of the textbox and its data type.

 Remarks

Use MaxLength to limit the amount of text a user can enter in an edit box or text box. MaxLength only applies for a text box when MaxLength is greater than zero, the text box does not use the InputMask property, and its Value property is of character type.


 Applies To

EditBox, TextBox


 See Also

SelLength Property


MaxTop Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the distance a maximized form is from the top edge of the main Visual FoxPro window. Available at design time and run time.

 Syntax

Object.MaxTop[ = nMaxTop]

 Settings

nMaxTop   Specifies the distance from the top edge of the main Visual FoxPro window to the top edge of the maximized form, in the unit of measurement specified by the ScaleMode property of the form.

 Remarks

This property is ignored in Visual FoxPro for the Macintosh.

Use the MaxTop property to ensure that a maximized form doesn't get moved too close to the top of the main Visual FoxPro window at run time.


 Applies To

Form, _SCREEN


 See Also

MaxLeft Property
MaxWidth Property
MinHeight Property
MinWidth Property
Scalemode Property


MaxWidth Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the maximum width a form can be resized to. Available at design time and run time.

 Syntax

Object.MaxWidth[ = nMaxWidth]

 Settings

nMaxWidth   Specifies the maximum width a form can be resized to, in the unit of measurement specified by the ScaleMode property of the form.

 Remarks

When the user sizes a form by choosing either the Size command from the Control menu the borders of the form, the form doesn't exceed the width specified in the MaxWidth property setting.

The default for the MaxWidth property setting is  – 1; no maximum width is specified.


 Applies To

Form, _SCREEN


 See Also

MaxHeight Property
MinHeight Property
MinWidth Property
ScaleMode Property


MCOL( ) Function

Syntax         Returns         Arguments         See Also

Returns the column position of the mouse pointer in the main Visual FoxPro window or a user-defined window.

 Syntax

MCOL([cWindowName [, nScaleMode]])

 Returns

Numeric

 Arguments

cWindowName   Specifies the name of the window whose mouse-pointer column position MCOL( ) returns.

If you omit cWindowName and there is no active user-defined window, MCOL( ) returns the mouse pointer’s column position in the main Visual FoxPro window. If you omit cWindowName and there is an active user-defined window, MCOL( ) returns the mouse pointer’s column position in the active user-defined window. MCOL( ) returns –1 if the mouse pointer is positioned outside the user-defined window or if no mouse driver is loaded and there is no output window.

nScaleMode   Specifies the unit of measurement for the value MCOL( ) returns. The settings for nScaleMode are:

nScaleMode	Description
0	(Default) Foxels. A foxel is equivalent to the average height and width of a character based on the current font of the form in which an object is contained. Foxels are useful in developing cross-platform applications for character-based and graphical platforms.
3	Pixels. A pixel is the smallest element that can be displayed on a screen or printer. Pixels are screen-dependent.


 See Also

COL( )
INKEY( )
ISMOUSE( )
MROW( )
ROW( )
WCOLS( )
WROWS( )


MENU( ) Function

Syntax         Returns         Remarks         Example         See Also

Returns the name of the active menu bar as an uppercase character string.

 Syntax

MENU( )

 Returns

Character

 Remarks

MENU( ) returns an empty string if no menu is active. Use the Menu Designer to create a menu and activate it.


 MENU( ) Function Example

The following example uses MENU( ) to pass the name of a menu bar to a procedure. The current system menu bar is saved to memory with SET SYSMENU SAVE, and all system menu titles are removed with SET SYSMENU TO.

Several system menu titles are created with DEFINE PAD. When you choose a menu title, MENU( ) passes the name of the Visual FoxPro system menu bar, _MSYSMENU, to the choice procedure. The choice procedure displays the name of the menu title you chose and the name of the system menu bar. If you choose the Exit menu, the original Visual FoxPro system menu is restored.

*** Save this program as MENUEXAM.PRG in the default VFP directory.***

CLEAR

SET SYSMENU SAVE

SET SYSMENU TO

DEFINE PAD padSys OF _MSYSMENU PROMPT '\<System' COLOR SCHEME 3 ;

KEY ALT+S, ''

DEFINE PAD padEdit OF _MSYSMENU PROMPT '\<Edit' COLOR SCHEME 3 ;

KEY ALT+E, ''

DEFINE PAD padRecord OF _MSYSMENU PROMPT '\<Record' COLOR SCHEME 3 ;

KEY ALT+R, ''

DEFINE PAD padWindow OF _MSYSMENU PROMPT '\<Window' COLOR SCHEME 3 ;

KEY ALT+W, ''

DEFINE PAD padReport OF _MSYSMENU PROMPT 'Re\<ports' COLOR SCHEME 3 KEY ALT+P, ''

DEFINE PAD padExit OF _MSYSMENU PROMPT 'E\<xit' COLOR SCHEME 3 ;

KEY ALT+X, ''

ON SELECTION MENU _MSYSMENU ;

DO choice IN menuexam WITH PAD(), MENU()

PROCEDURE choice

PARAMETER gcPad, gcMenu

WAIT WINDOW 'You chose ' + gcPad + ;

' from menu ' + gcMenu NOWAIT

IF gcPad = 'PADEXIT'

SET SYSMENU TO DEFAULT

ENDIF


 See Also

ACTIVATE MENU
CREATE MENU
DEFINE MENU


MENU TO Command

Included for backward compatibility. Use the Visual FoxPro Menu Designer instead.


Message Event

Included for backward compatibility. Use the StatusBarText property instead.


MESSAGE( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns either the current error message as a character string or the contents of the program line that caused the error.

 Syntax

MESSAGE([1])

 Returns

Character

 Arguments

1   If MESSAGE( ) is used in an ON ERROR routine, include this argument to return the program source code that caused the error. If the program source code isn’t available, MESSAGE(1) returns one of the following:

•	The entire program line if the line is macro substituted.

•	A command if the line contains a command without any additional clauses.

•	A command followed by three dots (...) if the line contains a command and additional clauses.

 Remarks

Unlike ERROR( ), MESSAGE( ) isn’t reset by RETURN or RETRY.


 MESSAGE( ) Function Example

The following example displays output from MESSAGE( ) and MESSAGE(1).

ON ERROR DO Errhand

*** The next line should generate an error ***

USE Nodatabase

ON ERROR	  && restore system error handler

PROCEDURE Errhand

? 'Line of code with error: ' + MESSAGE(1)

? 'Error number: ' + STR(ERROR( ))

? 'Error message: ' + MESSAGE( )


 See Also

ERROR( )
ON ERROR


MESSAGEBOX( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Displays a user-defined dialog box.

 Syntax

MESSAGEBOX(cMessageText [, nDialogBoxType [, cTitleBarText]])

 Returns

Numeric

 Arguments

cMessageText   Specifies the text that appears in the dialog box. Use a carriage return (CHR(13)) in cMessageText to move a portion of the message to the next line in the dialog box. The height and width of the dialog box is increased as necessary to contain cMessageText.

nDialogBoxType   Specifies the buttons and icons that appear in the dialog box, the default button when the dialog box is displayed, and the behavior of the dialog box.

In the following tables, the dialog box button values 0 to 5 specify the buttons that appear in the dialog box. The icon values 16, 32, 48, and 64 specify the icon that appears in the dialog box. The default values 0, 256, and 512 specify which button in the dialog box is the default button. The default button is selected when the dialog box is displayed.

Omitting nDialogBoxType is identical to specifying a value of 0 for nDialogBoxType.

Value	Dialog box buttons
0	OK button only.
1	OK and Cancel buttons.
2	Abort, Retry, and Ignore buttons.
3	Yes, No, and Cancel buttons.
4	Yes and No buttons.
5	Retry and Cancel buttons.
Value	Icon
16	Stop sign.
32	Question mark.
48	Exclamation point.
64	Information (i) icon.
Value	Default button
0	First button.
256	Second button.
512	Third button.
nDialogBoxType can be the sum of up to three values — one value from each of the preceding tables. For example, if nDialogBoxType is 290 (2+32+256), the specified dialog box has the following characteristics:

•	Abort, Retry, and Ignore buttons.

•	The message box displays the question mark icon.

•	The second button, Retry, is the default.

cTitleBarText   Specifies the text that appears in the title bar of the dialog box. If you omit cTitleBarText, the title “Microsoft Visual FoxPro” appears in the title bar.

 Remarks

The value MESSAGEBOX( ) returns indicates which button in the dialog box was chosen. In dialog boxes with a Cancel button, pressing ESC to exit the dialog box returns the same value (2) as choosing Cancel.

Note that the shortest abbreviation for this function is MESSAGEB( ).

The following table lists the values MESSAGEBOX( ) returns for each button.

Return value	Button
1	OK
2	Cancel
3	Abort
4	Retry
5	Ignore
6	Yes
7	No


 MESSAGEBOX( ) Function Example

The following example displays a user-defined dialog box. The message “Record not found. Would you like to search again?” is displayed as the caption in the user-defined dialog box, and “My Application” is displayed in the title bar.

The user-defined dialog box contains Yes and No buttons and the question mark icon, and the second button (No) is the default button. When you choose one of the buttons, your choice is displayed.

cMessageTitle = 'My Application'

cMessageText = 'Record not found. Would you like to search again?'

nDialogType = 4 + 32 + 256

*  4 = Yes and No buttons

*  32 = Question mark icon

*  256 = Second button is default

nAnswer = MESSAGEBOX(cMessageText, nDialogType, cMessageTitle)

DO CASE

CASE nAnswer = 6

WAIT WINDOW 'You chose Yes'

CASE nAnswer = 7

WAIT WINDOW 'You chose No'

ENDCASE


 See Also

WAIT


MiddleClick Event

Syntax         Parameters         Applies To         See Also

Occurs when the user clicks the middle mouse button on a three button mouse over a control.

 Syntax

PROCEDURE Control.MiddleClick
[LPARAMETERS nIndex]

 Parameters

nIndex   Uniquely identifies a control if it is in a control array.


 Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, Container, Control, EditBox, Form, Grid, Header, Image, Label, Line, ListBox, OptionButton, OptionGroup, Page, PageFrame, Shape, Spinner, TextBox, ToolBar


 See Also

Click Event, DblClick Event, DragDrop Event, DragOver Event, DropDown Event, Enabled Property, KeyPress Event, MouseDown Event, MouseMove Event, MouseUp Event, Scrolled Event, Undock Event


MIN( ) Function

Syntax         Returns         Arguments         Example         See Also

Evaluates a set of expressions and returns the expression with the minimum value.

 Syntax

MIN(eExpression1, eExpression2 [, eExpression3 ...])

 Returns

Character, Numeric, Currency, Double, Float, Date, or DateTime

 Arguments

eExpression1, eExpression2 [, eExpression3 ...]   Specify the set of expressions from which you want MIN( ) to return the expression with the lowest value. All the expressions must be of the same type.


 MIN( ) Function Example

The following example uses APPEND BLANK to create a table with 10 records containing random values, then uses MIN( ) and MAX( ) to display the maximum and minimum values in the table.

CLOSE DATABASES

CREATE TABLE Random (cValue N(3))

FOR nItem = 1 TO 10  && Append 10 records,

APPEND BLANK

REPLACE cValue WITH 1 + 100 * RAND( )  && Insert random values

ENDFOR

CLEAR

LIST  && Display the values

gnMaximum = 1  && Initialize minimum value

gnMinimum = 100  && Initialize maximum value

SCAN

gnMinimum = MIN(gnMinimum, cValue)

gnMaximum = MAX(gnMaximum, cValue)

ENDSCAN

? 'The minimum value is: ', gnMinimum  && Display minimum value

? 'The maximum value is: ', gnMaximum  && Display maximum value


 See Also

CALCULATE
MAX( )


MinButton Property

See Also

Specifies whether a form has a Minimize button. Available at design time and run time.

 Syntax

Object.MinButton[ = lExpr]

 Settings

lExpr   The settings for the MinButton property are:

Setting	Description
True (.T.)	(Default) The form has a Minimize button.
False (.F.)	The form doesn't have a Minimize button.
 Remarks

A Minimize button enables users to minimize a Form window to an icon.

The settings you specify for MaxButton, MinButton, BorderStyle, and ControlBox are not reflected in the Form’s appearance until run time.

In Microsoft Windows version 3.0 or later, an MDI child form is displayed with a Minimize button regardless of the setting of MinButton. However, if MinButton is set to false (.F.), it doesn't respond to clicks, and the corresponding Minimize command isn’t on the form’s Control-box menu.

Minimizing a form to an icon at run time generates a Resize event.

The WindowState property reflects the current state of the window. If you set the WindowState property to 1 (Minimized), the Form is minimized independently of whatever settings are in effect for the MinButton and BorderStyle properties.


 Applies To

Form, _SCREEN


 See Also

BorderStyle Property
ControlBox Property
MaxButton Property
WindowState Property


MinHeight Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the minimum height that a form can be resized to. Available at design time and run time.

 Syntax

Object.MinHeight[ = nHeight]

 Settings

nHeight   The minimum height that the form can be resized to, in the unit of measurement specified by the ScaleMode property of the form.

 Remarks

When the user sizes a form by choosing either the Size command from the Control menu orby dragging the borders of the form, the form doesn't become any shorter than the height specified in the MinHeight property setting.

The default setting for the MinHeight property setting is  – 1; no minimum height is specified.


 Applies To

Form, _SCREEN


 See Also

MaxHeight Property
MaxWidth Property
MinWidth Property
ScaleMode Property


MINUTE( ) Function

Syntax         Returns         Arguments         Example         See Also

Returns the minute portion from a DateTime expression.

 Syntax

MINUTE(tExpression)

 Returns

Numeric

 Arguments

tExpression   Specifies the DateTim e expression from which the minute portion is returned.


 MINUTE( ) Function Example

The following example displays the minute portion of the current time and the minute portion of a specific time.

CLEAR

? MINUTE(DATETIME( ))

? MINUTE({10:42am})  && Displays 42


 See Also

CTOT( )
DATE( )
DATETIME( )
DTOT( )
HOUR( )
SEC( )
SECONDS( )
SET SECONDS
TIME( )


MinWidth Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the minimum width that a form can be resized to. Available at design time and run time.

 Syntax

Object.MinWidth[ = nWidth]

 Settings

nWidth   The minimum width that the form can be resized to, in the unit of measurement specified by the ScaleMode property of the Form.

 Remarks

When the user sizes a Form by choosing either the Size command from the Control menu or by dragging the borders of the form, the Form cannot be made any narrower than the width specified in the MinWidth property setting.

The default setting for the MinWidth property is  – 1; no minimum width is specified.


 Applies To

Form, _SCREEN


 See Also

MaxHeight Property
MaxWidth Property
MinHeight Property
ScaleMode Property


MLINE( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns a specific line from a memo field as a character string.

 Syntax

MLINE(MemoFieldName, nLineNumber [, nNumberOfCharacters])

 Returns

Character

 Arguments

MemoFieldName   Specifies the name of the memo field from which MLINE( ) returns a line. If the memo field is in a table open in a noncurrent work area, preface the memo field name with a period and the table alias.

nLineNumber   Specifies the number of the line to be returned from the memo field. An empty string is returned if nLineNumber is negative, 0, or greater than the number of lines in the memo field.

nNumberOfCharacters   Specifies the number of characters from the beginning of the memo field after which MLINE( ) returns the specified line.

The _MLINE system variable is typically used for nNumberOfCharacters. _MLINE is automatically adjusted each time MLINE( ) is called.

In recursive procedures that return lines from large memo fields, you can obtain the best performance by including _MLINE as nNumberOfCharacters.

 Remarks

MLINE( ) trims any trailing spaces from the line specified with nLineNumber.

The length and number of the lines in a memo field are determined by the current value of SET MEMOWIDTH (the default line length is 50 characters). If a carriage return is encountered, no additional characters are returned. The current _WRAP setting determines how the memo field line is displayed.

When searching a memo field for a character string, you can use ATLINE( ) or ATCLINE( ) to return the line number of the line in which the character string is found. Use this line number in MLINE( ) to return the contents of the line from the memo field.


 MLINE( ) Function Example

In the following example, two methods are used to return lines from a memo field. Two loops use MLINE( ) to return lines from the memo field. Note the improvement in performance in the second loop when the system variable _MLINE is used in MLINE( ).

CLEAR

SET TALK OFF

SET MEMOWIDTH TO 50

CLOSE DATABASES

CREATE TABLE tmemo (name c(10), notes m)

APPEND BLANK	&& Add a record

WAIT WINDOW 'Filling memo field - takes several seconds' NOWAIT

*** Fill the memo field  ***

FOR gnOuterLoop = 1 TO 5	&& loop 5 times

FOR gnAlphabet = 65 TO 75	&& letters A to H

REPLACE notes WITH REPLICATE(CHR(gnAlphabet), 10) ;

+ CHR(13) ADDITIVE

NEXT

NEXT

*** Display all lines from the memo field ***

STORE MEMLINES(notes) TO gnNumLines	&& Number of lines in memo field

STORE SECONDS( ) TO gnBegin	&& Beginning time

FOR gnCount = 1 TO gnNumLines	&& Loop for # of lines in memo field

? MLINE(notes, gnCount)	&& Display each line

NEXT

? STR(SECONDS( ) - gnBegin, 4, 2) + ' seconds'	&& Total time

*** Preferable method using _MLINE in MLINE( ) ***

*** Display all lines from the memo field ***

WAIT 'Press a key to see the preferred method' WINDOW

CLEAR

STORE 0 TO _MLINE 	&& Reset _MLINE to zero

STORE SECONDS( ) TO gnBegin	&& Beginning time

FOR count = 1 TO gnNumLines	&& Loop for # of lines in memo field

? MLINE(notes, 1, _MLINE)	&& Display each line

NEXT

? STR(SECONDS( ) - gnBegin, 4, 2) + ' seconds'	&& Total time

SET TALK ON

CLOSE DATABASES

ERASE tmemo.dbf

ERASE tmemo.fpt


 See Also

ATCLINE( )
ATLINE( )
COPY MEMO
MEMLINES( )
_MLINE
MODIFY MEMO
SET MEMOWIDTH
_WRAP


_MLINE System Memory Variable
_MLINE System Variable

Syntax         Arguments         Remarks         See Also

Contains the memo field offset for the MLINE( ) function.

 Syntax

_MLINE = nNumberOfCharacters

 Arguments

nNumberOfCharacters   Specifies the memo field offset. For more information about the use of _MLINE and an example of its use, see MLINE( ) .

 Remarks

MLINE( ) returns one line of text from a memo field. MLINE( ) stores the location of its memo field offset to the _MLINE system variable. Use _MLINE as the second numeric argument in the MLINE( ) function to increase the performance of MLINE( ).

The startup default value for _MLINE is 0. Be sure to reset _MLINE to 0 before using _MLINE again with the MLINE( ) function.


 See Also

MEMLINES( )
MLINE( )
SET MEMOWIDTH


MD | MKDIR Command

Syntax         Arguments         Remarks         Example         See Also

 Syntax

MD cPath | MKDIR cPath

 Arguments

cPath   Specifies a directory or a path (with a drive designator and directories).

If cPath is a directory without a drive designator, the directory is created as a subdirectory of the current Visual FoxPro default directory.

 Remarks

Visual FoxPro generates an error message if you attempt to create a directory that already exists.


 MD | MKDIR Command Example

The following example uses MKDIR to create a new directory named mytstdir, then CHDIR is used to change to the new directory. GETDIR( ) is used to display the directory structure, and then RMDIR is used to remove the newly created directory. GETDIR( ) is used to display the directory structure again.

SET DEFAULT TO HOME( )  && Restore Visual FoxPro directory

MKDIR mytstdir  && Create a new directory

CHDIR mytstdir  && Change to the new directory

= GETDIR( )  && Display the Select Directory dialog box

SET DEFAULT TO HOME( )  && Restore Visual FoxPro directory

RMDIR mytstdir  && Remove the new directory

= GETDIR( )  && Display the Select Directory dialog box


 See Also

CD | CHDIR
GETDIR( )
HOME( )
RD | RMDIR
SET DEFAULT
SET PATH
SYS(5) - Default Drive
SYS(2003) - Current Directory
SYS(2004) - Visual FoxPro Start Directory


MDIForm Property

Included for backward compatibility. Use the ShowWindow Property instead.


MDOWN( ) Function

Included for backward compatibility. Use the Click, MouseDown, MouseUp and RightClick events instead.


MDX( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns the name of the open .CDX compound index file that has the specified index position number.

 Syntax

MDX(nIndexNumber [, nWorkArea | cTableAlias])

 Returns

Character

 Arguments

nIndexNumber   Specifies which compound index file name to return. If the table has a structural compound index file and nIndexNumber is 1, the name of the structural compound index file (which is always the same as the name of the table) is returned. If nIndexNumber is 2, the name of the first compound index file specified with USE or SET INDEX is returned. If nIndexNumber is 3, the second compound index file name is returned, and so on. If nIndexNumber is greater than the number of open compound index files, an empty string is returned.

If the table doesn’t have a structural compound index file and nIndexNumber is 1, the name of the first compound index file specified with USE or SET INDEX is returned. If nIndexNumber is 2, the second compound index file name is returned, and so on. If nIndexNumber is greater than the number of open compound index files, an empty string is returned.

nWorkArea   Specifies the work area number for compound index files open in work areas other than the current one. If you omit this optional argument, names of compound index files are returned for the current work area.

cTableAlias   Specifies the table alias for compound index files open in work areas other than the current one. If you omit this optional argument, names of compound index files are returned for the current work area.

 Remarks

MDX( ) is identical to CDX( ).

Index files can be opened for a table with the INDEX clause of the USE command or with SET INDEX. A structural compound index file is automatically opened with its table. MDX( ) ignores any .IDX index files specified with USE or with SET INDEX.

Use TAG( ) to return tag names from a compound index file; use NDX( ) to return the name of an open .IDX index file.

In Visual FoxPro for Windows, when SET FULLPATH is ON, MDX( ) returns the path to the .CDX file with the .CDX file name. When SET FULLPATH is OFF, MDX( ) returns the drive the .CDX file resides on with the .CDX file name.

In Visual FoxPro for Macintosh, MDX( ) ignores the FULLPATH setting and always returns the path to the .CDX file with the .CDX file name.


 See Also

CDX( )
INDEX
NDX( )
SET INDEX
SET FULLPATH
SYS(14) - Index Expression
TAG( )
USE


MDY( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the specified date or datetime expression in month-day-year format with the name of the month spelled out.

 Syntax

MDY(dExpression | tExpression)

 Returns

Character

 Arguments

dExpression   Specifies the date expression to return in month-day-year format.

tExpression   Specifies the datetime expression to return in month-day-year format.

 Remarks

If SET CENTURY is OFF, the character expression is returned in a month dd, yy format. If SET CENTURY is ON, the format is month dd, yyyy.


 MDY( ) Function Example

The following example creates a user-defined function that returns a date with the corresponding weekday.

SET CENTURY OFF

CLEAR

? Longdate({02/16/95})  && Displays Thursday, February 16, 95

SET CENTURY ON

? Longdate({02/16/95})  && Displays Thursday, February 16, 1995

*** LongDate ***

FUNCTION longdate

PARAMETERS gdDate

RETURN CDOW(gdDate) + ', ' + MDY(gdDate)


 See Also

DMY( )
SET CENTURY
SET DATE


MEMLINES( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the number of lines in a memo field.

 Syntax

MEMLINES(MemoFieldName)

 Returns

Numeric

 Arguments

MemoFieldName   Specifies the name of the memo field. If the memo field is in a table that isn’t open in the current work area, preface the memo field name with the table alias and a period.

 Remarks

The number of lines in a memo field is determined by the current value of SET MEMOWIDTH.


 MEMLINES( ) Function Example

The following example scans three records in the employee table and uses MEMLINES( ) to determine whether or not there is data in the notes memo field and when page breaks should occur. The last_name data for the record appears, along with the notes (if there is data in the memo field) or a message indicating that there are no notes for that record.

CLOSE DATABASES

CLEAR

SET TALK OFF

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE employee  && Open Employee table

SET MEMOWIDTH TO 65

gnLine = 1

GOTO 2

SCAN NEXT 3

gnMemoSize = MEMLINES(notes)

IF gnMemoSize = 0

STORE .T. TO glNoMemo

STORE 1 TO gnMemoSize

ELSE

STORE .F. TO glNoMemo

ENDIF

IF gnLine + gnMemoSize > 65

EJECT

gnLine = 1

ENDIF

@ gnLine,2 SAY 'Last Name: '+ last_name

gnLine = gnLine +1

@ gnLine ,2 SAY 'Notes: '

?? IIF(glNoMemo, 'No notes ',notes)

gnLine = gnLine + gnMemoSize + 2

IF gnLine > 24

gnLine = 1

CLEAR

ENDIF

ENDSCAN


 See Also

MLINE( )
SET MEMOWIDTH


MEMORY( ) Function

Syntax         Returns         Remarks         See Also

Returns the amount of memory available to run an external program.

 Syntax

MEMORY( )

 Returns

Numeric

 Remarks

In Visual FoxPro, MEMORY( ) always returns 640.

MEMORY( ) is similar to SYS(12), with two exceptions:

•	MEMORY( ) returns the amount of available memory in kilobytes; SYS(12) returns the amount of memory in bytes.

•	MEMORY( ) returns a numeric expression. SYS(12) returns its value as a character string.


 See Also

SYS(12) - Available Memory in Bytes
SYS(1001) - Visual FoxPro Memory


MemoWindow Property

Included for backward compatibility. Use an EditBox control instead.


MENU Command

Included for backward compatibility. Use the Menu Designer instead.


MOD( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Divides one numeric expression by another numeric expression and returns the remainder.

 Syntax

MOD(nDividend, nDivisor)

 Returns

Numeric

 Arguments

nDividend   Specifies the dividend. The number of decimal places in nDividend determines the number of decimal places in the return value.

nDivisor   Specifies the divisor. A positive number is returned if nDivisor is positive, and a negative number is returned if nDivisor is negative.

 Remarks

The modulus function MOD( ) and the % operator return identical results.


 MOD( ) Function Example

CLEAR

? MOD(36,10)  && Displays 6

? MOD((4*9), (90/9))  && Displays 6

? MOD(25.250,5.0)  && Displays 0.250

? IIF(MOD(YEAR(DATE( )), 4) = 0, 'Summer Olympics this year';

, 'No Summer Olympics this year')


 See Also

% Operator


MODIFY CLASS Command

Syntax         Arguments         Remarks         See Also

Opens the Class Designer, allowing you to modify an existing class definition or create a new class definition.

 Syntax

MODIFY CLASS ClassName [OF ClassLibraryName1]
[AS cBaseClassName [FROM ClassLibraryName2]]
[METHOD MethodName] [NOWAIT] [SAVE]

 Arguments

ClassName   Specifies the name of the class definition to modify or create.

OF ClassLibraryName1   Specifies the name of the .VCX visual class library containing the class definition. If you are creating a new class definition and the .VCX visual class library already exists, the class definition is added to it.

A .VCX file extension is assumed for the visual class library. Be sure to include the file extension if the visual class library you specify has a file extension other than .VCX.

If the .VCX visual class library you specify is currently in the SET CLASSLIB search list, the visual class library is removed from the search list.

AS cBaseClassName   Specifies the class on which the class definition is based. cBaseClassName can be any of the Visual FoxPro base classes except Column, Cursor, DataEnvironment, Header, Page, and Relation. You can also specify a user-defined class for cBaseClassName if you include the FROM ClassLibraryName2 clause that specifies the name of the .VCX visual class library containing the user-defined class.

If you omit AS cBaseClassName, the class definition is based on the Visual FoxPro FormSet base class.

FROM ClassLibraryName2   Specifies the name of the .VCX visual class library containing the user-defined class specified with cBaseClassName.

METHOD MethodName   Specifies an event or method for which the Code window is opened in the Class Designer. The METHOD clause lets you immediately begin editing event or method code in the Class Designer.

MethodName supports the Visual FoxPro object syntax. For example, to immediately edit the Click event code for a text box named txtFirstName in the class named MyClass in a visual class library named MyClassLibrary, use the following command:

MODIFY CLASS MyClass OF MyClassLibrary;
METHOD txtFirstName.Click

If you only include an event or method name in the METHOD clause, the Code window is opened for the class’s event or method. For example, to immediately edit the Click event code for a class named MyClass in a visual class library named MyClassLibrary, use the following command:

MODIFY CLASS MyClass OF MyClassLibrary METHOD Click

NOWAIT   Continues program execution after the Class Designer is opened. The program doesn’t wait for the Class Designer to be closed, but continues execution on the program line immediately following the line that contains MODIFY CLASS NOWAIT. If you omit NOWAIT when MODIFY CLASS is issued in a program, the Class Designer is opened and program execution pauses until the Class Designer is closed.

NOWAIT is effective only from within a program. It has no effect on MODIFY CLASS when issued from the Command window.

SAVE   Leaves the Class Designer open after another window is activated. If you omit SAVE, the Class Designer is closed when another window is activated. Including SAVE has no effect when issued from the Command window.

 Remarks

Use MODIFY CLASS to modify an existing class definition or to create a new class definition and save it in a .VCX visual class library. You can open the .VCX visual class library with SET CLASSLIB, allowing you to access the class definitions within the .VCX visual class library.


 See Also

ADD CLASS
CREATE CLASS
CREATE CLASSLIB
RELEASE CLASSLIB
SET CLASSLIB


MODIFY COMMAND Command

Syntax         Arguments         Remarks         See Also

Opens an editing window so you can modify or create a program file.

 Syntax

MODIFY COMMAND [FileName | ?]
[NOEDIT]
[NOMENU]
[NOWAIT]
[RANGE nStartCharacter, nEndCharacter]
[[WINDOW WindowName1]
[IN [WINDOW] WindowName2 | IN SCREEN]]
[AS nCodePage]
[SAME]
[SAVE]

 Arguments

FileName   Specifies the file name for the program to open or create. If you don’t specify an extension for a new program file, Visual FoxPro automatically assigns a .PRG extension. MODIFY COMMAND supports a file skeleton that contains the asterisk (*) and question mark (?) wildcards. An editing window is opened for each program whose file name matches the file skeleton.

If you omit the file name, an editing window opens for a file initially named PROG1.PRG. When you close the editing window, you can save the file with a different name.

?   Displays the Open dialog box. Choose one of the existing programs or enter the name of a new program to create.

NOEDIT   Specifies that the program file can't be changed, but can be viewed and copied to the Clipboard.

NOMENU   Removes the Format menu title from the Visual FoxPro system menu bar, preventing changes to font, font size, line spacing, and indentation.

NOWAIT   Continues program execution after the editing window is opened. The program doesn’t wait for the editing window to be closed, but continues execution on the program line immediately following the line that contains MODIFY COMMAND NOWAIT. If you omit NOWAIT when MODIFY COMMAND is used in a program, an editing window is opened and program execution pauses until the editing window is closed.

NOWAIT is effective only from within a program. It has no effect on MODIFY COMMAND when issued from the Command window.

An implicit NOWAIT occurs if you open more than one editing window with a single MODIFY COMMAND command. For example:

MODIFY COMMAND *.PRG.

RANGE nStartCharacter, nEndCharacter   Specifies a range of characters selected when the editing window is opened. Characters are selected starting at the position specified with nStartCharacter up to (but not including) the character position of nEndCharacter. If nStartCharacter is equal to nEndCharacter, no characters are selected, and the cursor is placed at the position specified with nStartCharacter.

WINDOW WindowName1   Specifies a window whose characteristics the editing window takes on. For example, if the window is created with the FLOAT option of DEFINE WINDOW, the editing window can be moved. The window need not be active or visible, but it must be defined.

IN [WINDOW] WindowName2   Specifies a parent window in which the editing window is opened. The editing window doesn’t assume the characteristics of the parent window and cannot be moved outside the parent window. If the parent window is moved, the editing window moves with it.

The parent window must first be defined with DEFINE WINDOW, and must be visible, to access the editing window.

IN SCREEN   Explicitly opens the editing window in the main Visual FoxPro window, after it has been placed in a parent window. An editing window is placed in a parent window by including the IN WINDOW clause.

AS nCodePage   Automatically converts accented characters in a program file created on another Visual FoxPro platform. The numeric expression nCodePage specifies the code page of the Visual FoxPro platform on which the program file was created. The file is saved in this code page unless you choose Save As from the File menu to save the file in a different code page.

SAME   Prevents the editing window from coming forward as the active window. If the editing window is hidden, it is displayed but doesn't become the active window.

SAVE   Leaves the editing window open after another window is activated. If you omit SAVE, the editing window is closed when another window is activated. Including SAVE has no effect when issued from the Command window.

 Remarks

When modifications are made to a program file, the updated file is written to disk. In Visual FoxPro, a backup file with a .BAK extension is created if you select the Make Backup Copy check box on the Edit tab in the Options dialog box, which appears when you choose Options from the Tools menu.

The built-in Visual FoxPro editor is used unless you specify an external editor with TEDIT in your configuration file.


 See Also

*
&&
DO
MODIFY FILE
NOTE


MODIFY CONNECTION Command

Syntax         Arguments         Remarks         Example         See Also

Displays the Connection Designer, allowing you to interactively modify an existing named connection stored in the current database.

 Syntax

MODIFY CONNECTION [ConnectionName | ?]

 Arguments

ConnectionName   Specifies the name of the connection to modify.

?   Displays the Open dialog box from which you can choose an existing named connection to modify.

 Remarks

If you omit the optional arguments, the Open dialog box is displayed, allowing you to specify an existing named connection to modify. The Connection Designer is displayed after you choose a named connection to modify.


 MODIFY CONNECTION Command Example

The following example assumes an ODBC data source called MyFoxSQLNT is available, and the user ID for the data source is “sa.” The testdata database is opened, and a connection named Myconn is created. MODIFY CONNECTION is used to displays the Connection Designer so you can modify the connection.

CLOSE DATABASES

OPEN DATABASE (SYS(2004) + 'samples\data\testdata')

CREATE CONNECTION Myconn DATASOURCE "MyFoxSQLNT" USERID "sa"

MODIFY CONNECTION Myconn && Displays named connections in the database


 See Also

CREATE CONNECTION
DELETE CONNECTION
OPEN DATABASE
RENAME CONNECTION


MODIFY DATABASE Command

Syntax         Arguments         Remarks         Example         See Also

Opens the Database Designer, allowing you to interactively modify the current database.

 Syntax

MODIFY DATABASE [DatabaseName | ?]
[NOWAIT] [NOEDIT]

 Arguments

DatabaseName   Specifies the name of the database to modify.

?   Displays the Open dialog box from which you can specify the name of the database to modify.

NOWAIT   Continues program execution after the Database Designer is opened. The program doesn’t wait for the Database Designer to be closed, but continues execution on the program line immediately following the line that contains MODIFY DATABASE NOWAIT. If you omit NOWAIT when MODIFY DATABASE is issued in a program, the Database Designer is opened and program execution pauses until the Database Designer is closed.

NOWAIT is effective only from within a program. It has no effect on MODIFY DATABASE when issued from the Command window.

NOEDIT   Prevents changes to the database.

 Remarks

For more information about interactively modifying a database with the Database Designer, see the Database Designer and Database Designer Toolbar topics and Chapter 5, “Collecting Tables into a Database,” in the User’s Guide.


 MODIFY DATABASE Command Example

The following example displays the Database Designer with the tables in the testdata database.

CLOSE DATABASES

SET PATH TO (HOME( ) + 'samples\data\')  	&& Sets path to database

MODIFY DATABASE testdata  && Open testdata database


 See Also

ADD TABLE
CLOSE DATABASES
CREATE DATABASE
DBC( )
DBGETPROP( )
DBSETPROP( )
DELETE DATABASE
DISPLAY TABLES
OPEN DATABASE
REMOVE TABLE


MODIFY FILE Command

Syntax         Arguments         Remarks         See Also

Opens an editing window so you can modify or create a text file.

 Syntax

MODIFY FILE [FileName | ?]
[NOEDIT]
[NOMENU]
[NOWAIT]
[RANGE nStartCharacter, nEndCharacter]
[[WINDOW WindowName1]
[IN [WINDOW] WindowName2 | IN SCREEN]]
[AS nCodePage]
[SAME]
[SAVE]

 Arguments

FileName   Specifies the file name for the text file. If you don’t specify an extension for a new text file, Visual FoxPro automatically assigns a .TXT extension. MODIFY FILE supports a file skeleton that can contain the asterisk (*) and question mark (?) wildcards. An editing window is opened for each text file whose name matches the file skeleton.

If you omit the file name, an editing window opens for a file initially named FILE1. When you close the editing window, you can save the file with a different name.

?   Displays the Open dialog box, from which you can choose a text file.

NOEDIT   Specifies that the text file can't be changed, but can be viewed and copied to the Clipboard.

NOMENU   Removes the Format menu title from the Visual FoxPro system menu bar, preventing changes to font, font size, line spacing, and indentation.

NOWAIT   Continues program execution after the editing window is opened. The program doesn’t wait for the editing window to be closed, but continues execution on the program line immediately following the line that contains MODIFY FILE NOWAIT. If you omit NOWAIT when MODIFY FILE is issued in a program, the editing window is opened and program execution pauses until the editing window is closed.

NOWAIT is effective only from within a program. It has no effect on MODIFY FILE when issued from the Command window.

An implicit NOWAIT occurs if you open more than one editing window with a single MODIFY FILE command. For example:

MODIFY FILE *.TXT

RANGE nStartCharacter, nEndCharacter   Specifies a range of characters selected when you open an editing window. Characters are selected starting at the position specified with nStartCharacter up to (but not including) the character position of nEndCharacter. If nStartCharacter is equal to nEndCharacter, no characters are selected, and the cursor is placed at the position specified with nStartCharacter.

WINDOW WindowName1   Specifies a window whose characteristics the editing window takes on. For example, if the window is created with the FLOAT option of DEFINE WINDOW, the editing window can be moved. The window need not be active or visible, but it must be defined.

IN [WINDOW] WindowName2   Specifies a parent window in which the editing window is opened. The editing window doesn’t assume the characteristics of the parent window and cannot be moved outside the parent window. If the parent window is moved, the editing window moves with it.

The parent window must first be defined with DEFINE WINDOW, and must be visible in order to access the editing window.

IN SCREEN   Explicitly opens the editing window in the main Visual FoxPro window, after it has been placed in a parent window. An editing window is placed in a parent window by including the IN WINDOW clause.

AS nCodePage   Automatically converts accented characters in a text file created on another Visual FoxPro platform. The numeric expression nCodePage specifies the code page of the Visual FoxPro platform on which the text file was created. The file is saved in this code page unless you choose Save As from the File menu to save the file in a different code page.

SAME   Prevents the editing window from coming forward as the active window. If the editing window is hidden, it is displayed but doesn't become the active window.

SAVE   Leaves the editing window open after another window is activated. If you omit SAVE, the editing window is closed when another window is activated. Including SAVE has no effect when issued from the Command window.

 Remarks

When modifications are made to a text file, the updated file is written to disk. In Visual FoxPro, a backup file with a .BAK extension is created if you select the Make Backup Copy check box on the Edit tab in the Options dialog box, which appears when you choose Options from the Tools menu. In previous versions of FoxPro, a backup file with a .BAK extension is created if you select the Backup check box in the Preferences dialog box, which appears when you choose Preferences from the Edit menu.

The Visual FoxPro editor is used unless you specify an external editor with TEDIT in your configuration file.


 See Also

*
&&
DO
MODIFY COMMAND
NOTE


MODIFY FORM Command

Syntax         Arguments         Remarks         Example         See Also

Opens the Form Designer so you can modify or create a Form.

 Syntax

MODIFY FORM
[FormName | ?] [METHOD MethodName]
[NOENVIRONMENT] [NOWAIT] [SAVE]
[[WINDOW WindowName1]
[IN [WINDOW] WindowName2 | IN SCREEN]]

 Arguments

FormName   Specifies the file name for the Form. If you don’t specify an extension for the file name, Visual FoxPro automatically assigns an .SCX extension.

?   Displays the Open dialog box from which you can choose an existing Form or enter the name of a new Form to create.

METHOD MethodName   Specifies an event or method for which the Code window is opened in the Form Designer. The METHOD clause lets you immediately begin editing event or method code in the Form Designer.

MethodName supports the Visual FoxPro object syntax. For example, to immediately edit the Click event code for a text box named txtFirstName in a form named frmAddress, use the following command:

MODIFY FORM frmAddress METHOD txtFirstName.Click

If you only include an event or method name in the METHOD clause, the Code window is opened for the form’s event or method. For example, to immediately edit the Click event code for a form named frmAddress, use the following command:

MODIFY FORM frmAddress METHOD Click

NOENVIRONMENT   Included for backward compatibility with 2.x screens, preventing the environment saved with the screen from being restored.

In Visual FoxPro, the data environment associated with a Visual FoxPro form is restored by setting the data environment AutoOpenTables property to true (.T.), which is the default. To make sure that the form environment is closed when the form is releases, set the data environment AutoCloseTables property to true (.T.), which is also the default.

When you create or modify forms, you can save the current Visual FoxPro data environment with the form definition file. Saving the Visual FoxPro data environment places additional records in the form definition table for all open tables and index files, the index order, and any relationships between the tables.

NOWAIT   Continues program execution after the Form Designer has been opened. The program doesn’t wait for the Form Designer to be closed, but continues execution on the program line immediately following the line that contains MODIFY FORM NOWAIT. If you omit NOWAIT, when MODIFY FORM is issued in a program the Form Designer is opened and program execution pauses until the Form Designer is closed.

NOWAIT is effective only from within a program. It has no effect on MODIFY FORM when issued from the Command window.

SAVE   When issued in a program, leaves the Form Designer open after another window is brought forward. Including the SAVE option has no effect when issued from the Command window.

WINDOW WindowName1   Specifies a window whose characteristics the Form Designer takes on. For example, if the window is created with the FLOAT option of DEFINE WINDOW, the Form Designer can be moved. The window need not be active or visible, but it must be defined.

The Form Designer has a default size that can be larger than the window from which it takes its characteristics. In this case, the Form Designer still assumes the characteristics of the window in which it is placed. The upper-left corner of the Form Designer is placed at the same coordinates as the upper-left corner of the window, and extends beyond the window’s borders.

IN [WINDOW] WindowName2   Specifies a parent window in which the Form Designer is opened. The Form Designer doesn’t assume the characteristics of the parent window and cannot be moved outside the parent window. If the parent window is moved, the Form Designer moves with it.

The parent window must first be defined with DEFINE WINDOW, and must be visible, to access the Form Designer.

IN SCREEN   Specifies that the Form Designer is explicitly opened in the main Visual FoxPro window, after the Form Designer has been placed in a parent window. The Form Designer is placed in a parent window by including the IN WINDOW clause.

 Remarks

Issuing MODIFY FORM without any arguments displays the Open dialog box. You can save the form with a different name when you close the Form Designer.


 MODIFY FORM Command Example

The following example open the stop watch (SWATCH.SCX) control sample in the Form Designer.

MODIFY FORM (HOME( ) + 'samples\solution\controls\timer\swatch.scx')


 See Also

COMPILE FORM
CREATE FORM
DO FORM


MODIFY GENERAL Command

Syntax         Arguments         Remarks         See Also

Opens editing windows for general fields in the current record.

 Syntax

MODIFY GENERAL GeneralField1 [, GeneralField2 ...]
[NOMODIFY]
[NOWAIT]
[[WINDOW WindowName1]
[IN [WINDOW] WindowName2 | IN SCREEN]]

 Arguments

GeneralField1 [, GeneralField2 ...]   Specify the names of the general fields to open. To open an editing window for a general field in a table open in a noncurrent work area, include the table alias with the field name. You can open multiple general fields in the current record by including a list of general fields separated by commas.

NOMODIFY   Specifies that the OLE object contained in the general field can't be changed, but can be viewed and copied to the Clipboard.

NOWAIT   Continues program execution after the general field editing window is opened. The program doesn’t wait for the editing window to be closed, but continues execution on the program line immediately following the line that contains MODIFY GENERAL NOWAIT. If you omit NOWAIT when MODIFY GENERAL is issued in a program, an editing window is opened and program execution pauses until the editing window is closed.

NOWAIT is effective only from within a program. It has no effect on MODIFY GENERAL when issued from the Command window.

WINDOW WindowName1   Specifies a window whose characteristics the general field editing window takes on. For example, if the window is created with the FLOAT option of DEFINE WINDOW, the general field editing window can be moved. The window need not be active or visible, but it must be defined.

IN [WINDOW] WindowName2   Specifies a parent window in which the general field editing window is opened. The general field window doesn’t assume the characteristics of the parent window and cannot be moved outside the parent window. If the parent window is moved, the general field window moves with it.

The parent window must first be defined with DEFINE WINDOW, and must be visible, to access the general field window.

IN SCREEN   Explicitly opens the general field window in the main Visual FoxPro window, after it has been placed in a parent window. A general field editing window is placed in a parent window by including the IN WINDOW clause.

 Remarks

When an editing window is open, you can insert, modify, or delete an OLE object.

For additional information about OLE objects in Visual FoxPro, see “Adding OLE Objects to Tables” in Chapter 16, “Adding OLE,” in the Developer’s Guide.


 See Also

@ ... SAY - Pictures & OLE Objects
APPEND GENERAL


MODIFY LABEL Command

Syntax         Arguments         See Also

Opens the Label Designer so you can create or modify a label.

 Syntax

MODIFY LABEL [FileName | ?]
[[WINDOW WindowName1]
[IN [WINDOW] WindowName2 | IN SCREEN]]
[NOENVIRONMENT]
[NOWAIT]
[SAVE]

 Arguments

FileName   Specifies the file name for the label. If you don’t specify an extension for the file name, Visual FoxPro automatically assigns an .LBX extension. If the file you specify doesn't exist or can't be found, a new label file is created.

?   Displays the Open dialog box, from which you can choose an existing label or enter the name of a new label to create.

WINDOW WindowName1   Specifies a window whose characteristics the Label Designer takes on. For example, if the window is created with the FLOAT option of DEFINE WINDOW, the Label Designer can be moved. The window doesn’t have to be active or visible, but it must be defined.

The Label Designer has a default size that can be larger than the window from which it takes its characteristics. In this case, the Label Designer still assumes the characteristics of the window in which it is placed. The upper-left corner of the Label Designer is placed at the same coordinates as the upper-left corner of the window, and extends beyond the window’s borders.

IN [WINDOW] WindowName2   Specifies a parent window in which the Label Designer is opened. The Label Designer doesn’t assume the characteristics of the parent window and cannot be moved outside the parent window. If the parent window is moved, the Label Designer moves with it.

The parent window must first be defined with DEFINE WINDOW, and must be visible to access the Label Designer.

IN SCREEN   Explicitly opens the Label Designer in the main Visual FoxPro window, after it has been placed in a parent window. A Label Designer is placed in a parent window by including the IN WINDOW clause.

NOENVIRONMENT   Included for backward compatibility with 2.x labels, preventing the environment saved with the label.

In Visual FoxPro, the data environment associated with a Visual FoxPro label is restored by setting the data environment AutoOpenTables property to true (.T.), which is the default. To make sure that the label environment is closed when the label is finished printing, set the data environment AutoCloseTables property to true (.T.), which is also the default.

When you create or modify labels, you can save the current Visual FoxPro data environment with the label definition file. Saving the Visual FoxPro data environment places additional records in the label definition table for all open tables and index files, the index order, and any relationships between the tables.

NOWAIT   Continues program execution after the Label Designer is opened. The program doesn’t wait for the Label Designer to be closed, but continues execution on the program line immediately following the line that contains CREATE LABEL NOWAIT. If you omit NOWAIT when CREATE LABEL is issued in a program, a Label Designer is opened and program execution pauses until the Label Designer is closed.

Including the NOWAIT option has no effect on the CREATE LABEL command when issued from the Command window.

SAVE   Leaves the Label Designer open after another window is activated. If you omit SAVE, the Label Designer is closed when another window is activated. Including SAVE has no effect when issued from the Command window.


 See Also

CREATE LABEL
LABEL


MODIFY MEMO Command

Syntax         Arguments         Remarks         Example         See Also

Opens an editing window for a memo field in the current record.

 Syntax

MODIFY MEMO MemoField1 [, MemoField2 ...]
[NOEDIT]
[NOMENU]
[NOWAIT]
[RANGE nStartCharacter, nEndCharacter]
[[WINDOW WindowName1]
[IN [WINDOW] WindowName2 | IN SCREEN]]
[SAME]
[SAVE]

 Arguments

MemoField1 [, MemoField2 ...]   Specifies the names of the memo fields to edit. To open an editing window for a memo field in a table open in another work area, include the table alias with the field name.

NOEDIT   Specifies that the memo field opened can't be changed, but can be viewed and copied to the Clipboard.

NOMENU   Removes the Format menu title from the Visual FoxPro system menu bar, preventing changes to font, font size, line spacing, and indentation.

NOWAIT   Continues program execution after the editing window is opened. The program doesn’t wait for the editing window to be closed, but continues execution on the program line immediately following the line that contains MODIFY MEMO NOWAIT. If you omit NOWAIT when MODIFY MEMO is issued in a program, an editing window is opened and program execution pauses until the editing window is closed.

NOWAIT is effective only from within a program. It has no effect on MODIFY MEMO when issued from the Command window.

RANGE nStartCharacter, nEndCharacter   Specifies a range of characters selected when the editing window is opened. Characters are selected starting at the position specified with nStartCharacter up to (but not including) the character position of nEndCharacter. If nStartCharacter is equal to nEndCharacter, no characters are selected, and the cursor is placed at the position specified with nStartCharacter.

WINDOW WindowName1   Specifies a window whose characteristics the editing window takes on. For example, if the window is created with the FLOAT option of DEFINE WINDOW, the editing window can be moved. The window need not be active or visible, but it must be defined.

IN [WINDOW] WindowName2   Specifies a parent window in which the editing window is opened. The editing window doesn’t assume the characteristics of the parent window and cannot be moved outside the parent window. If the parent window is moved, the editing window moves with it.

The parent window must first be defined with DEFINE WINDOW, and must be visible, to access the editing window.

IN SCREEN   Explicitly opens the editing window in the main Visual FoxPro window, after it has been placed in a parent window. An editing window is placed in a parent window by including the IN WINDOW clause.

SAME   Prevents the editing window from coming forward as the active window. If the editing window is hidden, it is displayed but doesn’t become the active window.

SAVE   Leaves the editing window open after another window is activated. If you omit SAVE, the editing window is closed when another window is activated. Including SAVE has no effect when issued from the Command window.

 Remarks

In the editing window, you can view or change the contents of the memo field.

In a table opened for shared access on a network, the current record is automatically locked when editing begins on one of its memo fields.


 MODIFY MEMO Command Example

The following example opens the notes memo field for the first record in employee in an editing window with a highlighted range.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE employee  && Opens Employee table

MODIFY MEMO notes NOEDIT RANGE 1,10  && First 10 characters selected

USE


 See Also

CLOSE MEMO


MODIFY MENU Command

Syntax         Arguments         Remarks         See Also

Opens the Menu Designer so you can modify or create a menu system.

 Syntax

MODIFY MENU [FileName | ?]
[[WINDOW WindowName1]
[IN [WINDOW] WindowName2 | IN SCREEN]]
[NOWAIT]
[SAVE]

 Arguments

FileName   Specifies the file name for the menu. If you don’t specify an extension for the file name, Visual FoxPro automatically assigns an .MNX extension.

?   Displays the Open dialog box from which you can choose an existing menu file or enter the name of a new menu to create.

WINDOW WindowName1   Specifies a window whose characteristics the Menu Designer takes on. For example, if the window is created with the FLOAT option of DEFINE WINDOW, the Menu Designer can be moved. The window need not be active or visible, but it must be defined.

IN [WINDOW] WindowName2   Specifies a parent window in which the Menu Designer is opened. The Menu Designer doesn’t assume the characteristics of the parent window and cannot be moved outside the parent window. If the parent window is moved, the Menu Designer moves with it.

The parent window must first be defined with DEFINE WINDOW, and must be visible, to access the Menu Designer.

IN SCREEN   Explicitly opens the Menu Designer in the main Visual FoxPro window, after it has been placed in a parent window. The Menu Designer is placed in a parent window by including the IN WINDOW clause.

NOWAIT   Continues program execution after the Menu Designer is opened. The program doesn’t wait for the Menu Designer to be closed, but continues execution on the program line immediately following the line that contains MODIFY MENU NOWAIT. If you omit NOWAIT when MODIFY MENU is issued in a program, the Menu Designer is opened and program execution pauses until the Menu Designer is closed.

NOWAIT is effective only from within a program. It has no effect on MODIFY MENU when issued from the Command window.

If you issue MODIFY MENU from the Command window without a menu name and include NOWAIT, the New Menu dialog is not displayed. The New Menu dialog lets you specify the type of menu (standard or shortcut) created.

SAVE   Leaves the Menu Designer open after another window is activated. If you omit SAVE, the Menu Designer is closed when another window is activated. Including SAVE has no effect when issued from the Command window.

 Remarks

For more information on creating menus, see “Creating a Menu System” in Chapter 11, “Designing Menus and Toolbars,” in the Developer’s Guide.


 See Also

DEFINE BAR
DEFINE MENU
DEFINE PAD
DEFINE POPUP
SET SYSMENU


MODIFY PROCEDURE Command

Syntax         Remarks         Example         See Also

Opens the Visual FoxPro text editor, allowing you to create new stored procedures for the current database, or modify existing stored procedures in the current database.

 Syntax

MODIFY PROCEDURE

 Remarks

A database must be open before you can create or modify stored procedures. Stored procedures are typically specified in Delete, Insert, or Update triggers created for a database with CREATE TRIGGER.

Stored procedures in the current database can be executed like other Visual FoxPro procedures in an open procedure file or program. See PROCEDURE for a description of the order and location in which Visual FoxPro searches for procedures.


 MODIFY PROCEDURE Command Example

The following example opens the testdata database and uses MODIFY PROCEDURE to open the Visual FoxPro text editor, allowing you to create new stored procedures or modify existing stored procedures.

CLOSE DATABASES

OPEN DATABASE (SYS(2004) + 'samples\data\testdata')

MODIFY PROCEDURE  && Opens the Visual FoxPro text editor


 See Also

CREATE TRIGGER
DISPLAY PROCEDURES
OPEN DATABASE
PROCEDURE


MODIFY PROJECT Command

Syntax         Arguments         Remarks         See Also

Opens the Project Manager so you can modify or create a project file.

 Syntax

MODIFY PROJECT [FileName | ?]
[IN SCREEN]
[NOWAIT]
[SAVE]

 Arguments

FileName   Specifies the file name for the project. If you don’t specify an extension for the file name, Visual FoxPro automatically assigns a .PJX extension.

?   Displays the Open dialog box from which you can open an existing project file or enter the name of a new project to create.

IN SCREEN   Explicitly opens the Project Manager in the main Visual FoxPro window, after it has been placed in a parent window. The Project Manager is placed in a parent window by including the IN WINDOW clause.

NOWAIT   Continues program execution after the Project Manager is opened. The program doesn’t wait for the Project Manager to be closed, but continues execution on the program line immediately following the line that contains MODIFY PROJECT NOWAIT. If you omit NOWAIT when MODIFY PROJECT is issued in a program, the Project Manager is opened and program execution pauses until the Project Manager is closed.

NOWAIT is effective only from within a program. It has no effect on MODIFY PROJECT when issued from the Command window.

SAVE   Leaves the Project Manager open after another window is activated. If you omit SAVE, the Project Manager is closed when another window is activated. Including SAVE has no effect when issued from the Command window.

 Remarks

In a project, you specify all the source files that are required for a final application, and then Visual FoxPro makes sure the generated application is based on the latest source files.

A project file is a table that keeps track of all the source files such as programs, forms, menus, libraries, reports, labels, tables, indexes, and format files. A project also keeps track of all the dependencies, references, and connections among the files.

Note   Shared libraries (.FLL, .MLB, .DLL, and CFM files) cannot be included in projects.

A project file has a .PJX file name extension and an associated memo file with a .PJT extension.

Issuing MODIFY PROJECT without any arguments displays the Open dialog box.

For information on the Project Manager, see Chapter 13, “Compiling an Application,” in the Developer’s Guide.


 See Also

BUILD APP
BUILD EXE
BUILD PROJECT
COMPILE
CREATE PROJECT


MODIFY QUERY Command

Syntax         Arguments         Remarks         See Also

Opens the Query Designer so you can modify or create a query.

 Syntax

MODIFY QUERY [FileName | ?]
[[WINDOW WindowName1]
[IN SCREEN]
[NOWAIT]
[SAVE]
[AS nCodePage]

 Arguments

FileName   Specifies the file name for the query. If you don’t specify an extension for the file name, Visual FoxPro automatically assigns a .QPR extension.

?   Displays the Open dialog box from which you can choose an existing query or enter the name of a new query to create.

WINDOW WindowName1   Specifies a window whose characteristics the Query Designer takes on. For example, if the window is created with the FLOAT option of DEFINE WINDOW, the Query Designer can be moved. The window need not be active or visible, but it must be defined.

IN SCREEN   Explicitly opens the Query Designer in the main Visual FoxPro window, after it has been placed in a parent window. The Query Designer is placed in a parent window by including the IN WINDOW clause.

NOWAIT   Continues program execution after the Query Designer is opened. The program doesn’t wait for the Query Designer to be closed, but continues execution on the program line immediately following the line that contains MODIFY QUERY NOWAIT. If you omit NOWAIT when MODIFY QUERY is issued in a program, the Query Designer is opened and program execution pauses until the Query Designer is closed.

NOWAIT is effective only from within a program. It has no effect on MODIFY QUERY when issued from the Command window.

SAVE   Leaves the Query Designer open after another window is activated. If you omit SAVE, the Query Designer is closed when another window is activated. Including SAVE has no effect when issued from the Command window.

AS nCodePage   Specifies the code page of the query. Include AS nCodePage if the query was created with a code page other than the current Visual FoxPro code page. When the query is opened, Visual FoxPro automatically converts the query to the current Visual FoxPro code page. You can use GETCP( ) for nCodePage to display the Code Page dialog box, allowing you to specify a code page for the query.

The query is saved in its original code page when it is closed.

If you omit the AS nCodePage clause or nCodePage is 0, the query is not converted to the current Visual FoxPro code page. If you specify a value for nCodePage that is not supported, Visual FoxPro generates an error message.

In Visual FoxPro, queries can be added to a project, and you can specify the query’s code page from within the Project Container. The Project Container keeps track of the query’s code page. However, if you use MODIFY QUERY to open a query outside of the Project Container, you should include AS nCodePage to specify the query’s code page.

 Remarks

For more information about creating queries, see “Creating a Query” in Chapter 4, “Retrieving Data,” in the User’s Guide.

Issuing MODIFY QUERY without any arguments displays the Open dialog box. If you choose New from this dialog box, the name QUERY1 is assigned to the query. You can save the query with a different name when you exit the Query Designer.

After you have created a query, the query is stored as a Visual FoxPro program file with a .QPR extension. You can execute a query program with DO, but you must include the .QPR extension with the query file name.


 See Also

CREATE QUERY
DO
GETCP( )


MODIFY REPORT Command

Syntax         Arguments         Remarks         See Also

Opens the Report Designer so you can modify or create a report.

 Syntax

MODIFY REPORT [FileName | ?]
[[WINDOW WindowName1]
[IN [WINDOW] WindowName2 | IN SCREEN]]
[NOENVIRONMENT]
[NOWAIT]
[SAVE]

 Arguments

FileName   Specifies the file name for the report. If you don’t specify an extension for the file name, Visual FoxPro automatically assigns an .FRX extension.

?   Displays the Open dialog box from which you can choose an existing report file or enter the name of a new report to create.

WINDOW WindowName1   Specifies a window whose characteristics the Report Designer takes on. For example, if the window is created with the FLOAT option of DEFINE WINDOW, the Report Designer can be moved. The window need not be active or visible, but it must be defined.

IN [WINDOW] WindowName2   Specifies a parent window in which the Report Designer is opened. The Report Designer doesn’t assume the characteristics of the parent window and cannot be moved outside the parent window. If the parent window is moved, the Report Designer moves with it.

The parent window must first be defined with DEFINE WINDOW, and must be visible, to access the Report Designer.

IN SCREEN   Explicitly opens the Report Designer in the main Visual FoxPro window, after it has been placed in a parent window. The Report Designer is placed in a parent window by including the IN WINDOW clause.

NOENVIRONMENT   Included for backward compatibility with 2.x reports; prevents the environment saved with the report.

In Visual FoxPro, the data environment associated with a Visual FoxPro report is restored by setting the data environment AutoOpenTables property to true (.T.), which is the default. To make sure that the report environment is closed when the report is finished printing, set the data environment AutoCloseTables property to true (.T.), which is also the default.

When you create or modify reports, you can save the current Visual FoxPro data environment with the report definition file. Saving the Visual FoxPro data environment places additional records in the report definition table for all open tables and index files, the index order, and any relationships between the tables.

NOWAIT   Continues program execution after the Report Designer is opened. The program doesn’t wait for the Report Designer to be closed, but continues execution on the program line immediately following the line that contains MODIFY REPORT NOWAIT. If you omit NOWAIT when MODIFY REPORT is issued in a program, the Report Designer is opened and program execution pauses until the Report Designer is closed.

NOWAIT is effective only from within a program. It has no effect on MODIFY REPORT when issued from the Command window.

SAVE   Leaves the Report Designer open after another window is activated. If you omit SAVE, the Report Designer is closed when another window is activated. Including SAVE has no effect when issued from the Command window.

 Remarks

Issuing MODIFY REPORT without any arguments displays the Open dialog box. If you choose New from this dialog box, the name REPORT1 is assigned to the report file. You can save the report file with a different name when you close the Report Designer.

For more information on creating and modifying reports, see Chapter 7, “Designing Reports and Labels,” in the User's Guide.


 See Also

_ASCIICOLS
_ASCIIROWS
CREATE REPORT
REPORT


MODIFY SCREEN Command

Included for backward compatibility. Use MODIFY FORM instead.


MODIFY STRUCTURE Command

Syntax         Remarks         See Also

Displays the Table Designer, allowing you to modify the structure of a table.

 Syntax

MODIFY STRUCTURE

 Remarks

In previous versions of FoxPro, MODIFY STRUCTURE opens the Table Structure dialog box.

If a table isn’t open in the currently selected work area, the Open dialog box is displayed, allowing you to choose a table to modify.

Changes you can make to a table’s structure include adding and deleting fields; modifying field names, sizes, and data types; adding, deleting, or modifying index tags; and specifying null value support for fields.

You can also modify the structure of a table using the interface. For more information, see “Modifying Tables” in Chapter 2, “Creating Tables and Indexes,” in the User’s Guide.

Caution   Changing a field from one data type to another may not transfer the contents of the field correctly, or at all. For example, if you convert a field of date type to a numeric type, the field contents do not transfer.

Visual FoxPro automatically makes a backup copy of the current table before you change the table’s structure. When the modifications are complete, the data contained in the backup copy of the table is appended to the newly modified table structure. If the table has a memo field, a memo backup file is also created. The table backup file has a .BAK extension, and the memo backup file has a .TBK extension.

If you accept the structure changes and then interrupt the data-copying process, the new file will not contain all the records in the original table.

Remember that Visual FoxPro creates a .BAK file for the original table file and, if the table has a memo field, a .TBK copy of the original memo file. If you have any problems with MODIFY STRUCTURE, you can delete the new file or files and rename the .BAK file and .TBK file, if any, to the original file extensions (.DBF and .FPT).

When you modify the structure of a table that has a memo field, the blocksize of the memo file is set to the current blocksize setting. You can specify the memo file blocksize with SET BLOCKSIZE.


 See Also

ALTER TABLE - SQL
CREATE
CREATE TABLE - SQL
SET BLOCKSIZE


MODIFY VIEW Command

Syntax         Arguments         Remarks         See Also

Displays the View Designer, allowing you to modify an existing SQL view.

 Syntax

MODIFY VIEW ViewName [REMOTE]

 Arguments

ViewName   Specifies the name of the view to modify.

REMOTE   Specifies that the view is a remote view that uses remote tables. If you omit REMOTE, you can modify a view using local tables.

 Remarks

SQL views are created with CREATE SQL VIEW.


 See Also

CREATE SQL VIEW
OPEN DATABASE


MODIFY WINDOW Command

Syntax         Arguments         Remarks         Example         See Also

Modifies a user-defined window or the main Visual FoxPro window.

 Syntax

MODIFY WINDOW WindowName | SCREEN
[FROM nRow1, nColumn1 TO nRow2, nColumn2
| AT nRow3, nColumn3 SIZE nRow4, nColumn4]
[FONT cFontName [, nFontSize]]
[STYLE cFontStyle]
[TITLE cTitleText]
[HALFHEIGHT]
[DOUBLE | PANEL | NONE | SYSTEM]
[CLOSE | NOCLOSE]
[FLOAT | NOFLOAT]
[GROW | NOGROW]
[MINIMIZE | NOMINIMIZE]
[SHADOW | NOSHADOW]
[ZOOM | NOZOOM]
[ICON FILE FileName1]
[FILL FILE FileName2]
[COLOR SCHEME nSchemeNumber
| COLOR ColorPairList]

 Arguments

WindowName   Specifies which user-defined window to modify. The window you specify must first be created with DEFINE WINDOW.

SCREEN   Specifies the main Visual FoxPro window as the window to modify. Do not abbreviate SCREEN or Visual FoxPro generates an error message. To return the main Visual FoxPro window to its startup configuration, issue the following command without any additional clauses:

MODIFY WINDOW SCREEN

Tip   Use MODIFY WINDOW SCREEN NOCLOSE to prevent accidentally terminating Visual FoxPro prematurely.

For more information about the MODIFY WINDOW clauses, see DEFINE WINDOW.

 Remarks

MODIFY WINDOW changes the attributes of an existing user-defined window (a window created with DEFINE WINDOW) or the main Visual FoxPro window. MODIFY WINDOW can’t be used to change the attributes of Visual FoxPro system windows (such as the Command window and Browse window).

Use MODIFY WINDOW to change the location, default font, title, border, controls, icon, wallpaper, and color of a user-defined window or the main Visual FoxPro window. You can change any of these attributes by including the optional clauses for the MODIFY WINDOW command. (Note that if you change colors, you must use CLEAR to apply the color changes.)

For example, include the FROM and TO or AT and SIZE clauses to specify a new location or size for a user-defined window or the main Visual FoxPro window. To prevent a user-defined window or the main Visual FoxPro window from being moved, include the NOFLOAT keyword.


 MODIFY WINDOW Command Example

The following example changes the contents of the title bar of the main Visual FoxPro window.

MODIFY WINDOW SCREEN TITLE 'My Application'


 See Also

DEFINE WINDOW
_SCREEN


MONTH( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the number of the month for a given Date or DateTime expression.

 Syntax

MONTH(dExpression | tExpression)

 Returns

Numeric

 Arguments

dExpression   Specifies the Date expression for which you want MONTH( ) to return the month number.

tExpression   Specifies the DateTime expression for which you want MONTH( ) to return the month number.

 Remarks

MONTH( ) returns a number from 1 through 12. January is month 1, and December is month 12.


 MONTH( ) Function Example

CLEAR

? DATE( )  && Displays today's date

? MONTH(DATE( ))  && Displays the month number

STORE {05/03/95} TO gdBuy

STORE MONTH(gdBuy + 31) TO gdMonth

? gdMonth


 See Also

CMONTH( )
DAY( )
SYS( ) Functions Overview
YEAR( )


MOUSE Command

Syntax         Arguments         Remarks         Example         See Also

Performs the equivalent of clicking, double-clicking, or moving the mouse, or performs a drag operation.

 Syntax

MOUSE [CLICK | DBLCLICK] [AT nRow1, nColumn1]
| DRAG TO nRow2, nColumn2, nRow3, nColumn3 ...]
[PIXELS]
[WINDOW cWindowName]
[LEFT | MIDDLE | RIGHT]
[SHIFT] [CONTROL] [ALT]

 Arguments

CLICK | DBLCLICK   Specifies that the mouse is clicked or double-clicked. If you omit the AT clause, the mouse is clicked or double-clicked at the current mouse pointer position.

AT nRow1, nColumn1   Specifies where the mouse is clicked, double-clicked, or the position to which the mouse pointer is moved. If you omit CLICK or DBLCLICK, the mouse pointer is moved to the position specified with nRow1, nColumn1.

Unless you specify a WINDOW, the position specified by nRow1, nColumn1 is relative to the main Visual FoxPro window, and the position is determined by the font of the main Visual FoxPro window. Most fonts can be displayed in a wide variety of sizes, and some are proportionally spaced. A row corresponds to the height of the current font; a column corresponds to the average width of a letter in the current font.

You cannot use the AT clause to choose a Visual FoxPro menu title. Use SYS(1500) - Activate a System Menu Item instead to choose a menu title.

DRAG TO nRow2, nColumn2, nRow3, nColumn3 ...]   Specifies that the mouse pointer is dragged to a position or a set of positions.

When the mouse pointer is dragged, a mouse button is pressed and held down until the mouse pointer reaches the destination position; then the mouse button is released. If you omit the LEFT, MIDDLE, and RIGHT clauses, the left (primary) mouse button is pressed and held down by default.

The DRAG clause accepts multiple sets of nRow, nColumn coordinates, allowing the mouse pointer to be dragged to several positions.

If CLICK or DBLCLICK is included, the mouse is clicked or double-clicked at its current position; then the mouse pointer is dragged to the specified position.

PIXELS   Specifies that the position you include in the AT and DRAG TO clause is in pixels.

If PIXELS is omitted, the position is determined by the font of the main Visual FoxPro window or the window specified with cWindowName. Most fonts can be displayed in a wide variety of sizes, and some are proportionally spaced. A row corresponds to the height of the current font; a column corresponds to the average width of a letter in the current font.

WINDOW cWindowName   Specifies the window to which the coordinates in the AT and DRAG TO clauses are relative. If you don’t include WINDOW and the name of an active window, the coordinates in the AT and DRAG TO clauses are relative to the main Visual FoxPro window.

To specify a system window and or a toolbar, enclose the entire system window or toolbar name in quotation marks.

LEFT | MIDDLE | RIGHT   Specifies which mouse button is pressed when the mouse is clicked, double-clicked, or dragged. If you omit the LEFT, MIDDLE, and RIGHT clauses, the MOUSE commands acts as if you had clicked the mouse button on a Macintosh or clicked the left (primary) mouse button in Windows.

In Visual FoxPro for Macintosh, specifying RIGHT is the equivalent of holding the CONTROL or [image] +OPTION keys while clicking the mouse.

[SHIFT] [CONTROL] [ALT]   Specifies a key that is pressed when the mouse is clicked, double-clicked, or dragged. In Visual FoxPro for Windows, SHIFT specifies the SHIFT key, CONTROL specifies the CTRL key, and ALT specifies the ALT key. In Visual FoxPro for Macintosh, SHIFT specifies the SHIFT key, CONTROL specifies the CONTROL or the [image] keys, and ALT specifies the CONTROL+OPTION key combination.

You can specify any combination of SHIFT, CONTROL, and ALT.

 Remarks

MOUSE is typically used to automate interactive application testing or to create demonstration programs.


 MOUSE Command Example

In the following example, the first command clicks the mouse at row and column 3 of the main Visual FoxPro window. The second command clicks the mouse at row and column 3 of the main Visual FoxPro window, and then drags the mouse pointer to the tenth row and column of the main Visual FoxPro window. The third command drags the mouse pointer from its current position to row and column 20. The fourth command double-clicks the mouse at its current position, then drags the mouse pointer to row and column 30. The last command drags the mouse pointer from its current position to row and column 10, then to row and column 20, and then to row and column 30.

MOUSE CLICK AT 3,3

MOUSE CLICK AT 3,3 DRAG TO 10,10

MOUSE DRAG TO 20,20

MOUSE DBLCLICK DRAG TO 30,30

MOUSE DRAG TO 10,10,20,20,30,30


 See Also

MCOL( ), MDOWN( ), MROW( ), SYS(1500) - Activate a System Menu Item


MouseDown Event

Syntax         Parameters         Remarks         Applies To         See Also

Occurs when the user presses a mouse button.

 Syntax

PROCEDURE Object.MouseDown
[LPARAMETERS nIndex, nButton, nShift, nXCoord, nYCoord]
 – Or –
LPARAMETERS nButton, nShift, nXCoord, nYCoord

 Parameters

You must include an LPARAMETERS or PARAMETERS statement in the event procedure and specify a name for each parameter. Visual FoxPro passes the MouseDown event four of five parameters in the following order:

nIndex   Contains a number which uniquely identifies a control if it is in a control array. The nIndex parameter is passed only when the control is part of a control array.

nButton   Contains a number that specifies which button was pressed to trigger the event: 1 (left), 2 (right), or 4 (middle).

nShift   Contains a number specifying the state of modifier keys when the mouse is pressed. The valid modifier keys are the SHIFT, CTRL, and ALT keys.

The values returned in nShift for individual modifier keys are listed in the following table.

Modifier key values for nShift

Windows key	Value
SHIFT	1
CTRL	2
ALT	4
If more than one modifier key is held down when the mouse is pressed, the nShift argument contains the sum of the values for the modifier keys. For example, if the user holds CTRL while pressing the mouse button, the nShift argument contains 2. But If the user holds CTRL+ALT while pressing the mouse button, the nShift argument contains 6.

nXCoord, nYCoord   Contains the current horizontal (nXCoord) and vertical (nYCoord) position of the mouse pointer within the form. These coordinates are expressed in terms of the form’s coordinate system in the unit of measurement specified by the ScaleMode property of the form.

 Remarks

Use a MouseDown procedure to specify actions to occur when a given mouse button is pressed. Unlike the Click and DblClick events, you can use the MouseDown event to distinguish between the left, right, and middle mouse buttons. You can also write code for mouse-keyboard combinations that use the modifier keys.

You can use a MouseMove event to respond to an event caused by moving the mouse. The nButton argument for MouseDown and MouseUp differs from the nButton argument used for MouseMove. For MouseDown or MouseUp, the nButton argument indicates exactly one button per event; for MouseMove, it indicates the current state of all buttons.


 Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, EditBox, Form, Grid, Header, Image, Label, Line, ListBox, OptionButton, OptionGroup, Page, PageFrame, Shape, Spinner, TextBox, ToolBar


 See Also

Click Event
DblClick Event
MiddleClick Event
MouseMove Event
MousePointer Property
MouseUp Event
MouseWheel Event


MouseIcon Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the mouse pointer icon displayed when the mouse pointer is positioned over an object. Available at design time and run time.

 Syntax

Object.MouseIcon[ = cFileName]

 Settings

cFileName   Specifies the file that is displayed when the mouse pointer is positioned over the object. You can specify a mouse icon (.ICO) file, a mouse cursor (.CUR) file, or an animated mouse cursor (.ANI) file.

 Remarks

To display the mouse icon, set the MousePointer property to 99 (Custom).


 Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, EditBox, Form, Grid, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, _SCREEN, Shape, Spinner, TextBox, ToolBar


 See Also

MousePointer Property


MouseMove Event

Syntax         Parameters         Applies To         See Also

Occurs when the user moves the mouse over an object.

 Syntax

PROCEDURE Object.MouseMove
[LPARAMETERS nIndex, nButton, nShift, nXCoord, nYCoord]
 – Or –
LPARAMETERS nButton, nShift, nXCoord, nYCoord

 Parameters

You must include an LPARAMETERS or PARAMETERS statement in the event procedure and specify a name for each parameter. Visual FoxPro passes the MouseMove event four or five parameters in the following order:

nIndex   Contains a number which uniquely identifies a control if it is in a control array. The nIndex parameter is passed only when the control is in a control array.

nButton   Contains a number that specifies which mouse button was being held down as the mouse was moved, as listed in the following table:

   Mouse button values for nButton

Windows	nButton Value
Left mouse button	1
Right mouse button	2
Middle mouse button	4
If more than one mouse button is held down as the mouse is moved, nButton contains the sum of the values for the mouse buttons. For example, if both the left and right mouse buttons are pressed, the value of nButton is 3.

nShift   Contains a number specifying the state of modifier keys when the mouse is moved. In Visual FoxPro for Windows, the valid modifier keys are the SHIFT, CTRL, and ALT keys.

The values returned in nShift for individual modifier keys are listed in the following table.

   Modifier key values for nShift

Windows key	Value
SHIFT	1
CTRL	2
ALT	4
If more than one modifier key is held down when the mouse is pressed, the nShift argument contains the sum of the values for the modifier keys. For example, in Visual FoxPro for Windows, if the user holds CTRL while pressing the mouse button, the nShift argument contains 2. But if the user holds CTRL+ALT while pressing the mouse button, the nShift argument contains 6.

nXCoord, nYCoord   Contains the current horizontal (nXCoord) and vertical (nYCoord) position of the mouse pointer within the form. These coordinates are always expressed in terms of the form’s coordinate system, in the unit of measurement specified in the ScaleMode property setting.

The MouseMove event is triggered continually as the mouse pointer moves across objects.

Note   You can use MouseDown and MouseUp events to respond to events caused by pressing and releasing mouse buttons.

The nButton parameter for MouseMove differs from the nButton parameter for MouseDown and MouseUp. For MouseMove, the nButton parameter indicates the current state of all buttons; a single MouseMove event can indicate that some, all, or no buttons are pressed. For MouseDown or MouseUp, the nButton parameter indicates exactly one button per event.

Avoid moving a window inside a MouseMove event procedure; it can cause cascading events and generate run-time errors, such as a stack overflow. MouseMove events are triggered when the window moves underneath the pointer. A MouseMove event can be triggered even if the mouse is stationary.


 Applies To

CheckBox, Column, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, EditBox, Form, Grid, Header, Image, Label, Line, ListBox, OptionButton, OptionGroup, Page, PageFrame, Shape, Spinner, TextBox, ToolBar


 See Also

Click Event
DblClick Event
MiddleClick Event
MousePointer Property
MouseDown Event
MouseUp Event
MouseWheel Event


MousePointer Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the shape of the mouse pointer when the mouse is over a particular part of an object at run time. Available at design time and run time.

 Syntax

Object.MousePointer[ = nType]

 Settings

nType   The settings for the MousePointer property are:

Setting	Description
0	(Default) Shape determined by the object.
1	Arrow.
2	Cross. A cross-hair pointer.
3	I-Beam.
4	Icon. A small white square within a black square.
5	Size. A four-pointed arrow pointing north, south, east, west.
6	Size NE SW. A double arrow pointing northeast and southwest.
7	Size NS. A double arrow pointing north and south.
8	Size NW SE. A double arrow pointing northwest and southeast.
9	Size WE. A double arrow pointing west and east.
10	Up Arrow.
11	Hourglass.
12	No Drop.
13	Hide Pointer.
14	Arrow.
 Remarks

You can use the MousePointer property to indicate changes in functionality as the mouse pointer passes over controls on a form or dialog box. You can set the MousePointer property to 11 (Hourglass or Wristwatch) to indicate that the user should wait for a process to finish.


 Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, EditBox, Form, Grid, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, _SCREEN, Shape, Spinner, TextBox, ToolBar


 See Also

MouseMove Event


MouseUp Event

Syntax         Parameters         Remarks         Applies To         See Also

Occurs when the user releases a mouse button.

 Syntax

PROCEDURE Object.MouseUp
[LPARAMETERS nButton, nShift, nXCoord, nYCoord]
 – Or –
LPARAMETERS nIndex, nButton, nShift, nXCoord, nYCoord

 Parameters

You must include an LPARAMETERS or PARAMETERS statement in the event procedure and specify a name for each parameter. Visual FoxPro passes the MouseUp event four of five parameters in the following order.

nIndex   Contains a number which uniquely identifies a control if it’s in a control array.

nButton   In Visual FoxPro for Windows, contains a number that specifies which button was released to trigger the event: 1 (left), 2 (right), or 4 (middle).

nShift   Contains a number specifying the state of modifier keys when the mouse is released. In Visual FoxPro for Windows, the valid modifier keys are the SHIFT, CTRL, and ALT keys.

The values returned in nShift for individual modifier keys are listed in the following table.

   Modifier key values for nShift

Windows key	Value
SHIFT	1
CTRL	2
ALT	4
If more than one modifier key is held down when the mouse is released, the nShift argument contains the sum of the values for the modifier keys. For example, in Visual FoxPro for Windows, if the user holds CTRL while releasing the mouse button, the nShift argument contains 2. But if the user holds CTRL+ALT while releasing the mouse button, the nShift argument contains 6.

nXCoord, nYCoord   Contains the current horizontal (nXCoord) and vertical (nYCoord) position of the mouse pointer within the form. These coordinates are always expressed in terms of the form’s coordinate system in the unit of measurement specified by the ScaleMode property of the form.

 Remarks

Use a MouseUp procedure to specify actions to occur when a given mouse button is released. Unlike the Click and DblClick events, the MouseUp event allows you to distinguish between the left, right, and middle mouse buttons. You can also write code for mouse-keyboard combinations that use the modifier keys.

You can use a MouseMove procedure to respond to an event caused by moving the mouse.

The nButton argument for MouseDown and MouseUp differs from the nButton argument used for MouseMove. For MouseDown or MouseUp, the nButton argument indicates exactly one button per event; for MouseMove, it indicates the current state of all buttons.


 Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, EditBox, Form, Grid, Header, Image, Label, Line, ListBox, OptionButton, OptionGroup, Page, PageFrame, Shape, Spinner, TextBox, ToolBar


 See Also

Click Event
DblClick Event
MiddleClick Event
MouseDown Event
MouseMove Event
MousePointer Property
MouseWheel Event
ScaleMode Property


MouseWheel Event

Syntax         Parameters         Applies To         See Also

Occurs when the user rotates the mouse wheel on a mouse device that has a wheel.

 Syntax

PROCEDURE Object.MouseWheel
LPARAMETERS [nIndex,] nDelta, nShift, nXCoord, nYCoord

 Parameters

You must include an LPARAMETERS or PARAMETERS statement in the event procedure and specify a name for each parameter. Visual FoxPro passes the MouseWheel event four or five parameters in the following order.

nIndex   Contains a number which uniquely identifies a control if it is in a control array. The nIndex parameter is passed only when the control is in a control array.

nDelta   Contains a mouse device dependent number that indicates the distance the mouse wheel is rotated. A negative value indicates the mouse wheel is rotated backwards; a positive value indicates the mouse wheel is rotated forwards.

nShift   Contains a number specifying the state of modifier keys when the mouse wheel is rotated. The valid modifier keys are the SHIFT, CTRL, and ALT keys.

The values returned in nShift for individual modifier keys are listed in the following table.

Value	Key
1	SHIFT
2	CTRL
4	ALT
If more than one modifier key is held down when the mouse wheel is rotated, the nShift argument contains the sum of the values for the modifier keys. For example, if the user holds CTRL while rotating the mouse wheel, the nShift argument contains 2. But if the user holds CTRL+ALT while rotating the mouse wheel, the nShift argument contains 6.

nXCoord, nYCoord   Contains the current horizontal (nXCoord) and vertical (nYCoord) position of the mouse pointer within the form. These coordinates are always expressed in terms of the form’s coordinate system, in the unit of measurement specified in the ScaleMode property setting.


 Applies To

CheckBox, Column, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, EditBox, Form, Grid, Header, Image, Label, Line, ListBox, OptionButton, OptionGroup, Page, PageFrame, Shape, Spinner, TextBox, ToolBar


 See Also

Click Event
MiddleClick Event
MousePointer Property
MouseDown Event
MouseUp Event


Movable Property

Syntax         Settings         Applies To         See Also

Specifies whether an object can be moved at run time by the user. Available at design time; read-only at run time.

 Syntax

Object.Movable[ = lExpr]

 Settings

lExpr   The settings for the Movable property are:

Setting	Description
True (.T.)	(Default) The object can be moved. For forms in Visual FoxPro for Windows, the Move command is added to the Control menu.
False (.F.)	The object cannot be moved. For grid columns, you cannot move the column by direct manipulation. However, the column can be moved if you change the column’s ColumnOrder property or move another column on top of it.


 Applies To

Column, Form, _SCREEN, ToolBar


 See Also

Sizable Property


Move Method

Syntax         Arguments         Remarks         Applies To         See Also

Moves an object.

 Syntax

Object.Move (nLeft [, nTop [, nWidth [, nHeight]]])

 Arguments

nLeft   Specifies the horizontal coordinate for the left edge of the object. nLeft is a single-precision value.

nTop   Specifies the vertical coordinate for the top edge of the object. nTop is a single-precision value.

nWidth   Specifies the new width of the object. nWidth is a single-precision value.

nHeight   Specifies the new height of the object. nHeight is a single-precision value.

 Remarks

Only the nLeft argument is required. However, to include any other arguments, you must also include all arguments in the syntax before the argument you want to include. For example, you cannot specify nWidth without specifying nLeft and nTop. Any trailing arguments that are unspecified remain unchanged.

Moving a Form on the screen or moving a control on a form is always relative to the origin (0,0), which is the upper-left corner. When moving controls in a container, the coordinate system of the container is used.


 Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, EditBox, Form, Grid, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, PageFrame, _SCREEN, Shape, Spinner, TextBox, ToolBar


 See Also

Top Property
Width Property


MOVE POPUP Command

Syntax         Arguments         Remarks         Example         See Also

Moves a user-defined menu created with DEFINE POPUP to a new location.

 Syntax

MOVE POPUP MenuName TO nRow1, nColumn1 | BY nRow2, nColumn2

 Arguments

MenuName   Specifies the menu to move.

In Visual FoxPro, you cannot move the system menu.

TO nRow1, nColumn1   Moves the menu to a location, specified by nRow1, nColumn1, in a user-defined window or in the main Visual FoxPro window.

BY nRow2, nColumn2   Moves the menu to a location relative to its current position. nRow2 specifies the number of rows to move the menu (down if nRow2 is positive, up if negative). The numeric expression nColumn2 specifies the number of columns to move the menu (to the right if nColumn2 is positive, to the left if negative).

 Remarks

A menu can be moved to a specific position or relative to its current position. If a menu has been defined, it can be moved; it doesn't have to be active or visible.


 MOVE POPUP Command Example

The following example defines and activates a menu, then moves and changes its size.

CLOSE DATABASE

CLEAR

DEFINE POPUP popMovIn FROM 2,2 TO 7, 14 PROMPT FILES LIKE *.PRG ;

TITLE 'Programs'

ACTIVATE POPUP popMovIn NOWAIT

=CHRSAW(2)

MOVE POPUP popMovIn BY 5,5  	&& Move menu down

=CHRSAW(2)

SIZE POPUP popMovIn BY 5,5  	&& Enlarge the menu

=CHRSAW(2)

SIZE POPUP popMovIn BY -5,-5	  && Shrink the menu

=CHRSAW(2)

MOVE POPUP popMovIn BY -5,-5  	&& Move menu up

=CHRSAW(2)

DEACTIVATE POPUP popMovIn

RELEASE POPUP popMovIn


 See Also

ACTIVATE POPUP
DEFINE POPUP
SIZE POPUP


MOVE WINDOW Command

Syntax         Arguments         Remarks         Example         See Also

Moves a user-defined window created with DEFINE WINDOW, or a Visual FoxPro system window (such as the Command window or Browse window) to a new location.

 Syntax

MOVE WINDOW WindowName TO nRow1, nColumn1
| BY nRow2, nColumn2 | CENTER

 Arguments

WindowName   Specifies the name of the window to move.

TO nRow1, nColumn1   Moves the window to a location, specified by nRow1, nColumn1, in the main Visual FoxPro window or in a user-defined window.

BY nRow2, nColumn2   Moves a window to a location relative to its current position. The numeric expression nRow2 specifies the number of rows to move the window (down if nRow2 is positive, up if negative). The numeric expression nColumn2 specifies the number of columns to move the window (to the right if nColumn2 is positive, to the left if negative).

CENTER   Centers a window in the main Visual FoxPro window or in its parent window.

 Remarks

A window can be moved to a specific position or relative to its current position. If a window is defined, it can be moved; it doesn't have to be active or visible.

To move a system window and or a toolbar (in Visual FoxPro), enclose the entire system window or toolbar name in quotation marks. For example, to move the Report Controls toolbar (when it isn’t docked) in Visual FoxPro, issue the following command:

MOVE WINDOW "Report Controls" BY 1,1


 MOVE WINDOW Command Example

In the following example, after the window named wEnter is defined and activated, the window is moved.

DEFINE WINDOW wEnter FROM 10,4 TO 15,54 SYSTEM ;

TITLE "Nomadic Window"

ACTIVATE WINDOW wEnter

WAIT WINDOW 'Press any key to move the window'

MOVE WINDOW wEnter TO 20,15

WAIT WINDOW 'Press any key to center the window'

MOVE WINDOW wEnter CENTER

WAIT WINDOW 'Press any key to release the window'

RELEASE WINDOW wEnter


 See Also

ACTIVATE WINDOW


Moved Event

Syntax         Remarks         Applies To         See Also

Occurs when an object is moved to a new position or a container object’s Top or Left property settings have been changed programmatically.

 Syntax

PROCEDURE Object.Moved

 Remarks

Occurs when an object is moved to a new position or when the settings for the Top or Left properties have been changed in code.


 Applies To

Column, Container Object, Control Object, Form, Grid, OLE Bound Control, OLE Container Control, PageFrame, ToolBar


 See Also

ColumnOrder Property
Left Property
Top Property


MoverBars Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether mover bars are displayed on a ListBox control. Available at design time; read-write at run time.

 Syntax

ListBox.MoverBars[ = lExpr]

 Settings

lExpr   The settings for the MoverBars property are:

Setting	Description
True (.T.)	Mover bars are displayed. Users can interactively re-order the contents of the control.
False (.F.)	(Default) Mover bars are not displayed.
 Remarks

The MoverBars property is only available if the RowSourceType property is set to 0 (None) or 1 (Value).


 Applies To

ListBox


 See Also

RowSourceType Property
ScrollBars Property


MRKBAR( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Determines whether a menu item on a user-defined or Visual FoxPro system menu is marked.

 Syntax

MRKBAR(cMenuName, nMenuItemNumber | cSystemMenuItemName)

 Returns

Logical

 Arguments

cMenuName   Specifies the name of the menu containing the menu item. The menu can be a Visual FoxPro system menu (such as _MFILE, MEDIT, or _MDATA).

nMenuItemNumber   Specifies the number of a menu item in a user-defined menu. A menu item’s number is specified when the menu item is created with DEFINE BAR.

cSystemMenuItemName   Specifies the name of a Visual FoxPro system menu item. For example, the following command displays a logical value specifying if the New menu item on the File menu is marked.

? MRKBAR('_MFILE', _MFI_NEW)

 Remarks

Use SET MARK OF to mark or unmark a menu item.

If the specified menu item is marked, MRKBAR( ) returns true (.T.); otherwise, MRKBAR( ) returns false (.F.).

For an example of using MRKBAR( ), see CNTBAR( ).


 See Also

MRKPAD( )
SET MARK OF
SET MARK TO


MRKPAD( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Determines whether a menu title on a user-defined menu bar or on the Visual FoxPro system menu bar is marked.

 Syntax

MRKPAD(cMenuBarName, cMenuTitleName)

 Returns

Logical

 Arguments

cMenuBarName   Specifies the name of the menu bar containing the menu title.

cMenuTitleName   Specifies the name of the menu title.

 Remarks

Use SET MARK OF to mark or unmark a menu title.

If the specified menu title is marked, MRKPAD( ) returns true (.T.); otherwise, MRKPAD( ) returns false (.F.).


 MRKPAD( ) Function Example

The following program example, named MARKPAD.PRG, uses MRKPAD( ) to toggle the mark character of a menu title when you choose it.

The current system menu bar is first saved to memory with SET SYSMENU SAVE, and all the system menu items are removed with SET SYSMENU TO.

Several system menu items are created with DEFINE PAD. When you choose a menu item, the choice procedure is executed. choice displays the name of the menu item you choose and the name of the menu bar. SET MARK OF is used with MRKPAD( ) to display or remove the menu item’s mark character. If you choose the Exit menu, the original Visual FoxPro system menu is restored.

*** Name this program MARKPAD.PRG ***

CLEAR

SET SYSMENU SAVE

SET SYSMENU TO

SET MARK OF MENU _MSYSMENU TO CHR(4)

PUBLIC glMarkPad

glMarkPad = .T.

DEFINE PAD padSys OF _MSYSMENU PROMPT '\<System'  COLOR SCHEME 3 ;

KEY ALT+S, ''

DEFINE PAD padEdit OF _MSYSMENU PROMPT '\<Edit'    COLOR SCHEME 3 ;

KEY ALT+E, ''

DEFINE PAD padRecord OF _MSYSMENU PROMPT '\<Record'  COLOR SCHEME 3 ;

KEY ALT+R, ''

DEFINE PAD padWindow OF _MSYSMENU PROMPT '\<Window'  COLOR SCHEME 3 KEY ALT+W, ''

DEFINE PAD padReport OF _MSYSMENU PROMPT 'Re\<ports' COLOR SCHEME 3 ;

KEY ALT+P, ''

DEFINE PAD padExit OF _MSYSMENU PROMPT 'E\<xit'    COLOR SCHEME 3 ;

KEY ALT+X, ''

ON SELECTION MENU _MSYSMENU ;

DO choice IN markpad WITH PAD( ), MENU( )

PROCEDURE choice

PARAMETER gcPad, gcMenu

WAIT WINDOW 'You chose ' + gcPad + ;

' from menu ' + gcMenu NOWAIT

SET MARK OF PAD (gcPad) OF _MSYSMENU TO ;

! MRKPAD('_MSYSMENU', gcPad)

glMarkPad= ! glMarkPad

IF gcPad = 'PADEXIT'

SET SYSMENU TO DEFAULT

ENDIF


 See Also

MRKBAR( )
SET MARK OF


MROW( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns the row position of the mouse pointer in the main Visual FoxPro window or in a user-defined window.

 Syntax

MROW([cWindowName [, nScaleMode]])

 Returns

Numeric

 Arguments

cWindowName   Specifies the name of a window whose mouse-pointer row position MROW( ) returns.

nScaleMode   Specifies the unit of measurement for the value MROW( ) returns. The settings for nScaleMode are:

nScaleMode	Description
0	(Default) Foxels. A foxel is equivalent to the average height and width of a character based on the current font of the form in which an object is contained. Foxels are useful in developing cross-platform applications for character-based and graphical platforms.
3	Pixels. A pixel is the smallest element that can be displayed on a screen or printer. Pixels are screen-dependent.
 Remarks

MROW( ) returns the main Visual FoxPro window row position of the mouse pointer if there is no active user-defined window and you omit the optional argument.

MROW( ) returns the mouse pointer row coordinate relative to the active user-defined window if there is an active user-defined window and you omit the optional argument. MROW( ) returns a value of –1 if the mouse pointer is positioned outside the user-defined window or if no mouse driver is loaded and there is no output window.

nScaleMode   Specifies the unit of measurement for the value MROW( ) returns. The settings for nScaleMode are:

nScaleMode	Description
0	(Default) Foxels. A foxel is equivalent to the average height and width of a character based on the current font of the form in which an object is contained. Foxels are useful in developing cross-platform applications for character-based and graphical platforms.
3	Pixels. A pixel is the smallest element that can be displayed on a screen or printer. Pixels are screen-dependent.


 See Also

COL( )
ISMOUSE( )
MCOL( )
ROW( )
WCOLS( )
WROWS( )


MTON( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns a Numeric value from a Currency expression.

 Syntax

MTON(mExpression)

 Returns

Numeric

 Arguments

mExpression   Specifies a Currency expression whose value MTON( ) returns. mExpression must evaluate to a valid Currency value or Visual FoxPro generates an error.

Currency values are created by placing a dollar sign ($) prefix immediately before a Numeric value.

 Remarks

MTON( ) returns a Numeric value with four decimal places.


 MTON( ) Function Example

The following example creates a currency type variable named gyMoney. TYPE( ) displays Y, indicating the variable is a currency type. MTON( ) is used to convert the variable to a numeric type, and TYPE( ) now displays N, indicating the variable is a numeric type after the conversion.

STORE $24.95 TO gyMoney  && Creates a currency type memory variable

CLEAR

? "gyMoney is type: "

?? TYPE('gyMoney')  && Displays Y, currency type value

gyMoney = MTON(gyMoney)	  &&  Converts gyMoney to a numeric value

? "gyMoney is now type: "

?? TYPE('gyMoney')  && Displays N, numeric type value


 See Also

NTOM( )


MultiSelect Property

Syntax         Settings         Remarks         Example         Applies To         See Also

Specifies whether a user can make multiple selections in a ListBox control and how the multiple selections can be made. Available at design time; read-write at run time.

 Syntax

ListBox.MultiSelect[ = nChoice]

 Settings

nChoice   The settings for the MultiSelect property are:

Setting	Description
0	(Default) Multiple selection isn’t allowed.
1	Multiple selection is allowed. To select multiple items in a ListBox control, hold the CTRL key down while clicking the items.
 Remarks

Set MultiSelect to true (.T.) to enable a user to select multiple items in a list. You can use the Selected property to determine which items are selected.


 MultiSelect Property Example

The following example creates a ListBox. The MultiSelect property for  the list box is set to true (.T.), allowing you to make multiple selections from the list box. The source of the items that appear in the list box items is an array; the array is specified with the RowSourceType and RowSource properties.

The ListCount property is used within a FOR ... ENDFOR loop to display the item or items you choose in the list box. The Selected property is used to determine the items you chose, and the List property is used to return the items.

CLEAR

DIMENSION gaMyListArray(10)

FOR gnCount = 1 to 10  && Fill the array with letters

STORE REPLICATE(CHR(gnCount+64),6) TO gaMyListArray(gnCount)

ENDFOR

frmMyForm = CREATEOBJECT('Form')  && Create a Form

frmMyForm.Closable = .f.  && Disable the Control menu box

frmMyForm.Move(150,10)  && Move the form

frmMyForm.AddObject('cmbCommand1','cmdMyCmdBtn')  && Add "Quit" Command button

frmMyForm.AddObject('lstListBox1','lstMyListBox')  && Add ListBox control

frmMyForm.lstListBox1.RowSourceType = 5  && Specifies an array

frmMyForm.lstListBox1.RowSource = 'gaMyListArray' && Array containing listbox items

frmMyForm.cmbCommand1.Visible =.T.  && "Quit" Command button visible

frmMyForm.lstListBox1.Visible =.T.  && "List Box visible

frmMyForm.SHOW  && Display the form

READ EVENTS  && Start event processing

DEFINE CLASS cmdMyCmdBtn AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 210  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close Form

CLEAR  && Clear main Visual FoxPro window

ENDDEFINE

DEFINE CLASS lstMyListBox AS ListBox  && Create ListBox control

Left = 10  && List Box column

Top = 10  && List Box row

MultiSelect = .T.  && Allow selecting more than 1 item

PROCEDURE Click

ACTIVATE SCREEN

CLEAR

? "Selected items:"

? "---------------"

FOR nCnt = 1 TO ThisForm.lstListBox1.ListCount

IF ThisForm.lstListBox1.Selected(nCnt)  && Is item selected?

? SPACE(5) + ThisForm.lstListBox1.List(nCnt) && Show item

ENDIF

ENDFOR

ENDDEFINE


 Applies To

ListBox


 See Also

AddItem Method
Clear Method
List Property
ListCount Property
NewItemID Property
RemoveItem Method
Selected Property
TopItemID Property


MWINDOW( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns the name of the window over which the mouse pointer is positioned.

 Syntax

MWINDOW([cWindowName])

 Returns

Character, Logical

 Arguments

cWindowName   Specifies a window name. If the mouse pointer is positioned over the specified window, MWINDOW( ) returns true (.T.); otherwise, MWINDOW( ) returns false (.F.).

 Remarks

If you omit the optional window name, MWINDOW( ) returns the name of the window over which the mouse pointer is positioned, or an empty string if the mouse pointer is positioned over the main Visual FoxPro window, over the Macintosh desktop, or over any other window that is not part of Visual FoxPro.


 See Also

MCOL( )
MDOWN( )
MROW( )
WONTOP( )
WOUTPUT( )


Name Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the name used to reference an object in code. Available at design time; read-write at run time.

 Syntax

Object.Name[ = cName]

 Settings

cName   Specifies the name used to reference the object in code.

 Remarks

The default name for new objects is the type of object plus a unique integer. For example, the first new Form object is Form1, and the third text box you create on a Form is Text3.

Note   If the object is the first object in the object hierarchy (that is, the outermost container object), use the object variable to reference the object instead of the Name property.


 Applies To

CheckBox, Column, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, Cursor, Custom, DataEnvironment, EditBox, Form, FormSet, Grid, Header, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, Page, PageFrame, Relation, _SCREEN, Shape, Spinner, TextBox, Timer, ToolBar


 See Also

Caption Property
NewIndex Property
NewItemID Property


NDX( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns the name of an open index (.IDX) file for the current or specified table.

 Syntax

NDX(nIndexNumber [, nWorkArea | cTableAlias])

 Returns

Character

 Arguments

nIndexNumber   Specifies which .IDX file name to return. USE and SET INDEX both support an index file list that lets you open .IDX files for a table. The order of the file names in this index file list determines which .IDX file name NDX( ) returns. For example, if nIndexNumber is 1, NDX( ) returns the name of the first .IDX file in the index file list; if nIndexNumber is 2, NDX( ) returns the second .IDX file name, and so on. NDX( ) ignores names of compound index (.CDX) files in the index file list.

NDX( ) returns an empty string if nIndexNumber is greater than the number of .IDX files in the index file list.

nWorkArea   Specifies the work area number for .IDX files open in a work area other than the current one. NDX( ) returns an empty string if no table is open in the work area you specify. If you omit nWorkArea, NDX( ) returns the names of .IDX files open with the table in the current work area.

cTableAlias   Specifies the table alias for .IDX files open in a work area other than the current one. If no table has the alias you include, Visual FoxPro generates an error message. If you omit cTableAlias, NDX( ) returns the names of .IDX files open with the table in the current work area.

 Remarks

The CDX( ) and MDX( ) functions can be used to return the names of open compound (.CDX) index files.

In Visual FoxPro for Windows, when SET FULLPATH is ON, NDX( ) returns the path to the .IDX file with the .IDX file name. When SET FULLPATH is OFF, NDX( ) returns the drive the .IDX file resides on with the .IDX file name.


 See Also

CDX( )
INDEX
MDX( )
SET FULLPATH
SET INDEX
SYS(14) - Index Expression
TAG( )
USE


NewIndex Property

Syntax         Remarks         Applies To         See Also

Specifies the index of the item most recently added to a ComboBox or ListBox control. Not available at design time; read-only at run time.

 Syntax

Control.NewIndex

 Remarks

The NewIndex property is especially useful when adding items to a sorted list.


 Applies To

ComboBox, ListBox


 See Also

Caption Property
NewItemID Property
Name Property


NewItemID Property

Syntax         Remarks         Applies To         See Also

Specifies the item ID of the item most recently added to a ComboBox or ListBox control. Not available at design time; read-only at run time.

 Syntax

[Form.]Control.NewItemID

 Remarks

For more information about the differences between using an item ID or an index, see AddItem Method or AddListItem Method.


 Applies To

ComboBox, ListBox


 See Also

AddItem Method
AddListItem Method
Clear Method
ItemData Property
List Property
ListCount Property
MultiSelect Property
NewIndex Property
RemoveItem Method
Selected Property
TopItemID Property


NoDataOnLoad Property

Syntax         Settings         Remarks         Applies To         See Also

Causes the view associated with a Cursor to activate without downloading data. Available at design time; read-write at run time.

 Syntax

DataEnvironment.Cursor.NoDataOnLoad[ = lExpr]

 Settings

lExpr   The settings for the NoDataOnLoad property are:

Setting	Description
True (.T.)	The view associated with the Cursor is opened without downloading data.
False (.F.)	(Default) The view associated with the Cursor is opened with data.
 Remarks

Note   When the Cursor object is accessed using CURSORSETPROP( ), the NoDataOnLoad property is read-only at run time.

Use the NoDataOnLoad property to ensure that the FormSet or Form associated with the view loads quickly (it can be time-consuming to download data from a backend server.) You can use REQUERY( ) in conjunction with NoDataOnLoad to download data into the active view once the Form is loaded.

The NoDataOnLoad property mimics the behavior of the NODATA clause of USE.


 Applies To

Cursor


 See Also

REQUERY( )
USE


NORMALIZE( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Converts a character expression, supplied by a user, into a form that can be compared with Visual FoxPro function return values.

 Syntax

NORMALIZE(cExpression)

 Returns

Character

 Arguments

cExpression   Specifies the character expression to normalize.

 Remarks

NORMALIZE( ) returns a character string from the character expression cExpression with the following changes:

•	The character expression is converted to uppercase. However, embedded strings are not changed. An example of an embedded string is "Hello" in the character expression "LEFT('Hello',1)".

•	Any abbreviated Visual FoxPro keywords in the character expression are expanded to their full length.

•	Any -> operators separating aliases from field names are converted to periods.

•	The syntax of any Visual FoxPro commands or functions within the character expression is checked, although the expression is not evaluated. If the syntax is incorrect, Visual FoxPro generates a syntax error. NORMALIZE( ) does not check for the existence of any fields, tables, memory variables, user-defined functions, or other references in the character expression.

For example, a user may enter an index expression like the following in the Expression Builder:

UPPE(cust->lname) + UPPE(cust->fname)

While this is a valid Visual FoxPro index key expression, it's difficult to compare this to the return values from a Visual FoxPro function like KEY( ). NORMALIZE( ) returns the following character string for the expression above:

UPPER(CUST.LNAME) + UPPER(CUST.FNAME)

This can be easily compared to the value returned by a function like KEY( ), allowing you, in this example, to determine if an index or index tag with the user-supplied index expression already exists.


 See Also

EVALUATE( )
ISUPPER( )
PROPER( )
UPPER( )


NOTE Command

Syntax         Arguments         Remarks         Example         See Also

Indicates the beginning of a nonexecuting comment line in a program file.

 Syntax

NOTE [Comments]

 Arguments

Comments   Specifies the comment.

 Remarks

Place a semicolon (;) at the end of each comment line that continues on a following line.


 NOTE Command Example

NOTE  Initialize the page number;

variable.

STORE 1 to gnPageNum

* Set up the loop

DO WHILE gnPageNum <= 25  && loop 25 times

gnPageNum = gnPageNum + 1

ENDDO  && DO WHILE gnPageNum <= 25


 See Also

&&
*
MODIFY COMMAND
MODIFY FILE


NTOM( ) Function

Syntax         Returns         Arguments         Example         See Also

Returns a Currency value with four decimal places from a numeric expression.

 Syntax

NTOM(nExpression)

 Returns

Currency

 Arguments

nExpression   Specifies a numeric expression whose Currency value NTOM( ) returns. If nExpression has more than four decimal places, it is rounded to four decimal places. If nExpression has less than four decimals places, it is padded with zeros until four decimal places are created.


 NTOM( ) Function Example

The following example creates a numeric type variable named gnNumeric. TYPE( ) displays N, indicating the variable is a numeric type. NTOM( ) is used to convert the variable to a currency type, and TYPE( ) now displays Y, indicating the variable is a currency type after the conversion.

STORE 24.95 TO gnNumeric  && Creates a numeric type memory variable

CLEAR

? "gnNumeric is type: "

?? TYPE('gnNumeric')  && Displays N, numeric type value

gnNumeric= NTOM(gnNumeric)	  &&  Converts gnNumeric to a currency value

? "gnNumeric is now type: "

?? TYPE('gnNumeric')  && Displays Y, currency type value


 See Also

MTON( )


NullDisplay Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the text that is displayed to indicate null values. Available at design time and run time.

 Syntax

Object.NullDisplay[ = cNullText]

 Settings

cNullText   Specifies the text that is displayed for null values. .NULL. is the default value.

 Remarks

This property changes the null display for individual objects only. To change null display for all objects, use SET NULLDISPLAY.


 Applies To

ComboBox, EditBox, ListBox, Spinner, TextBox


 See Also

CREATE TABLE - SQL, SET NULLDISPLAY


NumberOfElements Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies how many items in an array are used to fill the list portion of a ComboBox or ListBox control. Available at design time and run time.

 Syntax

[Form.]Control.NumberOfElements[ = nTotal]

 Settings

nTotal   Specifies the number of elements that a list can contain.

 Remarks

Available only when the ListSourceType property is set to 5 (Array).

NumberOfElements is useful to limit the number of elements of an array that are displayed in a list. The number of elements used for the list begins with the FirstElement property setting and includes the number of elements specified in the NumberOfElements property setting.


 Applies To

ComboBox, ListBox


 See Also

FirstElement Property


NUMLOCK( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the current mode of the NUM LOCK key or sets the mode of the NUM LOCK key on or off.

 Syntax

NUMLOCK([lExpression])

 Returns

Logical

 Arguments

lExpression   Turns the NUM LOCK key on or off. If lExpression is true (.T.), the NUM LOCK key is turned on; if lExpression is false (.F.), the NUM LOCK key is turned off. NUMLOCK( ) returns a logical value corresponding to the NUM LOCK key setting before NUMLOCK(.T.) or NUMLOCK(.F.) is issued.

 Remarks

NUMLOCK( ) returns true (.T.) if the NUM LOCK key is on (pressing a key on the numeric keypad returns a number), or false (.F.) if NUM LOCK is off (pressing a key on the numeric keypad moves the cursor).

In Visual FoxPro for Macintosh, the NUM LOCK key setting can be changed by pressing SHIFT+CLEAR.


 NUMLOCK( ) Function Example

In the following example, the equal sign (=) is used to execute NUMLOCK( ) without returning a value.

gcOldLock = NUMLOCK( )  && Save original setting

WAIT WINDOW 'Press a key to turn Num Lock on'

= NUMLOCK(.T.)  && Turn Num Lock on

WAIT WINDOW 'Press a key to turn Num Lock off'

= NUMLOCK(!NUMLOCK( ))  && Toggle Num Lock to the opposite value

WAIT WINDOW 'Press a key to restore original Num Lock setting'

= NUMLOCK(gcOldLock)	  && Return to original setting


 See Also

CAPSLOCK( )
INSMODE( )


NVL( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns a non-null value from two expressions.

 Syntax

NVL(eExpression1, eExpression2)

 Returns

Character, Date, DateTime, Numeric, Currency, Logical, or the null value

 Arguments

eExpression1, eExpression2   NVL( ) returns eExpression2 if eExpression1 evaluates to a null value. NVL( ) returns eExpression1 if eExpression1 is not a null value. eExpression1 and eExpression2 may be any data type. NVL( ) returns .NULL. if both eExpression1 and eExpression2 both evaluate to the null value.

 Remarks

Use NVL( ) to remove null values from calculations or operations where null values are not supported or are not relevant.


 NVL( ) Function Example

The following example creates a memory variable named glMyNull that contains the null value. NVL( ) is used to return a non-null value from glMyNull and another expression.

STORE .NULL. TO glMyNull  && A memory variable containing the null value

CLEAR

? NVL(.T., glMyNull)  && Displays .T.

? NVL(glMyNull, glMyNull)  && Displays .NULL.


 See Also

ISNULL( )
SET NULL


Object Property

Syntax         Settings         Remarks         Applies To         See Also

Provides access to the OLE server properties and methods for an OLE object. Not available at design time. Depending on the OLE server, the properties for the OLE object may be read-only or read-write at run time.

 Syntax

OLEObject.Object[.Property] [= eValue]
 – Or –

OLEObject.Object[.Method]

 Settings

Property   Specifies a property the OLE server supports for the OLE object.

eValue   Specifies a value for a property the OLE server supports for the OLE object.

Method   Specifies a method the OLE server supports for the OLE object

 Remarks

For information about the properties and methods supported by the OLE server, see the documentation for the OLE enabled application that created the object. For example, if the OLE object is a Microsoft Excel worksheet, see the Excel documentation for the properties and methods supported by Excel (an OLE enabled application).


 Applies To

OLE Bound Control, OLE Container Control


 See Also

CREATEOBJECT( )
GETOBJECT( )


Objects Collection

Syntax         Settings         Remarks         Applies To          See Also

An array to access objects in an Application object.

 Syntax

ApplicationObject.Objects(nIndex)

 Settings

nIndex   Uniquely identifies an object in the Application object. Note that nIndex might not correspond to the order in which the objects were created.

 Remarks

The Objects collection can be used to determine the current objects for an Application object.


Applies To

Application Object, _VFP System Variable


 See Also

Forms Property


OBJNUM( ) Function

Included for backward compatibility. Use the TabIndex property for controls instead.


OBJTOCLIENT( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns a position or dimension of a control or object relative to its form.

 Syntax

OBJTOCLIENT(ObjectName, nPosition)

 Returns

Numeric

 Arguments

ObjectName   Specifies the name of the control or object for which the form position is returned.

nPosition   Specifies which form position or dimension of the control or object is returned. The following table lists the values for nPosition and the corresponding position or dimension returned.

nPosition	Position or Dimension
1	Top
2	Left
3	Width
4	Height
 Remarks

OBJTOCLIENT( ) returns the position or dimension of a control or object relative to the client area of the form on which it resides. For example, a control or object can be placed on a page in a page frame, and the page frame is placed on a form. The Top, Left, Width, and Height properties return the position or dimension of a control or object relative to the page on which it is placed. However, you can use OBJTOCLIENT( ) to determine the position or dimension of a control or object relative to the form on which the page is placed.

The value returned by OBJTOCLIENT( ) is in pixels.


 OBJTOCLIENT( ) Function Example

The following example uses OBJTOCLIENT( ) to display the positions and dimensions of two check boxes relative to the form they’re placed on. The Top, Left, Width, and Height properties are also used to display the positions and dimensions of the two check boxes relative to the page frame on which they’re placed.

A command button and a page frame are placed on a form. The PageCount property is used to specify the number of pages on the page frame. The Tabs property is set to true (.T.) to specify that the page frame has tabs for each page. Check boxes are placed on each page in different positions.

When a check box is clicked, the Click procedure for the check box is executed. If the check box is checked, the Top, Left, Width, and Height properties are used to display the positions and dimensions of the check box relative to the page frame, and OBJTOCLIENT( ) is used to display the positions and dimensions of the check box relative to the form. If the check box is unchecked, the main Visual FoxPro window is cleared.

CLEAR

STORE _DBLCLICK TO gnDblClick  && Save double-click value

STORE 0.05 TO _DBLCLICK  && Make double-click unlikely

frmMyForm = CREATEOBJECT('Form')  && Create a form

frmMyForm.Closable = .f.  && Disable the Control-menu box

frmMyForm.Move(150,10)  && Move the form

frmMyForm.AddObject('cmbCommand1','cmdMyCmdBtn')  && Add Command button

frmMyForm.AddObject('pgfPageFrame1','pgfMyPageFrame')  && Add PageFrame

frmMyForm.pgfPageFrame1.Page1.AddObject('chkCheckBox1','chkMyCheckBox1')

frmMyForm.pgfPageFrame1.Page2.AddObject('chkCheckBox2','chkMyCheckBox2')

frmMyForm.cmbCommand1.Visible =.T.  && "Quit" Command button visible

frmMyForm.pgfPageFrame1.Visible =.T.  && PageFrame visible

frmMyForm.pgfPageFrame1.Page1.chkCheckBox1.Visible =.T.

frmMyForm.pgfPageFrame1.Page2.chkCheckBox2.Visible =.T.

frmMyForm.SHOW  && Display the form

READ EVENTS  && Start event processing

DEFINE CLASS cmdMyCmdBtn AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 210  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close Form

CLEAR  && Clear main Visual FoxPro window

STORE gnDblClick TO _DBLCLICK  && Restore double-click value

ENDDEFINE

DEFINE CLASS pgfMyPageFrame AS PageFrame  && Create PageFrame

Left = 10  && PageFrame  column

Top = 10  && PageFrame  row

Height = 175  && PageFrame  height

Width = 350  && PageFrame  height

PageCount = 2  && 2 Pages on the PageFrame

Tabs = .T.  && Tabs visible

ENDDEFINE

DEFINE CLASS chkMyCheckBox1 AS CheckBox  && Create first Check Box

Top = 0

Width = 200

Caption = 'Display Position'

PROCEDURE Click

DO CASE

CASE ThisForm.pgfPageFrame1.Page1.chkCheckBox1.Value = 0

ACTIVATE SCREEN

CLEAR

CASE ThisForm.pgfPageFrame1.Page1.chkCheckBox1.Value = 1

ACTIVATE SCREEN

CLEAR

? 'Positions relative'

? 'to PageFrame:'

?

? 'Top: '

?? ALLTRIM(STR;

(ThisForm.pgfPageFrame1.Page1.chkCheckBox1.Top))

? 'Left: '

?? ALLTRIM(STR;

(ThisForm.pgfPageFrame1.Page1.chkCheckBox1.Left))

? 'Width: '

?? ALLTRIM(STR;

(ThisForm.pgfPageFrame1.Page1.chkCheckBox1.Width))

? 'Height: '

?? ALLTRIM(STR;

(ThisForm.pgfPageFrame1.Page1.chkCheckBox1.Height))

?

? 'Positions relative'

? 'to Form:'

?

? 'Top: '

?? ALLTRIM(STR(OBJTOCLIENT;

(ThisForm.pgfPageFrame1.Page1.chkCheckBox1,1)))

? 'Left: '

?? ALLTRIM(STR(OBJTOCLIENT;

(ThisForm.pgfPageFrame1.Page1.chkCheckBox1,2)))

? 'Width: '

?? ALLTRIM(STR(OBJTOCLIENT;

(ThisForm.pgfPageFrame1.Page1.chkCheckBox1,3)))

? 'Height: '

?? ALLTRIM(STR(OBJTOCLIENT(ThisForm.pgfPageFrame1.Page1.chkCheckBox1,4)))

ENDCASE

ENDDEFINE

DEFINE CLASS chkMyCheckBox2 AS CheckBox  && Create second Check Box

Top = 30

Left = 175

Width = 200

Caption = 'Display Position'

PROCEDURE CLICK

DO CASE

CASE ThisForm.pgfPageFrame1.Page2.chkCheckBox2.Value = 0

ACTIVATE SCREEN

CLEAR

CASE ThisForm.pgfPageFrame1.Page2.chkCheckBox2.Value = 1

ACTIVATE SCREEN

CLEAR

? 'Positions relative'

? 'to PageFrame:'

?

? 'Top: '

?? ALLTRIM(STR(ThisForm.pgfPageFrame1.Page2.chkCheckBox2.Top))

? 'Left: '

?? ALLTRIM(STR;

(ThisForm.pgfPageFrame1.Page2.chkCheckBox2.Left))

? 'Width: '

?? ALLTRIM(STR;

(ThisForm.pgfPageFrame1.Page2.chkCheckBox2.Width))

? 'Height: '

?? ALLTRIM(STR;

(ThisForm.pgfPageFrame1.Page2.chkCheckBox2.Height))

?

? 'Positions relative'

? 'to Form:'

?

? 'Top: '

?? ALLTRIM(STR(OBJTOCLIENT;

(ThisForm.pgfPageFrame1.Page2.chkCheckBox2,1)))

? 'Left: '

?? ALLTRIM(STR(OBJTOCLIENT;

(ThisForm.pgfPageFrame1.Page2.chkCheckBox2,2)))

? 'Width: '

?? ALLTRIM(STR(OBJTOCLIENT;

(ThisForm.pgfPageFrame1.Page2.chkCheckBox2,3)))

? 'Height: '

?? ALLTRIM(STR(OBJTOCLIENT;

(ThisForm.pgfPageFrame1.Page2.chkCheckBox2,4)))

ENDCASE

ENDDEFINE


 See Also

Height Property
Left Property
Top Property
Width Property


OBJVAR( ) Function

Included for backward compatibility. Use the Name property for controls instead.


OCCURS( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the number of times a character expression occurs within another character expression.

 Syntax

OCCURS(cSearchExpression, cExpressionSearched)

 Returns

Numeric

 Arguments

cSearchExpression   Specifies a character expression that OCCURS( ) searches for within cExpressionSearched.

cExpressionSearched   Specifies the character expression OCCURS( ) searches for cSearchExpression.

 Remarks

OCCURS( ) returns 0 (zero) if cSearchExpression isn’t found within cExpressionSearched.


 OCCURS( ) Function Example

STORE 'abracadabra' TO gcstring

CLEAR

? OCCURS('a', gcstring)  && Displays 5

? OCCURS('b', gcstring)  && Displays 2

? OCCURS('c', gcstring)  && Displays 1

? OCCURS('e', gcstring)  && Displays 0


 See Also

$
INLIST( )


OEMTOANSI( ) Function

Included for backward compatibility. Use the GETCP( ) Function instead.


OLDVAL( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns original field values for fields that have been modified but not updated.

 Syntax

OLDVAL(cExpression [, cTableAlias | nWorkArea])

 Returns

Character, Currency, Date, DateTime, Double, Float, Integer, Logical, Numeric, or Memo

 Arguments

cExpression   Specifies an expression whose original value OLDVAL( ) returns from a table or a remote data source. cExpression is typically a field or an expression consisting of a set of fields from the table or remote data source.

cTableAlias   Specifies the alias of the table or cursor from which the original field values are returned.

nWorkArea   Specifies the work area of the table or cursor from which the original field values are returned.

 Remarks

OLDVAL( ) returns original field values for records in a Visual FoxPro table or cursor that has row or table buffering enabled with CURSORSETPROP( ).

If a table in a database or a cursor has validation rules, OLDVAL( ) does not require that row or table buffering be enabled in order to return original field values.

If the record pointer is moved to a different record when row buffering is enabled, or if TABLEUPDATE( ) is issued to commit changes to the record, or there is some other action that causes an update, such as ending a transaction, the fields are updated and the original field values are no longer available.

The data type of the value OLDVAL( ) returns is determined by the expression you specify with cExpression.

The original field values are returned for the table or cursor open in the currently selected work area if OLDVAL( ) is issued without the optional cTableAlias or nWorkArea arguments.


 OLDVAL( ) Function Example

The following example demonstrates how you can use OLDVAL( ) to return original field value for a field in a buffered table. A table named employees is created and INSERT - SQL is used insert the value “Smith” into the cLastName field.

MULTILOCKS is set to ON, a requirement for table buffering. CURSORSETPROP( ) is used to set the buffering mode to optimistic table buffering (5).

The original value of the cLastName field (Smith) is displayed and then the cLastName field is modified with REPLACE. The new value of the cLastName field (Jones) is displayed. The original value of the cLastName field (Smith) is displayed with OLDVAL( ). TABLEUPDATE( ) is then used to commit changes to the table. The updated value of the cLastName field (Jones) is then displayed.

CLOSE DATABASES

CLEAR

* Create new table and add blank record

CREATE TABLE employee (cLastName C(10))

APPEND BLANK

* Insert initial value

INSERT INTO employee (cLastName) VALUES ("Smith")

* Enable and set table buffering

SET MULTILOCKS ON  && Allow table buffering

=CURSORSETPROP("Buffering", 5, "employee" )  && Enable table buffering

* Display initial value

=MESSAGEBOX("Original cLastName value: "+ cLastName, 0, "Results")

* Change record value and display results

REPLACE cLastName WITH "Jones"

=MESSAGEBOX("Modified cLastName value: "+ cLastName, 0, "Results")

* Store the old value of the field to cTemp variable and display results

cTemp=OLDVAL("cLastName", "employee")

=MESSAGEBOX("Original cLastName value: "+ cTemp, 0, "Results")

* Update table and display final value

=TABLEUPDATE(.T.)

=MESSAGEBOX("Final cLastName value: "+ cLastName, 0, "Results")

* Close and delete example table file

USE

DELETE FILE employee.dbf


 See Also

CURVAL( )
GETFLDSTATE( )
TABLEREVERT( )
TABLEUPDATE( )
CURSORSETPROP( )


OLE Bound Control

Syntax         Remarks         Properties         Events         Methods         See Also

Creates an OLE bound control.

 Syntax

OLEBoundControl

 Remarks

On a form or report, an OLE bound control lets you display the contents of an OLE object (such as from Microsoft Word or Microsoft Excel) in a General field of a table.

Unlike OLE container controls, insertable OLE objects do not have their own set of events. Also, OLE bound controls, unlike OLE container controls, are bound to a General field in a Visual FoxPro table.

For additional information about OLE objects in Visual FoxPro, see Chapter 16, “Adding OLE,” in the Developer’s Guide.


 Properties

AutoActivate	AutoSize	BaseClass
ClassLibrary	Class	Comment
ControlSource	DocumentFile	DragIcon
DragMode	Enabled	Height
HelpContextId	HostName	Left
MousePointer	Name	Object
OLEClass	OLELCID Property	OLETypeAllowed
ParentClass	Sizable	Stretch
TabIndex	TabStop	Tag
Top	Value	Visible
Width


 Events

Destroy	DragDrop	DragOver
Error	GotFocus	Init
LostFocus	Moved	Resize
UIEnable


 Methods

CloneObject	DoVerb	Drag
Move	Refresh	ResetToDefault
SaveAsClass	SetFocus	ZOrder


 See Also

APPEND GENERAL
CREATE FORM
CREATE CLASS
CREATEBINARY( )
DEFINE CLASS
MODIFY GENERAL
OLE Container Control


OLE Container Control

Syntax         Remarks         Properties         Events         Methods         Example         See Also

Creates an OLE container control.

 Syntax

OLEControl

 Remarks

An OLE container control lets you add OLE objects to your applications. OLE objects include ActiveX Controls (.OCX files) and insertable OLE objects created in other applications such as Microsoft Word and Microsoft Excel. Unlike ActiveX Controls (.OCX files), insertable OLE objects do not have their own set of events. OLE container controls, unlike OLE bound controls, are not bound to a General field in a Visual FoxPro table.

Note that the type of ActiveX control placed in an OLE container control determines the properties, events, and methods available for the ActiveX control

For additional information about OLE objects in Visual FoxPro, see Chapter 16, “Adding OLE,” in the Developer’s Guide.


 Properties

Align	AutoActivate	AutoSize
AutoVerbMenu	BaseClass	Cancel
Class	ClassLibrary	Comment
ControlSource	Default	DocumentFile
DragIcon	DragMode	Enabled
Height	HelpContextID	HostName
Left	MouseIcon	MousePointer
Name	Object	OLEClass
OLELCID	OLETypeAllowed	Parent
ParentClass	Sizable	Stretch
TabIndex	TabStop	Tag
Top	Visible	WhatsThisHelpID
Width


 Events

Destroy	DragDrop	DragOver
Error	GotFocus	Init
LostFocus	Moved	Resize
UIEnable


 Methods

CloneObject	DoVerb	Drag
Move	Refresh	ResetToDefault
SaveAsClass	SetFocus	ShowWhatsThis
ZOrder


 OLE Container Control Example

The following example adds an OLE Container control to a form, and uses the OleClass and DocumentFile properties to specify Excel as the OLE server and an Excel worksheet as the file to edit.

The DocumentFile property specifies a worksheet named BOOK1.XLS in the EXCEL directory on drive C. This example will not work properly if the file and directory specified in the DocumentFile property do not exist; it may be necessary to modify the DocumentFile property to specify an existing directory and worksheet file.

* The DoVerb method is used to activate the worksheet for editing.

frmMyForm = CREATEOBJECT('Form')  && Create a Form

frmMyForm.Closable = .F.  && Disable the Control-menu boxthe close box

frmMyForm.AddObject('cmdCommand1','cmdMyCmdBtn')  && Add Command button

frmMyForm.AddObject("oleObject","oleExcelObject")  && Add OLE object

frmMyForm.cmdCommand1.Visible=.T.  && Display the "Quit" Command button

frmMyForm.oleObject.Visible=.T.  && Display the OLE control

frmMyForm.oleObject.Height = 50  && OLE control height

frmMyForm.Show  && Display the Form

frmMyForm.oleObject.DoVerb(-1)  && -1 for Edit

READ EVENTS  && Start event processing

DEFINE CLASS oleExcelObject as OLEControl

OleClass ="Excel.Sheet"  && Server name

DocumentFile = "C:\EXCEL\BOOK1.XLS"  && This file must exist

ENDDEFINE

DEFINE CLASS cmdMyCmdBtn AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 210  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close form

ENDDEFINE


 See Also

ActiveX Controls Overview
APPEND GENERAL
CREATE FORM
CREATE CLASS
CREATEBINARY( )
DEFINE CLASS
MODIFY GENERAL
OLE Bound Control


OLEClass Property

Syntax         Settings         Remarks         Example         Applies To         See Also

Returns the named class ID of an OLE object. Read-only at design time and run time for an existing object, but can be set for an object when creating it.

 Syntax

Control.OLEClass[ = cName]

 Settings

cName   The named class ID of the object. This is the registered name of the application that was used to create the object or will be invoked if the object is activated.

 Remarks

You set OLEClass property of an OLE container object using the Insert Object dialog box when you initially add an OLE container to a form, or in code when creating an OLE object as part of a class definition. This property is also set when you create OLE objects using the APPEND GENERAL command.

The OLEClass property of an object specifies the application that is used to create or edit the OLE object. To specify the actual contents of the object, set its DocumentFile property.


 OLEClass Property Example

The following example adds an OLE Container control to a form, and uses the OleClass and DocumentFile properties to specify Excel as the OLE server and an Excel worksheet as the file to edit.

Define class foo as form

   add object oleXLSheet1 as oleXLSheet

EndDefine

Define class oleXLSheet as OLECONTROL

   oleclass = "Excel.Sheet"

   documentfile="C:\msoffice\Excel\mysheet.xls"

   oletypeallowed = 1    && Embedded

EndDefine


 Applies To

OLE Bound Control, OLE Container Control


 See Also

APPEND GENERAL
CREATEOBJECT( )
DocumentFile Property


OLELCID Property

Syntax         Remarks         Applies To         See Also

Contains a numeric value indicating the Locale ID for an OLE Bound control or an OLE Container control. Read-only at design time and run time.

 Syntax

Control.OLELCID

 Remarks

The Locale ID value is determined by the value of the DefOLELCID property for the form or the main Visual FoxPro window when an OLE Bound control or an OLE Container control is placed on the form or the main Visual FoxPro window.

If the form or the main Visual FoxPro window’s DefOLELCID property is zero when the OLE Bound control or OLE Container control is placed on the form or the main Visual FoxPro window, the control uses the current Visual FoxPro Locale ID (LCID). Use SYS(3004) to determine the current Visual FoxPro Locale ID. Use the DefOLELCID property to specify a Locale ID for a form.

See SYS(3005) for a listing of Locale IDs.

Note   The OLELCID property only affects the language of the user interface, which OLE controls display, and not the language of the OLE automation commands. The OLE automation command language is affected only by the Global LocaleID, set with SYS(3005).


 Applies To

OLE Bound Control, OLE Container Control


 See Also

DefOLELCID Property
SYS(3005) - Set Locale ID


OLERequestPendingTimeout Property

Syntax         Settings         Applies To         See Also

Specifies how long after an Automation request is made before a busy message is displayed. Read/write at run time.

 Syntax

ApplicationObject.OLERequestPendingTimeout[ = nMilliseconds]

 Settings

nMilliseconds   Specifies the number of milliseconds that must elapse before a busy message is displayed when an Automation request is pending. The busy message is displayed when a mouse or keyboard event occurs. The default value for nMilliseconds is 5000 milliseconds.

If nMilliseconds is 0, a busy message isn’t displayed when anAutomation request is pending and a mouse or keyboard event occurs.


 Applies To

Application Object, _VFP System Variable


 See Also

OLEServerBusyRaiseError Property
OLEServerBusyTimeout Property


OLEServerBusyRaiseError Property

Syntax         Settings         Applies To         See Also

Specifies whether an error message is displayed when an Automation request is rejected. Read/write at run time.

 Syntax

ApplicationObject.OLEServerBusyRaiseError[ = lExpression]

 Settings

lExpression   One of the following settings:

Setting	Description
.T. (True)	An error doesn’t occur and a busy message is not displayed when the number of milliseconds specified by the OLEServerBusyTimeout property have elapsed.
.F. (False)	(Default) An error occurs and a busy message is displayed when the number of milliseconds specified by the OLEServerBusyTimeout property have elapsed.


 Applies To

Application Object, _VFP System Variable


 See Also

OLERequestPendingTimeout Property
OLEServerBusyTimeout Property


OLEServerBusyTimeout Property

Syntax         Settings         Applies To         See Also

Specifies how long an Automation request is retried while a server is busy. Read/write at run time.

 Syntax

ApplicationObject.OLEServerBusyTimeout[ = nMilliseconds]

 Settings

nMilliseconds   Specifies the number of milliseconds for which an OLE Automation request is retried before a server busy message is displayed.


 Applies To

Application Object, _VFP System Variable


 See Also

OLERequestPendingTimeout Property
OLEServerBusyRaiseError Property


OLETypeAllowed Property

Syntax         Settings         Remarks         Applies To         See Also

Returns the type of OLE object (embedded or linked) contained in a control. Read-only at design time and run time.

 Syntax

Control.OLETypeAllowed[ = nValue]

 Settings

nValue   Returns a value that indicates the type of OLE object (embedded or linked) contained in a control. Possible values are 0 (Linked), 1 (Embedded), -1 (an OLE Bound control that does not contain an OLE object), and -2 (OLE control (.OCX)).

 Remarks

OLETypeAllowed is only useful when you specify a setting for the DocumentFile property.

Note   You can set the OLETypeAllowed property in code to create a linked OLE object using the DEFINE CLASS command.


 Applies To

OLE Bound Control, OLE Container Control


 See Also

DEFINE CLASS
DocumentFile Property


ON BAR Command

Syntax         Arguments         Remarks         Example         See Also

Specifies a menu or menu bar that is activated when you choose a specific menu item from a menu.

 Syntax

ON BAR nMenuItemNumber OF MenuName1
[ACTIVATE POPUP MenuName2
| ACTIVATE MENU MenuBarName]

 Arguments

nMenuItemNumber OF MenuName1   Specifies the menu item number and menu of the menu item that activates another menu or menu bar. Each item in a menu can have another menu or menu bar assigned to it.

A menu item with a menu or menu bar assigned to it has an arrow placed to the right of the menu item. The arrow indicates that choosing that menu item activates an additional menu or menu bar. An additional space for the cascading submenu arrow is placed to the right of each item if you define the menu with DEFINE POPUP ... MARGIN. If you create the menu without the MARGIN clause, the cascading submenu arrow might overwrite the last character of the menu item.

ACTIVATE POPUP MenuName2   Specifies the name of the menu to activate when the menu item is chosen. Use ON BAR without ACTIVATE POPUP to release a menu from a menu item.

ACTIVATE MENU MenuBarName   Specifies the name of the menu bar to activate when the menu item is chosen. Use ON BAR without ACTIVATE MENU to release a menu bar from a menu item.

 Remarks

A menu that displays and activates another menu is called a cascading submenu. Use ON SELECTION BAR or ON SELECTION POPUP to execute a command when an item is chosen from a menu.

The menus and menu bar can be user-defined (created with DEFINE POPUP and DEFINE MENU) or part of the Visual FoxPro menu system.


 ON BAR Command Example

The following example demonstrates a system of cascading submenus. A menu bar named mnuDinner is created with two menu bar titles. Each title uses ON PAD to activate the menu named popMainCourse or popDessert. The menus named popMainCourse and popDessert each have additional menus named popBurger, popPizza and popPie assigned to their item lists with three ON BAR commands. The popOlives and popPie items have additional menus assigned with two ON BAR commands.

When you make a selection, ON SELECTION POPUP ALL executes a procedure named yourchoice that activates a window and displays your choice. The choice is determined with POPUP( ) and PROMPT( ), which return the name of the menu and the contents (text) of the menu item.

DEFINE WINDOW wOrder FROM 10,0 TO 13,39

DEFINE MENU mnuDinner

DEFINE PAD padOne OF mnuDinner PROMPT '\<Main Course' KEY ALT+M, ''

DEFINE PAD padTwo OF mnuDinner PROMPT '\<Dessert'     KEY ALT+D, ''

ON PAD padOne OF mnuDinner ACTIVATE POPUP popMainCourse

ON PAD padTwo OF mnuDinner ACTIVATE POPUP dessert

DEFINE POPUP popMainCourse MARGIN MESSAGE ;

'We have burgers and pizza today'

DEFINE BAR 1 OF popMainCourse PROMPT '\<Hamburgers'

DEFINE BAR 2 OF popMainCourse PROMPT '\<Pizza'

ON BAR 1 OF popMainCourse ACTIVATE POPUP burger

ON BAR 2 OF popMainCourse ACTIVATE POPUP pizza

DEFINE POPUP burger MARGIN MESSAGE ;

'What would you like on your burger?'

DEFINE BAR 1 OF burger PROMPT '\<Ketchup'

DEFINE BAR 2 OF burger PROMPT '\<Mustard'

DEFINE BAR 3 OF burger PROMPT '\<Onions'

DEFINE BAR 4 OF burger PROMPT '\<Pickles'

DEFINE POPUP pizza MARGIN MESSAGE ;

'Here are the available toppings'

DEFINE BAR 1 OF pizza PROMPT '\<Anchovies'

DEFINE BAR 2 OF pizza PROMPT '\<Green Peppers'

DEFINE BAR 3 OF pizza PROMPT '\<Olives'

DEFINE BAR 4 OF pizza PROMPT '\<Pepperoni'

ON BAR 3 OF pizza ACTIVATE POPUP olives

DEFINE POPUP olives MARGIN

DEFINE BAR 1 OF olives PROMPT '\<Black' MESSAGE 'Black olives?'

DEFINE BAR 2 OF olives PROMPT '\<Green' MESSAGE 'Green olives?'

DEFINE POPUP dessert MARGIN MESSAGE 'Our dessert offerings'

DEFINE BAR 1 OF dessert PROMPT '\<Brownies'

DEFINE BAR 2 OF dessert PROMPT '\<Cookies'

DEFINE BAR 3 OF dessert PROMPT '\<Ice Cream'

DEFINE BAR 4 OF dessert PROMPT '\<Pie'

ON BAR 4 OF dessert ACTIVATE POPUP pie

DEFINE POPUP pie MARGIN MESSAGE 'What kind of pie?'

DEFINE BAR 1 OF pie PROMPT '\<Blueberry'

DEFINE BAR 2 OF pie PROMPT '\<Cherry'

DEFINE BAR 3 OF pie PROMPT '\<Peach'

DEFINE BAR 4 OF pie PROMPT '\<Rhubarb'

ON SELECTION POPUP ALL DO yourchoice

ACTIVATE MENU mnuDinner

PROCEDURE yourchoice

ACTIVATE WINDOW wOrder

CLEAR

DO CASE

CASE POPUP( ) = 'BURGER'

@ 0,0 SAY 'A ' + POPUP( ) + ' order:'

@ 1,0 SAY 'You ordered a burger with ' + LOWER(PROMPT( ))

CASE POPUP( ) = 'PIZZA'

@ 0,0 SAY 'A ' + POPUP( ) + ' order:'

@ 1,0 SAY 'You ordered a pizza with ' + LOWER(PROMPT( ))

CASE POPUP( ) = 'OLIVES'

@ 0,0 SAY 'A ' + POPUP( ) + ' order:'

@ 1,0 SAY 'You ordered a pizza with ' ;

+ LOWER(PROMPT( )) + ' olives'

CASE POPUP( ) = 'DESSERT'

@ 0,0 SAY 'A ' + POPUP( ) + ' order:'

@ 1,0 SAY 'You ordered ' + LOWER(PROMPT( )) + ' for dessert'

CASE POPUP( ) = 'PIE'

@ 0,0 SAY 'A ' + POPUP( ) + ' order:'

@ 1,0 SAY 'You ordered ' + LOWER(PROMPT( )) + ' pie'

ENDCASE

WAIT WINDOW

DEACTIVATE WINDOW wOrder

RETURN


 See Also

ACTIVATE MENU
DEFINE BAR
DEFINE MENU
DEFINE POPUP
ON SELECTION BAR
ON SELECTION POPUP


ON ERROR Command

Syntax         Arguments         Remarks         Example         See Also

Specifies a command that executes when an error occurs.

 Syntax

ON ERROR
[Command]

 Arguments

Command   Specifies the Visual FoxPro command to execute. After the command executes, program execution resumes on the line immediately following the line that caused the error. However, if the error-handling procedure includes RETRY, the program line that caused the error is executed again.

If the command specifies a procedure to execute when an error occurs, you can use ERROR( ), MESSAGE( ), LINENO( ), and PROGRAM( ) to pass the error number, the error message, the program line number, and program name to the procedure. This information can be used to correct the cause of the error.

 Remarks

When an error occurs during program execution, Visual FoxPro executes the command you specify with ON ERROR. Typically, ON ERROR uses DO to execute an error-handling procedure.

Use ON ERROR without a command to restore the default Visual FoxPro error handler.

ON ERROR procedures cannot be nested. If ON ERROR is issued within an ON ERROR procedure, the default Visual FoxPro error handler is restored.


 ON ERROR Command Example

ON ERROR DO errhand WITH ;

ERROR( ), MESSAGE( ), MESSAGE(1), PROGRAM( ), LINENO( )

*** The next line should cause an error ***

USE nodatabase

ON ERROR  && restore system error handler

PROCEDURE errhand

PARAMETER merror, mess, mess1, mprog, mlineno

CLEAR

? 'Error number: ' + LTRIM(STR(merror))

? 'Error message: ' + mess

? 'Line of code with error: ' + mess1

? 'Line number of error: ' + LTRIM(STR(mlineno))

? 'Program with error: ' + mprog


 See Also

AERROR( )
DO
ERROR( )
FUNCTION
LINENO( )
MESSAGE( )
PROGRAM( )
PROCEDURE
RETRY


ON ESCAPE Command

Syntax         Arguments         Remarks         Example         See Also

Specifies a command that executes when you press the ESC key during program or command execution.

 Syntax

ON ESCAPE
[Command]

 Arguments

Command   Specifies the Visual FoxPro command to execute. After the command executes, program execution resumes on the line immediately following the program line that was executing when you pressed ESC. However, if a procedure specified with ON ESCAPE includes RETRY, the program line that was executing when you pressed ESC executes again.

 Remarks

Typically, ON ESCAPE uses DO to execute a procedure.

If both ON ESCAPE and ON KEY are in effect and you press ESC, Visual FoxPro executes the command specified with ON ESCAPE.

Use ON ESCAPE without a command to cause no command to execute when ESC is pressed (the default).

Note   Visual FoxPro doesn’t execute an ON ESCAPE routine if SET ESCAPE is OFF.


 ON ESCAPE Command Example

The following example sets up an infinite loop but defines an ON ESCAPE routine to exit it.

SET ESCAPE ON

ON ESCAPE DO stopit

WAIT WINDOW 'Press ESC to stop loop' NOWAIT

glMoreLoop = .T.

DO WHILE glMoreLoop

ENDDO

RETURN

PROCEDURE stopit

glMoreLoop = .F.

RETURN


 See Also

INKEY( )


ON EXIT BAR Command

Included for compatibility with dBASE.


ON EXIT MENU Command

Included for compatibility with dBASE.


ON EXIT PAD Command

Included for compatibility with dBASE.


ON EXIT POPUP Command

Included for compatibility with dBASE.


ON KEY Command

Included for backward compatibility. Use ON KEY LABEL instead.


ON KEY = Command

Included for backward compatibility. Use ON KEY LABEL instead.


ON KEY LABEL Command

Syntax         Arguments         Remarks         Example         See Also

Specifies a command that executes when you press a specific key or key combination or click the mouse button.

 Syntax

ON KEY [LABEL KeyLabelName] [Command]

 Arguments

LABEL KeyLabelName   Specifies the key label name assigned to the key. The KeyLabelName is the letter or digit on the key or a special name assigned to the key. The following table lists the special key label names.

Visual FoxPro key label assignments

For this key	Specify this KeyLabelName value
	LEFTARROW
	RIGHTARROW
	UPARROW
	DNARROW
HOME	HOME
END	END
PAGE UP	PGUP
PAGE DOWN	PGDN
DEL	DEL
BACKSPACE	BACKSPACE
SPACEBAR	SPACEBAR
INS	INS
TAB	TAB
SHIFT+TAB	BACKTAB
ENTER	ENTER
F1 to F12	F1, F2, F3 ...
CTRL+F1 to CTRL+F12	CTRL+F1, CTRL+F2 ...
SHIFT+F1 to SHIFT+F12	SHIFT+F1, SHIFT+F2 ...
ALT+F1 to ALT+F12	ALT+F1, ALT+F2, ALT+F3 ...
ALT+0 to ALT+9	ALT+0, ALT+1, ALT+2 ...
ALT+A to ALT+Z	ALT+A, ALT+B, ALT+C ...
CTRL+LEFT ARROW	CTRL+LEFTARROW
CTRL+RIGHT ARROW	CTRL+RIGHTARROW
CTRL+HOME	CTRL+HOME
CTRL+END	CTRL+END
CTRL+PAGE UP	CTRL+PGUP
CTRL+PAGE DOWN	CTRL+PGDN
CTRL+A TO CTRL+Z	CTRL+A, CTRL+B, CTRL+C ...
CTRL+0	CTRL+0
RIGHT MOUSE BUTTON	RIGHTMOUSE
LEFT MOUSE BUTTON	LEFTMOUSE
MOUSE BUTTON	MOUSE
ESC	ESC
Command   Specifies the command that executes when you press the specified key or key combination or click the mouse button.

You can include parameter or parameter expressions with the command that you assign to the key, as in the following example:

ON KEY LABEL ALT+V WAIT WINDOW "Version: " + VERSION()

You can include variables in the assignment, but they must be public. For example:

PUBLIC message

message = "Default drive: " + SYS(5)

ON KEY LABEL ALT+D WAIT WINDOW message

 Remarks

ON KEY LABEL typically uses DO to execute a procedure.

ON KEY LABEL executes the command immediately during the execution of READ, BROWSE, EDIT, CHANGE, and user-defined menus. If a program is executing when you press the key or click the mouse button, Visual FoxPro executes the current program line and then executes the ON KEY LABEL command. Any ON KEY LABEL key assignments created in a program remain in effect after the program is run. You can also create key assignments in the Command window.

To restore the behavior of a specific key to normal, issue ON KEY LABEL KeyLabelName. To restore all keys to their default behavior, issue ON KEY.

Tip   To prevent recursive calls during the execution of an ON KEY LABEL procedure, include PUSH KEY CLEAR early in the procedure to disable all active ON KEY LABEL commands. Issue POP KEY at the end of the procedure to enable the ON KEY LABEL commands.

The ON KEY LABEL key assignments aren’t in effect in the Visual FoxPro system menu bar, system menus, dialog boxes, alerts, and so on. The key assignments are effective in the Visual FoxPro system windows — the Visual FoxPro text editor, the Command window, the Trace window, and so on.

Unlike ON KEY, there can be multiple active ON KEY LABEL commands. For example, you can assign a command to each of the arrow keys and a mouse button.

Executing an ON KEY LABEL resets PARAMETERS( ) to 0. For more information, see PARAMETERS( ).

In Visual FoxPro, certain events cannot be trapped because they are under the control of Windows. In particular, ON KEY LABEL MOUSE, ON KEY LABEL LEFTMOUSE, and ON KEY LABEL RIGHTMOUSE are not executed when you click a Windows control such as a Control menu, scroll bar, or the like. Also, CTRL+0 is supported in ON KEY LABEL in Visual FoxPro, allowing you to redefine the key combination used to enter a null value into a field.


 ON KEY LABEL Command Example

The following example displays a message when an arrow key is pressed.

CLEAR

PUBLIC msg

msg = CHR(13) + CHR(13) + "Press F9 to " + ;

"restore default key definition."

ON KEY LABEL RIGHTARROW Wait Window "Right Arrow " + msg NOWAIT

ON KEY LABEL LEFTARROW Wait Window "Left Arrow " + msg NOWAIT

ON KEY LABEL UPARROW Wait Window "Up Arrow " + msg NOWAIT

ON KEY LABEL DNARROW Wait Window "Down Arrow " + msg NOWAIT

* Press F9 to clear the ON KEY LABEL assignments

ON KEY LABEL F9 ON KEY


 See Also

INKEY( )
ON( )
POP KEY
PUSH KEY


ON PAD Command

Syntax         Arguments         Remarks         See Also

Specifies the menu or menu bar that is activated when you choose a specific menu title.

 Syntax

ON PAD MenuTitleName OF MenuBarName1
[ACTIVATE POPUP MenuName
| ACTIVATE MENU MenuBarName2

 Arguments

MenuTitleName OF MenuBarName1   Specifies the menu title to which a menu or menu bar is assigned.

ACTIVATE POPUP MenuName   Specifies the menu to activate when the menu title is chosen. Use ON PAD MenuTitleName OF MenuBarName1 without ACTIVATE POPUP to release a menu from a menu title.

If you specify the system menu bar _MSYSMENU for MenuBarName1, MenuName cannot specify a menu that is created with the DEFINE POPUP PROMPT clause.

ACTIVATE MENU MenuBarName2   Specifies the name of the menu bar to activate when the menu title is chosen. Use ON PAD MenuTitleName OF MenuBarName1 without ACTIVATE MENU to release a menu bar from a menu name.

 Remarks

Use ON SELECTION PAD to execute a command when a menu title is chosen.


 See Also

ACTIVATE MENU
DEFINE MENU
ON SELECTION MENU
ON SELECTION PAD


ON PAGE Command

Syntax         Arguments         Remarks         See Also

Specifies a command that executes when printed output reaches a specified line number in a report or when you issue EJECT PAGE.

 Syntax

ON PAGE
[AT LINE nLineNumber [Command]]

 Arguments

AT LINE nLineNumber [Command]   Specifies the command to execute at the designated line number. The specified command executes when _PLINENO, the system variable that keeps track of the current line number in a report, becomes greater than the line number specified with nLineNumber. The command specified with ON PAGE also executes when you issue EJECT PAGE. For more information, see EJECT PAGE.

 Remarks

ON PAGE typically uses DO to execute a procedure for handling page breaks, headers, and footers.

Executing ON PAGE without the AT LINE clause clears the ON PAGE command.


 See Also

EJECT PAGE


ON READERROR Command

Included for backward compatibility. Use the Valid event instead.


ON SELECTION BAR Command

Syntax         Arguments         Remarks         See Also

Specifies a command that executes when you choose a specific menu item.

 Syntax

ON SELECTION BAR nMenuItemNumber OF MenuName
[Command]

 Arguments

nMenuItemNumber OF MenuName [Command]   Specifies the menu item’s bar number, the menu name, and the command to execute for the specified menu item.

 Remarks

Typically, ON SELECTION BAR uses DO to execute a procedure or program. When you create and activate a menu, place ON SELECTION BAR between DEFINE POPUP and ACTIVATE POPUP.

You can also use ON SELECTION BAR with a Visual FoxPro system menu.

Use ON SELECTION POPUP to execute a command when you choose any menu item on a menu. Use ON BAR to activate a menu or menu bar when you choose a specific menu item.

Use ON SELECTION BAR nMenuItemNumber OF MenuName without a command to release a command assigned to a menu item.


 See Also

DEFINE BAR
DEFINE POPUP
ON BAR
ON SELECTION POPUP


ON SELECTION MENU Command

Syntax         Arguments         Remarks         Example         See Also

Specifies a command that executes when you choose any menu title on a menu bar.

 Syntax

ON SELECTION MENU MenuBarName | ALL
[Command]

 Arguments

MenuBarName   Specifies the name of the menu bar to which you assign a command. The command executes when you choose any menu title from the menu bar. You can specify the name of a user-defined menu bar created with DEFINE MENU or the Visual FoxPro system menu bar _MSYSMENU.

ALL   Executes a command when you choose any menu title from any menu bar.

Command   Specifies the command to execute when you choose a menu title. Use ON SELECTION MENU without a command to release a command assigned to a menu bar.

 Remarks

When you create and activate a menu bar, place ON SELECTION MENU between DEFINE MENU and ACTIVATE MENU.

Use ON SELECTION PAD to execute a command when you choose a specific menu item. ON SELECTION PAD takes precedence over ON SELECTION MENU. Use ON PAD to activate a menu or menu bar when you choose a specific menu title.

Use ON SELECTION MENU without a command to release a command assigned to a menu bar.


 ON SELECTION MENU Command Example

In the following example, ON SELECTION MENU is used to execute a procedure when a menu title is chosen from the Visual FoxPro system menu bar.

The current system menu bar is saved to memory with SET SYSMENU SAVE and all system menu titles are removed with SET SYSMENU TO.

DEFINE PAD creates several system menu titles. When you choose a menu title, the choice procedure assigned to the menu bar with ON SELECTION MENU executes. The choice procedure displays the name of the menu title you choose and the name of the menu bar. If you choose the Exit menu title, the original Visual FoxPro system menu is restored.

*** Name this program ONMENU.PRG ***

CLEAR

SET SYSMENU SAVE

SET SYSMENU TO

DEFINE PAD padSys OF _MSYSMENU PROMPT '\<System' COLOR SCHEME 3 ;

KEY ALT+S, ''

DEFINE PAD padEdit OF _MSYSMENU PROMPT '\<Edit' COLOR SCHEME 3 ;

KEY ALT+E, ''

DEFINE PAD padRecord OF _MSYSMENU PROMPT '\<Record' COLOR SCHEME 3 ;

KEY ALT+R, ''

DEFINE PAD padWindow OF _MSYSMENU PROMPT '\<Window' COLOR SCHEME 3 ;

KEY ALT+W, ''

DEFINE PAD padReport OF _MSYSMENU PROMPT 'Re\<ports' COLOR SCHEME 3 KEY ALT+P, ''

DEFINE PAD padExit OF _MSYSMENU PROMPT 'E\<xit' COLOR SCHEME 3 ;

KEY ALT+X, ''

ON SELECTION MENU _MSYSMENU ;

DO choice IN onmenu WITH PAD( ), MENU( )

PROCEDURE choice

PARAMETER gcPad, gcMenu

WAIT WINDOW 'You chose ' + gcPad + ;

' from menu ' + gcMenu NOWAIT

IF gcPad = 'PADEXIT'

SET SYSMENU TO DEFAULT

ENDIF


 See Also

ACTIVATE MENU
DEFINE MENU
ON PAD
ON SELECTION PAD


ON SELECTION PAD Command

Syntax         Arguments         Remarks         See Also

Specifies a command that executes when you choose a specific menu title on a menu bar.

 Syntax

ON SELECTION PAD MenuTitleName OF MenuBarName
[Command]

 Arguments

MenuTitleName OF MenuBarName   Specifies the menu title name to which the command is assigned.

Command   Specifies the Visual FoxPro command to execute when you choose the specified menu title.

 Remarks

When you choose the specified menu title, Visual FoxPro executes the command you specify with ON SELECTION PAD. Typically, ON SELECTION PAD uses DO to execute a procedure or program when you choose a specific menu title from the menu bar. When you create and activate the menu bar, place ON SELECTION PAD between DEFINE MENU and ACTIVATE MENU.

Use ON SELECTION MENU to execute a command when you choose any menu title on a menu bar. Use ON PAD to activate a menu or menu bar when you choose a specific menu title on a menu bar.

Use ON SELECTION PAD without a command to release a command assigned to the menu title.


 See Also

ACTIVATE MENU
DEFINE MENU
DEFINE PAD
ON PAD
ON SELECTION MENU


ON SELECTION POPUP Command

Syntax         Arguments         Remarks         See Also

Specifies a command that executes when you choose any menu item from a specified menu or from all menus.

 Syntax

ON SELECTION POPUP MenuName | ALL
[Command]

 Arguments

MenuName   Specifies the menu to which the command is assigned.

ALL   If you include ALL instead of a menu name, Visual FoxPro executes the command when you choose a menu item from any menu.

Command   Specifies the command to execute when you choose a menu item.

 Remarks

When you choose any menu item from a menu, Visual FoxPro executes the command you specify with ON SELECTION POPUP. When you create and activate the menu, place ON SELECTION POPUP between DEFINE POPUP and ACTIVATE POPUP.

Use ON SELECTION BAR to execute a command when you choose a specific menu item. ON SELECTION BAR takes precedence over ON SELECTION POPUP. Use ON BAR to activate a menu or menu bar when you choose a specific menu item.

Use ON SELECTION POPUP without a command to release a command assigned to a menu item with a previous ON SELECTION POPUP.


 See Also

ACTIVATE POPUP
DEFINE BAR
DEFINE POPUP
ON BAR


ON SHUTDOWN Command

Syntax         Arguments         Remarks         See Also

Specifies a command that executes when you try to exit Visual FoxPro, or Microsoft Windows.

 Syntax

ON SHUTDOWN [Command]

 Arguments

Issue ON SHUTDOWN without Command to release the current ON SHUTDOWN command.

 Remarks

The command you specify in ON SHUTDOWN is executed if you try to exit Visual FoxPro. If you try to exit Microsoft Windows from the Program Manager while Visual FoxPro is open, control is returned to Visual FoxPro and the command you specify in ON SHUTDOWN is executed.

The ON SHUTDOWN command is typically a DO command that executes a routine to display a dialog box. The dialog box asks if you are sure you want to exit the current application and Visual FoxPro. If you want to exit the application, the routine can close open files, clean up the Visual FoxPro environment and then execute QUIT. If you don’t want to exit the current application, the routine can return control back to the application.


 See Also

QUIT


ON( ) Function

Syntax         Returns         Arguments         Example         See Also

Returns the command assigned to each of these event-handling commands: ON ERROR, ON ESCAPE, ON KEY LABEL, or ON PAGE.

 Syntax

ON(cONCommand [, KeyLabelName])

 Returns

Character

 Arguments

cONCommand   Specifies one of the event-handling commands. Here are the commands and corresponding character expressions to use with ON( ):

Command	cONCommand
ON ERROR	ERROR
ON ESCAPE	ESCAPE
ON KEY LABEL	KEY
ON PAGE	PAGE
For example, to return the command currently assigned to ON ERROR, use

? ON('ERROR')

KeyLabelName   Used in ON KEY LABEL to specify a key or key combination to which the command is assigned. Specify KEY in cONCommand and the key label name of the key or key combination in KeyLabelName. For a complete list of key label names, see ON KEY LABEL.

For example, to return the command currently assigned to the F7 function key with ON KEY LABEL, use

? ON('KEY', 'F7')

 Remarks

When an event occurs that is trapped by one of the event-handling commands, the command assigned by the event-handling command executes. ON( ) returns the command you assigned to an event-handling command. ON( ) returns an empty string if a command isn’t currently assigned to the event-handling command you specify.


 ON( ) Function Example

The following example uses ON( ) to display ON ERROR and ON KEY LABEL settings.

ON ERROR DO errorhand

ON KEY LABEL CTRL+F2 WAIT WINDOW 'You pressed ^F2'

ON KEY LABEL ALT+Z DISPLAY MEMORY

CLEAR

? ON('ERROR')  && Displays DO errorhand

? ON('KEY', 'CTRL+F2')  && Displays WAIT WINDOW 'You pressed ^F2'

? ON('KEY', 'ALT+Z')  && Displays DISPLAY MEMORY

ON ERROR

ON KEY LABEL CTRL+F2

ON KEY LABEL ALT+Z


 See Also

INKEY( )
LASTKEY( )
ON ERROR
ON ESCAPE
ON KEY
ON KEY LABEL
ON PAGE
ON READERROR
READKEY( )


OneToMany Property

Syntax         Settings         Remarks         Applies To         See Also

When moving through records in the parent table, specifies whether the record pointer remains on the same parent record until the record pointer of the child table moves through all related records. Available at design time; read-only at run time.

 Syntax

Object.DataEnvironment.Relation.OneToMany[ = lExpr]

 Settings

lExpr   The settings for the OneToMany property are:

Setting	Description
True (.T.)	The record pointer remains on the same parent record until the record pointer of the child table moves through all related records.
False (.F.)	(Default) The parent table’s record pointer moves to the specified record and the child table’s record pointer moves to the first related record.
 Remarks

The OneToMany property can be used to specify the record pointer movement in a simple parent-child table relationship. To specify the record pointer movement in a more complex relationship (for example, a grandparent-parent-child relationship), use SET SKIP in the Init method for the Form or report.

When OneToMany is set to true (.T.), it mimics the behavior of SET SKIP.


 Applies To

Relation


 See Also

SET SKIP


OPEN DATABASE Command

Syntax         Arguments         Remarks         Example         See Also

Opens a database.

 Syntax

OPEN DATABASE [FileName | ?]
[EXCLUSIVE | SHARED]
[NOUPDATE]
[VALIDATE]

 Arguments

FileName   Specifies the name of the database to open. If you don’t specify an extension for the file name, Visual FoxPro automatically assigns a .DBC extension. If you omit FileName, the Open dialog box is displayed. You can specify a path name as part of the database name.

Note   Visual FoxPro will not recognize a path name properly if a disk or directory name contains an exclamation point (!).

?   Displays the Open dialog box from which you can choose an existing database or enter the name of a new form to create.

EXCLUSIVE   Opens the database in exclusive mode. If you open the database exclusively, other users cannot access it and will receive an error if they try to gain access. If you do not include EXCLUSIVE or SHARED, the current SET EXCLUSIVE setting determines how the database is opened.

SHARED   Opens the database in shared mode. If you open the database for shared use, other users have access to it. If you do not include EXCLUSIVE or SHARED, the current SET EXCLUSIVE setting determines how the database is opened.

NOUPDATE   Specifies that no changes can be made to the database. In other words, the database is read-only. If you omit NOUPDATE, the database is opened with read and write access.

Tables contained in the database are not affected by NOUPDATE. To prevent changes to a table in the database, include NOUPDATE in USE when you open the table.

VALIDATE   Specifies that Visual FoxPro ensures that references in the database are valid. Visual FoxPro checks to see that tables and indexes referenced in the database are available on disk. Visual FoxPro also checks to see that referenced fields and index tags exist in the tables and indexes.

 Remarks

While the database is open, all tables contained in it are available. However, the tables are not implicitly opened. You must open them with USE.

When USE executes, Visual FoxPro looks for the table within the current database. If the table isn’t found, Visual FoxPro then looks for a table outside the database. This means that if a table in a database has the same name as a table outside the database, the table in the database is found first.

You cannot open a database that has been opened exclusively by another user.


 OPEN DATABASE Command Example

In the following example, OPEN DATABASE is used to open the testdata database. DISPLAY DATABASE is used to display information about the tables in the database.

CLOSE DATABASES

SET PATH TO (HOME( ) + 'samples\data\')  	&& Sets path to database

OPEN DATABASE testdata  && Open testdata database

DISPLAY DATABASE  && Displays table information


 See Also

ADD TABLE
CLOSE DATABASES
CREATE DATABASE
DBUSED( )
DISPLAY DATABASE
FREE TABLE
LIST DATABASE
REMOVE TABLE


OpenTables Method

Syntax         Arguments         Remarks         Applies To         See Also

Programmatically opens the tables and views associated with the data environment.

 Syntax

DataEnvironment.OpenTables

 Arguments

DataEnvironment   Specifies the data environment associated with the form, form set, or report.

 Remarks

The OpenTables method loads the data environment tables when the AutoOpenTables property of the data environment is set to false (.F.) or if the data environment has been unloaded using the CloseTables method.


 Applies To

DataEnvironment


 See Also

AfterCloseTables Event
AutoOpenTables Property
BeforeOpenTables Event
CloseTables Method


OpenViews Property

Syntax         Settings         Remarks         Applies To         See Also

Determines the type of views associated with a form set, form, or report’s data environment that are opened automatically. Available at design time; read-only at run time.

 Syntax

DataEnvironment.OpenViews[ = nExpression]

 Settings

nExpression   The settings for the OpenViews property are:

Setting	Description
0	(Default) Local and Remote. Both local and remote views for the data environment for the form set, form, or report are opened automatically.
1	Local only. Only local views for the data environment for the form set, form, or report are opened automatically.
2	Remote only. Only remote views for the data environment of the form set, form, or report are opened automatically.
3	None. No views are opened for the data environment of the form set, form, or report.
 Remarks

The OpenViews property applies when the AutoOpenTables property is set to true (.T.) or the OpenTables method is executed.


 Applies To

DataEnvironment


 See Also

AutoOpenTables Property
OpenTables Method


OpenWindow Property

Included for backward compatibility. Use an EditBox control instead.


OptionButton Control

Syntax         Remarks         Properties         Events         Methods         See Also

Creates a single option button.

 Syntax

OptionButton

 Remarks

A single option button can be added only to a group of option buttons.

For more information about creating a group of option buttons, see the OptionGroup Control topic and Chapter 10, “Using Controls,” in the Developer’s Guide.


 Properties

Alignment	AutoSize	BackColor
BackStyle	BaseClass	Caption
Class	ClassLibrary	ColorScheme
ColorSource	Comment	ControlSource
DisabledBackColor	DisabledForeColor	DisabledPicture
DownPicture	DragIcon	DragMode
Enabled	FontBold	FontCondense
FontExtend	FontItalic	FontName
FontOutline	FontShadow	FontSize
FontStrikeThru	FontUnderLine	ForeColor
Height	HelpContextID	Left
MousePointer	Name	Parent
ParentClass	Picture	RightToLeft
SpecialEffect	StatusBarText	Style
TabIndex	TabStop	Tag
TerminateRead	ToolTipText	Top
Value	Visible	Width


 Events

Click	DblClick	Destroy
DragDrop	DragOver	Error
ErrorMessage	GotFocus	Init
KeyPress	LostFocus	Message
MiddleClick Event	MouseDown	MouseMove
MouseUp	MouseWheel	RightClick
Valid	When


 Methods

CloneObject	Drag	Move
ReadExpression	ReadMethod	Refresh
ResetToDefault	SaveAsClass	SetFocus
WriteExpression	WriteMethod	ZOrder


 See Also

CREATE FORM
CREATE CLASS
DEFINE CLASS
OptionGroup Control


OptionGroup Control

Syntax         Remarks         Properties         Events         Methods         Example         See Also

Creates a group of option buttons.

 Syntax

OptionGroup

 Remarks

Option button groups are containers that contain option buttons. A group of option buttons let you make a choice from a set of buttons. Choosing an option button makes your choice current and releases a previous choice. A bullet next to the option button indicates the current choice. For example, option buttons can be used to direct output to a file, a printer, or a window.

For additional information about creating groups of option buttons, see Chapter 10, “Using Controls,” in the Developer’s Guide.


 Properties

AutoSize	BackColor	BackStyle
BaseClass	BorderColor	BorderStyle
ButtonCount	Buttons	Class
ClassLibrary	Comment	ColorSource Property
ControlSource	DragIcon	DragMode
Enabled	Height	HelpContextID
Left	MousePointer	Name
Parent	ParentClass	SpecialEffect
TabIndex	Tag	TerminateRead
Top	Value	Visible
Width


 Events

Click	DblClick	DragDrop
DragOver	Error	ErrorMessage
Init	InteractiveChange	Message
MiddleClick Event	MouseDown	MouseMove
MouseUp	MouseWheel	ProgrammaticChange
RightClick	UIEnable	Valid
When


 Methods

AddObject	CloneObject	Drag
Move	ReadExpression	ReadMethod
Refresh	RemoveObject	ResetToDefault
SaveAsClass	SetAll	WriteExpression
WriteMethod	ZOrder


 OptionGroup Control Example

The following example creates an OptionGroup control and places the control on a form. The OptionGroup control has three buttons, and depending on the option button you click, a circle, ellipse, or square is displayed. The Buttons and Caption properties are used to specify the text displayed next to each option button.

The Shape control is used to create the circle, ellipse, and square. The OptionGroup control’s Click event uses a DO CASE ... ENDCASE structure and the Value property to display the appropriate shape when you click an option button.

frmMyForm = CREATEOBJECT('Form')  && Create a Form

frmMyForm.Closable = .F.  && Disable the Control menu box

frmMyForm.AddObject('cmdCommand1','cmdMyCmndBtn')  && Add Command button

frmMyForm.AddObject('opgOptionGroup1','opgMyOptGrp') && Add Option Group

frmMyForm.AddObject('shpCircle1','shpMyCircle')  && Add Circle Shape

frmMyForm.AddObject('shpEllipse1','shpMyEllipse')  && Add Ellipse Shape

frmMyForm.AddObject('shpSquare','shpMySquare')  && Add Box Shape

frmMyForm.cmdCommand1.Visible =.T.  && "Quit" Command button visible

frmMyForm.opgOptionGroup1.Buttons(1).Caption = "\<Circle"

frmMyForm.opgOptionGroup1.Buttons(2).Caption = "\<Ellipse"

frmMyForm.opgOptionGroup1.Buttons(3).Caption = "\<Square"

frmMyForm.opgOptionGroup1.SetAll("Width", 100) && Set Option group width

frmMyForm.opgOptionGroup1.Visible = .T.  && Option Group visible

frmMyForm.opgOptionGroup1.Click  && Show the circle

frmMyForm.SHOW  && Display the form

READ EVENTS  && Start event processing

DEFINE CLASS opgMyOptGrp AS OptionGroup  && Create an Option Group

ButtonCount = 3  && Three Option buttons

Top = 10

Left = 10

Height = 75

Width = 100

PROCEDURE Click

ThisForm.shpCircle1.Visible = .F.  && Hide the circle

ThisForm.shpEllipse1.Visible = .F.  && Hide the ellipse

ThisForm.shpSquare.Visible = .F.  && Hide the square

DO CASE

CASE ThisForm.opgOptionGroup1.Value = 1

ThisForm.shpCircle1.Visible = .T. && Show the circle

CASE ThisForm.opgOptionGroup1.Value = 2

ThisForm.shpEllipse1.Visible = .T.  && Show the ellipse

CASE ThisForm.opgOptionGroup1.Value = 3

ThisForm.shpSquare.Visible = .T.  && Show the square

ENDCASE

ENDDEFINE

DEFINE CLASS cmdMyCmndBtn AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 210  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close Form

ENDDEFINE

DEFINE CLASS shpMyCircle AS SHAPE  && Create a circle

Top = 10

Left = 200

Width = 100

Height = 100

Curvature = 99

BackColor = RGB(255,0,0)  && Red

ENDDEFINE

DEFINE CLASS shpMyEllipse AS SHAPE  && Create an ellipse

Top = 35

Left = 200

Width = 100

Height = 50

Curvature = 99

BackColor = RGB(0,128,0)  && Green

ENDDEFINE

DEFINE CLASS shpMySquare AS SHAPE  && Create a square

Top = 10

Left = 200

Width = 100

Height = 100

Curvature = 0

BackColor = RGB(0,0,255)  && Blue

ENDDEFINE


 See Also

CREATE FORM
CREATE CLASS
DEFINE CLASS
OptionButton Control


Order Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the controlling index tag for a Cursor object. Available at design time and run time.

 Syntax

DataEnvironment.Cursor.Order[ = cTagName]

 Settings

cTagName   Specifies an existing index tag for a table.

 Remarks

If the ChildOrder property of a relation object is set, the Order property is ignored.

Use the Order property to specify the order in which records are displayed or accessed.

The Order property mimics the behavior of SET ORDER.


 Applies To

Cursor


 See Also

ChildOrder Property
INDEX
SET ORDER


ORDER( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the name of the controlling index file or tag for the current or specified table.

 Syntax

ORDER([nWorkArea | cTableAlias [, nPath]])

 Returns

Character

 Arguments

nWorkArea   Specifies the work area of a table whose controlling index file name or controlling tag name ORDER( ) returns.

cTableAlias   Specifies a table alias whose controlling index file name or controlling tag name ORDER( ) returns.

nPath   Specifies that the drive and directory are returned along with the single-entry or compound index file name. The numeric expression nPath can have any value.

 Remarks

A table can have several index files open simultaneously. However, only one single-entry index file (the controlling index file) or tag from a compound index file (the controlling tag) controls the order in which the table is displayed or accessed. Certain commands, such as SEEK, use the controlling index file or controlling tag to search for records. This function returns the name of the controlling index file or controlling tag.

USE and SET INDEX both support opening more than one index with an index file list. A controlling index file or controlling tag can be designated in this index file list. SET ORDER can also be used to designate a controlling index or controlling tag.

By default, ORDER( ) returns the controlling index file name or controlling tag name for the current work area. ORDER( ) returns the empty string if an order has not been set (SET ORDER TO is issued or there is no controlling index file or tag).


 ORDER( ) Function Example

The following example displays index tags and files.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer ORDER cust_id && Opens Customer table

? ORDER( )  && Displays CUST_ID

? ORDER('customer', 1)  && Displays CUSTOMER.CDX


 See Also

INDEX
SET INDEX
SET ORDER
USE


OS( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the name and version number of the operating system under which Visual FoxPro is running.

 Syntax

OS([1])

 Returns

Character

 Arguments

1   Use OS(1) to return the version number of the operating system software.

 Remarks

If the optional 1 argument is omitted, the underlying operating system name and its version number is returned.

In Visual FoxPro for Windows, use OS( ) to return the MS-DOS version (for example, MS-DOS 6.22).


 OS( ) Function Example

? OS( )

? OS(1)


 See Also

DISKSPACE( )
GETENV( )
VERSION( )


PACK Command

Syntax         Arguments         Remarks         See Also

Permanently removes all records marked for deletion in the current table and reduces the size of a memo file associated with the table.

Syntax

PACK [MEMO] [DBF]

Arguments

MEMO   Removes unused space from the memo file but doesn’t remove records marked for deletion from the table. Information in memo fields is stored in an associated memo file. A memo file has the same name as the table and an .FPT extension.

DBF   Removes records marked for deletion from the table but doesn’t affect the memo file.

Remarks

When you use PACK, Visual FoxPro copies all records not marked for deletion to a temporary table. After PACK is finished executing, Visual FoxPro deletes the original table from disk and renames the temporary table with the original table name. If you press ESC to interrupt PACK, the temporary table is deleted, and the original table remains unchanged. The original table is also recovered if you run out of disk space while PACK is executing.

When you issue PACK without the MEMO and DBF clauses, PACK affects both the table and the memo file.

PACK requires exclusive use of the table. For more information about opening a table exclusively on a network, see SET EXCLUSIVE.

If the current table has one or more indexes open, PACK rebuilds the index files.

Caution   Be careful to mark only records that you no longer need. There is no way to retrieve deleted records after using PACK.


See Also

DELETE - SQL
DELETE
DELETED( )
RECALL
SET EXCLUSIVE


PACK DATABASE Command

Syntax         Remarks         Example         See Also

Removes records marked for deletion from the current database.

Syntax

PACK DATABASE

Remarks

A database contains records marked for deletion after a table or view is removed from the database, or if the structure of a table in the database is modified.

The database must be opened exclusively, and no table or view in the database can be open.


PACK DATABASE Command Example

In the following example, PACK DATABASE is used to pack the testdata database, removing records marked for deletion.

CLOSE DATABASES

SET PATH TO (HOME( ) + 'samples\data\')  	&& Sets path to database

OPEN DATABASE testdata  && Open the database

PACK DATABASE && Pack the current database


See Also

CLOSE DATABASES
DELETE DATABASE
MODIFY DATABASE
OPEN DATABASE
SET DATABASE
VALIDATE DATABASE


PAD( ) Function

Syntax         Returns         Remarks         Example         See Also

Returns as an uppercase character string the menu title most recently chosen from a menu bar.

Syntax

PAD( )

Returns

Character

Remarks

A menu bar must be defined and active for PAD( ) to return a menu title. Menu bars are created and activated with DEFINE MENU and ACTIVATE MENU.

You can also use PAD( ) with the Visual FoxPro system menu bar.

PAD( ) returns an empty string if a menu bar isn’t defined and active or you issue PAD( ) from the Command window.


PAD( ) Function Example

In this example, PAD( ) is used to pass a menu title to a procedure.

The current Visual FoxPro system menu bar is saved to memory with SET SYSMENU SAVE , and all system menu titles are removed with SET SYSMENU TO.

Several system menu titles are created with DEFINE PAD. When a menu title is chosen, PAD( ) is used to pass the menu title to the procedure named choice. choice displays the menu title chosen and the name of the menu bar. If you choose the Exit menu title, the original Visual FoxPro system menu is restored.

*** Name this program PADEXAM.PRG ***

CLEAR

SET SYSMENU SAVE

SET SYSMENU TO

DEFINE PAD padSys OF _MSYSMENU PROMPT '\<System' COLOR SCHEME 3 ;

KEY ALT+S, ''

DEFINE PAD padEdit OF _MSYSMENU PROMPT '\<Edit' COLOR SCHEME 3 ;

KEY ALT+E, ''

DEFINE PAD padRecord OF _MSYSMENU PROMPT '\<Record' COLOR SCHEME 3 ;

KEY ALT+R, ''

DEFINE PAD padWindow OF _MSYSMENU PROMPT '\<Window' COLOR SCHEME 3 ;

KEY ALT+W, ''

DEFINE PAD padReport OF _MSYSMENU PROMPT 'Re\<ports' COLOR SCHEME 3 KEY ALT+P, ''

DEFINE PAD padExit OF _MSYSMENU PROMPT 'E\<xit' COLOR SCHEME 3 ;

KEY ALT+X, ''

ON SELECTION MENU _MSYSMENU ;

DO choice IN padexam WITH PAD( ), MENU( )

PROCEDURE choice

PARAMETERS gcPad, gcMenu

WAIT WINDOW 'You chose ' + gcPad + ;

' from menu ' + gcMenu NOWAIT

IF gcPad = 'PADEXIT'

SET SYSMENU TO DEFAULT

ENDIF


See Also

ACTIVATE MENU
BAR( )
DEFINE PAD
DEFINE MENU
MENU( )
ON PAD
ON SELECTION PAD
PROMPT( )


PADL( ) | PADR( ) | PADC( ) Functions

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns a string from an expression, padded with spaces or characters to a specified length on the left or right sides, or both.

Syntax

PADL(eExpression, nResultSize [, cPadCharacter])
 – Or –

PADR(eExpression, nResultSize [, cPadCharacter])
 – Or –

PADC(eExpression, nResultSize [, cPadCharacter])

Returns

Character

Arguments

eExpression   Specifies the expression to be padded. This expression can be any expression type except a logical expression or a general or picture field.

nResultSize   Specifies the total number of characters in the expression after it is padded.

cPadCharacter   Specifies the value to use for padding. This value is repeated as necessary to pad the expression to the specified number of characters.

If you omit cPadCharacter, spaces (ASCII character 32) are used for padding.

Remarks

PADL( ) inserts padding on the left, PADR( ) inserts padding on the right, and PADC( ) inserts padding on both sides.


PADL( ) | PADR( ) | PADC( ) Functions Example

STORE 'TITLE' TO gcString

CLEAR

? PADL(gcString, 40, '=')

? PADR(gcString, 40, '=')

? PADC(gcString, 40, '=')


See Also

ALLTRIM( )
LEFT( )
LTRIM( )
RIGHT( )
STUFF( )
TRIM( )


_PADVANCE System Memory Variable
_PADVANCE System Variable

Included for backward compatibility. Use the Report Designer instead.


Page Object

Syntax         Remarks         Properties         Events         Methods         See Also

Creates a page in a page frame.

Syntax

Page

Remarks

Pages allow you to create tabbed forms or dialogs. A set of pages is contained in a page frame.

You can refer to a page within a page frame by name as in this example:

myFrame.MyPage1

You can also refer to a page by its index number with the PAGES keyword. This is consistent with the control collections in other Visual FoxPro containers.

myFrame.PAGES(2).Enabled = .T.

This index does not necessarily equal the PageOrder property. You may have three pages with PageOrders of 2, 3, and 5. You can refer to these pages as follows:

myFrame.PAGES(1)

myFrame.PAGES(2)

myFrame.PAGES(3)

Only the active page is refreshed when the Refresh method occurs for the form on which the page is located.

For additional information about creating pages and page frames, see “Adding Page Frames to a Form” in Chapter 10, “Using Controls,” in the Developer’s Guide.


Properties

ActiveControl	BackColor	BackStyle
BaseClass	Caption	Class
ClassLibrary	ColorSource Property	Comment
ControlCount	Controls	DragIcon
DragMode	Enabled	FontBold, FontItalic, FontStrikethru, FontUnderline Properties
FontCondense	FontExtend	FontItalic
FontName	FontOutline	FontShadow
FontSize	FontStrikeThru	FontUnderline
ForeColor	HelpContextID	KeyPreview
Name	PageOrder	Parent
ParentClass	Picture


Events

Activate	Click	DblClick
Deactivate	Destroy	DragDrop
DragOver	Error	Init
MiddleClick Event	MouseDown	MouseMove
MouseUp	MouseWheel	RightClick


Methods

AddObject	CloneObject	Drag
ReadExpression	ReadMethod	Refresh
RemoveObject	ResetToDefault	SetAll
WriteExpression	WriteMethod	ZOrder


See Also

CREATE FORM
CREATE CLASS
DEFINE CLASS
PageFrame Control


PageCount Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the number of pages contained in a page frame. Available at design time and run time.

Syntax

PageFrame.PageCount[ = nPages]

Settings

nPages   Specifies the number of pages contained in a page frame.

Remarks

The minimum value for the PageCount property setting is 0.

Caution   If you decrease the PageCount property setting (for example, if you change the setting from 3 to 2), all pages that exceed the new setting and the objects they contain are lost.


Applies To

PageFrame


See Also

ButtonCount Property
ControlCount Property
FormCount Property
Page Object


PageFrame Control

Syntax         Remarks         Properties         Events         Methods         See Also

Creates a page frame to contain pages.

Syntax

PageFrame

Remarks

A page frame is a container object that contains pages. Pages in turn can contain controls. Note that for a page frame to be visible, it must be added to a form.

The page frame defines global characteristics of the page: size and positioning, borderstyle, which page is active, and so on.

The page frame determines the location of the pages and how much of each page is visible. Pages are positioned at the top left corner of the page frame. If the page frame is moved, the pages move with the page frame.

A page frame contains the individual pages which by default are named Page1, Page2, Page3, and so on.

Note that only the active page is refreshed when the Refresh method occurs for the Form on which the page is located.

For additional information about creating pages and page frames, see “Adding Page Frames to a Form” in Chapter 10, “Using Controls,” in the Developer’s Guide.


Properties

ActivePage	BaseClass	BorderColor
BorderWidth	Class	ClassLibrary
ColorSource Property	Comment	DragMode
Enabled	Height	Left
Name	PageCount	PageHeight
Pages	PageWidth	Parent
ParentClass	RightToLeft	SpecialEffect
TabIndex	Tabs	TabStop
TabStretch	Top	Visible
Width


Events

Click	DblClick	Destroy
DragDrop	DragOver	Error
Init	MiddleClick Event	MouseDown
MouseMove	MouseUp	MouseWheel
Moved	Resize	RightClick
UIEnable


Methods

AddObject	CloneObject	Drag
Move	ReadExpression	ReadMethod
Refresh	RemoveObject	ResetToDefault
SaveAsClass	SetAll	WriteExpression
WriteMethod	ZOrder


See Also

CREATE FORM
CREATE CLASS
DEFINE CLASS
Page Object


PageHeight Property

Syntax         Settings         Applies To         See Also

Specifies the height of a page. Read-only at design time and run time.

Syntax

PageFrame.PageHeight[ = nHeight]

Settings

nHeight   Specifies the height of the page in the unit of measurement specified by the ScaleMode property of the form.


Applies To

PageFrame


See Also

PageWidth Property
Page Object
ScaleMode Property


_PAGENO System Memory Variable
_PAGENO System Variable

Syntax         Arguments         Remarks         See Also

Contains the current page number.

Syntax

_PAGENO = nCurrentPageNumber

Arguments

nCurrentPageNumber   Specifies a numeric value from 1 to 32,767 for the current page number. _PAGENO, _PBPAGE and _PEPAGE work in unison. If _PAGENO is set (or incremented) such that it falls outside the range of _PBPAGE to _PEPAGE, no pages are printed.

Remarks

_PAGENO contains a numeric value that determines the current page number. The startup default is 1. _PAGENO allows you to print page numbers in streaming output without defining, initializing, and incrementing a memory variable for that purpose.


See Also

ON PAGE
_PBPAGE
_PEPAGE
_PLENGTH
_PLINENO


PageOrder Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the relative order of pages in a page frame. Available at design time and run time.

Syntax

Page.PageOrder[ = nOrder]

Settings

nOrder   Specifies the relative order of a page in a page frame.

Remarks

If a page frame contains five pages and you want the third page displayed last, set the PageOrder property of the third page to 5. The PageOrder setting for the fourth page becomes 3, the PageOrder setting for the fifth page becomes 4, and so on.

Note   PageOrder settings don't have to be sequential. Also, the PageOrder must be less than or equal to the number of pages in a page frame.


Applies To

Page


See Also

Activate Event
Deactivate Event
PageFrame Control
ZOrder Method


Pages Property

Syntax         Settings         Applies To         See Also

An array used to access individual pages in a page frame. Available at run time only.

Syntax

PageFrame.Pages(Index).Property[ = Expr]

Settings

Index   Represents the index of the page you want to access.

Expr   Specifies a property value for the page contained in a page frame.


Applies To

PageFrame


See Also

Buttons Property
Page Object
PageCount Property


PageWidth Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the width of the page. Available at design time; read-only at run time.

Syntax

PageFrame.PageWidth[ = nWidth]

Settings

nWidth   Specifies the width of the page in the unit of measurement specified by the ScaleMode property of the form.

Remarks

The PageWidth property setting is the same as the Width property setting unless the page frame contains more than one page and the pages are stacked.


Applies To

PageFrame


See Also

PageHeight Property
Page Object
ScaleMode Property


Paint Event

Syntax         Remarks         Applies To         See Also

Occurs when a form or toolbar is repainted.

Syntax

PROCEDURE Object.Paint

Remarks

A form or toolbar is repainted when part or all of the form or toolbar is exposed after it has been moved or sized, or after a window that was covering the form or toolbar has been moved.

Using a Refresh method in a Resize event forces repainting of the entire object every time a user resizes the form or toolbar.

Using a Paint event for certain tasks can cause a cascading event. In general, avoid using a Paint event for the following:

•	Moving or sizing a form or control.

•	Changing any variables that affect size or appearance, such as setting an object’s BackColor property.

•	Calling the Refresh method.

Note   A Resize event may be more appropriate for some of these tasks.


Applies To

Form, ToolBar


See Also

Circle Method
ClipControls Property
Line Method
Print Method
PSet Method
Refresh Method
Resize Event


Panel Property

Syntax         Settings         Applies To         See Also

Specifies the active panel in a Grid control. Available at design time; read-write at run time. Available only if the Partition property is set to a value greater than 0.

Syntax

Grid.Panel[ = nSide]

Settings

nSide   The settings for the Panel property are:

Setting	Description
0	Left panel is active.
1	(Default) Right panel is active.


Applies To

Grid


See Also

PanelLink Property
Partition Property


PanelLink Property

Syntax         Settings         Applies To         See Also

Specifies whether the left and right panels of a Grid control are linked when the grid is split. Available at design time; read-write at run time. Available only if the Partition property is set to a value greater than 0.

Syntax

Grid.PanelLink[ = lExpr]

Settings

lExpr   The settings for the PanelLink property are:

Setting	Description
True (.T.)	(Default) The left and right panels of the grid are linked when the grid is split.
False (.F.)	The left and right panels of the grid are not linked when the grid is split.
If PanelLink is set to true (.T.), both panels of the grid are affected when the following properties are set: HeaderHeight, DeleteMark, GridLineColor, GridLines, GridLineWidth, Highlight, RecordMark, RowHeight, and ScrollBars.

If PanelLink is set to false (.F.), the Panel property setting determines which panel the following properties are set on: HeaderHeight, DeleteMark, GridLineColor, GridLines, GridLineWidth, HighLight, RecordMark, RowHeight, and ScrollBars.


Applies To

Grid


See Also

DeleteMark Property
GridLineColor Property
GridLines Property
GridLineWidth Property
HeaderHeight Property
Highlight Property
Panel Property
Partition Property
RecordMark Property
RowHeight Property
ScrollBars Property


PARAMETERS Command

Syntax         Arguments         Remarks         Example         See Also

Assigns data passed from a calling program to private variables or arrays.

Syntax

PARAMETERS ParameterList

Arguments

ParameterList   Specifies the variable or array names to which the data is assigned.

Parameters within ParameterList are separated by commas. There must be at least as many parameters in the PARAMETERS statement as in the DO ... WITH statement. If more variables or arrays are listed in the PARAMETERS statement than are passed by DO ... WITH, the remaining variables or arrays are initialized to false (.F.). A maximum of 27 parameters can be passed.

PARAMETERS( ) returns the number of parameters that were passed to the most recently executed routine.

Remarks

When PARAMETERS is used with DO ... WITH, it must be the first executable statement in the called program, procedure, or user-defined function.

By default, DO ... WITH passes variables and arrays to procedures by reference. When a value is changed in the called procedure, the new value is passed back to the associated variable or array in the calling program. If you want to pass a variable or array to a procedure by value, enclose the variable or array in parentheses in the DO ... WITH parameter list. Any changes made to the parameter in the called procedure are not passed back to the calling program.

Variables are by default passed by reference to a procedure and by value to a user-defined function. Use SET UDFPARMS TO REFERENCE to pass variables to a user-defined function by reference.


PARAMETERS Command Example

The following example passes parameters to an error-handling routine.

ON ERROR DO errhand WITH ERROR( ), MESSAGE( ), ;

MESSAGE(1),PROGRAM( ),LINENO( )

USE nodatabase

ON ERROR	&& restores system error-handling routine

PROCEDURE errhand

PARAMETERS gnError, gcMess, gnMess1, gcProg, gnLineNo

? 'Error number: ' + LTRIM(STR(gnError))

? 'Error message: ' + gcMess

? 'Line of code with error: ' + gnMess1

? 'Line number of error: '+ LTRIM(STR(gnLineNo))

? 'Program with error: ' + gcProg


See Also

DO
LOCAL
LPARAMETERS
PARAMETERS( )
PRIVATE
PUBLIC
SET UDFPARMS


PARAMETERS( ) Function

Syntax         Returns         Remarks         Example         See Also

Returns the number of parameters passed to the most recently called program, procedure, or user-defined function.

Syntax

PARAMETERS( )

Returns

Numeric

Remarks

PARAMETERS( ) is useful for determining how many parameters are passed to a program, procedure, or user-defined function.

Note   The value returned by PARAMETERS( ) is reset every time a program, procedure, or user-defined function is called or when ON KEY LABEL is executed.


PARAMETERS( ) Function Examples

Example 1 calls a procedure and displays in a wait window the number of parameters passed.

Example 2 uses a procedure to display the average of 4 values.

* Example 1

DO testpar WITH 1,2,3

PROCEDURE testpar

PARAMETERS gn1,gn2,gn3

gcMessage = 'PARAMETERS( ) ='+ALLTRIM(STR(PARAMETERS( )))

WAIT WINDOW (gcMessage)

RETURN

* Example 2

SET TALK OFF

gnVal1 = 10

gnVal2 = 20

gnVal3 = 30

gnVal4 = 15

gnMin = getavg(gnVal1, gnVal2, gnVal3, gnVal4)

? 'Average value is '

?? gnMin

* This user-defined function permits up to 9 parameters to be passed.

* It uses the PARAMETERS( ) function to determine how many

* were passed and returns the average value.

FUNCTION getavg

PARAMETERS gnPara1,gnPara2,gnPara3,gnPara4,gnPara5, ;

gnPara6,gnPara7,gnPara8,gnPara9

IF PARAMETERS( ) = 0

RETURN 0

ENDIF

gnResult = 0

FOR gnCount = 1 to PARAMETERS( )

gcCompare = 'gnPara' +(STR(gnCount,1))

gnResult = gnResult + EVAL(gcCompare)

ENDFOR

gnResult = gnResult / (gnCount - 1)

RETURN gnResult


See Also

DO
FUNCTION
LPARAMETERS
LOCAL
PARAMETERS
PCOUNT( )
PRIVATE
PROCEDURE
PUBLIC
SET UDFPARMS


Parent Property
Parent Object Reference

Syntax         Remarks         Applies To         See Also

References the container object of a control. Not available at design time; read-only at run time.

Syntax

Control.Parent

Remarks

Use the Parent keyword to access the properties, methods, or controls of a control’s container object. You can also use the Parent object reference to access the container object of a page or form.

The Parent keyword is useful in an application in which you pass controls as arguments. For example, you can pass a control variable to a general procedure and use the Parent object reference to access its container object.

You can also use the Parent object reference for objects in a control class that have been placed on an unknown form.


Applies To

CheckBox, Column, ComboBox, CommandButton, CommandGroup, Container, Control, Custom, EditBox, Form, Grid, Header, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, Page, PageFrame, Separator, Shape, Spinner, TextBox, Timer, ToolBar


See Also

BaseClass Property


ParentAlias Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the alias name of the parent table. Read-only at design time and at run time.

Syntax

DataEnvironment.Relation.ParentAlias[ = cAliasName]

Settings

cAliasName   Specifies the alias name of the parent table in the relation.

Remarks

The ParentAlias property setting must be the same name as the Alias property setting for the Cursor object that represents the parent table.


Applies To

Relation


See Also

Alias Property
ChildAlias Property


ParentClass Property

Syntax         Remarks         Applies To         See Also

Returns the name of the class on which the object's class is based. Read-only at design time and run time.

Syntax

Object.ParentClass

Remarks

In the Class Designer, the ParentClass property contains the name of the class on which the subclass’s class is based.


Applies To

CheckBox, Column, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, Custom, EditBox, Form, FormSet, Grid, Header, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, Page, PageFrame, _SCREEN, Shape, Spinner, TextBox, Timer, ToolBar


See Also

Parent Property


Partition Property

Syntax         Settings         Applies To         See Also

Specifies whether a Grid control is split into two panels and specifies where the split is relative to the left edge of the grid. Available at design time; read-write at run time.

Syntax

Grid.Partition[ = nSplit]

Settings

nSplit   Specifies the position where the grid splits into two panels. If nSplit is 0, the grid isn't split.


Applies To

Grid


See Also

Panel Property
PanelLink Property


PasswordChar Property

Syntax         Settings         Remarks         Applies To         See Also

Determines whether the characters entered by a user or placeholder characters are displayed in a TextBox control; determines the character used as a placeholder. Available at design time and run time.

Syntax

TextBox.PasswordChar[ = cCharString]

Settings

cCharString   Specifies the characters displayed in a text box.

Remarks

Use this property to create a password field in a dialog box. Although you can use any character, most applications use the asterisk (*), ANSI character 42.

This property does not affect the Value property setting; it contains exactly what the user types or what was set from code. Set PasswordChar to an empty string ("") to display the actual text. The default setting is an empty string.

You can assign any string to this property, but only the first character is significant; all others are ignored.


Applies To

TextBox


See Also

Format Property
InputMask Property
Value Property


PAYMENT( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the amount of each periodic payment on a fixed-interest loan.

Syntax

PAYMENT(nPrincipal, nInterestRate, nPayments)

Returns

Numeric

Arguments

nPrincipal   Specifies the beginning principal of the loan.

nInterestRate   Specifies the fixed interest rate per period. If monthly payments are made on the loan but the interest rate is annual, divide the annual interest rate by 12.

nPayments   Specifies the total number of payments to be made on the loan.

Remarks

PAYMENT( ) assumes a constant periodic interest rate and assumes that payments are made at the end of each period.


PAYMENT( ) Function Example

STORE 100000 to gnPrincipal	  && $100,000 beginning principal

STORE .105/12 TO gnInterest  && 10.5% annual interest rate

STORE (20*12) TO gnPayments	  && 20 years of monthly payments

CLEAR

? PAYMENT(gnPrincipal, gnInterest, gnPayments)  && Displays 998.38


See Also

CALCULATE
FV( )
PV( )


_PBPAGE System Memory Variable
_PBPAGE System Variable

Included for backward compatibility. Use the Report Designer instead.


PCOL( ) Function

Syntax         Returns         Remarks         Example         See Also

Returns the current column position of the printer’s print head.

Syntax

PCOL( )

Returns

Numeric

Remarks

The value PCOL( ) returns is relative to the current setting of the left printer margin. You can set the left margin with SET MARGIN or by storing a value to the system memory variable _PLOFFSET.

PCOL( ) is especially useful for relative addressing of printed text.

You can use the $ operator in place of PCOL( ).


PCOL( ) Function Example

CLEAR

@ PROW( ), PCOL( )+12 SAY 'Contact person'

@ PROW( ), $+12 SAY 'Contact person'


See Also

COL( )
ROW( )
PROW( )


_PCOLNO System Memory Variable
_PCOLNO System Variable

Included for backward compatibility. Use the Report Designer instead.


_PCOPIES System Memory Variable
_PCOPIES System Variable

Included for backward compatibility. Use the Report Designer instead.


PCOUNT( ) Function

See Also         Example

Returns the number of parameters passed to the current program, procedure, or user-defined function.

Syntax

PCOUNT( )

Returns

Numeric

Remarks

PCOUNT( ) is useful for determining how many parameters are passed to the current program, procedure, or user-defined function.

Note   The value returned by PCOUNT( ) is reset every time a program, procedure, or user-defined function is called or when ON KEY LABEL is executed.


 PCOUNT( ) Function Examples

Example 1 calls a procedure and displays in a wait window the number of parameters passed.

Example 2 uses a procedure to display the average of 4 values.

* Example 1

DO testpar WITH 1,2,3

PROCEDURE testpar

PARAMETERS gn1,gn2,gn3

gcMessage = 'PCOUNT( ) ='+ALLTRIM(STR(PCOUNT( )))

WAIT WINDOW (gcMessage)

RETURN

* Example 2

SET TALK OFF

gnVal1 = 10

gnVal2 = 20

gnVal3 = 30

gnVal4 = 15

gnMin = getavg(gnVal1, gnVal2, gnVal3, gnVal4)

? 'Average value is '

?? gnMin

* This user-defined function permits up to 9 parameters to be passed.

* It uses the PCOUNT( ) function to determine how many

* were passed and returns the average value.

FUNCTION getavg

PARAMETERS gnPara1,gnPara2,gnPara3,gnPara4,gnPara5, ;

gnPara6,gnPara7,gnPara8,gnPara9

IF PCOUNT( ) = 0

RETURN 0

ENDIF

gnResult = 0

FOR gnCount = 1 to PARAMETERS( )

gcCompare = 'gnPara' +(STR(gnCount,1))

gnResult = gnResult + EVAL(gcCompare)

ENDFOR

gnResult = gnResult / (gnCount - 1)

RETURN gnResult


 See Also

DO
FUNCTION
LPARAMETERS
LOCAL
PARAMETERS
PARAMETERS( )
PRIVATE
PROCEDURE
PUBLIC
SET UDFPARMS


_PDRIVER System Memory Variable
_PDRIVER System Variable

Included for backward compatibility. Use the TO FILE ASCII argument in REPORT.


_PDSETUP System Memory Variable
_PDSETUP System Variable

Included for backward compatibility. Use the TO FILE ASCII argument in REPORT.


_PECODE System Memory Variable
_PECODE System Variable

Included for backward compatibility. Use the Report Designer instead.


_PEJECT System Memory Variable
_PEJECT System Variable

Included for backward compatibility. Use the Report Designer instead.


PEMSTATUS( ) Function

Syntax         Returns         Arguments         See Also

Returns an attribute for a property, event, or method.

Syntax

PEMSTATUS(oObjectName | cClassName, cProperty | cEvent | cMethod,
nAttribute)

Returns

Character or Logical

Arguments

oObjectName   Specifies the object for which a property, event, or method attribute is returned. oObjectName can be any expression that evaluates to an object, such as an object reference, an object memory variable, or an object array element.

cClassName   Specifies the class for which a property, event, or method attribute is returned.

cProperty   Specifies the property for which an attribute is returned.

cEvent   Specifies the event for which an attribute is returned.

cMethod   Specifies the method for which an attribute is returned.

nAttribute   A numeric value that specifies which property, event, or method attribute is returned.

The following table lists the values for nAttribute and the corresponding property, event, or method attribute.

nAttribute	Property, Event, or Method Attribute
0	Changed (properties only). A logical true (.T.) is returned if the property value has changed from its original, default value; otherwise a logical false (.F.) is returned.
1	Read-only (properties only). A logical true (.T.) is returned if the property is read-only; otherwise a logical false (.F.) is returned.
2	Protected. A logical true (.T.) is returned if the property, event, or method is a protected; otherwise a logical false (.F.) is returned.
3	Type. A character string is returned indicating if cProperty, cEvent, or cMethod is a property, event, or method. Property, Event, or Method is returned.
4	User-defined. A logical true (.T.) is returned if the property, event, or method  is a user-defined property, event, or method; otherwise a logical false (.F.) is returned.
5	Defined property, event, or method. A logical true (.T.) is returned if the property, event, or method exists for oObjectName or cClassName, otherwise a logical false (.F.) is returned.


See Also

CREATE FORM
GETPEM( )
SYS(1269) - Property Information
SYS(1270) - Object Location
SYS(1271) - Object's .SCX File
SYS(1272) - Object Hierarchy


_PEPAGE System Memory Variable
_PEPAGE System Variable

Included for backward compatibility. Use the Report Designer instead.


PI( ) Function

Syntax         Returns         Remarks         Example         See Also

Returns the numeric constant pi.

Syntax

PI( )

Returns

Numeric

Remarks

The numeric constant pi (3.141592) is the ratio of the circumference of a circle to its diameter.

The number of decimal places displayed in the value returned by PI( ) is determined by SET DECIMALS.


PI( ) Function Example

CLEAR

? PI( )   && Displays 3.14

STORE 2.30 TO gnRadius

STORE PI( ) * gnRadius^2 TO gnArea

? gnArea  && Displays 16.6190


See Also

SET DECIMALS


Picture Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the bitmap (.BMP) file or icon (.ICO) file to be displayed on the control. Available at design time and run time.

Syntax

Control.Picture[ = cFileName ]

Settings

cFileName   Specifies a .BMP or an .ICO file.

Remarks

The setting for this property is a path to a .BMP or an .ICO file.

Note   If you set the Picture property at design time and the file you specify does not exist, Visual FoxPro displays an error message, but the property remains set to the file you specified. Visual FoxPro ignores the Picture property at run time if it is set to a file that does not exist.

Graphics are centered on the control. For CommandButton controls, the Style property must be set to 0 (Standard) for the bitmap to be displayed on the control; For CheckBox and OptionButton controls, the Style property must be set to 1 (Graphical).

For CommandButton and OptionButton controls, the specified bitmap is used whether a button is available, selected, or unavailable. You can specifiy a different bitmap for each button state using the DownPicture and DisabledPicture properties.


Applies To

CheckBox, CommandButton, Container Object, Control Object, Custom, Form, Image, OptionButton, Page, _SCREEN


See Also

DisabledPicture Property
DownPicture Property
Style Property


PLAY MACRO Command

Syntax         Arguments         Remarks         See Also

Executes a keyboard macro.

Syntax

PLAY MACRO MacroName
[TIME nDelay]

Arguments

MacroName   Specifies the name of the keyboard macro to play.

TIME nDelay   Specifies the time interval between the delivery of each keystroke in a keyboard macro. The delay time must be between 0 and 10 seconds. nDelay can evaluate to a number with a decimal fraction. For example, if you specify nDelay equal to 1.5, keystrokes from the macro will be played with a one and a half second delay between each keystroke.

Remarks

You can save a series of keystrokes as a keyboard macro by choosing Macros from the Tools menu. PLAY MACRO plays this series of keystrokes. Playing keyboard macros within programs lets you create self-running demo programs.

If you issue PLAY MACRO from the Command window, it executes immediately. If PLAY MACRO is issued in a program, execution is delayed until the program executes a command that allows keyboard input. Examples of commands that wait for input are @ ... GET, BROWSE, CHANGE, and EDIT.

If a series of PLAY MACRO commands is pending in a program, Visual FoxPro doesn’t execute the commands in the order in which they are issued. Macros are played in reverse order—the first PLAY MACRO executes last, the last PLAY MACRO executes first—in their bottom to top order within the program.


See Also

CLEAR MACROS
ON KEY LABEL
RESTORE MACROS
SAVE MACROS


_PLENGTH System Memory Variable
_PLENGTH System Variable

Included for backward compatibility. Use the Report Designer instead.


_PLINENO System Memory Variable
_PLINENO System Variable

Included for backward compatibility. Use the Report Designer instead.


_PLOFFSET System Memory Variable
_PLOFFSET System Variable

Included for backward compatibility. Use the Report Designer instead.


Point Method

Syntax         Arguments         Remarks         Applies To         See Also

Returns the red-green-blue (RGB) color of the specified point on a form.

Syntax

Object.Point ([nXCoord, nYCoord])

Arguments

nXCoord   Specifies the horizontal coordinate of the point, in the units specified in the ScaleMode property setting of the form.

nYCoord   Specifies the vertical coordinate of the point, in the units specified in the ScaleMode property setting of the form.

Remarks

If nXCoord or nYCoord is outside of the form, the Point method returns  – 1.


Applies To

Form, _SCREEN


See Also

Circle Method
Line Method
Print Method
PSet Method


POP KEY Command

Syntax         Arguments         Remarks         See Also

Restores ON KEY LABEL assignments that were placed on the stack with PUSH KEY.

Syntax

POP KEY
[ALL]

Arguments

ALL   Clears all current key assignments defined with ON KEY LABEL and clears all key assignments defined with ON KEY LABEL from the stack.

Remarks

POP KEY, when used with PUSH KEY, lets you save a set of key assignments created with ON KEY LABEL commands, make changes to the key assignments with more ON KEY LABEL commands, and then restore the original key assignments.

For more information on placing ON KEY LABEL commands on the stack, see PUSH KEY.


See Also

ON KEY LABEL
ON( )
PUSH KEY


POP MENU Command

Syntax         Arguments         Remarks         Example         See Also

Restores the specified menu bar definition that was placed on the stack with PUSH MENU.

Syntax

POP MENU MenuBarName
[TO MASTER]

Arguments

MenuBarName   Specifies the name of the menu bar whose definition is pulled off the stack. The specified menu bar can be user-defined or the Visual FoxPro system menu bar.

TO MASTER   Restores the first menu bar definition pushed onto the stack, and then clears the stack.

Remarks

When used with PUSH MENU, POP MENU lets you save a menu bar definition, make changes to the menu bar definition, and then restore the menu bar definition to its original state.

Menu bars are placed on and removed from the stack in last-in, first-out order.


POP MENU Command Example

In the following example, the system menu bar definition is pushed to the stack and then modified. The original system menu definition is then restored by popping it off the stack.

PUSH MENU _MSYSMENU

SET SYSMENU TO _MFILE, _MEDIT

POP MENU _MSYSMENU


See Also

ACTIVATE MENU
DEFINE MENU
POP POPUP
PUSH MENU
PUSH POPUP


POP POPUP Command

Syntax         Arguments         Remarks         Example         See Also

Restores the specified menu definition that was placed on the stack with PUSH POPUP.

Syntax

POP POPUP MenuName

Arguments

MenuName   Specifies the name of the menu whose definition is pulled off the stack. The menu can be a user-defined menu created with DEFINE MENU or a Visual FoxPro system menu.

Remarks

When used with PUSH POPUP, POP POPUP lets you save a menu definition, make changes to the menu definition, and then restore the menu definition to its original state.

Menu definitions are placed on and removed from the stack in a last-in, first-out order.


POP POPUP Command Example

In the following example, a menu named popExam is created. menu definition is pushed to the stack and then one of the menu iems is modified. The original menu definition is then restored by popping it off the stack.

DEFINE POPUP popExam FROM 5,5

DEFINE BAR 1 OF popExam PROMPT 'One'

DEFINE BAR 2 OF popExam PROMPT 'Two'

DEFINE BAR 3 OF popExam PROMPT 'Three'

DEFINE BAR 4 OF popExam PROMPT 'Four'

ACTIVATE POPUP popExam NOWAIT

PUSH POPUP popExam

WAIT 'Popup pushed' WINDOW

RELEASE BAR 2 OF popExam

WAIT 'This is the modified popup' WINDOW

POP POPUP popExam

WAIT 'Popup popped, original popup restored' WINDOW

DEACTIVATE POPUP popExam

RELEASE POPUP popExam


See Also

ACTIVATE POPUP
DEFINE POPUP
POP MENU
PUSH MENU
PUSH POPUP


POPUP( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns as a string the name of the active menu, or a logical value indicating if a menu has been defined.

Syntax

POPUP([cMenuName])

Returns

Character or Logical

Arguments

cMenuName   Returns a logical value indicating if cMenuName has been defined. POPUP( ) returns true (.T.) if the menu you specify has been defined; otherwise POPUP( ) returns false (.F.).

Remarks

POPUP( ) returns the name of the active menu as a character string if you omit the optional cMenuName argument. A menu must be defined and active for POPUP( ) to return its name. Menus are created and activated with DEFINE POPUP and ACTIVATE POPUP. The menu can also be a Visual FoxPro system menu. POPUP( ) returns an empty string if a menu isn’t defined and active or you issue POPUP( ) from the Command window.


See Also

ACTIVATE POPUP
BAR( )
DEFINE BAR
DEFINE POPUP
ON SELECTION POPUP


_PPITCH System Memory Variable
_PPITCH System Variable

Included for backward compatibility. Use the Report Designer instead.


_PQUALITY System Memory Variable
_PQUALITY System Variable

Included for backward compatibility. Use the Report Designer instead.


_PRETEXT System Memory Variable
_PRETEXT System Variable

Syntax         Remarks         See Also

Specifies a character expression to preface text merge lines.

Syntax

_PRETEXT = cExpression

Remarks

With SET TEXTMERGE you can merge text within a program. You can output lines of text, the contents of variables, and the results of expressions and functions to the screen, a window, a printer, a text file, or a low-level file.

If you store a character expression to _PRETEXT, the character expression is added to the beginning of the output text line. To facilitate program indentation, you can store a tab or tabs to _PRETEXT.


See Also

 \ | \\
SET TEXTMERGE
_TEXT


PRIMARY( ) Function

Syntax         Returns         Arguments         Example         See Also

Returns true (.T.) if an index tag is a primary index tag; otherwise, returns false (.F.).

Syntax

PRIMARY([nIndexNumber] [, nWorkArea | cTableAlias])

Returns

Logical

Arguments

nIndexNumber   Specifies the number of the index tag for which PRIMARY( ) returns the primary status. PRIMARY( ) returns the primary status in the following order as nIndexNumber increases from 1 to the total number of structural compound and independent compound index tags.

1.	Primary status for each tag in the structural compound index (if one is present) are returned first. The primary status is returned for the tags in the order the tags are created in the structural index.

2.	Primary status for each tag in any open, independent compound indexes are returned next. The primary status is returned for the tags in the order in which the tags are created in the independent compound indexes.

If you omit nIndexNumber, PRIMARY( ) checks the master controlling index tag to see if it’s a primary index tag. If there is no master controlling index tag, PRIMARY( ) returns false (.F.).

nWorkArea   Specifies the work area of the index tag specified with nIndexNumber.

cTableAlias   Specifies the work area of the index tag specified with nIndexNumber.

If you omit nWorkArea and cTableAlias, PRIMARY( ) checks the index tag in the currently selected work area to see if it’s a primary index tag.


PRIMARY( ) Function Example

The following example opens the customer table in the database. FOR ... ENDFOR is used to create a loop in which the primary status of each index tag in the customer structural index is checked. The name of each structural index tag is displayed with its primary status.

CLOSE DATABASES

SET PATH TO (SYS(2004) + 'samples\data\')	&& Sets path to database

OPEN DATABASE testdata  && Open testdata database

USE Customer	  && Open customer table

FOR nCount = 1 TO 254

IF !EMPTY(TAG(nCount))  && Checks for tags in the index

? TAG(nCount)  && Display tag name

? PRIMARY(nCount)	  && Display primary status

ELSE

EXIT  && Exit the loop when no more tags are found

ENDIF

ENDFOR


See Also

ALTER TABLE - SQL
CANDIDATE( )
CREATE TABLE - SQL
INDEX


Print Method

Syntax         Arguments         Applies To         See Also

Prints a character string on a form.

Syntax

[FormSet.] Object.Print [(cText)]

Arguments

cText   Specifies the character string to print. If you omit cText, a blank line is printed.

cText is printed on the form starting at the position specified by the CurrentX and CurrentY properties. When a carriage return is included, CurrentX is increased by the width of cText (same as the value returned by TextWidth) and CurrentY remains unchanged.

When the Print method is finished, the CurrentX and CurrentY properties are set to the point immediately after the last character printed.


Applies To

Form, _SCREEN


See Also

CurrentX
CurrentY Properties
TextHeight Method
TextWidth Method


PRINTJOB ... ENDPRINTJOB Command

Syntax         Arguments         Remarks         See Also

Activates the settings for print job system variables.

Syntax

PRINTJOB
Commands

ENDPRINTJOB

Arguments

Commands   Specifies the Visual FoxPro commands that are executed until the print job is completed.

Remarks

PRINTJOB ... ENDPRINTJOB initializes the printer and certain system variables that affect printed output. It can send control codes to the printer, eject a page from the printer before and/or after a print job, initialize the printer column number, and control the number of copies printed.

PRINTJOB performs these tasks:

•	Sends starting printer control codes, stored in the system variable _PSCODE, to the printer. For more information on printer control codes, see the System Variables Overview and your printer manual.

•	Ejects a page if the system variable _PEJECT is set to BEFORE or to BOTH.

•	Sets the system variable _PCOLNO to 0. _PCOLNO stores the printer column number.

ENDPRINTJOB performs these tasks:

•	Sends ending printer control codes, stored in the system variable _PECODE, to the printer. You can reset the printer to the configuration it had before PRINTJOB was issued.

•	Ejects a page if the system variable _PEJECT is set to AFTER or to BOTH.

•	Loops back to PRINTJOB to print another copy of the report if the _PCOPIES system variable is set to a value higher than 1 (the default). The value of the system variable _PCOPIES determines the number of copies. When the number of copies printed equals the value of _PCOPIES, Visual FoxPro exits the loop. Program control then begins with the command immediately following ENDPRINTJOB.

PRINTJOB and ENDPRINTJOB may be executed only from within a program. You may not nest PRINTJOB ... ENDPRINTJOB commands.


See Also

ON PAGE
System Variables Overview


PRINTSTATUS( ) Function

Syntax         Returns         Remarks         Example         See Also

Returns true (.T.) if the printer or print device is online; otherwise, false (.F.) is returned.

Syntax

PRINTSTATUS( )

Returns

Logical

Remarks

PRINTSTATUS( ) is similar to SYS(13), except SYS(13) returns READY instead of true (.T.) or OFFLINE instead of false (.F.).

In Visual FoxPro, PRINTSTATUS( ) always returns true (.T.) if the printer is connected through the Windows Control Panel.


PRINTSTATUS( ) Function Example

? PRINTSTATUS( )

*** Program Example ***

STORE PRINTSTATUS( ) TO glReady

IF NOT glReady

WAIT 'Make sure printer is attached and turned on!' WINDOW

ELSE

WAIT 'Printer is ready!' WINDOW

ENDIF


See Also

SET DEVICE
SET PRINTER
SYS(13) - Printer Status


PRIVATE Command

Syntax         Arguments         Remarks         Example         See Also

Hides specified variables or arrays that were defined in a calling program from the current program.

Syntax

PRIVATE VarList
 – Or –

PRIVATE ALL
[LIKE Skeleton | EXCEPT Skeleton]

Arguments

VarList   Specifies the variables or arrays to be declared private.

ALL LIKE Skeleton   Causes PRIVATE to hide all variables and arrays whose names match Skeleton, which can contain the question mark (?) and asterisk (*) wildcards.

ALL EXCEPT Skeleton   Causes PRIVATE to hide all variables or arrays unless their names match Skeleton, which can contain the question mark (?) and asterisk (*) wildcards.

Remarks

The hiding of variables created in higher-level programs enables variables of the same name as the private variables to be manipulated in the current program without affecting the values of the hidden variables. Once the program containing PRIVATE has completed execution, all variables and arrays that were declared private are again available.

PRIVATE doesn’t create variables; it simply hides variables declared in higher-level programs from the current program.


PRIVATE Command Example

*** Program example demonstrating PRIVATE ***

SET TALK OFF

val1 = 10

val2 = 15

DO down

? val1, val2  && Displays 10, 100

PROCEDURE down

PRIVATE val1

val1 = 50

val2 = 100

? '       Val1       Val2'

? val1, val2  && Displays 50, 100

RETURN


See Also

DIMENSION
FUNCTION
LOCAL
LPARAMETERS
PARAMETERS
PARAMETERS( )
PROCEDURE
PUBLIC


PRMBAR( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns the text of a menu item.

Syntax

PRMBAR(MenuName, nMenuItemNumber)

Returns

Character

Arguments

MenuName   Specifies the menu name.

nMenuItemNumber   Specifies the number of the menu item whose text PRMBAR( ) returns. For example, if nMenuItemNumber is 1, the text of the first menu item is returned; if nMenuItemNumber is 2, the text of the second menu item is returned, and so on. The expression must be at least 1 and no greater than the number of menu items in the menu.

Remarks

Menus are created with DEFINE POPUP, which creates the menu, and DEFINE BAR, which creates the menu items in the menu. PRMBAR( ) also works with a Visual FoxPro system menu. PRMBAR( ) returns the text that appears on the menu item. The menu doesn’t have to be active.

If a menu item was created using the backslash and less-than characters (\<) to create an access key, or a backslash (\) to disable the menu item, PRMBAR( ) returns only the menu item text; it doesn’t include these special characters. PRMBAR( ) returns an empty string when a menu item is a separator created with the backslash and dash (\-) characters.


See Also

CNTBAR( )
GETBAR( )
DEFINE BAR
DEFINE POPUP
MRKBAR( )
PRMPAD( )


PRMPAD( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the text of a menu title.

Syntax

PRMPAD(MenuBarName, MenuTitleName)

Returns

Character

Arguments

MenuBarName   Specifies the name of the menu bar containing the menu title.

MenuTitleName   Specifies the menu title.

Remarks

Menu bars are created with DEFINE MENU, which creates the menu bar, and DEFINE PAD, which creates the menu titles in the menu bar. PRMPAD( ) also works with the Visual FoxPro menu system. A menu bar doesn’t have to be active for PRMPAD( ) to return the text for a menu title.

If a menu title was created using the backslash and less-than characters (\<) to create an access key, or a backslash (\) to disable the menu title, PRMPAD( ) returns only the text of the menu title; it doesn’t include the special characters.


PRMPAD( ) Function Example

In the following example, a menu bar named mnuExample is created with three menu titles. The access key and disabled option designators aren’t returned from the menu titles named titleTwo and titleThree. The menu bar is activated to show the menu titles and is cleared from the screen and from memory when a menu title is chosen.

CLEAR

SET TALK OFF

STORE 'mnuExample' TO gcPopName

DEFINE MENU mnuExample BAR AT LINE 1

DEFINE PAD titleOne OF mnuExample PROMPT 'This will be returned'

DEFINE PAD titleTwo OF mnuExample PROMPT '\<As will this'

DEFINE PAD titleThree OF mnuExample PROMPT '\And this, too'

=messagebox( PRMPAD('mnuExample', 'titleOne') )

=messagebox( PRMPAD('mnuExample', 'titleTwo') )

=messagebox( PRMPAD(gcPopName, 'titleThree') )

ACTIVATE MENU mnuExample

DEACTIVATE MENU mnuExample

RELEASE MENU mnuExample


See Also

CNTBAR( )
GETBAR( )
DEFINE BAR
DEFINE POPUP
MRKPAD( )
PRMBAR( )


PROCEDURE Command

Syntax         Arguments         Remarks         Example         See Also

Identifies the beginning of a procedure in a program file.

Syntax

PROCEDURE ProcedureName
Commands
[RETURN [eExpression ]]

ENDPROC

Arguments

ProcedureName   Specifies the name of the procedure to create.

Remarks

PROCEDURE is a statement within a program file that specifies the beginning of each procedure in the program file and defines the procedure name. Procedure names must begin with a letter or underscore and may contain any combination of letters, numbers, and underscores.

n Visual FoxPro for Windows, procedure names can be up to 254 characters long.

Comments can be placed on the same line after PROCEDURE and ENDPROC. These comments are ignored during compilation and program execution.

The PROCEDURE statement is followed by a series of commands that make up the procedure. You can include RETURN anywhere in the procedure to return control to the calling program or to another program, and to define a value returned by the procedure. If you do not include a RETURN command, an implicit RETURN is automatically executed when the function quits. If the RETURN command does not include a return value (or if an implicit RETURN is executed), Visual FoxPro assigns .T. (True) as the return value.

The procedure ends with the ENDPROC command. This command is optional; the procedure quits when it encounters another PROCEDURE command, a FUNCTION command, or the end of the progam file.

Note   You cannot have normal executable program code included in a program file after procedures; only procedures, user-defined functions, and class definition can follow the first PROCEDURE or FUNCTION command in the file.

When you execute a procedure with DO ProcedureName, Visual FoxPro searches for the procedure in a specific order. Visual FoxPro searches:

1.	The program containing DO ProcedureName.

2.	The current database.

3.	The procedure files opened with SET PROCEDURE.

4.	Programs in the execution chain. It searches program files beginning with the most recently executed program and continuing back to the first executed program.

5.	A stand-alone program file. If a program file with the same name as the file name specified with DO is found, Visual FoxPro executes the program. If a matching program file name isn’t found, Visual FoxPro generates an error message.

Include the IN clause in DO to execute a procedure in a specific file.

By default, parameters are passed to procedures by value. For information on passing parameters to procedures by reference, see SET UDFPARMS. A maximum of 27 parameters can be passed to a procedure. Parameters can be passed to a procedure by including a PARAMETERS or LPARAMETERS statement in the procedure, or by placing a list of parameters immediately after PROCEDURE ProcedureName. Enclose the list of parameters in a set of parentheses, and separate the parameters with commas.


PROCEDURE Command Example

The following example illustrates how a procedure can be called to accomplish a discrete task such as making an entry in a log file. The procedure opens the log file (which is assumed to exist in the example), constructs an entry based in information passed in parameters, writes the entry out, and closes the file. The procedure is called with a DO command similar to the one at the top of the program.

DO MakeLogEntry WITH "Logged in", "jsmith"

PROCEDURE MakeLogEntry

   PARAMETERS message, username

   pnHandle = FOPEN("LOG2.TXT",2)           && Assume the file exists

   pnSize = FSEEK(pnHandle,0,2)	             	&& Move to end of file

   logEntry = dtoc(date())+","+time()+","+username+","+message

   =FPUTS(pnHandle, logEntry)

   =FCLOSE(pnHandle)  && Close file

ENDPROC

The following example shows how a procedure can be called to return a value.

SET CENTURY ON

? longdate(({02/16/95}))    && Displays Thursday, February 16, 1995

PROCEDURE longdate

   PARAMETER mdate

   RETURN CDOW(mdate) + ", " + MDY(mdate)

ENDPROC


See Also

FUNCTION
LPARAMETERS
LOCAL
PARAMETERS
PARAMETERS( )
PRIVATE
PUBLIC
RETURN
SET PROCEDURE
SET UDFPARMS


PROGRAM( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the name of the program currently executing or the name of the program executing when an error occurred.

Syntax

PROGRAM([nLevel])

Returns

Character

Arguments

nLevel   Specifies how many program levels back the program name is to be found. This parameter can range from 0 to the program nesting depth. A program can execute another program which can execute another program, and so on. Programs may be nested to 128 levels.

If you specify 0 or 1 in nLevel, PROGRAM( ) returns the name of the master program (the highest-level program). If nLevel exceeds the program nesting depth, PROGRAM( ) returns an empty string.

Remarks

PROGRAM( ) helps your program recover from errors. It is similar to SYS(16).

If used without an argument, PROGRAM( ) returns the name of the currently executing program.


PROGRAM( ) Function Example

ON ERROR DO errhand WITH PROGRAM( )

*** The next line should generate an error ***

USE nodatabase

ON ERROR	  && Returns to system default error-handling routine

PROCEDURE errhand

PARAMETERS gcProgram

WAIT 'An error occurred in the program ' + gcProgram WINDOW


See Also

DO
LINENO( )
MESSAGE( )
SYS(16) - Executing Program File Name


ProgrammaticChange Event

Syntax         Applies To         See Also

Occurs when the value of a control is changed in code.

Syntax

PROCEDURE Control.ProgrammaticChange
[LPARAMETERS nIndex]

Parameters

nIndex   Uniquely identifies a control if it is in a control array.


Applies To

CheckBox, ComboBox, CommandGroup, EditBox, ListBox, OptionGroup, Spinner, TextBox


See Also

Caption Property
Style Property


PROMPT( ) Function

Syntax         Returns         Remarks         See Also

Returns the text for a menu title chosen from a menu bar or for a menu item chosen from a menu.

Syntax

PROMPT( )

Returns

Character

Remarks

PROMPT( ) returns the text of the menu title last chosen from a menu bar or the menu item last chosen from a menu. The menu bar or menu can be user-defined or a Visual FoxPro system menu bar or menu. If a menu bar or menu isn’t active or you press ESC to exit a menu bar or menu, PROMPT( ) returns an empty string.

A menu bar is created with DEFINE MENU, and each menu title in the menu bar is created with DEFINE PAD. A menu is created with DEFINE POPUP, and the menu items in the menu are created with DEFINE BAR.

MENU( ) and POPUP( ) can be used to return the name of the menu bar or menu from which the menu title or menu item is chosen.


See Also

BAR( )
DEFINE BAR
DEFINE MENU
DEFINE PAD
DEFINE POPUP
POPUP( )
PRMBAR( )


PROPER( ) Function

Syntax         Returns         Arguments         Example         See Also

Returns from a character expression a string capitalized as appropriate for proper names.

Syntax

PROPER(cExpression)

Returns

Character

Arguments

cExpression   Specifies the character expression from which PROPER( ) returns a capitalized character string.


PROPER( ) Function Example

STORE 'Visual FoxPro' TO gcExpr1

CLEAR

? PROPER(gcExpr1)  && Displays "Visual Foxpro"

STORE 'VISUAL FOXPRO' TO gcExpr2

? PROPER(gcExpr2)  && Displays "Visual Foxpro"


See Also

LOWER( )
UPPER( )


PROW( ) Function

Syntax         Returns         Remarks         Example         See Also

Returns the current row number of the printer’s print head.

Syntax

PROW( )

Returns

Numeric

Remarks

If you issue EJECT, Visual FoxPro resets PROW( ) to 0.

PROW( ) is especially useful for relative addressing of printed text.


PROW( ) Function Example

In the following example, the two commands return the same result. You can use the $ operator in place of PCOL( ). Both $ and PCOL( ) return the current column position of the printer.

@ PROW( ), PCOL( ) + 12 SAY 'Contact person'

@ PROW( ), $+12 SAY 'Contact person'


See Also

@ ... SAY
COL( )
PCOL( )
ROW( )


PRTINFO( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns the current specified printer setting.

Syntax

PRTINFO(nPrinterSetting [, cPrinterName])

Returns

Numeric

Arguments

nPrinterSetting   Specifies which Visual FoxPro printer setting is returned.

The following tables list the printer setting return values.

Note   If PRTINFO(2) returns  – 1 or a value other than those listed in the table below, use PRTINFO(3) and PRTINFO(4) to return the paper size.

If nPrinterSetting equals 1 (PRT_ORIENTATION in FOXPRO.H), PRTINFO( ) returns the paper orientation:

Return values	Setting
–1	Information not available
0	Portrait
1	Landscape
If nPrinterSetting equals 2 (PRT_PAPERSIZE in FOXPRO.H), PRTINFO( ) returns the paper size:

Return values	Setting
–1 or a value other than those listed below	Information not available. Use nPrinterSetting  = 3 and nPrinterSetting = 4 to determine the paper size.
1	Letter, 8 1/2 x 11 in
2	Letter Small, 8 1/2 x 11 in
3	Tabloid, 11 x 17 in
4	Ledger, 17 x 11 in
5	Legal, 8 1/2 x 14 in
6	Statement, 5 1/2 x 8 1/2 in
7	Executive, 7 1/4 x 10 1/2 in
8	A3, 297 x 420 mm
9	A4, 210 x 297 mm
10	A4, Small  210 x 297 mm
11	A5, 148 x 210 mm
12	B4, 250 x 354 mm
13	B5, 182 x 257 mm
14	Folio, 8 1/2 x 13 in
15	Quarto, 215 x 275 mm
16	10 x 14 in
17	11 x 17 in
18	Note, 8 1/2 x 11 in
19	Envelope #9, 3 7/8 x 8 7/8 in
20	Envelope #10, 4 1/8 x 9 1/2 in
21	Envelope #11, 4 1/2 x 10 3/8 in
22	Envelope #12, 4 1/2 x 11 in
23	Envelope #14, 5 x 11 1/2 in
24	C size sheet
25	D size sheet
26	E size sheet
27	Envelope DL, 110 x 220 mm
28	Envelope C5, 162 x 229 mm
29	Envelope C3, 324 x 458 mm
30	Envelope C4, 229 x 324 mm
31	Envelope C6, 114 x 162 mm
32	Envelope C65, 114 x 229 mm
33	Envelope B4, 250 x 353 mm
34	Envelope B5, 176 x 250 mm
35	Envelope B6, 176 x 125 mm
36	Envelope, 110 x 230 mm
37	Envelope Monarch, 3 7/8 x 7.5 in
38	6 3/4 Envelope, 3 5/8 x 6 1/2 in
39	US Std Fanfold, 14 7/8 x 11 in
40	German Std Fanfold, 8 1/2 x 12 in
41	German Legal Fanfold, 8 1/2 x 13 in
If nPrinterSetting equals 3 (PRT_PAPERLENGTH in FOXPRO.H), PRTINFO( ) returns the paper length in .1mm increments.

If nPrinterSetting equals 4 (PRT_PAPERWIDTH in FOXPRO.H), PRTINFO( ) returns the paper width in .1mm increments.

If nPrinterSetting equals 5 (PRT_SCALE in FOXPRO.H), PRTINFO( ) returns the factor by which printed output is scaled.

If nPrinterSetting equals 6 (PRT_COPIES in FOXPRO.H), PRTINFO( ) returns the number of copies to print.

If nPrinterSetting equals 7 (PRT_DEFASOURCE in FOXPRO.H), PRTINFO( ) returns the default paper source:

Return values	Setting
1	Upper bin
2	Lower bin
3	Middle bin
4	Manual feed
5	Envelope bin
6	Manual feed envelope
7	Auto select
8	Tractor feed
9	Small format
10	Large format
11	Large capacity
14	Cassette
If nPrinterSetting equals 8 (PRT_PRTQUAL in FOXPRO.H), PRTINFO( ) returns a positive value indicating the horizontal resolution in dots per inch (DPI), or a negative value indicating the print quality:

Return values	Setting
-1	Draft
-2	Low
-3	Medium
-4	High
If nPrinterSetting equals 9 (PRT_COLOR in FOXPRO.H), PRTINFO( ) returns a value indicating if a color printer renders color or monochrome output:

Return values	Setting
1	Color
2	Monochrome
If nPrinterSetting equals 10 (PRT_DUPLEX in FOXPRO.H), PRTINFO( ) returns the duplex mode:

Return values	Setting
1	Simplex printing
2	Vertical duplex
3	Horizontal duplex
If nPrinterSetting equals 11 (PRT_YRESOLUTION in FOXPRO.H), PRTINFO( ) returns the vertical resolution in dots per inch (DPI).   – 1 is returned if this information is not available.

If nPrinterSetting equals 12 (PRT_TTOPTION in FOXPRO.H), PRTINFO( ) returns a value that indicates how TrueType® fonts are printed:

Return values	Setting
1	Print as bitmapped graphics
2	Download as soft fonts
3	Substitute device fonts
If nPrinterSetting equals 13 , PRTINFO( ) returns a value that indicates if output is collated:

Return values	Setting
0	No collation
1	Collated
cPrinterName   Specifies the name of the printer for which information is returned. If cPrinterName is omitted, information is returned for the default printer.

Remarks

Visual FoxPro printer settings are set in the Page Setup dialog box. Choose Page Setup from the File menu to display the Visual FoxPro Page Setup dialog box.


See Also

GETPRINTER( )
PRINTSTATUS( )
SET DEVICE
SET PRINTER
SYS(13) - Printer Status
SYS(1037) - Page Setup Dialog Box


_PSCODE System Memory Variable
_PSCODE System Variable

Included for backward compatibility. Use the Report Designer instead.


PSet Method

Syntax         Arguments         Remarks         Applies To         See Also

Sets a point on a form or the main Visual FoxPro window to the foreground color.

Syntax

[FormSet.]Object.PSet([nXCoord, nYCoord])

Arguments

nXCoord   Specifies the horizontal coordinate of the point to set, in the unit of measurement specified by the ScaleMode property of the form.

nYCoord   Specifies the vertical coordinate of the point to set, in the unit of measurement specified by the ScaleMode property of the form.

Remarks

The size of the point drawn depends on the DrawWidth property. When DrawWidth is set to 1, the PSet method sets a single pixel to the specified color. When DrawWidth is set to a value greater than 1, the point is centered on the specified coordinates. The way the point is drawn depends on the setting of the DrawMode and DrawStyle properties.

When the PSet method is called, the CurrentX and CurrentY properties are set to the point specified by the arguments.


Applies To

Form, _SCREEN


See Also

CurrentX
CurrentY Properties
DrawMode Property
DrawStyle Property
DrawWidth Property
ForeColor Property


_PSPACING System Memory Variable
_PSPACING System Variable

Included for backward compatibility. Use the Report Designer instead.


PUBLIC Command

Syntax         Arguments         Remarks         Example         See Also

Defines global variables or arrays.

Syntax

PUBLIC MemVarList
 – Or –

PUBLIC [ARRAY] ArrayName1(nRows1 [, nColumns1])
[, ArrayName2(nRows2 [, nColumns2])] ...

Arguments

MemVarList   Specifies one or more memory variables to be initialized and designated as global.

[ARRAY] ArrayName1 (nRows1 [, nColumns1])
[, ArrayName2 (nRows2 [, nColumns2])] ...   Specifies one or more arrays to be initialized and designated as global. See DIMENSION for a description of each argument.

Remarks

Global variables and arrays can be used and modified from any program you execute during the current Visual FoxPro session.

Variables and arrays created with PUBLIC are initialized false (.F.) except for the public variables FOX and FOXPRO, which are initialized true (.T.). The public variables FOX and FOXPRO can be used to conditionally execute code based on the product you are running.

Any Variable or array you create in the Command window is automatically public.

Any Variable or array you wish to declare as public must be declared public prior to assigning it a value.

Visual FoxPro generates a syntax error if, within a program, you assign a value to a variable or array and later declare it public with PUBLIC.


PUBLIC Command Example

SET TALK OFF

PUBLIC val1,val2

val1 = 10

val2 = 15

DO down

? val1

? val2

RELEASE ALL 	 && Releases private variables only

DISPLAY MEMORY LIKE val?

RELEASE val1,val2  && Public variables must be released explicitly

DISPLAY MEMORY LIKE val?

PROCEDURE down

PRIVATE val1

val1 = 50

val2 = 100

? val1

? val2

RETURN


See Also

DIMENSION
FUNCTION
LOCAL
LPARAMETERS
PARAMETERS
PARAMETERS( )
PRIVATE
PROCEDURE
RELEASE


PUSH KEY Command

Syntax         Arguments         Remarks         See Also

Places all current ON KEY LABEL command settings on a stack in memory.

Syntax

PUSH KEY
[CLEAR]

Arguments

CLEAR   Clears all current key assignments from memory.

Remarks

PUSH KEY, when used with POP KEY, lets you save key assignments defined with ON KEY LABEL commands, change these assignments, and then restore the previous assignments.

For example, you may want to use a new set of ON KEY LABEL commands when you open a Browse window. Before you open the Browse window, use PUSH KEY to save the current ON KEY LABEL key assignments in memory. You can then add or change ON KEY LABEL assignments specifically for the Browse window. After you close the Browse window, your previous ON KEY LABEL key assignments can be restored from memory with POP KEY.

ON KEY LABEL settings are placed on and removed from the stack in a last-in, first-out order.

DISPLAY STATUS and LIST STATUS show the current key assignments defined with ON KEY LABEL commands.


See Also

ON KEY LABEL
ON( )
POP KEY


PUSH MENU Command

Syntax         Arguments         Remarks         Example         See Also

Places a menu bar definition in a stack of menu bar definitions in memory.

Syntax

PUSH MENU MenuBarName

Arguments

MenuBarName   Specifies the name of the menu bar whose definition is placed on the stack. The menu bar can be user-defined or the Visual FoxPro system menu bar.

Remarks

When used with POP MENU, PUSH MENU lets you save a menu bar definition, make changes to the menu bar definition, and then restore the menu bar definition to its original state.

Menu bar definitions are placed on and removed from the stack in last-in, first-out order.


PUSH MENU Command Example

In the following example, the Visual FoxPro system menu bar is pushed to the stack and then modified. The original system menu bar is then restored by popping it off the stack.

WAIT WINDOW 'Press a key to push the system menu bar'

PUSH MENU _MSYSMENU

WAIT WINDOW 'Press a key to change the system menu bar'

SET SYSMENU TO _MFILE, _MEDIT

WAIT WINDOW 'Press a key to restore the system menu bar'

POP MENU _MSYSMENU


See Also

ACTIVATE MENU
DEFINE MENU


PUSH POPUP Command

Syntax         Arguments         Remarks         Example         See Also

Places a menu definition on a stack of menu definitions in memory.

Syntax

PUSH POPUP MenuName

Arguments

MenuName   Specifies the name of the menu whose definition is placed on the stack. The menu can also be a Visual FoxPro system menu.

Remarks

When used with POP POPUP, PUSH POPUP lets you save a menu definition, make changes to the menu definition, and then restore the menu definition to its original state.

Menu definitions are placed on and removed from the stack in last-in, first-out order.


PUSH POPUP Command Example

In the following example, a menu named popExam is created. The menu definition is pushed to the stack and then modified. The original menu is then restored by popping it off the stack.

DEFINE POPUP popExam FROM 5,5

DEFINE BAR 1 OF popExam PROMPT 'One'

DEFINE BAR 2 OF popExam PROMPT 'Two'

DEFINE BAR 3 OF popExam PROMPT 'Three'

DEFINE BAR 4 OF popExam PROMPT 'Four'

ACTIVATE POPUP popExam NOWAIT

PUSH POPUP popExam

WAIT 'Original Popup' WINDOW

RELEASE BAR 2 OF popExam

WAIT 'Modified Popup. Original Popup is pushed to a stack.' WINDOW

POP POPUP popExam

WAIT 'Original Popup restored' WINDOW

DEACTIVATE POPUP popExam

RELEASE POPUP popExam


See Also

ACTIVATE POPUP
DEFINE POPUP


PUTFILE( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Invokes the Save As dialog box and returns the file name you specify.

Syntax

PUTFILE([cCustomText] [, cFileName] [, cFileExtensions])

Returns

Character

Arguments

cCustomText   Specifies custom text to appear in the Save As dialog box. In Windows 3.x, the text appears as the dialog box title. In Windows95, the custom text replaces the File Name label. On the Macintosh, the custom text replaces Save As label.

Note that under Windows 95, long captions may be truncated.

cFileName   Specifies the default file name displayed in the text box.

cFileExtensions   Specifies file name extensions. Only file names with the specified extension are displayed in the scrollable list of the Save As dialog box when the All Files check box is cleared. The first extension in cFileExtensions is automatically appended to the file name entered if an extension isn’t included with the file name. For a list of Visual FoxPro file extensions and corresponding creator types, see File Extensions and File Types.

The character expression cFileExtensions can take one of the following forms:

•	cFileExtensions can contain a single extension, such as PRG, and only file names with that extension are displayed.

•	cFileExtensions can contain a list of file name extensions separated by semicolons. For example, if you include PRG;FXP, Visual FoxPro displays all file names with the extensions .PRG and .FXP.

•	If file names have the same root name but different extensions (for example, CUSTOMER.PRG and CUSTOMER.FXP), Visual FoxPro displays only the file name with the extension that appears first in cFileExtensions.

•	cFileExtensions can contain a list of file name extensions separated by vertical bars, such as PRG|FXP. In such a case, Visual FoxPro displays all file names with listed extensions, even if the files have the same root name.

•	If cFileExtensions contains only a semicolon (;), Visual FoxPro displays all file names that don’t have an extension.

•	If cFileExtensions is an empty string, Visual FoxPro displays the names of all files in the current directory or folder.

•	If cFileExtensions contains MS-DOS wildcards, such as the question mark (?) and asterisk (*), Visual FoxPro displays all file names with extensions that meet the wildcard criteria. For example, if cFileExtensions is ?X?, all file names with the extensions .FXP, .EXE, .TXT, and so on, are displayed.

Remarks

Use PUTFILE( ) to choose an existing file name or specify a new file name. PUTFILE( ) returns the file name with its path. If you don’t enter a file name, PUTFILE( ) returns the default file name (specified with cFileName) and extension (specified by cFileExtensions). If you choose Cancel or press ESC, PUTFILE( ) returns an empty string. You can use the file name that PUTFILE( ) returns to name a file and save it to disk.


PUTFILE( ) Function Example

The following example creates a delimited data file from any existing table the user chooses. GETFILE( ) is used to find and open a table and PUTFILE( ) is used to return the name of the target file.

gcTableName = GETFILE('DBF', 'Open Table:')

USE (gcTableName)

gcDelimName = ALIAS( ) + '.DLM'

gcDelimFile = PUTFILE('Delimited file:', gcDelimName, 'DLM')

IF EMPTY(gcDelimFile)  && Esc pressed

CANCEL

ENDIF

COPY TO (gcDelimFile) DELIMITED	&& Create delimited file

MODIFY FILE (gcDelimFile) NOEDIT


See Also

FILE( )
GETEXPR
GETFILE( )
GETPICT( )
LOCFILE( )


PV( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the present value of an investment.

Syntax

PV(nPayment, nInterestRate, nTotalPayments)

Returns

Numeric

Arguments

nPayment   Specifies the periodic payment amount. nPayment can evaluate to a positive or negative number. PV( ) assumes that the payments are made at the end of each period.

nInterestRate   Specifies the periodic interest rate. If the interest rate of an investment is annual and the payments are made monthly, divide the annual interest rate by 12.

nTotalPayments   Specifies the total number of payments.

Remarks

PV( ) computes the present value of an investment based on a series of equal periodic payments at a constant periodic interest rate.


PV( ) Function Example

STORE 500 to gnPayment  && Periodic payments made monthly

STORE .075/12 TO gnInterest	  && 7.5% annual interest rate

STORE 48 TO gnPeriods  && Four years (48 months)

CLEAR

? PV(gnPayment, gnInterest, gnPeriods)  && Displays 20679.19


See Also

CALCULATE
FV( )


_PWAIT System Memory Variable
_PWAIT System Variable

Included for backward compatibility. Use the Report Designer instead.


QueryUnload Event

Syntax         Remarks         Applies To         See Also

Occurs before a form is unloaded.

Syntax

PROCEDURE Form.QueryUnload

Remarks

The QueryUnload event occurs before the Destroy event. The ReleaseType property is set prior to the QueryUnload event being called.

The QueryUnload event occurs when CLEAR WINDOWS, RELEASE WINDOWS, or QUIT is executed in code, when the user double-clicks the Control-menu box, or when the user chooses Close from the Control-menu on a form.

Note   The QueryUnload event does not occur if you issue the RELEASE command on the form in code or invoke the form's Release method.

Issuing NODEFAULT in the QueryUnload event procedure prevents the form from unloading.


Applies To

Form


See Also

CLEAR
ControlBox Property
DEFINE CLASS
Destroy Event
QUIT
RELEASE
Release Method
RELEASE WINDOWS
ReleaseType Property
Unload Event


QUIT Command

Syntax         Remarks         See Also

Ends the current Visual FoxPro session and returns control to the operating system.

Syntax

QUIT

Remarks

In Visual FoxPro for Windows, you are returned to Windows.

Caution   Always use QUIT to terminate a Visual FoxPro session. If you turn the computer off without issuing QUIT, open files may be damaged and data lost, and temporary work files that would normally be deleted may be left on disk.


See Also

CANCEL
RESUME
RUN
SUSPEND


Quit Method

Syntax         Remarks         Applies To          See Also

Ends an instance of Visual FoxPro.

Syntax

ApplicationObject.Quit( )

Remarks

Call the Quit( ) method to return control to the application that created the instance of Visual FoxPro.


Applies To

Application Object, _VFP System Variable


See Also

QUIT


RAND( ) Function

Syntax         Returns         Arguments         Example         See Also

Returns a random number between 0 and 1.

 Syntax

RAND([nSeedValue])

 Returns

Numeric

 Arguments

nSeedValue   Specifies the seed value that determines the sequence of values RAND( ) returns.

RAND( ) returns the same sequence of random numbers if you use the same seed value for nSeedValue the first time you issue RAND( ) followed by subsequent RAND( ) function calls without nSeedValue.

If nSeedValue is negative the first time you issued RAND( ), a seed value from the system clock is used. To achieve the most random sequence of numbers, issue RAND( ) initially with a negative argument and then issue RAND( ) without an argument.

If you omit nSeedValue, RAND( ) uses a default seed value of 100001.


 RAND( ) Function Example

The first example below uses RAND( ) to create a table with 10 records containing random values, then uses MIN( ) and MAX( ) to display the maximum and minimum values in the table.

The second example below displays a random number that falls between two values, 1 and 10.

CLOSE DATABASES

CREATE TABLE Random (cValue N(3))

FOR nItem = 1 TO 10  && Append 10 records,

APPEND BLANK

REPLACE cValue WITH 1 + 100 * RAND( )  && Insert random values

ENDFOR

CLEAR

LIST  && Display the values

gnMaximum = 1  && Initialize minimum value

gnMinimum = 100  && Initialize maximum value

SCAN

gnMinimum = MIN(gnMinimum, cValue)

gnMaximum = MAX(gnMaximum, cValue)

ENDSCAN

? 'The minimum value is: ', gnMinimum  && Display minimum value

? 'The maximum value is: ', gnMaximum  && Display maximum value

CLEAR

gnLower = 1

gnUpper = 10

? INT((gnUpper - gnLower + 1) * RAND( ) + gnLower)


 See Also

EXP( )
PI( )


RangeHigh Event

Syntax         Parameters         Remarks         Applies To         See Also

For a spinner or text box, occurs when the control loses the focus. For a combo box or list box, occurs when the control receives the focus.

 Syntax

PROCEDURE Object.RangeHigh
[LPARAMETERS nIndex]

 Parameters

nIndex   Uniquely identifies a control if it is in a control array.

 Remarks

A RangeHigh event can return a numeric value to Visual FoxPro through a RETURN statement. For a spinner or a text box with a numeric value, if the value returned to Visual FoxPro is less than the value entered in the control, the control retains the focus. For a combo box or list box, the value returned to Visual FoxPro specifies which item in the control is initially selected, For example, if 2 is returned to Visual FoxPro, the second item in the control is initially selected.


 Applies To

ComboBox, ListBox, Spinner, TextBox


 See Also

KeyboardHighValue
KeyboardLowValue Properies
RangeLow Event
RETURN
SpinnerHighValue
SpinnerLowValue Properties


RangeLow Event

Syntax         Parameters         Remarks         Applies To         See Also

For a spinner or text box, occurs when the control loses the focus. For a combo box or list box, occurs when the control receives the focus.

 Syntax

PROCEDURE Object.RangeLow
[LPARAMETERS nIndex]

 Parameters

nIndex   Uniquely identifies a control if it is in a control array.

 Remarks

A RangeLow event can return a numeric value to Visual FoxPro through a RETURN statement. For a spinner or a text box with a numeric value, if the value returned to Visual FoxPro is greater than the value entered in the control, the control retains the focus. For a combo box or list box, the value returned to Visual FoxPro specifies which item in the control is initially selected, For example, if 2 is returned to Visual FoxPro, the second item in the control is initially selected.

If SET KEYCOMP is set to MAC (the default), a ComboBox control with the Style property set to 2 - Dropdown List cannot receive the focus; to display and steer in the drop-down list, use the mouse.


 Applies To

ComboBox, ListBox, Spinner, TextBox


 See Also

KeyboardHighValue
KeyboardLowValue Properties
RangeHigh Event
RETURN
SpinnerHighValue
SpinnerLowValue Properties


RAT( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the numeric position of the last (rightmost) occurrence of a character string within another character string.

 Syntax

RAT(cSearchExpression, cExpressionSearched [, nOccurrence])

 Returns

Numeric

 Arguments

cSearchExpression   Specifies the character expression that RAT( ) looks for in cExpressionSearched. The character expression can refer to a memo field of any size.

cExpressionSearched   Specifies the character expression that RAT( ) searches. The character expression can refer to a memo field of any size.

nOccurrence   Specifies which occurrence, starting from the right and moving left, of cSearchExpression RAT( ) searches for in cExpressionSearched. By default, RAT( ) searches for the last occurrence of cSearchExpression (nOccurrence = 1). If nOccurrence is 2, RAT( ) searches for the next to last occurrence, and so on.

 Remarks

RAT( ), the reverse of the AT( ) function, searches the character expression in cExpressionSearched starting from the right and moving left, looking for the last occurrence of the string specified in cSearchExpression.

RAT( ) returns an integer indicating the position of the first character in cSearchExpression in cExpressionSearched. RAT( ) returns 0 if cSearchExpression isn’t found in cExpressionSearched, or if nOccurrence is greater than the number of times cSearchExpression occurs in cExpressionSearched.

The search performed by RAT( ) is case-sensitive.


 RAT( ) Function Example

STORE 'abracadabra' TO string

STORE 'a' TO find_str

CLEAR

? RAT(find_str,string)  && Displays 11

? RAT(find_str,string,3)  && Displays 6


 See Also

AT( )
ATCLINE( )
ATLINE( )
LEFT( )
OCCURS( )
RATLINE( )
RIGHT( )
SUBSTR( )


RATC( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns the numeric position of the last occurrence of a character expression or memo field within another character expression or memo field.

 Syntax

RATC(cSearchExpression, cExpressionSearched [, nOccurrence])

 Returns

Numeric

 Arguments

cSearchExpression   Specifies the character expression that RATC( ) looks for in cExpressionSearched.

cExpressionSearched   Specifies the character expression that RATC( ) searches. The character expressions cSearchExpression and cExpressionSearched can be memo fields of any size.

nOccurrence   Specifies which occurrence, starting from the right and moving left, of cSearchExpression RATC( ) searches for in cExpressionSearched. By default, RATC( ) searches for the last occurrence of cSearchExpression (nOccurrence equals 1). If nOccurrence is 2, RATC( ) searches for the next to last occurrence and so on.

 Remarks

RATC( ) is designed for expressions containing double-byte characters. If the expression contains only single-byte characters, RATC( ) is equivalent to RAT( ).

RATC( ) returns the numeric position of the last occurrence of a character expression or memo field within another character expression or memo field. The character expressions or memo fields can contain any combination of single-byte and double-byte characters.

RATC( ) is the reverse of the AT_C( ) function: it searches from right to left.

RATC( ) returns an integer indicating the position of the first character in cSearchExpression in cExpressionSearched. RATC( ) returns 0 if cSearchExpression isn't found in cExpressionSearched, or if nOccurrence is greater than the number of times cSearchExpression occurs in cExpressionSearched.

The search performed by RATC( ) is case-sensitive.


 See Also

AT_C( )
LEFTC( )
RAT( )
RIGHTC( )
SUBSTRC( )


RATLINE( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the line number of the last occurrence of a character expression within another character expression or memo field, counting from the last line.

 Syntax

RATLINE(cSearchExpression, cExpressionSearched)

 Returns

Numeric

 Arguments

cSearchExpression   Specifies the character expression that RATLINE( ) looks for in cExpressionSearched.

cExpressionSearched   Specifies the character expression that RATLINE( ) searches. The character expressions cSearchExpression and cExpressionSearched can be memo fields of any size.

Use MLINE( ) to return the line containing cSearchExpression.

Tip   RATLINE( ) offers a convenient way to search memo fields.

 Remarks

RATLINE( ), the reverse of the ATLINE( ) function, searches a character expression cExpressionSearched, starting with the last character in cExpressionSearched, for the occurrence of cSearchExpression.

If the search is successful, RATLINE( ) returns the number of the line where the match occurs. If the search is unsuccessful, RATLINE( ) returns 0.

The search performed by RATLINE( ) is case-sensitive.

Caution   The line number that RATLINE( ) returns is determined by the value of SET MEMOWIDTH, even if cExpressionSearched isn’t a memo field. For more information, see SET MEMOWIDTH.


 RATLINE( ) Function Example

In the following example, RATLINE( ) returns the line number for the last line in the notes memo field containing the word “graduated.” MLINE( ) uses this value to return the contents of the line.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE employee  && Opens Employee table

STORE 'graduated' TO gcString

STORE MLINE(notes, RATLINE(gcString, notes)) TO gnFileLine

? gnFileLine


 See Also

AT( )
ATCLINE( )
ATLINE( )
LEFT( )
MLINE( )
OCCURS( )
RAT( )
RIGHT( )
SUBSTR( )


RD | RMDIR Command

Syntax         Arguments         Remarks         Example         See Also

Removes a directory or folder from disk.

 Syntax

RD cPath | RMDIR cPath

 Arguments

cPath   Specifies the name and location of the directory or folder to remove from disk.

 Remarks

Visual FoxPro generates an error message if you attempt to remove a directory or folder that is not empty.


 RD | RMDIR Command Example

The following example uses MKDIR to create a new directory named mytstdir, then CHDIR is used to change to the new directory. GETDIR( ) is used to display the directory structure, and then RMDIR is used to remove the newly created directory. GETDIR( ) is used to display the directory structure again.

SET DEFAULT TO HOME( )  && Restore Visual FoxPro directory

MKDIR mytstdir  && Create a new directory

CHDIR mytstdir  && Change to the new directory

= GETDIR( )  && Display the Select Directory dialog box

SET DEFAULT TO HOME( )  && Restore Visual FoxPro directory

RMDIR mytstdir  && Remove the new directory

= GETDIR( )  && Display the Select Directory dialog box


 See Also

CD | CHDIR
GETDIR( )
HOME( )
MD | MKDIR
SET DEFAULT
SET PATH
SYS(5) - Default Drive
SYS(2003) - Current directory
SYS(2004) - Visual FoxPro Start Directory


RDLEVEL( ) Function

Included for backward compatibility. Use the Form Designer instead of READ.


READ EVENTS Command

Syntax         Remarks         See Also

Starts event processing.

 Syntax

READ EVENTS

 Remarks

When READ EVENTS is issued, Visual FoxPro starts event processing.

Issue CLEAR EVENTS to stop event processing. When CLEAR EVENTS is issued, program execution continues with the line immediately following READ EVENTS.


 See Also

CLEAR Command
Form Designer


READ Command

Included for backward compatibility. Use the Form Designer instead.


READ MENU Command

Included for backward compatibility. Use the Menu Designer to create menus.


ReadActivate Event

Included for backward compatibility with READ. Use the Form Designer instead of READ.


ReadBackColor, ReadForeColor Properties

Included for backward compatibility with READ. Use the Form Designer instead of READ.


ReadCycle Property

Included for backward compatibility with READ. Use the Form Designer instead of READ.


ReadDeactivate Event

Included for backward compatibility with READ. Use the Form Designer instead of READ.


ReadExpression Method

Syntax         Arguments         Applies To         See Also

Returns the expression entered for a property value in the Properties window. Available at design time and run time.

Syntax

Object.ReadExpression(cPropertyName)

Arguments

cPropertyName   Specifies the name of the property to return the expression from.


Applies To

CheckBox, Column, ComboBox, CommandButton, CommandGroup, Custom, EditBox, Form, FormSet, Grid, Header, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, Page, PageFrame, Shape, Spinner, TextBox, Timer, ToolBar


See Also

WriteExpression Method


READKEY( ) Function

Included for backward compatibility with READ. Use the Form Designer instead of READ.


ReadLock Property

Included for backward compatibility with READ. Use the Form Designer instead of READ.


ReadMethod Method

Syntax         Arguments         Applies To         See Also

Returns the text of the specified method. Available at design time and run time.

Syntax

Control.ReadMethod(cMethod)

Arguments

cMethod   Specifies the name of a method.


Applies To

CheckBox, Column, ComboBox, CommandButton, CommandGroup, Custom, EditBox, Form, FormSet, Grid, Header, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, Page, PageFrame, Shape, Spinner, TextBox, Timer, ToolBar


See Also

ReadExpression Method
WriteExpression Method
WriteMethod Method


ReadMouse Property

Included for backward compatibility with READ. Use the Form Designer instead of READ.


ReadObject Property

Included for backward compatibility with READ. Use the Form Designer instead of READ.


ReadOnly Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether the user can edit a control, or specifies whether a table or view associated with a Cursor object allows updates. Available at design time; read-write at run time.

Syntax

[Form.]Control.ReadOnly[ = lExpr]

DataEnvironment.Cursor.ReadOnly[ = lExpr]

Settings

lExpr   The settings for the ReadOnly property are:

Setting	Description
True (.T.)	The user cannot edit the control. The table or view associated with the Cursor object cannot be modified.
False (.F.)	(Default) The user can edit the control. The table or view associated with the Cursor object can be modified.
Remarks

Note   When the Cursor is accessed using CURSORSETPROP( ), the ReadOnly property is read-only at run time.

The ReadOnly property differs from the Enabled property because when ReadOnly is set to true (.T.), the user can still move to the control.

For Cursors, ReadOnly mimics the NOUPDATE clause of USE.

For combo box controls, the ReadOnly property cannot be set to true (.T.) when the Style property is set to 2 - Drop-down List.


Applies To

Column, ComboBox, Cursor, EditBox, Grid, Spinner, TextBox


See Also

Enabled Property
USE


ReadSave Property

Included for backward compatibility with READ. Use the Form Designer instead of READ.


ReadShow Event

Included for backward compatibility with READ. Use the Form Designer instead of READ.


ReadTimeout Property

Included for backward compatibility with READ. Use the Form Designer instead of READ.


ReadValid Event

Included for backward compatibility with READ. Use the Form Designer instead of READ.


ReadWhen Event

Included for backward compatibility with READ. Use the Form Designer instead of READ.


RECALL Command

Syntax         Arguments         Remarks         Example         See Also

Unmarks records marked for deletion in the selected table.

Syntax

RECALL
[Scope] [FOR lExpression1] [WHILE lExpression2]
[NOOPTIMIZE]

Arguments

Scope   Specifies a range of records to recall. Only the records that fall within the range specified are recalled. The scope clauses are: ALL, NEXT nRecords, RECORD nRecordNumber, and REST.

The default scope for RECALL is the current record (NEXT 1).

FOR lExpression1   Specifies that only the records for which lExpression1 evaluates to true (.T.) are recalled. This option allows you to filter out undesired records.

Rushmore optimizes a RECALL FOR if lExpression1 is an optimizable expression. For best performance, use an optimizable expression in the FOR clause.

For more information, see SET OPTIMIZE, and “Understanding Rushmore Technology” in  Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

WHILE lExpression2   Specifies a condition whereby records are recalled for as long as lExpression2 evaluates to true (.T.).

NOOPTIMIZE   Prevents Rushmore optimization of RECALL

For more information, see SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

Remarks

You can use RECALL to recover records, provided you have not issued PACK or ZAP.

Caution   Once a file has been packed, all records marked for deletion are gone forever.

You can mark records for deletion by issuing DELETE or DELETE - SQL, or by choosing Delete Records from the Table menu when a Browse or Edit window is active. You can recall records by issuing RECALL, or by choosing Recall Records from the Record menu when a Browse or Edit window is active.


RECALL Command Example

The following example opens the customer table in the testdata database. DELETE - SQL is used to mark all records for deletion where the country field contains USA. All the records marked for deletion are displayed. RECALL ALL is used to unmark all the records marked for deletion.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

DELETE FROM customer WHERE country = 'USA'  && Mark for deletion

CLEAR

LIST FIELDS company, country FOR DELETED( ) && List marked records

RECALL ALL  && Unmark all records marked for deletion


See Also

DELETE
DELETE - SQL
PACK
SET DELETED
ZAP


RECCOUNT( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the number of records in the current or specified table.

Syntax

RECCOUNT([nWorkArea | cTableAlias])

Returns

Numeric

Arguments

nWorkArea   Specifies the work area number for a table open in another work area.

RECCOUNT( ) returns 0 if a table isn’t open in the work area you specify.

cTableAlias   Specifies the table alias for a table open in another work area.

Remarks

The value RECCOUNT( ) returns isn’t affected by SET DELETED and SET FILTER.

RECCOUNT( ) without the optional arguments nWorkArea or cTableAlias returns the number of records in the table in the currently selected work area.


RECCOUNT( ) Function Example

In the following example, Visual FoxPro compares the available disk space with the amount needed to sort customer.

*** Check DISKSPACE before a SORT ***

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

*** Get size of table header ***

gnTableHead = HEADER( )

*** Calculate size of table ***

gnFileSize = gnTableHead + (RECSIZE( ) * RECCOUNT( ) + 1)

IF DISKSPACE( ) > (gnFileSize * 3)

WAIT WINDOW 'Sufficient diskspace to sort.'

ELSE

WAIT WINDOW 'Insufficient diskspace. Sort cannot be done.'

ENDIF


See Also

RECNO( )
RECSIZE( )


RECNO( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the current record number in the current or specified table.

Syntax

RECNO([nWorkArea | cTableAlias])

Returns

Numeric

Arguments

nWorkArea   Specifies the work area number for a table open in another work area. RECNO( ) returns 0 if a table isn’t open in the work area you specify.

cTableAlias   Specifies the table alias for a table open in another work area.

Remarks

The current record is the record on which the record pointer is positioned.

RECNO( ) returns negative numbers for records appended in a table buffer.

RECNO( ) returns a value that is one greater than the number of records in the table if the record pointer is positioned beyond the last record in the table. RECNO( ) returns 1 if the record pointer is positioned before the first record in the table or the table has no records. If a table has no records, EOF( ) always returns true (.T.).

RECNO( ) issued without the optional arguments nWorkArea or cTableAlias returns the current record number for the table in the currently selected work area.

If you have issued SEEK unsuccessfully in an indexed table, you can specify 0 for nWorkArea to use “soft seek” logic to return the record number of the closest matching record. RECNO(0) returns 0 if a close match cannot be found. Visual FoxPro generates an error message if you issue GO RECNO(0) when a close match isn’t found.


RECNO( ) Function Example

The following example searches the customer table for a company name, and, if the company name isn't found, uses RECNO(0) to return the closest matching company.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

SET ORDER TO company

SEEK 'Ernst'

IF FOUND( )

DISPLAY company, contact

ELSE

GOTO RECNO(0)

CLEAR

? 'Closest matching company is ' + company

? 'Record number: ' + ALLTRIM(STR(RECNO( )))

ENDIF


See Also

GOGOTO
RECCOUNT( )
RECSIZE( )
SEEK
SKIP


RecordMark Property

Syntax         Settings         Applies To         See Also

Specifies whether the record selector column is displayed in a Grid control. Available at design time; read-write at run time.

Syntax

Grid.RecordMark[ = lExpr]

Settings

lExpr   The settings for the RecordMark property are:

Setting	Description
True (.T.)	(Default) The record selector column is displayed in a Grid.
False (.F.)	The record selector column is not displayed in a Grid.


Applies To

Grid


See Also

ScrollBars Property


RecordSource Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the source of data to which the Grid control is bound. Available at design time; read-write at run time.

Syntax

Grid.RecordSource[ = cName]

Settings

cName   cName is typically the alias name of a cursor or the name of a table. The RecordSource property specifies the main cursor that the grid is bound to.

Remarks

If you specify a record source for a grid, you can specify the contents of individual columns in the grid by setting their ControlSource property. If you do not set the ControlSource property for a column in the grid, the column displays the next available undisplayed field of the grid’s record source.


Applies To

Grid


See Also

ControlSource property
Order Property
RecordMark Property
RecordSourceType Property


RecordSourceType Property

Syntax         Settings         Applies To         See Also

Specifies how the data source that populates the Grid control is opened. Available at design time and read-write at run time.

Syntax

Grid.RecordSourceType[ = nType]

Settings

nType   The settings for the RecordSourceType property are:

Setting	Description
0	Table. Automatically opens the table specified in the RecordSource property setting.
1	(Default) Alias. Treats the record source as specified.
2	Prompt. The user is prompted for the record source at run time. If a database is open, the user can choose one of the tables it contains as a record source.
3	Query (.QPR). The RecordSource property setting specifies a .QPR file.
4	SQL Statement. The SQL statement is specified in the RecordSource property.


Applies To

Grid


See Also

RecordSource Property


RECSIZE( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the size (width) of a table record.

Syntax

RECSIZE([nWorkArea | cTableAlias])

Returns

Numeric

Arguments

nWorkArea   Specifies the work area number for a table open in another work area. RECSIZE( ) returns 0 if a table isn’t open in the work area you specify.

cTableAlias   Specifies the table alias for a table open in another work area.

Remarks

RECSIZE( ) issued without the optional arguments nWorkArea or cTableAlias returns the record size for the table in the currently selected work area.


RECSIZE( ) Function Example

In the following example, Visual FoxPro compares the available disk space with the amount needed to sort customer.

*** Check DISKSPACE before a SORT ***

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

*** Get size of table header ***

gnTableHead = HEADER( )

*** Calculate size of table ***

gnFileSize = gnTableHead + (RECSIZE( ) * RECCOUNT( ) + 1)

IF DISKSPACE( ) > (gnFileSize * 3)

WAIT WINDOW 'Sufficient diskspace to sort.'

ELSE

WAIT WINDOW 'Insufficient diskspace. Sort cannot be done.'

ENDIF


See Also

RECCOUNT( )
FSIZE( )


Refresh Method

Syntax         Remarks         Applies To         See Also

Repaints a form or control and refreshes any values.

Syntax

[Form.]Object.Refresh

Remarks

Generally, painting a form or control is handled automatically while no events are occurring. Use the Refresh method when you want to update the form or control immediately.

Use Refresh to force a complete repaint of a form or control, and to update the value of a control. The Refresh method is useful when you want a form to be displayed while another form is loading or when you want to update the contents of a control. To update the contents of a combo box or a list box, use the Requery method.

Note   When a form is refreshed, all controls on the form are also refreshed. When a page frame is refreshed, only the active page is refreshed.


Applies To

CheckBox, Column, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, EditBox, Form, FormSet, Grid, Header, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, Page, PageFrame, _SCREEN, Spinner, TextBox, ToolBar


See Also

Paint Event
Requery Method


REFRESH( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Refreshes data in an updatable SQL view.

Syntax

REFRESH([nRecords [, nRecordOffset]] [, cTableAlias | nWorkArea])

Returns

Numeric

Arguments

nRecords   Specifies the number of records to refresh. If nRecords is 1 or you omit nRecords, only the current record is refreshed. If nRecords is 0, no records are refreshed.

nRecordOffset   Specifies the number of records before the current record where the refresh begins. For example, if the current record is record 10 and nRecordOffset is  4, record refresh begins with record 6. If nRecordOffset is 0 or you omit nRecordOffset, the refresh begins with the current record.

cTableAlias   Specifies the alias of the remote SQL view in which records are refreshed.

nWorkArea   Specifies the work area of the table or cursor in which records are refreshed. If you omit nWorkArea and cTableAlias, records are refreshed in the remote SQL view in the currently selected work area.

Remarks

REFRESH( ) returns the number of records refreshed.

The records are refreshed with data from the tables from which the SQL view is created. Records are refreshed in the SQL view open in the currently selected work area.

REFRESH( ) cannot refresh locked or buffered records, and the records must have unique primary keys. If a record in a table does not have a primary key value, the corresponding record in the SQL view is marked for deletion.

Tip   Calling the REFRESH( ) function can result in a significant impact on performance, because the function reexecutes the query on which the view is based. Therefore, do not call this function more than necessary.


See Also

CREATE SQL VIEW
CURSORGETPROP( )
CURSORSETPROP( )


REGIONAL Command

Syntax         Arguments         Remarks         Example         See Also

Creates regional variables and arrays.

Syntax

#REGION nRegionNumber

REGIONAL VarList

Arguments

#REGION nRegionNumber   Creates a region. Regional variables must be declared before they are used in a program. Note that #REGION is a compiler directive, not a command. nRegionNumber specifies a region number 0 through 31.

REGIONAL VarList   Declares the variables for the region created with the #REGION directive. VarList is a list of variables and arrays separated by commas.

During program compilation, if another identically named regional variable has already been compiled when a regional declaration is encountered, the second occurrence of the variable name is made unique to ensure there is no conflict with the previously declared regional variable.

A variable’s name is made unique by padding the regional variable’s name out to 10 characters with underscores and the current region number. This substitution takes place entirely during program compilation and has no effect on execution speed.

When a variable name is modified, use DISPLAY MEMORY to display the modified variable name. To monitor the variable in the Debug window, use its modified variable name. Since the Trace window uses the original program source code, the original variable name (not the modified name created by the compiler) appears in the Trace window.

Remarks

Variables or arrays with identical names will not interfere with each other if their values are protected within a “region.” Regional variables are similar to private variables.


REGIONAL Command Example

In the following example, two sets of regional variables are created. In region 1, the variables gcA, gcB, gcC, and gcD are created, and the character string “One” is stored to each. In region 2, the variables gcC, gcD, gcE and gcF are created, and the character string “Two” is stored to each. The variables gcC and gcD are common to both regions.

The output from DISPLAY MEMORY is then shown. The names of variables gcC and gcD are modified in the second region. gcC becomes GCC________2, and gcD becomes GCD________2. All the variables are private and can be accessed by lower-level programs.

#REGION 1

REGIONAL gcA,gcB,gcC,gcD

STORE 'One' to gcA,gcB,cgC,gcD

#REGION 2

REGIONAL gcC,gcD,gcE,gcF	  && gcC and gcD are common to both regions

STORE 'Two' to gcC,gcD,gcE,gcF

DO showmemory

PROCEDURE showmemory

DISPLAY MEMORY LIKE g*


See Also

PRIVATE
PUBLIC
STORE


REINDEX Command

Syntax         Arguments         Remarks         Example         See Also

Rebuilds open index files.

Syntax

REINDEX [COMPACT]

Arguments

COMPACT   Converts regular single index (.IDX) files to compact .IDX files.

Remarks

Index files become outdated when you open a table without opening its corresponding index files and make changes to the index files’ key fields. When index files become outdated, you can update them by reindexing.

REINDEX updates all index files open in the selected work area. Visual FoxPro recognizes each index file type ( compound index (.CDX) files, structural .CDX files, and single index (.IDX) files) and reindexes accordingly. It updates all tags in .CDX files, and updates structural .CDX files, which automatically open with the table.

Any index files created with the UNIQUE keyword of the INDEX command or with SET UNIQUE ON retain their UNIQUE status when reindexed.

To REINDEX outdated index files, issue these commands:

USE TableName INDEX OutdatedIndexNames

REINDEX


REINDEX Command Example

In the following example, ISEXCLUSIVE( ) verifies that the customer table was opened for exclusive use. The table is not reindexed since the one in the current work are was not opened for exclusive use.

cExclusive = SET('EXCLUSIVE')

SET EXCLUSIVE OFF

SET PATH TO (SYS(2004) + 'SAMPLES\DATA\')

OPEN DATA testdata  && Opens the test databsase

USE Customer	  && Not opened exclusively

USE Employee IN 0 EXCLUSIVE	 && Opened exclusively in another work area

IF ISEXCLUSIVE( )

   REINDEX  && Can only be done if table opened exclusively

ELSE

    WAIT WINDOW 'The table has to be exclusively opened'

ENDIF

SET EXCLUSIVE &cExclusive


See Also

INDEX
SET INDEX
SET EXCLUSIVE
SET UNIQUE
SYS( ) Functions Overview
USE


Relation Object

Syntax         Remarks         Properties         Events         Methods         See Also

Created when you establish relationships from within the Data Environment Designer for a form, form set, or report.

Syntax

Relation

Remarks

The Relation object allows you to determine or specify how two tables are related.

Setting a Relation object property at run time generates an error. For a new property setting to take effect, you must call the CloseTables and OpenTables methods for the data environment.

For more information about the data environment for Forms and FormSets, see “Setting the Data Environment” in Chapter 9, “Creating Forms,” in the Developer’s Guide.

For more information about the data environment for reports, see Chapter 12, “Adding Queries and Reports,” in the Developer’s Guide.


Properties

ChildAlias	ChildOrder	Name
OneToMany	ParentAlias	RelationalExpr


Events

Destroy	Error	Init


Methods

ResetToDefault


See Also

Cursor Object
DataEnvironment Object


RELATION( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns a specified relational expression for a table open in a specific work area.

Syntax

RELATION(nRelationNumber [, nWorkArea | cTableAlias])

Returns

Character

Arguments

nRelationNumber   Specifies which relation is returned. For example, if nRelationNumber is 3, RELATION( ) returns the relational expression for the third relation created.

nWorkArea   Specifies the work area for a table open in another work area. If a table isn’t open in the work area you specify, RELATION( ) returns the empty string.

cTableAlias   Specifies the table alias for a table open in another work area.

Remarks

RELATION( ) by default returns relational expressions for the table in the currently selected work area. It returns the empty string if no relations exist. For additional information about creating relations between tables, see SET RELATION.

DISPLAY STATUS and LIST STATUS display relational expressions. Issue MODIFY DATABASE to display the Database Designer, allowing you to view and modify relations between tables in the current open database. Issue SET to display the Data Session window, allowing you to view and modify relations between free tables.


RELATION( ) Function Example

In the following example, tables are opened and orders set, then the relations are displayed using RELATION( ).

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer IN 0 ORDER cust_id  && Opens Customer table

USE employee IN 0 ORDER emp_id  && Opens Customer table

USE orders IN  0 ORDER order_id  && Opens Customer table

SELECT orders

SET RELATION TO emp_id INTO employee

SET RELATION TO cust_id INTO customer ADDITIVE

? RELATION(1)  && Displays CUST_ID

? RELATION(2)  && Displays EMP_ID

? RELATION(3)  && Displays empty string


See Also

DISPLAY STATUS
MODIFY DATABASE
LIST STATUS
SET
SET RELATION
SET RELATION OFF
TARGET( )


RelationalExpr Property

Syntax         Settings         Applies To         See Also

Specifies the expression based on fields in the parent table that relates to an index in the child table joining the two tables. For the Grid control, available at design time; read-write at run time. For the Relation object, available at design time; read-only at run time.

Syntax

Object.RelationalExpr[ = cExpr]

Settings

cExpr   Specifies any Visual FoxPro expression, typically one that matches the child table’s current index as specified by the ChildOrder property.


Applies To

Grid, Relation


See Also

ChildOrder Property
LinkMaster Property
SET RELATION


RelativeColumn Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the active column in the visible portion of a Grid control. Not available at design time and read-only at run time.

Syntax

Grid.RelativeColumn[ = nColumn]

Settings

nColumn   Specifies the active column in a Grid control.

Remarks

Use the RelativeColumn property to determine the relative position of the active column in a grid. For example, if you scroll through a grid so that the first column is no longer visible, but the active column is the first visible column in the grid, RelativeColumn is set to 1. To determine the absolute position of the active column in a grid, use the ActiveColumn property.


Applies To

Grid


See Also

ActiveColumn Property
ActiveRow Property
RelativeRow Property


RelativeRow Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the active row in the visible portion of a Grid control. Not available at design time; read-only at run time.

Syntax

Grid.RelativeRow[ = nRow]

Settings

nRow   Specifies the active row in a Grid control.

Remarks

Use the RelativeRow property to determine the relative position of the active row in a grid. For example, if you scroll through a grid so that the first row is no longer visible, but the active row is the first visible row in the grid, RelativeRow is set to 1. To determine the absolute position of the active row in a grid, use the ActiveRow property.


Applies To

Grid


See Also

ActiveColumn Property
ActiveRow Property
RelativeColumn Property


RELEASE Command

Syntax         Arguments         See Also

Removes variables and arrays from memory.

Syntax

RELEASE MemVarList
 – Or –

RELEASE ALL [EXTENDED]
[LIKE Skeleton | EXCEPT Skeleton]

Arguments

RELEASE MemVarList   Specifies the variables and arrays released from memory. Separate the variables and array names with commas.

RELEASE ALL   Releases from memory all variables and arrays.

EXTENDED   When issued in a program, specifies that all public variables are released. RELEASE ALL, RELEASE ALL LIKE, or RELEASE ALL EXCEPT do not release public variables when issued in a program.

LIKE Skeleton | EXCEPT Skeleton   Releases from memory all variables and arrays that match the specified skeleton, or all variables and arrays except those that match the specified skeleton. Skeleton can include the wildcards ? and *.


See Also

CLEAR MEMORY
DIMENSION
PRIVATE
PUBLIC
STORE


RELEASE BAR Command

Syntax         Arguments         See Also

Removes a specified menu item or all menu items on a menu from memory.

Syntax

RELEASE BAR nMenuItemNumber OF MenuName | ALL OF MenuName

Arguments

nMenuItemNumber OF MenuName   Specifies a menu item in a user-defined menu to remove from memory. To remove a menu item from a Visual FoxPro system menu, include the internal Visual FoxPro system menu item name in nMenuItemNumber. For more information, see System Menu Names.

ALL OF MenuName   Specifies that every menu item on a user-defined menu is removed from memory. ALL cannot be used to remove menu items from a Visual FoxPro system menu.


See Also

DEFINE BAR


RELEASE CLASSLIB Command

Syntax         Arguments         Remarks         Example         See Also

Closes .VCX visual class libraries containing class definitions.

Syntax

RELEASE CLASSLIB ClassLibraryName1 | ALIAS AliasName1
[, ClassLibraryName2 | ALIAS AliasName2 …]
[IN APPFileName | EXEFileName]

Arguments

ClassLibraryName1 | ALIAS AliasName1   Specifies the name or alias of a visual class library file to close.

ClassLibraryName2 | ALIAS AliasName2 …   Specifies the names or aliases of additional visual class library files to close.

IN APPFileName | EXEFileName   Specifies a Visual FoxPro application file (.APP) or executable file (.EXE) containing the visual class library.

Remarks

.VCX visual class libraries are opened with SET CLASSLIB. Once the library is open, the class definitions within the visual class library are available to programs and from the Command window.

To close all open visual class libraries, issue SET CLASSLIB TO without any additional arguments.


RELEASE CLASSLIB Command Example

The following example uses CREATE CLASSLIB to create a visual class library named myclslib. A class named myform based on the Visual FoxPro Form base class is created and is stored in the myclslib visual class library. SET CLASSLIB is used to open the myclslib visual class library so that classes within it can be used. RELEASE CLASSLIB is then used to close the myclslib visual class library.

CREATE CLASSLIB myclslib  	&& Creates a new .VCX visual class library

CREATE CLASS myform OF myclslib AS "Form"  && Creates new class

SET CLASSLIB TO myclslib ADDITIVE 	 && Opens MyClsLib.VCX

RELEASE CLASSLIB myclslib


See Also

ADD CLASS
CREATE CLASS
CREATE CLASSLIB
MODIFY CLASS
REMOVE CLASS
RENAME CLASS
SET CLASSLIB


RELEASE LIBRARY Command

Syntax         Arguments         Remarks         See Also

Removes a single external API library from memory.

Syntax

RELEASE LIBRARY LibraryName

Arguments

LibraryName   Specifies the name of the API library to remove from memory.

Remarks

Issue SET LIBRARY TO to remove all API libraries from memory. An external API routine library is loaded into memory with SET LIBRARY. For more information on API routine libraries, see SET LIBRARY.


See Also

SET LIBRARY


RELEASE MENUS Command

Syntax         Arguments         Remarks         See Also

Removes user-defined menu bars from memory.

Syntax

RELEASE MENUS [MenuBarNameList [EXTENDED]]

Arguments

MenuBarNameList   Specifies the menu bars to be released from memory. Separate the menu bar names with commas.

EXTENDED   Releases a menu bar and all its subordinate menus, menu titles, menu items, and all associated ON SELECTION BAR, ON SELECTION MENU, ON SELECTION PAD, and ON SELECTION POPUP commands.

Remarks

An active menu bar must first be deactivated with DEACTIVATE MENU before it can be released from memory.

If RELEASE MENUS is issued without any additional arguments, all user-defined menu bars are removed from memory.


See Also

DEFINE MENU


Release Method

Syntax         Remarks         Applies To         See Also

Releases a form or form set from memory.

Syntax

Object.Release

Remarks

The Release method is useful when a form or form set is created with the DO FORM command and there is no variable by which to reference the form or form set.

You can use the forms collection of the Screen object to find the form or form set and call its Release method.

The Release method mimics the behavior of the RELEASE command issued from within the form or form set.


Applies To

Form, FormSet, _SCREEN


See Also

DO FORM
RELEASE


RELEASE PAD Command

Syntax         Arguments         Example         See Also

Removes a specific menu title or all menu titles from memory.

Syntax

RELEASE PAD MenuTitleName OF MenuBarName | ALL OF MenuBarName

Arguments

MenuTitleName OF MenuBarName   Specifies the menu title to remove from memory.

You can remove a menu title from the Visual FoxPro system menu bar by specifying its name in MenuTitleName. For example, the command RELEASE PAD _MEDIT OF _MSYSMENU removes the Edit menu title from the Visual FoxPro system menu bar.

ALL OF MenuBarName   Specifies that every menu title in a user-defined menu bar is removed from memory. The ALL clause cannot be used to remove menu titles from the Visual FoxPro system menu bar.


RELEASE PAD Command Example

The following example removes the Window menu title from the system menu bar.

PUSH MENU _MSYSMENU

RELEASE PAD _MSM_WINDO OF _MSYSMENU  && Removes Window menu title

WAIT WINDOW 'Press a key to restore the default menu'

POP MENU _MSYSMENU  && Restore default Visual FoxPro menu system


See Also

DEFINE PAD
System Menu Names


RELEASE POPUPS Command

Syntax         Arguments         Remarks         See Also

Removes a specific menu or all menus from memory.

Syntax

RELEASE POPUPS [MenuNameList [EXTENDED]]

Arguments

MenuNameList   Specifies the menus to release from memory. Separate the menu names with commas.

Visual FoxPro system menus that appear under the Visual FoxPro system menu bar can also be released. To release a Visual FoxPro system menu, include the internal name of the system menu (_MFILE, _MEDIT, _MDATA, and so on). Use SET SYSMENU TO DEFAULT to restore the default system menu bar and system menus.

EXTENDED   Releases a menu, its items, and all commands associated with ON SELECTION POPUP and ON SELECTION BAR.

Remarks

An active menu must be deactivated with DEACTIVATE POPUP before it can be released from memory.

If RELEASE POPUPS is issued without any additional arguments, all user-defined menus are removed from memory.


See Also

DEFINE POPUP
System Menu Names


RELEASE PROCEDURE Command

Syntax         Arguments         Remarks         See Also

Closes procedure files opened with SET PROCEDURE.

Syntax

RELEASE PROCEDURE FileName1 [, FileName2 …]

Arguments

FileName1 [, FileName2 …]   Specifies the name of the procedure file or a set of procedure files to close.

Remarks

Procedure files are opened with SET PROCEDURE. Once the file is open, the procedures within the file are available to programs and from the Command window.

To close all open procedure files, issue SET PROCEDURE TO without any additional arguments.


See Also

SET PROCEDURE


RELEASE WINDOWS Command

Syntax         Arguments         See Also

Removes user-defined windows or Visual FoxPro system windows from memory.

Syntax

RELEASE WINDOWS [WindowNameList] |

Arguments

WindowNameList   Specifies the windows released from memory. WindowNameList can include both user-defined windows and Visual FoxPro system windows. Separate the window names with commas.

If WindowNameList isn’t included, the active user-defined window is released.

RELEASE WINDOWS can be used to remove Visual FoxPro system windows from the main Visual FoxPro window from or a parent, user-defined window.

The following list includes system windows that can be released from the main Visual FoxPro window or from a parent window.

•	Command

•	Debug

•	Trace

•	View

To release a system window and or a toolbar (in Visual FoxPro), enclose the entire system window or toolbar name in quotation marks. For example, to release the Report Controls toolbar in Visual FoxPro, issue the following command:

RELEASE WINDOW "Report Controls"

Use ACTIVATE WINDOW to place a system window in the main Visual FoxPro window or in a user-defined window.


See Also

ACTIVATE WINDOW
DEFINE WINDOW


ReleaseType Property

Syntax         Settings         See Also

Returns an integer that determines how a Form object is released. Not available at design time; read-only at run time.

Syntax

Object.ReleaseType

Settings

The settings for the ReleaseType property are:

Setting	Description
0	Variable released.
1	Close menu command or close box.
2	Exit Visual FoxPro.
Remarks

The ReleaseType property is set prior to the QueryUnload event being called.


Applies To

Form, _SCREEN


See Also

QueryUnload Event
Unload Event


REMOVE CLASS Command

Syntax         Arguments         See Also

Removes a class definition from a .VCX visual class library.

Syntax

REMOVE CLASS ClassName OF ClassLibraryName

Arguments

ClassName   Specifies the name of the class definition to remove from the visual class library.

OF ClassLibraryName   Specifies the name of the .VCX visual class library containing the class definition to remove. If no file extension is included in ClassLibraryName, a .VCX extension is assumed.

Remarks

Exercise care when removing class definitions — the class definition you remove may be a parent class on which other classes are based.


See Also

ADD CLASS
CREATE CLASS
CREATE CLASSLIB
MODIFY CLASS
RELEASE CLASSLIB
RENAME CLASS
SET CLASSLIB


REMOVE TABLE Command

Syntax         Arguments         Example         See Also

Removes a table from the current database.

Syntax

REMOVE TABLE TableName | ?
[DELETE] [RECYCLE]

Arguments

TableName   Specifies the table to remove from the current database.

?   Displays the Remove dialog box from which you can choose a table in the current database to remove.

DELETE   Specifies that the table is removed from the database and from disk.

Caution   Any table deleted from disk with this clause cannot be retrieved. Even if SET SAFETY is ON, you are not warned before the table is deleted from disk.

RECYCLE   Specifies that the table isn’t immediately deleted from disk and is placed in the Windows 95 Recycle Bin.

Remarks

When a table is removed from the database, it becomes a free table and can be added to another database. Tables are added to a database with ADD TABLE.

When REMOVE TABLE is issued, all primary indexes, default values, and validation rules associated with the table are also removed. If SET SAFETY is ON, Visual FoxPro displays a prompt asking if you are sure you want to remove the table from the database.

Important     REMOVE TABLE affects other tables in the current database if those tables have rules or relations associated with the table being removed. The rules and relations are no longer valid when the table is removed from the database.


REMOVE TABLE Command Example

The following example creates two databases named mydbc1 and mydbc2, and a table named table1. The table is added to mydbc1 when it is created. The table is then closed and removed from mydbc1. ADD TABLE is then used to add the table to mydbc2. RENAME TABLE is used to change the name of the table from table1 to table2.

CREATE DATABASE mydbc1

CREATE DATABASE mydbc2

SET DATABASE TO mydbc1

CREATE TABLE table1 (cField1 C(10), n N(10))  && Adds table to mydbc1

CLOSE TABLES	  && A table must be closed to remove it from a database

REMOVE TABLE table1

SET DATABASE TO mydbc2

ADD TABLE table1

RENAME TABLE table1 TO table2


See Also

ADD TABLE
CLOSE DATABASES
CREATE DATABASE
FREE TABLE
OPEN DATABASE


RemoveItem Method

Syntax         Arguments         See Also

Removes an item from a combo box or list box.

Syntax

Control.RemoveItem(nIndex)

Arguments

nIndex   Specifies an integer corresponding to the order in which items are displayed in the control. For the first item in a list box or combo box, nIndex = 1.


Applies To

ComboBox, ListBox


See Also

AddItem Method
Clear Method
RemoveListItem Method


RemoveListItem Method

Syntax         Arguments         See Also

Removes an item from a combo box or list box.

Syntax

Control.RemoveListItem(nItemId)

Arguments

nItemId   Specifies an integer representing the unique ID of the item in the control.


Applies To

ComboBox, ListBox


See Also

AddItem Method
Clear Method


RemoveObject Method

Syntax         Arguments         See Also

Removes a specified object from a container object at run time.

Syntax

Object.RemoveObject(cObjectName)

Arguments

cObjectName   Specifies the name of an object to remove. If the object does not exist, an error occurs.

Remarks

When an object is removed, it disappears from the screen and can no longer be referenced.


Applies To

Column, CommandGroup, Container Object, Custom, DataEnvironment, Form, FormSet, Grid, OptionGroup, Page, PageFrame, _SCREEN, ToolBar


See Also

AddObject Method
RemoveItem Method
RemoveListItem Method


RENAME Command

Syntax         Arguments         See Also

Changes the name of a file to a new name.

Syntax

RENAME FileName1 TO FileName2

Arguments

FileName1 TO FileName2   Specifies the file name to change and the new file name. Include a file extension for each file. If the file extensions are not included, the default extension .DBF is assumed. If you rename a free table that has an associated .FPT memo file, be sure to rename the memo file. Include a period (.) after the file name to rename a file that doesn’t have an extension.

Do not use RENAME to change the name of a table in a database; RENAME does not change the name of the table in the database. Use RENAME TABLE to change the name of a table in a database.

Include paths with either or both file names if the files are not on the default path. If FileName1 and FileName2 are in different directories or folders, FileName1 is moved into the directory or folder of FileName2.

When you issue RENAME, FileName2 cannot already exist and FileName1 must exist and cannot be open.

FileName1 and FileName2 can contain wildcard characters such as * and ?. For example, to rename all program files with the extension .PRG in the current directory or folder to backup files with extension .BAK, issue RENAME *.PRG TO *.BAK.


See Also

COPY FILE
COPY TO
RENAME CLASS
RENAME TABLE


RENAME CLASS Command

Syntax         Arguments         Example         See Also

Renames a class definition contained in a .VCX visual class library.

Syntax

RENAME CLASS ClassName1 OF ClassLibraryName TO ClassName2

Arguments

ClassName1   Specifies the name of the class definition that is renamed.

OF ClassLibraryName   Specifies the name of the .VCX visual class library containing the class definition to rename. If you don’t specify a file extension in ClassLibraryName, Visual FoxPro automatically assigns a .VCX extension.

TO ClassName2   Specifies the new name of the class definition.

Remarks

Visual FoxPro does not update other class definitions within the visual class library that reference the renamed class definition — be careful when renaming class definitions.


RENAME CLASS Command Example

The following example uses CREATE CLASSLIB to create a visual class library named myclslib. A class named myform based on the Visual FoxPro Form base class is created with CREATE CLASS and is stored in the myclslib visual class library. RENAME CLASS is used to change the class name from myform to yourform.

CREATE CLASSLIB myclslib  	&& Creates a new .VCX visual class library

CREATE CLASS myform OF myclslib AS "Form"  && Creates new class

RENAME CLASS myform OF myclslib TO yourform  && Change class name


See Also

ADD CLASS
CREATE CLASS
MODIFY CLASS
RELEASE CLASSLIB
REMOVE CLASS
SET CLASSLIB


RENAME CONNECTION Command

Syntax         Arguments         Example         See Also

Renames a named connection in the current database.

Syntax

RENAME CONNECTION ConnectionName1 TO ConnectionName2

Arguments

ConnectionName1   Specifies the name of the connection to be renamed.

ConnectionName2   Specifies the new name of the connection.

Remarks

The database containing the named connection must be opened exclusively and must be current before the connection can be renamed. To open a database for exclusive use, include EXCLUSIVE in OPEN DATABASE.


RENAME CONNECTION Command Example

The following example assumes an ODBC data source called MyFoxSQLNT is available, and the user ID for the data source is “sa.” The testdata database is opened, and a connection named Myconn1 is created. DISPLAY CONNECTIONS is used to display the named connections in the database.

RENAME CONNECTION is then used to change the newly created connection name to Myconn2. DISPLAY CONNECTIONS is used again to display the connection with its new name. The newly renamed connection is then removed from the database with DELETE CONNECTION.

CLOSE DATABASES

OPEN DATABASE (SYS(2004) + 'samples\data\testdata')

CREATE CONNECTION Myconn1 DATASOURCE "MyFoxSQLNT" USERID "sa"

CLEAR

DISPLAY CONNECTIONS  && Displays named connections in the database

RENAME CONNECTION Myconn1 TO Myconn2

DISPLAY CONNECTIONS  && Displays connection with new name

DELETE CONNECTION Myconn2  && Removes the connection just renamed


See Also

DELETE CONNECTION
DBGETPROP( )
DISPLAY CONNECTIONS
LIST CONNECTIONS
MODIFY CONNECTION
OPEN DATABASE


RENAME TABLE Command

Syntax         Arguments         Remarks         Example         See Also

Renames a table in the current database.

Syntax

RENAME TABLE TableName1 TO TableName2

Arguments

TableName1   Specifies the name of the table to be renamed.

TableName2   Specifies the new name of the table.

Remarks

You cannot use RENAME TABLE to change the name of a free table; use RENAME instead.


RENAME TABLE Command Example

The following example creates two databases named mydbc1 and mydbc2, and a table named table1. The table is added to mydbc1 when it is created. The table is then closed and removed from mydbc1. ADD TABLE is then used to add the table to mydbc2. RENAME TABLE is used to change the name of the table from table1 to table2.

CLOSE DATABASES

CREATE DATABASE mydbc1

CREATE DATABASE mydbc2

SET DATABASE TO mydbc1

CREATE TABLE table1 (cField1 C(10), n N(10))  && Adds table to mydbc1

CLOSE TABLES	  && A table must be closed to remove it from a database

REMOVE TABLE table1

SET DATABASE TO mydbc2

ADD TABLE table1

RENAME TABLE table1 TO table2


See Also

ADD TABLE
CLOSE DATABASES
CREATE DATABASE
COPY FILE
COPY TO
OPEN DATABASE
RENAME


RENAME VIEW Command

Syntax         Arguments         Remarks         Example         See Also

Renames a SQL view in the current database.

Syntax

RENAME VIEW ViewName1 TO ViewName2

Arguments

ViewName1   Specifies the name of the SQL view to be renamed.

ViewName2   Specifies the new name of the SQL view.

Remarks

The database containing the SQL view must be opened exclusively and must be current before the SQL view can be renamed. To open a database for exclusive use, include EXCLUSIVE in OPEN DATABASE.


RENAME VIEW Command Example

The following example opens the testdata database. CREATE SQL VIEW is used to create a local SQL view named myview which is created from a SELECT - SQL statement that selects all records from the customer table. RENAME VIEW is used to change the name of the view from myview to yourview.

The View Designer is displayed, allowing modify the newly renamed SQL view. After the View Designer is closed, the SQL view is erased.

CLOSE DATABASES

OPEN DATABASE (SYS(2004) + 'samples\data\testdata')

CREATE SQL VIEW myview AS SELECT * FROM customer  && Create the view

RENAME VIEW myview TO yourview  && Change the view name

MODIFY VIEW yourview  && Open the View designer

DELETE VIEW yourview  && Delete the view


See Also

CREATE SQL VIEW
DELETE VIEW
DISPLAY VIEWS
LIST VIEWS
MODIFY VIEW
OPEN DATABASE
RENAME VIEW
SELECT - SQL
USE


REPLACE Command

Syntax         Arguments         Remarks         Example         See Also

Updates table records.

Syntax

REPLACE FieldName1 WITH eExpression1 [ADDITIVE]
[, FieldName2 WITH eExpression2 [ADDITIVE]] ...
[Scope] [FOR lExpression1] [WHILE lExpression2]
[IN nWorkArea | cTableAlias]
[NOOPTIMIZE]

Arguments

FieldName1 WITH eExpression1 [, FieldName2 WITH eExpression2 ... ]   Specifies that the data in FieldName1 be replaced with the value of the expression eExpression1; that the data in FieldName2 be replaced with the value of the expression eExpression2; and so on.

When the expression value is longer than the width of a numeric field, REPLACE forces the value to fit by carrying out the following steps:

1.	First, REPLACE truncates decimal places and rounds the remaining decimal portion of the field.

2.	If the value still doesn’t fit, REPLACE stores the field contents using scientific notation.

3.	If the value still doesn’t fit, REPLACE replaces the field contents with asterisks.

ADDITIVE   Appends to the end of the memo fields replacements to memo fields. ADDITIVE applies to replacements in memo fields only. If you omit ADDITIVE, the memo field is overwritten with the value of the expression.

Scope   Specifies a range of records to replace. Only the records that fall within the range are replaced. The scope clauses are: ALL, NEXT nRecords, RECORD nRecordNumber, and REST.

The default scope for REPLACE is the current record (NEXT 1).

FOR lExpression1   Specifies that the designated fields be replaced only in records for which lExpression1 evaluates to true (.T.). Including FOR lets you conditionally replace records, filtering out those you don’t want replaced.

Rushmore optimizes REPLACE FOR if lExpression1 is an optimizable expression. For best performance, use an optimizable expression in the FOR clause.

For more information, see SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

WHILE lExpression2   Specifies a condition whereby fields are replaced for as long as the logical expression lExpression2 evaluates to true (.T.).

IN nWorkArea   Specifies the work area of the table in which records are updated.

IN cTableAlias   Specifies the alias of the table in which records are updated.

If you omit nWorkArea and cTableAlias, records are updated in the table in the currently selected work area.

NOOPTIMIZE   Prevents Rushmore optimization.

For more information, see SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

Remarks

REPLACE replaces data in a field with the value in an expression. Fields in unselected work areas must be prefaced with their alias.

Note   If the IN clause is omitted, no replacement occurs if the record pointer is at the end of the file in the current work area and you specify a field in another work area.


REPLACE Command Example

The following example creates a table with 10 records. REPLACE is used to place random values into a field. MIN( ) and MAX( ) displays the maximum and minimum values in the table.

CLOSE DATABASES

CREATE TABLE Random (cValue N(3))

FOR nItem = 1 TO 10  && Append 10 records,

APPEND BLANK

REPLACE cValue WITH 1 + 100 * RAND( )  && Insert random values

ENDFOR

CLEAR

LIST  && Display the values

gnMaximum = 1  && Initialize minimum value

gnMinimum = 100  && Initialize maximum value

SCAN

gnMinimum = MIN(gnMinimum, cValue)

gnMaximum = MAX(gnMaximum, cValue)

ENDSCAN

? 'The minimum value is: ', gnMinimum  && Display minimum value

? 'The maximum value is: ', gnMaximum  && Display maximum value


See Also

GATHER
INSERT - SQL
SCATTER


REPLACE FROM ARRAY Command

Syntax         Arguments         Remarks         See Also

Updates data in fields with values from a variable array.

Syntax

REPLACE FROM ARRAY ArrayName
[FIELDS FieldList]
[Scope]
[FOR lExpression1]
[WHILE lExpression2]
[NOOPTIMIZE]

Arguments

ArrayName   Specifies the name of the array whose values replace the field data.

FIELDS FieldList   Specifies that only the fields in FieldList be replaced by the contents of the array. Fields in unselected work areas must be prefaced with their table alias.

Scope   Specifies a range of records to replace with the contents of the array. Only the records that fall within the range are replaced. Replacement occurs until the end of the scope or the end of the array is reached.

The scope clauses are: ALL, NEXT nRecords, RECORD nRecordNumber, and REST.

The default scope for REPLACE FROM ARRAY is the current record (NEXT 1).

FOR lExpression1   Specifies that fields be replaced only in records for which lExpression1 evaluates to true (.T.). Including FOR lets you conditionally replace records, filtering out those you don’t want. Replacement occurs in each record for which lExpression1 is true (.T.), or until the end of the array is reached.

Rushmore optimizes REPLACE FROM ARRAY FOR if lExpression1 is an optimizable expression. For best performance, use an optimizable expression in the FOR clause.

For more information, see  SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

WHILE lExpression2   Specifies a condition whereby fields in records are replaced by the contents of the array for as long as the logical expression lExpression2 evaluates to true (.T.).

NOOPTIMIZE   Prevents Rushmore optimization.

For more information, see  SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

Remarks

Memo and general fields are ignored in REPLACE FROM ARRAY. To import data into these fields, use GATHER and APPEND GENERAL.

Starting with the first element, the elements of the array replace the corresponding fields of the record. The first array element replaces the first field of the record, the second array element replaces the second field, and so on.

If the array has fewer elements than the table has fields, the additional fields are ignored. If the array has more elements than the table has fields, the additional array elements are ignored.

Note   No replacement occurs if the record pointer is at the end of the file in the current work area and you specify a field in another work area.


See Also

APPEND FROM ARRAY
APPEND GENERAL
COPY TO ARRAY
GATHER
REPLACE
SCATTER
SET OPTIMIZE


REPLICATE( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns a character string that contains a specified character expression repeated a specified number of times.

Syntax

REPLICATE(cExpression, nTimes)

Returns

Character

Arguments

cExpression   Specifies the character expression that is replicated.

nTimes   Specifies the number of times the character expression is replicated.

Remarks

In Visual FoxPro, the maximum length of the resulting character string is restricted by the amount of available memory.


REPLICATE( ) Function Example

CLEAR

? REPLICATE('HELLO ',4) && Displays HELLO HELLO HELLO HELLO


See Also

SPACE( )


REPORT Command

Syntax         Arguments         Remarks         See Also

Displays or prints a report under the control of a report definition file created with MODIFY REPORT or CREATE REPORT.

Syntax

REPORT FORM FileName1 | ?
[ENVIRONMENT]
[Scope] [FOR lExpression1] [WHILE lExpression2]
[HEADING cHeadingText]
[NOCONSOLE]
[NOOPTIMIZE]
[PLAIN]
[RANGE nStartPage [, nEndPage]]
[PREVIEW [WINDOW WindowName]
[NOWAIT]]
[TO PRINTER [PROMPT] | TO FILE FileName2 [ASCII]]
[NAME ObjectName]
[SUMMARY]

Arguments

FileName1   Specifies the name of the report definition file to print.

?   Displays the Open dialog box, from which you can choose a report file.

ENVIRONMENT   Included for backward compatibility with 2.x reports. To restore the data environment associated with a Visual FoxPro report, set the data environment AutoOpenTables property to true (.T.), which is the default. To make sure that the report environment is closed when the report is finished printing, set the data environment AutoCloseTables property to true (.T.), which is also the default.

For reports converted from earlier versions of FoxPro, including ENVIRONMENT opens and restores all the tables and relations in the Data Environment even if AutoOpenTables is set to false (.F.).

When you create or modify reports, you can save the current Visual FoxPro data environment with the report definition file. Saving the Visual FoxPro data environment places additional records in the report definition table for all open tables and index files, the index order, and any relationships between the tables.

Scope   Specifies a range of records to include in the report. Only the records that fall within the range are included in the report.

The scope clauses are: ALL, NEXT nRecords, RECORD nRecordNumber, and REST. For more information on scope clauses, see Scope Clauses.

The default scope for REPORT is ALL records.

FOR lExpression1   Prints data only in those records for which lExpression1 evaluates to true (.T.). Including FOR lets you filter out the records you don’t want to print.

Rushmore optimizes REPORT FOR if lExpression1 is an optimizable expression. For best performance, use an optimizable expression in the FOR clause.

For more information, see  SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

WHILE lExpression2   Specifies a condition whereby data is printed for as long as the logical expression lExpression2 evaluates to true (.T.).

HEADING cHeadingText   Specifies text for an additional heading to be placed on each page of the report. The PLAIN clause takes precedence if you include both HEADING and PLAIN.

NOCONSOLE   Suppresses the echoing of a report to the main Visual FoxPro window or to a user-defined window when the report is being printed or sent to a file.

NOOPTIMIZE   To prevent Rushmore optimization of REPORT, include NOOPTIMIZE.

For more information, see SET OPTIMIZE and”Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

PLAIN   Specifies that a page heading appears only at the beginning of the report.

RANGE nStartPage [, nEndPage]   Specifies a range of pages to print. nStartPage specifies the first page printed; nEndPage specifies the last page printed. If nEndPage is omitted, the last page printed defaults to 9,999.

PREVIEW [WINDOW WindowName]   Displays the report in page preview mode instead of sending the report to the printer. To print a report, you must issue REPORT with TO PRINTER.

System variables are ignored when you include PREVIEW.

You can include the optional WINDOW clause to specify a window in which the report is previewed. WindowName can be the name of a window created with DEFINE WINDOW or a form.

You can include the optional NOWAIT clause so that at run time Visual FoxPro does not wait for the page preview window to be closed before continuing program execution. Instead, Visual FoxPro continues program execution while the page preview window is open.

In a distributed application, be sure that the View menu is available. If the Print Preview toolbar is closed, it cannot be restored unless the View menu is available.

TO PRINTER [PROMPT]   Sends a report to the printer.

In Visual FoxPro, you can include the optional PROMPT clause to display a printer settings dialog box before printing starts. The printer settings that you can adjust depend on the currently installed printer driver. Place PROMPT immediately after TO PRINTER.

TO FILE FileName2 [ASCII]   Specifies the text file to which you send a report. The current printer driver is used when the report is sent to the text file. The file created when you include TO FILE has the default extension .TXT.

You can include the optional ASCII clause to create an ASCII text file from the report definition file. Without the ASCII clause, PostScript and other printer codes are written to the text file. Any graphics, lines, rectangles, or rounded rectangles in the report definition do not appear in the ASCII text file.

The number of columns and rows on each page in the ASCII text file is determined by the contents of the _ASCIICOLS and _ASCIIROWS system variables. The default values for _ASCIICOLS and _ASCIIROWS are 80 columns and 63 rows respectively. These values correspond to a standard portrait page.

NAME ObjectName   Specifies an object variable name for the data environment of a report. The data environment and the objects in the data environment have properties and methods, for example AddObject, that need to be set or called at run time. The object variable provides access to these properties and methods. If you don’t specify a NAME, Visual FoxPro uses as a default the name of the report file that can be referenced in the code associated with the events.

SUMMARY   Suppresses detail line printing. Only totals and subtotals are printed.

Remarks

The default extension for a report definition file is .FRX. If the report definition file is not in the default directory or folder, the path must also be included with the file name.


See Also

_ASCIICOLS
_ASCIIROWS
CREATE REPORT
DataEnvironment Object
MODIFY REPORT


Requery Method

Syntax         Remarks         Applies To         See Also

Requeries the row source to which the ListBox or ComboBox control is bound.

Syntax

Control.Requery

Remarks

Use the Requery method to ensure a control contains the most recent data. The Requery method requeries the RowSource property and updates the list with the new values.


Applies To

ComboBox, ListBox


See Also

RowSource Property


REQUERY( ) Function

Syntax         Arguments         Returns         Remarks         See Also

Retrieves data again for a SQL view.

Syntax

REQUERY([nWorkArea | cTableAlias])

Arguments

nWorkArea   Specifies the work area in which the SQL view is open.

cTableAlias   Specifies the alias of the SQL view. If you omit nWorkArea and cTableAlias, the data for the SQL view open in the currently selected work area is retrieved.

Returns

Numeric

Remarks

REQUERY( ) returns 1 if the data is successfully retrieved; otherwise, it returns 0.

REQUERY( ) is typically used to refresh a SQL view when data has changed on the data source.


See Also

CREATE SQL VIEW
SELECT - SQL
USE


RequestData Method

Syntax         Returns         Settings         Remarks         Example         Applies To          See Also

Creates an array containing data from a table open in an instance of Visual FoxPro.

Syntax

RequestData([nWorkArea | cTableAlias] [, nRecords])

Returns

Array

Settings

nWorkArea   Specifies the work area number of the table from which data is stored in the array. If you omit cTableAlias and nWorkArea, data from the table open in the current work area is stored in the array.

cTableAlias   Specifies the alias of the table from which data is stored in the array.

nRecords   Specifies the number of records stored in the array, starting from the current record. If nRecords is omitted and sufficient memory is available, all records, starting from the current record, are stored in the array.

Remarks

Use the RequestData method to retrieve data from an instance of Visual FoxPro.


Example

The following example, run from within Visual FoxPro, creates a second instance of Visual FoxPro. The Customer table is opened in the second instance of Visual FoxPro.

An array containing data from the Customer table is created in the first instance of Visual FoxPro, and the contents of the array is displayed. The array contains data from the first 5 records in the Customer table. The second instance of Visual FoxPro is then closed.

oNewInstance = CREATEOBJECT('VisualFoxPro.Application')

oNewInstance.DoCmd('USE C:\VFP\SAMPLES\DATA\Customer')

aCustomerArray = oNewInstance.RequestData('Customer',5)

DISPLAY MEMORY LIKE aCustomerArray

oNewInstance.DoCmd('QUIT')


Applies To

Application Object, _VFP System Variable


See Also

DataToClip Method


Reset Method

Syntax         Applies To         See Also

Resets the Timer control so that it starts counting from 0.

Syntax

Timer.Reset


Applies To

Timer


See Also

Interval Property
Timer Event


ResetToDefault Method

Syntax         Settings         Remarks         Applies To         See Also

Restores a property, event, or method to its Visual FoxPro default setting. Available at run time and design time.

Syntax

[Form.]Object.ResetToDefault(cPropertyName
| cEventName | cMethodName)

Settings

cPropertyName   Specifies the name of the property to reset to the Visual FoxPro default setting.

cEventName   Specifies the name of the event to reset. All user-defined code in the event is deleted.

cMethodName   Specifies the name of the method to reset. All user-defined code in the method is deleted.

Remarks

ResetToDefault returns a property to the setting it had when first created. For example, if you have changed the font of a command button, calling this method for the caption resets the font to its default (Arial).

ResetToDefault removes all user-defined code from an event or method at design time.


Applies To

CheckBox, Column, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, Cursor, Custom, DataEnvironment, EditBox, Form, FormSet, Grid, Header, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, Page, PageFrame, Relation, _SCREEN, Shape, Spinner, TextBox, Timer, ToolBar


See Also

GETPEM( ) Function


Resizable Property

Syntax         Settings         Applies To         See Also

Specifies whether a Column object can be sized at run time by the user. Available at design time; read-write at run time.

Syntax

Column.Resizable[ = lExpr]

Settings

lExpr   The settings for the Resizable property are:

Setting	Description
True (.T.)	The Column object is sizable.
False (.F.)	(Default) The Column object cannot be sized by the user.


Applies To

Column


See Also

Width Property


Resize Event

Syntax         Parameters         Remarks         Applies To         See Also

Occurs when an object is resized.

Syntax

PROCEDURE Object.Resize
[LPARAMETERS nIndex]

Parameters

nIndex   Uniquely identifies a control if it is in a control array.

Remarks

Resize can be triggered interactively. Resize can be triggered in code by setting the Height and the Width properties. For a Column, Resize can be triggered in code by setting the Column’s Width property.


Applies To

Column, Container Object, Control Object, Form, Grid, OLE Bound Control, OLE Container Control, PageFrame, ToolBar


See Also

Height Property
Paint Event
Width Property


RESTORE FROM Command

Syntax         Arguments         Remarks         Example         See Also

Retrieves variables and variable arrays saved in a variable file or a memo field and places them into memory.

Syntax

RESTORE FROM FileName | MEMO MemoFieldName
[ADDITIVE]

Arguments

FileName   Specifies the variable file from which the variables and arrays are restored. Variable files are assigned a .MEM extension.

MEMO MemoFieldName   Specifies the memo field from which variables and arrays are restored.

ADDITIVE   Prevents any variables or arrays currently in memory from being erased. If the number of variables or arrays being added with ADDITIVE plus the number of existing variables exceeds the variable limit, Visual FoxPro brings as many variables and arrays as possible into memory from the variable file or memo field.

If you restore a variable or array that has the same name as an existing variable or array, the value in the existing variable or array is overwritten with the value of the restored variable or array.

Remarks

When RESTORE FROM is issued in a program, all PUBLIC and PRIVATE variables and arrays are restored as PRIVATE; all LOCAL variables and arrays are restored as LOCAL. If RESTORE is issued in the Command window, PUBLIC and PRIVATE variables and arrays are restored as PUBLIC; LOCAL variables and arrays are restored as LOCAL.

RESTORE FROM clears any variables or arrays currently in memory unless you include the ADDITIVE keyword. RESTORE FROM does not affect system variables.

Note that object type variables cannot be restored from a variable file or memo field.


RESTORE FROM Command Example

In the following example, two variables are created. They are saved to a variable file and restored without clearing the existing variables.

gnVal1 = 50

gcVal2 = 'Hello'

SAVE TO temp

CLEAR MEMORY

gdVal3 = DATE( )

RESTORE FROM temp ADDITIVE

CLEAR

DISPLAY MEMORY LIKE g*


See Also

DIMENSION
PUBLIC
PRIVATE
RELEASE
SAVE TO
STORE


RESTORE MACROS Command

Syntax         Arguments         Remarks         See Also

Restores to memory keyboard macros saved in a keyboard macro file or memo field.

Syntax

RESTORE MACROS
[FROM FileName | FROM MEMO MemoFieldName]

Arguments

FROM FileName   Specifies the macro file from which macros are restored. Macro files have an .FKY extension, and this extension is assumed if you don’t specify one. If you have assigned a different extension to the file, you must include this extension in FileName.

FROM MEMO MemoFieldName   Specifies the memo field from which macros are restored.

Remarks

Use SAVE MACRO to store keyboard macros to a keyboard macro file or a memo field.

By default, restoring macros from a file or memo field is additive — the restored macros are appended to the existing set of macros in memory. If a macro name in the file or memo field is the same as an existing macro name, the macro in the file or memo field overwrites the existing macro.

If issued without a file name or memo field name, RESTORE MACROS clears all macros from memory and restores the default macros. The default macros are restored from the keyboard macro file named DEFAULT.FKY. If DEFAULT.FKY cannot be found, Visual FoxPro restores the F2 through F9 keys to the standard Visual FoxPro startup settings.


See Also

CLEAR
PLAY MACRO
SAVE MACROS


RESTORE SCREEN Command

Syntax         Arguments         Remarks         See Also

Restores the main Visual FoxPro window or a user-defined window previously saved to the screen buffer, a variable, or an array element.

Syntax

RESTORE SCREEN
[FROM VarName]

Arguments

FROM VarName   Specifies the name of a variable or array element from which you want to restore the screen or window image.

Remarks

Use SAVE SCREEN to place the current main Visual FoxPro window or active user-defined window in the screen buffer, a variable, or an array element.

Variables or array elements containing stored screen or window images have an S data type when you view the variables or array elements with DISPLAY or LIST MEMORY. The main Visual FoxPro window or user-defined windows saved to variables or array elements can also be saved to and restored from variable files with SAVE TO and RESTORE FROM.

If issued without the FROM clause, RESTORE SCREEN restores the main Visual FoxPro window or user-defined window from the screen buffer.


See Also

RESTORE FROM
SAVE SCREEN
SAVE TO


RESTORE WINDOW Command

Syntax         Arguments         Remarks         Example         See Also

Restores to memory window definitions and window statuses saved to a window file or memo field.

Syntax

RESTORE WINDOW WindowNameList | ALL
FROM FileName | FROM MEMO MemoFieldName

Arguments

WindowNameList   Specifies one or more windows to be restored. Separate the window names with commas.

ALL   Restores all window definitions in the window file or memo field.

FROM FileName   Specifies the window file from which windows are restored. A window file has a .WIN extension. If the file was given another extension when it was saved, you must include this extension in FileName.

FROM MEMO MemoFieldName   Specifies the memo field from which the windows are restored.

Remarks

Use SAVE WINDOW to store window definitions in a window file or in a memo field.

Any windows in memory with the same names as those restored are overwritten. A window’s status (hidden, active, and so on) when it is saved is preserved when it is restored.


RESTORE WINDOW Command Example

In the following example, a window named wOutput1 is defined and saved to a variable. All windows are cleared and the window named wOutput1 is restored and activated.

CLEAR

DEFINE WINDOW wOutput1 FROM 2,1 TO 13,75 TITLE 'Output' ;

CLOSE FLOAT GROW SHADOW ZOOM

SAVE WINDOW wOutput1 TO temp

CLEAR WINDOWS

RESTORE WINDOW wOutput1 FROM temp

ACTIVATE WINDOW wOutput1

WAIT "The window wOutput1 has been restored" WINDOW

RELEASE WINDOW wOutput1


See Also

ACTIVATE WINDOW
DEFINE WINDOW
SAVE WINDOWS


RESUME Command

Syntax         Remarks         See Also

Continues execution of a suspended program.

Syntax

RESUME

Remarks

Use SUSPEND to suspend program execution. The suspended program restarts at the line where execution was suspended.

SUSPEND and RESUME are valuable debugging tools. You can suspend a program to examine the current status of the Visual FoxPro environment, including memory variables, window, menu bar, or menu definitions.

Important     To prevent commands that are executed when a program is suspended from interfering with subsequent program output, issue CLEAR to clear the main Visual FoxPro window or the active user-defined window before you resume program execution.


See Also

CANCEL
CLEAR
RETURN
SUSPEND


RETRY Command

Syntax         Remarks         See Also

Re-executes the previous command.

Syntax

RETRY

Remarks

RETRY returns control to the calling program and re-executes the last line executed in the program. RETRY is similar to RETURN, except RETURN executes the next line in the calling program.

RETRY is useful in error-handling routines. It is frequently used to re-execute a command until a record- or file-locking function succeeds in locking the record or file. You can use SET REPROCESS to control retries of a record- or file-locking function. SET REPROCESS is preferable in most network situations.


See Also

ON ERROR
RETURN
SET REPROCESS


RETURN Command

Syntax         Arguments         Remarks         Example         See Also

Returns program control to a calling program.

Syntax

RETURN [eExpression | TO MASTER | TO ProcedureName]

Arguments

eExpression   Specifies an expression returned to the calling program. If you omit RETURN or the return expression, true (.T.) is automatically returned to the calling program.

TO MASTER   Returns control to the highest-level calling program.

TO ProcedureName   Specifies the procedure to which control is returned.

Remarks

RETURN terminates execution of a program, procedure, or function and returns control to the calling program, the highest-level calling program, another program, or the Command window.

Visual FoxPro releases PRIVATE variables when RETURN is executed.

RETURN is usually placed at the end of a program, procedure, or function to return control to a higher-level program. However, an implicit RETURN is executed if you omit RETURN.


RETURN Command Example

In the following example, the function longdate returns a character string that is suitable for printing from a date.

SET CENTURY ON

? longdate({02/16/95})  && Displays Thursday, February 16, 1995

FUNCTION longdate

PARAMETER mdate

RETURN CDOW(mdate) + ', ' + MDY(mdate)


See Also

DO
FUNCTION
LPARAMETERS
PARAMETERS
PARAMETERS( )
PRIVATE
PROCEDURE
PUBLIC


RGB( ) Function

Syntax         Arguments         Remarks         Example         See Also

Returns a single color value from a set of red, green, and blue color components.

Syntax

RGB(nRedValue, nGreenValue, nBlueValue)

Arguments

nRedValue   Specifies the intensity of the red color component. nRedValue can range from 0 to 255. 0 is the minimum color intensity; 255 is the maximum color intensity.

nGreenValue   Specifies the intensity of the green color component. nGreenValue can range from 0 to 255.

nBlueValue   Specifies the intensity of the blue color component. nBlueValue can range from 0 to 255.

Remarks

The value returned by RGB( ) can be used to set color properties such as BackColor and ForeColor.


RGB( ) Function Example

The following example uses RGB( ) to change the background color of a Form to blue.

goMyForm = CREATEOBJECT('FORM')  && Create a form

goMyForm.Show  && Display the form

WAIT WINDOW 'Press a key to change the form color'

goMyForm.BackColor=RGB(0,0,255)  && Change the form background color

WAIT WINDOW 'Press a key to release the form'

RELEASE goMyForm  && Release the form from memory


See Also

GETCOLOR( )
RGBSCHEME( )


RGBSCHEME( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns an RGB color pair or an RGB color pair list from a specified color scheme.

Syntax

RGBSCHEME(nColorSchemeNumber [, nColorPairPosition])

Returns

Character

Arguments

nColorSchemeNumber   Specifies the number of the color scheme for which you want a complete RGB color listing. RGBSCHEME( ) returns 10 RGB color pairs.

nColorPairPosition   Returns a single RGB color pair from a color scheme. nColorPairPosition specifies the position of the RGB color pair in the color scheme. For example, if nColorPairPosition is 4, the fourth RGB color pair is returned.

Remarks

Use SCHEME( ) to return a traditional color pair or a color pair list from a color scheme. RGB color pairs use numeric values to specify colors. Traditional color pairs use letters to specify colors.


RGBSCHEME( ) Function Example

The following displays the third RGB color pair from color scheme number 4.

CLEAR

? RGBSCHEME(4,3)


See Also

Colors Overview
RGB( )
SCHEME( )


RIGHT( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the specified number of rightmost characters from a character string.

Syntax

RIGHT(cExpression, nCharacters)

Returns

Character

Arguments

cExpression   Specifies the character expression whose rightmost characters are returned.

nCharacters   Specifies the number of characters returned from the character expression. RIGHT( ) returns the entire character expression if nCharacters is greater than the length of cExpression. RIGHT( ) returns an empty string if nCharacters is negative or 0.

Remarks

Characters are returned beginning with the last character on the right and continuing for a specified number of characters.


RIGHT( ) Function Example

CLEAR

? RIGHT('Redmond, WA', 2)  && Displays WA


See Also

AT( )
LEFT( )
LTRIM( )
RAT( )
RTRIM( )
SUBSTR( )
TRIM( )


RIGHTC( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns the specified number of rightmost characters from a character string.

Syntax

RIGHTC(cExpression, nCharacters)

Returns

Character

Arguments

cExpression   Specifies the character expression whose rightmost characters are returned.

nCharacters   Specifies the number of characters returned from the character expression. RIGHTC( ) returns the entire character expression if nCharacters is greater than the length of cExpression. RIGHTC( ) returns an empty string if nCharacters is negative or 0.

Remarks

RIGHTC( ) is designed for expressions containing double-byte characters. If the expression contains only single-byte characters, RIGHTC( ) is equivalent to RIGHT( ).

Characters are returned beginning with the last character on the right and continuing for nCharacters.


See Also

AT_C( )
LEFTC( )
RATC( )
RIGHTC( )
SUBSTRC( )


RightClick Event

Syntax         Applies To         See Also

Occurs when the user clicks the right (secondary) mouse button over a control in Windows.

Syntax

PROCEDURE Control.RightClick
[LPARAMETERS nIndex]

Parameters

nIndex   Uniquely identifies a control if it is in a control array.


Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, Container, Control, EditBox, Form, Grid, Header, Image, Label, Line, ListBox, OptionButton, OptionGroup, Page, PageFrame, Shape, Spinner, TextBox, ToolBar


See Also

Click Event
DblClick Event
DragDrop Event
DragOver Event
DropDown Event
Enabled Property
KeyPress Event
MouseDown Event
MouseMove Event
MouseUp Event
Scrolled Event
Undock Event


RightToLeft Property

Syntax         Settings       Remarks         Applies To         See Also

Ignored unless you are running a Middle Eastern version of Windows. Specifies the reading order of text in controls and the display of streaming output on forms. Available at design time; read-write at run time.

Syntax

Object.RightToLeft[ = lExpression]

Settings

lExpression   The settings for the RightToLeft property are:

Setting	Description
True (.T.)	(Default) Text is entered and displayed in controls in a right to left reading order. Streaming output (for example, text displayed with ? or ??) is displayed on forms in a right to left reading order.
False (.F.)	Text is entered and displayed in controls in a left to right reading order. Streaming output is displayed on forms in a left to right reading order.
Remarks

Use the Alignment property to specify the orientation of text in check boxes and option buttons.


Applies To

CheckBox, ComboBox, CommandButton, EditBox, Form, Grid, Label, ListBox, OptionButton, PageFrame, _SCREEN, Spinner, TextBox


See Also

Alignment Property


RLOCK( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Attempts to lock a table record or records.

Syntax

RLOCK([nWorkArea | cTableAlias]
| [cRecordNumberList, nWorkArea | cTableAlias])

Returns

Logical

Arguments

nWorkArea | cTableAlias   Specifies the work area number or table alias for a table open in another work area. If you don’t specify a work area or alias, RLOCK( ) attempts to lock the current record in the table in the currently selected work area.

cRecordNumberList   Specifies that RLOCK( ) attempts to lock multiple records. The character expression cRecordNumberList specifies one or more record numbers, separated by commas, that RLOCK( ) attempts to lock. For example, to attempt record locks on the first four records in a table, cRecordNumberList should contain 1, 2, 3, 4.

To lock multiple records, you must have SET MULTILOCKS on and you must include the work area number (nWorkArea) or alias (cTableAlias) of the table in which you attempt to lock multiple records.

You can also lock multiple records by moving the record pointer to the record you would like to lock, issuing RLOCK( ) or LOCK( ) and then repeating this process for additional records.

In Visual FoxPro, you can specify 0 as a record number. Specifying 0 lets you attempt to lock the table header.

Important     Keep the table header locked for as short a time as possible because other users cannot add records to the table when the table header is locked.

Release the table header lock with UNLOCK RECORD 0, UNLOCK, or UNLOCK ALL.

If all the records specified in cRecordNumberList are successfully locked, RLOCK( ) returns true (.T.). If one or more of the records specified in cRecordNumberList cannot be locked, RLOCK( ) returns false (.F.) and locks none of the records. In either case, existing record locks remain in place. Multiple record locking is an additive process — placing additional record locks doesn’t release existing record locks.

From a performance perspective, it is always faster to lock the entire table than to lock even a small number of records.

Remarks

RLOCK( ) is identical to LOCK( ).

If the lock or locks are successfully placed, RLOCK( ) returns true (.T.). Locked records are available for both read and write access by the user who placed the locks and for read-only access to all other users on the network.

Executing RLOCK( ) doesn’t guarantee that the attempted record lock or locks are successfully placed. A record lock cannot be placed on a record already locked by another user or in a table locked by another user. If the record lock or locks cannot be placed for any reason, RLOCK( ) returns false (.F.).

By default, RLOCK( ) makes one attempt to lock a record. Use SET REPROCESS to automatically retry a record lock when the first attempt fails. SET REPROCESS controls the number of lock attempts or the length of time lock attempts are made when the initial lock attempt is unsuccessful. For more information about SET REPROCESS and table locking, see SET REPROCESS.

SET MULTILOCKS determines whether you can lock multiple records in a table. If SET MULTILOCKS is off (the default), you can lock only a single record in a table. If SET MULTILOCKS is on, you can lock multiple records in a table. For more information, see SET MULTILOCKS.

A table record can be unlocked only by the user who placed the lock. Record locks can be released by issuing UNLOCK, closing the table, or exiting Visual FoxPro.

UNLOCK can be used to release record locks in the current work area, a specific work area or in all work areas. For more information, see UNLOCK.

Switching SET MULTILOCKS from ON to OFF or from OFF to ON implicitly performs UNLOCK ALL. All record locks in all work areas are released.

To close tables, use USE, CLEAR ALL, or CLOSE DATABASES.

For more information about record and file locking and sharing tables on a network, see Chapter 17, “Programming for Shared Access,” in the Developer’s Guide.


RLOCK( ) Function Example

The following example locks and unlocks the first four records in the customer and employee tables.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

SET REPROCESS TO 3 AUTOMATIC

STORE '1,2,3,4' TO gcRecList

gcOldExc = SET('EXCLUSIVE')

SET EXCLUSIVE OFF

SELECT 0

USE employee  && Open Employee table

SELECT 0

USE customer  && Open Customer table

? LOCK('1,2,3,4', 'customer')  && Lock 1st 4 records in customer

? RLOCK(gcRecList, 'employee')  && Lock 1st 4 records in employee

UNLOCK IN customer

UNLOCK IN employee

SET EXCLUSIVE &gcOldExc


See Also

CLEAR
CLOSE
FLOCK( )
LOCK( )
SET MULTILOCKS
SET RELATION
SET REPROCESS
UNLOCK
USE


_RMARGIN System Memory Variable
_RMARGIN System Variable

Included for backward compatibility. Use the Report Designer instead.


ROLLBACK Command

Syntax         Remarks         Example         See Also

Cancels any changes made during the current transaction.

Syntax

ROLLBACK

Remarks

ROLLBACK restores the original tables, table memo files, and index files to the state they were in before the transaction began.

When you modify records in a database that is part of a transaction, other users on the network do not have access (read or write) to the records until you end the transaction.

When other users on the network try to access records you have modified, they must wait until you end your transaction. They receive the message “Record not available ... please wait” until the records become available. Because of this, it is important to keep the length of the transaction to a minimum or conduct the transaction during times when others do not need access.

ROLLBACK undoes any changes made during the current transaction. If the transaction is nested, only the modifications made since the previous BEGIN TRANSACTION are undone. Program execution continues with the next statement.

If any record or file locks were placed, they are released.


ROLLBACK Command Example

In the following example, the customer table in the testdata database is opened. BEGIN TRANSACTION is issued to start a transaction. The contents of the cust_id and company fields are displayed, and then the contents of the company field is replaced. The new contents are displayed, and ROLLBACK is issued to restore the original contents of the company field. The cust_id and company fields are displayed again with the company field containing its original values.

CLOSE DATABASES

CLEAR

* Transactions are only supported within a DBC

OPEN DATABASE SYS(2004)+"samples\data\testdata"

BEGIN TRANSACTION

USE customer

LIST FIELDS cust_id, company NEXT 20

WAIT WINDOW "Press a key to change the company field"

REPLACE ALL company WITH "***"   && Change field contents

GO TOP

CLEAR

LIST FIELDS cust_id, company NEXT 20

WAIT WINDOW "Press a key to restore the company field"

ROLLBACK                             && Restore original field contents

CLEAR

GO TOP

LIST FIELDS cust_id, company NEXT 20

WAIT WINDOW "Press a key to exit"


See Also

BEGIN TRANSACTION
END TRANSACTION
TXNLEVEL( )


ROUND( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns a numeric expression rounded to a specified number of decimal places.

Syntax

ROUND(nExpression, nDecimalPlaces)

Returns

Numeric

Arguments

nExpression   Specifies the numeric expression whose value is to be rounded.

nDecimalPlaces   Specifies the number of decimal places nExpression is rounded to.

If nDecimalPlaces is negative, ROUND( ) returns a whole number containing zeros equal in number to nDecimalPlaces to the left of the decimal point. For example, if nDecimalPlaces is –2, the first and second digits to the left of the decimal point in the value are 0.

Remarks

The value ROUND( ) returns has the same number of decimal places as nDecimalPlaces. ROUND( ) ignores the number of decimal places specified by SET DECIMALS.


ROUND( ) Function Example

SET DECIMALS TO 4

SET FIXED ON	  && Fix decimal display

CLEAR

? ROUND(1234.1962, 3)   && Displays 1234.1960

? ROUND(1234.1962, 2)   && Displays 1234.2000

? ROUND(1234.1962, 0)   && Displays 1234.0000

? ROUND(1234.1962, -1)  && Displays 1230.0000

? ROUND(1234.1962, -2)  && Displays 1200.0000

? ROUND(1234.1962, -3)  && Displays 1000.0000

SET FIXED OFF  && Restore start up defaults

SET DECIMALS TO 2


See Also

INT( )
SET DECIMALS


ROW( ) Function

Included for backward compatibility. Use the CurrentY property.


RowHeight Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the height of the rows in a Grid control. Available at design time; read-write at run time.

Syntax

Grid.RowHeight[ = nHeight]

Settings

nHeight   Specifies the height of all the rows in a Grid control.

Remarks

If RowHeight is set to  – 1 (Auto), it automatically resizes the rows to fit the current FontSize property setting.


Applies To

Grid


See Also

FontSize Property


RowSource Property

Syntax         Settings         Remarks         Example         Applies To         See Also

Specifies the source of the values in a ComboBox or ListBox control. Available at design time and run time.

Syntax

Control.RowSource[ = cName]

Settings

cName   Specifies the source of the values.

Remarks

The source of the values can be a comma-delimited list of values, a table, an SQL statement that creates a cursor or a table, a query, an array, a comma-delimited list of fields (which may be prefaced by a period and the table alias), a file skeleton (such as *.DBF or *.TXT), a table’s field names, or a menu. Use the RowSourceType property to set the type of row source.

You can use RowSource to specify multiple columns for a ComboBox or ListBox control at design time. To specify multiple columns, set RowSourceType to 1 (Value) and specify the RowSource values (separated by a comma) as follows:

Col1Row1,Col2Row1,Col1Row2,Col2Row2,,Col2Row3

To specify an alias for the table containing the columns, use the following syntax:

Alias.Col1Row1,Col2Row1,Col1Row2,Col2Row2,,Col2Row3

The values you specify fill the control, by row, up to the number of columns that are specified by the ColumnCount property. The preceding example assumes that ColumnCount is set to 2. As shown in the preceding example, there will be no value in column 1, row 3 because there are two successive commas with no value entered between them preceding column 2, row 3.


RowSource Property Example

The following example creates a list box. The source of the items that appear in the list box items is an array; the name of the array is specified with the RowSource property. The RowSourceType property is set to 5 (array) to specify that an array is the source for the items in the list box.

The MultiSelect property for the list box is set to true (.T.), allowing you to make multiple selections from the list box. The item or items you choose in the list box are displayed by using the ListCount, Selected and List properties to determine the number of items in the list box and the items you chose.

CLEAR

DIMENSION gaMyListArray(10)

FOR gnCount = 1 to 10  && Fill the array with letters

STORE REPLICATE(CHR(gnCount+64),6) TO gaMyListArray(gnCount)

NEXT

frmMyForm = CREATEOBJECT('Form')  && Create a Form

frmMyForm.Closable = .f.  && Disable the Control menu box

frmMyForm.Move(150,10)  && Move the form

frmMyForm.AddObject('cmbCommand1','cmdMyCmdBtn')  && Add "Quit" Command button

frmMyForm.AddObject('lstListBox1','lstMyListBox')  && Add ListBox control

frmMyForm.lstListBox1.RowSourceType = 5  && Specifies an array

frmMyForm.lstListBox1.RowSource = 'gaMyListArray' && Array containing listbox items

frmMyForm.cmbCommand1.Visible =.T.  && "Quit" Command button visible

frmMyForm.lstListBox1.Visible =.T.  && "List Box visible

frmMyForm.SHOW  && Display the form

READ EVENTS  && Start event processing

DEFINE CLASS cmdMyCmdBtn AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 210  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close Form

CLEAR  && Clear main Visual FoxPro window

ENDDEFINE

DEFINE CLASS lstMyListBox AS ListBox  && Create ListBox control

Left = 10  && List Box column

Top = 10  && List Box row

MultiSelect = .T.  && Allow selecting more than 1 item

PROCEDURE Click

ACTIVATE SCREEN

CLEAR

? "Selected items:"

? "---------------"

FOR nCnt = 1 TO ThisForm.lstListBox1.ListCount

IF ThisForm.lstListBox1.Selected(nCnt)  && Is item selected?

? SPACE(5) + ThisForm.lstListBox1.List(nCnt) && Show item

ENDIF

ENDFOR

ENDDEFINE


Applies To

ComboBox, ListBox


See Also

ColumnCount Property
RecordSource Property
RowSourceType Property


RowSourceType Property

Syntax         Settings         Example         Applies To         See Also

Specifies the type of source for the values in a control. Available at design time and run time.

Syntax

Control.RowSourceType[ = nSource]

Settings

nSource   The settings for the RowSourceType property are:

Setting	Description
0	(Default) None. When the default value is used, fill the list at run time using the AddItem or AddListItem method.
1	Value. Populated by a comma-delimited list.
2	Alias. Use the ColumnCount property to select fields in the table.
3	SQL Statement. A SQL SELECT command that creates a cursor or a table.
4	Query (.QPR). Specify a file name with a .QPR extension.
5	Array. Set the columns property to display multiple dimensions.
6	Fields. A comma delimited list of fields. The fields may be prefaced by the table alias and a period.
7	Files. List is populated from the current directory or folder. Specify  file skeleton (such as *.DBF or *.TXT) or mask in the RowSource property.
8	Structure. Fields from the table specified in RowSource.
9	Popup. Included for backward compatibility.
For more information about using each of the RowSourceType settings, see “Using List Boxes and Drop-Down List Boxes” in Chapter 10, “Using Controls,” in the Developer's Guide.


RowSourceType Property Example

The following example creates a list box. The source of the items that appear in the list box items is an array; the name of the array is specified with the RowSource property. The RowSourceType property is set to 5 (array) to specify that an array is the source for the items in the list box.

The MultiSelect property for the list box is set to true (.T.), allowing you to make multiple selections from the list box. The item or items you choose in the list box are displayed by using the ListCount, Selected and List properties to determine the number of items in the list box and the items you chose.

CLEAR

DIMENSION gaMyListArray(10)

FOR gnCount = 1 to 10  && Fill the array with letters

STORE REPLICATE(CHR(gnCount+64),6) TO gaMyListArray(gnCount)

NEXT

frmMyForm = CREATEOBJECT('Form')  && Create a Form

frmMyForm.Closable = .f.  && Disable the Control menu box

frmMyForm.Move(150,10)  && Move the form

frmMyForm.AddObject('cmbCommand1','cmdMyCmdBtn')  && Add "Quit" Command button

frmMyForm.AddObject('lstListBox1','lstMyListBox')  && Add ListBox control

frmMyForm.lstListBox1.RowSourceType = 5  && Specifies an array

frmMyForm.lstListBox1.RowSource = 'gaMyListArray' && Array containing listbox items

frmMyForm.cmbCommand1.Visible =.T.  && "Quit" Command button visible

frmMyForm.lstListBox1.Visible =.T.  && "List Box visible

frmMyForm.SHOW  && Display the form

READ EVENTS  && Start event processing

DEFINE CLASS cmdMyCmdBtn AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 210  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close Form

CLEAR  && Clear main Visual FoxPro window

ENDDEFINE

DEFINE CLASS lstMyListBox AS ListBox  && Create ListBox control

Left = 10  && List Box column

Top = 10  && List Box row

MultiSelect = .T.  && Allow selecting more than 1 item

PROCEDURE Click

ACTIVATE SCREEN

CLEAR

? "Selected items:"

? "---------------"

FOR nCnt = 1 TO ThisForm.lstListBox1.ListCount

IF ThisForm.lstListBox1.Selected(nCnt)  && Is item selected?

? SPACE(5) + ThisForm.lstListBox1.List(nCnt) && Show item

ENDIF

ENDFOR

ENDDEFINE


Applies To

ComboBox, ListBox


See Also

RowSource Property


RTOD( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Converts radians to degrees.

Syntax

RTOD(nExpression)

Returns

Numeric

Arguments

nExpression   Specifies the numeric expression representing radians that RTOD( ) converts to degrees.

Remarks

RTOD( ) converts the value (in radians) of a numeric expression to an equivalent value in degrees.

RTOD( ) is useful for working with the Visual FoxPro trigonometric functions COS( ), SIN( ), and TAN( ).

Use DTOR( ) to convert degrees to radians.


RTOD( ) Function Example

CLEAR

? RTOD(ACOS(0))  && Displays 90.00

STORE -1 to gnArcAngle

? RTOD(ACOS(gnArcAngle))  && Displays 180.00

? RTOD(ACOS(SQRT(2)/2))   && Displays 45.00


See Also

COS( )
DTOR( )
SIN( )
TAN( )


RTRIM( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns a character string that results from removing the trailing blanks from a character expression.

Syntax

RTRIM(cExpression)

Returns

Character

Arguments

cExpression   Specifies the character expression from which trailing blanks are trimmed.

Remarks

RTRIM( ) can be used to ensure that blanks are removed from data entered by a user. RTRIM( ) is identical to TRIM( ).


RTRIM( ) Function Example

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

CLEAR

? 'The contact for '+ RTRIM(company) + ' is ' + contact


See Also

ALLTRIM( )
LTRIM( )
TRIM( )


RUN | ! Command

Syntax         Arguments         Remarks         See Also

Executes external operating commands or programs.

Syntax

RUN [/N [K]] MS-DOSCommand | ProgramName
 – Or –
! [/N [K]] MS-DOSCommand | ProgramName

Arguments

MS-DOSCommand   Specifies the MS-DOS command to execute. See your MS-DOS documentation for more information about available MS-DOS commands.

ProgramName   Specifies the program or application to run.ou can specify a Windows-based or an MS-DOS-based program or application.

/N [K]   Specifies NOWAIT. Include the letter N (do not replace N with a numeric value and do not include K) to execute another Windows-based application.

Remarks

You can issue RUN from within the Command window or from within a program.

Important     To use RUN, you must have the operating system file COMMAND.COM in the current directory, or it must be located where the MS-DOS COMSPEC parameter can find it. For more information on COMSPEC, see your MS-DOS documentation.

Caution   Do not use RUN to run disk reorganization programs such as CHKDSK from within Visual FoxPro. These programs modify the contents of your disk in a manner that may prevent Visual FoxPro from operating properly.

RUN and Visual FoxPro   When RUN is used to run programs outside of Visual FoxPro, it searches for programs in a slightly different manner from FoxPro for MS-DOS.

If the program you specify in RUN doesn’t have an extension, Visual FoxPro first look along the MS-DOS path for a Program Information File (PIF) with the name you specify. A PIF lets you run a non-Windows program under Windows. You can specify parameters for the program, whether the program is run in a window or on the full screen, the amount of memory allocated for the program, and so on.

If the PIF is found, the program specified in the PIF is executed with the PIF parameters. If a PIF isn’t found, the MS-DOS path is then searched for an executable file with the name you specify.

When a PIF isn’t found, Visual FoxPro uses FOXRUN.PIF, a PIF installed in the Visual FoxPro directory. FOXRUN.PIF is configured to run the program in a window. You can modify FOXRUN.PIF to run programs in another configuration.

FOXRUN.PIF   FOXRUN.PIF allows you to execute MS-DOS and Windows programs and commands from within Visual FoxPro. FOXRUN.PIF must be in the same directory as VFP.EXE in Visual FoxPro.

/N means NOWAIT. Include the letter N (do not replace N with a numeric value and do not include K) to execute another Windows-based application. For example, the following statement opens the Windows Character Map accessory:

! /N CHARMAP.EXE

The following example opens the Windows color picker from the Windows Control Panel:

! /N CONTROL COLOR

A Windows-based application executed with RUN /N or ! /N behaves the same way the application does when you open it through the Program Manager or the File Manager. You can switch between the application and Visual FoxPro or FoxPro for Windows using the standard Windows operations.

You can include an optional numeric value immediately after /N to specify how the Windows-based application is opened. Do not include any spaces between /N and the numeric value. The following table lists the numeric value you can include and describes the state of the Windows-based application when opened.

Value	Application attributes
1	Active and normal size
2	Active and minimized
3	Active and maximized
4	Inactive and normal size
7	Inactive and minimized
Running MS-DOS Programs in Visual FoxPro   By default, FOXRUN.PIF runs the specified external MS-DOS program in a window. While the MS-DOS program or command is running, the title of the window is FoxPro Run Command. In Visual FoxPro, the FoxPro Run Command window is closed after the external program or command is finished executing.

You can use the Windows PIF editor to customize FOXRUN.PIF. You can edit the PIF to specify if the Inactive FoxPro Run Command window is left open  or is closed (the default in Visual FoxPro) with the Close Window on Exit check box. You can also open external programs in a full screen by selecting Full Screen; allocate memory for the program; and so on.

Memory Considerations   By default, FOXRUN.PIF allocates a minimum of 256K of memory for running an external command or program. If you do not have 256K of free conventional memory, Visual FoxPro displays an error message. To correct this, try one or both of the following:

•	Close applications and files to free up additional memory.

•	Edit FOXRUN.PIF to reduce the amount of memory required in the KB Required text box.

If the external command requires more than 256K, MS-DOS displays an error message in the FoxPro Run Command window. To correct this, edit your FOXRUN.PIF to increase the amount of memory required in the KB Required text box.


See Also

GETENV( ), _SHELL


SAVE MACROS Command

Syntax         Arguments         Remarks         Example         See Also

Saves a set of keyboard macros to a keyboard macro file or to a memo field.

Syntax

SAVE MACROS TO FileName | TO MEMO MemoFieldName

Arguments

TO FileName   Specifies the file to which the macros are saved. Keyboard macro file names can contain a maximum of eight characters and must begin with a letter or an underscore;  they cannot begin with a number. The subsequent characters can be any combination of letters, numbers, and underscores. The file is assigned an .FKY extension. If you assign an extension other than .FKY, you must include that extension in RESTORE MACROS.

TO MEMO MemoFieldName   Specifies the memo field to which the macros are saved. The table containing the memo field must be open; however, it does not have to be in the selected work area. To save macros to a table in another work area, include the table’s alias when specifying the memo field.

Remarks

When you quit Visual FoxPro, the macros you have created are lost unless you use SAVE MACROS to store them to a keyboard macro file or to a memo field.


SAVE MACROS Command Example

The following example saves the current set of macros to a file called MYMACROS.FKY.

SAVE MACROS TO mymacros


See Also

CLEAR
PLAY MACRO
RESTORE MACROS


SAVE SCREEN Command

Syntax         Arguments         Remarks         See Also

Saves an image of the main Visual FoxPro window or an active user-defined window to the screen buffer, a variable, or an array element.

Syntax

SAVE SCREEN [TO VarName]

Arguments

TO VarName   Specifies the variable or array element to which the screen or window image is saved.

Remarks

Use RESTORE SCREEN to redisplay images saved to the screen buffer, a variable, or an array element.

Variables or array elements containing an image of the main Visual FoxPro window or user-defined window have an S data type when you view the variables or array elements with DISPLAY or LIST MEMORY.

If issued without the TO VarName clause, SAVE SCREEN saves the main Visual FoxPro window or user-defined window to the screen buffer.


See Also

RESTORE FROM
RESTORE SCREEN
SAVE TO


SAVE TO Command

Syntax         Arguments         Remarks         Example         See Also

Stores current variables and arrays to a variable file or memo field.

Syntax

SAVE TO FileName | MEMO MemoFieldName
[ALL LIKE Skeleton | ALL EXCEPT Skeleton]

Arguments

FileName   Specifies the variable file in which the variables and arrays are saved. The default extension for a variable file is .MEM.

MEMO MemoFieldName   Specifies the memo field in which the variables and arrays are saved.

ALL LIKE Skeleton   Specifies that all variables and arrays which match the specified Skeleton be saved. The skeleton can include the question mark (?) and asterisk (*) wildcards.

ALL EXCEPT Skeleton   Specifies that all variables and arrays except those that match the specified Skeleton be saved. The skeleton can include the question mark (?) and asterisk (*) wildcards.

Remarks

Use RESTORE FROM to place variables and arrays back into memory from a variable file or memo field. Note that object type variables cannot be saved to a variable file or memo field.

The variable file or memo field is marked with the current code page.


SAVE TO Command Example

In the following example, two variables are created. They are saved to a variable file and restored without clearing the existing variables.

gnVal1 = 50

gcVal2 = 'Hello'

SAVE TO temp

CLEAR MEMORY

gdVal3 = DATE( )

RESTORE FROM temp ADDITIVE

CLEAR

DISPLAY MEMORY LIKE g*


See Also

PRIVATE
PUBLIC
RELEASE
RESTORE FROM


SAVE WINDOWS Command

Syntax         Arguments         Remarks         Example         See Also

Saves all or specified window definitions to a window file or memo field.

Syntax

SAVE WINDOWS WindowNameList | ALL
TO FileName | TO MEMO MemoFieldName

Arguments

WindowNameList   Specifies one or more windows to be saved. Separate the window names with commas.

ALL   Saves all window definitions to the window file or memo field.

TO FileName   Specifies the window file to which the window definitions are saved.

If you don’t specify an extension when naming the file, the default extension of .WIN is assigned. If you specify another extension when you save the window definitions to a file, you must include the extension when you restore the window definitions from the file.

TO MEMO MemoFieldName   Specifies the memo field to which the window definitions are saved. The table containing the memo field must be open; however, it does not have to be in the currently selected work area. To save window definitions to a table in another work area, include the table’s alias when specifying the memo field.

Remarks

Use RESTORE WINDOW to restore window definitions from a window file or memo field. The status of each window is also saved. For example, if a window is hidden when it is saved to a file or memo field, it remains hidden when it is restored.


SAVE WINDOWS Command Example

In the following example, a window named wOutput1 is created, and the window definition is saved to the file TEMP.WIN. All windows are cleared and wOutput1 is restored from the file and activated.

CLEAR

DEFINE WINDOW wOutput1 FROM 2,1 TO 13,75 TITLE 'Output' ;

CLOSE FLOAT GROW SHADOW ZOOM

ACTIVATE WINDOW wOutput1

@ 1,1 SAY 'This is the contents of the window'

SAVE WINDOWS wOutput1 TO temp

CLEAR WINDOWS

WAIT WINDOW 'The window has been saved - Press a key'

RESTORE WINDOW wOutput1 FROM temp

ACTIVATE WINDOW wOutput1

WAIT WINDOW 'The window has been restored - Press a key'

DEACTIVATE WINDOW wOutput1

RELEASE WINDOW wOutput1

DELETE FILE temp.win


See Also

DEFINE WINDOW
RESTORE SCREEN
RESTORE WINDOW
SAVE SCREEN


SaveAs Method

Syntax         Arguments         Remarks         Applies To         See Also

Saves an object as an .SCX file.

Syntax

Object.SaveAs(cFileName [, oObjectName])

Arguments

cFileName   Specifies the .SCX file to which you want to save the object.

oObjectName   Specifies a reference to a DataEnvironment object.

Remarks

Use the SaveAs method to create a form or form set programmatically and save it as an .SCX file.

When you use the SaveAs method, all the properties, events, and methods associated with the object are stored as as well. Note that only objects created from Visual FoxPro base classes can be saved. User-defined classes cannot be saved. See DEFINE CLASS  for a listing of Visual FoxPro base classes.


Applies To

DEFINE CLASS , Form, FormSet, _SCREEN


See Also

SaveAsClass Method
SET CLASSLIB


SaveAsClass Method

Syntax         Arguments         Remarks         Applies To         See Also

Saves an instance of an object as a class definition in a class library.

Syntax

Object.SaveAsClass.(ClassLibName, ClassName [, Description])

Arguments

ClassLibName   Specifies the name of the .VCX file in which to store the class definition.

ClassName   Specifies the name assigned to the class.

Description   Specifies the optional description for the class.

Remarks

When you use the SaveAsClass method, all the properties, events, and methods associated with the object are stored as part of the class definition.

Note   You can use the SaveAsClass method only if the class originates from a class library (.VCX).


Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, Custom, EditBox, Form, FormSet, Grid, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, PageFrame, _SCREEN, Shape, Spinner, TextBox, Timer, ToolBar


See Also

SaveAs Method
SET CLASSLIB


SAVEPICTURE( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Creates a bitmap (.BMP) file from a picture object reference.

Syntax

SAVEPICTURE(oObjectReference, cFileName)

Returns

Logical

Arguments

oObjectReference   Specifies a picture object reference from which SAVEPICTURE( ) creates a bitmap file.

cFileName   Specifies the name of the bitmap file that SAVEPICTURE( ) creates. If cFileName includes a path, the file is created in the directory specified in the path. If a file with the same name already exists, it is overwritten without warning, even if SET SAFETY is ON. An error message is displayed if the file you specify does not exist.

Remarks

Picture object references are typically created with LOADFILE( ). However, certain properties (such as the PictureOpen property for the OLE Outline control) use a default picture object reference which can be used to create a bitmap file.


See Also

LOADPICTURE( )


ScaleMode Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the unit of measurement for the coordinates of an object when using graphics methods or when positioning controls. Available at design time and run time.

Syntax

Object.ScaleMode = nMode

Settings

nMode   The settings for the ScaleMode property are:

Setting	Description
0	Foxels (A Visual FoxPro term. Equivalent to the maximum height and average width of a character in the current font.)
3	Pixels (default; smallest unit of monitor or printer resolution)
Remarks

If you create a custom visual class for cross-platform use, be sure that the ScaleMode property for Forms in the visual class is set to pixels.


Applies To

Form, _SCREEN, ToolBar


See Also

DrawMode Property
DrawStyle Property


SCAN ... ENDSCAN Command

Syntax         Arguments         Remarks         Example         See Also

Moves the record pointer through the currently selected table and executes a block of commands for each record that meets the specified conditions.

Syntax

SCAN [NOOPTIMIZE]
[Scope] [FOR lExpression1] [WHILE lExpression2]
[Commands]
[LOOP]
[EXIT]
ENDSCAN

Arguments

NOOPTIMIZE   Prevents Rushmore optimization of SCAN.

For more information, see SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

Scope   Specifies a range of records to be scanned. Only the records within the range are scanned. The scope clauses are: ALL, NEXT nRecords, RECORD nRecordNumber, and REST. For more information on scope clauses, see Scope Clauses.

The default scope for SCAN is all records (ALL).

FOR lExpression1   Executes commands only for records for which lExpression1 evaluates to true (.T.). Including the FOR clause lets you filter out records you don’t want scanned.

Rushmore optimizes a query created with SCAN ... FOR if lExpression1 is an optimizable expression. For best performance, use an optimizable expression in the FOR clause.

For more information, see SET OPTIMIZE and  “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

WHILE lExpression2   Specifies a condition whereby the commands are executed for as long as lExpression2 evaluates to true (.T.).

Commands   Specifies the Visual FoxPro commands to be executed.

LOOP   Returns control directly back to SCAN. LOOP can be placed anywhere between SCAN and ENDSCAN.

EXIT   Transfers program control from within the SCAN ... ENDSCAN loop to the first command following ENDSCAN. EXIT can be placed anywhere between SCAN and ENDSCAN.

ENDSCAN   Indicates the end of the SCAN procedure.

Remarks

SCAN automatically advances the record pointer to the next record that meets the specified conditions and executes the block of commands.

You can place comments after ENDSCAN on the same line. The comments are ignored during program compilation and execution.


SCAN ... ENDSCAN Command Example

The following example uses a SCAN ... ENDSCAN loop to display all the companies in Sweden.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

CLEAR

SCAN FOR UPPER(country) = 'SWEDEN'

? contact, company, city

ENDSCAN


See Also

DO CASE ... ENDCASE
DO WHILE ... ENDDO
FOR ... ENDFOR


SCATTER Command

Syntax         Arguments         Remarks         Example         See Also

Copies data from the current record to a set of variables or to an array.

Syntax

SCATTER
[FIELDS FieldNameList
| FIELDS LIKE Skeleton | FIELDS EXCEPT Skeleton] [MEMO]
TO ArrayName | TO ArrayName BLANK | MEMVAR | MEMVAR BLANK
| NAME ObjectName

Arguments

FIELDS FieldNameList   Specifies the fields to be transferred to the variables or to the array. All fields are transferred if you omit FIELDS FieldNameList. The field list can contain memo fields if you follow the field list with the MEMO keyword. SCATTER always ignores general and picture fields, even if you include MEMO.

FIELDS LIKE Skeleton | FIELDS EXCEPT Skeleton   You can selectively transfer fields to variables or an array by including the LIKE or EXCEPT clause or both. If you include LIKE Skeleton, fields that match Skeleton are transferred to the variables or the array. If you include EXCEPT Skeleton, all fields except those that match Skeleton are transferred to the variables or the array.

Skeleton supports wildcard characters. For example, to transfer all fields that begin with the letters A and P to the variables or the array, use:

SCATTER FIELDS LIKE A*,P* TO myarray

The LIKE clause can be combined with the EXCEPT clause:

SCATTER FIELDS LIKE A*,P* EXCEPT PARTNO* TO myarray

MEMO   Specifies that the field list includes a memo field or memo fields. By default, memo fields are ignored in SCATTER.

You must have sufficient memory to scatter large memo fields to variables or to an array. Visual FoxPro generates an error message if you lack sufficient memory. If a memo field is too large to fit in memory, neither it nor any additional memo fields in the field list are scattered. If a memo field isn’t scattered, its variable or array element is set to false (.F.).

TO ArrayName   Specifies the array to which the record contents are copied. Starting with the first field, SCATTER copies in sequential order the contents of each field into each element of the array.

Extra array elements are left unchanged if the array you specify has more elements than the number of fields. A new array is automatically created if the array doesn’t already exist or if it has fewer elements than the number of fields. The array elements have the same size and data types as the corresponding fields.

TO ArrayName BLANK   Creates an array with empty elements which are the same size and type as the fields in the table.

MEMVAR   Scatters the data to a set of variables instead of to an array. SCATTER creates one variable for each field in the table and fills each variable with data from the corresponding field in the current record, assigning to the variable the same name, size, and type as its field.

A variable is created for each field in the field list if a field list is included.

Preface the variable name with the M. qualifier to reference a variable that has the same name as a field in the current table.

Important     Do not include TO with MEMVAR. Visual FoxPro creates an array named MEMVAR if you include TO.

MEMVAR BLANK   Creates a set of empty variables. Each variable is assigned the same name, data type, and size as its field. If a field list is included, a variable is created for each field in the field list.

NAME ObjectName   Creates an object whose properties have the same names as fields in the table. The values of each of the object’s properties are the contents of the fields in the table. Properties are not created for general fields in the table.

To reference a property in an object that has the same name as an open table, preface the property name with the M. qualifier. For example:

USE customer

SCATTER NAME customer

? customer.company    && Returns the table value

? M.customer.company  && Returns the object property value

Remarks

SCATTER and COPY TO ARRAY are similar. COPY TO ARRAY copies multiple records into an array while SCATTER copies just one record into an array or a set of variables. SCATTER automatically creates the array or variables if they don’t already exist.

Use GATHER to copy variables or array elements to table records.


SCATTER Command Examples

Example 1

This example uses SCATTER to create a set of variables based on the fields in the test table. Each field is then assigned a value and a new  blank record is added to the table. The data is copied to the table using the GATHER command.

CREATE TABLE Test FREE ;

(Object C(10), Color C(16), SqFt n(6,2))

SCATTER MEMVAR BLANK

m.Object="Box"

m.Color="Red"

m.SqFt=12.5

APPEND BLANK

GATHER MEMVAR

BROWSE

Example 2

This example uses SCATTER along with the NAME clause to create an object with properties based on the fields in the table. The object’s properties are then assigned values and a new blank record is added to the table. The data is copied to the new record using GATHER with the NAME clause.

CREATE TABLE Test FREE ;

(Object C(10), Color C(16), SqFt n(6,2))

SCATTER NAME oTest BLANK

oTest.Object="Box"

oTest.Color="Red"

oTest.SqFt=12.5

APPEND BLANK

GATHER NAME oTest

RELEASE oTest

BROWSE


See Also

APPEND FROM ARRAY
COPY TO ARRAY
DECLARE
DIMENSION
GATHER


_SCCTEXT System Variable

Syntax         Arguments         Remarks          See Also

Specifies a Visual FoxPro conversion program that handles translating Visual FoxPro binary files into text equivalents and back.

Syntax

_SCCTEXT = cProgramName

Arguments

cProgramName   Specifies a source control conversion program. If your source control conversion program is in a directory other than the current default directory, include a path with the program name.

You can also specify a source control conversion program in your configuration file by including a line using this syntax:

_SCCTEXT = cProgramName

Remarks

By default, _SCCTEXT contains SCCTEXT.PRG, a Visual FoxPro conversion program that handles translating Visual FoxPro binary files into text equivalents and back. These text files are used as the basis for comparing and merging versions of Visual FoxPro binary files through a source control application.


See Also

Projects Tab, Options Dialog Box


SCHEME( ) Function

Syntax         Returns         Arguments         Example         See Also

Returns a color pair list or a single color pair from a specified color scheme.

Syntax

SCHEME(nSchemeNumber [, nColorPairNumber])

Returns

Character

Arguments

nSchemeNumber   Specifies the number of the color scheme for which you want a complete color-pair list. SCHEME( ) returns ten color pairs.

nColorPairNumber   Specifies the position of one color pair in the color scheme, and SCHEME( ) returns only this color pair. For example, if nColorPairNumber is 4, SCHEME( ) returns the fourth color pair from the color scheme.


SCHEME( ) Function Example

The following example returns the third color pair from color scheme number 4:

? SCHEME(4,3)


See Also

Colors Overview


SCOLS( ) Function

Syntax         Returns         Remarks         See Also

Returns the number of columns available in the main Visual FoxPro window.

Syntax

SCOLS( )

Returns

Numeric

Remarks

The value returned by SCOLS( ) depends on the current display mode. Display modes can be changed with SET DISPLAY.


See Also

COL( ), ROW( ), SET DISPLAY, SROWS( ), WCOLS( ), WROWS( )


_SCREEN System Memory Variable
_SCREEN System Variable

Syntax         Arguments         Remarks         Properties         Methods         Example         See Also

Specifies properties and methods for the main Visual FoxPro window.

Syntax

_SCREEN.PropertyName [= eValue]
 – Or –

_SCREEN.MethodName

Arguments

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.


Properties

ActiveControl	ActiveForm	AutoCenter
BackColor	BaseClass	BorderStyle
BufferMode	Caption	Class
ClassLibrary	ClipControls	Closable
Comment	ControlBox	ControlCount
Controls	CurrentX	CurrentY
DataSession	DataSessionID	DefOLELCID Property
Desktop	DrawMode	DrawStyle
DrawWidth	Enabled	FillColor
FillStyle	FontBold	FontItalic
FontName	FontOutline	FontShadow
FontSize	FontStrikeThru	FontUnderline
Forecolor	FormCount	Forms
HalfHeightCaption	Height	HelpContextID
Icon	KeyPreview	Left
LockScreen	MaxButton	MaxHeight
MaxLeft	MaxTop	MaxWidth
MDIForm	MinButton	MinHeight
MinWidth	MousePointer	Movable
Name	ParentClass	Picture
ReleaseType	RightToLeft	ScaleMode
ShowTips	TabIndex	TabStop
Tag	Top	Visible
Width	WindowState	WindowType


Methods

AddObject	Box	Circle
Cls	Draw	Hide
Line	Move	Point
Print	Pset	Refresh
Release	RemoveObject	SaveAs
SaveAsClass	SetAll	Show
TextHeight	TextWidth	ZOrder


_SCREEN System Variable Example

The following example demonstrates the use of _SCREEN to customize the main Visual FoxPro window.

* Local variables to store current settings

Local oldScreenLeft

Local oldScreenTop

Local oldScreenHeight

Local oldScreenWidth

Local oldScreenColor

WITH _Screen

   oldScreenLeft=.Left                 && Save current position and size

   oldScreenTop=.Top

   oldScreenHeight=.Height

   oldScreenWidth=.Width

   oldScreenColor = .Backcolor

   .LockScreen=.T.                     && Disable screen redraw

   .BackColor=rgb(192,192,192)         && Change the background to grey

   .BorderStyle=2                      && Change the border to double

   .Closable=.F.                       && Remove window control buttons

   .ControlBox=.F.

   .MaxButton=.F.

   .MinButton=.T.

   .Movable=.T.

   .Height=285

   .Width=550

   .Caption="Custom Screen"            && Set a caption

   .LockScreen=.F.                     && Enable screen redraw

ENDWITH

=MESSAGEBOX("Return to normal  ",48,WTITLE())

With _Screen

   .Left = oldScreenLeft               && Reset original

   .Top = oldScreenTop                 && position and size

   .Height = oldScreenHeight

   .Width  = oldScreenWidth

   .BackColor=oldScreenColor           && Change background to white

   .LockScreen=.T.                     && Disable screen redraw

   .BorderStyle=3                      && Change border to sizeable

   .Closable=.T.                       && Reset window control buttons

   .ControlBox=.T.

   .MaxButton=.T.

   .MinButton=.T.

   .Movable=.T.

   .Caption="Microsoft Visual FoxPro"  && Reset the caption

   .LockScreen=.F.                     && Enable screen redraw

Endwith


See Also

MODIFY WINDOW
Form Object


SCROLL Command

Syntax         Arguments         Example         See Also

Scrolls an area of the main Visual FoxPro window or a user-defined window up, down, left, or right.

Syntax

SCROLL nRow1, nColumn1, nRow2, nColumn2, nRowsScrolled
[, nColumnsScrolled]

Arguments

nRow1, nColumn1, nRow2, nColumn2   Specifies the rectangular region where scrolling occurs in the main Visual FoxPro window or in the active user-defined window. nRow1, nColumn1 specifies the upper-left corner of the region, and nRow2, nColumn2 specifies the lower-right corner.

nRowsScrolled   Specifies the number of rows up or down to scroll inside the rectangular region. If the numeric expression nRowsScrolled is positive, Visual FoxPro scrolls up the number of rows. If nRowsScrolled is negative, Visual FoxPro scrolls down the number of rows. If nRowsScrolled is 0 and you omit nColumnsScrolled, Visual FoxPro clears the rectangular region.

nColumnsScrolled   Specifies the number of columns left or right to scroll inside the rectangular region. If the numeric expression nColumnsScrolled is positive, Visual FoxPro scrolls to the right the number of columns. If nColumnsScrolled is negative, Visual FoxPro scrolls to the left the number of columns. If you include both nRowsScrolled and nColumnsScrolled, Visual FoxPro scrolls the area diagonally.


SCROLL Command Example

The following command scrolls a small rectangular region:

CLEAR

@ 4, 1 FILL TO 10, 8 COLOR GR+/B

WAIT WINDOW 'Press key to scroll left top corner'

SCROLL 0, 0, 5, 5, -2, 1


See Also

MOVE WINDOW


ScrollBars Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the type of scroll bars a control has. Available at design time; read-write at run time.

Syntax

[Form.]Control.ScrollBars[= nType]

Settings

nType   For a grid, the ScrollBars property settings are:

Setting	Description
0	None
1	Horizontal
2	Vertical
3	(Default) Both vertical and horizontal
For an edit box, the settings are:

Setting	Description
0	None
2	Vertical
Remarks

If enabled, the scroll bars are displayed automatically when the grid or edit box contains more information than can be displayed in the space provided.


Applies To

EditBox, Grid


See Also

DoScroll Method
Scrolled Event


Scrolled Event

Syntax         Remarks         Applies To         See Also

Occurs in a Grid control when the horizontal or vertical scroll bars are clicked or the scroll box is moved.

Syntax

PROCEDURE Grid.Scrolled
LPARAMETERS [nIndex], nDirection

Parameters

nIndex   Uniquely identifies a control if it is in a control array.

nDirection   Specifies how the user scrolled through the contents of a Grid control. The possible values are:

Value	User scrolled using
0	UP ARROW key
1	DOWN ARROW key
2	Vertical scroll bar in area above the scroll box
3	Vertical scroll bar in area below the scroll box
4	LEFT ARROW key
5	RIGHT ARROW key
6	Horizontal scroll bar in area to the left of the scroll box
7	Horizontal scroll bar in area to the right of the scroll box
Remarks

The Scrolled event also occurs if you call the DoScroll method from within a program.


Applies To

Grid


See Also

ActiveColumn Property
ActiveRow Property
DoScroll Method
RelativeColumn Property
RelativeRow Property


SEC( ) Function

Syntax         Returns         Arguments         Example         See Also

Returns the seconds portion from a DateTime expression.

Syntax

SEC(tExpression)

Returns

Numeric

Arguments

tExpression   Specifies the DateTime expression from which SEC( ) returns the second. If tExpression contains only a date and not a time, Visual FoxPro adds the default time of midnight (12:00:00 A.M.) to tExpression.


SEC( ) Function Example

The following example displays the second portion of the current time and the second portion of a specific time.

CLEAR

? SEC(DATETIME( ))

? SEC({10:42:16am})  && Displays 16


See Also

DATETIME( )
SET SECONDS


SECONDS( ) Function

Syntax         Returns         Remarks         Example         See Also

Returns the number of seconds that have elapsed since midnight.

Syntax

SECONDS( )

Returns

Numeric

Remarks

SECONDS( ) returns a numeric value in decimal format, with a resolution of 1 millisecond. If you are running Windows NT, resolution is 10 milliseconds.


SECONDS( ) Function Example

CLEAR

? SECONDS( )

? SECONDS( )/(60 * 60)


See Also

SYS(2) - Seconds Since Midnight
TIME( )


Seconds Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether the seconds portion of a DateTime value is displayed in a text box. Available at design time and run time.

Syntax

Object.Seconds[ = nValue]

Settings

nValue   One of the following settings:

Setting	Description
0	Off. The seconds portion of the DateTime value is not displayed.
1	On. The seconds portion of the DateTime value is displayed.
2	(Default) The SET SECONDS setting determines if the seconds portion of the DateTime value is displayed. If SET SECONDS is ON, the seconds portion of the DateTime value is displayed. If SET SECONDS is OFF, the seconds portion of the DateTime value is not displayed.
Remarks

The Seconds property setting is ignored if the DateFormat property is set to Short or Long.


Applies To

TextBox


See Also

Century Property, DateFormat Property, DateMark Property, Hours Property, SET SECONDS, StrictDateEntry Property


SEEK Command

Syntax         Arguments         Remarks         Example         See Also

Searches a table for the first occurrence of a record whose index key matches a general expression, then moves the record pointer to the matching record.

Syntax

SEEK eExpression
[ORDER nIndexNumber | IDXIndexFileName
| [TAG] TagName [OF CDXFileName]
[ASCENDING | DESCENDING]]
[IN nWorkArea | cTableAlias]

Arguments

eExpression   Specifies the index key for which SEEK searches. eExpression can be null.

ORDER nIndexNumber   Specifies the number of the index file or tag that is used to search for the index key. nIndexNumber refers to the index files as they are listed in USE or SET INDEX. Open .IDX files are numbered first in the order in which they appear in USE or SET INDEX. Tags in the structural .CDX file (if one exists) are then numbered in the order in which they were created. Finally, tags in any open independent .CDX files are numbered in the order in which they were created. See SET ORDER for more information about index numbering.

ORDER IDXIndexFileName   Specifies an .IDX file that is used to search for the index key.

ORDER [TAG] TagName [OF CDXFileName]   Specifies a tag of a .CDX file that is used to search for the index key. The tag name can be from a structural .CDX file or any open independent .CDX file.

If identical tag names exist in open independent .CDX files, use OF CDXFileName to specify the .CDX file containing the tag.

Note   The .IDX file takes precedence if duplicate .IDX file and tag names exist.

ASCENDING   Specifies that the table is searched in ascending order.

DESCENDING   Specifies that the table is searched in descending order.

IN nWorkArea   Specifies the work area number of the table that is searched.

IN cTableAlias   Specifies the alias of the table that is searched.

If you omit IN nWorkArea and IN cTableAlias, the table in the currently selected work area is searched.

Remarks

You can use SEEK only with indexed tables, and you can search only on the index key. The match must be exact unless SET EXACT is set to OFF.

If SEEK finds a record with a matching index key, RECNO( ) returns the record number of the matching record, FOUND( ) returns true (.T.), and EOF( ) returns false (.F.).

If a matching key isn’t found, RECNO( ) returns the number of records in the table plus 1, FOUND( ) returns false (.F.), and EOF( ) returns true (.T.).

If SET NEAR is on, the record pointer is positioned immediately after the record with the closest index key. If SET NEAR is off, the record pointer is positioned at the end of the file. In either case, RECNO() returns the record number of the closest record.


SEEK Command Example

In the following example, customer is opened and indexed on the company field. SEEK is used to find the index key expression that matches the value contained in the variable gcSeekVal.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer ORDER company  && Opens Customer table

SET EXACT OFF

STORE 'B' TO gcSeekVal

SEEK gcSeekVal

IF FOUND( )

DISPLAY FIELDS company, contact

ENDIF


See Also

EOF( )
FOUND( )
INDEX
LOCATE
RECNO( )
SEEK( )
SET EXACT
SET NEAR


SEEK( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Searches an indexed table for the first occurrence of a record whose index key matches a specified expression. Returns a logical value indicating if the search was successful.

Syntax

SEEK(eExpression [, nWorkArea | cTableAlias
[, nIndexNumber | cIDXIndexFileName | cTagName]])

Returns

Logical

Arguments

eExpression   Specifies the index key expression for which you want SEEK( ) to search.

nWorkArea   Specifies the work area number of the table that is searched for the index key.

cTableAlias   Specifies the alias of the table that is searched.

If you omit nWorkArea and cTableAlias, the table in the currently selected work area is searched.

nIndexNumber   Specifies the number of the index file or tag that is used to search for the index key. nIndexNumber refers to the index files as they are listed in USE or SET INDEX. Open .IDX files are numbered first in the order in which they appear in USE or SET INDEX. Tags in the structural .CDX file (if one exists) are then numbered in the order in which they were created. Finally, tags in any open independent .CDX files are numbered in the order in which they were created. For more information about index numbering, see SET ORDER.

cIDXIndexFileName   Specifies an .IDX file that is used to search for the index key.

cTagName   Specifies a tag of a .CDX file that is used to search for the index key. The tag name can be from a structural .CDX file or any open independent .CDX file.

Note   The .IDX file takes precedence if duplicate .IDX file and tag names exist.

Remarks

You can use SEEK( ) only with a table with an index order set, and you can search only for an index key. The match must be exact unless SET EXACT is set to OFF.

If a match is found, SEEK( ) returns true (.T.), and the record pointer moves to the matching record. If no match is found, SEEK( ) returns false (.F.) and the record pointer moves to the end of the file. Issuing SEEK( ) is equivalent to issuing SEEK and FOUND( ) in succession.

If you omit the nIndexNumber, IDXIndexFileName, and cTagName arguments, SEEK( ) uses the master controlling index or index tag to search for the index key.


SEEK( ) Function Example

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer ORDER cust_id  && Opens Customer table

? SEEK('CHOPS')  && Returns .T., record found


See Also

EOF( )
FOUND( )
LOCATE
SEEK
SET ORDER


SELECT Command

Syntax         Arguments         Remarks         Example         See Also

Activates the specified work area.

Syntax

SELECT nWorkArea | cTableAlias

Arguments

nWorkArea   Specifies a work area to activate. If nWorkArea is 0, the lowest-numbered unused work area is activated.

cTableAlias   Specifies a work area containing an open table to activate. cTableAlias is the alias of the open table. You can also include a letter from A through J for cTableAlias to activate one of the first ten work areas.

s

Remarks

By default, work area number 1 is active when you start Visual FoxPro.

Note   Fields in tables open in any work area can be included in Visual FoxPro commands and functions. Use the following formats to access fields in a table open in a work area other than the current one: alias.field or alias -> field.


SELECT Command Example

The following example demonstrates ways of selecting work areas.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

SELECT 1	  && Work area 1

USE customer  && Opens Customer table

SELECT 2	  && Work area 2

USE orders  && Opens Orders table

SELECT customer	  && Work area 1

BROWSE

SELECT B	  && Work area 2

BROWSE


See Also

ALIAS( )
SELECT( )
USE


SELECT - SQL Command

Syntax         Arguments         Remarks         Example         See Also

Retrieves data from one or more tables.

Syntax

SELECT [ALL | DISTINCT] [TOP nExpr [PERCENT]]
[Alias.] Select_Item [AS Column_Name]
[, [Alias.] Select_Item [AS Column_Name] ...]

FROM [FORCE]
[DatabaseName!]Table [Local_Alias]
[[INNER | LEFT [OUTER] | RIGHT [OUTER] | FULL [OUTER] JOIN
DatabaseName!]Table [Local_Alias]
[ON JoinCondition …]

[[INTO Destination]
| [TO FILE FileName [ADDITIVE] | TO PRINTER [PROMPT]
| TO SCREEN]]

[PREFERENCE PreferenceName]

[NOCONSOLE]

[PLAIN]

[NOWAIT]

[WHERE JoinCondition [AND JoinCondition ...]
[AND | OR FilterCondition [AND | OR FilterCondition ...]]]

[GROUP BY GroupColumn [, GroupColumn ...]]

[HAVING FilterCondition]

[UNION [ALL] SELECTCommand]

[ORDER BY Order_Item [ASC | DESC] [, Order_Item [ASC | DESC] ...]]

Arguments

SELECT   Specifies the fields, constants, and expressions that are displayed in the query results.

ALL   By default, displays all the rows in the query results.

DISTINCT   Excludes duplicates of any rows from the query results.

Note   You can use DISTINCT only once per SELECT clause.

TOP nExpr [PERCENT]   Specifies that the query result contains a specific number of rows or a percentage of rows in the query result. You must include an ORDER BY clause when you include the TOP clause. The ORDER BY clause specifies the columns on which the TOP clause determines the number of rows to include in the query result.

You can specify from 1 to 32,767 rows. Rows with identical values for the columns specified in the ORDER BY clause are included in the query result. Therefore, if you specify 10 for nExpr, the query result can contain more than 10 rows if there are more than 10 rows with identical values for the columns specified in the ORDER BY clause.

If the PERCENT keyword is included, the number of rows returned in the result is rounded up to the next highest integer. Permissible values for nExpr when the PERCENT keyword is included are 0.01 to 99.99.

Alias.   Qualifies matching item names. Each item you specify with Select_Item generates one column of the query results. If two or more items have the same name, include the table alias and a period before the item name to prevent columns from being duplicated.

Select_Item specifies an item to be included in the query results. An item can be one of the following:

•	The name of a field from a table in the FROM clause.

•	A constant specifying that the same constant value is to appear in every row of the query results.

•	An expression that can be the name of a user-defined function.

AS Column_Name   Specifies the heading for a column in the query output. This option is useful when Select_Item is an expression or contains a field function and you want to give the column a meaningful name. Column_Name can be an expression but cannot contain characters (for example, spaces) that aren’t permitted in table field names.

FROM   Lists the tables containing the data that the query retrieves. If no table is open, Visual FoxPro displays the Open dialog box so you can specify the file location. Once open, the table remains open once the query is complete.

FORCE specifies that tables are joined in the order in which they appear in the FROM clause. If FORCE is omitted, Visual FoxPro attempts to optimize the query. However, the query might be executed faster by including the FORCE keyword to disable the Visual FoxPro query optimization.

DatabaseName! specifies the name of a non-current database containing the table. You must include the name of database containing the table if the database is not the current database. Include the exclamation point (!) delimiter after the database name and before the table name.

Local_Alias specifies a temporary name for the table named in Table. If you specify a local alias, you must use the local alias in place of the table name throughout the SELECT statement.

INNER JOIN specifies that the query result contains only rows from a table that match one or more rows in another table.

LEFT [OUTER] JOIN specifies that the query result contains all rows from the table to the left of the JOIN keyword and only matching rows from the table to the right of the JOIN keyword. The OUTER keyword is optional; it can be included to emphasize that an outer join is created.

RIGHT [OUTER] JOIN specifies that the query result contains all rows from the table to the right of the JOIN keyword and only matching rows from the table to the left of the JOIN keyword. The OUTER keyword is optional; it can be included to emphasize that an outer join is created.

FULL [OUTER] JOIN specifies that the query result contains all matching and non matching rows from both tables. The OUTER keyword is optional; it can be included to emphasize that an outer join is created.

ON JoinCondition specifies the conditions for which the tables are joined.

INTO Destination   Specifies where to store the query results. If you include the INTO clause and the TO clause in the same query, the TO clause is ignored. If you don’t include the INTO clause, query results are displayed in a Browse window. You can also use TO to direct query results to the printer or a file.

Destination can be one of the following clauses:

•	ARRAY ArrayName, which stores query results in a memory variable array. The array isn’t created if the query selects 0 records.

•	CURSOR CursorName [NOFILTER], which stores query results in a cursor. If you specify the name of an open table, Visual FoxPro generates an error message. After SELECT is executed, the temporary cursor remains open and is active but is read-only. Once you close this temporary cursor, it is deleted. Cursors may exist as a temporary file on the drive or volume specified by SORTWORK.

Include NOFILTER to create a cursor that can be used in subsequent queries. In previous versions of Visual FoxPro, it was necessary to include an extra constant or expression as a filter to create a cursor that could be used in subsequent queries. For example, adding a logical true as a filter expression created a query that could be used in subsequent queries:

SELECT *, .T. FROM customers INTO CURSOR myquery

Including NOFILTER can reduce query performance because a temporary table is created on disk. The temporary table is deleted from disk when the cursor is closed.

•	DBF | TABLE TableName
[DATABASE DatabaseName [NAME LongTableName]] stores query results in a table. If you specify a table that is already open and SET SAFETY is set to OFF, Visual FoxPro overwrites the table without warning. If you don’t specify an extension, Visual FoxPro gives the table a .DBF extension. The table remains open and active after SELECT is executed.

Include DATABASE DatabaseName to specify a database to which the table is added. Include NAME LongTableName to specify a long name for the table.Long names can contain up to 128 characters and can be used in place of short file names in the database.

TO FILE FileName   If you include a TO clause but not an INTO clause, you can direct query results to an ASCII text file named FileName, to the printer, or to the main Visual FoxPro window.

ADDITIVE appends query output to the existing contents of the text file specified in TO FILE FileName.

TO PRINTER [PROMPT] directs query output to a printer. Use the optional PROMPT clause to display a dialog box before printing starts. In this dialog box, you can adjust printer settings. The printer settings that you can adjust depend on the currently installed printer driver. Place PROMPT immediately after TO PRINTER.

TO SCREEN directs query output to the main Visual FoxPro window or to an active user-defined window.

PREFERENCE PreferenceName   Saves the Browse window’s attributes and options for later use, if query results are sent to a Browse window. PREFERENCE saves the attributes, or preferences, indefinitely in the FOXUSER resource file. Preferences can be retrieved at any time.

Issuing SELECT with a PREFERENCE PreferenceName for the first time creates the preference. Issuing SELECT later with the same preference name restores the Browse window to that preference state. When the Browse window is closed, the preference is updated.

If you exit a Browse window by pressing CTRL+Q+W, changes you’ve made to the Browse window are not saved to the resource file.

NOCONSOLE   Prevents display of query results sent to a file, the printer, or the main Visual FoxPro window.

PLAIN   Prevents column headings from appearing in the query output that is displayed. You can use PLAIN whether or not a TO clause is present. If an INTO clause is included, PLAIN is ignored.

NOWAIT   Continues program execution after the Browse window is opened and query results are directed to it. The program doesn’t wait for the Browse window to be closed, but continues execution on the program line immediately following the SELECT statement.

When TO SCREEN is included to direct output to the main Visual FoxPro window or to a user-defined window, output pauses when the main Visual FoxPro window or user-defined window is full of query results. Press a key to see the next set of query results. If NOWAIT is included, the query results are scrolled off the main Visual FoxPro window or the user-defined window without pausing for a key press. NOWAIT is ignored if included with the INTO clause.

WHERE   Tells Visual FoxPro to include only certain records in the query results. WHERE is required to retrieve data from multiple tables.

JoinCondition specifies fields that link the tables in the FROM clause. If you include more than one table in a query, you should specify a join condition for every table after the first.

You must use the AND operator to connect multiple join conditions. Each join condition has the following form:

FieldName1 Comparison FieldName2

FieldName1 is the name of a field from one table, FieldName2 is the name of a field from another table, and Comparison is one of the following operators:

Operator	Comparison
=	Equal
==	Exactly equal
LIKE	SQL LIKE
<>, !=, #	Not equal
>	More than
>=	More than or equal to
<	Less than
<=	Less than or equal to
When you use the = operator with strings, it acts differently depending on the setting of SET ANSI. When SET ANSI is set to OFF, Visual FoxPro treats string comparisons in a manner familiar to Xbase users. When SET ANSI is set to ON, Visual FoxPro follows ANSI standards for string comparisons. See SET ANSI and SET EXACT for additional information about how Visual FoxPro performs string comparisons.

The WHERE clause supports the ESCAPE operator for the JoinCondition, allowing you to perform meaningful queries on data containing the SELECT - SQL % and _ wildcard characters.

The ESCAPE clause lets you specify that a SELECT - SQL wildcard character be treated as a literal character. In the ESCAPE clause you specify a character, which when placed immediately before the wildcard character, indicates that the wildcard character be treated as a literal character.

FilterCondition specifies the criteria that records must meet to be included in the query results. You can include as many filter conditions as you like in a query, connecting them with the AND or OR operator. You can also use the NOT operator to reverse the value of a logical expression, or use EMPTY( ) to check for an empty field.

FilterCondition can take any of the forms in the following examples:

Example 1

Example 1 displays FilterCondition in the form of FieldName1 Comparison FieldName2

customer.cust_id = orders.cust_id

Example 2

Example 2 displays FilterCondition in the form of FieldName Comparison Expression

payments.amount >= 1000

Example 3

Example 3 displays FilterCondition in the form of FieldName Comparison ALL (Subquery)

When the filter condition includes ALL, the field must meet the comparison condition for all values generated by the subquery before its record is included in the query results.

company < ALL ;

(SELECT company FROM customer WHERE country = "UK")

Example 4

Example 4 displays FilterCondition in the form of FieldName Comparison ANY | SOME (Subquery)

When the filter condition includes ANY or SOME, the field must meet the comparison condition for at least one of the values generated by the subquery.

company < ANY ;

(SELECT company FROM customer WHERE country = "UK")

Example 5

Example 5 displays FilterCondition in the form of FieldName [NOT] BETWEEN Start_Range AND End_Range

This example checks to see whether the values in the field are within a specified range of values.

customer.postalcode BETWEEN 90000 AND 99999

Example 6

Example 6 displays FilterCondition in the form of [NOT] EXISTS (Subquery)

This example checks to see whether at least one row meets the criterion in the subquery. When the filter condition includes EXISTS, the filter condition evaluates to true (.T.) unless the subquery evaluates to the empty set.

EXISTS ;

(SELECT * FROM orders WHERE customer.postalcode = 	orders.postalcode)

Example 7

Example 7 displays FilterCondition in the form of FieldName [NOT] IN Value_Set

When the filter condition includes IN, the field must contain one of the values before its record is included in the query results.

customer.postalcode NOT IN ("98052","98072","98034")

Example 8

Example 8 displays FilterCondition in the form of FieldName [NOT] IN (Subquery)

Here, the field must contain one of the values returned by the subquery before its record is included in the query results.

customer.cust_id IN ;

(SELECT orders.cust_id FROM orders WHERE orders.city="Seattle")

Example 9

Example 9 displays FilterCondition in the form of FieldName [NOT] LIKE cExpression

customer.country NOT LIKE "UK"

This filter condition searches for each field that matches cExpression.

You can use the percent sign (%) and underscore ( _ ) wildcards as part of cExpression. The percent sign represents any sequence of unknown characters in the string. An underscore represents a single unknown character in the string.

GROUP BY GroupColumn [, GroupColumn ...]   Groups rows in the query based on values in one or more columns. GroupColumn can be the name of a regular table field, a field that includes a SQL field function, or a numeric expression indicating the location of the column in the result table (the leftmost column number is 1).

HAVING FilterCondition   Specifies a filter condition which groups must meet to be included in the query results. HAVING should be used with GROUP BY. It can include as many filter conditions as you like, connected with the AND or OR operators. You can also use NOT to reverse the value of a logical expression.

FilterCondition cannot contain a subquery.

A HAVING clause without a GROUP BY clause acts like a WHERE clause. You can use local aliases and field functions in the HAVING clause. Use a WHERE clause for faster performance if your HAVING clause contains no field functions. Note that the HAVING clause should appear before an INTO clause or a syntax error occurs.

[UNION [ALL] SELECTCommand]   Combines the final results of one SELECT with the final results of another SELECT. By default, UNION checks the combined results and eliminates duplicate rows. Use parentheses to combine multiple UNION clauses.

ALL prevents UNION from eliminating duplicate rows from the combined results.

UNION clauses follow these rules:

•	You cannot use UNION to combine subqueries.

•	Both SELECT commands must have the same number of columns in their query output.

•	Each column in the query results of one SELECT must have the same data type and width as the corresponding column in the other SELECT.

•	Only the final SELECT can have an ORDER BY clause, which must refer to output columns by number. If an ORDER BY clause is included, it affects the entire result.

You can also use the UNION clause to simulate an outer join.

When you join two tables in a query, only records with matching values in the joining fields are included in the output. If a record in the parent table doesn’t have a corresponding record in the child table, the record in the parent table isn’t included in the output. An outer join allows you to include all the records in the parent table in the output, along with the matching records in the child table. To create an outer join in Visual FoxPro, you need to use a nested SELECT command, as in the following example:

SELECT customer.company, orders.order_id, orders.emp_id ;

FROM customer, orders ;

WHERE customer.cust_id = orders.cust_id ;

UNION ;

SELECT customer.company, " ", " " ;

FROM customer ;

WHERE customer.cust_id NOT IN ;

(SELECT orders.cust_id FROM orders)

Note   Be sure to include the space immediately preceding each semicolon. Otherwise, you’ll receive an error.

The section of the command before the UNION clause selects records from both tables that have matching values. The customer companies that do not have associated invoices are not included. The section of the command after the UNION clause selects records in the customer table that do not have matching records in the orders table.

Regarding the second section of the command, note the following:

•	The SELECT statement within the parentheses is processed first. This statement results in a selection of all customer numbers in the orders table.

•	The WHERE clause finds all customer numbers in the customer table that are not in the orders table. Since the first section of the command provided all companies that had a customer number in the orders table, all companies in the customer table are now included in the query results.

•	Because the structures of tables included in a UNION must be identical, there are two placeholders in the second SELECT statement to represent orders.order_id and orders.emp_id from the first SELECT statement.

Note   The placeholders must be the same type as the fields they represent. If the field is a date type, the placeholder should be { / / }. If the field is a character field, the placeholder should be the empty string, ("").

ORDER BY Order_Item   Sorts the query results based on the data in one or more columns. Each Order_Item must correspond to a column in the query results and can be one of the following:

•	A field in a FROM table that is also a select item in the main SELECT clause (not in a subquery).

•	A numeric expression indicating the location of the column in the result table. (The leftmost column is number 1.)

ASC specifies an ascending order for query results, according to the order item or items, and is the default for ORDER BY.

DESC specifies a descending order for query results.

Query results appear unordered if you don’t specify an order with ORDER BY.

Remarks

SELECT is a SQL command that is built into Visual FoxPro like any other Visual FoxPro command. When you use SELECT to pose a query, Visual FoxPro interprets the query and retrieves the specified data from the tables. You can create a SELECT query from within:

•	The Command window

•	A Visual FoxPro program (as with any other Visual FoxPro command)

•	The Query Designer

When you issue SET TALK ON and execute SELECT, Visual FoxPro displays the length of time the query took to execute and the number of records in the results. _TALLY contains the number of records in the query results.

SELECT does not respect the current filter condition specified with SET FILTER.

A subquery, referred to in the following arguments, is a SELECT within a SELECT and must be enclosed in parentheses. You can have up to two subqueries at the same level (not nested) in the WHERE clause (see that section of the arguments). Subqueries can contain multiple join conditions.

When you create query output, columns are named according to the following rules:

•	If a select item is a field with a unique name, the output column name is the field’s name.

•	If more than one select item has the same name,an underscore and a letter are appended to the column name. For example, if a table called Customer has a field called STREET, and a table called Employees also has a field called STREET, output columns are named Extension_A and Extension_B (STREET_A and STREET_B). For a select item with a 10-character name, the name is truncated to add the underscore and letter. For example, DEPARTMENT would become DEPARTME_A.

•	If a select item is an expression, its output column is named EXP_A. Any other expressions are named EXP_B, EXP_C, and so on.

•	If a select item contains a field function such as COUNT( ), the output column is named CNT_A. If another select item contains SUM( ), its output column is named SUM_B.

User-Defined Functions with SELECT   Although using user-defined functions in the SELECT clause has obvious benefits, you should also consider the following restrictions:

•	The speed of operations performed with SELECT may be limited by the speed at which such user-defined functions are executed. High-volume manipulations involving user-defined functions may be better accomplished by using API and user-defined functions written in C or assembly language.

•	You can assume nothing about the Visual FoxPro input/output (I/O) or table environment in user-defined functions invoked from SELECT. In general, you don’t know which work area is selected, the name of the current table, or even the names of the fields being processed. The value of these variables depends on where precisely in the optimization process the user-defined function is invoked.

•	It isn’t safe to change the Visual FoxPro I/O or table environment in user-defined functions invoked from SELECT. In general, the results are unpredictable.

•	The only reliable way to pass values to user-defined functions invoked from SELECT is by the argument list passed to the function when it is invoked.

•	If you experiment and discover a supposedly forbidden manipulation that works correctly in a certain version of FoxPro, there is no guarantee it will continue to work in later versions.

Apart from these restrictions, user-defined functions are acceptable in the SELECT clause. However, don’t forget that using SELECT might slow performance.

The following field functions are available for use with a select item that is a field or an expression involving a field:

•	AVG(Select_Item), which averages a column of numeric data.

•	COUNT(Select_Item), which counts the number of select items in a column. COUNT(*) counts the number of rows in the query output.

•	MIN(Select_Item), which determines the smallest value of Select_Item in a column.

•	MAX(Select_Item), which determines the largest value of Select_Item in a column.

•	SUM(Select_Item), which totals a column of numeric data.

You cannot nest field functions.

Joins   Visual FoxPro supports ANSI SQL ‘92 Join syntax, allowing you to create queries that link the rows in two or more tables by comparing the values in specified fields. For example, an inner join selects rows from two tables only when the values of the joined fields are equal. Visual FoxPro supports nested joins.

Because SQL is based on mathematical set theory, each table can be represented as a circle. The ON clause that specifies the join conditions determines the point of overlap which represents the set of rows that match. For an inner join, the overlap occurs within the interior or “inner” portion of the two circles. An outer join includes not only those matched rows found in the inner cross section of the tables, but also the rows in the outer part of the circle to the left, or right, of the intersection.

Important     Keep the following information in mind when creating join conditions:

•	If you include two tables in a query and don’t specify a join condition, every record in the first table is joined with every record in the second table as long as the filter conditions are met. Such a query can produce lengthy results.

•	Be careful when using, in join conditions, functions such as DELETED( ), EOF( ), FOUND( ), RECCOUNT( ), and RECNO( ), which support an optional alias or work area. Including an alias or work area in these functions might yield unexpected results. SELECT doesn’t use your work areas; it performs the equivalent of  USE ... AGAIN. Single-table queries that use these functions without an optional alias or work area will return proper results. However, multiple-table queries that use these functions — even without an optional alias or work area — might return unexpected results.

•	Use caution when joining tables that contain empty fields because Visual FoxPro matches empty fields. For example, if you join on CUSTOMER.ZIP and INVOICE.ZIP, and CUSTOMER contains 100 empty zip codes and INVOICE contains 400 empty zip codes, the query output contains 40,000 extra records resulting from the empty fields. Use the EMPTY( ) function to eliminate empty records from the query output.

For additional information about joins, see “Defining and Modifying Join Conditions” in Chapter 8, “Creating Views,” in the Developer’s Guide.


SELECT - SQL Command Examples

The following examples illustrate the use of user-defined functions with SELECT - SQL:

Example 1

Example 1 displays the names of all companies in customer (one field from one table).

CLOSE ALL

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

SELECT customer.company ;

FROM customer

Example 2

Example 2 displays the contents of three fields from two tables and joins the two tables based on the cust_id field. It uses local aliases for both tables.

CLOSE ALL

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

SELECT a.company, b.order_date, b.shipped_on ;

FROM customer a, orders b ;

WHERE a.cust_id = b.cust_id

Example 3

Example 3 displays only records with unique data in the specified fields.

CLOSE ALL

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

SELECT DISTINCT a.company, b.order_date, b.shipped_on ;

FROM customer a, orders b ;

WHERE  a.cust_id = b.cust_id

Example 4

Example 4 displays the country, postalcode, and company fields in ascending order.

CLOSE ALL

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

SELECT country, postalcode, company ;

FROM customer ;

ORDER BY country, postalcode, company

Example 5

Example 5 stores the contents of fields from two tables in a third table.

SELECT a.company, b.order_date, b.shipped_on ;

FROM customer a, orders b ;

WHERE a.cust_id = b.cust_id ;

INTO TABLE custship.dbf

BROWSE

Example 6

Example 6 displays only records with an order date earlier than 02/16/95.

CLOSE ALL

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

SELECT a.company, b.order_date, b.shipped_on ;

FROM customer a, orders b ;

WHERE a.cust_id = b.cust_id ;

AND b.order_date < {02/16/95}

Example 7

Example 7 displays the names of all companies from customer with a postal code that matches a postal code in the orders table.

CLOSE ALL

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

SELECT company FROM customer a WHERE ;

EXISTS (SELECT * FROM orders b WHERE a.postalcode = b.postalcode)

Example 8

Example 8 displays all records from customer having a company name that begins with an uppercase C and is an unknown length.

CLOSE ALL

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

SELECT * FROM customer a WHERE a.company LIKE "C%"

Example 9

Example 9 displays all records from customer having a country name that begins with an uppercase U and is followed by one unknown character.

CLOSE ALL

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

SELECT * FROM customer a WHERE a.country LIKE "U_"

Example 10

Example 10 displays the names of all cities in customer in uppercase and names the output column CityList.

SELECT UPPER(city) AS CityList FROM customer

Example 11

Example 11 demonstrates how you can perform a query on data that contains percentage signs (%). A backslash (\) is placed before the percentage sign to indicate that it should be treated as a literal, and the backslash is specifed as the escape character in the ESCAPE clause.

Because the sample tables included with Visual FoxPro do not contain the percentage sign character, this query returns no results.

CLOSE ALL

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

SELECT * FROM customer;

WHERE company LIKE "%\%%" ESCAPE "\"

Example 12

Example 12 demonstrates how you can perform a query on data that contains underscores (_). A backslash (\) is placed before the underscore to indicate that it should be treated as a literal, and the backslash is specifed as the escape character in the ESCAPE clause.

Because the sample tables included with Visual FoxPro do not contain the underscore character, this query returns no results.

CLOSE ALL

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

SELECT * FROM customer;

WHERE company LIKE "%\_%" ESCAPE "\"

Example 13

In example 13, the Escape character uses itself as a literal. The dash is both the escape character and a literal. The query returns all rows where the company name contains a percentage sign followed by a dash.

Because the sample tables included with Visual FoxPro do not contain the percentage sign character, this query returns no results.

CLOSE ALL

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

SELECT * FROM customer;

WHERE company LIKE "%-%--%" Escape "-"


See Also

CREATE QUERY
CREATE TABLE - SQL
INSERT - SQL
MODIFY QUERY
SET ANSI
SET EXACT
SET PATH
_TALLY


SELECT( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the number of the currently selected work area or the highest-numbered unused work area.

Syntax

SELECT([ 0 | 1 | cTableAlias ])

Returns

Numeric

Arguments

0   Specifies that SELECT( ) return the number of the current work area.

1   Specifies that SELECT( ) return the highest-numbered unused work area.

cTableAlias   Specifies the alias of the table for which SELECT( ) returns the work area.

Remarks

SELECT( ) returns the number of the current work area if SET COMPATIBLE is set to OFF. If SET COMPATIBLE is set to ON, SELECT( ) returns the number of the unused work area with the highest number.

A work area can be selected (activated) with SELECT.


SELECT( ) Function Example

CLOSE DATABASES

SET COMPATIBLE ON

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

SELECT 0  && Unused work area

USE customer  && Opens Customer table

SELECT 0  && Unused work area

USE orders  && Opens Orders table

CLEAR

? SELECT( )  && Returns 3, lowest available work area


See Also

ALIAS( )
SELECT
SET COMPATIBLE


Selected Property

Syntax         Settings         Remarks         Example         Applies To         See Also

Specifies whether an item is selected in a combo box or list box. Not available at design time; read-write at run time.

Syntax

[Form.]Control.Selected(nIndex)[= lExpr]

Settings

nIndex   Specifies the index of an item in a combo box or list box.

lExpr   The settings for the Selected property are:

Setting	Description
True (.T.)	The item is selected.
False (.F.)	(Default) The item isn’t selected.
Remarks

The Selected property is particularly useful where users can make multiple selections. You can quickly check which items in a list are selected. You can also use this property to select or deselect items in a list from within a program. To check whether the third item in a list box is selected, issue the following:

IF MyList.Selected(3)

  WAIT WINDOW "It’s selected!"

ELSE

  WAIT WINDOW "It’s not!"

ENDIF


Selected Property Example

The following example creates a list box. The source of the items that appear in the list box items is an array; the name of the array is specified with the RowSource property. The RowSourceType property is set to 5 (array) to specify that an array is the source for the items in the list box.

The MultiSelect property for the list box is set to true (.T.), allowing you to make multiple selections from the list box. The item or items you choose in the list box are displayed by using the ListCount, Selected and List properties to determine the number of items in the list box and the items you chose.

CLEAR

DIMENSION gaMyListArray(10)

FOR gnCount = 1 to 10  && Fill the array with letters

STORE REPLICATE(CHR(gnCount+64),6) TO gaMyListArray(gnCount)

NEXT

frmMyForm = CREATEOBJECT('Form')  && Create a Form

frmMyForm.Closable = .f.  && Disable the Control-menu box

frmMyForm.Move(150,10)  && Move the form

frmMyForm.AddObject('cmbCommand1','cmdMyCmdBtn')  && Add "Quit" Command button

frmMyForm.AddObject('lstListBox1','lstMyListBox')  && Add ListBox control

frmMyForm.lstListBox1.RowSourceType = 5  && Specifies an array

frmMyForm.lstListBox1.RowSource = 'gaMyListArray' && Array containing listbox items

frmMyForm.cmbCommand1.Visible =.T.  && "Quit" Command button visible

frmMyForm.lstListBox1.Visible =.T.  && "List Box visible

frmMyForm.SHOW  && Display the form

READ EVENTS  && Start event processing

DEFINE CLASS cmdMyCmdBtn AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 210  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close Form

CLEAR  && Clear main Visual FoxPro window

ENDDEFINE

DEFINE CLASS lstMyListBox AS ListBox  && Create ListBox control

Left = 10  && List Box column

Top = 10  && List Box row

MultiSelect = .T.  && Allow selecting more than 1 item

PROCEDURE Click

ACTIVATE SCREEN

CLEAR

? "Selected items:"

? "---------------"

FOR nCnt = 1 TO ThisForm.lstListBox1.ListCount

IF ThisForm.lstListBox1.Selected(nCnt)  && Is item selected?

? SPACE(5) + ThisForm.lstListBox1.List(nCnt) && Show item

ENDIF

ENDFOR

ENDDEFINE


Applies To

ComboBox, ListBox


See Also

AddItem Method
Clear Method
List Property
ListCount Property
ListItemID Property
MultiSelect Property
NewItemID Property
RemoveItem Method
RemoveListItem Method
SelectedID Property
TopItemID Property


SelectedBackColor, SelectedForeColor Properties

Syntax         Settings         Applies To         See Also

Specifies the background or foreground color for the selected text. Available at design time and run time.

Syntax

Control.SelectedBackColor[ = nColor]

 – Or –

Control.SelectedBackColor RGB(nRedValue, nGreenValue, nBlueValue)

Control.SelectedForeColor[ = nColor]

 – Or –

Control.SelectedForeColor RGB(nRedValue, nGreenValue, nBlueValue)

Settings

nColor   Specifies a single number to represent the color.

Note   In the Properties window, you can double-click any of the color properties to display the Color dialog box. You can choose or define colors from this dialog box. The red, green, and blue intensities that correspond to the color you choose become the settings for these properties after you close the Color dialog box.

For more information, see the color table in the BackColor, ForeColor Properties topic.


Applies To

ComboBox, EditBox, Spinner, TextBox


See Also

BackColor
ForeColor Properties
RGB( )
SelectedItemBackColor
SelectedItemForeColor Properties


SelectedID Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether an item is selected in a combo box or list box. Not available at design time; read-write at run time.

Syntax

Control.SelectedID(nItemID)[= lExpr]

Settings

nItemID   Specifies the item ID of an item in a combo box or ListBox.

lExpr   The settings for the SelectedID property are:

Setting	Description
True (.T.)	The item is selected.
False (.F.)	(Default) The item isn’t selected.
Remarks

The SelectedID property is particularly useful where users can make multiple selections. You can quickly check which items in a list are selected. You can also use this property to select or deselect items in a list using code. To check whether the third item in a ListBox is selected, issue the following:

IF MyList.SelectedID(3)

  WAIT WINDOW "It’s selected!"

ELSE

  WAIT WINDOW "It’s not!"

ENDIF


Applies To

ComboBox, ListBox


See Also

AddItem Method
Clear Method
List Property
ListCount Property
ListItemID Property
MultiSelect Property
NewItemID Property
RemoveItem Method
RemoveListItem Method
Selected Property
TopItemID Property


SelectedItemBackColor, SelectedItemForeColor Properties

Syntax         Settings         Applies To         See Also

Specifies the background or foreground color for the selected item in a combo box or list box. Available at design time and run time.

Syntax

Control.SelectedItemBackColor[ = nColor]

 – Or –

Control.SelectedItemBackColor RGB(nRedValue, nGreenValue, nBlueValue)

Control.SelectedItemForeColor[ = nColor]

 – Or –

Control.SelectedItemForeColor RGB(nRedValue, nGreenValue, nBlueValue)

Settings

nColor   Specifies a single number to represent the color.

Note   In the Properties window, you can double-click any of the color properties to display the Color dialog box. You can choose or define colors from this dialog box. The red, green, and blue intensities that correspond to the color you choose become the settings for these properties after you close the Color dialog box.

For more information, see the color table in the BackColor, ForeColor Properties topic.


Applies To

ComboBox, ListBox


See Also

BackColor
ForeColor Properties
RGB( )
SelectedBackColor
SelectedForeColor Properties


SelectOnEntry Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether text in a column cell, edit box, or text box selected when the user moves to it. Available at design time and run time.

Syntax

Object.SelectOnEntry[ = lExpr]

Settings

The settings for the SelectOnEntry property are:

Setting	Description
True (.T.)	(Default for columns) The text is selected.
False (.F.)	(Default for edit and text boxes) The text isn’t selected
Remarks

If the Highlight property is set to true (.T.), you can use it in conjunction with the SelectOnEntry property to determine if the entire text appears selected. If you set the Highlight property to false (.F.), the SelectOnEntry property is ignored.


Applies To

Column, EditBox Control, TextBox Control


See Also

Highlight Property
HighlightRow Property


SelLength Property

Syntax         Settings         Remarks         Applies To         See Also

Returns the number of characters the user selects in a text-entry area of a control, or specifies the number of characters to select. Not available at design time; read-write at run time.

Syntax

[Form.]Control.SelLength[= nLength]

Settings

nLength   Specifies the number of characters selected. Selected text appears highlighted. The valid range of settings is 0 to the total number of characters in the control. Setting SelLength to less than 0 causes a run-time error.

Remarks

Use this property with the SelStart and SelText properties for tasks such as:

•	Setting the insertion point within a string of characters.

•	Establishing an insertion range that limits where the insertion point can go.

•	Selecting a specific group of characters (substrings) in a control.

•	Clearing text.

When working with these properties, be aware of the following behaviors:

•	Setting SelLength to less than 0 causes a run-time error.

•	Setting SelStart to greater than the text length sets the property to the existing text length. Changing SelStart changes the selection to an insertion point and sets SelLength to 0.

•	Setting SelText to a new value sets SelLength to 0 and replaces the selected text with the new string.


Applies To

ComboBox, EditBox, Spinner, TextBox


See Also

SelStart Property
SelText Property


SelStart Property

Syntax         Settings         Remarks         Applies To         See Also

Returns the starting point of a text selection made by the user in a text-entry area of a control, or indicates the position of the insertion point if no text is selected. Also, specifies the starting point of a text selection in a text-entry area of a control. Not available at design time; read-write at run time.

Syntax

[Form.]Control.SelStart[= nStart]

Settings

nStart   Specifies the starting point of text selected or indicates the position of the insertion point if no text is selected. Selected text appears shaded. The valid range of settings is 0 to the total number of characters in the edit area of the control.

Remarks

Use this property with the SelLength and SelText properties for tasks such as:

•	Setting the insertion point within a string of characters.

•	Establishing an insertion range that limits where the insertion point can go.

•	Selecting a specific group of characters (substrings) in a control.

•	Clearing text.

When working with these properties, be aware of the following behaviors:

•	Setting SelLength to less than 0 causes a run-time error.

•	Setting SelStart to greater than the text length sets the property to the existing text length. Changing SelStart changes the selection to an insertion point and sets SelLength to 0.

•	Setting SelText to a new value sets SelLength to 0 and replaces the selected text with the new string.


Applies To

ComboBox, EditBox, Spinner, TextBox


See Also

SelLength Property
SelText Property


SelText Property

Syntax         Settings         Remarks         Applies To         See Also

Returns the text that the user selected in a text-entry area of a control, or returns an empty string ("") if no characters are selected. Specifies the string containing the selected text. Not available at design time; read-write at run time.

Syntax

[Form.]Control.SelText[= cString]

Settings

cString   Specifies the string containing the selected text or consists of an empty string if no characters are selected. Selected text appears shaded.

Remarks

Use this property with the SelLength and SelStart properties for tasks such as:

•	Setting the insertion point within a string of characters.

•	Establishing an insertion range that limits where the insertion point can go.

•	Selecting a specific group of characters (substrings) in a control.

•	Clearing text.

When working with these properties, be aware of the following behaviors:

•	Setting SelLength to less than 0 causes a run-time error.

•	Setting SelStart to greater than the text length sets the property to the existing text length. Changing SelStart changes the selection to an insertion point and sets SelLength to 0.

•	Setting SelText to a new value sets SelLength to 0 and replaces the selected text with the new string.


Applies To

ComboBox, EditBox, Spinner, TextBox


See Also

SelLength Property
SelStart Property


Separator Object

Syntax         Remarks         Properties         Methods         See Also

Creates a Separator object that places space between controls in a toolbar.

Syntax

Separator

Remarks

Controls in a toobar are placed immediately next to each other unless you include a Separator between the controls. A Separator is a special object that adds space between the controls and creates a group of controls.

For additional information about creating toolbars and separators, see Chapter 11, “Designing Menus and Toolbars,” in the Developer’s Guide.


Properties

BaseClass	Class	ClassLibrary
Enabled	HelpContextID	Name
ParentClass


Methods

SaveAsClass	ZOrder


See Also

CREATE CLASS
CREATE FORM
DEFINE CLASS
Toolbar Object


SetFocus Method

Syntax         Remarks         Applies To         See Also

Assigns the focus to a control.

Syntax

Control.SetFocus

Remarks

You cannot assign the focus to a control if the control’s Enabled or Visible property is set to false (.F.), or the control’s When event returns false (.F.). If the Enabled or Visible property has been set to false (.F.), you must first set it to true (.T.) before the control can receive the focus from the SetFocus method.

Once a control has the focus, any user input is directed to that control.


Applies To

CheckBox, Column, ComboBox, CommandButton, Container Object, Control Object, EditBox, Grid, ListBox, OLE Bound Control, OLE Container Control, OptionButton, Page Object, Spinner, TextBox


See Also

Enabled Property
GotFocus Event
LostFocus Event
Visible Property


SetVar Method

Syntax         Settings         Remarks         Applies To          See Also

Creates a variable and stores a value to the variable for an instance of the Visual FoxPro application automation server.

Syntax

ApplicationObject.SetVar(cVariableName, eValue)

Settings

cVariableName   Specifies the name of the variable to create.

eValue   Specifies the value stored to the variable. If the variable specified with cVariableName already exists, the new value is store to the variable.

Remarks

While the DoCmd method can be used to set a variable to a character value, the SetVar method should be used to set a variable to other data types. For example, a variable can only be set to an object reference with the SetVar method.


Applies To

Application Object, _VFP System Variable


See Also

DoCmd Method, Eval Method, STORE


Shape Control

Syntax         Remarks         Properties         Events         Methods         Example         See Also

Creates a Shape control that displays a box, circle, or ellipse.

Syntax

Shape

Remarks

A Shape control is a graphical control that displays a box, circle, or ellipse that can't be changed directly. However, because a Shape control has a full set of properties, events, and methods that other controls have, the Shape control can respond to events and can be changed dynamically at run time.

The Curvature property determines what shape is displayed and can vary from 0 to 99. 0 specifies no curvature and creates square corners; 99 specifies maximum curvature and creates circles and ellipses.

For additional information about creating shapes, see the Form Designer topic and Chapter 10, “Using Controls,” in the Developer’s Guide.


Properties

BackColor	BackStyle	BaseClass
BorderColor	BorderStyle	BorderWidth
Class	ClassLibrary	ColorScheme
ColorSource	Comment	Curvature
DragIcon	DragMode	DrawMode
Enabled	FillColor	FillStyle
Height	HelpContextID	Left
MousePointer	Name	Parent
ParentClass	SpecialEffect	Tag
ToolTipText	Top	Visible
Width


Events

Click	DblClick	Destroy
DragDrop	DragOver	Error
Init	MiddleClick Event	MouseDown
MouseMove	MouseUp	MouseWheel
RightClick	UIEnable


Methods

CloneObject	Drag	Move
ReadExpression	ReadMethod	SaveAsClass
WriteExpression	WriteMethod	ZOrder


Shape Control Example

The following example demonstrates how the Shape control can be used to display a circle, ellipse, or square on a form.

A form is created, and a set of option buttons and a command button are placed on the form. When you click one of the option buttons, the corresponding shape is displayed on the form. The Visible property is set to true (.T.) to display a shape; it is set to false (.F.) to hide the shape before another shape is displayed. The Height, Width, and Curvature properties of each shape determine the type of shape (circle, ellipse, or square) created.

frmMyForm = CREATEOBJECT('Form')  && Create a Form

frmMyForm.Closable = .F.  && Disable the Control menu box

frmMyForm.AddObject('cmdCommand1','cmdMyCmndBtn')  && Add Command button

frmMyForm.AddObject('opgOptionGroup1','opgMyOptGrp') && Add Option Group

frmMyForm.AddObject('shpCircle1','shpMyCircle')  && Add Circle Shape

frmMyForm.AddObject('shpEllipse1','shpMyEllipse')  && Add Ellipse Shape

frmMyForm.AddObject('shpSquare','shpMySquare')  && Add Box Shape

frmMyForm.cmdCommand1.Visible =.T.  && "Quit" Command button visible

frmMyForm.opgOptionGroup1.Buttons(1).Caption = "\<Circle"

frmMyForm.opgOptionGroup1.Buttons(2).Caption = "\<Ellipse"

frmMyForm.opgOptionGroup1.Buttons(3).Caption = "\<Square"

frmMyForm.opgOptionGroup1.SetAll("Width", 100) && Set Option group width

frmMyForm.opgOptionGroup1.Visible = .T.  && Option Group visible

frmMyForm.opgOptionGroup1.Click  && Show the circle

frmMyForm.SHOW  && Display the form

READ EVENTS  && Start event processing

DEFINE CLASS opgMyOptGrp AS OptionGroup  && Create an Option Group

ButtonCount = 3  && Three Option buttons

Top = 10

Left = 10

Height = 75

Width = 100

PROCEDURE Click

ThisForm.shpCircle1.Visible = .F.  && Hide the circle

ThisForm.shpEllipse1.Visible = .F.  && Hide the ellipse

ThisForm.shpSquare.Visible = .F.  && Hide the square

DO CASE

CASE ThisForm.opgOptionGroup1.Value = 1

ThisForm.shpCircle1.Visible = .T. && Show the circle

CASE ThisForm.opgOptionGroup1.Value = 2

ThisForm.shpEllipse1.Visible = .T.  && Show the ellipse

CASE ThisForm.opgOptionGroup1.Value = 3

ThisForm.shpSquare.Visible = .T.  && Show the square

ENDCASE

ENDDEFINE

DEFINE CLASS cmdMyCmndBtn AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 210  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close Form

ENDDEFINE

DEFINE CLASS shpMyCircle AS Shape  && Create a circle

Top = 10

Left = 200

Width = 100

Height = 100

Curvature = 99

BackColor = RGB(255,0,0)  && Red

ENDDEFINE

DEFINE CLASS shpMyEllipse AS Shape  && Create an ellipse

Top = 35

Left = 200

Width = 100

Height = 50

Curvature = 99

BackColor = RGB(0,128,0)  && Green

ENDDEFINE

DEFINE CLASS shpMySquare AS Shape  && Create a square

Top = 10

Left = 200

Width = 100

Height = 100

Curvature = 0

BackColor = RGB(0,0,255)  && Blue

ENDDEFINE


See Also

CREATE CLASS
CREATE FORM
DEFINE CLASS


_SHELL System Memory Variable
_SHELL System Variable

Syntax         Remarks         See Also

Specifies a program shell.

Syntax

_SHELL = cCommand

Remarks

The _SHELL system memory variable is used to prevent access to the Command window while a program is running in Visual FoxPro. The DO command with the name of a program to execute is usually stored to _SHELL.

You can also specify a command to execute when Visual FoxPro is started by placing the SHELL configuration item in your Visual FoxPro configuration file.

The following example demonstrates how _SHELL typically can be used.

1. A startup program named MYSTART.PRG is used to launch another program named MYAPP.PRG. MYSTART.PRG stores the command to run MYAPP.PRG to _SHELL. This starts MYAPP.PRG. Before Visual FoxPro displays the Command window, _SHELL is checked for a command. If _SHELL contains a command, it is executed and Visual FoxPro then stores the empty string to _SHELL.

2. After the initialization code in MYAPP.PRG is successfully executed, the command to launch MYAPP.PRG is stored again to _SHELL. Visual FoxPro does not execute the command or store the empty string to _SHELL, and access to the Command window is prevented. (The Command window cannot be accessed when _SHELL contains anything but the empty string).

3. Before MYAPP.PRG finishes execution, it stores the empty string to _SHELL to restore access to the Command window.

*** MYSTART.PRG ***

...

_SHELL = "DO MYAPP.PRG"

*** MYAPP.PRG ***

*** Initialization Code ***

...

*** Initialization Code successfully completed? ***

_SHELL = "DO MYAPP.PRG" && Prevents access to Command window

...

*** Clean up Code ***

_SHELL = ""


See Also

DO Command
RUN | !
_STARTUP System Variable


SHOW GET Command

Included for backward compatibility. Use the Refresh method to redisplay a control after changing the control’s properties.


SHOW GETS Command

Included for backward compatibility. Use the Refresh method to redisplay all controls on a form or formset after changing the control’s properties.


SHOW MENU Command

Syntax         Arguments         Remarks         Example         See Also

Displays one or more user-defined menu bars without activating them.

Syntax

SHOW MENU MenuBarName1 [, MenuBarName2 ...] | ALL
[PAD MenuTitleName]
[SAVE]

Arguments

MenuBarName1 [, MenuBarName2 ...]   Specifies the name of one or more menu bars to display.

ALL   Displays all currently defined menu bars.

PAD MenuTitleName   Specifies a menu title to be highlighted on a menu bar.

SAVE   Retains an image of the specified menu bars without activating them. You can clear the menu bar images with CLEAR.

Remarks

The menu bars are displayed but can’t be used. Before they can be displayed, you must first create the menu bars with DEFINE MENU.


SHOW MENU Command Example

CLEAR

DEFINE MENU mnuExample BAR AT LINE 2

DEFINE PAD padConv OF mnuExample PROMPT '\<Conversions' COLOR SCHEME 3 ;

KEY ALT+C, ''

DEFINE PAD padCard OF mnuExample PROMPT 'Card \<Info' COLOR SCHEME 3 ;

KEY ALT+I, ''

SHOW MENU mnuExample


See Also

ACTIVATE MENU
CREATE MENU
DEFINE MENU


Show Method

Syntax         Arguments         Remarks         Applies To         See Also

Displays a form and determines whether the form is modal or modeless.

Syntax

[FormSet.]Object.Show([nStyle])

Arguments

nStyle   Determines how a form is shown. The following values are valid:

Value	Description
1	Modal. No user input (keyboard or mouse) can occur in any other form or in the menu until the modal form is hidden or released. The program must hide or release a modal form (usually in response to some user action) before further user input can occur. Although other forms in your application are disabled when a modal form is displayed, other applications are not.
2	(Default) Modeless. Code that occurs after the Show method is run as it is encountered.
If you omit nStyle, the form is shown in the style specified by the WindowType property.

Remarks

The Show method sets a form or form set’s Visible property to true (.T.) and makes the form the active object. If a form’s Visible property is already set to true (.T.), the Show method makes it the active object.

If a form set is activated, the last active form in the form set also becomes active. If no form is active, the form that was added to the FormSet class definition first is made active.

Forms contained within a form set retain their Visible property setting. If a form’s Visible property is set to false (.F.), the Show method for the form set does not show the form.


Applies To

Form, FormSet, _SCREEN, ToolBar


See Also

Activate Event
Hide Method
Visible Property
WindowType Property


SHOW OBJECT Command

Included for backward compatibility. Use the Refresh method to redisplay a control after changing the control’s properties.


SHOW POPUP Command

Syntax         Arguments         Remarks         See Also

Displays one or more menus defined with DEFINE POPUP without activating them.

Syntax

SHOW POPUP MenuName1 [, MenuName2 ...] | ALL
[SAVE]

Arguments

MenuName1 [, MenuName2 ...]   Specifies the name of one or more menus to display.

ALL   Displays all currently defined menus.

SAVE   Retains an image of the specified menus without activating them. The menu images can be cleared with CLEAR.

Remarks

The menus are displayed but can’t be used. Before they can be shown, the menus must first be created with DEFINE POPUP.


See Also

ACTIVATE POPUP
DEFINE POPUP


SHOW WINDOW Command

Syntax         Arguments         Remarks         Example         See Also

Displays one or more user-defined windows or Visual FoxPro system windows without activating them.

Syntax

SHOW WINDOW WindowName1 [, WindowName2 ...] | ALL | SCREEN
[IN [WINDOW] WindowName3]
[REFRESH]
[TOP | BOTTOM | SAME]
[SAVE]

Arguments

WindowName1 [, WindowName2 ...]   Specifies the name of one or more windows to display.

ALL   Displays all user-defined windows.

SCREEN   Displays the main Visual FoxPro window when it is hidden. You can also choose Screen from the Window menu to display the main Visual FoxPro window. You can hide the main Visual FoxPro window by clicking its close box or issuing DEACTIVATE WINDOW SCREEN, HIDE WINDOW SCREEN, or RELEASE WINDOW SCREEN.

IN [WINDOW] WindowName3   Displays the window inside a parent window specified with WindowName3. The window doesn’t assume the characteristics of the parent window. A window displayed inside a parent window can’t be moved outside the parent window. If the parent window is moved, the child window moves with it.

The parent window specified with WindowName3 must first be created with DEFINE WINDOW.

IN SCREEN   Explicitly displays the window in the main Visual FoxPro window instead of in another window. Windows are placed in the main Visual FoxPro window by default.

REFRESH   Redraws a Browse window. This option is useful on a network to ensure that you are browsing the most current version of a table. The work area for the Browse window table is selected.

Memo-editing windows are refreshed with changes made to the memo field by other users on a network. SET REFRESH determines the interval between memo-editing-window refreshes. Refer to SET REFRESH for additional information on how data is refreshed in tables opened for shared use on a network.

TOP   Places the specified window in front of all other windows.

BOTTOM   Places the specified window behind all other windows.

SAME   Places the specified window back into a stack of windows in the same position the window occupied before it was deactivated. SAME affects only windows that have been previously displayed or activated and then cleared from the main Visual FoxPro window with DEACTIVATE WINDOW.

SAVE   Keeps an image of the window in the main Visual FoxPro window or in another window after the window is released. Normally, windows are removed from the main Visual FoxPro window after they are released. The window image can be cleared from the main Visual FoxPro window or a window with CLEAR.

Remarks

SHOW WINDOW controls the display and front-to-back screen placement of windows. If a window is hidden or hasn’t been activated, SHOW WINDOW displays the window without activating it. If one or more windows are currently displayed, SHOW WINDOW lets you change the front-to-back order of the windows.

You can also display system windows, such as the Command window.

In Visual FoxPro, you can use SHOW WINDOW to display the Visual FoxPro toolbars. Use HIDE WINDOW to remove a toolbar from the FoxPro window. Toolbars must be active before they can be displayed. The following table lists the Visual FoxPro toolbars names to use in SHOW WINDOW and HIDE WINDOW. Enclose the toolbar name in quotation marks.

Toolbar Names
Color Palette	Layout	Report Designer
Database Designer	Print Preview	Standard
Form Controls	Query Designer	View Designer
Form Designer	Report Controls
To show a system window, enclose the entire system window name in quotation marks.

You can’t specify where output is directed to user-defined windows with SHOW WINDOW. Use ACTIVATE WINDOW to direct output to a user-defined window created with DEFINE WINDOW.


SHOW WINDOW Command Example

The following example, a window named wOutput1 is created and displayed. Since SHOW WINDOW is used to display the window, output can’t be directed to the window until it is activated.

CLEAR

DEFINE WINDOW wOutput1 FROM 2,1 TO 13,75 TITLE 'Output' ;

CLOSE FLOAT GROW SHADOW ZOOM

SHOW WINDOW wOutput1


See Also

ACTIVATE WINDOW, DEFINE WINDOW


ShowTips Property

Syntax         Settings         Remarks         Applies To         See Also

Determines whether ToolTips are shown for the controls on the specified Form object or the specified ToolBar object. Available at design time and run time.

Syntax

Object.ShowTips = lExpr

Settings

lExpr   Determines whether ToolTips are shown for the specified control. The settings for the ShowTips property are:

Setting	Description
True (.T.)	(Default for the ToolBar object) ToolTips are displayed when a user places the mouse on a control.
False (.F.)	(Default for the Form object) ToolTips are not displayed when a user places the mouse on a control.
Remarks

You can specify the text that appears in each ToolTip using the ToolTipText property.


Applies To

Form, _SCREEN, ToolBar


See Also

ToolTipText Property


ShowWhatsThis Method

Syntax         Settings         Remarks         Applies To          See Also

Displays the Whats This Help topic specified for an object with the WhatsThisHelpID property.

Syntax

Object.ShowWhatsThis

Settings

Object Specifies the object for which the Whats This Help topic is displayed.

Remarks

The ShowWhatsThis method is automatically called when the F1 key is pressed. If the WhatsThisHelp property is set to true (.T.), the Whats This Help topic for the object, specified with the WhatsThisHelpID property, is displayed. If the WhatsThisHelp property is set to false (.F.), the Help topic for the object, specified with the HelpContextID property, is displayed.


Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, EditBox, Form, Grid, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, Shape, Spinner, TextBox, Timer, ToolBar


See Also

WhatsThisButton Property, WhatsThisMode Method, WhatsThisHelp Property, WhatsThisHelpID Property


ShowWindow Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether a form or toolbar is a top-level form or a child form. Available at design time; read-only at run time.

Syntax

Form.ShowWindow[ = nExpr]

Settings

nExpr   The settings for the ShowWindow property are:

Setting	Description
0	In Screen (Default). The form is a child form that is placed in the main Visual FoxPro window.
1	In Top-Level Form. The form is a child form of the active top-level form, which can be the main Visual FoxPro window or another top-level form. Use this setting if you want the child form to be placed inside the active top-level form. If nExpr is set to 1 when the top-level form is the main Visual FoxPro window, Visual FoxPro automatically resets nExpr to 0.
2	As Top-Level Form. The form is a top-level form in which child forms can be placed. Note that a top-level form is always modeless, regardless of the WindowType property setting.
Remarks

A child form is a form contained within another form. Child forms cannot be moved outside the bounds of their parent form; when minimized, they appear at the bottom of their parent form. If a parent form is minimized, the child forms are also minimized.

A top-level form is an independent, modeless form without a parent form, and is used to create an SDI (single document interface) application or to serve as the parent for other child forms. Top-level forms work at the same level as other Windows applications, and can appear in front of or behind them. Top-level forms appear on the Windows taskbar.

The Desktop property determines the behavior of a child form. If the Desktop property is set to true (.T.) the child form is not constrained to the borders of its parent form and can be moved anywhere on the Windows desktop. The child form doesn’t appear in the Windows taskbar.


Applies To

Form, ToolBar


See Also

ACTIVATE WINDOW, Desktop Property


SET Command

Syntax         Remarks         See Also

Opens the Data Session window.

Syntax

SET

Remarks

The Data Session window provides an easy way to open tables, establish relations, or set or change many Visual FoxPro options.


See Also

SET VIEW


SET ALTERNATE Command

Syntax         Arguments         See Also

Directs screen or printer output created with ?, ??, DISPLAY, or LIST to a text file.

Syntax

SET ALTERNATE ON | OFF
 – Or –

SET ALTERNATE TO [FileName [ADDITIVE]]

Arguments

ON   Directs output to the text file.

OFF   (Default) Disables output to the text file.

TO FileName   Creates the text file, which is assigned the default extension .TXT unless you include a different extension with the file name.

If you use SET ALTERNATE TO without FileName, the last file you created using SET ALTERNATE TO FileName is closed.

ADDITIVE   Appends output to the end of the file specified with FileName. If you omit ADDITIVE, the contents of the file are overwritten.


See Also

CLOSE
SET PRINTER


SET ANSI Command

Syntax         Arguments         Remarks         See Also

Determines how comparisons between strings of different lengths are made with the = operator in Visual FoxPro SQL commands.

Syntax

SET ANSI ON | OFF

Arguments

ON   Pads the shorter string with the blanks needed to make it equal to the longer string’s length. The two strings are then compared character for character for their entire lengths. Consider this comparison:

'Tommy' = 'Tom'

The result is false (.F.) if SET ANSI is on because when padded, ‘Tom’ becomes ‘Tom  ’ and the strings ‘Tom  ’ and ‘Tommy’ don’t match character for character.

The == operator uses this method for comparisons in Visual FoxPro SQL commands.

OFF   Specifies that the shorter string not be padded with blanks. The two strings are compared character for character until the end of the shorter string is reached. Consider this comparison:

'Tommy' = 'Tom'

The result is true (.T.) when SET ANSI is off because the comparison stops after ‘Tom’.

Remarks

SET ANSI determines whether the shorter of two strings is padded with blanks when a SQL string comparison is made. SET ANSI has no effect on the == operator; when you use the == operator, the shorter string is always padded with blanks for the comparison.

SET ANSI is scoped to the current data session.

SET ANSI and the Query Designer   Visual FoxPro builds a SELECT  -  SQL command in the Query Designer when you create a query. When creating Join and Filter conditions, if you choose the Equal or Exactly Like options, the = or == operator is included in the generated SELECT. The SET ANSI setting can affect the results of queries you create and perform in the Query Designer.

String Order   In SQL commands, the left-to-right order of the two strings in a comparison is irrelevant—switching a string from one side of the = or == operator to the other doesn’t affect the result of the comparison.


See Also

CREATE QUERY
MODIFY QUERY
SELECT - SQL
SET DATASESSION
SET EXACT


SET ASSERTS Command

Syntax         Arguments         Remarks         See Also

Specifies if ASSERT commands are evaluated or ignored.

Syntax

SET ASSERTS ON | OFF

Arguments

ON   Specifies that Visual FoxPro executes ASSERT commands.

OFF   Specifies that Visual FoxPro ignores ASSERT commands.

Remarks

ASSERTS is set to OFF if you choose the Ignore All button in the message box following an assert.


See Also

ASSERT


SET AUTOSAVE Command

Syntax         Arguments         Remarks         See Also

Determines whether Visual FoxPro flushes data buffers to disk when you exit a READ or return to the Command window.

Syntax

SET AUTOSAVE ON | OFF

Arguments

ON   Specifies that buffers be flushed to disk whenever you exit a READ or return to the Command window.

OFF   Specifies that buffers be flushed to disk only if five minutes have elapsed since the last flush occurred, and only when you exit a READ or return to the Command window.

OFF is the default for SET AUTOSAVE.

Remarks

Flushing buffers may reduce the chance of data loss if your computer loses power.

SET AUTOSAVE is scoped to the current data session.


See Also

FFLUSH( )
FLUSH
SET DATASESSION


SET BELL Command

Syntax         Arguments         Remarks         Example

Turns the computer bell on or off and sets the bell attributes.

Syntax

SET BELL ON | OFF
 – Or –
SET BELL TO [cWAVFileName, nDuration]

Arguments

ON   (Default) Turns the bell on.

OFF   Turns the bell off.

TO cWAVFileName, nDuration   In Visual FoxPro, you can specify a waveform sound or system alert sound to play when the bell is rung.

cWAVFileName specifies the waveform sound to play. cWAVFileName can be a waveform sound file name or an entry from the sounds section of your WIN.INI file. If the sound cannot be found, Visual FoxPro plays the default sound specified by the SystemDefault entry in the sounds section of your WIN.INI file. Visual FoxPro plays no sound if the default sound cannot be located or if there isn’t a SystemDefault entry.

If you specify a waveform or system alert sound, you must also include nDuration. A syntax error occurs if you omit the duration value. The duration value you specify is ignored and the entire waveform or system alert sound is played.

Remarks

SET BELL enables or disables the sounding of the bell during editing when you reach the end of a field or enter invalid data.


SET BELL Command Example

In the following example, the waveform sound file DING.WAV is played.

SET BELL TO 'C:\WINDOWS\DING.WAV', 0

?? CHR(7)


SET BLOCKSIZE Command

Syntax         Arguments         Remarks         See Also

Specifies how Visual FoxPro allocates disk space for the storage of memo fields.

Syntax

SET BLOCKSIZE TO nBytes

Arguments

nBytes   Specifies the block size in which disk space for memo fields is allocated. If nBytes is 0, disk space is allocated in single bytes (blocks of 1 byte). If nBytes is an integer between 1 and 32, disk space is allocated in blocks of nBytes bytes multiplied by 512. If nBytes is greater than 32, disk space is allocated in blocks of nBytes bytes.

If you specify a block size value greater than 32, you can save substantial disk space.

Remarks

The default value for SET BLOCKSIZE is 64. To reset the block size to a different value after the file has been created, set it to a new value and then use COPY to create a new table. The new table has the specified block size.

SET BLOCKSIZE is scoped to the current data session.


See Also

COPY FILE
MODIFY STRUCTURE
PACK
SET DATASESSION


SET BORDER Command

Included for backward compatibility. Use the BorderStyle Property instead.


SET BRSTATUS Command

Included for backward compatibility. Use the StatusBarText Property instead.


SET CARRY Command

Syntax         Arguments         Remarks         See Also

Determines whether Visual FoxPro carries data forward from the current record to a new record created with INSERT, APPEND, and BROWSE.

Syntax

SET CARRY ON | OFF
 – Or –
SET CARRY TO [FieldList [ADDITIVE]]

Arguments

ON   Brings data from all fields in all work areas forward from the current record to a new record.

OFF   (Default) Prevents data from all fields from being passed to a new record.

TO [FieldList [ADDITIVE]]   FieldList specifies the fields from which data is carried forward. Separate the field names with commas.

ADDITIVE specifies that the fields in the field list be added to the current set of fields being carried forward.

Issuing SET CARRY TO implicitly performs SET CARRY ON.

Use SET CARRY TO without FieldList to restore the default setting (all fields are carried forward).

Remarks

Use SET CARRY to enable data to be carried forward from the current record to a new record or to prevent data from being carried forward. Fields that generally remain unchanged during an editing session can be brought forward for each new record. For example, a field containing the current date can be brought forward for each new record so a new date doesn’t have to be entered again. Note that the contents of General type fields are not carried forward.

SET CARRY affects only the table open in the currently selected work area.

SET CARRY is scoped to the current data session.


See Also

INSERT
SET DATASESSION


SET CENTURY Command

Syntax         Arguments         Remarks         See Also

Determines whether Visual FoxPro displays the century portion of date expressions.

 Syntax

SET CENTURY ON | OFF | TO [nCentury [ROLLOVER nYear]]

 Arguments

ON   Specifies a four-digit year in a format that includes 10 characters (including date delimiters).

OFF   (Default) Specifies a two-digit year in a format that includes eight characters and assumes the twentieth century for date calculations.

TO nCentury   A number from 1 to 99 that specifies the current century. When a date has a two digit year, nCentury determines in which century the year occurs.

Issue SET CENTURY TO without any additional arguments to restore the default current century.

SET CENTURY ON

SET CENTURY TO 19

? {02/16/56}	&& Displays 02/16/1956

SET CENTURY TO 20

? {02/16/56}	&& Displays 02/16/2056

ROLLOVER nYear   A number from 0 to 99 that specifies the year above which is the current century and below which is the next century.

Issue SET CENTURY TO without any additional arguments to restore the default century rollover year to 0.

SET CENTURY ON

SET CENTURY TO 19 ROLLOVER 60

? {02/16/96}	&& Displays 02/16/1996

? {02/16/56}	&& Displays 02/16/2056

 Remarks

Use SET CENTURY to specify how date variables and functions are displayed.

SET CENTURY is scoped to the current data session.


 See Also

DATE( )
SET DATASESSION
SET SYSFORMATS
YEAR( )


SET CLASSLIB Command

Syntax         Arguments         Remarks         Example         See Also

Opens a .VCX visual class library containing class definitions.

 Syntax

SET CLASSLIB TO ClassLibraryName [IN APPFileName | EXEFileName]
[ADDITIVE] [ALIAS AliasName]

 Arguments

TO ClassLibraryName   Specifies the name of the .VCX visual class library to open. If ClassLibraryName does not include a fully qualified path, Visual FoxPro first searches for the visual class library in the default Visual FoxPro directory, and then in the directories in the Visual FoxPro path. The default Visual FoxPro directory is specified with SET DEFAULT, and the Visual FoxPro search path is specified with SET PATH.

Issuing SET CLASSLIB TO without ClassLibraryName closes all open visual class libraries. Use RELEASE CLASSLIB to close an individual visual class library.

IN APPFileName | EXEFileName   Specifies a Visual FoxPro application file (.APP) or executable file (.EXE) containing the visual class library.

ADDITIVE   Opens the .VCX visual class library without closing any currently open .VCX visual class libraries. If this clause is omitted, all open .VCX visual class libraries are closed.

ALIAS AliasName   Specifies an alias for the visual class library. The visual class library can be referenced by its alias. For example, the following commands open a .VCX visual class library named MyClass, assign it the alias MyCntrls, and then create a control named MyButton.

SET CLASSLIB TO MyClass ALIAS MyCntrls

mMyButton = CREATEOBJ('MyCntrls.MyButton')

 Remarks

When CREATEOBJECT( ), ADD OBJECT in DEFINE CLASS, or the AddObject method is issued, Visual FoxPro searches for the class definition defining the object specified in these commands in the following locations and order:

1.	The Visual FoxPro base classes.

2.	Class definitions in memory in the order they are loaded.

3.	Class definitions in the current program.

4.	Class definitions in the .VCX class libraries opened with SET CLASSLIB.

5.	Class definitions in procedure files opened with SET PROCEDURE.

6.	Class definitions in the Visual FoxPro program execution chain.

7.	The OLE Registry if SET OLEOBJECT is set to ON.

If the class definition containing the object cannot be located, Visual FoxPro generates an error message.


 SET CLASSLIB Command Example

The following example uses CREATE CLASSLIB to create a visual class library named myclslib. A class named myform based on the Visual FoxPro Form base class is created and is stored in the myclslib visual class library. SET CLASSLIB is used to open the myclslib visual class library so that classes within it can be used.

CREATE CLASSLIB myclslib  	&& Creates a new .VCX visual class library

CREATE CLASS myform OF myclslib AS "Form"  && Creates new class

SET CLASSLIB TO myclslib ADDITIVE 	 && Opens MyClsLib.VCX


 See Also

ADD CLASS
AddObject Method
CREATE CLASS
CREATE CLASSLIB
CREATEOBJECT( )
MODIFY CLASS
RELEASE CLASSLIB
SET PROCEDURE
SET OLEOBJECT


SET CLEAR Command

Included for backward compatibility. Use the Refresh Method instead.


SET CLOCK Command

Syntax         Arguments         See Also

Determines whether Visual FoxPro displays the system clock and specifies the clock location on the main Visual FoxPro window.

 Syntax

SET CLOCK ON | OFF | STATUS
 – Or –
SET CLOCK TO [nRow, nColumn]

 Arguments

ON   Displays the clock in the upper-right corner of the main Visual FoxPro window.

OFF   (Default) Removes the clock from the status bar or from the main Visual FoxPro window.

STATUS   Displays the clock in the graphical status bar. Issue SET STATUS BAR ON to display the graphical status bar.

TO [nRow, nColumn]   Using row and column coordinates, specifies where the clock is displayed in the main Visual FoxPro window. Use SET CLOCK TO without the coordinates to display the clock in its default position in the upper-right corner of the main Visual FoxPro window.

If you place the clock in the graphical status bar with SET CLOCK STATUS and you specify a location in the main Visual FoxPro window with TO nRow, nColumn, Visual FoxPro removes the clock from the graphical status bar and places it at the location you specify.


 See Also

SET BRSTATUS
SET HOURS
SET STATUS


SET COLLATE Command

Syntax         Arguments         Remarks         See Also

Specifies a collation sequence for character fields in subsequent indexing and sorting operations.

 Syntax

SET COLLATE TO cSequenceName

 Arguments

cSequenceName   Specifies a collation sequence. The following collation sequence options are available.

Options	Language
DUTCH	Dutch
GENERAL	English, French, German, Modern Spanish, Portuguese, and other Western European languages
GERMAN	German phone book order (DIN)
ICELAND	Icelandic
MACHINE	Machine (the default collation sequence for earlier FoxPro versions)
NORDAN	Norwegian, Danish
SPANISH	Traditional Spanish
SWEFIN	Swedish, Finnish
UNIQWT	Unique Weight
Note   When you specify the SPANISH option, “ch” is a single letter that sorts between “c” and “d”, and “ll” sorts between “l” and “m”.

If you specify a collation sequence option as a literal character string, be sure to enclose the option in quotation marks:

SET COLLATE TO "SWEFIN"

MACHINE is the default collation sequence option and is the sequence Xbase users are familiar with. Characters are ordered as they appear in the current code page.

GENERAL may be preferable for U.S. and Western European users. Characters are ordered as they appear in the current code page. In FoxPro versions earlier than 2.5, you may have used UPPER( ) or LOWER( ) on character fields when you created indexes. In FoxPro versions later than 2.5, you can instead specify the GENERAL collation sequence option and omit the UPPER( ) conversion.

If you specify a collation sequence option other than MACHINE and if you create an .IDX file, a compact .IDX is always created.

Use SET(“COLLATE”) to return the current collation sequence.

If you include the following line in your Visual FoxPro configuration file, a collation sequence is specified when you start Visual FoxPro:

COLLATE = cSequenceName

This is identical to issuing the following command:

SET COLLATE TO cSequenceName

 Remarks

SET COLLATE enables you to order tables containing accented characters for any of the supported languages. Changing the setting of SET COLLATE doesn’t affect the collating sequence of previously opened indexes. Visual FoxPro automatically maintains existing indexes, providing the flexibility to create many different types of indexes, even for the same field.

For example, if an index is created with SET COLLATE set to GENERAL, and the SET COLLATE setting is later changed to SPANISH, the index retains the GENERAL collation sequence.

SET COLLATE is scoped to the current data session.

For additional information on code pages and Visual FoxPro’s international support, see Code Pages Supported by Visual FoxPro, and Chapter 18, “Developing International Applications,” in the Developer’s Guide.

For more information on configuring Visual FoxPro, see Chapter 3, “Configuring Visual FoxPro,” in the Installation Guide and Master Index.


 See Also

IDXCOLLATE( )
SET DATASESSION


SET COLOR OF Command

Included for backward compatibility. Use SET COLOR OF SCHEME instead.


SET COLOR OF SCHEME Command

Syntax         Arguments         Remarks         See Also

Specifies the colors of a color scheme or copies one color scheme to another color scheme.

 Syntax

SET COLOR OF SCHEME nScheme1 TO
[SCHEME nScheme2 | ColorPairList]

 Arguments

nScheme1   Specifies the number of the color scheme you want to change. This can be a value from 1 through 24.

Note   In Visual FoxPro, color schemes 13 through 15 are reserved for internal use. Do not use these color schemes.

TO [SCHEME nScheme2]   Specifies the number of a color scheme to which color scheme nScheme1 is changed.

TO [ColorPairList]   Specifies up to 10 color pairs you would like to change in your color scheme. You can selectively change colors in a color scheme by including a comma for each color pair that you don’t want to change. For example, to change the third color pair in color scheme 1 to bright white and blue and leave the rest of the color settings unchanged, use this command:

SET COLOR OF SCHEME 1 TO , , W+/B*

A color pair can also be specified with a set of six RGB (red, green, and blue) color values separated by commas. To change the third color pair in color scheme 1 to bright white and blue and leave the rest of the color settings unchanged, you can use this command:

SET COLOR OF SCHEME 1 TO , , RGB(255,255,255,0,0,255)

 Remarks

Not all interface elements can be controlled by color schemes — system windows, such as the View and Command windows, the system menu bar, and so on are always controlled by the Control Panel color settings. Issuing SET COLOR OF SCHEME nScheme1 TO without including an optional clause restores the colors from the current color scheme.

For more information about color sets and color schemes, see the Colors Overview topic.


 See Also

Colors Overview
CREATE COLOR SET
SET COLOR SET


SET COLOR SET Command

Syntax         Arguments         Remarks         See Also

Loads a previously defined color set.

 Syntax

SET COLOR SET TO [ColorSetName]

 Arguments

ColorSetName   Specifies the color set to load.

 Remarks

You can create color sets with SET COLOR OF SCHEME and save them with CREATE COLOR SET.

If you issue SET COLOR SET without an optional clause, the current color set remains loaded.

For more information about color sets, see the Colors Overview topic.


 See Also

Colors Overview
CREATE COLOR SET
SET COLOR OF SCHEME


SET COLOR TO Command

Included for backward compatibility. Use SET COLOR OF SCHEME instead.


SET COMPATIBLE Command

Syntax         Arguments         Remarks         See Also

Controls compatibility with FoxBASE+ and other Xbase languages.

Syntax

SET COMPATIBLE FOXPLUS | OFF | DB4 | ON
[PROMPT | NOPROMPT]

Arguments

FOXPLUS | OFF   (Default) These two keywords can be used interchangeably. Each allows programs created in FoxBASE+ to run in Visual FoxPro without changes.

DB4 | ON   Including either keyword affects the behavior of some commands and functions.

PROMPT | NOPROMPT   These options determine whether Visual FoxPro displays a dialog box when you open a dBASE table containing a memo field.

Include the PROMPT option to display the Convert Memos dialog box. If you open a dBASE table containing a memo field, Visual FoxPro by default displays the Convert Memos dialog box, which enables you to convert the dBASE memo file to a Visual FoxPro format. You must convert the memo file to a Visual FoxPro format to open the table in Visual FoxPro. You can later convert the memo file to a dBASE format by including the TYPE FOXPLUS option in the COPY command.

If you include NOPROMPT, the Convert Memos dialog box is not displayed when you open a dBASE table containing a memo field. The dBASE memo file is automatically converted to a Visual FoxPro format.

Remarks

Commands and functions affected by SET COMPATIBLE include LIKE( ), PLAY MACRO, SELECT( ), and STORE (when STORE is used with arrays).

SET COMPATIBLE doesn’t create compatibility with other Xbase commands, functions, or features not supported in Visual FoxPro. For example, it doesn’t allow you to open a report form created in other Xbase products with the Report Designer.

The following table lists the commands affected by SET COMPATIBLE.

Commands
@ ... GET with a RANGE clause	READ with an @ ... GET VALID clause
@ ... SAY with CHR(7)	Nested READs
@ ... SAY scrolling	READ
@ ... SAY when STATUS is ON	RUN | !
ACTIVATE SCREEN	SET COLOR TO
ACTIVATE WINDOW	SET BORDER
APPEND MEMO	SET FIELDS
DECLARE	SET MESSAGE
DIMENSION	SET MEMOWIDTH
GO | GOTO with SET TALK ON	SET PRINTER TO <file>
FSIZE( )	STORE
INKEY( )	SUM
LASTKEY( )	TRANSFORM( ) with a numeric PICTURE clause
LIKE( )	SELECT( )
Menu commands	SYS(2001, "COLOR")
PLAY MACRO


See Also

SET KEYCOMP


SET CONFIRM Command

Syntax         Arguments         Remarks         See Also

Specifies whether the user can exit a text box by typing past the last character in the text box.

Syntax

SET CONFIRM ON | OFF

Arguments

ON   Specifies that thte user cannot exit a text box by typing past the last character in the text box. To exit the text box, the user can press ENTER, TAB, or any of the arrow keys to move from a text box to another control.

SET CONFIRM ON also affects menu items and menu titles created with DEFINE BAR and DEFINE PAD. If the user types the first letter of the menu item or menu title, the item or title is selected but is not chosen. To choose the menu item or title when it is selected, the user should press ENTER or the SPACEBAR.

OFF   Specifies that the user can exit a text box by typing past the last character in the text box. The insertion point, when it reaches the last character in a text box, moves to the next control, and the bell is sounded (if SET BELL is set to ON).

OFF is the default value of SET CONFIRM.

SET CONFIRM OFF also affects menu items and menu titles. If SET CONFIRM is set to OFF, the user can choose an item from a menu or a menu title in a menu bar by pressing the key corresponding to the first letter of the menu item or title. (When SET CONFIRM is set to ON, this action only selects the menu item or title.)

Remarks

SET CONFIRM has no effect on access keys for menu items and menu titles. If a menu item or menu title is created with an access key, the menu item or title can be chosen by pressing the corresponding access key.

You can create text boxes using the Form Designer.

SET CONFIRM is scoped to the current data session.


See Also

TextBox Control
SET DATASESSION


SET CONSOLE Command

Syntax         Arguments         Remarks         See Also

Enables or disables output to the main Visual FoxPro window or to the active user-defined window from within programs.

Syntax

SET CONSOLE ON | OFF

Arguments

ON   (Default) Sends all output to the main Visual FoxPro window or to the active user-defined window.

OFF   Suppresses output to the main Visual FoxPro window or to the active user-defined window.

Remarks

SET CONSOLE is set to ON when you are using Visual FoxPro interactively, and it cannot be changed to OFF from the Command window. You can change the setting to OFF only from within a program.

SET CONSOLE affects some interactive Visual FoxPro dialog boxes. For example, if SET CONSOLE is set to OFF and you issue BROWSE when no table is open, Visual FoxPro displays an error message. If SET CONSOLE is set to ON in the same circumstances, Visual FoxPro displays the Open dialog box.

SET CONSOLE doesn’t affect output from @ ... SAY. Output from @ ... SAY is controlled by the SET DEVICE setting.

Important     An error always sets SET CONSOLE to ON. Use SYS(100) to check the SET CONSOLE setting before the error occurred. For more information, see SYS(100) - Console Setting.


See Also

SYS( )


SET COVERAGE Command

Syntax         Arguments         Remarks          See Also

Turns code coverage on or off or specifies a text file to which code coverage information is directed.

Syntax

SET COVERAGE TO [FileName [ADDITIVE]]

Arguments

TO FileName   Specifies the name of a text file to which code coverage information is directed. Issue SET COVERAGE TO without a file name to close the text file.

If the file you specify doesn't exist, Visual FoxPro automatically creates and opens it.

ADDITIVE   Appends the code coverage information to the end of the text file specified with FileName. If you omit ADDITIVE, the code coverage information replaces the contents of the text file.

Remarks

You can also set code coverage options in the Coverage dialog box.


See Also

_COVERAGE, SET EVENTTRACKING


SET CPCOMPILE Command

Syntax         Arguments         Remarks         See Also

Specifies the code page for compiled programs.

Syntax

SET CPCOMPILE TO [nCodePage]

Arguments

nCodePage   Specifies the compilation code page with nCodePage.

For additional information on code pages and Visual FoxPro’s international support, see Code Pages Supported by Visual FoxPro, and Chapter 18, “Developing International Applications,” in the Developer’s Guide.

Issue SET CPCOMPILE TO without nCodePage to reset the compilation code page to the current code page. Use CPCURRENT( ) to determine the current code page.

Remarks

Use SET CPCOMPILE to compile programs for a specific code page. The code page you specify with SET CPCOMPILE is used for programs compiled automatically by Visual FoxPro, programs compiled from the Compile dialog, and programs compiled with the COMPILE command. However, you can include the AS clause in the COMPILE command to override the code page you specify with SET CPCOMPILE.


See Also

COMPILE
CPCURRENT( )


SET CPDIALOG Command

Syntax         Arguments         Remarks         See Also

Specifies whether the Code Page dialog box is displayed when a table is opened.

Syntax

SET CPDIALOG ON | OFF

Arguments

ON   (Default) Displays the Code Page dialog box when you open a table and the following conditions are true:

•	The table is opened exclusively.

•	The table is not marked with a code page.

OFF   Does not display the Code Page dialog box when a table is opened.

Remarks

The Code Page dialog box allows you to specify a code page for tables created in earlier FoxPro versions and other products that create Visual FoxPro tables. The table is marked with the code page you choose.

When creating an application, issue SET CPDIALOG ON to ensure that the tables included in your application are marked with the proper code page. In your completed application, be sure that SET CPDIALOG is OFF.

You can also interactively specify whether the Code Page dialog box is displayed with the Prompt for Code Page check box in the Data tab of the Options dialog box. The Options dialog box is displayed by choosing Options from the Tools menu.

For additional information on code pages and Visual FoxPro’s international support, see Code Pages Supported by Visual FoxPro, and Chapter 18, “Developing International Applications,” in the Developer’s Guide.


See Also

CPCURRENT( )
CPCONVERT( )
CPDBF( )
GETCP( )
USE


SET CURRENCY Command

Syntax         Arguments         Example         See Also

Defines the currency symbol and specifies its position in the display of numeric, currency, float, and double expressions.

Syntax

SET CURRENCY TO [cCurrencySymbol]
 – Or –
SET CURRENCY LEFT | RIGHT

Arguments

cCurrencySymbol   Specifies a character string representing the currency symbol; can be one to nine characters long. Issue SET CURRENCY TO without cCurrencySymbol to reset the currency symbol to the default dollar sign ($).

LEFT   (Default) Positions the currency symbol to the left of the currency value.

RIGHT   Positions the currency symbol to the right of the currency value.

Remarks

The currency symbol is displayed in output created with @ ... SAY and in text boxes created with @ ... GET when the $ code is included in the FUNCTION or PICTURE clause.

SET CURRENCY is scoped to the current data session.


SET CURRENCY Command Example

The following example displays the DM currency symbol on either side of the currency value. If you use PICTURE to display the currency symbol, be sure to include @ before the dollar sign.

STORE SET('CURRENCY') TO gcCurrPosit

STORE 1234.56 TO gnDollarAmnt

CLEAR

SET CURRENCY TO 'DM'

@ 2,2 SAY gnDollarAmnt PICTURE '@$99,999.99'

IF gcCurrPosit = 'LEFT'

SET CURRENCY RIGHT

ELSE

SET CURRENCY LEFT

ENDIF

@ 4,2 SAY gnDollarAmnt FUNCTION '$99,999.99'


See Also

SET DATASESSION
SET DECIMALS
SET SEPARATOR
SET SYSFORMATS


SET CURSOR Command

Syntax         Arguments         Remarks         See Also

Determines whether the insertion point is displayed when Visual FoxPro waits for input.

Syntax

SET CURSOR ON | OFF

Arguments

ON   (Default) Causes the insertion point to be displayed during a pending @ ... GET, @ ... EDIT, WAIT, or INKEY( ).

OFF   Prevents the insertion point from being displayed during a pending @ ... GET, @ ... EDIT, WAIT, or INKEY( ).

Remarks

SET CURSOR, similar to SYS(2002), enables you to turn the insertion point on or off.


See Also

INKEY( )
SET( )
SYS(2002) - Turn Insertion Point On or Off
WAIT


SET DATABASE Command

Syntax         Arguments         Example         See Also

Specifies the current database.

Syntax

SET DATABASE TO [DatabaseName]

Arguments

DatabaseName   Specifies the name of an open database to be made the current database. If you omit DatabaseName, no open database is made the current database.

Remarks

Many databases can be open at the same time, but only one can be the current database. Commands and functions that manipulate open databases, such as ADD TABLE and DBC( ), operate on the current database.

The current database can also be specified by choosing an open database from the Database drop-down list on the Standard toolbar.

Visual FoxPro may automatically open databases when a query or a Form is executed.

SET DATABASE is scoped to the current data session.


SET DATABASE Command Example

The following example creates two databases named mydbc1 and mydbc2, and a table named table1. SET DATABASE is used to make mydbc1 the current database, and table1 is added to mydbc1 when it is created. The table is then closed and removed from mydbc1.  SET DATABASE is used to make mydbc1 the current database, and ADD TABLE is then used to add the table to mydbc2. RENAME TABLE is used to change the name of the table from table1 to table2.

CREATE DATABASE mydbc1

CREATE DATABASE mydbc2

SET DATABASE TO mydbc1

CREATE TABLE table1 (cField1 C(10), n N(10))  && Adds table to mydbc1

CLOSE TABLES	  && A table must be closed to remove it from a database

REMOVE TABLE table1

SET DATABASE TO mydbc2

ADD TABLE table1

RENAME TABLE table1 TO table2


See Also

ADD TABLE
CLOSE DATABASES
DBC( )
DBGETPROP( )
DBSETPROP( )
DELETE DATABASE
DISPLAY TABLES
MODIFY DATABASE
OPEN DATABASE
REMOVE TABLE
SET DATASESSION


SET DATASESSION Command

Syntax         Arguments         Remarks         See Also

Activates the specified form’s data session.

Syntax

SET DATASESSION TO [nDataSessionNumber]

Arguments

nDataSessionNumber   Specifies a form’s data session to activate. If you omit nDataSessionNumber, data session 1 (the Global data session) is activated.

Remarks

By default, data session 1, the Global data session, is active when you start Visual FoxPro.

A form’s DataSession property determines whether the form has its own unique data session when the form is created. If a form’s DataSession property is set to true (.T.), the form has its own data session, otherwise, a data session is not created for the form. You can use the form’s read-only DataSessionId property to determine the form’s data session number.

A data session is closed when the form that created the data session is released.

SET DATASESSION is typically used to debug forms, and should not be issued when a form is active.

The following SET commands scope to the current data session:

SET Commands
SET ANSI	SET AUTOSAVE
SET BLOCKSIZE	SET CARRY
SET CENTURY	SET COLLATE
SET CONFIRM	SET CURRENCY
SET DATABASE	SET DATE
SET DECIMALS	SET DELETED
SET DELIMITERS	SET EXACT
SET EXCLUSIVE	SET FIELDS
SET FIXED	SET HOURS
SET LOCK	SET MARK TO
SET MEMOWIDTH	SET MULTILOCKS
SET NEAR	SET NULL
SET POINT	SET REPROCESS
SET SAFETY	SET SECONDS
SET SEPARATOR	SET SYSFORMATS
SET TALK	SET UNIQUE


See Also

AUSED( )
CREATE FORM
DataSession Property
DataSessionId Property


SET DATE Command

Syntax         Remarks         See Also

Specifies the format for the display of Date and DateTime expressions.

Syntax

SET DATE [TO] AMERICAN | ANSI | BRITISH | FRENCH | GERMAN
| ITALIAN | JAPAN | TAIWAN | USA | MDY | DMY | YMD
| SHORT | LONG

Remarks

Here are the settings and the resulting date formats:

Setting	Format
AMERICAN	mm/dd/yy
ANSI	yy.mm.dd
BRITISH/FRENCH	dd/mm/yy
GERMAN	dd.mm.yy
ITALIAN	dd-mm-yy
JAPAN	yy/mm/dd
TAIWAN	yy/mm/dd
USA	mm-dd-yy
MDY	mm/dd/yy
DMY	dd/mm/yy
YMD	yy/mm/dd
SHORT	Short date format determined by the Windows Control Panel short date setting.
LONG	Long date format determined by the Windows Control Panel long date setting.
The default date setting is AMERICAN.

The SET DATE setting also determines how the date appears in datetime expressions.

If DATE is set to SHORT or LONG, the SET CENTURY, SET MARK, SET HOURS, and SET SECONDS settings are ignored.

SET DATE is scoped to the current data session.


See Also

DATE( )
DATETIME( )
SET CENTURY
SET DATASESSION
SET MARK TO
SET SYSFORMATS


SET DEBUG Command

Syntax         Arguments         Remarks         See Also

Makes the Debug and Trace windows either available or unavailable from the Visual FoxPro menu system.

Syntax

SET DEBUG ON | OFF

Arguments

ON   (Default) Makes the Debug and Trace windows available from the Visual FoxPro system menu.

OFF   Makes the Debug and Trace windows unavailable from the Visual FoxPro system menu. However, when SET DEBUG is set to OFF, you can open the Debug window with SET ECHO ON or ACTIVATE WINDOW DEBUG, and you can open the Trace window with SET STEP ON or ACTIVATE WINDOW TRACE.

Remarks

For more information on using the Trace and Debug windows, see Chapter 14, “Testing and Debugging Applications,” in the Developer’s Guide.


See Also

CLEAR DEBUG, DEBUG, SET ECHO


SET DEBUGOUT Command

Syntax         Arguments         Remarks         See Also

Directs debugging output to a file.

Syntax

SET DEBUGOUT TO [FileName [ADDITIVE]]

Arguments

FileName   Specifies the name of the file to which debugging output is directed. If the file you specify doesn’t exist, it is automatically created. If the file you specify already exists, its contents are overwritten unless you include the ADDITIVE clause.

Issue SET DEBUGOUT TO to stop direction of debugging output to the file and close the file.

ADDITIVE   Specifies that debugging output is appended to the end of the file specified with FileName.

Remarks

Debugging output that is directed to the file includes ASSERT messages, output from the DEBUGOUT command, and events that are specified with SET EVENTLIST or in the Event Tracking Dialog Box. See the Event Tracking dialog box for more information about specifying events to track interactively.


See Also

ASSERT, DEBUG, DEBUGOUT, SET EVENTLIST, SET EVENTTRACKING


SET DECIMALS Command

Syntax         Arguments         Remarks         See Also

Specifies the number of decimal places displayed in numeric expressions.

Syntax

SET DECIMALS TO [nDecimalPlaces]

Arguments

nDecimalPlaces   Specifies the minimum number of decimal places to display. The default is two decimal places. The maximum number of decimal places is 18; the minimum is zero.

Remarks

SET DECIMALS specifies the minimum number of decimal places used to display the results of division, multiplication, and trigonometric and financial functions.

SET DECIMALS is scoped to the current data session.


See Also

SET DATASESSION
SET FIXED
SET SYSFORMATS


SET DEFAULT Command

Syntax         Arguments         Remarks         See Also

Specifies the default drive and directory.

Syntax

SET DEFAULT TO [cPath]

Arguments

cPath   Specifies one of the following:

•	A drive designator.

•	A drive designator with a directory name.

•	A child directory name.

•	Any of the above using MS-DOS shorthand notation ( \ or ..).

Remarks

SET DEFAULT changes the default directory to the directory you specify.

Visual FoxPro searches for a file in the default Visual FoxPro directory. The default directory is the one from which you start Visual FoxPro. However, you can specify a different default directory in your Visual FoxPro configuration file or in a startup program. If Visual FoxPro cannot find a file in the default directory, it then searches the Visual FoxPro path if one has been specified. Use SET PATH to specify the Visual FoxPro path.

If you create a file and don’t specify where to place it, the file is placed in the default Visual FoxPro directory.

When you quit Visual FoxPro, you are returned to Windows. When you exit Windows, you are returned to the drive and directory that you started Windows from.

Tip   SYS(5) returns the default drive. SYS(2003) returns the default directory with no drive designator. SYS(5) + SYS(2003) returns the default drive and the directory.

You can change the default drive to drive A using either of the following commands:

SET DEFAULT TO A

SET DEFAULT TO A:

You can specify a specific directory:

SET DEFAULT TO A:\sales

SET DEFAULT TO C:\sales\data

You can specify a child directory. If the root directory on drive C is the default Visual FoxPro directory, issue the following command to change the default directory to C:\SALES:

SET DEFAULT TO sales

You can use MS-DOS shorthand notation. If the current directory is C:\SALES\DATA, issue the following command to make the root directory the default directory:

SET DEFAULT TO \

You can also move the default directory one directory toward the root directory with the following command:

SET DEFAULT TO ..


See Also

CD | CHDIR
MD | MKDIR
RD | RMDIR
SET PATH
SYS(5) - Default Drive
SYS(2003) - Current Directory


SET DELETED Command

Syntax         Arguments         Remarks         See Also

Specifies whether Visual FoxPro processes records marked for deletion and whether they are available for use in other commands.

Syntax

SET DELETED ON | OFF

Arguments

ON   Specifies that commands which operate on records (including records in related tables) using a scope ignore records marked for deletion.

OFF   (Default) Specifies that records marked for deletion can be accessed by commands that operate on records (including records in related tables) using a scope.

Remarks

Queries that use DELETED( ) to test the status of records can be optimized using Rushmore technology if the table is indexed on DELETED( ).

For more information on optimizing queries, see “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

You can mark records for deletion by issuing DELETE - SQL or DELETE, or by choosing Delete Records... from the Table menu from within a Browse or Edit window.

You can recall records by issuing RECALL or by choosing Recall Records... from the Table menu from within a Browse or Edit window.

Important     SET DELETED is ignored if the default scope for the command is the current record or you include a scope of a single record. INDEX and REINDEX always ignore SET DELETED and index all records in the table.

SET DELETED is scoped to the current data session.


See Also

DELETE
DELETE - SQL
DELETED( )
PACK
RECALL
SET DATASESSION


SET DELIMITERS Command

Included for backward compatibility. Use the Format Property instead.


SET DEVELOPMENT Command

Syntax         Arguments         Remarks         See Also

Causes Visual FoxPro to compare the creation date and time of a program with those of its compiled object file when the program is run.

Syntax

SET DEVELOPMENT ON | OFF

Arguments

ON   (Default) Specifies that Visual FoxPro recompile the source program before it executes if it is more current than its compiled object program. This option ensures that the most current version of a program is executed.

OFF   Specifies that Visual FoxPro not compare the source and compiled versions of the program. If SET DEVELOPMENT is set to OFF, you might not always be executing the most current version of a program.

Remarks

The most current version of a program modified with the Visual FoxPro editor invoked with MODIFY COMMAND is always executed, regardless of the SET DEVELOPMENT setting.

SET DEVELOPMENT needs to be set to ON only when programs are modified outside of Visual FoxPro. Using an external editor — for example, a terminate-and-stay-resident (TSR) editor — may require you to issue CLEAR PROGRAM before you execute the modified program. For more information, see CLEAR PROGRAM. Use SET DEVELOPMENT OFF for optimum performance.

When SET DEVELOPMENT is set to ON, program execution can be canceled during a READ. The Cancel command on the Program menu is available when SET DEVELOPMENT is ON and a READ is active. Choosing Cancel during the READ cancels program execution. If SET DEVELOPMENT is set to OFF, the Cancel command on the Program menu is unavailable during a READ.

SET DEVELOPMENT also determines whether the Trace window is opened when an error occurs within a Form that is running. If SET DEVELOPMENT is ON, the Trace window is opened with the program line that caused the error selected. If SET DEVELOPMENT is OFF, the Trace window is not opened when an error occurs in a Form.


See Also

COMPILE
MODIFY COMMAND
MODIFY FILE


SET DEVICE Command

Syntax         Arguments         Remarks         See Also

Directs output from @ ... SAY to the screen, a printer, or a file.

Syntax

SET DEVICE TO SCREEN | TO PRINTER [PROMPT] | TO FILE FileName

Arguments

TO SCREEN   Directs @ ... SAY output to the main Visual FoxPro window or to the active user-defined window.

TO PRINTER [PROMPT]   Directs @ ... SAY output to the printer. A page eject is issued when the coordinates in @ ... SAY specify a location on the page higher than the location specified by the coordinates in the previous @ ... SAY.

You can include the optional PROMPT clause to display a dialog box before printing starts. In this dialog box, the user can adjust printer settings, including the number of copies to print and page numbers. The currently installed printer driver determines which printer settings the user can adjust. Place PROMPT immediately after TO PRINTER.

TO FILE FileName   Specifies a file to which @ ... SAY sends output.

Remarks

@ ... SAY output can be sent to the main Visual FoxPro window, the active user-defined window, the printer, or a file.


See Also

SYS(101) - Device Setting


SET DISPLAY Command

Syntax         Arguments         Remarks         See Also

Enables you to change the current display mode on monitors that support different modes.

Syntax

SET DISPLAY TO CGA | EGA25 | EGA43 | VGA25 | VGA50

Arguments

CGA   Switches the font size for the main Visual FoxPro window to 9-point.

EGA25   Switches the font size for the main Visual FoxPro window to 9-point and the main Visual FoxPro window size to 25 lines.

EGA43   Switches the font size for the main Visual FoxPro window to 7-point and the main Visual FoxPro window size to 50 lines.

VGA25   Switches the font size for the main Visual FoxPro window to 9-point and the main Visual FoxPro window size to 25 lines.

VGA50   Switches the font size for the main Visual FoxPro window to 7-point and the main Visual FoxPro window size to 50 lines.

VGA50   Switches the font size for the main Visual FoxPro window to 8-point.

Remarks

SET DISPLAY changes the font size for the main Visual FoxPro window. The size of the main Visual FoxPro window is increased if necessary to accommodate the number of lines required by the option you specify. If the graphical status bar appears when you issue SET DISPLAY, it is turned off.

Visual FoxPro generates an error message if an option isn’t supported by your video hardware.

The SET MESSAGE line is reset to the last line of the main Visual FoxPro window whenever SET DISPLAY is issued.


See Also

SET MESSAGE
SYS(2006) - Current Graphics Card


SET DOHISTORY Command

Included for backward compatibility. Use the Trace Window instead.


SET ECHO Command

Syntax         Arguments         Remarks         See Also

Opens the Trace window for program debugging. Included for backward compatibility. Use the Trace window instead.

Syntax

SET ECHO ON | OFF

Arguments

ON   Displays the source code for the program that is executing in the Trace window. The line currently executing is highlighted.

OFF   (Default) Closes the Trace window in FoxPro versions earlier than 2.0. From within a program, the Trace window can be closed with DEACTIVATE WINDOW TRACE.

Remarks

You can also use the Trace window to set breakpoints, which suspend program execution.

For more information about the Trace window, see the Trace Window topic and Chapter 14, “Testing and Debugging Applications,” in the Developer’s Guide.


See Also

RESUME
SET STEP
SUSPEND


SET ESCAPE Command

Syntax         Arguments         See Also

Determines whether pressing the ESC key interrupts program and command execution.

Syntax

SET ESCAPE ON | OFF

Arguments

ON   (Default) Allows command and program execution to be interrupted when the user presses ESC.

If the user presses ESC during the execution of a command or program while the insertion point is in the Command window, the following message appears:

*** INTERRUPTED ***

If the user presses ESC during command or program execution, processing completes at the current program line, and an alert appears with the following three options:

•	(Default) Choose Cancel to immediately stop program execution and return to the Command window.

•	Choose Suspend to pause program execution and return to the Command window. This option is useful for debugging a program. Choosing Resume from the Program menu or issuing RESUME in the Command window restarts the program at the line at which it was paused.

•	Choose Ignore to continue program execution at the line at which it was paused.

OFF   Prevents command and program execution from being interrupted when the user presses ESC.


See Also

ON ESCAPE
ON KEY LABEL


SET EVENTLIST Command

Syntax         Arguments         Remarks         See Also

Specifies events to track in the Debug Output Window or in a file specified with SET EVENTTRACKING.

Syntax

SET EVENTLIST TO [EventName1 [, EventName2 …] [ADDITIVE]]

Arguments

EventName1 [, EventName2 …]   Specifies the names of the events to track. You can include any number of event names separated by commas.

ADDITIVE   Specifies that the events EventName1, EventName2 … are added to the set of events currently being tracked. If ADDITIVE is omitted, only the events EventName1, EventName2 … are tracked.

Remarks

Issue SET EVENTLIST TO without any event names to remove all events from the set of events being tracked. You can also specify events to track in the Event Tracking dialog box.


See Also

SET DEBUGOUT, SET EVENTTRACKING


SET EVENTTRACKING Command

Syntax         Arguments         Remarks          See Also

Turns event tracking on or off or specifies a text file to which event tracking information is directed.

Syntax

SET EVENTTRACKING ON | OFF | PROMPT
TO [FileName [ADDITIVE]]

Arguments

ON   Turns event tracking on and directs event tracking information to the text file specified with FileName.

OFF   Turns event tracking off and stops directing event tracking information to the text file.

PROMPT   Displays the Event Tracking dialog box, allowing the user to specify which events are tracked.

TO FileName   Specifies the name of a text file to which event tracking information is directed. SET EVENTTRACKING must be ON to direct event tracking information to a text file. Issue SET EVENTTRACKING TO without a file name to close the text file.

If the file you specify doesn't exist, Visual FoxPro automatically creates and opens it.

ADDITIVE   Appends the event tracking information to the end of the text file specified with FileName. If you omit ADDITIVE, the event tracking information replaces the contents of the text file.

Remarks

Use SET EVENTLIST or the Event Tracking dialog box to specify the events that are tracked.


See Also

SET COVERAGE, SET EVENTLIST


SET EXACT Command

Syntax         Arguments         Remarks         See Also

Specifies the rules Visual FoxPro uses when comparing two strings of different lengths.

Syntax

SET EXACT ON | OFF

Arguments

ON   Specifies that expressions must match character for character to be equivalent. Any trailing blanks in the expressions are ignored for the comparison. For the comparison, the shorter of the two expressions is padded on the right with blanks to match the length of the longer expression.

OFF   (Default) Specifies that, to be equivalent, expressions must match character for character until the end of the expression on the right side is reached.

Remarks

The SET EXACT setting has no effect if both strings are the same length.

String Comparisons   Visual FoxPro has two relational operators that test for equality.

The = operator performs a comparison between two values of the same type. This operator is suited for comparing character, numeric, date, and logical data.

However, when you compare character expressions with the = operator, the results might not be exactly what you expect. Character expressions are compared character for character from left to right until one of the expressions isn’t equal to the other, or until the end of the expression on the right side of the = operator is reached (SET EXACT OFF), or until the ends of both expressions are reached (SET EXACT ON).

The == operator can be used when an exact comparison of character data is needed. If two character expressions are compared with the == operator, the expressions on both sides of the == operator must contain exactly the same characters, including blanks, to be considered equal. The SET EXACT setting is ignored when character strings are compared using ==.

The following table shows how the choice of operator and the SET EXACT setting affect comparisons. (An underscore represents a blank space.)

Comparison	= EXACT OFF	= EXACT ON	== EXACT ON or OFF
“abc” = “abc”	Match	Match	Match
“ab” = “abc”	No match	No match	No match
“abc” = “ab”	Match	No match	No match
“abc” = “ab_”	No match	No match	No match
“ab” = “ab_”	No match	Match	No match
“ab_” = “ab”	Match	Match	No match
“” = “ab”	No match	No match	No match
“ab” = “”	Match	No match	No match
“__” = “”	Match	Match	No match
“” = “___”	No match	Match	No match
TRIM(“___”) = “”	Match	Match	Match
“” = TRIM(“___”)	Match	Match	Match
SET EXACT is scoped to the current data session.


See Also

SET ANSI


SET EXCLUSIVE Command

Syntax         Arguments         Remarks         See Also

Specifies whether Visual FoxPro opens table files for exclusive or shared use on a network.

Syntax

SET EXCLUSIVE ON | OFF

Arguments

ON   (The default for the global data session.) Limits accessibility of a table opened on a network to the user who opened it. The table isn’t accessible to other users on the network. Unlike FLOCK( ), SET EXCLUSIVE ON also prevents all other users from having read-only access. A file can also be opened on a network for exclusive use by including the EXCLUSIVE clause with the USE command. It isn’t necessary to perform record or file locking on a table opened for exclusive use.

Opening a table for exclusive use ensures that the file can’t be changed by other users. For some commands, execution isn’t possible until a table is opened for exclusive use. These commands are INSERT, INSERT BLANK, MODIFY STRUCTURE, PACK, REINDEX, and ZAP.

OFF   (The default for a private data session.) Allows a table opened on a network to be shared and modified by any user on the network.

For additional information about record and file locking and sharing tables on a network, see Chapter 17, “Programming for Shared Access,” in the Developer’s Guide.

Remarks

Changing the setting of SET EXCLUSIVE doesn’t change the status of previously opened tables. For example, if a table is opened with SET EXCLUSIVE set to ON, and SET EXCLUSIVE is later changed to OFF, the table retains its exclusive-use status.

SET EXCLUSIVE is scoped to the current data session.


See Also

FLOCK( )
RLOCK( )
SET DATASESSION
USE


SET FDOW Command

Syntax         Arguments         Remarks         Example         See Also

Specifies the first day of the week.

Syntax

SET FDOW TO [nExpression]

Arguments

nExpression   Specifies the first day of the week. The following table lists the values nExpression can assume and the corresponding first day of the week.

Nexpression	Day of the week
1	Sunday
2	Monday
3	Tuesday
4	Wednesday
5	Thursday
6	Friday
7	Saturday
If you omit nExpression, the first day of the week is reset to Sunday (1).

Remarks

The first day of the week can also be set with the Week Starts On list box in the Regional tab of the Options dialog.


SET FDOW Command Example

STORE SET('FDOW') TO gnFdow  && Save current value

SET FDOW TO 1  && Sets first day of the week to Sunday, the default

SET FDOW TO 7  && Sets first day of the week to Saturday

SET FDOW TO &gnFdow  && Restore original day


See Also

CDOW( )
DAY( )
DOW( )
SET FWEEK
SYS( ) Functions Overview
WEEK( )


SET FIELDS Command

Syntax         Arguments         Remarks         See Also

Specifies which fields in a table can be accessed.

Syntax

SET FIELDS ON | OFF | LOCAL | GLOBAL
 – Or –
SET FIELDS TO [[FieldName1 [, FieldName2 ...]]
| ALL [LIKE Skeleton | EXCEPT Skeleton]]

Arguments

ON   Specifies that only the fields in the field list can be accessed.

OFF   (Default) Specifies that all the fields in the current table can be accessed.

LOCAL   Specifies that only the fields in the current work area listed in the fields list can be accessed.

GLOBAL   Specifies that all fields in the field list, including fields in other work areas, can be accessed.

SET FIELDS GLOBAL lets you access fields in other work areas without issuing SET COMPATIBLE TO DB4.

TO [FieldName1 [, FieldName2 ...]]   Specifies the names of fields that can be accessed in the current table. You must include an alias with the field name in the following cases:

•	When the field is in a table that is open in a work area other than the currently selected work area.

•	When the field names are the same in two or more tables.

You can include fields from tables that are open in other work areas if the fields are prefaced with their table aliases. However, these fields cannot be accessed unless you issue SET FIELDS GLOBAL or SET COMPATIBLE DB4.

The field list can contain statements for creating calculated fields. A calculated field contains read-only data created with an expression. This expression can take any form, but it must be a valid FoxPro expression. Calculated fields cannot be accessed unless you issue SET FIELDS GLOBAL or SET COMPATIBLE DB4.

The format of the statement you use to create a calculated field is:

<calculated field name> = <expr>

This example creates a calculated field called LOCATION:

CLOSE DATABASES

USE customer

SET FIELDS TO LOCATION = ALLTRIM(city) + ', ' + state

CITY and STATE are the names of fields from the selected table.

ALL   Allows access to all the fields in the current table.

ALL LIKE Skeleton | EXCEPT Skeleton   You can selectively access fields by including the LIKE or EXCEPT clause or both. If you include LIKE Skeleton, you can access fields that match Skeleton. If you include EXCEPT Skeleton, you can access all fields except those that match Skeleton.

The skeleton Skeleton supports wildcards such as * and ?. For example, to access fields that begin with the letters A and P, issue:

SET FIELDS TO ALL LIKE A*,P*

The LIKE clause can be combined with the EXCEPT clause:

SET FIELDS TO ALL LIKE A*,P* EXCEPT PARTNO*

Remarks

SET FIELDS TO is additive — issuing SET FIELDS TO with a field list adds the specified fields to those that are currently accessible.

Issuing SET FIELDS TO implicitly performs SET FIELDS ON. Issuing SET FIELDS TO without any additional arguments implicitly performs SET FIELDS OFF. Issue SET FIELDS TO without including either a field list or ALL to remove all fields from the field list for the current table.

SET FIELDS is scoped to the current data session.


See Also

SET FILTER
SET DATASESSION


SET FILTER Command

Syntax         Arguments         Remarks         See Also

Specifies a condition that records in the current table must meet to be accessible.

Syntax

SET FILTER TO [lExpression]

Arguments

lExpression   Specifies the condition that records must satisfy.

If the current table is indexed on a field or fields specified in lExpression, Visual FoxPro Rushmore technology will optimize queries based on the field or fields.

Remarks

Once SET FILTER is issued, only the records that satisfy the condition specified by the logical expression lExpression are available in the table. All commands that access the table respect the SET FILTER condition. A separate filter can be set for every open table.

The condition specified by SET FILTER isn’t evaluated until the record pointer is moved in the table.

Issuing SET FILTER TO without lExpression turns off the filter for the current table.

SELECT - SQL does not respect the current filter condition.


See Also

FILTER( )
SELECT - SQL


SET FIXED Command

Syntax         Arguments         Remarks         See Also

Specifies if the number of decimal places used in the display of numeric data is fixed.

Syntax

SET FIXED ON | OFF

Arguments

ON   Uses the SET DECIMALS setting to determine the number of decimal places displayed in results. The default number of decimal places is 2.

OFF   (Default) Allows the number of decimal places displayed in results to depend on the specific constants, variables, and operators used in a numeric expression. The contents of fields are displayed with the declared number of decimal places.

Remarks

SET FIXED is scoped to the current data session.


See Also

SET DECIMALS
SET DATASESSION


SET FORMAT Command

Included for backward compatibility. Use the Format Property instead.


SET FULLPATH Command

Syntax         Arguments         See Also

Specifies if CDX( ), DBF( ), MDX( ), and NDX( ) return the path in a file name.

Syntax

SET FULLPATH ON | OFF

Arguments

ON   (Default) Specifies that CDX( ), DBF( ), MDX( ), and NDX( ) return the drive designator, path, and file name.

OFF   Specifies that only the drive designator and file name are returned.


See Also

CDX( ), DBF( ), MDX( ), NDX( )


SET FUNCTION Command

Syntax         Arguments         See Also

Assigns an expression (keyboard macro) to a function key or key combination.

Syntax

SET FUNCTION nFunctionKeyNumber | KeyLabelName TO [eExpression]

Arguments

nFunctionKeyNumber   Specifies the number of the function key assigned to the macro. For example, use SET FUNCTION 2 to specify the F2 function key.

KeyLabelName   Specifies a key combination, including a function key, to which to assign the macro. Visual FoxPro supports key combinations that include function keys. You can use the CTRL or SHIFT key in combination with a function key to create additional programmable keys. For a list of key label expressions, see ON KEY LABEL.

TO [eExpression]   Specifies the series of keystrokes stored to the function key or key combination. Visual FoxPro interprets a semicolon (;) in the expression as a carriage return.

Function key definitions can be cleared with CLEAR MACROS.


See Also

CLEAR MACROS
FKLABEL( )
FKMAX( )
ON KEY LABEL


SET FWEEK Command

Syntax         Arguments         Remarks         Example         See Also

Specifies the requirements for the first-week-of-the-year.

Syntax

SET FWEEK TO [nExpression]

Arguments

nExpression   Specifies a value which determines the requirements for the first-week-of-the-year. The following table lists the values nExpression can assume and the corresponding requirements for the first-week-of-the-year:

nExpression	First week requirement
1	(Default) The first week contains January 1st.
2	The larger half (four days) of the first week is in the current year.
3	The first week has seven days.
If you omit nExpression, the first-week-of-the-year is reset to 1 (the first week contains January 1st).

Remarks

The first-week-of-the-year can also be set with the First Week of Year list box in the Regional tab of the Options dialog.


SET FWEEK Command Example

STORE SET('FWEEK') TO gnFweek  && Save current value

SET FWEEK TO 1  && First week contains January 1st

SET FWEEK TO 3  && First week has seven days

SET FWEEK TO &gnFweek  && Restore original setting


See Also

CDOW( )
DAY( )
DOW( )
SET FDOW
SYS( ) Functions Overview
WEEK( )


SET HEADINGS Command

Syntax         Arguments         Remarks         See Also

Determines whether column headings are displayed for fields and whether file information is included when TYPE is issued to display the contents of a file.

Syntax

SET HEADINGS ON | OFF

Arguments

ON   (Default) Specifies that the field names are displayed.

If TYPE is issued to display the contents of a file, Visual FoxPro inserts a formfeed, the path and name of the file, and the date at the beginning of the displayed output.

OFF   Specifies that the field names are not displayed.

If TYPE is issued to display the contents of a file, Visual FoxPro does not insert additional information about the file at the beginning of the displayed output.

Remarks

SET HEADINGS specifies whether a field name appears as a column heading above each field in the output of AVERAGE, CALCULATE, DISPLAY, LIST, and SUM.


See Also

AVERAGE
CALCULATE
DISPLAY
LIST
SUM
TYPE


SET HELP Command

Syntax         Arguments         Remarks         See Also

Enables or disables Visual FoxPro online Help or specifies a Help file.

Syntax

SET HELP ON | OFF
 – or –
SET HELP TO [FileName]

Arguments

ON   (Default) Displays the Help window when the user presses F1 or issues HELP in the Command window.

OFF   Makes Visual FoxPro online Help unavailable.

TO [FileName]   Specifies a Help file other than Visual FoxPro online Help.

If you issue SET HELP TO without including a file name, Visual FoxPro looks for a Help file with the name FOXHELP.HLP.

Remarks

Use SET HELP to provide a tailored online Help file within a custom application or to switch between the different Help files in Visual FoxPro.

For more information about Visual FoxPro online Help, see Part 7, “Creating Help Files,” in the Developer’s Guide.


See Also

HELP
SET HELPFILTER
SET TOPIC


SET HELPFILTER Command

Syntax         Arguments         Remarks         See Also

Enables Visual FoxPro to display a subset of .DBF-style Help topics in the Help window.

Syntax

SET HELPFILTER [AUTOMATIC] TO [lExpression]

Arguments

AUTOMATIC   Automatically removes the criteria specified with SET HELPFILTER after the Help window is closed. Including AUTOMATIC is identical to issuing SET HELPFILTER TO immediately after the Help window is closed. You must place AUTOMATIC directly before TO lExpression.

lExpression   Specifies a logical expression used to filter Help topics. Only topics for which lExpression evaluates to true (.T.) are displayed. lExpression is typically contains a name of a field in the help table.

Remarks

You can only set a filter for .DBF-style Help only. You cannot set a filter for graphical Help.

For more information about Visual FoxPro online Help, see Part 7, “Creating Help Files,” in the Developer’s Guide.


See Also

HELP
SET HELP
SET TOPIC


SET HOURS Command

Syntax         Arguments         Remarks         See Also

Sets the system clock to a 12- or 24-hour time format.

Syntax

SET HOURS TO [12 | 24]

Arguments

TO 12   (Default) Specifies a 12-hour format.

TO 24   Specifies a 24-hour format.

Remarks

Use SET HOURS TO without 12 or 24 to return to the default 12-hour format.

TIME( ) always returns a value in 24-hour format and isn’t affected by SET HOURS. The value returned by DATETIME( ) is determined by the current SET HOURS setting.

SET HOURS is scoped to the current data session.


See Also

DATETIME( )
SECONDS( )
SET CLOCK
SET SYSFORMATS
TIME( )


SET INDEX Command

Syntax         Arguments         Remarks         See Also

Opens one or more index files for use with the current table.

Syntax

SET INDEX TO [IndexFileList | ? ]
[ORDER nIndexNumber | IDXIndexFileName
| [TAG] TagName [OF CDXFileName] [ASCENDING | DESCENDING]]
[ADDITIVE]

Arguments

IndexFileList   Specifies one or more index files to open. Use commas to separate multiple index files in the list. The index file list can contain any combination of .IDX and .CDX index file names; you don’t have to include the file name extensions unless another .IDX or .CDX file exists with the same name.

The first index file in the index file list becomes the controlling index file, which controls how records are accessed and displayed. The records are displayed and accessed in physical record order if the first index file is a .CDX file and SET ORDER TO TAG has not been issued.

?   Displays the Open dialog box from which you can open a single .IDX file.

ORDER nIndexNumber   Specifies a controlling index file or tag. The numeric expression nIndexNumber specifies the index files as they appear in the index file list.

.IDX files are numbered first in the order in which they appear in the index file list. Tags in the structural .CDX file (if one exists) are numbered in the order in which the tags were created. Finally, tags in any independent .CDX files are numbered in the order in which they were created. See SET ORDER for a further discussion of the numbering of index files and tags.

If nIndexNumber is 0, records in the table are displayed and accessed in physical record order, but the index files remain open. ORDER 0 enables you to update open index files while accessing records in physical order. ORDER with no additional arguments is identical to ORDER 0.

Visual FoxPro generates an error message if nIndexNumber is greater than the number of .IDX files and .CDX file tags.

ORDER IDXIndexFileName   Specifies an .IDX file as the controlling index file.

ORDER [TAG] TagName [OF CDXFileName]   Specifies a tag (TagName) of a .CDX file to be the controlling tag. The tag name can be from the structural .CDX file or any open independent .CDX file.

If tags with the same name exist in open independent .CDX files, use OF CDXFileName to specify the .CDX file the tag is in.

ASCENDING | DESCENDING   Specifies whether table records are displayed and accessed in ascending or descending order. The index files or tags aren’t changed in any way; only the order in which the records are displayed and accessed is changed. Include the ASCENDING or DESCENDING clause immediately after the ORDER clause.

ADDITIVE   Specifies that previously opened index files, except for a structural compound index, are left open when you issue SET INDEX to open an additional index file or files for a table. Without ADDITIVE, the previously opened files would be closed.

Remarks

Records in a table that has an index file or files open can be displayed and accessed in an order determined by one of the index files. Both single index (.IDX) and compound (.CDX) index files can be opened with SET INDEX. If a table has a structural .CDX file, the file is opened automatically when the table is opened.

Only one .IDX file (the controlling index file) or tag from a .CDX file (the controlling tag) controls the order in which records in the table are displayed or accessed. Certain commands (SEEK, for example) use the controlling index file or tag to search for records.

Issuing SET INDEX TO without additional arguments closes all open index files (except a structural .CDX file) in the current work area.


See Also

CLOSE INDEXES
INDEX
SET ORDER
USE


SET INTENSITY Command

Included for backward compatibility. Use SET COLOR OF SCHEME instead.


SET KEY Command

Syntax         Arguments         Remarks         See Also

Specifies access to a range of records based on their index keys.

Syntax

SET KEY TO [eExpression1 | RANGE eExpression2 [, eExpression3]]
[IN cTableAlias | nWorkArea]

Arguments

eExpression1   Allows access to a set of records with identical index keys. eExpression1 is a single index key value. All records with index keys that match eExpression1 are accessible.

RANGE eExpression2 [, eExpression3]   Allows access to a set of records with index keys that fall within a range of index key values. eExpression2 allows access to records with index keys equal to or greater than eExpression2. eExpression3 (preceded by a comma) allows access to records with index keys equal to or less than eExpression3. Including both eExpression2 and eExpression3 (separated by a comma) allows access to records with index keys equal to or greater than eExpression2 and equal to or less than the eExpression3.

For example, the CUSTOMER table includes a character field containing postal codes. If the table is indexed on the postal code field, you can specify a range of postal codes with SET KEY.

In the following example, only records with postal codes falling within the range of 40000 to 43999 appear in a Browse window:

CLOSE DATABASES

USE customer

SET ORDER TO postalcode

SET KEY TO RANGE '40000', '43999'

BROWSE

IN cTableAlias | nWorkArea   Allows access to a range of records for a table open in a specific work area. cTableAlias specifies the work area alias and nWorkArea specifies the work area number. If no table has the alias you specify, Visual FoxPro generates an error message. If you omit the work area alias and number, SET KEY operates on the table in the currently selected work area.

Remarks

Use SET KEY to limit the range of records you can access in a table. The table must be indexed, and the index key value or values you include must be the same data type as the index expression of the master index file or master tag.

Issue SET KEY TO without any additional arguments to restore access to all records in the table.


See Also

INDEX
KEY( )
SET FILTER


SET KEYCOMP Command

Syntax         Remarks         See Also

Controls Visual FoxPro keystroke navigation.

Syntax

SET KEYCOMP TO DOS | WINDOWS | MAC

Remarks

SET KEYCOMP determines the keystrokes and keystroke combinations you use to move through the Visual FoxPro interface by accessing controls such as buttons, list boxes, menus, and so on. The effect of SET KEYCOMP depends on the control.

Use SET KEYCOMP when you want to use keystrokes that are familiar to you.

To navigate in Windows or the Macintosh using MS-DOS keystrokes, issue

SET KEYCOMP TO DOS

You can specify the DOS or WINDOWS (default) option.

You can specify a startup SET KEYCOMP setting in your Visual FoxPro configuration file, CONFIG.FPW. For example, the following line, when placed in your configuration file, has the effect of SET KEYCOMP TO DOS:

KEYCOMP = DOS

This section describes how the DOS and WINDOWS options affect Visual FoxPro.

Default Buttons
DOS	The default button in a dialog box has the focus; its appearance does not change. It is chosen when you press CTRL+ENTER.
WINDOWS	The default button in a dialog box can change appearance when you move among controls. It can be dimmed, or it has the focus (is surrounded by a bold border) to indicate it is the current default.  It is chosen when you press ENTER. Pressing ENTER always performs the default button’s action.
For an illustration of how the default button changes appearance in a dialog box, issue SET KEYCOMP TO WINDOWS, choose Open from the File menu, and then press TAB to move through the Open dialog box.

Access Keys
DOS	An access key for a control is a single key. If you aren’t in a control that has keyboard steering (a combo box or a list box), you can press the access key to choose it.
WINDOWS	An access key for a control can be a single key or a key combination. If the current control has keyboard steering (a combo box or a list box), you can press ALT plus the access key to choose the control. To choose other controls, you can press the access key or ALT plus the access key.
Combo Boxes
DOS	When a combo box has the focus, you can open it by pressing ENTER or the SPACEBAR. Keyboard steering within a combo box is not available until the combo box is open.
WINDOWS	When a combo box has the focus, you can open it by pressing the SPACEBAR, ALT+UP ARROW, or ALT+DOWN ARROW. Keyboard steering within a combo box is available when the combo box has the focus, and when it is open.  For example, a selected combo box contains a list of available drives. If drives A, B, and C are available and drive B is currently displayed, you can choose drive C without opening the combo box by pressing C or the DOWN ARROW key. Drive C is chosen and you move to the next control.
Option Buttons
DOS	Press the TAB key when a group of option buttons is selected to move among the option buttons.
WINDOWS	Press the TAB key when a group of option buttons is selected to move from the option buttons to the next control.  To move among a set of option buttons, press the UP ARROW and DOWN ARROW keys.
Browse Window
DOS	A field is not selected upon entry into the field.
WINDOWS	A field is automatically selected upon entry into the field.


See Also

SET COMPATIBLE


SET LIBRARY Command

Syntax         Arguments         Remarks         See Also

Opens an external API (application programming interface) library file.

Syntax

SET LIBRARY TO [FileName [ADDITIVE]]

Arguments

FileName   Specifies the file name of the API library or procedure file to open.

Visual FoxPro assume an .FLL extension for libraries. If the library has an .FLL extension, you don’t have to include the extension with the file name. If a library has an extension other than .FLL, you must include the extension with the file name.

Important     When using SET LIBRARY, be aware of the following:

•	You cannot use API libraries built for one platform on another platform. For example, libraries created for FoxPro for MS-DOS cannot be used in Visual FoxPro; libraries created for Visual FoxPro cannot be used in FoxPro for MS-DOS.

•	You cannot use API libraries built for one version on another version. For example, you cannot use libraries built for FoxPro version 2.6 in Visual FoxPro. You must recompile and link.

Visual FoxPro assumes a .PRG extension for a procedure file.

When you execute a procedure with DO ProcedureName, Visual FoxPro searches for the procedure in the following files in this order:

1.	The file containing DO ProcedureName.

2.	A procedure file opened with SET PROCEDURE (if one is set).

3.	The programs in the execution chain. Visual FoxPro searches program files beginning with the most recently executed program and continuing back to the first executed program.

4.	A procedure file opened with SET LIBRARY (if one is set).

5.	A stand-alone program file. If Visual FoxPro finds a program file with the same name as the file name specified with DO, the program is executed. If it doesn’t find a matching program file name, Visual FoxPro generates an error message.

ADDITIVE   Opens additional API libraries. Include ADDITIVE after the file name in successive SET LIBRARY commands.

Visual FoxPro ignores ADDITIVE when you use SET LIBRARY to open a procedure file.

Remarks

Use SET LIBRARY to open external Application Program Interface (API) libraries or a procedure file.

API routine libraries extend the capabilities of the Visual FoxPro language and user interface. Once an external API library is opened, you can use the API functions as if they were Visual FoxPro functions. Use DISPLAY STATUS or LIST STATUS to display the library’s available functions.

You can use existing API libraries or create your own API libraries.

In Visual FoxPro, the preferred way to register functions in shared libraries is to use the DECLARE - DLL command.

To remove all API libraries from memory, use SET LIBRARY TO without including FileName or ADDITIVE. To remove an individual library from memory, use RELEASE LIBRARY LibraryName.

If you specify a procedure file, the procedures within the procedure file are made available to all programs and are also available interactively through the Command window.

The ability of Visual FoxPro to open a procedure file with SET LIBRARY provides compatibility with dBASE IV. Using SET LIBRARY to open a procedure file will close all open API libraries. Using SET LIBRARY to open API libraries will close a procedure file opened with SET LIBRARY. Use SET PROCEDURE to open a procedure file and prevent API libraries from being closed.

For additional information about procedure files, see PROCEDURE and SET PROCEDURE.


See Also

CALL
DISPLAY STATUS
LIST
LOAD
RELEASE


SET LOCK Command

Syntax         Arguments         Remarks         See Also

Enables or disables automatic file locking in certain commands.

Syntax

SET LOCK ON | OFF

Arguments

ON   Specifies that the commands listed below automatically lock the table when they execute. This provides read-only access to other users on the network and ensures that you are using the most current data.

OFF   (Default) Enables shared access of tables with commands listed below. Use SET LOCK OFF if you don’t need the most current information from a table.

Remarks

Visual FoxPro doesn’t place a lock on a file when executing commands that require read-only access to a table. These commands include the following:

Commands
AVERAGE	JOIN (both files)
CALCULATE	LIST
COPY TO	LABEL
COPY TO ARRAY	REPORT
COUNT	SORT
DISPLAY (with a scope)	SUM
INDEX	TOTAL
While they are executed, these commands don’t change the contents of a table, and access to the table is available to other users on the network. Thus, the table can be changed while you are executing one of these commands. For example, you might begin printing a report by using REPORT before another user changes a record included in the report. Your report now contains outdated information.

SET LOCK is scoped to the current data session.


See Also

FLOCK( )
LOCK( )
RLOCK( )
SET DATASESSION
SET MULTILOCKS


SET LOGERRORS Command

Syntax         Arguments         Remarks         See Also

Determines whether Visual FoxPro sends compilation error messages to a text file.

Syntax

SET LOGERRORS ON | OFF

Arguments

ON   (Default) Specifies that a compilation error message log file be created with the same name as the compiled program and an .ERR extension. If a log file with the same name already exists, it is overwritten.

OFF   Specifies that a compilation error message log file is not created when a program is compiled.

Remarks

Use SET LOGERRORS to save compilation error messages to a text file when programs are compiled.

If a log file exists with the same name as the compiled program, and if the program compiles without error, the log file is deleted.


See Also

COMPILE


SET MACKEY Command

Syntax         Arguments         Remarks         See Also

Specifies a key or key combination that displays the Macro Key Definition dialog box.

Syntax

SET MACKEY TO [KeyLabelName]

Arguments

KeyLabelName   Specifies the key or key combination that displays the Macro Key Definition dialog box. See ON KEY LABEL for the key labels to use.

Remarks

Use SET MACKEY to change the default key combination for displaying the Macro Key Definition dialog box. Choose Macros from the Tools menu to display this dialog box.

If you issue SET MACKEY TO without a key name or key combination name, you cannot activate the Macro Key Definition dialog box by pressing a key or key combination.


See Also

CLEAR
ON KEY LABEL
PLAY MACRO
RESTORE MACROS
SAVE MACROS


SET MARGIN Command

Syntax         Arguments         Remarks         See Also

Sets the left printer margin and affects all output directed to the printer.

Syntax

SET MARGIN TO nColumns

Arguments

nColumns   Specifies the left margin in columns. The default is 0 columns; the maximum is 256.

Remarks

If you use SET MARGIN to adjust the left margin, the value specified with SET MARGIN is stored to the system variable _PLOFFSET. You can also set the left margin by storing a value directly to _PLOFFSET.

The value of the system variable _LMARGIN also affects the left margin setting.

Important     The left margin setting specified in SET MARGIN doesn’t affect reports created with the Report Designer and then run with REPORT. Although _PLOFFSET is adjusted during the running of a report created with the Report Designer, it is reset to its original value after the report is run. The Left Margin setting in the Page Setup dialog box of the Report Designer determines the offset from the left edge of the paper. Choose Page Setup from the File menu to display the Page Setup dialog when the Report Designer is open.


See Also

_LMARGIN
_PLOFFSET


SET MARK OF Command

Syntax         Arguments         Remarks         See Also

Specifies a mark character for menu titles or menu items, or displays or clears the mark character.

Syntax

SET MARK OF MENU MenuBarName1
TO lExpression1
 – or –
SET MARK OF POPUP MenuName1
TO lExpression3
 – or –
SET MARK OF BAR nMenuItemNumber OF MenuName2
TO lExpression4

Arguments

MENU MenuBarName1   Specifies the name of the menu bar for which the mark character is specified, displayed or cleared.

•	TO lExpression1   Displays or clears the mark character for every menu title on the menu bar. If the logical expression lExpression1 evaluates to true (.T.), the mark character is displayed beside every menu title. The mark character is cleared from every menu name if lExpression1 evaluates to false (.F.).

POPUP MenuName1   Specifies the name of the menu for which the mark character is specified, displayed, or cleared.

•	TO lExpression3   Displays or clears the mark characters for all the menu items. If lExpression3 evaluates to true (.T.), the mark characters are displayed. If lExpression3 evaluates to false (.F.), the mark characters are cleared.

BAR nMenuItemNumber OF MenuName2   Specifies the number of the menu item (and the name of the menu containing the menu item) for which the mark character is specified, displayed, or cleared.

•	TO lExpression4   Displays or clears the mark character for the menu item. If lExpression4 evaluates to true (.T.), the mark character is displayed. If lExpression4 evaluates to false (.F.), the mark character is cleared.

Remarks

You cannot specify a mark character for menu titles or menu items. The mark character is always a check mark ( [image]). However, you can use SET MARK OF to display or clear the check mark for menu titles or menu items.

You cannot mark menu items created with any of the DEFINE POPUP PROMPT clauses (FIELD, FILES, or STRUCTURE).

Use MRKPAD( ) to determine if a menu title has a mark character displayed, and use MRKBAR( ) to determine if a menu item has a mark character displayed.

For an example using SET MARK OF, see CNTBAR( ).


See Also

CNTBAR( )
CNTPAD( )
DEFINE BAR
DEFINE MENU
DEFINE PAD
DEFINE POPUP
MRKBAR( )
MRKPAD( )


SET MARK TO Command

Syntax         Arguments         Remarks         See Also

Specifies a delimiter for the display of date expressions.

Syntax

SET MARK TO [cDelimiter]

Arguments

cDelimiter   Specifies the character you want to use as the date delimiter.

Remarks

SET MARK TO specifies the character that separates the month, day, and year in displayed dates.

Use SET MARK TO without cDelimiter to reset the delimiter to the default forward slash ( / ).

SET MARK TO is scoped to the current data session.


See Also

SET DATASESSION
SET DATE
SET SYSFORMATS


SET MEMOWIDTH Command

Syntax         Arguments         Remarks         See Also

Specifies the displayed width of memo fields and character expressions.

Syntax

SET MEMOWIDTH TO nColumns

Arguments

nColumns   Specifies a width between 8 and 1024 columns. The default width for output is 50 columns. If you issue SET COMPATIBLE ON or SET COMPATIBLE DB4, the default width is changed to 80 columns. If you specify a value for nColumns greater than 1024, width is set to 1024.

Remarks

SET MEMOWIDTH specifies the width of output sent to the main Visual FoxPro window or a user-defined window by commands such as ? | ??, DISPLAY, or LIST. It affects the output width of memo fields and character expressions longer than 1024 characters. It also affects the values returned by the ATCLINE( ), ATLINE( ), MEMLINE( ), and MLINE( ) functions.

Note that for ? and ?? the displayed width will not exceed 256 characters.

If output is directed to the main Visual FoxPro window, the width of the output is determined by the font for the main Visual FoxPro window. If output is directed to a user-defined window, the width of the output is determined by the font for the user-defined window.

SET MEMOWIDTH is scoped to the current data session.


See Also

ATCLINE( )
ATLINE( )
MEMLINES( )
MLINE( )
SET DATASESSION


SET MESSAGE Command

Syntax         Arguments         Remarks         See Also

Defines a message for display in the main Visual FoxPro window or in the graphical status bar, or specifies the location of messages for user-defined menu bars and menu commands.

Syntax

SET MESSAGE TO [cMessageText]
 – or –
SET MESSAGE TO [nRow [LEFT | CENTER | RIGHT]]
 – or –
SET MESSAGE WINDOW [WindowName]

Arguments

TO [cMessageText]   Specifies the message to display.

TO [nRow [LEFT | CENTER | RIGHT]]   Specifies the placement of messages in the main Visual FoxPro window. nRow specifies the row on which messages are displayed. If nRow is 0, no messages are displayed.

LEFT, CENTER, and RIGHT specify the horizontal screen placement of messages.

Visual FoxPro ignores a message location specified with SET MESSAGE when the graphical status bar is displayed.

WINDOW [WindowName]   Specifies the window in which messages are displayed. To remove a message from the window and display it on the screen, issue SET MESSAGE WINDOW.

Remarks

SET MESSAGE lets you create a message. It also lets you specify where to display messages created with DEFINE BAR, DEFINE MENU, DEFINE PAD, or DEFINE POPUP.

By default, messages are placed on the last line of the main Visual FoxPro window if the character-based status bar is displayed. If the graphical status bar is displayed, messages are placed in the status bar.

The SET MESSAGE line is reset to the last line of the main Visual FoxPro window whenever SET DISPLAY is issued.

SET MESSAGE TO without any arguments places messages in the graphical status bar.


See Also

SET DISPLAY
SET STATUS
SET STATUS BAR


SET MULTILOCKS Command

Syntax         Arguments         Remarks         See Also

Determines whether you can lock multiple records using LOCK( ) or RLOCK( ).

Syntax

SET MULTILOCKS ON | OFF

Arguments

ON   Allows you to attempt locking a set of records. Include a set of record numbers in LOCK( ) or RLOCK( ) to try to lock multiple records.

OFF   (Default) Allows you to attempt locking a single record with LOCK( ) or RLOCK( ).

Remarks

When a table is opened for shared use on a network, you can attempt to lock more than one record in a table file. The SET MULTILOCKS setting determines whether you can attempt to lock either a single record or a set of records. Records can be locked with the LOCK( ) or RLOCK( ) function.

Switching SET MULTILOCKS from ON to OFF or from OFF to ON implicitly issues UNLOCK ALL — all record locks in all work areas are released.

SET MULTILOCKS is scoped to the current data session.

MULTILOCKS must be ON to before row or table buffering can be enabled with CURSORSETPROP( ). See CURSORSETPROP( ) for additional information about row and table buffering.

If you select the Enable Data Buffering check box in the Work Area Properties dialog box (which is displayed when you choose the Properties button in the Data Session window), MULTILOCKS is automatically set to ON for the current data session. However, clearing the Enable Data Buffering check box does not set MULTILOCKS to OFF for the current data session.

For more information about record and file locking and sharing tables on a network, see the LOCK( ) and RLOCK( ) functions, and Chapter 17, “Programming for Shared Access,” in the Developer’s Guide.


See Also

CURSORSETPROP( )
LOCK( )
RLOCK( )
SET DATASESSION


SET NEAR Command

Syntax         Arguments         Remarks         See Also

Determines where the record pointer is positioned after FIND or SEEK unsuccessfully searches for a record.

Syntax

SET NEAR ON | OFF

Arguments

ON   Positions the record pointer on the closest matching record if a record search using FIND or SEEK is unsuccessful. With this setting, RECNO( ) returns the record number of the closest matching record, FOUND( ) returns false (.F.), and EOF( ) returns false (.F.).

OFF   (Default) Positions the record pointer at the end of the table if a record search using FIND or SEEK is unsuccessful. With this setting, RECNO( ) returns the number of records in the table plus 1, FOUND( ) returns false (.F.), and EOF( ) returns true (.T.).

Remarks

A search is unsuccessful when no record meets the search criteria.

Issuing RECNO( ) with an argument of 0 returns the record number of the closest matching record if a search is unsuccessful, regardless of the setting of SET NEAR.

SET NEAR is scoped to the current data session.


See Also

EOF( )
FIND
FOUND( )
RECNO( )
SEEK
SET DATASESSION


SET NOCPTRANS Command

Syntax         Arguments         Remarks         See Also

Prevents translation to a different code page for selected fields in an open table.

Syntax

SET NOCPTRANS TO [FieldName1 [, FieldName2 ...]]

Arguments

TO [FieldName1 [, FieldName2 ...]]   Specifies the fields that should not be translated to another code page.

Issue SET NOCPTRANS TO without a set of fields to return to the default translation (established by the CODEPAGE configuration item) for all character and memo fields in a table. Use SET(“NOCPTRANS”) to return the fields specified in the last SET NOCPTRANS command you issued. Use the CHR( ) function to ensure that individual characters don’t get translated.

Remarks

Because Visual FoxPro can be configured to automatically translate character and memo fields into other code pages, the SET NOCPTRANS command is available to prevent the automatic translation of fields containing binary data. For example, a memo field may contain a Microsoft Word document. When you access the Word document, you would like the document in its original, untranslated form. Use SET NOCPTRANS to specify that the memo field not be translated.

You don’t need to use SET NOCPTRANS to access binary data if the character or memo field containing the binary data has not been translated. You can ensure that character and memo fields are not translated by omitting the CODEPAGE configuration item from your Visual FoxPro configuration file.

For additional information on code pages and Visual FoxPro’s international support, see Code Pages Supported by Visual FoxPro, and Chapter 18, “Developing International Applications,” in the Developer’s Guide.


See Also

CPCONVERT( )
CPCURRENT( )
CPDBF( )
MODIFY COMMAND
MODIFY FILE


SET NOTIFY Command

Syntax         Arguments         Remarks         See Also

Enables or disables the display of certain system messages.

Syntax

SET NOTIFY ON | OFF

Arguments

ON   (Default) Enables the display of certain system messages.

OFF   Disables the display of certain system messages.

Remarks

Examples of system messages that SET NOTIFY affects are

•	“ Expression is valid” in the Expression Builder dialog box.

•	“ Do Canceled,” which appears when program execution is canceled.

System messages are displayed in the graphical (not the character-based) status bar at the bottom of the main Visual FoxPro window.


See Also

SET MESSAGE
WAIT


SET NULL Command

Syntax         Arguments         Remarks         Example         See Also

Determines how null values are supported by the ALTER TABLE, CREATE TABLE and INSERT - SQL commands.

Syntax

SET NULL ON | OFF

Arguments

ON   Specifies that all columns in a table created with ALTER TABLE and CREATE TABLE will allow null values. You can override null value support for columns in the table by including the NOT NULL clause in the columns’ definitions.

Also, specifies that INSERT - SQL will insert null values into any columns not included in the INSERT - SQL VALUE clause. INSERT - SQL will insert null values only into columns that allow null values.

Note   If you add support for null values to one or more columns in a table, the limit on the number of columns for that table is reduced from 255 to 254.

OFF   (Default) Specifies that all columns in a table created with ALTER TABLE and CREATE TABLE will not allow null values. You can designate null value support for columns in ALTER TABLE and CREATE TABLE by including the NULL clause in the columns’ definitions.

Also specifies that INSERT - SQL will insert blank values into any columns not included in the INSERT - SQL VALUE clause.

Remarks

SET NULL affects only how null values are supported by ALTER TABLE, CREATE TABLE and INSERT - SQL. Other commands are unaffected by SET NULL.

SET NULL is scoped to the current data session.


SET NULL Command Example

The following example demonstrates how SET NULL affects support for null values. The first table, employee, is created with SET NULL ON, so its fields support null values. REPLACE is used to place a null value in the cLastName field. The second table, staff, is created with SET NULL OFF, so its fields do not support null values. REPLACE is used to place zero in the cLastName field.

CLOSE DATABASES

SET NULL ON                    && Fields will support null values

CREATE TABLE employee (cLastName C(20), ySalary Y(12,2))

APPEND BLANK                   && Add a new blank record

REPLACE cLastName WITH .NULL.  && cLastName supports null values

SET NULL OFF                   && Fields will not support null values

CREATE TABLE staff (cLastName C(20), ySalary Y(12,2))

APPEND BLANK                   && Add a new blank record

REPLACE cLastName WITH 0       && Doesn't support null values


See Also

ALTER TABLE
CREATE TABLE
INSERT - SQL
ISNULL( )
NVL( )
SET DATASESSION


SET NULLDISPLAY Command

Syntax         Arguments         Remarks          See Also

Specifies the text displayed for null values.

Syntax

SET NULLDISPLAY TO [cNullText]

Arguments

cNullText   Specifies the text that is displayed for null values. If cNullText is omitted, the default null value text, .NULL., is restored and displayed for null values.

Remarks

By default, Visual FoxPro displays .NULL. for null values in objects, Browse windows, DISPLAY output, LIST output, and so on. Use SET NULLDISPLAY to change the default null value text to a different character string. SET NULLDISPLAY changes the default null value text for all objects for which the NullDisplay property is the empty string.

Use the NullDisplay property to change the default null value text to a different character string for an individual object.


See Also

CREATE TABLE - SQL,
SQL NullDisplay Property


SET ODOMETER Command

Syntax         Arguments         Remarks         See Also

Specifies the reporting interval of the record counter for commands that process records.

Syntax

SET ODOMETER TO [nRecords]

Arguments

TO [nRecords]   Specifies the reporting interval in number of records. The value of nRecords can range from 1 to 32,767 records. The default value is 100 records.

Remarks

Use SET ODOMETER to change the interval at which commands display information about the number of records processed.

For example, COPY TO displays the number of records that are copied to a new file while the command is executing. The record counter can be turned off by issuing SET TALK OFF.


See Also

SET TALK
_TALLY


SET OLEOBJECT Command

Syntax         Arguments         Remarks         See Also

Specifies whether Visual FoxPro searches the OLE Registry when an object cannot be located.

Syntax

SET OLEOBJECT ON | OFF

Arguments

ON   (Default) Specifies that Visual FoxPro searches the OLE Registry when an object cannot be located.

OFF   Specifies that Visual FoxPro does not search the OLE Registry when an object cannot be located.

Remarks

When an object is created with CREATEOBJECT( ) or GETOBJECT( ), Visual FoxPro searches for the object in the following locations and order:

1.	The Visual FoxPro base classes.

2.	Class definitions in memory in the order they are loaded.

3.	Class definitions in the current program.

4.	Class definitions in the .VCX class libraries opened with SET CLASSLIB.

5.	Class definitions in procedure files opened with SET PROCEDURE.

6.	Class definitions in the Visual FoxPro program execution chain.

7.	The OLE Registry.

When Visual FoxPro searches for an object, the OLE Registry is searched last. Visual FoxPro loads OLE support before it searches the OLE Registry, increasing the amount of memory required by Visual FoxPro and reducing the amount of memory available to other applications.

If you are developing an application that does not require OLE support, issue SET OLEOBJECT OFF to prevent Visual FoxPro from searching the OLE Registry when an object cannot be located.

SET OLEOBJECT does not affect OLE objects in Forms or General fields. Visual FoxPro always loads OLE support when a Form containing an OLE object is opened for modification or is instantiated, or a table with a general field is opened.

Because GETOBJECT( ) activates an OLE object, Visual FoxPro generates an error when GETOBJECT( ) is issued and SET OLEOBJECT is OFF.


See Also

CREATEOBJECT( )
GETOBJECT( )


SET OPTIMIZE Command

Syntax         Arguments         Remarks         See Also

Enables or disables Rushmore optimization.

Syntax

SET OPTIMIZE ON | OFF

Arguments

ON   (Default) Enables Rushmore optimization.

OFF   Disables Rushmore optimization.

Remarks

Visual FoxPro uses a technology called Rushmore to optimize data retrieval. Table commands that support a FOR clause use Rushmore technology to enhance their performance. When you issue a command that is optimizable, Rushmore determines which records match the FOR criterion. The command is executed on records in the table that match the Rushmore record set.

In rare cases, you should disable Rushmore optimization. If a command that benefits from Rushmore optimization modifies a query’s index keys, the Rushmore record set may become outdated. You can disable Rushmore optimization to ensure that you have the most current information from the table.

You can use SET OPTIMIZE to globally enable or disable Rushmore technology. Every command that uses Rushmore has a NOOPTIMIZE clause you can include to disable Rushmore optimization for the command.

For more information, see “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

Here are the commands whose performance is optimized by Rushmore:

Commands
AVERAGE	INDEX
BLANK	LABEL
BROWSE	LIST
CALCULATE	LOCATE
CHANGE	RECALL
COPY TO	REPLACE
COPY TO ARRAY	REPLACE FROM ARRAY
COUNT	REPORT
DELETE	SCAN
DISPLAY	SORT
EDIT	SUM
EXPORT	TOTAL


See Also

INDEX
SET ORDER


SET ORDER Command

Syntax         Arguments         Remarks         See Also

Designates a controlling index file or tag for a table.

Syntax

SET ORDER TO
[nIndexNumber | IDXIndexFileName | [TAG] TagName [OF CDXFileName]
[IN nWorkArea | cTableAlias]
[ASCENDING | DESCENDING]]

Arguments

nIndexNumber   Specifies the number of the controlling index file or tag. nIndexNumber refers to the index files as they are listed in USE or SET INDEX. Open .IDX files are numbered first in the order in which they appear in USE or SET INDEX. Tags in the structural .CDX file (if one exists) are then numbered in the order in which they were created. Finally, tags in any open independent .CDX files are numbered in the order in which they were created.

The following example illustrates how different index file types and tags are numbered. (The file names are for illustration only and don’t necessarily exist.) A table named video.dbf is opened with three indexes (title.idx, costs.cdx, and rating.idx) in the first work area with this command:

USE video INDEX title.idx, costs.cdx, rating.idx IN 1

The video table has a structural compound index file (video.cdx) with two tags, NUMBERSOLD and YEARSOLD. The structural .CDX file is automatically opened when video is opened.

Since .IDX files are numbered first, issue SET ORDER TO 1 to make title.idx the controlling index and SET ORDER TO 2 to make rating.idx the controlling index:

SET ORDER TO 1

Controlling index: C:\FOX30\TITLE.IDX

SET ORDER TO 2

Controlling index: C:\FOX30\RATING.IDX

The tags in video.cdx are numbered next:

SET ORDER TO 3

Controlling index: C:\FOX30\VIDEO.CDX  Tag: NUMBERSOLD

SET ORDER TO 4

Controlling index: C:\FOX30\VIDEO.CDX  Tag: YEARSOLD

Finally, the tags in the independent  file, costs.cdx, are numbered:

SET ORDER TO 5

Controlling index: C:\FOX30\COSTS.CDX  Tag: RENTALCOST

SET ORDER TO 6

Controlling index: C:\FOX30\COSTS.CDX  Tag: BUYCOST

nIndexNumber can also be 0. If you issue SET ORDER TO 0, all index files remain open and are updated when records are added, deleted or modified. However, the records in the table are displayed and accessed in record number order and not in an indexed order. Issuing SET ORDER TO without additional arguments is identical to issuing SET ORDER TO 0.

If nIndexNumber is greater than the number of .IDX files and .CDX file tags, Visual FoxPro generates an error message.

IDXIndexFileName   Specifies an .IDX file as the controlling index file.

[TAG] TagName [OF CDXFileName]   Specifies a tag of a .CDX file as the controlling tag. The tag name can be from a structural .CDX file or any open independent .CDX file.

If identical tag names exist in open independent .CDX files, use OF CDXFileName to specify the .CDX file containing the tag.

Note   The .IDX file takes precedence if duplicate .IDX file and tag names exist.

IN nWorkArea | cTableAlias   Designates a controlling index file or tag for a table open in a work area other than the currently selected work area. nWorkArea specifies the work area number and cTableAlias specifies the alias for a table.

ASCENDING | DESCENDING   Displays and allows access to table records in ascending or descending order. Including ASCENDING or DESCENDING doesn’t change the index file or tag in any way.

Remarks

A table can have many index files open simultaneously. However, only one single-index (.IDX) file (the controlling index file) or tag from a compound index (.CDX) file (the controlling tag) determines the order in which the records in a table are displayed or accessed. SET ORDER lets you designate the controlling index file or tag. Certain commands (SEEK, for example) use the controlling index file or tag to search for records.

You can open index files with a table by including the INDEX clause in the USE command. If a table has an associated structural .CDX file, that file is automatically opened with the table. After a table has been opened, you can open and close index files for the table using SET INDEX.

By default, SET ORDER designates the controlling index or controlling tag for the table open in the currently selected work area.


See Also

INDEX
ORDER( )
SET INDEX


SET PALETTE Command

Syntax         Arguments         Remarks         See Also

Specifies whether the Visual FoxPro default color palette is used.

Syntax

SET PALETTE ON | OFF

Arguments

ON   (Default) Restores the default Visual FoxPro color palette.

OFF   Replaces the Visual FoxPro default color palette with color palettes from the .BMP graphics and OLE objects.

Remarks

OLE objects and .BMP graphics can contain color palettes that determine how the graphics and objects appear when they are displayed. The color palette of the first graphic or object displayed is used for all subsequent graphics or objects. Since a single color palette is used for all the graphics and objects, the colors of some of the graphics and objects may be changed in an unexpected manner.

The default Visual FoxPro color palette is designed to improve the display appearance of multiple .BMP graphics and OLE objects.


See Also

@ ... SAY
MODIFY GENERAL


SET PATH Command

Syntax         Arguments         Remarks         See Also

Specifies a path for file searches.

Syntax

SET PATH TO [Path]

Arguments

TO [Path]   Specifies the directories you want Visual FoxPro to search. Use commas or semicolons to separate the directories.

Note   Visual FoxPro will not recognize a path name properly if a disk or directory name contains an exclamation point (!).

On all FoxPro platforms, functions that return path information, such as CURDIR( ), DBF( ), and SYS(2003), use MS-DOS path-naming conventions in their return values.

Remarks

Issue SET PATH TO without Path to restore the path to the default directory. Use SET DEFAULT to specify the default directory and CURDIR( ) to return the current default directory.

SET PATH is not scoped to the current data session; changes you make to the default path using the SET PATH command affect all data sessions.


See Also

CD | CHDIR
GETFILE( )
LOCFILE( )
MD | MKDIR
RD | RMDIR
SET DEFAULT
SET DATASESSION


SET PDSETUP Command

Syntax          Arguments          Remarks           See Also

Loads a printer driver setup or clears the current printer driver setup.

Syntax

SET PDSETUP TO [[cPrinterDriverSetup [, Parameter1[, Parameter2 ...]]]
[WITH Parameter3 [, Parameter4 ...]]]

Arguments

cPrinterDriverSetup   Specifies the name of the printer driver setup to load.

When you load a printer driver setup, the name of the setup is stored in the _PDSETUP system variable, and a special variable array, _PDPARMS, can be created. (_PDPARMS is discussed in detail under the WITH clause in this topic.)

If the printer driver setup name you specify with cPrinterDriverSetup doesn’t exist in your resource file, the current printer driver setup application is executed so you can create a setup with this name. If the current printer driver setup application is GENPD.APP, the Printer Setup Editing dialog box appears so you can create the setup.

If the setup name begins with a dash (-), the _GENPD program won’t be executed, but the name following the dash is stored in _PDSETUP.

If you issue SET PDSETUP TO without cPrinterDriverSetup, the current printer driver setup is cleared, the empty string is stored in _PDSETUP, and the _PDPARMS array is cleared from memory.

Parameter1 [, Parameter2 ...]   Specifies any number of optional parameters. These parameters are passed to the printer setup interface application and can be of any type (character, numeric, logical, and so on). The first line in your printer setup interface application must be an LPARAMETERS or PARAMETERS statement to accept the parameters passed from SET PDSETUP.

If you are using GENPD.APP, don’t include these optional parameters. GENPD.APP doesn’t accept parameters passed from SET PDSETUP, so including them generates an error.

WITH Parameter3 [, Parameter4 ...]   Creates the special _PDPARMS printer array. Each parameter you specify with Parameter3, Parameter4, and so forth  becomes an element in _PDPARMS. The first parameter (Parameter3) is stored to the first element of _PDPARMS, the second parameter (Parameter4) is stored to the second element, and so on. These parameters may be of any type (character, numeric, logical, and the like).

If you are using GENPD.APP, any parameters you include are overwritten by the application.

Remarks

In Visual FoxPro, a printer driver setup is used when you print character-based reports created in FoxPro for MS-DOS.

A printer driver setup consists of a combination of settings, including the printer driver program and information such as page orientation, default font size and font style, margins, and so on. Printer driver setups are stored in your FoxPro for MS-DOS resource file, FOXUSER.DBF, and can be created interactively and assigned a name in the Printer Setup Editing dialog box.

A printer driver setup can also be loaded or cleared with the _PDSETUP system variable.

When you issue SET PDSETUP, the current printer setup interface application is executed. The interface application is passed the name of the printer driver setup included in SET PDSETUP. The interface application can also be specified with the _GENPD system variable. The default interface application is GENPD.APP, the printer setup interface application included with FoxPro for MS-DOS.


See Also

_GENPD
_PDRIVER
_PDSETUP
SET PRINTER


SET POINT Command

Syntax         Arguments         Remarks         Example         See Also

Determines the decimal point character used in the display of numeric and currency expressions.

Syntax

SET POINT TO [cDecimalPointCharacter]

Arguments

cDecimalPointCharacter   Specifies the character for the decimal point.

Remarks

Use SET POINT to change the decimal point from the default, which is a period (.). Issue SET POINT TO without cDecimalPointCharacter to reset the decimal point to a period. Although you can set the displayed decimal point to a different character, you must use a period as the decimal point in calculations.

SET POINT is scoped to the current data session.


SET POINT Command Example

gnX = 1.25

gcNewPoint = '_'

SET POINT TO gcNewPoint

? gnX

SET POINT TO	&& Reset the decimal point to a period (.)

? gnX


See Also

SET DATASESSION
SET DECIMALS
SET FIXED
SET SEPARATOR
SET SYSFORMATS


SET PRINTER Command

Syntax         Arguments         Remarks         See Also

Enables or disables output to the printer, or routes output to a file, port, or network printer.

Syntax

SET PRINTER ON [PROMPT] | OFF
 – or –
SET PRINTER FONT cFontName [, cFontSize]
[STYLE cFontStyle]
– or –
SET PRINTER TO [FileName [ADDITIVE] | PortName]
– or –
SET PRINTER TO [DEFAULT | NAME WindowsPrinterName]
 – or –
SET PRINTER TO NAME \\ServerName\PrinterName

Arguments

ON [PROMPT]   Enables output to the printer. Output formatted with @ ... SAY isn’t routed to the printer when SET PRINTER is set to ON. Use SET DEVICE TO PRINTER to direct output from @ ... SAY to the printer.

You can include PROMPT to display a dialog box before printing starts. In this dialog box you can adjust printer settings. The currently installed printer driver determines which printer settings you can adjust.

OFF   (Default) Disables output to the printer.

FONT cFontName [, cFontSize]   Specifies a default font for printer output. cFontName specifies the name of the font, and cFontSize specifies the point size. For example, the following command specifies 16-point Courier font as the default printer font:

SET PRINTER FONT 'Courier', 16

If the font you specify is not available, a font with similar font characteristics is substituted.

STYLE cFontStyle   Specifies a default font style for printer output. If you omit the STYLE clause, the normal font style is used.

If the font style you specify is not available, a font style with similar characteristics is substituted.

The font styles you can specifiy with cFontStyle are as follows:

Character	Font Style
B	Bold
I	Italic
N	Normal
O	Outline
Q	Opaque
S	Shadow
-	Strikeout
T	Transparent
U	Underline
You can include more than one character to specify a combination of font styles. For example, the following command specifies 16-point Courier Bold Italic:

SET PRINTER FONT 'Courier', 16 STYLE 'BI'

TO [FileName [ADDITIVE] | PortName]   Specifies a file or port to which output is directed.

In Visual FoxPro, use SET PRINTER TO NAME instead to specify a printer.

FileName specifies a file name to which output is directed. If you include ADDITIVE, output is appended to the existing contents of the file. If you omit ADDITIVE, the existing contents of the file are overwritten.

PortName sends output to a different local printer.

TO [DEFAULT | NAME WindowsPrinterName]   Sends printer output to the default Windows printer or to a specific Windows printer. Windows printer names are stored in WIN.INI.

You can use GETPRINTER( ) or APRINTERS( ) to determine the names of the currently installed printers. For example, the following command displays the Windows Print Setup dialog box and makes printer you select the printer to which printed output is directed:

SET PRINTER TO NAME GETPRINTER( )

TO NAME \\ServerName\PrinterName   Supported only under Windows NT. Spools printer output to a network printer.

ServerName is the network name assigned to your print server. This name is assigned by the network administrator and must be unique.

PrinterName is a name assigned to the printer and is also assigned by the network administrator.

Remarks

Use SET PRINTER TO with the specified arguments to direct output to a file, a port for a different local printer, or a network printer.

Use SET PRINTER TO without an argument to reset output to the default MS-DOS PRN print utility.

When you direct output to a network printer, output prints or collects in a print spooler until a new SET PRINTER command is issued. For additional information about printing on your network, consult your network documentation.


See Also

APRINTERS( )
GETPRINTER( )
PRINTSTATUS( )
SET DEVICE


SET PROCEDURE Command

Syntax         Arguments         Remarks         See Also

Opens a procedure file.

Syntax

SET PROCEDURE TO [FileName1 [, FileName2, ...]]
[ADDITIVE]

Arguments

FileName1 [, FileName2, ...]   Specifies the sequence in which files are to be opened. SET PROCEDURE can take more than one file name, allowing you to open several procedure files at once. This option allows you to create stand-alone libraries of functions and specify them separately.

ADDITIVE   Opens additional procedure files without closing currently open procedure files.

Remarks

Issuing SET PROCEDURE TO without any file names closes all open procedure files. Use RELEASE PROCEDURE to close individual files.

When you execute a procedure, the procedure files are searched if the procedure isn’t located in the currently executing program.

For more information about procedure files, see PROCEDURE and DO.


See Also

PROCEDURE
RELEASE PROCEDURE


SET READBORDER Command

Syntax         Arguments         Remarks         Example         See Also

Determines whether borders are placed around text boxes created with @ ... GET.

Syntax

SET READBORDER ON | OFF

Arguments

ON   Places a single-line border around all text boxes created with @ ... GET. If SET READBORDER is set to ON when the first text box is created, all subsequent text boxes created in the same READ level also have borders.

OFF   (Default) Specifies that a border isn’t placed around text boxes created with @ ... GET. If SET READBORDER is set to OFF when the first text box is created, all subsequent text boxes created in the same READ level do not have borders.

Remarks

SET READBORDER specifies whether single-line borders are placed around text boxes created with @ ... GET.


SET READBORDER Command Example

In the following example, the first three text boxes created with @ ... GET have borders. The third text box has a border, even though SET READBORDER was SET to OFF before it was created. The fourth text box does not have a border, since READBORDER was SET to OFF and it is encompassed in a different READ from the first three text boxes.

SET READBORDER ON

@ 2,2 GET gnW DEFAULT 1	&& 1st READ

@ 4,2 GET gnX DEFAULT 1	&& 1st READ

SET READBORDER OFF

@ 6,2 GET gnY DEFAULT 1	&& 1st READ

READ

@ 8,2 GET gnZ DEFAULT 2	&& 2nd READ

READ


See Also

READ
READ EVENTS


SET REFRESH Command

Syntax         Arguments         Remarks         See Also

Determines whether and how often a Browse window is updated with changes made to records by other users on the network.

Syntax

SET REFRESH TO nSeconds1 [, nSeconds2]

Arguments

TO nSeconds1 [, nSeconds2]   Specifies whether and how often updates are made. nSeconds1 specifies the number of seconds between updates to a Browse or memo-editing window. nSeconds1 can be a value from 0 to 3,600; the default value is 0 seconds. When nSeconds1 is a nonzero value and other users change records you are viewing, those records are updated when the refresh interval elapses. The records you are viewing aren’t updated if nSeconds1 is 0.

Visual FoxPro buffers portions of tables in memory on your workstation. nSeconds2 specifies how often these local data buffers are updated with current data from the network. nSeconds2 is the number of seconds between data buffer updates. You can specify a value between 0 and 3,600; the default value is 5. The buffers are never refreshed if nSeconds2 is set to 0.

If you specify a value for nSeconds1 other than 0 but don’t include nSeconds2, nSeconds2 is set to the same value as nSeconds1. However, nSeconds2 is set to 5 if you specify 0 for nSeconds1 and don’t include nSeconds2.

Performance can be improved by increasing the value of nSeconds2.

Remarks

Because tables can be opened for shared use on a network, it is possible that records you are viewing in a Browse window are being edited by other users on the network.

SET REFRESH affects records displayed in a Browse window opened with BROWSE, CHANGE, or EDIT. Memo fields opened for editing in a Browse window are also updated.

SET REFRESH can also be used to specify how often data buffered locally on your workstation is updated.


See Also

BROWSE
CHANGE
EDIT
MODIFY MEMO
SET DATASESSION


SET RELATION Command

Syntax         Arguments         Remarks         See Also

Establishes a relationship between two open tables.

Syntax

SET RELATION TO
[eExpression1 INTO nWorkArea1 | cTableAlias1
[, eExpression2 INTO nWorkArea2 | cTableAlias2 ...]
[IN nWorkArea | cTableAlias]
[ADDITIVE]]

Arguments

eExpression1   Specifies the relational expression that establishes a relationship between the parent and child tables. The relational expression is usually the index expression of the controlling index of the child table.

The index for the child table can be a single-entry (.IDX ) index, a multiple-entry structural compound (.CDX) index, or an independent compound index. If the index is compound, specify the proper index tag to order the child table. SET ORDER can be used to specify the index tag that orders the child table.

For example, consider the customer and orders tables described in the Remarks section below. Suppose the child orders table has been indexed and ordered on the customer number with this command:

SET ORDER TO TAG cust_id

To relate the customer and orders tables on customer number, select the work area containing the customer parent table or include the IN clause to specify the parent table’s work area or alias, and issue SET RELATION, specifying the index expression with the following relational expression:

SET RELATION TO cust_id INTO orders

The child table must be indexed unless the relational expression is numeric. Visual FoxPro displays an error message if you issue SET RELATION with a non-numeric relational expression and the child table isn’t ordered with an index.

If eExpression1 is numeric, it is evaluated when the record pointer in the parent table is moved. The record pointer in the child table is then moved to record number eExpression1.

INTO nWorkArea1 | cTableAlias1   Specifies the work area number (nWorkArea1) or table alias (cTableAlias1) of the child table.

eExpression2 INTO nWorkArea2 | cTableAlias2 ...   Specifies a relational expression (eExpression2) and a child table or tables to establish an additional relationship between the parent table and child tables. From a single SET RELATION command, you can create multiple relations between a single parent table and various child tables. Precede each relation by a comma.

nWorkArea2 specifies a work area number and cTableAlias2 specifies a table alias for the child table.

IN nWorkArea   Specifies the work area of the parent table.

IN cTableAlias   Specifies the alias of the parent table.

The IN clause allows you to create a relationship without first selecting the parent table’s work area. If you omit nWorkArea and cTableAlias, the parent table must be open in the currently selected work area.

ADDITIVE   Preserves all existing relationships in the current work area and creates the specified relationship. If you omit ADDITIVE, any relationships in the current work area are broken and the specified relationship is created.

Remarks

Before you can establish a relationship, one table (the parent table) must be open, and the other table (the child table) must be open in another work area.

Related tables typically have a common field. For example, suppose a table named customer contains customer information. It has fields for name, address, and a unique customer number. A second table named orders contains order information. It too has a field for the customer number, along with fields for dates and shipping information.

SET RELATION relates these two tables on their common field — the customer number field. To set the relation, the child table must be indexed on the common field. After you set the relation, whenever you move the record pointer to a record with a given customer number in the parent customer table, the record pointer in the child orders table moves to the record with the same customer number. If a matching record can’t be found in the child table, the record pointer in the child table is positioned at the end of the table.

Issue SET RELATION TO with no arguments to remove all relationships in the currently selected work area. SET RELATION OFF can be used to remove a specific parent-child relationship.


See Also

INDEX
RELATION( )
SET ORDER
SET RELATION OFF
SET SKIP
TARGET( )


SET RELATION OFF Command

Syntax         Arguments         See Also

Breaks an established relationship between the parent table in the currently selected work area, and a related child table.

Syntax

SET RELATION OFF INTO nWorkArea | cTableAlias

Arguments

INTO nWorkArea | cTableAlias   Specifies the child table’s work area number or table alias.


See Also

RELATION( )
SELECT
SET RELATION
SET SKIP
TARGET( )


SET REPROCESS Command

Syntax         Arguments         Remarks         See Also

Specifies how many times and for how long Visual FoxPro attempts to lock a file or record after an unsuccessful locking attempt.

Syntax

SET REPROCESS TO nAttempts [SECONDS] | TO AUTOMATIC

Arguments

TO nAttempts [SECONDS]   Specifies the number of times Visual FoxPro attempts to lock a record or file after an initial unsuccessful attempt. The default value is 0, the maximum value is 32,000.

SECONDS specifies that Visual FoxPro attempts to lock a file or record for nAttempts seconds. It’s available only when nAttempts is greater than zero.

For example, if nAttempts is 30, Visual FoxPro attempts to lock a record or file up to 30 times. If you also include SECONDS (SET REPROCESS TO 30 SECONDS), Visual FoxPro continuously attempts to lock a record or file for up to 30 seconds.

A system message (“Waiting for lock ... “) appears if SET STATUS is set to ON.

If an ON ERROR routine is in effect and attempts by a command to lock the record or file are unsuccessful, the ON ERROR routine is executed. However, if a function attempts the lock, an ON ERROR routine isn’t executed and the function returns false (.F.).

If an ON ERROR routine isn’t in effect, a command attempts to lock the record or file, and the lock can’t be placed, an appropriate alert appears (for example, “Record is in use by another”). If a function attempts to place the lock, the alert isn’t displayed and the function returns false (.F.).

If nAttempts is 0 (the default value) and you issue a command or function that attempts to lock a record or file, Visual FoxPro tries to lock the record or file indefinitely. Visual FoxPro displays the system message, “Attempting to lock... Press Escape to Cancel,” while attempting to lock the record or file. The lock is placed and the system message is cleared if the record or file becomes available for locking while you wait. If a function attempted to place the lock, the function returns true (.T.).

If you press ESC in response to the system message, an appropriate alert appears (for example, “Record is in use by another”). If a function attempts to place the lock, the alert isn’t displayed and the function returns false (.F.).

If an ON ERROR routine is in effect and a command is attempting to lock the record or file, the ON ERROR routine takes precedence over additional attempts to lock the record or file. The ON ERROR routine is immediately executed. Visual FoxPro does not attempt additional record or file locks and does not display the system message.

If nAttempts is –1, Visual FoxPro attempts to lock the record or file indefinitely. You can’t cancel the locking attempts by pressing the ESC key, and an ON ERROR routine isn’t executed.

Setting nAttempts to -2 is equivalent to using the TO AUTOMATIC clause.

Visual FoxPro displays the “Waiting for lock ... ” system message only if SET STATUS is set to ON.

If a lock has been placed by another user on the record or file you are attempting to lock, you must wait until the user releases the lock.

TO AUTOMATIC   Specifies that Visual FoxPro attempts to lock the record or file indefinitely (equivalent to setting nAttempts to –2). This clause is similar to setting nAttempts to -1, except that it includes the facility to quit the attempt to lock a record or file.

The “Attempting to lock ... Press Escape to Cancel” system message appears while Visual FoxPro attempts to lock the record or file. The lock is placed and the system message is cleared if the record or file becomes available for locking while you wait. If a function is used to place the lock, the function returns true (.T.).

If an ON ERROR routine isn’t in effect and you press ESC in response to the system message, an appropriate alert appears (for example, “Record is in use by another”). If a function attempts to place the lock, the alert isn’t displayed and the function returns false (.F.).

If an ON ERROR routine is in effect and ESC is pressed, the ON ERROR routine is executed. If a function attempts to place the lock, an ON ERROR routine isn’t executed and the function returns false (.F.).

For more information about record and file locking and sharing tables on a network, see Chapter 17, “Programming for Shared Access,” in the Developer’s Guide.

Remarks

The first attempt to lock a record or file isn’t always successful. Frequently, a record or file is locked by another user on the network. SET REPROCESS determines whether Visual FoxPro makes additional attempts to lock the record or file when the initial attempt is unsuccessful. You can specify either how many times additional attempts are made or for how long the attempts are made. An ON ERROR routine affects how unsuccessful lock attempts are handled.

SET REPROCESS is scoped to the current data session.


See Also

FLOCK( )
SET DATASESSION


SET RESOURCE Command

Syntax         Arguments         Remarks         See Also

Updates or specifies a resource file.

Syntax

SET RESOURCE ON | OFF
 – Or –
SET RESOURCE TO [FileName]

Arguments

ON   (Default) Specifies that changes made to the Visual FoxPro environment are saved to the resource file.

OFF   Specifies that changes made to the Visual FoxPro environment are not saved to the resource file.

TO [FileName]   Specifies that changes made to the Visual FoxPro environment are saved to a resource file (FileName) other than the default FOXUSER.DBF resource file.

Issue SET RESOURCE TO without a resource file name to open the default FOXUSER.DBF resource file. Issuing SET RESOURCE TO performs an implicit SET RESOURCE ON.

Remarks

The resource file is a Visual FoxPro table that contains information on system and user-defined resources such as keyboard macros, preferences, system window locations and sizes, diary entries, and so on.


See Also

SYS(2005) - Current Resource File


SET SAFETY Command

Syntax         Arguments         Remarks         See Also

Determines whether Visual FoxPro displays a dialog box before overwriting an existing file, or whether table or field rules, default values, and error messages are evaluated when changes are made in the Table Designer or with ALTER TABLE.

Syntax

SET SAFETY ON | OFF

Arguments

ON   (Default) Specifies that a dialog box is displayed before you overwrite an existing file. The dialog box gives you the option of overwriting the existing file.

For the Table Designer, specifies that table or field rules, default values, and error messages are evaluated when you save changes to a table’s structure. Data validation occurs for new or modified validation rules after you save the table structure changes. If a validation rule contains a UDF (user-defined function), the UDF isn’t evaluated and the validation rule is ignored.

For ALTER TABLE, table or field rules, default values, and error messages are evaluated when ALTER TABLE changes the table’s structure. Data validation occurs for new or modified validation rules when ALTER TABLE changes the table’s structure. If a validation rule contains a UDF (user-defined function), the UDF isn’t evaluated and the validation rule is ignored.

OFF   Specifies that a dialog box isn’t displayed before an existing file is overwritten.

For the Table Designer, specifies that table or field rules, default values, and error messages are not evaluated when you save changes to a table’s structure. However, data validation occurs for new or modified validation rules after you save the table structure changes.

For ALTER TABLE, table or field rules, default values, and error messages are not evaluated when ALTER TABLE changes the table’s structure. Data validation does not occur for new or modified validation rules after ALTER TABLE changes the table’s structure.

Remarks

SET SAFETY is scoped to the current data session.


See Also

ALTER TABLE - SQL
MODIFY STRUCTURE
SET DATASESSION
SET TALK


SET SECONDS Command

Syntax         Arguments         Remarks         Example         See Also

Specifies whether seconds are displayed in the time portion of a DateTime value.

Syntax

SET SECONDS ON | OFF

Arguments

ON   (Default) Specifies that seconds are displayed in DateTime values.

OFF   Specifies that seconds are not displayed in DateTime values.

Remarks

SET SECONDS is scoped to the current data session.


SET SECONDS Command Example

The following example demonstrates the effect of the SET SECONDS setting on the time value returned by DATETIME( ). When SET SECONDS is ON, the time value is displayed with the seconds portion. When SET SECONDS is OFF, the time value is displayed without the seconds portion.

SET SECONDS ON

CLEAR

? DATETIME( )  && Displays time value with the seconds portion

SET SECONDS OFF  && Displays time value without the seconds portion

? DATETIME( )


See Also

CTOT( )
DATE( )
DATETIME( )
DTOT( )
HOUR( )
MINUTE( )
SEC( )
SECONDS( )
SET SECONDS
TIME( )


SET SEPARATOR Command

Included for backward compatibility. Use the Windows Control Panel instead.


SET SKIP Command

Syntax         Arguments         Remarks         Example         See Also

Creates a one-to-many relationship among tables.

Syntax

SET SKIP TO [TableAlias1 [, TableAlias2] ...]

Arguments

TO TableAlias1 [, TableAlias2] ...   Specifies the aliases of multiple child tables. These are used to create a one-to-many relationship with a parent table. Use commas to separate the aliases. In commands that support a scope (DISPLAY, LIST, and so on), records in the parent table are repeated for each corresponding record in the child table.

Use SET SKIP TO without additional arguments to remove the one-to-many relationship from the parent table open in the currently selected work area. Any one-to-one relationships remain in effect. One-to-one relationships can be removed with SET RELATION TO.

Remarks

Using SET RELATION, you can establish relations between tables open in different work areas. When the record pointer is moved in the parent table, the record pointer in the child table moves to the first corresponding record. The relational expression in SET RELATION determines where the record pointer moves in the child table. A one-to-one relation is created — for each record in the parent table, the record pointer moves to the first matching record in the child table. If a matching record can’t be found in the child table, the record pointer in the child table moves to the end of the table.

Frequently, a child table contains multiple records that correspond to one record in the parent table. SET SKIP lets you establish a one-to-many relationship between one record in the parent table and multiple records in the child table. When you skip through the parent table, the record pointer remains on the same parent record until the record pointer moves through all related records in the child table.

To establish a one-to-many relationship, first create the relationship between the parent and child table with SET RELATION. Then, issue SET SKIP to create a one-to-many relationship.


SET SKIP Command Example

This example below finds all occurences in three tables where each item in the first field are the same. It does this by using scanning the first table which has a relation into a second, which table has a relation into a third. The first table then does a SET SKIP for the other two tables. A SET SKIP on the second table has no effect. It affects only the table being scanned (replaced, etc.).  In the example, eight matches are found.

CLOSE DATABASES

* Creates parent table with values a and b in Name field

CREATE TABLE Parent FREE (Name C(1), Val C(10))

INSERT INTO Parent VALUES ('a', 'Parent.a1')

INSERT INTO Parent VALUES ('b', 'Parent.b1')

SELECT 0	  && Child1 will have two a's and two b's

CREATE TABLE Child1 FREE (Name1 C(1), Val C(10))

INSERT INTO Child1 VALUES ('a', 'Child1.a1')

INSERT INTO Child1 VALUES ('b', 'Child1.b1')

INSERT INTO Child1 VALUES ('b', 'Child1.b2')

INSERT INTO Child1 VALUES ('a', 'Child1.a2')

INDEX ON Name1 TAG tagName     && The tag name is irrelevant

SELECT 0    && Child2 will have two a's and two b's

CREATE TABLE Child2 FREE (Name2 C(1), Val C(10))

INSERT INTO Child2 VALUES ('b', 'Child1.b1')

INSERT INTO Child2 VALUES ('b', 'Child1.b2')

INSERT INTO Child2 VALUES ('a', 'Child1.a1')

INSERT INTO Child2 VALUES ('a', 'Child1.a2')

INDEX ON Name2 TAG tagName	  && The tag name is irrelevant

SELECT Child1

SET RELATION TO Name1 INTO Child2

SELECT Parent

SET RELATION TO Name INTO Child1

SET SKIP TO Child1, Child2   && Parent gets both skips.

                             && Otherwise, only four record triplets

                             && would be listed.

SCAN ALL  && There will be eight triplets: four a's and four b's

? Parent.Val, Child1.Val, Child2.Val

ENDSCAN


See Also

RELATION( )
SET RELATION
SKIP


SET SKIP OF Command

Syntax         Arguments         Remarks         See Also

Enables or disables a menu, menu bar, menu title, or menu item for user-defined menus or the Visual FoxPro system menu.

Syntax

SET SKIP OF MENU MenuBarName1 lExpression1
 – Or –
SET SKIP OF PAD MenuTitleName OF MenuBarName2 lExpression2
 – Or –
SET SKIP OF POPUP MenuName1 lExpression3
 – Or –
SET SKIP OF BAR nMenuItemNumber | SystemItemName
OF MenuName2 lExpression4

Arguments

MENU MenuBarName1 lExpression1   Enables or disables the Visual FoxPro system menu bar or user-defined menu bar created with DEFINE MENU. For example, the Visual FoxPro system menu bar _MSYSMENU can be disabled with this command:

SET SKIP OF MENU _MSYSMENU .T.

It can be enabled with this command:

SET SKIP OF MENU _MSYSMENU .F.

PAD MenuTitleName OF MenuBarName2 lExpression2   Enables or disables a Visual FoxPro system menu title or a user-defined menu title created with DEFINE PAD. For example, the Visual FoxPro Edit menu title can be disabled with this command:

SET SKIP OF PAD _MSM_EDIT OF _MSYSMENU .T.

The menu title can be enabled with this command:

SET SKIP OF PAD _MSM_EDIT OF _MSYSMENU .F.

POPUP MenuName1 lExpression3   Enables or disables a Visual FoxPro system menu or a user-defined menu created with DEFINE POPUP. For example, the Visual FoxPro Edit menu can be disabled with this command:

SET SKIP OF POPUP _MEDIT .T.

The menu can be enabled with this command:

SET SKIP OF POPUP _MEDIT .F.

BAR nMenuItemNumber | SystemItemName OF MenuName2 lExpression4   Enables or disables a menu item on a Visual FoxPro system menu or a user-defined menu item created with DEFINE BAR. For example, the New command on the Visual FoxPro File menu can be disabled with this command:

SET SKIP OF BAR _MFI_NEW OF _MFILE .T.

where SystemItemName specifies the menu command _MFI_NEW, MenuName2 specifies the menu _MFILE, and lExpression4 specifies the logical expression .T.. The menu command can be enabled with this command:

SET SKIP OF BAR _MFI_NEW OF _MFILE .F.

Use nMenuItemNumber to specify a menu item created with DEFINE BAR.

Remarks

For a complete listing of the internal names of Visual FoxPro system menu components, see System Menu Names. You can also use SYS(2013) to return the system menu internal names.

If the logical expression lExpression evaluates to true (.T.), the menu, menu bar, menu name, or menu item included in SET SKIP OF is disabled, appears dimmed, and can’t be selected. If lExpression evaluates to false (.F.), the menu, menu bar, menu name, or menu item is enabled and can be selected.


See Also

CREATE MENU
DEFINE BAR
DEFINE MENU
DEFINE PAD
DEFINE POPUP
System Menu Names Overview
SKPBAR( )


SET SPACE Command

Syntax         Arguments         Example         See Also

Determines whether a space is displayed between fields or expressions when you use the ? or ?? command.

Syntax

SET SPACE ON | OFF

Arguments

ON   (Default) Inserts a space between fields and expressions.

OFF   Removes all spaces between fields or expressions and runs them together.


SET SPACE Command Example

gcX = 'John'

gcY = 'Smith'

SET SPACE OFF

? gcX,gcY

SET SPACE ON

? gcX,gcY


See Also

? | ??


SET STATUS Command

Included for backward compatibility. Use the StatusBarText Property instead.


SET STATUS BAR Command

Included for backward compatibility. Use the StatusBarText Property instead.


SET STEP Command

Syntax         Arguments         Remarks         See Also

Opens the Trace window and suspends program execution for debugging.

Syntax

SET STEP ON

Arguments

ON   Opens the Trace window and suspends program execution.

Remarks

SET STEP is used to debug programs. You can insert SET STEP ON in a program at the point where you’d like to execute individual commands.

For information about the Trace window, see the Trace Window topic and Chapter 14, “Testing and Debugging Applications,” in the Developer’s Guide.

You can pass parameters to a program and then trace its execution by following these steps:

1.	Open the Trace window.

2.	From the Trace window’s Program menu, choose Open and select the program to trace.

3.	Set a breakpoint on the first executable line of the program.

4.	In the Command window, DO the program WITH the parameters.


See Also

SET ECHO


SET SYSFORMATS Command

Syntax         Arguments         Remarks         See Also

Specifies whether Visual FoxPro for Windows system settings are updated with the current Windows system settings.

Syntax

SET SYSFORMATS ON | OFF

Arguments

ON   Specifies that the Visual FoxPro system settings are updated when the Windows system settings are changed. SET SYSFORMAT ON is identical to choosing the Use System Settings check box on the International tab of the Options dialog. Note that issuing SET SYSFORMAT ON changes the SET DATE setting to SHORT.

The settings are used for the duration of the current data session, or, if issued during the default data session, for the duration of the Visual FoxPro session.

OFF   (Default) Specifies that the Visual FoxPro system settings are not updated when the Windows system settings are changed. The Visual FoxPro default settings are not restored.

Remarks

The Windows system settings are specified in International option of the Windows Control Panel.

When SET SYSFORMATS is ON, the following SET commands can be used to override the current system settings. However, changing the Windows system settings when SET SYSFORMATS is ON overrides these SET commands:

•	SET CENTURY

•	SET CURRENCY

•	SET DATE

•	SET DECIMALS

•	SET HOURS

•	SET MARK TO

•	SET POINT

When Visual FoxPro is started, the Visual FoxPro system settings are the default settings of these SET commands. To use the Windows system settings when Visual FoxPro is started, place the following line in your Visual FoxPro CONFIG.FPW configuration file:

SYSFORMATS = ON

SET SYSFORMATS is scoped to the current data session.


See Also

SET CENTURY
SET CURRENCY
SET DATASESSION
SET DATE
SET DECIMALS
SET HOURS
SET MARK TO
SET POINT
SET SEPARATOR


SET SYSMENU Command

Syntax         Arguments         Remarks         See Also

Enables or disables the Visual FoxPro system menu bar during program execution, and allows you to reconfigure it.

Syntax

SET SYSMENU ON | OFF | AUTOMATIC
| TO [MenuList]
| TO [MenuTitleList]
| TO [DEFAULT] | SAVE | NOSAVE

Arguments

ON   Enables the main Visual FoxPro menu bar during program execution when Visual FoxPro is waiting for keyboard input during commands such as BROWSE, READ, and MODIFY COMMAND.

OFF   Disables the main Visual FoxPro menu bar during program execution.

AUTOMATIC   Makes the main Visual FoxPro menu bar visible during program execution. The menu bar is accessible and menu items are enabled and disabled as appropriate for the current command.

AUTOMATIC is the default setting.

TO [MenuList]
TO [MenuTitleList]    Specifies a subset of menus or menu titles for the main Visual FoxPro menu bar. The menu or menu title list can contain any combination of menus or menu titles separated by commas. The internal names for the menus and menu titles are listed in System Menu Names.

For example, the following command removes all menus from the main Visual FoxPro menu bar except the File and Window menus:

SET SYSMENU TO _MFILE, _MWINDOW

Use RELEASE BAR to specify the menu items available in the menus.

TO [DEFAULT]   Restores the main menu bar to its default configuration. If you have modified the main menu bar or its menus, issue SET SYSMENU TO DEFAULT to restore it. You can specify a default configuration with SET SYSMENU SAVE.

SAVE   Makes the current menu system the default configuration. If you modify the menu system after issuing SET SYSMENU SAVE, you can restore the previous configuration by issuing SET SYSMENU TO DEFAULT.

NOSAVE   Resets the menu system to the default Visual FoxPro system menu. However, the default Visual FoxPro system menu is not displayed until you issue SET SYSMENU TO DEFAULT.

Remarks

SET SYSMENU controls the main Visual FoxPro menu bar during program execution and lets you selectively remove menu titles and menus from and restore them to the main Visual FoxPro menu system.

Issuing SET SYSMENU TO without additional arguments disables the main Visual FoxPro menu bar.


See Also

System Menu Names
POP MENU
PUSH MENU
RELEASE
SYS(2013) - System Menu Name String


SET TALK Command

Syntax         Arguments         Remarks         See Also

Determines whether Visual FoxPro displays command results.

Syntax

SET TALK ON | OFF | WINDOW [WindowName] | NOWINDOW

Arguments

ON   (Default) Allows talk to be sent to the main Visual FoxPro window, the system message window, the graphical status bar, or a user-defined window. If SET TALK is set to OFF and is then changed to ON, the talk is directed to the same location it was sent to before you issued SET TALK OFF.

OFF   Prevents talk from being sent to the main Visual FoxPro window, the system message window, the graphical status bar, or a user-defined window.

WINDOW [WindowName]   WindowName specifies a user-defined window to which talk is directed. You must create the user-defined window before directing talk to it. Talk is directed to the Visual FoxPro system window if the window you specify doesn’t exist.

NOWINDOW   Directs talk to the main Visual FoxPro window.

Remarks

Some table processing commands return information, or “talk,” about their status while they execute. These commands include:

Commands

APPEND FROM	PACK
AVERAGE	REINDEX
CALCULATE	REPLACE
COPY TO	SELECT - SQL
COUNT	SORT
DELETE	SUM
INDEX	TOTAL
Talk can be directed to the main Visual FoxPro window, the graphical status bar, or a user-defined window. Talk can also be turned off.

The SET TALK reporting interval can be specified with SET ODOMETER. The default value for SET ODOMETER is 100. Note that execution speed can be degraded when SET TALK is set to ON, because the main Visual FoxPro window or user-defined window must be frequently updated. If you just need the total number of records processed by a command, you can issue SET TALK OFF and display the _TALLY system variable once the command has completed executing.

SET TALK is scoped to the current data session.


See Also

DEFINE WINDOW
SET DATASESSION
SET NOTIFY
SET ODOMETER
SYS(103) - Talk Setting
_TALLY


SET TEXTMERGE Command

Syntax         Arguments         Remarks         See Also

Enables or disables the evaluation of fields, variables, array elements, functions, or expressions that are surrounded by text-merge delimiters, and lets you specify text-merge output.

Syntax

SET TEXTMERGE
[ON | OFF]
[TO [FileName] [ADDITIVE]]
[WINDOW WindowName]
[SHOW | NOSHOW]

Arguments

ON   Specifies that any fields, variables, array elements, functions, or expressions surrounded by the text-merge delimiters be evaluated and output when placed after \ or \\, or between TEXT and ENDTEXT.

The following short program example demonstrates how the contents of the variable gcTodayDate and the DATE( ) and TIME( ) functions are evaluated when SET TEXTMERGE is set to ON. The variable gcTodayDate, DATE( ), and TIME( ) are evaluated because they are enclosed by the text-merge delimiters and SET TEXTMERGE is set to ON.

CLEAR

SET TALK OFF

STORE 'Today is: ' TO gcTodayDate

SET TEXTMERGE ON

\<<gcTodayDate>>

\\<<DATE( )>>

\The time is:

\\ <<TIME( )>>

Here is the output from the program above when run on January 1:

Today is: 01/01/95

The time is: 10:55:19

OFF   (Default) Specifies that any fields, variables, array elements, functions, or expressions be literally output along with the text-merge delimiters surrounding them. Note the difference in output when SET TEXTMERGE is set to OFF in the previous example:

CLEAR

SET TALK OFF

STORE 'Today is: ' TO gcTodayDate

SET TEXTMERGE OFF

\<<gcTodayDate>>

\\<<DATE( )>>

\The time is:

\\ <<TIME( )>>

Here is the output from this program:

<<gcTodayDate>><<DATE( )>>

The time is: <<TIME( )>>

TO [FileName]   Specifies that output from \, \\, and TEXT ... ENDTEXT be directed to a text file rather than the main Visual FoxPro window, which is the default. You can also direct the output to a text file by including FileName. If a file with that name doesn’t exist, a new file is created. If a file with the same name already exists and SET SAFETY is set to ON, you are given the option of overwriting the existing file.

The text file is opened as a low-level file, and its file handle is stored to the _TEXT system variable. You can close the file by issuing SET TEXTMERGE TO without additional arguments. If the file handle of another file was previously stored in _TEXT, that file is closed.

ADDITIVE   Specifies that output from \, \\, and TEXT ... ENDTEXT be appended to an existing file keyword.

For more information on directing text-merge output to a file, see _TEXT.

WINDOW WindowName   Specifies that output from \, \\, and TEXT ... ENDTEXT be directed to a user-defined window rather than the main Visual FoxPro window, which is the default. WindowName specifies the name of the window to which you want to direct output. The window must be created with DEFINE WINDOW before output can be sent to it. The window doesn’t have to be active or visible.

SHOW | NOSHOW   (Default) SHOW displays text-merge output.

NOSHOW suppresses display of text-merge output.

By default, output generated by \, \\, and TEXT ... ENDTEXT is sent to the main Visual FoxPro window or an active user-defined window.

Remarks

The \, \\, and TEXT ... ENDTEXT commands are used to merge text with the contents of tables, variables, array elements, and the results of functions and expressions. If a field, variable, array element, function, or expression is surrounded by text-merge delimiters (by default, << and >>), it can be evaluated and merged with text. This text-merge capability lets you produce letters, programs, and templates that create programs.

SET TEXTMERGE determines how fields, variables, array elements, functions, or expressions surrounded by text-merge delimiters are evaluated. It also lets you direct text-merge output to the main Visual FoxPro window, a user-defined window, or a file.

Memo fields can be used to nest merged text. If a memo field contains field names, variables, array elements, functions, or expressions surrounded by the current text-merge delimiters, these are evaluated and output with the contents of the memo field. The memo field name must also be enclosed in text-merge delimiters.


See Also

\ | \\
_PRETEXT
SET TEXTMERGE DELIMITERS
_TEXT


SET TEXTMERGE DELIMITERS Command

Syntax         Arguments         Remarks         See Also

Specifies the text-merge delimiters.

Syntax

SET TEXTMERGE DELIMITERS
[TO cLeftDelimiter [, cRightDelimiter]]

Arguments

TO cLeftDelimiter [, cRightDelimiter]   Specifies the delimiters. If you specify only one delimiter with cLeftDelimiter, both the left and right delimiters are set to cLeftDelimiter. If you specify both delimiters with cLeftDelimiter and cRightDelimiter, the left delimiter is set to cLeftDelimiter and the right delimiter is set to cRightDelimiter.

Remarks

With SET TEXTMERGE DELIMITERS, you can specify a set of text-merge delimiters other than the default delimiters, which are double angle brackets (<< and >>). The current delimiters can be displayed with DISPLAY STATUS.

If you issue SET TEXTMERGE DELIMITERS without any additional arguments, the default delimiters are restored.

For more information about text-merge delimiters, see SET TEXTMERGE.


See Also

\ | \\
_PRETEXT
SET TEXTMERGE
_TEXT


SET TOPIC Command

Syntax         Arguments         Remarks         See Also

Specifies the Help topic or topics to open when you invoke the Visual FoxPro Help system.

Syntax

SET TOPIC TO [cHelpTopicName | lExpression]

Arguments

cHelpTopicName   Specifies the name of the Help topic you want to display.

lExpression   A logical expression that is the basis for opening a specific topic or topics.

Remarks

For more information on creating your own Help system, see Part 7, “Creating Help Files,” in the Developers Guide.


See Also

HELP
SET HELP
SET HELPFILTER
SET TOPIC ID


SET TOPIC ID Command

Syntax         Arguments         See Also

Specifies the Help topic to display when you invoke the Visual FoxPro Help system. The Help topic is based on the topic’s context ID.

Syntax

SET TOPIC ID TO nHelpContextID

Arguments

nHelpContextID   Specifies the Help topic to display, based on a numerical context ID. nHelpContextID is a context number in the MAP section of the Help project file.


See Also

HELP
SET HELP
SET TOPIC


SET TRBETWEEN Command

Syntax         Arguments         Remarks         See Also

Enables or disables tracing between breakpoints in the Trace window.

Syntax

SET TRBETWEEN ON | OFF

Arguments

ON   (Default) Specifies that every line of program code be displayed and highlighted in the Trace window as it is executed. Issuing SET TRBETWEEN ON is identical to enabling the Trace Between Breaks command in the Trace window’s Program menu.

OFF   Specifies that only the last line at which program execution was paused be highlighted in the Trace window. Issuing SET TRBETWEEN OFF is identical to disabling the Trace Between Breaks command.

Remarks

The Trace window displays the source code for a program as the program executes. The executing program line is highlighted. When the Trace window is open, you can set breakpoints that cause program execution to stop.

The Trace window can also be opened by issuing ACTIVATE WINDOW TRACE, SET ECHO ON, or SET STEP ON.


See Also

ACTIVATE WINDOW
SET ECHO
SET STEP


SET TYPEAHEAD Command

Syntax         Arguments         Remarks         See Also

Specifies the maximum number of characters that can be stored in the type-ahead buffer.

Syntax

SET TYPEAHEAD TO nCharacters

Arguments

nCharacters   Specifies the maximum number of characters to store in the type-ahead buffer.

No characters are held in the type-ahead buffer if you issue SET TYPEAHEAD TO 0. This statement deactivates INKEY( ) and ON KEY.

Remarks

The type-ahead buffer can store as many as 32,000 characters until the they are ready to be processed. The default value for SET TYPEAHEAD is 20.


See Also

INKEY( )
ON KEY


SET UDFPARMS Command

Syntax         Arguments         Remarks         Example         See Also

Specifies if Visual FoxPro passes parameters to a user-defined function (UDF) by value or by reference.

Syntax

SET UDFPARMS TO VALUE | REFERENCE

Arguments

TO VALUE   Specifies that a variable be passed to a user-defined function by value. When a variable is passed by value, the variable’s value can be changed in the user-defined function, but the variable’s original value in the calling program isn’t changed.

TO REFERENCE   Specifies that a variable be passed to a user-defined function by reference. When a variable is passed by reference and the user-defined function changes the value of the passed variable, the variable’s original value in the calling program is also changed.

Remarks

By default, variables are passed to a user-defined function by value. (Variables passed to procedures with DO ... WITH are passed by reference.)

You can force parameters to be passed to a UDF by value or reference, regardless of the setting of SET UDFPARMS. Enclose a variable in parentheses to force the variable to be passed by value. Preface the variable with an @ symbol to force the variable to be passed by reference.

Tip   Entire arrays can be passed to a procedure or user-defined function. The entire array is passed if you issue SET UDFPARMS TO REFERENCE or preface the array name with @. The first element of the array is passed by value if you issue SET UDFPARMS TO VALUE or enclose the array name by parentheses. Array elements are always passed by value.


 SET UDFPARMS Command Example

The following example illustrates the difference between passing variables by value and by reference.

*** Pass variable by value ***

CLEAR

SET TALK OFF

WAIT 'Press a key to pass by value' WINDOW

SET UDFPARMS TO VALUE

STORE 1 TO gnX

*** The value of gnX is unchanged ***

@ 2,2 SAY 'UDF value: ' + STR(plusone(gnX))

@ 4,2 SAY 'Value of gnX: ' + STR(gnX)

*** Pass variable by reference ***

WAIT 'Press a key to pass by reference' WINDOW

CLEAR

SET UDFPARMS TO REFERENCE

STORE 1 TO gnX

*** The value of gnX is changed ***

@ 2,2 SAY 'UDF value: ' + STR(plusone(gnX))

@ 4,2 SAY 'Value of X: ' + STR(gnX)

SET UDFPARMS TO VALUE

*** This is a UDF that adds one to a number ***

FUNCTION plusone

PARAMETER gnZ

gnZ = gnZ + 1

RETURN gnZ

*** End of UDF ***

Here is the above example with variables passed by value and reference through the use of parentheses and @, respectively:

*** Pass variable by value ***

CLEAR

SET TALK OFF

WAIT 'Press a key to pass by value' WINDOW

STORE 1 TO gnX

@ 2,2 SAY 'UDF value: ' + STR(plusone((gnX)))

@ 4,2 SAY 'Value of gnX: ' + STR(gnX)

*** Pass variable by reference ***

WAIT 'Press a key to pass by reference' WINDOW

CLEAR

STORE 1 TO gnX

@ 2,2 SAY 'UDF value: ' + STR(plusone(@gnX))

@ 4,2 SAY 'Value of gnX: ' + STR(gnX)

*** This is a UDF that adds one to a number ***

FUNCTION plusone

PARAMETER gnZ

gnZ = gnZ + 1

RETURN gnZ

*** End of UDF ***


 See Also

DO
LPARAMETERS
PARAMETERS
PARAMETERS( )
PROCEDURE


SET UNIQUE Command

Syntax         Arguments         Remarks         See Also

Specifies whether records with duplicate index key values are maintained in an index file.

Syntax

SET UNIQUE ON | OFF

Arguments

ON   Specifies that any record with a duplicate index key value not be included in the index file. Only the first record with the original index key value is included in the index file.

OFF   (Default) Specifies that records with duplicate index key values be included in the index file.

Remarks

An index file retains its SET UNIQUE setting when you issue REINDEX. For more information, see INDEX and REINDEX.

SET UNIQUE is scoped to the current data session.


 See Also

INDEX
REINDEX
SET DATASESSION


SET VIEW Command

Syntax         Arguments         Remarks         See Also

Opens or closes the Data Session window or restores the Visual FoxPro environment from a view file.

Syntax

SET VIEW ON | OFF
 – Or –
SET VIEW TO FileName | ?

Arguments

ON   Opens the Data Session window.

OFF   (Default) Closes the Data Session window.

TO FileName   Restores the Visual FoxPro environment to the state it was in when the view file specified with FileName was created. View files are created with CREATE VIEW.

?   Displays the Open dialog box, from which you can open a view file.

Remarks

For more information on view files, see CREATE VIEW.


 See Also

CREATE VIEW
SET


SET WINDOW OF MEMO Command

Included for backward compatibility. Use the TextBox Control instead.


SET( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns the status of various SET commands.

Syntax

SET(cSETCommand [, 1 | 2])

Returns

Character, Numeric

Arguments

cSETCommand   A character expression specifying the SET command for which you want information returned. The current setting of the specified command is returned as a character or numeric string.

1 | 2   Specifies that additional information about a SET command be returned.

Including this argument doesn’t return additional information for all SET commands, just those listed with 1 and 2 in the following table.

SET Command	Value Returned
ALTERNATE	ON or OFF
ALTERNATE, 1	FileName
CLOCK	ON or OFF
CLOCK, 1	nRow and nColumn
COMPATIBLE	ON or OFF
COMPATIBLE, 1	PROMPT or NOPROMPT
CURRENCY	LEFT or RIGHT
CURRENCY, 1	cCurrencySymbol
DATE	AMERICAN, ANSI, BRITISH/FRENCH, GERMAN, ITALIAN, JAPAN, USA, MDY, DMY, or YMD
DATE, 1	Date Ordering: 0 - MDY 1 - DMY 2 - YMD
DELIMITERS	ON or OFF
DELIMITERS, 1	cDelimiters
FIELDS	ON or OFF
FIELDS, 1	FieldName1, FieldName2, ...
FIELDS, 2	LOCAL or GLOBAL
HELP	ON or OFF
HELP, 1	FileName
KEY	eExpression2, eExpression3
KEY, 1	eExpression2
KEY, 2	eExpression3
MESSAGE	nRow
MESSAGE, 1	cMessageText
MOUSE	ON or OFF
MOUSE, 1	nSensitivity
PRINTER	ON or OFF
PRINTER, 2	Default printer name
RESOURCE	ON or OFF
RESOURCE, 1	FileName
TALK	ON or OFF
TALK, 1	WINDOW, NOWINDOW or WindowName
TEXTMERGE	ON or OFF
TEXTMERGE, 1	cLeftDelimiter and cRightDelimiter
TOPIC	cHelpTopicName | lExpression
TOPIC, 1	nContextID
Remarks

SET( ) recognizes the four-character abbreviation for all Visual FoxPro SET keywords. For example, STAT and PRIN can be used for SET STATUS and SET PRINTER, respectively.

The SET( ) function is identical to SYS(2001).


See Also

DISPLAY STATUS
LIST
SET
SYS(2001) - SET ... Command Status


SetAll Method

Syntax         Arguments         Example         Applies To         See Also

Assigns a property setting on all, or a certain class of, controls in a Container object.

Syntax

Container.SetAll(cProperty, Value [, cClass])

Arguments

cProperty   Specifies the property to be set.

Value   Specifies the new setting for the property. The data type of Value depends on the property being set.

cClass   Specifies the class name (the class on which the object is based, not the Visual FoxPro base class for the object).

Remarks

Use the SetAll method to set a property for all, or a certain class of, controls in a Container. For example, to set the BackColor property on all the Column objects in a Grid control to red, issue the following:

Form1.Grid1.SetAll("BackColor", RGB(255, 0, 0), "Column")

You can also set the properties for objects that are contained by other objects within the container. To set the ForeColor property of the Headers that are contained by each Column object contained in a Grid control to green, issue the following:

Form1.Grid1.SetAll("ForeColor", RGB(0, 255, 0), "Header")


SetAll Method Example

The following example uses the SetAll method with the DynamicBackColor property to specify the background colors for the records in a Grid control. If the number of a record displayed in the Grid is even, the record’s DynamicBackColor is white, otherwise its DynamicBackColor is green.

A Grid control is placed on a form, and the customer table is opened and its contents displayed in the grid. The Caption property is used to specify a different header caption (Customer ID) for the CUST_ID field. A command button is placed on the form to close the form.

CLOSE ALL  && Close tables and databases

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  IN 0  && Opens Customer table

frmMyForm = CREATEOBJECT('Form')  && Create a form

frmMyForm.Closable = .f.  && Disable the Control-menu box

frmMyForm.AddObject('cmdCommand1','cmdMyCmdBtn')  && Add Command button

frmMyForm.AddObject('grdGrid1','Grid')  && Add Grid control

frmMyForm.grdGrid1.Left = 25    && Adjust Grid position

frmMyForm.grdGrid1.SetAll("DynamicBackColor", "IIF(MOD(RECNO( ), 2)=0, RGB(255,255,255), RGB(0,255,0))", "Column")  && Alternate white and green records

frmMyForm.grdGrid1.Visible = .T.  && Grid control visible

frmMyForm.cmdCommand1.Visible =.T.  && "Quit" Command button visible

frmMyForm.grdGrid1.Column1.Header1.Caption = 'Customer ID'

frmMyForm.SHOW  && Display the form

READ EVENTS  && Start event processing

DEFINE CLASS cmdMyCmdBtn AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 210  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close form

CLOSE ALL  && Close table and database

ENDDEFINE


Applies To

Column, CommandGroup, Container Object, Form, FormSet, Grid, OptionGroup, Page, PageFrame, _SCREEN, ToolBar


See Also

SaveAs Method
SaveAsClass Method


SETFLDSTATE( ) Function

Syntax         Returns         Arguments         Example         See Also

Assigns a field or deletion state value to a field or record in a table or cursor.

Syntax

SETFLDSTATE(cFieldName | nFieldNumber, nFieldState
[, cTableAlias | nWorkArea])

Returns

Logical

Arguments

cFieldName | nFieldNumber   Specifies the name or the number of the field for which the edit or deletion status is assigned. The field number nFieldNumber corresponds to the position of the field in the table or cursor structure. DISPLAY STRUCTURE or FIELD( ) can be used to determine a field’s number.

To set the deletion status for the record, include 0 as the field number.

nFieldState   Specifies a value for the field or deletion status. The following table lists the field or deletion state value and the corresponding edit or deletion status:

nFieldState	Edit or deletion status
1	Field has not been edited or deletion status has not changed.
2	Field has been edited or deletion status has changed.
3	Field in an appended record has not been edited or deletion status has not changed for the appended record.
4	Field in an appended record has been edited or deletion status has changed for the appended record.
cTableAlias   Specifies the alias of the table or cursor in which the edit or deletion status is assigned.

nWorkArea   Specifies the work area of the table or cursor in which the edit or deletion status is assigned. The field or deletion state value is assigned for the table or cursor open in the currently selected work area if SETFLDSTATE( ) is issued without the optional cTableAlias or nWorkArea arguments.

Remarks

Visual FoxPro uses field state values to determine which fields in tables or cursors are updated. SETFLDSTATE( ) lets you control which fields Visual FoxPro attempts to update, regardless of which fields have been edited in the table or cursor.


SETFLDSTATE( ) Function Example

The following example demonstrates how you can use SETFLDSTATE( ) to change the field status. MULTILOCKS is set to ON, a requirement for table buffering. The customer table in the testdata database is opened, and CURSORSETPROP( ) is then used to set the buffering mode to optimistic table buffering (5).

GETFLDSTATE( ) is issued to display a value (1) corresponding to the unmodified state of the cust_id field before it is modified. The cust_id field is modified with REPLACE, and GETFLDSTATE( ) is issued again to display a value (2) corresponding to the modified state of the cust_id field.

SETFLDSTATE( ) is used to change the field status of the cust_id field back to 1 (unmodified). GETFLDSTATE( ) is issued again and displays 1, corresponding to the state of the cust_id field assigned by SETFLDSTATE( ). TABLEREVERT( ) is used to return the table to its original state.

CLOSE DATABASES

SET MULTILOCKS ON  && Must be on for table buffering

SET PATH TO (HOME( ) + 'samples\data\')  	&& Sets path to database

OPEN DATABASE testdata  && Open testdata database

USE Customer	  && Open customer table

= CURSORSETPROP('Buffering', 5, 'customer')  && Enable table buffering

CLEAR

? GETFLDSTATE('cust_id')  && Displays 1, not modified

REPLACE cust_id 	WITH '***'  && Changes field contents

? GETFLDSTATE('cust_id')  && Returns 2, field modified

= SETFLDSTATE('cust_id', 1)  && Change the field status

? GETFLDSTATE('cust_id')  && Displays 1, not modified

= TABLEREVERT(.T.)  && Discard all table changes


See Also

DELETED( )
DISPLAY STRUCTURE
FIELD( )
GETFLDSTATE( )


SIGN( ) Function

Syntax         Returns         Arguments         Example         See Also

Returns a numeric value of 1, –1, or 0 if the specified numeric expression evaluates to a positive, negative, or 0 value.

Syntax

SIGN(nExpression)

Returns

Numeric

Arguments

nExpression   Specifies the numeric expression SIGN( ) evalutates. SIGN( ) returns 1 if nExpression evaluates to a positive number, –1 if nExpression evaluates to a negative number, and 0 if nExpression evaluates to 0.


SIGN( ) Function Example

STORE 10 TO gnNum1

STORE -10 TO gnNum2

STORE 0 TO gnZero

CLEAR

? SIGN(gnNum1)  && Displays 1

? SIGN(gnNum2)  && Displays -1

? SIGN(gnZero)  && Displays 0


See Also

ABS( )


SIN( ) Function

Syntax         Returns         Arguments         Example         See Also

Returns the sine of an angle.

Syntax

SIN(nExpression)

Returns

Numeric

Arguments

nExpression   Specifies an angle whose sine SIN( ) returns. nExpression can assume any value and the value returned by SIN( ) ranges between –1 and 1.

Note   nExpression is specified in radians. Use DTOR( ) to convert an angle from degrees to radians. The number of decimal places displayed by SIN( ) can be specified with SET DECIMALS.


SIN( ) Function Example

CLEAR

? SIN(0)  && Displays 0.00

? SIN(PI( )/2)  && Displays 1.00

? SIN(DTOR(90))  && Displays 1.00


See Also

ACOS( )
COS( )
DTOR( )
RTOD( )
SET DECIMALS


Sizable Property

See Also

Specifies whether an object can be sized. Available at design time; read-write at run time.

Syntax

Object.Sizable = lExpr

Settings

lExpr   The settings for the Sizable property are:

Setting	Description
True (.T.)	(Default) You can size the object.
False (.F.)	You cannot size the object.
Remarks

For bound and unbound OLE controls, Sizable affects the OLE object that the control contains. If Sizable is set to true (.T.) and you activate the OLE object, you can size it larger or smaller than the OLE control. If the AutoSize property is set to true (.T.), the OLE control automatically resizes to fit the new size of the OLE object when you deactivate it.

Note   To make a Form sizable, set the BorderStyle property to 3.


Applies To

OLE Bound Control, OLE Container Control, ToolBar


See Also

AutoSize Property, BorderStyle Property


SizeBox Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether a form has a size box. Available at design time; read-write at run time.

Syntax

Object.SizeBox = lExpr

Settings

lExpr   The settings for the SizeBox property are:

Setting	Description
True (.T.)	(Default) A size box appears in the lower-right corner of the form if the form’s BorderStyle property is set to 3 (the default).
False (.F.)	No size box appears in the form.
Remarks

The SizeBox provides a way for users to resize a form using the mouse. The size box can appear in a form only if the form’s BorderStyle property is set to 3 (Sizable Border), which is the default for new forms.


Applies To

Form


See Also

BorderStyle Property
ZoomBox Property


SIZE POPUP Command

Syntax         Arguments         Remarks         Example         See Also

Changes the size of a menu created with DEFINE POPUP.

Syntax

SIZE POPUP MenuName TO nRow1, nColumn1 | BY nRow2, nColumn2

Arguments

MenuName   Specifies the name of the menu whose size you want to change.

TO nRow1, nColumn1   Changes the size of a menu to a specific size. nRow1 and nColumn1 specify the new row and column coordinates, respectively, of the lower-right corner of the menu.

BY nRow2, nColumn2   Changes the size of a menu relative to its current size. nRow2 and nColumn2 specify the change in size of the menu in rows and columns, relative to the current row and column coordinates of the lower-right corner of the menu.

Remarks

If a user-defined menu has been created, its size can be changed; it doesn’t have to be active or visible.


SIZE POPUP Command Example

This example creates a menu containing files with a .PRG extension and moves, enlarges, and shrinks the menu before closing it.

CLEAR

DEFINE POPUP popMovIn FROM 2,2 TO 7, 14 PROMPT FILES LIKE *.PRG ;

TITLE 'Programs'

ACTIVATE POPUP popMovIn NOWAIT

=CHRSAW(2)

MOVE POPUP popMovIn BY 5,5  	&& Move popup down

=CHRSAW(2)

SIZE POPUP popMovIn BY 5,5  && Enlarge the popup

=CHRSAW(2)

SIZE POPUP popMovIn BY -5,-5  && Shrink the popup

=CHRSAW(2)

MOVE POPUP popMovIn BY -5,-5  && Move popup up

=CHRSAW(2)

DEACTIVATE POPUP popMovIn

RELEASE POPUP popMovIn


See Also

ACTIVATE POPUP


SIZE WINDOW Command

Syntax         Arguments         Remarks         See Also

Changes the size of a window created with DEFINE WINDOW or a Visual FoxPro system window.

Syntax

SIZE WINDOW WindowName TO nRow1, nColumn1 | BY nRow2, nColumn2

Arguments

WindowName   Specifies the name of the window whose size you want to change.

To change the size of a system window, enclose the entire system window name in quotation marks. For example, to increase the size of the Command window by 1 row and 1 column, issue the following command:

SIZE WINDOW 'Command Window' BY 1,1

You can only change the size of the Command, Debug, and Trace windows.

TO nRow1, nColumn1   Changes the size of a window to a specific size. nRow1 and nColumn1 specify the new row and column coordinates, respectively, of the lower-right corner of the window relative to the upper-left corner of the window.

BY nRow2, nColumn2   Changes the size of a window relative to its current size. nRow2 and nColumn2 specify the change in size of the window in rows and columns, relative to the current row and column coordinates of the lower-right corner of the window.

Remarks

If a user-defined window has been created, its size can be changed; it doesn’t have to be active or visible.


See Also

ACTIVATE WINDOW
DEFINE WINDOW
ZOOM WINDOW


SKIP Command

Syntax         Arguments         Remarks         Example         See Also

Moves the record pointer forward or backward in a table.

Syntax

SKIP
[nRecords]
[IN nWorkArea | cTableAlias]

Arguments

nRecords   Specifies the number of records to move the record pointer.

Issuing SKIP without nRecords advances the record pointer to the next record. The record pointer moves toward the end of the file nRecords records if nRecords evaluates to a positive number. The record pointer moves toward the beginning of the file nRecords records if nRecords evaluates to a negative number.

If the record pointer is positioned on the last record of a table and SKIP with no arguments is executed, RECNO( ) returns a value 1 greater than the number of records in the table and EOF( ) returns true (.T.). If the record pointer is positioned on the first record of a table and SKIP –1 is executed, RECNO( ) returns 1 and BOF( ) returns true (.T.).

IN nWorkArea | cTableAlias   Moves the record pointer in a table in a specific work area. nWorkArea specifies the work area number and cTableAlias specifies a table or work area alias.

Remarks

If the table has a master controlling index tag or index file, SKIP moves the record pointer to the record determined by the index sequence.


SKIP Command Example

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

CLEAR

SKIP 4 IN 'customer'

? RECNO('customer')  && Displays 5

GO BOTTOM

SKIP -5

? RECNO( )


See Also

GO | GOTO
SET SKIP


SKPBAR( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Determines if a menu item is enabled or disabled with SET SKIP OF.

Syntax

SKPBAR(cMenuName, MenuItemNumber)

Returns

Logical

Arguments

cMenuName   Specifies the name of the menu that contains the item.

MenuItemNumber   Specifies the number of the menu item whose status (enabled or disabled) SKPBAR( ) returns. The menu item number is assigned when the menu item is created with DEFINE BAR.

Remarks

SKPBAR( ) returns true (.T.) if the menu item is disabled, and false (.F.) if the menu item is enabled.


See Also

DEFINE BAR
SET SKIP OF
SKPPAD( )


SKPPAD( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Determines whether a menu title is enabled or disabled with SET SKIP OF.

Syntax

SKPPAD(cMenuBarName, cMenuTitleName)

Returns

Logical

Arguments

cMenuBarName   Specifies the name of the menu bar that contains the menu title.

cMenuTitleName   Specifies the name of the menu title whose status (enabled or disabled) SKPPAD( ) returns.

Remarks

SKPPAD( ) returns true (.T.) if the menu title is disabled, and false (.F.) if the menu title is enabled.


See Also

DEFINE BAR
SET SKIP OF
SKPBAR( )


SORT Command

Syntax         Arguments         Remarks         See Also

Sorts records in the currently selected table and outputs the sorted records to a new table.

Syntax

SORT TO TableName
ON FieldName1 [/A | /D] [/C]
[, FieldName2 [/A | /D] [/C] ...]
[ASCENDING | DESCENDING]
[Scope] [FOR lExpression1] [WHILE lExpression2]
[FIELDS FieldNameList
| FIELDS LIKE Skeleton
| FIELDS EXCEPT Skeleton]
[NOOPTIMIZE]

Arguments

TableName   Specifies the name of the new table containing the sorted records. Visual FoxPro assumes a .DBF file name extension for tables. A .DBF extension is automatically assigned if the file name you include doesn’t have an extension.

ON FieldName1   Specifies the field in the currently selected table on which the sort is based. The contents and data type of the field determine the order of the records in the new table. By default, the sort is done in ascending order. You can’t sort on memo or general fields.

The following example sorts a table on the cust_id field. The customer table is opened and sorted, creating a new table named temp. The records in temp are ordered by the cust_id field.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

CLEAR

LIST FIELDS company, cust_id NEXT 3

SORT TO temp ON cust_id

USE temp

LIST FIELDS company, cust_id NEXT 3

WAIT WINDOW 'Now sorted on CUST_ID' NOWAIT

You can include additional field names (FieldName2, FieldName3) to further order the new table. The first field FieldName1 is the primary sort field, the second field FieldName2 is the secondary sort field, and so on.

[/A | /D] [/C]   For each field you include in the sort, you can specify an ascending or descending sort order. /A specifies an ascending order for the field. /D specifies a descending order. /A or /D can be included with any type of field.

By default, the field sort order for character fields is case sensitive. If you include the /C option after the name of a character field, case is ignored. You can combine the /C option with the /A or /D option. For example, /AC or /DC.

In the following example, a new table named clients is created. The orders table is sorted on the order_date field in ascending order and the freight field in descending order.

USE orders

SORT TO clients ON order_date/A,freight/D

ASCENDING   Specifies an ascending order for all fields not followed by /D.

DESCENDING   Specifies a descending order for all fields not followed by /A.

If you omit either ASCENDING or DESCENDING, the sort order is ascending by default.

Scope   Specifies a range of records to sort. The scope clauses are: ALL, NEXT nRecords, RECORD nRecordNumber, and REST.

The default scope for SORT is ALL records.

FOR lExpression1   Specifies that only the records in the current table for which the logical condition lExpression1 evaluates to true (.T.) are included in the sort. Including FOR lets you conditionally sort records, filtering out undesired records.

Rushmore optimizes a SORT ... FOR command if lExpression1 is an optimizable expression. For best performance, use an optimizable expression in the FOR clause.

A discussion of expressions that Rushmore can optimize appears in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

WHILE lExpression2   Specifies a condition whereby records from the current table are included in the sort for as long as the logical expression lExpression2 evaluates to true (.T.).

FIELDS FieldNameList   Specifies fields from the original table to include in the new table that SORT creates. If you omit the FIELDS clause, all fields from the original table are included in the new table.

FIELDS LIKE Skeleton   Specifies that fields from the original table that match the field skeleton Skeleton are included in the new table that SORT creates.

FIELDS EXCEPT Skeleton   Specifies that all fields except those that match the field skeleton Skeleton are included in the new table that SORT creates.

The field skeleton Skeleton supports wildcards. For example, to specify that all fields that begin with the letters A and P are included in the new table, use:

SORT TO mytable ON myfield FIELDS LIKE A*,P*

The LIKE clause can be combined with the EXCEPT clause:

SORT TO mytable ON myfield FIELDS LIKE A*,P* EXCEPT PARTNO*

NOOPTIMIZE   Disables Rushmore optimization of SORT.

For more information, see SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

Remarks

One or more specified fields in the current table determine the order in which the records appear in the new table.

Important     Be sure you have enough disk space for the new table and the temporary work files created during the sort. The disk space needed to perform a sort can be as much as three times the size of the source table. The amount of available disk space can be determined with DISKSPACE( ) and SYS(2020). If you run out of disk space during a sort, Visual FoxPro displays an error message, and the temporary work files are deleted.

Character-type fields that contain numbers and spaces might not sort in the order you expect. Numeric fields fill from right to left, with empty spaces to the left. In contrast, character fields fill from left to right, with empty spaces to the right.

For example, if two records in a table contain a character field with 1724 in one record and 18 in the other, and the table is sorted on this field in ascending order, the record containing 1724 appears before the record containing 18. This is because Visual FoxPro reads each character in the character fields from left to right, and because 17 (in 1724) is less than 18 (in 18), it puts 1724 first. To avoid this problem, always precede lower numbers with leading zeros (0018) or make the field numeric.


See Also

COPY FILE
DISKSPACE( )
INDEX
SYS(2020) - Default Disk Size


Sorted Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether the items in the list portion of a ComboBox or ListBox control are automatically sorted alphabetically. Available at design time and run time.

Syntax

[Form.]Control.Sorted[= lExpr]

Settings

lExpr   The settings for the Sorted property are:

Setting	Description
True (.T.)	List items are sorted alphabetically (case-sensitive). Visual FoxPro handles almost all necessary string processing to maintain alphabetic order, including changing the index numbers for items as required when items are added or removed from the list.
False (.F.)	(Default) List items are not sorted alphabetically.
Remarks

The Sorted property is only available if the RowSourceType property is set to 0 (None) or 1 (Value).


Applies To

ComboBox, ListBox


See Also

AddItem Method
List Property
ListCount Property
ListItemID Property
RemoveItem Method
RowSource Property
RowSourceType Property


SOUNDEX( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns a phonetic representation of the specified character expression.

Syntax

SOUNDEX(cExpression)

Returns

Character

Arguments

cExpression   Specifies the character expression SOUNDEX( ) evaluates.

Remarks

SOUNDEX( ) returns a four-character string. By comparing the results SOUNDEX( ) returns for two character expressions, you can determine if the two expressions are phonetically similar, indicating that they sound alike. This can be useful when searching for duplicate records in a table.

SOUNDEX( ) isn’t case sensitive and generally disregards vowels.


SOUNDEX( ) Function Example

CLEAR

? SOUNDEX('Smith') = SOUNDEX('Smyth')  && Displays .T.

? SOUNDEX('Computer')  && Displays C513


See Also

DIFFERENCE( )


SPACE( ) Function

Syntax         Returns         Arguments         See Also

Returns a character string composed of a specified number of spaces.

Syntax

SPACE(nSpaces)

Returns

Character

Arguments

nSpaces   Specifies the number of spaces that SPACE( ) returns. The maximum value of nSpaces is limited only by memory in Visual FoxPro.


See Also

PADC( ) | PADL( ) | PADR( )
REPLICATE( )


Sparse Property

Syntax         Settings         Applies To         See Also

Specifies whether the CurrentControl property affects all cells or only the active cell in a Column object. Available at design time; read-write at run time.

Syntax

Column.Sparse [= lExpr]

Settings

lExpr   The settings for the Sparse property are:

Setting	Description
True (.T.)	(Default) Only the Column’s active cell uses the CurrentControl property setting to accept and display data. The other cells use the TextBox control if the current control for the cells is not the container object or a command button. The other cells remain empty if the current control for the cells is the container object or a command button.
False (.F.)	All cells in the Column object use the CurrentControl property setting to display data; the active cell accepts data.


Applies To

Column


See Also

Bound Property
CurrentControl Property
DynamicCurrentControl Property


SpecialEffect Property

Syntax         Settings         Applies To         See Also

Specifies different format options for a control. Available at design time and run time. SpecialEffect is ignored for command buttons.

Syntax

[Form.]Control.SpecialEffect = nExpr

Settings

nExpr   For a PageFrame control, Container object, or Control object, the settings for the SpecialEffect property are:

Setting	Description
0	Raised. The control appears to be raised from the form.
1	Sunken. The control appears to be set into the form.
2	Flat.
Note   For a PageFrame control, SpecialEffect is available only if the Tabs Property is set to false (.F.). Also, the BorderColor property for a PageFrame applies only when nExpr is set to 2 (Flat).

For all other controls, the settings for the SpecialEffect property are:

Setting	Description
0	(Default for all controls and objects except the Container object.) 3D. Border of control is raised to simulate a 3-dimensional look.
1	Plain. Control appears without a 3-dimensional border.
2	Flat (Available for the Container object only.).
Note   If the Height property is set to a value too small, the 3D setting has no effect.


Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, EditBox, ListBox, OptionButton, OptionGroup, PageFrame, Shape, Spinner, TextBox


See Also

BackColor
ForeColor Properties
SelectedItemBackColor
SelectedItemForeColor Properties


_SPELLCHK System Memory Variable
_SPELLCHK System Variable

Syntax         Arguments         Remarks         See Also

Specifies a spelling checker program for the Visual FoxPro text editor.

Syntax

_SPELLCHK = ProgramName

Arguments

ProgramName   Specifies a spelling checker program. If your spelling checker program is in a directory other than the current default directory, include a path with the program name.

You can also specify a spelling checker program in your Visual FoxPro configuration file. Include the line:

_SPELLCHK = ProgramName

Remarks

By default, _SPELLCHK uses SPELLCHK.APP. If you rename SPELLCHK.APP or move it to another directory, store the new spelling checker program name and its path in _SPELLCHK.


See Also

MODIFY COMMAND
MODIFY FILE
MODIFY MEMO


Spinner Control

Syntax         Remarks         Properties         Events         Methods         See Also

Creates a spinner.

Syntax

Spinner

Remarks

A spinner allows a user to choose from a range of numeric values by ‘spinning’ through the values by clicking the up or down arrows on the spinner or by typing a value into the spinner box.

The KeyBoardHighValue and SpinnerHighValue properties specify the maximum numeric values that can be entered from the keyboard into the spinner box and by clicking the arrow buttons on the spinner.

The KeyBoardLowValue and SpinnerLowValue properties specify the minimum numeric values that can be entered from the keyboard into the spinner box and by clicking the arrow buttons on the spinner.

For additional information about creating spinners, see the Form Designer topic and Chapter 10, “Using Controls,” in the Developer’s Guide.


Properties

Alignment	BackColor	BaseClass
BorderStyle	Class	ClassLibrary
ColorScheme	ColorSource	Comment
ControlSource	DisabledBackColor	DisabledForeColor
DragIcon	DragMode	Enabled
FontBold	FontCondense	FontExtend
FontItalic	FontName	FontOutline
FontShadow	FontSize	FontStrikeThru
FontUnderline	ForeColor	Format
Height	HelpContextID	HideSelection
Increment	InputMask	KeyboardHighValue
KeyboardLowValue	Left	Margin
MousePointer	Name	Parent
ParentClass	ReadOnly	RightToLeft
SelectedBackColor	SelectedForeColor	SelLength
SelStart	SelText	SpecialEffect
SpinnerHighValue	SpinnerLowValue	StatusBarText
TabIndex	TabStop	Tag
TerminateRead	ToolTipText	Top
Text Property	Value	Visible
Width


Events

Click	DblClick	Destroy
DownClick	DragDrop	DragOver
Error	ErrorMessage	GotFocus
Init	InteractiveChange	KeyPress
LostFocus	Message	MiddleClick Event
MouseDown	MouseMove	MouseUp
MouseWheel	ProgrammaticChange	RangeHigh
RangeLow	RightClick	UIEnable
UpClick	Valid	When


Methods

CloneObject	Drag	Move
ReadExpression	ReadMethod	Refresh
SaveAsClass	SetFocus	WriteExpression
WriteMethod	ZOrder


See Also

CREATE CLASS
CREATE FORM
DEFINE CLASS


SpinnerHighValue, SpinnerLowValue Properties

Syntax         Settings         Applies To         See Also

Specifies the highest or lowest value that can be entered into a Spinner control by clicking the up and down arrows. Available at design time and run time.

Syntax

Spinner.SpinnerHighValue[ = nHigh]

Spinner.SpinnerLowValue[ = nLow]

Settings

nHigh   Specifies the highest value that can be entered into a spinner with the up arrow.

nLow   Specifies the lowest value that can be entered into a spinner with the down arrow.


Applies To

Spinner


See Also

KeyboardHighValue
KeyboardLowValue Properties


SplitBar Property

Syntax         Settings         Applies To          See Also

Specifies whether the split bar is displayed in a Grid control. Available at design time; read-only at run time.

Syntax

Grid.SplitBar[ = lExpr]

Settings

lExpr   One of the following:

lExpr	Description
True (.T.)	(Default) The split bar is displayed in a Grid control, allowing you to split the Grid into two separate panes.
False (.F.)	The split bar isn’t displayed in a Grid control, preventing you from splitting the Grid into separate panes.


Applies To

Grid Control


See Also

GridLines Property


SQL Commands Overview

See Also

Visual FoxPro supports Structured Query Language (SQL) commands. Visual FoxPro’s SQL commands make use of Rushmore technology to optimize performance, and a single SQL command can be used to replace multiple Visual FoxPro commands.

Visual FoxPro supports the following SQL commands:

SELECT - SQL   Specifies the criteria on which a query is based and issues the query. Visual FoxPro interprets the query and retrieves the specified data from the table(s). The SELECT command is built into Visual FoxPro like any other Visual FoxPro command. You can create a SELECT command query in these areas:

•	In the Command window.

•	In a Visual FoxPro program (like any other Visual FoxPro command).

•	In the Query Designer.

ALTER TABLE - SQL   Modifies an existing table. You can modify the name, type, precision, scale, null value support, and referential integrity rules for each field in the table.

CREATE CURSOR - SQL   Creates a temporary table. Each field in the temporary table is defined with a name, type, precision, scale, null value support, and referential integrity rules. These definitions can be obtained from the command itself or from an array.

CREATE TABLE -SQL   Creates a table. Each new table field is defined with a name, type, precision, scale, null value support, and referential integrity rules. These definitions can be obtained from the command itself or from an array.

DELETE - SQL   Marks records in a table for deletion using SQL syntax.

INSERT - SQL   Appends a new record to the end of an existing table. The new record contains data listed in the INSERT command or from an array.

UPDATE - SQL   Updates records in a table. The records can be updated based on the results of a SELECT - SQL statement.


See Also

CREATE CURSOR - SQL, CREATE QUERY, CREATE TABLE - SQL, DELETE - SQL, INSERT - SQL, MODIFY QUERY, SELECT - SQL, UPDATE - SQL


SQLCANCEL( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Requests cancellation of an executing SQL statement.

Syntax

SQLCANCEL(nConnectionHandle)

Returns

Numeric

Arguments

nConnectionHandle   Specifies the active connection handle whose SQL statement is to be cancelled.

Remarks

SQLCANCEL( ) returns 1 if the SQL statement is successfully cancelled,  – 1 if there is a connection level error, and  – 2 if there is an environment level error.

SQLCANCEL( ) cancels the execution of SQLCOLUMNS( ), SQLEXEC( ), SQLMORERESULTS( ), and SQLTABLES( ) in asynchronous mode. Use SQLSETPROP( ) to establish asynchronous mode.


SQLCANCEL( ) Function Example

The following example assumes SQLCONNECT( ) is successfully issued, and its return value is stored to a memory variable named gnConnHandle.

SQLEXEC( ) is used to sends a SQL statement to the data source and return the results to a cursor. SQLCANCEL( ) is issued to stop the query.

= SQLSETPROP(gnConnHandle, 'asynchronous', .T.)  && To stop SQLEXEC( )

= SQLEXEC(gnConnHandle, 'SELECT * FROM authors')

= SQLCANCEL(gnConnHandle)  && Wrong select statement, cancel


See Also

AERROR( )
SQLCOLUMNS( )
SQLEXEC( )
SQLMORERESULTS( )
SQLSETPROP( )
SQLTABLES( )


SQLCOLUMNS( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Stores a list of column names and information about each column for the specified data source table to a Visual FoxPro cursor.

Syntax

SQLCOLUMNS(nConnectionHandle, TableName
 [, “FOXPRO” | “NATIVE”] [, CursorName])

Returns

Numeric

Arguments

nConnectionHandle   Active connection handle.

TableName   Specifies the name of the table from which the column names are returned. TableName can contain the wildcard characters ? and *. The question mark (?) matches any single character and the asterisk (*) matches any number of characters.

FOXPRO | NATIVE   Specifies the format for the column information in the result set. Be sure to enclose FOXPRO or NATIVE in quotation marks. The NATIVE format option stores column information for tables in the same format as the data source. The FOXPRO format option stores the column information in the same format as that used for the Visual FoxPro table or cursor that would be created if you imported the data source table into Visual FoxPro. If you omit FOXPRO or NATIVE, the format option defaults to FOXPRO.

The following table shows the columns in the result set for the FOXPRO format.

Column name	Description
Field_name	Column name
Field_type	Column data type
Field_len	Column length
Field_dec	Number of decimal places
The following table shows the columns in the result set for the NATIVE format. In NATIVE format, depending on the data source, additional columns not listed in the following table may be included in the result set.

Column name	Description
Table_qualifier	Table qualifier identifier
Table_owner	Table owner identifier
Table_name	Table identifier
Column_name	Column identifier
Data_type	Column data type
Type_name	Column data type name
Precision	Precision of the column
Length	Transfer size of the data
Scale	Scale of the column
Radix	Base for Numeric type
Nullable	Supports null values
Remarks	Description of the column
If the table you specify with TableName doesn’t exist and the format is set to NATIVE, SQLCOLUMNS( ) returns true (.T.) and creates an empty table or cursor. If the table you specify with TableName doesn’t exist and the format is set to FOXPRO, SQLCOLUMNS( ) returns false (.F.).

CursorName   Specifies the name of the Visual FoxPro cursor for the result set. If you don’t include a cursor name, Visual FoxPro uses the default name SQLRESULT.

Remarks

SQLCOLUMNS( ) returns 1 if the cursor is successfully created, 0 if SQLCOLUMNS( ) is still executing,  – 1 if a connection level error occurs, and  – 2 if an environment level error occurs.

SQLCOLUMNS( ) is one of the four functions that you can execute either synchronously or asynchronously. The Asynchronous setting of SQLSETPROP( ) determines if these functions execute synchronously or asynchronously. In asynchronous mode, you must call SQLCOLUMNS( ) repeatedly until a value other than false (.F.) (still executing) is returned.


SQLCOLUMNS( ) Function Example

The following example assumes SQLCONNECT( ) is successfully issued, and its return value is stored to a memory variable named gnConnHandle. SQLCOLUMNS( ) is used to create a cursor named MyCursor containing information about the columns in the authors table.

= SQLCOLUMNS(gnConnHandle, 'authors', 'FOXPRO', 'MyCursor')


See Also

AERROR( )
SQLGETPROP( )
SQLSETPROP( )
SQLTABLES( )


SQLCOMMIT( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Commits a transaction.

Syntax

SQLCOMMIT(nConnectionHandle)

Returns

Numeric

Arguments

nConnectionHandle   Specifies the connection handle to the data source returned by SQLCONNECT( ).

Remarks

Use SQLCOMMIT( ) to commit a transaction. SQLCOMMIT( ) returns 1 if the transaction is successfully committed; otherwise, it returns -1. If SQLCOMMIT( ) returns -1, you can use AERROR( ) to determine why the transaction could not be committed.

If manual transactions are in effect (the SQLSETPROP( ) Transactions property is set to Manual), you can send multiple updates to remote tables and commit all the updates with SQLCOMMIT( ).

Updates can be rolled back with SQLROLLBACK( ).


SQLCOMMIT( ) Function Example

The following example assumes SQLCONNECT( ) is successfully issued, and its return value is stored to a memory variable named gnConnHandle. SQLSETPROP( ) is used to set the Transactions property to 2 (Manual), allowing you to use SQLCOMMIT( ) and SQLROLLBACK( ).

The authors table is modified with SQLEXEC( ), and the changes to the table are committed with SQLCOMMIT( ).

= SQLSETPROP(gnConnHandle, 'Transactions', 2)  && Manual transactions

= SQLEXEC(gnConnHandle, "INSERT INTO authors (au_id, au_lname);

VALUES ('aupoe', 'Poe')")  && Modify the authors table

= SQLCOMMIT(gnConnHandle)  && Commit the changes


See Also

AERROR( )
BEGIN TRANSACTION
END TRANSACTION
SQLCONNECT( )
SQLROLLBACK( )
SQLSETPROP( )


SQLCONNECT( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Establishes a connection to a data source.

Syntax

SQLCONNECT([DataSourceName, cUserID, cPassword | cConnectionName])

Returns

Numeric

Arguments

DataSourceName   Specifies the name of a data source as defined in your ODBC.INI file.

cUserID   Specifies a user identifier used to log on to the data source.

cPassword   Specifies the password to the data source.

cConnectionName   Specifies a named connection created with CREATE CONNECTION.

Remarks

SQLCONNECT( ) returns a positive non-zero numeric handle if you successfully connect to the data source. You should store this handle in a memory variable and use the variable in subsequent function calls that require a connection handle. SQLCONNECT( ) returns  – 2 if the connection cannot be made.

If SQLCONNECT( ) is issued without any of its additional arguments, the Select Connection or Datasource dialog box can be displayed, allowing you to choose a data source.


SQLCONNECT( ) Function Example

The following example assumes an ODBC data source called MyFoxSQLNT is available, and the user ID for the data source is “sa.” SQLCONNECT( ) is issued, and its return value is stored to a variable named gnConnHandle.

If you successfully connect to the data source, SQLCONNECT( ) returns a positive number, a dialog is displayed and SQLDISCONNECT( ) is used to disconnect from the data source.

If you cannot connect to the data source, SQLCONNECT( ) returns a negative number and a message is displayed.

STORE SQLCONNECT('MyFoxSQLNT', 'sa') TO gnConnHandle

IF gnConnHandle <= 0

= MESSAGEBOX('Cannot make connection', 16, 'SQL Connect Error')

ELSE

= MESSAGEBOX('Connection made', 48, 'SQL Connect Message)

= SQLDISCONNECT(gnConnHandle)

ENDIF


See Also

AERROR( )
CREATE CONNECTION
SQLDISCONNECT( )
SQLGETPROP( )
SQLEXEC( )
SQLSETPROP( )
SQLSTRINGCONNECT( )


SQLDISCONNECT( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Terminates a connection to a data source.

Syntax

SQLDISCONNECT(nConnectionHandle)

Returns

Numeric

Arguments

nConnectionHandle   Specifies the connection handle to the data source returned by SQLCONNECT( ). Specify 0 for nConnectionHandle to terminate all active connections.

Remarks

SQLDISCONNECT( ) returns 1 if the connection is successfully terminated,  – 1 if there is a connection level error, and  – 2 if there is an environment level error.

SQLDISCONNECT( ) terminates a connection to a data source. You must supply the connection handle that SQLCONNECT( ) returned when you established the connection.

Note   If you execute SQLDISCONNECT( ) within an asynchronous function sequence or during a transaction, SQLDISCONNECT( ) generates an error.


SQLDISCONNECT( ) Function Example

The following example assumes an ODBC data source called MyFoxSQLNT is available, and the user ID for the data source is “sa.” SQLCONNECT( ) is issued, and its return value is stored to a variable named gnConnHandle.

If you successfully connect to the data source, SQLCONNECT( ) returns a positive number, a dialog is displayed and SQLDISCONNECT( ) is used to disconnect from the data source.

If you cannot connect to the data source, SQLCONNECT( ) returns a negative number and a message is displayed.

STORE SQLCONNECT('MyFoxSQLNT', 'sa') TO gnConnHandle

IF gnConnHandle <= 0

= MESSAGEBOX('Cannot make connection', 16, 'SQL Connect Error')

ELSE

= MESSAGEBOX('Connection made', 48, 'SQL Connect Message)

= SQLDISCONNECT(gnConnHandle)

ENDIF


See Also

AERROR( )
SQLCONNECT( )
SQLSTRINGCONNECT( )


SQLEXEC( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Sends a SQL statement to the data source, where the statement is processed.

Syntax

SQLEXEC(nConnectionHandle, [cSQLCommand, [CursorName]])

Returns

Numeric

Arguments

nConnectionHandle   Specifies the connection handle to the data source returned by SQLCONNECT( ).

cSQLCommand   Specifies the SQL statement passed to the data source.

The SQL statement can contain a parameterized WHERE clause which creates a parameterized view. All parameters in the WHERE clause must be defined before SQLEXEC( ) is issued. For example, if the parameters are variables, the variables must be created and intialized before SQLEXEC( ) is issued.

For additional information about creating parameterized views, see Chapter 8, “Creating Views,” in the Developer’s Guide.

CursorName   Specifies the name of the Visual FoxPro cursor to which the result set is sent. If you don’t include a cursor name, Visual FoxPro uses the default name SQLRESULT.

For multiple result sets, new cursor names are derived by appending an incremented number to the name of the first cursor.

Remarks

SQLEXEC( ) returns the number of result sets if there is more than one. SQLEXEC( ) returns 0 if it is still executing and returns 1 when it has finished executing. SQLEXEC( ) returns –1 if a connection level error occurs.

If SQLEXEC( ) is used to execute a SQL statement prepared with SQLPREPARE( ), only the connection handle argument nConnectionHandle is required. The cSQLCommand and CursorName arguments should be omitted.

If the SQL statement generates one result set, SQLEXEC( ) stores the result set to the specified Visual FoxPro cursor. If the SQL statement generates two or more result sets and SQLSETPROP( ) is set to 1 (batch mode), you can name each result set by setting the SQLSETPROP( ) BatchMode option to 0 and changing the cursor name each time you call SQLMORERESULTS( ).

SQLEXEC( ) is one of the four functions that you can execute either synchronously or asynchronously. The Asynchronous setting of SQLSETPROP( ) determines whether these functions execute synchronously or asynchronously. In asynchronous mode, you must call SQLEXEC( ) repeatedly until it returns a value other than 0 (still executing).


SQLEXEC( ) Function Example

The following example assumes SQLCONNECT( ) is successfully issued, and its return value is stored to a memory variable named gnConnHandle.

SQLEXEC( ) is used to execute a query that returns all the information in the authors table into a cursor named MyCursor.

= SQLSETPROP(gnConnHandle, 'asynchronous', .F.)

= SQLEXEC(gnConnHandle, 'SELECT * FROM authors', 'MyCursor')


See Also

AERROR( )
SQLCANCEL( )
SQLGETPROP( )
SQLMORERESULTS( )
SQLPREPARE( )
SQLSETPROP( )


SQLGETPROP( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns current or default settings for an active connection.

Syntax

SQLGETPROP(nConnectionHandle, cSetting)

Returns

Character, Numeric, or Logical

Arguments

nConnectionHandle   Specifies the connection handle to the data source returned by SQLCONNECT( ). If you specify 0 for nConnectionHandle, SQLGETPROP( ) returns the environment setting.

cSetting   Specifies the setting. See SQLSETPROP( ) for a list of the settings you can specify.

Remarks

If a connection level error occurs,  – 1 is returned. If an environment level error occurs,  – 2 is returned.


SQLGETPROP( ) Function Example

The following example uses SQLCONNECT( ) to display the connection dialog box. Choose a datasource and the example will display the results using SQLGETPROP( ) with the DataSource cSetting.

* Clear environment

CLOSE ALL

CLEAR ALL

CLEAR

* Display the Select Connection or Datasource dialog box

* to choose a connection

nHandle=SQLCONNECT()

* Test connection, report results

IF nHandle > 0

   cSource= SQLGETPROP(nHandle, "datasource")

   =MESSAGEBOX("Current Data Source = "+cSource,0,"Connection Results")

ELSE

   =MESSAGEBOX("Connection Error = " + ;

      ALLTRIM(STR(nHandle)),0,"Connection Results")

ENDIF

=SQLDISCONNECT(nHandle)


See Also

AERROR( )
SQLCONNECT( )
SQLSETPROP( )


SQLMORERESULTS( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Copies another result set to a Visual FoxPro cursor if more result sets are available.

Syntax

SQLMORERESULTS(nConnectionHandle)

Returns

Numeric

Arguments

nConnectionHandle   Specifies the connection handle to the data source returned by SQLCONNECT( ).

Remarks

SQLMORERESULTS( ) determines if more result sets are available from a SQL statement executed with SQLEXEC( ) in non-batch mode. If more result sets are available, they are copied to a Visual FoxPro cursor, one set at a time.

SQLMORERESULTS( ) returns 0 if the SQL statement is still executing, returns 1 if it is finished executing, and returns 2 if no more data is found. In non-batch mode, SQLMORERESULTS( ) should be called after each successful SQLEXEC( ) call until SQLMORERESULTS( ) returns 2 (no more data found). The setting of the SQLSETPROP( ) batch mode option determines whether SQLEXEC( ) executes a SQL statement in batch or non-batch mode.

SQLMORERESULTS( ) returns  – 1 if a connection level error occurs, and returns – 2 if an environment level error occurs.

SQLMORERESULTS( ) is one of the four functions that you can execute either synchronously or asynchronously. The asynchronous setting of SQLSETPROP( ) determines if these functions execute synchronously or asynchronously. In asynchronous mode, you must call SQLMORERESULTS( ) repeatedly until it returns a value other than 0 (still executing).


SQLMORERESULTS( ) Function Example

The following example assumes SQLCONNECT( ) is successfully issued, and its return value is stored to a memory variable named gnConnHandle. SQLSETPROP( ) is used to set the BatchMode property to false (.F.) so the individual result sets can be retrieved.

SQLMORERESULTS( ) is issued twice to create two cursors containing the results of the SQLEXEC( ) query. SET is used to display the View window and the cursors created by SQLEXEC( ).

= SQLSETPROP(gnConnHandle, 'BatchMode', .F.)  && Individual result sets

= SQLEXEC(gnConnHandle, 'SELECT * FROM authors;

SELECT * FROM titles')

= SQLMORERES(gnConnHandle)  && First result set

= SQLMORERES(gnConnHandle)  && Second result set


See Also

AERROR( )
SQLCANCEL( )
SQLCONNECT( )
SQLEXEC( )
SQLGETPROP( )
SQLSETPROP( )


SQLPREPARE( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Prepares a SQL statement for remote execution by SQLEXEC( ).

Syntax

SQLPREPARE(nConnectionHandle, cSQLCommand, [CursorName])

Returns

Numeric

Arguments

nConnectionHandle   Specifies the connection handle to the data source returned by SQLCONNECT( ).

cSQLCommand   Specifies the SQL statement passed to the data source.

The SQL statement can contain a parameterized WHERE clause which creates a parameterized view. All parameters in the WHERE clause must be defined before SQLPREPARE( ) is issued. For example, if the parameters are variables, the variables must be created and intialized before SQLPREPARE( ) is issued.

For additional information about creating parameterized views, see Chapter 8, “Creating Views,” in the Developer’s Guide.

CursorName   Specifies the name of the Visual FoxPro cursor to which the result set is sent. If you don’t include a cursor name, Visual FoxPro uses the default name SQLRESULT.

For multiple result sets, new cursor names are derived by appending an incremented number to the name of the first cursor.

Remarks

SQLPREPARE( ) sends the SQL statement to the data source where it is compiled for faster execution. After the SQL statement is compiled, it can be executed with SQLEXEC( ). If SQLEXEC( ) is used to execute a SQL statement prepared with SQLPREPARE( ), only the connection handle is required in SQLEXEC( ).


SQLPREPARE( ) Function Example

gcAuthor = 'Smith'

= SQLPREPARE(gnConnHandle, 'SELECT * FROM authors;
WHERE au_lname = ?gcAuthor')

= SQLEXEC(gnConnHandle)

...

gcAuthor = 'Jones'

= SQLEXEC(gnConnHandle)


See Also

SQLCONNECT( )
SQLEXEC( )


SQLROLLBACK( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Cancels any changes made during the current transaction.

Syntax

SQLROLLBACK(nConnectionHandle)

Returns

Numeric

Arguments

nConnectionHandle   Specifies the connection handle to the data source returned by SQLCONNECT( ).

Remarks

SQLROLLBACK( ) returns 1 if the transaction is successfully rolled back; otherwise, it returns -1. If SQLROLLBACK( ) returns -1, you can use AERROR( ) to determine why the transaction could not be rolled back.

If manual transactions are in effect (the SQLSETPROP( ) transaction property is set to manual), you can send multiple updates to remote tables. The updates can all be rolled back with SQLROLLBACK( ).

Updates can be committed with SQLCOMMIT( ).


SQLROLLBACK( ) Function Example

The following example assumes SQLCONNECT( ) is successfully issued, and its return value is stored to a memory variable named gnConnHandle. SQLSETPROP( ) is used to set the Transactions property to 2 (manual), allowing you to use SQLCOMMIT( ) and SQLROLLBACK( ).

The authors table is modified with SQLEXEC( ), and the changes to the table are cancelled with SQLROLLBACK( ).

= SQLSETPROP(gnConnHandle, 'Transactions', 2)  && manual

= SQLEXEC(gnConnHandle, "INSERT INTO authors (au_id, au_lname);

VALUES ('aupoe', 'Poe')")

= SQLROLLBACK(gnConnHandle)


See Also

AERROR( )
SQLCOMMIT( )
SQLCONNECT( )
SQLSETPROP( )


SQLSETPROP( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Specifies settings for an active connection.

Syntax

SQLSETPROP(nConnectionHandle, cSetting [, eExpression])

Returns

Numeric

Arguments

nConnectionHandle   Specifies the connection handle to the data source returned by SQLCONNECT( ).

cSetting   Specifies the setting. The following table lists the values for cSetting.

Setting	Description
Asynchronous	Specifies whether result sets are returned synchronously (false (.F.), the default), or asynchronously (true (.T.)). Read-Write.
BatchMode	Specifies whether SQLEXEC( ) returns result sets all at once (true (.T.), the default), or individually with SQLMORERESULTS( ) (false (.F.)). Read-Write.
ConnectBusy	Contains true (.T.) if a shared connection is busy; otherwise contains false (.F.). Read-Only.
ConnectString	The login connection string. Read-Only.
ConnectTimeOut	Specifies the time to wait (in seconds) before returning a connection time-out error. If you specify 0, the wait is indefinite and a time-out error is never returned. ConnectTimeOut can be 0 to 600. The default is 15. Read-Write.
DataSource	The name of the data source as defined in the ODBC.INI file. Read-Write.
DispLogin	Contains a numeric value that determines when the ODBC Login dialog box is displayed. DispLogin may assume the following values: 1 or DB_COMPLETE (from FOXPRO.H). 1 is the default. 2 or DB_PROMPT (from FOXPRO.H). 3 or DB_NOPROMPT (from FOXPRO.H). If 1 or DB_COMPLETE is specified, Visual FoxPro displays the ODBC Login dialog box only if any required information is missing. If 2 or DB_PROMPT is specified, the ODBC Login dialog box is always displayed, allowing you to change settings before connecting. If 3 or DB_NOPROMPT is specified, the ODBC Login dialog box isn’t displayed and Visual FoxPro generates an error if the required login information isn’t available. Read-Write.
DispWarnings	Specifies if error messages are displayed (true (.T.)) or are not displayed (false (.F.), the default). Read-Write.
IdleTimeout	The idle timeout interval in seconds. Active connections are deactivated after the specified time interval. The default value is 0 (wait indefinitely). Read-Write.
ODBChdbc	The internal ODBC connection handle which may be used by external library files (FLL files) to call ODBC. Read-Only.
ODBChstmt	The internal ODBC statement handle which may be used by external library files (FLL files) to call ODBC. Read-Only.
PacketSize	The size of the network packet used by the connection. Adjusting this value can improve performance. The default value is 4096 bytes (4K). Read-Write
Password	The connection password. Read-Only.
QueryTimeOut	Specifies the time to wait (in seconds) before returning a general time-out error. If you specify 0 (the default), the wait is indefinite and a time-out error is never returned. QueryTimeOut can be 0 to 600. Read-Write.
Transactions	Contains a numeric value that determines how the connection manages transactions on the remote table. Transactions may assume the following values: 1 or DB_TRANSAUTO (from FOXPRO.H). 1 is the default. Transaction processing for the remote table is automatically handled. 2 or DB_TRANSMANUAL (from FOXPRO.H). Transaction processing is handled manually through SQLCOMMIT( ) and SQLROLLBACK( ). Read-Write.
UserId	The user identification. Read-Only.
WaitTime	The amount of time in milliseconds that elapses before Visual FoxPro checks if the SQL statement has completed executing. The default is 100 milliseconds. Read-Write.
eExpression   Specifies the value for the setting you designate with cSetting. If you omit eExpression, the default value is restored for the setting.

Remarks

SQLSETPROP( ) returns 1 if it is successful; otherwise, it returns  – 1 if a connection level error occurs or  – 2 if an environment level error occurs.

Use SQLSETPROP( ) to specify settings at the connection level. To specify Visual FoxPro default settings at the environment level, include 0 as the connection handle.

The ConnectTimeOut option can be set only at the Visual FoxPro level and has no equivalent at the connection level. You can set all other options at either the connection or the Visual FoxPro level. Each option set at the Visual FoxPro level serves as a default value for subsequent connections.

Use SQLGETPROP( ) to return the current value for a specified setting.


SQLSETPROP( ) Function Example

SQLSETPROP( ) is used to set the packet size for the current connection.

* Clear environment

CLOSE ALL

CLEAR ALL

CLEAR

* Display the Select Connection or Datasource dialog box

* to choose a connection

nHandle=SQLCONNECT()

* Test connection, report results

IF nHandle > 0

* Set PacketSize

nSet=SQLSETPROP(nHandle, "PacketSize", 2048 )

* Test setting and display results

IF nSet > 0

=MESSAGEBOX("PacketSize was set to 2048",0,"Connection Results")

ELSE

=MESSAGEBOX("Error setting PacketSize",0,"Connection Results")

ENDIF

ELSE

=MESSAGEBOX("No Connection",0,"Connection Results")

ENDIF

=SQLDISCONNECT(nHandle)


See Also

AERROR( )
SQLGETPROP( )


SQLSTRINGCONNECT( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Establishes a connection to a data source through a connection string.

Syntax

SQLSTRINGCONNECT([cConnectString])

Returns

Numeric

Arguments

cConnectString   Specifies the data source connection string required by some ODBC drivers. Visual FoxPro passes the connection string to the ODBC driver. For more information about data source connection strings, see your ODBC driver documentation.

If SQLSTRINGCONNECT( ) is issued without cConnectString, the SQL Data Sources dialog box is displayed, allowing you to choose a data source.

Remarks

SQLSTRINGCONNECT( ) returns a positive non-zero numeric handle if you successfully connect to the data source. You should store this handle in a memory variable and use the variable in subsequent function calls that require a connection handle.


SQLSTRINGCONNECT( ) Function Example

The following example assumes an ODBC data source called MyFoxSQLNT is available, and the user ID for the data source is “sa,” and the password is “FOXPRO.” SQLSTRINGCONNECT( ) is issued, and its return value is stored to a variable named gnConnHandle.

If you successfully connect to the data source, SQLSTRINGCONNECT( ) returns a positive number, a dialog is displayed and SQLDISCONNECT( ) is used to disconnect from the data source.

If you cannot connect to the data source, SQLSTRINGCONNECT( ) returns a negative number and a message is displayed.

STORE SQLSTRINGCONNECT('dsn=MyFoxSQLNT;uid=sa;pwd=FOXPRO');

TO gnConnHandle

IF gnConnHandle < 0

= MESSAGEBOX('Cannot make connection', 16, 'SQL Connect Error')

ELSE

= MESSAGEBOX('Connection made', 48, 'SQL Connect Message')

= SQLDISCONNECT(gnConnHandle)

ENDIF


See Also

AERROR( )
SQLCONNECT( )
SQLDISCONNECT( )


SQLTABLES( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Stores the names of tables in a data source to a Visual FoxPro cursor.

Syntax

SQLTABLES(nConnectionHandle [, cTableTypes] [, cCursorName])

Returns

Numeric

Arguments

nConnectionHandle   Specifies the connection handle to the data source returned by SQLCONNECT( ).

cTableTypes   Specifies one or more table types. Valid table types are ‘TABLE,’ ‘VIEW,’ ‘SYSTEM TABLE,’ or any valid data source-specific table type identifier. cTabletypes must be in upper-case. If you include a list of table types, separate the table types with commas.

All table names in the data source are selected if you omit cTableTypes or if cTableTypes is the empty string.

The table type you specify must be delimited with single quotation marks. The following example demonstrates how to specify the ‘VIEW’ and ‘SYSTEM TABLE’ table types as a string literal.

? SQLTABLES(handle, "'VIEW', 'SYSTEM TABLE'", "mydbresult")

cCursorName   Specifies the name of the Visual FoxPro cursor to which the result set is sent. If you don’t include a cursor name, Visual FoxPro uses the default name SQLRESULT.

The following table shows the columns in the cursor.

Column name	Description
TABLE_QUALIFIER	Table qualifier identifier
TABLE_OWNER	Table owner identifier
TABLE_NAME	The table name as it appears in the data dictionary
TABLE_TYPE	The table type as it appears in the data dictionary
REMARKS	A description of the table
Remarks

SQLTABLES( ) returns 1 if the cursor is successfully created, 0 if SQLTABLES( ) is still executing,  – 1 if a connection level error occurs, and  – 2 if an environment level error occurs.

SQLTABLES( ) is one of the four functions that you can execute either synchronously or asynchronously. The setting of the SQLSETPROP( ) asynchronous option determines if these functions execute synchronously or asynchronously. In asynchronous mode, you must call SQLTABLES( ) repeatedly until it returns a value other than false (.F.), meaning the function is still executing.


SQLTABLES( ) Function Example

The following example assumes an ODBC data source called MyFoxSQLNT is available, and the user ID for the data source is “sa.” SQLCONNECT( ) is issued, and its return value is stored to a variable named gnConnHandle.

If you cannot connect to the data source, SQLCONNECT( ) returns a negative number and a message is displayed.

If you successfully connect to the data source, SQLCONNECT( ) returns a positive number and a dialog is displayed. SQLTABLES( ) is used to create a cursor named mycursor that contains information about tables in the data source. LIST is used to display information about the tables.

STORE SQLCONNECT('MyFoxSQLNT', 'sa') TO gnConnHandle

IF gnConnHandle < 0

= MESSAGEBOX('Cannot make connection', 16, 'SQL Connect Error')

ELSE

= MESSAGEBOX('Connection made', 48, 'SQL Connect Message')

STORE SQLTABLES(gnConnHandle, 'TABLES', 'mycursor') TO nTables

IF nTables = 1

SELECT mycursor

LIST

ENDIF

ENDIF


See Also

AERROR( )
SQLCOLUMNS( )
SQLCONNECT( )
SQLGETPROP( )
SQLSETPROP( )


SQRT( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the square root of the specified numeric expression.

Syntax

SQRT(nExpression)

Returns

Numeric

Arguments

nExpression   Specifies the numeric expression SQRT( ) evaluates. nExpression cannot be negative.

Remarks

The number of decimal places in the value returned by SQRT( ) is the larger of the current decimal place setting and the number of decimal places contained in nExpression. The current decimal place setting is specified with SET DECIMALS.


SQRT( ) Function Example

CLEAR

? SQRT(4)  && Displays 2.00

? SQRT(2*SQRT(2))  && Displays 1.68


See Also

SET DECIMALS


SROWS( ) Function

Syntax         Returns         Remarks         Example          See Also

Returns the number of rows available in the main Visual FoxPro window.

Syntax

SROWS( )

Returns

Numeric

Remarks

In Visual FoxPro for Windows, the value returned by SROWS( ) depends on the current display mode. The display mode can be changed with SET DISPLAY.


SROWS( ) Function Example

CLEAR

? SROWS( )


See Also

COL( ), ROW( ), SCOLS( ), SET DISPLAY,  WCOLS( ), WROWS( )


StartMode Property

Syntax         Remarks         Applies To          See Also

Contains a numeric value that indicates how the instance of Visual FoxPro was started. Read-only at run time.

Syntax

ApplicationObject.StartMode

Remarks

The following table lists the numeric values the StartMode property can contain and how the instance of Visual FoxPro was started.

Value	Description
0	Visual FoxPro was started as a normal, interactive session.
1	Visual FoxPro was started as an out-of-process OLE server.
2	Visual FoxPro was started as a runtime out-of-process OLE server.
3	Visual FoxPro was started as a runtime in-process OLE server.


Applies To

Application Object, _VFP System Variable


See Also

CREATEOBJECT( )


_STARTUP System Memory Variable
_STARTUP System Variable

Included for backward compatibility. Use DO instead.


StatusBar Property

Syntax         Settings         Applies To          See Also

Specifies the text displayed in the status bar of an instance of Visual FoxPro. Read-write at run time.

Syntax

ApplicationObject.StatusBar[ = cMessageText]

Settings

cMessageText   Specifies the text displayed in the status bar.


Applies To

Application Object, _VFP System Variable


See Also

SET MESSAGE Command


StatusBarText Property

Syntax         Settings         Applies To         See Also

Specifies the text displayed in the status bar when a control has the focus. Available at design time and run time.

Syntax

[Form.]Control.StatusBarText[= cText]

Settings

cText   Specifies the text that describes the control with the focus.


Applies To

CheckBox, ComboBox, CommandButton, EditBox, Grid, ListBox, OptionButton, Spinner, TextBox


See Also

Caption Property


STORE Command

Syntax         Arguments         Remarks         Example         See Also

Stores data to a \variable, to an array, or to an array element.

Syntax

STORE eExpression TO VarNameList | ArrayNameList
 – Or –

VarName | ArrayName = eExpression

Arguments

eExpression   Specifies an expression whose value is stored to the variable, array, or array element. If the variable doesn’t exist, it is created and initialized to eExpression. An array must be previously defined with DIMENSION. STORE replaces the value in an existing variable, array, or array element with the new value.

VarNameList   Specifies a list of variables or array elements to which eExpression is stored. Separate the names or array elements with commas.

ArrayNameList   Specifies a list of names of existing arrays to which eExpression is stored. Separate array names with commas.

STORE initializes every element in the arrays to the specified value if SET COMPATIBLE is OFF. STORE stores the specified value to memory variables of the specified names if SET COMPATIBLE is ON, overwriting any existing arrays that have those names.

Remarks

An alternative to STORE is the equal sign (=) assignment operator. The variable, array, or array element must be on the left side of the equal sign and its value on the right side.

Dates can be stored directly to variables, arrays, or array elements by using braces:

STORE {12/25/95} TO gdXMas

The maximum number of variables or arrays you can create is listed in the System Capacities table . The limit can be increased or decreased in your Visual FoxPro configuration file. For more information on configuring Visual FoxPro, refer to Chapter 3, “Configuring Visual FoxPro,” in the Installation Guide and Master Index.


STORE Command Example

STORE DATE( ) TO gdDate

STORE 50 TO gnNumeric

STORE 'Hello' TO gcCharacter

STORE .T. TO glLogical

STORE $19.99 TO gyCurrency

DIMENSION gaMyArray(2,2)

SET COMPATIBLE OFF

STORE 2 TO gaMyArray

CLEAR

DISPLAY MEMORY LIKE g*


See Also

DIMENSION
SET COMPATIBLE


STR( ) Function

Syntax         Returns         Arguments         See Also

Returns the character equivalent of a specified numeric expression.

Syntax

STR(nExpression [, nLength [, nDecimalPlaces]])

Returns

Character

Arguments

nExpression   Specifies the numeric expression STR( ) evaluates.

nLength   Specifies the length of the character string STR( ) returns. The length includes one character for the decimal point and one character for each digit to the right of the decimal point.

STR( ) pads the character string it returns with leading spaces if you specify a length larger than the number of digits to the left of the decimal point. STR( ) returns a string of asterisks, indicating numeric overflow, if you specify a length less than the number of digits to the left of the decimal point.

nDecimalPlaces   Specifies the number of decimal places in the character string STR( ) returns. You must include nLength to specify the number of decimal places.

If you specify fewer decimal places than are in nExpression, the extra digits are truncated.


See Also

VAL( )


STRCONV( ) Function

Syntax         Returns         Arguments         See Also

Converts character expressions between single-byte, double-byte, UNICODE, and locale-specific representations.

Syntax

STRCONV(cExpression, nConversionSetting)

Returns

Character

Arguments

cExpression   Specifies the character expression that STRCONV( ) converts.

nConversionSetting   Specifies the type of conversion. The following table lists the values of nConversionSetting and the type of conversion performed.

nConversionSetting	Conversion
1	Converts single-byte characters in cExpression to double-byte characters.
2	Converts double-byte characters in cExpression to single-byte characters.
3	Converts double-byte Hiragana characters in cExpression to double-byte Katakana characters.
4	Converts double-byte Katakana characters in cExpression to double-byte Hiragana characters.
5	Converts double-byte characters to UNICODE (wide characters).
6	Converts UNICODE (wide characters) to double-byte characters.
7	Converts cExpression to locale-specific lowercase.
8	Converts cExpression to locale-specific uppercase.


See Also

CHRTRANC( )
IMESTATUS( )
ISLEADBYTE( )


Stretch Property

Syntax         Settings         Applies To         See Also

Specifies how an image is sized to fit inside a control. Available at design time and run time.

Syntax

[Form.]Control.Stretch[= nType]

Settings

nType   The settings for the Stretch property are:

Setting	Description
0	(Default) Clip. The image is clipped to fit the control.
1	Isometric. The image resizes to fit the control while maintaining its original proportions.
2	Stretch. The image resizes to fit the control, but does not maintain its original proportions.


Applies To

Image, OLE Bound Control, OLE Container Control


See Also

Autosize Property
Sizable Property


StrictDateEntry Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether date and DateTime values must be entered in a specific, strict format in a text box. Available at design time and run time.

Syntax

Object.StrictDateEntry[ = nValue]

Settings

nValue   One of the following settings:

Setting	Description
0	Loose. Dates and DateTime values can be entered in a loosely formatted manner. The order in which the days, months, and years are entered is determined by the DateFormat property or SET DATE. Spaces, backslashes, periods, hyphens, and the current date delimiter (specified with the DateMark property or SET MARK ) can be used to delimit date values. If the year is omitted from a date, the current year is used for the date. A caret (^) can be included as the first character in a date to specify year-month-day date ordering, overriding the order specified by the DateFormat property or SET DATE. A comma or a space can be used to delimit the date from the time in a DateTime value. When entering just an hour in a DateTime value, the colon can be omitted if the year is included in the date or a comma is used to separate the date from the time. If an invalid date or DateTime value is entered, an error message is not displayed and the text box value is set to an empty date or DateTime value. You can test for an invalid date in the Valid event.
1	(Default) Strict. Provides compatibility with previous versions of Visual FoxPro. Dates in date and DateTime values must be entered in a strict 99/99/99 format where 99 represents days, months, and years. The order in which the days, months, and years are entered is determined by the DateFormat property or SET DATE.
Remarks

The following table lists valid date and DateTime values you can enter in a text box when StrictDateEntry is set to 0 (Loose).

Date or DateTime value	Description
12 31	December 31st of the current year.
12 31 96 14	December 31st of 1996, 2 P.M.
12 31, 14	December 31st of the current year, 2 P.M.
12 - 31 - 96, 2p	December 31st of 1996, 2 P.M. Note the extra spaces between the hyphen delimiters.
^96-12-31, 2p	December 31st of 1996, 2 P.M. Caret (^) specifies year-month-day date ordering, overriding the order specified by the DateFormat property or SET DATE.
^/12/31	December 31st of the current year. Caret (^) specifies year-month-day date ordering, overriding the order specified by the DateFormat property or SET DATE.


Applies To

TextBox


See Also

Century Property, DateFormat Property, DateMark Property, Hours Property, Seconds Property, SET DATE, SET MARK TO


STRTRAN( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Searches a character expression or memo field for occurrences of a second character expression or memo field, and then replaces each occurrence with a third character expression or memo field.

Syntax

STRTRAN(cSearched, cSearchFor [, cReplacement]
[, nStartOccurrence] [, nNumberOfOccurrences])

Returns

Character

Arguments

cSearched   Specifies the character expression that is searched. cSearched can be a memo field.

cSearchFor   Specifies the character expression that is searched for in cSearched. The search is case-sensitive. cSearchFor can be a memo field.

cReplacement   Specifies the character expression that replaces every occurrence of cSearchFor in cSearched. If you omit cReplacement, every occurrence of cSearchFor is replaced with the empty string.

nStartOccurrence   Specifies which occurrence of cSearchFor is the first to be replaced. For example, if nStartOccurrence is 4, replacement begins with the fourth occurrence of cSearchFor in cSearched and the first three occurrences of cSearchFor remain unchanged. The occurrence where replacement begins defaults to the first occurrence of cSearchFor if you omit nStartOccurrence.

nNumberOfOccurrences   Specifies the number of occurrences of cSearchFor to replace. If you omit nNumberOfOccurrences, all occurrences of cSearchFor, starting with the occurrence specified with nStartOccurrence, are replaced.

Remarks

You can specify where the replacement begins and how many replacements are made. STRTRAN( ) returns the resulting character string.


STRTRAN( ) Function Example

STORE 'abracadabra' TO gcString

? STRTRAN(gcString, 'a', 'z')  && Displays zbrzczdzbrz

? STRTRAN(gcString, 'a', 'q', 2, 3)  && Displays abrqcqdqbra


See Also

STUFF( )


STUFF( ) Function

Syntax         Returns         Arguments         Example         See Also

Returns a character string created by replacing a specified number of characters in a character expression with another character expression.

Syntax

STUFF(cExpression, nStartReplacement, nCharactersReplaced, cReplacement)

Returns

Character

Arguments

cExpression   Specify the character expression in which the replacement occurs.

nStartReplacement   Specifies the position in cExpression where the replacement begins.

nCharactersReplaced   Specifies the number of characters to be replaced. If nCharactersReplaced is 0, the replacement string cReplacement is inserted into cExpression.

cReplacement   Specifies the replacement character expression. If cReplacement is the empty string, the number of characters specified by nCharactersReplaced are removed from cExpression.


STUFF( ) Function Example

STORE 'abcdefghijklm' TO gcString1

STORE '12345' TO gcString2

CLEAR

? STUFF(gcString1, 4, 0, gcString2)	  && insert

? STUFF(gcString1, 4, 3, gcString2)  	&& replace

? STUFF(gcString1, 4, 6, '')	  && delete

? STUFF(gcString1, 4, 1, gcString2)  	&& replace and insert

? STUFF(gcString1, 4, 4, gcString2)	  && replace and delete

? STUFF(gcString1, 4, LEN(gcString1), gcString2)	&& replace, delete rest


See Also

LEFT( )
PADC( ) | PADL( ) | PADR( )
RIGHT( )
STRTRAN( )
SUBSTR( )


STUFFC( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns a character string created by replacing a specified number of characters in a character expression with another character expression.

Syntax

STUFFC(cExpression, nStartReplacement, nCharactersReplaced, cReplacement)

Returns

Character

Arguments

cExpression   Specify the character expression in which the replacement occurs.

nStartReplacement   Specifies the character position in cExpression where the replacement begins.

nCharactersReplaced   Specifies the number of characters to be replaced. If nCharactersReplaced is 0, the entire replacement string cReplacement is inserted into cExpression.

cReplacement   Specifies the replacement character expression. If cReplacement is the empty string, the number of characters specified by nCharactersReplaced are removed from cExpression.

Remarks

STUFFC( ) is designed for expressions containing double-byte characters. If the expression contains only single-byte characters, STUFFC( ) is equivalent to STUFF( ).

STUFFC( ) returns a character string created by replacing a specified number of characters in a character expression with another character expression. The character expressions can consist of any combination of single-byte and double-byte characters.


See Also

LEFTC( )
RIGHTC( )
STUFF( )
SUBSTRC( )


Style Property

Syntax         Settings         Applies To         See Also

Specifies the style of a control. Available at design time and run time.

Syntax

[Form.]Control.Style[= nType]

Settings

nType   For ComboBox controls, the settings for the Style property are:

Setting	Description
0	Drop-down Combo. Includes a drop-down list and an edit area. The user can select from the list or enter characters in the edit area.
2	Drop-down List. The user must select from the drop-down list.
Follow these guidelines in deciding which setting to choose:

•	Set Style to 0 (Dropdown Combo) to give the user a list of choices and also enable the user to enter a selection in the edit area. Style 0 saves space on the Form because the list portion closes when the user makes a selection.

•	Set Style to 2 (Dropdown List) to display a fixed list of choices from which the user can select one. The list portion closes when the user selects an item.

For CheckBox and OptionButton controls, the settings for the Style property are:

Setting	Description
0	Standard.
1	Graphical. The button appears like a command button. It can contain both graphics and text. When the button contains both, the text is always centered at the bottom of the button.
For CommandButton controls, the settings for the Style property are:

Setting	Description
0	Standard
1	Invisible
For TextBox controls, the settings for the Style property are:

Setting	Description
0	(Default) Normal.
1	Included for backward compatibility with the FoxPro version 2.x @ ... SAY command. The TextBox is read-only and cannot receive the focus.


Applies To

CheckBox, ComboBox, CommandButton, OptionButton, TextBox


See Also

Click Event
DblClick Event


SUBSTR( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns a character string from the given character expression or memo field.

Syntax

SUBSTR(cExpression, nStartPosition [, nCharactersReturned])

Returns

Character

Arguments

cExpression   Specifies the character expression or memo field from which the character string is returned.

StartPosition   Specifies the position in the character expression or memo field cExpression from where the character string is returned. The first character of cExpression is position 1.

If TALK is SET ON and nStartPosition is greater than the number of characters in cExpression, Visual FoxPro generates an error message. If TALK is SET OFF, the empty string is returned.

nCharactersReturned   Specifies the number of characters to return from cExpression. If you omit nCharactersReturned, characters are returned until the end of the character expression is reached.

Remarks

SUBSTR( ) returns a character string from a character expression or memo field, starting at a specified position in the character expression or memo field and continuing for a specified number of characters.

SUBSTR( ) will not return a value for a memo field when issued in the Debug window. To return a value in the Debug window, place the memo field name within ALLTRIM( ), and place ALLTRIM( ) within SUBSTR( ).


SUBSTR( ) Function Example

STORE 'abcdefghijklm' TO mystring

CLEAR

? SUBSTR(mystring, 1, 5)  && Displays abcde

? SUBSTR(mystring, 6)  && Displays fghijklm


See Also

AT( )
LEFT( )
RIGHT( )
STRTRAN( )
STUFF( )


SUBSTRC( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns a character string from the given character expression or memo field.

Syntax

SUBSTRC(cExpression, nStartPosition [, nCharactersReturned])

Returns

Character

Arguments

cExpression   Specifies the character expression or memo field from which the character string is returned.

nStartPosition   Specifies the position in the character expression or memo field cExpression from where the character string is returned. The first character of cExpression is position 1.

If TALK is set to ON and nStartPosition is greater than the number of characters in cExpression, Visual FoxPro generates an error message. If TALK is set to OFF, the empty string is returned.

nCharactersReturned   Specifies the number of characters to return from cExpression. If you omit nCharactersReturned, characters are returned until the end of the character expression is reached.

Remarks

SUBSTRC( ) is designed for expressions containing double-byte characters. If the expression contains only single-byte characters, SUBSTRC( ) is equivalent to SUBSTR( ).

SUBSTRC( ) returns a character string from the given character expression or memo field. The character expression or memo field can contain any combination of single-byte and double-byte characters.

SUBSTRC( ) will not return a value for a memo field when issued in the Debug window. To return a value in the Debug window, place the memo field name within ALLTRIM( ), and place ALLTRIM( ) within SUBSTRC( ).


See Also

AT_C( )
LEFTC( )
RIGHTC( )
STUFFC( )
SUBSTR( )


SUM Command

Syntax         Arguments         Example         See Also

Totals all or specified numeric fields in the currently selected table.

Syntax

SUM [eExpressionList]
[Scope] [FOR lExpression1] [WHILE lExpression2]
[TO MemVarNameList | TO ARRAY ArrayName]
[NOOPTIMIZE]

Arguments

eExpressionList   Specifies one or more fields or field expressions to total. If you omit the field expression list, all numeric fields are totaled.

Scope   Specifies a range of records to include in the total. The scope clauses are: ALL, NEXT nRecords, RECORD nRecordNumber, and REST.

The default scope for SUM is ALL records.

FOR lExpression1   Specifies that only the records for which the logical condition lExpression1 evaluates to true (.T.) are included in the total. Including FOR lets you conditionally total records, filtering out undesired records.

Rushmore optimizes a SUM ... FOR command if lExpression1 is an optimizable expression. For best performance, use an optimizable expression in the FOR clause.

For more information on Rushmore optimization, see SET OPTIMIZE  and “Using Rushmore to Speed Data Access” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

WHILE lExpression2   Specifies a condition whereby records from the current table are included in the total for as long as the logical expression lExpression2 evaluates to true (.T.).

TO MemVarNameList   Stores each total to a variable. If you specify a variable in MemVarNameList that doesn’t exist, Visual FoxPro automatically creates it. Separate the variable names in the list with commas.

TO ARRAY ArrayName   Stores totals to a variable array. If the array you specify in SUM doesn’t exist, Visual FoxPro automatically creates it. If the array exists and is too small to contain all the totals, the size of the array is automatically increased to accommodate the totals.

NOOPTIMIZE   Disables Rushmore optimization of SUM.

For more information, see SET OPTIMIZE and “Using Rushmore to Speed Data Access in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.


SUM Command Example

The following example displays the totals of the in_stock and on_order fields in the products table, along with a sum of the two totals.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE products  && Opens Products table

SUM in_stock, on_order, in_stock+on_order ;

TO gnInStock, gnOnOrder, gnUnits

CLEAR

?

? 'Total in stock : ', gnInStock  && Displays 3119.00

? 'Total on order:  ', gnOnOrder  && Displays 780.00

? 'Total # units :  ', gnUnits  && Displays 3899.00


See Also

AVERAGE
CALCULATE
COUNT


SUSPEND Command

Syntax         Remarks         See Also

Pauses program execution and returns to interactive Visual FoxPro.

Syntax

SUSPEND

Remarks

While a program is paused, you can execute intervening commands, check variable values, open the Trace and Debug windows, and so on.

All variables created while the program is paused are PRIVATE.

Use RESUME to restart execution of a suspended program. Program execution continues with the line following the line containing SUSPEND.


See Also

CANCEL
RESUME


SYS( ) Functions Overview

Syntax         Returns         Remarks

Returns Visual FoxPro system information.

Syntax

SYS( )

Returns

Character

Remarks

Visual FoxPro SYS( ) functions return character values that contain useful system information. The following table shows what each SYS( ) function returns:

Function	Information returned
SYS(0)	Network machine information
SYS(1)	Julian system date
SYS(2)	Seconds since midnight
SYS(3)	Legal file name
SYS(5)	Default drive or volume
SYS(6)	Current printer device
SYS(7)	Current format file
SYS(9)	Visual FoxPro serial number
SYS(10)	String from Julian day number
SYS(11)	Julian day number
SYS(12)	Available memory in bytes
SYS(13)	Printer status
SYS(14)	Index expression
SYS(15)	Character translation
SYS(16)	Executing program file name
SYS(17)	Processor in use
SYS(18)	Current control
SYS(20)	Transform German text
SYS(21)	Controlling index number
SYS(22)	Controlling tag or index name
SYS(23)	FoxPro EMS memory usage
SYS(24)	EMS memory limit
SYS(100)	Console setting
SYS(101)	Device setting
SYS(102)	Printer setting
SYS(103)	Talk setting
SYS(1001)	Visual FoxPro memory
SYS(1016)	User object memory use
SYS(1023)	Enable Help diagnostic mode.
SYS(1024)	Disable Help diagnostic mode.
SYS(1037)	Page Setup Dialog Box
SYS(1269)	Property Information
SYS(1270)	Object Location
SYS(1271)	Object's .SCX File
SYS(1272)	Object Hierarchy
SYS(1500)	Activate a menu item
SYS(2000)	File name wildcard match
SYS(2001)	SET command status
SYS(2002)	Turn insertion point on or off
SYS(2003)	Current directory
SYS(2004)	Visual FoxPro start directory
SYS(2005)	Current resource file
SYS(2006)	Current graphics card
SYS(2007)	Check sum value
SYS(2010)	CONFIG.SYS file settings
SYS(2011)	Current lock status
SYS(2012)	Memo field block size
SYS(2013)	System menu name string
SYS(2014)	Minimum path
SYS(2015)	Unique procedure name
SYS(2016)	SHOW GETS WINDOW name
SYS(2017)	Display sign-on screen
SYS(2018)	Error message parameter
SYS(2019)	Configuration file name and location
SYS(2020)	Default disk size
SYS(2021)	Filtered index expression
SYS(2022)	Disk cluster (block) size
SYS(2023)	Temporary Path
SYS(2029)	Table type
SYS(2333)	ActiveX Dual Interface Support
SYS(3004)	Return Locale ID
SYS(3005)	Set Locale ID
SYS(3006)	Set Language and Locale IDs
SYS(3050)	Set Buffer Memory Size
SYS(3051)	Set Lock Retry Interval
SYS(3052)	Override SET REPROCESS Locking
SYS(3053)	ODBC Environment Handle


SYS(0) - Network Machine Information

Syntax         Returns         Remarks         See Also

SYS(0) returns network machine information when using Visual FoxPro in a network environment.

Syntax

SYS(0)

Returns

Character

Remarks

Machine information must first be assigned by the network software and the network shell must be loaded.

If machine information has not been assigned or the network shell hasn’t been loaded, SYS(0) returns a character string consisting of 15 spaces, a number sign (#) followed by another space, and then 0. Consult your network documentation for further information on defining machine information.

SYS(0) returns 1 when using Visual FoxPro in a stand-alone environment.

SYS(0) returns the machine name and user name.


See Also

SYS( ) Functions Overview


SYS(1) - Julian System Date

Syntax         Returns         Remarks         Example         See Also

Returns the current system date as a Julian day number character string.

Syntax

SYS(1)

Returns

Character

Remarks

The value returned by SYS(1) is valid in the U.S.A. You can get Visual FoxPro versions for any system date after September 14, 1752, and before December 31, 9999.


SYS(1) - Julian System Date Example

? SYS(1)

? SYS(10,VAL(SYS(1)))


See Also

CDOW( )
CTOD( )
DATE( )
DATETIME( )
DAY( )
DOW( )
DTOC( )
SYS( ) Functions Overview
SYS(10) - String from Julian Day Number
SYS(11) - Julian Day Number


SYS(2) - Seconds Since Midnight

Syntax         Returns         Example         See Also

Returns the number of seconds elapsed since midnight.

Syntax

SYS(2)

Returns

Character


SYS(2) - Seconds Since Midnight Example

? TIME( )

? SYS(2)


See Also

DATETIME( )
SECONDS( )
SYS( ) Functions Overview
TIME( )


SYS(3) - Legal File Name

Syntax         Returns         Remarks         See Also

Returns a legal file name that can be used to create temporary files.

Syntax

SYS(3)

Returns

Character

Remarks

SYS(3) may return a non-unique name when issued successionally on a fast computer. Use SUBSTR(SYS(2015), 3, 10) to create unique, legal eight character file name.


See Also

FILE( )
SYS( ) Functions Overview
SYS(2015) - Unique Procedure Name


SYS(5) - Default Drive or Volume

Syntax         Returns         Remarks         Example         See Also

Returns the current Visual FoxPro default drive or volume.

Syntax

SYS(5)

Returns

Character

Remarks

This function returns the current Visual FoxPro default drive. Use SET DEFAULT to specify a default drive or volume.


SYS(5) - Default Drive or Volume Example

IF _DOS OR _WINDOWS

SET DEFAULT TO C:

ENDIF

? SYS(5)


See Also

SET DEFAULT, SYS( ) Functions Overview


SYS(6) - Current Printer Device

Syntax         Returns         Remarks         Example         See Also

Returns the current print device.

Syntax

SYS(6)

Returns

Character

Remarks

This function returns the current SET PRINTER TO setting.


SYS(6) - Current Printer Device Example

? SYS(6)

SET PRINTER TO output.txt

? SYS(6)


See Also

SET PRINTER
SYS( ) Functions Overview


SYS(7) - Current Format File

Syntax         Returns         Arguments         Remarks         See Also

Returns the name of the current format file.

Syntax

SYS(7 [, nWorkArea])

Returns

Character

Arguments

nWorkArea   Specifies the work area number for which SYS(7) returns the format file name. The format file name for the current work area is returned if you omit nWorkArea.

Remarks

A format file is opened with SET FORMAT. The empty string is returned if a format file isn’t open for the work area you specify.


See Also

SET FORMAT
SYS( ) Functions Overview


SYS(9) - Visual FoxPro Serial Number

Syntax         Returns         See Also

Returns your Visual FoxPro serial number.

Syntax

SYS(9)

Returns

Character


See Also

SYS( ) Functions Overview
VERSION( )


SYS(10) - String from Julian Day Number

Syntax         Returns         Remarks         Example         See Also

Converts a Julian day number to a character string.

Syntax

SYS(10, nJulianDayNumber)

Returns

Character

Remarks

SYS(10) returns a Character-type date from a Julian day number nJulianDayNumber.


SYS(10) - String from Julian Day Number Example

? SYS(1)

? SYS(10,VAL(SYS(1)))


See Also

CDOW( )
CTOD( )
DATE( )
DATETIME( )
DAY( )
DOW( )
DTOC( )
SYS( ) Functions Overview
SYS(1) - Julian System Date
SYS(11) - Julian Day Number


SYS(11) - Julian Day Number

Syntax         Returns         Remarks         Example         See Also

Converts a date expression or character string in date format to a Julian day number.

Syntax

SYS(11, dExpression | tExpression | cExpression)

Returns

Character

Remarks

SYS(11) returns a Julian day number from a date expression dExpression, a datetime expression tExpression, or a character expression cExpression in a date format. The day number is returned as a character string.


SYS(11) - Julian Day Number Example

? SYS(11, {10/31/95})

? SYS(11,'10/31/95')


See Also

CDOW( )
CTOD( )
DATE( )
DATETIME( )
DAY( )
DOW( )
DTOC( )
SYS( ) Functions Overview
SYS(10) - String from Julian Day Number


SYS(12) - Available Memory in Bytes

Syntax         Returns         Remarks         See Also

Returns the amount of memory below 640K that is available to execute an external program.

Syntax

SYS(12)

Returns

Character

Remarks

In Visual FoxPro, SYS(12) always returns 655,360.

SYS(12) is similar to MEMORY( ), with two exceptions:

•	SYS(12) returns the amount of available memory in bytes. MEMORY( ) returns available memory in kilobytes.

•	SYS(12) returns a character string. MEMORY( ) returns a numeric value.


See Also

MEMORY( )
RUN | !
SYS( ) Functions Overview
SYS(23) - FoxPro EMS Memory Usage
SYS(24) -  EMS Memory Limit
SYS(1001) - Visual FoxPro Memory
SYS(1016) - User Object Memory Use


SYS(13) - Printer Status

Syntax         Returns         Remarks         Example         See Also

Returns the status of the printer.

Syntax

SYS(13)

Returns

Character

Remarks

OFFLINE is returned if the printer isn’t ready. READY is returned if the printer is ready.

If the printer is connected to a COM port, SYS(13) returns READY if the printer returns Clear To Send Data or Data Set Ready.

If the printer is connected to a parallel port, SYS(13) returns OFFLINE if the printer returns Out of Paper, I/O Error, Time Out, Printer Busy, or Printer Not Selected.


SYS(13) - Printer Status Example

IF SYS(13) = 'OFFLINE'

WAIT WINDOW 'Printer is offline'

ENDIF


See Also

PRINTSTATUS( )
SET PRINTER
SYS( ) Functions Overview


SYS(14) - Index Expression

Syntax         Returns         Arguments         Remarks         See Also

Returns index expression of an open single-entry .IDX index file or index expressions for tags in compound .CDX index files.

Syntax

SYS(14, nIndexNumber [, nWorkArea | cTableAlias])

Returns

Character

Arguments

nIndexNumber   Specifies which index expression to return from the open index files or tags. SYS(14) returns index expressions from open index files and tags in the following order as nIndexNumber increases from 1 to the total number of open single-entry files and structural compound and independent compound index tags:

1.	Index expressions from single-entry index files (if any are open) are returned first. The order the single-entry index files are included in USE or SET INDEX determines the order the index expressions are returned.

2.	Index expressions for each tag in the structural compound index (if one is present) are returned next. The index expressions are returned from the tags in the order that the tags were created in the structural index.

3.	Index expressions for each tag in any open independent compound indexes are returned last. The index expressions are returned from the tags in the order that the tags were created in the independent compound indexes.

The empty string is returned if nIndexNumber is greater than the total number of open single-entry files and structural compound and independent compound index tags.

nWorkArea | cTableAlias   Specifies a work area number or work area alias. If you omit nWorkArea and cTableAlias, index expressions are returned from index files open in the current work area. If a table doesn’t have the alias you specify, Visual FoxPro generates an error message.

Remarks

An index expression is specified when an index file or tag is created with INDEX. The index expression determines how a table is displayed and accessed when an index file or tag is used to order the table.

For more information on index expressions and creating index files and tags, see INDEX. SYS(14) is similar to the KEY( ) function.

USE and SET INDEX both support an index file name list that lets you open index files for a table. Any combination of single-entry index files, structural compound or independent compound index file names can be included in the index file list.


See Also

CDX( )
KEY( )
INDEX
MDX( )
NDX( )
REINDEX
SET INDEX
SET ORDER
SYS( ) Functions Overview
TAG( )


SYS(15) - Character Translation

Included for backward compatibility. Use SET COLLATE instead.


SYS(16) - Executing Program File Name

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the file name of the program being executed.

Syntax

SYS(16 [, nProgramLevel])

Returns

Character

Arguments

nProgramLevel   Indicates from how many levels back the program name is fetched. This value can range from 1 to the depth at which programs are nested.

If nProgramLevel is 0 or 1, SYS(16) returns the name of the main program (the program first executed). The name of the currently executing program is returned if nProgramLevel is omitted. The empty string is returned if nProgramLevel is greater than the program nesting depth.

Remarks

This option is useful for recovering from errors. SYS(16) is similar to PROGRAM( ). However, SYS(16) returns a path with the program name; whereas PROGRAM( ) returns just the program name.

If a procedure or function is being executed, SYS(16) returns the name of the file containing the procedure or function after the procedure or function name.

When the executing program is part of an application (.APP), SYS(16) returns only the name of the program — the path isn’t returned with the program name.


SYS(16) - Executing Program File Name Example

The program nesting is returned in the following short program example:

STORE 1 TO gnX

DO WHILE LEN(SYS(16,gnX)) != 0

? SYS(16,gnX)

STORE gnX+1 TO gnX

ENDDO


See Also

LINENO( )
ON ERROR
PROGRAM( )
SYS( ) Functions Overview


SYS(17) - Processor in Use

Syntax         Returns         Remarks         Example         See Also

Returns the central processing unit (CPU) being used.

Syntax

SYS(17)

Returns

Character

Remarks

This function returns the type of central processing unit you are using: 80386, 80486, and so on.

Note   For more information about processor type, you can call the function FxGestalt( ) in the Foxtools library.


SYS(17) - Processor in Use Example

? 'Processor in use: ', SYS(17)


See Also

SYS( ) Functions Overview


SYS(18) - Current Control

Included for backward compatibility. Use the ActiveControl property instead.


SYS(20) - Transform German Text

Included for backward compatibility. Use SET COLLATE instead.


SYS(21) - Controlling Index Number

Syntax         Returns         Remarks         See Also

Returns, as a character string, the index position number of the master controlling .CDX compound index tag or .IDX index file for the currently selected work area.

Syntax

SYS(21)

Returns

Character

Remarks

The index position number is determined by the order in which the .IDX index files and.CDX compound index tags are specified in USE and SET INDEX.

You can use SET INDEX, SET ORDER, and USE to specify which .IDX index file or .CDX compound index tag is the master controlling index file or tag. For more information on specifying a master controlling index or tag, see SET INDEX, SET ORDER, and USE.

“0” is returned if there isn’t a master controlling .CDX compound index tag or .IDX index file (for example, SET ORDER TO is issued to display and access the table in natural record order).


See Also

CDX( )
KEY( )
INDEX
MDX( )
NDX( )
REINDEX
SET INDEX
SET ORDER
SYS( ) Functions Overview
SYS(22) - Controlling Tag or Index Name
TAG( )
USE


SYS(22) - Controlling Tag or Index Name

Syntax         Returns         Remarks         See Also

Returns the name of the master controlling .CDX compound index tag or .IDX index file for a table.

Syntax

SYS(22 [, nWorkArea])

Returns

Character

Remarks

You can use SET INDEX, SET ORDER, and USE to specify which .IDX index file or .CDX compound index tag is the master controlling index file or tag. For more information on specifying a master controlling index or tag, see SET INDEX, SET ORDER, and USE.

The empty string is returned if there isn’t a master controlling .CDX compound index tag or .IDX index file (for example, SET ORDER TO is issued to display and access the table in natural record order).

nWorkArea   Specifies the work area number of the table for which SYS(22) returns the name of the master controlling .CDX compound index tag or .IDX index file.


See Also

CDX( )
KEY( )
INDEX
MDX( )
NDX( )
REINDEX
SET INDEX
SET ORDER
SYS( ) Functions Overview
SYS(21) - Controlling Index Number
TAG( )


SYS(23) - FoxPro EMS Memory Usage

Syntax         Returns         Remarks         See Also

Returns the amount of EMS memory (in 16K segments) that is currently being used by the Standard (16-bit) version of FoxPro for MS-DOS.

Syntax

SYS(23)

Returns

Character

Remarks

0 is returned if no EMS memory is in use.

SYS(23) always returns 0 in the Extended (32-bit) version of FoxPro for MS-DOS and Visual FoxPro.


See Also

SYS( ) Functions Overview
SYS(12) - Available Memory in Bytes
SYS(24) - EMS Memory Limit
SYS(1001) - Visual FoxPro Memory
SYS(1016) - User Object Memory Use


SYS(24) - Visual FoxPro EMS Memory Limit
SYS(24) - EMS Memory Limit

Syntax         Returns         Remarks         See Also

Returns the EMS limit set in your FoxPro for MS-DOS configuration file.

Syntax

SYS(24)

Returns

Character

Remarks

SYS(24) returns 0 in the Standard version of FoxPro for MS-DOS if an EMS limit is not included in your configuration file.

SYS(24) always returns 0 in the Extended (32-bit) version of FoxPro for MS-DOS and Visual FoxPro.

For complete information on this configuration setting, see Chapter 3, “Configuring Visual FoxPro,” in the Installation Guide and Master Index.


See Also

SYS( ) Functions Overview
SYS(12) - Available Memory in Bytes
SYS(23) - FoxPro EMS Memory Usage
SYS(1001) - Visual FoxPro Memory
SYS(1016) - User Object Memory Use


SYS(100) - Console Setting

Syntax         Returns         Example         See Also

Returns the current SET CONSOLE setting.

Syntax

SYS(100)

Returns

Character


SYS(100) - Console Setting Example

IF SYS(100) != 'ON'

SET CONSOLE ON

ENDIF


See Also

SET CONSOLE
SYS( ) Functions Overview


SYS(101) - Device Setting

Syntax         Returns         Example         See Also

Returns the current SET DEVICE setting.

Syntax

SYS(101)

Returns

Character


SYS(101) - Device Setting Example

IF SYS(101) != 'SCREEN'

SET DEVICE TO SCREEN

ENDIF


See Also

SET DEVICE
SYS( ) Functions Overview


SYS(102) - Printer Setting

Syntax         Returns         Example         See Also

Returns the current SET PRINTER setting.

Syntax

SYS(102)

Returns

Character


SYS(102) - Printer Setting Example

IF SYS(102) != 'OFF'

SET PRINTER OFF

ENDIF


See Also

SET PRINTER
SYS( ) Functions Overview


SYS(103) - Talk Setting

Syntax         Returns         Example         See Also

Returns the current SET TALK setting.

Syntax

SYS(103)

Returns

Character


SYS(103) - Talk Setting Example

IF SYS(103) != 'ON'

SET TALK ON

ENDIF


See Also

SET TALK
SYS( ) Functions Overview


SYS(1001) - Visual FoxPro Memory

Syntax         Returns         Remarks         See Also

Returns the total amount of memory available to the Visual FoxPro memory manager.

Syntax

SYS(1001)

Returns

Character

Remarks

In Visual FoxPro, SYS(1001) returns the virtual memory pool size, which is approximately four times the amount of physical memory.


See Also

SYS( ) Functions Overview
SYS(12) - Available Memory in Bytes
SYS(23) - FoxPro EMS Memory Usage
SYS(24) - EMS Memory Limit
SYS(1016) - User Object Memory Use


SYS(1016) - User Object Memory Use

Syntax         Returns         Remarks         See Also

Returns amount of memory being used by objects you define.

Syntax

SYS(1016)

Returns

Character

Remarks

User-defined objects include: user-defined windows, menu bars, menus, variables, arrays, open tables, files opened with low-level file functions, and so on.


See Also

SYS( ) Functions Overview
SYS(12) - Available Memory in Bytes
SYS(23) - FoxPro EMS Memory Usage
SYS(24) - EMS Memory Limit
SYS(1001) - Visual FoxPro Memory


SYS(1023) - Enable Help Diagnostic Mode

Syntax         Returns         Remarks         See Also

Enables the Help diagnostic mode, allowing you to trap the HelpContextID passed to the Visual FoxPro Help system.

Syntax

SYS(1023)

Returns

Character

Remarks

SYS(1023) is useful for debugging a custom Help system for your application. SYS(1023) returns the empty string.

When the Help diagnostic mode is enabled with SYS(1023), a dialog box is displayed whenever you press F1 or issue HELP. The dialog box displays the HelpContextID to be passed to the Visual FoxPro Help system, and you are given the option of passing the HelpContextID to the Visual FoxPro Help system.

If you choose Yes, the HelpContextID is passed to the Visual FoxPro Help system and the corresponding Help topic (if available) is displayed. If you choose No, the HelpContextID is not passed to the Visual FoxPro Help system and the corresponding Help topic is not displayed.

Use SYS(1024) to disable the Help diagnostic mode and restore the default Visual FoxPro Help system processing.


See Also

HELP
HelpContextID Property
SET HELP
SYS(1024) - Disable Help Diagnostic Mode


SYS(1024) - Disable Help Diagnostic Mode

Syntax         Returns         Remarks         See Also

Disables the Help diagnostic mode enabled by issuing SYS(1023).

Syntax

SYS(1024)

Returns

Character

Remarks

Use SYS(1024) to disable the Help diagnostic mode enabled with SYS(1023) and restore the default Visual FoxPro Help system processing. SYS(1023) is used to debug a custom Help system for your application.

SYS(1024) returns the empty string.


See Also

HELP
HelpContextID Property
SET HELP
SYS(1023) - Enable Help Diagnostic Mode


SYS(1037) - Page Setup Dialog Box

Syntax         Returns         Remarks         See Also

Displays the Page Setup dialog box

Syntax

SYS(1037)

Returns

Character

Remarks

SYS(1037) displays the Page Setup dialog box, allowing you to make adjustments to printer settings such as the paper size and orientation. The settings you can adjust in this dialog depend on the printer you’ve installed.

SYS(1037) always returns the empty string.


See Also

GETPRINTER( )
PRINTSTATUS( )
SET DEVICE
SET PRINTER


SYS(1269) - Property Information

Syntax         Returns         Arguments         Remarks         See Also

Returns a logical value that indicates whether a property setting has changed from its default setting or whether the property is read-only.

Syntax

SYS(1269, oObjectName, cProperty, nPropertyAttribute)

Returns

Logical

Arguments

oObjectName   Specifies the object for which the property setting information is returned.

cProperty   Specifies the property for which SYS(1269) returns information.

nPropertyAttribute   Specifies the property attribute.

If nPropertyAttribute is 0, SYS(1269) returns true (.T.) if the property setting has changed from its default setting. SYS(1269) returns false (.F.) if the property setting has not been changed from its default value.

If nPropertyAttribute is 1, SYS(1269) returns true (.T.) if the property setting is read-only. SYS(1269) returns false (.F.) if the property setting is read-write.

Remarks

Use SYS(1269) to determine whether a property setting has been changed from its default value or is read-only before attempting to set the property programmatically.


See Also

CREATE FORM
GETPEM( )
PEMSTATUS( )
SYS(1270) - Object Location
SYS(1271) - Object's .SCX File
SYS(1272) - Object Hierarchy


SYS(1270) - Object Location

Syntax         Returns         Arguments         Remarks         See Also

Returns a reference for an object at the specified point.

Syntax

SYS(1270 [, nXCoord, nYCoord])

Returns

Object, Logical

Arguments

nXCoord   Specifies the horizontal coordinate.

nYCoord   Specifies the vertical coordinate.

Remarks

If you omit the coordinates nXCoord and nYCoord, a reference to the object that is under the current mouse position is returned. If you include the coordinates nXCoord and nYCoord, a reference to the object at that location is returned.

False (.F.) is returned if no object is under the mouse pointer or located at the coordinates specified with nXCoord and nYCoord.


See Also

CREATE FORM
GETPEM( )
PEMSTATUS( )
SYS(1269) - Property Information
SYS(1271) - Object's .SCX File
SYS(1272) - Object Hierarchy


SYS(1271) - Object's .SCX File

Syntax         Returns         Arguments         Remarks         See Also

Returns the name of the .SCX or .VCX file in which the specified instantiated object is stored.

Syntax

SYS(1271, oObjectName)

Returns

Character, Logical

Arguments

oObjectName   Specifies the name of the object for which the .SCX file is returned.

Remarks

SYS(1271) returns the name of the .SCX file in which the specified instantiated object is stored.

SYS(1271) returns a logical false (.F.) if the object cannot be located in an .SCX file (for example, if the object was created from the Command window).


See Also

CREATE FORM
GETPEM( )
PEMSTATUS( )
SYS(1269) - Property Information
SYS(1270) - Object Location
SYS(1272) - Object Hierarchy


SYS(1272) - Object Hierarchy

Syntax         Returns         Arguments         See Also

Returns the object hierarchy for a specified object. Not available at design time.

Syntax

SYS(1272, oObjectName)

Returns

Character

Arguments

oObjectName   Specifies the name of the object for which the hierarchy is returned.


See Also

CREATE FORM
GETPEM( )
PEMSTATUS( )
SYS(1269) - Property Information
SYS(1270) - Object Location
SYS(1271) - Object's .SCX File


SYS(1500) - Activate a Menu Item
SYS(1500) - Activate a System Menu Item

Syntax         Returns         Arguments         Remarks         Example         See Also

Activates a Visual FoxPro system menu item.

Syntax

SYS(1500, cSystemItemName, cMenuName)

Returns

Character

Arguments

cSystemItemName   Specifies the name of the Visual FoxPro system menu item to activate.

cMenuName   Specifies the name of the Visual FoxPro system menu or submenu containing the menu item.

Remarks

See System Menu Names for a list of Visual FoxPro menu and menu item names. You can also use SYS(2013) - System Menu Name String to display a list of Visual FoxPro menu and menu item names.

User-defined menu items and disabled system menu items cannot be activated with SYS(1500).

SYS(1500) returns the empty string.


SYS(1500) - Activate a System Menu Item Example

The following example uses SYS(1500) to paste a command into a program file.

_CLIPTEXT = "MESSAGEBOX('TEST')"  && Command to paste

MODIFY COMMAND myprog NOWAIT  && Open a program file

SYS(1500, '_MED_PASTE', '_MEDIT')  && Paste menu item


See Also

SYS(2013) - System Menu Name String, System Menu Names


SYS(2000) - File Name Wildcard Match

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the name of the first file that matches a file name skeleton.

Syntax

SYS(2000, Skeleton [, 1])

Returns

Character

Arguments

Skeleton   Specifies the file name skeleton. The file skeleton can contain the wildcards ? and *.

1   Returns the name of the next matching file.

Remarks

The empty string is returned if a matching file can’t be found.


SYS(2000) - File Name Wildcard Match Example

? SYS(2000,'FOX.*')

? SYS(2000,'FOX.*',1)


See Also

LOCFILE( )
SYS( ) Functions Overview


SYS(2001) - SET ... Command Status

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the status of the specified SET commands.

Syntax

SYS(2001, cSETCommand [, 1 | 2])

Returns

Character

Arguments

cSETCommand   Specifies the SET command whose status SYS(2001) returns.

1 | 2   Some SET commands have two or more settings; for example, SET PRINTER ON, SET PRINTER OFF, and SET PRINTER TO FileName. Use SYS(2001) without 1 or 2 to return the ON or OFF switch setting. Use SYS(2001) with 1 or 2 to return the additional settings. See SET( ) for a list of SET commands for which additional information is returned when 1 or 2 is included.

Remarks

SYS(2001) is identical to SET( ).


SYS(2001) - SET ... Command Status Example

? SYS(2001,'PRINTER')

? SYS(2001,'PRINTER',1)


See Also

SET( )
SYS( ) Functions Overview


SYS(2002) - Turn Insertion Point On or Off

Syntax         Returns         Remarks         See Also

Turns the insertion point on or off.

Syntax

SYS(2002 [, 1])

Returns

None

Remarks

SYS(2002) turns the insertion point off. SYS(2002, 1) turns the insertion point on. For more information about turning the insertion point on and off, see SET CURSOR.


See Also

INKEY( )
SET CURSOR
SYS( ) Functions Overview


SYS(2003) - Current Directory

Syntax         Returns         Remarks         See Also

Returns the name of the current directory on the default drive.

Syntax

SYS(2003)

Returns

Character

Remarks

You can use SYS(5) to determine the current drive.


See Also

CURDIR( )
SET DEFAULT
SET PATH
SYS( ) Functions Overview
SYS(5) - Default Drive


SYS(2004) - Visual FoxPro Start Directory

Syntax         Returns         Remarks         Example         See Also

Returns the name of the directory from which Visual FoxPro was started.

Syntax

SYS(2004)

Returns

Character

Remarks

SYS(2004) returns the location of the .ESL file in a distributed run time Visual FoxPro application.


 SYS(2004) - Visual FoxPro Start Directory Example

? 'Visual FoxPro launch directory: ', SYS(2004)


 See Also

HOME( ), SET PATH, SYS( ) Functions Overview


SYS(2005) - Current Resource File

Syntax         Returns         Remarks         Example         See Also

Returns the name of the current Visual FoxPro resource file.

Syntax

SYS(2005)

Returns

Character

Remarks

The Visual FoxPro resource file is a Visual FoxPro table that contains information on system and user-defined resources like keyboard macros, preferences, system window locations and sizes, diary entries, and so on.

The Visual FoxPro resource file defaults to FOXUSER.DBF. Use SET RESOURCE to specify a different Visual FoxPro resource file.


SYS(2005) - Current Resource File Example

? 'Current resource file: ', SYS(2005)


See Also

SET RESOURCE
SYS( ) Functions Overview


SYS(2006) - Current Graphics Card

Syntax         Returns         Example         See Also

Returns the type of graphics card and monitor you are using.

Syntax

SYS(2006)

Returns

Character


SYS(2006) - Current Graphics Card Example

? 'Current graphics card/monitor: ', SYS(2006)


See Also

ISCOLOR( )
SET DISPLAY
SYS( ) Functions Overview


SYS(2007) - Check Sum Value

Syntax         Returns         Remarks         See Also

Returns the check sum value of a character expression.

Syntax

SYS(2007, cExpression)

Returns

Character

Remarks

A check sum can be used to test the validity of data or to compare two character expressions.

cExpression   Specifies the character expression for which SYS(2007) returns a check sum value.


See Also

SET RESOURCE
SYS( ) Functions Overview


SYS(2010) - CONFIG.SYS File Settings

Syntax         Returns         Remarks         See Also

Returns the files setting in CONFIG.SYS.

Syntax

SYS(2010)

Returns

Character

Remarks

In FoxPro for MS-DOS, SYS(2010) returns as a character string the files setting in your CONFIG.SYS configuration file.

In Visual FoxPro, SYS(2010) always returns 255.

Most CONFIG.SYS files contain a line specifying the maximum number of files that can be opened at the same time under MS-DOS. This line usually reads FILES=NNN, where NNN is a number. SYS(2010) returns this number.

A CONFIG.SYS configuration file doesn’t have to have a files setting; furthermore, you need not have a CONFIG.SYS file. SYS(2010) returns the default MS-DOS files setting in either case.

The number returned by SYS(2010) isn’t the number of files you can open in Visual FoxPro, FoxPro for Windows, and FoxPro for MS-DOS. MS-DOS opens files for its own use. Visual FoxPro and FoxPro for Windows also open files for their own internal use, and the number of these open files can vary throughout a FoxPro session. The files setting in your CONFIG.SYS file must be somewhat greater than the number of files you would like to open in Visual FoxPro.

For more information on the CONFIG.SYS configuration file, see your MS-DOS manual.


See Also

SYS( ) Functions Overview


SYS(2011) - Current Lock Status

Syntax         Returns         Remarks         See Also

Returns the record or table lock status for the current work area.

Syntax

SYS(2011)

Returns

Character

Remarks

Unlike the FLOCK( ), LOCK( ), and RLOCK( ) functions, SYS(2011) doesn’t attempt to lock the table or record.

The character string returned by SYS(2011) is identical to the message displayed in the status bar (Exclusive, Record Unlocked, Record Locked ...).

SYS(2011) returns Exclusive only at the workstation that opened the table exclusively, and Record Locked only at the workstation that applied the record lock.


See Also

FLOCK( )
LOCK( )
RLOCK( )
SYS( ) Functions Overview


SYS(2012) - Memo Field Blocksize

Syntax         Returns         Arguments         Remarks         See Also

Returns the memo field block size for a table.

Syntax

SYS(2012 [, nWorkArea | cTableAlias])

Returns

Character

Arguments

nWorkArea | cTableAlias   Specifies the work area number or table alias for the table for which the memo field block size is returned. nWorkArea specifies a work area number and cTableAlias specifies a table alias. If you do not specify a work area or alias, SYS(2012) returns the memo field block size for the table open in the currently selected work area.

SYS(2012) returns 0 if a table isn’t open in the specified work area or the table doesn’t have a memo field.

Remarks

For more information on specifying the memo field block size for a table, see SET BLOCKSIZE.


See Also

SET BLOCKSIZE


SYS(2013) - System Menu Name String

Syntax         Returns         Remarks         See Also

Returns a space-delimited character string containing the internal names of the Visual FoxPro menu system.

Syntax

SYS(2013)

Returns

Character

Remarks

SYS(2013) facilitates utilization of the Visual FoxPro system menu bar and system menus. The character string returned contains the name of the system menu bar, its menu titles, and the name of each item on the menus.

SYS(2013) returns the names of the menu titles and menu items for every FoxPro platform. See System Menu Names for a listing of menu titles and menu items for a specific FoxPro platform.


See Also

DEFINE BAR
DEFINE MENU
DEFINE POPUP
SYS( ) Functions Overview
SYS(1500) - Activate a System Menu Item
System Menu Names


SYS(2014) - Minimum Path

Syntax         Returns         Arguments         Remarks         See Also

Returns the minimum path relative to the current or specified directory for a specified file.

Syntax

SYS(2014, cFileName [, Path])

Returns

Character

Arguments

cFileName   Specifies the name of the file for which SYS(2014) returns the minimum path. If you omit Path, SYS(2014) returns the minimum path between the file and the current directory. You can change the current directorywith SET DEFAULT.

Path   Specifies a directory for which SYS(2014) returns the minimum path between the specified directory and the file specified with cFileName.

Path   Specifies a folder for which SYS(2014) returns the minimum path between the specified folder and the file specified with cFileName.

Remarks

SYS(2014) can be used with FULLPATH( ) to make applications portable. That is, when given the location of the current program and the location of other files used by the program, FULLPATH( ) and SYS(2014) obtain the proper paths for these files. Once the files’ paths are determined, the files can be accessed by the program.


See Also

FULLPATH( )
SET DEFAULT
SET PATH
SYS( ) Functions Overview


SYS(2015) - Unique Procedure Name

Syntax         Returns         Remarks         See Also

Returns a unique 10-character procedure name that begins with an underscore followed by a combination of letters and numbers.

Syntax

SYS(2015)

Returns

Character

Remarks

SYS(2015) can be used to create unique procedure or function names.

The name that SYS(2015) returns is created from the system date and system time. Calling SYS(2015) more than once during the same millisecond interval will return a unique character string.


See Also

SYS( ) Functions Overview
SYS(3) - Legal File Name


SYS(2016) - SHOW GETS WINDOW Name

Included for backward compatibility. Use the Refresh method instead of SHOW GETS.


SYS(2017) - Display Startup Screen

Included for backward compatibility. Use CREATE FORM instead.


SYS(2018) - Error Message Parameter

Syntax         Returns         Remarks         See Also

Returns the error message parameter for the most recent error.

Syntax

SYS(2018)

Returns

Character

Remarks

Certain error messages return additional information about the cause of the error. For example, if you reference a variable that doesn’t exist, the name of the variable is included in the error message. SYS(2018) returns this additional information, called the error message parameter. Names of variables and files are common types of error message parameters.

Suppose you try to run a program named REPORTS, but the program doesn’t exist. The text of the error message displayed is:

File REPORTS does not exist.

REPORTS is the error message parameter, and it is returned by SYS(2018):

? SYS(2018)


See Also

ERROR( )
MESSAGE( )
ON ERROR
SYS( ) Functions Overview


SYS(2019) - Configuration File Name and Location

Syntax         Returns         Remarks         See Also

Returns the name and location of the Visual FoxPro configuration file.

Syntax

SYS(2019)

Returns

Character

Remarks

The configuration file is named CONFIG.FPW.

If a configuration file can’t be located, SYS(2019) returns an empty string.

The Visual FoxPro configuration file is typically located in the directory where Visual FoxPro is started, but can be located elsewhere. Visual FoxPro first looks for it in the startup directory.

If the configuration file isn’t located in the startup directory, the MS-DOS path is then searched. Two options let you tell Visual FoxPro where your configuration file is located and its name:

•	You can create an MS-DOS environmental variable named FOXPROWCFG with the MS-DOS SET command, and you can store the location and name of your configuration file in FOXPROCFG. In FoxPro for MS-DOS, the MS-DOS environmental variable is named FOXPROCFG.

•	When you start Visual FoxPro, you can also use the -C switch  to designate a configuration file. Include the location and name of the configuration file immediately after -C.

For further information about the Visual FoxPro configuration file, see Chapter 3, “Configuring Visual FoxPro,” in the Installation Guide and Master Index.


See Also

SYS( ) Functions Overview


SYS(2020) - Default Disk Size

Syntax         Returns         Remarks         See Also

Returns the total size in bytes of the default disk.

Syntax

SYS(2020)

Returns

Character

Remarks

The default disk can be specified with SET DEFAULT.


See Also

DISKSPACE( )
SET DEFAULT
SYS( ) Functions Overview


SYS(2021) - Filtered Index Expression

Syntax         Returns         Arguments         Remarks         See Also

Returns the filter expression for an open single-entry index (.IDX) file or filter expressions for tags in compound index (.CDX) files.

Syntax

SYS(2021, nIndexNumber [, nWorkArea | cTableAlias])

Returns

Character

Arguments

nIndexNumber   The numeric expression nIndexNumber specifies which filter expression to return from the open index files. SYS(2021) returns filter expressions from open index files in the following order as nIndexNumber increases from 1 to the total number of open single-entry .IDX files and structural compound and independent compound index tags:

1.	Filter expressions from single-entry .IDX files (if any are open) are returned first. The order in which the single-entry .IDX files are included in USE or SET INDEX determines the order in which the filter expressions are returned.

2.	Filter expressions for each tag in the structural .CDX file (if one is present) are returned next. The filter expressions are returned from the tags in the order the tags were created in the structural index.

3.	Filter expressions for each tag in any open independent .CDX files are returned last. The filter expressions are returned from the tags in the order the tags were created in the independent compound indexes.

The empty string is returned if nIndexNumber is greater than the total number of open single-entry .IDX files and structural and independent .CDX file tags.

nWorkArea   Specifies the work area number for a table open in another work area.

cTableAlias   Specifies a table alias for a table open in another work area. If a table doesn’t have the alias you specify, Visual FoxPro displays an error message.

Remarks

You can create filtered indexes in Visual FoxPro. If you include the optional FOR clause in INDEX, the index file acts as a filter on the table. Only records that match the filter expression lExpression in the FOR clause are available for display and access. Index keys are created in the index file for only those records matching the filter expression.

The empty string is returned if an index or index tag was created without a FOR clause.

USE and SET INDEX both support an index file name list that lets you open index files for a table. Any combination of single-entry .IDX file names, structural .CDX file names, and independent .CDX file names may be included in the index file name list.

SYS(2021) returns filter expressions from index files open in the current work area unless you include a specific work area or alias.


See Also

CDX( )
KEY( )
INDEX
MDX( )
NDX( )
REINDEX
SET INDEX
SET ORDER
SYS( ) Functions Overview
TAG( )


SYS(2022) - Disk Cluster Size

Syntax         Returns         Arguments         See Also

Returns the cluster size in bytes of a specified disk.

Syntax

SYS(2022 [, cDiskName])

Returns

Character

Arguments

cDiskName   Specifies a drive letter (A, B, C, ...) for a disk other than the current default disk.


See Also

SET DEFAULT, SYS( ) Functions Overview


SYS(2023) - Temporary File Drive
SYS(2023) - Temporary Path

Syntax         Returns         Remarks         See Also

Returns the path on which Visual FoxPro stores its temporary files.

Syntax

SYS(2023)

Returns

Character

Remarks

You can specify the path on which temporary files are stored by including the special TMPFILES configuration item in your Visual FoxPro configuration file.

For additional information about the special TMPFILES configuration item, see Chapter 3, “Configuring Visual FoxPro,” in the Installation Guide and Master Index.


See Also

SYS( ) Functions Overview


SYS(2029) - Table Type

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns a value corresponding to the table type.

Syntax

SYS(2029 [, nWorkArea | cTableAlias])

Returns

Character

Arguments

nWorkArea   Specifies the work area in which the table is open.

cTableAlias   Specifies the alias of the table. If you omit nWorkArea and cTableAlias, SYS(2029) returns a value for the table open in the currently selected work area.

Remarks

The following table lists the values returned by SYS(2029) and the corresponding table type:

Return value	Table type
0	No table open
3	Previous versions of FoxPro, FoxBASE+, dBASE III PLUS, and dBASE IV with no memo field
48	Visual FoxPro with or without a memo field
67	dBASE IV SQL table with no memo field
99	dBASE IV SQL System table with a memo field
131	FoxBASE+ and dBASE III PLUS table with a memo field
139	dBASE IV table with a memo field
203	dBASE IV SQL table with a memo field
245	Previous versions of FoxPro with a memo field


SYS(2029) - Table Type Example

The following example opens the customer table in the testdata database.

CLOSE DATABASES

OPEN DATABASE (SYS(2004) + 'samples\data\testdata')

USE Customer	  && Open customer table

CLEAR

DO CASE

CASE SYS(2029) = '3'

? 'Previous versions of FoxPro'

CASE SYS(2029) = '48'

? 'Visual FoxPro Table'

CASE SYS(2029) = '67'

? 'dBASE IV SQL table, no memo fields'

CASE SYS(2029) = '99'

? 'dBASE IV SQL System table with a memo field'

CASE SYS(2029) = '131'

? 'FoxBASE+ table with a memo field'

CASE SYS(2029) = '139'

? 'dBASE IV table with a memo field'

CASE SYS(2029) = '203'

? 'dBASE IV SQL table with a memo field'

CASE SYS(2029) = '245'

? 'Previous versions of FoxPro with a memo field'

ENDCASE


See Also

ALTER TABLE - SQL
CREATE
CREATE TABLE - SQL
USE


SYS(2333) - ActiveX Dual Interface Support

Syntax         Returns         Arguments         Remarks         See Also

Enables or disables ActiveX dual interface (VTABLE binding) support.

Syntax

SYS(2333 [, 0 | 1])

Returns

Character

Arguments

0   Disables ActiveX dual interface support. If 0 or 1 is omitted, ActiveX dual interface support is disabled.

1   Enables ActiveX dual interface support.

Remarks

The ActiveX control dual interface (VTABLE binding) is an optimization supported by Visual FoxPro. If an ActiveX control doesn’t use the dual interface, you can disable the optimization while using that control.

If an ActiveX control does not perform properly when the control is instantiated, issue SYS(2333) or SYS(2333, 0) before the control is instantiated to disable dual interface support for the control. After the control has been instantiated, issue SYS(2333, 1) to enable ActiveX dual interface support for any controls that are later instantiated.


See Also

ActiveX Controls Overview.
OLE Container Control


SYS(3004) - Return Locale ID

Syntax         Returns         Remarks         See Also

Returns the Locale ID used by automation and ActiveX controls.

Syntax

SYS(3004)

Returns

Character

Remarks

SYS(3004) returns the current Visual FoxPro Locale ID (LCID), which is determined by the Visual FoxPro Language ID (LangID) and Sort ID.

The Locale ID determines the language in which automation and ActiveX controls exchange information. The default Visual FoxPro Locale ID is 1033, English.

For example, assume you have installed the German version of Microsoft Excel 5.0, which supports both English and German commands. In this case, the following example allows you to start and close the German version of Microsoft Excel 5.0:

oleExcel1 = CREATEOBJECT('Excel.Application')  && Starts Excel

? SYS(3005, 1033)  && English Locale ID

oleExcel.Quit  && Closes Excel with English command

oleExcel2 = CREATEOBJECT('Excel.Application')  && Starts Excel

? SYS(3005, 1031)  && German Locale ID

oleExcel.Beenden  && Closes Excel with German command

For a list of Visual FoxPro Locale IDs, see SYS(3005) - Set Locale ID. For additional information about Locale, Language, and Sort IDs, see the Microsoft Windows Software Development Kit documentation.


See Also

DefOLELCID Property
OLELCID Property
SYS(3005) - Set Locale ID
SYS(3006) - Set Language and Locale IDs


SYS(3005) - Set Locale ID

Syntax         Returns         Arguments         Remarks         See Also

Sets the Locale ID used by automation and ActiveX controls.

Syntax

SYS(3005, nLocaleID)

Returns

Character

Arguments

nLocaleID   Specifies the Locale ID. The following list contains the Locale IDs supported in Visual FoxPro:

nLocaleID	Language
1029	Czech
1031	German
1033	English (Default)
1034	Spanish
1036	French
1040	Italian
1045	Polish
1046	Portuguese (Brazilian)
2070	Portuguese (Standard)
Remarks

SYS(3005) sets the global Locale ID (LCID). The Locale ID determines the language in which automation and ActiveX controls exchange information. The default Visual FoxPro Locale ID is 1033, English.

Using the DefOLELCID Property is the preferred method for setting a Locale ID for a form or the main Visual FoxPro window. The automation command language is affected only by the Global LocaleID, set with SYS(3005). The DefOLELCID and OLELCID properties affect only the language of the user interface, which ActiveX controls display, and not the language of the automation commands.

For example, assume you have installed the German version of Microsoft Excel 5.0, which supports both English and German commands. In this case, the following example allows you to start and close the German version of Microsoft Excel 5.0:

oleExcel1 = CREATEOBJECT('Excel.Application')  && Starts Excel

? SYS(3005, 1033)  && English Locale ID

oleExcel.Quit  && Closes Excel with English command

oleExcel2 = CREATEOBJECT('Excel.Application')  && Starts Excel

? SYS(3005, 1031)  && German Locale ID

oleExcel.Beenden  && Closes Excel with German command

For additional information about Locale IDs, see the Microsoft Windows Software Development Kit documentation.


See Also

DefOLELCID Property
OLELCID Property
SYS(3004) - Return Locale ID
SYS(3006) - Set Language and Locale IDs


SYS(3006) - Set Language and Locale IDs

Syntax         Returns         Arguments         Remarks         See Also

Sets the Language ID and the Locale ID.

Syntax

SYS(3006, nLanguageID)

Returns

Character

Arguments

nLanguageID   Specifies the Language ID.

Remarks

SYS(3006) sets the Visual FoxPro Language ID (LangID), and then sets the Locale ID (LCID) based on the Language ID and the current value of the Sort ID.

Using the DefOLELCID Property is the preferred method for setting a Locale ID for a form or the main Visual FoxPro window.

For additional information about Language, Locale, and Sort IDs, see the Microsoft Windows Software Development Kit documentation.


See Also

DefOLELCID Property
OLELCID Property
SYS(3004) - Return Locale ID
SYS(3005) - Set Locale ID


SYS(3050) - Set Buffer Memory Size

Syntax         Returns         Arguments         Remarks         See Also

Sets the foreground or background buffer memory size.

Syntax

SYS(3050, nType, [nBuffMemSize])

Returns

Character

Arguments

nType   Specifies the buffer. The following table lists the values for nType and the corresponding buffer:

nType	Buffer
1	Foreground
2	Background
nBuffMemSize   Specifies the maximum buffer memory size in bytes. If you specify a value for nBuffMemSize that is less than 256K bytes, Visual FoxPro sets the buffer memory size to 256K bytes.

Specify 0 for nBuffMemSize to return the buffer memory size to the Visual FoxPro startup value. The startup value depends on the amount of your computer’s memory. If you omit nBuffMemSize, SYS(3050) returns the buffer memory size for the buffer specified with nType.

Remarks

SYS(3050) allows you to optimize Visual FoxPro performance by adjusting the amount of memory Visual FoxPro allocates for the foreground and background buffers. The foreground memory buffer is the memory available to Visual FoxPro when it is operating in the foreground as the currently active application. The background memory buffer is the memory available to Visual FoxPro when it is operating in the background when another application is the foreground application.

SYS(3050) returns a numeric value as a character string that indicates the maximum amount of memory Visual FoxPro allocates for the foreground or background buffers.


 See Also

SYS(1001) - Visual FoxPro Memory


SYS(3051) - Set Lock Retry Interval

Syntax         Returns         Arguments         Remarks         See Also

Specifies the time in milliseconds that Visual FoxPro waits before attempting to lock a record, table, memo, or index file after an unsuccessful locking attempt.

Syntax

SYS(3051, [nWaitMilliseconds])

Returns

Character

Arguments

nWaitMilliseconds   Specifies the wait time in milliseconds; can be a value from 100 to 1000 milliseconds.

Specify 0 for nWaitMilliseconds to return the lock attempt time interval to the Visual FoxPro default startup value (333 milliseconds). If you omit nWaitMilliseconds, SYS(3051) returns the current lock attempt time interval.

Remarks

SYS(3051) returns a numeric value as a character string that indicates the lock attempt time interval.


See Also

SET REPROCESS
SYS(3052) - Override SET REPROCESS Locking


SYS(3052) - Override SET REPROCESS Locking

Syntax         Returns         Arguments         Remarks         See Also

Specifies whether Visual FoxPro uses the SET REPROCESS setting when attempting to lock an index or memo file.

Syntax

SYS(3052, nFileType, [lHonorReprocess])

Returns

Character

Arguments

nFileType   Specifies the type of file. The following table lists the values for nType and the corresponding file type:

nFileType	File type
1	Index
2	Memo
lHonorReprocess   Specifies whether Visual FoxPro uses the SET REPROCESS setting for unsuccessful lock attempts for index and memo files.

Specify true (.T.) to use the SET REPROCESS setting when Visual FoxPro attempts to lock files specified with nFileType. Specify false (.F.), the default, to override the SET REPROCESS setting when Visual FoxPro attempts to lock files specified with nFileType. When set to false, Visual FoxPro waits indefinitely for locks on the specified files; this option is the same as locking behavior in previous versions of FoxPro.

If you omit lHonorReprocess, SYS(3052) returns the current setting for the file type specified with nFileType.

Remarks

SYS(3052) provides additional control over file locking in Visual FoxPro. It’s best to set lHonorReprocess to true (.T.) in order to reduce the risk of file lock contention if your application uses transaction processing.

SYS(3052) returns as a character string a numeric value of 0 (corresponding to false (.F.)) or 1 (corresponding to true (.T.)). If lHonorReprocess is included in SYS(3052), the value returned is identical to the logical value you specify for lHonorReprocess. If you omit lHonorReprocess, the value returned is the current setting for the file type specified with nFileType.


See Also

SET REPROCESS
SYS(3051) - Set Lock Retry Interval


SYS(3053) - ODBC Environment Handle

Syntax         Returns         Remarks         See Also

Returns the ODBC environment handle.

Syntax

SYS(3053)

Returns

Character

Remarks

If ODBC isn’t loaded, SYS(3053) loads it and returns the ODBC environment handle.

The environment handle returned by SYS(3053) provides access to ODBC through ODBC API calls. Access to the ODBC API is available in Visual FoxPro through DECLARE - DLL, and through external Visual FoxPro API library routines.

Only one ODBC environment handle should be used at any time. A Visual FoxPro program using ODBC calls should use SYS(3053) to get the ODBC environment handle rather than reallocating and freeing the ODBC environment handle through ODBC API calls.

Exercise care when manipulating an ODBC environment handle. For further information about the ODBC API, see the Microsoft ODBC SDK documentation.


See Also

DECLARE - DLL
SET LIBRARY


SYS(3054) Function
SYS(3054) Function - Rushmore Optimization Level

Syntax         Returns         Arguments         Remarks          See Also

Enables or disables display of Rushmore optimization levels for queries.

Syntax

SYS(3054, 0 | 1)

Returns

Character

Arguments

0   (Default) Disables the display of Rushmore optimization levels.

1   Enables the display of Rushmore optimization levels.

Remarks

Use SYS(3054) to improve query performance by determining the extent to which the query is optimized by Rushmore technology.

Issue SYS(3054, 1) to display the Rushmore optimization level after a query is executed. The optimization level is displayed in the active window.

The following table lists the three levels of Rushmore optimization:

Optimization Level	Description
None	The query could not be optimized with Rushmore technology.
Partial	Some expressions in the query could be optimized with Rushmore technology. The index tags used for Rushmore optimization are listed.
Full	The query was fully optimized with Rushmore technology. The index tags used for Rushmore optimization are listed.
If SYS(3054,1) indicates that a query could not be optimized or could be optimized only partially, you can modify the query to take advantage of Rushmore optimization.

For more information about Rushmore technology and optimizing queries, see “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

Issue SYS(3054, 0) to stop display of the Rushmore optimization level after a query is executed.


See Also

SELECT - SQL Command


SYSMETRIC( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns the size of the operating system’s screen elements.

Syntax

SYSMETRIC(nScreenElement)

Returns

Numeric

Arguments

nScreenElement   Specifies a screen element. The following table shows values for nScreenElement and the corresponding screen element:

nScreenElement	Screen Element
1	Screen width
2	Screen height.
3	Width of sizable window frame
4	Height of sizable window frame
5	Width of scroll arrows on vertical scroll bar
6	Height of scroll arrows on vertical scroll bar
7	Width of scroll arrows on horizontal scroll bar
8	Height of scroll arrows on horizontal scroll bar
9	Height of window title
10	Width of non-sizable window frame
11	Height of non-sizable window frame
12	Width of DOUBLE or PANEL window frame
13	Height of DOUBLE or PANEL window frame
14	Scroll box width on horizontal scroll bar in text editing windows
15	Scroll box height on vertical scroll bar in text editing windows
16	Minimized window icon width
17	Minimized window icon height
18	Maximum insertion point width
19	Maximum insertion point height
20	Single-line menu bar height
21	Maximized window width
22	Maximized window height
23	Kanji window height
24	Minimum sizable window width
25	Minimum sizable window height
26	Minimum window width
27	Minimum window height
28	Window controls width
29	Window controls height
30	1 if mouse hardware present; otherwise 0
31	1 for Microsoft Windows debugging version; otherwise 0
32	1 if mouse buttons swapped; otherwise 0
Remarks

SYSMETRIC( ) returns the size of screen elements. Screen elements include menus, windows, window controls, and the insertion point. Values are returned in pixels unless otherwise noted and can vary for different displays, display drivers, and video hardware. For further information on screen elements, refer to the GetSystemMetrics function in the Microsoft Windows Programmer’s Reference.

SYSMETRIC( ) enables you to determine the size of menus, windows, and window controls you create in Visual FoxPro. Windows and menus created with DEFINE WINDOW and DEFINE MENU use the same screen element sizes as the operating system’s windows and menus.


See Also

FONTMETRIC( )
GETFONT( )
TXTWIDTH( )
WFONT( )


System Variables Overview

See Also

System variables are built-in variables that Visual FoxPro creates and maintains automatically. They are PUBLIC by default, but you can declare them PRIVATE.

Important     The functionality of many system variables has been replaced by new features in Visual FoxPro. For details, see the description for each system variable.

The following table lists the five types of Visual FoxPro system variables and their designation in expressions:

Variable type	Description	Expression
C	Character	cExpression
D	Date	dExpression
L	Logical	lExpression
N	Numeric	nExpression
O	Object	oExpression
The following table lists all system variables — their types and default values:

Variable	Type	Default value
_ALIGNMENT	C	LEFT
_ASCIICOLS	N	80
_ASCIIROWS	N	63
_ASSIST	C	Empty string
_BEAUTIFY	C	Empty string
_BOX	L	.T.
_BROWSER	C	BROWSER.APP
_BUILDER	C	BUILDER.APP
_CALCMEM	N	0.0
_CALCVALUE	N	0.0
_CLIPTEXT	C	Empty string
_CONVERTER	C	CONVERT.APP
_CUROBJ	N	-1
_DBLCLICK	N	0.5
_DIARYDATE	D	Current date
_DOS	L	.T. in FoxPro for MS-DOS
_FOXDOC	C	Empty string
_GENGRAPH	C	Empty string
_GENMENU	C	GENMENU.PRG
_GENPD	C	Empty string
_GENSCRN	C	GENSCRN.PRG
_GENXTAB	C	Empty string
_INDENT	N	0
_LMARGIN	N	0
_MAC	L	.T. in Visual FoxPro for Macintosh
_MLINE	N	0
_PADVANCE	C	FORMFEED
_PAGENO	N	1
_PBPAGE	N	1
_PCOLNO	N	Current column
_PCOPIES	N	1
_PDRIVER	C	Empty string
_PDSETUP	C	Empty string
_PECODE	C	Empty string
_PEJECT	C	NONE
_PEPAGE	N	32767
_PLENGTH	N	66
_PLINENO	N	0
_PLOFFSET	N	0
_PPITCH	C	DEFAULT
_PQUALITY	L	.F.
_PRETEXT	C	Empty string
_PSCODE	C	Empty string
_PSPACING	N	1
_PWAIT	L	.F.
_RMARGIN	N	80
_SCREEN	O	FORM
_SHELL	C	Empty string
_SPELLCHK	C	SPELLCHK.APP
_STARTUP	C	Empty string
_TABS	C	Empty string
_TALLY	N	0
_TEXT	C	–1
_THROTTLE	N	0
_TRANSPORT	C	Empty string
_TRIGGERLEVEL	N	0
_UNIX	L	.T. in FoxPro for UNIX
_WINDOWS	L	.T. in Visual FoxPro for Windows
_WIZARD	C	WIZARD.APP
_WRAP	L	.F.


See Also

PUBLIC
PRIVATE
STORE


System Menu Names

See Also

The following tables list the internal names and user interface names for the Visual FoxPro system menu bar, menu titles, menus, and menu items. With these names you can use the Visual FoxPro system menu bar to create a menu system for your own application.

The SYS(2013) function returns a space-delimited string containing these names. You can also create a quick menu using the Menu Designer to see the internal system menu names.

For more information on the system menu bar, see Chapter 11, “Designing Menus and Toolbars,” in the Developer’s Guide.

System Menu Names in Visual FoxPro

The internal name for the system menu bar itself in Visual FoxPro is _MSYSMENU.

System Menus

Menu Titles	Internal Name
File	_MSM_FILE
Edit	_MSM_EDIT
Data Session	_MSM_VIEW
Format	_MSM_TEXT
Tools	_MSM_TOOLS
Program	_MSM_PROG
Window	_MSM_WINDO
Help	_MSM_SYSTM
File Menu

Menu and Items	Internal Name
File menu	_MFILE
New...	_MFI_NEW
Open...	_MFI_OPEN
Close	_MFI_CLOSE
Close All	_MFI_CLALL
1st Separator	_MFI_SP100
Save	_MFI_SAVE
Save As...	_MFI_SAVAS
Revert	_MFI_REVRT
2nd Separator	_MFI_SP200
Import	_MFI_IMPORT
Export	_MFI_EXPORT
3rd Separator	_MFI_SP300
Page Setup...	_MFI_SETUP
Print Preview	_MFI_PREVU
Print...	_MFI_PRINT
Send	_MFI_SEND
4th Separator	_MFI_SP400
Exit	_MFI_QUIT
Edit Menu - Visual FoxPro

Menu and Items	Internal Name
Edit menu	_MEDIT
Undo	_MED_UNDO
Redo	_MED_REDO
1st Separator	_MED_SP100
Cut	_MED_CUT
Copy	_MED_COPY
Paste	_MED_PASTE
Paste Special	_MED_PSTLK
2nd Separator	_MED_SP200
Select All	_MED_SLCTA
3rd Separator	_MED_SP300
Find...	_MED_FIND
Replace...	_MED_REPL
Go To Line...	_MED_GOTO
4th Separator	_MED_SP400
Insert Object...	_MED_INSOB
Object...	_MED_OBJ
Links...	_MED_LINK
Convert to Static	_MED_CVTST
View Menu

Menu and Items	Internal Name
View menu	_MVIEW
Toolbars...	_MVI_TOOLB
Tools Menu

Menu and Items	Internal Name
Tools menu	_MTOOLS
Wizards	_MTL_WZRDS
1st Separator	_MTL_SP100
Spelling...	_MTL_SPELL
Macros...	_MST_MACRO
2nd Separator	_MTL_SP200
Trace Window	_MWI_TRACE
Debug Window	_MWI_DEBUG
3rd Separator	_MTL_SP300
Options...	_MTL_OPTNS
Program Menu

Menu and Items	Internal Name
Program item	_MPROG
Do...	_MPR_DO
Cancel	_MPR_CANCL
Resume	_MPR_RESUM
Suspend	_MPR_SUSPEND
1st Separator	_MPR_SP100
Compile...	_MPR_COMPL
Window Menu

Menu and Items	Internal Name
Window menu	_MWINDOW
Arrange All	_MWI_ARRAN
1st Separator	_MWI_SP100
Hide	_MWI_HIDE
Clear	_MWI_CLEAR
Cycle	_MWI_ROTAT
2nd Separator	_MWI_SP200
Command Window	_MWI_CMD
Data Session Window	_MWI_VIEW
Help Menu

Menu and Items	Internal Name
Help menu	_MSYSTEM
Contents	_MST_HELP
Search For Help On...	_MST_HPSCH
1st Separator	_MST_SP100
Technical Support	_MST_TECHS
2nd Separator	_MST_SP200
About Microsoft Visual FoxPro...	_MST_ABOUT


See Also

SYS(2013) - System Menu Name String
SYS(1500) - Activate a System Menu Item


TabIndex Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the tab order of controls on a page and the tab order of forms in a form set. Available at design time and run time.

Syntax

[Object.]Control.TabIndex[ = nOrder]

Settings

nOrder   Specifies the tab order for the control.

Remarks

For controls on a form, a tab order is assigned based on the order in which the controls are added. Each new control is placed last in the tab order.

For a form in a form set, a tab order is assigned based on the order in which the form was added. The form with nOrder set to 1 is the first form that is active in the form set. When a user tabs from the last control on a form, the first control on the next form in the tab order gets the focus. If a form is not included in a form set, the TabIndex property is ignored.

You can make changes at design time using the Properties window or at run time using code. However, if you change the TabIndex setting of one control or form, be sure to change the TabIndex setting for all controls on the pages or forms in the form set. If you do not designate a tab order for all controls or forms, Visual FoxPro assigns the tab order for the remaining controls and forms based on the order in which they are added and changed at run time, which can produce unintended results.

To ignore the tab order of a control or a form, set the TabStop property to false (.F.).


Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, EditBox, Form, Grid, Label, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, Page, PageFrame, _SCREEN, Spinner, TextBox


See Also

TabStop Property


TABLEREVERT( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Discards changes made to a buffered row or a buffered table or cursor and restores the OLDVAL( ) data for remote cursors and the current disk values for local tables and cursors.

Syntax

TABLEREVERT([lAllRows [, cTableAlias | nWorkArea]])

Returns

Numeric

Arguments

lAllRows   Determines whether all changes made to the table or cursor are discarded. If lAllRows is true (.T.) and table buffering is enabled, changes made to all records are discarded in the table or cursor. If lAllRows is false (.F.) and table buffering is enabled, only changes made to the current record in the table or cursor are discarded.

If row buffering is enabled, the value of lAllRows is ignored and the changes made to the current record in the table or cursor are discarded.

The default value for lAllRows is false (.F.).

cTableAlias   Specifies the alias of the table or cursor in which the changes are discarded.

nWorkArea   Specifies the work area of the table or cursor in which the changes are discarded.

Remarks

TABLEREVERT( ) returns the number of records for which changes were discarded.

Note   On a network, the data currently on disk may differ from the data on disk when the table was opened or the cursor was created. Other users on the network may have changed the data after the table was opened or the cursor was created.

TABLEREVERT( ) cannot discard changes made to a table or cursor that does not have row or table buffering enabled. If you issue TABLEREVERT( ) and row or table buffering is not enabled, Visual FoxPro generates an error message. Use CURSORSETPROP( ) to enable or disable row and table buffering.

Changes are discarded in the table or cursor open in the currently selected work area if TABLEREVERT( ) is issued without the optional cTableAlias or nWorkArea arguments.

TABLEREVERT( ) does not return the record pointer to its original position.


TABLEREVERT( ) Function Example

The following example demonstrates how you can use TABLEREVERT( ) to discard changes made to a buffered table. MULTILOCKS is set to ON, a requirement for table buffering. The customer table in the testdata database is opened, and CURSORSETPROP( ) is then used to set the buffering mode to optimistic table buffering (5).

The value of the cust_id field is displayed and then the cust_id field is modified with REPLACE. The new value of the cust_id field is displayed. TABLEREVERT( ) is then used to return the table to its original state (TABLEUPDATE( ) could be issued instead to commit the changes). The reverted value of the cust_id field is then displayed.

CLOSE DATABASES

SET MULTILOCKS ON  && Must be on for table buffering

SET PATH TO (HOME( ) + 'samples\data\')  	&& Sets path to database

OPEN DATABASE testdata  && Open testdata database

USE Customer	  && Open customer table

= CURSORSETPROP('Buffering', 5, 'customer')  && Enable table buffering

CLEAR

? 'Original cust_id value: '

?? cust_id  && Displays current cust_id value

REPLACE cust_id 	WITH '***'  && Changes field contents

? 'New cust_id value: '

?? cust_id  && Displays new cust_id value

= TABLEREVERT(.T.)  && Discard all table changes

? 'Reverted cust_id value: '

?? cust_id  && Displays reverted cust_id value


See Also

CURSORSETPROP( )
CURVAL( )
OLDVAL( )
TABLEUPDATE( )


TABLEUPDATE( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Commits changes made to a buffered row or a buffered table or cursor.

Syntax

TABLEUPDATE([nRows [, lForce]] [, cTableAlias | nWorkArea]
[, cErrorArray])

Returns

Logical

Arguments

nRows   Specifies which changes made to the table or cursor are committed.If nRows is 0 and row or table buffering is enabled, only changes made to the current record in the table or cursor are committed.

 If nRows is 1 and table buffering is enabled, changes made to all records are committed to the table or cursor. If nRows is 1 and row buffering is enabled, only changes made to the current record in the table or cursor are committed.

If nRows is 2 and table buffering is enabled, changes made to all records are committed to the table or cursor. If nRows is 2 and row buffering is enabled, only changes made to the current record in the table or cursor are committed.

Unlike the 0 and 1 values for nRow, an error doesn’t occur when a change can not be committed, and Visual FoxPro continues to process any remaining records in the table or cursor. If cErrorArray is included, an array containing error information is created when an error occurs.

The default value for nRows is 0.

lForce   Determines whether changes made to the table or cursor by another user on a network are overwritten. If lForce is true (.T.), any changes made to the table or cursor by another user on a network are overwritten.

If lForce is false (.F.), Visual FoxPro commits changes to the table or cursor, starting with the first record and continuing towards the end of the table or cursor. If a record modified by another user on the network is encountered, Visual FoxPro generates an error.

When Visual FoxPro generates the error, you can handle the error through an ON ERROR routine, and the ON ERROR routine can issue TABLEUPDATE( ) with lForce set to true (.T.) to commit changes to the record. Alternately, if a transaction is in progress, the ON ERROR routine can handle the error and then issue ROLLBACK to revert the table or cursor to its original state.

The default for lForce is false (.F.).

cTableAlias   Specifies the alias of the table or cursor in which the changes are committed.

nWorkArea   Specifies the work area of the table or cursor in which the changes are committed.

cErrorArray   Specifies the name of an array created when nRows is 2 and changes to a record cannot be committed. The array contains a single column containing the record numbers of the records for which changes could not be committed.

Remarks

TABLEUPDATE( ) returns true (.T.) if changes to all records are committed; otherwise, TABLEUPDATE( ) returns false (.F.). If you specify 0 or 1 for nRow, the record pointer remains on the record where changes could not be committed and can issue AERROR( ) to determine why the changes could not be commited.

TABLEUPDATE( ) cannot commit changes made to a table or cursor that does not have row or table buffering enabled. If you issue TABLEUPDATE( ) and row or table buffering is not enabled, Visual FoxPro generates an error message. However, TABLEUPDATE( ) can still commit changes to a table or cursor that has validation rules. Use CURSORSETPROP( ) to enable or disable row and table buffering.

Changes are committed to the table or cursor open in the currently selected work area if TABLEUPDATE( ) is issued without the optional cTableAlias or nWorkArea arguments.


TABLEUPDATE( ) Function Example

The following example demonstrates how you can use TABLEUPDATE( ) to commit changes made to a buffered table. A table named employees is created and INSERT - SQL is used insert the value “Smith” into the cLastName field.

MULTILOCKS is set to ON, a requirement for table buffering. CURSORSETPROP( ) is used to set the buffering mode to optimistic table buffering (5).

The original value of the cLastName field (Smith) is displayed and then the cLastName field is modified with REPLACE. The new value of the cLastName field (Jones) is displayed. TABLEUPDATE( ) is then used to commit changes to the table (TABLEREVERT( ) could be issued instead to discard the changes). The updated value of the cLastName field (Jones) is then displayed.

CLOSE DATABASES

CREATE TABLE employee (cLastName C(10))

SET MULTILOCKS ON  && Must be on for table buffering

= CURSORSETPROP('Buffering', 5, 'employee' )  && Enable table buffering

INSERT INTO employee (cLastName) VALUES ('Smith')

CLEAR

? 'Original cLastName value: '

?? cLastName  && Displays current cLastName value (Smith)

REPLACE cLastName WITH 'Jones'

? 'New cLastName value: '

?? cLastName  && Displays new cLastName value (Jones)

= TABLEUPDATE(.T.)  && Commits changes

? 'Updated cLastName value: '

?? cLastName  && Displays current cLastName value (Jones)


See Also

CURSORSETPROP( )
CURVAL( )
OLDVAL( )
TABLEREVERT( )


Tabs Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether a page frame has tabs. Available at design time and run time.

Syntax

PageFrame.Tabs[ = lExpr]

Settings

lExpr   The settings for the Tabs property are:

Setting	Description
True (.T.)	(Default) The page frame has tabs.
False (.F.)	The page frame doesn’t have tabs.
Remarks

Specify the text and width of the tabs by setting the Caption property of the page.


Applies To

PageFrame


See Also

Caption Property


_TABS System Memory Variable
_TABS System Variable

Included for backward compatibility. Use the Report Designer instead.


TabStop Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether a user can use the TAB key to move the focus to an object. Available at design time and run time.

Syntax

[Object.]Control.TabStop[ = lExpr]

Settings

lExpr   Specifies whether an object is included in the tab order. The settings for the TabStop property are:

Setting	Description
True (.T.)	(Default) The control or form is included in the tab order, as determined by the TabIndex property.
False (.F.)	The object is ignored in the tab order. For a control, when a user presses the TAB key, the focus skips a control that has its TabStop property set to false (.F.). For a form, when a user presses the TABkey on the last control on a form and the next form in the tab order has its TabStop property set to false (.F.), the focus moves to the first control on the same form. The focus does not move to the next form in the tab order.
Remarks

If TabStop property is set to false (.F.) for a control or form, the control or form is skipped when the TAB key is used to move through the tab order, but it can still receive the focus when the mouse is used.

Note   The TabStop property is read-only when it applies to a control contained in a Column object.


Applies To

CheckBox, ComboBox, CommandButton, Container Object, Control Object, EditBox, Form, Grid, ListBox, OLE Bound Control, OLE Container Control, OptionButton, Page, PageFrame, _SCREEN, Spinner, TextBox


See Also

TabIndex Property


TabStretch Property

Syntax         Settings         Applies To         See Also

Specifies the behavior if the tabs do not fit on the page frame. Available at design time and run time. TabStretch is available only if Tabs is set to true (.T.).

Syntax

PageFrame.TabStretch[ = nSetting]

Settings

nSetting   The settings for the TabStretch property are:

Setting	Description
0	Stack. A second row of tabs are created.
1	(Default) Clip. The tabs are clipped as necessary.


Applies To

PageFrame


See Also

Tabs Property


TabStyle Property

Syntax         Settings         Applies To          See Also

Specifies whether the Page tabs in a page frame are justified or non-justified. Available at design time and run time.

Syntax

PageFrame.TabStyle[ = nStyle]

Settings

nStyle   One of the following:

nStyle	Description
0	(Default) Justified. The width of each page tab is adjusted to accommodate its caption. If necessary, the width of each page tab is increased so the page tabs span the entire width of the PageFrame. This setting is ignored if the TabStretch property is set to 1, Single Row.
1	Non-justified. The width of each page tab is not adjusted to accommodate its caption. The width of each page tab isn’t adjusted so that the page tabs span the entire width of the PageFrame. This setting is ignored if the TabStretch property is set to 1, Single Row.


Applies To

PageFrame


See Also

TabStretch Property


Tag Property

Syntax         Settings         Remarks         Applies To         See Also

Stores any extra data needed for your program. Available at design time and run time.

Syntax

Object.Tag[ = Expr]

Settings

Expr   Specifies any string.

Remarks

By default, the Tag property is set to an empty string (""). You can use this property to assign any string to an object without affecting it in any way. Unlike other properties, the value of the Tag property is not used by Visual FoxPro.


Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, EditBox, Form, Grid, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, _SCREEN, Shape, Spinner, TextBox, Timer


See Also

Comment Property


TAG( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns a tag name from an open, multiple-entry compound .CDX index file or the name of an open, single-entry .IDX index file.

Syntax

TAG([CDXFileName,] nTagNumber [, nWorkArea | cTableAlias])

Returns

Character

Arguments

CDXFileName   Specifies the name of the multiple-entry compound .CDX index file from which TAG( ) returns a tag name.

nTagNumber   Specifies a number corresponding to the order in which a tag was created in the compound index file. For example, if nTagNumber is 1, TAG( ) returns the name of the first tag created in the compound index file. If nTagNumber is 2, TAG( ) returns the name of the second tag created, and so on. TAG( ) returns the empty string when nTagNumber exceeds the number of tag names.

If you omit CDXFileName, TAG( ) returns compound index file tag names and single-entry index file names in a specific order as follows.

1.	Names of single-entry index files are returned based on their order in the INDEX clause of USE or SET INDEX.

2.	Tag names from the structural compound index file (if one exists for the table) are returned.

3.	Tag names from other open compound index files are returned, again in the order in which the tags were created in the compound index files and in the order in which the compound index files are specified in the INDEX clause for USE or SET INDEX.

nWorkArea | cTableAlias   Returns tag names and index file names from files open in another work area. nWorkArea specifies a work area number and cTableAlias specifies a table alias. By default, tag names and index file names are returned from files in the current work area.

Remarks

Tags are index entries in multiple-entry compound .CDX index files created with INDEX.

Note   Multiple-entry compound .CDX index files and single-entry .IDX index files can be opened for a table with the INDEX clause in USE or with SET INDEX. A structural compound .CDX index file is automatically opened with its table.


TAG( ) Function Example

The following example opens the customer table in the testdata database. FOR ... ENDFOR is used to create a loop in which CDX( ) is used to display the name of each structural index.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE Customer	  && Open customer table

CLEAR

FOR nCount = 1 TO 254

IF !EMPTY(TAG(nCount))  && Checks for tags in the index

? CDX(nCount)	  && Display .CDX names

ELSE

EXIT  && Exit the loop when no more tags are found

ENDIF

ENDFOR


See Also

CDX( )
INDEX
MDX( )
NDX( )
SET INDEX
SYS(14) - Index Expression
USE Command


TAGCOUNT( ) Function

Included for compatibility with dBASE.


TAGNO( ) Function

Included for compatibility with dBASE.


_TALLY System Memory Variable
_TALLY System Variable

Syntax         Arguments         Remarks         Example         See Also

Contains the number of records processed by the most recently executed table command.

Syntax

_TALLY = nRecords

Arguments

nRecords   Contains a numeric value indicating the number of records processed by the most recently executed table command.

Remarks

Certain table processing commands return information about their status (“talk”) while they execute. When such a command finishes executing, it displays the number of records it processed (if SET TALK is ON), and stores this number to the _TALLY system variable.

The following commands return status information:

APPEND FROM	AVERAGE
CALCULATE	COPY To
COUNT	DELETE
INDEX	PACK
REINDEX	REPLACE
SELECT - SQL	SORT
SUM	TOTAL
UPDATE
When you start Visual FoxPro, _TALLY is set to 0. Executing one of the commands above replaces the _TALLY value with the number of records the command processed.


_TALLY System Variable Example

This example uses SELECT to return the number of customers in the USA. The result is automatically stored to _TALLY. The _TALLY value is displayed.

SELECT * FROM customer ;

WHERE country = 'USA' ;

INTO CURSOR temp

? _TALLY


See Also

SET ODOMETER
SET TALK


TAN( ) Function

Syntax         Returns         Arguments         Example         See Also

This trigonometric function returns the tangent of an angle.

Syntax

TAN(nExpression)

Returns

Numeric

Arguments

nExpression   Specifies the angle in radians for which TAN( ) returns the tangent. To convert an angle from degrees to radians, use DTOR( ). The number of decimal places returned by TAN( ) can be specified with SET DECIMALS.


TAN( ) Function Example

CLEAR

? TAN(0)  && Displays 0.00

? TAN(PI( )/4)  && Displays 1.00

? TAN(PI( )*3/4)  && Displays -1.00


See Also

COS( )
DTOR( )
RTOD( )
SET DECIMALS
SIN( )


TARGET( ) Function

Syntax         Returns         Arguments         Example         See Also

Returns the alias of a table that is the target for a relation as specified in the INTO clause of SET RELATION.

Syntax

TARGET(nRelationshipNumber [, nWorkArea | cTableAlias])

Returns

Character

Arguments

nRelationshipNumber   Specifies the number of a relationship. Include a number from 1 to the number of relationships out of the specified work area. The aliases of the target databases are returned (in no specific order) until nRelationshipNumber is greater than the number of relationships. When nRelationshipNumber is greater than the number of relationships, the empty string is returned.

nWorkArea | cTableAlias   Returns the alias of the target table in another work area. nWorkArea specifies a work area number and cTableAlias specifies a table alias. By default, the alias of the target table from the current work area is returned if you don’t specify the work area or alias.


TARGET( ) Function Example

In the following example, a relation is set on the field order_id from orders into customer. The TARGET( ) function is then used to return the alias of the target table.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE orders IN 0 ORDER order_id

USE customer IN 0 ORDER cust_id

SELECT orders

SET RELATION TO cust_id INTO customer

? TARGET(1)  && Displays customer

? TARGET(2)  && Empty string


See Also

RELATION( )
SET RELATION


TerminateRead Property

Included for backward compatibility with READ.


Text Property

Syntax         Remarks         Applies To         See Also

Contains the unformatted text entered in the textbox portion of a control. Not available at design time; read-only at run time.

Syntax

Object.Text

Remarks

Unlike the Value property, the value contained in the Text property is unformatted and is identical to the text entered in the control by the user.

The unformatted text contained in a control’s Text property can differ from the control’s Value property for the following reasons:

•	The Value property may not be of Character type; it may contain a Date or Numeric value.

•	For an edit box, the Value property may add line feeds to the text entered in the edit box, providing compatibility with previous versions. For this reason, using the Text property is the preferred method for selecting text with the SelStart and SelLength properties.

•	If the Format property for the control uses the R setting, input mask characters are removed from the Value property.

If the Style property for a combo box control is set to 2 (Drop-down List), the Text property contains the empty string because the ComboBox does not have a text box.


Applies To

ComboBox, EditBox, Spinner, TextBox


See Also

Format Property, SelStart Property, SelLength Property, Style Property, Value Property


TEXT ... ENDTEXT Command

Syntax         Arguments         Remarks         Example         See Also

Outputs lines of text, the results of expressions and functions, and the contents of variables.

Syntax

TEXT
TextLines

ENDTEXT

Arguments

TextLines   Specifies the text sent to the current output device. TextLines can consist of text, memory variables, array elements, expressions, functions or any combination of these.

Expressions, functions, memory variables, and array elements specified with TextLines are evaluated only if SET TEXTMERGE is ON and must be enclosed in the delimiters specified by SET TEXTMERGE DELIMITERS. If SET TEXTMERGE is OFF, the expressions, functions, memory variables, and array elements are output as literals along with their delimiters.

For example, today’s date is output if SET TEXTMERGE is ON and a text line contains <<DATE( )>>. If SET TEXTMERGE is OFF, <<DATE( )>> is output literally.

If you place comments within TEXT and ENDTEXT or after \ or \\, the comments are also output.

Remarks

This structured programming command sends text lines placed between TEXT and ENDTEXT to the main Visual FoxPro window, a user-defined window, a printer, a text file, or a low-level file.

TEXT sends the text lines to the current output device. This continues until an ENDTEXT statement is encountered or until the program ends.

By default, output from TEXT ... ENDTEXT is sent to the main Visual FoxPro window or the active window. Issue SET CONSOLE OFF to suppress output to the main Visual FoxPro window or the active window. Use SET PRINTER to send output to a printer or a text file.

Output from TEXT ... ENDTEXT can also be sent to a low-level file created or opened with FCREATE( ) or FOPEN( ). If a file handle returned by FCREATE( ) or FOPEN( ) is stored to the _TEXT system variable, output is directed to the corresponding low-level file.


TEXT ... ENDTEXT Command Example

The following example demonstrates how you can use SET TEXTMERGE, SET TEXTMERGE DELIMITERS, TEXT ... ENDTEXT, and the _TEXT system variable.

A low-level file called NAMES.TXT is created and its file handle is stored in the _TEXT system variable. The program is exited if NAMES.TXT can’t be created. The customer table is opened, and the names of the first 10 contacts are output to NAMES.TXT. Text and the results of functions are output to the text file.

The text file containing the names is then opened with MODIFY FILE.

CLEAR

CLOSE DATABASES

SET TALK OFF

SET TEXTMERGE ON	  && Enable embedding of expressions and functions

STORE FCREATE('names.txt') TO _TEXT	  && Create low-level file

IF _TEXT = -1  && Can't create low-level file then exit program

WAIT WINDOW 'Cannot create an output file; press a key to exit'

CANCEL

ENDIF

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

TEXT

CONTACT NAMES

<<DATE( )>>        <<TIME( )>>

ENDTEXT

WAIT WINDOW 'Press a key to generate the first ten names'

SCAN NEXT 10

TEXT

<<contact>>

ENDTEXT

ENDSCAN

CLOSE ALL  && Close the text file and the table

MODIFY FILE names.txt

ERASE names.txt


See Also

FOPEN( )
_PRETEXT
SET TEXTMERGE
SET TEXTMERGE DELIMITERS
_TEXT


_TEXT System Memory Variable
_TEXT System Variable

Syntax         Arguments         Remarks         Example         See Also

Directs output from the \ | \\ and TEXT ... ENDTEXT text merge commands to a low-level file.

Syntax

_TEXT = nFileHandle

Arguments

nFileHandle   Specifies a numeric value that determines the low-level file to which output is directed.

Remarks

\ | \\ and TEXT ... ENDTEXT facilitate the merging of text with the contents of tables, memory variables, and the results of functions and expressions. Output generated by these text merge commands can be directed to the screen or a window or to a low-level file. The _TEXT system memory variable lets you direct text merge output from these commands to a low-level file.

To send output from the \ and \\ and TEXT ... ENDTEXT text merge commands to a low-level file, include the TO FileName clause in SET TEXTMERGE. The file handle of FileName is stored to _TEXT. If the file handle of another low-level file was previously stored in _TEXT, that low-level file is closed.

FCREATE( ) creates and opens low-level files and FOPEN( ) opens existing files. These functions return a positive file handle if the file is successfully created or opened. Storing this file handle to _TEXT directs any subsequent output from the \, \\ and TEXT ... ENDTEXT text merge commands to the file. Use STORE or = to store a file handle to _TEXT. You must open a low-level file with write privileges in order for it to accept output from the text merge commands.

You can close low-level files with FCLOSE( ) or CLOSE ALL. You can also use SET TEXTMERGE TO without a file name to close the low-level file whose handle is stored in _TEXT.

The startup default value of _TEXT is –1. If you are directing text merge output to a file whose file handle is stored in _TEXT, you can turn off the output to that file without closing the file by storing –1 to _TEXT. By storing different file handles and –1 to _TEXT, you can direct text merge output to alternate files.


_TEXT System Memory Variable Example

The following program demonstrates how to direct text merge output to alternate files:

SET TALK OFF

SET TEXTMERGE ON NOSHOW	&& Enable text merge, no output to screen

SET TEXTMERGE DELIMITERS TO	&& Default text merge delimiters <<,>>

SET TEXTMERGE TO date.txt	&& Create and send output to date.txt

STORE _TEXT TO gcDateHandle	&& Save date.txt's file handle

STORE -1 TO _TEXT	&& Output off to date.txt; keep it open

SET TEXTMERGE TO time.txt	&& Create and send output to time.txt

STORE _TEXT TO gcTimeHandle	&& Save time.txt's file handle

*** Send the following text to time.txt ***

\The time is:

STORE gcDateHandle TO _TEXT 	&& Now direct output to date.txt

*** Send the following text to date.txt ***

\Today's date is:

STORE gcTimeHandle TO _TEXT	&& Now direct output to time.txt

*** Output the time on the same line ***

\\ <<TIME( )>>

STORE gcDateHandle TO _TEXT	&& Now direct output to date.txt

*** Output the date on the same line ***

\\ <<DATE( )>>

CLOSE ALL  && Close all files

TYPE date.txt  && See what's in this file...

WAIT WINDOW  && Pause

TYPE time.txt  && ...and what's in this file

ERASE date.txt

ERASE time.txt


See Also

\ | \\
FOPEN( )
FCLOSE( )
FCREATE( )
_PRETEXT
SET TEXTMERGE
SET TEXTMERGE DELIMITERS


TextBox Control

Syntax         Remarks         Properties         Events         Methods         See Also

Creates a text box.

Syntax

TextBox

Remarks

Creates a text box in which you can edit the contents of a memory variable, array element, or field. All standard Visual FoxPro editing features, such as cut, copy, and paste, are available in the text box. If the text box is used to edit a date or datetime value and the entire value is selected, you can press + or - to increment or decrement the value by one day.

Use the InputMask and Format properties to specify how values are entered and displayed in the text box.

For additional information about creating text boxes, see the Form Designer topic and Chapter 10, “Using Controls,” in the Developer’s Guide.


Properties

Alignment	BackColor	BackStyle
BaseClass	BorderStyle	Class
ClassLibrary	ColorScheme	ColorSource
Comment	ControlSource	DisabledBackColor
DisabledForeColor	DragIcon	DragMode
Enabled	FontBold	FontCondense
FontExtend	FontItalic	FontName
FontOutline	FontShadow	FontSize
FontStrikeThru	FontUnderline	ForeColor
Format	Height	HelpContextID
HideSelection	InputMask	Left
Margin	MaxLength	MemoWindow
MousePointer	Name	OpenWindow
Parent	ParentClass	PasswordChar
ReadOnly	RightToLeft	SelectedBackColor
SelectedForeColor	SelectOnEntry	SelLength
SelStart	SelText	SpecialEffect
StatusBarText	Style	TabIndex
TabStop	Tag	TerminateRead
Text Property	ToolTipText	Top
Value	Visible	Width


Events

Click	DblClick	Destroy
DragDrop	DragOver	Error
ErrorMessage	GotFocus	Init
InteractiveChange	KeyPress	LostFocus
Message	MiddleClick Event	MouseDown
MouseMove	MouseUp	MouseWheel
ProgrammaticChange	RangeHigh	RangeLow
RightClick	UIEnable	Valid
When


Methods

CloneObject	Drag	Move
ReadExpression	ReadMethod	Refresh
ResetToDefault	SaveAsClass	SetFocus
WriteExpression	WriteMethod	ZOrder


See Also

CREATE CLASS
CREATE FORM
DEFINE CLASS


TextHeight Method

Syntax         Arguments         Remarks         Applies To         See Also

Returns the height of a text string as it would be displayed in the current font.

Syntax

[nHeight =] [FormSet.]Object.TextHeight(cText)

Arguments

nHeight   Returns a value in pixels specifying the height of the text string.

cText   Specifies the character string for which the text height is determined.

Remarks

The TextHeight method determines the amount of vertical space required to display cText. The height returned includes the leading space above and below the character string, so you can use the height returned to calculate and position multiple lines of text within the form. If cText contains embedded carriage returns, the TextHeight method returns the cumulative height of the lines, including the leading space above and below each line.


Applies To

Form, _SCREEN


See Also

FontSize Property
ScaleMode Property
TextWidth Method


TextWidth Method

Syntax         Arguments         Remarks         Applies To         See Also

Returns the width of a text string as it would be displayed in the current font.

Syntax

[nWidth =] [FormSet.]Object.TextWidth(cText)

Arguments

nWidth   Returns a value in pixels specifying the width of the text string.

cText   Specifies the character string for which the text width is determined.

Remarks

The TextWidth method determines the amount of horizontal space required to display cText.


Applies To

Form, _SCREEN


See Also

FontSize Property
ScaleMode Property
TextHeight Method


THIS Object Reference

Syntax         Arguments         Remarks         Example         See Also

Provides a reference to the current object in event code or in a class definition.

Syntax

THIS.PropertyName | ObjectName

Arguments

PropertyName   Specifies a property to set or get for the object.

ObjectName   Specifies an object in the class.

Remarks

THIS provides a convenient way of referring to the current object when writing event-handling programs in a form. For example, this Click Event program for a command button sets the button’s caption to the current time:

this.caption = time()

Using THIS instead of explicitly referring to the current object by name (for example, thisform.command1.caption) makes program code portable between objects, because it avoids the object’s name, and automatically encapsulates the object’s parent class.

THIS also allows you to reference a property or an object in a class definition. Methods in a class definition block can use THIS to specify a property or object that will exist when the class is created.

Because multiple instances of objects share the same method code, THIS always refers to the instance in which the code is executing. If there are multiple instances of an object, and one of the object’s methods is called, THIS refers to the correct object.


THIS Object Reference Example

The following example creates a subclass called MyForm, based on the Form class. A method called ChangeBackColor is created. ChangeBackColor uses THIS to refer to MyForm.

DEFINE CLASS MyForm AS FORM

   CAPTION = "This Form"

   HEIGHT = 15

   WIDTH = 20

   PROCEDURE ChangeBackColor

   PARAMETER NewColor

      THIS.BACKCOLOR = NewColor

   ENDPROC

ENDDEFINE


See Also

THISFORM
THISFORMSET


THISFORM Object Reference

Syntax         Arguments         Remarks         See Also

Provides a reference to the current form in form event code or in a class definition.

Syntax

THISFORM.PropertyName | ObjectName

Arguments

PropertyName   Specifies a property for the form.

ObjectName   Specifies an object in the form.

Remarks

THISFORM provides a convenient way of referring to the current form when writing event-handling programs in a form. For example, this Click Event program for a command button sets the button’s caption to the current time:

thisform.command1.caption = time()

Using THISFORM instead of explicitly referring to the current form by name (for example, form1.command1.caption) makes program code portable between forms.

When creating class definitions, THISFORM also provides a means of referring to the current form within a method. THISFORM lets you reference an object on the form or property without using multiple Parent properties.


See Also

THIS
THISFORMSET


THISFORMSET Object Reference

Syntax         Arguments         Remarks         See Also

Provides a reference to the current form set in event code or in a class definition.

Syntax

THISFORMSET.PropertyName | ObjectName

Arguments

PropertyName   Specifies a property for the form set.

ObjectName   Specifies an object in the form set.

Remarks

THISFORMSET provides a convenient way of referring to the current formset when writing event-handling programs in a form. Using THISFORMSET instead of explicitly referring to the current form by name (for example, form1.command1.caption) makes program code portable between forms.

When creating class definitions, THISFORMSET also provides a means of referring to the current formset within a method. THISFORMSET lets you reference an object on the form or property without using multiple Parent properties.


See Also

THIS
THISFORM


_THROTTLE System Memory Variable
_THROTTLE System Variable

Syntax         Arguments         Remarks         See Also

Specifies the execution speed of programs when the Trace window is open.

Syntax

_THROTTLE = nSeconds

Arguments

nSeconds   Specifies the delay in seconds between execution of each program line. The startup default value is 0, with no pause between execution of program lines. nSeconds can range from 0 to 5.5 seconds. For example, if nSeconds is 0.5 seconds, a 1/2-second delay occurs between execution of program lines.

Remarks

The Trace window, one of the debugging tools available in Visual FoxPro, displays a program’s source code as the program executes. The Trace window highlights each line in the program when the line executes. The numeric value of _THROTTLE determines the delay between execution of each program line when the Trace window is open.

Note   The Trace Between Breaks option on the Trace window’s Program menu must be on for a delay to occur.


See Also

SET DEBUG
SET STEP


TIME( ) Function

Syntax         Returns         Arguments          See Also

Returns the current system time in 24-hour, eight-character string (hh:mm:ss) format.

Syntax

TIME([nExpression])

Returns

Character

Arguments

nExpression   The time returned includes hundredths of a second if nExpression is included. The numeric expression nExpression can be any value. However, the actual maximum resolution is about 1/18 second. Use SECONDS( ) for greater resolution.


See Also

CTOT( )
DATE( )
DATETIME( )
DTOT( )
HOUR( )
SEC( )
SECONDS( )
SET SECONDS
SYS(2) - Seconds Since Midnight


Timer Control

Syntax         Remarks         Properties         Events         Methods          See Also

Creates a timer that can execute code at regular intervals.

Syntax

Timer

Remarks

The Timer control, invisible to the user, is useful for background processing. A typical use for the timer is checking the system clock to determine if it is time to run a program or application..

For additional information about creating timers, see Chapter 10, “Using Controls,” in the Developer’s Guide.


Properties

BaseClass	Class	ClassLibrary
Comment	Enabled	Height
Interval	Left	Name
Parent	ParentClass	Tag
Top	Width


Events

Destroy	Error	Init
Timer


Methods

CloneObject	ReadExpression	ReadMethod
Reset	ResetToDefault	SaveAsClass
WriteExpression	WriteMethod


See Also

CREATE CLASS
CREATE FORM
DEFINE CLASS
Form Designer


Timer Event

Syntax         Arguments         Applies To          See Also

Occurs when the number of milliseconds specified in the Interval property has elapsed.

Syntax

PROCEDURE Timer.Timer
[LPARAMETERS nIndex]

Arguments

nIndex   Uniquely identifies a control if it is in a control array.


Applies To

Timer


See Also

Interval Property
Reset Method


ToolBar Object

Syntax         Remarks         Properties         Events         Methods         Example          See Also

Creates a custom toolbar.

Syntax

ToolBar

Remarks

Use the ToolBar object to create your own toolbars for your applications.

The following list describes the properties of a custom toolbar:

•	Toolbars are always on top.

•	Toolbars automatically dock when they are moved to the edge of the main Visual FoxPro window.

•	When toolbars aren’t docked, they have a half-height title bar.

•	When the size of a toolbar is changed, the controls are arranged to fit.

•	You can move a toolbar by clicking and dragging in any area of the toolbar that isn’t a control.

•	Many controls placed on the toolbar do not receive the focus when they’re chosen.

•	Access keys in controls placed in a toolbar are disabled.

Although any control can be placed on a toolbar, some controls, such as a list box, may be too large to fit properly in a docked toolbar. These controls can be programatically removed from the toolbar when the toolbar is docked and replaced with a smaller version of the same control or a different control.

For additional information about creating toolbars, see Chapter 11, “Designing Menus and Toolbars,” in the Developer’s Guide.


Properties

ActiveControl	BackColor	BaseClass
Caption	Class	ClassLibrary
Comment	ColorSource Property	ControlBox
ControlCount	Controls	DataSession
DataSessionID	Docked	DockPosition
Enabled	ForeColor	Height
HelpContextID	KeyPreview	Left
LockScreen	MousePointer	Movable
Name	Parent	ParentClass
ScaleMode	ShowTips	Sizable
Top	Visible	Width


Events

Activate	AfterDock	BeforeDock
Click	DblClick	Deactivate
Destroy	DragDrop	DragOver
Error	Init	MiddleClick Event
MouseDown	MouseMove	MouseUp
MouseWheel	Moved	Paint
Resize	RightClick	UnDock


Methods

AddObject	CloneObject	Dock
Hide	Move	Refresh
RemoveObject	ResetToDefault	SaveAsClass
SetAll	Show	ZOrder


ToolBar Object Example

The following example demonstrates how you can create a toolbar from the Toolbar class. Visual FoxPro rearranges the buttons when the toolbar is resized. When the ToolBar object is created, Visual FoxPro automatically places the controls from left to right in the order they are added to the class definition, ignoring the controls’ Top and Left properties.

PUBLIC tbrDesktop

tbrDesktop = CREATEOBJ('mytoolbar')

tbrDesktop.SHOW

DEFINE CLASS myToolBar    AS Toolbar

ADD OBJECT btnBold    AS CommandButton

ADD OBJECT sep1	       AS Separator

ADD OBJECT btnItalics AS CommandButton

btnBold.HEIGHT = 20

btnBold.WIDTH = 50

btnBold.Caption = "Bold"

btnItalics.HEIGHT = 20

btnItalics.WIDTH = 50

btnItalics.Caption = "Italic"

btnItalics.FontBold = .F.

LEFT	= 1

TOP = 1

WIDTH = 25

CAPTION = "Desktop Attributes"

PROCEDURE Activate

this.btnBold.FontBold = _SCREEN.FONTBOLD

this.btnItalics.FontItalic = _SCREEN.FONTITALIC

ENDPROC

PROCEDURE btnBold.CLICK

_SCREEN.FONTBOLD = !_SCREEN.FONTBOLD

This.FontBold =_SCREEN.FONTBOLD

ENDPROC

PROCEDURE btnItalics.CLICK

_SCREEN.FONTITALIC = !_SCREEN.FONTITALIC

This.FontItalic = _SCREEN.FONTITALIC

ENDPROC

ENDDEFINE


See Also

CREATE CLASS
CREATE FORM
DEFINE CLASS
Separator Object


ToolTipText Property

Syntax         Settings         Remarks         Applies To          See Also

Specifies the text that appears as a ToolTip for a control. Available at design time and run time.

Syntax

Control.ToolTipText = cText

Settings

cText   Specifies the text to use for the ToolTip. The maximum number of characters you can specify for cText is 127.

Remarks

You can only set the ToolTipText property if the ShowTips property is set to true (.T.) for the form or toolbar that contains the control.


Applies To

CheckBox, ComboBox, CommandButton, EditBox, Grid, ListBox, OptionButton, Shape, Spinner, TextBox


See Also

ShowTips Property


Top Property

Syntax         Settings         Remarks         Example         Applies To          See Also

Specifies the distance between the top edge of a control or form and its container object. Available at design time and run time.

Syntax

Object.Top[ = nValue]

Settings

nValue   Specifies the distance between the top edge of an object or form and the top edge of its container object.

The default container for a form is the main Visual FoxPro window.

Remarks

The Top property specifies how far from the object’s zero position the object is located. For example, if a form is contained within the Visual FoxPro main window, the zero position is immediately below the system menu, or if a toolbar is docked to the top of the main window, immediately below the toolbar.

Use the Left and Top and the Height and Width properties for operations based on an object’s external dimensions, such as moving or resizing.

Note   The Top property is read-only when it applies to a control contained in a Column object.

The unit of measurement used by the Top property is determined by the control’s ScaleMode property setting.


Top Property Example

The following example demonstrates how the Top property is used to position controls on a form. The AddObject method is used to add a Line control and three command buttons to a form. The Top property specifies the vertical placement of each control on the form.

frmMyForm = CREATEOBJECT('Form')  && Create a Form

frmMyForm.Closable = .F.  && Disable the Control-menu box

frmMyForm.AddObject('shpLine','Line')  && Add a Line control to the form

frmMyForm.AddObject('cmdCmndBtn1','cmdMyCmndBtn1')  && Up Cmnd button

frmMyForm.AddObject('cmdCmndBtn2','cmdMyCmndBtn2')  && Down Cmnd button

frmMyForm.AddObject('cmdCmndBtn3','cmdMyCmndBtn3')  && Quit Cmnd button

frmMyForm.shpLine.Visible = .T.  && Make Line control visible

frmMyForm.shpLine.Top = 20  && Specify Line control row

frmMyForm.shpLine.Left = 125  && Specify Line control column

frmMyForm.cmdCmndBtn1.Visible =.T.  && Up Command button visible

frmMyForm.cmdCmndBtn2.Visible =.T.  && Down" Command button visible

frmMyForm.cmdCmndBtn3.Visible =.T.  && Quit Command button visible

frmMyForm.SHOW  && Display the form

READ EVENTS  && Start event processing

DEFINE CLASS cmdMyCmndBtn1 AS COMMANDBUTTON  && Create Command button

Caption = 'Slant \<Up'  && Caption on the Command button

Left = 50  && Command button column

Top = 100  && Command button row

Height = 25  && Command button height

PROCEDURE Click

ThisForm.shpLine.Visible = .F.  && Hide the Line control

ThisForm.shpLine.LineSlant ='/'  && Slant up

ThisForm.shpLine.Visible = .T.  && Show the Line control

ENDDEFINE

DEFINE CLASS cmdMyCmndBtn2 AS CommandButton  && Create Command button

Caption = 'Slant \<Down'  && Caption on the Command button

Left = 200  && Command button column

Top = 100  && Command button row

Height = 25  && Command button height

PROCEDURE Click

ThisForm.shpLine.Visible = .F.  && Hide the Line control

ThisForm.shpLine.LineSlant ='\'  && Slant down

ThisForm.shpLine.Visible = .T.  && Show the Line control

ENDDEFINE

DEFINE CLASS cmdMyCmndBtn3 AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 150  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close Form

ENDDEFINE


Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, Custom, EditBox, Form, Grid, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, PageFrame, _SCREEN, Shape, Spinner, TextBox, Timer, ToolBar


See Also

Left Property
Height Property
Move Method
ScaleMode Property
Width Property


TopIndex Property

Syntax         Settings         Remarks         Applies To          See Also

Specifies the item that appears in the top-most position in a list. Not available at design time; read-write at run time.

Syntax

Control.TopIndex[ = nIndex]

Settings

nIndex   Specifies the index of the item that appears in the top-most position in a list.

Remarks

The index of an item reflects its position in the list, which is relative to other items in the list and can change.


Applies To

ComboBox, ListBox


See Also

AddItem Method
Clear Method
List Property
ListCount Property
MultiSelect Property
NewItemID Property
RemoveItem Method
Selected Property
TopItemID Property


TopItemID Property

Syntax         Settings         Remarks         Applies To          See Also

Specifies the item ID of the item that appears in the top-most position in a list. Not available at design time; read-write at run time.

Syntax

Control.TopIItemID[ = nItemID]

Settings

nItemID   Specifies the item ID of the item that appears in the top-most position in a list.

Remarks

The default setting for the TopItemID property is 1, or the first item in the list.


Applies To

ComboBox, ListBox


See Also

AddItem Method
Clear Method
List Property
ListCount Property
MultiSelect Property
NewItemID Property
RemoveItem Method
Selected Property
TopIndex Property


TOTAL Command

Syntax         Arguments         Remarks          See Also

Computes totals for numeric fields in the currently selected table.

Syntax

TOTAL TO TableName
ON FieldName
[FIELDS FieldNameList]
[Scope]
[FOR lExpression1]
[WHILE lExpression2]
[NOOPTIMIZE]

Arguments

TableName   Specifies the name of the table that will contain the totals. If the specified table doesn’t exist, Visual FoxPro creates it. If the table exists and SET SAFETY is ON, Visual FoxPro asks if you would like to overwrite the existing table. If SET SAFETY is OFF, you aren’t prompted, and the output table is overwritten.

FieldName   Specifies the field on which the totals are grouped. The table must be sorted on this field, or an open index or index tag must have this field as its key expression.

FIELDS FieldNameList   Specifies the fields to be totaled. Separate the field names in the list with commas. If you omit the FIELDS clause, all numeric fields are totaled by default.

Scope   Specifies a range of records to total. The scope clauses are: ALL, NEXT nRecords, RECORD nRecordNumber, and REST.

The default scope for TOTAL is ALL records.

FOR lExpression1   Specifies a condition whereby only the records that satisfy the logical condition lExpression1 are included in the totals.

Rushmore optimizes a query created with TOTAL ... FOR if lExpression1 is an optimizable expression. For best performance, use an optimizable expression in the FOR clause.

For more information, see SET OPTIMIZE  and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

WHILE lExpression2   Specifies a condition whereby records from the current table are included in the totals for as long as the logical expression lExpression2 evaluates to true (.T.).

NOOPTIMIZE   Disables Rushmore optimization of TOTAL.

For more information, see SET OPTIMIZE and “Understanding Rushmore Technology” in Chapter 15, “Optimizing Applications,” in the Developer’s Guide.

Remarks

The table in the currently selected work area must be sorted or indexed. A separate total is calculated for each set of records with a common field value or unique index key value. The results are placed into records in a second table. One record is created in the second table for each common field value or unique index key value.

Numeric overflow can occur if the numeric fields in the second table aren’t wide enough to contain the totals. Visual FoxPro conserves the most significant portions of the totals when numeric overflow occurs. When a field is too small to accept a total:

•	Decimal places are truncated, and the remaining decimal portion of the total is rounded.

•	If the total still doesn’t fit, scientific notation is used if the total field contains seven or more digits.

•	Finally, asterisks replace the field contents.


See Also

AVERAGE
CALCULATE
INDEX
SORT
SUM


TRANSFORM( ) Function

Syntax         Returns         Arguments         Example          See Also

Returns a character string from an expression in a format determined by a format code.

Syntax

TRANSFORM(eExpression, cFormatCodes)

Returns

Character

Arguments

eExpression   Specifies the character, currency, date, or numeric expression to format.

cFormatCodes   Specifies one or more format codes that determine how the expression is formatted. The following table lists the available format codes.

Format Codes	Description
@C	CR is appended to positive currency or numeric values to indicate a credit.
@D	Date and DateTime values are converted to the current SET DATE format.
@E	Date and DateTime values are converted to a BRITISH date format.
@T	Leading and trailing spaces are trimmed from character values.
@X	DB is appended to negative currency or numeric values to indicate a debit.
@Z	If 0, currency or numeric values are converted to spaces.
@(	Encloses negative currency or numeric values in parentheses.
@^	Converts currency or numeric values to scientific notation.
@0	Converts numeric or currency values to their hexadecimal equivalents. The numeric or currency value must be positive and less than 4,294,967,296.
!	Converts character data to uppercase.
$	Adds the current currency symbol specified by SET CURRENCY to currency and numeric values. By default, the symbol is placed immediately before or after the value. However, the currency symbol and its placement (specified with SET CURRENCY), the separator character (specified with SET SEPARATOR) and the decimal character (specified with SET POINT) can all be changed.
X	Specifies the width of character values. For example, if cFormatCodes is ‘XX’, 2 characters are returned.
Y	Converts logical true (.T.) and false (.F.) values to Y and N, respectively.
!	Converts lowercase characters to uppercase.
.	Specifies the decimal point position in currency and numeric values.
,	Separates digits to the left of the decimal point in currency and numeric values.


TRANSFORM( ) Function Example

STORE 12.34 TO gnPrice

CLEAR

? TRANSFORM(gnPrice, '$$$$.99')  && Displays $12.34


See Also

InputMask Property


_TRANSPORT System Memory Variable
_TRANSPORT System Variable

Included for backward compatibility. Use the Visual FoxPro Converter instead.


_TRIGGERLEVEL System Memory Variable
_TRIGGERLEVEL System Variable

Syntax         Arguments         Remarks         See Also

Contains a read-only numeric value indicating the current trigger procedure nesting level.

Syntax

_TRIGGERLEVEL = nExpression

Arguments

nExpression   Contains the current trigger procedure nesting level. _TRIGGERLEVEL contains 1 when the initial trigger procedure is executing. If a trigger procedure causes another trigger procedure to fire, _TRIGGERLEVEL is incremented by 1. _TRIGGERLEVEL contains 0 if a trigger procedure is not executing.

Remarks

Use CREATE TRIGGER to create a Delete, Insert, or Update trigger for a table. You can use APPEND PROCEDURES and MODIFY PROCEDURES to create stored procedures that are executed when a Delete, Insert, or Update trigger occurs.

_TRIGGERLEVEL contains a numeric value that is read-only. If you use STORE or = to assign a value to _TRIGGERLEVEL, the value is ignored.


See Also

APPEND PROCEDURES
CREATE TRIGGER
MODIFY PROCEDURE


TRIM( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the specified character expression with all trailing blanks removed.

Syntax

TRIM(cExpression)

Returns

Character

Arguments

cExpression   Specifies the character expression from which TRIM( ) removes all trailing blanks.

Remarks

TRIM( ) is identical to RTRIM( ).


TRIM( ) Function Example

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

CLEAR

? 'The contact for '+ TRIM(company) + ' is ' + contact


See Also

ALLTRIM( )
LTRIM( )
RTRIM( )


TTOC( ) Function

Syntax         Returns         Arguments         Example         See Also

Converts a DateTime expression to a Character value of a specified format.

Syntax

TTOC(tExpression [, 1 | 2])

Returns

Character

Arguments

tExpression   Specifies a DateTime expression from which TTOC( ) returns a Character value. If tExpression contains only a time, Visual FoxPro adds the default date of 12/30/1899 to tExpression. If tExpression contains only a date, Visual FoxPro adds the default time of midnight (12:00:00 A.M.) to tExpression.

1   Specifies that TTOC( ) return a Character string in a format suitable for indexing. The character string has a 14 character yyyy:mm:dd:hh:mm:ss format that is not affected by the current settings of SET CENTURY or SET SECONDS.

2   Specifies that TTOC( ) return a Character string consisting of only the time portion of the DateTime expression. The settings of SET SECONDS and SET DATE specify if the seconds portion of the time is included in the character string. Note that if SET DATE is set to LONG or SHORT, the format of the character string is determined by the format of the Control Panel time setting.


TTOC( ) Function Example

The following example creates a Datetime type variable named gtDtime. TYPE( ) displays T, indicating the variable is a Datetime type. TTOC( ) is used to convert the variable to a character type, and TYPE( ) now displays C, indicating the  variable is a character type after the conversion.

STORE DATETIME( ) TO gtDtime  && Creates a Datetime type memory variable

CLEAR

? "gtDtime is type: "

?? TYPE('gtDtime')  && Displays T, Datetime type value

gtDtime = TTOC(gtDtime)	  &&  Converts gtDtime to a character value

? "gtDtime is now type: "

?? TYPE('gtDtime')  && Displays C, character type value


See Also

DATE( )
DATETIME( )
HOUR( )
MINUTE( )
SEC( )
SECONDS( )
SET CENTURY
SET DATE, SET SECONDS
TIME( )
TTOD( )


TTOD( ) Function

Syntax         Returns         Arguments         Example         See Also

Returns a Date value from a DateTime expression.

Syntax

TTOD(tExpression)

Returns

Date

Arguments

tExpression   Specifies a date and time expression from which TTOD( ) returns a Date value. tExpression must evaluate to a valid DateTime. If tExpression contains only a time, Visual FoxPro adds the default date of 12/30/1899 to tExpression and returns this default date.


TTOD( ) Function Example

The following example creates a Datetime type variable named gtDtime. TYPE( ) displays T, indicating the variable is a Datetime type. TTOD( ) is used to convert the variable to a date type, and TYPE( ) now displays D, indicating the variable is a date type after the conversion.

STORE DATETIME( ) TO gtDtime  && Creates a Datetime type memory variable

CLEAR

? "gtDtime is type: "

?? TYPE('gtDtime')  && Displays T, Datetime type value

gtDtime = TTOD(gtDtime)	  &&  Converts gtDtime to a date value

? "gtDtime is now type: "

?? TYPE('gtDtime')  && Displays D, character type value


See Also

DATE( )
DATETIME( )
HOUR( )
MINUTE( )
SEC( )
SECONDS( )
SET CENTURY
SET SECONDS
TIME( )
TTOC( )


TXNLEVEL( ) Function

Syntax         Returns         Remarks         Example         See Also

Returns a numeric value indicating the current transaction level.

Syntax

TXNLEVEL( )

Returns

Numeric

Remarks

Use BEGIN TRANSACTION to create a transaction. Transactions are nested by issuing BEGIN TRANSACTION when another transaction is in progress. Transactions can be nested in this manner to five levels. Use TXNLEVEL( ) to determine the current transaction level.

TXNLEVEL( ) returns a value from 0 to 5. TXNLEVEL( ) returns 0 if a transaction is not in progress.


TXNLEVEL( ) Function Example

In the following example, the customer table in the testdata database is opened. BEGIN TRANSACTION is issued to start a transaction, and TXNLEVEL( ) is used to display the transaction level (1). BEGIN TRANSACTION is issued again to start a nested transaction, and TXNLEVEL( ) displays 2 for the current transaction level.

CLOSE DATABASES

OPEN DATABASE SYS(2004)+"samples\data\testdata"

USE Customer	  && Open customer table

CLEAR

BEGIN TRANSACTION

tLevel = ALLTRIM(STR(TXNLEVEL()))

=MESSAGEBOX("Current Transaction: " + tLevel, 0, "Trasaction Level")

BEGIN TRANSACTION

tLevel = ALLTRIM(STR(TXNLEVEL()))

=MESSAGEBOX("Current Transaction: " + tLevel, 0, ;

"Trasaction Level")

END TRANSACTION

END TRANSACTION


See Also

BEGIN TRANSACTION
END TRANSACTION
ROLLBACK


TXTWIDTH( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns the length of a character expression with respect to the average character width for a font.

Syntax

TXTWIDTH(cExpression [, cFontName, nFontSize [, cFontStyle]])

Returns

Numeric

Arguments

cExpression   Specifies a character expression for which TXTWIDTH( ) returns the length. If you include only cExpression, the length of the character expression is returned for the current font for the main Visual FoxPro window or the active output window. A non-proportional font always returns a value equal to the number of characters in cExpression.

Include the optional arguments cFontName, nFontSize and cFontStyle to determine the length of a character expression with a specific font, font point size, or font style.

cFontName   Specifies the name of the font. Include cFontName to return the length of a character expression with a specific font.

nFontSize   Specifies a number that corresponds to the point size of the font. Include nFontSize to return the length of a character expression with a specific point size.

cFontStyle   Specifies a special font style for the character expression. cFontStyle is a font style code specified by a character or a set of characters. The Normal font style is used if cFontStyle isn’t included.

Here are the characters for each font style:

Character	Font Style
B	Bold
I	Italic
N	Normal
O	Outline
Q	Opaque
S	Shadow
-	Strikeout
T	Transparent
U	Underline
You can include more than one character to specify a combination of font styles. For example, BI specifies a Bold Italic font style.

The following command displays a message in a Courier normal 24-point font, centered horizontally in the main Visual FoxPro window:

@ 25,(WCOLS( )-TXTWIDTH('Hello!','Courier ',24)* ;

FONTMETRIC(6,'Courier ',24)/FONTMETRIC(6))/2  ;

SAY 'Hello!' FONT 'Courier ',24

Remarks

TXTWIDTH( ) returns the number of characters a character expression cExpression occupies, based on the average character width of a specified font (the average character width of a font is called a foxel). Use FONTMETRIC(6) to determine the average character width of a font.

If you don’t include a font in TXTWIDTH( ), the value returned by TXTWIDTH( ) is determined by the current font for the main Visual FoxPro window, as long as output is directed to the main Visual FoxPro window when TXTWIDTH( ) is issued. If output is being directed to a user-defined window, the value returned is determined by the window’s current font.


See Also

FONTMETRIC( )
GETFONT( )
LEN( )
SYSMETRIC( )
WFONT( )


TYPE Command

Syntax         Arguments         Remarks         See Also

Displays the contents of a file.

Syntax

TYPE FileName1
[AUTO]
[WRAP]
[TO PRINTER [PROMPT] | TO FILE FileName2]
[NUMBER]

Arguments

FileName1   Specifies the name of the file to display. The name must include a file extension.

AUTO   Turns automatic indentation on. When you also include WRAP, TYPE automatically indents wrapped text in each paragraph by the same amount it indents the first line of the paragraph. For example:

•	Wrapped lines are aligned with the tab when a paragraph begins with a tab.

•	Wrapped lines are aligned with the tab when a paragraph begins with a number (or other text) followed by a tab and text.

•	Wrapped lines are indented by the same amount as the first line when the first line of a paragraph is indented with spaces.

WRAP   Enables wordwrap so that a word that is too long to fit at the end of a line is automatically moved to the next line.

TO PRINTER [PROMPT]   Directs output to the printer.

You can include the optional PROMPT clause to display a print dialog before printing starts. Place the PROMPT keyword immediately after TO PRINTER.

TO FILE FileName2   Directs output to the file specified with FileName2.

NUMBER   Places line numbers at the beginning of each line in the output.

Remarks

TYPE displays the contents of files. This display can be directed to the main Visual FoxPro window, the active user-defined window, a printer, or another file.

When SET HEADINGS is ON, Visual FoxPro inserts a formfeed, the path and name of the file, and the date at the beginning of output produced with TYPE. If SET HEADINGS is OFF, this information isn’t included.

In FoxPro for MS-DOS, if a printer driver setup is loaded and you direct output from TYPE to a file or a printer, TYPE displays the file contents using the settings from the printer driver setup.


See Also

SET HEADINGS


TYPE( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Evaluates an expression and returns the data type of its contents.

Syntax

TYPE(cExpression)

Returns

Character

Arguments

cExpression   Specifies the expression to be evaluated, which can be a variable, field, memo field, or any other expression. The expression must be passed as a character string; place quotation marks around the names of memory variables, fields, and so on. If you do not place quotation marks around the expression, the TYPE( ) function returns “U” (undefined expression).

Remarks

The following table lists the character values TYPE( ) returns and their corresponding data types:

Data type	Character returned
Character	C
Numeric (also float, double, and integer)	N
Currency	Y
Date	D
DateTime	T
Logical	L
Memo	M
Object	O
General	G
Undefined type of expression	U


TYPE( ) Function Example

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

nTest = 1.01

cTest = "String"

CLEAR

? TYPE('customer.contact')  && Displays C

? TYPE('(12 * 3) + 4')  && Displays N

? TYPE('DATE( )')  && Displays D

? TYPE('.F. OR .T.')  && Displays L

? TYPE('ANSWER=42')  && Displays U

? TYPE('$19.99')  && Displays Y

? TYPE('nTest')  && Displays N

? TYPE('cTest')  && Displays C


See Also

EVALUATE( )


UIEnable Event

Syntax         Parameters         Remarks         Applies To         See Also

Occurs for all objects contained within a page whenever the page is activated or deactivated.

Syntax

PROCEDURE Object.UIEnable
[LPARAMETERS nIndex, lEnabled]
 – Or –
PROCEDURE Object.UIEnable
LPARAMETERS lEnabled

Parameters

nIndex   Contains a number that uniquely identifies a control if it is in a control array. The nIndex parameter is passed only if the control is in a control array.

lEnabled   Contains a logical value that specifies whether the page that the object is contained within is being activated or deactivated. If lEnabled is true (.T.), the page that the object is contained within is being activated (becoming the active page). If lEnabled is false (.F.), the page is being deactivated (becoming the inactive page).

Remarks

Use the UIEnable event to specify any action you want to occur for an object or control when the page that it is contained within is activated or deactivated.

The UIEnable event does not occur for pages when the form is initially activated. The UIEnable event occurs only when a page is programmatically or interactively activated or deactivated.


Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, EditBox, Grid, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionGroup, PageFrame, Shape, Spinner, TextBox


See Also

Activate Event
Deactivate Event


UnDock Event

Syntax         Parameters         Applies To         See Also

Occurs when the toolbar is dragged from its docked position.

Syntax

PROCEDURE ToolBar.Undock
[LPARAMETERS nIndex]

Parameters

nIndex   Uniquely identifies a control if it is in a control array.


Applies To

ToolBar


See Also

AfterDock Event
BeforeDock Event
Dock Method


UNIQUE( ) Function

Included for compatibility with dBASE.


_UNIX System Memory Variable
_UNIX System Variable

Syntax         Remarks         See Also

Contains true (.T.) if you are using FoxPro® for UNIX®.

Syntax

_UNIX = lExpression

Remarks

The _UNIX system variable contains true (.T.) if you are using FoxPro for UNIX. _UNIX contains false (.F.) if you are using a different platform version of FoxPro or Visual FoxPro.

The value contained in _UNIX cannot be changed with STORE or =.


See Also

_DOS
_MAC
VERSION( )
_WINDOWS


Unload Event

Syntax         Parameters         Remarks         Applies To         See Also

Occurs when an object is released.

Syntax

PROCEDURE Object.Unload
[LPARAMETERS nIndex]

Parameters

nIndex   Uniquely identifies a control if it is in a control array.

Remarks

The Unload event is the last event to occur before a form set or form is released. Unload occurs after the Destroy event and after all the contained objects have been released.

The occurrence of this event depends on the type of object:

•	Form objects are released in code when the object variable that refers to the form is released or when its form set is released.

•	form set objects are released in code when the object variable that refers to the form set is released.

If a container object, such as a form set, contains objects, the Unload event for the container object occurs after the Unload events for the objects it contains. For example, a form set containing one form that contains one control (a CommandButton) is released in this order:

1. FormSet’s Destroy event

2. Form’s Destroy event

3. CommandButton’s Destroy event

4. Form’s Unload event

5. FormSet’s Unload event


Applies To

Form, FormSet


See Also

Destroy Event


UNLOCK Command

Syntax         Arguments         Remarks         Example         See Also

Releases a record lock, multiple record locks, or a file lock from a table, or releases all record and file locks from all open tables.

Syntax

UNLOCK
[RECORD nRecordNumber]
[IN nWorkArea | cTableAlias]
[ALL]

Arguments

RECORD nRecordNumber   Releases the record lock on record number nRecordNumber. You can specify 0 for nRecordNumber to unlock a table header locked with LOCK(0) or RLOCK(0).

Issuing UNLOCK RECORD nRecordNumber for a record in a table with a file lock releases the file lock.

IN nWorkArea | cTableAlias   Releases a record lock (or locks) or a file lock from a table in a specific work area. nWorkArea specifies a work area number and cTableAlias specifies a table alias. If you don’t include nWorkArea or cTableAlias, UNLOCK releases a record lock (or locks) or a file lock from the table in the currently selected work area.

ALL   Releases all record and file locks in all work areas.

For more information about record and file locking and sharing tables on a network, see Chapter 17, “Programming for Shared Access,” in the Developer’s Guide.

Remarks

Record and file locks can be removed from a table only by the user who issued the locks. UNLOCK cannot unlock a table opened for exclusive use.

A record lock (or locks) or a file lock is released from the table in the current work area if you issue UNLOCK without any additional arguments.

If relations are established between tables, releasing a record lock (or locks) or a file lock from one of the tables doesn’t release locks from the related records or files. You must explicitly release the record or file locks in each of the related files. You can release all locks on any related tables by issuing UNLOCK ALL (this also releases locks in unrelated files).


UNLOCK Command Example

CLOSE DATABASES

SET REPROCESS TO 3 AUTOMATIC

STORE '1,2,3,4' TO gcRecList	  && Lock records 1 through 4

gcOldExc = SET('EXCLUSIVE')	  && Save the EXCLUSIVE setting

SET EXCLUSIVE OFF  && Allow sharing of tables

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

SELECT 0

USE employee  && Opens Employee table

? LOCK('1,2,3,4', 'customer')  && Lock the first 4 records in customer

? RLOCK(gcRecList, 'employee') && Lock the first 4 records in employee

UNLOCK IN customer

UNLOCK IN employee

SET EXCLUSIVE &gcOldExc  && Restore original EXCLUSIVE setting


See Also

FLOCK( )
LOCK( )
RLOCK( )


UpClick Event

Syntax         Parameters         Applies To         See Also

Occurs when the up arrow on a control is clicked.

Syntax

PROCEDURE Control.UpClick
[LPARAMETERS nIndex]

Parameters

nIndex   Uniquely identifies a control if it is in a control array.


Applies To

ComboBox, ListBox, Spinner


See Also

DownClick Event


UPDATE - SQL Command

Syntax         Arguments         Remarks         Example         See Also

Updates records in a table with new values.

Syntax

UPDATE [DatabaseName1!]TableName1
SET Column_Name1 = eExpression1
[, Column_Name2 = eExpression2 ...]
WHERE FilterCondition1 [AND | OR FilterCondition2 ...]]

Arguments

[DatabaseName1!]TableName1   Specifies the table in which records are updated with new values.

DatabaseName1! specifies the name of a non-current database containing the table. You must include the name of the database containing the table if the database is not the current one. Include the exclamation point (!) delimiter after the database name and before the table name.

SET Column_Name1 = eExpression1
[, Column_Name2 = eExpression2   Specifies the columns that are updated and their new values. If you omit the WHERE clause, every row in the column is updated with the same value.

WHERE FilterCondition1 [AND | OR FilterCondition2 ...]]   Specifies the records that are updated with new values.

FilterCondition specifies the criteria that records must meet to be updated with new values. You can include as many filter conditions as you like, connecting them with the AND or OR operator. You can also use the NOT operator to reverse the value of a logical expression, or use EMPTY( ) to check for an empty field.

Remarks

UPDATE - SQL can only update records in a single table.

Unlike REPLACE, UPDATE - SQL uses record locking when updating multiple records in a table opened for shared access. This reduces record contention in multiuser situations, but may reduce performance. For maximum performance, open the table for exclusive use or use FLOCK( ) to lock the table.


UPDATE - SQL Command Example

The following example opens the customer table in the testdata database. UPDATE -SQL is used to set all of the values in the maxordamt field to 25.

CLOSE DATABASES

OPEN DATABASE SYS(2004)+"samples\data\testdata"

USE Customer	  && Open customer table

* Set and display amounts for customers

UPDATE customer SET maxordamt = 25

BROWSE FIELDS company,maxordamt


See Also

DELETE - SQL
GATHER
INSERT - SQL
REPLACE
SCATTER


UPDATE Command

Included for backward compatibility. Use UPDATE - SQL instead.


UPDATED( ) Function

Included for backward compatibility. Use the InteractiveChange or ProgrammaticChange events instead.


UPPER( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the specified character expression in uppercase.

Syntax

UPPER(cExpression)

Returns

Character

Arguments

cExpression   Specifies the character expression UPPER( ) converts to uppercase.

Remarks

Each lowercase letter (a – z) in the character expression is converted to uppercase (A – Z) in the returned string. All other characters remain unchanged.


UPPER( ) Function Example

CLEAR

? UPPER('abcdefgh')  && Displays ABCDEFGH


See Also

ISLOWER( )
ISUPPER( )
LOWER( )


USE Command

Syntax         Arguments         Remarks         Example         See Also

Opens a table and its associated index files, or a SQL view.

Syntax

USE [[DatabaseName.]Table | SQLViewName | ?]
[IN nWorkArea | cTableAlias]
[ONLINE]
[ADMIN]
[AGAIN]
[NOREQUERY [nDataSessionNumber]]
[NODATA]
[INDEX IndexFileList | ?
[ORDER [nIndexNumber | IDXFileName
| [TAG] TagName [OF CDXFileName]
[ASCENDING | DESCENDING]]]]
[ALIAS cTableAlias]
[EXCLUSIVE]
[SHARED]
[NOUPDATE]

Arguments

[DatabaseName.]TableName   Specifies the name of the table to open. Because spaces are significant in file names in Windows 95, Windows NT, and on the Macintosh, avoid using extraneous spaces in TableName.

To open a table not in the current database, qualify the table name with the database name, using a period (.) to separate the database and tables names. If you don't qualify a table with a database name, Visual FoxPro can open tables only in the current database.

SQLViewName   Specifies the name of a SQL view in the current database to open. A SQL view is created with CREATE SQL VIEW. SQLViewName can also be the name of an offline view created with CREATEOFFLINE( ).

?   Displays the Use dialog, from which you can choose a table to open.

IN nWorkArea   Specifies the work area in which the table is opened. You can close a table in a specific work area by issuing USE with the IN clause and the work area number.

The IN clause supports 0 as a work area. Including 0 opens a table in the lowest available work area. For example, if tables are open in work areas 1 through 10, the following command opens the customer table in work area 11:

USE customer IN 0

IN cTableAlias   Specifies that the table is opened in the work area of a table that is currently open. The alias of the open table is specified with cTableAlias.

If you omit nWorkArea and cTableAlias, the table is opened in the currently selected work area.

ONLINE   Opens an offline view created with CREATEOFFLINE( ). Specify the name of the offline view in SQLViewName. Use TABLEUPDATE( ) to update data on the server.

The offline view must be opened exclusively. Include the EXCLUSIVE clause in USE or SET EXCLUSIVE to ON before opening the offline view with USE.

ADMIN   Opens an offline view created with CREATEOFFLINE( ), but does not update the data on the server with the changes made to the offline view.Opening an offline view with the ADMIN keyword allows you to make changes to the offline view without updating the data on the server.

AGAIN   To open a table concurrently in multiple work areas, you can do one of the following:

•	Select another work area and issue USE with the table name and the AGAIN clause.

•	Issue USE with the table name and the AGAIN clause, and specify a different work area with the IN clause.

When you open a table again in another work area, the table in the new work area takes on the attributes of the table in the original work area. For example, if a table is opened for read-only or exclusive access and is opened again in another work area, the table is opened for read-only or exclusive access in the new work area.

Index files opened for the original table are available for the table you open again if you don’t open indexes when you open the table again. The index order is set to 0 in the work areas where the table is opened again.

You can open indexes that weren’t opened with the original table. This sets the index order to 0 for the original table.

A table opened again is assigned the default alias of the work area. You can include an alias every time you open a table in multiple work areas as long as the aliases are unique.

In Visual FoxPro for Windows, opening a table again in another work area doesn’t consume an additional file handle.

NOREQUERY [nDataSessionNumber]   Specifies that data from a remote SQL view is not downloaded again. NOREQUERY is available only for SQL views and is typically used when you open a SQL view again by including the AGAIN clause. Including the NOREQUERY clause increases performance for large data sets because the data does not need to be downloaded again.

nDataSessionNumber can be included to specify that data for a remote SQL view in a specific data session isn’t downloaded again. If nDataSessionNumber is omitted, data isn’t downloaded for the view open in the current data session.

For additional information about the NOREQUERY clause, see Chapter 8, “Creating Views,” in the Developer’s Guide.

NODATA   Specifies that only the structure of a SQL view is downloaded. The SQL view’s data isn’t downloaded. NODATA provides the fastest method for determining a SQL view’s structure.

For additional information about the NODATA clause, see Chapter 8, “Creating Views,” in the Developer’s Guide.

INDEX IndexFileList   Specifies a set of indexes to open with the table. If a table has a structural compound index file, the index file is automatically opened with the table.

IndexFileList can contain any combination of names of single-entry .IDX and compound .CDX index files. You don’t have to include the file name extensions for index files unless an .IDX and a .CDX index file in the index file list have the same name.

The first index file named in the index file list is the master controlling index file, which controls how records in the table are accessed and displayed. However, if the first index file is a .CDX compound index file, records in the table are displayed and accessed in physical record order.

INDEX ?   Displays the Open dialog with a list of available index files to choose from.

ORDER [nIndexNumber]   Specifies a master controlling single-entry .IDX index file or compound .CDX index file tag other than the first index file or index tag specified in IndexFileList.

.IDX index files are numbered first, in the order in which they appear in the index file list. Tags in the structural compound index file (if one exists) are then numbered in the order in which the tags were created. Finally, tags in any independent compound index files are numbered in the order in which they were created. You can also use SET ORDER to specify the controlling index file or tag. See SET ORDER for a further discussion of the numbering of index files and tags.

If nIndexNumber is 0, records in the table are displayed and accessed in physical record order, and the indexes remain open. Including ORDER 0 enables open index files to be updated while presenting the file in record number order. Including ORDER without nIndexNumber is identical to including ORDER 0.

ORDER [IDXFileName]   Specifies a single-entry .IDX index file as the master controlling index file.

ORDER [TAG TagName] [OF CDXFileName]   Specifies a master controlling tag in a compound .CDX index file. The tag name can be from the structural compound index file or any open compound index file. If identical tag names exist in open compound index files, include OF CDXFileName and specify the name of the compound index file containing the desired tag.

ASCENDING   Specifies that the table records are accessed and displayed in ascending order.

DESCENDING   Specifies that the table records are accessed and displayed in descending order.

Including ASCENDING or DESCENDING doesn’t change the index file or tag; it alters only the order in which records are displayed and accessed.

ALIAS cTableAlias   Creates an alias for the table. You can refer to a table by its alias in commands and functions that require or support an alias.

When a table is opened, it is automatically assigned an alias, which is the table name if ALIAS isn’t included. You can create a different alias for the table by including ALIAS and a new alias. In Visual FoxPro, an alias can contain up to 254 letters, digits or underscores and must begin with a letter or an underscore. In other FoxPro versions, an alias can contain up to 10 letters, digits or underscores and must begin with a letter or an underscore.

A default alias is assigned automatically if you use AGAIN to open a single table simultaneously in multiple work areas and you don’t specify an alias when you open the table in each work area.

A default alias is also assigned if a conflict occurs. For example:

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

ACTIVATE WINDOW View  && Open the Data Session Window

USE customer ALIAS orders IN 1  	&& Alias is ORDERS

USE orders IN 3	  && Conflict; alias is C

EXCLUSIVE   Opens a table for exclusive use on a network. For more information on the exclusive use of tables, see SET EXCLUSIVE.

SHARED   Opens a table for shared use on a network. SHARED allows you to open a table for shared use even when EXCLUSIVE is set ON.

NOUPDATE   Prevents changes to the table and its structure.

Remarks

If USE is issued without a table name and a table file is open in the currently selected work area, the table is closed. Also, a table is closed when another table is opened in the same work area. You can’t have more than one table open in a work area at one time.


USE Command Example

The following example opens three tables in three different work areas. The Data Session window is opened to show where the tables are open and to show the alias for each table.

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

ACTIVATE WINDOW View

USE customer IN 0  && Opens Customer table

USE employee IN 0  && Opens Employee table

USE products IN 0  && Opens Products table


See Also

CREATE
CREATE SQL VIEW
CREATE TABLE - SQL
CREATEOFFLINE( )
DBF( )
INDEX
USED( )


USED( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Determines if a table is open in a specified work area.

Syntax

USED([nWorkArea | cTableAlias])

Returns

Logical

Arguments

nWorkArea | cTableAlias   Specifies the table’s work area. nWorkArea specifies the work area number and cTableAlias specifies the table alias. If you don’t include nWorkArea or cTableAlias, the currently selected work area is checked for an open table.

If you include a table alias, USED( ) returns true if a table with the alias you specify is open in one of the work areas.

Remarks

If a table is open in a specified work area, USED( ) returns true (.T.); otherwise USED( ) returns false (.F.).


USED( ) Function Example

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

SELECT A

USE customer  && Opens Customer table

SELECT B

USE orders  && Opens Orders table

SELECT C

USE employee  && Opens Employee table

? USED('A')  && Displays .T.

? USED('B')  && Displays .T.

? USED(4)  && Displays .F.


See Also

ALIAS( )
SELECT( )


VAL( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns a numeric value from a character expression composed of numbers.

Syntax

VAL(cExpression)

Returns

Numeric

Arguments

cExpression   Specifies a character expression composed of up to 16 numbers. Rounding occurs if more than 16 numbers are included in cExpression.

Remarks

VAL( ) returns the numbers in the character expression from left to right until a non-numeric character is encountered (leading blanks are ignored). VAL( ) returns 0 if the first character of the character expression isn’t a number or a plus sign (+) or minus sign (-).

VAL( ) can be used to convert the character strings returned by the Visual FoxPro SYS( ) functions to numeric values.


VAL( ) Function Example

CLEAR

STORE '12' TO A

STORE '13' TO B

? VAL(A) + VAL(B)  && Displays 25.00

STORE '1.25E3' TO C

? 2 * VAL(C)  && Displays 2500.00


See Also

SET DECIMALS
STR( )


Valid Event

Syntax         Remarks         Applies To         See Also

Occurs before a control loses the focus.

Syntax

PROCEDURE Control.Valid
[LPARAMETERS nIndex]

Parameters

nIndex   Uniquely identifies a control if it is in a control array.

Remarks

If the Valid event returns true (.T.), the control loses focus. If the Valid event returns false (.F.), the control does not lose focus.

The Valid event can also return a numeric value. Returning a numeric value has one of three effects:

•	If 0 is returned, the control does not lose focus.

•	If a positive value is returned, the value specifies the number of controls the focus advances. For example, if the Valid event returns 1, the next control gets the focus.

•	If a negative value is returned, the value specifies the number of controls the focus moves back. For example, if the Valid event returns –1, the previous control gets the focus.


Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, EditBox, Grid, ListBox, OptionButton, OptionGroup, Spinner, TextBox


See Also

LostFocus Event
When Event


VALIDATE DATABASE Command

Syntax         Arguments         Remarks         Example         See Also

Ensures that the locations of tables and indexes in the current database are correct.

Syntax

VALIDATE DATABASE
[RECOVER]
[NOCONSOLE]
[TO PRINTER [PROMPT] | TO FILE FileName]

Arguments

RECOVER   Displays dialogs that allow you to locate tables and indexes that are not in the locations contained in the database. VALIDATE DATABASE RECOVER must be issued in the Command window; issuing VALIDATE DATABASE RECOVER within a program generates an error message.

NOCONSOLE   Suppresses error message output to the main Visual FoxPro window or to the active user-defined window.

TO PRINTER [PROMPT]   Directs error message output from VALIDATE DATABASE to a printer.

PROMPT displays a Print dialog box before printing starts. Place the PROMPT keyword immediately after TO PRINTER.

TO FILE FileName   Directs error message output to the file specified with FileName. If the file already exists and SET SAFETY is ON, you are asked if you want to overwrite the file.

Remarks

VALIDATE DATABASE ensures that the database contains the proper locations of tables and indexes, that tables in the database contain the proper fields, and that index tags in the database exist.

VALIDATE DATABASE operates on the current database. The database must be opened for exclusive use by including the EXCLUSIVE keyword when you issue OPEN DATABASE.


VALIDATE DATABASE Command Example

The following example opens the testdata database and uses VALIDATE DATABASE to ensure that the locations of tables and indexes in the database are correct.

CLOSE DATABASES

SET PATH TO (SYS(2004) + 'samples\data\') && Sets path to database

OPEN DATABASE testdata EXCLUSIVE && Open testdata database

VALIDATE DATABASE


See Also

CREATE DATABASE
MODIFY DATABASE
OPEN DATABASE
USE


Value Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the current state of a control. Available at design time and run time. Read-only for ComboBox and ListBox controls.

Syntax

[Form.]Control.Value[ = nSetting]

Settings

nSetting   For a CheckBox control, the settings for the Value property are:

Setting	Description
0	(Default) Unchecked.
1	Checked.
2	Mixed-value. This setting is only available in code.
For CommandGroup, ComboBox, EditBox, ListBox, OptionGroup, and Spinner controls, the setting for the Value property is the character string or numeric value that is currently selected.

For an OptionButton control, the settings for the Value property are:

Setting	Description
0	(Default) Indicates the button isn’t selected.
1	Indicates the button is selected.
For a TextBox control, the setting for the Value property is the character string or numeric, date, datetime, currency, or logical value that is currently selected. The default setting is a character string.

Remarks

For the Grid control, the Value property is available only when the Grid control has the focus.

The Value property of a CommandGroup or OptionGroup control can be used to determine which button in the group caused an event. It is set to an integer that indicates which button in the group caused the event.

The Value property changes behavior when a control source is set for a control. When a control source is set, the Value property setting of a control is the data type of the variable or field referenced by the ControlSource property. If the data type is not valid for the given control, Visual FoxPro generates an error.

The following is a list of valid data types:

Control	Data Types allowed
CheckBox	Integer, Logical, Numeric
ComboBox	Character, Integer, Numeric
CommandGroup	Character, Integer, Numeric
EditBox	Character, Memo
Grid	Character, Numeric
ListBox	Character, Integer, Numeric
OptionButton	Integer, Logical, Numeric
OptionGroup	Character, Integer, Numeric
Spinner	Currency, Integer, Numeric
TextBox	Any data type


Applies To

CheckBox, ComboBox, CommandGroup, EditBox, Grid, ListBox, OptionButton, OptionGroup, Spinner, TextBox


See Also

Bound Property
ListIndex Property


VARREAD( ) Function

Included for backward compatibility in Visual FoxPro. Use the ControlSource or Name properties instead.


VERSION( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns information about the Visual FoxPro version you are using.

Syntax

VERSION(nExpression)

Returns

Character, Numeric

Arguments

nExpression   Specifies that VERSION( ) returns additional information about Visual FoxPro. If you omit nExpression, VERSION( ) returns the Visual FoxPro version number.

The following table lists values for nExpression and the additional Visual FoxPro information returned.

nExpression	Additional Visual FoxPro information returned
1	Visual FoxPro date and serial number.
2	Visual FoxPro version type: 0 - Run time version 1 - Standard Edition (earlier versions) 2 - Professional Edition (earlier versions)
3	Localized Visual FoxPro language. The following two character values indicate the language for which Visual FoxPro is localized: 00 - English 33 - French 34 - Spanish 39 - Italian 42 - Czech 48 - Polish 49 - German 55 - Portuguese 82 - Korean 86 - Simplified Chinese 88 - Traditional Chinese
Remarks

Use VERSION( ) to conditionally execute version-specific portions of code.

VERSION( ), VERSION(1), and VERSION(3) return character strings; VERSION(2) returns a numeric value.


VERSION( ) Function Example

CLEAR

? VERSION( )


See Also

GETCP( )
GETENV( )
OS( )


Version Property

Syntax         Applies To          See Also

Returns the version number of an instance of Visual FoxPro as a character string. Read-only at run time.

Syntax

ApplicationObject.Version


Applies To

Application Object, _VFP System Variable


See Also

VERSION( )


_VFP System Variable

Syntax         Arguments         Remarks         Properties         Methods         See Also

References the Application object for the current instance of Visual FoxPro.

Syntax

_VFP.PropertyName[ = eValue]

– Or –

_VFP.Method

Arguments

PropertyName   Specifies a property for the application object.

eValue   Specifies a value for the property.

Method   Specifies a method to execute for the application object.

Remarks

_VFP provides access to the Objects collection.


Properties

ActiveForm	Application	AutoYield
Caption	DefaultFilePath	Forms
FullName	Height	Left
Name	OLERequestPendingTimeout	OLEServerBusyRaiseError
OLEServerBusyTimeout	Parent	StartMode
StatusBar	Visible	Width
Top	Version


Methods

DataToClip	DoCmd	Eval
Help	Quit	RequestData
SetVar


See Also

Application Object
CREATEOBJECT( )


View Property

Syntax         Settings         Applies To         See Also

Specifies the type of view for a Grid control. Available at design time; read-write at run time.

Syntax

Grid.View[ = nType]

Settings

nType   If the panes are not split (the Partition property is set to 0), the settings for the View property are:

Setting	Description
0	Browse
1	Change
If the panes are split, the settings for the View property are:

Setting	Description
0	Browse (left pane), Browse (right pane)
1	Browse (left pane), Change (right pane)
2	Change (left pane), Browse (right pane)
3	Change (left pane), Change (right pane)


Applies To

Grid


See Also

Panel Property
PanelLink Property
Partition Property


Visible Property

Syntax         Settings         Remarks         Example         Applies To         See Also

Specifies whether an object is visible or hidden. Available at design time and run time.

Syntax

Object.Visible[ = lExpr]

Settings

lExpr   The settings for the Visible property are:

Setting	Description
True (.T.)	The default in the Form Designer. The object is visible.
False (.F.)	The default in program code. The object is hidden.
Remarks

Setting the Visible property for the _SCREEN system variable has no effect in Visual FoxPro for Windows.

Even if the object is hidden, it can still be accessed in code.

To hide an object at startup, set the Visible property to false (.F.) at design time. If you set the Visible property in code, you can hide an object and display it at run time in response to a particular event.

When a form’s Visible property is set to false (.F.), the form is hidden and the last-active form set, form, or other object becomes active. When a form’s Visible property is set to true (.T.), the form becomes visible. Setting a form’s Visible property to true (.T.) does not affect the form’s Order property setting. The form does not become active when Visible is set to true (.T.). Use the Show method to activate a form and make it visible in the same step.

Note   If the Visible property of a form is set to false (.F.), the form isn’t displayed, even if the form set’s Visible property is set to true (.T.). However, if the form set’s Visible property is set to false (.F.), all forms contained in the form set are invisible.


Visible Property Example

The following example demonstrates how the Visible property is used to display controls after they have been added to a form with the AddObject method.

The AddObject method is used to add a Line control and three command buttons to the form. The Visible property is set to true (.T.) for the Line control and the command buttons, displaying them on the form. The Visible property is also used to hide the Line control before its slant direction is changed, and to display the Line control after its slant direction is changed.

frmMyForm = CREATEOBJECT('Form')  && Create a form

frmMyForm.Closable = .F.  && Disable the Control-menu box

frmMyForm.AddObject('shpLine','Line')  && Add a Line control to the form

frmMyForm.AddObject('cmdCmndBtn1','cmdMyCmndBtn1')  && Up Cmnd button

frmMyForm.AddObject('cmdCmndBtn2','cmdMyCmndBtn2')  && Down Cmnd button

frmMyForm.AddObject('cmdCmndBtn3','cmdMyCmndBtn3')  && Quit Cmnd button

frmMyForm.shpLine.Visible = .T.  && Make Line control visible

frmMyForm.shpLine.Top = 20  && Specify Line control row

frmMyForm.shpLine.Left = 125  && Specify Line control column

frmMyForm.cmdCmndBtn1.Visible =.T.  && Up Command button visible

frmMyForm.cmdCmndBtn2.Visible =.T.  && Down" Command button visible

frmMyForm.cmdCmndBtn3.Visible =.T.  && Quit Command button visible

frmMyForm.SHOW  && Display the form

READ EVENTS  && Start event processing

DEFINE CLASS cmdMyCmndBtn1 AS COMMANDBUTTON  && Create Command button

Caption = 'Slant \<Up'  && Caption on the Command button

Left = 50  && Command button column

Top = 100  && Command button row

Height = 25  && Command button height

PROCEDURE Click

ThisForm.shpLine.Visible = .F.  && Hide the Line control

ThisForm.shpLine.LineSlant ='/'  && Slant up

ThisForm.shpLine.Visible = .T.  && Show the Line control

ENDDEFINE

DEFINE CLASS cmdMyCmndBtn2 AS CommandButton  && Create Command button

Caption = 'Slant \<Down'  && Caption on the Command button

Left = 200  && Command button column

Top = 100  && Command button row

Height = 25  && Command button height

PROCEDURE Click

ThisForm.shpLine.Visible = .F.  && Hide the Line control

ThisForm.shpLine.LineSlant ='\'  && Slant down

ThisForm.shpLine.Visible = .T.  && Show the Line control

ENDDEFINE

DEFINE CLASS cmdMyCmndBtn3 AS CommandButton  && Create Command button

Caption = '\<Quit'  && Caption on the Command button

Cancel = .T.  && Default Cancel Command button (Esc)

Left = 125  && Command button column

Top = 150  && Command button row

Height = 25  && Command button height

PROCEDURE Click

CLEAR EVENTS  && Stop event processing, close form

ENDDEFINE


Applies To

CheckBox, Column, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, EditBox, Form, FormSet, Grid, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, PageFrame, _SCREEN, Shape, Spinner, TextBox, ToolBar


See Also

Show Method
ZOrder Method


WAIT Command

Syntax         Arguments         Remarks         See Also

Displays a message and pauses Visual FoxPro execution until the user presses a key or click the mouse.

Syntax

WAIT
[cMessageText]
[TO VarName]
[WINDOW [AT nRow, nColumn]]
[NOWAIT]
[CLEAR | NOCLEAR]
[TIMEOUT nSeconds]

Arguments

cMessageText   Specifies a custom message to display. If you omit cMessageText, Visual FoxPro displays the default message. If cMessageText is an empty string (""), a message isn’t displayed and Visual FoxPro waits until a key is pressed before continuing program execution.

TO VarName   Saves the key pressed to a variable or an array element. If the variable or an array element you specify with VarName doesn’t exist, it is created. The empty string is stored in VarName if you press ENTER or a nonprintable key or key combination, or click the mouse.

WINDOW   Displays the message in a system message window located in the upper-right corner of the main Visual FoxPro window. The window can be temporarily hidden by pressing the CTRLor SHIFT key.

AT nRow, nColumn   In Visual FoxPro, specifies the position of the message window on the screen.

NOWAIT   Continues program execution immediately after the message is displayed. The program doesn’t wait for the message to be removed from the main Visual FoxPro window, but continues executing on the program line immediately following the program line containing WAIT NOWAIT. If you omit NOWAIT, program execution pauses until the message is removed from the main Visual FoxPro window by pressing a key or clicking the mouse.

CLEAR   Removes a Visual FoxPro system window or a WAIT message window from the main Visual FoxPro window from within a program. For example, talk from indexing, sorting, and so on is directed to a Visual FoxPro system window if you issue SET TALK WINDOW. The window can be removed interactively if you press a key or move the mouse. Issue WAIT CLEAR to remove the window from within a program.

NOCLEAR   Specifies that a WAIT message window remains on the main Visual FoxPro window until WAIT CLEAR or another WAIT WINDOW command is issued, or a Visual FoxPro system message is displayed.

TIMEOUT nSeconds   Specifies the number of seconds that can elapse without input from the keyboard or the mouse before the WAIT is terminated. nSeconds specifies the number seconds (fractional seconds are permitted) that elapse. If TIMEOUT isn’t the last clause in WAIT, Visual FoxPro generates a syntax error message.

Remarks

If a WAIT message is displayed in Visual FoxPro for Windows, pressing the Shift or CTRL keys hides all windows including the WAIT message.


See Also

ACCEPT


WBORDER( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Determines whether the active or specified window has a border.

Syntax

WBORDER([WindowName])

Returns

Logical

Arguments

WindowName   Specifies the name of the window for which WBORDER( ) returns a logical value.

WBORDER( ) returns a logical value for the active output window if you omit a window name.

Remarks

WBORDER( ) returns true (.T.) if the specified window has a border; otherwise WBORDER( ) returns false (.F.). By default, windows have borders. Include the NONE clause in DEFINE WINDOW to create a window without a border.


See Also

ACTIVATE WINDOW
DEFINE WINDOW


WCHILD( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns either the number of child windows in a parent window or the names of the child windows in the order in which they are stacked in the parent window.

Syntax

WCHILD([WindowName] [nChildWindow])

Returns

Character or Numeric

Arguments

WindowName   Specifies a window other than the active output window for which WCHILD( ) returns the number of child windows. The number of child windows in the specified window is returned if you include just a window name without the numeric expression nChildWindow.

If you include both WindowName and nChildWindow, WCHILD( ) returns the names of the child windows in the specified window. If you include both WindowName and nChildWindow, separate WindowName and nChildWindow with a comma.

You can also include the empty string in WindowName to specify the main Visual FoxPro window.

nChildWindow   Specifies a numeric expression included to return the names of child windows in the active output window when you omit WindowName.

The numeric expression nChildWindow can be 0 or any positive value. The name of the child window at the bottom of the stack of child windows in the current output window is returned if nChildWindow is 0.

If nChildWindow is a positive number, WCHILD( ) returns the name of the next child window in the window stack. The name of next child window in the stack is returned if you issue WCHILD( ) again with a positive number, and so on. The empty string is returned if WCHILD( ) is called more times than the number of child windows in the parent window. For more information on window stacking, see ACTIVATE WINDOW.

Note   In Visual FoxPro for Windows, if the main Visual FoxPro window is active, all windows are children of the main Visual FoxPro window. In Visual FoxPro, toolbars that are not docked in the border of the main Visual FoxPro window are children of the main Visual FoxPro window. Issuing a series of WCHILD( ) functions with positive numbers returns the names of the active windows and toolbars.

If you include both WindowName and nChildWindow, separate WindowName and nChildWindow with a comma.

Remarks

You can create a window (the parent window) and place other windows (child windows) inside. Including the IN or IN WINDOW clause in DEFINE WINDOW creates a child window inside the parent window. A child window created and activated inside a parent window cannot be moved outside the parent window. If the parent window is moved, the child window moves with it.

The number of child windows in the active output window is returned if you issue WCHILD( ) without any arguments.


See Also

ACTIVATE WINDOW
DEFINE WINDOW
WPARENT( )


WCOLS( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

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

Syntax

WCOLS([WindowName])

Returns

Numeric

Arguments

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 don’t 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.

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 Fonts Overview.


WCOLS( ) Function Example

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

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

SCOLS( )
SROWS( )
WLCOL( )
WLROW( )
WROWS( )


WEEK( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns a number representing the week-of-the-year from a Date or DateTime expression.

Syntax

WEEK(dExpression | tExpression [, nFirstWeek] [, nFirstDayOfWeek])

Returns

Numeric

Arguments

dExpression | tExpression   Specifies the Date or DateTime expression for which WEEK( ) returns the week-of-the-year.

If you omit the optional nFirstWeek and nFirstDayOfWeek arguments, WEEK( ) uses Sunday as the first-day-of-the-week.

nFirstWeek   Specifies the requirements for the first-week-of-the-year. nFirstWeek may be one of the following values.

nFirstWeek	Description
0	WEEK( ) returns whatever week is currently selected in the First Week of Year list box on the International tab in the Options dialog box.
1	First week contains January 1st. This is the default when you omit nFirstWeek.
2	The larger half (four days) of the first week is in the current year.
3	First week has seven days.
nFirstDayOfWeek   Specifies the first-day-of-the-week. nFirstDayOfWeek may be one of the following values.

nFirstDayOfWeek	Description
0	WEEK( ) returns whatever day is currently selected in the Week Starts on list box on the International tab in the Options dialog box.
1	Sunday. This is the default when you omit nFirstDayOfWeek, and is the first-day-of-the-week used in earlier FoxPro versions.
2	Monday
3	Tuesday
4	Wednesday
5	Thursday
6	Friday
7	Saturday
Remarks

WEEK( ) returns a number from 1 to 53 that represents the week-of-the-year. For example, WEEK( ) returns 1 for the first-week-of-the-year, 2 for the second-week-of-the-year, and so on. Note that a week can be split between years — the first-week-of-the-year can be in the current year and the previous year.


WEEK( ) Function Example

The following example displays the week-of-the-year for today’s date and for a specific date.

CLEAR

? WEEK(DATE( ))

? WEEK({2/16/1995})


See Also

CDOW( )
DAY( )
DOW( )
SET FDOW
SET FWEEK
SYS( ) Functions Overview


WEXIST( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Determines whether the specified user-defined window exists.

Syntax

WEXIST(WindowName)

Returns

Logical

Arguments

WindowName   Specifies the name of the user-defined window.

You can also specify the name of a Visual FoxPro system window (the Command window, the Data Session window, a Browse window, and so on), and in Visual FoxPro, the name of a toolbar. WEXIST( ) returns true (.T.) if the system window or toolbar you specify is visible or hidden. WEXIST( ) returns false (.F.) if the specified system window or toolbar is closed.

Two exceptions are the Command and Debug windows. Including the Command window’s name in WEXIST( ) always returns a true value. If the Debug window has been opened, WEXIST( ) returns true, even if the Debug window is closed.

Remarks

WEXIST( ) returns true (.T.) if the user-defined window you specify has been created with DEFINE WINDOW; otherwise WEXIST( ) returns false (.F.). The specified window doesn’t have to be active or visible for WEXIST( ) to return true (.T.), but it must exist.


WEXIST( ) Function Example

DEFINE WINDOW wScreen1 FROM 10,10 TO 20,69

DEFINE WINDOW wScreen2 FROM 1,0 TO 19,79

CLEAR

? WEXIST('wScreen1')  && Displays .T.

STORE 'wScreen2' TO gcWinName

? WEXIST('win_name')  && Displays .F.

? WEXIST(gcWinName)  && Displays .T.

RELEASE WINDOWS wScreen1, wScreen2


See Also

ACTIVATE WINDOW
DEFINE WINDOW
WONTOP( )
WOUTPUT( )
WVISIBLE( )


WFONT( ) Function

Syntax         Returns         Arguments         Example         See Also

Returns the name, size, or style of the current font for a window in Visual FoxPro for Windows.

Syntax

WFONT(nFontAttribute [, WindowName])

Returns

Character and Numeric

Arguments

nFontAttribute   Specifies the font attribute you want to return.

If nFontAttribute is 1, WFONT( ) returns the name of the current font for the active or specified window.

If nFontAttribute is 2, WFONT( ) returns the font size.

If nFontAttribute is 3, WFONT( ) returns a code that identifies the font style.

The font style code is a character or set of characters that correspond to the current font style. For example, the current font style is Bold Italic if WFONT(3) returns BI.

The following table lists the codes for each font style:

Character	Font Style
B	Bold
I	Italic
N	Normal
O	Outline
Q	Opaque
S	Shadow
-	StrikeThru
T	Transparent
U	Underline
WindowName   Specifies the name of the window for which you want to determine the current font, font size, or font style. In Visual FoxPro, you can also include the name of a toolbar. Include the empty string to return the current font, font size, or font style for the main Visual FoxPro window.

WindowName can be the name of a user-defined window created with DEFINE WINDOW or a text- or memo-editing window.

You can also include the name of a system window (View, Trace, Debug, and so on). WFONT( ) can return font attributes only for a system window that has been opened and is currently visible or hidden. If the system window you specify is closed, Visual FoxPro generates an error message.

WFONT( ) returns the current font, font size or font style for the active output window if you omit WindowName.


WFONT( ) Function Example

The following example creates a user-defined window called wFontChar. The window is activated and its font characteristics are displayed in the window. The font characteristics are then displayed for the main Visual FoxPro window.

CLEAR

DEFINE WINDOW wFontChar ;

FROM 1,1 TO 3,35 ;

FONT 'MS SANS SERIF',8 ;

STYLE 'BI'  && Define window with font and style

ACTIVATE WINDOW wFontChar

? WFONT(1), WFONT(2), WFONT(3)  && wFontChar window

ACTIVATE SCREEN

?

?

?

? 'Font characteristics for the window wFontChar'

?

?

? WFONT(1,''), WFONT(2,''), WFONT(3,'')  && Main Visual FoxPro window

?

? 'Font characteristics for the main Visual FoxPro window'

WAIT WINDOW

RELEASE WINDOW wFontChar

CLEAR


See Also

FONTMETRIC( )
GETFONT( )
SYSMETRIC( )
TXTWIDTH( )


WhatsThisButton Property

Syntax         Settings         Remarks         Applies To          See Also

Specifies whether the What’s This button appears in a form’s title bar. Read-only at run time.

Syntax

Form.WhatsThisButton[ = lExpr]

Settings

lExpr   One of the following:

Setting	Description
True (.T.)	Turns display of the What’s This button on.
False (.F.)	(Default) Turns display of the What’s This button off.
Remarks

The What’s This button is not displayed in the form’s title bar if the WhatsThisButton property is set to true (.T.) and any of the following are true:

•	The form’s WhatsThisHelp property is set to false (.F).

•	The form’s BorderStyle property is set to 0 (None).

•	The form’s MinButton property is set to true (.T.).

•	The form’s MaxButton property is set to true (.T.).


Applies To

Form


See Also

BorderStyle Property, MaxButton Property, MinButton Property, ShowWhatsThis Method, WhatsThisMode Method, WhatsThisHelp Property, WhatsThisHelpID Property


WhatsThisHelp Property

Syntax         Settings         Remarks         Applies To          See Also

Specifies whether context-sensitive Help uses What’s This help or the Windows help file specified with SET HELP.

Syntax

Form.WhatsThisHelp[ = lExpr]

Settings

lExpr   One of the following:

Setting	Description
True (.T.)	The form uses one of the three What’s This Help techniques to open the Windows help file specified with SET HELP and display the topic specified with the WhatsThisHelpID property.
False (.F.)	(Default) The form uses the F1 key to open the Windows help file specified with SET HELP. The Help topic specified with the HelpContextID property is displayed.
Remarks

The three What’s This Help techniques are as follows:

1.	A What’s This button is displayed in the form title bar. When this button is clicked, the mouse pointer changes to an arrow with a question mark. The Help topic displayed when a control is clicked is specified with the WhatsThisHelpID property for the control.

2.	The WhatsThisMode method is invoked, changing the mouse pointer changes to an arrow with a question mark. The Help topic displayed when a control is clicked is specified with the WhatsThisHelpID property for the control.

3.	The ShowWhatsThis method is invoked for a control. The Help topic displayed is specified with the control’s WhatsThisHelpID property.


Applies To

Form


See Also

HelpContextID Property, SET HELP, ShowWhatsThis Method, WhatsThisButton Property, WhatsThisMode Method, WhatsThisHelpID Property


WhatsThisHelpID Property

Syntax         Settings         Applies To          See Also

Specifies a Help topic context ID to provide Whats This Help for an object. Available at design time and run time.

Syntax

Object.WhatsThisHelpID[ = nContextID]

Settings

nContextID   Specifies the context ID number of a topic in a Help file. nContextID may be negative, zero, or positive. The following table lists the values for nContextID and what is displayed when the object is clicked with the question mark mouse pointer:

nContextID	Description
Negative	(Default, -1) Displays the Whats This Help popup with the message “No Help topic is associated with this item.”
Zero	Visual FoxPro searches upward through the object’s hierarchy for the first object with a positive WhatsThisHelpID property value. If an object with a positive WhatsThisHelpID property value is found, the Whats This Help topic is displayed. If an object with a positive WhatsThisHelpID property value isn’t found, no Whats This Help topic is displayed.
Positive	Displays the Whats This Help topic corresponding to the context ID specified with nContextID. If no Help topic has the context ID specified with nContextID, the Whats This Help popup with the message “No Help topic is associated with this item” is displayed.


Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, EditBox, Form, Grid, Header, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, Shape, Spinner, TextBox, Timer, ToolBar


See Also

HelpContextID Property, SET HELP, ShowWhatsThis Method, WhatsThisButton Property, WhatsThisHelp Property, WhatsThisMode Method,


WhatsThisMode Method

Syntax         Remarks         Applies To          See Also

Displays the Whats This Help question mark mouse pointer and enables Whats This Help mode.

Syntax

[Form.]Object.WhatsThisMode

Remarks

Calling the WhatsThisMode method changes the mouse pointer to an arrow with a question mark and enables Whats This Help mode. Clicking an object displays the Whats This Help topic specified by the WhatsThisHelpID property for the object. Pressing ESC disables the Whats This Help mode and returns the mouse pointer to it’s original state.


Applies To

Form


See Also

HelpContextID Property, SET HELP, ShowWhatsThis Method, WhatsThisButton Property, WhatsThisHelp Property, WhatsThisHelpID Property


When Event

Syntax         Remarks         Applies To         See Also

Occurs before a control receives the focus.

Syntax

PROCEDURE Control.When
[LPARAMETERS nIndex]

Parameters

nIndex   Uniquely identifies a control if it is in a control array.

Remarks

If the When event returns true (.T.), the default control receives the focus. If the When event returns false (.F.), the control doesn’t receive the focus. The order of events when a control gains the focus is:

1.	When event

2.	GotFocus event

For ListBox controls, the When event occurs each time a user moves the focus between items in the list by clicking on items or by moving the selection with the arrow keys.

For all other controls, the When event occurs when an attempt is made to move the focus to the control.


Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, EditBox, Grid, ListBox, OptionButton, OptionGroup, Spinner, TextBox


See Also

GotFocus Event
Valid Event


Width Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies the width of an object. Available at design time and run time.

Syntax

[Object.]Width[ = nWidth]

Settings

nWidth   Specifies the width of an object.

Remarks

Use the Height, Width, Left, and Top properties for operations or calculations based on an object’s total area, such as sizing or moving the object.

For forms and controls, the values for this property changes as the object is sized by the user or in code. Maximum settings of this property for all objects are system-dependent.

For forms, the Width property specifies the external width of the form, excluding the borders.

For controls, the Width property is measured from the center of the control’s border so that controls with different border widths align correctly.

Note   The Width property is read-only when it applies to a control contained in a Column object.

The Width property is determined in the unit of measurement specified by the ScaleMode property setting.


Applies To

CheckBox, Column, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, Custom, EditBox, Form, Grid, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, PageFrame, _SCREEN, Shape, Spinner, TextBox, Timer, ToolBar


See Also

Height Property
Left Property
Move Method
ScaleMode Property
Top Property


WindowList Property

Included for backward compatibility with READ. Use the Form Designer instead of READ.


WindowState Property

Syntax         Settings         Applies To         See Also

Specifies whether a form window is displayed as a maximized, minimized, or normal window at run time. Available at design time and run time.

Syntax

[Object.]WindowState[ = nState]

Settings

nState   The settings for the WindowState property are:

Setting	Description
0	Normal
1	Minimized (minimized to an icon). If the main Visual FoxPro window is minimized when Visual FoxPro is exited, the main Visual FoxPro window isn’t displayed before exiting. If you application displays a dialog before exiting, be sure to set _SCREEN.WindowState to 0 before displaying the dialog.
2	Maximized (enlarged to fill the screen)


Applies To

Form, _SCREEN


See Also

Height Property
Left Property
Top Property
Width Property


_WINDOWS System Memory Variable
_WINDOWS System Variable

See Also

Contains true (.T.) if you are using Visual FoxPro for Windows.

Syntax

_WINDOWS = lExpression

Remarks

_WINDOWS contains false (.F.) if you are using a different platform version of FoxPro or Visual FoxPro.

The value contained in _WINDOWS cannot be changed with STORE or =.


See Also

_DOS, _MAC, _UNIX, VERSION( )


WindowType Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies how a form set or form behaves when it is shown or run with DO FORM. Available at design time and run time.

Syntax

Object.WindowType[ = nType]

Settings

nType   For a form set, the settings for the WindowType property are:

Setting	Description
0	Modeless.
1	Modal. No other forms can become active and the menu can be active. All forms in the form set are active.
2	Read. The form set behaves as if it were activated by the READ command. Execution stops on the Show method or DO FORM command. When the Form is deactivated, execution continues. (Included for backward compatibility, and available only for Forms converted from previous versions of FoxPro.)
3	Read Modal. The form set behaves as if it were activated by a READ command’s MODAL clause. Program execution stops at the Show method or the DO FORM command. Any forms specified in the WindowList property are available, but other forms and the menu are not available. (Included for backward compatibility, and available only for forms converted from previous versions of FoxPro.)
For a form, the settings for the WindowType property are:

Setting	Description
0	Modeless.
1	Modal. No other forms can become active and the menu is inactive. All forms in the form set are active.
Remarks

You cannot change the WindowType setting once the window has been displayed.

The Show method takes a parameter that can override the WindowType setting.

Note   The WindowType setting of a form set overrides the individual WindowType settings of the forms it contains. For example, if the WindowType property for a form set is set to 0, all the forms contained in it are modeless, regardless of their individual WindowType property settings.


Applies To

Form, FormSet, _SCREEN


See Also

DO FORM
READ
READ EVENTS
Show Method
WindowList Property


WITH ... ENDWITH Command

Syntax         Arguments         Remarks         Example         See Also

Specifies multiple properties for an object.

Syntax

WITH ObjectName
[.cStatements]
ENDWITH

Arguments

ObjectName   Specifies the name of the object. ObjectName can be the name of the object or a reference to the object.

.cStatements   cStatements can consist of any number of Visual FoxPro commands used to specify properties for ObjectName. Place a period before cStatement to denote that it is a property of ObjectName.

Remarks

WITH ... ENDWITH provides a convenient way to specify a number of properties for a single object. Note that you can also execute methods from within a WITH ... ENDWITH structure.


WITH ... ENDWITH Command Example

The following example creates a custom class name Employee. After the Employee class has been created with CREATEOBJECT( ), WITH ... ENDWITH is used to set multiple properties for the class. The properties values are then displayed.

moemployee = CREATEOBJECT('employee')

WITH moemployee

.First_Name = 'John'

.Last_Name = 'Smith'

.Address = '16 Maple Lane'

.HireDate = {02/16/95}

ENDWITH

CLEAR

? moemployee.First_Name + ' '

?? moemployee.Last_Name

? moemployee.Address

? moemployee.HireDate

DEFINE CLASS employee AS CUSTOM

First_Name = SPACE(20)

Last_Name = SPACE(20)

Address = SPACE(30)

HireDate = {  \  \  }

ENDDEFINE


See Also

:: Scope Resolution Operator
ADD CLASS
CREATE CLASS
CREATE CLASSLIB
CREATEOBJECT( )
GETOBJECT( )
MODIFY CLASS
RELEASE CLASSLIB
SET CLASSLIB


_WIZARD System Memory Variable
_WIZARD System Variable

Syntax         Arguments         Remarks         See Also

Contains the name of the Visual FoxPro wizard application.

Syntax

_WIZARD = cProgramName

Arguments

cProgramName   Specifies a wizard application. If your wizard application is in a directory other than the current Visual FoxPro default directory, include a path with the application name.

You can also specify a wizard application in your Visual FoxPro configuration file by including a line using the following syntax:

_WIZARD = cProgramName

Remarks

The _WIZARD system variable contains the name of the application that Visual FoxPro uses when you choose a wizard to run. By default, _WIZARD contains WIZARD.APP, installed in your Visual FoxPro directory. You can specify a different name for the wizard application.


See Also

System Variables Overview


WLAST( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns the name of the window that was active prior to the current window or determines whether the specified window was active prior to the current window.

Syntax

WLAST([WindowName])

Returns

Character or Logical

Arguments

WindowName   Specifies a window that WLAST( ) evaluates. In Visual FoxPro, you can also specify the name of a toolbar. WLAST( ) returns true (.T.) if the specified window was active prior to the current window; otherwise false (.F.) is returned. False (.F.) is also returned if the window you specify doesn’t exist.

The name of the window that was active prior to the current window is returned if you omit WindowName.

Remarks

WLAST( ) returns the empty string if the window that was active prior to the current window is the Debug, Trace, or Command window. Program execution isn’t affected by bringing these windows forward when you are debugging a program that uses WLAST( ).


See Also

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


WLCOL( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns the column coordinate of the upper-left corner of the active or specified window.

Syntax

WLCOL([WindowName])

Returns

Numeric

Arguments

WindowName   Specifies the window for which WLCOL( ) returns the column coordinate. In Visual FoxPro, you can also specify the name of a toolbar. If you omit WindowName, WLCOLS( ) returns the column coordinate of the active output window. You can also use the empty string for WindowName to specify the main Visual FoxPro window.

In Visual FoxPro, if no window is active, WLCOLS( ) returns the column coordinate of the main Visual FoxPro window relative to the Windows desktop.

If a system window (the Command window, the Data Session window, a Browse window, and so on) has been opened and is visible or hidden (its name appears on the Window menu), you can include its name in WLCOL( ). If you specify the name of a system window that is closed, FoxPro generates an error message. The Debug window is an exception. Once the Debug window has been opened, its name can be included in WLCOL( ) if it is visible, hidden, or closed.

Remarks

The value returned by WLCOL( ) depends on the current video display mode, and is relative to the main Visual FoxPro window. The display mode can be changed with SET DISPLAY.

Windows can be positioned outside the main Visual FoxPro window. If the specified window is to the left of the main Visual FoxPro window, WCOL( ) returns a negative value. If the window’s left border is to the right of the main Visual FoxPro window, WCOL( ) returns a positive value greater than the width of the main Visual FoxPro window.


See Also

SET DISPLAY
WCOLS( )
WLROW( )
WROWS( )


WLROW( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns the row coordinate of the upper-left corner of the active or specified window.

Syntax

WLROW([WindowName])

Returns

Numeric

Arguments

WindowName   Specifies the window for which WLROW( ) returns the row coordinate. In Visual FoxPro, you can also specify the name of a toolbar. If you omit WindowName, WLROW( ) returns the row coordinate of the active output window. You can also use the empty string for WindowName to specify the main Visual FoxPro window.

In Visual FoxPro, if no window is active, WLROW( ) returns the row coordinate of the main Visual FoxPro window relative to the Windows desktop.

If a system window (the Command window, the Data Session window, a Browse window, and so on) has been opened and is visible or hidden (its name appears on the Window menu), you can include its name in WLROW( ). If you specify the name of a system window that is closed, FoxPro generates an error message. The Debug window is an exception. Once the Debug window has been opened, its name can be included in WLROW( ) if it is visible, hidden, or closed.

Remarks

The value returned by WLROW( ) depends on the current video display mode, and the row coordinate is relative to the main Visual FoxPro window. The display mode can be changed with SET DISPLAY.

Windows can be positioned off the main Visual FoxPro window. If the top of the window is above the main Visual FoxPro window, WLROW( ) returns a negative value. If the top of the window is below the bottom of the main Visual FoxPro window, WLROW( ) returns a positive value greater than the height of the main Visual FoxPro window.


See Also

SET DISPLAY
WCOLS( )
WLCOL( )
WROWS( )


WMAXIMUM( ) Function

Syntax         Arguments         Remarks         See Also

Determines whether the active or specified window is maximized.

Syntax

WMAXIMUM([WindowName])

Arguments

WindowName   Specifies the name of the window WMAXIMUM( ) evaluates. You can specify the name of a Visual FoxPro system window (the Command window, the Data Session window, a Browse window, and so on).

If you omit WindowName, WMAXIMUM( ) returns a logical value for the active window. You can also use the empty string for WindowName to specify the main Visual FoxPro window.

Remarks

Windows can be enlarged to fill the window that contains them. In Visual FoxPro for Windows, the default container window is the main window.

A user-defined window created with DEFINE WINDOW can be maximized only if the ZOOM keyword is included in its definition.

WMAXIMUM( ) returns true (.T.) if the current or specified window is maximized; otherwise WMAXIMUM( ) returns false (.F.). In Visual FoxPro, you can include the name of a toolbar. However, WMAXIMUM( ) always returns false (.F.) for a toolbar because toolbars cannot be maximized.


See Also

DEFINE WINDOW
WMINIMUM( )
ZOOM WINDOW


WMINIMUM( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Determines whether the active or specified window is minimized.

Syntax

WMINIMUM([WindowName])

Returns

Logical

Arguments

WindowName   Specifies the name of the window WMINIMUM( ) evaluates. You can specify the name of a Visual FoxPro system window (the Command window, the Data Session window, a Browse window, and so on).

If you omit WindowName, WMINIMUM( ) returns a logical value for the active window. You can also include the empty string in WindowName to specify the main Visual FoxPro window.

Remarks

In Visual FoxPro for Windows, windows can be reduced to an icon.

A user-defined window created with DEFINE WINDOW can be minimized only if the MINIMIZE keyword is included in its definition.

WMINIMUM( ) returns true (.T.) if the current or specified window is minimized; otherwise it returns false (.F.). In Visual FoxPro, you can include the name of a toolbar. However, WMINIMUM( ) always returns false (.F.) for a toolbar because toolbars cannot be minimized.


See Also

DEFINE WINDOW
WMAXIMUM( )
ZOOM WINDOW


WONTOP( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

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

Syntax

WONTOP([WindowName])

Returns

Character or Logical

Arguments

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 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 frontmost and you don’t specify a window name, WONTOP( ) returns the empty string. 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 frontmost. It returns false (.F.) if the window isn’t frontmost or doesn’t exist.


WONTOP( ) Function Example

The following example uses WONTOP( ) to display the name of the frontmost 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( )


WordWrap Property

Syntax         Settings         Remarks         Applies To         See Also

Specifies whether a Label control expands vertically or horizontally to fit the text specified with its Caption property when the control is resized. Available at design time and run time.

Syntax

[Form.]Label.WordWrap[ = lExpr]

Settings

lExpr   The settings for the WordWrap property are:

Setting	Description
True (.T.)	The text wraps and the label expands or contracts vertically to fit the text and the size of the font. The horizontal size does not change.
False (.F.)	(Default) The text does not wrap and the label expands or contracts horizontally to fit the length of the text and vertically to fit the size of the font and the number of lines. The vertical size does not change.
Remarks

Use this property to determine how a label displays its contents. For example, a graph that changes dynamically might have a label containing text that also changes. To maintain a constant horizontal size for the label and allow for increasing or decreasing text, you would set the WordWrap property to true (.T.).

If you want a label to expand only horizontally, set WordWrap to false (.F.). If you do not want the label to change size, set AutoSize to false (.F.).

Note   If the WordWrap property is set to true (.T.), the AutoSize property is ignored.


Applies To

Label


See Also

AutoSize Property
Caption Property


WOUTPUT( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Determines whether output is being directed to the active or specified window.

Syntax

WOUTPUT([WindowName])

Returns

Logical and Character

Arguments

WindowName   Specifies the window WOUTPUT( ) evaluates for output. Output cannot be directed to a system window or toolbar. If you omit WindowName, WOUTPUT( ) returns the name of the window to which output is currently directed. You can also include the empty string in WindowName to specify the main Visual FoxPro window.

WOUTPUT( ) returns the empty string if output is being directed to the main Visual FoxPro window.

Remarks

WOUTPUT( ) returns true (.T.) if the specified user-defined window is the active output window. WOUTPUT( ) returns false (.F.) if the window you specify doesn’t exist or is a system window. The last user-defined window activated with ACTIVATE WINDOW is the active output window.


WOUTPUT( ) Function Example

In the following example, a window is created and activated. WOUTPUT( ) is used to display the name of this active output window. The window is closed and removed from memory. If another window is active, its name is displayed. If another window isn’t active, a message is displayed indicating that output is directed to the main Visual FoxPro window.

DEFINE WINDOW wOutput1 FROM 2,2 TO 12,32 TITLE 'Output Window'

ACTIVATE WINDOW wOutput1

WAIT WINDOW 'wOutput1 window: ' + WOUTPUT( )

RELEASE WINDOW wOutput1

IF EMPTY(WOUTPUT( ))

WAIT WINDOW 'Output being directed to the main Visual FoxPro window'

ELSE

WAIT WINDOW 'Output window: ' + WOUTPUT( )

ENDIF


See Also

ACTIVATE WINDOW
DEFINE WINDOW
WEXIST( )
WONTOP( )
WVISIBLE( )


WPARENT( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the name of the parent window of the active or specified window.

Syntax

WPARENT([WindowName])

Returns

Character

Arguments

WindowName   Specifies a window whose parent window name WPARENT( ) returns. WPARENT( ) returns the empty string if the specified window doesn’t have a parent window. If you omit WindowName, WPARENT( ) returns the name of the parent window of the active output window. WPARENT( ) returns the empty string if the active output window doesn’t have a parent window.

Remarks

You can use DEFINE WINDOW to create a window and place it in a parent window. The child window becomes integrated with its parent window. For example, a child window defined and activated inside a parent window can’t be moved outside the parent window. If the parent window is moved, the child window moves with it.


WPARENT( ) Function Example

The following example defines a parent and child window. It then uses WPARENT( ) to identify which window is the parent.

CLEAR ALL

CLEAR

DEFINE WINDOW wParent ;

FROM 1,1 TO 20,20 ;

TITLE 'wParent'	  && Parent window

ACTIVATE WINDOW wParent

DEFINE WINDOW wChild ;

FROM 1,1 TO 10,10 ;

TITLE 'wChild' ;

IN WINDOW wParent  && Child window

ACTIVATE WINDOW wChild

WAIT WINDOW 'The parent window is ' + WPARENT( )

RELEASE WINDOW wParent, wChild


See Also

ACTIVATE WINDOW
DEFINE WINDOW
WCHILD( )


_WRAP System Memory Variable
_WRAP System Variable

Included for backward compatibility. Use the Report Designer instead.


WREAD( ) Function

Included for backward compatibility. Use the Form Designer instead.


WriteExpression Method

Syntax         Arguments         Applies To         See Also

Writes an expression to a property. Available at design time and run time.

Syntax

Object.WriteExpression[cPropertyName, cExpression]

Arguments

cPropertyName   Specifies the name of the property to write the expression to.

cExpression   Specifies a character string that is written to the property sheet as an expression.


Applies To

CheckBox, Column, ComboBox, CommandButton, CommandGroup, Custom, EditBox, Form, FormSet, Grid, Header, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, Page, PageFrame, Shape, Spinner, TextBox, Timer, ToolBar


See Also

ReadExpression Method


WriteMethod Method

Syntax         Arguments         Remarks         Applies To         See Also

Writes the specified text to the specified method. Available at design time only.

Syntax

Control.WriteMethod(MethodName, MethodText)

Arguments

MethodName   Specifies the name of the method to write the specified text to.

MethodText   Specifies the text to write to the specified method to.

Remarks

This method will only set the method text for existing methods. If the object does not contain the method specified, Visual FoxPro generates an error.


Applies To

CheckBox, Column, ComboBox, CommandButton, CommandGroup, Custom, EditBox, Form, FormSet, Grid, Header, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, Page, PageFrame, Shape, Spinner, TextBox, Timer, ToolBar


See Also

ReadExpression Method
ReadMethod Method
WriteExpression Method


WROWS( ) Function

Syntax         Returns         Arguments         Remarks         See Also

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

Syntax

WROWS([WindowName])

Returns

Numeric

Arguments

WindowName   Specifies the window for which WROWS( ) returns the number of rows. In Visual FoxPro, you can also specify the name of a toolbar.

In Visual FoxPro, the value returned by WROWS( ) depends on the font specified for the window. Most fonts can be displayed in a wide variety of sizes, and some are proportionally spaced. A row corresponds to the height of the current font. For more information, see Fonts Overview.

You can specify the name of a system window (the Command window, the Data Session window, a Browse window, and so on) in WROWS( ) if the system window has been opened and is visible or hidden. If you specify the name of a system window that is closed, FoxPro generates an error message. The Debug window is an exception. Once the Debug window has been opened, its name can be included in WROWS( ) if it is visible, hidden, or closed.

You can also include the empty string in WindowName to return the number of rows 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 WCOLS( ), which return window locations or sizes.

Remarks

If you don’t specify a window name, the number of rows in the active output window is returned. If no window is active, the number of rows in the main Visual FoxPro window is returned.


See Also

SCOLS( )
SROWS( )
WCOLS( )
WLCOL( )
WLROW( )


WTITLE( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Returns the title assigned to the active or specified window.

Syntax

WTITLE([WindowName])

Returns

Character

Arguments

WindowName   Specifies a window whose title WTITLE( ) returns. The title assigned to the window with the TITLE clause is returned if you include the name of a user-defined window created with DEFINE WINDOW.

When you issue BROWSE WINDOW to open a Browse window in a user-defined window, WTITLE( ) returns the title of the user-defined window if the Browse window doesn’t have a title. WTITLE( ) returns the title of the Browse window if the Browse window does have a title.

You can also use the empty string for WindowName to specify the main Visual FoxPro window.

Remarks

WTITLE( ) can be used to return a window’s title, which appears in the top border of the window. The title is returned for the active window if you omit WindowName. WTITLE( ) returns the empty string if the Debug, Trace or Command window is active or output is being directed to the main Visual FoxPro window.

Window Names and Titles   Names are assigned to user-defined windows, system windows, toolbars (in Visual FoxPro), and Browse windows in the following manner:

User-defined windows are assigned names when they are created with DEFINE WINDOW. There is a distinction between user-defined window names and titles. By default, user-defined windows don’t have titles. If the TITLE clause is included when the window is created, the specified title appears in the top border of the window, but isn’t the name of the window.

By default, each system window, which is part of the Visual FoxPro interface, derives its name from the title of the window. Examples of system windows include the Command window, the Data Session window, and the Trace window. In Visual FoxPro, each toolbar derives its name from the title of the toolbar.

Program and editing windows and the Label and Report Designer windows derive their names from the name of the file being created or modified.

A Browse window derives its name from the title of the window. The name and title of the Browse window is assigned in one of three ways: either by the default title assignment of the table alias, or by the window title (if any exists), or by the Browse title (if any exists).

By default, the Browse window name is the table alias.

To specify a system window and toolbar names in commands and functions, enclose the entire system window or toolbar name in quotation marks. For example, to hide the Report Controls toolbar in Visual FoxPro, issue the following command:

HIDE WINDOW "Report Controls"

Additional Notes on Window Names   If you are unsure of the name assigned to a window, check the Window menu. All window names are listed at the bottom of the Window menu.

Two windows exist if you issue BROWSE WINDOW WindowName. The Browse window is a separate window and takes on the attributes of the specified user-defined window. If a window is active when you issue BROWSE and you don’t include the WINDOW clause, the Browse window takes on the attributes of the active window. You can override this behavior by including NORMAL in BROWSE.

You can include window names that contain spaces in commands and functions that accept window names, such as MOVE WINDOW, DEACTIVATE WINDOW, and WONTOP( ), by specifying the part of the window name that begins with the first non-space character and continuing until the last non-space character is encountered.

For example, a Browse window with the name Invoice Entry can be moved with this command:

MOVE WINDOW invoice BY 1,1

The names of user-defined windows cannot contain spaces, but the names of Browse and system windows can.


See Also

ACTIVATE WINDOW
DEFINE WINDOW
WEXIST( )
WLAST( )
WONTOP( )
WOUTPUT( )
WREAD( )


WVISIBLE( ) Function

Syntax         Returns         Arguments         Remarks         See Also

Determines if the specified window has been activated and isn’t hidden.

Syntax

WVISIBLE(WindowName)

Returns

Logical

Arguments

WindowName   Specifies the name of the window WVISIBLE( ) evaluates. In Visual FoxPro, you can also specify the name of a toolbar. You can also include the empty string in WindowName to specify the main Visual FoxPro window.

Remarks

WVISIBLE( ) returns true (.T.) if the specified window is shown or activated and isn’t hidden. Windows are shown and activated with SHOW WINDOW and ACTIVATE WINDOW.

WVISIBLE( ) returns false (.F.) if the window has not been activated, has been hidden with HIDE WINDOW, has been deactivated with DEACTIVATE WINDOW, or doesn’t exist.


See Also

ACTIVATE WINDOW
DEFINE WINDOW
WEXIST( )
WONTOP( )
WOUTPUT( )


YEAR( ) Function

Syntax         Returns         Arguments         Remarks         Example         See Also

Returns the year from the specified date or datetime expression.

Syntax

YEAR(dExpression | tExpression)

Returns

Numeric

Arguments

dExpression   Specifies a date expression from which YEAR( ) returns the year. dExpression can be a function that returns a date, or a Date-type memory variable, array element, or field. It can also be a literal date string, such as {06/06/95}.

tExpression   Specifies a datetime expression from which YEAR( ) returns the year.

Remarks

YEAR( ) always returns the year with the century. The CENTURY setting (ON or OFF) doesn’t affect the returned value.


YEAR( ) Function Example

CLEAR

? YEAR(DATE( ))


See Also

DATE( )
DATETIME( )
DOW( )
SET CENTURY


ZAP Command

Syntax         Arguments         Remarks         See Also

Removes all records from a table, leaving just the table structure.

Syntax

ZAP
[IN nWorkArea | cTableAlias]

Arguments

IN nWorkArea   Specifies the work area of the table in which all records are removed.

IN cTableAlias   Specifies the alias of the table in which all records are removed.

If you omit nWorkArea and cTableAlias, all records are removed in the table in the currently selected work area.

Remarks

Issuing ZAP is equivalent to issuing DELETE ALL followed by PACK, but ZAP is much faster.

If SET SAFETY is ON, Visual FoxPro asks if you would like to remove the records from the current table.

Issuing ZAP does not cause a Delete trigger to occur. For more information about creating triggers for a table, see CREATE TRIGGER.

Caution   Records zapped from the current table cannot be recalled.


See Also

CREATE TRIGGER
DELETE
PACK


ZoomBox Property

Syntax         Settings         Applies To         See Also

Specifies whether a form has a zoom box. Available at design time; read-write at run time.

Syntax

Object.ZoomBox = lExpr

Settings

lExpr   The settings for the ZoomBox property are:

Setting	Description
True (.T.)	(Default) A zoom box appears in the upper-right corner of the form.
False (.F.)	No zoom box appears in the form.


Applies To

Form


See Also

BorderStyle Property
SizeBox Property


ZOOM WINDOW Command

Syntax         Arguments         Remarks         Example         See Also

Changes the size and position of a user-defined window or a Visual FoxPro system window.

Syntax

ZOOM WINDOW WindowName MIN | MAX | NORM
[AT nRow1, nColumn1 | FROM AT nRow1, nColumn1
[SIZE AT nRow2, nColumn2 | TO nRow2, nColumn2]]

Arguments

WindowName   Specifies the name of the window whose size you want to change.

MIN   Reduces the window to minimum size.

In Visual FoxPro for Windows, the window is reduced to an icon.

All system windows can be reduced to a minimum size in Visual FoxPro for Windows. Visual FoxPro system windows must be open in the main Visual FoxPro window or a user-defined window before they can be minimized.

A user-defined window can be minimized after it is defined. It doesn’t have to be activated before you change its size.

MAX   Expands a window to fill the main Visual FoxPro window, the Windows desktop, or a user-defined window. If a child window is placed in a parent window and the child window is maximized, it fills the parent window. If any of the additional ZOOM WINDOW clauses (AT, SIZE, TO, or FROM) are included with MAX, MAX is ignored.

Only user-defined windows defined with ZOOM can be expanded to maximum size.

NORM   Returns a window to its original size after it has been minimized or maximized. NORM can also be used to move a window without changing its size. Use ZOOM WINDOW NORM without any additional clauses to return a minimized or maximized window to its original size and location.

AT nRow1, nColumn1 | FROM nRow2, nColumn2   You can specify the placement of a window by including the AT or FROM clause.

ZOOM WINDOW WindowName NORM AT AT nRow1, nColumn1 restores a minimized or maximized window to its original size and places it at the specific location. The AT nRow1, nColumn1 coordinates specify where the upper-left corner of the window is placed. A window’s location can also be changed with MOVE WINDOW.

In Visual FoxPro for Windows, if NORM is included, the upper-left corner of the window is placed in the main Visual FoxPro window at the location specified with AT nRow1, nColumn1. If MIN is included, AT and FROM are ignored and the window is displayed as an icon in the lower portion of the main Visual FoxPro window. If MAX is included, AT and FROM are ignored and the window is expanded to fill the main Visual FoxPro window.

In Visual FoxPro for Windows, if the window is created with the IN DESKTOP clause, the upper-left corner of the window is placed in the Windows desktop at the location specified with AT nRow1, nColumn1. If MIN is included, AT and FROM are ignored and the window is displayed as an icon in the lower portion of the Windows desktop. If MAX is included, AT and FROM are ignored and the window is expanded to fill the Windows desktop.

SIZE AT nRow2, nColumn2 | TO nRow2, nColumn2   You can also specify a window size for a window by including SIZE or TO. If SIZE is included, the window size is nRow2 rows high and nColumn2 columns wide. If the TO clause is included, the upper-left corner of the window remains in its current position and the lower-right corner of the window is placed at the position specified with nRow2, nColumn2.

Remarks

In Visual FoxPro for Windows, windows can be reduced to a minimum size, enlarged to fill the entire main Visual FoxPro window, or sized anywhere in between.

If you create a user-defined window with DEFINE WINDOW and the IN DESKTOP clause in Visual FoxPro for Windows, the window you create can be enlarged to fill the entire desktop.

In Visual FoxPro for Windows, windows can be zoomed directly from minimum to maximum size and vice versa.

When zooming a window, you can specify where to place the resized window in the main Visual FoxPro window or a user-defined window.

To zoom a system window, enclose the entire system window name in quotation marks. For example, to maximize the Command window, issue the following command:

ZOOM WINDOW 'Command Window' MAX

You can use ZOOM WINDOW to resize all system windows except the Filer, the Calculator, and the Puzzle.


ZOOM WINDOW Command Example

In the following example, a Browse window is opened for the customer table. The Browse window is minimized. The Browse window is then returned to its default size. It is then minimized again at a specific location. The Browse window is then enlarged to a specific size and is maximized.

CLEAR ALL

CLEAR

CLOSE DATABASES

OPEN DATABASE (HOME( ) + 'samples\data\testdata')

USE customer  && Opens Customer table

BROWSE NORMAL NOWAIT

IF _DOS OR _WINDOWS

ZOOM WINDOW customer MIN

WAIT WINDOW TIMEOUT 3 ;

'MIN clause - This window will timeout. Please wait.'

ENDIF

ZOOM WINDOW customer NORM

WAIT WINDOW TIMEOUT 3 ;

'NORM clause - This window will timeout. Please wait.'

IF _DOS OR _WINDOWS

ZOOM WINDOW customer MIN AT 10,10

WAIT WINDOW TIMEOUT 3 ;

'MIN AT 10,10 clause - This window will timeout. Please wait.'

ENDIF

ZOOM WINDOW customer NORM AT 1,1 SIZE 22,25

WAIT WINDOW TIMEOUT 3 ;

'NORM & SIZE clauses - This window will timeout. Please wait.'

ZOOM WINDOW customer NORM FROM 10,10 TO 22,70

WAIT WINDOW TIMEOUT 3 ;

'NORM & TO clauses - This window will timeout. Please wait.'

ZOOM WINDOW customer MAX

WAIT WINDOW TIMEOUT 3 'MAX clause - This window will timeout. Please wait.'

CLEAR ALL


See Also

ACTIVATE WINDOW
DEFINE WINDOW
SIZE WINDOW


ZOrder Method

Syntax         Settings         Remarks         Applies To         See Also

Places a specified form or control at the front or back of the z-order within its graphical level. Places a control contained by the ToolBar object at the front or back of the controls array that determines the order in which controls appear in the toolbar.

Syntax

[Object.]ZOrder([nOrder])

Settings

nOrder   Specifies an integer indicating the position of the object relative to other objects. If you omit nOrder, the setting is 0.

Setting	Description
0	(Default) The object is positioned at the front of the z-order.
1	The object is positioned at the back of the z-order.
Remarks

There are two graphical layers associated with objects. The back layer is the drawing space, where the results of the graphics methods appear, and the front layer is the object layer. The contents of one layer covers the contents of the layer behind. The ZOrder method arranges objects only within the layer where the object appears.

Note   For a Page object, the ZOrder method does not affect the PageOrder property setting. ZOrder only determines the Page that is on top and active.

For more information about using controls, see Chapter 10, “Using Controls,” in the Developer’s Guide.


Applies To

CheckBox, ComboBox, CommandButton, CommandGroup, Container Object, Control Object, EditBox, Form, Grid, Image, Label, Line, ListBox, OLE Bound Control, OLE Container Control, OptionButton, OptionGroup, Page, PageFrame, _SCREEN, Shape, Spinner, TextBox, ToolBar


See Also

PageOrder Property


Data and Field Types

See Also

All Visual FoxPro data has a type — a description of the permissible values and range and size of those values. Once you specify the type of data you are using, Visual FoxPro can efficiently store and manipulate the data.

Variables and arrays hold a subset of the available Visual FoxPro data types. Additional data types are available only for fields in a table. To add a field of a specific type to a table programmatically, specify the field type with a letter abbreviation. For more information, see the description for FieldType in CREATE TABLE - SQL.

Visual FoxPro Data Types

Data type	Description	Size	Range
Character	Any text	1 byte per character to 254	Any characters
Currency	Monetary amounts	8 bytes	– 922337203685477.5808 to 922337203685477.5807
Date	Chronological data consisting of month, year, and day	8 bytes	01/01/100 to 12/31/9999
DateTime	Chronological data consisting of month, year, day, and time	8 bytes	01/01/100 to 12/31/9999, plus 00:00:00 a.m. to 11:59:59 p.m.
Logical	Boolean value of true or false	1 byte	True (.T.) or False (.F.)
Numeric	Integers or fractions	8 bytes in memory; 1 to 20 bytes in table	– .9999999999E+19 to .9999999999E+20
Visual FoxPro Field Types

Field type	Description	Size	Range
Double	A double-precision floating-point number	8 bytes	+/–4.94065645841247E-324 to +/–8.9884656743115E307
Float	Same as Numeric	8 bytes in memory; 1 to 20 bytes in table	– .9999999999E+19 to .9999999999E+20
General	Reference to an OLE object	4 bytes in table	Limited by available memory
Integer	Integer values	4 bytes	–2147483647 to 2147483646
Memo	Reference to a block of data	4 bytes in table	Limited by available memory
Character (Binary)	Any character data you want to maintain without change across code pages	1 byte per character to 254	Any characters
Memo (Binary)	Any memo field data you want to maintain without change across code pages	4 bytes in table	Limited by available memory


See Also

ALTER TABLE - SQL Command
Character Data Type
CREATE TABLE - SQL Command
Currency Data Type
Date Data Type
DateTime Data Type
Double Field Type
Float Field Type
General Field Type
Logical Data Type
Memo Field Type
Numeric Data Type


Character Data Type

See Also

Choose the Character data type when you want to include letters, numbers, spaces, symbols, and punctuation. Character fields or variables store text information such as names, addresses, and numbers that are not used in mathematical calculations.

For more information about the specifications for this type, see the tables of Data and Field Types.


See Also

Character Operators
CREATE TABLE - SQL Command
Creating Character Expressions
Data and Field Types


Currency Data Type

See Also

Use the Currency data type instead of Numeric for monetary values. If you specify more than four decimal places in a currency expression, Visual FoxPro rounds to four places before evaluating the expression. For more information about the specifications for this type, see the tables of Data and Field Types.

To assign the Currency data type, use the dollar sign:

money = $50.33

moremoney = $675.43886

In the preceding example, the variable moremoney is internally rounded to 675.4389.


See Also

CREATE TABLE - SQL Command
Data and Field Types


Date Data Type

See Also

Choose the Date data type to store dates without time values. A Date value is stored in “yyyymmdd” character format. For more information about the specifications for this type, see the tables of Data and Field Types.

To assign the Date values, enclose the date value in braces:

dLastAppointment = {10/14/94}

To assign a blank Date value, use braces alone or enclosing a space or forward slash, as in the following examples.

STORE {} to dBlankdate0

STORE { } to dBlankdate1

STORE {/} to dBlankdate2

In both Date and DateTime data types, the following rules apply:

•	{00:00:00AM}is equivalent to {12:00:00AM}, Midnight.

•	{00:00:00PM}is equivalent to {12:00:00PM}, Noon.

•	{00:00:00}to {11:59:59} is equivalent to {12:00:00AM} to {11:59:59AM}.

•	{12:00:00}to {23:59:59} is equivalent to {12:00:00PM} to {11:59:59PM}.


See Also

CREATE TABLE - SQL Command
Creating Date Expressions
Data and Field Types
Date and DateTime Operators


DateTime Data Type

See Also

Choose the DateTime data type to store values that are either dates or times, or both. A DateTime value is stored in eight bytes — two four-byte integers. The first four bytes represent the date. The remaining four bytes represent the time in milliseconds from midnight. DateTime values can contain both a date and a time, or only a date or only a time. If you specify no date value, Visual FoxPro adds a default date of December 30, 1899. If you specify no time value, Visual FoxPro adds a default time of midnight. For more information about the specifications for this type, see the tables of Data and Field Types.

In both Date and DateTime data types, the following rules apply:

•	{00:00:00AM}is equivalent to {12:00:00AM}, Midnight.

•	{00:00:00PM}is equivalent to {12:00:00PM}, Noon.

•	{00:00:00}to {11:59:59} is equivalent to {12:00:00AM} to {11:59:59AM}

•	{12:00:00}to {23:59:59} is equivalent to {12:00:00PM} to {11:59:59PM}


See Also

CREATE TABLE - SQL Command
Creating Date Expressions
Data and Field Types
Date and DateTime Operators


Double Field Type

See Also

Use the Double data type instead of Numeric when you need more accuracy, a fixed amount of storage in your table, or true floating-point values. For more information about the specifications for this type, see the tables of Data and Field Types.


See Also

Creating Numeric Expressions
Numeric Operators


Float Field Type

See Also

Included for compatibility reasons, the Float data type is functionally equivalent to Numeric. For more information about the specifications for this type, see the tables of Data and Field Types.


See Also

CREATE TABLE - SQL Command
Creating Numeric Expressions
Data and Field Types
Numeric Operators


General Field Type

See Also

Use the General field type to store OLE objects. The General field contains a ten-byte reference to the actual contents of the field: a spreadsheet, a word processor document, or a picture, created by another application. The actual type and amount of data, however, depends on the OLE server that creates the object and whether you link or embed the OLE object. If you link an OLE object, your table contains only the reference to the data and to the application that created it. If you embed an OLE object, the table contains a copy of the data as well as a reference to the application that created it. The size of a General field is limited only by the amount of available disk space.  For more information about the specifications for this type, see the tables of Data and Field Types.


See Also

APPEND GENERAL Command
CREATE TABLE - SQL Command
Data and Field Types
General Field Window


Integer Field Type

See Also

Use the Integer field type for non-decimal numeric values where performance and table storage limitations are especially important.

In tables, the integer field type is stored as a 4-byte binary value, consequently it requires less memory than other numeric data types. As a binary value, it requires no ASCII conversion. For more information about the specifications for this type, see the tables of Data and Field Types.


See Also

CREATE TABLE - SQL Command
Creating Numeric Expressions
Data and Field Types
Numeric Operators


Logical Data Type

See Also

Use the Logical data type when you want an efficient way to store data that has only two values. Logical data is stored as true (.T.) or false (.F.). For more information about the specifications for this type, see the tables of Data and Field Types.


See Also

CREATE TABLE - SQL Command
Data and Field Types
Logical Operators


Memo Field Type

See Also

Use the Memo field type to store blocks of data. The Memo field contains a ten-byte reference to the actual contents of the memo. The actual size of memos, however, depends on the amount of data you enter into them. Data from Memo fields of records in a table are stored in a separate file with the same name as the table and an .FPT extension. Memo fields are limited only by the amount of available disk space. For more information about the specifications for this type, see the tables of Data and Field Types.


See Also

CREATE TABLE - SQL Command
Data and Field Types
MODIFY MEMO Command


Numeric Data Type

See Also

Use Numeric data to indicate magnitude. Numeric values contain digits from 0 to 9, and, optionally, a sign and a decimal point. For more information about the specifications for this type, see the tables of Data and Field Types.

Visual FoxPro also supports hexadecimal values for numeric data. For example, the decimal value 255 can be represented as 0xFF.


See Also

CREATE TABLE - SQL Command
Creating Numeric Expressions
Data and Field Types
Numeric Operators


Storing Data

See Also

The following table summarizes the scope differences between data containers.

Container	Scope	Example
Constants	Private	#DEFINE ERRSTR "Error!"
Variables	Public, private, or local	Var = 7
Arrays	Public, private, or local	ArrayName[1,1] = "John Brown"
Fields	Permanent storage, accessible while the table containing the records is open	REPLACE name WITH "John Brown"
Object Properties	Referenced through the object and the object’s container hierarchy	txtCustomer.Value = "John Brown"


See Also

Arrays
Constants
Fields
LOCAL Command
Objects
PRIVATE Command
PUBLIC Command
Records
Variables


Constants

See Also

A constant is a named item that retains its value throughout all operations. The value , or 3.1415926535, is an example of a numeric constant; the letter A is an example of a character constant.

To assign a value to a constant

•	Use the #DEFINE preprocessor directive.

In the following example, the constant TABLERR1 is defined as a character string.

#DEFINE TABLERR1 "This table is not available. Please try later."

To release a defined constant

•	Use the #UNDEFINE preprocessor directive.

#UNDEF TABLERR1


See Also

#DEFINE ... #UNDEF Preprocessor Directive


Variables

See Also         Example

A variable is a memory location whose value can change throughout the operation of a program. A variable can contain any data type value. You can change the value of a variable at any time.

Variables exist only while an application is running or in the Visual FoxPro session in which they are created. To specify the scope of a variable, use the LOCAL, PRIVATE, and PUBLIC keywords.

To create a variable, store a value to a named Visual FoxPro element using the STORE command or the  = (equal) operator.


Variables Examples

The following examples are simple assignment statements that are functionally equivalent.

STORE 7 TO nVar

nVar = 7

The following example uses a variable, nInc, to hold the value of a loop counter. Visual FoxPro assigns a new value to the variable during each loop.

FOR nInc = 1 TO 10

? nInc

ENDFOR

The following example uses a variable, cName, to hold the value of the Firstname field from the Customer table.

USE Customer

STORE Customer.Firstname TO cName


See Also

= Command
FOR ... ENDFOR Command
LOCAL Command
PRIVATE Command
PUBLIC Command
STORE Command


Arrays

See Also

An array is an ordered series of data values, called elements, that are referenced by number. Because arrays exist in memory, they provide fast data access and easy manipulation. You can easily specify, locate, or manipulate elements in an array.

Create an array with the DIMENSION or DECLARE command and assign value to each element by identifying the element by array name and position. The following example creates a two-dimensional array of five rows and two columns, then assigns a value to the second column of the first row:

DIMENSION ArrayName[5,2]

ArrayName[1,2] = 966789

You can also use SCATTER, GATHER, COPY TO ARRAY, and APPEND FROM ARRAY to move field values to and from array elements.


See Also

APPEND FROM ARRAY Command
COPY TO ARRAY Command
DECLARE Command
DIMENSION Command
GATHER Command
SCATTER Command


Fields

See Also

A field is a named location in a record that contains a particular type of data. Fields can be any Visual FoxPro data type or field type.

A field’s data type is specified at design time in the Table Designer, or at run time with the CREATE TABLE command.


See Also

CREATE TABLE - SQL Command
Records


Records

See Also

A record is a set of fields in a table. Records can have up to 255 fields. All records in a table contain the same fields. Though the content of fields differ from record to record, the size of a field is the same for all records in a table. The data type for each field is the same for all records in a table.

To create records

•	Use the INSERT - SQL command or the APPEND command.


See Also

APPEND Command
Fields
INSERT - SQL


Objects

See Also

An object is an instance of a class. A class is a description of the data and behavior characteristics of a group of objects. Visual FoxPro objects can be forms, form sets, or controls. Use Visual FoxPro objects to implement consistent, dependable behavior throughout your application, to reduce the amount of code, and to increase the reusability of code.

To create objects

•	Use the Form Designer.

– or –

•	Use the CREATEOBJECT( ) function.


See Also

CREATEOBJECT( ) Function


Operators

See Also

Operators allow you to manipulate data of the same type. Visual FoxPro operators are grouped by the following data types and functions:

•	Character Operators

•	Date and DateTime Operators

•	Logical Operators

•	Relational Operators

•	Numeric Operators


See Also

Character Operators
Date and DateTime Operators
Logical Operators
Numeric Operators
Relational Operators


Character Operators

See Also

You can join and compare character data using the character operators +, -, and $. The following table lists the character expression operators in order of precedence.

Character Operators

Operator	Action	Code
+	Concatenation. Joins two strings, a string and a field, or a string and a variable.	? 'Good ' + 'morning'
-	Concatenation. Removes trailing blanks from the element preceding the operator then joins two elements.	? customer.first - customer.last
$	Comparison. Seeks one character expression within another.	? 'father' $ 'grandfather' ? 'Main' $ customer.address


See Also

$ Operator

Character Data Type


Date and Time Operators

See Also

The following operators act on dates and times.

Date and Time Operators

Operator	Action	Code
+	Addition	tNewTime = tTime1 + nSeconds dNewDate = dDate1 + nDays
–	Subtraction	nSeconds = tTime1 - tTime2 tNewTime = tTime1 - nSeconds dNewDate = dDate1 - nDays


See Also

Date Data Type
DateTime Data Type


Logical Operators

See Also

The following table lists the logical operators in order of precedence.

Logical Operators

Operator	Action	Code
( )	Expression groups	cVar AND (cVar2 AND cVAR3)
NOT, !	Logical negative	IF NOT cVarA = cVarB IF ! nVar1 = nVar2
AND	Logical AND	lVar0 AND lVar9
OR	Logical inclusive OR	lVarX OR lVarY


See Also

BITAND( ) Function
BITNOT( ) Function
BITOR( ) Function
BITXOR( ) Function
Relational Operators


Relational Operators

See Also

The following table lists the relational operators.

Relational Operators

Operator	Action	Code
<	Less than	? 23 < 54
>	Greater than	? 1 > 2
=	Equal to	? cVar1 = cVar
<>, #, !=	Not equal to	? .T. <> .F.
<=	Less than or equal to	? {01/01/92} <= {01/01/92}
>=	Greater than or equal to	? 32 >= nHisAge
==	Character string comparison	? status == "Open"


See Also

Logical Operators


Numeric Operators

See Also

The following table lists the numeric operators in order of precedence.

Numeric Operators

Operator	Action	Code
( )	Group subexpressions	(4-3) * (12/nVar2)
**, ^	Exponentiation	? 3 ** 2 ? 3 ^ 2
*, /	Multiplication and division	? 2 * 7 ? 14 / 7
%	Modulus (remainder)	? 15 % 4
+, -	Addition and subtraction	? 4 + 15


See Also

% Operator
Currency Data Type
Double Field Type
Float Field Type
Numeric Data Type


Building Expressions

See Also

Visual FoxPro expressions combine data and operators to create a value of a given data type. Whenever you need a value of a given data type, you can usually also supply an expression.

To combine	See
Character data	Creating Character Expressions
Date or time data	Creating Date Expressions
Numeric data	Creating Numeric Expressions
Logical values	Creating Logical Expressions


See Also

Creating Character Expressions
Creating Date Expressions
Creating Numeric Expressions
Creating Logical Expressions
Creating Name Expressions
Creating Visual FoxPro Names
Macro Substitution


Creating Visual FoxPro Names

See Also

Data containers and some parameters to commands and functions require a name. When you create a name in Visual FoxPro, apply the following rules:

•	Use only letters, underscores, and numbers.

•	Begin the name with a letter or underscore.

•	Use 1 to 128 characters, except for field names in free tables and index tags — those can be 10 characters at most.

•	Avoid words reserved by Visual FoxPro.

File names follow your operating system’s conventions.


See Also

Creating Name Expressions


Creating Character Expressions

See Also

Compose character expressions by combining character operators with the following Visual FoxPro elements:

•	Character fields.

•	Functions that return character values.

•	Variables and array elements that contain character data.

•	Character constants, called string literals.

You can embed quotation marks(" and ') in a character string by enclosing the character string within square brackets ([ ]):

STORE [Robert's Diner] TO cCompanyName

STORE [See the "Sunday Special"] TO cBanner

You can also embed quotation marks by enclosing the character string with quotation marks of the alternate type:

STORE "Robert's Diner" TO cCompanyName

STORE 'See the "Sunday Special"' TO cBanner


See Also

Character Operators


Creating Date Expressions

See Also

Compose date expressions by combining date operators with the following Visual FoxPro elements:

•	Date or DateTime fields.

•	Functions that return dates or dates and times.

•	Variables and array elements that contain dates or times.

•	Date and DateTime constants.

Visual FoxPro treats an invalid date as an empty date.


See Also

Date Operators


Creating Numeric Expressions

See Also

Compose numeric expressions by combining numeric operators with the following Visual FoxPro elements:

•	Numeric type fields.

•	Functions that return numeric values.

•	Variables and array elements that contain numeric data.

•	Numeric constants.


See Also

Numeric Operators


Creating Logical Expressions

See Also

Compose logical expressions by combining logical operators with the following Visual FoxPro elements:

•	Logical type fields.

•	Functions that return logical values.

•	Variables and array elements that contain logical values.

•	Any expression that evaluates to a logical value.

Visual FoxPro evaluates logical expressions from left to right, and only for as long as necessary.


See Also

Logical Operators


Creating Name Expressions

See Also

Many Visual FoxPro commands and functions require that you supply a name. Although a name cannot be a variable or an array element, you can create a name expression that substitutes the value of a Character variable or array element as the name.

When you store the name to the variable or array element, you can substitute the name into a command or function by enclosing the variable in parentheses. To use a list of names, separate the names with commas. A name is not an expression, a variable or array element, or a field. A name should not be surrounded by quotation marks. Otherwise, names follow the Visual FoxPro naming rules described in the section Creating Visual FoxPro Names.

For example, the REPLACE command requires a field name. You can store a field name to a variable and use a name expression in REPLACE where the field name occurs:

STORE 'city' TO cVarCity

REPLACE (cVarCity) WITH 'Paris'


See Also

Macro Substitution
Visual FoxPro Naming Rules


Macro Substitution

See Also

You can replace names with variables by using macro substitution. To use macro substitution, place an ampersand (&) before the variable to tell Visual FoxPro to use the value of the variable as a name, and use a period (.) to end the macro substitution expression.

For example, the following print statement produces “FoxPro”:

x = "Fox"

? "&x.Pro"


See Also

Creating Name Expressions


Manipulating Data

See Also

The expressions you can build give you full access to the power of manipulating data in Visual FoxPro. You can extend the power with user-defined functions, manipulate fields, records and arrays, use classes and objects, and manipulate null values.

To use	See
Arrays	Working with Arrays
Classes	Working with Classes and Objects
Fields	Working with Fields and Records
Null Values	Handling Null Values
Objects	Working with Classes and Objects
Records	Working with Fields and Records
User-defined functions	Working with User-Defined Functions


See Also

Handling Null Values
Working with Arrays
Working with Classes and Objects
Working with Fields and Records
Working with User-Defined Functions


Working with User-Defined Functions

See Also

To create a function or a procedure, use the FUNCTION or PROCEDURE commands to assign a name to the function or procedure. Follow the first line with any number of statements. Use a PARAMETERS or LPARAMETERS statement as the first executable line of a stand-alone UDF that receives parameters. End a UDF that returns values to the calling program with a RETURN statement. You can call UDFs as procedures or as functions. You can pass up to 24 parameters to a UDF.


See Also

Calling a Function
Calling a Procedure
FUNCTION Command
PARAMETERS Command
Passing Parameters by Value or by Reference
PROCEDURE Command
RETURN Command


Calling a Procedure

See Also

To call a procedure

•	Use the DO command followed by the procedure name.

DO cMyUDF


See Also

DO Command
Working with User-Defined Functions


Calling a Function

See Also

To call a function

•	Use the = (equal) operator, followed by the function name and parentheses that contain any parameters you pass to the function.

=cMyUDF()

=cMyUDF(p1,p2)

If you omit the RETURN statement in a UDF, the default return value is true (.T.).


See Also

= Command
RETURN Command
Working with User-Defined Functions


Passing Parameters by Value or by Reference

See Also

You can pass variables or array elements as parameters by reference or by value. To change parameters passed to and returned from a UDF, pass by reference. To maintain the original value of parameters passed to a UDF, even if the UDF changes the values within the UDF, pass by value.

By default, Visual FoxPro passes parameters to UDFs by value. Objects are always passed by reference.


See Also

Passing Parameters by Reference
Passing Parameters by Value
Working with User-Defined Functions


Passing Parameters by Reference

See Also

You can pass parameters by reference every time or only in a specific instance.

To pass parameters by reference

•	Use the TO REFERENCE clause of the SET UDFPARMS command before calling the UDF:

– or –

•	Use the @ token to pass a variable or array by reference, as in the following example:

? "UDF value: " + STR(plusone(@nX))


See Also

Passing Parameters by Value
SET UDFPARMS Command
Working with User-Defined Functions


Passing Parameters by Value

See Also

You can pass parameters by value every time or only in a specific instance.

To pass parameters by value

•	Use the TO VALUE clause of the SET UDFPARMS command before calling the UDF:

 – or –

•	Use parentheses to pass a variable or array by value, as in the following example.

? 'UDF value: ' + STR(plusone((nX)))


See Also

Passing Parameters by Reference
SET UDFPARMS Command
Working with User-Defined Functions


Working with Fields and Records

See Also

You access data in fields by specifying one or more records that contain the target data. You can use the record pointer to access a particular record through the GOTO command or you can access fields in several records by identifying the records with a Scope, FOR, or WHILE clause in a command.

To	See
Specify a record range	Scope Clauses
Find records that match a logical condition	FOR Clauses
Operate on records while a logical condition is true	WHILE Clauses


See Also

Fields
FOR Clauses
GOTO Command
Records
Scope Clauses
WHILE Clauses


Scope Clauses

See Also

If a Visual FoxPro command has a Scope clause, you can specify a record range for the command to act on by replacing Scope with one of the clauses in the following table.

Scope clause	Effect
ALL	Command affects all records in the table.
NEXT nExpr	Command affects a range of records beginning at the current record and continuing for the specified number of records. For instance, the following example acts on the current record and the two following records:
	REPLACE status WITH "open" NEXT 3
RECORD nNumber	Command affects only the specified record number. The following example acts on record five.
	REPLACE status WITH "open" RECORD 5
REST	Command affects a range of records beginning with the current record and ending with the last record in the table. The following example stores a null value in the remaining records.
	REPLACE status WITH .NULL. REST


See Also

FOR Clauses
REPLACE Command
WHILE Clauses


FOR Clauses

See Also

A FOR clause causes a command to act on each record that meets the specified logical condition. FOR clauses have the following syntax:

FOR lExpr

The following example stores low balance in the alert field of all records that contain less than 500 in the total field.

REPLACE ALL alert WITH "low balance" FOR total < 500

The following table lists commands in which you can use a FOR clause.

Commands That Use FOR Clauses
APPEND FROM ARRAY	COUNT	LOCATE
APPEND FROM	DEFINE PAD	RECALL
AVERAGE	DELETE	REPLACE FROM ARRAY
BLANK	DISPLAY	REPLACE
BROWSE	EXPORT	REPORT
CALCULATE	FOR( )	SCAN...ENDSCAN
CHANGE	INDEX	SORT
COPY TO ARRAY	LABEL	SUM
COPY TO	LIST


See Also

REPLACE Command
Scope Clauses
WHILE Clauses


WHILE Clauses

See Also

A WHILE clause causes a command to act on each record as long as the logical expression evaluates to true (.T.). The first time the expression evaluates to false (.F.), the command ceases without attempting any remaining records. This expression is typically used with a table that’s been sorted or indexed on the field(s) included in the WHILE expression. For instance, the following example navigates an indexed table to locate the first record that meets the condition, then the REPLACE command acts on those records that meet the WHILE condition.

USE Mytable INDEX street

LOCATE FOR UPPER(street) = "MAIN"

REPLACE street WITH "Maine" WHILE UPPER(street) = "MAIN"

The following table lists commands in which you can use a WHILE clause.

Commands That Use WHILE Clauses
AVERAGE	COUNT	RECALL
BLANK	DELETE	REPLACE
BROWSE	DISPLAY	REPLACE FROM ARRAY
CALCULATE	EXPORT	REPORT
CHANGE	LABEL	SCAN ... ENDSCAN
COPY TO ARRAY	LIST	SORT
COPY TO	LOCATE	SUM


See Also

LOCATE Command
REPLACE Command


Working with Arrays

See Also

Arrays provide a way to quickly order information. Once information is in an array, you can easily search, sort, and perform other data manipulation. To get information to and from arrays, you transfer data to a table or transfer data from a table to an array.

Visual FoxPro makes no size or data type restrictions on array contents. The only restriction on size is the amount of memory available.

To transfer data from	See
Arrays to tables	Transferring Data from an Array to a Table
SQL statements to arrays	Arrays and SQL - SELECT
Tables to arrays	Transferring Data from a Table to an Array


See Also

Arrays and SQL - SELECT
Transferring Data from a Table to an Array
Transferring Data from an Array to a Table


Transferring Data from a Table to an Array

See Also

The following Visual FoxPro commands transfer data from a table to an array:

•	SCATTER transfers data from a single table record to an array.

•	COPY TO ARRAY transfers data from a series of records to an array.

•	SELECT - SQL can transfer the results of a query to an array.


See Also

Arrays and SQL - SELECT
COPY TO ARRAY Command
SCATTER Command
SELECT - SQL Command
Transferring Data From an Array to a Table


Transferring Data from an Array to a Table

See Also

The following Visual FoxPro commands transfer data from an array to a table:

•	GATHER transfers data from an array to a single table record.

•	APPEND FROM ARRAY adds new records to a table and fills the records with data from an array.

•	INSERT - SQL appends a single new record to a table and fills the record with data from an array.


See Also

APPEND FROM ARRAY Command
GATHER Command
INSERT - SQL Command
Transferring Data From a Table to an Array


Arrays and SELECT - SQL

See Also         Example

SELECT - SQL is a versatile command for querying tables and can direct query results to an array.

To send SELECT - SQL query results to an array, specify the INTO ARRAY clause with an array name. If the array doesn’t exist, it is automatically created. If the array does exist, it is redimensioned automatically to accommodate the query results.

Example

SELECT DISTINCT a.cust_id, a.company, b.amount ;

FROM customer a, payments b ;

WHERE a.cust_id = b.cust_id INTO ARRAY results

DISPLAY MEMORY LIKE results


See Also

SELECT - SQL Command


Working with Classes and Objects

See Also

Visual FoxPro provides two special operators for object programming: the dot operator (.) and the scope resolution operator (::). Visual FoxPro also adds commands that enable you to create a class, and to create and add objects to a class.

Operator, Command, Function	Description
.  (Dot operator)	Scopes objects to their parents and properties, events, and methods to objects.
:: (Scope resolution operator)	Calls a parent class method from within the subclass.
CREATEOBJECT( )	Creates an object from a class, a subclass, or an OLE object.
DEFINE CLASS with ADD OBJECT clause	Creates a class definition. The ADD OBJECT clause adds an object based on an existing class or subclass at design time.
GETOBJECT( )	Returns a reference to an OLE object.
For more information about using classes and objects, see Chapter 3, “Object-Oriented Programming,” in the Developer’s Guide.


See Also

:: Scope Resolution Operator
CREATEOBJECT( ) Function
DEFINE CLASS Command
GETOBJECT( ) Function


Handling Null Values

See Also

Visual FoxPro provides support for null values. This support simplifies the task of representing unknown data and makes it easier to work with Microsoft Access or SQL databases that may contain null values.

Null values are:

•	Equal to the absence of any value.

•	Different than zero, the empty string (""), or blank.

•	Sorted ahead of other data.

•	Propagated in calculations and most functions.

Null values affect the behavior of commands and functions, logical expressions, and parameters.

To use null values in	See
Commands and functions	Behavior of Null Values in Commands and Functions
Expressions	Behavior of Null Values in Logical Expressions
Parameters	Using NULL as a Parameter


See Also

Behavior of Null Values in Logical Expressions
Behavior of Null Values in Commands and Functions
EMPTY( ) Function
ISBLANK( ) Function
ISNULL( ) Function
Using NULL as a Parameter


Behavior of Null Values in Commands and Functions

See Also

The following table describes how commands and functions interpret null values.

Data type	Behavior
Logical	Most logical expressions that evaluate to .NULL. return .NULL. or generate an error. EMPTY( ), ISBLANK( ), and ISNULL( ) are exceptions.
Numeric	Numeric expressions that evaluate to .NULL. return .NULL. A numeric function evaluates to .NULL. when passed a null value.
Date	Date expressions containing null values return .NULL.


See Also

Date Data Type
EMPTY( ) Function
ISBLANK( ) Function
ISNULL( ) Function
Logical Data Type
Handling Null Values
Numeric Data Type


Behavior of Null Values in Logical Expressions

See Also

Null values persist through logical expressions in most cases. The following table describes the behavior of null values in logical expressions.

Logical  expression	Result if x=TRUE	Result if x=FALSE	Result if x=.NULL.
x AND .NULL.	.NULL.	FALSE	.NULL.
x OR .NULL.	TRUE	.NULL.	.NULL.
NOT x	FALSE	TRUE	.NULL.
When a conditional expression encounters a null value, the condition fails, because .NULL. is not true (.T.). For example, a FOR clause that evaluates to .NULL. is treated as false (.F.). Note that null values are treated as .NULL. until the entire expression is evaluated.


See Also

FOR Clauses
Handling Null Values


Using NULL as a Parameter

See Also

The following general rules apply to null values passed to commands and functions:

•	Commands generate errors when passed a null value.

•	Functions that accept .NULL. as a valid value propagate .NULL. to the result.

•	Functions that accept parameters that could be numeric values generate an error if you supply .NULL. for those parameters.

•	ISBLANK( ), ISDIGIT( ), ISLOWER( ), ISUPPER( ), ISALPHA( ), and EMPTY return false (.F.) when passed a null value. ISNULL( ) returns true (.T.) when passed a null value.

•	The commands INSERT - SQL and SELECT - SQL process null values through the IS NULL and IS NOT NULL clauses and, in the case of INSERT, UPDATE, and REPLACE, place null values into records.

•	SQL Aggregate functions ignore instead of propagate null values.

•	Visual FoxPro aggregate functions only propagate .NULL. if all supplied values are null values; otherwise, any null value is ignored.


See Also

EMPTY( ) Function
INSERT - SQL Command
ISALPHA( ) Function
ISBLANK( ) Function
ISDIGIT( ) Function
ISLOWER( ) Function
ISNULL( ) Function
ISUPPER( ) Function
REPLACE Command
SELECT - SQL Command
SQL Commands Overview
UPDATE Command


Class Browser Properties

See Also

The following properties are associated with the Class Browser. For more information about the values for these properties, see Initial Values of Class Browser Properties. For more information about property naming conventions, see Variable Naming Conventions.

Note   Properties marked as “Reference only” or “Internal use only” are maintained internally and used by the Class Browser. Avoid changing the value of reference-only properties; you might cause errors in the Class Browser.

lActive   Reference only. Returns the active status of the Class Browser. If the Class Browser has the focus, the value is true (.T.).

cAlias   Returns the alias of the work area within the Class Browser data session associated with the selected class in the class list. By default, the Class Browser’s private data session opens at least two table aliases: BROWSER and METADATA. The BROWSER alias is for BROWSER.DBF and is shared for all instances. The METADATA alias is for the class library (.VCX) or form (.SCX) open in the Class Browser. If more than one file is open, the METADATA alias is incremented once for each open file.

cAddInMethod   Reference only. Returns the method name that called the external add-in being executed and clears when execution is complete. When an add-in is executed, this property contains the name of the method that called the add-in.

lAddInMode   Returns the status of a Class Browser add-in. If true (.T.), the add-in is called; if false (.F.), the add-in is complete.

lAddInTrace   Returns the status of the display trace mode that monitors the events of an add-in. If true (.T.), messages describing the events of an add-in are sent to the Visual FoxPro main window.

nAtPos   Internal use only. The default value is 0.

lAutoExpand   Determines whether the class list expands or collapses automatically when it is refreshed. If the value is true (.T.), the class list automatically expands or collapses the class trees in the outline. If false (.F), the class list outline does not expand or collapse. The default value is true (.T.).

cBaseClass   Reference only. Returns the name of the base class of the selected class in the class list.

cBrowserTable   Reference only. Returns the full path of the BROWSER.DBF registration table.

lBusyState   Reference only. Returns the status of the refresh operation for the Class Browser. If true (.T.), the refresh operation is in progress.

cClass   Reference only. Returns the name of the selected class in the class list.

nClassCount   Reference only. Returns the total number of items in the class list. The default value is 0.

cClassLibrary   Reference only. Returns the name of the class library for the selected class in the class list.

aClassList   Reference only. A two-dimensional array of values associated with a class library (.VCX) or form (.SCX) file in the current class list. Each file in the list has its own alias. For example, if the class list displays two files, the aliases are METADATA1 and METADATA2.

The array contains the following formation.

aClassList position	Setting
[nIndex,1]	Name of a class.
[nIndex,2]	Associated metadata record number.
[nIndex,3]	Outline indentation level.
[nIndex,4]	Name of the file containing the parent class.
[nIndex,5]	Name of the parent class.
[nIndex,6]	Name of the file containing the class.
[nIndex,7]	Name of the class icon file.
[nIndex,8]	The BaseClass of the class.
nClassListIndex   Reference only. Returns the position of the selected class in the Class list. The value for the first item is 0. The default value is – 1.

nClassTimeStamp   The TimeStamp value (from the VCX/SCX TimeStamp field) for the selected class.

cClassType   Reference only. Returns the current filter on the Class list as specified in the ClassType box.

tcClassType   The initial Type filter for the Class list.

tcDefaultClass   Reference only. Returns the value or reference of the second parameter passed to BROWSER.APP. For example, if you open the Class Browser by typing the following code, this property returns “baseform.”

DO (_BROWSER) WITH "wizstyle.vcx","baseform"

lDescriptions   If true (.T.), descriptions are displayed for classes and members.

lDisplayHierarchyError   Whether or not to display an error message if classes without valid ParentClasses are loaded in the Class Browser. The default is true (.T.).

nDisplayMode   Reference only. Returns the display mode specified by the display mode option group: 1 – hierarchical or 2 – alphabetical. The default value is 1.

lDragDrop   For internal use only. Whether or not a drag operation is in progress.

cDragIcon   Returns the current cursor file for the drag icon during a drag operation.

lEmptyFilter   If true (.T.), empty methods are displayed in the Members list. The default is false (.F.).

lError   Returns the status of error checking. If true (.T.), an error occurred and the Class Browser error dialog box is displayed. When the Class Browser opens, this property is set to false (.F.). If you want to check for errors, make sure this property is set to false.

lExpanded   For internal use only.

nFileCount   Reference only. Returns the number of class library (.VCX) or form (.SCX) files currently open in the Class Browser. The default value is 0.

lFileMode   Reference only. Returns the type of the selected item in the class list. If true (.T.), a file is selected; if false (.F.), a class is selected.

cFileName   Reference only. Returns the full path of the file associated with the selected class in the class list.

tcFileName   Reference only. Returns the value or reference of the second parameter passed to BROWSER.APP. For example, if you open the Class Browser by typing the following code, this property returns “WIZSTYLE.VCX.”

DO (_BROWSER) WITH "wizstyle.vcx","baseform"

aFiles   Reference only. An array of class library (.VCX), form (.SCX), application (.EXE), object library (.OLB), and type library (.TLB) files currently opened in the Class Browser.

cFilter   Reference only. Returns the current SET FILTER setting from the open metadata table for the selected class in the class list.

lFormAddObject   For internal use only.

cGetFileExt   Determines the Class Browser’s GETFILE( ) default method extensions. The default value is “VCX;SCX;PJX;EXE;OLB;TLB.”

lHiddenFilter   If true (.T.), hidden members are displayed in the Members list. The default is false (.F.).

lIgnoreErrors   For internal use only.

lInitialized   Reference only. Returns the initialization state of the Class Browser. If true (.T.), the Class Browser is initialized; if false (.F.), the Class Browser is not initialized.

aInstances   Reference only. An array of instances associated with the selected class in the class list. Functionality is identical to AINSTANCE( ).

nInstances   Reference only. Returns the total number of instances associated with the selected class in the class list using AINSTANCE( ). The default value is 0.

cLastFindText   For internal use only.

nLastHeight   The initial height of a form before a Resize event occurs. The default value is (THIS.Height).

nLastRecNo   For internal use only. The initial value is 1.

cLastSetComp   The setting of SET COMPATIBLE when the Class Browser was loaded.

cLastSetESC   The setting of SET ESCAPE when the Class Browser was loaded.

cLastSetUDFParms   The setting of SET UDFPARMS when the Class Browser was loaded.

cLastValue   For internal use only.

nLastWidth   Returns the initial width of a form before a Resize event occurs. The default value is (THIS.Width).

tlListBox   If a true (.T.) value is passed to the Class Browser in this argument, classes and members are displayed in list boxes rather than treeview controls.

lModalDialog   Determines if the class list is refreshed when the Class Browser regains focus after activating a modal dialog box. If true (.T.), the list is not refreshed; if false (.F.), the list is refreshed. The default value is true (.T.).

nMouseButton   For internal use only. Which mouse button was pressed.

lNoDefault   Returns the status indicating how default behavior is handled when returning from an add-in. If true (.T.), the default behavior is ignored.

lOutlineOCX   Reference only. If true (.T.), classes and members are displayed in treeview controls. You might need this information in an add-in program.

cParentClass   Reference only. Returns the name of the parent class of the selected class in the class list.

lParentClassBrowser   If true (.T.), the Edit ParentClass Method toolbar is displayed. The default is true.

cParentClassBrowserCaption   The caption of the ParentClass Browser toolbar. The default value is SPACE(10) + “ParentClass Browser”

cParentClassSymbol   Determines the symbol displayed beside a class to indicate that it is a subclass of a class that is not displayed in the Classes list.

nPixelOffset   Internal use only. Determines the number of pixels to cascade multiple instances of the Class Browser. The default value is 22.

cPlatform   Reference only. Returns the name of the current platform.

cProgramName   Reference only. Returns the full path of the BROWSER.APP file being executed.

lProtectedFilter   If true (.T.), protected members are displayed in the Members list. The default is false (.F.).

lReadOnly   Reference only. Returns the read-only status of the file associated with the selected class in the class list.

nRecCount   Reference only. Returns the total number of records in the open class library (.VCX) and form (.SCX) files. The default value is 0.

lRefreshMode   Internal use only.

lRelease   Internal use only. Specifies that the Class Browser is automatically released.

lResizeMode   Internal use only. Returns the resize mode status of the Class Browser.

lSCXMode   Reference only. Returns the status of the file type of the selected class in the class list. If true (.T.), the file is a form (.SCX); if false (.F.), the file is a class library (.VCX).

nShift   For internal use only. State of the SHIFT key when a mouse button is pressed.

oSource   Reference only. Returns the reference for an object dropped on a form from the Class Browser. After the DragDrop method is complete, oSource is set to null (.NULL.).

cStartName   Reference only. Returns the Name property of the Class Browser from when the Class Browser was loaded, but before the name is incremented. For example, the default value is ClassBrowser and, for each instance opened, the name is incremented: ClassBrowser1, ClassBrowser2.

nStrLen   For internal use only. The default value is 0.

cTimeStamp   Reference only. Returns the timestamp field value of the selected class in the class list.

lVCXSCXMode   If true (.T.), the class or file selected is a .VCX or .SCX, or is in a .VCX or .SCX.

tnWindowState   For internal use only. Whether the Class Browser window is minimized (1), maximized (2), or normal (0).


 See Also

Browsing Classes
Class Browser Buttons
Class Browser Methods
Class Browser Object Members
Class Browser Window
Customizing the Class Browser
Initial Values of Class Browser Properties


Initial Values of Class Browser Properties

See Also

When an instance of the Class Browser is opened, the properties are set to the default values shown in the following table.

Class Browser property	Initial setting
caddin	“”
caddinmethod	“”
calias	“”
Caption	“Class Browser”
cbaseclass	“”
cbrowsertable	“”
cclass	“”
cclasslibrary	“”
cclasstimestamp	“”
cclasstype	“”
cdragicon	“”
cfilename	“”
cfilter	“”
cgetfileext	vcx;scx;pjx;exe;olb;tlb
clastgetfileext	“”
clastsetcomp	“”
clastsetesc	“”
clastsetudfparms	“”
clastvalue	“”
cparentclass	“”
cparentclasssymbol	(IIF(VERSION(3)==“00”,CHR(171),“<”))
cplatform	“”
cprogramname	“”
cstartname	“”
DataSession	2
FontBold	.F.
FontName	“MS Sans Serif”
FontSize	8
Height	360
HelpContextID	95825501
Icon	browser.ico
lautoexpand	.T.
ldescriptions	.T.
ldisplayhierarchyerror	.T.
Left	0
lparentclassbrowser	.T.
MinHeight	(175)
MinWidth	(250)
Name	“classbrowser”
natpos	0
nclasscount	0
nclasslistindex	-1
ndisplaymode	1
nfilecount	0
ninstances	0
nlastheight	(this.Height)
nlastrecno	1
nlastwidth	(this.Width)
nmousebutton	0
npixeloffset	22
nreccount	0
nshift	0
nstrlen	0
ntimestamp	0
oparentclassbrowser	.NULL.
osource	.NULL.
ShowTips	.T.
Top	-1
Width	462


 See Also

Browsing Classes
Class Browser Buttons
Class Browser Methods
Class Browser Object Members
Class Browser Properties
Class Browser Window
Customizing the Class Browser


Class Browser Object Members

See Also

You can use the names in this table to reference the object members of the Class Browser. The table order reflects the order the member object appears in the Class Browser window. The reference to the Class Browser window itself is _oBrowser.

Class Browser object	Object name
Class description edit box	edtClassDesc
Class member edit box	edtMemberDesc
Open command button	cmdOpen
Add Additional File command button	cmdAdd
View Class Code command button	cmdExport
Find command button	cmdFind
New Class command button	cmdSubclass
Rename command button	cmdRename
Redefine command button	cmdRedefine
Remove command button	cmdRemove
Clean Up Library command button	cmdCleanup
Class Icon image	imgClassIcon
Class Icon button	cmdClassIcon
Type label for the Type combo box	lblClassType
Type combo box	cboClassType
Class List 3D effect control	txtClassList3D
Class List OLE container	oleClassList
Member List OLE container	oleMembers
Member List 3D effect control	txtMembers3D
Object Member list box	lstMembers*
Methods list box	lstClassList*
Class Description edit box	edtClassDesc
Member Description edit box	edtMemberDesc
•	These objects exist only when lOutlineOCX is false (.F.).


 See Also

Browsing Classes
Class Browser Buttons
Class Browser Methods
Class Browser Properties
Class Browser Window
Customizing the Class Browser
Initial Values of Class Browser Properties


Class Browser Methods

See Also

The following methods are associated with the Class Browser.

AddClass( )   Copies a class from one class library (.VCX) file to another. Used after a drag-and-drop operation between instances of the Class Browser and dependent on the oSource property. If the specified class does not exist, a class is created.

AddFile( )   Adds a class library (.VCX) or form (.SCX) file to the Class Browser class list. If no parameters are passed, an AddFile dialog box appears by using the Class Browser GetFile( ) method. If lIgnoreRefresh is true (.T.), the Class Browser class list is not refreshed. If you are adding multiple files, you can wait until all classes are added before refreshing the list.

Syntax:  AddFile([cFileName][, lIgnoreRefresh])

AddIn( )   Installs or removes the specified add-in to the BROWSER.DBF registration table.

Syntax:  AddIn(cName[, cProgram] [, cMethod] [, cFileFilter] [, cPlatform][, cComment])

Arguments

•	cName   Specifies the name of the add-in. Not case-sensitive; however, when displayed on a menu, the value appears as entered.

•	cProgram   Specifies the name of a program (.PRG), form (.SCX), application (.APP), executable file (.EXE), or compiled program (.FXP) to run. If no extension is provided, the extension .PRG is assumed. If a specific class library (.VCX) and a name for a new class are provided, a new class is created in the library.

Note   If this argument is .NULL., the add-in is marked for deletion in BROWSER.DBF and disabled in the add-in shortcut menu.

•	cMethod   Specifies a method name to use as an event hook. If empty, the add-in appears on the menu.

•	cFileFilter   Specifies a list of class libraries and forms that enable the add-in. If empty, the add-in is available for all class libraries (.VCX) and forms (.SCX).

•	cPlatform   Specifies the platform the add-in is available on. If empty, the add-in is available on all platforms supported by Visual FoxPro.

•	cComment   Specifies text stored in a memo field in the BROWSER.DBF.

AddInMenu( )   Expands the menu that displays the registered add-ins.

AddInMethod( )   Executes any registered add-in for the specified object method.

Syntax:  AddInMethod(cObjMethod)

Example:  To change the default behavior of the Help button in the Class Browser, use the following code:

_OBROWSER.AddInMethod("cmdHelp.click")

AutoRefresh( )   Determines whether to refresh the display by checking for updated class library (.VCX) information in the selected class in the class list, and by checking the total number of records in the class library (.VCX) file being edited. This method runs when the Class Browser form is activated.

BinToInt( )   Returns the integer equivalent of a string representing a binary value. For example, passing this method a cBinaryValue of “11001” would return 25.

Syntax:  BinToInt([cBinaryValue])

CleanUpFile( )   Removes records from the class library (.VCX) file associated with the selected class in the class list.

ClearBrowser( )   Internal use only.

ClearClass( )   Clears the class cache from memory with the CLEAR CLASS command for a specific class, or all classes displayed if lClearAll is set to true (.T.).

Syntax:  ClearClass([lClearAll])

NewClass( )   Creates a subclass of the selected class in the class list.

DeactivateMenu( )   Deactivates the add-in popup menu.

DisplayMenu( )   Displays the shortcut menu at the current mouse pointer location. If tnMenuMode is 0, the Class Browser form shortcut menu is displayed; if 1, the Class list shortcut menu; if 2, the Member list shortcut menu.

Syntax:  DisplayMenu(tnMenuMode)

DoAddIn( )   Executes the specified add-in of the current or specific record of the table with the BROWSER alias.

Syntax:  DoAddIn([cAddInName])

FileMatch( )   Compares the specified file against the specified file list to determine if the file is one associated with the add-in.

Syntax:  FileMatch(cFileName, cFileList)

ExportClass( )   Generates and displays the definition source code of the selected class or the selected file in the class list. If the parameter lShow is true (.T.), the Class Browser window displays the code.

Syntax:  ExportClass([lShow])

FindClass( )   Finds class text within a class.

Syntax:  FindClass([cFind])

FormAddObject( )   Adds an instance of the selected class in the class list to an external form.

Syntax:  FormAddObject(oObject [, nXCoord] [, nYCoord] [, lActivateForm] [, lDesignMode][, lNoShow])

Arguments

•	oObject   Specifies a reference to the destination container.

•	nXCoord   Specifies the horizontal position of the object inside the container. If no value is passed, the current mouse position is used.

•	nYCoord   Specifies the vertical position of the object inside the container. If no value is passed, the current mouse position is used.

•	lActivateForm   If true (.T.), the destination form is activated when the object is added to it; if false (.F.), the Class Browser remains active.

•	lDesignMode   If true (.T.), the object reference is an object currently in the Form Designer or class designer.

•	lNoShow   If true (.T.), the object reference is an object currently in the Form Designer or class designer.

FormatMethods( )   Formats the text of generated methods in the display of the class definition code.

Syntax:  FormatMethods(cMethods)

FormatProperties( )   Formats the text of generated properties in the display of the class definition source code.

Syntax:  FormatProperties(cProperties [, lAddObjectMode])

GetFile( )   Opens the Class Browser GetFile( ) dialog box. The GetFile( ) method is used internally by the Open or Add buttons in the Class Browser. Whenever the Class Browser prompts for a class library (.VCX) or form (.SCX), the GetFile( ) method is called internally.

Syntax:  GetFile([cFileExt])

GetTimeStamp( )   Returns the character equivalent of a timestamp value. If no parameter is passed, returns the timestamp string of the currently selected file.

Syntax:  GetTimeStamp([ntimestamp])

IndentText( )   Indents a block of text one tab.

Syntax:  IndentText(cCode)

IntToBin( )   Returns a string representing a binary value that is the equivalent of an integer value. For example, passing this method a nInteger of 25 would return “11001”.

Syntax:  IntToBin([nInteger])

ModifyClass( )   Opens the selected class in the Class Designer.

MsgBox( )   Displays the Class Browser message box. Similar to the Visual FoxPro MESSAGEBOX( ) function.

Syntax:  MsgBox(cMessage [, nType] [, cTitle])

NewFile( )   Creates a new class library (.VCX) file. If no parameters are passed, the Open dialog box is displayed. If parameters are provided, a new class library (.VCX) is created and added to the class list in Class Browser.

Syntax:  NewFile([cFileName] [, lOpenFile])

OpenFile( )   Opens an existing class library (.VCX) or form (.SCX) file. If a file name is not provided, the Open dialog box appears.

Syntax:  OpenFile([cFileName])

ProperBaseClass( )   Returns the base class name in the proper case. For example, “combobox” would return as “ComboBox”.

Syntax:  ProperBaseClass(cBaseClass)

RedefineClass( )   Changes the parent class of the selected class in the class list.

Syntax:  RedefineClass([cAsClass] [, cClassLoc])

RefreshButtons( )   Refreshes the Class Browser command buttons based on the file type.

RefreshClassIcon( )   Reloads the class icon from the icon file.

RefreshClassList( )   Refreshes the class list.

Syntax:  RefreshClassList([cDefaultClass] [, lIgnoreTable])

RefreshClassListSubclass( )   For internal use only.

RefreshFileAttrib( )   Refreshes the file attribute status of the file name associated with the selected class in the class list.

RefreshCaption( )   Refreshes the Class Browser caption of a form.

RefreshDescriptions( )   Internal use only. Refreshes the descriptions of classes and members.

RefreshMembers( )   Refreshes the Member tabs to display information associated with the selected class in the class list and, if provided, the specified member.

Syntax:  RefreshMembers([tcDefaultMember])

RefreshParentClassBrowser( )   Refreshes the state of the ParentClass Browser toolbar.

RefreshPrefRecNo( )   Refreshes the BROWSER.DBF preference record pointer for the class library (.VCX) or form (.SCX) file being edited.

RefreshRecNo( )   Refreshes the current record pointer of the class library (.VCX) or form (.SCX) table for the file of the selected class.

RemoveClass( )   Removes the selected class in the class list from its associated class library (.VCX) file.

Syntax:  RemoveClass([lConfirm])

RenameClass( )   Changes the class name of the selected class in the class list.

Syntax:  RenameClass([cToClass])

ResetDefaults( )   Restores original display settings. This method is called when you choose Restore Defaults from the shortcut menu.

SavePreferences( )   Saves current preference settings to the BROWSER.DBF registration table.

ScaleResize( )   Scales the controls on the Class Browser form to fit after the form is resized using the Resize( ) event.

SeekClass( )   Moves the class list pointer to a specific class or index in the class list. Can use the numeric value of the visual position in the class list.

Syntax:  SeekClass([cClass][, cClassLibrary])

SeekMember( )   Moves the member list pointer to a specific member.

Syntax:  SeekMember(tcMember)

SeekParentClass( )   Displays the parent class of the selected class in the class list.

SetBusyState( )   Sets the lBusyStatus property to true (.T.) or false (.F.) based on the parameter received; also sets the mouse pointer shape to an arrow or hourglass.

Syntax:  SetBusyState(lBusyState)

SetFont( )   Sets the font and font size used by the Class Browser for its form, controls, and dialog boxes. If you don’t specify a font name or size, SetFont( ) opens the Get Font dialog box.

Syntax:  SetFont([cFontName][, nFontSize][, lFontBold][, lFontItalic])

ShowMenu( )   Displays a menu based on an array. If a menu is a single-dimension array, this method displays a list of all items in your menu. If the array is two-dimensional with an item and an action, it displays the menu items and when the item is selected, it executes the associated action.

Syntax:  ShowMenu(aMenu[, cOnSelection])

TrimExt( )   Truncates the file name extension.

Syntax:  TrimExt(cFileName [, lPlatformType])

TrimFile( )   Truncates the file name and returns only the file name and path.

Syntax:  TrimFile(cFileName [, lPlatformType])

TrimPath( )   Truncates the path name.

Syntax:  TrimPath(cFileName [, lTrimExt] [, lPlatformType])

UpdateReferences( )   Used to update references of classes (subclasses and object members) when renaming a class and when moving a class from one class browser to another.

Syntax:  UpdateReferences(tcOldClassLoc, tcOldClass, tcNewClassLoc, tcNewClass [, tlAllInstances])

Arguments

•	tcOldClassLoc   Specifies the original contents of the ClassLoc field in the .VCX or .SCX file.

•	tcOldClass   Specifies the original contents of the Class field in the .VCX or .SCX file.

•	tcNewClassLoc   Specifies the new contents of the ClassLoc field in the .VCX or .SCX file..

•	tcNewClass   Specifies the new contents of the Class field in the .VCX or .SCX file.

•	tlAllInstances   If true (.T.) all files in all Class Browser windows are updated. If false (.F.) only the files in the current Class Browser window are updated.

VersionCheck( )   Validates the open class library (.VCX) or form (.SCX) file.

Syntax:  VersionCheck([lShowErrorMsg])

ViewProperty( )   Displays the value of a specific property of the selected class.

Syntax:  ViewProperty(cProperty)

WildcardMatch( )   Compares strings for a wildcard match with the filters specified in the Type box.

Syntax:  WildcardMatch(cMatchExpList, cExpressionSearched)


 See Also

Browsing Classes
Class Browser Buttons
Class Browser Methods
Class Browser Object Members
Class Browser Properties
Class Browser Window
Customizing the Class Browser
Initial Values of Class Browser Properties


AutoFormat Builder

See Also

The AutoFormat Builder of the Form Designer applies a set of styles to selected controls of the same type. For example, you can select two or more text box controls on the form and use the AutoFormat Builder to apply the same styles; or you can specify whether the styles apply to all or just some of the controls’ borders, colors, fonts, layout, or 3D effect.

To use the AutoFormat Builder

1.	Using the Form Controls toolbar, place multiple controls of the same kind on the form.

2.	Select and right-click all the controls you want to format, and then choose Builder from the Form Designer shortcut menu.

A dialog appropriate to the selected control appears.

1.	Choose the options you want from the dialog box, and then choose OK.

When you choose OK, the builder closes and applies the selected configuration.

Shortcut

(Form Designer toolbar)

Builder Options

Style   Specifies Embossed, Standard, or Professional style. When you click a style, the display to the left is updated to show you how the style looks.

Apply Style To

Borders   Applies the selected style to the control borders. This option corresponds to the BorderStyle property.

Colors   Applies the selected style to the control colors. This option corresponds to the BackColor and ForeColor properties, BackStyle property, and BorderColor property.

Fonts   Applies the selected style to the control fonts.

Layout   Applies the selected style to the control alignment.

3D Effect   Applies the selected style to the control 3D effect.

Apply Now   Applies the style to the selected controls without leaving the AutoFormat Builder.


  See Also

BackColor and ForeColor Properties
BackStyle Property
BorderColor Property
BorderStyle Property


Combo Box Builder

See Also

The Combo Box Builder makes it easy to set properties for a Combo Box control. You set properties by choosing options from the Combo Box Builder dialog box.

To use the Combo Box Builder

1.	Using the Form Controls toolbar, place multiple combo box controls on the form.

2.	Select and right-click all the combo box controls you want to format, and then choose Builder from the Form Designer Shortcut Menu.

3.	Choose the options on each tab of the dialog box that appears, and then choose OK.

When you choose OK, the builder closes, applying the property settings to the control.

Builder Tabs

List Items   Specifies items from a table, an array, or manual selection to appear in the combo box.

Style   Specifies Style and SpecialEffect properties of the control, including 3D or plain style, drop-down combo or list, and single-key or incremental searching.

Layout   Specifies the control width and column widths properties.

Value   Specifies which column returns a value and where to store it.


  See Also

Combo Box Control
Layout Tab, Combo Box Builder
List Items Tab, Combo Box Builder
Style Tab, Combo Box Builder
Value Tab, Combo Box Builder


List Items Tab, Combo Box Builder

See Also

The List Items tab in the Combo Box Builder specifies items that go into the combo box. The other Combo Box Builder tabs are: Layout, Style, and Value.

When you choose OK, the builder closes, applying the property settings from every tab to the control.

Tab Options

Fill the List With   Specifies the kind of data with which to fill the combo box list. The selection you make here determines which choices appear on this tab. Choose Fields From a Table or View, Data Entered by Hand, or Values From an Array.

Fields From a Table or View   Allows you to select free tables or tables and views from a database to use in the combo box.

Databases and Tables   Lists the available databases and gives the option to select Free Tables. To find a database or table, click the dialog button, which displays the Open dialog box. This option appears when you have selected Fields From a Table or View in the Fill the List With drop-down list.

List of Tables   Displays tables and views in the selected database, or free tables. This option appears when you have selected Fields From a Table or View in the Fill the List With drop-down list.

Available Fields   Shows all fields in the selected table or view. Select the fields whose data you want in your combo box. This option appears when you have selected Fields From a Table or View in the Fill the List With drop-down list.

Arrow Buttons   Adds fields to and removes fields from the Selected Fields box. This option appears when you have selected Fields From a Table or View in the Fill the List With drop-down list.

You can also double-click an item to move it between lists.

Selected Fields   Displays the fields that will be used to fill the combo box list. The order of the fields selected will correspond to the order of the columns in the combo box. This option appears when you have selected Fields From a Table or View in the Fill the List With drop-down list.

Data Entered By Hand   Allows you to select the number of columns to be displayed in the combo box and enter the information to be displayed.

Columns   Specifies the number of columns in the combo box list. This option appears when you have selected Data Entered By Hand in the Fill the List With drop-down list.

Column Grid   Displays the columns in which to enter data. Type the data in the column cells. You can size the columns by dragging the lines between them with the mouse. This option appears when you have selected Data Entered By Hand in the Fill the List With drop-down list.

Values From An Array   Allows you to use data from an array within the combo box.

Array Name   Specifies the name of an array. This option appears when you have selected Values From An Array in the Fill the List With drop-down list.

Entire Array   Specifies that the entire array will fill the combo box list. This option appears when you have selected Values From An Array in the Fill the List With drop-down list.

Range Of The Array   Specifies that a part of the array will fill the combo box list based on the column and row settings. This option appears when you have selected Values From An Array in the Fill the List With drop-down list.

Column and Row Range   Specifies the starting and ending column and row as the array range. These options are only available when you select Range of the Array. This option appears when you have selected Values From An Array in the Fill the List With drop-down list.


  See Also

Combo Box Builder
ControlSource Property
Layout Tab, Combo Box Builder
Open Dialog Box
RowSource Property
RowSourceType Property
Style Tab, Combo Box Builder
Value Tab, Combo Box Builder


Style Tab, Combo Box Builder

See Also

The Style tab in the Combo Box Builder specifies special effects, drop-down combo, drop-down list, and incremental searching support for the combo box. The other Combo Box Builder tabs are: List Items tab, Layout tab, and Value tab.

When you choose OK, the builder closes, applying all the property settings from every tab to the control.

Tab Options

Three-dimensional   Specifies a left and top edge highlight and a right and lower edge shadow for the combo box.

Plain   Specifies that the combo box is an unshadowed box on the form. Three-dimensional and Plain determine the value of the SpecialEffect property.

Drop-down Combo   Specifies that the combo box will be a drop-down combo, where the user can click the drop-down arrow to see a list of choices or enter a new item directly in the text box. This option corresponds to setting the Style property to 0.

Drop-down List   Specifies that the combo box will be a drop-down list, where the user may select only from the list. This option corresponds to setting the Style property to 2.

Yes, Enable Incremental Searching   Specifies whether the control tries to match an item in the list as the user types each letter. This option corresponds to setting the IncrementalSearch property.

No, Don’t Enable Incremental Searching   Disables incremental searching so that each key stroke initiates a search for a beginning character.


  See Also

Combo Box Builder
IncrementalSearch Property
List Items Tab, Combo Box Builder
Layout Tab, Combo Box Builder
Style Property
Value Tab, Combo Box Builder


Layout Tab, Combo Box Builder

See Also

The Layout tab in the Combo Box Builder controls column width and display. The other Combo Box Builder tabs are: List Items tab, Style tab, and Value tab.

When you choose OK, the builder closes, applying all the property settings from every tab to the control.

Tab Options

Adjust the Width of the Combo Box to Display All Columns   Specifies that all selected columns will display even if the open combo box must extend beyond the form boundary. This controls the Width property of the combo box

Column Grid   Controls the values in the ColumnWidths property You can adjust the column width by dragging the right edge of a column heading with the mouse. Double-click a column heading to hide the column.

The grid shows actual data if it is available. If no data is available, the grid displays a message to that effect.

To change column order, return to the List Items tab, remove the fields, and add them back in the desired order.


  See Also

Combo Box Builder
List Items Tab, Combo Box Builder
Style Tab, Combo Box Builder
Value Tab, Combo Box Builder


Value Tab, Combo Box Builder

See Also

The Value tab in the Combo Box Builder specifies where to get return values and where to store them. The other Combo Box Builder tabs are: List Items tab, Style tab, and Layout tab.

When you choose OK, the builder closes, applying the property settings from every tab to the control.

Tab Options

Return the Value From   Specifies the column whose value is stored to a table field when the user selects a combo box item. This option corresponds to the BoundColumn property.

Field Name   Specifies a table or view field in which to store the value specified in the Return the Value From box. By default, the list includes fields from tables in the data environment. Choose the dialog button to display the Open dialog box so you can select another table. This option corresponds to the ControlSource property.

For example, if you fill the combo box with a list of 50 states, when the user chooses a state, you could write it to the STATE field of an address table.


  See Also

BoundColumn Property
Combo Box Builder
ControlSource Property
Layout Tab, Combo Box Builder
List Items Tab, Combo Box Builder
Open Dialog Box
Style Tab, Combo Box Builder


Command Group Builder

See Also

The Command Group Builder makes it easy to set properties for a Command Group control. You set properties by selecting options in the Command Group Builder dialog box.

To use the Command Group Builder

1.	Using the Form Controls toolbar, place a Command Group control on a form.

2.	Select and right-click the Command Group control, and then choose Builder from the Form Designer Shortcut Menu.

A dialog box appropriate to the selected control appears.

1.	Choose the options you want from the dialog box, and then choose OK.

When you choose OK, the builder closes, applying the property settings from every tab.

Builder Tabs

Buttons   Specifies the number of buttons and the Caption and Picture properties of each.

Layout   Specifies button layout (vertical or horizontal), spacing, and border style by controlling the Height and Width properties of the command group.

Note   Command buttons may have captions, or graphics, or both. You can also specify graphics to be displayed when the button is disabled and when it is pressed, but you must do so programmatically or in the Properties window. For more details, see the DisabledPicture and DownPicture properties.


  See Also

Buttons Tab, Command Group Builder
Command Button Control
Command Group Control
Form Designer Shortcut Menu
Layout Tab, Command Group Builder
Properties Window


Buttons Tab, Command Group Builder

See Also

The Buttons tab in the Command Group Builder specifies the number of buttons and their captions and graphics. This builder also has a Layout tab.

When you choose OK, the builder closes, applying the property settings from every tab.

Tab Options

Number of Buttons   Specifies the number of buttons the command group will have. This option corresponds to the ButtonCount property. Range is from 0 to 100.

Caption Column   Specifies the caption to go on the button. Type the caption in the grid cell. This option corresponds to the Caption property.

Graphic Column   Specifies the path and file name of the bitmap to display on the button. Type the path and file name in the box, or click the dialog button to display the Open dialog box so you can select a file. This picture will be displayed on the command button all the time, regardless of the button’s state. This option corresponds to the Picture property.

Buttons automatically resize to accommodate new captions and pictures. The group container also automatically resizes, and neighboring buttons are repositioned, if necessary, to preserve desired spacing.


  See Also

ButtonCount Property
Caption Property
Command Group Builder
DisabledPicture
DownPicture Property
Layout Tab, Command Group Builder
Open Dialog Box
Picture Property
Properties window


Layout Tab, Command Group Builder

See Also

The Layout tab in the Command Group Builder specifies button layout (vertical or horizontal), spacing, and border style. This builder also has the Buttons tab.

When you choose OK, the builder closes, applying the property settings from every tab.

Tab Options

Button Layout   Specifies vertical or horizontal layout of command group buttons. You can also customize the location of buttons within a Command Group by selecting Edit from the shortcut menu and dragging buttons within the Command Group boundary. Return to Command Group editing by first clicking outside the Command Group boundary.

If you have customized the button layout, neither Vertical nor Horizontal is selected. If you then select Vertical or Horizontal, the buttons snap into alignment and you lose the custom pattern. Choose  Cancel to retrieve the custom pattern.

Spacing Between Buttons   Specifies spacing between buttons. If you have customized the button spacing, this option is disabled. If you snap the buttons into horizontal or vertical alignment, this option is enabled.

Border Style   Specifies a single-line border or no border around the command group.


  See Also

Buttons Tab, Command Group Builder
Command Group Builder


Edit Box Builder

See Also

The Edit Box Builder makes it easy to set properties for an Edit Box control. Edit boxes are commonly used to display long Character fields or Memo fields and allow the user to edit text. An edit box can also display text from a text file or from the clipboard. You set properties for the Edit Box control by selecting options in the Edit Box Builder dialog box.

To use the Edit Box Builder

1.	Using the Form Controls toolbar, place an Edit Box control on a form.

2.	Select and right-click the Edit Box control, and then choose Builder from the Form Designer Shortcut Menu.

A dialog box appropriate to the selected control appears.

1.	Choose the options you want from the dialog box, then choose OK.

When you choose OK, the builder closes, applying the property settings from every tab.

Builder Tabs

Format   Specifies miscellaneous format options for the edit box.

Style   Specifies edit box visual effect, border, and alignment.

Value   Specifies a field in which to store the edit box’s value.


  See Also

EditBox Control
Format Tab, Edit Box Builder
Properties Window
Style Tab, Edit Box Builder
Value Tab, Edit Box Builder


Format Tab, Edit Box Builder

See Also

The Format tab in the Edit Box Builder specifies miscellaneous format options for the edit box, such as adding vertical scrollbars and making the box read-only. This builder also has the Style tab and Value tab.

When you choose OK, the builder closes, applying the property settings from every tab.

Tab Options

Allow User to Insert Tabs   Permits inserting of tabs in the edit box. This prevents the focus from moving to the next control when the TAB key is pressed. Press CTRL+TAB to move to the next control. This option corresponds to the AllowTabs property.

Add Vertical Scrollbars   Adds vertical scrollbars to the edit box. This option corresponds to the ScrollBars property.

Select on Entry   Specifies that the text in the edit box be selected when the edit box has the focus. This adds the setting “K” to the Format property.

Use Current SET DATE   Adds the setting “D” to the Format property so that date entries will conform to the current SET DATE or Date Format of the International tab of the Options dialog box.

Hide Selection   Specifies whether or not selected text in the edit box remain visibly selected when the edit box doesn’t have the focus. This option corresponds to the HideSelection property.

Enable at Runtime   Specifies whether or not the edit box is enabled when the form is run. This option corresponds to the Enabled property.

Make Read-Only   Prevents the user from changing the text in the edit box. This option corresponds to the ReadOnly property.

British Date   Adds the setting “E” to the Format property so that date entries will conform to British formatting of SET DATE or of the Date Format of the International tab of the Options dialog box.


  See Also

AllowTabs Property
Edit Box Builder
Enabled Property
Format Property
HideSelection Property
ReadOnly Property
ScrollBars Property
Style Tab, Edit Box Builder
Value Tab, Edit Box Builder


Style Tab, Edit Box Builder

See Also

The Style tab in the Edit Box Builder specifies edit box visual effect, border, and alignment. This builder also has the Format tab and Value tab.

When you choose OK, the builder closes, applying the property settings from every tab.

Tab Options

Special Effect

3D   Specifies a left and top edge highlight and a right and lower edge shadow for the combo box. This option corresponds to the 3D setting of the SpecialEffect property.

Plain   Specifies that the combo box is an unshadowed box on the form. This option corresponds to the Plain setting of the SpecialEffect property.

Border

Single   Specifies a single line around the edit box. This option corresponds to the Fixed-Single setting of the BorderStyle property.

None   Specifies no line around the edit box. This option corresponds to the None setting of the BorderStyle property.

Character Alignment

Left   Specifies that text in the edit box will be left-aligned. This option corresponds to the Left setting of the Alignment property.

Right   Specifies that text in the edit box will be right-aligned. This option corresponds to the Right setting of the Alignment property.

Center   Specifies that text in the edit box will be centered. This option corresponds to the Center setting of the Alignment property.


  See Also

Alignment Property
BorderStyle Property
Edit Box Builder
Format Tab, Edit Box Builder
SpecialEffect Property
Value Tab, Edit Box Builder


Value Tab, Edit Box Builder

See Also

The Value tab in the Edit Box Builder specifies a field in which to store the edit box’s value. This builder also has the Format tab and Style tab.

When you choose OK, the builder closes, applying the property settings from every tab.

Tab Options

Field Name   Specifies a table or view field in which to store the edit box’s value. Type the field name, or click the dialog button to display the Open dialog box, where you can select another table or view. In the Edit Box Builder, click the drop-down arrow next to the Field Name box to select a field.

The default contents of this tab are all the fields in the data environment. This option corresponds to the ControlSource property.


  See Also

ControlSource Property
Data Environment
Edit Box Builder
Format Tab, Edit Box Builder
Open Dialog Box
Style Tab, Edit Box Builder


Form Builder

See Also

The Form Builder makes it easy to add fields as new controls to a form. You add controls and specify style by selecting options displayed in the Form Builder dialog box.

To use the Form Builder

•	Right-click on a new or existing form in the Form Designer.

 – Or –

•	Choose Quick Form from the Form menu.

When you choose OK, the builder closes, applying the property settings from every tab.

Builder Tabs

Field Selection   Specifies fields to be added as form controls.

Style   Offers several style choices for your controls and the option to enlarge the form if necessary. The form size will only enlarge to fit the size of the Maximum Design Area as set in the Forms tab of the Options dialog box.

The styles correspond to those offered by the Form Wizards. If you created a form with a wizard, and then wish to add a new control of the same style, use the Form Builder. You may also add new controls with a different style. The style chosen in the Form Builder does not affect existing controls on a form. To format them, use the AutoFormat Builder.


  See Also

AutoFormat Builder
Field Selection Tab, Form Builder
Forms Tab, Options Dialog Box
Style Tab, Form Builder


Field Selection Tab, Form Builder

See Also

The Field Selection tab in the Form Builder specifies fields to be added as form controls. This builder also has a Style tab.

When you choose OK, the builder closes, applying the property settings from every tab.

Tab Options

Databases and Tables   Lists the available databases or lets you select free tables. To find a database or table, click the dialog button, which displays the Open dialog box.

List of Tables   Displays tables and views in the selected database, or free tables.

Available Fields   Shows all fields in the selected table or view. Select the fields whose data you want on your form.

Arrow Buttons   Adds fields to and removes fields from the Selected Fields box.

Selected Fields   Displays the fields that will appear on your form as controls.


  See Also

Form Builder
Open Dialog Box
Style Tab, Form Builder


Style Tab, Form Builder

See Also

The Style tab in the Form Builder offers several style choices for your controls and the option to enlarge the form to accommodate data. The form size will only enlarge to fit the size of the Maximum Design Area as set in the Forms tab of the Options dialog box.

This builder also has a Field Selection tab.

When you choose OK, the builder closes, applying the property settings from every tab.

Tab Options

Style   Specifies the style of the form controls, which is determined by the class of the control. Select a form style to see a preview of what the style will look like.

Enlarge Form as Needed checkbox   Specifies that the builder enlarge the form to accommodate the selected fields; up to the maximum size determined by the design area of the form, if necessary.


 See Also

Field Selection Tab, Form Builder
Form Builder
Forms Tab, Options Dialog Box


Grid Builder

See Also

The Grid Builder makes it easy to set properties for a Grid control. The Grid control allows you to present and manipulate rows and columns of data in a form or page. You set grid properties by selecting options displayed in the Grid Builder dialog box.

To use the Grid Builder

1.	Using the Form Controls toolbar, place a Grid control on a form.

2.	Select and right-click the Grid control, and then choose Builder from the Form Designer Shortcut Menu.

3.	Choose the options you want from the dialog, and then choose OK.

When you choose OK, the builder closes, applying the property settings from every tab.

Note   Before running your form, make sure you have sized the Grid control to adequately display your data.

Builder Tabs

Grid Items   Specifies fields to be displayed in the grid.

Style   Specifies a style for the grid display.

Layout   Specifies column captions and control types.

Relationship   Specifies relationships between grid fields and table fields.


  See Also

Grid Control
Grid Items Tab, Grid Builder
Layout Tab, Grid Builder
RecordSource Property
RecordSourceType Property
Relationship Tab, Grid Builder
Style Tab, Grid Builder


Grid Items Tab, Grid Builder

See Also

The Grid Items tab in the Grid Builder specifies fields to be displayed in the grid. This builder also has the Style tab, Layout tab, and Relationship tab.

When you choose OK, the builder closes, applying the property settings from every tab.

Note   In the Grid Builder, you can select fields from a single table only. To set a relationship between Grids, you must use the Grid Builder on each Grid separately, and then use the Relationship tab of one Grid Builder to establish the relationship.

Tab Options

Databases and Tables   Lists the available databases and gives the option to select free tables. To find a database or table, click the dialog button, which displays the Open dialog box.

List of Tables   Displays tables and views in the selected database, or free tables.

Available Fields   Shows all fields in the selected table. You may select fields from only one table.

Arrow Buttons   Add fields to and remove fields from the Selected Fields list.

Selected Fields   Displays the fields that will appear in the grid. Each field displays in one column in the grid.


  See Also

Grid Builder
Layout Tab, Grid Builder
Open Dialog Box
Relationship Tab, Grid Builder
Style Tab, Grid Builder


Style Tab, Grid Builder

See Also

The Style tab in the Grid Builder specifies a style for the grid display. This builder also has the Grid Items tab, Layout tab, and Relationship tab.

When you choose OK, the builder closes, applying the property settings from every tab.

Tab Options

Style   Specifies the Professional, Standard, Embossed, or Ledger style for the grid display. You can choose to preserve the current style.


  See Also

Grid Builder
Grid Items Tab, Grid Builder
Layout Tab, Grid Builder
Relationship Tab, Grid Builder


Layout Tab, Grid Builder

See Also

The Layout tab in the Grid Builder specifies column captions and the type of control you can add to the Grid. This builder also has the Grid Items tab, Style tab, and Relationship tab.

When you choose OK, the builder closes, applying the property settings from every tab.

Note   You must select a column before you can change its heading.

Tab Options

Caption   Specifies the caption for the selected column. Type a caption in the box. If you do not specify a caption, the field names will be the column headings.

Control Type   Specifies the type of control to add to the selected column. Text or edit boxes are available for character data, text or check boxes are available for logical data, and text boxes or spinners are available for numeric data.

Grid Display   Shows the grid columns as currently specified. The display automatically updates according to your Caption and Control Type selections. You can set the columns to the desired width by dragging the right edge of a heading.


  See Also

Grid Builder
Grid Items Tab, Grid Builder
Style Tab, Grid Builder
Relationship Tab, Grid Builder


Relationship Tab, Grid Builder

See Also

The Relationship tab in the Grid Builder specifies a relationship between grid fields and table fields. This builder also has the Grid Items tab, Style tab, and Layout tab.

When you choose OK, the builder closes, applying the property settings from every tab.

Tab Options

Key Field in Parent Table   Specifies the key field of the controlling table in a relationship. This option corresponds to the LinkMaster property. To find a table, click the dialog button, which displays the Open dialog box.

Related Index in Child Table   Specifies the index tag name of the controlled table in a relationship. This option corresponds to the ChildOrder property.


  See Also

ChildOrder Property
Grid Builder
Grid Items Tab, Grid Builder
Style Tab, Grid Builder
Layout Tab, Grid Builder
LinkMaster Property


List Box Builder

See Also

The List Box Builder makes it easy to set properties for a List Box control. List boxes provide the user with a scrollable list that contains a number of options or pieces of information. In a list box, multiple items can be visible at all times. You set list box properties by selecting options displayed in the List Box Builder dialog box.

To use the List Box Builder

1.	Using the Form Controls toolbar, place a List Box control on a form.

2.	Select and right-click the List Box control, and then choose Builder from the Form Designer Shortcut Men.

3.	Choose the options you want from the dialog, and then choose OK.

When you choose OK, the builder closes, applying the property settings from every tab.

Builder Tabs

List Items   Specifies items to fill the list box and the sources of that data.

Style   Specifies style (3D or plain) and number of rows, and enables or disables incremental searching.

Layout   Controls column width and display.

Value   Specifies from which column to get return values and which field to store them in.


  See Also

Form Designer Shortcut Menu
Layout Tab, List Box Builder
List Box Control
List Items Tab, List Box Builder
Properties Window
Style Tab, List Box Builder
Value Tab, List Box Builder


List Items Tab, List Box Builder

See Also

The List Items tab in the List Box Builder specifies items to fill the list box. The other List Box Builder tabs are Layout tab, Style tab, and Value tab.

When you choose OK, the builder closes, applying the property settings from every tab.

Tab Options

Fill the List With   Specifies the kind of data with which to fill the list. The selection you make here determines which options appear on this tab. The options are Fields from a Table or View, Data Entered by Hand, and Values from an Array. Each set of options is described below.

Fields from a Table or View

Databases and Tables   Lists the available databases and the option to select Free Tables. To find a database or table, click the dialog button, which displays the Open dialog box.

List of Tables   Displays tables and views in the selected database, or free tables.

Available Fields   Shows all fields in the selected table or view. Select the fields whose data you want in your list box.

Arrow Buttons   Adds fields to and removes fields from the Selected Fields list.

Selected Fields   Displays the fields that will be used to fill the list. This option corresponds to the RowSource property.

Data Entered by Hand

Columns   Specifies the number of columns in the list. This option corresponds to the ColumnCount property.

Column Grid   Displays the columns in which to enter data. Type the data in the grid cells. You can size the columns by dragging the lines between the column headers with the mouse. Use the arrow keys to move through the columns. This option corresponds to the RowSource property.

Values from an Array

Array Name   Specifies the name of an array. This option corresponds to the RowSource property.

Entire Array   Specifies that the entire array will fill the list.

Range of the Array   Specifies that a part of the array will fill the list.

Column and Row Range   Specifies the starting and ending column and row as the array range. These options are available when you select Range of the Array. This option corresponds to the FirstElement property, NumberOfElements property, and ColumnCount property.


  See Also

Layout Tab, List Box Builder
List Box Builder
Open Dialog Box
RowSource Property
RowSourceType Property
Style Tab, List Box Builder
Value Tab, List Box Builder


Style Tab, List Box Builder

See Also

The Style tab in the List Box Builder specifies style, number of rows to display, and incremental searching. The other List Box Builder tabs are List Items tab, Layout tab, and Value tab.

When you choose OK, the builder closes, applying the property settings from every tab.

Tab Options

Three-dimensional   Specifies a three-dimensional look for the list box. This option corresponds to the SpecialEffect property.

Plain   Specifies a plain look for the list box. This option corresponds to the SpecialEffect property.

Rows to Display   Sets the Height property of the list box so that it displays only the specified number of rows at a time.

Yes, Enable Incremental Searching   Specifies whether the control tries to match an item in the list as the user types each letter. This option corresponds to setting the IncrementalSearch property to .T.

No, Don’t Enable Incremental Searching   Disables incremental searching. This option corresponds to setting the IncrementalSearch property to .F.


  See Also

Height Property
IncrementalSearch Property
Layout Tab, List Box Builder
List Box Builder
List Items Tab, List Box Builder
SpecialEffect Property
Value Tab, List Box Builder


Layout Tab, List Box Builder

See Also

The Layout tab in the List Box Builder controls column width and display. The other List Box Builder tabs are: List Items tab, Style tab, and Value tab.

When you choose OK, the builder closes, applying the property settings from every tab.

Tab Options

Adjust the Width of the List Box to Display All Columns   Specifies that all columns will be displayed, and the list box will be automatically sized as required. This option corresponds to the Width property.

Column Grid   Shows the columns defined on the List Items tab. You can adjust the column width by dragging the right edge of a column heading with the mouse. Double-click a column heading to hide the column. This option corresponds to the ColumnWidths property.


  See Also

ColumnWidths Property
List Box Builder
List Items Tab, List Box Builder
Style Tab, List Box Builder
Value Tab, List Box Builder.
Width Property


Value Tab, List Box Builder

See Also

The Value tab in the List Box Builder specifies where to get return values and where to store them. The other List Box Builder tabs are: List Items tab, Style tab, and Layout tab.

When you choose OK, the builder closes, applying the property settings from every tab.

Tab Options

Return the Value From   Specifies the column or field from which to get a value when the user selects a list box item. This option corresponds to the BoundColumn property.

Field Name   Specifies a table or view field in which to store the value specified in the Return the Value From box. By default, the list includes fields from a table or view selected on the List Items tab. Choose the dialog button to display the Open dialog box so you can select another file. This option corresponds to the ControlSource property.


  See Also

BoundColumn Property
ControlSource Property
Layout Tab, List Box Builder
List Box Builder
List Items Tab, List Box Builder
Open Dialog Box
Style Tab, List Box Builder


Option Group Builder

See Also

The Option Group Builder makes it easy to set properties for an Option Group control. Option buttons allow users to choose one of several mutually exclusive options. You set properties by selecting options displayed in the Option Group Builder dialog box.

To use the Option Group Builder

1.	Using the Form Controls toolbar, place an Option Group control on a form.

2.	Select and right-click the Option Group control, and then choose Builder from the Form Designer Shortcut Menu.

3.	Choose the options you want from the dialog, and then choose OK.

When you choose OK, the builder closes, applying the property settings from every tab.

Builder Tabs

Buttons   Specifies number of buttons, captions, and graphics.

Layout   Specifies option button layout (vertical or horizontal), spacing, and border style.

Value   Specifies a table or view field in which to store the option group’s value.


  See Also

Buttons Tab, Option Group Builder
Layout Tab, Option Group Builder
Option Group Control
Value Tab, Option Group Builder


Buttons Tab, Option Group Builder

See Also

The Buttons tab in the Option Group Builder specifies the number of buttons, captions, and graphics. This builder also has the Layout tab and the Value tab.

When you choose OK, the builder closes, applying the property settings from every tab.

Tab Options

Number of Buttons   Specifies the number of buttons the option group will have. This option corresponds to the ButtonCount property.

Standard   Specifies radio-style option buttons. The Graphic column is disabled when Standard is selected.

Graphical   Specifies rectangular option buttons. You can specify both caption and graphic in the columns when this is selected.

Caption Column   Specifies the caption to display next to the button. Type the caption in the box, or leave it blank if you don’t want a caption. This option corresponds to the Caption property.

Graphic Column   Specifies the path and file name of the bitmap to display on the button. Type the path and file name in the box, or click the dialog button to display the Open dialog box so you can select a file. This option corresponds to the Picture property of the Option button.

Note   Option buttons may have both captions and graphics. You can also specify graphics to be displayed when the button is disabled and when it is pressed, but you must do so programmatically or in the Properties window. For more details, see the DisabledPicture and DownPicture properties.


  See Also

ButtonCount
Caption Property
DisabledPicture
DownPicture
Layout Tab, Option Group Builder
Option Group Builder
Picture Property
Properties Window
Value Tab, Option Group Builder


Layout Tab, Option Group Builder

See Also

The Layout tab in the Option Group Builder specifies button layout (vertical or horizontal), spacing, and border style. This builder also has the Buttons tab and Value tab.

When you choose OK, the builder closes, applying the property settings from every tab.

Tab Options

Button Layout   Specifies vertical or horizontal layout of option group buttons by adjusting the Width property.

Spacing Between Buttons   Specifies spacing between buttons by adjusting the Width property or the Height property.

Border Style   Specifies a single-line border around the option group, or no border. This option corresponds to the BorderStyle property.


  See Also

BorderStyle Property
Buttons Tab, Option Group Builder
Option Group Builder
Value Tab, Option Group Builder


Value Tab, Option Group Builder,
Value Tab, Option Group Builder

See Also

The Value tab in the Option Group Builder specifies a table or view field in which to place the option group’s value. This builder also has the Buttons tab and Layout tab.

When you choose OK, the builder closes, applying the property settings from every tab.

Tab Options

Field Name   Specifies a table or view field in which to store the option group’s value. By default, the list includes fields from a table. Choose the dialog button to display the Open dialog box so you can select another file. This option corresponds to the ControlSource property.


  See Also

Buttons Tab, Option Group Builder
ControlSource Property
Layout Tab, Option Group Builder
Open Dialog Box
Option Group Builder


Referential Integrity Builder

See Also

The Referential Integrity (RI) Builder helps you ensure referential integrity by setting up triggers to control how records are inserted, updated, or deleted in related tables.

The RI Builder is displayed when you:

•	Double-click a relationship line between two tables in the Database Designer and choose the Referential Integrity button in the Edit Relationship dialog box.

•	Choose Edit Referential Integrity from the Database Designer shortcut menu.

•	Choose Edit Referential Integrity from the Database menu.

Builder Tabs

Rules for Updating   Specifies rules to apply when the key value in the parent table is modified.

Rules for Deleting   Specifies rules to apply when a record in the parent table is deleted.

Rules for Inserting   Specifies rules to apply when a new record is inserted or an existing record is updated in the child table.


  See Also

Database Designer
Edit Relationship Dialog Box
Rules for Deleting Tab
Rules for Inserting Tab
Rules for Updating Tab


Rules for Updating Tab, RI Builder

See Also

The Rules for Updating tab in the Referential Integrity Builder specifies rules to apply when the key value in the parent table is modified. This builder also has the Rules for Deleting tab and the Rules for Inserting tab.

Tab Options

Cascade   Specifies that changes in the fields of the Primary or Candidate key of the parent table are reflected in related child tables. If you select this option, any time you change any of those fields in the parent table, Visual FoxPro automatically changes the corresponding values in all related child table records.

Restrict   Prevents modification of values in fields of the Primary or Candidate key of the parent table so there are no orphaned records in the child table.

Ignore   Allows you to update records in the parent table, even if there are related records in the child table.

Referential Integrity Grid

•	Parent Table displays the name of the table in the database relation containing the primary or candidate index.

•	Child Table displays the name of the child table in the database relation.

•	Update displays the update rules for referential integrity for the relation. Possible values are Cascade, Restrict, or Ignore. You can change the settings by selecting the field, which will present a drop-down list of the choices.

•	Delete displays the delete rules for the referential integrity for the relation. Possible values are Cascade, Restrict, or Ignore. You can change the settings by selecting the field, which will present a drop-down list of the choices.

•	Insert displays the insert rules for the referential integrity for the relation. Possible values are Cascade, Restrict, or Ignore. You can change the settings by selecting the field, which will present a drop-down list of the choices.

•	Parent Tag grid column displays the tag name of the index in the Primary or Candidate in the Parent table.

•	Child Tag grid column displays the tag name of the index in the child table.


  See Also

Referential Integrity Builder
Rules for Deleting Tab
Rules for Inserting Tab


Rules for Deleting Tab, RI Builder

See Also

The Rules for Deleting tab in the Referential Integrity Builder specifies rules to apply when a record in the parent table is deleted. This builder also has the Rules for Updating tab and the Rules for Inserting tab.

Tab Options

Cascade   Specifies that deletions in the parent table are reflected in the related child tables. If you select Cascade Delete for a relationship, whenever you delete records in the parent table, records in the related child table are automatically deleted.

Restrict   Prevents you from deleting records in the parent table that have related records in the child table. If you select Restrict Delete for a relationship, an attempt to delete records in the parent table generates an error if there are related records in the child table.

Ignore   Allows you to delete records in the parent table, even if there are related records in the child table.

Referential Integrity Grid

•	Parent Table displays the name of the table in the database relation containing the primary or candidate index.

•	Child Table displays the name of the child table in the database relation.

•	Update displays the update rules for referential integrity for the relation. Possible values are Cascade, Restrict, or Ignore. You can change the settings by selecting the field, which will present a drop-down list of the choices.

•	Delete displays the delete rules for the referential integrity for the relation. Possible values are Cascade, Restrict, or Ignore. You can change the settings by selecting the field, which will present a drop-down list of the choices.

•	Insert displays the insert rules for the referential integrity for the relation. Possible values are Cascade, Restrict, or Ignore. You can change the settings by selecting the field, which will present a drop-down list of the choices.

•	Parent Tag grid column displays tag name of the index in the Primary or Candidate in the Parent table.

•	Child Tag grid column displays the tag name of the index in the child table.


  See Also

Referential Integrity Builder
Rules for Inserting Tab
Rules for Updating Tab


Rules for Inserting Tab, RI Builder

See Also

The Rules for Inserting tab in the Referential Integrity Builder specifies rules to apply when a new record is inserted or an existing record is updated in the child table. This builder also as the Rules for Updating tab and the Rules for Deleting tab.

Tab Options

Restrict   Prevents you from adding records in the child table for which there are no matching record in the parent table. If you select Restrict Insert for a relationship, an attempt to add records in the child table generates an error if there is no matching parent record .

Ignore   Allows you to insert records into the child table regardless of whether there is a matching record in the parent table.

Referential Integrity Grid

•	Parent Table displays the name of the table in the database relation containing the primary or candidate index.

•	Child Table displays the name of the child table in the database relation.

•	Update displays the update rules for referential integrity for the relation. Possible values are Cascade, Restrict, or Ignore. You can change the settings by selecting the field, which will present a drop-down list of the choices.

•	Delete displays the delete rules for the referential integrity for the relation. Possible values are Cascade, Restrict, or Ignore. You can change the settings by selecting the field, which will present a drop-down list of the choices.

•	Insert displays the insert rules for the referential integrity for the relation. Possible values are Cascade, Restrict, or Ignore. You can change the settings by selecting the field, which will present a drop-down list of the choices.

•	Parent Tag grid column displays tag name of the index in the Primary or Candidate in the Parent table.

•	Child Tag grid column displays the tag name of the index in the child table.


  See Also

Referential Integrity Builder
Rules for Inserting Tab
Rules for Updating Tab


Text Box Builder

See Also

The Text Box Builder makes it easy to set properties for a Text Box control. The text box is the basic control that allows users to add or edit data in a Character, Numeric, or Date field in a table. You set properties by selecting options displayed in the Text Box Builder dialog box.

To use the Text Box Builder

1.	Using the Form Controls toolbar, place a Text Box control on a form.

2.	Select and right-click the Text Box control, and then choose Builder from the Form Designer Shortcut Menu.

1.	Choose the options you want from the dialog, and then choose OK.

When you choose OK, the builder closes, applying the property settings from every tab.

Builder Tabs

Format   Specifies miscellaneous format options for the text box and the type of input mask.

Style   Specifies text box visual effect, border, and character alignment.

Value   Specifies a field in which to store the text box’s value.


  See Also

Format Tab, Text Box Builder
Style Tab, Text Box Builder
Text Box Control
Value Tab, Text Box Builder


Format Tab, Text Box Builder

See Also

The Format tab in the Text Box Builder specifies miscellaneous format options for the text box and the type of input mask. This builder also has the Value tab and the Style tab.

When you choose OK, the builder closes, applying the property settings from every tab.

Tab Options

Data Type   Specifies a Character, Date, Logical, or Numeric data type for your text box. If you choose a value in the Value tab, make sure it is the same data type as the value specified here.

Enable at Run Time   Specifies that the text box be enabled when the form is run. This option is available for all data types and is checked by default. This option corresponds to the Enabled property.

Alphabetic Characters Only   Specifies that only alphabetic characters be allowed in the text box (no numbers or symbols). This option is available for Character data type only. This option corresponds to the “A” setting of the Format property.

Make Read-Only   Prevents the user from changing the text in the text box. This option corresponds to the ReadOnly property and is available for all data types.

Select on Entry   Specifies that the text in the text box be selected when the text box has the focus. This option is available for the Character data type only. This option corresponds to the “K” setting of the Format property.

Hide Selection   Specifies whether or not selected text in the text box remains visibly selected when the text box doesn’t have the focus. This option corresponds to the HideSelection property and is available for all data types.

Display Leading Zeros   Specifies that zeros to the left of the decimal point be displayed. This is available for the Numeric data type only. This option corresponds to the “L” setting of the Format property.

Use Current SET DATE   Adds the setting “D” to the Format property so that date entries will conform to the current SET DATE or Date Format of the Regional tab of the Options dialog box. This option appears when you select Date in the Data Type drop-down box.

British Date   Adds the setting “E” to the Format property so that date entries will conform to British formatting of SET DATE or of the Date Format of the Regional tab of the Options dialog box. This option appears when you select Date in the Data Type drop-down box.

Input Mask   Specifies format of user input for Numeric, Character, and Logical fields. Several options are available from the drop-down list; an example of the selected input mask appears to the right of the drop-down list. For example, an input mask for a Numeric data type is North American phone number format:
(###) ###-####.


  See Also

Enabled Property
Format Property
HideSelection Property
Input Mask Property
ReadOnly Property
Style Tab, Text Box Builder
Text Box Builder
Value Tab, Text Box Builder


Style Tab, Text Box Builder

See Also

The Style tab in the Text Box Builder specifies text box visual effect, border, and character alignment. This builder also has the Value tab and the Format tab.

When you choose OK, the builder closes, applying the property settings from every tab.

Tab Options

Special Effect

3D   Specifies a bold left and top edge for the text box. This option corresponds to the 3D setting of the SpecialEffect property.

Plain   Specifies that the text box is an unshadowed box on the form.This option corresponds to the Plain setting of the SpecialEffect property.

Border

Single   Specifies a single line around the text box. This option corresponds to the Fixed-Single setting of the BorderStyle property.

None   Specifies no line around the text box. This option corresponds to the None setting of the BorderStyle property.

Character Alignment

Left   Specifies that text in the text box will be left-aligned. This option corresponds to the Left setting of the Alignment property.

Right   Specifies that text in the text box will be right-aligned. This option corresponds to the Right setting of the Alignment property.

Center   Specifies that text in the text box will be centered. This option corresponds to the Center setting of the Alignment property.

Automatic   Specifies that text in the text box will be aligned according to the data type of the control source. This option corresponds to the Automatic (Default) setting of the Alignment property.

Size Text Box to Fit   Automatically sizes the text box. If an input mask is specified, the input mask settings are used to fit the text box. If not, then the ControlSource property field length is used to fit the text box.


  See Also

BorderStyle Property
ControlSource Property
Format Tab, Text Box Builder
SpecialEffect Property
Text Box Builder
Value Tab, Text Box Builder


Value Tab, Text Box Builder

See Also

The Value tab in the Text Box Builder specifies a field in which to store the text box’s value. This tab also has the Format tab and the Style tab.

When you choose OK, the builder closes, applying the property settings from every tab.

Tab Options

Field Name   Specifies a table or view field in which to store the text box’s value. Choose the dialog button to display the Open dialog box so you can select a file. This option corresponds to the ControlSource property.


  See Also

ControlSource Property
Format Tab, Text Box Builder
Open Dialog Box
Style Tab, Text Box Builder
Text Box Builder


Using BUILDER.DBF

See Also

You can use the BUILDER.DBF table to specify a builder application. Each record contains fields that represent the name of a builder, optionally, a description of the builder, and a field called Type that identifies the Class or Base Class property that invokes the custom builder. For instance, the Type entry for a Command Button is Commandbutton and the Type entry for the Autoformat builder is Multiselect because it runs against multiple selected controls.

The following table describes a BUILDER table record.

Field Name	Field Type	Width (comment)
NAME	Character	45 (Builder name)
DESCRIPT	Memo	4
BITMAP (unused)	Memo	4
TYPE	Character	20
PROGRAM	Memo	4 (Builder application)
CLASSLIB	Memo	4 (Class Library name)
CLASSNAME	Memo	4 (Builder Class)
PARMS	Memo	4 (passed parameter list)
The named builder application compares the value in the Type field and the Class of the object and starts if there is a match. If more than one match is found, a selection dialog displays.

By default, the BUILDER.APP application passes three parameters, listed in the PARMS field of BUILDER.DBF, to a builder program:

PARMS Entry	Description
wbReturnValue	Variable containing a value to be returned to the BUILDER.APP.
<character string>	A literal string to pass to Register table.
<optional value>	A keyword or other value to pass to BUILDER .APP
To create a custom builder

1.	Write an application that provides an interface and modifies the selected control or controls.

1.	Save the application in the Wizards folder

2.	Open the BUILDERS.DBF table and append a new record

3.	Enter values for the Name, Descript, Type, and program fields.

If your custom builder uses additional values, you can also enter values for the remaining fields.

After you complete all entries and close the Browse, the new builder is registered. For example, if you create a program that changes the fonts of selected controls, then save the program in a file called CHGFONT.PRG, the following table shows the entries for BUILDER.DBF.

Field Name	Value
NAME	The Builder That Changes Fonts
DESCRIPT	This builder modifies the font of all selected controls
TYPE	MULTISELECT
PROGRAM	CHGFONT.PRG
When you use the builder, Visual FoxPro displays the Builder Selection dialog box because there are now two builders of the Multiselect type. When you choose the “The Builder that Changes Fonts” option, BUILDER.APP runs the program you saved as CHGFONT.PRG.


  See Also

Builder System Variable


Browsing Classes

See Also

You can browse, track, and modify classes using the Visual FoxPro Class Browser.

To	See
Run the Class Browser	Running the Class Browser
Look at a class hierarchy	Viewing Class Hierarchies
View specific classes	Filtering the Class Browser Class List
View the code for a class	Viewing Class Definition Code
View typelib and object library information	Viewing Type Library Information
Create, remove, redefine, or copy classes	Managing Classes with the Class Browser
Add an instance of a class to a form	Adding Controls to Forms with the Class Browser
Modify classes	Modifying Class Icons and Descriptions
Modify the Class Browser	Customizing the Class Browser


 See Also

Adding Controls to Forms with the Class Browser
Class Browser Buttons
Class Browser Window
Customizing the Class Browser
Filtering the Class Browser Class List
Managing Classes with the Class Browser
Modifying Class Icons and Descriptions
Running the Class Browser
Viewing Class Definition Code
Viewing Class Hierarchies


Running the Class Browser

See Also

You can run the Class Browser from the Visual FoxPro menu or from the Command window.

To run the Class Browser

1	From the Tools menu, choose Class Browser.

 – Or –

Use the DO command and the _BROWSER system variable:

DO (_BROWSER)

The program stored by default to the _BROWSER system memory is BROWSER.APP. BROWSER.APP accepts five optional arguments:

DO (_BROWSER) [WITH [tcFileName][, tcDefaultClass[.member]][, tlListBox][, tcClassType][, tnWindowState]]

Argument	Description
tcFileName	The name of the .VCX, .SCX, .OLB, .TLB, .PJX, or .EXE file to open in the Class Browser. If not specified, the Open dialog box is displayed so you can select a file to open.
TcDefaultClass[.member]	The class in the .VCX to be selected by default. If no default class is specified, the class library is selected. If a member is specified, that member is selected in the Members list.
tlListBox	Whether to display the classes and members in list boxes rather than treeview controls. Include true (.T.) for this parameter to display the list boxes. The default is false (.F.)
tcClassType	Specifies the initial Type filter for the classes displayed in the Class Browser. You can change the filter in the Class Browser by choosing another value from the Type list. The default is no filter.
tnWindowState	0 - Normal (the default) 1 - Minimized 2 - Maximized
For example, the following command opens the Class Browser maximized with the print_report class in SAMPLES.VCX selected, the cmdOK object selected in the Members list, and the forms and members in SAMPLES.VCX displayed in list boxes:

DO (_BROWSER) WITH "samples.vcx", "print_report.cmdOK", .T., "form", 2


 See Also

Adding Controls to Forms with the Class Browser
_BROWSER System Variable
Browsing Classes
Class Browser Buttons
Class Browser Methods
Class Browser Properties
Class Browser Window
Customizing the Class Browser
Filtering the Class Browser Class List
Managing Classes with the Class Browser
Modifying Class Icons and Descriptions
Running the Class Browser
Viewing Class Definition Code


Viewing Class Hierarchies

See Also

With the Class Browser, you can see the hierarchy for a class library. You can also view user-defined members for a class and track the inheritance of members between related classes.

To view class members and hierarchies

1	Run the Class Browser.

2	Open a class library.

3	From the Class list, select a class. The Class Browser displays the icon for the class in the Class list and beside the Type drop-down. The user-defined class members are displayed in the Members list.

If Hierarchical mode is selected on the shortcut menu, subclasses are displayed indented beneath parent classes.

For example, if you open TSBASE.VCX in the Visual FoxPro SAMPLES\TASTRADE\LIBS directory, you can select tsbaseform to view its user-defined members, and then select its subclass, tsmaintform, to view its members.

When a class is selected, you can easily view its parent.

To view the parent class

•	Right-click the class and then choose Select ParentClass from the shortcut menu. The Class Browser selects the parent class.

If the class has a chevron (<<) next to it, its parent class is located in a class library (.VCX) that is not displayed in the class list. When you choose Select ParentClass from the class shortcut menu, the class library containing the parent class is added to the class list, and the parent class is selected.

For example, open CUSTOMER.SCX from the SAMPLES\TASTRADE\FORM directory, right-click the frmcustomers folder icon, and choose Select ParentClass. The Class Browser adds its class library, TSBASE.VCX, to the Class list and selects the tsform class.

You can view multiple class libraries or form files by opening another file in the current Class Browser window or by opening another Class Browser window. You can also open the same file in several Class Browser windows.


 See Also

Adding Controls to Forms with the Class Browser
_BROWSER System Variable
Browsing Classes
Class Browser Buttons
Class Browser Methods
Class Browser Properties
Class Browser Window
Customizing the Class Browser
Filtering the Class Browser Class List
Managing Classes with the Class Browser
Modifying Class Icons and Descriptions
Running the Class Browser
Viewing Class Definition Code


Filtering the Class Browser Class List

See Also

You can use filters such as a Visual FoxPro base class type or a class name to display a specific set of classes in the Class list.

To filter the list of classes

1	Open a file in the Class Browser.

2	In the Type box, type a class name or select one from the list.

 – Or –

In the Type box, type a single filter, or several filters separated by a comma. The comma acts as a logical OR: a class needs to match only one filter to be included in the class list.

The classes matching the filters appear in the class list and the filter you entered is added to the drop-down list. The drop-down list keeps a history of the types and filters you have selected to view in the current instance of the Class Browser window. The list is not saved after the instance is closed.

Note   When you choose Alphabetical, Visual FoxPro evaluates all of the classes. When you choose Hierarchical, the default choice, Visual FoxPro evaluates the parent classes. If a parent class matches the filter, its child classes are evaluated. If the parent class does not match the filter, its child classes are not evaluated and do not appear in the list — even if the child matches the filter.

You can create a filter that combines characters in a class name with wildcards as described in the following table.

If you know this	Replace unknown characters with this
First characters in the class name	Asterisk (*). For example, to view all classes beginning with “VCR,” type VCR*.
All but one character of the class name	Question mark (?). For example, to view all classes starting with MsgBox and some number, such as MsgBox1, type MsgBox?.
A string of characters within the class name	Two percent signs (%%). For example, to view all classes containing the string “mover,” type %MOVER%.
You can also expand your search for classes to include a specific character string in its name or description.

To search by class name and description text

1	Open a file in the Class Browser, and then choose the Find button.

2	In the Find Class dialog box, type a string of text you want found.

3	A list of classes with the string in its name or description appears in the class list. If the list is hierarchical, only the matching parents classes and their associated matching subclasses are in the list. If you want to view any class that has the string of text, choose the alphabetical option.


 See Also

Adding Controls to Forms with the Class Browser
Browsing Classes
Class Browser Buttons
Class Browser Window
Customizing the Class Browser
Managing Classes with the Class Browser
Modifying Class Icons and Descriptions
Running the Class Browser
Viewing Class Definition Code
Viewing Class Hierarchies


Viewing Class Definition Code

See Also

If you want to see specific parameters or understand the logic behind a class, you can use the Class Browser to view the code for the class in one of three ways. You can even view the parent class code for a user-defined method.

To view class definition code

1	In the Class Browser, select the class you want to view.

2	Choose the View Class Code button.

3	Visual FoxPro displays the definition code for the class you selected in a read-only window. You can use some of the editing commands from the Edit menu, such as Find, Copy, and Select All.

The class definition displayed in the read-only window includes all property settings and method and event code.

Note   The code displayed is for information. In many cases, you can save it to a program and run it directly, but code with nested containers will generate errors.

To modify a class that is displayed in the Class Browser

•	Double-click the class in the Class list.

To edit method code of a method in the Members list

•	Double-click the method in the Members list.

When you modify a class or form while the Class Browser window is open, you can easily view the ParentClass code for a method or event.

To view ParentClass code for a method

1	Double-click a class or member.

2	If no code window is open in the Form Designer or Class Designer, choose Code from the View menu.

3	Choose the Edit ParentClass Method toolbar button.

Note   You can also view code or modify a class by selecting the class in the Members list and pressing the SPACEBAR.


 See Also

Adding Controls to Forms with the Class Browser
Browsing Classes
Class Browser Buttons
Class Browser Window
Customizing the Class Browser
Filtering the Class Browser Class List
Managing Classes with the Class Browser
Modifying Class Icons and Descriptions
Running the Class Browser
Trace Window
Viewing Class Hierarchies
Viewing Type Library Information


Viewing Type Library Information

See Also

Type libraries are OLE compound document files that include information about types and objects exposed by an OLE application. A type library can be a stand-alone binary file (.TLB), compiled in an application file (.EXE) or included in a DLL. DLLs with one or more type libraries are often compiled as object libraries (.OLB).

To view type library information

1	In the Class Browser, choose Open or View Additional File.

2	In the Files of type drop-down list in the Open dialog box, choose Application, *.olb, or *.tlb.

The type library information for the selected file is displayed in the Members list.


 See Also

Adding Controls to Forms with the Class Browser
Browsing Classes
Class Browser Buttons
Class Browser Window
Customizing the Class Browser
Filtering the Class Browser Class List
Managing Classes with the Class Browser
Modifying Class Icons and Descriptions
Running the Class Browser
Trace Window
Viewing Class Hierarchies


Managing Classes with the Class Browser

See Also

You can create subclasses, copy classes from one class library to another, remove classes and library files, rename a class, or redefine the relationship of a class.

Caution   If you remove, rename, or redefine a class, the forms that are not currently displayed in a Class Browser window and that rely on the class might not run properly.

To add a subclass

1	In the Class Browser, open a class library.

2	Select the class you want to subclass, and then choose the New Class button.

3	In the New Class dialog box, enter the name for the new subclass.

4	In the Class Designer, define and save the subclass.

5	The Class Browser displays the new subclass.

To copy a class from one class library to another

1	In the Class Browser, open the source class library.

2	From the Tools menu, open a second instance of the Class Browser and select the destination library file.

3	In the source class library, select the class you want to copy, and then drag the class icon picture located above the class list to the class icon picture in the destination library. The cursor appears with a plus sign when you are over the destination class icon.

4	In the dialog box that opens, choose Yes to move the class, No to copy the class, or Cancel to prevent changes to either library.

To copy multiple classes from one class library file to another

1	Open the source class library in the Class Browser.

2	If you want to filter the class list, type a filter in the Type box to limit the classes you want to copy from the file.

3	From the Tools menu, open a second instance of the Class Browser and select the destination library file.

4	In the source class library, select the class library file you want to copy, and then drag the class icon picture located above the class list to the class icon picture in the destination library. The cursor appears with a plus sign when you are over the destination class icon picture.

5	In the dialog box that opens, choose Yes to move all the classes, No to copy all the classes, or Cancel to prevent changes to either library.

To remove a class, class library, or form

1	Open the class library or form in the Class Browser.

2	In the Class list, select the class, class library, or form you want to remove or delete, and then choose the Remove button. For classes, the record in the library is marked for deletion the next time you choose Clean Up Library. For class libraries and forms, the file is deleted from the disk.

To rename a class in a class library

1	Open the class library in the Class Browser.

2	In the Class list, select the class you want to rename, and then choose the Rename button.

Caution   If you rename a class that has associated subclasses that are not currently contained in an open Class Browser window, the subclasses will not be able to reference properties that are inherited from the renamed class.

3	In the Rename Class dialog box, type the new name, and then choose Rename.

4	The Class Browser displays the new name and the new name is automatically referenced in all the affected forms and classes currently displayed in Class Browser windows.

To change the parent class of a class

1	Open the class library in the Class Browser.

2	In the Class list, select the class you want to redefine, and then choose the Redefine button.

3	In the As box of the Redefine dialog box, type the name of the new parent class. The new parent must be derived from the same base class as the original. For example, you can redefine a class derived from the base class toolbar to another toolbar class, but cannot redefine it as a form class.

4	In the Of box, select or type the class library file name.


 See Also

Browsing Classes
Class Browser Buttons
Class Browser Methods
Class Browser Properties
Class Browser Window
Customizing the Class Browser
Filtering the Class Browser Class List
Modifying Class Icons and Descriptions
Running the Class Browser
Viewing Class Hierarchies
Viewing Type Library Information


Creating Instances of Classes with the Class Browser

See Also

You can easily create instances of classes displayed in the Class Browser.

To create an instance of a class

1	Open the class library or form in the Class Browser.

2	In the Class list, select the class or form you want to create an instance of.

3	Drag the class icon from beside the Type list and drop it on the main Visual FoxPro window.

If you drop a form or form class on the main Visual FoxPro window, the form is created and displayed. If you drop a control on the main Visual FoxPro window, the control is added to the _SCREEN object. If you hold the SHIFT key down during the drag operation, the object is created but not made visible.

Note   When you create an instance of a class, the code in the Init event, and possibly other events, executes. You need to know what code is associated with your classes before creating an instance. If the class expects an environment that has not be set up, errors will occur. The Class Browser does not provide error handling for user-defined classes.

To remove an object from the _SCREEN object

•	Use the RemoveObject method of _SCREEN.

For example, if you drag the VCR class from SAMPLES\CLASSES\BUTTONS.VCX and drop it on the form, the following line of code in the Command window removes it:

_SCREEN.RemoveObject("VCR1")


 See Also

Browsing Classes
Class Browser Buttons
Class Browser Window
Customizing the Class Browser
SaveAs Method
SaveAsClass Method
Viewing Class Hierarchies
Viewing Type Library Information


Adding Controls to Forms with the Class Browser

See Also

You can add controls from the Class Browser while designing or running a form.

To add controls to a form or container

1	In the Form Designer, open the form.

2	In the Class Browser, open the class library file containing the class of the object you want to add to the form.

3	From the Class list, select the class name, and then drag and drop the class icon on the form. The class icon is located above the Class list.

To view the class for a control on a form or in a container

1	In the Form Designer, select the control.

2	From the Tools menu, choose Class Browser. The Class Browser opens and displays the class of the control you selected on the form.

You can design your forms so that you can add objects of a class from the Class Browser on the form while it is running. You might want to design a form class that has this feature as one of its properties.

To add objects on a running form or a container on a form

1	Run the form.

2	Open the Class Browser and view the class list containing the class of object you want to add to the form.

3	Select the class you want and drag the class icon from the Class Browser to the form.

4	A new object appears on the form based on the class you selected from the Class Browser.

Tip   You can also add an instance of the selected class to any container by positioning the mouse pointer over the container and entering the following line of code in the Command window:

_oBrowser.FormAddObject(SYS(1270))

To view the class for a control on a running form

1	Set the focus to the control.

2	From the Tools menu, choose Class Browser. The Class Browser evaluates _SCREEN.ActiveForm.ActiveControl and displays the class of the control you selected on the form.


 See Also

Browsing Classes
Class Browser Buttons
Class Browser Window
Customizing the Class Browser
SaveAs Method
SaveAsClass Method
Viewing Class Hierarchies
Viewing Type Library Information


Modifying Class Icons and Descriptions

See Also

Using the Class Browser, you can modify the container icon, class description, and member descriptions for a class. You can also modify a class through the Class Designer from the Class Browser.

When you select a class in the Class Browser, the icon for the class appears above the class list. You can assign a different bitmap or icon to the class. By default, the class container icon and toolbar icon are the same as the parent’s.

To change the class icon

1	In the Class Browser, select the class with the icon you want to change.

2	Right click the mouse to choose the Class Icon picture located above the class list.

3	In the Open dialog box, select the new bitmap or icon, then choose OK.

4	The new icon replaces the old one in the Class Browser. If the old class icon for the container and toolbar were the same, both change to the new icon. If they were different, only the container icon changes.

5	You might see a prompt asking if you wish to reset the class library icon to the default, which is the icon Visual FoxPro uses for its base classes. If you want to change the icon to match its base class, choose Yes.

To change class and member descriptions without opening each class in the Class Designer, you can use the description boxes in the Class Browser.

To change the description for a class, method, or property

1	In the Class Browser, select the class you want to change.

2	In the edit box in the bottom-left corner of the window, type the new text for the class description.

3	In the Members list, select a method or property.

4	In the edit box in the bottom-right corner of the window, type the new text for the property description.

If no member is selected in the Members list, the edit box in the bottom-right corner of the window displays the class and timestamp information for the class selected in the Classes list.

Note   You can change the descriptions for methods and properties. The descriptions for classes, object members, and instances are read-only.

If you want to modify more than the icon and descriptions for a class, you can open the Class Designer by selecting a class or file name in the Class Browser.

To modify a class in the Class Designer

•	In the Class list, double-click the name of a class to open the Class Designer.

 – Or –

•	In the Class list, double-click the name of a file, and then choose a class in the Open dialog box.


 See Also

Browsing Classes
Class Browser Buttons
Class Browser Window
Class Designer
Customizing the Class Browser
Filtering the Class Browser Class List
Managing Classes with the Class Browser
MODIFY CLASS Command
Viewing Class Definition Code
Viewing Class Hierarchies
Viewing Type Library Information


Customizing the Class Browser

See Also

You can change the properties, events, and methods of the Class Browser.

To programmatically manipulate the Class Browser

1	Open the Class Browser to automatically create the public variable _oBrowser. You can use this variable to reference or manipulate the Class Browser form as you can any form object.

2	Set the properties of the Class Browser you want to change.

For example, before or after opening the Class Browser, you can set the Caption property of the Class Browser to “Hello” and the Left property to 10 with the following lines of code:

_OBROWSER.Caption = "Hello"

_OBROWSER.Left = 10


 See Also

Browsing Classes
_BROWSER System Variable
Class Browser Buttons
Class Browser Methods
Class Browser Object Members
Class Browser Properties
Class Browser Window
Initial Values of Class Browser Properties


Class Browser Window

See Also

The Class Browser displays the classes in a class library or a form and the type library information in a .TLB, .OLB, or .EXE file. You can use the Class Browser to view, use, and manage classes and their user-defined members.

Tip   You can open the Class Browser shortcut menu by clicking the right mouse button on the Class Browser window or by pressing ALT+F10.

To use the Class Browser, choose Class Browser from the Tools menu and specify a file, or type DO (_BROWSER) in the Command window.

Window Options

Class Browser Buttons   Perform various Class Browser commands. Additional functionality is provided through the Class Browser Shortcut menu.

Type Box   Allows selection or entry of a class type or character string to filter the class list. The drop-down list shows the base classes. The list also keeps a history of class types and filters you have selected or entered for the current instance of the Class Browser.

Class Icon   Displays an icon representing the selected class. The icon can be dragged to the main Visual FoxPro window to create an instance of the class. A user-defined bitmap can be assigned to the class icon.

Class List   Lists the classes and subclasses contained in a class library (.VCX) or a form (.SCX) in a hierarchical or alphabetical view. A chevron (<<) next to a class indicates that the parent class is in a file not displayed in the current Class list. To see the parent class, choose Select ParentClass from the shortcut menu. To modify any class in the Class Designer, double-click the class name.

Member List   Lists the user-defined properties and methods of the class or form selected in the Class list. You can filter this list by selecting options from the Member list shortcut menu.

•	Protected filter   If a check mark is displayed beside the Protected filter shortcut menu item, protected members are displayed in the Member list. Protected members are indicated by an asterisk (*).

•	Hidden filter   If a check mark is displayed beside the Hidden filter shortcut menu item, hidden members are displayed in the Member list. Hidden members are indicated by an carat (^).

•	Empty filter   If a check mark is displayed beside the Empty filter shortcut menu item, empty methods are displayed in the Member list. Empty methods are indicated by an tilde (~).

Class Description Box   Displays a description for the selected class. This box is located at the bottom left of the Class Browser window. You can edit the description in this box.

Member Description Box   Displays information about the selected member of a class. This box is located at the bottom right of the Class Browser window.

For object members, the box is a read-only display of class and base class. For property or method members, the box displays a description you can edit. For instances, the box displays a read-only description that includes the variable scope (public or hidden), member names, and property values.


See Also

Adding Controls to Forms with the Class Browser
Browsing Classes
Class Browser Buttons
Class Browser Methods
Class Browser Properties
Class Designer
Command Window
Customizing the Class Browser
Filtering the Class Browser Class List
Modifying Class Icons and Descriptions
Viewing Class Hierarchies


Class Browser Buttons

See Also

When the Class Browser is open, a toolbar with a single button is also open. You can choose this Edit ParentClass Method button when you are editing method code. If there is code associated with the method in the parent class, the code is displayed in a separate window so you can see the functionality you can inherit or override.

The following buttons are displayed in the Class Browser.

Open	Opens an existing class library (.VCX) file, creates a new class library file, or opens an existing form/form set (.SCX) file.
View Additional File	Adds an existing class library (.VCX) file or a form or form set (.SCX) file to the class list, or creates a new class library file.
View Class Code	Displays the code for the class definitions of the selected class.
Find	Searches for specific text in class names, class descriptions, member names, and member descriptions.
New Class	Creates a subclass of the selected class or any existing class.
Rename	Changes the name of the selected class, property or method. Caution   Renaming a class might invalidate forms or classes that are not currently displayed in Class Browser windows and that rely on the class. Changing the name of a property or method can cause code that references the property or method to fail.
Redefine	Changes the parent class of the selected class.
Remove	Removes the selected class or deletes the selected file. Caution   Removing a class or file might invalidate forms or subclasses that rely on the class.
Clean Up Class Library	Runs the PACK command to remove records in the .VCX file marked for deletion.


 See Also

Adding Controls to Forms with the Class Browser
Browsing Classes
Class Browser Methods
Class Browser Properties
Class Browser Window
Managing Classes with the Class Browser
Viewing Class Definition Code


Class Menu

The Class menu contains options that allow you to create and edit properties and methods, specify include files, and control general class attributes.

Class Menu Commands

New Property   Creates a new property. Displays the New Property dialog box.

New Method   Creates a new method. Displays the New Method dialog box.

Edit Property/Method   Opens the Edit Property/Method dialog box where you can edit an existing property or method. Enabled when you add a new property or method.

Include File   Lets you specify a file that contains compiler directives. Displays the Include File dialog box.

Class Info   Displays the Class Info dialog box, which shows all properties and methods of class members, their design-time appearance, and whether or not they are protected.


Class Info Dialog Box

See Also

Shows various attributes of class members, their design-time appearance, and whether or not they are protected.

Class Info Dialog Box Tabs

The options are grouped onto the following tabs.

Tab	Description
ClassTab	General information about the class and its associated icons.
MembersTab	Information about individual members of the class.


 See Also

Class Tab, Class Info Dialog Box
Members Tab, Class Info Dialog Box


Class Tab, Class Info Dialog Box

See Also

Gives general information about the class and its associated icons.

The Class tab and Members tab are in the Class Info dialog box, which appears when you choose Class Info from the Class menu.

Class Tab Options

Toolbar Icon   Displays the name of the class toolbar icon. Choose the dialog button to select an icon for the class.

The class toolbar icon is displayed in the Form Controls toolbar in the Form Designer, and in the Class Designer when you populate the Form Controls toolbar with the classes in your class library. The class toolbar icon also appears in the Project container when the class is part of a project.

Container Icon   Displays the name of the class container toolbar icon. Choose the dialog button to select an icon for the class container.

The container icon is displayed only in the Class Browser window.

OLE Public   Specifies that when a program containing the OLEPublic keyword is built through the Project Manager, a custom OLE Automation Server is generated. A Globally Unique Identifier, or GUID, is also generated for the program.

Description   Displays comments about the selected class. You can type a new description in the box or edit an existing one.

Class Name   Displays the name of the class selected in the Class Designer.

Parent Class   Displays name of parent class.

Class Library   Displays path and file name of class library.


 See Also

Class Designer
Class Info Dialog Box
Class Menu
Form Controls Toolbar
Form Designer
Members Tab, Class Info Dialog Box


Members Tab, Class Info Dialog Box

See Also

Displays information about individual members of the class. The dialog box that contains this tab appears when you choose Class Info from the Class menu.

Members Tab Options

The Members tab consists of a list box with the following columns:

Class   Displays the class name.

Name   Displays the class property or method name.

Visibility   Specifies whether the class member is protected, public, or hidden. If you select Protected from the Visibility drop-down list in the Edit Property/Method dialog box, access and changes to class properties are prevented from outside the class or subclass definition.

No Init   Specifies whether the Init method is executed when an object is added. When true (.T.), the Init method is not executed. This option only applies to sub-classes of the class.

Modify   Opens the Edit Property/Method dialog box where you can edit an existing property or method.


 See Also

Class Info Dialog Box
Class Tab, Class Info Dialog Box


Database Menu

The Database menu contains commands for creating and editing tables in a database.

Database Menu Commands

New Table   Displays the New Table dialog box where you can create a new table using the Table Wizard or Table Designer.

Add Table   Displays the Open dialog box so you can add an existing table to a database. You can select any table that is not currently part of another database. Since tables can only belong to one database at a time, you need to remove a table from a database before you can use it in a new database.

New Remote View   Displays the New Remote View dialog box where you can create a new remote view using the Remote View Wizard or the View Designer.

New Local View   Displays the New Local View dialog box where you can create a new view of a local table using the Local View Wizard or View Designer.

Modify   Opens the selected table in the Table Designer, or the selected view in the View Designer. Use the Table Designer to create and modify tables, fields, indexes, default field values, validation rules, triggers, and comments.

Browse   Displays the selected table in the Browse window for viewing and editing.

Remove   Prompts you to remove the selected table from the database or to delete it from the disk. Removing a table removes it from the database, but leaves the table’s .DBF file on the disk. Deleting a table removes the table from the database and permanently removes the table’s .DBF file from the disk.

Find Object   Displays the Find Table or View dialog box so you can locate objects in the database schema.

Rebuild Table Indexes   Generates keys and rebuilds indexes for the selected table. The number of records indexed appears in the status bar.

Remove Deleted Records   Displays a prompt asking whether you want to permanently remove all records marked for deletion from the active table.

Edit Relationship   Displays the Edit Relationship dialog box where you can alter the persistent relationship between tables. Enable this command by selecting a relationship line in the Database Designer.

Edit Referential Integrity   Displays the Referential Integrity Builder, in which you set up rules to control how records are inserted, updated, or deleted in related tables.

Edit Stored Procedures   Displays all Visual FoxPro stored procedures for the current database in an editing window.

Connections   Displays the Connections dialog box, in which you can choose to modify an existing connection to a remote data source or choose to create a new one.

Arrange   Displays the Arrange dialog box, in which you can choose the option to order, align, or resize the objects displayed in the Database Designer.

Refresh   Updates the display in the Database Designer with the current disk image of the database.

Clean Up Database   Runs the PACK command to decrease the size of the database by removing rows that have been marked for deletion. You can use the VALIDATE DATABASE command to clean up links between databases and tables.

Properties   Displays the Database Properties dialog box, in which you can choose which objects appear in the schema display or add a comment to the database.


New Table Dialog Box

See Also

Lets you create a new table in the database using the Table Designer or the Table Wizard.

The New Table dialog box only displays the Table Wizard option when you have checked Prompt for Wizards in the Projects tab of the Options dialog box.

This dialog box appears when you select New Table from the Database menu.

Dialog Box Options

Table Wizard   Opens the Table Wizard, which creates a table for you. The wizard provides sample fields that make it easy to create a table structure. Available only if you check Prompt for Wizards in the Projects tab of the Options dialog box.

New Table   Opens the Table Designer so you can create a table in the database.


 See Also

ADD TABLE Command
Database Designer
Options Dialog Box
Projects Tab, Options Dialog Box
Table Designer
Table Wizard


New Remote View Dialog Box

See Also

Lets you create a new remote view using the View Designer or the Remote View Wizard. If the information you need is on a remote data source, you can create a remote view from it and incorporate that view into your database.

The New Remote View dialog box only displays the Remote View Wizard option when you have checked Prompt for Wizards in the Projects tab of the Options dialog box.

This dialog box appears when you select New Remote View from the Database menu.

Note   Before you can create a new remote view, you must establish a connection or ODBC data source. To establish a connection, use the Connection Designer.

Dialog Box Options

View Wizard   Opens the Remote View Wizard, which creates a remote view. Available only if you check Prompt for Wizards in the Projects tab of the Options dialog box.

New View   Opens the Select Connection Or Datasource dialog box so you can select a remote data source to use in your remote view.


 See Also

Connection Designer
Database Designer
Projects Tab, Options Dialog Box
Options Dialog Box
Remote View Wizard
Select Connection or Datasource Dialog Box
View Designer


New Local View Dialog Box

See Also

Lets you create a view of local tables or other views in the database using either the Local View Wizard or View Designer. Local views can include native Visual FoxPro .DBF format tables, existing local or remote views, any tables in a .DBF format, and other tables stored on local servers.

The New Local View dialog box only displays the Local View Wizard option when you have checked Prompt for Wizards in the Projects  tab of the Options dialog box.

This dialog box appears when you select New Local View from the Database menu.

Dialog Box Options

View Wizard   Opens the Local View Wizard, which creates a local view. Available only if you check Prompt for Wizards in the Projects  tab of the Options dialog box.

New View   Opens the View Designer so you can create a local view.


 See Also

Database Designer
Local View Wizard
Options Dialog Box
Projects Tab, Options Dialog Box
View Designer


Find Table or View
Find Table or View Dialog Box

Allows you to select a table or views you can't locate in the database schema displayed in Database Designer. Use this dialog box to find tables or views in the database schema.

This dialog box appears when you select Find Object from the Database menu.

Dialog Box Options

Tables or Views   Shows a list of objects in your database layout that you can find. If the table or view you want does not appear in this list, it has not been added to the database.

Find button   Selects and displays the object in the database schema.


Edit Relationship Dialog Box

See Also

After creating a persistent relationship between tables, use the Edit Relationship dialog box to alter the relation.

This dialog box appears when you select a relationship line in the Database Designer and select Edit Relationship from the Database menu, or double-click the relationship line.

Dialog Box Options

Table   Shows the name of the current parent table, and allows you to select a different index tag.

Related Table   Shows the name of the current child table, and allows you to select a different index tag.

Relationship Type   Shows the type of relationship between the parent and child tables.

Referential Integrity   Displays the Referential Integrity Builder so you can set up rules to control how records are inserted, updated, or deleted in related tables.

Note   If your tables are not already indexed, you need to open them in the Table Designer and create indexes before you use the Referential Integrity Builder.


 See Also

Database Designer
Referential Integrity Builder
Table Designer


Connections Dialog Box

Allows you to create and maintain database connections. This dialog box appears when you select Connections from the Database menu.

Dialog Box Options

Connections in <database>   Lists the connections associated with the database currently opened.

New   Opens the Connection Designer, which allows you to create and modify named connections.

Modify   Opens the Connection Designer, which allows you to modify the existing database connection.

Delete   Allows you to delete the connection from the database.


Arrange Tables and Views
Arrange Tables and Views Dialog Box

Allows you to change the layout of tables and views in your database. Use this dialog box to arrange, align, or resize the tables and views in your database layout.

This dialog box appears when you select Arrange from the Database  menu.

Dialog Box Options

Arrange

These options allow you to order the contents of the database layout.

By Name   Orders the tables and views by name.

By Type   Orders the tables together and the views together.

Align Objects

These options allow you to position the contents of the database layout in a line.

Vertically   Positions the objects in a line vertically in the Database Designer window.

Horizontally   Positions the objects in a line horizontally in the Database Designer window.

Resize objects to default height and width   By default, the objects in the database show five of the fields. If you changed the size of the objects to view more of the contents of the object, you can return to the default size.


Database Properties Dialog Box

Allows you to choose the type of database objects that are displayed in the Database Designer. You can choose from tables, relations, local views, and remote views. You can also add a comment. Use this dialog box to show or hide database objects in your database schema.

This dialog box appears when you select Properties from the Database menu.

Dialog Box Options

Table   Shows or hides the tables in the database schema.

Relations   Shows or hides the relationship lines between tables in the database schema.

Local Views   Shows or hides the views created on data stored in local tables.

Remote Views   Shows or hides the views created on data stored in a remote data source.

Comment   Provides space for you to type a comment about the database schema.


Data Environment Menu

See Also

Contains commands that allow you to view and modify a data environment. This menu appears when you open a form, report, or label, or create new ones, and choose Data Environment from the View menu. The Data Environment window is also displayed.

Data Environment Menu Commands

Add   Displays the Add Table or View dialog box so you can add a table or view to the Data Environment Designer window.

Remove   Removes the selected table or view from the Data Environment window.

Browse   Displays in a Browse window the table or view currently selected in the Data Environment Designer. In Browse mode you can examine or edit table or view contents.


See Also

Data Environment Designer


Edit Menu

See Also

The Edit menu contains options for editing, searching for, and manipulating text and controls.

Edit Menu Commands

Undo   Reverses the last editing change. When you save a file, the Undo command is disabled until you change the file in some way. The Undo command reverses keystrokes, cut, paste, or clear actions, moving of text, indent or outdent, and replacement. Shortcut: CTRL + Z

Redo   Reverses the last Undo command. When you save a file, the Redo command is disabled until you type new text and use the Undo command. The Redo command reverses keystrokes, cut, paste, or clear actions, moving of text, indent or outdent, and replacement. Shortcut: CTRL + R

Cut   Removes selected text, controls, or anything else that you can select, to the Clipboard. Once you cut (or copy) something, you can paste it elsewhere in your application or in other applications. Shortcut: CTRL + X

Copy   Duplicates selected text, controls, or anything else that you can select, and puts it on the Clipboard. Once you copy (or cut) something to the Clipboard, you can paste it elsewhere in your application or in other applications. Shortcut: CTRL + C

Paste   Takes cut or copied text, objects, controls, or anything that you can select (except for forms) from the Clipboard and places it at the insertion point. To place your selection on the Clipboard, use the Cut or Copy commands. Shortcut: CTRL + V

Paste Special   Displays the Paste Special dialog box, which allows you to link or embed an OLE object from the Clipboard. To use Paste Special, you must first copy the object you want to paste to the Clipboard; this will enable the command. Visual FoxPro places the object in the current General field. You must open the General Field window to paste the data.

Clear   Removes selected text, objects, or anything else that you can select, without moving it to the Clipboard.

Select All   Selects all objects or text in the active window, or a field in a browse window. Shortcut: CTRL + A

Find   Displays the Find dialog box so you can search for text. Shortcut: CTRL + F

Find Again   Searches for another occurrence of the text last typed into the Find dialog box. Shortcut: CTRL + G

Replace   Searches for and replaces specified text in the current file by displaying the Replace dialog box. To replace in tables, use Replace Field on the Table menu. Shortcut: CTRL+ L

Go To Line   Moves the insertion point to the designated line in a text or program file, or in the Command window, by displaying the Go To Line dialog box.

Insert Object   Displays the Insert Object dialog box, which lists the OLE objects you can link or embed in your application for forms or General fields in Visual FoxPro tables.

Object   Displays a list of actions supported by the currently selected OLE object. This option is enabled when a General Field window is active or when a Bound OLE control is selected on a running form. Its name changes to reflect the type of OLE object selected in the field. For example, if you’ve selected a picture that was linked or embedded from Microsoft Paint, this menu option changes to Edit Paint Picture Object.

Links   Displays the Edit Link dialog box so you can change or break an object link.

Properties   Displays the Edit Properties dialog box, which allows you to set editing options for the current editing window or set color and font options for all editing sessions. This edit command is enabled when you modify a text file or select the Command window. You can also access this dialog box when you choose Properties from the shortcut menu of any editing window.


See Also

Format Menu


Paste Special Dialog Box

See Also

Lets you link or embed an OLE object from the Clipboard. Visual FoxPro places the object in the current General field. You must open the General Field window to paste the data.

To use Paste Special, you must first copy the object you want to paste to the Clipboard and then open the General field window; this will enable the command. Paste Special opens the Paste Special dialog box.

Dialog Box Options

Source   Displays the application, directory, and file you’re pasting from.

As   Displays the available formats for the object you’re pasting. Select the format for the object according to what you want to be able to do with the stored object within Visual FoxPro. The Object format allows you to edit the object (for example, a Microsoft Excel worksheet object) by opening its source application from a field. If an object is in a Picture or Bitmap format, you can’t edit it from a table field. The Picture or Bitmap formats display the object and minimize the space it occupies in your file. If you plan to change the size of the object, choose the Picture format.

Paste   Embeds the object from the Clipboard in the current General field.

Paste Link   Links the object to Visual FoxPro so you can modify the object from within Visual FoxPro. Paste Link is only available when copying a saved object.

Note   With a Microsoft Word document, both Paste and Paste Link are enabled.

Display As Icon   Displays the application icon instead of the data. This saves disk space when linking or embedding.

Change Icon   Displays the Change Icon dialog box, which allows you to specify the icon  to be used for a linked or embedded object on a form or in a General field of a Visual FoxPro table. This button appears when you select the Display As Icon check box.

Results   Describes what actions will be performed on the contents of the clipboard after you choose OK. You can alter the description displayed by choosing the Paste, Paste Link, or Display As Icon options.


See Also

Edit Menu
General Field Type


Find Dialog Box

See Also

Contains options that let you search for text.

Shortcut

CTRL+F

Dialog Box Options

Look For   Specifies the text string to search for.

To search for special characters, type the following C language representations in the text boxes in the Find dialog box.

To search for	Type
Enter	\r
Tab	\t
Backslash	\\
New line (line feed)	\n
Scope   Defines how extensive the search is. The Scope options are enabled when you are editing a procedure in a Code window.

•	Current Procedure   Searches only the current procedure which is displayed in the Code window.

•	Current Object   Searches all procedures (event code) in the current (selected) object.

•	All Objects   Searches all procedures (event code) in all objects in the current form or form set.

Find Next   Finds the next occurrence of the string you typed in the Look For box.

Replace   Expands the dialog box by adding a Replace All button and the Replace With text entry box, in which you can specify replacement text.


See Also

Edit Menu


Replace Dialog Box

See Also

Lets you search for and replace specified text in the current file. To replace within tables, choose Replace Field from the Table menu.

Shortcut

CTRL+L

Dialog Box Options

Look For   Specifies the text string to search for.

Replace With   Specifies the replacement text.

Options   Defines the limits and direction of the search and replace. If you specify text to search for and don’t get the expected results, make sure you have the following options selected:

•	Match Case   Replaces text that exactly matches the combination of uppercase and lowercase letters you type in the Look For box.

•	Wrap Around   Searches the current file, from the insertion point to the end of the file, and then from the beginning of the file to the original insertion point.

•	Match Whole Word   Replaces distinct occurrences of words, except for embedded text.

•	Search Backward   Searches backwards from the current insertion point to the beginning of the file.

Scope   Defines how extensive the search is. The Scope options are enabled when you are editing a procedure in a Code window.

•	Current Procedure   Searches only the current procedure which is displayed in the Code window.

•	Current Object   Searches all procedures (event code) in the current (selected) object.

•	All Objects   Searches all procedures (event code) in all objects in the current form or form set.

Find Next   Finds the next occurrence of the string you typed in the Look For box. This button is not enabled until you type text in the Look For box.

Replace   Changes the selected text to the text in the Replace With box. If you want to leave the selected text unchanged and move to the next occurrence, choose the Find Next button.

Replace All   Finds and replaces all instances of the text in the Find What box with the text in the Replace With box. You can undo the replacements by choosing the Undo command.


See Also

Edit Menu
Table Menu


Go To Line Dialog Box

See Also

Lets you move the insertion point to the designated line in a text or program file, or in the Command window.

Dialog Box Options

Line Number   Specifies the line number where you want the insertion point to appear.


See Also

Command Window
Find Dialog Box
Options Dialog Box


Insert Object Dialog Box

See Also

Lists the OLE objects you can link or embed in your application for forms or General fields in Visual FoxPro tables.

In a browse window, double-click a General field to bring up an editing window and enable the Insert Object command.

For a form, select an OLE Container control while a form is displayed. This displays the Insert Object dialog box and the new object is stored in the field to which the control is bound.

Dialog Box Options

Create New   Displays the Object Type box so you can choose an OLE application in which to create a new object.

Object Type   Appears when you select Create New, and displays the OLE applications installed on your computer. Select an application in which to create the object.

Create From File   Displays the File box so you can specify an existing object to insert.

File   Appears when you select Create From File. Type the object’s file name and path, or choose Browse to select the appropriate file.

Browse   Opens the Browse dialog box which allows you to select a table or view.

Link   Links the object. If you don’t select this option, the object is embedded.

Display As Icon   Displays the inserted object as an icon. The icon comes from the application in which the object was created.

Results   Describes what actions will be performed on the contents of the file after you choose OK. You can alter the description displayed by choosing the Create New, Create from File, or Display As Icon options.

Change Icon   Displays the Change Icon dialog box, which allows you to select a different icon for the OLE object. Appears when you select the Display As Icon option.

Insert Control (forms only)   Displays the Control Type box so you can insert an ActiveX control.

Control Type (forms only)   Appears when Insert Control is selected, and lists the ActiveX controls you can insert.

Add Control (forms only)   Appears when Insert Control is selected, and displays the Browse dialog box so you can find and select an ActiveX control not listed under Control Type.


See Also

Controls Tab, Options Dialog Box
Form Controls Toolbar
General Field Type
Properties Window
Tools Menu


Change Icon Dialog Box

See Also

Specifies an icon to be used for a linked or embedded object on a form or in a General field of a Visual FoxPro table. This dialog box is displayed when you select Display as Icon in the Insert Object dialog box or the Paste Special dialog box and choose Change Icon.

Dialog Box Options

Icon

•	Current   Specifies that the current icon is to be used.

•	Default   Specifies that the default icon is to be used.

•	From File   Specifies the file from which the new icon is to be obtained. Type the path and file name in the box, and then choose OK to show all available icons. Scroll through the icons, select the icon you want to use, and then choose OK.

Label   Specifies the label that will be displayed beneath the icon. Type the desired label in the box.

Browse   Displays the Browse dialog box so you can select a file containing the icon you want.


See Also

Insert Object Dialog Box


Links Dialog Box
Edit Links Dialog Box

Lets you change or break an object link. This menu option is enabled when you open a general field that contains a linked OLE object you generated in a separate application.

Dialog Box Options

Links   Displays the name and path of the linked file, the type of application, and the type of updating selected for the link.

Source   Displays the complete name and location of the object file selected in the Link box.

Type   Displays the object application or type of application to which the file selected in the Link box is linked.

Update   Specifies how you want to update information.

•	Select Automatic to have Visual FoxPro update the information whenever new information becomes available.

•	Select Manual to update the information only when you select a link and choose the Update Now button.

Update Now   Updates the link selected in the Link box. If information has changed in the object document, the new information shows in your form or report.

Open Source   Opens the selected file in the object application for editing.

Change Source   Displays the Change Source dialog box, where you can specify a different object file for the selected link or change item information.

Break Link   Breaks the link selected in the Link box. This changes the object to a picture which can no longer be edited by the OLE application that created it.


 Edit Properties Dialog Box

See Also

Allows you to set editing options for the current editing window or set color and font options for all editing sessions.

This dialog box appears when you choose Properties from the shortcut menu of any editing window or when you choose Properties from the Edit menu.

Dialog Box Options

Behavior

The options in this area affect the current editing window only.

Drag-and-drop editing   Enables drag-and-drop text editing for manipulating text with the mouse.

Word wrap   Wraps text lines within the window.

Automatic indent   Automatically indents text according to the first line's indent. This does not affect how the text is saved.

Appearance

Alignment   Specifies left, center, or right alignment of text.

Tab width (characters)   Specifies how many characters wide each tab is. The range is from 1 to 50 characters.

Font   Changes the font in the edit window. Choose Font to open the Font dialog box.

Show line/column position   Enables the display of line number and column position in the status bar.

Syntax coloring   Toggles whether colors are shown for syntax elements.

Save Options

Make backup copy   Specifies that Visual FoxPro create a backup copy each time you save a file.

Save with line feeds   Saves the file with line feeds that have been entered into it. If this box is not selected, line feeds are removed when the file is saved.

Save with end-of-file marker   Places a CTRL+Z character at the end of a file when the file is saved. This extra character, when saved with the file, helps resolve the difference between normal editing activity and MODIFY MEMO activity.

Compile before saving   Specifies that Visual FoxPro automatically compile the program and check for syntax errors when the file is saved. This option applies only when you are editing program files.

Save preferences   Saves preferences of this group for editing only the current file.

Apply to method code   Specifies the current settings as the default for all new files of this type.


See Also

MODIFY MEMO


File Menu

The File menu contains options that allow you to create, open, save, and otherwise manipulate files. You can also enter printer information, print files, and exit Visual FoxPro.

File Menu Commands

New   Displays the New dialog box where you can create new files using designers and wizards. New program or text files are created simply by typing them in the Editing window. Shortcut: CTRL + N

Join Source Control Project   Allows you to create a local version of a source-controlled Visual FoxPro project.

Open   Displays the Open dialog box where you can open an existing file or create a new file. Corresponds to the GETFILE( ) function. Shortcut: CTRL + O

Close   Closes the active window. If you hold down SHIFT and choose the File menu, the Close command becomes the Close All command. Close All closes all open windows. Corresponds to the CLOSE  command.

Save   Saves changes to the active file. If the file has not already been saved, the Save As dialog box appears for every file type except connections and views. For unnamed connections and views, Visual FoxPro displays only a text box for the file name. If the file already exists, Visual FoxPro prompts you before overwriting it. Shortcut: CTRL + S

Save As   Displays the Save As dialog box where you can save a new file or save an existing file or object with a different name. Corresponds to the PUTFILE( ) function.

Save As Class   Displays the Save As Class dialog box where you can save a form, or selected controls on a form, as a class definition. Available when you run the Form Designer. Use this command if you intend to create subclasses based on the form or reuse the controls for other forms.

Save As View   Creates a new view based on the current query. Available from the Query Designer when the active query has been saved and a database is open.

Revert   Discards changes made to a project, query, form, report, label, program, text file, menu, view, or memo field since the file was last saved.

Import   Displays the Import dialog box, where you can import data to a Visual FoxPro table from a spreadsheet or another table format. You can also use the Import Wizard to import files.

Export   Displays the Export dialog box, where you can export data from Visual FoxPro tables to a text file, spreadsheet, or common table format.

Page Setup   Displays the Page Setup dialog box, in which you can adjust column width and page layout for reports or labels. The Page Setup command is enabled when you have a report or label open.

Print Preview   Displays the Print Preview toolbar, which shows you the results of your work without printing it. Use the options on the toolbar to change the preview. You can also click the image of the previewed page to zoom in, and click again to zoom out or return to design mode. This command is enabled when you have a report or label open.

Print   Displays the Print dialog box, which lets you print the current text file, report, label, or the contents of the Command window, or choose another file to print. Shortcut: CTRL + P

Send   Lets you send e-mail from within Visual FoxPro. This command is available only if you have an electronic mail application installed on your machine..

1, 2, 3, 4   Lists the four most recently opened projects. Choose the file you want to open.

Exit   Ends your Visual FoxPro session and returns control to the operating system. Issuing the QUIT command in the Command window or a program has the same effect. Shortcut: ALT + F4


New Dialog Box

See Also

Lets you create new files using designers and wizards.

Visual FoxPro provides a range of designers to help you create classes, connections, databases, forms, labels, menus, queries, local and remote views, reports, and tables. You may also use a Visual FoxPro wizard to create many of these files, including a variety of reports, forms, and queries. New program or text files are created simply by typing them in the Editing window. The following table shows you the file types and how each can be created.

Shortcut

   CTRL+N

The New dialog box appears when you select New from the File menu.

Dialog Box Options

File Type   The following table lists the file types and the features available for creating them, depending on whether you click New File or Wizards.

File Type	Created With
Project	Project Manager
Database	Database Designer
Table	Table Designer, Table Wizard
Query	Query Designer, Cross-Tab Wizard, Query Wizard, Local View Wizard, Remote View Wizard, PivotTable Wizard
*Connection	Connection Designer
*View	View Designer, Local View Wizard
*Remote View	Remote View Wizard
Form	Form Designer, Form Wizard, One-to-Many Form Wizard
Report	Report Designer, Report Wizard, One-to-Many Report Wizard, Group/Total Report Wizard
Label	Label Designer, Label Wizard
Program	Editing Window
Class	Class Designer
Text File	Editing Window
Menu	Menu Designer
*You must have a database open to enable this option.

New File   Displays a dialog box, designer, or editing window so you can create the selected file type.

Wizard   Opens a wizard that creates the selected file type. If there is a group of wizards to choose from, Visual FoxPro will prompt you to select the wizard you want.


 See Also

Class Designer
Connection Designer
Database Designer
Editing Window
Form Designer
Label Designer
Menu Designer
Project Manager
Query Designer
Report Designer
Table Designer
View Designer


Create Dialog Box

See Also

Appears when you select Project, Database, or Table in the New dialog box and then choose New File. Allows you to specify the directory, name, and type of the new file.

Dialog Box Options

Code Page   Displays the Code Page dialog box so that you can specify the code page needed to view the file correctly. This command applies only to text files such as program (.PRG), query (.QPR), and text (.TXT) files.


 See Also

Code Page Dialog Box


Select Connection or Data Source Dialog Box

See Also

Allows you to select a data source or an existing connection to a data source to create a new remote view. You can also access the Connection Designer to create a new connection.

Appears when you select Remote View in the New dialog box, and then choose New File.

Dialog Box Options

Connections in Database/Available Data Sources   Lists available ODBC data sources or existing connections, depending on which option you select in the Select option group. Select the data source or connection you want and choose OK.

Select

Connections   Displays existing connections for you to choose in the active database.

Available Data Sources   Displays the available ODBC data sources for creating a remote view.

New   Displays the Connection Designer, in which you can create and save a connection to a data source.


 See Also

Connection Designer
CREATE CONNECTION Command


New Label Dialog Box

See Also

Displays predefined Avery label types. This dialog box appears when you select Label from the New dialog box and then choose New File. The type you select becomes the basis for the new label you create in the Label Designer. The Columns column refers to how many columns of that label type will fit on an 8 1/2 x 11 page.

The following columns display information about the label (you cannot change these settings):

Avery No.   The manufacturer’s identification number for a particular label type.

Height   The height in inches of an individual label.

Width   The width in inches of an individual label.

Columns   How many columns of that label type will fit on an 8 1/2 x 11 page.

Note   You can add a new label size to the list using the ADDLABEL.APP application located in VFP\TOOLS.


 See Also

CREATE LABEL Command
Label Designer


New Class Dialog Box

See Also

Specifies information for a new class; this information is then used by the Class Designer.

This dialog box appears when you select Class in the New dialog box and then choose New File or type CREATE CLASS in the Command window.

Dialog Box Options

Class Name   Specifies the name of the class definition to create.

Note   The name that you specify is converted to lowercase when the class is saved.

Based On   Specifies the class on which the new class definition is based. Choose from the list, or click the dialog button to display a dialog box from which you can select a .VCX file. This list includes all Visual FoxPro classes by default.

From   Lists the path to the visual class library of the base class you specified in the Based On box.

Store In   Displays a File Save dialog box in which you can specify the name of the visual class library in which to save the new class.


 See Also

Class Designer
Class Property
Class Library Property
CREATE CLASS Command


Open Dialog Box

See Also

Lets you open an existing file or create a new file. Previously opened projects appear at the bottom of the File menu. Corresponds to the GETFILE( ) function.

You can open a previously opened project by choosing its name from the bottom of the File menu.

Note   Files created with the Open command are not added to a project.

Shortcut

   CTRL+O

This dialog box appears when you select Open from the File menu.

Dialog Box Options

Code Page   Displays the Code Page dialog box so you can specify the code page needed to view the file correctly. This command applies only to text files such as program (.PRG), query (.QPR), and text (.TXT) files.

Environment   Saves all environment settings with the file, and opens the associated environment when you open the file. This option is enabled when you choose Form, Label, or Report from the List Files of Type list, and is checked by default. To open a form, label, or report without opening an associated environment, clear the check box.

Exclusive   Allows you exclusive use of a table (.DBF) or database (.DBC) file so that no other user can open the file. This option is enabled only when a table is to be opened. Corresponds to the USE EXCLUSIVE command.

Open As Read Only   Specifies that the file you open cannot be modified, only reviewed.

Class Name    Displays classes stored in the class library displayed in the Class Library Name box. This list appears only when you open a class library.


 See Also

1, 2, 3, 4 (File Menu)
Code Page Dialog Box
GETFILE( ) Function
USE EXCLUSIVE Command


Code Page Dialog Box

See Also

Allows you to assign a code page to a .DBF or text file that does not have one.

.DBF and text files display properly only if they have the correct code pages. Visual FoxPro automatically assigns code pages to these files when you create them. However, .DBF and text files created in previous versions of FoxPro or in other products might not have code pages.

If you check Prompt for Code Page in the Data Tab of the Options dialog box, Visual FoxPro prompts you to specify a code page when opening tables or text files that are not marked with a code page. You can also display the Code Page dialog box with the GETCP( ) function.

Dialog Box Options

Platform   Refers to the type of operating system you are using. Your selection determines which code pages are displayed in the Code Page box.

•	All   Displays code pages for all platforms.

•	Windows   Displays only Windows code pages.

•	MS-DOS   Displays only MS-DOS code pages.

•	Macintosh   Displays only Macintosh code pages.

Code Page   Lists all the code pages for the selected platform.

Select   Designates the currently selected code page as the default.


 See Also

Data Tab, Options Dialog Box
GETCP( ) Function
Open Dialog Box
Save As Dialog Box


Save As Dialog Box

See Also

Saves a new file or saves an existing file with a different name. Corresponds to the PUTFILE( ) function.

The Save As command is enabled for the following file types:

•	Project

•	Query

•	Connection (see the following note)

•	View (see the following note)

•	Form

•	Report

•	Label

•	Program

•	Text File

•	Menu

Note   When you choose Save or Save As for a connection or view, the Save dialog box appears.

This dialog box appears when you select Save As from the File menu.

Dialog Box Options

 Code Page   This option is available if you are saving a text file or a table that has no code page. The Code Page dialog box is displayed so that you can attach the correct code page. If your existing text file uses the extended character set, choose Code Page and make the appropriate selections.


 See Also

Code Page Dialog Box
PUTFILE( ) Function
Save (File Menu)


Save As Class Dialog Box

See Also

Lets you save a form, or selected controls on a form, as a class definition. Create a class if you intend to create subclasses based on the form or reuse the controls for other forms.

This dialog box appears when you select Save As Class from the File menu.

Dialog Box Options

Save   Specifies the part of the form to save as a class definition.

•	Selected Controls   Saves only the selected controls as a class definition.

•	Current Form   Saves the active form as a class definition.

•	Entire Form Set   Saves a collection of related forms as a class definition. This command is enabled after you use the Create FormSet command on the Form menu.

As Class   Specifies the class definition to which to save the selected controls, entire form, or form set.

•	Name   Specifies the name assigned to the class.

•	File   Specifies the name of the .VCX file in which to store the class definition.

•	Description   Specifies the optional description for the class.


 See Also

Class Designer
Form Menu


Import Dialog Box

See Also

Lets you import data to a Visual FoxPro table from a spreadsheet or another table format. You can also use the Import Wizard to import files.

Note   You cannot import text files with this menu command. To import text files, use the Import Wizard, or create a table and then append the text file to the new table.

This dialog box appears when you select Import from the File menu.

Dialog Box Options

Type   Specifies the type of file to import. Select a file type from the list.

From   Specifies the path and name of the source file. Type the path and name, or click the dialog button to find the source file.

Sheet   Specifies a Microsoft Excel worksheet to import. This box appears only if you select Microsoft Excel 5.0 (XLS) in the Type box.

To   Displays the path, as defined in the File Locations tab of the Options dialog box, and the file name of the imported file. The file name is that of the source file, but with a .DBF extension.

Import Wizard   Starts the Import Wizard, which prompts you with simple questions as you go through a brief series of steps. You must use the Import Wizard to import text files, or create a table and then append the text file to the new table.

The following table shows the file types you can import with this command, and their equivalents that you would type in the Command window.

File Types	Command Equivalent
FrameWork II (FW2)	IMPORT FROM FileName TYPE FW2
Lotus 1-2-3 1-A (WKS)	IMPORT FROM FileName TYPE WKS
Lotus 1-2-3 2.x (WK1)	IMPORT FROM FileName TYPE WK1
Lotus 1-2-3 3.x (WK3)	IMPORT FROM FileName TYPE WK3
Microsoft Excel 2.0, 3.0, and 4.0 (XLS)	IMPORT FROM FileName TYPE XLS
Microsoft Excel 5.0 (XL5)	IMPORT FROM FileName TYPE XL5
MultiPlan 4.01 (MOD)	IMPORT FROM FileName TYPE MOD
Paradox 3.5, 4.0, 4.5 (DB)	IMPORT FROM FileName TYPE PDOX
RapidFile (RPD)	IMPORT FROM FileName TYPE RPD
Symphony 1.01 (WRK)	IMPORT FROM FileName TYPE WRK
Symphony 1.10 (WR1)	IMPORT FROM FileName TYPE WR1


 See Also

Append From Dialog Box
Command Window
Export Dialog Box
Import Wizard
IMPORT Command


Dialog Box Selection

Select one of the following topics for help on that dialog box.

Append From Dialog Box

Export Dialog Box

Import Dialog Box


Export Dialog Box

See Also

Lets you export data from Visual FoxPro tables to a text file, spreadsheet, or common table format.

This dialog box appears when you select Export from the File menu.

Dialog Box Options

Type   Specifies the type of file to export. Select a file type from the list.

To   Specifies the path and name of the destination file. Type the path and name, or click the dialog button to find the destination file.

Text delimiter   Allows you to delimit strings of text in the output file. The default text delimiter is the double-quote (“) character. This option only appears if you choose Delimited Text from the Type drop-down list.

Field separator   Allows you to separate data fields in the output file. The default field separator is the comma (,) character. This option only appears if you choose Delimited Text from the Type drop-down list.

From   Specifies the path and name of the source file. Type the path and name, or click the dialog button to find the source file.

Options   Displays the Export Options dialog box, where you specify which records and fields to export.

The following table shows the file types you can export with this command, and their equivalents that you would type in the Command window.

File Types	Command Equivalent
Data Interchange Format (DIF)	COPY TO FileName TYPE DIF
dBASE IV (DBF)	COPY TO FileName FOX2X
Delimited Text	COPY TO FileName TYPE DELIMITED
FoxBASE+ (DBF)	COPY TO FileName FOXPLUS
FoxPro for Windows 2.x (DBF)	COPY TO FileName FOX2X
Lotus 1-2-3 1-A (WKS)	COPY TO FileName TYPE WKS
Lotus 1-2-3 2.x (WK1)	COPY TO FileName TYPE WK1
Microsoft Excel 2.0, 3.0, and 4.0 (XLS)	COPY TO FileName TYPE XLS
Microsoft Excel 5.0 (XLS)	COPY TO FileName TYPE XL5
MultiPlan 4.01 (MOD)	COPY TO FileName TYPE MOD
Symbolic Link Format	COPY TO FileName TYPE SYLK
Symphony 1.01 (WRK)	COPY TO FileName TYPE WRK
Symphony 1.10 (WR1)	COPY TO FileName TYPE WR1
System Data Format (SDF)	COPY TO FileName TYPE SDF
Visual FoxPro 5.0 (DBF)	COPY TO FileName


 See Also

Command Window
COPY TO Command
Export Options
EXPORT Command
Import (File Menu)


Export Options Dialog Box

See Also

Specifies which records and fields to export. This dialog box is displayed when you choose Options in the Export dialog box.

Dialog Box Options

Criteria   These options control which records and fields export and the conditions under which they export.

•	Scope   Displays the Scope dialog box, in which you specify how many records to export.

•	For   Displays the Expression Builder, in which you create a logical expression which every record must meet to be exported.

•	While   Displays the Expression Builder, in which you create a logical WHILE expression that must be true in order for records to be exported.

•	Fields   Displays the Field Picker dialog box, where you choose fields to be exported.


 See Also

Export Dialog Box
EXPORT Command
Expression Builder
Field Picker Dialog Box
Scope Dialog Box,


Page Setup Dialog Box

See Also

Lets you adjust column width and page layout for reports or labels. The settings you can adjust in this dialog box depend on the printer you’ve installed, and these settings are saved with the report or label.

This dialog box appears when you select Page Setup from the File menu.

Dialog Box Options

Page Layout   Provides a graphical representation of the page, which reflects your layout in the Report Designer and Label Designer, and the settings you select or type in the Page Setup dialog box.

Columns

Number   Specifies the number of columns to print across the page.

Width   Specifies the width of individual columns, in inches or centimeters.

Spacing   Specifies the space between columns, in inches or centimeters.

Print Area

Printable Page   Specifies that the requirements of the currently selected printer driver determine the minimum margins.

Whole Page   Specifies that the paper size determines the minimum margins.

Left Margin   Specifies the width of the left margin, in inches or centimeters.

Dimensions   Indicates whether column width and spacing is reckoned in inches or centimeters.

Print Order   Specifies how records wrap when you have multiple columns.

Print Setup   Displays the Print Setup dialog box, where you select a printer, printer path, and paper setting.


 See Also

Print Dialog Box
Print Setup Dialog Box


Print Dialog Box

See Also

Lets you print a text file, report, label, or the contents of the Command window or Clipboard.

This dialog box appears when you select Print from the File menu.

Shortcut

   CTRL+P

Dialog Box Options

Printer

Name   Displays the names of the printers currently installed on your machine.

Status   Displays whether or not the chosen printer is the default printer, and if it is ready to print.

Type   Displays the model of the selected printer. You specify the printer model when you first install the printer.

Where   Displays the network printer path.

Comment   Displays comments about the printer.

Properties   Displays the system Printer Properties dialog box, which allows you to set options for your printer.

Print Range

All   Specifies that all the pages in the document print.

Pages   Allows you to specify which pages of the document print.

Selection   Prints the highlighted selection in the document.

Copies

Number of Copies   Allows you to specify the number of copies of the document to be printed.

Collate   Specifies that if multiple copies of a document are printed, the printed copies will be collated.


 See Also

Expression Builder

Print File Dialog Box
Print Preview
Print Setup Dialog Box
Report and Label Print Options Dialog Box


Print Dialog Box
Print Options Dialog Box

See Also

Lets you print a text file, report, label, or the contents of the Command window or Clipboard.

This dialog box appears when you select Options from the Print dialog box.

Dialog Box Options

Print What

Type   Specifies the type of file to print. You may select Report, Label, Command Window, File, ASCII File, Clipboard, or any open text file (.QPR, .PRG, or .TXT).

Note   The ASCII File option bypasses the printer driver and sends the contents of the selected file directly to the printer. Make sure that the file contains valid printer commands. Sending invalid printer commands to your print device may cause your printer to fail and to require a reset.

File   Specifies the path and file name of the file you want to print. Type the path and name, or click the dialog button to display the Print File dialog box, in which you can search directories and select the file to print.

Print Options

Line Numbers   Prints line numbers in the left margin. This option is enabled for the Command window, and the Clipboard.

Page Eject Before   Advances the printer to the top of the next page before printing the file.

Page Eject After   Advances the printer to the top of the next page after printing the file. This option is not enabled for reports and labels.

Restore Environment   For running FoxPro version 2.x reports, ensures that the data environment settings previously saved with the report are used to run the report. This option does not apply to Visual FoxPro reports because they use their own data environments.

Print Setup   Displays the Windows Print Setup dialog box, in which you can specify a local or network printer, page orientation, paper size, and additional printing options.

Options   Displays the Report and Label Print Options dialog box, in which you can create expressions using the Expression Builder to select the records you want to print.


 See Also

Expression Builder

Print File Dialog Box
Print Preview
Print Setup Dialog Box
Report and Label Print Options Dialog Box


Print Setup Dialog Box

See Also

Selects a printer, printer path, and paper setting. The settings you can adjust in this dialog box depend on the printer you’ve installed, and these settings are saved with the report or label. You can also change the settings for the current print job; these settings are not saved with the report file.

Dialog Box Options

Printer

Name   Displays the names of the printers currently installed on your machine.

Status   Displays whether or not the chosen printer is the default printer, and if it is ready to print.

Type   Displays the model of the selected printer. You specify the printer model when you first install the printer.

Where   Displays the network printer path.

Comment   Displays comments about the printer.

Orientation

Portrait   Orients the paper vertically for printing.

Landscape   Orients the paper horizontally for printing.

Paper

Size   Specifies the paper size to use. You can print either to paper or envelopes.

Source   Specifies the paper source (for example, upper tray) in the printer.


 See Also

Print Dialog Box
Print File Dialog Box
Print Options Dialog Box
Print Preview


 See Also

Page Setup Dialog Box
Print (File Menu)
Print File Dialog Box
Print Options Dialog Box
Print Preview


Report and Label Print Options Dialog Box

See Also

This dialog box appears when you click Options in the Print Options dialog box.

Dialog Box Options

Scope   Allows you specify how much to print. Choose All, Next, Record, or Rest from the drop-down list. Choose a number from the spinner on the right when you select Next or Record from the Scope drop-down list.

For   Displays the Expression Builder, in which you create a logical expression which every record must meet to be printed.

While   Displays the Expression Builder, in which you create a logical expression that must be true in order for records to print.


 See Also

Expression Builder
Print Dialog Box
Scope Dialog Box


Print File Dialog Box

See Also

Allows you to search a drive or directory for a file to print. This dialog box appears when you click the dialog button to the right of the File box in the Print dialog box.

Dialog Box Options

Code Page   Displays the Code Page dialog box so you can attach the correct code page. If the file you want to print uses the extended character set, click Code Page and make the appropriate selections.


 See Also

Print Dialog Box


Form Menu

The Form menu contains commands for creating and modifying forms and form sets.

Form Menu Commands

New Property   Displays the New Property dialog box where you can add a new property to the form or form set.

New Method   Displays the New Method dialog box, where you can add a new method to the form or form set.

Edit Property/Method   Displays the Edit Property/Method dialog box, where you can edit an existing property or method. The property or method is scoped to the standalone form or form set, as applicable.

Include File   Displays the Include File dialog box, where you can specify a header file of predefined compile-time constants. This file is used when compiling the form’s code.

Create Form Set   Creates a new form set, which is a parent container for one or more forms.

Remove Form Set   Removes an existing form set. You may want to remove a form set if you have only a single form in it and want to work only with that form. This command is enabled only if you have created a form set and have only one form in that form set.

Add New Form   Adds new forms once you have created a form set. Enabled only if you are working with a form set rather than individual forms.

Remove Form   Removes the selected form once you have created a form set. This command is enabled only when you have more than one form in your form set.

Quick Form   Displays the Form Builder. which helps you create a simple form that you can customize by adding your own controls.

Run Form   Once you have designed a form, use this command to run the form. Visual FoxPro prompts you to save the form before running it. Shortcut: .


New Property Dialog Box

See Also

Allows you to create a new property and specify the description and visibility of the property.

This dialog box appears when you select New Property from the Class or Form menus.

Dialog Box Options

Name   Specifies the name of the new property.

Visibility (Classes only)   Protected properties cannot be accessed by object instances, but can be accessed by subclasses. Hidden properties cannot be accessed by either object instances or subclasses.

Description   Contains the method description to be displayed at the bottom of the Properties window in the Class Designer and, if the property is not protected, in the Form Designer.


 See Also

Class Designer
Edit Property/Method Dialog Box
Form Designer
New Class Dialog Box
New Method Dialog Box
Properties Window


New Method Dialog Box

See Also

Allows you to create a new method and specify the description and visibility of the method.

This dialog box appears when you select New Method from the Class or Form menus.

Dialog Box Options

Name   Specifies the name of the new method.

Visibility (Classes only)   Specifies whether the class property is protected. Protected properties cannot be accessed by object instances, but can be accessed by subclasses. Hidden properties cannot be accessed by either object instances or subclasses.

Description   Contains the method description to be displayed at the bottom of the Properties window in the Class Designer and, if the property is not protected, in the Form Designer.


 See Also

Class Designer
Edit Property/Method Dialog Box
Form Designer
New Property Dialog Box
Properties Window


Edit Property/Method Dialog Box

See Also

Allows you to edit an existing property or method. The property or method is scoped to the standalone form or form set, as applicable. For classes, it is enabled when you add a new property or method.

This dialog box appears when you select Edit Property/Method from the Class or Form menus.

Dialog Box Options

Property or Method   Specifies the name of the property.

No Init (Classes Only)   Specifies whether the Init method is executed when an object is added. When checked, the Init method is not executed. This option only applies to subclasses of a class.

Remove   Removes the selected property/method.

Description   Contains the property or method description to be displayed at the bottom of the Properties window in the Class Designer and, if the property is not protected, in the Form Designer.

Visibility (Classes Only)   Specifies whether the class is public, protected, or hidden.


 See Also

Class Designer
Form Designer
New Property Dialog Box
Properties Window


Include File Dialog Box

See Also

Allows you to specify an include file containing predefined compile-time constants for a user-defined class, form, or form set.

This dialog box appears when you select Include File from the Class or Form menus.

Dialog Box Options

Include File   Specifies a header file of predefined compile-time constants for a user-defined class, form, or form set. Type the name of the include file in the box, or use the dialog button to select an existing include file.


 See Also

#DEFINE


Format Menu

See Also

The Format menu contains options for fonts, spacing, alignment, and object positioning.

Note   The commands available on the Format menu vary according to what window you are working with. For example, if you are creating a report using the Report Designer, the Format menu contains different commands than if you are working in the Command window or on a report or label.

Format Menu Commands

Text Alignment   Displays the Text Alignment submenu, which contains commands that let you adjust alignment and spacing of text within a field or label control. This command is available when you work with a report or label.

Reading Order   Sets the text reading order for the report. This option is only enabled in a BIDI version of FoxPro.

Fill   Fills selected controls with a pattern. This command is available when you work with a report or label.  To enable this command, you must create a rectangle or rounded rectangle control in a report or label, and then select the control. Fill provides eight fill pattern options.

Pen   Displays the Pen submenu, which contains commands that let you set point size and the design pattern of lines and outlines for rectangles and rounded rectangles on your label or report. This command is available when you work with a report or label.

Mode   Displays the Mode submenu, which lets you determine whether the selected control is opaque or transparent. Opaque prevents controls behind the selected control from showing through. Transparent allows controls behind the selected control to show through. This command is available when you work with a report or label.

Font   Displays the Font dialog box, where you can set the font type, style, and size. This command is available when you work with a text file, field, or label control in a report or label, or the Command window.

Enlarge Font   Increases the font size by the next-larger size available. This command is available when you work with a text or program file or the Command window.

Reduce Font   Decreases the font size to the next-smaller size available. This command is available when you work with a text or program file.

Single Space   Displays text with no blank lines between lines of text. This command is available when you work with a text file, program file, or the Command window.

1 1/2 Space   Sets line spacing at 1.5, which displays text with one and a half blank lines between lines of text. This command is available when you work with a text file, program file, or the Command window.

Double Space   Sets line spacing at 2, which displays text with two blank lines between lines of text. This command is available when you work with a text file, program file, or the Command window.

Indent   Indents the selected line or lines by one tab. This command is available when you work with a text file, program file, or the Command window.

Unindent   Removes previously inserted indents one at a time. This command is available when you work with a text file, program file, or the Command window.

Align   Displays the Align submenu, which lets you align controls on a form or in a report, label, or class. This command is available when you work with a report, label, form, or class.

Size   Displays the Size submenu, which lets you change the size of controls. This command is available when you work with a report, label, form, or class, and create and select a control.

Horizontal Spacing   Displays the Horizontal Spacing submenu, which lets you change the horizontal spacing of selected objects. This command is available when you work with a report, label, form, or class.

Vertical Spacing   Displays the Vertical Spacing submenu, which lets you set the vertical spacing between selected controls. This command is available when you work with a report, label, form, or class.

Bring to Front   Brings selected controls to the front layer so that they appear on top of overlapping controls. This command is available when you work with a report, label, form, or class, and when you add and then select objects. Shortcut:  CTRL + G

Send to Back   Sends selected controls to the back layer so that any overlapping controls appear on top of them. This command is available when you work with a report, label, form, or class, and when you add and then select objects. Shortcut:  CTRL + J

Group   Joins selected controls so that they can be manipulated as a single control. It is equivalent to dragging the mouse to select all controls at once. This command is available when you work with a report or label, and then select controls.

Ungroup   Separates previously grouped controls so that they can be manipulated individually. This command is available when you work with a report or label and have grouped controls.

Snap to Grid   Moves controls in grid increments when you select and drag them. This command is available when you work with a report, label, form, or class, and when you add and then select objects. You can set the default for Form Designer in the Forms tab of the Options dialog box.

Set Grid Scale   Displays the Set Grid Scale dialog box, where you can define horizontal and vertical increments of the grid in pixels, and (for reports and labels) specify whether the ruler displays inches or pixels. This command is available when you work with a report, label, form, or class. You can set the default for Form Designer in the Forms tab of the Options dialog box.

Comment   Marks selected lines of text as comment by placing an *!* at the beginning of the line. This command is available when you work with a text file, program file, or the Command window.

Uncomment   Removes previous comment formatting, *!*, from the selected text. This command is available when you work with a text file, program file, or the Command window.


 See Also

Form Designer
Forms Tab, Options Dialog Box


Font Dialog Box

See Also

Controls the font type, style, and size.

You can change fonts in a text file, field or label control in a report or label, or the Command window. To change fonts in reports and labels, you must create a label control or field control and then select it.

Dialog Box Options

Font   Displays the available fonts.

Font Style   Displays the styles (Regular, Bold, Italic, or Bold Italic) you can apply to the font or selected text.

Size   Displays a list of point sizes for the font.

Effects

•	Strikeout   Strikes through text using a horizontal line. This option appears only when you are working with a report or label.

•	Underline   Underlines the selected text. This option appears only when you are working with a report or label.

Color   Specifies text color of selected text. This option appears only when you are working with a report or label.

Sample   Displays a sample of the selected font’s letter style for both uppercase and lowercase letters.

Script   Lists the available language scripts for a specific font. Pick the one appropriate for the language your computer is set up for.


 See Also

Browse Window
Edit Window
Format Menu


Text Alignment Submenu

See Also

Adjusts alignment and spacing of text within a field or label control in a report or label.

These commands are available when you work with a report or label. To enable them, you must select a field or label control.

Submenu Commands

Left   Left-justifies text in the selected control.

Center   Centers text in the selected control.

Right   Right-justifies text in the selected control.

Single Space   Displays selected text with no blank lines between lines of text in a label control, text or program file, or the Command Window.

1 1/2 Space   Displays selected text with one and a half blank lines between lines of text in a label control, text or program file, or the Command Window.

Double Space   Displays selected text with two blank lines between lines of text in a label control, text or program file, or the Command Window.


 See Also

Format Menu


Pen Submenu

See Also

Sets point size and the design pattern of lines and outlines for rectangles and rounded rectangles on your label or report.

These commands are available when you work with a report or label. To enable them, create a line control, select the line control, and then select the Pen command.

Submenu Commands

Hairline   Creates a one-pixel-width outline.

1-Point   Creates a one-point-width outline.

Note   Depending on your monitor’s resolution, a point could be one or several pixels wide.

2-Point   Creates a two-point-width outline.

4-Point   Creates a four-point-width outline.

6-Point   Creates a six-point-width outline.

None   Creates no outline.

Dotted   Creates dotted-line outline.

Dashed   Creates dashed-line outline.

Dash-dot   Creates an outline of alternating dashes and dots.

Dash-dot-dot   Creates an outline of dashes alternating with two dots.


 See Also

Color Palette Toolbar
Format Menu
Report Controls Toolbar


Align Submenu

See Also

Aligns controls on a form or in a report, label, or class. You can align controls in relationship to each other or to the grid in the Report Designer, Form Designer, Label Designer, or Class Designer. You can align controls by a particular side or by the center.

To do more than just center a single control vertically or horizontally on a form, report, class, or label, you must select more than one control.

These commands are available when you work with a report, label, form, or class. They are enabled when you create controls and select them.

Submenu Commands

The buttons for the Align command equivalents are located on the Layout toolbar.

By default, Visual FoxPro uses the control whose edge is the closest to the direction you selected as the anchor for the alignment.

Using the Layout toolbar, you can align the controls with the side farthest from the side you select by holding down the CTRL key and clicking the correct alignment button.

Align Left Sides   [image]   Aligns the left sides of the selected objects.

Align Right Sides   [image]   Aligns the right sides of the selected objects.

Align Top Edges   [image]   Aligns the top edges of selected controls.

Align Bottom Edges   [image]   Aligns the bottom edges of the selected controls.

Align Vertical Centers   [image]   Places selected controls so that their centers line up vertically.

Align Horizontal Centers   [image]   Places selected controls so that their centers line up horizontally.

Center Vertically   Centers selected controls vertically within their containers.

Center Horizontally   Centers selected controls horizontally within their containers.

Tip   To align objects that are arranged vertically, use the right side, left side, or vertical center alignment. To align objects that are arranged horizontally, use the top, bottom, or horizontal center alignment. If you do the opposite, objects will be stacked on top of each other or will overlap.


 See Also

Class Designer
Form Designer
Format Menu
Label Designer
Layout Toolbar
Report Designer
View Menu


Size Submenu

See Also

Changes control size. You can change control sizes individually or resize a group of controls to match each other. You can resize any report control except labels.

These commands are available when you work with a report, label, form, or class, and create and select a control.

Submenu Commands

The buttons for the Size commands are located on the Layout toolbar.

To Fit   Sizes the object to fit its contents. Available only when you are working with forms.

To Grid   Sizes the object in grid increments when you drag it if the Snap to Grid command is checked on the Format menu.

To Tallest   [image]   Sizes all selected objects to the height of the tallest selected object.

To Shortest   CTRL + [image]   Sizes all selected objects to the height of the shortest selected object.

To Widest   [image]   Sizes all selected objects to the width of the widest selected object.

To Narrowest   CTRL+ [image]   Sizes all selected objects to the width of the narrowest selected object.


 See Also

Format Menu
Layout Toolbar


Horizontal Spacing Submenu

See Also

Sets the horizontal spacing of selected objects.

These commands are available when you work with a report, label, form, or class.

Submenu Commands

Make Equal   Spaces selected controls equally across the band.

Increase   Increases the horizontal space between selected controls.

Decrease   Decreases the horizontal space between selected controls.


 See Also

Format Menu


Vertical Spacing Submenu

See Also

Sets the vertical spacing between selected controls.

These commands are available when you work with a report, label, form, or class.

Submenu Commands

Make Equal   Spaces selected controls equally down the band.

Increase   Increases the vertical space between selected controls.

Decrease   Decreases the vertical space between selected controls.


 See Also

Format Menu


Set Grid Scale Dialog Box

See Also

Lets you define horizontal and vertical increments of the grid in pixels, and (for reports and labels) specifies whether the ruler displays in system units or pixels.

This command is available when you work with a report, label, form, or class.

You can set the default for Form Designer in the Forms tab of the Options dialog box.

Dialog Box Options

Grid (in pixels)

Horizontal   Specifies the number of pixels per inch horizontally. The range is from 1 to 48 pixels. Use the spinner control or type a number in the edit box.

Vertical   Specifies the number of pixels per inch vertically. The range is from 1 to 48 pixels. Use the spinner control or type a number in the edit box.

Ruler Scale

System Default   Specifies inches or centimeters as the unit of measurement displayed on the ruler, depending on your language setting. This option appears only for reports and labels.

Pixels   Specifies pixels as the unit of measurement displayed on the ruler. This option appears only for reports and labels.


 See Also

Form Designer
Format Menu
Forms Tab, Options Dialog Box
Tools Menu


Help Menu

The Help menu contains options for accessing online Help and information on how to get technical assistance.

Help Menu Commands

Microsoft Visual FoxPro Help Topics   Displays the Visual FoxPro Help Index tab.

Documentation   Displays the Visual FoxPro documentation on CD.

Sample Applications   Displays the Visual FoxPro Sample Applications help topic.

Microsoft on the Web   Displays the Microsoft on the Web Submenu, which provides access to helpful Microsoft Web pages.

Technical Support   Displays information about Microsoft Developer Technical Support.

About Microsoft Visual FoxPro   Displays the About dialog box, which contains information about Visual FoxPro and your system.


Microsoft on the Web Submenu

Provides access to Microsoft Web pages of interest. To use the options on this submenu, you must be able access to the World Wide Web using any of the popular browsers. When you choose an option, Visual FoxPro loads the default browser and links directly to the page associated with your choice.

Free Stuff   Displays a Web page from which you can download software, such as new drivers and early-release versions of new utilities.

Product News   Displays the home page for Visual FoxPro, which contains links to the latest information about Visual FoxPro, including training opportunities, Visual FoxPro events, and product case studies.

Frequently Asked Questions   Displays the Microsoft Support Online Frequently Asked Questions Web page for Visual FoxPro, with links to FAQ pages for all versions of the product.

Online Support   Displays the Visual FoxPro Support Options Web page, which provides links to Microsoft Visual FoxPro newsgroups and reference information.

Microsoft for Developers Only Home Page   Displays the Microsoft for Developers Only Web page. This page provides links to information on Windows-related development, international develpment, and development-related products and technologies.

Send Feedback   Displays the Submit Feedback Web page, in which you can fill out a survey that asks for usage information and product suggestions.

Web Directory   Displays a Web page from The Microsoft Network, with a wide variety of links to sources of information on reference, travel, publication searches, finances, home improvement, and more.

Search the Web   Displays a Web page from which you can search the entire World Wide Web.

Web Tutorial   Displays Microsoft’s Internet Tutorial Web page. This page teaches you about the Internet and the World-Wide Web, explains how to surf the Web, and provides references for terminology, etiquette, and other topics.

Microsoft Home Page   Displays the Microsoft Home Page, from which you can access information about Microsoft products, obtain product support, and download software.


Technical Support

Displays the Microsoft Developer Technical Support Help file, from which you can find out how to get technical support.


About Microsoft Visual FoxPro Dialog Box

Displays the Visual FoxPro copyright, licensing, and version information, and your product identification number.

To display this dialog box

•	From the Help menu, choose About.

Dialog Box Options

System Info   Displays the Microsoft System Information tool which contains your system configuration information. To access help information about Microsoft System Information, press F1 or, choose Help Topics from the Microsoft System Information Help menu.


Menu Menu

The Menu menu contains commands you use to create or modify menu systems.

Menu Commands

Quick Menu   Loads the main Visual FoxPro menu system into the Menu Designer so you can use it as the basis for creating a menu system.

Insert Item   Inserts a new row in the Menu Designer window. Shortcut: CTRL+I

Insert Bar   Displays the Insert System Menu Bar dialog box, which allows you to add menu items to the Menu Designer window.

Delete Item   Deletes the selected row from the Menu Designer window. Shortcut: CTRL + E.

Generate   Displays the Generate Menu dialog box so you can specify a name for the generated menu program and then generate the program.

Preview   Displays a menu system as you design it without compiling menu program code.


Insert System Menu Bar Dialog Box

Allows you to add menus and menu options to the Menu Designer window. This dialog box appears when you choose Insert Bar from the Menu menu or select the Insert Bar button on the Menu Designer window.

Menu Bar Options

Menu List Box   Lists the available menu names and menu option names, depending on whether you have chosen Usage or Prompt in the Order by area.

Order By

Usage   Designates that the Menu List Box display the available menu items in the order that they would appear on their respective menu titles. For example, all of the File menu items are listed first, in the order that they appear on the actual File menu. Edit menu items appear next, and so on.

Prompt   Designates that the Menu List Box display the available menu items in alphabetical order.

Insert   Inserts the selected menu item on the designated row in the Menu Designer window.


Generate Menu Dialog Box

See Also

Lets you specify a name for the generated menu program and then generate the program. If you have not saved your menu, you are prompted to do so.

This dialog box appears when you select Generate from the Menu menu.

Dialog Box Options

Output File   Specifies the path to the generated menu program. Choose the dialog button to select a directory and file name, or substitute a file name of your choice by typing over the name displayed.

Generate   Produces a menu program file, which has the .MPR extension.


 See Also

Do Dialog Box
Menu Designer


Program Menu

See Also

The options on the Program menu are used to run and test Visual FoxPro source code.

Program Menu Commands

Do   Opens the Do dialog box where you can specify a program or form file to execute. Shortcut: CTRL+D

Cancel   Ends execution of a suspended Visual FoxPro program file. Available when a program is suspended. If you cancel a program, the program variables in memory are not released.

Resume   Restarts execution of a suspended program at the line where it was suspended. Available when you stop running a program. Shortcut: CTRL+M, or type RESUME in the Command window.

Suspend   Stops running the program, but keeps it open so you can resume program execution by choosing the Resume command. Available when you are running a program. You can also include the SUSPEND command in your program code to suspend execution at a particular point.

Compile   Opens the Compile dialog box, from which you can compile program, menu, or query files. If you have a program open in the Editing window, the Compile command compiles the current program without displaying any options.

Do <Program>   Runs the program displayed in the Editing window. Appears only when you open a program file. Shortcut: CTRL+E


 See Also

COMPILE Command


Do Dialog Box

See Also

Lets you specify a program or form file to run.

This dialog box appears when you select Do from the Program menu.

Shortcut

CTRL+D

Dialog Box Options

Do (text box)   Specifies the program or form file to run. To run the program or form, select a name from the list and choose Do, or double-click the file name.

The program files displayed are those in the current directory with the .APP,  .FXP, .MPR, .PRG, .QPR, or .SRC extension that matches the type specified in the Files of Type box.

Do (button)   Sets the default folder to the one that contains the selected program or form and runs the program or form.


 See Also

DO Command


Compile Dialog Box

See Also

Lets you can compile program, menu, or query files.

Note   If you have a program open in the Edit window, the Compile command compiles the current program without displaying any options.

This dialog box appears when you select Compile from the Program menu.

Dialog Box Options

File Name   Specifies the file to compile. To compile, select the file name from the list and choose Compile, or double-click the file name. To choose multiple files, hold down the CTRL key while clicking file names.

The files displayed are those in the current directory that match the type specified in the List Files Of Type box.

List Files Of Type   Lists the available file types. Program (.PRG) is the default. If you have given your programs, forms, menus, or queries an extension different from the Visual FoxPro default, you can see them by choosing All Files.

Compile   Compiles the selected files.

Select All   Selects all file names in the File Name box for compiling.

Deselect All   Deselects all file names in the File Name box.

More   Expands the Compile dialog box so you can specify other options.

Options

Encrypt Compiled Files   Scrambles compiled files to protect your source code from being reconstructed by decompile programs.

Include Debugging Information   Specifies whether debugging information is included with the compiled file. If this is not checked, you cannot view program execution in the Trace window. Corresponds to the NODEBUG argument in the COMPILE command.

Compile Updated Files Only   Of the files selected, compiles only those that are new or have been updated since the last time they were compiled.

Error Location

ERR File   Stores error messages for each selected file in a separate file with the same base name as the original file. The .ERR file is stored in the same directory as the source file. If you uncheck this box, error messages for all selected files are stored together in a log file that you specify in the File box.

Append   Adds error messages for each selected file to an existing log file. This check box is enabled if you uncheck the .ERR File check box.

File   Stores error messages for all selected files in one log file. Type the log file name in the box, or choose the dialog button to find and specify an existing log file. This text box is enabled if you uncheck the .ERR File check box.

Location of Compiled Files

Directory   Specifies a path where compiled output files are stored. Type the path in the box, or choose the dialog button to find and specify a directory and file name.


 See Also

COMPILE Command
Trace Window


Project Menu

See Also

The Project menu contains options for creating and modifying projects.

Project Menu Commands

New File   Displays the New File dialog box where you can create a new file based on the type of file you select in the Project Manager. Enabled when you select a file or file type in the Project Manager. The New File command has the same effect as choosing the New button in the Project Manager.

Add File   Displays the Open dialog box so you can add an existing file to a project. This command has the same effect as choosing the Add button in the Project Manager. Enabled when you select a type of file to add in the Project Manager. The file extension and files displayed in the Open dialog box reflect your selection.

Remove File   Removes a selected file from a project and gives you the option to delete it from your hard disk. The Remove command deletes the file from the project, but not from the hard disk. The Delete command removes the selected file both from the project and the hard disk. The Remove File command has the same effect as the Remove button in the Project Manager.

Modify File   Opens either a designer or an editing window so that you can modify a file. This command is enabled if you select a database, free table, query, form, report, label, class library, program, menu, or text file in the Project Manager. The Modify File command has the same effect as the Modify button in the Project Manager.

Open File   Opens the selected database. This command appears when you open the Project Manager and select a database. It has the same effect as the Open button in the Project Manager. If the database is already open, this command changes to Close File.

Close File   Closes the selected database.  This command appears when you open the Project Manager and select a database that is currently open. It has the same effect as the Close button in the Project Manager. If the database is already closed, this command changes to Open File.

Run File   Runs the selected query, form, or program. Enabled when you select a query, form, menu, or program in the Project Manager. It has the same effect as the Run button in the Project Manager.

Browse File   Displays the selected table in a Browse window so you can view and edit its contents. The Browse command has the same effect as the Browse button in the Project Manager.

Preview File   Displays the selected report or label in Print Preview mode. Enabled when you select a report or label in the Project Manager. The Print Preview command has the same effect as the Preview button in the Project Manager.

Rename File   Displays the Rename File dialog box, where you can rename the selected file. Enabled when you have a file selected in the Project Manager.

Include   In a project, includes a file that was previously excluded. Enabled only when you select an excluded file. All included files are compiled into the .APP or .EXE file, making them read-only. If you want to write to a file at run time, you should mark them as excluded.

Exclude   In a project, excludes a file that was previously included. Excluded files are not compiled into the application. Enabled only when you select an included file in Project Manager. Excluded files appear with a slashed circle before their names in the Project Manager. Excluded files are listed in the Project Manager window for your reference, but you must manually distribute them if the application needs them.

Set Main   Specifies that the selected program, menu, query, or form is the application’s main program; the program that is initially executed in a compiled application. You must select a program, form, or menu in the Project Manager to enable this command. When you have selected a main program, this command displays a check mark next to it whenever you have selected the main program in the Project Manager. The main program name is displayed in bold letters in the Project Manager.

Edit Description   Displays the Description dialog box in which you modify the text that appears as the file description at the bottom of the Project Manager window.

Add Project to Source Control   Displays a dialog box from your source code control provider, which allows you to add the opened project to source control. This menu option appears if you have selected a source control provider on the Project tab of the Options dialog box.

Source Control   Displays the Source Control submenu, which allows you to access your source control related dialog boxes from within Visual FoxPro. This Project Menu option appears only if you open a source code-controlled project.

Project Information   Displays the Project Information dialog box, in which you view and edit information about the project and its files. Shortcut: CTRL + J

Errors   Shows a log of errors generated while building the application.

Build   Displays the Build Options dialog box, in which you create a custom application or refresh an existing project.

Refresh   Refreshes the project.

Clean Up Project   Runs the PACK command to decrease the size of the project (.PJX) file by permanently removing files that have been marked for deletion. When you use Remove File to remove a file from a project, the associated record remains in the project’s .PJX file but is marked for deletion. If you remove several files, choose Clean-Up Project to remove records that are marked for deletion.


See Also

Browse Window
Print Preview Toolbar


New File Dialog Box

See Also

Lets you create a new form, report, label, or query, depending on the type of file currently selected in the Project Manager.

If you check Prompt for Wizard in the Projects tab of the Options dialog box, Visual FoxPro prompts you with the option of running a wizard if there is a wizard associated with the selected file type.

Note   File names preceded by a slashed circle are excluded when the project is built. If there is no slashed circle by the file name, that file will be included in the build. The main program file name is in bold.

This dialog box appears when you select New File from the Project menu.

Dialog Box Options

File Type Wizard   Opens a wizard that creates the selected file type. If there is a group of wizards to choose from, Visual FoxPro will prompt you to select the wizard you want. Displayed only if you check Prompt for Wizard in the Projects tab of the Options dialog box.

New File Type   Displays a dialog box, designer, or editing window so you can create the selected file type.


See Also

New Dialog Box
Options Dialog Box
Project Manager
Project Menu
Projects Tab, Options Dialog Box


Rename File Dialog Box

See Also

Lets you rename the selected file.

This dialog box appears when you select Rename File from the Project menu.

Dialog Box Options

Rename   Displays the selected file’s current file name.

To   Displays the current file name, which can be replaced by typing a new name into the box.

Note   Exercise care when renaming files. If you rename a table that is referenced in the DataEnvironment property of a form, that form will not be able to find the table. If you rename a class that has been added to a form, the form will not be able to locate the class.


See Also

Project Manager


Description Dialog Box

Provides a text box where you can type a brief description identifying a file. This dialog box appears when you select a file in the Project Manager and choose the Edit Description command on the Project menu.

Dialog Box Options

Description   Displays the current description of a file, which can be replaced by typing a new description in the box.


Source Control Submenu

Provides options for managing project files in a source-controlled project. This submenu appears only if you open a source code-controlled project.

Submenu Options

Get Latest Version   Displays the Get Latest Version of Files dialog box, which allows you to place the latest read-only copy of the selected source control file in the Project Manager.

Check Out   Displays the Check Out Files dialog box, which allows you to check out a copy of the selected files from your source control provider and places a writable copy in the corresponding development environment working directory.

Check In   Displays the Check In Files dialog box, which allows you to check in changes made in your development environment working directory to your source code control database.

Undo Check Out   Displays the Undo Checkout of Files dialog box, which allows you to overwrite your changes to a file and copies the latest checked-in version to your development environment working directory.

Show History   Displays a dialog box from your source code control provider, which allows you to view the history of changes for the selected file.

Show Differences   Displays a dialog box from your source code control provider, which allows you to view the differences between your local copy of the file and the latest checked-in copy of the file in the source control provider.

Source Control Properties   Displays a dialog box from your source code control provider, which allows you to view detailed information about the selected file.

Add Files to Source Control   Displays the Add Files to Source Control dialog box, which allows you to add the selected file or files in your project to source code control.

Remove Files From Source Control   Displays the Remove Files from Source Control dialog box, which allows you to remove the selected file or files in your project from source code control.

Share Files   Displays a dialog box from your source code control provider, which allows you to share a specific file between multiple projects.

Update Project List   Merges your changes with the central project list file (project metafile, or .PJM file) and displays the results in the Update Project List dialog box. When the process is complete, your local project file will be updated to reflect files that other developers have added. If you have added files, you should update the project list so that other developers can in turn update their project lists and “see” the files.

Show Project List History   Displays a dialog box from your source code control provider, which allows you to view the version number, creation date, and other information about the selected project.

Show Project List Differences   Displays a dialog box from your source code control provider, which allows you to view the differences between your copy of the project and the source control version of the project.

Project Properties   Displays a dialog box from your source code control provider, which allows you to view detailed information about the selected project.

Detach Project From Source Control   Allows you to remove your project from source code control.


Get Latest Version of Files Dialog Box

See Also

Gets the selected files from the source code control provider and places a local copy in the Project Manager.

Dialog Box Options

File(s) to Get Latest Version   Lists available files in the source code control project.

Select All   Selects all available files.

Advanced   Displays the source code control provider’s Advanced Get Options dialog box.


Check In Files Dialog Box

See Also

Checks in changes made in your development environment working directory to your source code control database.

Dialog Box Options

Files To Be Checked In   Lists the files available for check in. Click the files you want to check in, or click Select All to select all the files listed.

Comment   Type an optional comment.

Keep Checked Out   Updates the source code control database with your changes but keeps the file checked out to you.


Check Out Files Dialog Box

See Also

Checks out a copy of the selected files from your source code control provider and places a writable copy in the corresponding development environment working directory.

Dialog Box Options

Files to be Checked Out   Lists the files available for check out. Click the files you want to check out, or click Select All to select all files listed.

Comment   Type a brief description of the reason for the check out.

Select All   Selects all files listed.

Advanced   Displays the source code control provider’s Advanced Check Out Options dialog box.


Undo Check Out of Files Dialog Box

See Also

Overwrites your changes to a file, and copies the latest checked in version to your development environment working directory.

Dialog Box Options

Files to Un-Check Out   Lists the currently checked out files.  Click the files whose checkout you want to undo, or click Select All to select all the listed files.

Select All   Selects all files listed.


Add Files to Source Control Dialog Box

See Also

Adds a file or selected files in your project to source code control.

Dialog Box Options

Files to add   Lists all the files you can add to source control.

Keep Checked out   Updates the source code control database with your changes but keeps the file checked out to you.

Comment   Displays comment associated with a file, or allows you to add or change one.


Remove Files from Source Control Dialog Box

See Also

Removes a file or selected files in your project from source code control.

Dialog Box Options

Files to Remove   Lists the source controlled files in your project.

Select All   Selects all files listed.


Update Project List Dialog Box

Displays the results when you choose Update Project List from the Source Control submenu on the Project menu.

Dialog Box Options

Comments   Displays the results of the update.


Project Info Dialog Box
Project Information Dialog Box

See Also

Lets you view and edit information about the project and its files. For more information about this dialog box, see the Files, tab Projects tab, and Server tab.

Shortcut

CTRL + J

This dialog box appears when you select Project Information from the Project menu.


See Also

Project Menu


Project Tab, Project Information Dialog Box

See Also

Displays status information about the project.

Tab Options

Author   Displays the author’s name, which you can change by typing in the box.

Company   Displays the company name, which you can change by typing in the box.

Address/City/State/Country/Postal Code   Displays the company address information, which you can change by typing in the boxes.

Home   Displays the directory that contains the project file. To change the directory, type another name in the box or click the dialog button to display the Select Directory dialog box.

Last Built   Displays the date and time of the last project build (cannot be edited).

Files   Displays the number of files in the project (cannot be edited).

Debug Info   Specifies whether debugging information is included with the compiled file. If this is not checked, you cannot view program execution in the Trace window. Corresponds to the NODEBUG argument in the COMPILE command.

Encrypted   Specifies whether to scramble compiled files for security.

Attach Icon   Specifies whether to display a selected icon when the application is run. When checked, displays the Open dialog box if an icon has never been assigned to the application.

Icon   Displays the Open dialog box so that you can choose an icon. This button is enabled only if you check Attach Icon to .EXE.


See Also

COMPILE Command
Files Tab, Project Information Dialog Box
Project Manager
Select Directory Dialog Box

Trace Window


Select Directory Dialog Box

See Also

Allows you to set the home directory of the project. This dialog box appears when you choose the dialog button on the Project tab of the Project Information dialog box. The dialog button is associated with the Home option.

Dialog Box Options

Directory   Displays a directory tree, where you click on the directory you want to set as the project home directory.

Drive   Allows you to select a drive so you can choose a directory on that drive.

Select   Makes the selected drive/directory combination the project home directory. This directory is then displayed in the Home box of the Project tab.


See Also

Project Information Dialog Box
Project Manager
Project Tab, Project Information Dialog Box


Files Tab, Project Information Dialog Box

See Also

Displays an alphabetical list of all project files, their type and include/exclude status, date and time last modified, and code page information.

Tab Options

Type   Displays an icon representing the file type.

Name   Displays the file name.

Last Modified   Displays the date and time the file was last modified.

Included   If you select this box, the file is included. If you clear the box, the file is excluded. For more information about including and excluding files in a project, see Project Menu.

Code Page   Displays the code page number.

Update native code page   Updates the code pages for each file listed.


See Also

Project Manager
Project Menu
Project Tab, Project Information Dialog Box


Server Tab, Project Information Dialog Box

See Also

Displays classes located on servers, their library, instancing, description, type, and Help information.

Tab Options

Server Classes   Displays a list of all the available classes, both .VCX and in code, which are marked as OLEPublic. Each class in the list has a corresponding .PJX file.

Class Library   Displays the directory path of the class library in which the selected class is stored.

Class Name   Displays the name of the class.

Instancing   Displays one of three choices; Single Use, Not Creatable, and Multi Use.

Single Use specifies that you can create an instance of the class both inside Visual FoxPro and outside of Visual FoxPro using OLE automation. Each request for an instance of the class by an OLE client outside of the project causes a separate copy of the OLE server to start.

Not Creatable specifies that you can create instances of the class only inside Visual FoxPro.

Multi Use specifies that you can create an instance of the class both inside Visual FoxPro and outside of Visual FoxPro using OLE automation. Each request for an instance of the class by an OLE client outside of the project causes an already running copy of the OLE server to be provided as the source for the new instance.

Description   Displays a small description of the class.

Help file   Displays the Help file associated with the class. Select the dialog button to display the Open dialog box if no file is listed.

Help context ID   Displays the context ID of the Help file associated with the application, if a Help file is distributed with the application.

Project name   Displays the name of the project associated with the server classes.

Typelib description   Displays a description of the class library the selected class is based on.


See Also

Files Tab, Project Information Dialog Box
Project Manager
Project Menu
Project Tab, Project Information Dialog Box


Build Options Dialog Box

See Also

Lets you create a custom application or refresh an existing project.

This dialog box appears when you select Build from the Project menu.

Dialog Box Options

Action

Rebuild Project   Creates and builds a project file. This option corresponds to the BUILD PROJECT command.

Build Application   Builds the project, compiles files that are out of date, and creates a single .APP file. This option corresponds to the BUILD APP command.

Build Executable   Creates an executable file from a project. This option corresponds to the BUILD EXE command.

Build OLE DLL   Creates a Dynamic Link Library with a .DLL file name extension using class information from the project file.

Options

Recompile All Files   Recompiles all files in the project and creates an object file for each source file.

Display Errors   Displays compile-time errors in an editing window after the build is complete.

Run After Build   Allows you to specify if you want the application to run after it has been built.

Regenerate OLE Server IDs   Installs and registers OLE servers contained in the project. When marked, this option specifies that new GUIDs (Globally Unique Identifiers) generate when you build a program. Only those classes marked OLE Public in the Class Info dialog box of the Class menu will be created and registered. This option is enabled when you have marked Build OLE DLL or Build Executable and have already built a program containing the OLEPublic keyword.

Version   Displays the EXE Version dialog box, which allows you to specify information for the version number and the type of version. This button is enabled when you select Build Executable or Build OLE DLL in the Build Options dialog box.


See Also

BUILD APP Command
BUILD EXE Command
BUILD PROJECT Command
Editing Window
Project Manager


EXE Version Dialog Box

Displays information about the build number, as well as other information which you supply.

Dialog Box Options

Version Number

Major   Displays a four-digit number that can be edited. This number corresponds to a major version.

Minor   Displays a four-digit number that can be edited. This number corresponds to a minor version.

Revision   Displays an editable four digit number. This number corresponds to incremental updates.

Auto Increment   When checked, this option allows for automatic updates to the Revision number with every build of the program.

Version Information

Type   Lists six categories of version information which you can define. These categories are Comments, Company Name, File Description, Legal Copyright, Legal Trademarks, and Product Name.

Value   Displays the information entered about a single category. Click a category in the Type list to display, enter, or edit the information.


Query Menu

The Query menu contains commands that create, modify, and run queries. This menu is available when the Query Designer or View Designer is open.

Query Menu Commands

Add Table   Displays the Add Table or View dialog box so you can add a table or view to the designer window.

Remove Table   Removes the selected table from the top pane of the designer window. This command is enabled when you have at least one table selected in the Query or View Designer.

Remove Join Condition   Removes the selected join line from between tables. This command is enabled when you select a join line between tables.

Output Fields   Puts the Fields tab on top in the Query or View Designer window. The Output Fields tab lets you specify the fields that appear in a query result.

Join   Puts the Join tab on top in the Query or View Designer window.

Filter   Puts the Selection Criteria tab on top in the Query or View Designer window. The Selection Criteria tab lets you specify the records that appear in a query result.

Order By   Puts the Order By tab on top in the Query or View Designer window. The Order By tab lets you specify the fields to order the records by in the query.

Group By   Puts the Group By tab on top in the Query or View Designer window. The Group By tab lets you specify conditions for grouping records in the query results.

Update Criteria   Puts the Update Criteria tab on top in the View Designer window. This command is available only for views.

Miscellaneous   Puts the Miscellaneous tab on top in the View Designer window.

Query Destination   Displays the Query Destination dialog box, which allows you to send the results of your query to seven different outputs.

View SQL   Displays the SQL statement that your query or view is building in a read-only text file.

Advanced Options (View Designer Only)   Displays the Advanced Options dialog box, in which you can fine tune how records are retrieved in a view or how updates are made to the server or source tables. This command is available with views only.

View Parameters (View Designer Only)   Displays the View Parameters dialog box, where you can set up views that prompt for a value entry to complete the query. This command is available with views when you have a database open.

Comments   Displays the Comment dialog box, where you can enter notes or comments to identify the query or view and its purpose.

Run Query   Executes the SQL select statement you build, and sends the results to the output destination you specified. Shortcut: CTRL + Q


Add Table or View Dialog Box

See Also

Appears when you select Query or Local View in the New dialog box and then choose New File. In this dialog box, you select one or more existing tables or views on which to base your new query or local view.

Dialog Box Options

Database   Displays the current database by default and lets you select another database.

Tables/Views in Database   Displays the tables or views in the current database, depending on whether you select the Tables or Views option.

Tables   Displays the tables in the current database in the Tables In Database box.

Views   Displays the views in the current database in the Views In Database box.

Other   Displays the Open dialog box, from which you can select a free table to add to the query.


See Also

Add Table or View Dialog Box
Join Condition Dialog Box
Query Menu


Join Condition Dialog Box

See Also

Specifies a join condition between tables. This dialog box appears when you add more than one table in your query or view, and those tables do not have a join condition already specified.

Dialog Box Options

Right Field List   Shows the fields from the table you have added. Select a field from the list by which to join the tables.

Left Field List   Shows the fields from all of the tables previously added into the Query Designer. Select a field from the list by which to join the tables.

Type of Join

Inner Join   Creates a join that will list only the records from the Left Field List that match the records from the Right Field List for the fields selected.

Left Join   Creates a join that includes the Left Field List records and the matching Right Field List records for the fields selected.

Right Join   Creates a join which includes the Right Field List records and the matching Left Field List records for the fields selected.

Full Join   Creates a join which includes all the records from both list boxes for the fields selected in the list boxes.

Description   Specifies how the fields of each table will relate to each other when you select the different join options.


See Also

Add Table or View Dialog Box
Query Menu
SELECT - SQL Command
SET ANSI Command


Query Destination Dialog Box

See Also

Lets you send the results of your query to seven different outputs. This command is available only for queries.

Dialog Box Options

The following table lists and describes the output types.

Destination Option	Details
Browse	Displays the results of your query in a Browse window.
Cursor	Saves the results of your query in a cursor.
Table	Saves the results of your query as a table file.
Graph	Makes the query results available for use with Microsoft Graph, a separate embedded OLE application included with Visual FoxPro.
Screen	Displays the results of your query in the active output window.
Report	Sends the results of your query to a report file.
Label	Sends the results of your query to a label file.


See Also

Browse Button, Query Destination Dialog Box
Cursor Button, Query Destination Dialog Box
Graph Button, Query Destination Dialog Box
Graph Wizard
Label Button, Query Destination Dialog Box
Query and View Designers
Report Button, Query Destination Dialog Box
Screen Button, Query Destination Dialog Box
Table Button, Query Destination Dialog Box


Browse Button, Query Destination Dialog Box

See Also

Displays the results of your query in a Browse window for examination and editing.


See Also

Browse Window


Cursor Button, Query Destination Dialog Box

Saves the results of your query in a cursor with the name you assign it. The cursor is read-only, appears in the View window, and is available for browsing, reporting, or other uses until you close it. This command is available only for queries.

Button Options

Cursor Name   Specifies the name of the cursor.


Table Button, Query Destination Dialog Box

Saves the results of your query as a table file (.DBF) with the name you assign to it. This command is available only for queries.

Button Options

Table Name   Specifies the name of the table. You can either type the name in the text box or use the dialog button to select an existing table that you want to overwrite.


Graph Button, Query Destination Dialog Box

See Also

Makes query results available for use with Microsoft Graph. This command is available only for queries, and is enabled when the source for GENGRAPH is set.

The Graph Wizard appears when you click Graph in the Query Destination dialog box and then choose Run Query from the Query menu.


See Also

GENGRAPH System Variable
Graph Wizard


Screen Button, Query Destination Dialog Box

Displays the results of your query in the active output window. This command is available only for queries.

Button Options

Secondary Output

None   Specifies that the output not be sent to the printer or saved as a text file.

To Printer   Sends the results of the query to the printer as well as to the screen.

To Text File   Saves the results of the query as a text file. Click the button to select an existing file to overwrite, or type the name of a new file in the text box.

Options

Suppress Column Headings   Keeps headings from appearing at the top of the query results.

Pause Between Screens   Pauses at the end of each screen and displays a prompt for you to continue to the next screen. At the prompt, you can cancel the query by pressing ESC.


Report Button, Query Destination Dialog Box

See Also

Displays the results of your query in a report layout. You must have previously set up a report file (.FRX) that accommodates the fields of output in the query. This command is available only for queries.

Button Options

Open Report   Displays the Open dialog box for you to select a report file to use for your query. You can click the button or type the file name in the text box.

Wizard Icon   Displays the Wizard Selection dialog box, from which you can choose a report wizard to run.

Page Preview   Displays the output in the Page Preview window.

Console On   Displays the output in the active output window.

Eject Page Before Report   Prints a blank page at the beginning of the report to separate documents at the printer.

Secondary Output

None   Specifes that the output not be sent to the printer or saved as a text file.

To Printer   Sends the results of the query to the printer.

To Text File   Saves the results of the query as a text file. Click the button to select an existing file that you want to overwrite, or type the name of a new file in the text box.

Options

Suppress Column Headings   Keeps column headings from appearing at the top of the output.

Summary Information Only   Suppresses detail line printing. The report produced includes the headings, footers, totals, and so on, but excludes the detail lines.

Report Headings   Displays the Expression Builder dialog box so you can add a heading to the output. You can click the button to create an expression or type the expression in the text box. The Report Heading option lets you customize the output at run time without changing the report file.


See Also

Expression Builder
REPORT Command
Wizard Selection Dialog Box


Label Button, Query Destination Dialog Box

See Also

Displays the results of the query in an existing label. You must have previously set up the label file (.LBX) to accommodate the columns of output in the query. This command is available for queries only.

Button Options

Open Label   Displays the Open dialog box for you to select a label file to use for your query. You can click the button or type a file name in the text box.

Wizard Icon   Displays the Label Wizard.

Page Preview   Displays the output in the Page Preview window.

Console On   Displays the output in the active output window.

Secondary Output

None   Specifies that the output not be sent to the printer or saved as a text file.

To Printer   Sends the results of the query to the printer.

To Text File   Saves the results of the query as a text file. Click the button to select an existing file that you want to overwrite, or type the name of a new file in the text box.


See Also

Label Wizard


Comment Dialog Box

Allows you to enter notes or comments to identify the query or view and its purpose.

Dialog Box Options

Add Comment   Allows you to type a comment or note about the query or view.


Advanced Options Dialog Box

See Also

Displays the Advanced Options dialog box, in which you can fine tune how records are retrieved in a view or how updates are made to the server or source tables. This command is available with views only.

Dialog Box Options

Connection Information

Connection Name/Datasource   Displays the name of the connection or data source being used to access the data in the view.

Share Connection   Specifies that Visual FoxPro is to use the same connection for new views you create. This option applies only to remote (ODBC) data. If you currently have a connection set up, you can set this option to Uses Current Connection for new views.

Data Fetching

Number of Records to Fetch at a Time   Controls how many records are returned at a time from the ODBC server or remote data source. For example, if you run a query that returns 1000 records, and you set this option to 100, the first 100 records will be displayed when you run the view, and the remaining records will be fetched in blocks of 100 as you continue to browse the results. Clicking All sets this value to -1, indicating that all records should be returned in the first fetch operation.

Maximum Number of Records to Fetch   Limits total number of records returned by a view. Clicking All sets this value to indicate that all records should be returned.

Use Memo When Character Field Length >=   Determines when long character fields should be converted to Memo fields in the output of your view.

Performance

Number of Records to Batch Update   Specifies number of records to update with a single command. For more information, see the REPLACE command and Scope Clauses.

Fetch Memo   Fetches Memo fields from the data source only when a memo field is activated in the view output.

Include Memo Fields in WHERE Clause   Specifies that when Visual FoxPro compares a record held locally to one on the server, it check for changes; memo fields should be included in this comparison. Some data sources don’t support this option; n this case, including a memo field can cause the server to report changes, even if the records are the same.

Precompile SQL on Back-end Server   Specifies that Visual FoxPro pass the SQL query to the server to be compiled before being executed. If this option is supported by the server, queries can be executed substantially faster than if they are not compiled.


See Also

Query and View Designers
REPLACE Command
Scope Clauses


View Parameters Dialog Box

See Also

Sets up views that prompt for a value entry to complete the view.

Dialog Box Options

Name   Specifies name of parameter.

Type   Specifies data type of parameter.

Insert   Inserts a blank row.

Delete   Deletes selected row.


See Also

Query and View Designers


Report Menu

See Also

The Report menu contains options that allow you to create and modify reports.

Report Menu Commands

Title/Summary   Displays the Title/Summary dialog box, in which you specify whether a Title and/or Summary band is included in the report.

Data Grouping   Displays the Data Grouping dialog box so you can create data groups and specify their properties.

Variables   Displays the Report Variables dialog box, in which you create variables within a report.

Default Font   Displays the Font dialog box, in which you specify the persistent fonts, font styles, and font sizes for label and field controls in reports and labels. The settings are saved with the report, so each time the report is modified, the default is the same.

Private Data Session   Opens the tables used in the report in a private set of work areas so that they are not affected by other reports, forms, or programs. Click this command to turn it on or off.

Quick Report   Automatically places selected fields in an empty Report Designer window. The command prompts you to select a table and then displays the Quick Report dialog box, in which you select fields and a field layout.

Run Report   Displays the Print dialog box so you can send the report to a printer.  Running a report doesn’t change the data in the table, index, or memo files.


See Also

Report Designer


Title/Summary Dialog Box

See Also

Lets you specify whether a Title and/or Summary band is included in the report.

Dialog Box Options

Report Title

Title Band   Includes a title band for information that prints once at the beginning of the report.

New Page   Ejects a page after the title band information is printed. You can only check this if you check Title Band first.

Report Summary

Summary Band   Includes a Summary band for information that prints once at the end of the report.

New Page   Ejects a page before the Summary band information is printed. You can only check this if you check Summary Band first.


See Also

Report Designer


Data Grouping Dialog Box

See Also

Lets you create group bands for separating groups of records visually, and displaying introductory and summary data for each group. These properties include printing text in headers and footers to identify specific groups, printing each group on a new page, and resetting page numbers when groups are printed on a new page.

Dialog Box Options

Group Expressions   Displays group break expressions, such as a field name, for the current report and allows you to type new ones. If you want to build an expression, choose the dialog button to display the Expression Builder dialog box.

Group Properties

These options allow you to specify options for page breaks.

Start Group On New Column   Starts a new column every time the group changes.

Start Each Group On a New Page   Starts a new page every time the group changes.

Reset Page Number to 1 for Each Group   Starts a new page and restarts page numbering every time the group changes.

Reprint Group Header On Each Page   Specifies that the group header follow the page header on all pages for the group when the group spans more than one page.

Start Group On New Page When Less Than   Sets the minimum distance from the page bottom that a group header is printed.

Insert   Inserts a blank text box in the Group Expressions box so you can define a new group expression.

Delete   Deletes the selected group expression from the Group Expressions box.


See Also

Expression Builder
Report Variables Dialog Box


Report Variables Dialog Box

See Also

Lets you create variables within a report. Visual FoxPro uses variables to store the results of calculations performed while the report is being printed. Use this command to add new variables, change or delete existing variables, or change the order in which the variables are evaluated.

Dialog Box Options

Variables   Displays the variables in the current report, and provides space for new variables.

Value to Store   Displays expressions stored in the current variable, or allows you to type an expression in the text box. To create an expression that will be stored in the variable, choose the dialog button to display the Expression Builder dialog box.

Initial Value   Displays the selected variable’s value before any calculations are performed, and the value to which the variable is reset. You can enter a value in the text box, or, if you want to create an expression for the initial value, choose the dialog button to display the Expression Builder dialog box.

Release After Report   Releases the report variable from memory after the report is printed. If this option is not selected, the variable remains available in memory until you exit Visual FoxPro or release the variable with the CLEAR ALL or CLEAR MEMORY command.

Reset   Allows you to specify the point at which the variable is reset to its initial value. By default, End of Report is displayed in the list box. You can also select End of Page or End of Column. If you have specified groups in a report in the Data Grouping dialog box, the Reset box displays an item for each group in the report.

Insert   Inserts a blank text box in the Variables box so you can type a new variable name.

Delete   Deletes the selected variable name from the Variables box.

Calculate

These options allow you to specify a calculation that the variable performs. The variable begins calculating with its initial value, and continues until it is reset to this initial value.

Nothing   Specifies that no calculations will be made on this variable.

Count   Counts the number of times a variable is printed per group, page, column, or report (depending on your selection in the Reset box). The calculation is based on the number of times the variable occurs, not on the variable’s value.

Sum   Computes the additive sum of the variable’s values. This option keeps a running total of the variable values for a group, page, column, or report (depending on your selection in the Reset box).

Average   Computes the arithmetic mean (average) of the variable values within a group, page, column, or report (depending on your selection in the Reset box).

Lowest   Displays the lowest value that occurred in that variable for a group, page, column, or report (depending on your selection in the Reset box). Places in the variable the value of the first record in the group. When a lower value is encountered, the variable’s value changes accordingly.

Highest   Displays the highest value that occurred in that variable for a group, page, column, or report (depending on your selection in the Reset box). Places in the variable the value of the first record in the group. When a higher value is encountered, the variable’s value changes accordingly.

Std. Deviation   Returns the square root of the variance for the variable values within a group, page, column, or report (depending on your selection in the Reset box).

Variance   Measures the degree to which individual field values vary from the average of all the values in the group, page, column, or report (depending on your selection in the Reset box).


See Also

CLEAR Commands
Data Grouping Dialog Box
Expression Builder


Quick Report Dialog Box

See Also

Lets you select fields and a field layout for a report.

You can also use Visual FoxPro wizards to quickly create a report. These include the Group/Total Report Wizard, One-to-Many Report Wizard, and Report Wizard.

Dialog Box Options

Field Layout   Shows column layout on the left and row layout on the right. Choose column layout to display the fields from left to right across the page. Choose row layout to display the fields one below the other down the page.

Titles   Determines whether field names will be displayed as titles in label controls either above or next to the corresponding field.

Add Alias   Automatically adds the alias to all field names in the Report Designer window.

Add Table to Data Environment   Automatically adds the table to the data environment.

Fields   Displays the Field Picker dialog box, in which you select fields to display in your report.


See Also

Field Picker
Group/Total Report Wizard
One-to-Many Report Wizard
Report Designer
Report Wizard


Report Expression Dialog Box

See Also

Defines the contents of a field control in a report. This dialog box appears when you place a field control on a report or label.

Dialog Box Options

Expression   Displays the currently selected expression, such as a table field or variable, or allows you to type a new one. Choose the dialog button to display the Expression Builder dialog box if you want to create an expression and verify it before continuing.

Format   When a valid expression is displayed in the Expression box, you can specify a format in this text box. Choose the dialog button to display the Format (Field) dialog box if you want to specify the format for the field in your report.

Calculations   Displays the Calculate Field dialog box so you can select an expression to create a computed field.

Print When   Displays the Print When dialog box so that you can specify the conditions that must be met before the text is printed in your report or label.

Object Position

Float   Specifies that the selected field move relative to the size of the surrounding fields.

Fix Relative to Top of Band   Causes the field to remain in the position you give it in the Report or Label Designer and maintain that position relative to the top of the band.

Fix Relative to Bottom of Band   Causes the field to remain in the position you give it in the Report or Label Designer and maintain that position relative to the bottom of the band.

Stretch With Overflow   Causes the field to expand down the report page to display all data in the field or expression.

Comment   Allows you to add comments to the .FRX or .LBX file. Comments are for reference only and do not appear anywhere in the printed report or label.


See Also

Calculate Field Dialog Box
Expression Builder
Format (Field) Dialog Box
Print When Dialog Box
Report Designer


Format (Field) Dialog Box

See Also

Specifies the value of an expression in a field control. This dialog box appears when you have a valid expression in the Expression box of the Report Expression dialog box and choose the dialog button for Format.

Dialog Box Options

Format   Allows you to type the format expression instead of setting the options below, or type a format template.

Character   Specifies Character data type, and displays the appropriate editing options.

Numeric   Specifies Numeric data type, and displays the appropriate editing options.

Date   Specifies Date data type, and displays the appropriate editing options.

Editing Options

This group changes according to the data type (Character, Numeric, or Date). Selecting these options places a formatting code in the Format box.

To Upper Case (Character type)   Converts all characters to uppercase.

Ignore Input Mask   Displays, but does not store, nonformat characters.

Left Justify (Numeric and Character type)   Begins all numeric data at the leftmost position in the specified field.

Right Justify (Character type)   Prints data flush-right in field.

Center Justify (Character type)   Centers data in field.

Blank If Zero (Numeric type)   If field output is zero, does not print the zero.

(Negative) (Numeric type)   Places negative numbers in parentheses.

SET Date (all types)   Displays data as a date using the current SET DATE format.

British Date (all types)   Displays data as a European (BRITISH) date.

CR If Positive (Numeric type)   Displays CR (credit) after positive numbers.

DB If Negative (Numeric type)   Displays DB (debit) after negative numbers.

Leading Zeros (Numeric type)   Prints all leading zeros.

Currency (Numeric type)   Displays currency format as specified on the Regional tab in the Options dialog box.

Scientific (Numeric type)   Displays format in scientific notation (useful for very large or very small numbers).


See Also

Regional Tab, Options Dialog Box
Report Designer
Report Expression Dialog Box


Calculate Field Dialog Box

See Also

Allows you to select a mathematical operation to create a computed field. This dialog box is displayed when you choose Calculations in the Report Expression dialog box.

Dialog Box Options

Reset   Allows you to specify the point at which the expression is reset to its initial value. By default, End of Report is displayed in the list box. You can also select End of Page or End of Column. If you have specified groups in a report in the Data Grouping dialog box, the Reset box displays an item for each group in the report.

Calculate

These options allow you to specify a calculation performed on the report expression.

Nothing   Specifies that no calculations be made on this expression.

Count   Counts the number of times a variable is printed per group, page, column, or report (depending on your selection in the Reset list). The calculation is based on the number of times the variable occurs, not on the variable’s value.

Sum   Computes the additive sum of the expression’s values. This option keeps a running total of the expression values for a group, page, column, or report (depending on your selection in the Reset box).

Average   Computes the arithmetic mean (average) of the expression values within a group, page, column, or report (depending on your selection in the Reset box).

Lowest   Displays the lowest value that occurred in that expression for a group, page, column, or report (depending on your selection in the Reset list). Initially sets the expression’s value equal to the value of the first record. When a lower value is encountered, the variable’s value changes accordingly.

Highest   Displays the highest value that occurred in that expression for a group, page, column, or report (depending on your selection in the Reset box). Initially sets the expression’s value equal to the value of the first record. When a higher value is encountered, the expression’s value changes accordingly.

Standard deviation   Returns the square root of the variance for the expression values within a group, page, column, or report (depending on your selection in the Reset box).

Variance   Measures the degree to which individual field values vary from the average of all the values in the group, page, column, or report (depending on your selection in the Reset box).


See Also

Data Grouping Dialog Box
Report Designer
Report Expression Dialog Box


Report Designer Band Dialog Boxes

See Also

Select one of the following topics for help on that dialog box.

Column Footer Dialog Box

Column Header Dialog Box

Detail Dialog Box

Group Footer Dialog Box

Group Header Dialog Box

Page Footer Dialog Box

Page Header Dialog Box

Summary Dialog Box

Title Dialog Box


See Also

Report Designer


Column Footer Dialog Box

See Also

Sets height and other options for the Column Footer band in a label or multiple-column report. This dialog box appears when you double-click the Column Footer band separator bar in the Report Designer.

Dialog Box Options

Height   Specifies band height. Type a value in the box, click the UP ARROW or DOWN ARROW key to change the displayed value in increments of .05, or drag the band’s separator bar with the mouse.

Constant Band Height   Prevents the band from stretching to accommodate lengthy data or shrinking to absorb blank lines that have been removed.

Run Expression

On Entry   Specifies that an expression be evaluated before the contents of the column footer are printed. Type the expression in the box, or choose the dialog button to display the Expression Builder dialog box.

On Exit   Specifies that an expression be evaluated after the contents of the column footer are printed. Type the expression in the box, or choose the dialog button to display the Expression Builder dialog box.


See Also

Expression Builder
Label Designer
Report Designer


Column Header Dialog Box

See Also

Sets height and other options for the Column Header band in a label or multiple-column report. This dialog box appears when you double-click the Column Header band separator bar in the Report Designer.

Dialog Box Options

Height   Specifies band height. Type a value in the box, click the UP ARROW or DOWN ARROW key to change the displayed value in increments of .05, or drag the band’s separator bar with the mouse.

Constant Band Height   Prevents the band from stretching to accommodate lengthy data or shrinking to absorb blank lines that have been removed.

Run Expression

On Entry   Specifies that an expression be evaluated before the contents of the column header are printed. Type the expression in the box, or choose the dialog button to display the Expression Builder dialog box.

On Exit   Specifies that an expression be evaluated after the contents of the column header are printed. Type the expression in the box, or choose the dialog button to display the Expression Builder dialog box.


See Also

Expression Builder
Label Designer
Report Designer


Detail Dialog Box

See Also

Sets height and other options for the Detail band in a report or label. This dialog box appears when you double-click the Detail band separator bar in the Report Designer.

Dialog Box Options

Height   Specifies band height. Type a value in the box, click the UP ARROW or DOWN ARROW key to change the displayed value in increments of .05, or drag the band’s separator bar with the mouse.

Constant Band Height   Prevents the band from stretching to accommodate lengthy data or shrinking to absorb blank lines that have been removed.

Run Expression

On Entry   Specifies that an expression be evaluated before a record in the detail band is printed. Type the expression in the box, or choose the dialog button to display the Expression Builder dialog box.

On Exit   Specifies that an expression be evaluated after a record in the detail band is printed. Type the expression in the box, or choose the dialog button to display the Expression Builder dialog box.


See Also

Expression Builder
Label Designer
Report Designer


Group Footer Dialog Box

See Also

Sets height options and band expressions for the Group Footer band in a report or label. This dialog box appears when you double-click the bar for the Group Footer band in the Report Designer. To create a Group Footer band, choose Data Grouping from the Report Menu, create a group expression, and then choose OK.

Dialog Box Options

Height   Specifies band height. Type a value in the box, click the UP ARROW or DOWN ARROW key to change the displayed value in increments of .05, or drag the band’s separator bar with the mouse.

Constant Band Height   Prevents the band from stretching to accommodate lengthy data or shrinking to absorb blank lines that have been removed.

Run Expression

On Entry   Specifies that an expression be evaluated before the contents of the group footer are printed. Type the expression in the box, or choose the dialog button to display the Expression Builder dialog box.

On Exit   Specifies that an expression be evaluated after the contents of the group footer are printed. Type the expression in the box, or choose the dialog button to display the Expression Builder dialog box.


See Also

Data Grouping Dialog Box
Expression Builder
Group Header Dialog Box
Label Designer
Report Designer


Group Header Dialog Box

See Also

Sets height options and band expressions for the Group Header band in a report or label. This dialog box appears when you double-click the bar for the Group Header band in the Report Designer. To create a Group Header band, choose Data Grouping from the Report Menu, create a group expression, and then choose OK.

Dialog Box Options

Height   Specifies band height. Type a value in the box, click the UP ARROW or DOWN ARROW key to change the displayed value in increments of .05, or drag the band’s separator bar with the mouse.

Constant Band Height   Prevents the band from stretching to accommodate lengthy data or shrinking to absorb blank lines that have been removed.

Run Expression

On Entry   Specifies that an expression be evaluated before each new group header is printed. Type the expression in the box, or choose the dialog button to display the Expression Builder dialog box.

On Exit   Specifies that an expression be evaluated after each new page is printed. Type the expression in the box, or choose the dialog button to display the Expression Builder dialog box.


See Also

Data Grouping Dialog Box
Expression Builder
Group Footer Dialog Box
Label Designer
Report Designer


Page Footer Dialog Box

See Also

Sets height and other options for the Page Footer band in a report or label. This dialog box appears when you double-click the Page Footer band separator bar in the Report Designer.

Dialog Box Options

Height   Specifies band height. Type a value in the box, click the UP ARROW or DOWN ARROW key to change the displayed value in increments of .05, or drag the band’s separator bar with the mouse.

Constant Band Height   Prevents the band from stretching to accommodate lengthy data or shrinking to absorb blank lines that have been removed. This option cannot be unselected in the Page Footer dialog box.

Run Expression

On Entry   Specifies that an expression be evaluated before each new group header is printed. Type the expression in the box, or choose the dialog button to display the Expression Builder dialog box.

On Exit   Specifies that an expression be evaluated after each new page is printed. Type the expression in the box, or choose the dialog button to display the Expression Builder dialog box.


See Also

Expression Builder
Label Designer
Report Designer


Page Header Dialog Box

See Also

Sets height and other options for the Page Header band in a report or label. This dialog box appears when you double-click the Page Header band separator bar in the Report Designer.

Dialog Box Options

Height   Specifies band height. Type a value in the box, click the UP ARROW or DOWN ARROW key to change the displayed value in increments of .05, or drag the band’s separator bar with the mouse.

Constant Band Height   Prevents the band from stretching to accommodate lengthy data or shrinking to absorb blank lines that have been removed. This is checked by default, and cannot be unchecked.

Run Expression

On Entry   Specifies that an expression be evaluated before each new group header is printed. Type the expression in the box, or choose the dialog button to display the Expression Builder dialog box.

On Exit   Specifies that an expression be evaluated after each new page is printed. Type the expression in the box, or choose the dialog button to display the Expression Builder dialog box.


See Also

Expression Builder
Label Designer
Report Designer


Summary Dialog Box

See Also

Sets height and other options for the Summary band in a report or label. This dialog box appears when you double-click the Summary band separator bar in the Report Designer. To see the Summary band, you must select Summary band in the Title/Summary dialog box.

Dialog Box Options

Height   Specifies band height. Range is from 0.2083 to 20.00 inches. Type a value in the box, click the UP ARROW or DOWN ARROW key to change the displayed value in increments of .05, or drag the band’s separator bar with the mouse.

Constant Band Height   Prevents the band from stretching to accommodate lengthy data or shrinking to absorb blank lines that have been removed. This option cannot be unselected in the Summary dialog box.

Run Expression

On Entry   Specifies that an expression be evaluated before each new group header is printed. Type the expression in the box, or choose the dialog button to display the Expression Builder dialog box.

On Exit   Specifies that an expression be evaluated after each new page is printed. Type the expression in the box, or choose the dialog button to display the Expression Builder dialog box.


See Also

Expression Builder
Label Designer
Report Designer
Title/Summary Dialog Box


Title Dialog Box

See Also

Sets height and other options for the Title band in a report or label. This dialog box appears when you double-click the Title band separator bar in the Report Designer. To see the Title band, you must select Title band in the Title/Summary dialog box.

Dialog Box Options

Height   Specifies band height. Type a value in the box, click the UP ARROW or DOWN ARROW key to change the displayed value in increments of .05, or drag the band’s separator bar with the mouse.

Constant Band Height   Prevents the band from stretching to accommodate lengthy data or shrinking to absorb blank lines that have been removed.

Run Expression

On Entry   Specifies that an expression be evaluated before each new group header is printed. Type the expression in the box, or choose the dialog button to display the Expression Builder dialog box.

On Exit   Specifies that an expression be evaluated after each new page is printed. Type the expression in the box, or choose the dialog button to display the Expression Builder dialog box.


See Also

Expression Builder
Label Designer
Report Designer
Title/Summary Dialog Box


Print When Dialog Box

See Also

Allows the conditional printing of an object based on the value of an expression and controls how objects print when bands are continued.

For field objects, this dialog box controls whether values that don’t change from band to band are printed. For non-field objects, this dialog box controls how continued bands are printed.

This dialog box appears when you a place a control on a report or label and choose Print When in the control’s dialog box.

A slightly different version of Print When appears when you draw a rectangle or line on a report or label, double-click it, and choose Print When from the Rectangle/Line dialog box.

Dialog Box Options

Print Once Per Band

This option appears for non-field objects only (such as OLE objects, labels, lines, rectangles, and rounded rectangles).

Yes   Objects will print when bands containing the object are started.

No   Object won’t print at all unless one or both of the following are checked: In First Whole Band of New Page/Column and When Detail Overflows to New Page/Column.

Print Repeated Values

This option appears for Field objects only.

Yes   Displays repeated values.

No   Suppresses repeated values.

Also Print

In First Whole Band Of New Page/Column   Prints the field in the first band of a new page or column that isn’t an overflow from a previous page or column. This box is automatically enabled if you check Yes for Print Repeated Values, and optional if you check No for Print Repeated Values.

When This Group Changes   Prints the field when the chosen group changes. This option is available only if a data group exists and you choose a data group from the list box.

When Detail Overflows to New Page/Column   Prints the field when the Detail band overflows to a new page or a new column.

Remove Line If Blank   Collapses the band if an object is not printing and no other object is occupying the same horizontal space.

Print Only When Expression Is True   Provides space for typing an expression, or displays the Expression Builder dialog box so you can define an expression to be evaluated before the field prints. All other options in this dialog box except Remove Line If Blank are disabled if you include an expression.


See Also

Expression Builder
Rectangle/Line Dialog Box
Report Designer
Report Expression Dialog Box


Rectangle/Line Dialog Box

See Also

Specifies position and printing options for rectangle and line controls. This dialog box appears when you draw a rectangle or line in a report or label and then double-click it while it’s selected.

Dialog Box Options

Print When   Displays the Print When dialog box so you can control exactly when the line or rectangle is printed in your report or label.

Object Position

Float   Specifies that the selected line or rectangle control move relative to the size of the surrounding fields.

Fix Relative to Top of Band   Causes the line or rectangle to remain in the position you give it in the Report or Label Designer and maintains that position relative to the top of the band.

Fix Relative to Bottom of Band   Causes the line or rectangle to remain in the position you give it in the Report or Label Designer and maintains that position relative to the bottom of the band.

Stretch Downwards

No Stretch   Specifies that the rectangle not stretch vertically as the band stretches to display field data.

Stretch Relative to Tallest Object In Group   Specifies that the rectangle stretch to accommodate the tallest object in the group.

Stretch Relative to Height of Band   Specifies that the rectangle stretch to fit in the band.

Comment   Allows you to add comments to the .FRX or .LBX file. Comments are for reference only and do not appear anywhere in the printed report or label.


See Also

Print When Dialog Box
Report Controls Toolbar


Round Rectangle Dialog Box

See Also

Specifies the exact shape, position, and printing options for round rectangle controls. This dialog box appears when you draw a round rectangle in a report or label and then double-click it while it’s selected.

Dialog Box Options

Style   Specifies the style of the round rectangle.

Object Position

Float   Specifies that the selected round rectangle control move relative to the size of the surrounding fields.

Fix Relative to Top of Band   Causes the round rectangle to remain in the position you give it in the Report or Label Designer and maintains that position relative to the top of the band.

Fix Relative to Bottom of Band   Causes the round rectangle to remain in the position you give it in the Report or Label Designer and maintains that position relative to the bottom of the band.

Stretch Downwards

No Stretch   Specifies that the round rectangle not stretch vertically as the band stretches to display field data.

Stretch Relative to Tallest Object In Group   Specifies that the round rectangle stretch to accommodate the tallest object in the group.

Stretch Relative to Height of Band   Specifies that the round rectangle stretch to fit in the band.

Print When   Displays the Print When dialog box so you can control exactly when the round rectangle is printed in your report or label.

Comment   Allows you to add comments to the .FRX or .LBX file. Comments are for reference only and do not appear anywhere in the printed report or label.


See Also

Print When Dialog Box
Report Controls Toolbar


Report Picture Dialog Box

See Also

Allows you to include bitmaps, icons, or other information from a General table field in your report or label. This dialog box appears when you choose the Picture/OLE Bound Control button from the Report Controls toolbar and place the control on a report or label.

Dialog Box Options

Picture Form

File   Specifies the bitmap or icon file name. Type the path and file name in the box, or choose the dialog button to open the Open dialog box so you can select the desired bitmap or icon file.

Field   Specifies a General field to include in your report or label. Choose the dialog button to open the Choose Field/Variable dialog box so you can select the desired field, or type the name of the field in the text box.

If a General field in the table contains an object other than a picture or a chart (for example, a Microsoft Excel worksheet or a Microsoft Word document), an icon representing the object is printed in the report or label.

If Picture and Frame Different Size

Clip Picture   Shows a section of the original picture in the frame, retaining the picture’s original dimensions if the picture is bigger than the frame you created in the Report or Label Designer. The picture is anchored at the top and at the left of the frame. You cannot see the lower-right portion of the picture that extends beyond the frame.

Scale Picture — Retain Shape   Displays the whole picture, filling as much of the frame as possible while retaining the relative proportions of the picture. This will protect your picture from vertical or horizontal distortion.

Scale Picture — Fill the Frame   Displays the whole picture, filling the frame completely. If necessary, the picture will be distorted vertically or horizontally to fit the frame.

Object Position

Float   Specifies that the selected picture move relative to the size of the surrounding fields.

Fixed Relative to Top of Band   Causes the picture to remain in the position you give it in the Report or Label Designer and maintains that position relative to the top of the band.

Fixed Relative to Top of Band   Causes the picture to remain in the position you give it in the Report or Label Designer and maintains that position relative to the bottom of the band.

Center Picture   Ensures that General field pictures smaller than the frame are centered in the report or label frame. The pictures included in a General field can be a variety of shapes and sizes. If the picture in a General field is smaller than the frame, it will be displayed in the upper-left corner of the frame unless you select Center Picture.

Note   If you are including a bitmap or icon file in your report or label, Center Picture will have no effect on the single picture. Because a single picture has known parameters, the picture will never be smaller than the frame.

Print When   Displays the Print When dialog box so you can control exactly when the picture is printed in your report or label.

Comment   Allows you to add comments. Comments are entirely for your reference and do not appear in the printed report or label.


See Also

Choose Field/Variable Dialog Box
Picture Property
Print When Dialog Box


Choose Field/Variable Dialog Box

See Also

Specifies a table field or variable.

Dialog Box Options

Choose a Field or Variable   Enter the desired field or variable.

Fields   Displays fields in the table specified in the Field box of the Report Picture dialog box. Double-click the desired field to move the field to the Choose a Field or Variable box.

Variables   Displays available variables. Double-click the desired variable to move it to the Choose a Field or Variable text box.

•	Comment   Allows you to add comments. Comments are entirely for your reference and do not appear in the printed report or label.


See Also

Renport Picture Dialog Box


Form Designer Shortcut Menu

See Also

Contains shortcuts to several useful commands that are in the Form Designer. These commands appear when you right-click the Form Designer.

Shortcut Menu Options

Run Form   Runs the form currently displayed in the Form Designer. This command corresponds to the Run Form command in the Form menu.

Paste   Places from the Clipboard cut or copied sections of text at the insertion point. This command corresponds to the Paste command in the Edit menu.

Data Environment   Displays the Data Environment Designer, which allows you to visually create and modify the data environment of the form or form set. This command corresponds to the Data Environment command in the View menu.

Properties   Displays the Properties window. The Properties window can also be displayed by selecting Properties in the View menu.

Builder   Opens the appropriate builder for the selected control. Several different builders can appear depending on the control selected in the Form Designer. If you select an item in the Form Designer which does not have a builder associated with it, a dialog box appears stating that no builders of that type are registered. The following table lists the types of builders available in the Form Designer.

Builder Name	Item Select on Form
Form Builder	Nothing
*Auto Format Builder	Multiple Controls
Edit Box Builder	Edit Box Control
Command Group Builder	Command Group Control
Text Box Builder	Text Box Control
Combo Box Builder	Combo Box Control
Option Group Builder	Option Group Control
List Box Builder	List Box Control
Grid Builder	Grid Control
*Note   The AutoFormat Builder corresponds to the Builder Lock button on the Form Controls toolbar.

Code   Displays the Code window. The Code window can also be displayed by selecting Code in the View menu.

Help   Displays Help on the selected item.


See Also

Form
Form Designer


Project Manager Shortcut Menu

See Also

Contains shortcuts to several commands useful in the Project Manager. These commands appear when you right-click the Project Manager.

Shortcut Menu Options

Expand All   Expands all collapsed file subgroups in the Project Manager, so you can see the files that the subgroups contain. This command is only available in the Project Manager through the shortcut menu.

Exclude   In a project, excludes a file that was previously included. Excluded files are not compiled into the application. Enabled only when you select an included file in Project Manager. Excluded files appear with a slashed circle before their names in the Project Manager. Excluded files are listed in the Project Manager window for your reference, but you must manually distribute them if the application needs them. This command corresponds to the Exclude command in the Project menu.

Include   In a project, includes a file that was previously excluded. Enabled only when you select an excluded file. All included files are compiled into the .APP or .EXE file, making them read-only. If you want to write to a file at run-time, you should mark them as excluded. This command corresponds to the Include command in the Project menu.

Set Main   Specifies that the selected program, menu, query, or form is the application’s main program; the program that is initially executed in a compiled application. You must select a program, form, or menu in the Project Manager to enable this command. When you have selected a main program, this command displays a check mark next to it whenever you have selected the main program in the Project Manager. The main program name is displayed in bold letters in the Project Manager. This command corresponds to the Set Main command in the Project menu.

Rename   Displays the Rename File dialog box where you can rename the selected file. Enabled when you have a file selected in the Project Manager. This command corresponds to the Rename File command in the Project menu.

Edit Description   Displays the Description dialog box in which you modify the text that appears as the file description at the bottom of the Project Manager window. This command corresponds to the Edit Description command in the Project menu.

Project Info   Displays the Project Information dialog box, in which you view and edit information about the project and its files. This command is enabled when you select a file in the Project Manager window.  The Project Info shortcut command corresponds to the Project Info command in the Project menu.

Code Page   Displays the Code Page dialog box for cross-platform data sharing. This command is enabled when you select a text file, query, icon, or bitmap file name in Project Manager.

Display Description/Path   Displays or hides the description and path information found at the bottom of the Project Manager. This command appears when you right-click in the Description/Path area of the Project Manager. This command can only be accessed in the Project Manager through the shortcut menu by right-clicking in the Description/Path area or on the Project Manager title bar.

Move   Allows you to move the position of the Project Manager using the arrow keys. This command can only be accessed in the Project Manager through the shortcut menu by right-clicking in the Description/Path area or on the Project Manager title bar.

Size   Allows you to adjust the size of the Project Manager window using the arrow keys. This command can only be accessed in the Project Manager through the shortcut menu by right-clicking in the Description/Path area or on the Project Manager title bar.

Close   Closes the Project Manager window. This command can be only accessed in the Project Manger by right-clicking in the Description/Path area or on the Project Manager title bar. This command corresponds to the Close command in the File menu.

Undock   Undocks the Project Manager when it is in the docked mode. This command can only be accessed in the Project Manager through the shortcut menu by right-clicking anywhere on the docked Project Manager.

Build   Displays the Build Options dialog box, in which you create a custom application or refresh an existing project. This command can only be accessed through the shortcut menu while Project Manager is in docked mode. When the Project Manager is undocked, this command corresponds to the Build command in the Project menu or the Build button in the Project Manager window.

Help   Displays Help on the selected item.


See Also

Project Manager
Project Menu


Database Designer Shortcut Menu

See Also

Contains shortcuts to several commands useful in the Database Designer. These commands appear when you right-click the Database Designer.

Shortcut Menu Options

Expand All   Expands all collapsed tables in the Database Designer tab so you can see their names. This command can only be accessed in the Database Designer through the shortcut menu.

Collapse All   Collapses all tables so that only their titles are visible. This command can only be accessed in the Database Designer through the shortcut menu.

Find Object   Displays the Find Table or View dialog box so you can locate objects in the database schema. This command corresponds to the Find Object command in the Database menu.

New Table   Displays the New Table dialog box where you can create a new table using the Table Wizard or Table Designer. This command corresponds to the New Table command in the Database menu.

Add Table   Displays the Open dialog box so you can add an existing table to a database. You can select any table that is not currently part of another database. Since tables can only belong to one database at a time, you need to remove a table from a database before you can use it in a new database. This command corresponds to the Add Table command in the Database menu.

New Remote View   Displays the New Remote View dialog box where you can create a new remote view using the Remote View Wizard or the View Designer. This command corresponds to the New Remote View command in the Database menu.

New Local View   Displays the New Local View dialog box where you can create a new view of a local table using the Local View Wizard or View Designer. This command corresponds to the New Local View command in the Database menu.

Edit Referential Integrity   Displays the Referential Integrity Builder, in which you set up rules to control how records are inserted, updated, or deleted in related tables. This command corresponds to the Edit Referential Integrity command in the Database menu.

Edit Stored Procedures   Displays all Visual FoxPro stored procedures for the current database in an editing window. This command corresponds to the Edit Stored Procedures command in the Database menu.

Connections   Displays the Connections dialog box, in which you can choose to modify an existing connection to a remote data source or choose to create a new one. This command corresponds to the Connections command in the Database menu.

Properties   Displays the Database Properties dialog box, in which you can choose which objects appear in the schema display, or add a comment to the database. This command corresponds to the Properties command in the Database menu.

Remove Relationship   Removes the selected table relationship. This command appears when you right-click on a relationship line between two tables in the Database Designer. This command can only be accessed in the Database Designer through the shortcut menu.

Edit Relationship   Displays the Edit Relationship dialog box where you can alter the persistent relationship between tables. Enable this command by selecting a relationship line in the Database Designer. This command corresponds to the Edit Relationship command in the Database menu.

Browse   Displays the selected table in the Browse window for viewing and editing. This command corresponds to the Browse command in the Database menu.

Delete   Deletes a table from the Database Designer window. This command can only be accessed in the Database Designer through the shortcut menu.

Collapse   Collapses the selected table so that only its title is visible. This command can only be accessed in the Database Designer through the shortcut menu.

Expand   Expands a collapsed table so you can see its field names. This command can only be accessed in the Database Designer through the shortcut menu.

Modify   Opens the selected table in the Table Designer, or the selected view in the View Designer. Use the Table Designer to create and modify tables, fields, indexes, default field values, validation rules, triggers, and comments. This command corresponds to the Modify command in the Database menu.

Help   Displays Help on the selected item.


See Also

Database Designer
Database Menu


Toolbars Shortcut Menu

See Also

Contains shortcuts to several useful toolbars. These commands appear when you right-click on all of the toolbars listed in the Toolbars dialog box.

Shortcut Menu Options

Color Palette   Displays the Color Palette toolbar.

Database Designer   Displays the Database Designer toolbar.

Debugger   Displays the Debugger toolbar. This command is enabled in the Debugger.

Form Controls   Displays the Form Controls toolbar.

Form Designer   Displays the Form Designer toolbar.

Layout   Displays the Layout toolbar.

Print Preview   Displays the Print Preview toolbar.

Query Designer   Displays the Query Designer toolbar.

Report Controls   Displays the Report Controls toolbar.

Report Designer   Displays the Report Designer toolbar.

Standard   Displays the Standard toolbar at the top of the Visual FoxPro screen toolbar.

View Designer   Displays the View Designer toolbar.

Toolbars   Displays the Toolbars dialog box.

Customize   Displays the Customize Toolbar dialog box.


See Also

Customize Toolbar Dialog Box
Toolbars Dialog Box


Command Window Shortcut Menu

See Also

Contains shortcuts to several commands useful in the Command window. These commands appear when you right-click on the Command window.

Shortcut Menu Options

Cut   Removes selected text to the Clipboard. Once you cut something, you can paste it elsewhere in the current application or in other application. This command corresponds to the Cut command in the Edit menu.

Copy   Duplicates selected text and puts it on the Clipboard. Once you copy something to the Clipboard, you can paste it elsewhere in the current application or in other applications. This command corresponds to the Copy command in the Edit menu.

Paste   Places from the Clipboard cut or copied sections of text at the insertion point. This command corresponds to the Paste command in the Edit menu.

Build Expression   Displays the Expression Builder dialog box. This command can only be accessed in the Command window through the shortcut menu.

Execute Selection   Executes the currently highlighted command or set of commands in the Command window. This command can only be accessed in the Command window through the shortcut menu.

Clear   Clears the Command window of all text. This command does not correspond to the Clear command in the window menu. If you select Clear, you cannot select Undo from the Edit menu to unclear the Command window.

Properties   Displays the Edit Properties dialog box, which allows you to set editing options for the current editing window or set color and font options for all editing sessions. This command corresponds to the Properties command in the Edit menu.


See Also

Command Window


Class Designer Shortcut Menu

See Also

Contains shortcuts to several commands that are useful in the Class Designer. These commands appear when you right-click on the Class Designer.

Shortcut Menu Options

Cut   Removes selected text or object to the Clipboard. Once you cut something, you can paste it elsewhere in the current application or in other application. This command corresponds to the Cut command in the Edit menu.

Copy   Duplicates selected text or object and puts it on the Clipboard. Once you copy something to the Clipboard, you can paste it elsewhere in the current application or in other applications. This command corresponds to the Copy command in the Edit menu.

Paste   Places from the Clipboard cut or copied sections of text at the insertion point. This command corresponds to the Paste command in the Edit menu.

Undo   Reverses the last editing change. When you save a file, the Undo command is disabled until you change the file in some way. The Undo command reverses keystrokes, cut, paste, or clear actions, moving of text, indent or outdent, and replacement.

Properties   Displays the Properties window. This command corresponds to the Properties command in the View menu.

Builder   Opens the appropriate builder for the selected control. Several different Builders can appear depending on the control selected in the Class Designer. If you select an item in the Class Designer which does not have a Builder associated with it, you will receive a dialog box message stating that no builders of that type are registered. This table lists the types of builders available in the Class Designer.

Builder Name	Item Select on Form
Form Builder	Nothing
*Auto Format Builder	Multiple Controls
Edit Box Builder	Edit Box Control
Command Group Builder	Command Group Control
Text Box Builder	Text Box Control
Combo Box Builder	Combo Box Control
Option Group Builder	Option Group Control
List Box Builder	List Box Control
Grid Builder	Grid Control
f

*Note   The AutoFormat Builder corresponds to the Builder Lock button on the Form Controls toolbar.

Code   Displays the Code window. Use the Code window to write, display, and edit form, event, and method code.

Help   Displays Help on the selected item.


See Also

Class Designer
Class Menu


Report Designer Shortcut Menu

See Also

Contains shortcuts to several commands useful in the Report Designer. These commands appear when you right-click the Report Designer.

Note   These shortcut menu options are context sensitive. Not all of the following options appear each time you open the shortcut menu.

Shortcut Menu Options

Paste   Places from the Clipboard cut or copied sections of text at the insertion point. This command corresponds to the Paste command in the Edit menu.

Cut   Removes selected text to the Clipboard. Once you cut something, you can paste it elsewhere in the current application or in other application. This command corresponds to the Cut command in the Edit menu.

Copy   Duplicates selected text and puts it on the Clipboard. Once you copy something to the Clipboard, you can paste it elsewhere in the current application or in other applications. This command corresponds to the Copy command in the Edit menu.

Preview   Shows you the results of your work without printing it and displays the Print Preview toolbar. Use the options on the toolbar to change the preview. You can also click the image of the previewed page to zoom in, and click again to zoom out or return to design mode. This command corresponds to the Preview command in the View menu.

Print   Allows you to print the current report by displaying the Print dialog box. This command corresponds to the Print command in the File menu.

Data Environment   Displays the Data Environment Designer which allows you to visually create and modify the data environment of the report. This command corresponds to the Data Environment command in the View menu.

Data Grouping   Displays the Data Grouping dialog box so you can create data groups and specify their properties. This command corresponds to the Data Grouping command in the Report menu.

Properties   Displays a dialog box that corresponds to the object type selected (a text field, rectangle, an OLE Oject field, etc.) which allows you to set the object’s position and other parameters. These parameters can include printing instructions, calculations and expressions.

Help   Displays Help on the selected item.


See Also

Report Designer
Report Menu


Label Designer Shortcut Menu

See Also

Contains shortcuts to several commands useful in the Label Designer. These commands appear when you right-click the Label Designer.

Note   These shortcut menu options are context-sensitive. Not all of the following options appear each time you open the shortcut menu.

Shortcut Menu Options

Paste   Places from the Clipboard cut or copied sections of text at the insertion point. This command corresponds to the Paste command in the Edit menu.

Cut   Removes selected text to the Clipboard. Once you cut something, you can paste it elsewhere in the current application or in other application. This command corresponds to the Cut command in the Edit menu.

Copy   Duplicates selected text and puts it on the Clipboard. Once you copy something to the Clipboard, you can paste it elsewhere in the current application or in other applications. This command corresponds to the Copy command in the Edit menu.

Preview   Shows you the results of your work without printing it and displays the Print Preview toolbar. Use the options on the toolbar to change the preview. You can also click the image of the previewed page to zoom in, and click again to zoom out or return to design mode. This command corresponds to the Preview command in the View menu.

Print   Allows you to print the current label by displaying the Print dialog box. This command corresponds to the Print command in the File menu.

Data Environment   Displays the Data Environment Designer which allows you to visually create and modify the data environment of the label. This command corresponds to the Data Environment command in the View menu.

Data Grouping   Displays the Data Grouping dialog box so you can create data groups and specify their properties. This command corresponds to the Data Grouping command in the Report menu.

Properties   Displays a dialog box that corresponds to the object type selected (a text field, rectangle, an OLE Oject field, etc.) which allows you to set the object’s position and other parameters. These parameters can include printing instructions, calculations and expressions.

Help   Displays Help on the selected item.


See Also

Label Designer
Report Menu


Editing Window Shortcut Menu

See Also

Contains shortcuts to several commands useful when viewing text or program files in the Editing window. These commands appear when you right-click on the Editing window.

Shortcut Menu Options

Cut   Removes selected text to the Clipboard. Once you cut something, you can paste it elsewhere in the current application or in other application. This command is available for both text and program files, and corresponds to the Cut command in the Edit menu.

Copy   Duplicates selected text and puts it on the Clipboard. Once you copy something to the Clipboard, you can paste it elsewhere in the current application or in other applications. This command is available for both text and program files, and corresponds to the Copy command in the Edit menu.

Paste   Places from the Clipboard cut or copied sections of text at the insertion point. This command is available for both text and program files, and corresponds to the Paste command in the Edit menu.

Build Expression   Displays the Expression Builder dialog box, which allows you to create and edit expressions. This command can only be accessed in the Editing window through the shortcut menu.

Do <program>   Lets you execute the program currently displayed in the Editing window. This command corresponds to the Do <program> command in the Program menu.

Execute Selection   Executes the currently highlighted command or set of commands in the Editing window. This command can only be accessed in the Editing window through the shortcut menu.

Procedure/Function List   Displays the Procedures and Functions dialog box, which allows you to see and go to any procedure, function, or #DEFINE definition in your program. This command can only be accessed in the Editing window through the shortcut menu when a .PRG file is displayed.

Font   Displays the Font dialog box where you can set the font type, style, and size. This command corresponds to the Font command in the Format menu.

Find   Displays the Find dialog box so you can search for text. This command corresponds to the Find command in the Edit menu.

Go To   Moves the insertion point to the designated line in the Editing window by displaying the Go To Line dialog box. This command is not enabled if you have selected Word Wrap on the Edit tab of the Options dialog box. This command corresponds to the Find command in the Edit menu.

Beautify   Displays the Beautify Options dialog box, which allows you to adjust the capitalization and indentation of text within the Editing window. This command corresponds to the Beautify command in the Tools menu.

Indent   Indents the selected lines of text. This command corresponds to the Indent command in the Format menu.

Unindent   Unindents the selected lines of text. This command corresponds to the Unindent command in the Format menu.

Comment   Marks the selected lines of text as a comment (*!*). This command corresponds to the Comment command in the Format menu.

Uncomment   Removes the comment format from the selected lines of text. This command corresponds to the Uncomment command in the Format menu.

Properties   Displays the Edit Properties dialog box, which allows you to set editing options for the current editing window or set color and font options for all editing sessions. This command is available for both text and program files, and corresponds to the Properties command in the Edit menu.


See Also

Editing Window


Procedures and Functions Dialog Box

See Also

Allows you to see and go to any procedure, function, or #DEFINE definition in your program.

This dialog box appears when you choose Procedure/Function List from the shortcut menu of a program in an editing window.

Dialog Box Options

Procedures and Functions List   A list of all procedures, functions, and, optionally, all #DEFINE definitions for the .PRG program. Double-click an item in the list to close the Procedures and Functions dialog box and go to the line of code in the program that defines the item.

Sort by   Specifies whether items in the list are sorted alphabetically or displayed by location in the order they appear in the program.

Display #define definitions   Toggles display of #DEFINE definitions in the list.

Go To   Positions you at the line of code that defines the selected procedure, function, or #DEFINE definition. You can also double-click a name in the list to go to that line of code.

Close   Closes the Procedures and Functions dialog box.


See Also

#DEFINE … #UNDEF Preprocessor Directive


Insert Object Reference Dialog Box

See Also

Allows you to see the name of all objects in the designer and insert a fully-qualified reference to the object in your code.

This dialog box appears when you choose Objects List from the shortcut menu of a Code window in the Form Designer or Class Designer.

Dialog Box Options

Objects list   All the objects contained in the highest level container in the Form Designer or Class Designer. Contained objects are indented to indicate the container hierarchy.

Insert   Inserts a string with the full object reference at the cursor in the editing window.


See Also

Class Designer
Form Designer


Code Window Shortcut Menu

See Also

Contains shortcuts to several commands useful in the Code window. These commands appear when you right-click on the Code window.

Shortcut Menu Options

Cut   Removes selected text to the Clipboard. Once you cut something, you can paste it elsewhere in the current application or in other application. This command is available for both text and program files, and corresponds to the Cut command in the Edit menu.

Copy   Duplicates selected text and puts it on the Clipboard. Once you copy something to the Clipboard, you can paste it elsewhere in the current application or in other applications. This command is available for both text and program files, and corresponds to the Copy command in the Edit menu.

Paste   Places from the Clipboard cut or copied sections of text at the insertion point. This command is available for both text and program files, and corresponds to the Paste command in the Edit menu.

Build Expression   Displays the Expression Builder dialog box, which allows you to create and edit expressions. This command can only be access in the Code window through the shortcut menu.

Execute Selection   Executes the currently highlighted command or set of commands in the Code window. This command can only be accessed in the Code window through the shortcut menu.

Object List   Displays the Insert Object Reference dialog box, which allows you to see the name of all objects in the designer and insert a fully-qualified reference to the object in your code. This command can only be accessed in the Code window through the shortcut menu.

Font   Displays the Font dialog box where you can set the font type, style, and size. This command corresponds to the Font command in the Format menu.

Find   Displays the Find dialog box so you can search for text. This command corresponds to the Find command in the Edit menu.

Go To   Moves the insertion point to the designated line in the Editing window by displaying the Go To Line dialog box. This command is not enabled if you have selected Word Wrap on the Edit tab of the Options dialog box. This command corresponds to the Find command in the Edit menu.

Beautify   Displays the Beautify Options dialog box, which allows you to adjust the capitalization and indentation of text within the Editing window. This command corresponds to the Beautify command in the Tools menu.

Indent   Indents the selected lines of text. This command corresponds to the Indent command in the Format menu.

Unindent   Unindents the selected lines of text. This command corresponds to the Unindent command in the Format menu.

Comment   Marks the selected lines of text as a comment (*!*). This command corresponds to the Comment command in the Format menu.

Uncomment   Removes the comment format from the selected lines of text. This command corresponds to the Uncomment command in the Format menu.

Properties   Displays the Edit Properties dialog box which allows you to set editing options for the current editing window or set color and font options for all editing sessions. This command is available for both text and program files, and corresponds to the Properties command in the Edit menu.


See Also

Code Window


Properties Window Shortcut Menu

See Also

Contains shortcuts to several useful commands that are in the Properties window. These commands appear when you right-click the Properties window.

Shortcut Menu Options

Property Descriptions   Displays a description box at the bottom of the Properties window. Click on any of the items in the Properties list to display a description of that property. This command can only be accessed in the Properties window through the shortcut menu.

Always on Top   When this command is checked, the Properties window will remain on top of all subsequent windows displayed in FoxPro. This command can only be accessed in the Properties window through the shortcut menu.

Non-Default Properties Only   Displays only properties that are non-default properties. Non-default properties whose values have been changed from the inherited parent class value are displayed in bold in the Property window. This command can only be accessed in the Properties window through the shortcut menu.

Small Font   Displays the text in the Properties list in the default small font size. This command can only be accessed in the Properties window through the shortcut menu.

Medium Font   Displays the text in the Properties list in a medium font size. This command can only be accessed in the Properties window through the shortcut menu.

Large Font   Displays the text in the Properties list in a large font size. This command can only be accessed in the Properties window through the shortcut menu.

Reset to Default   Resets the selected property to its default value.  This command is enabled only when the selected property is set to a value other than the default value. This command can only be accessed in the Properties window through the shortcut menu.

Zoom   Displays the Zoom <property> dialog box, which allows you to view the entire text value of a property. This command is only enabled when the selected property has a value that is a variable length text string. This command can only be accessed in the Properties window through the shortcut menu.

Expression Builder   Displays the Expression Builder dialog box, which allows you to create and edit expressions.

Help   Displays Help on the selected item.


See Also

Properties Window
Zoom <property> Dialog Box


Zoom <property> Dialog Box

See Also

Displays the text value of the selected property. This command is accessed through the shortcut menu on the Properties window.


See Also

Properties Window
Properties Window Shortcut Menu


Data Environment Shortcut Menu

See Also

Contains shortcuts to several commands useful in the Data Environment Designer. These commands appear when you right-click on the Data Environment Designer.

Shortcut Menu Options

Add   Displays the Add Table or View dialog box, which allows you to select one or more existing tables or views to add to the Data Environment.

Remove   Removes the selected table or view from the Data Environment. This option only appears when you select a table.

Browse   Displays the selected table or view in a Browse window.

Form Designer   Brings the Form Designer to the front. This command appears only when the Data Environment Designer is opened within the Form Designer.

Report Designer   Brings the Report Designer to the front. This command appears only when the Data Environment Designer is opened within the Report Designer.

Properties   Displays the Properties window, which allows you to view and edit the properties, events, and methods for the data environment.

Code   Displays the Code window, which allows you to write, display, and edit form, event, and method code.

Help   Displays Help on the selected item.


See Also

Data Environment Designer


Trace Window Shortcut Menu

See Also

Contains shortcuts to several commands useful in the Trace window of the Debugger. These commands appear when you right-click the Trace window.

Shortcut Menu Options

Open   Displays the Open dialog box, which allows you to select a file.

Resume   Available if program execution is suspended. Allows you to continue execution of the program at the current line of code.

Step Into   Allows you to execute the next line of code or move into the next executable line of code in a called procedure.

Step Over   Allows you to execute the next line of code. If the next line of code calls a function, method, or procedure, then the function, method, or procedure is executed in the background.

Step Out   Allows you to continue executing the code in a procedure without stepping through the code line by line. Program execution is suspended again on a line of code following the procedure call in the calling program.

Set Next Statement   Places the current line marker on the line of code with the cursor. This line of code will then be executed when you step or resume execution.

Run to Cursor   Allows you to execute code from the current line indicator to the line of code with the cursor. Click the line of code you want to suspend execution on to place the cursor on that line.

Trace Between Breaks   Toggles trace between breakpoints.

Docking View   Allows you to specify whether the docking feature for the window is on or off. If unchecked, you cannot dock the window.

Hide   Hides the Trace window.

Font   Displays the Font dialog box where you can set the font type, style, and size. This command corresponds to the Font command in the Format menu.

Help   Displays Help on the selected item.


See Also

Debugger Window
Trace Window


Watch Window Shortcut Menu

See Also

Contains shortcuts to several commands useful in the Watch window of the Debugger. These commands appear when you right-click on the Watch window.

Shortcut Menu Options

Insert Watch   Inserts a new blank watch expression.

Delete Watch   Deletes the highlighted watch expression.

Docking View   Allows you to specify whether the docking feature for the window is on or off. If unchecked, you cannot dock the window.

Hide   Hides the Watch window.

Font   Displays the Font dialog box where you can set the font type, style, and size. This command corresponds to the Font command in the Format menu.

Help   Displays Help on the selected item.


See Also

Debugger Window
Watch Window


Locals Window Shortcut Menu

See Also

Contains shortcuts to several commands useful in the Locals window of the Debugger. These commands appear when you right-click the Locals window.

Shortcut Menu Options

Public   Displays public variables in the Locals window.

Local   Displays local variables in the Locals window.

Standard   Displays standard variables in the Locals window.

Objects   Displays objects in the Locals window

Docking View   Allows you to specify whether the docking feature for the window is on or off. If unchecked, you cannot dock the window.

Hide   Hides the Locals window.

Font   Displays the Font dialog box where you can set the font type, style, and size. This command corresponds to the Font command in the Format menu.

Help   Displays Help on the selected item.


See Also

Locals Window
Debugger Window


Call Stack Window Shortcut Menu

See Also

Contains shortcuts to several commands useful in the Call Stack window of the Debugger. These commands appear when you right-click the Call Stack window.

Shortcut Menu Options

Ordinal Position   Allows you to show or hide the ordinal position indicator.

Current Procedure   Allows you to show or hide the current procedure indicator.

Call Stack Indicator   Allows you to show or hide the call stack indicator.

Docking View   Allows you to specify whether the docking feature for the window is on or off. If unchecked, you cannot dock the window.

Hide   Hides the Call Stack window.

Font   Displays the Font dialog box where you can set the font type, style, and size. This command corresponds to the Font command in the Format menu.

Help   Displays Help on the selected item.


See Also

Call Stack Window
Debugger Window


Debug Output Window Shortcut Menu

See Also

Contains shortcuts to several commands useful in the Debug Output window of the Debugger. These commands appear when you right-click the Debug Output window.

Shortcut Menu Options

Save As   Displays the Save As dialog box, which allows you to save the contents of the Debug Output window.

Clear   Clears the contents of the Debug Output window.

Docking View   Allows you to specify whether the docking feature for the window is on or off.

Hide   Hides the Debug Output window.

Font   Displays the Font dialog box where you can set the font type, style, and size. This command corresponds to the Font command in the Format menu.

Help   Displays Help on the selected item.


See Also

Debug Output Window
Debugger Window


Debugger Toolbar Shortcut Menu

See Also

Contains shortcuts to several commands useful in the Debugger window or FoxPro Frame. These commands appear when you right-click the Debugger Window toolbar or the Debugger frame.

Shortcut Menu Options

Trace   Displays or hides the Trace window.

Watch   Displays or hides the Watch window.

Locals   Displays or hides the Locals window.

Call Stack   Displays or hides the Call Stack window.

Output   Displays or hides the Debug Output window.

Menu   Displays or hides the Visual FoxPro Debugger window menu.

Toolbar   Displays or hides the Visual FoxPro Debugger toolbar.

Status   Displays or hides the Visual FoxPro Debugger status bar.


See Also

Debugger Toolbar
Debugger Window


Query Designer Shortcut Menu

See Also

Contains shortcuts to several commands useful in the Query Designer. These commands appear when you right-clickhold down [image] +OPTION and click the mouse button the Query Designer.

Shortcut Menu Options

Run Query   Executes the SQL select statement you built, and sends the results to the output destination you specified.

View SQL   Displays the SQL statement your query or view is building in a read-only text file.

Remove Table   Removes the selected table from the top pane of the designer window. This command is enabled when you have at least one table in the Query or View Designer selected.

Add Table   Displays the Add Table Or View dialog box so you can add a table or view to the designer window.

Output Settings   Displays the Query Destination dialog box, which lets you send the results of your query to seven different outputs.

Help   Displays Help on the selected item.


See Also

Query Designer
Query Menu


View Designer Shortcut Menu

See Also

Contains shortcuts to several commands useful in the View Designer. These commands appear when you right-clickhold down [image] +OPTION and click the mouse button the View Designer.

Shortcut Menu Options

Run Query   Executes the SQL select statement you built, and sends the results to the output destination you specified.

View SQL   Displays the SQL statement your query or view is building in a read only text file.

Remove Table   Removes the selected table from the top pane of the designer window. This command is enabled when you have at least one table in the Query or View Designer selected.

Add Table   Displays the Add Table Or View dialog box so you can add a table or view to the designer window.

Help   Displays Help on the selected item.


See Also

View Designer
View Menu


View Classes Button Shortcut Menu

See Also

Contains shortcuts to several commands useful in the Form Designer. This menu appears when you click the View Classes button of the Form Controls toolbar.

Shortcut Menu Options

Add   Displays the Open dialog box, which allows you to select a Visual Class Library to display on the Form Controls toolbar.

Standard   When selected, displays the standard controls for the Form Controls toolbar.

ActiveX Controls   When selected, displays ActiveX controls on the Form Controls toolbar.


See Also

Form Controls Toolbar


Class Browser Shortcut Menu

See Also

Contains shortcuts to several commands useful in the Class Browser. These commands appear when you right-clickhold down [image] +OPTION and click the mouse button the Class Browser window, the Class list, and the Members list. The shortcut menu is context sensitive and some of the items are displayed only when applicable.

Shortcut Menu Options

Descriptions   When checked, displays the Class Description box and the Member Description box. The Class Description box displays a description for the selected class, and the Member Description box displays information about the selected class member.

Always on Top   When checked, the Class Browser window remains on top, even when other windows are active. When unchecked, the window does not remain on top.

Restore Defaults   Restores the following settings:

Option	Default Setting
Descriptions	On
Always on top	Off
Auto Expand	On
Hierarchical	On
Protected	Off – Protected members not displayed
Hidden	Off – Hidden members not displayed
Empty Filter	Off – Empty members not displayed
Auto Expand   When checked, the Class Browser automatically expands the class tree to display all of the Objects, Properties, and Methods for each class or subclass when the class or subclass is selected.

Hierarchical   When checked, displays the classes in a hierarchy so that subclasses are displayed under parent classes and the class trees can be expanded or collapsed. If not selected, the classes are displayed alphabetically.

Protected   When checked, displays protected members in the Members list. Protected members are indicated by an asterisk (*).

Hidden   When checked, displays hidden members in the Members list. Hidden members are indicated by a carat (^).

Empty   When checked, displays empty methods in the Members list. Empty methods are indicated by a tilde (~).

Modify   Opens the selected class in the Class Designer or the selected form in the Form Designer. If a method is selected, opens the Designer with the method code window displayed.

Container Icon   Allows you to choose an icon or bitmap for a class.

Remove   Removes a selected class from a class library or removes, and optionally deletes, a selected class library.

Rename   Renames a class, property, or method in the Class Browser. If you rename a class, the Class Browser renames any references to the class in all the files open in all instances of the Class Browser.

Redefine   Changes the ParentClass of the selected class.

Select ParentClass   Selects the ParentClass of the selected class. If the ParentClass is not already displayed in the Class Browser, the library with the ParentClass is added to the Class Browser.

View   displays in a Message box the setting of a selected property in the Members list.

Font   Sets the font attributes of all controls in the Class Browser.

Export   Displays the class definition, property settings, and all method code for the selected class.

Add-ins   Displays a menu of registered add-in programs, applications, and classes.

Help   Opens the Help file.


See Also

Adding Controls to Forms with the Class Browser
Browsing Classes
Class Browser Buttons
Class Browser Methods
Class Browser Properties
Class Browser Window
Managing Classes with the Class Browser
Viewing Class Definition Code


Table Menu

The Table menu contains commands for examining and editing the active (selected) table. This menu appears when you display a table in a browse or edit window.

Table Menu Commands

Properties   Displays the Work Area Properties dialog box, in which you can modify the structure of a table, select index files and fields, and define data filters.

Font   Displays the Font dialog box, which controls the font, font style, and font size of text used to display data in a table or view in the Browse window or Edit window.

Go to Record   Opens the Go To Record submenu, which contains options that let you position the record pointer on a specific record.

Append New Record   Adds a new record to the end of the current table or view. Shortcut: CTRL+Y

Toggle Deletion Mark   Places or removes a deletion mark at the beginning of a selected record to mark or unmark it for deletion. Shortcut: CTRL+T

Append Records   Displays the Append From dialog box, which you use to add records to the current table from another table a spreadsheet, or text file.

Delete Records   Displays the Delete dialog box, in which you mark records for deletion. Corresponds to the DELETE command.

Recall Records   Displays the Recall Records dialog box, in which you unmark records that are marked for deletion. Corresponds to the RECALL command.

Remove Deleted Records   Prompts you to permanently remove records that are marked for deletion. Corresponds to the PACK command.

Replace Field   Displays the Replace Field dialog box, where you can change values stored in one record or in a range of records.

Size Field   Changes the width of the selected field using the keyboard. Place the cursor in a field, choose this command, and then use the LEFT ARROW and RIGHT ARROW keys to narrow or widen the selected field. Press ENTER when the field is the desired size.

Move Field   Moves the selected field using the keyboard. Place the cursor in a field, choose this command, and then use the LEFT ARROW and RIGHT ARROW keys to relocate the field. Press ENTER when the field is relocated.

Resize Partitions   Activates the window splitter so that you can partition the window or change the size of the existing partitions using the keyboard. Use the LEFT ARROW and RIGHT ARROW keys to resize the partitions, and then press ENTER.

Link Partitions   When this command is enabled and the Browse window is split, allows you to scroll in both partitions simultaneously. When disabled, allows you to scroll in one partition without scrolling in the other partition.

Change Partitions   Makes the inactive partition of the split Browse window active, and the active partition inactive. Shortcut: CTRL+H

Rebuild Indexes   Rebuilds any open index files associated with the active table so that they accurately reflect the current status of the table. This command is enabled only if a table has indices associated with it.


Properties Dialog Box
Work Area Properties Dialog Box

See Also

Lets you modify the structure of a table, select index files and fields, and define data filters. This dialog box appears when you choose Properties from the Table menu.

Dialog Box Options

Cursor   Displays the title of the currently opened table.

Enable data buffering   Sets buffering on.

Lock Records

When edited   Prevents access by other users while you edit records. This is also known as pessimistic buffering.

When written   Permits access by other users until the record is updated. This is also known as optimistic buffering.

Buffer

Current record   Enables buffering of the current record only. This is also known as record buffering

All edited records   Enables buffering of all edited records. This is also known as table buffering.

Note   When you select Buffer Current Record, Multilocks are automatically set to ON (if they are currently off), but are not set to OFF if you clear Buffer Current Record or select Buffer All Edited Records. Set the defaults for new tables in the Data tab of the Options dialog box.

Data filter   Provides a text box for typing a data filter expression. Alternatively, the dialog button displays the Expression Builder dialog box, in which you can specify which records in the active table will be available for processing. Corresponds to the SET FILTER command.

Index order   Specifies the index order of the table. In the Database Designer, the table’s primary index appears with a key symbol next to it in the list of indexes. Corresponds to the SET ORDER command.

Allow Access To

All fields in the work area   Specifies that the user have access to all fields in the work area. Corresponds to the SET FIELDS command.

Only fields specified by field filter   Specifies that only records which match the selections in the Field Picker dialog box be displayed or available for editing.

Field Filter   Displays the Field Picker dialog box, in which you control the number of active fields.

Modify   Displays the Table Designer, in which you can modify database and free tables, fields, and indexes.


See Also

Data Tab, Options Dialog Box
Database Designer
Expression Builder
Field Picker
SET FIELDS Command
SET FILTER Command
SET MULTILOCKS Command
SET ORDER Command
Table Designer


Field Picker Dialog Box

See Also

Limits the number of active fields in a table so you can customize what is displayed. Fields that are not active cannot be accessed, examined, or modified. Data in the table itself is not affected. The selections you make in this dialog box are ignored unless you select Only Fields Specified by Field Filter in the Work Area Properties dialog box.

This dialog box appears when you choose Field Filter in the Work Area Properties dialog box, or Fields in the Quick Report dialog box, Append From Options dialog box, or Export Options dialog box.

Dialog Box Options

All Fields   Displays all field names in the current table.

Selected Fields   Displays field names you select in the All Fields box and copy with the Move button.

From Table   Specifies which table’s fields are displayed in the All Fields box.

Move   Copies the selected fields from the All Fields box to the Selected Fields box.

All   Copies all fields from the All Fields box to the Selected Fields box.

Remove   Removes the selected fields from the Selected Fields box.

Remove All   Removes all fields from the Selected Fields box.


See Also

Append From Options
Export Options
Quick Report Dialog Box
Work Area Properties Dialog Box


Go To Record Submenu

See Also

Contains options that let you position the record pointer on a specific record.

Go To Record Submenu Commands

Top   Positions the pointer on the first record in the table or view .

Bottom   Positions the pointer on the last record in the table or view.

Next   Positions the pointer on the record immediately after the current record.

Previous   Positions the pointer on the record immediately before the current record.

Record #   Displays the Go To Record dialog box, in which you specify a record number.

Locate   Displays the Locate Record dialog box, in which you can find an indexed or unindexed field or find more than one record in a table or view.


See Also

Go To Record
Locate Record


Go To Record Dialog Box

See Also

Specifies which record to move the record pointer to. Type the record number in the Record Number box, or use the up and down arrows as required until the desired number displays in the Record Number box. Choose OK to return to the Browse window with the record pointer on the specified record.

This dialog box appears when you choose the Record # command from the Go to Record submenu.


See Also

Browse Window


Locate Record Dialog Box

See Also

Searches for a record in the active table or view that matches specified conditions. Use this command when you want to search a table or view record-by-record on an indexed or unindexed field, or when you want to find more than one record in a table.

This dialog box appears when you choose the Locate command from the Go to Record submenu.

Dialog Box Options

Scope   Allows you specify the records on which Visual FoxPro is to act. Choose All, Next, Record, or Rest from the drop-down list. Choose a number from the spinner on the right when you select Next or Record from the Scope drop-down list.

For   Displays the Expression Builder dialog box, in which you create the logical expression that every record must meet to be affected by the command.

While   Displays the Expression Builder dialog box. The While expression specifies that the action affects records only as long as the logical expression is true. The first time the expression evaluates to false, the action ceases without considering remaining records.

Locate   Carries out the command using the Scope, For, and While values.


See Also

Browse Window
CONTINUE Command
Expression Builder
Go To Record
LOCATE Command
Scope Dialog Box


Scope Dialog Box

See Also

Specifies which records Visual FoxPro acts on in the current table or view. This dialog box appears when you choose Scope from the Export Options dialog box.

Dialog Box Options

All   The action affects all records in the table or view.

Next   The action affects a range of records beginning with the current record and continuing for the number of records you specify. Type a value of 1 to act on the current record.

Record   The action affects only the specified record number.

Rest   The action affects a range of records beginning with the current record and ending with the last record in the table or view.


See Also

Browse Window
Export Options Dialog Box


Append From Dialog Box

See Also

Lets you add records to the current table or view from another table, a spreadsheet, or text file. This dialog displays when you select Append Records from the Table menu.

Dialog Box Options

Type   Specifies the file type from which to append records.

From   Provides space for you to type the name of the file from which to append records. If you don’t know the name, choose the dialog button to display the Open dialog box and select the desired file.

To   Displays the path and file name of the table or view to which the records will be appended.

Options   Displays the Append From Options dialog box, in which you specify fields to append, and build an expression which records to be appended must meet.


See Also

Append From Options
APPEND FROM Command
Browse Window
Open Dialog Box


Append From Options Dialog Box

See Also

Specifies fields to append and allows you to build an expression which records to be appended must meet. This dialog box appears when you choose Options in the Append From dialog box.

Dialog Box Options

Criteria

Fields   Displays the Field Picker dialog box, where you select fields to append.

For   Displays the Expression Builder dialog box, where you create a For expression that every record must meet to be appended.


See Also

Append From Dialog Box
Expression Builder
Field Picker


Delete Records Dialog Box
Delete (Records) Dialog Box

See Also

Lets you mark records for deletion. Corresponds to the DELETE command.

This command does not physically delete records, but only marks them for deletion in the future. To permanently delete records from the hard disk, use Remove Deleted Records in the Table menu.

Dialog Box Options

Scope   Allows you to specify the records on which Visual FoxPro is to act. Choose Next, All, Record or Rest from the drop-down list. Choose a number from the spinner on the right when you select Next or Record from the Scope drop-down list.

For   Displays the Expression Builder dialog box, where you create the logical expression that every record must meet to be affected by the command. Every record in the table is tested using the For expression.

While   Displays the Expression Builder dialog box. The While expression specifies that the action affects records only as long as the logical expression is true. The first time the expression evaluates to false, the action ceases without considering remaining records.

Delete   Deletes records using the Scope, For, and While values.


See Also

Database Menu
DELETE Command
Expression Builder
Recall Records Dialog Box
Scope Dialog Box


Recall Records Dialog Box

See Also

Lets you unmark records that are marked for deletion. Corresponds to the RECALL command.

Dialog Box Options

Scope   Allows you to specify the records on which Visual FoxPro is to act. Choose Next, All, Record or Rest from the drop-down list. Choose a number from the spinner on the right when you select Next or Record from the Scope drop-down list.

For   Displays the Expression Builder dialog box, where you create the logical expression that every record must meet to be affected by the command. Every record in the table is tested using the For expression.

While   Displays the Expression Builder dialog box. The While expression specifies that the action affects records only as long as the logical expression is true. The first time the expression evaluates to false, the action ceases without considering remaining records.

Recall   Recalls records using the Scope, For, and While values.


See Also

Delete Records Dialog Box
Expression Builder
RECALL Command
Scope Dialog Box


Replace Field Dialog Box

See Also

Changes values stored in one record or in a range of records.

Dialog Box Options

Field   Displays the name of table fields from the current table. When you click the down arrow, the types and sizes of fields are displayed.

With   Specifies the expression that describes the replacement values. Type the expression or choose the dialog button to display the Expression Builder dialog box and create a replacement expression.

Replacement Criteria

Scope   Allows you to specify the records on which Visual FoxPro is to act. Next, All, Record or Rest from the drop-down list. Choose a number from the spinner on the right when you select Next or Record from the Scope drop-down list.

For   Displays the Expression Builder dialog box, where you create the logical expression that every record must meet to be affected by the command. Every record in the table is tested using the For expression.

While   Displays the Expression Builder dialog box. The While expression specifies that the action affects records only as long as the logical expression is true. The first time the expression evaluates to false, the action ceases without considering remaining records.

Replace   Replaces records using the Scope, For, and While values. Enabled only when you have a field name or expression in both the Field and With text boxes.


See Also

Expression Builder
REPLACE Command
Scope Dialog Box


Tools Menu

The Tools menu contains commands that set system options, run wizards, create macros, check spelling, beautify code, run a source code control provider, and trace and debug source code.

Menu Commands

Wizards   Displays a submenu of Visual FoxPro wizards. If multiple wizards exist for that category, the Wizard Selection dialog box appears. If not, the appropriate wizard opens.

Spelling   Displays the Spelling dialog box, from which you can customize and run the spell checker.

Macros   Opens the Macros dialog box, where you can define key combinations to perform a series of keystrokes.

Class Browser   Opens the Class Browser window.

Beautify   Opens the Beautify Options dialog box, in which you adjust the capitalization and indentation of text within an editing window.

Debugger   Opens the Debugger window, in which you can monitor values stored in variables, array elements, fields, and properties. You can also see the return value of Visual FoxPro functions.

Trace Window   Allows you to see your lines of code as they are being executed. This menu option appears when you choose FoxPro Frame as the debug environment on the Debug tab of the Options dialog box.

Watch Window   Allows you to display expressions and their current values, and set breakpoints on an expression. This menu option appears when you choose FoxPro Frame as the debug environment on the Debug tab of the Options dialog box.

Locals Window   Allows you to display all the variables, arrays, objects, and object members that are visible in a given program, procedure, or method. This menu option appears when you choose FoxPro Frame as the debug environment on the Debug tab of the Options dialog box.

Call Stack Window   Allows you to display procedures, programs, and methods that are executing. While a program is running, it is listed in the Call Stack window. If you run a procedure or another program from within the first program, while the second program is running, both program names are displayed in the Call Stack window, and so on. This menu option appears when you choose FoxPro Frame as the debug environment on the Debug tab of the Options dialog box.

Output Window   Allows you to display output from active programs, procedures, or method code. This menu option appears when you choose FoxPro Frame as the debug environment on the Debug tab of the Options dialog box.

Run <source code control provider>   Allows you to open your source code control-provider application. This option appears if you open a source code controlled project and have selected your source code control provider in the Active Source Control Provider drop-down list on the Projects tab of the Options dialog box.

Options   Displays the Options dialog box where you can set many categories of system options.


Wizard Selection Dialog Box

See Also

Displays a list of wizards from which you can choose. This dialog box is displayed when you choose Wizards from the Tools menu and then choose Query, Form, Report, or All from the submenu.

Dialog Box Options

Select the wizard you would like to use   Displays all Visual FoxPro wizards available for a particular item. For instance, Visual FoxPro has three different report wizards.

Description   Gives a brief description of the currently selected wizard.


See Also

Wizards Overview


Spelling Dialog Box

See Also

Lets you check spelling in a text file or memo field.

Dialog Box Options

Not In Dictionary   Displays a word not found in the active dictionaries. If your text has column spacing or indents, this box changes to Extra Space.

Note   If you don’t want Visual FoxPro to count extra spaces, change the setting in the Spelling Options dialog box.

Change To/Suggestions   Type or select a replacement for the word not found in the dictionaries. To delete the word in the Not In Dictionary box from the document, delete the text in the Change To box and choose Change All.

Ignore   Leaves the specified word unchanged in the specified instance.

Ignore All   Leaves the specified word unchanged throughout the document.

Change   Changes the specified word to the word in the Change To box.

Change All   Changes the specified word throughout the document to the word in the Change To box.

Add   Adds the specified word to the dictionary.

Undo Last   Reverses the last replacement made in the document. You can reverse up to five of the most recent replacements.

Suggest   Displays a list of proposed suggestions after you type a word in the Change To box.

Options   Displays the Spelling Options dialog box, in which you can control the rules Visual FoxPro uses to check spelling.


See Also

SPELLCHK System Variable
Spelling Options Dialog Box


Spelling Options Dialog Box

See Also

Controls the rules Visual FoxPro uses to check spelling. This dialog box appears when you choose Options in the Spelling dialog box.

Dialog Box Options

Always Suggest   Displays a list of suggested corrections for each unmatched word when you check spelling.

Ignore Words In UPPERCASE   Skips words in which each character is an uppercase letter.

Ignore Extra Spaces   Skips extra spaces between words.

Dictionary

Language   Specifies the language of the active dictionary.

Type   Specifies the Normal, Concise, Complete, Medical, or Legal dictionary.


See Also

Spelling Dialog Box


Macros Dialog Box

See Also

Lets you define key combinations using the CTRL key ALT key, or function keys to perform a series of keystrokes. You can combine individual macros in sets and store them in files.

Dialog Box Options

Individual Macro

Displays macros available for use. When you first install Visual FoxPro, the following macros already exist.

Key	Function
F2	SET
F3	LIST
F4	DIR
F5	DISPLAY STRUCTURE
F6	DISPLAY STATUS
F7	DISPLAY MEMORY
F8	DISPLAY
F9	APPEND
Record   Displays the Record Macro dialog box, in which you can create a macro.

New   Displays the New Macro dialog box, in which you can manually create a macro.

Edit   Displays the Edit Macro dialog box, in which you can edit the selected macro.

Clear   Prompts you to erase or keep the selected macro.

Macro Set

Save   Displays the Save Macros dialog box, in which you can name and save individual macros or macro sets.

Restore   Displays the Restore Macros dialog box in which you can add a saved macro set to the current macros (i.e., those in the Individual macro box in the Macros dialog box).

Set Default   Prompts you to overwrite the default macro set with a new macro set.

Clear All   Prompts you to erase all macros in the Individual Macro list.


See Also

APPEND Command
DIR Command
DISPLAY Command
DISPLAY MEMORY Command
DISPLAY STATUS Command
DISPLAY STRUCTURE Command
Edit Macro Dialog Box
LIST Command
Macro File Format (.FKY)
Macro Substitution
PLAY MACRO Command
SET Command


Record Macro Dialog Box

See Also

Automatically creates a macro by recording your keystrokes until you stop recording.

This dialog box appears when you choose Record in the Macros dialog box.

Dialog Box Options

Defined Key   Displays the key combination you press that will run the macro. To assign your macro to a particular keystroke, put the cursor in this field, and then press the key or key combination. Visual FoxPro puts the name of the key or key combination you pressed into this field and assigns the macro you are about to record to that key or key combination.

Macro Name   Displays the default macro name, which is based on the defined key. For example, if the defined key is CTRL+D, the macro name will be CTRL_D. If you want to rename the macro, type the new name (up to 20 characters) in the box. The recording doesn’t begin until you click OK, which puts the insertion point in the command window where you record the macro.


See Also

Macros Dialog Box
SET FUNCTION Command
Stop Recording Macro Dialog Box


Stop Recording Macro Dialog Box

See Also

Interrupts the process of recording a macro. From this dialog box, you can choose OK to stop recording the macro as it is, or you can take advantage of some other options.

This dialog box appears when you select Macros from the Tools menu while recording a macro.

Dialog Box Options

Insert Literal   Records the literal meaning of the next keystroke, instead of a meaning currently assigned to the key with a macro. Use this when you want to circularly define two keys.

Insert Pause   Records a pause in the macro. Before you choose Insert Pause, choose either Key To Resume or Seconds to define how macro execution will resume.

Key to Resume   Prompts for a key that resumes execution of a macro that has been paused. This prompt appears only if you have implemented the SET MACKEY command.

Seconds   Specifies how long the pause in macro execution lasts before it automatically resumes. In the spinner control, type or select a number.

Continue   Returns to the point before the Stop Recording Macro dialog box appeared so you can continue recording the macro.

Discard   Deletes the macro you are recording and puts your insertion point in the last entered text box.

OK   Confirms that the macro is completed and ready for use.


See Also

Macros Dialog Box
SET MACKEY


Overwrite Macro Dialog Box

See Also

Replaces an existing macro with a new one of the same name. This dialog box appears when you define an already existing key combination in the Record Macro dialog box and click OK.

Dialog Box Options

Overwrite   Replaces the existing macro definition with the new definition.

Append Keystrokes   Adds keystrokes to the end of the existing macro. The insertion point is placed in the last entered text box so you can type the keystrokes to append.


See Also

Record Macro Dialog Box


New Macro Dialog Box

Manually creates a macro instead of recording your keystrokes.

Dialog Box Options

Defined Key   Displays the key combination you press that will launch the macro.

Macro Name   Displays the default macro name, which is based on the defined key. For example, if the defined key is CTRL+D, the macro name will be CTRL_D. If you want to rename the macro, type the new name (up to 20 characters) in the box.

Macro Contents   Provides space for you to type the keystrokes the macro executes. Use the key label assignments listed in the ON KEY LABEL topic and enclose them in braces to represent the desired keystrokes. Place all key combinations (such as CTRL+F2) in braces also. For example:

MODIFY{SPACEBAR}COMMAND{ENTER}

{HOME}{SHIFT+END}

Note   The key combinations SHIFT+CTRL+\, CTRL+-, CTRL+^, and SHIFT+CTRL+ENTER are not supported in Visual FoxPro.


Macro Edit Dialog Box
Edit Macro Dialog Box

See Also

Allows you to manually edit a pre-existing macro.

Dialog Box Options

Defined Key   Displays the key combination you press that will launch the macro.

Macro Name   Displays the default macro name, which is based on the defined key. For example, if the defined key is CTRL+D, the macro name will be CTRL_D. If you want to rename the macro, type the new name (up to 20 characters) in the box.

Macro Contents   Provides space for you to type the keystrokes the macro executes. Use the key label assignments listed in the ON KEY LABEL topic and enclose them in braces to represent the desired keystrokes. Place all key combinations (such as CTRL+F2) in braces also. For example:

MODIFY{SPACEBAR}COMMAND{ENTER}

{HOME}{SHIFT+END}

Note   The key combinations SHIFT+CTRL+\, CTRL+-, CTRL+^, and SHIFT+CTRL+ENTER are not supported in Visual FoxPro.


See Also

ON KEY LABEL Command


Beautify Options Dialog Box

Allows you to specify capitalization and indentation styles to editing window text. This command appears when you open a program or text file in an editing window.

Dialog Box Options

Capitalization

Keywords   Provides four ways to represent keywords. Keywords can be formatted as UPPERCASE, lowercase, Mixed Case, or No change.

Symbols   Provides four ways to represent symbols. Symbols can be formatted as UPPERCASE, lowercase, Match with first occurrence, or No change. Match with first occurrence only affects the symbols available within the current editing window.

Indentation

Types of indent   Provides three ways to indent text. Text can be indented using Tabs, Spaces, or No Change. If Spaces is selected, type or select the number of spaces to indent the text using the Spaces spinner control.

Text to indent   Allows you to specify what types of text should be indented. Comment causes all text lines beginning with the * comment identifier to be indented. Continuation lines causes the lines following the (;)—used to indicate the first line continuation mark—to be indented. The indentation for Continuation lines continues at the same level until a new command line is entered.

Extra indent beneath   Provides extra indentation for the lines following the beginning of procedures and DO CASE control structures.


Debugger Window

See Also

The Visual FoxPro Debugger window contains the Debugger menus, the Debugger toolbar, and several debugging windows.

This window is activated when you choose Debugger from the main Visual FoxPro Tools menu.

Window Elements

Trace Window   Allows you to see your lines of code as they are being executed.

Locals Window   Displays the visible variables, arrays, objects, and object members from the current program, procedure, or method.

Watch Window   Displays expressions and their current values, and allows you to set breakpoints on an expression.

Call Stack Window   Displays procedures, programs, and methods that are executing.

Debug Output Window   Displays debug-specific output from your programs.

The debugging windows and toolbar can be docked and positioned.

To	Do
Resize adjacent docked windows	Drag the separator bar between them.
Float a window	Choose Undock from the shortcut menu.
View an open, hidden window	Click the toolbar button associated with the window twice: once to close the window and a second time to reopen the window.


See Also

Tools Menu


Options Dialog Box

See Also

Lets you set different categories of options.

When you choose Set As Default, which appears on every tab in the dialog box, Visual FoxPro saves all the options on all tabs.

Tab Options

Tabs available in Options dialog box

The options are grouped onto the following tabs.

Tab	To access these features
View	Interface options, such as whether to display a status bar, clock, command results, system messages, or a recently used project list.
General	Data entry and programming options, such as setting the warning sound, whether to log compilation errors, whether to automatically fill new records, what navigation keys to use, what color palette to use, and whether to warn before overwriting files.
Data	Table options, such as whether to use Rushmore optimization, whether to enforce uniqueness using indexes, the memo clock size, the record counter interval for searches, and what locking options to use.
Remote Data	Remote data access options, such as connection timeout values, the number of records to fetch at once, and how to use SQL for updates.
File Locations	Locations for the default Visual FoxPro directory, where Help is stored, and where auxiliary files are stored.
Forms	Form Designer options, such as the grid spacing, the scale units to use, the maximum design area, and what template classes to use.
Projects	Project Manager options, such as whether to prompt for wizards, whether to run or modify files on double-click, and options for source control.
Controls	Options for what visual class libraries and ActiveX controls to make available from the View Classes button on the Form Controls toolbar.
Regional	Formats for dates, times, currency, and numbers.
Debug	Debugger display and trace options, such as what font and color to use.
Syntax Coloring	Font and color options for identifying elements of programs such as comments and keywords.
Field Mapping	Options for what controls to create when dragging tables or fields to a form from the Data Environment Designer, Database Designer, or Project Manager.


See Also

Controls Tab, Options Dialog Box
Data Tab, Options Dialog Box
Debug Tab, Options Dialog Box
Edit Properties Dialog Box
Field Mapping Tab, Options Dialog Box
File Locations Tab, Options Dialog Box
Forms Tab, Options Dialog Box
General Tab, Options Dialog Box
Projects Tab, Options Dialog Box
Regional Tab, Options Dialog Box
Remote Data
Syntax Coloring Tab, Options Dialog Box
View Tab, Options Dialog Box


View Tab, Options Dialog Box

See Also

Contains options for controlling the display of Visual FoxPro features.

When you choose Set As Default, which appears on every tab in the dialog box, Visual FoxPro saves all the options on all tabs.

Tab Options

Show

Status bar   Specifies whether Visual FoxPro displays the status bar at the bottom of the main window. Corresponds to the SET STATUS BAR command.

Clock   Specifies whether the system clock appears in the status bar. You must choose the Status Bar option for this option to have effect. Corresponds to the SET CLOCK STATUS command.

Command results   Specifies that Visual FoxPro displays the results of certain commands including APPEND FROM, AVERAGE, CALCULATE, COUNT, INDEX, SUM, and TOTAL, in the main Visual FoxPro window, the system message window, the graphical status bar, or a user-defined window. Corresponds to the SET TALK command.

System messages   Specifies that Visual FoxPro displays certain system messages in the status bar. This option corresponds to the SET NOTIFY command.

Recently used project list   Specifies that the 1, 2, 3, 4 commands appear on the File menu, allowing you to directly open one of the four projects most recently used. This option is disabled if Resource file in the File Locations tab has been unchecked or if SET RESOURCE has been set to OFF.

Open last project on startup   Specifies that Visual FoxPro opens the most recently used project when starting. This option is disabled if Resource file in the File Locations tab has been unchecked or if SET RESOURCE has been set to OFF.


See Also

File Menu
Options Dialog Box
SET CLOCK Command
SET NOTIFY Command
SET STATUS BAR Command
SET TALK Command


General Tab, Options Dialog Box

See Also

Contains sound, programming, data entry, and other options in Visual FoxPro.

When you choose Set As Default—which appears on every tab in the dialog box—Visual FoxPro saves all the options on all tabs.

Tab Options

Warning Sound

Off   Turns the error sound off. Corresponds to the SET BELL OFF command.

Default   Sets the error sound to your system default. Corresponds to the SET BELL ON command.

Play   Sets the error sound to a .WAV file. Type the name of the file in the box, or click the dialog button to select an existing .WAV file. Corresponds to the SET BELL <file> command.

Programming

Cancel programs on Escape   Specifies that you can cancel a running program by pressing the ESC key. Corresponds to the SET ESCAPE command.

Log compilation errors   Specifies that Visual FoxPro logs compilation errors in a file with the same name as the project file, but with an .ERR extension. Corresponds to the SET LOGERRORS command.

SET DEVELOPMENT   Specifies that Visual FoxPro recompiles a program before running it if the object code is older than the source code. Corresponds to the SET DEVELOPMENT command.

dBASE compatibility   Specifies compatibility with FoxBASE+, dBASE, and other Xbase languages. Corresponds to the SET COMPATIBLE command.

Use Visual FoxPro color palette   Specifies that Visual FoxPro applies the default color palette to all bitmaps and OLE objects, which prevents palette shift when several pictures are displayed at once. Corresponds to the SET PALETTE command.

Confirm file replacement   Specifies that Visual FoxPro prompts you for verification when you are about to overwrite existing files with new ones. Corresponds to the SET SAFETY command.

Browse IME control   Specifies that Visual FoxPro displays an Input Method Editor when you navigate to a text box in the Browse window. This setting has no effect if you are not working in a DBCS environment. Corresponds to the IMESTATUS( ) function.

Data Entry

Navigation keys   Specifies whether to use Windows- or MS-DOS–compatible navigation keys for tasks such as moving between controls in forms. Corresponds to the SET KEYCOMP command.

Fill new records with current values   Specifies that Visual FoxPro automatically copies values from the current record to a new record that you are inserting or appending. Corresponds to the SET CARRY command.

Enter or tab to exit fields   Specifies that you want to exit text boxes only by pressing ENTER or TAB. Otherwise, you can exit text boxes by typing past the last character in the text box. Corresponds to the SET CONFIRM command.


See Also

IMEStatus( ) Function
Options Dialog Box
SET BELL Command
SET CARRY Command
SET COMPATIBLE Command
SET CONFIRM Command
SET DEVELOPMENT Command
SET ECHO Command
SET ESCAPE Command
SET KEYCOMP Command
SET LOGERRORS Command
SET PALETTE Command
SET SAFETY Command
Trace Window


Data Tab, Options Dialog Box

See Also

Contains options for controlling data in tables.

When you choose Set As Default—which appears on every tab in the dialog box—Visual FoxPro saves all the options on all tabs.

Tab Options

Open exclusive   Specifies whether Visual FoxPro opens tables and databases exclusively, so that no one else can view or modify them while you are working on them. Opening files exclusively can result in better performance. Use this option when processing large numbers of records under circumstances when other users do not need access to data (such as at night). This option corresponds to the SET EXCLUSIVE command.

Show field names   Specifies whether Visual FoxPro displays a field name as a column heading above each field in the output of the AVERAGE, CALCULATE, DISPLAY, LIST, and SUM commands. This option corresponds to the SET HEADINGS command.

Prompt for code page   Specifies whether Visual FoxPro prompts you to attach a code page when you open tables that do not already have one attached. This option corresponds to the SET CPDIALOG command.

Ignore deleted records   Specifies whether Visual FoxPro ignores records marked for deletion when executing commands that use a scope clause. If this option is cleared, Visual FoxPro includes the marked records. This option corresponds to the SET DELETED command.

Rushmore optimization   Specifies whether Visual FoxPro uses Rushmore optimization when executing commands that include a FOR clause. This option corresponds to the SET OPTIMIZE command.

Unique records in indexes   Specifies whether Visual FoxPro allows records with duplicate index key values in an index file. If you choose this option, only the first record containing the original key index is indexed. This option corresponds to the SET UNIQUE command.

Collating sequence   Specifies a collation sequence (sort order) for character fields in indexing and sorting operations. This option corresponds to the SET COLLATE command.

Record counter interval   Specifies how many records should be processed during commands such as COPY TO before Visual FoxPro updates the record counter display in the status line. The range is from 1 to 32,767 records. The higher the number you specify, the longer the delay between updates, but the command can run faster. You must choose the Status Bar option on the View tab for this option to have effect. This option corresponds to the SET ODOMETER command.

Memo block size (bytes)   Specifies the block size in which disk space for memo fields is allocated. The value you enter specifies the minimum disk space required for a memo field, and the size by which memo fields increase as data is added to them. If you specify a value between 1 and 32, Visual FoxPro multiplies your value by 512, and then allocates disk space in a block of that size. If you specify a value greater than 32, Visual FoxPro allocates blocks of only that size; specifying a number greater than 32 can therefore save disk space. This option corresponds to the SET BLOCKSIZE command.

Browse refresh interval (sec)   Specifies how often Visual FoxPro updates the display of records in an active Browse window, which is useful in a multiuser environment. Possible values are 0 to 3600. Set this value to 0 to prevent updates. Set this value to a high number to update the Browse window less often, which can increase performance. This option corresponds to the SET REFRESH command.

Table refresh interval (sec)   Specifies how often Visual FoxPro should update the display of an active table, which is useful in a multi-user environment. Possible values are 0 to 3600. Set this value to 0 to prevent updates; set this value to a high number to update the table less often, which can increase performance. This option corresponds to the SET REFRESH command.

String comparisons

SET NEAR on   Specifies that Visual FoxPro positions the record pointer on the closest matching record after an unsuccessful FIND or SEEK command. This option corresponds to the SET NEAR command.

SET EXACT on   Specifies that Visual FoxPro uses the full length of both string expressions (except for trailing blanks) when using the comparison operator (=). If you clear this option, Visual FoxPro stops comparing two strings when the end of the expression on the right side of the comparison operator (=) is reached. This option corresponds to the SET EXACT command.

Note   This setting has no effect on the results of the = operator.

SET ANSI on   Specifies whether Visual FoxPro pads strings when comparing them with the SQL = operator, which compares character by character until the shorter string is finished. If you choose this option, Visual FoxPro pads the shorter string with spaces, so a SQL comparison fails (“Tommy” is not equivalent to “Tom  ”). If you clear this option, the shorter string is not padded, so strings of unequal length can be equivalent (“Tommy” is equivalent to “Tom”). This option corresponds to the SET ANSI command.

Locking and buffering

Automatic file locking   Specifies that Visual FoxPro automatically locks files for certain commands that do not change data including AVERAGE, COPY TO, INDEX, REPORT, SORT, and TOTAL. If you clear this option, the file is not locked during these commands, and other users can change records while your command is being executed. This option corresponds to the SET LOCK command.

Multiple record locks   Specifies whether Visual FoxPro locks multiple records concurrently. If you clear this option, Visual FoxPro clears all current locks and allows you to lock only one record at a time; the current record is unlocked when you lock the next one. This option corresponds to the SET MULTILOCKS command.

Buffering   Specifies for multi-user environments whether to buffer record changes locally, and if so, whether to do so optimistically or pessimistically. Buffering can improve performance and provide greater concurrency control. You must choose the Multiple Record Locks option for this option to have effect. It corresponds to the CURSORSETPROP( ) function. Options are:

•	Off   Changes are not buffered, and record updates are made immediately to disk. This mode is recommended only when working in a single-user environment.

•	Record (Pessimistic)   The current record is locked when the user makes a change to it, and changes are buffered. Other users can read but not change the record on disk. When the record pointer moves to another record, the current record is written back automatically from the buffer to the source table, and then unlocked. Pessimistic record locking is useful for interactive editing in a table subject to many updates by other users.

•	Record (Optimistic)   Changes for a single record are buffered but not locked when the user moves the record pointer to the record. Other users can read and change the record on disk. When the user moves the record pointer to another record, Visual FoxPro checks changes in the current record against the record on disk. If the record on disk has been changed, Visual FoxPro offers options to discard current changes or overwrite the record on disk. Optimistic record buffering is recommended primarily when updating tables in which there is little activity.

•	Table (Pessimistic)   Record changes are buffered and locked when the user moves the record pointer to them, and remain so until TABLEUPDATE( ) is called. Pessimistic table buffering is the safest mode for updating multiple records in a table, but because it locks every changed record, it can limit other users’ access to the data. It is therefore recommended only to help speed data entry when users will be entering new records in batches, or when it is essential for the application that all currently-used records be held exclusively by the application.

Note   When using table buffering, you must issue TABLEUPDATE( ) to write buffered record changes to the disk. If you don’t, the changed records are discarded when the user quits Visual FoxPro.

•	Table (Optimistic)   Record changes are buffered, but not locked, when the user moves the record pointer to the record. Other users can read and change the records on disk. When TABLEUPDATE( ) is issued, Visual FoxPro checks for changes in each record as the record is written to disk; records that have changed are not written. Optimistic table buffering is useful for optimizing update performance in tables in which there is little activity. When using this option, issue TABLEUPDATE( ) often so that the chances of buffered records changing on disk is minimized.

Note   When using table buffering, you must issue TABLEUPDATE( ) to write buffered record changes to the disk. If you don’t, the changed records are discarded when the user quits Visual FoxPro.

Reprocessing   Specifies how many times or for how long Visual FoxPro attempts to lock a record or table that is already locked by another user. This option corresponds to the SET REPROCESS command. Choices are:

•	Attempt Lock (Default). Attempts to lock one time only.

•	Attempt Lock (Automatic). Continues to attempt the lock until successful or until the user cancels the attempt by pressing ESC. Equivalent to SET REPROCESS TO AUTO.

•	Wait for Lock. Continues to attempt a lock until the record becomes available. This option does not provide a way for the user to stop trying to lock the record. Equivalent to SET REPROCESS TO -1.

•	Retry Attempts. Attempts to lock the record or table the specified number of times. If the lock is still unsuccessful, an error message is displayed. SET REPROCESS TO n, where n is the number of retry attempts.

•	Retry Seconds. Attempts to lock the record or table for the specified number of seconds. If the lock is still unsuccessful, an error message is displayed.  SET REPROCESS TO n SECONDS, where n is the number of seconds to retry.


See Also

AVERAGE Command
CALCULATE Command
DISPLAY Command
LIST Command
SET ANSI Command
SET BLOCKSIZE Command
SET COLLATE Command
SET CPDIALOG Command
SET DELETED Command
SET EXACT Command
SET HEADINGS Command
SET NEAR Command
SET ODOMETER Command
SET OPTIMIZE Command
SET REFRESH Command
SET REPROCESS Command
SET UNIQUE Command
SUM Command


Remote Data Tab, Options Dialog Box

See Also

Contains options for remote (ODBC) view and connection defaults.

When you choose Set As Default—which appears on every tab in the dialog box—Visual FoxPro saves all the options on all tabs.

Tab Options

Remote View Defaults

Settings in the Remote view defaults box represent Visual FoxPro cursor settings for the current session. If you choose Set As Default, the settings become the defaults for subsequent sessions. The options in this box correspond to settings you make or get using the CURSORSETPROP( ) and CURSORGETPROP( ) functions.

Share connection   Specifies that Visual FoxPro uses the current connection for new views, which is useful if a data source supports only one connection at a time.

Fetch memo   Specifies that Visual FoxPro does not fetch memo and general fields from the data source until a memo or general field is activated in the view output. Clear this option to reduce the amount of data downloaded initially from the remote table—this results in faster performance.

SQL updates: Criteria   Specifies what fields Visual FoxPro checks on a remote server to determine whether a record has changed before you attempt to update it. The update fails if the data in the fields you specify has changed.

SQL updates: Method   Specifies whether Visual FoxPro uses SQL UPDATE or SQL DELETE and then INSERT to update information on the remote server.

Records to fetch at a time   Specifies how many records Visual FoxPro should return at a time from the remote data source. Choose All to specify that all records should be returned in the first fetch operation. This setting is limited by the value specified in Maximum records to fetch.

Maximum records to fetch   Specifies the total number of records returned by a view, which can help prevent you from downloading an excessive amount of data if you have constructed a query incorrectly. Choose All to specify that all records should be returned.

Use memo for fields >=   Specifies the maximum length of data in long Character fields. If character data exceeds the specified length, Visual FoxPro converts it to a memo field in the output of your view. The default is 255, the maximum size of a character field in Visual FoxPro.

Records to batch update   Specifies the number of update statements sent at once for views. The default is 1. Adjusting this value can greatly increase update performance. For more information, see the REPLACE command and Scope Clauses.

Connection Defaults

Settings in the Connection defaults box represent Visual FoxPro global default settings for connections. The options in this box correspond to settings you make or get using the SQLSETPROP( ) and SQLGETPROP( ) functions.

Asynchronous execution   Specifies that Visual FoxPro executes SQL pass-through commands (using SQLEXEC( ), SQLMORERESULTS( ), SQLTABLES( ), and SQLCOLUMNS( )) in the background after returning control to your application. If you choose this option, your application can display progress information and can allow users to interrupt a command with the ESC key if SET ESCAPE has been set to true. You can determine the status of a SQL command executing asynchronously by calling one of the pass-through functions repeatedly until it reports that the command is done. The default is that this option is disabled (synchronous execution), which specifies that Visual FoxPro waits until the pass-through SQL command is complete before returning control to your application.

Display warnings   Enables the display of warning messages.

Batch processing   Specifies that when you send multiple SQL pass-through statements using SQLEXEC( ), Visual FoxPro does not return any results until all individual result sets have been retrieved. Corresponds to setting BatchMode in the SQLSETPROP( ) function. If this option is disabled, you must call SQLMORERESULTS( ) to determine whether data is available.

Automatic transactions   Specifies that transactions are handled automatically by the connection on remote tables. If you clear this option, you must handle transaction processing manually using SQLCOMMIT( ) and SQLROLLBACK( ),

Show login   Specifies whether to display login prompts when a connection is activated (if the connection requires users to be logged in). For example, Only When Necessary specifies that login prompts appear only for login information not specified in the connection or view definition.

Connection timeout (sec)   Specifies the number of seconds (between 0 and 600) to wait for a connection to be established with the remote server. If the connection cannot be established within the specified time, Visual FoxPro generates an error. Specify 0 to wait indefinitely for a connection.

Idle timeout (min)   Specifies the number of minutes of idle time allowed before the connection is deactivated. If a request to the server is not made within the specified time, Visual FoxPro terminates the connection. However, Visual FoxPro attempts to reconnect automatically if a request to the server is made after the connection has timed out.

Query timeout (sec)   Specifies the number of seconds (between 0 and 600 to wait for the server to respond to a request. If the server takes longer than the specified number of seconds to process the query, Visual FoxPro generates an error.  Specify 0 to wait indefinitely for query results.

Wait time (ms)   Specifies the number of milliseconds that elapse before Visual FoxPro checks if the SQL statement has completed executing.


See Also

Memo Field Type
REPLACE command
Scope Clauses
SQLEXEC( ) Function
SQLGETPROP( ) Function
SQLSETPROP( ) Function


File Locations Tab, Options Dialog Box

See Also

Contains directory locations and names of files used by Visual FoxPro. You can type the path and file name directly into each box or click the dialog button to display a dialog box for setting the option.

When you choose Set As Default—which appears on every tab in the dialog box—Visual FoxPro saves the option settings in the registry (system Windows registration database).

Tab Options

Default Directory   Specifies the default Visual FoxPro directory. If you check this box and choose Set As Default, the displayed directory is registered as the default for the current session and all future sessions. If you clear this option and choose Set As Default, the displayed directory is deleted from the registry. If you check this box and choose OK, this changes the default directory for the current session only. Finally, if you clear this option, you will not be able to change the current session’s default directory. This option corresponds to the SET DEFAULT command.

Search path   Specifies the directories that Visual FoxPro searches in for files if it doesn’t find the files in the default directory. The directories must be separated by commas or semicolons. You can use the dialog button to automatically insert semicolons when specifying multiple directories. This option corresponds to the SET PATH command.

Temporary files   Specifies the directory in which Visual FoxPro saves temporary files—for example, when sorting or indexing. Because temporary files can grow quite large, specify a directory with plenty of free space. For best performance, specify a fast drive; for example, in a multi-user environment, you might specify a local drive.

Help file   Specifies whether Visual FoxPro displays Help, and if so, what file to use. If the file name’s extension is .HLP, then graphical Help is used. If the file name’s extension is .DBF, then .DBF-style Help is used. If no extension is specified, the default is graphical Help. This option corresponds to the SET HELP command.

Resource file   Specifies whether Visual FoxPro stores its current state (macros, size and location of windows, and so on) into a resource file, and if so, what file to use. If this option is not selected, Visual FoxPro resets the system state to its default each time you start the program. In addition, some options in the Options dialog box will be disabled.

This option corresponds to the SET RESOURCE command.

Converter   Specifies the file name of the application that is called when you open a form, report, or other application component created in an earlier version of FoxPro or Visual FoxPro. The specified application converts the component to the current file format. This option corresponds to the CONVERTER system variable.

Menu builder   Specifies the file name of the menu builder program. This option corresponds to the GENMENU system variable.

Spelling checker   Specifies the file name of the spell checker application. This option corresponds to the SPELLCHK system variable.

Builders   Specifies the file name of the application that is called in the Form Designer when you choose Builder from the right-click menu. A builder consists of one or more dialog boxes that help you set properties for a specific control, or combine clauses to create a specific expression. This option corresponds to the BUILDER system variable. Builders can be displayed automatically if you choose the Builder lock option in the Forms tab.

Wizards   Specifies the file name of the application that is called when you run a wizard. This option corresponds to the _WIZARD system variable.


See Also

ADDLABEL.APP
BUILDER System Variable
CONVERTER System Variable
GENMENU System Variable
Options Dialog Box
SET DEFAULT Command
SET HELP Command
SET PATH Command
SET RESOURCE Command
SPELLCHK System Variable
WIZARD System Variable


Forms Tab, Options Dialog Box

See Also

Contains options for the Form Designer.

When you choose Set As Default—which appears on every tab in the dialog box—Visual FoxPro saves the option settings in the registry (system Windows registration database).

Note   If an instance of the Form Designer is already open when you change settings in the Form tab of the Options dialog box, the changes are not reflected until you close that instance of the Form Designer and then reopen it.

Tab Options

Grid

Grid lines   Specifies that the Form Designer displays grid lines to help you align controls.

Snap to grid   Specifies that when you draw new controls, their edges align with the nearest grid lines.

Horizontal spacing (pixels)   Specifies the width of the space between horizontal grid lines. The width is based on the Scale units option on this tab.

Vertical spacing (pixels)   Specifies the height of the space between vertical grid lines. The height is based on the Scale Units option on this tab.

Show position   Specifies whether object position and dimensions are displayed on the status bar.

Tab ordering   Specifies how to set tab order in a form. Choose Interactive to use order controls by clicking on them. Choose By List to use the Tab Order dialog box.

Scale units   Sets the default scale mode for the Form Designer and Class Designer. Specifies pixels or foxels.

Maximum design area   Specifies a maximum size of the form for design time. Visual FoxPro will not let you size a form that is bigger than the specified resolution. It is a good idea to specify the smallest resolution your users will want so that your forms will be viewable by all users. If none is selected, Visual FoxPro will not enforce any size restriction.

Template classes

Specifies a class library and class to base your new forms and form sets on. The default is that Visual FoxPro uses its base class.

Form Set   Displays the Form Set Template dialog box, where you select a form set template.

Form   Displays the Form Template dialog box, where you select a form template.

Builder lock   Specifies that builders are displayed automatically in the Form Designer when you create a control that has a builder registered to it.

Prompt to save changes before running form   Specifies that when you run a form from the Form Designer, you are prompted to save changes to the form made since the last time you saved it. If you clear this option, the Form Designer saves changes automatically before running the form.


See Also

Form Designer
Format Menu
Options Dialog Box
Tab Order Dialog Box
View Menu


Form Set Template Dialog Box

See Also

Specifies a form set template to use for form sets.

Dialog Box Options

Class   Specifies the file name of the form set template.

Class name   Lists classes in the currently selected class library.


See Also

Forms Tab, Options Dialog Box


Form Template Dialog Box

See Also

Specifies a form template to use for forms.

Dialog Box Options

Class   Specifies the file name of the form template.

Class name   Lists classes in the currently selected class library.


See Also

Forms Tab, Options Dialog Box


Projects Tab, Options Dialog Box

See Also

Contains options for the Project Manager.

When you choose Set As Default—which appears on every tab in the dialog box—Visual FoxPro saves the option settings in the registry (system Windows registration database).

Tab Options

Project double-click action

Specifies whether Visual FoxPro runs or modifies a file when you double-click it in the Project Manager.

Run Selected File   Visual FoxPro runs the selected file when you double-click it.

Modify Selected File   Visual FoxPro opens the appropriate designer or editor when you double-click a file.

Prompt for Wizards   Specifies that Visual FoxPro prompts you to use a wizard, if applicable, when you choose New File from the Project menu or choose New in the Project Manager.

Display user-defined container icons   Specifies that Visual FoxPro displays user-defined container icons in the Project Manager.

Source control options

Options in this box allow you to specify what source control application to use, and how the source control application works when you add, modify, or remove components of your project.

Active source control provider   Specifies the name of the source control application to use. The name you specify here will apply to new projects. When you create a project, the name of the source control application in effect at the time is stored with the project so that Visual FoxPro knows what source control application to use each time the project is opened. To disable source control, choose None.

Automatically add new projects to source control   Specifies that you are prompted to put a project under source control when you create it. If you clear this option, new projects are not automatically put under source control and you must add them manually.

Check out files upon modify   Specifies that files are automatically checked out to a user who modifies them from the Project Manager. If a file is already checked out, Visual FoxPro displays an error. If you clear this option, users who attempt to modify files which are not checked out from the Project Manager can view the files but cannot change them.

Note   If users modify project files using commands in the Command window (such as MODIFY), they must check the files out first.

Add files to source control upon add   Specifies that files added to the project are automatically put under source control for that project. If you clear this option, files that you add become part of the project (the .PJX file), but are not put under source control. However, you can manually place project files under source control at any time.

Note   Database (.DBC), table (.DBF), API library, and application (.APP) files are not put under source control automatically when added to a project. However, you can put these files under source control manually.

Remove files from source control upon removal from project   Specifies that when you remove a file from a project, it is removed from source control as well. If you clear this option, when you remove a file from the project, the source control information for the file remains in the source control database. Doing so maintains archive information about this file, and if the file is not deleted from disk, allows you to access it using the source control system outside of Visual FoxPro.

Display dialog box for shortcut menu commands   Specifies that when you choose a source control command from the project shortcut menu, Visual FoxPro allows you to select more than one file on which to carry out the selected command. If you clear this option, the command applies only to the file selected in the project, but this can be overridden by pressing SHIFT+Right Mouse Click and choosing the command.

Text generation   Specifies the name of the application used to create a text representation of binary files (form, label, menu, report, or class library) each time the file is checked in. The resulting text file is checked in along with the table source file, and can be used to create a report of the differences between multiple versions of a file.


See Also

Controls Tab, Options Dialog Box
New File Dialog Box
Options Dialog Box
Project Manager


Controls Tab, Options Dialog Box

See Also

Contains options to register visual class libraries for specifying template classes on the Forms tab of the Options dialog box. These options also specify what can be selected from the View Classes button on the Form Controls toolbar to make adding custom controls to forms easy.

When you choose Set As Default—which appears on every tab in the dialog box—Visual FoxPro saves the option settings in the registry (system Windows registration database).

Tab Options

Visual class libraries   Specifies that class libraries (.VCX files) are displayed in the Selected list.

ActiveX controls   Specifies that ActiveX controls are displayed in the Selected list.

Selected   Lists files that you can add or remove to your Visual FoxPro environment. If you have chosen Visual class libraries, the list displays the .VCX files that you have already added, and specifies which libraries appear on the shortcut menu when you click the View Classes button on the Form Controls toolbar.

If you have chosen ActiveX controls, the list displays the classes of objects and controls available on your system. ActiveX objects and controls that you have already added are checked, and appear on the shortcut menu when you click the View Classes button on the Form Controls toolbar.

Label   Appears when the Visual class libraries option is selected. Specifies the name for the class library. By default, Visual FoxPro uses the file name without the .VCX extension.

Library   Appears when the Visual class libraries option is selected. Displays the path and file name for of the .VCX files for the currently-selected class library.

Show   Appears when the ActiveX is selected. Allows you to specify what types of ActiveX objects appear in the Selected list.

•	Insertable Objects   Specifies that the Selected list displays classes of objects that you can insert as ActiveX objects into Visual FoxPro applications.

•	Controls   Specifies that the Selected list displays ActiveX controls.

Add   Choose this button to display the Open dialog box so you can add libraries (.VCX files) or ActiveX controls to the Selected list. Adding an ActiveX control also registers it so it will be available in the list of controls in the Insert Object dialog box and in other applications.

Remove   Appears when the Visual class libraries option is selected. Choose this button to remove the selected library from the Selected box.


See Also

Form Controls Toolbar
Forms Tab, Options Dialog Box
Insert Object Dialog Box
Open Dialog Box


Regional Tab, Options Dialog Box

See Also

Contains options for date, time, and numeric formatting. You can temporarily or persistently override system settings in Visual FoxPro. The option settings on this tab are reflected in time, date, and currency output.

When you choose Set As Default—which appears on every tab in the dialog box—Visual FoxPro saves the option settings in the registry (system Windows registration database).

Tab Options

Use System Settings   Specifies that all settings on this tab are read from the system (as established in the Control Panel). In this mode, most options are read-only.

If you clear this option, you can specify settings that override system settings.

Date and time

Specifies how date and time data is displayed by default. An example of the current settings appears in the top-right box of the option group.

Date format   Specifies the order of the day, month, and year in a date. Choose Short to remove leading zeros from the date. Choose Long to display the date written out. Corresponds to the SET DATE command.

Date Separator   Specifies the character that appears between portions of a date. Clear this option to use the default separator. Corresponds to the SET MARK TO command.

Century   Specifies that the year is displayed with century information (for example, 1997). Clear this option to display the year as 2 digits (for example, 97). Corresponds to the SET CENTURY command.

12-Hour   Specifies that hours are displayed in 12-hour format with “AM” or “PM.”

24-Hour   Specifies that hours are displayed in 24-hour format.

Seconds   Specifies that seconds are included in the time display.

Currency and numbers

Specifies how currency data is displayed by default. An example of the current settings appears in the top-right box of the option group.

Currency Format   Specifies the location of the currency symbol. Corresponds to the SET CURRENCY command.

Currency Symbol   Specifies the character or characters used for currency. Corresponds to the SET CURRENCY command.

1000 Separator   Specifies the character inserted at every third digit left of the decimal separator. Corresponds to the SET SEPARATOR command.

Decimal Separator   Specifies a character used to indicate the decimal. Corresponds to the SET POINT command.

Decimal Digits   Specifies the number of digits to follow the decimal separator. Corresponds to the SET DECIMALS command.

Week Starts on   Specifies which day the week starts on. Corresponds to the SET FDOW command.

First Week of Year   Specifies where a yearly calendar begins. Corresponds to the SET FWEEK command.


See Also

Options Dialog Box
SET DATE Command
SET MARK TO Command
SET CENTURY Command
SET CURRENCY Command
SET SEPARATOR Command
SET POINT Command
SET DECIMALS Command
SET FDOW Command
SET FWEEK Command


Debug Tab, Options Dialog Box

See Also

Enables you to set options to customize the Visual FoxPro debugger windows, including:

•	Font and colors

•	Whether to trace Timer event code

•	Whether line numbers are displayed

•	Whether to log Debug Output window output to a file.

When you choose Set As Default—which appears on every tab in the dialog box—Visual FoxPro saves the option settings in the registry (system Windows registration database).

Tab Options

Environment   Specifies the debugging environment:

•	Debug frame   All debugger windows appear in one big frame that is external to the Visual FoxPro main window, with their own menus and toolbars.This makes the debugger less intrusive on your application’s run-time environment. If you choose this option, you can open the debugger by choosing Debugger on the Tools menu.

•	FoxPro frame   Debugger windows appear in the Visual FoxPro main window. The FoxPro environment is most useful if you want just a single window open, for example the Watch window. If you choose this option, Visual FoxPro replaces the Debugger command on the Tools menu with commands to open individual debug windows, and toolbars for individual debug windows are tiled to the main Visual FoxPro window.

Note   You cannot change this option if the debugger is open.

Display timer events   Choose this option if you want Timer Control timer events displayed in the Trace window when their interval value is reached. If you clear this option, the timer event still occurs, but is not displayed; it is treated as if you had specified Step Over for that event.

Specify Window

Choose an option to specify which debugger window you want to set options for. The window you choose here affects the following available options.

Call Stack   Displays the following options for the window:

•	Show call stack order   Displays a number beside each program listed in the Call Stack window, with the highest number indicating the currently executing program.

•	Show current line indicator   Indicates whether the current line indicator [image] is displayed in the Call Stack window.

•	Show Call Stack indicator   Indicates whether an arrow [image] is displayed in the Call Stack window to indicate the procedure displayed in the Trace window. If the current line and call stack procedures are the same, Visual FoxPro displays only the current line indicator.

Locals   No additional options are available for this window.

Output   Displays the Log debug output area, which contains these options:

•	Log Debug Output   Copies the values written in the Debug Output window to a text file. If you choose to log output values, you need to specify a file to log them to. The default file extension for a log file is .LOG. Visual FoxPro will log output to a file only if the Output window is displayed. You can display information in the Output window (and send it to the log file) using the DEBUGOUT or SET PRINTER TO DEBUG commands in a program.

When you quit Visual FoxPro, this option is cleared, so that you do not inadvertently overwrite a log file the next time you start Visual FoxPro.

•	Append   Specifies that the debug output is written after the current contents of an existing file, preserving the original contents.

•	Overwrite   Specifies that the debug output replaces the contents of the specified file.

Trace   Displays the following options for the window:

•	Show line numbers   Displays line numbers to the left of the lines of code in the Trace window.

•	Trace between breakpoints   Executes code between breakpoints at the throttle speed. The throttle speed indicates the pause in seconds between the execution of each line of code. If you clear this option, code between breakpoints is executed at normal speed.

•	Pause between line execution   Specifies the delay in seconds between the execution of each line of code. This option allows you to slow program execution so you can watch the lines of code without having to step through each line individually.

Watch   No additional options are available for this window.

Options available for all debugger windows

Font   Choose a font and style for the specified debugger window. For example, to set the font of the debugger’s Trace window, choose Trace under Specify Window, and then choose Font to select the font, size, and style.

Colors

Area   Select the text element for which you want to specify a color. For example, to specify a color for the text used for changed values, select Changed Value. The choices in the Area list depend on what window has been specified under Specify Window.

Foreground   Choose a color for the text of the selected area. To use the default color established in the Windows control panel, select Automatic.

Background   Choose a background color for the selected area. For example, to show comments in yellow text on a blue background, select yellow in Foreground and blue in Background. To use the default color established in the Windows control panel, select Automatic.


See Also

Call Stack Window
Debug Output Window
Debugger Window
Trace Window
Watch Window


Syntax Coloring Tab, Options Dialog Box

See Also

Contains options to specify color and font to identify Visual FoxPro program elements, such as keywords and comments, in the command window and in all editing windows—except those opened with the MODIFY FILE or MODIFY MEMO commands.

When you choose Set As Default—which appears on every tab in the dialog box—Visual FoxPro saves the option settings in the registry (system Windows registration database).

Tab Options

Syntax color settings

Area   Choose the type of program element to set font and color options for. When you make your selection, the other controls are updated with values for the selected area.

Font style   Choose a font style for the specified area. For example, to display all comments in your programs italic, select Comments in the Area box, then select Italic in the Font style box.

Foreground   Choose a color for the text of the selected area. To use the default color established in the Control Panel, select Automatic.

Background   Choose a background color for the selected area. For example, to show comments in yellow text on a blue background, choose Comments in the Area box, select yellow in Foreground, and then select blue in Background. To use the default color established in the Control Panel, select Automatic.

Sample

This area displays the effect of your settings.

Reset All   Choose this option to set syntax coloring to the Visual FoxPro default settings.


See Also

Edit Properties Dialog Box
MODIFY FILE
MODIFY MEMO


Field Mapping Tab, Options Dialog Box

See Also

Enables you to specify what type of control Visual FoxPro creates when you drag a table or field to a form from the Data Environment Designer, Database Designer, or Project Manager. For example, you can specify that Visual FoxPro creates an edit box when you drag a Character field onto a form.

When you choose Set As Default—which appears on every tab in the dialog box—Visual FoxPro saves the option settings in the registry (system Windows registration database).

Tab Options

Map fields to classes for drag-and-drop operations   Displays the current mappings between field types and classes (controls). The list includes:

•	Type   All supported data types for database fields. The field type Multiple is used to specify the class that will be created if you drag an entire table or multiple fields onto a control at once. The field type Label is used to specify the class that will be created for the field captions.

•	Class Library   The library containing the class definition to map to a field type. If this column is blank, the field type is mapped to a Visual FoxPro base class.

•	Class Name   The class to which a field type is mapped, which specifies the type of control will be created.

Modify   Choose this button to display the Modify Field Mapping dialog box, where you can specify a different mapping for the selected field type.

To modify field mappings

1	In the Field Mapping tab of the Options dialog box, choose Modify.

2	In the Modify Field Mapping dialog box, select a field type from the Type list.

1.	To set the class that is created whenever you drag a table or multiple fields, select Multiple.

2	To select the class library (.VCX file) that contains the control you want to associate with the selected field type, choose Browse.

3	Select a class name from the Name list. The class you specify here will be created any time a field of the selected type is dragged onto a form.

4	Choose OK or Apply to accept the mapping.

Database options

Drag and drop field caption   Choose this option if you want Visual FoxPro to use the name of the field as the caption of the class being created. If you clear this option, Visual FoxPro will not create field captions.

Copy field comment   Choose this option to have Visual FoxPro copy the comment from a field (if any) to the Comment property of the new class when creating it.

Copy field input mask   Choose this option to have Visual FoxPro copy the input mask of a field (if any) to the InputMask property of the new class when creating it.

Copy field format   Choose this option to have Visual FoxPro copy the format specification from a field (if any) to the Format property of the new class when creating it.


See Also

Modify Field Mapping Dialog Box


Modify Field Mapping Dialog Box

See Also

Use this dialog box to change the mapping between a database field type and the type of class (control) that Visual FoxPro creates when you drag a table or field onto a form from the Data Environment Designer, Database Designer, or Project Manager.

This dialog box appears when you choose Modify in the Field Mapping tab of the Options dialog box.

Dialog Box Options

Type   Select the database field type for which you want to change the mapping. By default, the field type is selected that was selected in the Field Type Mapping tab.

Class information

Library   Enter a class library that contains the class that you want to have Visual FoxPro create when a field of the specified type is dragged onto a form. If this box is blank, the field type is mapped to a Visual FoxPro base class.

Browse   Choose this to display the Open dialog box, from which you can select a class library.

Name   Select the name of a class to map to the specified field type. The list contains only the classes in the library you chose; to display the Visual FoxPro base classes in this box, clear the Library box. The base class and description of the selected class, if available, is displayed below the class name.

Apply   Choose this to create the mapping. Choose Apply if you want to change a mapping but keep the Field Type Mapping dialog box open to change another mapping. To change a single mapping, choose OK.


See Also

Field Mapping Tab, Options Dialog Box


View Menu

See Also

The View menu displays Report, Label, and Form designers and toolbars, and lets you customize the way you work in a table.

Menu Commands

Toolbars   Displays the Toolbars dialog box where you can create, edit, hide, and customize toolbars.

Properties   Displays the Properties window so you can set or change the properties of forms and controls. This command is available when you open the Form Designer or Class Designer.

Browse <table>   Displays the contents of the current table or view in a Browse window, and allows you to examine and make changes to data in the table or view. This command is available when you open a table or view in Browse, Edit, or Append Mode view.

Edit   Displays the contents of the selected table or view with the fields in each record listed one below the other, and allows you to examine and make changes to the data in the table or view. This command is available when a table is open in Browse, Edit, or Append Mode view.

Append Mode   Automatically adds new records to the end of the current table or view when an entry is made in the last record. You can append records in either the edit or browse view of the table or view. This command is available when a table or view is open in a Browse, Edit, or Append Mode view.

Database Designer   Displays the Database Designer, where you can view and modify all the tables, views, and relationships contained in the current database. This command is available when you open a table in a Browse, Edit, or Append Mode view that is associated with a database.

Table Designer   Displays the Table Designer, where you create and modify the structure of database tables, free tables, table fields, and indexes. This command is available when a table is open in a Browse, Edit, or Append Mode view.

Grid Lines   Removes or adds lines to aid you in reading data or positioning objects. If you are viewing a table in Browse or Append Mode, the Grid Lines command adds horizontal and vertical lines between records and fields; in an Edit view, horizontal lines are added between records. If you are designing a form, report, or label, the Grid Lines command places a grid in the design area.

Design   Puts a new or existing label, report, or form in design mode. This command is available, and checked, when you create a new label or report, or when you open an existing one. To turn this command off, choose the Preview command.

Tab Order   Sets the tab order for objects on a form. Available when you run the Form or Class Designer. You can choose the method for setting the tab order by selecting either Interactive or By List in the Forms tab of the Options dialog box.

Code   Displays the Code window, so you can write, display, and edit event code. This command is available when you open the Form Designer.

Form Controls Toolbar   Displays the Form Controls toolbar, which you use to create controls on a form. This command is available when you open the Form Designer or Class Designer.

Layout Toolbar   Displays the Layout Toolbar, which you use to align, size, and position controls. A check mark by the command indicates the toolbar is currently displayed. This command is available when you open the Form Designer, Class Designer, Report Designer, or Label Designer.

Color Palette Toolbar   Displays the Color Palette toolbar, which you use to specify foreground and background colors for a control. A check mark by the command indicates that the toolbar is currently displayed. This command is available when you open the Form Designer, Report Designer, Class Designer, or Label Designer.

Show Position   Shows in the status bar the position, height, and width of the selected object in a form, report, or label. If more than one object is selected, Show Position displays the last-selected object’s position. For a selected object in a report or label, its position and dimensions are displayed in the left half of the status bar. The position of the object’s top, left, bottom, and right edges are shown, followed by its height and width, in the current ruler increments. If no object is selected, the mouse pointer position is shown. For a selected object in a form, its position and dimensions are displayed in the right half of the status bar. The first two numbers show the horizontal position of the object’s top left corner, followed by its vertical position. The second two numbers show the object’s width and height. Position and dimensions are reckoned in pixels from the top left corner of the designer window, and from left to right. This command is available when you work in the Form Designer, Report Designer, or Label Designer.

Preview   Shows a report or label in a print preview. To close the print preview, you can click the Close Preview button on the Print Preview toolbar or choose the Design command on the View menu. This command is available when you work in the Report Designer or Label Designer.

Report Controls Toolbar   Displays the Report Controls toolbar, which you use to create controls on a report. A check mark by the command indicates that the toolbar is currently displayed. This command is available when you work in the Report Designer.

General Options   Displays the General Options dialog box, where you can specify code for an entire menu system. Available when you open the Menu Designer.

Menu Options   Displays the Menu Options dialog box, where you can specify code for a specific menu. Available when you open the Menu Designer.

Maximize Top Pane   Enlarges the top pane of the Query and View Designers so you can see all the tables in the query or view. This command is available when you open the Query Designer or View Designer.

Minimize Top Pane   Reduces the top pane of the Query and View Designers so you can see the tabs in the bottom half of the window. This command is available when you open the Query Designer or View Designer.

Data Environment   Displays the Data Environment Designer, which you use to create and modify the data environment for forms, form sets, and reports. This command is available when you open the Form Designer, Report Designer, or Label Designer.


See Also

Append Mode
Browse Window
Color Palette Toolbar
Database Designer
Layout Toolbar
Properties Window
Report Controls Toolbar
Table Designer


Toolbars Dialog Box

See Also

Allows you to create, edit, hide, and customize toolbars.

Dialog Box Options

Toolbars   Lists built-in toolbars followed by custom toolbars. Selected toolbars are tiled or displayed in the active output window.

New   Displays the New Toolbar dialog box, where you can enter a name for your new toolbar.

Reset   Returns the selected toolbar to its built-in version. This button changes to Delete if you select a custom toolbar. You cannot reset a custom toolbar.

Delete   Deletes the selected custom toolbar. This button changes to Reset if you select a built-in toolbar. You cannot delete a built-in toolbar.

Customize   Displays the Customize Toolbar dialog box so that you can add and delete toolbar buttons.

Display

Color Buttons   Displays colored buttons on both built-in and customized toolbars. Clear this check box if you are using a black-and-white monitor.

Large Buttons   Displays toolbar buttons that are larger than the standard size. If your monitor has a high resolution, you may want to display larger buttons.

Show ToolTips   Displays the name of the button when you place the pointer over any button on a toolbar.


See Also

Customize Toolbar Dialog Box


Customize Toolbar Dialog Box

See Also

Allows you to add and delete toolbar buttons. The available buttons are displayed by category. Click a button to see its description.

This dialog box appears when you choose Customize in the Toolbars dialog box.

Dialog Box Options

Categories   Lists the button categories.

Button   Displays the buttons included in the category you select in the Categories box. To add the button, drag it to the desired toolbar or drop it onto the Visual FoxPro desktop to create a new toolbar.

Description   Describes the selected button.


See Also

Toolbars Dialog Box


Tab Order Dialog Box

See Also

Adjusts the order in which objects are accessed in the form when you use the keyboard. This dialog box appears when you choose Tab Order from the View menu and you have selected the By List option for Tab Ordering in the Forms tab of the Options dialog box.

Dialog Box Options

Object List   Lists all objects except graphic and text objects in the form or class. Objects are listed in the order in which they are currently accessible via the keyboard. Change the order by clicking the button to the left of the object picture and dragging the object to the position in the list that corresponds to its place in the desired access order.

By Row   Adjusts object order so objects are accessed by row, from left to right, across the form starting at the top.

By Column   Adjusts object order so objects are accessed by column, from top to bottom, down the form starting at the left side.


See Also

Forms Tab, Options Dialog Box
Tab Index Property


General Options Dialog Box

See Also

Allows you to specify code for an entire menu system. You can access this dialog box by selecting General Options from the View menu in the Menu Designer.

Dialog Box Options

Procedure   Creates menu procedure code. If code exceeds the displayed editing region, the scroll bar is activated.

Edit   Opens an editing window so you can create code there instead of in the General Options dialog box. To activate the editing window, click Edit, and then click OK in the General Options dialog box.

Location

Replace   Replaces the existing menu system with a new menu system.

Append   Adds a new menu system to the right of the active menu system.

Before   Inserts a new menu before the specified menu. This option displays a drop-down list containing the names in the active menu system. To insert the new menu, select the menu name you want the new menu to precede.

After   Insert a new menu after the specified menu. This option displays a drop-down list containing the names in the active menu system. To insert the new menu, select the menu name you want the new menu to follow.

Menu Code

Setup   Opens an editing window in which you can add setup code to a menu system. To make the editing window active, click OK in the General Options dialog box.

Cleanup   Opens an editing window in which you can add cleanup code to a menu system. To make the editing window active, click OK in the General Options dialog box.

Top-Level Form   If checked, allows the menu to be used in a top-level (SDI) form. If not checked, allows the menu to only be used on the Visual FoxPro frame.


See Also

Menu Designer
Menu Options Dialog Box


Menu Options Dialog Box

See Also

Allows you to specify code for a specific menu.  You can access this dialog box by selecting Menu Options from the View menu in the Menu Designer.

Dialog Box Options

Name   Contains the name of the menu. By default, this is the same as the text in the Prompt column of the Menu Designer. Change it by typing a new name in the Prompt column.

Procedure   Provides space for menu procedure code, or displays existing code. If code exceeds the displayed editing region, the scroll bar is activated.

Edit   Opens an editing window so you can create code there instead of in the Menu Options dialog box. To activate the editing window, click OK in the Menu Options dialog box.


See Also

General Options Dialog Box
Menu Designer


Window Menu

Arranges, displays, and hides windows.

Menu Commands

Arrange All   Displays all open windows so they don’t overlap. Windows that you have hidden with the Hide command remain hidden.

Hide   Removes the active window from sight. Hidden windows remain open, but are not visible to you. You can view hidden windows by selecting the window name from the 1, 2, 3...9 list.

Hide All   Removes all windows from your view, except the Command window and the main Visual FoxPro window, but keeps them open. This command is available when you hold down SHIFT while choosing the Window menu.

Tip   You can momentarily hide all windows in front of the active output window by holding down SHIFT+CTRL and then holding down the ALT key. Releasing the ALT key displays the windows again.

Show All   Displays all open windows. The names of the open windows appear at the bottom of the Window menu. This command is available when you hold down SHIFT while choosing the Window menu.

Clear   Clears all text from the main Visual FoxPro window.

Cycle   Sequentially brings active open windows to the front.

Command Window   Displays the Command window where you can type Visual FoxPro commands.

Data Session   Displays the Data Session window, where you can easily open tables, establish relations, and set work area properties.

1,2,3,...9   Displays the names of up to nine open windows and allows you to choose from them. You can select the window name or use the access key, a number 1 through 9, to activate the window. If you have more than nine windows open, you can choose the More Windows command to make a selection.

More Windows   Displays the More Windows dialog box, in which you select a window to activate. This command appears on the Window menu when you have more than nine windows open.


More Windows Dialog Box

Displays a list of active windows from which you can choose. This dialog box appears when you choose More Windows from the Windows menu. Choose one of the active window names listed in the Select window to view the active window.


Differences Between Visual FoxPro and Previous Versions

See Also

Visual FoxPro menus and features have been modified in version 5.0. In addition, Visual FoxPro 5.0 differs from Visual FoxPro 3.0 and FoxPro 2.6 in some terminology, language, database, and interface features. If you’re looking for a FoxPro 2.6 or Visual FoxPro 3.0 feature in Visual FoxPro 5.0, check the following locations.

To	See
Review differences in terminology	Terminology Differences
Review differences in the language	Backward-Compatible Commands and Functions
Review differences in tables and databases	Table and Database Differences
Review differences in the interface	Interface Differences
Review differences in functionality	Functional Differences
For more information about new features, see Chapter 2, “Overview of New Features,” in the Installation Guide and Master Index.


See Also

Backward-Compatible Commands and Functions
Functional Differences
Interface Differences
Table and Database Differences
Terminology Differences


Terminology Differences

See Also

Visual FoxPro redefines some FoxPro 2.6 terms. For more information on new terms, see the Glossary.

FoxPro 2.6 term	Visual FoxPro term
@ ... GET field	TextBox control
@ ... SAY field	Label control
Blanks or empty fields or variables	Null values
Browse	Grid control
Buffer	Record and table buffers and transactions.
Code snippets	Properties, and method and event code.
Control	Control
Database	Database
Edit region	EditBox control
Long names	Long names. See Visual FoxPro Naming Rules.
Memory variable	Variable
Object	Object
OLE automation	Automation
OLE control	ActiveX control
OLE General field	OleBoundControl
Popup	ComboBox control
Power tools	Visual designers and toolbars.
PushButton	CommandButton control
Radio button	OptionButton control
Screen	Form
Screen picture	Image control
Screen set	Form set
System memory variable	System variable
Table	Table
Text	Label control


See Also

ComboBox Control
CommandButton Control
EditBox Control
Form Object
Grid Control
Handling Null Values
Image Control
Label Control
OptionButton Control
TextBox Control
Visual FoxPro Naming Rules


Table and Database Differences

See Also

Visual FoxPro distinguishes between tables and databases. Although FoxPro 2.6 tables are fully functional in Visual FoxPro, if you modify the table structure of FoxPro tables, they are saved as Visual FoxPro tables.

FoxPro 2.6 feature or functionality	Visual FoxPro feature or functionality
Character field with NOCPTRANS characteristic	Character (BINARY) field type. See Data and Field Types.
Date fields	Date data type,  DateTime data type
General field size	Now 4 bytes. See General Field Type.
Memo field size	Now 4 bytes. See Memo Field Type.
Memo field with NOCPTRANS characteristic	Memo (BINARY) field type. See Data and Field Types.
Numeric fields	Currency data type,  Double field type, Float field type, Integer field type, or Numeric data type
OLE data in a General field	OLE Bound control
Visual FoxPro tables can accept null values. To prevent errors generated by attempts to store null values to FoxPro 2.6 variables or to Visual FoxPro controls, initialize variables or arrays. To prevent users from attempting to store null values to tables, you can disable the NULL entry key combination by using the following statement:

ON KEY LABEL CTRL+0 *

The structure of Visual FoxPro project (.PJX), screen (.SCX), report (.FRX), and label (.LBX) files differ from the structure of FoxPro 2.6 files. For details on the structure of Visual FoxPro table files created in the Project Manager, Form Designer, Report Designer, and Label Designer, see Table Structures of Table Files. For details on changes made to converted and saved record files, see Checking Converted FoxPro 2.6 Reports and Labels.

Views in Visual FoxPro

Visual FoxPro allows you to use views as you would tables or queries. If you build a view in Visual FoxPro without qualifying the table name to a database, you’ll get an error when you try to modify the view in the View Designer. To ensure that you can use or modify views in all versions of Visual FoxPro, use CREATE SQL VIEW with the following clause:

FROM testdata!products	&& testdata is the database name

&& products is the table name

When you specify the source this way, Visual FoxPro searches for the table both in the open database list, including the current and any non-current databases, and in the default search path for the table.


See Also

Checking Converted FoxPro 2.6 Reports and Labels
CREATE SQL VIEW
Currency Data Type
Data and Field Types
Double Field Type
Float Field Type
Form Designer
General Field Type
Label Designer
Memo Field Type
Numeric Data Type
OLE Bound Control
OLE Container Control
Report Designer
Table Structures of Table Files
View Designer


Interface Differences

See Also

In addition to the changes in the Visual FoxPro interface, such as keystroke, menu, and tool differences, you might want to know about changes to screens, reports, and labels for your own application interfaces.

To	See
Review keystroke differences	Keystroke Differences
Review menu differences	Menu Differences
Review tool differences	Tool Differences
Review screen differences	Screen Differences
Review report and label differences	Report and Label Differences


See Also

Differences Between FoxPro 2.6 and Visual FoxPro
Keystroke Differences
Menu Differences
Report and Label Differences
Screen Differences
Tool Differences


Keystroke Differences

See Also

Visual FoxPro redefines some FoxPro 2.6 navigation key combinations.

FoxPro 2.6 Key Combination	Visual FoxPro  Key Combination	Definition or Difference
—	CTRL+N	Create a new file
CTRL+N	CTRL+Y	Add a record to a Browse window
CTRL+O	CTRL+E	DO program in editing window
SHIFT+F10	—	Opened the Macro Definition dialog box
—	SHIFT+F10	Opens the shortcut menu for the active window
You can insert null values into null-enabled fields with CTRL+0. If you don’t want your users to store null values to variables, disable this key combination with the following command:

ON KEY LABEL CTRL+0 *

You can restore SHIFT+F10 as the default macro recording key sequence with the SET MACKEY command.

In Visual FoxPro, the TAB key navigates between controls so you cannot tab through options in a list box. Use the arrow keys instead.

Note   Other Microsoft products use CTRL+Y for redo, but Visual FoxPro uses CTRTL+R for redo, and for backward compatibility with previous versions of FoxPro, retains CRTL+Y for adding a record to a Browse window.


See Also

Differences Between FoxPro 2.6 and Visual FoxPro


Menu Differences

See Also

Visual FoxPro displays only menus with active options. Some menu items have moved to different locations. For more information on Visual FoxPro menus, see System Menu Names.

FoxPro 2.6 or 3.0 menu command	Visual FoxPro menu command
1 1/2 Space (Text Menu)	1 1/2 Space (Format Menu)
Append (Record Menu)	Append Records (Table Menu)
Append From (Database Menu)	Import (File Menu)
Beautify (Program Menu)	Beautify (Tools Menu) Documenting Wizard
Browse (Record Menu)	Browse (View Menu)
Change Links  (Edit Menu)	Links (Edit Menu)
Copy To (Database Menu)	Export (File Menu)
Debug (Program or Tools Menu)	Debugger (Tools Menu)
Delete (Record Menu)	Delete Records (Table Menu)
Double Space (Text Menu)	Double Space (Format Menu)
Enlarge (Text Menu)	Enlarge Font (Format Menu)
Font (Text Menu)	Font (Format Menu)
FoxDoc (Program Menu)	Documenting Wizard
Generate (Program Menu)	Visual FoxPro generates only menus.
Goto (Record Menu)	Go To Record (Table Menu)
Indent (Text Menu)	Indent (Format Menu)
Locate (Record Menu)	Go To Record (Table Menu)
Macros (Program Menu)	Macros (Tools Menu)
Pack (Database Menu)	Remove Deleted Records (Database Menu)
Printer Setup (File Menu)	Page Setup (File Menu)
Recall (Record Menu)	Recall Records (Table Menu)
Reduce (Text Menu)	Reduce Font (Format Menu)
Reindex (Database Menu)	Rebuild Indexes (Table Menu) Rebuild Table Indexes (Database Menu)
Replace (Record Menu)	Replace Field (Table Menu)
Replace All (Edit Menu)	Replace (Edit Menu)
Replace and Find Again (Edit Menu)	Replace (Edit Menu)
Report (Database Menu) Label (Database Menu)	Print (File Menu)
Single Space (Text Menu)	Single Space (Format Menu)
Spelling (Text Menu)	Spelling (Tools Menu)
Trace (Program or Tools Menu)	Debugger (Tools Menu)
UnIndent (Text Menu)	Unindent (Format Menu)


See Also

ActiveControl Property
ActiveForm Property
Edit Menu
File Menu
Form Controls Toolbar
Form Designer
Format Menu
Go To Record Dialog Box
Grid Control
Label Designer
Layout Toolbar
Load Event
Memo Field Type
Menu Designer
MOUSE Command
Project Manager
Properties Window
Query Designer
REPORT Command
Report Designer
Report Wizard
Table Menu
Tools Menu
Unload Event
View Menu
ZOrder Method


Tool Differences

See Also

Some FoxPro 2.6 tools have new names and functionality in Visual FoxPro.

FoxPro 2.6 tool	Visual FoxPro tool
Catalog Manager	Project Manager
Project Manager	Project Manager
Screen Builder	Form Designer
Align (Object Menu)	Layout Toolbar
Screen Builder Toolbox	Form Controls Toolbar
Control dialogs and screen layout dialogs	Properties Window
Menu Builder	Menu Designer
RQBE	Query Designer
Report Writer	Report Designer
Label Designer	Label Designer
View window options	Data Session (Window Menu)
Transporter	Converter Dialog Box
Browse window	Grid Control


See Also

Differences Between FoxPro 2.6 and Visual FoxPro


Screen Differences

See Also

You can run unconverted FoxPro 2.6 screen (.SPR) files in Visual FoxPro. Visual FoxPro forms use code in events and methods and settings of properties instead of code snippets.

FoxPro 2.6 screen feature	Visual FoxPro property, method or event
#DEFINE, #INSERT preprocessor statements	Global include file called by new .SPR file. See Checking the .SPR File
#Section 1 Setup code	Form set Load event
#Section 2 Setup code	Form Load event
Cleanup code except procedures	Unload event
Code snippets	Method and event code, and properties
Constants	Resolved only in method and event code. See Checking the .SPR File.
Overlapping @ ... GET controls in .PRG files	ZOrder method, and ActiveForm and ActiveControl properties
Macro substitutions	Unresolved in properties. Use variables instead. See Checking Converted FoxPro 2.6 Screens.
READ	WindowType Property


See Also

Checking Converted FoxPro 2.6 Screens
Differences Between FoxPro 2.6 and Visual FoxPro


Report and Label Differences

See Also

You can use unconverted FoxPro 2.6 reports and labels in Visual FoxPro, but Visual FoxPro reports and labels allow you to set and control the data environment and to control report content through report variables.

FoxPro 2.6 report or label feature	Visual FoxPro report or label feature
Memo field size	Now 4 bytes. See Memo field type.
REPORT TO FILE	REPORT TO FILE ASCII creates simple text file.
REPORT ENVIRONMENT LABEL ENVIRONMENT	Data Environment (View Menu)
For more information on Visual FoxPro reports and labels, see the Report Designer.


See Also

Data Environment (View Menu)
Differences Between FoxPro 2.6 and Visual FoxPro


Functional Differences

See Also

Some FoxPro 2.6 functionality is different in Visual FoxPro.

Feature	FoxPro 2.6 Behavior	Visual FoxPro Behavior
CLEAR ALL	Releases everything except system variables.	Releases everything except objects currently in use and system variables.
Consecutive @ ... GET commands that create overlapping controls.	Controls  are overlapped from top (first defined) to bottom (last defined).	Controls are overlapped from bottom to top. To change, see Checking Code After Conversion.
@ ... GET controls	Accept data only to the size of the associated field.	Accept data to the size of the control mask. Use an input mask to restrict input to the field size.


See Also

Checking Code After Conversion
CLEAR Commands
Interface Differences
Language Differences
Table and Database Differences
Terminology Differences


Checking Converted FoxPro 2.6 Projects

See Also

After you convert a FoxPro project to Visual FoxPro, you need to check the project files for improvements you might be able to make. From within the Project Manager, you can:

•	Check converted screen files.

•	Check converted report and label files.

•	Check converted tables.

•	Check code after you convert files.


See Also

Checking Code After Conversion
Checking Converted FoxPro 2.6 Reports and Labels
Checking Converted FoxPro 2.6 Screens
Checking Converted FoxPro 2.6 Tables


Checking Converted FoxPro 2.6 Screens

See Also

After you convert a FoxPro 2.6 screen (.SCX) file, you should check for the following conditions:

•	READ statements with both a MODAL and DEACTIVATE clause. Visual FoxPro processes both these clauses.

•	Conflicting control, object, form, and variable names.

•	Long variable names that have more than ten common characters.

For more information, see Visual FoxPro Naming Rules or Reserved Words.

•	Controls under shapes. In FoxPro 2.6, the positions of shapes has no effect on other controls. In converted FoxPro 2.6 screens, shapes are behind all other controls and invisible buttons are always on top of all other controls.

•	UDFs and other code that might be superseded by new Visual FoxPro commands or functions. For more information, see Checking Code After Conversion.

•	Macro substitutions. Replace macro substitutions in the Properties window with variable assignments. For example, a PushButton prompt in FoxPro 2.6 Screen Builder that contains &lcprompt is converted to ="&lcprompt" and must be changed to =lcprompt.

Visual FoxPro runs converted screens from the .SPR file created during conversion. Check this .SPR file and the code in any programs or other screens that might call the converted screen to determine whether you can eliminate the new .SPR file and run directly from the .SCX file. For more information, see Checking the .SPR File and Changing Converted Screens to Visual FoxPro Forms. To understand how Visual FoxPro supports converted screens in READ compatibility mode, see Overview of READ Compatibility Architecture.


See Also

Changing Converted Screens to Visual FoxPro Forms
Checking the .SPR File
Differences Between Visual FoxPro and Previous Versions
Overview of READ Compatibility Architecture
Properties Window
Reserved Words
Visual FoxPro Naming Rules


Changing Converted Screens to Visual FoxPro Forms

See Also

Converted FoxPro 2.6 screens run in a compatibility mode provided by the WindowType property. To understand how the Visual FoxPro architecture supports the screens in READ compatibility mode, see Overview of READ Compatibility Architecture.

The following table describes the basic feature mapping in converted screens.

FoxPro 2.6 screen feature	Visual FoxPro feature
Screen set	Form set
Screen	Form contained in a form set
READ level	Page contained in a page frame
READ screen mode	WindowType property = 2
READ MODAL screen mode	WindowType property = 3
You can change converted screens to run directly from the .SCX file. To remove the need for the .SPR file created during conversion, you might need to change any files that call the converted screen. You might also need to move code from the .SPR file to the converted screen (.SCX file).

You can change converted FoxPro 2.6 screens to the Visual FoxPro event model.

To change converted screens to Visual FoxPro forms

1	Change the WindowType property from 2 (Read) to 0 (Modeless), or from 3 (Read Modal) to 1 (Modal).

Note   When you make this change, the READ compatibility properties and events are no longer available and the WindowType setting cannot be changed back.

2	If you have a single form, move form set event code to the matching or appropriate form events and remove the form set.

3	Move code from the READ-compatibility events to the form events and methods that are now available, taking event firing sequences into account.

Read-compatibility events	Form events and methods
ReadActivate event ReadDeactivate event ReadShow event ReadValid event ReadWhen event	Activate event Load event Show method Deactivate event
4	Remove page and page frame controls that are extraneous.

5	Process parameters in the Init event of the form instead of the screen Load event.

6	Replace preprocessor constants that mapped to property settings with the evaluated value.

7	Property settings in Visual FoxPro are not preprocessed. They must contain actual values or expressions that can be evaluated at run time. Method and event code is preprocessed, and constants defined there will be evaluated correctly.

8	Adjust scoping of variables in events or methods, which are private by default, by using the PUBLIC, PRIVATE, or LOCAL commands or by adding properties to the form.

9	To run the form directly, move code from the generated .SPR file to appropriate methods in the form.

Note   The Visual FoxPro 3.0 defaults in the FontSize, FontBold, and ColorSource properties differ from the Visual FoxPro 5.0 defaults in the same properties.

For more information, see Converting Visual FoxPro 3.0 Files.


See Also

Converting Visual FoxPro 3.0 Files
Form Object
FormSet Object
Overview of READ Compatibility Architecture
Page Object
PageFrame Control
READ Command
READ Compatibility Properties and Events
Removing Pages and Page Frames
WindowType Property


READ Compatibility Properties and Events

See Also

The READ compatibility of a form or form set is controlled by its WindowType property. The WindowType property of a form set overrides the WindowType settings of all forms it contains. Initially, converted screens have a WindowType property setting of 2 (Read) or 3 (Read Modal) and corresponding Read properties and events, listed in the table below.

With the WindowType property set to 2 or 3, converted forms provide the following properties and events for backward compatibility.

FoxPro 2.6 feature	Visual FoxPro property or event
#SECTION 1 Setup Code	The form set Load event
#SECTION 2 Setup Code	The form Load event
READ ACTIVATE	The form set ReadActivate event
READ CYCLE	The form set ReadCycle property
READ DEACTIVATE	The form set ReadDeactivate event
READ LOCK	The form set ReadLock property
READ NOMOUSE	The form set ReadMouse property
READ SAVE	The form set ReadSave property
READ SHOW	The form set ReadShow event
READ TIMEOUT	The form set ReadTimeout property
READ VALID	The form set ReadValid event
READ WHEN	The form set ReadWhen event


See Also

Form Object
FormSet Object
Load Event
LOCAL Command
PRIVATE Command
PUBLIC Command
READ Command
ReadActivate Event
ReadDeactivate Event
ReadShow Event
ReadValid Event
ReadWhen Event
Removing Pages and Page Frames
WindowType Property


Removing Pages and Page Frames

See Also

Converted form sets and forms always have a page frame containing at least one page for each read level of the original screen. Unless they supply specific functionality, you can remove the pages and page frame from each form in a form set.

To remove a page from a form set

1	From the Properties window, select the page to delete.

2	Select all the controls on the page and choose Cut from the Edit menu.

3	With the page frame current, press DELETE to remove the page frame.

4	With the page current, press DELETE to remove the page.

5	With the form current, choose Paste from the Edit menu to restore the controls.

6	Change the WindowType property to 0 or 1 before you save the changed form.

When you remove the last page, the page frame is also deleted.

Note   When you remove the pages and page frame, you must change the WindowType property to 0 or 1.


See Also

Changing Converted Screens to Visual FoxPro Forms
Differences Between Visual FoxPro and Previous Versions
Page Object
PageFrame Control
Properties Window
ReadActivate Event
ReadDeactivate Event
ReadShow Event
ReadValid Event
ReadWhen Event
WindowType Property


Checking the .SPR File

See Also

FoxPro 2.6 screens (.SCX) file conversion creates a new (.SPR) file. If the original .SCX contains preprocessor directives, a global include file is also created. The new files enable Visual FoxPro to handle FoxPro 2.6 preprocessor directives, and to run the converted screen if other application components expect an .SPR file.

If the original .SCX file contains preprocessor directives, the conversion process:

•	Creates a global include file that contains all #DEFINE statements found in a screen.

•	Places a statement in the new .SPR file that references the include file.

•	Places code representing the FoxPro 2.6 #INSERT preprocessor directive directly into the form.

For more information on the location of specific code segments, see Differences Between Visual FoxPro and Previous Versions.


See Also

#DEFINE ... #UNDEF Preprocessor Directive
Differences Between Visual FoxPro and Previous Versions
EXTERNAL Command
FormSet Object


Overview of READ Compatibility Architecture

See Also

Several features of the Visual FoxPro event model are used to support backward compatibility for READs within converted FoxPro 2.6 screens. To understand how the Visual FoxPro features support READ compatibility, see any of the topics below.

•	WindowType property

•	TerminateRead property

•	Form sets and their properties and events

•	Page frames and pages

•	Event firing sequence

•	Variable scoping in Load events

•	Parameters received by form sets


See Also

Checking Converted FoxPro 2.6 Screens
Converting FoxPro 2.6 Files


WindowType Property

See Also

The form set WindowType property identifies the READ compatibility mode of converted forms. If forms are in READ compatibility mode, the WindowType property is either 2 (Read) or 3 (Read Modal).


See Also

Changing Converted Screens to Visual FoxPro Forms
READ
WindowType Property


TerminateRead Property

See Also

The TerminateRead property supports the “Terminate READ on Selection” option of FoxPro 2.6 controls.


See Also

TerminateRead Property


Form Sets and Their Properties and Events

See Also

Visual FoxPro screen conversion always creates a form set to contain a converted FoxPro 2.6 screen set or screen.

FoxPro 2.6 READ compatibility mode includes properties and events that support backward compatibility for FoxPro 2.6 behavior. The following list maps Visual FoxPro properties and events to FoxPro 2.6 equivalents. Except for form set Load and Unload events and form load events, which are unaffected by WindowType property settings, these properties and events are effective only when the WindowType property is set to 2 or 3.

Visual FoxPro form set property	FoxPro 2.6 equivalent
ReadCycle	READ CYCLE
ReadLock	READ LOCK
ReadMouse	READ NOMOUSE
ReadSave	READ SAVE
ReadTimeout	READ TIMEOUT
Visual FoxPro form set event	FoxPro 2.6 equivalent
Load	#SECTION 1 Setup Code
ReadActivate	READ ACTIVATE
ReadDeactivate	READ DEACTIVATE
ReadShow	READ SHOW
ReadValid	READ VALID
ReadWhen	READ WHEN
Unload	Cleanup Code
Visual FoxPro form event	FoxPro 2.6 equivalent
Load	#SECTION 2 Setup Code


See Also

Changing Converted Screens to Visual FoxPro Forms
Load Event
READ Compatibility Properties and Events
ReadActivate Event
ReadCycle Property
ReadDeactivate Event
ReadLock Property
ReadMouse Property
ReadSave Property
ReadShow Event
ReadTimeout Property
ReadValid Event
ReadWhen Event
Unload Event


Page Frames and Pages

See Also

In FoxPro 2.6 READ compatibility mode, each form set contains at least one page frame that contains one page for each read level of the original screen. Each page contains all the controls that participate in that READ level. Visual FoxPro destroys the participating controls and the page whenever a READ terminates.

Visual FoxPro creates a page frame, if one does not already exist, and a page to handle the READ level for any @ ... GET commands in a FoxPro 2.6 program. The page and its controls become active at the READ and terminate when the READ terminates.


See Also

Page Object
Pageframe Control
Removing Pages and Page Frames


Event Firing Sequence

See Also

The following tables show the firing sequence of Visual FoxPro events when a form is in READ compatibility mode, with the form set WindowType property set to 2 (Read) or 3 (Read Modal). The data environment’s AutoOpenTables property is assumed to be set to false (.F.).

Object	Events
Form set	Load
Data environment	BeforeOpenTables
Form(s)	Load
Data environment cursor(s)	Init
Data environment	Init
Objects 1	Init
Form set	ReadWhen
Form set	ReadActivate
Form set	ReadShow
Form set	Show
Form	Show
Form set	Activate
Form	Activate
Object 2	When
Form	GotFocus
Object 3	GotFocus
Object 4	Valid
1 For each object, from innermost object to outermost container

2 The first object in the tab order

3 If the When event returned true (.T.)

4 As the object loses focus

When a form closes, the READ compatibility event sequence is as follows.

Object	Events
Form	QueryUnload
Form set	ReadValid
Objects 1	Destroy
Form	Unload
Form set	Unload
Data environment	AfterCloseTables
Data environment	Destroy
Data environment cursors(s)	Destroy
1 For each object, from outermost container to innermost object


See Also

Activate Event
AfterCloseTables Event
AutoOpenTables Property
BeforeOpenTables Event
Destroy Event
GotFocus Event
Init Event
Load Event
QueryUnload Event
ReadActivate Event
ReadShow Event
ReadValid Event
ReadWhen Event
Show Method
Unload Event
Valid Event
When Event


Variable Scoping in Load Events

See Also

In FoxPro 2.6 READ compatibility mode, variables created in the Load event of a form set with WindowType set to 2 or 3 are scoped to the form set and visible to the entire form set, its forms, and controls. Control the visibility of variables created in other form set events or methods by using the PRIVATE, PUBLIC or LOCAL commands.


See Also

Changing Converted Screens to Visual FoxPro Forms
LOCAL Command
PRIVATE Command
PUBLIC Command


Parameters Received by Form Sets

See Also

The WindowType property determines how parameters are handled by Visual FoxPro form sets.

WindowType property setting	Parameters passed to
0 or 1	Form set Init event
2 or 3	Form set Load event


See Also

Changing Converted Screens to Visual FoxPro Forms
Init Event
Load Event


Checking Converted FoxPro 2.6 Reports and Labels

See Also

Converting a FoxPro 2.6 report or label to a Visual FoxPro file changes the table structure of the .FRX or .LBX file and adds records to support the data environment of the report or label.

Once you convert a report to Visual FoxPro format, you can add functionality to it. For information on differences between FoxPro 2.6 reports and Visual FoxPro reports, see Differences Between Visual FoxPro and Previous Versions. For details on creating or modifying reports, see Report Designer.


See Also

AutoCloseTables Property
AutoOpenTables Property
Differences Between Visual FoxPro and Previous Versions
REPORT Command
Report Designer


Checking Converted FoxPro 2.6 Tables

See Also

Visual FoxPro does not change the structure of FoxPro tables unless you add the table to a database or add a new data type or enable acceptance of null values. Once you change the structure of a table by adding a new data type such as DateTime, or by enabling null values in a field, Visual FoxPro modifies the table file structure, making the file unrecognizable to FoxPro 2.6.

You can create a FoxPro 2.6 table from a Visual FoxPro table by using the COPY TO command with the TYPE clause and the FOX2X keyword, as in the following example:

* A Visual FoxPro table

USE vfptable.dbf

* Creates a FoxPro 2.6 table

COPY TO fp26tabl.dbf TYPE FOX2X

To copy a FoxPro 2.6 table structure from a Visual FoxPro table, use COPY TO and the NEXT clause, as in the following example.

* Creates an empty FoxPro 2.6 table

COPY TO fp26tabl.dbf NEXT 0 TYPE FOX2X

Visual FoxPro changes all null values in NULL-enabled fields to either 0 or blank, and creates a structure recognized by FoxPro 2.6. For details on Visual FoxPro table structures, see Table Structures of Table Files.


See Also

COPY TO Command
Table Structures of Table Files


Checking Code After Conversion

See Also

When you convert projects or files, check .PRG files for code you can modify to take full advantage of the Visual FoxPro event model. You might relocate code or procedures to events or methods in containers or objects, or use new Visual FoxPro commands or functions.

From within the Project Manager, you can check all project files for the following situations:

•	Check for UDFs or other code that duplicates new Visual FoxPro functions. For more information, see Differences Between Visual FoxPro and Previous Versions, or New Commands and Functions.

•	Check .PRG files for @ ... GET code that creates overlapping controls. You might need to reorder your @ ... GET code and change the ZOrder Method of controls to maintain FoxPro 2.6 functionality.

Tip   To access properties of controls in .PRG files, use the _SCREEN system variable, and the ActiveForm, and ActiveControl properties.

•	Look for symbol name conflicts with new reserved words.

•	Check for conflicting configurable key combinations and navigation keys. For more information, see Keystroke Differences in Interface Differences.

•	Change CLEAR READ commands in forms or form sets to RELEASE THISFORMSET or RELEASE THISFORM, or to CLEAR EVENTS.

•	Change SHOW GET and SHOW GETS statements to object.Refresh statements.

•	Change SHOW GET and SHOW GETS statements in list and combo boxes to object.Requery statements.

•	Move Foundation READs into the Visual FoxPro event model by using READ EVENTS and CLEAR EVENTS commands.


See Also

ActiveControl Property
ActiveForm Property
CLEAR Commands
Differences Between Visual FoxPro and Previous Versions
Interface Differences
Moving Foundation READs into Visual FoxPro
New Commands and Functions
Project Manager Window
READ EVENTS Command
Refresh Method
RELEASE Command
Reserved Words
_SCREEN System Variable
SHOW GET Command
SHOW GETS Command


Variable Naming Conventions

See Also

Follow this suggested format for naming variables.

Syntax

[Scope]TypeName

Arguments

Scope   Optional. A convention for noting the range of reference for the variable. For example, local variables can be prefixed with “l,” which reminds you that they can referenced only within the procedure they were defined in. Suggested expressions for Scope are as follows.

Scope	Description	Example
l	Local	lnCounter
p	Private (default)	pnStatus
g	Public (global)	gnOldRecno
t	Parameter	tnRecNo
Type   Convention for noting the data type of a variable. Suggested prefixes for Type are as follows.

Type	Description	Example
a	Array	aMonths
c	Character	cLastName
y	Currency	yCurrentValue
d	Date	dBirthDay
t	Datetime	tLastModified
b	Double	bValue
f	Float	fInterest
l	Logical	lFlag
n	Numeric	nCounter
o	Object	oEmployee
u	Unknown	uReturnValue
Remarks

Prefixes aren’t required, but are recommended as good programming practice. Using a prefix does not dictate the value of a variable — in Visual FoxPro, prefixes are used only as a naming convention. For example, adding the prefix “c” does not check that only character data is stored to the variable, but it does help you remember that the variable was created to accept character data.

Note   The scope prefix is recommended but not required. In some cases, explicit scoping does not apply. For example, in the main program of a stand-alone application, there is no difference in visibility for variables scoped as PUBLIC or PRIVATE. The type prefix is always relevant and is required in sample programs.


 See Also

Constant Naming Conventions
Object Naming Conventions
Table Field Naming Conventions
Visual FoxPro Naming Rules
Window Naming Conventions


Object Naming Conventions

See Also

Follow this suggested format for naming objects.

Syntax

PrefixName

Suggested prefixes for object names are listed in the following table.

Prefix	Object	Example
chk	CheckBox	chkReadOnly
cbo	ComboBox	cboEnglish
cmd	CommandButton	cmdCancel
cmg	CommandGroup	cmgChoices
cnt	Container	cntMoverList
ctl	Control	ctlFileList
<user-defined>	Custom	user-defined
edt	EditBox	edtTextArea
frm	Form	frmFileOpen
frs	FormSet	frsDataEntry
grd	Grid	grdPrices
grc	Column	grcCurrentPrice
grh	Header	grhTotalInventory
img	Image	imgIcon
lbl	Label	lblHelpMessage
lin	Line	linVertical
lst	ListBox	lstPolicyCodes
olb	OLEBoundControl	olbObject1
ole	OLE	oleObject1
opt	OptionButton	optFrench
opg	OptionGroup	opgType
pag	Page	pagDataUpdate
pgf	PageFrame	pgfLeft
sep	Separator	sepToolSection1
shp	Shape	shpCircle
spn	Spinner	spnValues
txt	TextBox	txtGetText
tmr	Timer	tmrAlarm
tbr	ToolBar	tbrEditReport
Remarks

Prefixes aren’t required, but are recommended as good programming practice. Using a prefix does not dictate the contents of an object variable — in Visual FoxPro, prefixes are used only as a naming convention. For example, adding the prefix “cbo” does not check that the object referenced by the variable is a combo box, but it does help you remember the object referenced by the variable.


See Also

Constant Naming Conventions
Table Field Naming Conventions
Variable Naming Conventions
Visual FoxPro Naming Rules
Window Naming Conventions


Table Field Naming Conventions

See Also

Follow this suggested format for naming fields in tables. These conventions are recommended, not required.

Syntax

Alias.TypeName

Arguments

Type   Notes the data type for a field in a table. Suggested prefixes for Type are as follows.

Type	Description	Example
c	Character	Customer.cLastName
d	Date	Customer.dBirthDay
t	Datetime	Customer.tLastMod
b	Double	Customer.bRate
f	Float	Customer.fValue
g	General	Customer.gPicture
l	Logical	Customer.lSellMail
m	Memo	Customer.mComments
y	Currency	Customer.yYearTDate
n	Numeric	Customer.nItems
i	Integer	Customer.iCustID
Remarks

Prefixes aren’t required, but are recommended as good programming practice. Using a prefix does not dictate the contents of a field — in Visual FoxPro, prefixes are used only as a naming convention. For example, adding the prefix “d” does not check that the contents of a field is a date, but it does help you remember the data type contained in the field.


 See Also

Constant Naming Conventions
Object Naming Conventions
Variable Naming Conventions
Visual FoxPro Naming Rules
Window Naming Conventions


Constant Naming Conventions

See Also

Follow this suggested format for naming constants.

Syntax

NAME

Remarks

It is recommended that constants be entered in uppercase.

Example

#DEFINE MAX_VALUE 10


 See Also

Object Naming Conventions
Table Field Naming Conventions
Variable Naming Conventions
Visual FoxPro Naming Rules
Window Naming Conventions


Window Naming Conventions

See Also

Follow this suggested format for naming windows.

Syntax

wName

Remarks

Do not use a prefix on class definitions; use prefixes only when the object is instantiated.

Example

When creating a window object, use the following code:

DEFINE WINDOW wCustomerInvoices ;

FROM nFirstRow, nFirstColumn TO nLastRow, nLastColumn


 See Also

Constant Naming Conventions
Object Naming Conventions
Table Field Naming Conventions
Variable Naming Conventions
Visual FoxPro Naming Rules


Converting from Other Versions of FoxPro

See Also

If you have files from other versions of FoxPro that you want to use in this version of Visual FoxPro, you have several choices. You can run many files from some previous versions of FoxPro directly; other require varying levels of conversion.

Converting from Visual FoxPro 3.0 for Windows

If you have Windows versions of Visual FoxPro 3.0 projects or files, you must convert or recompile them. Visual FoxPro 3.0 .SCX and .VCX files are automatically recompiled when you open them in Visual FoxPro 5.0.

File Type	Treatment
.PJX	Convert*
.SCX	Recompile**
.VCX	Recompile**
.PRG, .MPR, .QPR, or .FRX	Recompile
.DBF or .DBC	Use as is, unless modifying

* Structure change enables source code control.

** Choose FontSize, FontBold, and ColorSource property defaults.

For more information, see Running Visual FoxPro 3.0 Files and Converting Visual FoxPro 3.0 Files.

Converting from Visual FoxPro 3.0 for the Macintosh

If you have Macintosh versions of Visual FoxPro 3.0 projects or files, you must copy the files to Windows, and then convert or recompile them.

File Type	Treatment
.PJX	Convert**
.SCX	Recompile***
.VCX	Recompile*
.PRG, .MPR, .QPR, or .FRX	Recompile
.DBF or .DBC	Use as is unless modifying

* Table structure differs from earlier versions: General and Memo fields are 4 bytes instead of 10 bytes wide.

** Structure change enables source code control.

*** Choose FontSize, FontBold, and ColorSource property defaults.

For more information, see Running Visual FoxPro 3.0 for the Macintosh Files or Converting FoxPro for the Macintosh Files.

Converting from FoxPro 2.6

If you have FoxPro 2.6 projects or files that you want to use in Visual FoxPro, you have several choices. You can run many files from previous versions of FoxPro directly in Visual FoxPro or you can choose to convert your files to the new format, as necessary. Or, you can re-examine your files and applications, and apply Visual FoxPro object-oriented design principles to them.

File Type	Treatment
.PJX	Convert
.SCX	Convert
.PRG, .MPR, .QPR, or .FRX	Run or convert
.DBF	Use as is, unless modifying*

* Table structure differs from earlier versions: General and Memo fields are 4 bytes instead of 10 bytes wide

For more information, see the following topics.

To	See
Run files	Running FoxPro 2.6 Files
Convert files	Converting FoxPro 2.6 Files
Check converted files	Checking Converted FoxPro 2.6 Projects
Redesign files	Redesigning Converted FoxPro 2.6 Files


See Also

Checking Converted FoxPro 2.6 Projects
Converting FoxPro 2.6 Files
Converting FoxPro for the Macintosh Files
Converting from Other Versions of FoxPro
Converting Visual FoxPro 3.0 Files
Redesigning Converted FoxPro 2.6 Files
Running FoxPro 2.6 Files
Running Visual FoxPro 3.0 Files
Running Visual FoxPro 3.0 for the Macintosh Files
Table File Structure


Converting Visual FoxPro 3.0 Files

See Also

Visual FoxPro converts version 3.0 project (.PJX), screen (.SCX), and class library (.VCX) files to Visual FoxPro 5.0 formats. You can automatically convert all files that require conversion by using Visual FoxPro 5.0 to open the project that contains them. You can also open individual screen, class library, report, and label files to start the Visual FoxPro 5.0 Converter, CONVERT.APP, located in the Visual FoxPro directory.

To convert files to Visual FoxPro 5.0

•	From the File menu, choose Open, select a Visual FoxPro 3.0 file to convert, and then choose OK.

 – Or –

•	Use a command such as MODIFY PROJECT or MODIFY FORM.

Visual FoxPro 5.0 automatically recompiles and then opens the file.

 – Or –

•	Start CONVERT.APP using the DO command.

The Conversion Options dialog box appears.

Converting to Visual FoxPro 5.0 adds source code control to the features provided in Visual FoxPro 3.0 project files. In addition, Visual FoxPro 3.0 screen and class library files are converted to retain Visual FoxPro 5.0 default settings for FontBold, FontSize, and ColorSource properties.

Property	3.0 Setting	5.0 Setting
FontBold	True	False
FontSize	10 points	9 points
ColorSource	0	4
For details on project (.PJX) file structure changes, see Table File Structure.


See Also

ColorSource Property
Conversion Options Dialog Box
_CONVERTER System Variable
Converting from Other Versions of FoxPro
FontBold Property
FontSize Property
MODIFY Command
Running Visual FoxPro 3.0 Files
Table File Structure


Running Visual FoxPro 3.0 Files

See Also

You must recompile Visual FoxPro 3.0 program (.PRG), form (.SCX), query (.QPR), menu (.MPR), report (.FRX), and database (.DBC), and class library (.VCX) files to run them in Visual FoxPro 5.0.

To run Visual FoxPro 3.0 applications in Visual FoxPro 5.0

1	Use the COMPILE command with any Visual FoxPro 3.0 .PRG, .SCX, .QPR, .MPR, .FRX, .DBC, or .VCX file.

2	Use the DO command on the recompiled file.

You must convert Visual FoxPro 3.0 projects to run them in Visual FoxPro 5.0. For details, see Converting Visual FoxPro 3.0 Files.


See Also

Conversion Options Dialog Box
Converting FoxPro 2.6 Files
Converting from Other Versions of FoxPro
Converting Visual FoxPro 3.0 Files
Redesigning Converted FoxPro 2.6 Files


Converting FoxPro for Macintosh Files
Converting FoxPro for the Macintosh Files

See Also

If you have FoxPro 2.6 for the Macintosh or Visual FoxPro 3.0 for the Macintosh files that you want to modify in Visual FoxPro 5.0, you must copy them to the Windows platform, and then convert or recompile them.

Converting FoxPro for the Macintosh Files

To use Visual FoxPro for the Macintosh files in Visual FoxPro 5.0, first copy the files to a Windows disk, and then convert or recompile your files.

To convert files to Visual FoxPro 5.0

1	Copy the Visual FoxPro for the Macintosh file to a Windows disk.

2	From the File menu, choose Open, select a Visual FoxPro 3.0 file to convert, and choose OK.

 – Or –

•	Use a command such as MODIFY PROJECT or MODIFY FORM.

The Conversion Options dialog box appears.

Using FoxPro 2.6 for the Macintosh Files

Converting from FoxPro 2.6 for the Macintosh to Visual FoxPro 5.0 for Windows requires a full conversion of project and other files after you copy the files to the Windows platform. For details of conversion from FoxPro 2.6 files see, Converting FoxPro 2.6 Files.


See Also

ColorSource
Conversion Options
Converting FoxPro 2.6 Files
Converting from Other Versions of FoxPro
FontBold
FontSize
MODIFY FORM
MODIFY PROJECT
Table File Structure


Running Visual FoxPro 3.0 for Macintosh Files
Running Visual FoxPro 3.0 for the Macintosh Files

See Also

Although you can run FoxPro for the Macintosh screens and Visual FoxPro 3.0 for the Macintosh forms from Visual FoxPro 5.0 directly, you must recompile Visual FoxPro 3.0 program (.PRG), form (.SCX), query (.QPR), menu (.MPR), report (.FRX), database (.DBC), and class library (.VCX) files to run them in Visual FoxPro 5.0.

To run Visual FoxPro 3.0 applications in Visual FoxPro 5.0

1	Use the COMPILE command with any Visual FoxPro 3.0 .PRG, .SCX, .QPR, .MPR, .FRX, .DBC, or .VCX file.

2	Use the DO command on the recompiled file.

You must convert Visual FoxPro 3.0 projects to run them in Visual FoxPro 5.0. For details, see Converting Visual FoxPro 3.0 Files.


See Also

COMPILE Command
Converting from Other Versions of FoxPro
Converting Visual FoxPro 3.0 Files
DO Command


Running FoxPro 2.6 Files

See Also

You can run generated FoxPro 2.6 files and use reports, queries, and tables directly in Visual FoxPro without having to convert them.

To run generated FoxPro 2.6 files in Visual FoxPro

•	Use the DO command with any FoxPro 2.6 .SPR, .QPR, or .MPR file.

You can also open the following FoxPro 2.6 files in Visual FoxPro without converting them.

•	FoxPro 2.6 queries (.QPR files) opens in the Query Designer without being converted.

•	FoxPro 2.6 menus (.MNX files) opens in the Menu Designer without being converted.

•	FoxPro 2.6 tables (.DBF files) opens in the Table Designer without being converted.

Visual FoxPro converts tables only if you add a new data type, enable null values in any field, add a code page, or add the table to a database. For details, see Checking Converted FoxPro 2.6 Tables.


See Also

Checking Converted FoxPro 2.6 Tables
Converting FoxPro 2.6 Files
DO Command
Menu Designer
Query Designer
Table Designer


Converting FoxPro 2.6 Files

See Also

You can convert FoxPro 2.6 files to Visual FoxPro format. Conversion allows you to use visual designers and access the added functionality of the Visual FoxPro event model. If you decide to convert FoxPro 2.6 files to Visual FoxPro, just open them in Visual FoxPro.

To convert a FoxPro 2.6 file

•	From the File menu, choose Open, select the FoxPro 2.6 file, and then choose OK.

 – Or –

•	Use a command such as MODIFY SCREEN or MODIFY FORM.

The Conversion Options dialog box appears.

You can convert projects, screens, reports, and labels; you can also move foundation READs to the Visual FoxPro event model. Converting either FoxPro 2.6 projects or individual screens retains the correct READ compatibility modes.

To	See
Convert projects Verify project conversions	Converting FoxPro 2.6 Projects Checking Converted FoxPro 2.6 Projects
Convert screens Verify screen conversions	Converting FoxPro 2.6 Screens Checking Converted FoxPro 2.6 Screens
Convert reports Verify report conversions	Converting FoxPro 2.6 Reports Checking Converted FoxPro 2.6 Reports and Labels
Convert labels Verify label conversions	Converting FoxPro 2.6 Labels Checking Converted FoxPro 2.6 Reports and Labels
Move foundation READs into Visual FoxPro	Moving Foundation READs into Visual FoxPro


See Also

Checking Converted FoxPro 2.6 Screens
Conversion Options Dialog Box
Converting FoxPro 2.6 Labels
Converting FoxPro 2.6 Projects
Converting FoxPro 2.6 Reports
Converting FoxPro 2.6 Screens
Converting from Other Versions of FoxPro
MODIFY FORM Command
MODIFY SCREEN Command
Moving Foundation READs into Visual FoxPro
Redesigning Converted FoxPro 2.6 Files


Converting FoxPro 2.6 Projects

See Also

To use FoxPro 2.6 projects (.PJX files) and FoxPro catalogs (.FPC files), you must convert them to Visual FoxPro projects. Once you convert them you can access your files from the Project Manager and visual designers, and add Visual FoxPro event model functionality.

To convert a FoxPro 2.6 project

•	From the File menu, choose Open, select Project, locate the project you want to convert, and then choose OK.

 – Or –

•	Use the MODIFY PROJECT command.

The Conversion Options dialog box appears.

If you choose functional conversion, the conversion process performs these steps:

•	Copies the original project files to a new subdirectory named OLDx in the original .PJX directory and automatically increments x as you convert more projects.

•	Converts the project and all associated screens, reports, and labels to Visual FoxPro format.

•	Moves code snippets to appropriate event and method code.

•	Sets form and control properties.

•	Creates a file with an .SPR extension for each converted screen. This file is different from a FoxPro 2.6 .SPR file. For more information, see Checking the .SPR File.

•	Places files in the following locations.

FoxPro 2.6 files	Project Manager tab
.PRG and .SPR files	Code tab
.SCX and .SCT files	Documents tab
.FRX and .LBX files	Documents tab
After converting a project, Visual FoxPro opens the Project Manager so you can access all the project files. To ensure that your project converted as you intended, see Checking Converted FoxPro 2.6 Projects.


See Also

Checking Converted FoxPro 2.6 Projects
Checking the .SPR File
Conversion Options Dialog Box
Converting from Other Versions of FoxPro
MODIFY PROJECT Command
Project Manager


Converting FoxPro 2.6 Screens

See Also

You can convert FoxPro 2.6 screens (.SCX files) to Visual FoxPro forms to make files available to the Form Designer and to add Visual FoxPro event model functionality. Converted screens are initially in a READ compatibility mode. For details, see Overview of READ Compatibility Architecture.

To convert a FoxPro 2.6 screen (.SCX) file

•	From the File menu, choose Open, select Form, and then locate the screen you want to convert.

 – Or –

•	Use the MODIFY FORM command.

The Conversion Options dialog box appears.

If you choose functional conversion, the process performs these steps:

•	Changes screens (.SCX and .SCT files) to Visual FoxPro form sets. The original screen files are given .S2X and .S2T extensions. Converted FoxPro screens and screen sets are changed to form sets in Visual FoxPro.

•	Sets the form set’s WindowType property to 2 (Read) or 3 (Read Modal) to retain backward compatibility. If you choose Visual Conversion, your form set’s WindowType property is set to 0 (Modeless) or 1 (Modal), which are Visual FoxPro settings, to match the modal setting of your screen.

•	Places code snippets in appropriate event and method code. For details on the mapping of FoxPro 2.6 screen features to Visual FoxPro properties, events, and methods, see Differences Between Visual FoxPro and Earlier Versions.

•	Creates a new .SPR file and, optionally, an include file. Athough Visual FoxPro .SCX files run directly, the .SPR file provides backward compatibility to other application components that need it, and contains the following:

•	Any parameter statements and supporting functions and procedures from the cleanup code snippet in the original screen. Any supporting functions, if they exist, are in scope and are available to all events and methods of the form set and form.

•	An optional statement that specifies the global include file for the form. For details on the global include file, see Checking the .SPR File.

•	A DO FORM command that launches the .SCX file.

You can then use the Form Designer to view your converted screen, enter new values for properties, methods, and events, or copy code from the .PRG file. To ensure that your screen converted as you intended, see Checking Converted FoxPro 2.6 Screens.


See Also

Checking Converted FoxPro 2.6 Screens
Checking the .SPR File
Conversion Options Dialog Box
Differences Between Visual FoxPro and Earlier Versions
DO FORM Command
Form Designer
MODIFY FORM Command
Overview of READ Compatibility Architecture
WindowType Property


Converting FoxPro 2.6 Reports

See Also

You must convert FoxPro 2.6 reports (.FRX files) to Visual FoxPro reports to access files in the Report Designer and to add Visual FoxPro functionality.

To convert a FoxPro 2.6 report

•	From the File menu, choose Open, select Report, and then locate the report file you want to convert.

 – Or –

•	Use the MODIFY REPORT command.

The Conversion Options dialog box appears.

The conversion process performs these steps:

•	Adds a user field to the .FRX file.

•	Changes any Memo fields from ten bytes to four.

•	Adds records to support the data environment of the report. FoxPro 2.6 environment records convert to data environment records.

•	Sets the AutoOpenTables and AutoCloseTables properties of the Data Environment, and the Destroy event of the new report for backward compatibility with the ENVIRONMENT clause of the FoxPro 2.6 REPORT command.

If the FoxPro 2.6 report was created without an ENVIRONMENT clause, the AutoOpenTables and AutoCloseTables properties of the converted report are set to false (.F.).

If the FoxPro 2.6 report was created with an ENVIRONMENT clause, the AutoOpenTables and AutoCloseTables properties of the converted report are set to true (.T.). The Destroy event of the converted report contains the following code:

THIS.OpenTables	&& Opens all the tables

THIS.Init	&& Runs the Init code of the converted report's

&& DataEnvironment

After converting a report, Visual FoxPro opens the Report Designer so you can add Visual FoxPro functionality to the converted report. To ensure that your report converted as you intended, see Checking Converted FoxPro 2.6 Reports and Labels.


See Also

AutoCloseTables Property
AutoOpenTables Property
Checking Converted FoxPro 2.6 Reports and Labels
Conversion Options Dialog Box
Memo Field Type
MODIFY REPORT Command
REPORT Command
Report Designer


Converting FoxPro 2.6 Labels

See Also

You must convert FoxPro 2.6 labels (.LBX files) to Visual FoxPro format to make files available to the Report Designer and to add Visual FoxPro functionality.

To convert a FoxPro 2.6 label

•	From the File menu, choose Open, select Label, and then locate the label file you want to convert.

 – Or –

•	Use the MODIFY LABEL command.

The Conversion Options dialog box appears.

The conversion process performs these steps:

•	Adds a user field to the .LBX file.

•	Changes any Memo fields from ten bytes to four.

•	Adds records to support the data environment of the label. FoxPro 2.6 environment records convert to data environment records.

•	Sets the AutoOpenTables and AutoCloseTables properties, and the Data Environment Destroy event of the new label for backward compatibility with the ENVIRONMENT clause of the FoxPro 2.6 LABEL command.

If the FoxPro 2.6 label was created without an ENVIRONMENT clause, the AutoOpenTables and AutoCloseTables properties of the converted label are set to false (.F.).

If the FoxPro 2.6 label was created with an ENVIRONMENT clause, the AutoOpenTables and AutoCloseTables properties of the converted label are set to true (.T.). The Destroy event of the converted label contains the following code:

THIS.OpenTables	&& Opens all the tables

THIS.Init	&& Runs the Init code of the converted report's

&& DataEnvironment

After converting a label, Visual FoxPro opens the Label Designer so you can so you can add Visual FoxPro functionality to the converted label. To ensure that your label converted as you intended, see Checking Converted FoxPro 2.6 Reports and Labels.


See Also

AutoCloseTables Property
AutoOpenTables Property
Checking Converted FoxPro 2.6 Reports and Labels
Conversion Options Dialog Box
Label Designer
Memo Field Type


Moving Foundation READs into Visual FoxPro

See Also

In FoxPro 2.6, the foundation READ was used to emulate event-driven programming by providing an event loop and handler. In Visual FoxPro, you can take advantage of the native event loop by converting your foundation READs.

To move a foundation READ into Visual FoxPro

1	Replace any foundation READ in the main program with a READ EVENTS command. For example, include a READ EVENTS command in a program that runs your main form or form set.

2	Place a CLEAR EVENTS command in the form, menu, or program event that ends the program. For example, assign a CLEAR EVENTS command to the Exit menu item.

Also, check the settings of the form set WindowType property for your converted screens. In FoxPro 2.6, you coordinated screens through READ and READ MODAL statements. These statements are converted to the WindowType property when you convert your files. For backward compatibility, the property is automatically set to 2 or 3, depending on the READ mode of the original screen. To enable full event model functionality once you’ve converted foundation READs, change the READ compatibility mode of screens, remove extra pages and page frames, and change form methods. For more details, see Overview of READ Compatibility Architecture and Checking Converted FoxPro 2.6 Screens.


See Also

Checking Converted FoxPro 2.6 Screens
CLEAR Commands

Differences Between Visual FoxPro and Earlier versions
Overview of READ Compatibility Architecture
READ EVENTS Command
WindowType Property


Redesigning Converted FoxPro 2.6 Files

See Also

You can make additional changes to your converted files to take full advantage of Visual FoxPro features. To redesign your application, review the following features:

•	New commands and functions, base classes, properties, events, and methods.

•	Enhanced multiuser support.

•	Better connectivity.

When you know which features you want to change, see Differences Between Visual FoxPro and Earlier Versions for information on how FoxPro 2.6 features map to Visual FoxPro features.


See Also

Checking Converted FoxPro 2.6 Projects
Differences Between Visual FoxPro and Earlier Versions
Enhanced Commands and Functions
New Commands and Functions


File Menu, Debugger Window

See Also

The File menu contains options that allow you to open programs and debugging configurations. You can also save debug output to a file.

Menu Commands

Open   Displays the Open dialog box so that you can specify a program to display in the Trace window. Opening a program does not run the program.

Load Configuration   Loads breakpoints, watches, and events to be tracked from a configuration file (.DBG file). Select the dialog button to display the Open dialog box, which allows you to specify a file.

Save Configuration   Saves the current breakpoints, watches and events to be tracked into a configuration file (.DBG file) so that they can be restored later. Select the dialog button to display the Open dialog box, which allows you to specify a file.

Save Output As   Writes the text displayed in the Debug Output window to a file specified in the Save As dialog box.

Exit   Closes the Debugger window and returns you to the main Visual FoxPro window.


See Also

Debug Output Window
Trace Window


Edit Menu, Debugger Window

See Also

The Edit menu contains options for editing text.

Menu Commands

Cut   Removes selected text to the Clipboard.

Copy   Duplicates selected text and puts it on the Clipboard.

Paste   Places cut or copied text from the Clipboard at the insertion point.

Select All   Selects all text in the active Debugger window.

Find   Displays the Find dialog box so you can search for text.

Find Again   Searches for the last target specified in the Find dialog box.


See Also

Debug Menu, Debugger Window
File Menu, Debugger Window
Tools Menu, Debugger Window
Window Menu, Debugger Window


Debug Menu, Debugger Window

See Also

The Debug menu contains options for stepping through code. You can also set the speed at which commands are executed as you watch.

Menu Commands

Do   Begins executing the program open in the Trace window. If no program is open in the Trace window, displays the Do dialog box so you can specify a program or form to trace. The program or form you specify is executed with program execution suspended at the first line of executable code.

Resume   Available if program execution is suspended. Continues execution of the program in the Trace window at the current line of code.

Cancel   Closes and stops executing the program or form in the Trace window.

Fix   Available if program execution is suspended.

If you are tracing through a program, Fix prompts you to cancel the program and then opens it in an editing window, at the same position that the cursor is in the Trace window.

If you are tracing through code in a form, Fix prompts you to cancel execution and clear the form object from memory. Then an editing window in the Form Designer opens at the same position that the cursor is in the Trace window.

Step Out   Continues executing the code in a procedure without stepping through the code line by line. Program execution is suspended again on the line of code following the procedure call in the calling program.

Step Over   Executes the next line of code. If the next line of code calls a function, method, or procedure, then the function, method, or procedure is executed in the background.

Step Into   Executes the next line of code.

Run To Cursor   Executes code from the current line indicator to the line of code with the cursor. Click the line of code you want to suspend execution on to place the cursor on that line.

Throttle   Opens the Execution Throttle dialog box so you can specify the delay in seconds between the execution of each line of code.

Set Next Statement   Places the current line marker on the line of code with the cursor. This line of code will then be executed when you step or resume execution.


See Also

Execution Throttle Dialog Box
Trace Window


Execution Throttle Dialog Box

See Also

Allows you to specify the delay in seconds between the execution of each line of code located in the Trace window. This dialog box appears when you select Throttle from the Debug menu.

Dialog Box Options

Delay (seconds)   Allows you to set the delay of execution from 0.0 seconds to 5.0 seconds between each line of code.


See Also

Debug Menu
Trace Window


Tools Menu, Debugger Window

See Also

The Tools menu provides access to the Debugger dialog boxes.

Menu Commands

Breakpoints   Opens the Breakpoints dialog box so you can add, delete, enable or disable breakpoints.

Event Tracking   Opens the Event Tracking dialog box so you can specify which events are written to the Debug Output window or a file when they occur.

Coverage Logging   Opens the Coverage dialog box so you can turn coverage logging on or off and specify a file for the coverage log.


See Also

Breakpoints Dialog Box
Coverage Dialog Box
Debug Output Window
Event Tracking Dialog Box


Breakpoints Dialog Box

See Also

Allows you to specify options for breakpoints.

This dialog box appears when you choose Breakpoints from the Tools menu of the Debugger window.

Dialog Box Options

Type   The type of breakpoint. Choose one of the following settings.

Setting	Description
Break at location	Stops execution at a line of code.
Break at location if expression is true	Stops execution at a line of code when an expression becomes true.
Break when expression is true	Stops execution when an expression becomes true.
Break when expression has changed	Stops execution when the value of an expression changes.
Location   Where to suspend execution. The location can be a program, a procedure, or a specific method or event. You can suspend program execution at a particular line in the location by including the line number after the location and a comma.

Tip   To display line numbers in the Trace window, choose Show line numbers in the Debug tab of the Options dialog box.

File   The file that the location is in. The file can be a program, form, or class file. If you don’t specify a file name, the breakpoint is evaluated for any method or procedure with the same name as the method or procedure in the Location box.

Pass Count   Number of times the line of code in the Location box must execute before program execution suspends.

Tip   Use Pass Count with loops that encounter problems only after a certain number of iterations.

Expression   Any valid Visual FoxPro expression. When you choose  Break when expression is true or Break at location if expression is true from the Type list, specify the expression here.

Breakpoints   Lists all breakpoints you have added. Enabled breakpoints are marked with a check and are toggled with the Enable and Disable buttons.

All breakpoints listed in the Breakpoints list are saved to a debug configuration file when you choose Save Configuration from the File menu in the Debugger window.

Add   Adds the breakpoint specified by the Type, Location, File, Pass Count, and Expression boxes to the Breakpoints list. Only added breakpoints are saved when you exit the dialog box.

Remove   Removes the selected breakpoint from the Breakpoints list.

Disable   Clears the check mark beside the selected breakpoint in the Breakpoints list. When you disable a breakpoint, program execution is not suspended at the location or condition specified by the breakpoint.

Enable   Sets the check mark beside the selected breakpoint in the Breakpoints list and activates the breakpoint.

Clear All   Removes all the breakpoints from the Breakpoints list.

Display Breakpoint Messages   Allows you to toggle whether breakpoint message boxes display when a breakpoint is encountered. Breakpoint messages do not display when the break at location breakpoint is encountered.


See Also

Debugging Tab, Options Dialog Box
Tools Menu, Debugger Window
Trace Window


Event Tracking Dialog Box

See Also

Allows you to see when each event occurs in relation to other events. Use this dialog box to determine the most efficient place to include your code.

This dialog box appears when you choose Event Tracking from the Tools menu in the Debugger window.

Dialog Box Options

Turn event tracking on   Toggles event tracking on or off.

When event tracking is enabled, every time a system event in the Events to track list occurs, the name of the event is displayed in the Debug Output window or written to a file.

Available events   Displays all available events that are not selected for tracking.

Tip   If you are not specifically working with mouse movements, remove the MouseMove event from the Events to track list. MouseMove events typically occur very frequently.

Events to track   Displays all events that you want to track.

Send Output To

Debugger Output Window   Toggles whether tracked events are listed in the Debug Output window. If the Debug Output window is not open, events will not be listed, even if the Debugger Output Window box is set.

File   Specifies a file for the tracked events to be written to. The dialog button allows you to select a file from the Open dialog box.

Append   Specifies that tracked events are written after the current contents of an existing file, preserving the original contents.

Overwrite   Specifies that tracked events replace the contents of the specified file.


See Also

Debug Output Window
Tools Menu, Debugger Window


Coverage Dialog Box

See Also

Allows you to specify options for logging program execution. Use this dialog box to retrieve information on how many times each line of code was executed, which lines of code were not executed in your testing, and how long each line took to execute.

This dialog box appears when you choose Coverage Logging from the Tools menu in the Debugger window.

Dialog Box Options

File   Specifies the file to write the coverage log to. The dialog button displays the Open dialog box, which allows you to select a file to write the coverage log to.

Append   Specifies that the coverage log is written after the current contents of an existing file, preserving the original contents

Overwrite   Specifies that coverage log replaces the contents of the specified file.

Generate   Calls the program specified by the system variable _COVERAGE to present the raw coverage information in a more readable format.


See Also

COVERAGE System Variable
Tools Menu, Debugger Window


Window Menu, Debugger Window

See Also

The Window menu provides access to the active Debugger windows.

Menu Commands

Clear Output Window   Deletes all text displayed in the Debug Output window.

Cascade   Allows you to view all the open Debugger windows in a stair-step fashion, one stacked on top of the other.

Restore to Default   Displays the windows in their original positions in the Debugger window and clears all the watch expressions. Also, all the data that is saved in the debugger configuration file is cleared.

Trace   Activates the Trace window.

Watch   Activates the Watch window.

Locals   Activates the Locals window.

Call Stack   Activates the Call Stack window.

Output   Activates the Debug Output window.

Note   If the windows are docked, there is no visual indication that they have been activated, although associated menu items are enabled or disabled.


See Also

Call Stack Window
Debug Output Window
Locals Window
Trace Window
Watch Window


Trace Window

See Also

Allows you to see your lines of code as they are being executed.

This window is activated when you choose Trace from the Window menu of the Debugger window.

Window Elements

Object   Available when running object code. The code in the Trace window is associated with the object displayed in the Object list. The Object list contains all objects contained in the highest level parent container of the object whose code is currently executing.

Procedure   Available when running object code. The code in the Trace window is associated with the method or event displayed in the Procedure list. The Procedure list contains all methods of the object in the Object list that have code associated with them.

The left area of the Trace window can contain the following symbols.

Symbol	Description
	Currently executing line of code.
	Active breakpoint.
	Inactive breakpoint.
	Call stack position if you are examining code at a different level than the currently executing code.


See Also

Window Menu, Debugger Window


Locals Window

See Also

Allows you to display all the variables, arrays, objects, and object members that are visible in a given program, procedure, or method.

This window is activated when you choose Locals from the Window menu of the Debugger window.

Window Elements

Locals for   Indicates the procedure whose variables, arrays, and objects are displayed in the Locals window.

Name   Displays the names of the visible locals.

Value   Displays the current values of the visible locals.

Type   Displays characters that represents the data types of the visible locals.

Use the shortcut menu to control the category of variable displayed.

Category	Description
Public	Variables declared with the PUBLIC keyword.
Local	Variables declared with the LOCAL keyword.
Standard	All variables in the scope of the procedure displayed in the Locals for box.
Objects	Object variables.
To see the values of array elements or object properties, click the drill-down box to the left of the array or object name. The Locals window allows you to see properties of all objects in the container hierarchy.


See Also

LOCAL Command
Locals Window Shortcut Menu
PUBLIC Command


Watch Window

See Also

Allows you to display expressions and their current values, and set breakpoints on an expression.

This window is activated when you choose Watch from the Window menu of the Debugger window.

Window Elements

Watch   The value or expression you want to examine. Type expressions here to add them to the grid of active watch expressions below.

Name   Displays the names of the current watch expressions.

Value   Displays the values of the current watch expressions.

Type   Displays characters that represents the data types of the current watch expressions.

You can select expressions, delete them, or add breakpoints to them.

Create a new watch expression

•	Select text in any Visual FoxPro window and drag it to the Watch window.

Edit a watch expression

•	Double-click the watch expression.


See Also

Window Menu, Debugger Window


Call Stack Window

See Also

Allows you to display procedures, programs, and methods that are executing. While a program is running, it is listed in the Call Stack window. If you run a procedure or another program from within the first program, while the second program is running, both program names are displayed in the Call Stack window, and so on.

This window is activated when you choose Call Stack from the Window menu of the Debugger window.

Window Elements

Output Pane   Displays currently executing procedures, programs, and methods.

Call Stack Indicator   Points to the currently running program, procedure, or method.

You can configure the Call Stack window in the Debug tab of the Options dialog box.


See Also

Debugging Tab, Options Dialog Box


Debug Output Window

See Also:

Allows you to display output from active programs, procedures, or method code.

This window is activated when you choose Output from the Window menu of the Debugger window.

Window Elements

Output Pane   Displays character strings specified by the DEBUGOUT command and, if event tracking is enabled, the names of system events as they occur.

Save the text in the window

•	Choose Save Output As from the File menu in the Debugger window.


See Also

DEBUGOUT
Event Tracking Dialog Box


Help Menu, Debugger Window

The Help menu contains options that open Visual FoxPro online Help, direct you to technical assistance, and display information about your computer's configuration.

Menu Commands

Contents   Displays the online Help table of contents.

Search For Help On   Displays a dialog box so that you can search for Help topics by keyword.

Technical Support   Displays information about Microsoft Product Support Services and common questions about Visual FoxPro.

Office Compatible   Displays information about Visual FoxPro compatibility with Microsoft Office.

About Microsoft Visual FoxPro   Displays information about Visual FoxPro and your system.


Debugger Keyboard Shortcuts

The following keyboard shortcuts apply to the debugging tools in the Debugger window or in the FoxPro frame.

Action	Keyboard
Resume	F5
Cancel	Esc
Step Into	F8
Step Over	F6
Step Out	SHIFT+F7
Run To Cursor	F7
Trace Window	ALT+8
Watch Window	ALT+3
Locals Window	ALT+4
Call Stack Window	ALT+7
Debug Output Window	ALT+2
Toggle Breakpoint	F9
Clear Breakpoints	CTRL+SHIFT+F9
Breakpoints	CTRL+B
Open File	CTRL+O
Save Configuration	ALT+S
Exit Debugger	ALT+F4


Debugger Toolbar

Button	Command
	Open
	Resume
	Cancel
	Step Into
	Step Over
	Step Out
	Run to Cursor
	Trace window
	Watch window
	Locals window
	Call Stack window
	Debug Output window
	Toggle breakpoint
	Clear all breakpoints
	Breakpoints dialog box
	Toggle coverage logging
	Toggle event logging


Class Designer

See Also

Use the Class Designer to visually create and modify classes. When the Class Designer window is active, Visual FoxPro displays the Class menu. The View menu allows you to open complementary class design tools such as the Properties window, the Form Controls toolbar, and the Layout toolbar.

Classes are stored in class library (.VCX) files. To modify more than one class, you can open multiple class designers at the same time.

The Class Designer window consists of:

The Class Window   Displays a single class. The Class window is anchored to the top-left corner of the Class Designer and cannot be moved unless the window contains toolbar types.

Form   Specifies the active form within a form set. The Form box is enabled only when the type of class being modified is FormSet.

Page   Specifies the active page within a page frame. The Page box is enabled only when the type of class being modified is PageFrame.


See Also

Class Menu
Data Session Window
Form Controls Toolbar
Form Designer
Layout Toolbar
Page Frame Control


Connection Designer

See Also

Use the Connection Designer to create and modify named connections. Because connections are stored as part of a database, you only can use the Connection Designer if you have a database open.

For more information on creating connections, see “Defining a Connection” in Chapter 8, “Creating Views,” in the Developer’s Guide.

Window Options

Specify Datasource

Data Source, Userid, Password   Specifies that Visual FoxPro display the following three boxes:

•	Data Source   Lets you choose a data source from the list of installed ODBC data sources.

•	Userid   Allows you to enter a user name or ID if the data source requires one.

•	Password   Allows you to enter a password if the data source requires one.

•	Database   Allows you to choose a database for the selected data source to connect to.

Connection String   Specifies that Visual FoxPro displays the Connect String text box, in which you type a connection string.

Verify Connection   Allows you to check the connection you have just entered information for. If the connection was made successfully, a dialog box appears to indicate this. If the connection was not successful, an error message appears. If no information has been specified for the connection, the Select Database dialog box appears, which allows you to select a data source.

New Data Source   Displays the Data Sources dialog box, which allows you to add, delete, or configure data sources.

Display ODBC Login Prompts

When Login Info Is Not Specified   Specifies that Visual FoxPro prompt the user with the ODBC Data Source Login dialog box if the user ID and password are not stored in the named connection definition.

Always   Specifies that Visual FoxPro always prompt the user with the ODBC Data Source Login dialog box. This enables the user to use a different login ID and password from those stored in the named connection.

Never   Specifies that Visual FoxPro never prompt the user. This option ensures higher security.

Data Processing

These options correspond to connection properties that you can also set with the DBSETPROP( ) function. For more information about these properties, see the connection properties in the DBGETPROP( ) function.

Asynchronous Execution   Specifies an asynchronous connection. This option corresponds to the Asynchronous connection property.

Display Warnings   Specifies the display of non-trappable warnings. This option corresponds to the DispWarnings connection property.

Batch Processing   Specifies that the connection operate in batch mode. This option corresponds to the BatchMode connection property

Automatic Transactions   Specifies that the transaction processing is automatically handled. This option corresponds to the Transactions connection property.

Packet Size   Allows you to specify the network packet size (in bytes) for information transmitted to and from the remote data site. Select a choice from the drop-down list, or type a value.

Timeout Intervals

These options set values for connection properties that you can also set with the DBSETPROP( ) function. For more information about these properties, see connection properties in the DBGETPROP( ) function.

Connection (sec)   Specifies the connection timeout interval in seconds. This option corresponds to the ConnectTimeout connection property.

Query (sec)   Specifies the query timeout interval in seconds. This option corresponds to the QueryTimeout connection property.

Idle (min)   Specifies the idle timeout interval in minutes. Active connections are deactivated after the specified time interval. This option corresponds to the IdleTimeout connection property.

Wait Time (ms)   Specifies the amount of time in milliseconds that elapses before Visual FoxPro determines whether the SQL statement has completed executing. This option corresponds to the WaitTime connection property.


See Also

CREATE CONNECTION command
DBGETPROP( ) Function
DBSETPROP( ) Function
DELETE CONNECTION Command
DISPLAY CONNECTIONS Command
LIST CONNECTIONS Command
MODIFY CONNECTION Command
RENAME CONNECTION Command
SQLCONNECT( ) Function
SQLDISCONNECT( ) Function
SQLGETPROP( ) Function
SQLSETPROP( ) Function


Database Designer

See Also

The Database Designer displays all the tables, views, and relationships contained in a database. When the Database Designer window is active, Visual FoxPro displays the Database menu and the Database Designer toolbar.

Each table is represented by a resizeable window that lists the table’s fields and indexes, if any exist. The Database Designer shows persistent relationships by displaying lines between tables that connect the indexes.

You can position the tables and views by dragging them into place, or using the Arrange command on the Database menu. If you want to show or hide objects in the window, you can use the Properties command on the Database menu.


See Also

CREATE DATABASE Command
Database Designer Toolbar
Database Menu
Table Designer
Table Wizard


Data Environment Designer

See Also

Use the Data Environment Designer to visually create and modify the data environment of forms, form sets, and reports. When the Data Environment Designer window is active, Visual FoxPro displays the Data Environment menu, which allows you to manipulate data environment objects. To display the Properties window and Code window, right-click to display the Data Environment Designer shortcut menu, and then select Properties and Code.

A data environment defines the source for the data used in a form or report. This can include tables, views, and relationships. The data environment is saved with the form or report and can be modified whenever you are using the Report Designer or Form Designer.

When the data environment of a form or report is defined, Visual FoxPro automatically opens the tables or views when you open or run the file and closes them when the file is closed or released.

•	For forms, Visual FoxPro populates the ControlSource property list in the Properties window with all the fields in your data environment.

•	For reports, Visual FoxPro populates the data set your report needs based on associated tables and views.


See Also

Code Window
ControlSource Property
Data Environment Menu
Form Designer
Properties Window
Report Designer


Form Designer

See Also

Use the Form Designer to visually create and modify forms and form sets. A form set consists of one or more forms that can be manipulated as a unit. Forms and form sets are objects with their own properties, events, and methods.

When the Form Designer window is active, Visual FoxPro displays the Form menu, the Form Controls toolbar, the Form Designer toolbar, and the Properties window.

The Form Designer window consists of:

Form Window   Contains a single form on which you add and modify controls. More than one form window is displayed in the Form Designer when you modify a form set containing multiple forms. Form windows can be moved around within the Form Designer.

Form   Specifies the active form within a form set. The Form drop-down list is enabled only when the Form Designer contains a form set.

Page   Specifies the active page within a page frame. The Page box is enabled only when the type of control being modified is a page frame.


See Also

Class Designer
Form Controls Toolbar
Form Designer Toolbar
Form Menu
Forms Tab, Options Dialog Box
Form Wizard
Page Frame Control
Properties Window


Label Designer

See Also

Use the Label Designer to create and modify labels. When the Label Designer window is active, Visual FoxPro displays the Report menu and the Report Controls toolbar.

The Label Designer is the same as the Report Designer, using the same menus and toolbars. The main difference is that the Label Designer automatically defines the page and its columns based on the size of label you select.

To quickly create a simple label layout, choose Quick Report on the Report menu. Quick Report prompts you for input on the fields and layout you want for your label.

Window Options

Bands

By default, the Label Designer displays five bands: Page Header, Column Header, Detail, Column Footer, and Page Footer.

You can add the following bands to your label.

Band	Printed	Typical Contents
Group Header	Once per report	Preface to following data
Group Footer	Once per report	Calculated values for group data
Title	Once per report	Title Date or page number Company logo Box around the title
Summary	Once per report	Grand totals Text such as Grand Totals
Ruler

The Label Designer has a vertical and horizontal ruler you use to more precisely position objects in the bands. Use the ruler in conjunction with the View menu’s Show Position command to help you position objects.

To change the ruler scale

The ruler is set to the system default (inches). Change this to pixels as follows:

1	From the Format menu, choose Set Grid Scale. The Set Grid Scale dialog box is displayed.

2	In the Set Grid Scale dialog box, select Pixels and choose OK.

The ruler scale is set to pixels, and the position indicator in the status bar (if Show Position is selected on the View menu) also displays positions in pixels.


See Also

Label Wizard
Quick Report Dialog Box
Report Controls Toolbar
Report Menu
Set Grid Scale Dialog Box
View Menu


Menu Designer
Menu and Shortcut Designers

See Also

Use the Menu Designer and the Shortcut Designer to create menus, menu items, submenus of menu items, lines that separate groups of related menu items, and so on. With the Menu and Shortcut Designers, you can customize your copy of Visual FoxPro or design menus for applications you intend to distribute.

The Menu and Shortcut Designers consists of:

Prompt   Allows you to specify the menu titles and menu items in your menu system.

Mover Control   This is the double-headed arrow button to the left of the Prompt column. It allows visual arranging of the menu items at design time.

Result   Allows you to specify the action that occurs when you choose a menu title or menu item. For example, you can execute a command, open a submenu, or run a procedure.

Create   Allows you to specify a submenu or procedure for a menu title or menu item.

Edit   Allows you to change a submenu or procedure associated with a menu title or menu item.

Options   Displays the Prompt Options dialog box, in which you can define keyboard shortcuts and other menu options.

Menu Level   Allows you to choose the menu, submenu, or shortcut with which you want to work.

Preview   Displays the menu you are creating.

Item

Insert   Inserts a new row in the Menu Designer window.

Insert Bar   Displays the Insert System Menu Bar dialog box, which allows you to insert standard Visual FoxPro menu items.

Delete   Deletes the current row from the Menu Designer.


See Also

General Options Dialog Box
Menu Options Dialog Box
Prompt Options


Query and View Designers

See Also

Use the Query Designer and the View Designer to create and modify queries and views. When the Query or View Designer is active, Visual FoxPro displays the Query menu and the Query toolbar or View Designer toolbar.

The top pane of the designer displays the tables in the query or view. Each table is represented by a resizeable window that lists the table’s fields and indexes. The designer shows join conditions by displaying lines that connect fields between tables. You can drag indexed fields between tables to create join conditions. Double-click a line to display the Join Condition dialog box for editing the condition.

Tab Options

Fields   Specifies fields, aggregate functions such as SUM or COUNT, or other expressions.

Join   Specifies join expressions for matching records between two or more tables or views.

Filter   Specifies conditions for selecting records, such as specific values in a field or join conditions defining temporary relationships between tables.

Order By   Specifies fields, aggregate functions such as SUM or COUNT, or other expressions used to set the order of records retrieved in the query.

Group By   Specifies fields, aggregate functions such as SUM or COUNT, or other expressions used to combine records into a group based on identical values in those fields.

Update Criteria   Specifies conditions under which views are updated. (View Designer only).

Miscellaneous   Specifies if duplicates should be retrieved and limits on records such as the top quantity or percentage.


See Also

COUNT Command
Fields Tab, Query and View Designer
Filter Tab, Query and View Designer
Group By Tab, Query and View Designer
Order By Tab, Query and View Designer
Query Menu
Query Toolbar
Query Wizard
SUM Command
Update Criteria Tab, View Designer
View Designer Toolbar


Fields Tab, Query and View Designers

See Also

Specifies fields, aggregate functions, and other expressions for query or view output. This tab appears in the Query Designer and the View Designer.

Tab Options

Available Fields   Lists all the available fields in the query’s or view’s tables.

Functions and Expression   Specifies a function or expression. You can either select a function from the list or type an expression directly into the box. Click the Add button to add it to the Selected Output box.

Selected Fields   Lists the selected fields, aggregate functions, and other expressions that appear in the query or view results. You can rearrange the order of the output by dragging the vertical double arrow to the left of the fields.

Add   Adds the selected item to the Selected Output box from the Available Fields box or the Functions/Expressions box.

Add All   Adds all fields to the Selected Output box from the Available Fields box.

Remove   Removes the selected item from the Selected Output box.

Remove All   Removes all items from the Selected Output box.

Properties   Displays the View Field Properties dialog box, which allows you to specify options for fields in a view just as you do for fields in database tables. This option is only available in the View Designer.


See Also

Filter Tab, Query and View Designer
Group By Tab, Query and View Designer
Order By Tab, Query and View Designer
Query Designer
Update Criteria Tab, View Designer
View Designer


View Field Properties (View Designer)
View Field Properties Dialog Box

Allows you to specify options for fields in a view just as you do for fields in database tables. Use this dialog box to define properties to determine the type of data the field stores, to control data entry for updatable views, and to control the display of the field.

This dialog box appears when you select a field then choose the Properties button on the Fields tab of the View Designer.

Dialog Box Options

Field   Specifies the name of the selected field in the view. To set properties on other selected fields, you can choose from the drop-down list.

Field Validation Options

These options allow you to control the contents of the field.

Rule   Specifies the expression for the field-level rule that controls which values can be entered into the field.

Message   Specifies the error message displayed when the field-level rule is violated.

Default value   Specifies a quantity or string that is the content for a field when a new record is added. The default value remains in the field until you enter a new value.

Display Options

These options allow you to control how values are entered or displayed in the field.

Format   Specifies the expression for case, size, and style for display of the field in the Browse window, forms, or reports. Property settings within the form and report can override this expression.

Input Mask   Specifies the format for values as they are entered into the field. For example, telephone numbers might have a format of (999) 999-9999.

Caption   Specifies the label that appears for the field in the Browse window, forms, or reports. Property settings within the form or report can override this setting.

Map Field Type to Classes Options

If you plan to use the view field in forms, these options allow you to specify a default control type that appears when you drop the field on a form.

Display library   Specifies the class library file (.VCX) containing the control class you want to associate with the field.

Display class   Specifies the type of control that is created when the field is dropped onto a form.

Data Mapping Options

By default, the view field has the same property settings as its associated field in a table. These options are only enabled for remote views.

Data type (remote views only)   Specifies the kind of data this field can hold.

Width (remote views only)   Specifies the number of characters this field can hold.

Decimal (remote views only)   For numeric data types, specifies the number of places to the right of the decimal point this field can hold.

Comment (remote views only)   Provides space for you to type a comment about the field.


Join Tab, Query and View Designers

See Also

Specifies join conditions for matching and selecting records in one or more tables or views., such as specific values in a field or join conditions defining temporary relationships between tables. This tab determines the join conditions listed in the FROM clause of the SELECT - SQL command in the SQL window. The Filter tab appears in both the Query and View Designers.

Tab Options

Condition Button   Appears if two or more tables are joined in the query. Click the double-headed horizontal arrow to edit the selected condition or query criterion in the Join Condition dialog box, which will update entries in the other columns.

Type   Specifies the type of join condition. By default, the join type is inner. When creating a new join condition, click the field to display a drop-down list of the join types. For more information about joins, see Chapter 6, “Querying and Updating Multiple Tables,” in the User’s Guide.

•	Inner   Specifies that only the records that match the join condition are included in the results. This type is the default and most commonly used type of join.

•	Right Outer   Specifies that records that match the join condition, and records from the table on the right of the join condition that do not match, are included in the results.

•	Left Outer   Specifies that records that match the join condition, and records from the table on the left of the join condition that do not match, are included in the results.

•	Full Join   Specifies that records that match and records that do not match the join condition are included in the results. The field must match the example text, character for character.

Field Name   Specifies the first field of the join condition. When creating a new join condition, click the field to display a drop-down list of the available fields.

Not   Reverses the condition to exclude records matching the condition.

Criteria   Specifies the type of comparison. The comparison types are:

•	Equal   Specifies that the fields have the same value.

•	Like   Specifies that the field must include characters that match characters in the example text. (Customer.state Like O would match records from Ohio, Oklahoma, and Oregon.)

•	Not Like   Specifies that the field must not include the characters in the example text. (Customer.state Not Like O would not match records from Ohio, Oklahoma, and Oregon.)

•	Exactly Like(==)   Specifies that the field must match the example text, character for character.

•	Not Exactly Like(Not ==)   Specifies that the field must not match the example text, character for character.

•	Greater Than (>)   Specifies that the field must be the same or more than the value in the example text.

•	Greater Than or Equal To (>=)   Specifies that the field must be more than the value in the example text.

•	Less Than (<)   Specifies that the field must be the same or less than the value in the example text.

•	Less Than or Equal To (<=)   Specifies that the field must be less than the value in the example text.

•	Is NULL   Specifies that the field must contain a null value.

•	Is Not NULL   Specifies that the field must not contain a null value.

•	Between   Specifies that the field must be greater than or equal to the lower value, and less than or equal to the higher value, in the example text. The two values in the example text are comma-delimited. (Invoices.idate Between 05/10/92,05/12/92 would match records for the 10th, 11th, and 12th of May, 1992).

•	Not Between   Specifies that the field must not be greater than or equal to the lower value, and not less than or equal to the higher value, in the example text. The two values in the example text are comma-delineated. (Invoices.idate Not Between 05/10/92,05/12/92 would not match records for the 10th, 11th, and 12th of May, 1992).

•	In   Specifies that the field must match one of several comma-delineated examples in the example text.

•	Not In   Specifies that the field must match one of several comma-delineated examples in the example text.

Value   Specifies the other table and field in the join condition.

Logical   Adds an AND or OR condition to the join condition list.

Insert button   Inserts a blank join condition above the selected condition.

Remove button   Removes the selected condition from the query.


See Also

Fields Tab, Query and View Designer
Group By Tab, Query and View Designer
Join Condition Dialog Box
Order By Tab, Query and View Designer
Query and View Designers
SELECT - SQL Command
Update Criteria Tab, View Designer


Filter Tab, Query and View Designers

See Also

Specifies conditions for selecting records, such as specific values in a field or join conditions defining temporary relationships between tables. This tab determines the conditions listed in the WHERE clause of the SELECT - SQL command in the SQL window. The Filter tab appears in both the Query and View Designers.

Tab Options

Mover Box   Drag the mover box to move the selected item up or down within the grid.

Condition Button   Click the double-headed horizontal arrow to edit the selected filter.

Field Name   Specifies the first field of the join condition. When creating a new join condition, click the field to display a drop-down list of the available fields.

Not   Reverses the condition to exclude records matching the condition.

Criteria   Specifies the type of comparison. The comparison types are:

•	Equal   Specifies that the fields have the same value.

•	Like   Specifies that the field must include characters that match characters in the example text. (Customer.state Like O would match records from Ohio, Oklahoma, and Oregon.)

•	Not Like   Specifies that the field must not include the characters in the example text. (Customer.state Not Like O would not match records from Ohio, Oklahoma, and Oregon.)

•	Exactly Like(==)   Specifies that the field must match the example text, character for character.

•	Not Exactly Like(Not ==)   Specifies that the field must not match the example text, character for character.

•	Greater Than (>)   Specifies that the field must be the same or more than the value in the example text.

•	Greater Than or Equal To (>=)   Specifies that the field must be more than the value in the example text.

•	Less Than (<)   Specifies that the field must be less than the value in the example text.

•	Less Than or Equal To (<=)   Specifies that the field must be the same or less than the value in the example text.

•	Is NULL   Specifies that the field must contain a null value.

•	Is Not NULL   Specifies that the field must not contain a null value.

•	Between   Specifies that the field must be greater than or equal to the lower value and less than or equal to the higher value in the example text. The two values in the example text are comma-delineated. (Invoices.idate Between 05/10/92,05/12/92 would match records for the 10th, 11th, and 12th of May, 1992).

•	Not Between   Specifies that the field must not be greater than or equal to the lower value, and not less than or equal to the higher value, in the example text. The two values in the example text are comma-delineated. (Invoices.idate Not Between 05/10/92,05/12/92 would not match records for the 10th, 11th, and 12th of May, 1992).

•	In   Specifies that the field must match one of several comma-delineated examples in the example text.

•	Not In   Specifies that the field must match one of several comma-delineated examples in the example text.

Example   Specifies the comparison criterion.

Case   Specifies whether to match the case (upper or lower) of the example in your condition.

Logical   Adds an AND or OR condition to the join condition list.

Insert button   Inserts a blank join condition above the selected condition.

Remove button   Removes the selected condition from the query.


See Also

Fields Tab, Query and View Designer
Group By Tab, Query and View Designer
Join Condition Dialog Box
Order By Tab, Query and View Designer
Query and View Designers
SELECT - SQL Command
Update Criteria Tab, View Designer


Order By Tab, Query and View Designers

See Also

Specifies fields, aggregate functions such as SUM or COUNT, or other expressions used to set the order of records retrieved in the query.

If the Cross Tabulate option is selected in the Fields tab, the order field list is created automatically.

For more information, see the ORDER BY clause in the SELECT - SQL command.

Tab Options

Selected Output   Lists the selected fields and expressions that will appear in the query results.

Ordering Criteria   Specifies the fields and expressions used in the query’s sort order. The arrow that appears to the left of each field specifies an ascending (up) or descending (down) sort. A mover box appears to the left of the arrow for changing the order of the fields.

Order Options

Ascending   Sets the selected item in the Ordering Criteria box to sort in ascending order.

Descending   Sets the selected item in the Ordering Criteria box to sort in descending order.

Add   Adds the selected item in the Selected Output box to the Ordering Criteria box.

Remove   Removes the selected item from the Ordering Criteria box.


See Also

COUNT Command
Fields Tab, Query and View Designer
Filter Tab, Query and View Designer
Group By Tab
SELECT - SQL Command
SUM Command
Update Criteria Tab, View Designer


Group By Tab, Query and View Designers

See Also

Groups rows of query or view results. This tab appears in the Query and View Designers. For more information, see the GROUP BYclause in the SELECT - SQL command.

Available Fields   Lists all the available fields in the query’s or view’s tables and other expressions.

Grouped Fields   Lists the fields, aggregate functions, and other expressions for determining the grouping of the query results. Fields are grouped in the order they appear in the list. You can change the field order and the grouping hierarchy by dragging the double-headed arrow to the left of each field.

Add   Adds the selected item in the Available Fields box to the Group By Fields box.

Remove   Removes the selected item from the Group By Fields box.

Having   Displays the Having dialog box for setting selection criteria on groups rather than on individual records.


See Also

Fields Tab, Query and View Designer
Filter Tab, Query and View Designer
Having Dialog Box
Order By Tab
Query and View Designers
SELECT - SQL Command
Update Criteria Tab, View Designer


Update Criteria Tab, View Designer

See Also

Specifies conditions for sending changes in the view to the original records in the tables used in the view. This tab is only displayed in the View Designer.

Tab Options

Table   Specifies which tables used in the view can accept changes. The list shows the tables that have fields in the Selected fields list of the Fields tab. Fields tab.

Reset Key   Selects the primary key field from each table as the key fields for the view and places a check mark under the key symbol in the Field name list for each primary key field. Key fields are used for matching the changes in the view to the original record in the table.

Update All   Selects all fields other than the key fields for updating and places a check mark under the pencil symbol in the Field name list.

Send SQL Updates   Specifies whether changes to the records in the view are actually sent to the original tables.

Field Name Pane   Shows the fields that you have selected for output and, therefore, are available to update.

•	Key Field (marked with a key symbol)   Specifies whether the field is a key field.

•	Updatable (marked with a pencil symbol)   Specifies whether the field is updatable.

•	Field Name   Displays the name of the output fields available to mark as key fields or updatable.

SQL WHERE Clause Includes

Controls which fields are added to the WHERE clause to detect update conflicts on the server when the changes to the view are sent to the original tables.

A conflict is based on a comparison between the old values in the view, OLDVAL( ), and the current values in the original table, CURVAL( ). If the values are equal, the original table is considered unchanged and no conflict exists. If they are not equal, a conflict exists and the data source returns an error.

The error returned for a conflict between the old value and the current value is Error 1585 “Record has been modified by another” or Error 1494 “Update conflict. Use TABLEUPDATE() to force the update or TABLEREVERT() to rollback”.

Key Fields Only   Sets the WHERE clause to detect a conflict if a key field has been changed in the original table. Changes made by another user to any other field in the original record of the table are not compared.

Key and Updatable Fields   Sets the WHERE clause to detect a conflict if another user changed any of the fields that were updatable.

Key and Modified Fields   Sets the WHERE clause to detect a conflict if the key field or one of the modified fields in the record in the original table has changed since the view was first retrieved (default).

Key and Timestamp   Sets the WHERE clause to detect a conflict if the timestamp of the record on the original table has changed since it was first retrieved. This option is only available if the remote table has a timestamp column.

Update Using

Specifies how updates are performed on the back end server.

SQL DELETE then INSERT   Deletes the record from the original table, and then creates a new record from the modified record in the view.

SQL UPDATE   Uses the changes in the fields of the view to modify the fields in the original table.


See Also

Fields Tab, Query and View Designer
Filter Tab, Query and View Designer
Group By Tab, Query and View Designer
Order By Tab, Query and View Designer
View Designer


Miscellaneous Tab, View Designer
Miscellaneous Tab, Query and View Designers

See Also

Specifies other record selection conditions for the query or view.

Tab Options

No Duplicates   Eliminates duplicate records from the query or view results. Duplicate records are records in which every field matches.

Cross-Tabulate(Queries only)   Sends the results of the query or view to Microsoft Graph, a report, or a table in cross-tabular format.

The Cross-Tabulate option is enabled only when Selected Output contains exactly three items. These three items represent the X axis, the Y axis, and the cell value for the graph.

Note   This option automatically selects the Group and Order By fields for the query. Once selected, you can no longer modify the query unless you clear this option.

For example, you could generate a report that shows the amount billed to clients by month. You would create a graph that displays clients down the left side of the page, the twelve months across the top of the page, and, within the graph, the amount billed to each client each month.

Top

Selects a quantity or percentage of records from the result set. When specifying a number or percentage, use the Order By tab in the Query and View Designer to choose which records are at the top of the result set.

All   Specifies that all of the records selected by the query or view should be included in the results set.

Number of Records   Sets a quantity of records of the selected records to include in the results set.

Percent   Changes the number in the box above to a percentage of records.


See Also

Fields Tab, Query and View Designer
Filter Tab, Query and View Designer
Group By Tab, Query and View Designer
Order By Tab, Query and View Designer
View Designer


Report Designer

See Also

Use the Report Designer to create and modify reports. When the Report Designer window is active, Visual FoxPro displays the Report menu and the Report Controls toolbar.

To quickly create a simple report layout, choose Quick Report on the Report menu. Quick Report prompts you for input on the fields and layout you want for your report.

Window Options

Bands

By default, the Report Designer displays three bands: Page Header, Detail, and Page Footer. A separator bar is located at the bottom of each band. The name of the band type appears on the bar next to a blue arrow, which indicates that the band is above, not below, the bar.

You can add the following bands to your report.

Band	Printed	Typical Contents
Column Header	Once per column	Column title
Column Footer	Once per column	Summary, totals
Group Header	Once per group	Preface to following data
Group Footer	Once per group	Calculated values for group data
Title	Once per report	Title Date or page number Company logo Box around the title
Summary	Once per report	Grand totals Text such as Grand Totals
Ruler

The Report Designer has a vertical and horizontal ruler you use to more precisely position objects in the bands. Use the ruler in conjunction with the View menu’s Show Position command to help you position objects.

The scale for the ruler is determined by your system measurement settings. You can change from the system default scale (inches or centimeters) to pixels from within Visual FoxPro. If you want to change to the system default, change the measurement setting for your operating system.

To change the ruler scale to pixels

Change this to pixels as follows:

1	From the Format menu, choose Set Grid Scale. The Set Grid Scale dialog box is displayed.

2	In the Set Grid Scale dialog box, select Pixels and choose OK.

The ruler scale is set to pixels, and the position indicator in the status bar (if Show Position is checked on the View menu) also displays positions in pixels.


See Also

Quick Report Dialog Box
Report Controls Toolbar
Report Wizard
Set Grid Scale Dialog Box
View Menu


Table Designer

See Also

Use the Table Designer to create and modify database tables, free tables, fields, and indexes. The Table Designer helps you implement advanced features such as validation rules, default values, and default control classes.

Tab Options

•	Fields   Displays table fields in a scrollable grid.

•	Indexes   Contains a scrollable grid for defining indexes.

•	Table   Displays the information about the table and allows you to specify triggers and record-level rules.


See Also

Database Designer
Expression Builder
Index Tab, Table Designer
Table Tab, Table Designer
Table Wizard


Fields Tab, Table Designer

See Also

The Table tab displays slightly different information depending on whether you open a database table or a free table. If you are creating a database table, the Field tab includes options for setting validation rules. If you are creating a free table, the tab contains only basic field name, type, and formatting options.

The tab displays table fields in a scrollable grid. Each row contains the field’s name, data type, character width, decimal width, and support for null values. Click a cell in the grid to modify a field.

Tab Options

Mover Button   This is the double-headed arrow button at the extreme left of the row. Once you have entered two or more rows, use the mover button to move a row up or down in the list.

Name   Specifies the name of the field. Spaces are not accepted. For database tables, the length of the name can be up to 128 characters.

Type   Specifies the field’s data type. Click the drop-down arrow to select a data type from the list.

Width   Specifies the number of characters or digits the field can store.

Decimal   Specifies the number of digits to the right of the decimal point. The Decimal column applies to numeric and double data types.

Index   Specifies a regular index on the field for ordering the data.

NULL   When checked, specifies that the field can accept a null value.

Insert Button   Inserts a new field above the selected field.

Delete Button   Deletes the selected field from the table.

Field Validation

If you are modifying a database table, the Field Properties option group appears below the scrollable grid.

Properties settings for the selected field are specified in this area. Choose the dialog button to the right of each property setting to display the Expression Builder, or just type the expression directly. Entries for these options are not required.

Rule   Specifies the field-level rule for enforcing data validation.

Message   Specifies the error message to be displayed if an entry violates the field-level validation rule.

Default Value   Specifies the default value for the field.

Map Field Type to Classes

To specify a default control class, set the library and class you want to create when you drag the field onto a form.

Display Library   Specifies the path and file name for the class library. To browse for a file, use the dialog button.

Display Class   Specifies the default control class for the field.

Display

Specifies the format properties for entering and displaying the field.

Format   Specifies the expression for case, size, and style for display of the field in the Browse window, forms, or reports. Property settings within the form and report can override this expression.

Input Mask   Specifies the format for values as they are entered into the field. For example, telephone numbers might have a format of (999) 999-9999.

Caption   Specifies the label that appears for the field in the Browse window, forms, or reports. Property settings within the form or report can override this setting.

Field Comment   Provides a space to enter notes about the field.


See Also

Expression Builder
Index Tab, Table Designer
Table Wizard


Index Tab, Table Designer
Indexes Tab, Table Designer

See Also

The Index tab appears in the Table Designer. It contains a scrollable grid for defining indexes. The grid has four columns.

Tab Options

Mover button   This is the double-headed arrow button at the extreme left of the row. Once you have entered two or more rows, use the mover button to move a row up or down in the list.

Order   Specifies the sort order for the index. An up arrow indicates an ascending sort; a down arrow, descending.

Name   Specifies the index tag name for the index. The arrow button to the left of the index name specifies ascending or descending order. Select the index, and then click on the arrow button to change the order.

Type   Specifies the type of index: Primary (only if the table is contained in a database), Candidate, Unique, or Regular (the default). When you click a cell in this column, a list appears from which you can select a type. An entry is not required in this field.

Only one index in a table can be set as Primary in the Type column.

Expression   Specifies the index expression, such as a field name. Click the button to create or edit an expression in the Expression Builder. An expression can be up to 240 characters.

Filter   Specifies the filter expression. Click the button to create or edit an expression in the Expression Builder dialog box.

Insert Button   Inserts a new index above the selected index in the grid.

Delete button   Deletes the selected index from the grid.


See Also

Expression Builder
FOR( ) Function
INDEX Command
SYS(14) - Index Expression
SYS(2021) - Filtered Index
Table Designer
Table Tab, Table Designer
Table Wizard


Table Tab, Table Designer

See Also

The Table tab appears in the Table Designer. It contains read-only information about the table and areas for setting the record-level rule and validation error text, triggers, and comments.

Note   If you are modifying a Free table, only the read-only statistics for the table are displayed on this tab. Free tables cannot have associated rules, triggers, or comments.

Tab Options

Name   Specifies the name of the table being created or modified.

For database tables, the table name appears in the Project Manager; it is not the file name. Long names up to 128 characters are supported.

Database   Displays the name of the database to which the table belongs if the table is not a free table. This box is read-only.

Statistics

Displays read-only about the table.

Table file   Displays the path and file name for the table.

Records   Displays the quantity of rows currently stored in the table.

Fields   Displays the quantity of columns defined in the table structure.

Length   Displays the length of the table.

Record Validation

Sets the row-level rule, validation error text, and a comment for the table. The button to the right of each setting displays the Expression Builder.

Validation Rule   Specifies a record-level rule for enforcing data validation.

Validation Text   Specifies the error message to be displayed if an entry fails to conform to the record-level validation rule.

Triggers

Specifies rules for updates, inserts, and deletes.

INSERT Trigger   Specifies a rule to be triggered every time a record is inserted or appended to the table. Click the dialog button to display the Expression Builder.

UPDATE Trigger   Specifies a rule to be triggered every time a record is updated in the table. Click the dialog button to display the Expression Builder.

DELETE Trigger   Specifies a rule to be triggered every time a record is deleted from the table. Click the dialog button to display the Expression Builder.

Table Comment   Provides space for you to type a comment about the table. Whatever you type here appears as the description at the bottom of Project Manager when this table is selected.


See Also

Expression Builder
FOR( ) Function
INDEX Command
SYS(14) - Index Expression
SYS(2021) - Filtered Index Table Designer
Table Tab, Table Designer
Table Wizard


Distributable Files

See Also

You may distribute any Visual FoxPro file that is not restricted. Pursuant to the Microsoft License Agreement you received with this product, files must be distributed in conjunction with a corresponding application. The following guidelines apply to distributable files.

Setup Wizard

Any files in the Visual FoxPro DISTRIB.SRC and SETUP directories that are required to support a corresponding application may be distributed. When you use the Setup Wizard to create distribution disks, it automatically places the required files from these directories on the distributable disks in a compressed format. Upon installation, these file are decompressed and are installed by name in the appropriate directories on the user’s machine. It is not necessary to copy these files to your distribution tree.

Samples

Files in the Visual FoxPro SAMPLES and API\SAMPLE directories are provided for you to learn from and build on. Although you may not distribute unmodified Visual FoxPro sample applications, you may refer to portions of sample application code as examples for building your own application.

If you use any files in the Visual FoxPro SAMPLES and API\SAMPLE directories (including all .BMP, .ICO, and .CUR files), these files must be included in your project and in the application build. They must not appear by name on the distributable disks and may not be distributed independently of your applications.

Class Libraries

You can use any .VCX file without modification in your applications. The libraries must be included in your project and in your application build.

ODBC Files

Please refer to the Microsoft License Agreement you received with this product for specific restrictions with respect to your redistribution of ODBC files.

ActiveX Controls

Visual FoxPro includes a set of ActiveX controls (.OCX files) you can add to and distribute with your applications.

Note   If you install the Visual FoxPro online documentation, the MediaView 1.41 ActiveX control (MEDV141N.OCX) is installed. This ActiveX control supports browsing the online documentation only; it cannot be added to or distributed with your applications.


See Also

ActiveX Controls Overview
Restricted Files
Sample Applications
Setup Wizard


Prompt Options Dialog Box

See Also

Allows you to specify options for prompts in a customized menu system. Use this dialog box to define keyboard shortcuts, determine when the menu or menu item is disabled, include a message in the status bar when the menu or menu item is selected, specify a name for a menu title, and control menu title location during OLE visual editing.

This dialog box appears when you choose the Options button in the Menu and Shortcut designers.

Dialog Box Options

Comment   Provides space for adding a comment for personal use only. Comments do not affect generated code in any way; Visual FoxPro ignores them when running the menu program.

Shortcut

Defines the optional shortcut key for a menu or menu item. Keyboard shortcuts for Visual FoxPro menu items are a combination of the CTRL key and another key.

Key Label   Displays your key combination. If a menu item doesn’t have a keyboard shortcut, Visual FoxPro displays “(press the key)” in the Key Label box. Press the key combination you want for your shortcut key.

Key Text   Displays the text you want to appear beside the menu item. Unless you change it, this box repeats the keyboard shortcut from the Key Label box. For example, if both the Key Label and the Key Text were CTRL+R, you could change the Key Text to ^R.

Note   You cannot assign CTRL+J as a keyboard shortcut for a menu item.

Skip For   Displays the Expression Builder dialog box. In the Skip For box of the Expression Builder, type the expression that determines whether the menu or menu item is disabled or enabled. The menu or menu item is disabled if the expression is .T.

Negotiate

Specifies the location of menu titles when the user edits an OLE object in your application.

None   Specifies that the menu title not be placed on the menu bar. This is the same as not choosing any option.

Left   Specifies that the menu title be placed in the left group of menu titles on the menu bar.

Middle   Specifies that the menu title be placed in the middle group of menu titles on the menu bar.

Right   Specifies that the menu title be placed in the right group of menu titles on the menu bar.

Note   Menu negotiation options are available only for OLE objects that can be edited in place.

Message   Displays the Expression Builder dialog box. In the Message box of the Expression Builder, type the message that will appear in the Visual FoxPro status bar that describes the menu choice.

Pad Name   Allows you to specify an optional menu title. The name or number used in the generated menu program is optional, and Visual FoxPro provides one if you don’t. Using this name or number, you can reference a menu or menu item at runtime. This option is available for menus only.

Note   This option is available only if the Result area in the Menu Designer window shows Command, Submenu, or Procedure.

Bar #   Allows you to specify an optional shortcut menu title. This option is available for shortcut menus only.


See Also

Expression Builder Dialog Box
Menu Designer
PROMPT( ) Function


Having Dialog Box

See Also

Specifies conditions for selecting which groups of records to include in query output. This dialog box appears when you choose Having in the Group By tab of the Query Designer.

Dialog Box Options

Field Name   Specifies a function, field name, or other expression. Select from a list of functions, a list of field names for each table, or use the expression command to display the Expression Builder dialog box. If you choose a function, a submenu displays a list of field names available to use with that function.

Not   Reverses the comparison criterion.

Comparison Criteria   Specifies the comparison criterion. Options are Equal (=), Like, Exactly Like (==), Greater Than(>), Less Than(<), Greater Than or Equal To (>=), Less Than or Equal To (<=), Is NULL, Between, and In.

Example   Specifies the value you want the field to be compared to.

Case   Specifies whether to match case (upper or lower) of the example in your condition.

Logical   Adds an AND or OR condition in the list of conditions.

Insert   Inserts a blank row above the selected condition.

Remove   Removes the selected row from the Field Name list.


See Also

Group By
Query Designer
SELECT - SQL Command


Set Index Order Dialog Box

See Also

Sets the index order for a child table. This dialog box appears when you set the parent table of a relation in the Data Session window and then click a child table in the Aliases list of the Data Session window if the child table has no index order already set.

Dialog Box Options

Set Index Order List   Lists any pre-defined index orders which exist for the selected child table.

No Order Button   Opens the Expression Builder dialog box where you can set your own relationship for the child table. You can also double-click on a table index listed in the dialog box to open the Expression Builder dialog box.


See Also

SET INDEX Command
Window Menu


Create One-To-Many Relationships Dialog Box

See Also

Establishes a one-to-many relationship, in which the child table can contain multiple records that correspond to one record in the parent table. Corresponds to the SET SKIP command.

This dialog box appears when you choose the 1-To-Many button in the Data Session window.

The 1-To-Many button is enabled when there is at least one relation originating from the selected table.

Dialog Box Options

Child Aliases   Lists the child aliases of the parent alias, whose name is given at the top of the dialog box.

Selected Aliases   Lists aliases of all tables currently involved in a one-to-many relationship with the parent table.

Move   Copies the selected child aliases in the Child Aliases box to the Selected Aliases box. To enable this button, you must select an alias in the Child Aliases box.

All   Copies all the child aliases in the Child Aliases box to the Selected Aliases box.

Remove   Removes the selected aliases from the Selected Aliases box. To enable this button, you must select an alias in the Selected Aliases box.

Remove All   Removes all aliases from the Selected Aliases box.


See Also

Data Session Window
One-To-Many Form Wizard
SET RELATION Command
SET SKIP Command


Expression Builder
Expression Builder Dialog Box

See Also

Allows you to create and edit expressions. An expression can be as simple as a field name or as complex as a calculation involving immediate IF functions, concatenations, and data type conversions. The main purpose of the Expression Builder is to facilitate the creation of expressions by providing you with lists of appropriate options each step of the way. This dialog box can be accessed from designers, windows, builders, and wizards.

To create an expression, you can type it directly into the expression box, or you can select items from the functions drop-down lists in the dialog box to have Visual FoxPro paste them into the expression box for you.

You might find some of the following functions useful when manipulating strings in expressions.

If you want to	Use this function

c

Remove leading and trailing blanks from character expressions	ALLTRIM( )
Remove leading blanks	LTRIM( )
Remove trailing blanks	RTRIM( )
Add specified characters to the left, right, or both sides of a string	PADL( ), PADR( ), PADC( )
Work with parts of a character string for comparisons	SUBSTR( )
Use a specified number of characters starting with the left of a string	LEFT( )
Use a specified number of characters starting from the right of a string	RIGHT( )
Change uppercase to lowercase, or lowercase to uppercase	UPPER( ), LOWER( )
Convert a string to initial capitals	PROPER( )
Have a numeric field interpreted as a character string	STR( )
Dialog Box Options

Functions

Contains list boxes of four function types. When you select a function from one of the four types, Visual FoxPro automatically pastes it into the expression box. When you are building expressions for remote views, Visual FoxPro lists only the functions specific to the target back-end data.

String   Lists available character string functions.

Logical   Lists available logical functions.

Math   Lists available math functions.

Date   Lists available date and time functions.

Expression   Displays the expression that you are creating or editing.

Fields   Lists the fields in the current table or view.

To paste a field into the Expression box, either double-click the field or select the field and press ENTER.

To display fields from a different table, select a different table in the From Table box.

From Table   Lists tables and views that are open. Select a table or view to update the Fields box.

Variables   Lists system memory variables, arrays, and memory variables that you have created.

To paste a variable into the Expression box, either double-click the variable, or select the variable and press ENTER.

Verify   Validates the syntax of the expression in the expression box if the corresponding table is open. If the expression is valid, “Expression is valid” is displayed in the status bar. If it is not valid or if the corresponding table is not open, Visual FoxPro displays an error message. This option is not enabled for remote views.

Note   If you include a user-defined function call in the expression, Verify will indicate an error, but there will not necessarily be an error when the expression is evaluated at run time.

Options   Displays the Expression Builder Options dialog box, in which you can set preferences for the Expression Builder.


See Also

ALLTRIM( ) Function
Expression Builder Options Dialog Box
IIF( ) Function
LEFT( ) Function
LOWER( ) Function
LTRIM( ) Function
PADC( ) Function
PADL( ) Function
PADR( ) Function
PROPER( ) Function
RIGHT( ) Function
RTRIM( ) Function
SET ANSI Command
SET EXACT Command
STR( ) Function
SUBSTR( ) Function
UPPER( ) Function


Expression Builder Options Dialog Box

See Also

Sets preferences for the items displayed in the Expression Builder. This dialog box appears when you choose Options in the Expression Builder dialog box.

Dialog Box Options

Functions

Use these options to change what appears on the String, Math, Logical, and Date functions in the Expression Builder. You can choose to display all of these in the Expression Builder String box, or select only those you want. To select or deselect multiple items, press CTRL as you make your selections.

String   Displays all string functions in the box. All selected string functions will be displayed in the Expression Builder.

Math   Displays all math functions in the box. All selected math functions will be displayed in the Expression Builder.

Logical   Displays all logical functions in the box. All selected logical functions will be displayed in the Expression Builder.

Date   Displays all date functions in the box. All selected date functions will be displayed in the Expression Builder.

Note   Select individual items by pressing CTRL+left mouse button. Select a consecutive group of items by left-clicking the first item and pressing SHIFT +left mouse button on the last item.

All   Selects all functions in the box so that they all appear as choices in the Expression Builder.

Clear   Deselects all functions in the box so that they don’t appear as choices in the Expression Builder.

Field Aliases

These options specify whether and how table or view aliases appear in your expressions.

Always Add Alias   Specifies that the table or view name is always included with fields used in the expression.

Add Non-Selected Alias Only   Specifies that when more than one table or view is open, Visual FoxPro only includes the name of any table or view that is not selected in the Aliases list of the Data Session window with any of its fields in the expression. Table or view names are not added for tables that are selected in the Aliases list.

Never Add Alias   Specifies that table or view names are not included with any field when you create the expression.

Show System Memory Variables   Specifies whether system memory variables are displayed in the Expression Builder. Turn this option off if you want to see only the system memory variables that have been defined.


See Also

Data Session Window
Expression Builder


Visual FoxPro Converter Dialog Box

See Also

Converts FoxPro 2.6 .and Visual FoxPro 3.0 files to Visual FoxPro 5.0. This dialog box appears when you choose Open from the File menu and select a file created in a previous version of FoxPro, or when you type MODIFY PROJECT, MODIFY FORM, MODIFY REPORT, or MODIFY LABEL filename in the Command window and select a file created in a previous version of FoxPro from the Open dialog box.

Dialog Box Options

Convert Both Macintosh and Windows Form Records   Only visible if converting FoxPro 2.6 screens or projects that contain platform-specific controls or information (such as references to screen fonts or paths). If you check this option, the converter creates a separate form for each platform. The Windows version of the form will have the original name, and the Macintosh version will have the original name with the suffix "_MAC" added. If the original screen was part of a project, the new project would be updated to include both new forms.

Retain Visual FoxPro 3.0 default property values   Only visible if converting Visual FoxPro 3.0 forms or projects. Visual FoxPro 5.0 default property settings for fonts and colors are Windows 95 compliant and sometimes different from Visual FoxPro 3.0 settings. If you check this option, your converted forms will retain the Visual FoxPro 3.0 property settings.

Backup files   Allows you to specify a directory for backup files to be saved in.

Create log file   Allows you to save a list of the actions performed while converting your files.

Functional Conversion   Only visible if converting FoxPro 2.6 screens or projects. Creates form and control images and copies code to locations in object properties, events, and methods. Functional conversion provides immediate FoxPro 2.6 READ compatibility so you can use forms in Visual FoxPro without making extensive manual changes. To gain complete event model functionality, you must eliminate pages and page frames, change the form set WindowType property, and manually relocate code in methods and events.

Visual Conversion   Only visible if converting FoxPro 2.6 screens or projects. Creates images of forms and all controls, but copies all the code from the original FoxPro 2.6 project or screens to a non-compilable .PRG file. Choose Visual Conversion if you want to move to full Visual FoxPro functionality without having to eliminate pages and page frames, change the form set WindowType property, and manually relocate code from object to object.

Continue   Displays the Visual FoxPro Transporter dialog box, which allows you to complete the file conversion process.


See Also

Checking Converted FoxPro 2.6 Screens
Command Window
Converting FoxPro 2.6 Files
Converting FoxPro 2.6 Label Files
Converting FoxPro 2.6 Projects
Converting FoxPro 2.6 Reports
Converting FoxPro 2.6 Screens
MODIFY FORM Command
MODIFY LABEL Command
MODIFY PROJECT Command
MODIFY REPORT Command
WindowType Property


Visual FoxPro Transporter Dialog Box

See Also

Allows you to transport forms, labels, and reports across different FoxPro platforms and versions. This dialog box only appears if you are trying to convert Macintosh or MS-DOS files which have never contained Windows records. The Transporter creates Windows platform records from the Macintosh or MS-DOS records so that the Converter can then convert the files to the Visual FoxPro 5.0 file format. The Converter calls the Visual FoxPro Transporter dialog box when you click the Continue button in the Visual FoxPro Converter dialog box.

Dialog Box Options

Transport   Creates a Windows version of the Macintosh or MS-DOS records so that the Visual FoxPro Converter will recognize the file and convert the file to the correct file format.

Don’t Transport   Cancels the file transport and conversion process. You can still open the file in the older version of FoxPro.

Font   Opens the Font dialog box so you can choose the default font for your transported screen, report or label.

Transport Objects From   Allows you to choose the appropriate platform from the drop-down list.


See Also

Converting From Other Versions of FoxPro
_TRANSPORT System Memory Variable
Visual FoxPro Converter


Locate Database Dialog Box

Allows you to locate or ignore a missing table or view.

This dialog box appears when you open or run a form and Visual FoxPro is unable to locate a table or view in the data environment of the form.

Dialog Box Options

Locate   Displays the Open dialog box, so you can find the table or view.

Ignore   Visual FoxPro will continue to load the form without instantiating the cursor object in data environment. If there are controls bound to fields in the table or view, additional errors will be generated.

Cancel   Visual FoxPro will stop loading the form.

Help   Displays Help on the dialog box.


Error 1815
"cursor" must be created with SELECT ... INTO TABLE (Error 1815)

You have tried to use a repackaged cursor as a source for another SELECT statement.

•	Some cursors cannot be used in successive queries.

Use the INTO TABLE clause of the SELECT - SQL statement instead.


Error 1832
"field | variable" is not unique and must be qualified (Error 1832)

You have referenced a field that exists in more than one table.

For example, if you use the TESTDATA database and issue the following command, the same error occurs because the cust_id field exists in both the customer and orders tables:

SELECT cust_id FROM customer,orders

•	To work around the non-uniqueness of field names, issue the following command:

SELECT customer.cust_id FROM customer,orders

For more information, see SELECT - SQL.


Error 1165
"field" is not related to the current work area (Error 1165)

You have issued a command that requires a relation in order to exist.

For example, issuing SET SKIP TO prior to the relation being established would generate this error.

•	Issue SET RELATION prior to issuing the command that failed.


Error 1196
"file" is not a Visual FoxPro .EXE file (Error 1196)

The .EXE file you specified was not created by Visual FoxPro.

•	Use RUN | ! to run external executable files.


Error 1309
"file" is not an object file (Error 1309)

An attempt was made to load a compiled Visual FoxPro program that doesn’t have a proper header.

•	Verify the name of the file you are trying to run using DO.


Error 1298
"name" band is too large to fit on page (Error 1298)

You have attempted to use a report band that is too large to fit on a page.

•	Redesign your report form and try this operation again.

For more information, see Report Designer.


Error 1929
"name" can only be used within a method (Error 1929)

One of the following commands was used outside of a method: THIS, THISFORM, or THISFORMSET.

•	You used the statement in a procedure, but it can only be used within a method.

Move the THIS, THISFORM, or THISFORMSET command into the appropriate method.


Error 1932
"name" cannot be closed while suspended (Error 1932)

•	Issue either RESUME or CANCEL for the stored procedure before re-attempting this operation.


Error 1462
"name" internal consistency error (Error 1462)

Internal product error. Visual FoxPro closes all open files and exits.

•	Visual FoxPro cannot reconcile two opposing internal states in the product.

Record your recent actions while using Visual FoxPro and then call Microsoft Support.


Error 1737
"name" is a method, event, or object (Error 1737)

name cannot store a value because it is not a property

•	Only properties can store values.

Verify the property names for the object you are working with (see its Help topic), and then use one of the existing properties or define your own in the New Property dialog box.


Error 1740
"name" is a read-only property (Error 1740)

Read-only properties cannot store values.

•	Only writable properties can store values.

Verify the property names and attributes for the object you are working with (see its Help topic), and then use one of the existing writable properties or define your own in the New Property dialog box.


Error 226
"name" is not a file variable (Error 226)

A variable or an array was used where a file variable (table field) is required. For more information, see Fields, or Working with Fields and Records.


Error 225
"name" is not a variable (Error 225)

A file variable (table field) was used where a variable or array is required. For more information, see Variables, Arrays, or Working with Arrays.


Error 1294
"name" is not a valid resource file (Error 1294)

A resource file is corrupted. By default, your resource file is FOXUSER (FOXUSER.DBF and FOXUSER.FPT).

•	FOXUSER.DBF, FOXUSER.FPT, or one of your default resource files is corrupted.

Restore your resource files from backup, or exit Visual FoxPro, delete the resource files, and then restart Visual FoxPro.

To check your default resource file, see the File Locations tab of the Options dialog box or use the SET RESOURCE command.


Error 232
"name" is not an array (Error 232)

A variable or file variable (table field) was used where an array is required. For more information, see Variables, Fields, or Working with Fields and Records.


Error 1924
"name" is not an object (Error 1924)

This name was previously defined as something other than an object.

•	You have another occurrence of name.

Check your code for duplicate instances of name.


Error 1983
"name" objects cannot return a value (Error 1983)

The root object of the form stores the return value from its Unload event with the TO clause of the DO FORM command.

•	Only Form and FormSet objects can return values.

Make sure the root object is a form or a form set.


Error 1130
"field" phrase is not found (Error 1130)

The field specified in PROMPT field was not found.

•	You are using a command with a PROMPT clause that references an unknown field.

For more information, type PROMPT in the Index tab of the Help file and select the command you are using.


Error 1429
"OLE error" (Error 1429)

The OLE server is transmitting an error to Visual FoxPro.

•	This error text was passed to Visual FoxPro from the OLE server.

For more information, see the appropriate OLE documentation.


Error 78
** or ^ domain error (Error 78)

Negative numbers can only be raised to integer values.

•	The exponentiation operator cannot accept fractional values for negative numbers.

Use an integer exponent.


Error *bad date*
*bad date*

The date expression is invalid.


Error *Interrupted*
*Interrupted*

Program execution has been halted temporarily.

•	You pressed the ESC key.

Choose Cancel, Suspend, or Ignore from the error dialog box.


Error 1550
.DBC internal consistency error (Error 1550)

An internal database error has occurred.

•	The database is corrupt.

Try VALIDATE DATABASE to diagnose or repair the problem.

•	The database container index (.DCX) is corrupt or not synchronized with the database container file (.DBC), usually as a result of an abnormal system shut-down.

Rebuild the index by closing the database, deleting the index file dbc_name.DCX, and reopening the database.

If the problem is not corrected, record your recent actions while using Visual FoxPro and then call Microsoft Support.


Error 115
.DIF file header is invalid (Error 115)

The .DIF file header is incorrect.


Error 117
.DIF type indicator is invalid (Error 117)

The .DIF file has an invalid data type indicator.


Error 116
.DIF vector is invalid - .DBF field mismatch (Error 116)

The .DIF file you have attempted to import has an internal conflict between its header and its data.


Error 120
.SYLK file dimension bounds are invalid (Error 120)

The file you have attempted to import is indicating invalid rows or columns.


Error 121
.SYLK file format is invalid (Error 121)

The file you have attempted to import is not in a valid SYLK file format.


Error 119
.SYLK file header is invalid (Error 119)

The file header of the file you have attempted to import has an incorrect SYLK file header.


Error 1727
A .DBF-style Help file is required (Error 1727)

SET HELPFILTER works only with a .DBF-style help file.


Error 1771
A member object with this name already exists (Error 1771)

You tried to add a member object to a container that already has a member with the same name.

•	Member objects must have unique names within a given container.

Review your member names.


Error 1538
A stored procedure is executing (Error 1538)

You have attempted to recompile or unload stored procedures (for example, MODIFY PROCEDURE or CLOSE DATABASES) while in the middle of executing a stored procedure. This is an invalid operation.


Error 1961
A subdirectory or file "name" already exists (Error 1961)

You have chosen a name that already exists.


Error 1889
A table in multiple relationships can only have one child order (Error 1889)

You have specified more than one child order for a table in multiple relationships. This operation is not allowed.


Error 13
Alias is not found (Error 13)

You have attempted to specify an alias that has not been defined. There is no such alias currently in use.


Error 24
Alias name is already in use (Error 24)

You have attempted to use a table with an alias that is associated with another table already in use.


Error 103
Allowed DO nesting level exceeded (Error 103)

The DO command limits nesting to 128 levels.


Error 1870
ALTER TABLE operation interrupted (Error 1870)

You have interrupted the ALTER TABLE command during the copying of records to the new record format. Some data might not have been copied. Verify the data.


Error 1211
An IF | ELSE | ENDIF statement is missing (Error 1211)

See the IF ... ENDIF topic for details on executing commands conditionally.


Error 1781
An object’s control source cannot be set to its Value property (Error 1781)

You have attempted to set a control source of an object to itself. Use a valid data source. For more information about setting up data sources, see “Setting up an ODBC Data Source” in Chapter 1, “Installing Visual FoxPro,” of the Installation Guide and Master Index.


Error 1098
API function _UserError( ) was called (Error 1098)

A user-supplied error string was displayed.


Error 1726
API library is not found (Error 1726)

You have attempted to issue SET LIBRARY TO or RELEASE LIBRARY, but the library you have specified cannot be found.


Error 1711
API library revision mismatch.  Rebuild library (Error 1711)

The API library you are using does not match your version of Visual FoxPro.

•	You are using an older version of an .FLL file.

Rebuild the .FLL file, or obtain an updated version.

•	The ActiveX control calling the Visual FoxPro API is out of date.

Rebuild the ActiveX control or obtain an updated version.

For more information, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


Error 1178
Application file "file" is not closed (Error 1178)

Visual FoxPro was attempting to build an application while a file in the application was already open.

•	All files in the application must be closed before you can build it.

Close the file and rebuild the application.


Application object not initialized
Application object not initialized (Error 1936)

The Automation server or type library is not registered correctly.

•	Your registry file is corrupted.

Remove the registry entry.


Error 1972
Array "name" is in use (Error 1972)

An object attempted to resize the array that contains it.


Error 230
Array dimensions are invalid (Error 230)

Arrays must have more than 0 and fewer than 65,000 elements.

•	You used an illegal value when you declared the array.

Use a valid number for the rows and columns of an array. For more information, see DIMENSION.


Error 1764
Array is not a member of the parent object (Error 1764)

Check your array references.


Error 1974
Arrays cannot be assigned to array elements (Error 1974)

Check your assignment names.


Error 1542
Base table fields have been changed and no longer match view fields. View field properties cannot be set (Error 1542)

The name or number of columns in the base table or base view of a view definition have been changed and no longer match the view definition.

•	View properties cannot be loaded into the view cursor.

Recreate or modify the view to reflect the structure changes in any base tables/views.


Error 1590
BEGIN TRANSACTION command failed.  Nesting level is too deep (Error 1590)

Transactions may only be nested 5 levels deep.

•	You must end a transaction before another transaction can begin.

Call END TRANSACTION or ROLLBACK first.


Error 38
Beginning of file encountered (Error 38)

The record pointer is at the beginning of the file.

•	You have attempted to position the record pointer before the first record in the file.

Use BOF( ) to test for the beginning of the file.


Error 227
Box dimensions are invalid (Error 227)

Row 2, column 2 must be larger than row 1, column 1 when using the @ ... BOX command.


Error 1164
Browse structure has changed (Error 1164)

The structure of a Browse window was changed by a Browse validation routine.


Error 1163
Browse table is closed (Error 1163)

A Browse window was closed by a Browse validation routine.


Error 1651
CANCEL or SUSPEND is not allowed (Error 1651)

The dBASE IV report or label file you are running calls a SUSPEND. This is not a valid operation in Visual FoxPro.


Error 62
Cannot access characters beyond string (Error 62)

You have attempted  to access characters beyond the last byte of a string variable or table field.


Error 1106
Cannot access file; transaction is in progress (Error 1106)

A table, index or memo file cannot be accessed because another user has started a transaction that is not yet complete. FLOCK( ) and RLOCK( ) normally do not prevent other users from reading the locked information. This message, which scrolls from left to right to indicate that Visual FoxPro is still active, provides compatibility with the Novell transaction tracking system (TTS).


Error 1152
Cannot access the selected table (Error 1152)

You have attempted to select a table outside the 32K work area range or are attempting to reference a file variable in a table that is not open.


Error 1421
Cannot activate the OLE server (Error 1421)

The object cannot be activated.

•	The object is static.

Link the object to a file.

•	The OLE server cannot be accessed.

Make sure the server application is installed and accessible. Also, make sure there is enough memory to launch the application.


Error 1741
Cannot add "name".  Class definition is cyclical (Error 1741)

You have attempted to specify a class in an ADD OBJECT statement whose class definition is the same as the class being defined. For more information, see DEFINE CLASS.


Error 1755
Cannot add an object to this class (Error 1755)

If a class is based on the Control base class, you can only add an object to it if its immediate parent is the CONTROLS class.


Error 1769
Cannot add this object to a Column (Error 1769)

The grid column does not support objects such as forms, form sets, toolbars, and columns.

•	You used the AddObject method on the grid column.

Use AddObject only for objects that are reasonably represented in a column. If you would like the appearance of a form in the column, save the contents of the form to a container class and add it to the column.


Error 1768
Cannot add this object to a Grid (Error 1768)

You have attempted to execute the Grid.AddObject method to add an object other than a column to the grid.

•	You are trying to add an object to a column, rather than adding a column to the grid.

To add an object to a column, use the Grid.Column syntax with the AddObject method.


Error 1537
Cannot add this table: it belongs to database "name" (Error 1537)

The operation you have attempted is supported only for free tables. Try again with a file of the correct type: a .DBF file that does not belong to a database.


Error Cannot allocate screen map.
Cannot allocate screen map

There was not enough memory to run Visual FoxPro.


Error 1672
Cannot append from password protected file (Error 1672)

The file you have attempted to append is encrypted.


Error 1795
Cannot arrange an untransported form (Error 1795)

When you move screens between different FoxPro 2.x platforms, you must transport the screens with the Transporter (TRANSPRT.PRG) before they can be arranged.


Error 1952
Cannot base a view on itself (Error 1952)

You have attempted to modify a view in the View Designer by selecting Add, and then selecting the view being modified as a base view from the dialog box. This is not a valid operation.


Error 2002
Cannot build a DLL without OLE public classes (Error 2002)

The BUILD DLL command requires that OLE public classes be defined.

•	You chose the wrong option from the Build Options dialog box.

Choose another action, such as Build Application.

•	No OLE public classes are defined.

Define one or more OLE public classes. For more information, see the Class Info dialog box or the OLEPUBLIC clause of the DEFINE CLASS command.


Error 1689
Cannot build without a main program (Error 1689)

The main program in the specified project cannot be found or has not been set.

•	Projects must have a main program.

For more information, see Set Main on the Project menu.


Error 2012
Cannot call SetFocus from within a When, Valid, RangeHigh or RangeLow event (Error 2012)

The SetFocus method conflicts with these events, which are testing to see if the object can get or lose focus.

•	You are calling SetFocus from a When event.

Call SetFocus from the GotFocus event instead.

•	You are calling SetFocus from a Valid, RangeHigh, or RangeLow event.

Call SetFocus from the LostFocus event instead.


Error 1573
Cannot change modality of a visible form (Error 1573)

The nStyle parameter of the Show method cannot be changed while a form is visible.

•	You are calling a form's Show method with a parameter while the form is visible.

Change the modality of the form while it is not visible by using code similar to the following:

Form1.Hide

Form1.Show(nStyle)


Error 1758
Cannot change property "name" in SetAll method (Error 1758)

The Name and TabIndex properties must have unique values and cannot be set with the SetAll method.


Error 1770
Cannot clear a class that is in use (Error 1770)

You have attempted to delete a class from a .VCX library file while that class definition was in use.

•	You used the REMOVE CLASS command, the OVERWRITE clause of the ADD CLASS command, or the RENAME CLASS command.

Issue CLEAR ALL to remove all references to the class and try again.


Error 176
Cannot clear a menu that is in use (Error 176)

You have attempted to clear an active menu.

•	The CLEAR MENU and RELEASE MENU commands cannot be applied to active menus.

Use DEACTIVATE MENU before clearing or releasing the menu.


Error 177
Cannot clear a popup that is in use (Error 177)

You have attempted to clear an active menu.

•	The CLEAR POPUP and RELEASE POPUP commands cannot be applied to active menus.

Use DEACTIVATE POPUP before clearing or releasing the menu.


Error 1951
Cannot clear the object in use (Error 1951)

Method or event code for that object is currently running.

•	You attempted to remove class definitions from memory with the CLEAR ALL command.

Interrupt the running code or wait until it completes before clearing memory.


Error 1546
Cannot close table during execution of a table-bound expression (Error 1546)

Do not attempt to close tables during this operation.


Error 1535
Cannot close this database because it is being used by a project (Error 1535)

You have attempted to close a database container that a project is using to display data.

•	The database must remain open while the project is open.

Leave the database open, or close the project.


Error 1971
Cannot compile until the current COMPILE command has completed (Error 1971)

You have attempted to compile code while another compilation was in progress. The compiler can complete only one thing at a time.


Error 102
Cannot create file "file" (Error 102)

The operating system cannot create this file.

•	The disk or directory is full.

Remove files and try again.

•	You do not have access to the target directory.

Check your permission level.

•	You specified an invalid file name.

Check for typing mistakes.


Error 1102
Cannot create file (Error 1102)

The operating system cannot create this file.

•	The disk or directory is full.

Remove files and try again.

•	You do not have access to the target directory.

Check your permission level.

•	You specified an invalid file name.

Check for typing mistakes.


Error 2019
Cannot create offline view on a currently modified view (Error 2019)

CREATEOFFLINE is not a valid operation.

•	You are modifying the view in the View Designer.

Close the view and try CREATEOFFLINE again.


Error Cannot create program workspace.
Cannot create program workspace.

Visual FoxPro was not able to create enough workspace at startup.

•	The disk or directory is full.

Remove files and try again.

•	You do not have access to the target directory.

Check your permission level.


Error 169
Cannot define menu item (Error 169)

You have attempted to add a menu bar to a menu item that was defined with files or structure.


Error 1572
Cannot delete a database object while it is open in a designer (Error 1572)

A view or connection is open in a designer.

•	You tried to delete the view or connection in the Command window or from the Database Designer.

Close the View Designer or the Connection Designer first.


Error 1307
Cannot divide by 0 (Error 1307)

You specified 0 (zero) as the second argument in the MOD( ) function.


Error 1871
Cannot DROP all existing columns (Error 1871)

An existing table must have at least one column.


Error 1754
Cannot find entry point "name" in the DLL (Error 1754)

The dynamic link library (DLL) entry point that you have declared is invalid. Check both the name of the entry point and the name of the DLL.


Error 1562
Cannot find object "name" in the database (Error 1562)

A reference has been made to a database object that cannot be found in the database. Use DISPLAY DATABASE or LIST DATABASE to confirm the names of the existing database objects.


Error Cannot find spell check program.
Cannot find spell check program.

The spelling check program cannot be found.

•	The _SPELLCHK system variable does not contain a valid file name.

Verify the value of _SPELLCHK.


Error Cannot find the beautify program
Cannot find the beautify program.

Visual FoxPro cannot find the program called BEAUTIFY.APP because the program was either deleted, renamed, or moved out of the main Visual FoxPro directory. You can:

•	Run Visual FoxPro Setup to install BEAUTIFY.APP.


Error 1944
Cannot find the builder program (Error 1944)

The builder application cannot be found.

•	The _BUILDER system variable does not contain a valid file name.

Verify the value of _BUILDER.


Error 1798
Cannot find the converter program (Error 1798)

The converter application cannot be found.

•	The _CONVERTER system variable does not contain a valid file name.

Verify the value of _CONVERTER.


Error 1693
Cannot find the menu-generation program (Error 1693)

The programs that create menus and screens (GENMENU and GENSCRN, respectively) cannot be located.


Error 1791
Cannot find the text generation program (Error 1791)

The program that generates text versions of binary files for source control cannot be located.

•	The _SCCTEXT system variable does not contain a valid file name.

Verify the value of _SCCTEXT.


Error Cannot find the spell check program
Cannot find the spell check program.

Visual FoxPro cannot find the program called SPELLCHK.APP because the program was either deleted, renamed, or moved out of the main Visual FoxPro directory. You can:

•	Run Visual FoxPro Setup to install SPELLCHK.APP.


Error Cannot find the wizard program
Cannot find the wizard program.

Visual FoxPro cannot find the program called WIZARD.APP because the program was either deleted, renamed, or moved out of the main Visual FoxPro directory. You can:

•	Run Visual FoxPro Setup to install WIZARD.APP.


Error 1563
Cannot find view "name" in the current database (Error 1563)

The name you have specified is not the name of a view in the current database. Check that the name entered is correct and that the current database is the required database. Use DISPLAY VIEWS or LIST VIEWS to confirm the names of the existing database views.

If the view name is in the list, the .DBC index might be corrupted.

To rebuild the index

1	Close the database.

2	Delete the index file (database_name.DCX).

3	Re-open the database.

4	Re-create the index.


Error 1846
Cannot GROUP by aggregate field (Error 1846)

You have attempted to use an aggregate function (MIN( ), MAX( ), SUM( ), AVG( ), COUNT( ), NPV( ), STD( ) or VAR( )) in a GROUP clause.


Error 1671
Cannot import from password-protected file (Error 1671)

The file you have attempted to import is encrypted.


Error 1547
Cannot insert an empty row from a view into its base table(s) (Error 1547)

While a view is updating, a new empty record (with no modified fields) is being inserted into one of the base tables of the view.

Make sure each record inserted from a view into a base table has at least one field that has been modified in the view prior to the view update.


Error 1566
Cannot issue the PACK command on a database while its objects have open cursors (Error 1566)

Close all database tables before issuing the PACK command.


Error 1720
Cannot issue the SET FORMAT command while a READ command is in progress on a format file (Error 1720)

The format file you have specified calls upon a format file currently in use.


Error 1753
Cannot load 32-bit DLL "name" (Error 1753)

The dynamic link library (DLL) file is missing or invalid.


Error 1527
Cannot locate ODBC library, ODBC32.DLL (Error 1527)

The file ODBC32.DLL cannot be found.

•	This file must be in the current path to use connectivity features.

If the file is not on your system, reinstall the ODBC component of Visual FoxPro. If present, copy the file to your default system directory.


Error 1412
Cannot locate the COMSPEC environment variable (Error 1412)

Visual FoxPro can’t find an environment variable it needs. This error usually occurs when you try to run Visual FoxPro from within another program and MS-DOS environment variables are passed improperly.


Error 2006
Cannot locate your Web browser (Error 2006)

Visual FoxPro could not run the Web START command for the Web location you chose.

•	There is no Web browser available on your machine.

Install (or re-install) a Web browser.


Error 1731
Cannot modify a base class (Error 1731)

You have attempted to modify a Visual FoxPro base class.

To make modifications, you must first define your own subclass based on the Visual FoxPro base class.


Error 1948
Cannot modify a class that is in use (Error 1948)

You have attempted to modify a class that is currently in use.

Use CLEAR CLASS to release the class definition from memory and try again.


Error 1844
Cannot nest aggregate functions (Error 1844)

Nesting of the aggregate functions MIN( ), MAX( ), and/or the CALCULATE command sub functions: AVG( ), CNT( ), MAX( ), MIN( ), NPV( ), STD( ), SUM( ), or VAR( ), is not permitted.


Error 1926
Cannot nest class definitions (Error 1926)

A class definition cannot contain another class definition.


Error 1254
Cannot nest key labels (Error 1254)

You cannot nest key labels.


Error 1337
Cannot nest the PRINTJOB command (Error 1337)

After encountering a PRINTJOB command, an ENDPRINTJOB command was not found before another PRINTJOB command was encountered.


Error Cannot open configuration file.
Cannot open configuration file.

Visual FoxPro found a configuration file but did not have the proper rights to open it.


Error 101
Cannot open file (Error 101)

Visual FoxPro cannot open the file you are requesting. The file might be locked by another user on a network.


Error 2013
Cannot open persistent table buffer directly (Error 2013)

The change buffer (.TBF) file for an offline view cannot be opened directly.

Only the .DBF file corresponding to the offline view can be opened.


Error 1930
Cannot redefine "name" (Error 1930)

You have tried to assign a value to THIS, THISFORM, THISFORMSET, or a reserved system variable. For more information, see Reserved Words.


Error 174
Cannot redefine a menu that is in use (Error 174)

You have attempted to issue a DEFINE MENU command while the menu is active in memory.

Issue a DEACTIVATE MENU command first.


Error 175
Cannot redefine popup that is in use (Error 175)

You have attempted to issue a DEFINE POPUP command while the menu is active in memory.

Issue a DEACTIVATE POPUP command first.


Error 170
Cannot release menu item (Error 170)

You have attempted to release a prompt that was defined with files or structure.


Error 1253
Cannot rename the current directory (Error 1253)

The directory you have flagged in the Filer could not be renamed.


Error 1153
Cannot rename the file to different device (Error 1153)

To move the file to another drive, use COPY FILE.


Error 1970
Cannot reopen project file "name" (Error 1970)

Visual FoxPro attempted to open the project you left open in the previous session.

•	The project no longer exists. If the project exists but cannot be opened, it might be corrupted.

Locate a valid project, or ignore the message.


Error 1976
Cannot resolve backlink (Error 1976)

Visual FoxPro was unable to successfully match a table with its database.

Use VALIDATE DATABASE to verify the links in the database.


Error 2017
Cannot reuse offline view in different mode (Error 2017)

Offline views can only be opened in the mode they were originally created.

•	You opened an offline view online inside a transaction and then attempted to open it offline.


Error Cannot run on MS-DOS before version 3.0.
Cannot run on MS-DOS before version 3.0.

Loaders and compact .EXE files cannot run on MS-DOS version 3.0 or earlier.


Error 1191
Cannot save form: an object has an invalid name (Error 1191)

Objects must be named correctly before the form can be saved.

•	One or more object names are set to the empty string.

Search for Name properties set to "".


Error 1706
Cannot sort .IDX files in descending order (Error 1706)

.IDX index files do not support a DESCENDING clause.


Error 1909
Cannot update project from project metafile (Error 1909)

There is a conflict in the project metafile (.PJM file).

•	You edited the .PJM file directly.

Restore the file to a previous version and use the interface to make changes: undo the checkout of the .PJM file and update the project list.

•	There is a conflict in the project information section of the .PJM file.

Resolve the conflict by removing complete lines only, if possible.

•	The formatting in the project metafile is incorrect.

For example, some information has an unexpected data type, or commas are misplaced.


Error 111
Cannot update the cursor (Error 111)

You have attempted to write to a file that was created or accessed for read-only purposes.


Error 1157
Cannot update the file (Error 1157)

There was a critical error while writing to disk, such as lack of disk space or read/write failure.


Error 292
Cannot use 0 or negative as the argument for LOG10( ) (Error 292)

A zero or a negative number has been used as the argument for a base-10 logarithm. For more information, see LOG10( ).


Error 1979
Cannot visually modify a class based on a nonvisual class (Error 1979)

You have attempted to modify a class that was defined in a program. You must use the Class Designer to modify classes based on base classes or classes defined in .VCX files.


Error 1978
Cannot visually modify a class of this type (Error 1978)

You have attempted to create a class based on one of the Cursor, DataEnvironment, Page, Column, Header, or Relation base classes. You cannot visually modify any of these base class types.


Error 1502
Cannot write to the record because it is in use (Error 1502)

Visual FoxPro could not write to the selected record because it is in use.


Error 1761
Class "name" already exists (Error 1761)

The ADD CLASS or RENAME CLASS command was issued with a class name that already exists in the class library.


Error 1434
Class "name" has not been registered (Error 1434)

You have attempted to use a form that contains an OLE object whose server has not been installed on the current machine.


Error 1776
Class "name" is in use (Error 1776)

The class specified with the SaveAsClass method already exists and is in use elsewhere.

Issue CLEAR ALL to free the class and allow it to be overwritten.


Error 1752
Class "name" is in use by MODIFY CLASS (Error 1752)

You have attempted to use a class that is currently being edited in the Class Designer.


Error 1576
Class "name" is not found in the class library (Error 1576)

The class you have specified cannot be found.

Make sure you are using the correct class name.


Error 1762
Class "name" is not found (Error 1762)

The REMOVE CLASS command specified a class name that does not exist in the class library.


Error 1313
Class creation canceled (Error 1313)

While attempting to create a class based on an ActiveX control, you canceled the dialog box.


Error 1733
Class definition "name" is not found (Error 1733)

The class definition specified in a CREATEOBJECT( ) function cannot be located.


Error 1950
Class definition "name" is recursive (Error 1950)

You have attempted to create an instance of one class that depends on another class that depends on the first class.


Error 1747
Class file "name" is invalid (Error 1747)

The visual class library (.VCX) file is corrupt and must be restored from a backup file or recreated.


Error 1746
Class file name for "name" is not valid (Error 1746)

A class stored in a visual class library (.VCX) file, based on a class that is also stored in a .VCX file, has been given a name that exceeds the maximum allowable file name length.


Error 1751
Class file version is greater than the current version (Error 1751)

You have attempted to use a visual class library (.VCX) file that was created by a later version of Visual FoxPro than the version you are currently using.


Error 1993
Class library file "name" is not found (Error 1993)

The visual class library (.VCX) file specified in the RELEASE CLASSLIB or CLEAR CLASSLIB command is not in the SET CLASSLIB list.


Error 1949
Class name is invalid (Error 1949)

The class name you have specified is not valid or does not exist.


Error 1914
Code page number is invalid (Error 1914)

The code page number you have specified (related to the country and language being used) is not valid for this version of Visual FoxPro. Verify that the code page number is correct. Localized versions can have support for additional code pages in the optional .INT file.


Error 1915
Collating sequence "name" is not found (Error 1915)

The collating sequence you have assigned with SET COLLATE is invalid.


Error 1728
Color scheme is reserved (Error 1728)

Color schemes are included for backward compatibility only. Color schemes 13 through 16 are reserved. User-defined color schemes are numbers 17 through 24.


Error 1642
Color set resource is not found (Error 1642)

You have attempted to SET COLOR SET TO a color set not found in the current resource file. Verify the current resource file with SYS(2005).


Error 223
Column number must be between 0 and 255 (Error 223)

The printer column number specified is out of range.


Error 1657
Column number must be between 0 and the right margin (Error 1657)

There was an attempt to set the _PCOLNO system variable to an invalid number. This system variable is included for backward compatibility. For better results in the current version, use the Report Designer.


Error 1695
COLUMN | FORM | ALIAS | NOOVERWRITE | WIDTH are only allowed with the FROM clause (Error 1695)

These options are available only when you create a quick report with the FROM clause.


Error 1698
COLUMN | ROW | ALIAS | NOOVERWRITE | SIZE | SCREEN are only allowed with the FROM clause (Error 1698)

These options are available only when you create a quick screen with the FROM clause.


Error 1579
Command cannot be issued on a table with cursors in table buffering mode (Error 1579)

Change the buffering mode to a non-table mode before executing this command.


Error 1593
Command cannot be issued within a transaction (Error 1593)

You must end all open transactions with END TRANSACTION or ROLLBACK before issuing this command. Visual FoxPro won’t allow anything that modifies a database (.DBC) to be part of a transaction. The following commands are illegal within a transaction:

•	CLEAR ALL

•	CLOSE ALL

•	CLOSE DATABASE

•	CLOSE TABLES

•	COPY INDEXES

•	CREATE / DELETE / MODIFY DATABASE

•	CREATE / DELETE / MODIFY VIEW

•	CREATE / DELETE TRIGGER

•	CREATE / DELETE / MODIFY CONNECTION

•	APPEND / MODIFY / COPY PROCEDURES

The following commands are not legal for transaction-participating tables:

•	ALTER TABLE

•	CREATE TABLE (of a table in a database container)

•	DELETE TAG

•	INDEX ON

•	INSERT (non-SQL)

•	MODIFY STRUCTURE

•	PACK

•	TABLEREVERT( )

•	Turning off table buffering (by changing the Buffering property from 3 or 5 to 1, 2, or 4 with the CURSORETPROP( ) function).

•	Closing a table (by issuing the USE command in the work area of a transaction-participating table)

•	ZAP


Error 1220
Command contains invalid character (Error 1220)

The source line contains an invalid character. This is probably caused by control characters embedded in the source line by an external editor.


Error 36
Command contains unrecognized phrase/keyword (Error 36)

A phrase beginning with an invalid keyword was used in a command line.


Error 1297
Command is allowed only in interactive mode (Error 1297)

You are attempting to use VALIDATE DATABASE with the RECOVER option in a program. This command can be issued only through the Command window.


Error 1221
Command is missing required clause (Error 1221)

A command was used without a clause that was required by the Visual FoxPro syntax. Select the command and press F1 to get context-sensitive Help on the command.


Error 1981
Compile error in file "name" (Error 1981)

You have attempted to add stored procedures to a database with the FROM clause of the APPEND PROCEDURES command, from a file which cannot be successfully compiled. Check that the file contains valid code.


Error 1252
Compiled code for this line is too long (Error 1252)

The object code produced for this statement exceeded the size of the Visual FoxPro internal code buffer.

•	This line contains too many long expressions.

Subdivide the line into multiple statements.


Error 1541
Connection "name" is busy (Error 1541)

This remote connection is in use by another executing statement.

Wait until it completes or cancel it before retrying this operation.


Error 1466
Connection handle is invalid (Error 1466)

The connection handle supplied is invalid.

Use SQLCONNECT( ) or SQLSTRINGCONNECT( ) to generate a valid connection handle.


Error 1497
Connection name is invalid (Error 1497)

The name you have specified is not the name of a view in the current database.

Check that the name entered is correct and that the current database is the required database.


Error 1526
Connectivity error: "name" (Error 1526)

An ODBC error has occurred. Visual FoxPro provides this message as a wrapper for the actual ODBC error. The ODBC error can be generated by the ODBC driver manager, by the ODBC driver, or by the back-end data server. AERROR( ) returns the ODBC errors. The format of an ODBC error 1526, as returned by AERROR( ), is as shown in the following table:

Element number	Description
1	Numeric. Contains 1526.
2	Character. The text of the error message.
3	Character. The text of the ODBC error message.
4	Character. The current ODBC SQL state.
5	Numeric. The error number from the ODBC data source.
6	Numeric. The ODBC connection handle.
7	The null value.
The ODBC error message (element number 3) contains the source of the error as the last name in the list preceding the actual error text.

Use the ODBC state code (element number 4) to look up the error in the ODBC book (Programmer's Reference).

For a server error, the data source error is set (element number 5). Use it to look up the error in the server documentation.


Error 1522
Connectivity internal consistency error (Error 1522)

Internal connectivity error.

If this error occurs, record your recent actions while using Visual FoxPro and then call Microsoft Support.


Error 1725
Constant is already created with #DEFINE (Error 1725)

The constant has already been defined with #DEFINE.

Use #UNDEF to release it before redefining.


Error 1799
Conversion is canceled (Error 1799)

The conversion has been canceled. The files involved might not be converted.


Error 1509
Conversion canceled.  Adjust the memo BLOCKSIZE (Error 1509)

You are trying to convert a dBASE table with a memo blocksize less than 512K.

To successfully convert the file for Visual FoxPro, go back to dBASE and adjust the memo blocksize to greater than, or equal to, 512K.


Error 1168
Could not add icon to executable file (Error 1168)

You have specified an invalid icon file (.ICO) while creating your distributable, executable files.


Error 1181
Could not add version resource to executable file (Error 1181)

The resource could not be added to the executable file at build time.

•	The resource might be corrupt.

Recreate the resource.


Error 1988
Currency value is out of range (Error 1988)

The maximum size of a numeric or float field is 20 digits.


Error 1166
Cursor is corrupt or in wrong format (Error 1166)

You have attempted to set the DragIcon property to an invalid .CUR file. A valid .CUR file must include an uncorrupted black and white cursor.


Error 44
Cyclic relation (Error 44)

A circular relationship was attempted by defining a sequence of relations that eventually points back to a table that is already related.


Error 1966
Data environment is already loaded (Error 1966)

You are invoking the Load event on the data environment and the data environment is already loaded.


Error 1967
Data environment is already unloaded (Error 1967)

The form is attempting to close tables as it shuts down.

•	AutoCloseTables is set to true (.T.).

Don’t programmatically close the data environment tables.

•	The CloseTables method is being called before the form is closed.

Set AutoCloseTables to false (.F.).


Error 1599
Data session #number was forced to ROLLBACK all transactions to avoid deadlock (Error 1599)

A deadlock was detected from another data session attempting to lock an index or memo file held by data session #number. A forced ROLLBACK was completed, leaving data session number in an error state.

Issue the appropriate number of ROLLBACK commands to clear the error state. These situations can be avoided by setting SYS(3052) on for index and memo files.


Error 1549
Data session #number cannot be released with open transaction(s) (Error 1549)

A data session-based object is being closed while there are open transactions. The data session will remain active.

Close the data session by issuing SET DATASESSION TO number followed by the appropriate number of END TRANSACTION or ROLLBACK commands.


Error 1732
Data type is invalid for this property (Error 1732)

Data type mismatch.

•	The value specified for the property is not the correct data type.

For more information, see Data and Field Types.


Error 9
Data type mismatch (Error 9)

An expression is invalid because it is composed of data types that Visual FoxPro cannot evaluate together.

•	You have either specified an inappropriate data type, or the two fields specified in an operation between two tables (such as UPDATE, REPLACE, SET RELATION) did not have the same data type.


Error 1534
Database "alias" is not open (Error 1534)

You have attempted to SET DATABASE TO a database that is not yet open.

Try OPEN DATABASE first.


Error 1569
Database "name": File access denied (Error 1569)

You have attempted to write to a write-protected database container (.DBC) file.


Error 1561
Database is invalid. Please validate (Error 1561)

Visual FoxPro has detected a problem with the structure of the database.

Try running VALIDATE DATABASE to diagnose or repair the problem.


Error 1570
Database is read-only (Error 1570)

Commands such as VALIDATE DATABASE RECOVER and those involving creation or modification of database objects require writing to the database.

Close the database and re-open it with writable access.


Error 1709
Database object is being used by someone else. (Error 1709)

Another user is accessing this database object.

•	Visual FoxPro is accessing records temporarily in response to another user’s actions.

Wait a few minutes and try again.

•	Another user is modifying a table or connection.

Contact the user. If you are modifying a table or a connection, you are preventing others from having access while you are in the designer. For more information, see MODIFY STRUCTURE, MODIFY CONNECTION, and so on.

•	Another user is modifying a view.

You can still use the view. If you want to modify it, contact the user. For more information, see MODIFY VIEW.


Error 1773
Database object type is invalid (Error 1773)

Valid types are: CONNECTION, VIEW, TABLE, RELATION, FIELD, INDEX. Some commands are appropriate only for a subset of these types.


Error 1544
DataType property for field "name" is invalid (Error 1544)

The value of the view field DataType property is not a valid Visual FoxPro data type.

Change the view field DataType property to a valid type.


Error 1232
DIMENSION contains variable declaration without required subscript arguments (Error 1232)

A DIMENSION statement contains a variable declaration without the required subscript arguments.


Error 1963
Directory is not found (Error 1963)

The directory you have specified does not exist.


Error 216
Display mode is not available (Error 216)

You have attempted to select an unavailable display mode.


Error 1907
Drive specifier is invalid (Error 1907)

You specified an invalid drive name in a DIR command.


Error 1156
Duplicate field names (Error 1156)

You have specified a duplicate name in the FIELDS clause for SORT or a COPY command. Correct your program or command and try again.


Error 4
End of file encountered (Error 4)

The record pointer was positioned past the last record in the file.


Error 1591
END TRANSACTION command cannot be issued without a corresponding BEGIN TRANSACTION command (Error 1591)

Contain transaction code between matched BEGIN TRANSACTION and END TRANSACTION pairs.


Error 1214
ENDTEXT does not have corresponding TEXT statement (Error 1214)

An ENDTEXT statement is missing a corresponding TEXT statement.


Error 1473
Environment-level property is invalid (Error 1473)

You have specified a property which cannot be set in the environment to be inherited by new cursors. You must first create the cursor and then use CURSORSETPROP( ).


Error 1957
Error accessing printer spooler (Error 1957)

An internal call to the GetPrinter( ) function has failed. Visual FoxPro calls this function through either PRTINFO( ) or SET PRINTER TO.


Error 1779
Error adding "name" to the object. Duplicate member/property name (Error 1779)

The member or property name you are trying to add to the object already exists.


Error 1112
Error closing the file (Error 1112)

An error was returned by the operating system while Visual FoxPro was attempting to close a file.


Error 1941
Error code is not valid (Error 1941)

The input to the ERROR command is not recognized.


Error 1424
Error copying the OLE object to Clipboard (Error 1424)

There are not enough resources available.


Error 1973
Error creating table:  "name" (Error 1973)

The table definition used in the FROM clause of the CREATE TABLE command contains an invalid field definition.


Error 1423
Error creating the OLE object (Error 1423)

There are not enough resources available, or Visual FoxPro can't find the server application.


Error 1735
Error in the class definition (Error 1735)

You have attempted one or more of the following invalid operations:

•	Used CREATEOBJECT( ) in a class definition.

•	Deleted grid columns in a class definition by setting the ColumnCount in the parent class to one value, and then setting the ColumnCount to a lower value in the child class.

•	Deleted pageframe-type pages in a class definition by setting the PageCount in the parent class to one value, and then setting the PageCount to a lower value in the child class.

•	Used the ADD OBJECT a[1] clause of the DEFINE CLASS command, where a is not an array.


Error 1258
Error in the PICTURE clause (Error 1258)

The compiler has detected an error when compiling a PICTURE clause. A picture must be a valid bitmap (.BMP) or icon (.ICO) file.


Error 1574
Error initializing Application object (Error 1574)

The Automation server or type library is not registered correctly.

•	Your registry file is corrupted.

Remove the registry entry.


Error 1508
Error initializing OLE (Error 1508)

There is not enough memory or there has been an improper installation for this operation. Close any other running applications and try again.


Error 1554
Error instantiating cursor.  Table "alias" cannot be opened.  Object will be ignored (Error 1554)

You have encountered an error in design mode while attempting to load the data environment. The object was not created; if you save the form, the object will be lost.


Error 1736
Error instantiating the object (Error 1736)

The server for the object is not registered properly, resources are low, or a required .DLL isn’t present.


Error 1881
Error loading file - record number n. "object" <or one of its members>. "Issue": "error" (Error 1881)

An error occurred while attempting to read in a form (.SCX) file. Issue is one of “Properties,” “Methods,” or “User Properties.”


Error 1958
Error loading printer driver (Error 1958)

An internal call to the LoadLibrary( ) function has failed. Visual FoxPro calls this function through either PRTINFO( ) or SET PRINTER TO.


Error 1995
Error loading the data environment.  Table is in use (Error 1995)

Check to see if the table has been opened exclusively in another data session.


Error 1797
Error occurred in conversion (Error 1797)

The converter has run and returned a non-error status, but the resulting report form (.FRX) file is not in Visual FoxPro format. If you have changed the value of _CONVERTER, the converter you are using doesn’t generate proper Visual FoxPro .FRX files.


Error 1584
Error reading a property from the database.  The property is ignored (Error 1584)

An error occurred while loading rule or trigger code from the database container. The rule or trigger will be ignored.

Try running VALIDATE DATABASE before reopening this table.


Error 1104
Error reading file (Error 1104)

An error was returned by the operating system while Visual FoxPro was attempting to read a file.


Error 1296
Error reading the resource (Error 1296)

An internal Visual FoxPro error has occurred.

Record your recent actions while using Visual FoxPro and then call Microsoft Support.


Error 1422
Error saving the OLE object (Error 1422)

There is not enough disk space or resources available to save the object.


Error 2005
Error with "name" - "property": "error" (Error 2005)

You have attempted to set a property to an illegal value through the language.


Error 1105
Error writing to file (Error 1105)

An error was returned by the operating system while Visual FoxPro was attempting to write to a file. Most often, this error is the result of an attempt to write to a write-protected diskette.


Error 1977
Exclusive open required to update this file.  Please reopen (Error 1977)

You do not have exclusive rights to this file.

Re-open the file with the EXCLUSIVE clause of the USE command.


Error 1523
Execution was canceled by the user (Error 1523)

You canceled a remote command by pressing the ESC key.


Error 46
Expression evaluated to an illegal value (Error 46)

An expression specified by SET MEMOWIDTH, BROWSE, or an @ ... TO command evaluated to an illegal value.


Error 67
Expression evaluator failed (Error 67)

An internal consistency check in the Visual FoxPro expression evaluator failed. This might be caused by a damaged Visual FoxPro object code file.

Recompile the program that caused the error.


Error 1148
Expression has been re-entered while the filter is executing (Error 1148)

The expression in SET FILTER TO has been re-entered while the filter is executing. This can happen with complex setups involving SET RELATION or SET FILTER, or during the use of Visual FoxPro functions or user-defined functions which reference other work areas, such as LOOKUP( ) or SEEK( ).


Error 1759
Expression is invalid.  Use a valid expression  for "name" property (Error 1759)

The expression you entered for a grid property is not valid. The expression is cleared from the property setting.

•	If you are setting the expression in the AfterRowColChange event of the grid, the error itself causes the event to fire again, leading to an recurring loop of error messages.

Press Cancel in the dialog box to disable the expression. You will not be able to set or change the expression.

•	The expression contains syntax errors.

Make sure your expression is valid and without syntax errors.

•	Variables in the expression are not scoped properly.

Make sure that any variables you use in the expression are globally scoped, or scoped to the form. If your expression contains a variable that is local to the function that you are setting the expression in, the variable will go out of scope when the function returns. However, the expression will be evaluated in the future when the grid tries to paint, and this will cause an error.


Error 1940
Expression is not valid outside of WITH/ENDWITH (Error 1940)

You can use an expression of the form .property=some_value only within a WITH ... ENDWITH construct.

•	This error might also occur if you are using .NULL. as an expression.

Put quotes around the .NULL. to keep it from being identified as a property.

•	You might have forgotten an ending period with a value such as true (.T.), false (.F.) or a null value (.NULL.)

Check for matching periods on either side of the constant.


Error 1947
Expression is too complex (Error 1947)

Your index expression is too long. The maximum number of characters allowed in an .IDX index key is 100. The maximum number of characters allowed in a .CDX index key is 240.


Error 293
Expression used with ACOS( ) is out of range (Error 293)

The expression you have used with the arc cosine function has a value out of the range of  – 1.0 to +1.0.


Error 291
Expression used with ASIN( ) is out of range (Error 291)

The expression you have used with the arc sine function has a value out of the range of  – 1.0 to +1.0.


Error Fatal error nExpr reporting error nExpr.
Fatal error nExpr reporting error nExpr.

No error number is returned. Visual FoxPro closes all open files and exits.

Record your recent actions while using Visual FoxPro and then call Microsoft Support.


Error 1001
Feature is not available (Error 1001)

The Visual FoxPro feature you have attempted to use is not supported in this version of Visual FoxPro.


Error 1580
Feature is not supported for non-.DBC tables (Error 1580)

You have tried to implement a feature, such as a nullable field, a primary key, a persistent relation, a default value, a validation rule, or a trigger, on a free table. These features are available only for tables that are contained in a database (.DBC).

Use ADD TABLE to add a free table to a database.


Error 1953
Feature is only available if the object is in design mode (Error 1953)

The operation you have attempted is only valid in design mode.


Error 1530
Fetching canceled; remote table is closed (Error 1530)

You interactively canceled a local function execution as part of remote data fetch by pressing the ESC key.


Error 1581
Field "name" does not accept null values (Error 1581)

You attempted to store a null value in a field that does not accept null values.

You can change this setting by checking the NULL checkbox when modifying a field in the Table Designer, or specifying the NULL keyword in a field definition.


Error 1582
Field "name" validation rule is violated (Error 1582)

Fix the field value or revert the record.


Error 1647
Field expression contains an invalid data type (Error 1647)

A picture data type was encountered by REPORT for a field expression.


Error 1913
Field must be a General field (Error 1913)

•	You have attempted to enter a non-general field name with APPEND GENERAL or MODIFY GENERAL.

•	You have attempted to enter a non-general field name into the Report Picture dialog box.


Error 350
Field must be a Memo field (Error 350)

You have attempted to enter a field name that is not a Memo field type with the APPEND or COPY MEMO command.


Error 1712
Field name is a duplicate or invalid (Error 1712)

•	A field in the table already has that name.

•	You used a space, or one of ., ", /, \, [, ], :, |, <, >, +, =, ;, *, or ? in the field name.


Error 1713
Field width or number of decimal places is invalid (Error 1713)

The field width or number of decimal places you have specified is not valid. For a list of the requirements, see System Capacities.


Error 2014
Fields marked as update keys will be cleared (Error 2014)

Memo, General, and Picture fields cannot be key fields.

•	A key field was changed to Memo, General, or Picture.

Visual FoxPro will clear the update key marker.


Error 1529
File "name" already exists as part of a database (Error 1529)

You have attempted to overwrite an existing file that is part of a database.

To avoid database corruption, first issue a REMOVE TABLE on the existing table from within its database.


Error 1553
File "name" is a database (Error 1553)

The operation you have attempted is not supported for database files.

Try again with a file of the correct type.


Error 1551
File "name" is an invalid database (Error 1551)

Problems were detected trying use the named database.

Try opening it and running VALIDATE DATABASE to diagnose or repair the problem.


Error 1552
File "name" is not a database (Error 1552)

The database operation you have attempted failed because the file was not a valid database.

Try again with a file of the correct type.


Error 1558
File "name" is not part of a database (Error 1558)

The operation you have attempted is not supported for free tables.

Try again with a file of the correct type.


Error 1565
File "name" is part of a database (Error 1565)

The operation you have attempted is supported only for free tables.

Try again with a file of the correct type.


Error 1933
File "name" is not closed (Error 1933)

Internal consistency error. A form (.SCX) or visual class library (.VCX) file was closed but the method and event code that is stored in it is still in use.


Error 1718
File "name" is read-only (Error 1718)

You have attempted to write to a read-only file.


Error 1190
File “name” is too large (Error 1190)

The file is too large to be modified.

•	The file is larger than 2 GB.

Use another method to reduce the file size, and then try again.


Error 1705
File access is denied (Error 1705)

You have attempted to write to a file that is write protected.


Error 7
File already exists (Error 7)

The file name you have attempted to rename already exists. This error is usually generated by the RENAME command.


Error 1184
File cannot be closed because outstanding references exist (Error 1184)

Outstanding references exist to an object in this form or form set.


Error 1503
File cannot be locked (Error 1503)

Visual FoxPro cannot lock the requested file. It may already be locked by another user on the network.


Error 1
File does not exist (Error 1)

The file you have specified does not exist.


Error 108
File is in use by another user (Error 108)

You have attempted a USE, DELETE, or RENAME command on a file that is being used by another user on a network.


Error 3
File is in use (Error 3)

You have attempted a USE, DELETE, or RENAME command on a file that is currently open.


Error 1113
File is not open (Error 1113)

You have attempted to read from, or write to, a file that is not currently open.


Error 1708
File is open in another work area (Error 1708)

Commands that require exclusive use of a table (PACK, MODIFY STRUCTURE, ZAP, and so on) cannot be used on a table that has been opened in multiple work areas with the AGAIN clause of the USE command.


Error 1338
File is the wrong version (Error 1338)

You have attempted to open a screen or a report file that is not a Visual FoxPro file.


Error 1637
File must be opened exclusively to convert the Memo file (Error 1637)

The table file you are using must be opened exclusively to be able to convert the memo file.


Error 110
File must be opened exclusively (Error 110)

You have attempted to perform an operation which requires exclusive use of the table.


Error 1918
File name is too long (Error 1918)

The name of the file exceeds current system capacities.


Error 1750
File was created in a later version of Visual FoxPro than the current version (Error 1750)

There is a discrepancy in the comparison of the version number built into the form (.SCX) or database container (.DBC) file and the version number stored in the product for these files.


Error 91
File was not placed in memory using the LOAD command (Error 91)

An error occurred when attempting to CALL or RELEASE a module which was not loaded.


Error 1140
FILTER expression exceeds allowed size (Error 1140)

You have attempted to issue SET FILTER TO on an expression that is longer than the maximum allowable size of 160 characters.


Error 1749
Form (.SCX) file must contain at least one Form (Error 1749)

To add a form to an .SCX file, use the Form Designer.


Error 1991
Form file "name" is from a previous version of FoxPro. It must be converted to the current format before it can be executed (Error 1991)

You have attempted to compile a form file (.SCX) from a previous version of FoxPro.

Convert to the current version and try again.


Error 1686
Form file "name" is invalid (Error 1686)

The screen file specified has become corrupted.


Error 11
Function argument value, type, or count is invalid (Error 11)

•	A value passed to a function is either not of the expected data type, or the value of the argument is out of range for this function.

•	You are passing too many arguments to a function.


Error 1999
Function is not implemented (Error 1999)

You have attempted to call a function that is not supported in the current version of Visual FoxPro.


Error 1536
Function is not supported on native tables (Error 1536)

The command or function you are using — for instance, REQUERY( ) — is not applicable to native Visual FoxPro tables.


Error 1525
Function is not supported on remote tables (Error 1525)

The command or function you are using — for instance, PACK or ALTER TABLE — is not applicable to remote tables.


Error 1300
Function name is missing ) (Error 1300)

A function name is missing a right parenthesis.

•	The current line contains a left parenthesis which has not been matched.

•	The function contains too many arguments and thus the right parenthesis is undetected.


Error 1304
Function name is missing (Error  (Error 1304)

A function name is missing a left parenthesis.


Error 1504
Function not supported for SQL pass-through cursors (Error 1504)

This command applies to view cursors only.

•	SQL pass-through cursors do not necessarily return single result sets.

Do not use REQUERY( ) on a SQL pass-through cursor.


Error 1586
Function requires row or table buffering mode (Error 1586)

The function you have attempted call is only enabled for cursors with row or table buffering enabled. Set the Buffering property to 2, 3, 4, or 5 with CURSORSETPROP( ) to enable row or table buffering.


Error 1986
GDI memory is low, close one or more windows and try again (Error 1986)

Close all open applications and restart Windows on your computer.


Error 1489
General fields cannot be used in the WHERE condition of an update statement. Change the WhereType property of the view (Error 1489)

In the WHERE clause of a SQL update statement, expressions you use to enforce optimistic locking cannot include general fields. Use the WhereType view property (you can change it from the default KeyAndModified to Key) to remove general fields from the update WHERE clause.

For more information on the WhereType property, see CURSORGETPROP( ) or DBGETPROP( ).


Error 1167
Icon is corrupt or in wrong format (Error 1167)

An invalid icon (.ICO) file was encountered during BUILD EXE.


Error 1587
Illegal nested OLDVAL( ) or CURVAL( ) (Error 1587)

The expression you are passing to OLDVAL( ) or CURVAL( ) references the OLDVAL( ) or CURVAL( ) function. This is not a supported operation.


Error 1910
Illegal printer driver recursion (Error 1910)

Your printer driver program calls upon the printer driver.


Error 1887
Illegal recursion in rule evaluation (Error 1887)

Your rule or trigger code has caused the original cursor (that is, the cursor the rule or trigger was fired from) to try to evaluate a rule or trigger recursively.

•	You either tried to move the record pointer or change values in the original cursor.

Check your rule and trigger code.


Error 1960
Illegal redefinition of variable "name" (Error 1960)

The PUBLIC or LOCAL command tried to change the state of a variable that already exists. For example, if you have a variable x that is not public and then issue PUBLIC x, you get this error.

Variables created in the Command window are public by definition. To create a variable that is not public, use a program (.PRG) file.


Error 1594
Illegal to attempt a file lock in a transaction after taking prior record locks (Error 1594)

You have either explicitly (with FLOCK( )) or implicitly (with REPLACE ALL, for example) attempted to take a file lock in a transaction. This is illegal if any record locks have already been taken either explicitly or implicitly at this transaction level or any lower transaction level. This is illegal even if those record locks have been freed inside the transaction.

You must roll back all record locks on this file before attempting this file lock. For more information, see ROLLBACK.


Error 1679
Import only Worksheet A for Lotus 1-2-3 version 3.0 files (Error 1679)

Worksheets B and C cannot be imported into Visual FoxPro because a table is two-dimensional.


Error 1241
Improper data type in the group expression (Error 1241)

A picture data type was encountered by REPORT for the group expression.


Error 1994
Include file "name" is not found (Error 1994)

The file specified in the form does not exist or #INCLUDE contains an invalid reference.


Error 1471
Incorrect column format (Error 1471)

You have attempted to pass an incorrect column type descriptor to SQLCOLUMNS( ).


Error 1470
Incorrect property name (Error 1470)

You have attempted to use an unknown property name.


Error 1886
Index does not accept NULL (Error 1886)

Your primary or candidate key index expression evaluated to NULL, which is an invalid value for these types of indexes.

Change record values so the expression does not evaluate to NULL.


Error 114
Index does not match the table.  Delete the index file and re-create the index (Error 114)

A damaged structure within an index file has been detected.

Delete the index file (.CDX or .IDX) and recreate it.


Error 23
Index expression exceeds maximum length (Error 23)

The index expression for this index exceeds the maximum length of 220 bytes.


Error 19
Index file does not match table (Error 19)

The index expression for the current index uses variables that are not contained within the current table.


Error 1683
Index tag is not found (Error 1683)

The tag you have specified could not be found in the index.

Verify the TAG clause of your command.


Error 1684
Index tag or file name must be specified (Error 1684)

You have attempted to exit without specifying a tag name.


Error 1730
Init event failed (Error 1730)


Error 1002
Input/output operation failure (Error 1002)

The operating system is unable to perform a file or hardware operation.


Error 1588
INSERT cannot be issued when row or table buffering is enabled or when integrity constraints are in effect (Error 1588)

Either set row and table buffering off by setting the Buffering property to 1 with CURSORSETPROP( ), or use APPEND instead of INSERT.


Error 1308
Insufficient stack space (Error 1308)

One of the following has occurred:

•	Your program is too recursive.

•	Your program is too complex and is nested too deeply.

•	An error in Visual FoxPro.


Error 1000
Internal consistency error (Error 1000)

Record your recent actions while using Visual FoxPro and then call Microsoft Support.


Error 1243
Internal error: Too many characters in the report (Error 1243)

The total size of all the headings and expressions defined for the report in CREATE REPORT or MODIFY REPORT is too large to be contained in the standard report file.


Error 231
Invalid argument used with the SET function (Error 231)

An invalid argument has been used with the SET( ) function.


Error 1477
Invalid call issued while executing a SQLCOLUMNS( ) sequence (Error 1477)

An invalid SQL pass-through (SPT) function call has been made while a SQLCOLUMNS( ) call was expected to continue the SPT call sequence in progress.

Call SQLCANCEL( ) to cancel the SPT sequence or make valid SPT calls to finish the call sequence.


Error 1474
Invalid call issued while executing a SQLEXEC( ) sequence (Error 1474)

An invalid SQL pass-through (SPT) function call has been made while a SQLEXEC( ) call was expected to continue the SPT call sequence in progress.

Call SQLCANCEL( ) to cancel the SPT sequence or make valid SPT calls to finish the call sequence.


Error 1475
Invalid call issued while executing a SQLMORERESULTS( ) sequence (Error 1475)

An invalid SQL pass-through (SPT) function call has been made while a SQLMORERESULTS( ) call was expected to continue the SPT call sequence in progress.

Call SQLCANCEL( ) to cancel the SPT sequence or make valid SPT calls to finish the call sequence.


Error 1476
Invalid call issued while executing a SQLTABLES( ) sequence (Error 1476)

An invalid SQL pass-through (SPT) function call has been made while a SQLTABLES( ) call was expected to continue the SPT call sequence in progress.

Call SQLCANCEL( ) to cancel the SPT sequence or make valid SPT calls to finish the call sequence.


Error 1783
Invalid class specified for @...Class command (Error 1783)

You cannot specify a form, form set, or toolbar class when using @ ... Class.


Error Invalid compact EXE file.  Rebuild EXE.
Invalid compact EXE file.  Rebuild EXE.

Your compact executable (.EXE) file has become corrupt.

Rebuild the file.


Error 1959
Invalid coordinates (Error 1959)

Coordinate values must be greater than -32768 and less than 32767.


Error 1578
Invalid database table name (Error 1578)

Valid database table names contain only alphanumeric characters and spaces, and cannot start with a number. They may not be longer than 128 characters.


Error 1245
Invalid expression in label definition file (Error 1245)

An invalid expression was encountered in a label file (.LBX).


Error 1111
Invalid file descriptor (Error 1111)

Visual FoxPro is unable to open a file.

Record your recent actions while using Visual FoxPro and then call Microsoft Support.


Error 1510
Invalid file format.  If this is a dBASE file, it must be converted first.  To convert it, type MODIFY LABEL file (Error 1510)

Convert your dBASE file and try again.


Error 112
Invalid key length (Error 112)

Index keys must be between 1 and 240 characters.

•	You created an index key of length 0.

When Visual FoxPro creates an index, it evaluates fields in the first record in the table. Make sure that the first record of the fields you base the index on contains some data.

•	You created an index key longer than 240 characters.

Create a shorter index key.


Error 2011
Invalid operation for offline view (Error 2011)

Some operations are not valid for offline views.

•	You tried to modify the view definition or table, compact the view, insert or delete records, or refresh the view.

Do not use these commands on offline views.


Error 2008
Invalid operation for offline view while being used online (Error 2008)

Some operations are not valid when an offline view is being used online.

•	You tried to change the buffer mode of the view.

By definition, offline views used online are in table buffer mode. Do not call CURSORSETPROP( ) to change the buffer mode.

•	You tried to create an index.

Do not use SET ORDER TO or INDEX on offline views while you are using it online.


Error 2007
Invalid operation for offline view while offline (Error 2007)

Some operations are not valid when an offline view is being used offline.

•	You tried to create an offline view from a view that is already offline.

Use the original view directly, or use a different view as the basis for your new offline view.

For more information, see CREATEOFFLINE( ).


Error 1115
Invalid operation for the cursor (Error 1115)

An attempt was made to use the PACK command on a cursor.


Invalid or duplicate field name
Invalid or duplicate field name.

The field name you specified already exists in the table.

•	Specify a unique field name for each field in the table.


Error Invalid or missing EXE file.
Invalid or missing EXE file.

The .EXE file you specified is either corrupted or missing.


Error 202
Invalid path or file name (Error 202)

You attempted to execute a Visual FoxPro command that contains an invalid path or file name.


Error 1103
Invalid seek offset (Error 1103)

Record your recent actions while using Visual FoxPro and then call Microsoft Support.


Error 31
Invalid subscript reference (Error 31)

A subscript was used that is outside of the valid range of array subscripts defined in the DIMENSION statement. This might also be caused by using two subscripts with a one-dimensional array.


Error 1479
Invalid update column name "name" (Error 1479)

The column name is not found in the column list of the view.

Correct the column name.


Error 1652
Invalid use of a Visual FoxPro function as an array (Error 1652)

Visual FoxPro encountered a function when it was expecting an array name.

Replace the function with a valid array name.


Error 1223
Invalid variable reference (Error 1223)

A function was used where a variable was expected.

Replace the reference with a valid variable or array name.


Error 1124
Key exceeds allowed size (Error 1124)

The compiled version of the index expression has exceeded 150 bytes.


Error 1117
Key field length does not match (Error 1117)

The key field length does not match for an UPDATE or SET RELATION TO operation between two files.


Error 1255
Key label "label" is invalid (Error 1255)

The key label you have used is not supported. See ON KEY LABEL for a list of supported key labels.


Error 1257
Key string is too long (Error 1257)

The character expression included with KEYBOARD is too long. Reduce its length.


Error 356
Keyboard macro file format is invalid (Error 356)

An attempt has been made to use a macro file with invalid data.


Error 54
Label file is invalid (Error 54)

An attempt was made to modify or print labels using a label file that was not created with CREATE LABEL or MODIFY LABEL.


Error 1653
Label nesting error (Error 1653)

A user-defined function in a label form has called LABEL with a FORM clause again.


Error 221
Left margin including indent must be less than the right margin (Error 221)

The position of the right margin must be greater than the position of the left margin.

Adjust the margin settings and try this operation again.


Error 21
Length of variable strings exceeds amount of memory (Error 21)

The combined length of all variable strings has exceeded the amount of memory.


Error 1691
Library file "name" is invalid (Error 1691)

Visual FoxPro cannot use the library file you specified.

Rebuild the library.


Error 18
Line is too long (Error 18)

The maximum length for a command line (2048 bytes) has been exceeded.

•	Macro substitution might have caused the line to expand beyond the 2048 byte limit.


Error 222
Line number must be less than page length (Error 222)

The line number used falls beyond the page length variable.


Error 1194
Link command failed (Error 1194)

A compilation error occurred and an .EXE was not created on the disk.


Error 1911
Localized product is required for this environment (Error 1911)

There was an attempt to use a US version of Visual FoxPro with a non-US system.


Error 58
LOG( ): Zero or negative used as argument (Error 58)

A zero or a negative number has been used as the argument of the natural log function.


Error Logical expression required.
Logical expression required

The expression provided in the Expression Builder must be of Logical type. For more information, see Creating Logical Expressions.


Error 1662
Lotus 1-2-3 version 1.0 file format is invalid (Error 1662)

The Lotus 1-2-3 file you have attempted to import is either not version 1.0 or has been corrupted.


Error 297
Lotus 1-2-3 version 2.0 file format is invalid (Error 297)

The Lotus 1-2-3 file you have attempted to import is not version 2.0. Use the Lotus conversion utility to convert the file to version 2.0 before attempting to import it.


Error 1678
Lotus 1-2-3 version 3.0 file format is invalid (Error 1678)

The Lotus 1-2-3 file you have attempted to import is either not version 3.0 or has been corrupted.


Error 355
Macro is not defined (Error 355)

An attempt has been made to play a macro that does not exist.


Error 1609
Maximum menu item length (50) is exceeded (Error 1609)

Reduce the number of menu items.


Error 1607
Maximum menu items allowed (128) is exceeded (Error 1607)

The maximum number of items that may be contained in a menu (128) was exceeded.


Error 1608
Maximum menus allowed (Error 25) is exceeded (Error 1608)

The maximum number of menus that may be defined (25) was exceeded.


Error 1431
Maximum number of OLE arguments is exceeded (Error 1431)

You have specified more arguments for an Automation method than is allowed in Visual FoxPro.

Call the method with fewer than 64 arguments.


Error 392
Maximum record length exceeded in the import file (Error 392)

The file you have attempted to import has a record length greater than 4,001 bytes.


Error 1943
Member "name" does not evaluate to an object (Error 1943)

Invalid syntax. The syntax indicates that the next element being evaluated should be an object but it isn’t.

For example, if you had a form called myform with a text box called text1, the command myform.txt.value = "help" would generate this error. The command should be myform.text1.value = "help".


Error 1760
Member "name" is a class member (Error 1760)

You have attempted to remove a member from an object. The member cannot be removed because it is a member of the class the object is based on.

To remove the member, modify the class.


Error 1975
Member object "name" has not been instantiated (Error 1975)

A reference was made to a member object in an Init event before that object was instantiated.


Error 1756
Member object removed – cannot complete Save operation (Error 1756)

The class could not be saved.

•	The .VCX file or memory is corrupted.


Error 41
Memo file "name" is missing or is invalid (Error 41)

An attempt was made to use a table file whose associated memo file (.DBT or .FPT) has been deleted, removed, or cannot be found.


Error 55
Memory file is invalid (Error 55)

An attempt was made to use RESTORE FROM on a file that is not a valid memory (.MEM) file.


Error 2000
Memory is low, so streaming output updating has been disabled (Error 2000)

The offscreen bitmap could not be created by a command such as ?, LIST, or DISPLAY.

•	Visual FoxPro memory is low.

Free up some memory.


Error 1687
Menu file is invalid (Error 1687)

The menu file you specified has become corrupted.


Error 178
Menu has not been activated with ACTIVATE MENU (Error 178)

You have attempted to select from a menu before the menu has been activated. For more information, see ACTIVATE MENU.


Error 179
Menu has not been activated with ACTIVATE POPUP (Error 179)

You have attempted to select a menu title from a menu before the menu has been activated. For more information, see ACTIVATE POPUP.


Error 168
Menu has not been defined with DEFINE MENU (Error 168)

You have attempted to activate a menu that has not been defined. For more information, see DEFINE MENU.


Error 165
Menu has not been defined with DEFINE POPUP (Error 165)

You have attempted to activate a menu before it has been defined. For more information, see DEFINE POPUP.


Error 167
Menu item position must be a positive number (Error 167)

You have attempted to position a menu or menu title using a negative number.


Error 1611
Menu items and titles must be type Character (Error 1611)

A menu item or menu title was encountered which was defined with a data type other than Character.


Error 287
Menu size is too small (Error 287)

The menu is too small to display menu items.

Define a larger menu.


Error 181
Menu specified in ACTIVATE MENU is already in use (Error 181)

You have attempted to activate a menu that is already active.


Error 182
Menu specified in ACTIVATE POPUP is already in use (Error 182)

You have attempted to activate a menu that is already activated.


Error 164
Menu title has not been defined with DEFINE PAD (Error 164)

There is a reference to a menu title that doesn’t exist. For more information, see DEFINE PAD.


Error 279
Menu was not pushed (Error 279)

An attempt has been made to pop a menu or popup that was not pushed.


Error 1765
Method contains syntax errors.  Method is not saved (Error 1765)

You have either included more than one procedure or have a class declaration in the code.

Fix the code and try again.


Error 1661
Microsoft Excel file format is invalid (Error 1661)

The Microsoft Excel file you have attempted to import is either not version 5.0 or has been corrupted.


Error 1723
Mismatched #IF/#ELSIF/#ELSE/#ENDIF (Error 1723)

You have included an incomplete or incorrect #IF preprocessor command.


Error 1256
Mismatched braces in key label (Error 1256)

A left or right brace is missing from a key label.


Error 1724
Missing #ENDIF (Error 1724)

You have issued an #IF command without a matching #ENDIF.


Error 1193
Missing .RTT section (Error 1193)

The Microsoft Visual FoxPro distribution component is not properly installed.


Error 1306
Missing comma (,) (Error 1306)

Visual FoxPro was expecting a comma and didn’t find one.

•	You might not have included the proper number of arguments with a function.

Check your syntax.


Error 152
Missing expression (Error 152)

A valid expression was expected, but not found.


Error 1231
Missing operand (Error 1231)

An operator that requires two operands was used without the second operand, such as ? (13+4)/.


Error 1670
Multiplan version 4.0 file format is invalid (Error 1670)

The Multiplan file you have attempted to import is either not version 4.0 or has been corrupted.


Error 1875
Multiple warnings occurred performing the requested index modifications (Error 1875)

All structural and property changes to the table were completed successfully.

•	Since you registered an ON ERROR handler, warnings were processed there.

Add code to verify the changes and handle the warnings you received.


Error 1710
MULTISELECT or MOVER clause is not supported for PROMPT style menus (Error 1710)

Commands that have the clauses PROMPT FIELD, PROMPT FILE, or PROMPT STRUCTURE do not allow the clauses MULTISELECT or MOVER.


Error 1145
Must be a character or numeric key field (Error 1145)

The key field used to UPDATE ON must be of type Character, Date or Numeric.


Error 1226
Must be a file variable (Error 1226)

A variable or an array was used where a file variable (field) is required.


Error 1225
Must be a variable or array (Error 1225)

A file variable (field) was used where a variable or array was required.


Error 94
Must specify additional parameters (Error 94)

The number of parameters specified in a DO ... WITH statement is greater than the number of parameters defined by the PARAMETERS statement in the called program.


Error 96
Nesting error (Error 96)

One of these situations has been encountered:

•	A DO is present without a matching ENDDO or vice versa

•	A SCAN is present without a matching ENDSCAN or vice versa

•	A FOR is present without a matching ENDFOR or vice versa

•	A LOOP or EXIT clause is present outside the DO WHILE ... ENDDO, FOR ... ENDFOR, or SCAN ... ENDSCAN commands.


Error 1488
No connection associated with this cursor (Error 1488)

The connection was closed.

•	You closed the connection with SQLDISCONNECT( ). and then tried to update, requery, or refresh the view.

Make sure you have an open connection before performing this command on a remote view.


Error 1520
No database is open or set as the current database (Error 1520)

You have attempted to perform an action which requires a database to be open and set as current.

Use the OPEN DATABASE or SET DATABASE TO commands, or select a database from the database drop-down list in the standard toolbar.


Error 1878
No default value to DROP (Error 1878)

You have attempted to use the DROP DEFAULT clause of the ALTER TABLE command on a column with no default value. This is not a valid operation.


Error 47
No fields found to process (Error 47)

No fields can be found, usually because a SET FIELDS TO was in effect.


Error 138
No fields were found to copy (Error 138)

During an attempt to copy to a file, no visible fields were found.


Error 1492
No key columns specified for the update table "name".  Use the KeyFieldList property of the cursor (Error 1492)

No key column(s) have been specified in the KeyFieldList property for a base table that is being updated.

Modify the KeyFieldList property to include key columns for each table that is being updated. For most views, you can use the View Designer to set the view update properties and then save the view back into the database. For more information, see CURSORGETPROP( ).


Error 1605
No menu is defined (Error 1605)

You attempted to activate a menu before defining a menu bar.


Error 1604
No menu item is defined (Error 1604)

You attempted to read a menu bar that has not been defined.


Error 166
No menu items have been defined for this menu (Error 166)

You must define menu item bars for each menu.


Error 1621
No menu titles have been defined for this menu (Error 1621)

You attempted to activate a menu that has no titles.


Error 1964
No PageFrame or Page is found in FormSet or Form with WindowType set to READ or READ MODAL (Error 1964)

You attempted to manually make a form set of type READ or READMODAL and you don’t have the right combination of pages and page frames. This operation should be performed only by the Converter.


Error 1238
No PARAMETER statement is found (Error 1238)

After doing a program with a parameter list, the called program must begin with a PARAMETER statement.


Error 1649
No previous PRINTJOB command to correspond to this command (Error 1649)

An ENDPRINTJOB command was encountered without a matching PRINTJOB command preceding it.


Error 1879
No primary key (Error 1879)

You have attempted to use the DROP PRIMARY KEY clause of the ALTER TABLE command on a table with no primary key. This is not a valid operation.


Error 1796
No records are found for the current platform (Error 1796)

You have attempted to modify a file that has no records from the current platform.

Use the transport program to convert the file.


Error 1463
No result set has been returned by the server (Error 1463)

The remote query did not generate a result set.

Check your query and its parameters to make sure you are producing a result set on the server.


Error 1877
No rule to DROP (Error 1877)

You have attempted to use the DROP CHECK clause of the ALTER TABLE command on a column (or table) with no rule. This is not a valid operation.


Error 1774
No sheet is found (Error 1774)

The .XLS file you are referencing contains no worksheet records. This can also occur for a file containing only charts or macros.


Error 1612
No such menu or menu item is defined (Error 1612)

The values passed to a READ MENU TO or READ MENU BAR TO command do not correspond to a defined menu or menu item.


Error 52
No table is open in the current work area (Error 52)

A table was not in use at the time Visual FoxPro attempted to execute a table command.

•	The current work area doesn’t have an open table.

Open a table or change work areas.


Error 1491
No update tables are specified.  Use the Tables property of the cursor (Error 1491)

No base tables are specified in the Tables property of the view.

Set the Tables property to specify the base table or tables that should be updated from the view. For most views you can use the View Designer to set the view update properties and then save the view back into the database. For more information, see CURSORGETPROP( ).


Error 45
Not a character expression (Error 45)

You have attempted to call a module with an expression whose value is not of the type Character.


Error 27
Not a numeric expression (Error 27)

You have attempted to use the SUM command on a non-numeric field.


Error 15
Not a table (Error 15)

The file that Visual FoxPro is attempting to use as a table contains an improper header.


Error 1682
Not a user-defined window (Error 1682)

You have attempted to use a command containing a WINDOW clause on a window that is not user-defined, such as the Command window.


Error 256
Not a valid Framework II database/spreadsheet (Error 256)

The file you have attempted to import is not a valid Framework II file format.


Error 255
Not a valid RapidFile database (Error 255)

The file you have attempted to import is not a valid RapidFile file format.


Error 1149
Not enough memory for buffer (Error 1149)

There is not enough memory for Visual FoxPro to allocate memory for a buffer.

•	Available memory is extremely limited.

Add memory or remove memory-resident programs to give Visual FoxPro more working memory.


Error 1150
Not enough memory for file map (Error 1150)

There is not enough memory for Visual FoxPro to allocate memory for a Visual FoxPro internal resource.

•	Available memory is extremely limited.

Add memory or remove memory-resident programs to give Visual FoxPro more working memory.


Error 1151
Not enough memory for filename (Error 1151)

There is not enough memory for Visual FoxPro to allocate memory for a Visual FoxPro internal resource.

•	Available memory is extremely limited.

Add memory or remove memory-resident programs to give Visual FoxPro more working memory.


Error 1600
Not enough memory to open a table with the USE command (Error 1600)

There was not enough memory to open an additional table.


Error 1696
NOWAIT/SAVE/NOENVIRONMENT/IN/WINDOW clauses are not allowed with the FROM clause (Error 1696)

These clauses cannot be included when you create a quick report with the FROM clause.


Error 39
Numeric overflow.  Data was lost (Error 39)

A mathematical operation resulted in a number that was too large to be stored in the field or variable in which it was placed.


Error 1766
Object "name" is not found (Error 1766)

The object you have specified is protected and cannot be found.


Error 1923
Object "name" is not found (Error 1923)

The object you have specified cannot be found.


Error 1985
Object already has a data environment; cannot use another one with the SaveAs method (Error 1985)

You cannot specify another data environment with the SaveAs method.


Error 1744
Object class is invalid for this container (Error 1744)

You have attempted to add a member object to a parent object with the AddObject method. It cannot be added because the member object’s class cannot be a member of the parent’s object class. For example, you cannot add a Grid object to a PageFrame object.


Error 1719
Object file "name" is in use and cannot be removed from memory (Error 1719)

A program specified in the project is suspended.

Cancel execution of the program so that you can successfully build from the project.


Error 1195
Object file "file" was compiled in a previous version of FoxPro (Error 1195)

You have attempted to run an application compiled in a previous version of FoxPro.

Recompile the source code in the current version.


Error 2009
Object is not an offline view (Error 2009)

Some commands and clauses require an offline view.

•	You tried to use the ONLINE or ADMIN clauses.

You must provide an offline view with these clauses. For more information, see USE.

•	You tried to drop a view.

Use DROPOFFLINE( ) only with offline views.


Error 1938
Object is not contained in a "name" (Error 1938)

This message is produced by the scope operator when the parent class you have specified is not in the inheritance hierarchy of the current (THIS) object. For example, this error will occur if you put FORMSET::Click in the Click event of a form that is not contained in a form set.


Error 1575
Object name is invalid (Error 1575)

You have specified a name for a member object in the AddObject method which is invalid.

Check the name and try again.


Error 1942
Objects cannot be assigned to arrays (Error 1942)

Array elements can only contain values.


Error 1987
Objects cannot be programmatically added to the Form Designer’s FormSet (Error 1987)

You have attempted to programmatically add forms to the Form Designer form set. This cannot be done.


Error 1989
Objects cannot be programmatically deleted from the Form Designer (Error 1989)

You have attempted to programmatically delete forms from the Form Designer form set. This cannot be done.


Error 1528
ODBC entry point missing, "name" (Error 1528)

The entry point for the specified function is not found in the ODBC32 dynamic-link library. The file ODBC32.DLL is invalid.

Reinstall the ODBC component of Visual FoxPro.


Error 2015
Offline view must be used online for this command (Error 2015)

When you are using a view in administrator mode, normal online use and table update operations are not valid. For more information, see the VIEW ADMIN clause of the USE command.


Error 2010
Offline views must be used exclusively when being used online (Error 2010)

Use the EXCLUSIVE clause together with the ONLINE clause to access the offline view. For more information, see USE.


Error 2003
OLE Changed Properties stream is the wrong version. Subclassed properties ignored. (Error 2003)

The names and values of the OLE object properties could not be read from the form (.SCX) or class (.VCX) file.

•	The information is missing from the file or the file is corrupt.

Reapply your recent changes and save the file in the Form Designer or Class Designer. The correct information is written out.

•	The version number for the OLE object has changed.

Contact the vendor of the OLE object.


Error 1426
OLE error code 0x"name" (Error 1426)

You have received an error code from OLE (in hex), and a brief description of the error. The remedy depends on the error returned by OLE.


Error 1427
OLE IDispatch exception code "name" (Error 1427)

You have received an error code returned by an Automation object. It is specific to the OLE object. The object did not provide any other textual information about the error.

Refer to the object's documentation for more information.


Error 1428
OLE IDispatch exception code "number" from "name": "name" (Error 1428)

You have received an error code returned by an Automation object. It is specific to the OLE object.In this case, the object returns a textual description of the error, as well as the source (usually OLE object name) of the error.

Refer to the object's documentation for more detailed information.


Error 1420
OLE object is invalid or corrupted (Error 1420)

The data stored in a general field for an OLE object cannot be validated.


Error 1965
One of the members of this class is based on a nonvisual class.  Cannot write .VCX file (Error 1965)

You have included a non-visual class in your class definition.

Remove it and try again.


Error 1968
One of the members of this Form or FormSet is based on a nonvisual class. Cannot write .SCX file (Error 1968)

You have included a non-visual class in your form set.

Remove it and try again.


Error 1436
Only insertable objects are allowed in General fields (Error 1436)

Insertable objects are objects such as a Microsoft Excel worksheet or Microsoft Word document. These are allowed in General fields. Non-insertable objects are objects such as ActiveX controls. ActiveX controls are not allowed in General fields.


Error 1885
Only structural tags can be defined as candidate (Error 1885)

You have attempted to create a candidate key (as with INDEX ON ... CANDIDATE) that was either an IDX file or a tag in a CDX file other than the CDX file specified.

Create the candidate index in the structural CDX file.


Error 1912
Operation is invalid for a General field (Error 1912)

You have attempted to perform an invalid operation, such as a calculation or indexing, on a General field.


Error 34
Operation is invalid for a Memo, General, or Picture field (Error 34)

•	An INDEX command cannot specify a MEMO field as its key expression.

•	There was not enough memory for Visual FoxPro to complete an operation.


Error 107
Operator/operand type mismatch (Error 107)

An arithmetic, string, or logical operator or function is being used with an invalid data type. This error would occur, for example, if you were to attempt to add two logical values.


Error 1413
Page frame cannot be sized that small (Error 1413)

Page frames must be tall enough to display one row of tabs, if the Tabs property is set; otherwise, they must be at least one pixel tall.

•	You tried to resize the page frame to less than the height of one row of tabs.

Make the page frame taller.


Error 1688
Paradox file format is invalid (Error 1688)

The Paradox file you have attempted to import is either not version 3.5 or has been corrupted.


Error 1767
Parent object will not allow this property setting for "name" (Error 1767)

You have attempted to set a property value on an object whose parent is controlling the setting of that property.

For example, when you try to set the ControlSource property of a contained control in a grid column, and the Bound property for the grid column has been set to true (.T.), you will get this error message because the ControlSource property for the control is taken from the grid column’s ControlSource Property.


Error 1217
Picture error in GET statement (Error 1217)

The PICTURE clause within an @ ... SAY or @ ... GET statement contains a picture that cannot include the value to be formatted. This error might be occurring because the picture is corrupt or because the value to be formatted does not match the picture format.


Error 1108
Picture too big, corrupt, or in wrong format (Error 1108)

You attempted to use an invalid picture file.


Popup too big, first nExpr entries shown.

You specified too many items to be shown in the menu.


Error 1722
Preprocessor expression is invalid (Error 1722)

Only simple expressions (evaluation, concatenation, and math) are allowed in preprocessor commands (#IF and so on).


Error 1681
PREVIEW clause is not allowed with OFF/NOCONSOLE or TO PRINT/FILE (Error 1681)

Page preview is not allowed when the console is not on or when printing to the printer or a file.


Error 1883
Primary key already exists (Error 1883)

You have attempted to use the ADD PRIMARY KEY clause of the ALTER TABLE command on a table that already has a primary key.

Remove the existing primary key first.


Error 1567
Primary key property is invalid; please validate database (Error 1567)

The primary key property for this table in the database is corrupted.

Use VALIDATE DATABASE to correct the problem.


Error 1956
Printer access denied (Error 1956)

An internal call to the OpenPrinter( ) function has failed. Visual FoxPro calls this function through either PRTINFO( ) or SET PRINTER TO.


Error 1643
Printer driver is corrupted (Error 1643)

An attempt has been made to load a printer driver that is corrupted.


Error 1644
Printer driver is not found (Error 1644)

The specified printer driver could not be located.


Error 125
Printer is not ready (Error 125)

The printer device specified is currently not accessible or the printer is timing out. The TIME parameter in your Visual FoxPro configuration file might need to be increased.


Error 124
Printer redirection is invalid (Error 124)

Either a path to a printer is not established or the print device cannot be shared.


Error 1162
Procedure "name" is not found (Error 1162)

The procedure specified with the IN clause of the DO command could not be located.


Error 1937
Procedure file "name" is not found (Error 1937)

You have specified a name in a RELEASE PROCEDURE name command that is not in the SET PROCEDURE list.


Error Product has not been properly installed.
Product has not been properly installed.

Reinstall your copy of Visual FoxPro.


Error 1202
Program is too large (Error 1202)

The program that Visual FoxPro is attempting to load will not fit into memory. The largest program or individual procedure Visual FoxPro can load is one containing 65,000 bytes.


Error 1946
Project file "name" is in the wrong version (Error 1946)

The project file specified does not match the version of Visual FoxPro.


Error 1685
Project file is invalid (Error 1685)

The project file specified has become corrupted.


Error 1169
Project file is read-only (Error 1169)

Visual FoxPro does not allow you to open read-only projects.

Make the project writable and then try again.


Error 1763
Property "name" already exists (Error 1763)

The object already has a property with this name.

Give the new property a unique name.


Error 1738
Property "name" is not a method or event (Error 1738)

You used a name that is not a method or event.


Error 1734
Property "name" is not found (Error 1734)

The property name you specified cannot be found.

Check the name of the property and try again.


Error 1757
Property "name" is protected (Error 1757)

You cannot change the value of a protected property.


Error 1743
Property "name" is read-only (Error 1743)

You cannot change the value of a read-only property.


Error 1138
Property does not have a default value. (Error 1138)

ResetToDefault can only be called for properties that have inheritable default values.

•	The property is read-only or is one of the following:

Alias, ChildOrder , CursorSource., Database, Name, Order, ParentAlias, RelationalExpr.


Error 1467
Property is invalid for local cursors (Error 1467)

The property is not supported for cursors based on local tables or local views; it applies only to cursors based on remote views.

Use the property only for remote view cursors.


Error 1468
Property is invalid for table cursors (Error 1468)

The property is not supported for cursors based on tables; it applies only to cursors based on views.

Use the property only for view cursors.


Error 1559
Property is not found (Error 1559)

The property name you specified cannot be found or is not valid for the specified object.

Check the name of the property and try again. Make sure the object and property are compatible.


Error 1739
Property setting will not take effect until data environment reloaded (Error 1739)

You attempted to set a property on a data environment object (Relation, Cursor) while the data environment is loaded. The property value will be stored with the object, but the property will not take effect until the data environment is unloaded and then reloaded.

To unload the data environment

•	Issue CloseTables in the form:

[Formset.]Form.DataEnvironment.CloseTables

To reload the data environment

•	Issue OpenTables in the form:

[Formset.]Form.DataEnvironment.OpenTables


Error 1560
Property value is invalid (Error 1560)

You attempted to set a property value for a cursor or database object that was not in the range or type defined for that property.

Check for valid values and change the value to match the property type.


Error 1469
Property value is out of bounds (Error 1469)

The property value is outside the limits allowed for this property.

Change the value to be valid for this property.


Error 1716
Queue "queue" is not found (Error 1716)

The queue specified in the SET PRINTER TO command cannot be found.


Error 2018
Reconnect of offline view failed (Error 2018)

The view cannot be reconnected as an online view: one of the components of the view is not available or missing. For example, a base table for the view might be locked exclusively or be missing, or the database container (.DBC) file might be missing.


Error 109
Record is in use by another user (Error 109)

You have attempted to write to a record that is locked by another user.


Error 20
Record is not in index (Error 20)

A key field of the table in use has been modified without the index having been active.

Apply the REINDEX command to the table file.


Error 130
Record is not locked (Error 130)

An attempt was made to use a BROWSE, CHANGE, EDIT, DELETE, GATHER, MODIFY MEMO, READ, RECALL, or REPLACE command on a record that was not locked.


Error 5
Record is out of range (Error 5)

The record number you attempted to access is beyond the actual number of records contained in the current table.

•	The current index does not match the table

Issue REINDEX on the table to try and correct the problem.


Error 1126
Record is too long (Error 1126)

While attempting to create a table file, the maximum length for the data portion of a record (65,500 bytes) was exceeded. The length of the data portion of a record is equal to the sum of the lengths of the individual record fields.


Error 1583
Record validation rule is violated (Error 1583)

The operation you have attempted is in violation of a record validation rule.

Fix the record values or revert the record.


Error 1206
Recursive macro definition (Error 1206)

The maximum number of macro substitutions (256 in any one statement) has been performed in the current line.

•	A macro references itself.


Error 1880
Related table is not found in current database (Error 1880)

A database relation object is being created or referenced for which the related table could not be found.

•	You used the REFERENCES clause of the CREATE TABLE or ALTER TABLE command.

Make sure both tables involved in the relation are in the database.


Error 1882
Related tag is not found or not primary or candidate (Error 1882)

A database relation object is being created or referenced in which some of the related information was missing, not primary or candidate, or invalid.

•	You used the REFERENCES and TAG clauses of the CREATE TABLE or ALTER TABLE command.

Make sure both tables involved in the relation are in the database.


Error 1183
Relation already exists. (Error 1183)

The tables are already related.


Error 1555
Relational expression is not valid (Error 1555)

The RelationalExpr property is not valid.

Make sure the expression is not empty and can be evaluated.


Error 2016
Removing a class member is not allowed (Error 2016)

An instance of a class cannot remove class members.

•	You tried to use RemoveObject.

Use AddObject and then set the CurrentControl property.


Error 1645
Report contains a nesting error (Error 1645)

A user-defined function in a report form has called REPORT FORM.


Error 50
Report file "name" is invalid (Error 50)

A report description contains an error.


Error 1592
ROLLBACK command cannot be issued without a corresponding BEGIN TRANSACTION command (Error 1592)

A transaction must be ongoing to use the ROLLBACK command.


Error 30
Row or column position is off the screen (Error 30)

A row or column number specified in an @ command is larger than the number of rows or columns on the screen, window, or printer.


Error 1598
Rule and trigger code must balance transaction usage (Error 1598)

A rule or trigger expression, or code invoked from an expression, has either started a transaction that it did not finish or finished one that it did not start. The write attempt that fired the rule or trigger code has been aborted.


Error 1405
RUN|! command failed (Error 1405)

The operating system has returned an error to Visual FoxPro indicating that it cannot create a process to execute a RUN command.

•	Most often, this error is the result of the inability to find the shell program to be executed, or insufficient free memory to load the shell program into memory.


Error 1411
RUN|! command string is too long (Error 1411)

The command string included with the RUN command is too long. The maximum length allowed is approximately 240 characters.


Error 1490
Saving a converted form as a class is not supported (Error 1490)

You have attempted to save a FoxPro 2.x converted screen as a class with the SaveAsClass method. This is not a valid operation.


Error 1507
Screen code is too large for available memory (Error 1507)

The screen object you are trying to copy has code larger than 64 KB.


Error 1851
SELECTs are not UNION compatible (Error 1851)

Data types or sizes of fields being projected in each SELECT statement are not identical.


Error 1715
Server "server" is not found (Error 1715)

The server specified with the SET PRINTER TO command could not be found.


Error 1540
Session number is invalid (Error 1540)

Use a valid session number with SET DATASESSION TO.


Source code not found.

The file you specified cannot be located in the specified directory.


Source code out of date.

The date source code you specified does not match the compiled (.FXP) file.


Error 1845
SQL expression is too complex (Error 1845)

Visual FoxPro ran out of memory when it tried to expand the SELECT statement in order to analyze it.


Error 1499
SQL parameter "name" is invalid (Error 1499)

The SQL parameter definition in a SQLEXEC( ) call, or in a view definition, contains a syntax error.

•	It is missing the closing character for a string constant or a closing right parenthesis.

Check the parameter definition following the “?” operator in the SQL string and correct the parameter syntax.


Error 1493
SQL parameter is missing (Error 1493)

The parameter marker (?) in a SQL statement used in SQLEXEC( ) or in a view definition is not followed by the parameter expression.

Add the parameter expression after the parameter marker.


Error 1465
SQL pass-through internal consistency error (Error 1465)

Internal SQL pass-through error.

Record your recent actions while using Visual FoxPro and then call Microsoft Support.


Error 1498
SQL SELECT statement is invalid (Error 1498)

The SQL statement which defines a view is missing the SELECT or FROM clause. Correct the syntax of the SQL statement. For more information, see SELECT - SQL.


Error 1472
SQL statement parameter is required for non-prepared SqlExec( ) calls (Error 1472)

You must either use SQLPREPARE( ) first or include a SQL statement in the call to SQLEXEC( ).

•	SQLPREPARE( ) has not been called.

Include a SQL statement directly in SQLEXEC( ) or call SQLPREPARE( ) before calling SQLEXEC( ).

•	The prepared state has been cleared because SQLEXEC( ) was called with a cSQLCommand argument or because SQLPREPARE( ) was called.

Call SQLPREPARE( ) again.


Error 1811
SQL: Aggregate on non-numeric expression (Error 1811)

There was an attempt to perform an average, sum, standard deviation or variance on a non-numeric field.


Error 1802
SQL: Cannot locate table (Error 1802)

The table you have specified could not be found.


Error 1806
SQL: Column "field | variable" is not found (Error 1806)

The field or variable you specified cannot be found.


Error 1819
SQL: DISTINCT is invalid (Error 1819)

You can use only one DISTINCT clause per level.


Error 1831
SQL: Error building temporary index (Error 1831)

A temporary index could not be built, possibly due to insufficient disk space.


Error 1801
SQL: Error correlating fields (Error 1801)

An outer reference can be used only in syntax similar to the following:

X = Y

Syntax such as X = Y + 1 or X = 5 will produce this error.


Error 1818
SQL: FROM clause is required (Error 1818)

There must be a FROM clause in the SELECT command. For more information, see SELECT - SQL.


Error 1807
SQL: GROUP BY clause is invalid (Error 1807)

There is an error in the GROUP BY clause. For more information, see SELECT - SQL.


Error 1803
SQL: HAVING clause is invalid (Error 1803)

There is an error in the HAVING clause.

For example, the clause might not contain a logical expression. For more information, see SELECT - SQL.


Error 1828
SQL: Illegal GROUP BY in subquery (Error 1828)

When using one of the six operators +, -, *, /, < and >, there can be only one row of output. For more information, see SELECT - SQL.


Error 1830
SQL: Index is not found (Error 1830)

Visual FoxPro could not find the existing index. For more information, see SELECT - SQL.


Error 1800
SQL: Internal error (Error 1800)

An internal error has occurred.

Record your recent actions while using Visual FoxPro and then call Microsoft Support.


Error 1822
SQL: Invalid aggregate field (Error 1822)

You have attempted to perform aggregation on a Memo field.


Error 1865
SQL: Invalid SET expression in UPDATE (Error 1865)

Check the expressions in your SET clauses. For more information, see the UPDATE command.


Error 1866
SQL: Invalid TOP specification (Error 1866)

The TOP clause of the SELECT - SQL command requires a value greater than zero. If the PERCENT clause is present, the value must be greater than zero and less than 100. In both cases, the value must be numeric.


Error 1810
SQL: Invalid use of subquery (Error 1810)

A subquery was used in a place where it wasn't expected. For more information, see SELECT - SQL.


Error 1839
SQL: Operation was canceled (Error 1839)

There was an attempt to run a SELECT statement on a table when SAFETY was ON and the user chose not to overwrite the table. For more information, see SELECT - SQL.


Error 1808
SQL: ORDER BY clause is invalid (Error 1808)

One of the fields chosen for the ORDER BY clause is not in the SELECT list. This occurs only when using numeric indexing as in the following example where the number chosen exceeds the number of fields selected:

SELECT a,b,c FROM table ORDER BY 4

For more information, see SELECT - SQL.


Error 1809
SQL: Out of memory (Error 1809)

Visual FoxPro has run out of memory while trying to process your SELECT command. For more information, see SELECT - SQL.


Error 1814
SQL: Queries of this type are not supported (Error 1814)

You have attempted to run a query that is not supported by FoxPro versions 2.5 through the current version. For more information, see SELECT - SQL.


Error 1820
SQL: SELECT contains invalid * (Error 1820)

You have attempted to use * in one of the aggregate functions of MAX( ), MIN( ), AVG( ), or SUM( ).

For more information, see SELECT - SQL and the CALCULATE command.


Error 1826
SQL: SELECT is invalid (Error 1826)

You have attempted to select more than one field in a subquery. For more information, see SELECT - SQL.


Error 1804
SQL: Statement is invalid (Error 1804)

There is an error in the projection list. For more information, see SELECT - SQL.


Error 1812
SQL: Statement too long (Error 1812)

The object code is too long to be compiled. For more information, see SELECT - SQL.


Error 1825
SQL: Subquery is invalid (Error 1825)

Something in the subquery is erroneous. For more information, see SELECT - SQL.


Error 1842
SQL: Subquery nesting is too deep (Error 1842)

Visual FoxPro does not support nested subqueries. For more information, see SELECT - SQL.


Error 1841
SQL: Too many columns referenced (Error 1841)

There must be no more than 256 columns total referenced in any SELECT command. For more information, see SELECT - SQL.


Error 1864
SQL: Too many fields in UPDATE (Error 1864)

You have attempted to issue UPDATE - SQL with more than 128 fields to update.


Error 1805
SQL: Too many subqueries (Error 1805)

The number of subqueries allowed in Visual FoxPro is two per SELECT statement. For more information, see SELECT - SQL.


Error 1834
SQL: Too many UNIONs (Error 1834)

The maximum number of UNIONs (10) has been exceeded. For more information, see SELECT - SQL.


Error 1867
SQL: TOP requires an ORDER BY (Error 1867)

You must provide an ORDER BY clause if you use the TOP clause. For more information, see SELECT - SQL.


Error 1813
SQL: Use of UNION in subquery is invalid (Error 1813)

UNION is not supported in subqueries in Visual FoxPro. For more information, see SELECT - SQL.


Error 1833
SQL: WHERE clause is invalid (Error 1833)

There is an error in the WHERE clause. For more information, see SELECT - SQL.


Error 61
SQRT( ) argument cannot be negative (Error 61)

SQRT( ) function arguments must not be negative.


Error 95
Statement is not allowed in interactive mode (Error 95)

The commands IF, ELSE, ENDIF, TEXT, ENDTEXT, EXIT, RETRY, RETURN, SUSPEND, DO WHILE, ENDDO, DO CASE, ENDCASE, SCAN, ENDSCAN, FOR, and ENDFOR are not allowed in the Command window; you must use these statements in a program.


Error 1931
Statement is not in a procedure (Error 1931)

Statements are not allowed after the ENDPROC clause. For more information, see DEFINE CLASS.


Error 1927
Statement is not valid in a class definition (Error 1927)

You have used a command that is not permitted within a DEFINE CLASS structure. Valid commands are: ADD OBJECT, ADD PROTECTED OBJECT, DIMENSION, FUNCTION, PROCEDURE, and PROTECTED. For more information, see DEFINE CLASS.


Error 1928
Statement is only valid within a class definition (Error 1928)

PROTECTED, ADD OBJECT, and ADD PROTECTED OBJECT commands are valid only within a class definition. For more information, see DEFINE CLASS.


Error 1934
Statement only valid within a method (Error 1934)

You have attempted to use the :: (scope resolution) operator outside of a method. Since the scope operator is driven from the THIS object reference, it can only be used within a method.


Error 1903
String is too long to fit (Error 1903)

The allowable string length was exceeded.


Error 1707
Structural .CDX file is not found (Error 1707)

The structural index file associated with a table file could not be found.


Error 1235
Structure is invalid (Error 1235)

In CREATE FROM, a table was specified whose structure does not match the STRUCTURE EXTENDED format.


Error 1212
Structure nesting is too deep (Error 1212)

The maximum structured programming command nesting of 64 levels has been exceeded.


Error 1860
Subquery returned more than one record (Error 1860)

Subqueries linked with the six normal operators <>, =, <=, >=, < or >, excluding ALL or ANY, can produce only a one-row result.


Error 1234
Subscript is outside defined range (Error 1234)

An attempt was made to reference an array element with a subscript that is outside of the range defined in the DIMENSION statement.


Error 1236
Suspend program before using RESUME (Error 1236)

RESUME is applicable only when a program is suspended.


Error 1673
Symphony version 1.0 file format is invalid (Error 1673)

The Symphony file you have attempted to import is either not version 1.0 or has been corrupted.


Error 1674
Symphony version 1.1 file format is invalid (Error 1674)

The Symphony file you have attempted to import is either not version 1.1 or has been corrupted.


Error 1242
Syntax error in the field expression (Error 1242)

There is an invalid expression involving a field.


Error 10
Syntax error (Error 10)

You have issued a command that is syntactically incorrect.

•	You might have misspelled the command or variable name, or used a clause that is not valid in the current context.

Press F1 to see context-sensitive help on the command.


Error 228
Tab stops must be in ascending order (Error 228)

The tab stops defined for the system variable _TABS must be in ascending order.


Error 1548
Table "alias" has one or more non-structural indexes open.  Please close them and retry the Begin Transaction (Error 1548)

Close all non-structural (non-.CDX) indexes and try the operation again.

If other indexes are open on the file, their writes will go directly to disk and will not be reflected in the table changes until you issue END TRANSACTION. Consequently, if a ROLLBACK is issued, the non-structural indexes will be incorrect.


Error 1564
Table "name" already exists in the database (Error 1564)

You have attempted to add a table to the database that was already in the database.


Error 1577
Table "name" is referenced in a relation (Error 1577)

You cannot remove a table from a database if that table is involved in a relation.

Delete the relation first.


Error 1545
Table buffer for alias "name" contains uncommitted changes (Error 1545)

The named cursor has a modified table buffer and these changes must be explicitly committed, using TABLEUPDATE( ), or discarded, using TABLEREVERT( ), before either the cursor can be closed or the buffering mode changed.


Error 1596
Table buffering is not enabled (Error 1596)

You have attempted to use the GETNEXTMODIFIED( ) function, which requires table buffering to be enabled.

Enable table buffering or use a different function.


Error 1556
Table cannot be browsed because cursor object is no longer valid. (Error 1556)

Close and reopen the Form Designer to resynchronize the table and the cursor.


Error 26
Table has no index order set (Error 26)

The records in the table have no order.

•	An index for the table file was not selected when an UPDATE command using the RANDOM clause was encountered.

Select an index for the table file.

•	A FIND or SEEK was attempted against a table with no index ordering.

Use SET ORDER TO to specify an index order.

•	SET RELATION was issued with a non-numeric expression.

Provide a numeric expression.


Error 17
Table number is invalid (Error 17)

Select a table number between 1 and 225.


Error 1690
Table operation is invalid during indexing (Error 1690)

You have attempted to perform a table operation in a user-defined function referenced with an index expression.


Error 1589
Table or row buffering requires that SET MULTILOCKS is set to ON (Error 1589)

All buffering modes require MULTILOCKS to be enabled. TO disable buffering, set buffering to 1 (DB_BUFOFF) using CURSORSETPROP( ).


Error 1888
Tag name is too long (Error 1888)

Tag names cannot exceed 10 characters.


Error 1147
Target table is already engaged in a relation (Error 1147)

There is more than one relationship between the currently selected table file and one of its targets.


Error 1792
Text generation is canceled (Error 1792)

The text generation program, SCCTEXT.PRG (or the program whose value is stored in the _SCCTEXT system variable), has been halted.

•	You pressed the ESC key.

The program was creating text versions of project files to check into source control. Avoid pressing ESC while checking files in.


Error 1954
The builder program is already running (Error 1954)

You have attempted to invoke a builder program while the builder is already running. This is not a valid operation.


Error 1478
The ChildOrder property of a relation object in the data environment is no longer valid.  The relation is being removed (Error 1478)

Due to data environment changes, the relation of a ChildOrder property has been removed.


Error 2020
The class file associated with this field cannot be found - class association cleared. (Error 2020)

The class is not valid or cannot be found.

•	You modified a table that had a field/class association whose class file could not be read.

Assign a valid class to the field.


Error 1969
The clipboard contained one or more objects that could not be added to the container.  Those objects were not pasted (Error 1969)

You have attempted to paste something invalid — for instance, a toolbar separator — onto a form or control.


Error 1935
The current object does not inherit from class "name" (Error 1935)

You have specified a class name that is not in the inheritance hierarchy of the current object.


Error 1945
The current object has been released (Error 1945)

You have issued RELEASE THIS in the destroy event of the current object.


Error 1742
The data source for this object must be a variable reference (Error 1742)

You have specified an invalid data source or control source for an object.

•	A data source or ControlSource property must contain a variable.

Make sure you have not specified an expression.


Error 1557
The database must be opened exclusively (Error 1557)

Commands such as VALIDATE DATABASE RECOVER, PACK DATABASE, and those involving creation or modification of database objects require exclusive access to the database.

Close the database and reopen it using OPEN DATABASE FileName EXCLUSIVE.


Error 1997
The default value for field "name" does not evaluate to the correct type for the field (Error 1997)

A default value expression must evaluate to the data type for the field.

Change the expression to evaluate to the correct data type.


Error 1962
The directory is not empty (Error 1962)

You cannot delete a directory that contains files or subdirectories.


Error 1984
The fields in table "name" did not match the entries in the database (Error 1984)

When opening a database-owned table, Visual FoxPro tries to confirm that each field of the table has a matching field object in the database.

•	The database or the table has been corrupted.

Use VALIDATE DATABASE to identify the problem.

•	The table being opened is the wrong one.

Remove and re-add the table to the database.


Error 1131
The file specified in the FROM clause is empty (Error 1131)

There are no records in this file.


Error 1699
The IN clause is not supported for this window (Error 1699)

This window cannot be placed inside another window.

•	You used the ACTIVATE WINDOW command to try and place one of the debugger windows inside another window.

Use a different window, or change your debugging environment in the Debug tab of the Options dialog box.


Error 1998
The index expression for index "name" contains an invalid reference to a Memo, General, or Picture field (Error 1998)

You cannot index on Memo, General, or Picture field types.


Error 42
The LOCATE command must be issued before the CONTINUE command (Error 42)

You have attempted to execute a CONTINUE command without first executing a LOCATE command.


Error 1571
The name "name" is already used for another object.  Please choose a different name (Error 1571)

No two top-level objects in the database can have the same database name.

Use DISPLAY DATABASE to see a list of all the objects in the database.


Error 2001
The name of the object file for "file" is already used by another program in the project (Error 2001)

Select a different file name.


Error 1793
The network request is not supported (Error 1793)

Visual FoxPro was unable to obtain information about a file on the network.

•	There are no drive letters available.

Free up a drive letter and try the request again.


Error 1438
The ActiveX control module failed to register correctly (Error 1438)

The file does not appear to be a valid ActiveX control.

•	The ActiveX control does not have a self-registration function.

Contact the ActiveX control vendor for an updated control that contains a working DllRegisterServer function.


The Remote View Wizard was unable to obtain column information for this remote table.
The Remote View Wizard was unable to obtain column information for this remote table. This may be the result of an ODBC error, or the remote table may not be owned by the current user.

If the query you are using doesn't contain the owner name for the table you specified, the information from the remote table will be unavailable.

To correct this problem, use the View Designer to add the current user as the owner of the table to the SQL string.

If you still get an error, you must correct the problem in ODBC.


Error 1524
The selected printer driver does not support direct access (Error 1524)

The printer you have selected and set through your operating system does not allow direct access. You can try the Generic/Text Only driver, or the equivalent, in Windows. Bear in mind that the "ASCII File" option in Visual FoxPro bypasses the printer driver and sends the contents of the selected file directly to the printer. You are responsible for making sure that any file sent in this manner contains valid printer commands, and/or that an appropriate driver is selected.


Error 1531
The table changes cannot be performed as the index or filter expression for index name would be invalid (Error 1531)

You have attempted to use the ALTER TABLE command where the result would render an existing index or filter expression invalid, even if it not explicitly modified by the ALTER TABLE command.


Error 2004
The table file "name" has moved.  Please validate database "name" and try again (Error 2004)

A cursor that is part of a data environment cannot find a table that is part of a database (.DBC file).


Error 1659
The table has memo fields that cannot be converted while open read-only (Error 1659)

You have attempted to perform a read-only operation on a dBASE IV style memo. Visual FoxPro cannot convert a memo in a read-only operation.


Error 1778
The table must be converted before appending (Error 1778)

You have attempted to use the APPEND FROM command on a table that was not created with Visual FoxPro.

Back up your original file and convert a copy of the table for use with Visual FoxPro.


Error 1982
The TO clause can only be used with modal Forms and FormSets (Error 1982)

You have attempted to use the DO FORM command with the TO clause:

DO FORM x TO variable.

This operation is illegal on modeless forms and form sets.


Error 1996
The validation rule for field "name" does not evaluate to a logical or NULL type (Error 1996)

The field validation rule result must be either a Logical type or a NULL.


Error 1213
There is a missing keyword in the FOR ... ENDFOR or DO CASE ... ENDCASE command structure (Error 1213)

For more information, see the FOR ... ENDFOR and DO CASE ... ENDCASE topics.


Error 56
There is not enough disk space for "name" (Error 56)

There is no room on the disk to complete this operation.

•	Your disk is full.

Free up some disk space and retry the operation.

•	Under certain versions of Novell, you tried to extend a file that has no owner. This error is returned but is not correct.

Work around the problem by assigning an owner to the file first.


Error 43
There is not enough memory to complete this operation (Error 43)

Free some memory currently in use and try this operation again.


Error 1780
This array element has been defined as an object and cannot be redefined in the class definition (Error 1780)

Once you have defined an array element as an object member in a class definition, it cannot be redefined.

For example, the following code would cause this error:

DEFINE CLASS test AS form

DIME a[1]

ADD OBJECT a[1] AS commandbutton

a[1] = 10

ENDDEFINE


Error 1777
This command is not supported for views (Error 1777)

Views cannot be changed with this command. This error has the following causes and solutions:

•	Using one of the following commands to change view structure: ALTER TABLE, CREATE TRIGGER, DELETE TRIGGER, and MODIFY STRUCTURE.

Use a command that operates on views, or use a table instead.

•	Modifying the structure of a view cursor with the Table Designer.

Use the View Designer to permanently modify the structure of cursors produced with a view definition.


Error 1784
This object is derived from a base class and does not have a parent class. (Error 1784)

The default class cannot be found. For more information, see DODEFAULT( ).


Error 1782
This OLE property cannot be an expression (Error 1782)

You have attempted to set some of the OLE properties to be an expression in the property sheet. This is not a valid operation.


Error 1521
This operation not supported for class member objects (Error 1521)

You have attempted to clone or copy an object that is a member of a class.


Error 1533
This property is read-only (Error 1533)

You cannot change the value of a read-only property.


Error 1916
To use this feature, set CODEPAGE=AUTO in your CONFIG.FPW file and restart Visual FoxPro (Error 1916)

This error occurred due to an invalid designation with the SET COLLATE command.


Error 1229
Too few arguments (Error 1229)

A function call contains less than the required number of arguments.


Error 1230
Too many arguments (Error 1230)

A function call contains more than the permitted number of arguments.


Error 1310
Too many characters are specified in the PICTURE clause (Error 1310)

The amount of characters permitted in a PICTURE clause is limited by memory.


Error 1872
Too many columns (Error 1872)

You can have a maximum of 255 fields per record.


Error 1694
Too many extensions are specified (Error 1694)

Too many file extensions have been included in a GETFILE( ), LOCFILE( ), or PUTFILE( ) function.

Include no more than 30 file extensions.


Error 6
Too many files open (Error 6)

Visual FoxPro has attempted to open more than its internal limit of files.


Error 1201
Too many names used (Error 1201)

As a program was being loaded or a table was being opened, the Visual FoxPro name table overflowed.

Divide the program into smaller modules.


Error 1250
Too many PROCEDURE commands are in effect (Error 1250)

The number of procedures is limited to the amount of memory you have.


Error 1249
Too many READ commands are in effect (Error 1249)

The maximum nesting level for the READ command (5) in effect has been exceeded.


Error 1161
Too many records to browse or edit in the demo version (Error 1161)

The maximum number of records you can browse or edit in the demo version of Visual FoxPro is 120.


Error 22
Too many variables (Error 22)

The maximum number of variables that can be created has been exceeded.


Error  Error 1116
Too many windows open (Error 1116)

No more windows can be created.

•	You have too many application windows open.

Close open applications.

•	There are not enough resources available.

Restart Windows.


Error 1646
Total field type must be Date or Numeric (Error 1646)

A report expression that includes a total specification is not numeric type.


Error 1246
Total label width exceeds allowed size (Error 1246)

The LABEL command detected a condition where the sum of the individual label widths plus separating spaces is greater than the maximum width allowed.


Error 1539
Trigger failed (Error 1539)

Fix record values so the trigger won’t fail, or revert the record.


Error 1532
Type conversion is not supported (Error 1532)

SQL parameter conversion error. Internal connectivity error.

Record your recent actions while using Visual FoxPro and then call Microsoft Support.


Error 1501
Type conversion is not supported for output parameters (Error 1501)

SQL parameter conversion error. Internal connectivity error.

Record your recent actions while using Visual FoxPro and then call Microsoft Support.


Error 1543
Type conversion required by the DataType property for field "name" is invalid (Error 1543)

The type conversion between the remote data type and the Visual FoxPro data type, specified by the view field DataType property, is not supported for the field of the view that is being activated.

Change the view field DataType property to a valid type.


Error 1410
Unable to create temporary work files (Error 1410)

A SORT or INDEX command that requires temporary work files was not permitted by the operating system to create them.

•	Your directory is full.

Remove some files.

•	Visual FoxPro does not have permission to access the temporary files directory.

Verify your permissions.


Error 1717
Unable to generate a printer driver (Error 1717)

The printer driver associated with the report or label you have chosen cannot be generated or loaded.


Unable to locate desired version of Visual FoxPro.

The version of Visual FoxPro requested is not on the designated path.


Unable to process error.

No error number is returned. Visual FoxPro closes all open files and exits.

Record your recent actions while using Visual FoxPro and then call Microsoft Support.


Error 1437
Unable to register the ActiveX control (Error 1437)

The file does not appear to be a valid ActiveX control.

•	The ActiveX control does not have a self-registration function.

Contact the ActiveX control vendor for an updated control that contains a working DllRegisterServer function.


Error 1884
Uniqueness of index "name" is violated (Error 1884)

The uniqueness of primary or candidate key is violated.

Fix the record values or revert them.


Unknown error code nExpr.

No error number is returned. Visual FoxPro closes all open files and exits.

Record your recent actions while using Visual FoxPro and then call Microsoft Support.


Error 104
Unknown function key (Error 104)

An attempt was made to use SET FUNCTION with a function key that does not match the name or number of an existing function key.


Error 1925
Unknown member "name" (Error 1925)

Visual FoxPro attempted to evaluate the following syntax:

objvar.memberobj.property

No member named memberobj was found.

•	You were attempting to access the members of a control class from outside the class.

Make sure references to controls, such as with .ActiveControl, are within scope.


Error 16
Unrecognized command verb (Error 16)

A word used at the beginning of the command line was not a valid Visual FoxPro command. For more information, see Reserved Words.


Error 1141
Unrecognized index file revision.  Re-create the index (Error 1141)

The index file is in a format that is not compatible with this version of Visual FoxPro.

Recreate the index.


Error 1692
Unresolvable REGIONAL name conflict (Error 1692)

Visual FoxPro has attempted to create a REGIONAL variable name that already exists.


Error 1595
Update conflict.  Some of your changes in the current row batch were committed.  Use TABLEUPDATE( ) with the lForce parameter to commit the update or the manual transaction to roll back the update (Error 1595)

The multitable update was not included in a remote transaction and failed.

•	Some of the tables involved in the update may be committed in the base remote tables.

Force the update for the current row or current row batch or rollback the remote manual transaction on the current connection. For more information, see TABLEUPDATE( ).


Error 1585
Update conflict (Error 1585)

An optimistic locking conflict has been detected while trying to update a view.

Make sure your update key is valid.

If you want to commit your changes to the base table(s), call TABLEUPDATE( ) with lForce. This will overwrite the changes made to the base table since the view was last fetched.

To discard the local changes made to the view, call TABLEREVERT( ).


Error 1097
User-defined functions are not allowed (Error 1097)

User-defined functions are not supported in this area of Visual FoxPro.

Remove the user-defined function.


Error 12
Variable "variable" is not found (Error 12)

The specified variable could not be found.


Error 1134
Variable must be in the selected table (Error 1134)

You can only use fields from the currently selected table in quick screens.


Error 1494
View definition has been changed (Error 1494)

The view cannot be re-queried.

•	The view definition in the database has been changed.

Close and reopen the view. To ensure that the view is not changed, open the database exclusively.


Error 1568
View fields have been changed. The Update and Key field properties have been reset to the default values (Error 1568)

You have attempted to modify a view whose table structure has changed. When you choose OK, the View Designer displays previous view conditions, but the Update Criteria tab resets to the default conditions. There has been no update.


Error 127
View file is invalid (Error 127)

An attempt has been made to open a view file with invalid data.


Error 1597
Views require either DB_BUFOPTROW or DB_BUFOPTTABLE (Error 1597)

Local or remote view-based cursors support updating only by way of an optimistic buffering mode.


Visual FoxPro cannot start

Visual FoxPro cannot be initialized or configured for one of the following reasons:

•	Insufficient memory.

Visual FoxPro could not allocate sufficient memory for internal structures. Free up memory and restart Visual FoxPro.

•	Insufficient disk space.

Visual FoxPro could not allocate temporary files. Free up disk space and restart Visual FoxPro.

•	VFP5.DLL could not be loaded.

Visual FoxPro cannot find VFP5.DLL because it is missing or has been renamed. Reinstall Visual FoxPro.

•	The resource file you specified with the -L startup switch could not be loaded.

Visual FoxPro cannot find the file you specified. Check that the file you specified with the -L switch is available.

•	Visual FoxPro requires Windows 95 or Windows NT 3.51.

Install Windows 95 or Window NT 3.51.

•	Product in use by another.

Make sure that you have the correct network access rights. See your Windows documentation.

•	Invalid or missing .EXE file.

Reinstall Visual FoxPro.


Error 1485
Warning:  Invalid data conversion(s) starting at record "number" (Error 1485)

A data conversion error was reported while fetching data in record number of the remote result set.

•	The ODBC driver cannot convert some remote data values into the local view data type.

Use a conversion function in the remote SQL statement to convert the data to a different data type before being fetched; use the DataType view field property to change the local data type.


Error 1486
Warning:  Invalid memo field conversion(s) starting at record "number" (Error 1486)

A memo conversion error was reported while fetching large data in record number of the remote result set.

•	The ODBC driver cannot convert some large remote data values into the local view data type.

Use a conversion function in the remote SQL statement to convert the data to a different data type before being fetched; use the DataType view field property to change the local data type. Use server-specific settings to limit the amount of data sent for each large data value.


Error 1496
Warning:  No information is available to check remote update conflicts (Error 1496)

The ODBC driver does not report the number of records affected by an UPDATE, DELETE, or INSERT statement. Optimistic locking conflicts on remote views using this connection will not be reported.

Be sure your update code handles this limitation.


Error 1483
Warning:  The connection packet size cannot be set (Error 1483)

The connection packet size cannot be set by the ODBC driver. The connection will use the default driver defined packet size. This might affect performance on this connection.

Check the driver and network documentation for alternative ways to set up the network packet size.


Error 1480
Warning:  The connection sync/async mode cannot be set (Error 1480)

The connection sync/async mode cannot be set by the ODBC driver. The connection will use the default driver defined sync/async mode. This will not allow SQL pass-through functions to return control while an ODBC call is in progress.


Error 1481
Warning:  The connection timeout cannot be set (Error 1481)

The connection timeout interval cannot be set by the ODBC driver. The connection will use the default driver defined timeout interval. This will not allow SQL pass-through functions to return control while an ODBC call is in progress.


Error 1487
Warning:  The connection transaction mode cannot be set (Error 1487)

The connection transaction mode cannot be set by the ODBC driver. The connection will use the default driver defined transaction mode.


Error 1495
Warning:  The key defined by the KeyField property for table "alias" is not unique (Error 1495)

The key specified for this table changed more than one row in the base table for some of the remote view rows being updated.

Redefine the key using the KeyField view property.


Error 1484
Warning:  The next "cExpr" modified records have already been updated remote (Error 1484)

An error has occurred while trying to update a batch of modified rows of a remote view, in the view cursor, after the batch has been successfully updated in the remote base table.

Turn off the SendUpdates view property and commit the records by calling TABLEUPDATE( ).


Error 1482
Warning:  The query timeout cannot be set (Error 1482)

The connection query timeout cannot be set by the ODBC driver. The connection will use the default driver defined query timeout.


Error 1908
Width or decimal place argument is invalid (Error 1908)

Either the length or decimal argument was invalid in the STR( ) function.

The sum of the specified left margin and paragraph indent exceeds the right margin.


Error 1955
WIN.INI/registry is corrupted (Error 1955)

You have attempted to get print information from the operating system by using PRTINFO( ) or SET PRINTER TO but no default printer is selected.

Use the Printer Control Panel to select set a default printer.


Error 1714
Window “name” has not been defined (Error 1714)

You have referenced a window that does not exist.

•	The window has not been created, or it has already been destroyed.

Create the window, or reference a different window.


Error 1632
Window file format is invalid (Error 1632)

The window save file (.WIN) being restored does not contain valid data.


Error 215
Window has not been activated with ACTIVATE WINDOW (Error 215)

An attempt was made to use a window which has not been activated. For more information, see ACTIVATE WINDOW.


Error 214
Window has not been defined with DEFINE WINDOW (Error 214)

An attempt has been made to activate a window that has not been defined.

Use the DEFINE WINDOW command before using the ACTIVATE WINDOW command.


Error 332
Window specified in DEFINE WINDOW has invalid coordinates (Error 332)

An attempt was made to define a window's coordinates outside the allowable range.


Error 1939
WITH/ENDWITH mismatch (Error 1939)

You must have a corresponding ENDWITH statement for every WITH statement.


Error 1775
Worksheet "name" is not found (Error 1775)

You are trying to specify a worksheet name that does not match a name in the specified .XLS file.

Verify the worksheet name and try the operation again.


Error 1680
Worksheet A for Lotus 1-2-3 version 3.0 file is hidden (Error 1680)

Visual FoxPro cannot import a worksheet that has been hidden.


Error 1772
You may not change the RecordSource of a BROWSE object (Error 1772)

The browse object must remain aligned with its table.

•	You tried to change the RecordSource property programmatically.

To browse a different table, close the current browse and browse the new table. For more information, see BROWSE or RecordSource.


Error 1127
You must use a logical expression with a FOR or WHILE clause (Error 1127)

A FOR or WHILE clause within a command does not contain a logical expression. For more information, see Creating Logical Expressions.


Error 37
You must use a logical expression with FILTER (Error 37)

You have attempted to issue SET FILTER TO on an expression that is not a logical expression. For more information, see Creating Logical Expressions.


No Help topic is associated with this item.


FPOLE.DLL

Example

With FPOLE.DLL, you can run Visual FoxPro commands and evaluate Visual FoxPro expressions from applications that allow API calls but do not support Automation.

FPOLE.DLL contains six the following functions.

To	See
Run a Visual FoxPro command.	FoxDoCmd( )
Evaluate a Visual FoxPro expression	FoxEval( )
Specify whether error messages are displayed in message boxes.	SetErrMode( )
Specify the OLE class that FoxDoCmd( ) and FoxEval( ) create.	SetOleObject( )
Close the OLE object created when you use FoxDoCmd( ) or FoxEval( ).	CloseIt( )
Retrieve the last error that occurred.	GetLastErr( )


FoxDoCmd( ) Function (FPOLE.DLL)

Runs a Visual FoxPro command from an application that allows API calls.

Syntax

nSuccess = FoxDoCmd(cFoxCommand, cOptions)

Returns

Integer

Arguments

cFoxCommand   Specifies the Visual FoxPro command to run.

cOptions   One or more of the following.

Setting	Description
	(Blank) Runs the specified command without activating the main Visual FoxPro window.
a	Activates the main Visual FoxPro window and runs the specified command.
i	If Visual FoxPro is not running, activates Visual FoxPro without making the Visual FoxPro window visible.
t	If another program is already running in Visual FoxPro, displays an error message rather than executing cFoxCommand.
Remarks

Returns -1 if the Visual FoxPro command is successfully executed; 0 otherwise.

If Visual FoxPro 5.0 is already running, FoxDoCmd( ) sends the command to Visual FoxPro. If Visual FoxPro is not already running, FoxDoCmd( ) runs Visual FoxPro and sends the command.

Example

*In Visual FoxPro 3.0 or 5.0

DECLARE integer FoxDoCmd in "FPOLE.DLL" string,string

=FoxDoCmd("SELECT * FROM customer","at")


FoxEval( ) Function (FPOLE.DLL)

Evaluates a Visual FoxPro expression from an application that allows .DLL calls.

Syntax

nExprLen = FoxEval(cExpression, cBuffer, nLen)

Returns

Integer

Arguments

cExpression   The Visual FoxPro expression to evaluate.

cBuffer   Where to store the value of the Visual FoxPro expression.

nLen   The length of cBuffer.

Remarks

Returns the length of the string stored in cBuffer if successful; -1 otherwise.

You need to pass the cBuffer argument by reference rather than by value for Visual FoxPro to be able to store a value in the buffer. In Visual FoxPro, for example, declare the function with @ after the second string. Arguments are passed by reference by default in Word Basic.

Because there is no way to create and read a buffer in a Help file macro, this function is not useful as a registered routine in Help.

Example

*In Visual FoxPro

DECLARE integer FoxEval in (MYDLL) ;

string, string @, integer

cBuff = SPACE(100)

=FoxEval("TTOC(DATETIME())","cBuff" @, 100)

?cBuff


SetErrMode( ) Function (FPOLE.DLL)

Specifies whether or not error messages from FPOLE.DLL are displayed in message boxes.

Syntax

nSuccess = SetErrMode(nErrMode)

Returns

Integer

Arguments

nErrMode   One of the following.

Setting	Description
0	Error messages are not displayed in message boxes.
1	(Default) Error messages are displayed in message boxes.
Remarks

Returns -1 if the mode was successfully set; 0 otherwise.


SetOLEObject( ) Function (FPOLE.DLL)

Specifies the OLE class that calls to FoxDoCmd( ) and FoxEval( ) create.

Syntax

nSuccess = SetOleObject(cOLEClass)

Returns

Integer

Remarks

Returns -1 if the class was specified successfully; 0 otherwise.

Specify your application in SetOLEObject( ) to allow Automation from applications that don’t natively support Automation.

Example

DECLARE integer SetOLEObject in (MYDLL) string

=SetOleObject("visualfoxpro.application")


CloseIt( ) Function (FPOLE.DLL)

Closes the OLE object created when you use FoxDoCmd( ) or FoxEval( ).

Syntax

nSuccess = CloseIt( )

Returns

Integer

Remarks

Returns -1 if the object was removed successfully; 0 otherwise.


GetLastErr( ) Function (FPOLE.DLL)

Retrieves the last error that occurred.

Syntax

nErrLen = GetLastErr(cBuffer, nLen)

Returns

Integer

Arguments

cBuffer   Where to store the error message.

nLen   The length of cBuffer.

Remarks

Returns the length of the string stored in cBuffer if successful; -1 otherwise.

You need to pass the cBuffer argument by reference rather than by value for Visual FoxPro to be able to store a value in the buffer. In Visual FoxPro, for example, declare the function with @ after the second string. Arguments are passed by reference by default in Word Basic.

Because there is no way to create and read a buffer in a Help file macro, this function is not useful as a registered routine in Help.


FPOLE Examples

The following examples demonstrate using functions in FPOLE.DLL from Visual FoxPro, a Help file, and Word Basic.

Visual FoxPro Example

MYDLL = "C:\vfp\fpole.dll"

DECLARE integer SetOleObject in (MYDLL) string

DECLARE integer FoxDoCmd in (MYDLL) string,string

DECLARE integer FoxEval in (MYDLL) ;

string, string @,integer

=SetOleObject("visualfoxpro.application")

?FoxDoCmd("wait wind 'test' timeout 2","")

?FoxDoCmd("modi proj xx2 nowait ","")

?FoxDoCmd("close all","")

CLEAR DLLS

Help File Example

1	In the [CONFIG] section of a help project, register the DLL:

RegisterRoutine("fpole.dll","FoxDoCmd","SS")

2	In your .RTF file, call the function the same way you would call a native Help macro:

HotSpotText!FoxDoCmd("DO (HOME() + 'myprg')","at")

3	Compile and run the help file.

Simple Word Basic Example

Declare Sub FoxDoCmd Lib "c:\vfp\fpole.dll" (cCommand As String, cOptions As String)

Sub MAIN

FoxDoCmd "USE c:\vfp\samples\data\customer", "i"

FoxDoCmd "_CLIPTEXT = customer.company", "i"

EditPaste

End Sub

Another Word Basic Example

This example presents a dialog box so that a user can choose a customer ID from a list. The associated company name and contact are then inserted into the Word document.

'Declare the FPOLE.DLL functions.

'--------------------------------

Declare Sub SetOleObject Lib "c:\vfp\fpole.dll"(cApp As String)

Declare Sub FoxDoCmd Lib "c:\vfp\fpole.dll"(cCommand As String, BringToFront As String)

Declare Sub FoxEval Lib "c:\vfp\fpole.dll"(cExpression As String, cBuff As String, nLen As Integer)

Declare Sub CloseIt Lib "c:\vfp\fpole.dll"

Sub MAIN

Dim cBuffer$

cBuffer$ = String$(50, " ")

Dim aCustID$(5)

aCustID$(0) = "BLONP"

aCustID$(1) = "CHOPS"

aCustID$(2) = "ISLAT"

aCustID$(3) = "LETSS"

aCustID$(4) = "SEVES"

cboCustID = 0'1st element in the array

Begin Dialog UserDialog 404, 150, "Calling Visual FoxPro with FPOLE.DLL"

DropListBox 44, 33, 160, 108, aCustID$(), .cboCustID

Text 15, 14, 268, 13, "Choose a Customer ID from the list.", .Text2

Text 15, 61, 231, 13, "Then Choose OK to insert the ", .Text4

Text 15, 78, 215, 13, "Company Name and Contact", .Text5

Text 15, 95, 141, 13, "into your document.", .Text6

OKButton 298, 76, 88, 21

CancelButton 299, 111, 88, 21

End Dialog

Dim dlg As UserDialog

nButtonChoice = Dialog(dlg)

' If the user presses "Cancel"...

'--------------------------------

If nButtonChoice = 0 Then

Goto EndOfSub

End If

' Automate Visual FoxPro

'-----------------------

Print "Opening Visual FoxPro"

SetOleObject "visualfoxpro.application"

FoxDoCmd "USE c:\vfp\samples\data\customer", "i"

FoxDoCmd "LOCATE FOR cust_id = " + Chr$(39) + aCustID$(dlg.cboCustID) + Chr$(39), "i"

Insert "Customer ID" + Chr$(9)

FoxEval "cust_id", cBuffer$, 50

Insert RTrim$(cBuffer$)

InsertPara

Insert "Company:" + Chr$(9)

FoxEval "company", cBuffer$, 50

Insert RTrim$(cBuffer$)

InsertPara

FoxEval "contact", cBuffer$, 50

Insert "Contact: " + Chr$(9) + RTrim$(cBuffer$)

InsertPara

Print "Closing Visual FoxPro"

CloseIt

Print " "

EndOfSub:

End Sub


Glossary

A

abstraction

accented characters

access key

ActiveX component

ActiveX control

aggregate function

alias

alternate index

ANSI

API

append

application

argument

arithmetic operator

array

ASCII

Automation

B

back-end data

backlink

band

base class

base table

basic optimizable expression

binary file

bitwise

BOF

bound control

breakpoint

browse

browse sequence

buffer

buffered updates

builder lock

builders

C

calculated field

candidate index

caption

.CDX file

CGI

character expression

check box

child table

class

class library

clause

cleanup code

client/server

clipboard

code page

combo box

command

command button

command button group

compact single-entry index

comparison operator

compiler directive

compound index file

conditional branching

configuration

configuration file

conflict

connection

constant

constraints

container classes

context string

control

control array

control break

control character

control classes

control source

criteria

cross-tab query

cross-tab report

cursor

custom control

D

data binding

data definition language

data dictionary

data environment

data grouping

data session

data source

data type

data warehouse

database

database table

DBCS

DDL

deadlock

debug

default

default value

delimiter

dependent object

design time

detail band

development environment

diacritical marks

dimension

DLL

docked

dynamic-link library

drag and drop

E

edit box

element

embed

encapsulation

EOF

equi-join

escape sequence

event

event code

event-driven programming

event loop

executable program

execution plan

expression

F

field

field-level rule

file skeleton

filter

flag

FLL

floating

foreign key

form

form set

forward link

FoxPro link library

free table

FTP

function

G

gateway

generated code

generated name

globally unique identifier

grid

group band

group footer

group header

grouping records

H

handle

home page

hot spot

HTML

HTTP

hypergraphic

I

.IDX file

image

in-process

independent .IDX

index

index file

inheritance

inner join

input mask

instance

international characters

IP address

ISAPI

J

join

join condition

join operator

jump

junction table

K

key

keyword

L

label

lifetime

ligature

line

link

list box

local alias

local data

local variable

local view

locale

locked

logical operator

long names

looping

M

macro

macro substitution

main Visual FoxPro window

main file

main report

many-to-many relationship

mark character

MDI

menu

menu bar

menu item

menu title

menu system

merge conflict

metafile

method

modal

modeless

multiple-document interface (MDI) application

multiple instances

multi-tiered view

N

named connection

name expression

native data

non-compact single-entry index

nonscrolling region

normalize

null value

O

object

object-oriented programming

object linking and embedding (OLE)

ODBC

OLE server

one-to-many relationship

one-to-one relationship

OOP

Open Database Connectivity (ODBC)

optimistic buffering

option button group

outer join

out-of-process

P

page

page footer

page header

parameter

parent table

partial seek

pass by reference

pass by value

pass-through query

persistence

persistent relationship

pessimistic buffering

pixel

polymorphism

point

precedence

primary index

primary key

primary table

private variable

procedure

progressive fetching

project

projection list

property

public variable

Q

qualified

query

R

record

record-level rule

resource file

referential integrity

registry

regular index

related table

relation

relational database

relational operator

remote call procedure

remote data

remote view

report band

report detail band

report footer band

report header band

resolving a reference

rule

run time

Rushmore technology

S

schema

scope

SDI

secondary window

selection criteria

self-join

server

session

set-based data

setting

setup code

shape

shortcut menu

single-document interface (SDI) application

skeleton

sort order

spinner

SQL

SQL pass-through

SQL Server

stack

stand-alone .IDX

stored procedure

string literal

structural compound index

Structured Query Language

stub

subclass

subscript

summary band

syntax

system object

system variable

T

tab

tab order

table

tags

TCP/IP

template

temporary relationship

text box

text file

timer

title band

tool lock

toolbar

topN query

transaction

trigger

twip

U

UDC

UDF

unary operator

unique index

upsizing

URL

user-defined class

user-defined function

V

validation

variable

view

view definition

visibility

visual editing

W

wildcard

wizard

work area

World Wide Web (WWW)

X, Y, Z

Xbase

zero-length string

zoom

z-order


abstraction

Identifying the distinguishing characteristics of a class or object without having to process all the information about the class or object. When you create a class—for example, a set of table navigation buttons—you can use it as a single entity instead of keeping track of the individual components and how they interact. See also encapsulation.


accented characters

Characters, such as é and ä, that include diacritical marks. See also diacritical marks, international characters.


access key

The keyboard key corresponding to the underlined or highlighted letter in a menu or dialog box. Pressing the ALT key and the access key activates the menu or dialog box. Sometimes referred to as a hot key.


ActiveX component

An application or development tool that can use objects supplied by another application, or which exposes its own objects for use by another application. Formerly these were known as “OLE Automation servers” and “OLE Automation controllers.”


ActiveX control

The new name for programmable elements formerly known as OLE controls, OCXs, or OLE custom controls. Controls previously built with the MFC Control Developer's Kit meet the ActiveX control specification.

An ActiveX control, like a built-in control, is an object that you place on a form to enable or enhance a user's interaction with an application. ActiveX controls have events and can be incorporated into other controls. These controls have an .OCX file name extension.


aggregate function

A function that generates a single value from a group of values, often used with GROUP BY and HAVING clauses. Aggregate functions include AVG( ), COUNT( ), MAX( ), MIN( ), and SUM( ). Also known as set functions.


alias

An alternative name assigned to a table or column in expressions often used to shorten the name for subsequent references in code. The alias prevents possible ambiguous references or provides a more descriptive name in query output. A table or view can be referenced by its alias and the work area in which it is opened.


alternate index

A candidate index that was not chosen as the primary key. See also candidate index, primary key.


ANSI

An acronym for the American National Standards Institute, an organization that sets standards for a variety of programming languages and systems.


API

An acronym for Application Program Interface, the set of commands that an application uses to request and carry out lower-level services performed by a computer’s operating system. The Visual FoxPro API contains commands that allow C and assembly language routines to interact with Visual FoxPro.


append

To add new records to the end of a table.


application

A collection of Visual FoxPro programs, forms, menus, and other files that are compiled into a single program. Applications are built with the Project Manager and have an .APP extension.


argument

A value on which a function or procedure operates. For example, in the Visual FoxPro statement SPACE(10), the number 10 is the argument.


arithmetic operator

Operators that perform numeric calculations. In Visual FoxPro, the arithmetic operators are: + (addition), – (subtraction), * (multiplication), / (division), ^ (exponentiation), and % (modulus). See also logical operator, relational operator.


array

An ordered collection of data contained in a variable and referenced by a single variable name. Each element of the array can be referenced by a numerical subscript. In Visual FoxPro, the data does not need to be of the same data type within an array. See also data type.


ASCII

An acronym for American Standard Code for Information Interchange. It is a code in which the numbers from 0 to 255 stand for letters, numbers, punctuation marks, and other characters. ASCII code is standardized to facilitate transmitting text between computers or between a computer and a peripheral device.


OLE automation
Automation

A way to manipulate an application's objects from outside the application. Automation is typically used to create applications that expose objects to programming tools and macro languages, to create and manipulate one application's objects from another application, or to create tools for accessing and manipulating objects. Formerly called OLE Automation.


back-end data

See remote data.


backlink

The path and file name information from a table’s header record that links the table back to the owning database container.See also forward link.


band

See report band.


base class

A class that is internally defined by Visual FoxPro and can be used as a basis for other user-defined classes. For example, Visual FoxPro forms and all controls are base classes that you can expand with your own functionality to create new classes. See also subclass.


base table

A table accessed by the SELECT - SQL statement that is included in the CREATE SQL VIEW command when creating a view.


basic optimizable expression

An expression whose execution time can be reduced using Rushmore technology. A basic optimizable expression can form an entire expression or can appear as part of an expression.


binary file

A file that contains encoded information interpreted according to the application that created it. Binary files can be edited only by the application in which they were created. Contrast text file.


bitwise

Functions that act on the individual bits of a value, rather than the value as a whole. In Visual FoxPro, the bitwise functions are BITAND( ), BITCLEAR( ), BITNOT( ), BITOR( ), BITRSHIFT( ), BITSET( ), BITTEST( ), and BITXOR( ).


BOF

Beginning of file.


bound control

A control on a form or report whose contents are associated with a particular field in the underlying table or query. For example, a text box that displays an employee’s last name might be bound to the LastName field in the Employees table.


breakpoint

A position in a program at which execution pauses and control returns to you. In Visual FoxPro, you set breakpoints in the Debugger window.


browse

To view a table and its contents. Visual FoxPro displays table information in a Browse window that has rows and columns in grid format.


browse sequence

In graphical Help files, a sequence of Help topics accessible by the use of the Browse Forward (>>) and Browse Back (<<) buttons. The browse sequence is helpful for users who like to read several related topics in a predefined order.


buffer

A temporary holding area in memory where information can be stored. Visual FoxPro provides buffering in two locking modes: pessimistic buffering and optimistic buffering. These choices determine when one or more records are locked, and how and when they are released.


buffered updates

Used to protect data in a multi-user environment. Visual FoxPro has two types of buffering: record and table. To access, modify, and write a single record at a time, use record buffering. To buffer the updates to several records, use table buffering. See also buffer.


   builder lock

A button on the Controls toolbar. When you press this button and then press another button on the Controls toolbar to create a control, the builder for that control starts up.


builders

Visual FoxPro tools, such as the List Box Builder, that help the user set properties for a specific control, or combine clauses to create a specific expression. A builder consists of one or more dialog boxes that present a simple set of choices. See also builder lock, wizard.


calculated field

A field defined in a query that displays the result of an expression rather than stored data.


candidate index

An index that can become the primary key, because it contains no null or duplicate values. See also alternate index, primary index.


caption

The name displayed beside or on a control in a dialog box or form. For example, “OK” might be the caption on a command button. You set the caption “OK” with the Caption property for that button.


.CDX file

See compound index file.


CGI

Common Gateway Interface. A mechanism that allows a Web server to run a program or script on the server and send the output to a Web browser. See also Internet Server Application Programming Interface (ISAPI).


character expression

An expression that evaluates to a character string.


   check box

A control that indicates whether an option is on or off. An X appears in the box when it is selected.


child table

The related or controlled table in a one-to-one or one-to-many table relationship. See also parent table, primary table, related table.


class

A template or blueprint that defines the characteristics of an object and describes how the object should look and behave. You can create a new class using the CREATE CLASS command or the Class Designer. See also object, subclass, user-defined class.


class library

Every visually designed class is stored in a class library. Class libraries have a .VCX file extension.


clause

An additional statement that follows a command and provides further instructions for performing the command.


cleanup code

Code that is executed after the menu definition code in an .MPR file. Cleanup code can include user-defined functions and procedures.


client/server

A description for applications that have a local (client) user interface but access data on a remote server. The application distributes the work between the local machine and the server, depending on the strengths of the front-end and back-end products.


clipboard

An area in the computer’s memory that functions as a holding place for what was last cut or copied from a file. Information contained in the clipboard can be inserted (pasted) into other documents and other applications.


code page

A character set that a computer uses to interpret and display data properly. Code pages usually correspond to different platforms and languages and are used in international applications. See also locale.


   combo box

A control, similar to a list box and text box combined, in which you enter a value or select an item from a list.


command

An instruction that, when issued by the user, causes Visual FoxPro to perform an action. A command can be typed from a keyboard, selected from a menu, or embedded in program code. See also function.


   command button

A control that is associated with a command. When you click the command button at run time, the command associated with the button executes.


   command button group

A control array of command buttons that can be treated as a unit.


compact single-entry index

An index file with an .IDX file extension that is limited to one index entry. You must explicitly open this index file and it must be active when you update a table.


comparison operator

An operator you use to compare two values or expressions. The result returned is True (-1) or False (0). The comparison operators are = (equal to), <> (not equal to), < (less than), > (greater than), <= (less than or equal to), and >= (greater than or equal to). You can also compare two values or expressions using Like and Is.


compiler directive

A command used in a program to alter the action of a compiler. Also referred to as a preprocessor directive. Visual FoxPro compiler directives include #DEFINE and #IF.


compound index file

An index file containing multiple index entries, called tags. A compound index file has a .CDX file extension. You must explicitly open this index file and it must be active when you update a table. See also structural compound index.


conditional branching

Allows users to test conditions and then, depending on the results of that test, perform different operations. See also IF ... ENDIF, DO CASE ... ENDCASE.


configuration

The software settings used to customize an application. In Visual FoxPro, configuration settings are stored in a configuration file (CONFIG.FPW).


configuration file

A text file named CONFIG.FPW that contains settings used to establish the Visual FoxPro environment, such as the main window title, default directory, project, editor, debugger and form tool options, temporary file storage, field mappings for drag-and-drop operations, and so on. When Visual FoxPro starts, it reads the configuration file and uses its settings to override the default settings stored in the Windows registry.


conflict

In a multi-user environment, a conflict occurs when one user tries to lock a record or table that is currently locked by another user. Two users cannot lock the same record or table at the same time. See also deadlock.


connection

A definition, stored in a database, that specifies the name of the data source. You can optionally use a named connection.


constant

A numeric or string value that does not change. Constant expressions combine constants and operators, but no variables, and evaluate to the same value every time.


constraints

An expression associated with a field or row that provides data integrity checking by restricting the values the user enters. A constraint for a field, called a field-level rule, is checked when you move to a different field. A constraint for a record, or record-level rule, is checked when you move to a different record.


container classes

Visual FoxPro base classes that group other similar classes together. For example, a form class consists of a group of several control classes, which can be treated as a unit. See also base class, form, form set.


context string

In a graphical Help system, a string that identifies a topic. The context string is assigned with a footnote character of #. Each context string must be unique; it can be assigned to only one topic within the Help file.


control

A graphical object, such as a text box, a rectangle, or a command button, that you place on a form to display data, perform an action, or make the form easier to read. Visual FoxPro controls include check boxes, edit boxes, labels, lines, images, shapes, and so on. You can draw these controls on a form using the Form Controls toolbar in the Form Designer.


control array

A group of controls that share common names, types, and event procedures. Each control has a unique index. When a control in the array recognizes an event, it calls the event procedure for the group and passes the index as an argument, allowing your code to determine which control recognized the event.


control break

An expression that defines the contents of a group in a report.


control character

A non-printing symbol that controls or modifies the way information is printed or displayed. Control characters have ASCII values between 0 and 31. Typically, control characters are typed from a keyboard by holding down the CTRL key while pressing another key.


control classes

Visual FoxPro base classes that can be included in a container and subclassed by users. Command buttons and text boxes are examples of control classes. See the Controls toolbar for a representation of the available control classes.


control source

A property that specifies where the data entered or displayed in a control is stored. For example, the ControlSource property for a text box can specify that the data in a text box is stored in and read from a particular field in a database.


criteria

A set of limiting conditions used in a query or filter to show a specific set of records. For example, the expression Salary > 30000, applied to an Employees table, limits a query to those employees who make more than $30,000 per year.


cross-platform compatibility

Allows you to create files and applications that run unmodified on either the Windows or Macintosh platform.


cross-tab query

A query that summarizes data in a spreadsheet format. For example, a cross-tab query of a Sales table might display State data in the rows and SalesRep data in the columns. The fields of the query might contain SUM(Sales) for each sales representative.


cross-tab report

A report that presents the result of a cross-tab query.


cursor

A temporary, read-only table that saves the results of a query with an assigned name. The cursor is available for browsing, reporting, or other uses until it is closed.


custom control

A control created by the user that is based on one or more Visual FoxPro base classes. You can add functionality to an existing Visual FoxPro control, or to any other custom control. See also base class, subclass.


data binding

A notification mechanism that links control properties through the container to a data source, such as a database field.


data definition language (DDL)

The language used to declare the structure of a database to the database management system.


data dictionary

A table containing information about all the tables in a database. The information stored in a data dictionary is meta-data, or data about the data, such as long table and field names, validation rules and triggers, and definitions for database objects such as views and named connections.


data environment

All the tables, views, and relationships that are to be opened when you run or modify a form or report. The data environment is saved with the form or report and can be modified in the Data Environment Designer.


data grouping

In reports, categorizing information into groups corresponding to a specified order. Headers and footers can be defined to print every time the value for a data group changes.


data session

A representation of the current dynamic work environment used by a form, form set, or report. Each data session contains its own set of work areas. These work areas contain the open tables, their indexes, and relationships. See also work area.


data source

An ODBC term for a database and the information you need to access that database. For example, a SQL Server data source consists of the SQL Server database, the server on which it resides, and the network used to access that server.


data type

The attribute of a variable or field that determines what kind of data it can hold. Visual FoxPro has these data types: Character, Currency, Date, DateTime, Double, Float, Logical, Numeric, Integer, General, and Memo.


data warehouse

A copy of the data in a database, created specifically to allow users to query the database. Creating a data warehouse allows you to structure the data for easiest reporting and for best security–for example, pre-joining tables to assist with queries by novice users, or removing fields that contain sensitive data. It also lets you move the data to another server to minimize the performance impact that queries can cause. Because data in a data warehouse is a snapshot of a database, it must be refreshed periodically; the exact interval depends on your application needs.


database

A database file has a .DBC extension and can contain one or more tables, views, connections to remote data sources, and stored procedures.


database table

A table contained in a database. Contrast free table.


DBCS

Double-byte character system. A character set that uses one or two bytes to represent a character, allowing more than 256 characters to be represented.


deadlock

In a multi-user environment, a deadlock occurs when one user has locked a record or a table and tries to lock another record that’s locked by a second user who, in turn, is trying to lock the record that’s locked by the first user. While such occurrences are rare, the longer that a record or table is locked, the greater the chance of deadlock. See also conflict.


debug

To look for and determine the cause of an error or problem in a computer program.


default

A predetermined setting for a property or parameter. The default is automatically used by Visual FoxPro if you do not supply a different value.


default value

A quantity or string that you designate as the content for a field when a new record is added to a database table. The default value remains in the field until you enter a new value.


delimiter

A character that marks the beginning or end of a sequence of characters and is not considered part of the sequence itself. For example, the double quotation mark (") is one delimiter for string constants; the string "DOG" consists of the three characters D, O, and G, and does not include the quotation marks.


dependent object

A dependent object is one you reference from an object higher in the application’s hierarchy.


design time

The mode of operation when an application is being created. At design time, you build the components of your application and set their properties. Contrast run time.


detail band

An area of a report that typically contains one or more lines for each record that is printed from a table.


development environment

The Visual FoxPro interactive interface for building applications.


diacritical marks

Accents or symbols placed over, under, or through letters to indicate sound changes from the unmarked forms of the letters. See also accented characters, international characters.


dimension

The size or number of elements in an array. See also ALEN( ).


docked

For toolbars, fixed to the top, bottom, or side of a Visual FoxPro window. The Project Manager can be docked to the top of a Visual FoxPro window.


dynamic-link library (DLL)

A Windows term for a set of routines that can be called from procedures and are loaded and linked into your application at run time. DLLs include utility routines or specific functions not intrinsic to Microsoft Windows. See also FoxPro link library.


drag and drop

A feature that enables you to drag one object onto another to perform an action. To drag an object, click the object and, while holding down the mouse button, move it to the new location. When you are satisfied with the location, release the mouse button to drop the object.


    edit box

A control that provides a place to enter or view text in a form. Edit boxes hold multiple lines of text. See also text box.


element

In Visual FoxPro, one of the individual members that make up an array.


embed

A term for inserting a copy of an object from one application into another. Once the copy is embedded, it has no further association with the object from which it was copied. If the original object changes, the embedded copy does not. Contrast link.


encapsulation

An object-oriented programming term for the ability to contain and hide information about an object, such as internal data structures and code. Encapsulation isolates the internal complexity of an object’s operation from the rest of the application. For example, when you set the Caption property on a command button, you don’t need to know how the string is stored. See also abstraction.


EOF

End of file.


equi-join

A join in which records from two tables are combined and added to the result set only when there are equal values in the joined fields. The inner and outer join types you use in query Design view are equi-joins. In SQL view, however, you can create joins that aren't equi-joins, but select records when the value in one join field is >, <, <>, >=, or <= the value in the other join field.


escape sequence

A sequence of keystrokes or output characters that begins with the ESC character. Escape sequences are typically used for positioning the cursor and controlling the display of text on the screen, or as codes to control printers.


event

An action, recognized by an object, for which you can write code to respond. Events can be generated by a user action–such as clicking the mouse or pressing a key–by program code, or by the system, as with timers.


event code

Code that is executed when an event occurs. The code can also be called programmatically. See also event.


event-driven programming

A programming model that emphasizes event code rather than the sequential code used in procedural programming. See also event, event code.


event loop

The interactive, run-time environment established by the READ EVENTS command and terminated by the CLEAR EVENTS command. See also event.


executable program

Executable programs are created in the Professional Edition of Visual FoxPro with the Project Manager and have an .EXE file extension.


execution plan

The order in which join and filter clauses are evaluated when a view or query is run.


expression

Any combination of variables, operators, constants, functions, and names of fields, controls, and properties that evaluates to a single value. You can use expressions as settings for many properties, and to set criteria or define calculated fields in queries.


field

Any data item contained in a record. One or more fields make up a record in a table, and one or more records make up a table.


field-level rule

A validation rule associated with a field that is activated when the field value is inserted or changed, and most often used to verify data entry and correctness. Field-level rules are activated before record-level rules and triggers, and work during buffered updates. Contrast trigger.


file skeleton

A series of wildcards, such as ? and *, that specify a particular file name structure to be looked for in a file search.


filter

A set of criteria applied to records in order to show a subset of the records or to sort the records.


flag

A variable whose value, true (.T.) or false (.F.), indicates whether some condition holds or whether some event has occurred. A flag is used to control the program’s actions at some later time.


floating

Able to move freely as its own window. For example, the Visual FoxPro toolbars, and the Project Manager and its tabs, can all float.


foreign key

A column, or combination of columns, whose values are required to match a primary key in another table. Used to join related tables.


form

A container class. A collection of one or more pages that behaves like a standard window or dialog box. A form contains controls for displaying and editing data. Forms can be contained within a form set. See also container classes, page.


form set

A container class. A collection of one or more related forms. Use the Form Designer to arrange forms within the form set. See also container classes.


forward link

The path and file name information, stored in the database container (.DBC), that links the database to files for tables that reside in the database. See also backlink.


foxel

Equivalent to the average height and width of a character based on the current font of the form in which an object is contained. Foxels are useful when developing cross-platform applications for character-based and graphical platforms.


FoxPro link library (FLL)

A Visual FoxPro compatible version of a DLL created in C; extends the functionality of Visual FoxPro.


free table

A table that is not contained in a database. A .DBF file created in a previous version of FoxPro is a free table until it is added to a database. Contrast database table.


FTP

File Transfer Protocol. A protocol that makes it possible for a user to transfer files from one location to another over the Internet.

URLs of files on FTP servers begin with ftp://.

Many Internet sites have established publicly accessible repositories of materials that can be obtained using FTP with the account name "anonymous." Thus, these sites are called "anonymous ftp servers." See also HTTP, URL, World Wide Web (WWW).


function

A preprogrammed calculation that can be carried out on request from any point in a Visual FoxPro program. Because a function takes in one or more arguments and returns a single value, it can be embedded in an expression. Functions contain a pair of parentheses that distinguish them from commands. For example, ROW( ) is a function. Functions can be from Visual FoxPro or user-defined. See also argument, expression, user-defined function.


gateway

A computer that provides a transfer point and protocol conversion between networked computers.


generated code

Programs created by GENMENU, the Visual FoxPro menu generator. Generated menu programs have an .MPR extension.


generated name

A unique name generated by SYS(2015). These names are inserted in generated programs with corresponding clauses and code.


globally unique identifier
globally unique identifier (GUID)

An identifier used to precisely identify objects and interfaces. All Windows applications and OLE objects have a GUID that is stored in the Windows registry.


   grid

A control that creates a grid allowing you to present data in a tabular format. Grid controls contain column headers, columns, and column controls.


group band

Fields that appear together in a report based on criteria that you specify by choosing Data Grouping from the Report menu.


group footer

A report band in which objects can be defined to print each time a group expression changes. Group footers usually contain calculated values for data in the group.


group header

A report band in which objects can be defined to print each time a group expression changes. Group headers usually contain information to preface the data that follows.


grouping records

See data grouping.


handle

A number assigned to a window that is used by the operating system to keep track of the attributes of the window. In a C or C++ library, a handle is a pointer.


hot spot

In a Help system, an area in a bitmap that is “hot,” meaning that it reacts when you move the mouse cursor on this area. The mouse cursor changes to a hand symbol and, when you click the mouse button, the topic defined in the hotspot editor appears. In online Help, hot spots are usually buttons and words that are green. See also hypergraphic.


home page

The main page of a World Wide Web site. A home page is generated by a Web owner and often has links to other pages, both within and outside the site. Although the home page is often the first page a visitor to the site sees, it is not the same as the start page.


HTML

Hypertext Markup Language, or HTML, is a system of marking up or tagging a document so that it can be published on the World Wide Web. Documents prepared in HTML include reference graphics and formatting tags. You use a Web browser (such as Microsoft Internet Explorer) to view these documents. See also FTP, HTTP, URL, World Wide Web (WWW).


HTTP

Hypertext Transfer Protocol. The Internet protocol used by World Wide Web browsers and servers to exchange information. The protocol makes it possible for a user to use a client program to enter a URL (or click a hyperlink) and retrieve text, graphics, sound, and other digital information from a Web server. URLs of files on Web servers begin with http://. See also FTP, URL, World Wide Web (WWW).


hypergraphic

In a Help system, a graphic with embedded hot spots.


   image

A control that allows you to include pictures on a form.


in-process

A DLL component that runs in the same process address space as the client that calls it. See also out-of-process


independent .IDX

Index files containing one index entry. An independent index file cannot have the same name as the associated table and will not automatically open with the table. See also compound index file.


index

A set of pointers that are logically ordered by the values of a key. Indexes provide quick access to data and can enforce uniqueness on the rows in a table. Indexes in Visual FoxPro are maintained in an index file. See also candidate index, primary key.


index file

A file whose entries identify the position of data in a table. See independent .IDX, compound index file.


inheritance

An object-oriented programming term. The ability of a subclass to take on the characteristics of the class it’s based on. If the characteristics of the parent class change, the subclass on which it is based inherits those characteristics. For example, if you add a new property, IsBold, to an editing control, any subclasses based on your control will also have an IsBold property.


inner join

A join in which records from two tables are combined and added to a query's results only if the values of the joined fields meet a specified condition. For example, the default join between tables in query Design view is an inner join that selects records from both tables only when the values of the joined fields are equal.


input mask

A property of fields and controls that restricts or dictates the format of user input. For example, an input mask such as (###) ###-#### restricts input to North American phone number format.


instance

An object-oriented programming term. An object created from a class definition. Unlike a class, which is just a definition, an instance actually exists as an object that can be used to perform tasks. For example, a text box on a running form is an instance of the TextBox class.


international characters

Characters, such as é, that include diacritical marks and therefore allow data manipulation in languages other than English. See also accented characters, diacritical marks.


IP address

Four numbers, separated by periods, that represent the internet name and location of a network device.


ISAPI

Internet Server Application Programming Interface. A set of functions for Internet servers, such as a Windows NT Server running Microsoft Internet Information Server (MIIS).


join

A database operation with a view or query that links the rows in two or more tables or views by comparing the values in specified fields. For example, the default join between tables is an inner join that selects records from both tables only when the values of the joined fields are equal. Because SQL is based on mathematical set theory, each table can be represented as a circle. The join condition determines the point of overlap which represents the set of records that match. This overlap occurs within the interior or “inner” portion of the two circles. An outer join includes not only those matched rows found in the inner cross section of the tables, but also the rows in the outer part of the circle to the left, or right, of the intersection.


join condition

The expression defining the association or join specified between tables or views in a view or query.


join operator

Comparison operator in a join condition that determines how the two sides of the condition are evaluated and which records are returned.


jump

In a Help system, a cross-reference to a related topic. In a graphical Help system, a jump appears as a green underlined word that is hot. See also hot spot.


junction table

A table created to break down a many-to-many relationship between two tables into two one-to-many relationships. The junction table contains the primary keys of the two tables with the many-to-many relationship.


key

A field or expression used to identify a record; often used as the index field for a table. See also primary key.


keyword

A word or phrase that is reserved for exclusive use by Visual FoxPro. Also known as a reserved word. In syntax, Visual FoxPro keywords appear in all capital letters. For example, EXCLUSIVE is a keyword of the USE command.


   label

A control that contains text to describe areas of the form or other controls. Sometimes referred to as a prompt. See also caption.


lifetime

A term for a variable that continues to exist after a function call or program is finished. Public variables continue to exist, local variables do not. See also scope.


ligature

Letters joined together as one, such as æ.


   line

A control that draws a line on a form.


link

An OLE term. A connection between a source document and a destination document. A linked object is a placeholder for information from the source document and maintains the connection between the two documents. When the information changes in the source document, the changes are reflected in the destination document. Contrast embed.


   list box

A control that provides a list of items to choose from.


local alias

In a SELECT - SQL command, a temporary name for a table specified in the FROM clause.


local data

Data that does not exist on a remote server. See also native data, remote data.


local view

A view that uses Visual FoxPro tables within the current database.


local variable

A variable that is accessible only within a function or procedure. Other procedures or functions cannot access this variable’s data. Use global variables to share data across many procedures and functions, or private variables to share data with the functions you call. See also lifetime, public variable, scope.


locale

The set of information that corresponds to a given language and country. A locale indicates specific settings such as decimal separators, date and time formats, and character-sorting order.


locked

The condition of a record or table that makes it read-only to all users except the one who is currently entering data in it.


logical operator

An operator that produces a logical result (true or false); sometimes called a Boolean operator. The logical operators in Visual FoxPro are ( ) (expression grouping), NOT or ! (negation), AND and OR (inclusive OR). See also arithmetic operator, relational operator.


long names

The ability of the software to allow longer names than the underlying system permits. Visual FoxPro permits long field and long table names. Using long names might produce unexpected results in cross-platform operation.


looping

Allows user to execute one or more lines of code as many times as necessary. See also SCAN ... ENDSCAN, FOR ... ENDFOR, DO WHILE ... ENDDO.


macro

In Visual FoxPro, a key that stands for a sequence of actions and keystrokes.


macro substitution

The act of replacing names with variables. In Visual FoxPro, you place an ampersand (&) before a variable to use the value of the variable as a name. A command or function containing a name expression executes faster than one containing macro substitution; always use a name expression instead of macro substitution. See also name expression.


main Visual FoxPro window

In Visual FoxPro, the window that underlies all system and user-defined windows.


main file

A program (.PRG file) or form (.SCX file) that serves as the execution starting point for a compiled application, and from which other components of your application are called. Typically, the main file sets the application’s operational environment, runs menu programs or forms to display the application’s interface, and establishes the event loop of the application with the READ EVENTS command. You designate a main file in the Project Manager before building your application.


main report

The part of a Visual FoxPro report that follows the title and consists of the page header, report body, and page footer.


many-to-many relationship

A relationship between tables where records in each table have multiple matching records in the related table. This type of relationship may require changes in your database design. See also junction table.


mark character

A symbol that appears to the left of a menu item to indicate that the menu item is selected. In Visual FoxPro for Windows, the default mark character is a check mark.


menu

A list of items, such as commands and file names, that appears when you choose a menu title from the menu bar.


menu bar

A horizontal strip that appears across the top of the screen and contains the names of menus.


menu item

A menu command or file name listed on a menu. You can create and define menu items for your applications using the Menu Designer.


menu title

A word, phrase, or icon on the menu bar that designates one menu. Selecting the menu title causes the menu to appear. Often referred to as a menu name.


menu system

The combination of the menu bar, menu titles, menus, and menu items.


merge conflict

A state in which source control software has been unable to integrate changes made by several developers to the same text file (such as a program) when the file is being checked in. For example, a merge conflict might occur if two developers make changes to the same line in the same program; when the second developer attempts to check in the file, a merge conflict is reported. When a merge conflict occurs, the source control software creates a version of the file in which the current version and the changes it was unable to integrate are marked (the exact means of marking depends on the source control software). The developer whose changes could not be integrated must edit the file to manually integrate changes, test it, and then check it in again.


metafile

A Windows file that stores an image in terms of graphic objects rather than pixels. When resized, a metafile preserves an image better than a bitmap.


method

An action that an object is capable of performing. For example, list boxes have methods called AddItem, RemoveItem, and Clear, for maintaining list contents. See also object.


modal

A window or form is modal if it retains the focus until you explicitly close it. Dialog boxes and messages are usually modal. For example, in a modal dialog box, you can’t access another window until you choose OK in the dialog box.


modeless

A window or form is modeless if it doesn’t require closing before switching to another form or window. For example, the Command window and toolbars are modeless.


multiple-document interface (MDI) application

An application that can support multiple documents from one application instance. MDI object applications can simultaneously service a user and one or more embedding containers. See also single-document interface (SDI) application.


multiple instances

Several objects created from the same class. Each object has its own private data and properties, but shares code.


multi-tiered view

A view based on other views, or on a combination of local tables and local or remote views.


named connection

A definition of a data source stored in a database, which you can then refer to by name when you create a remote view. You can also set properties on the named connection to optimize the communication between Visual FoxPro and the remote data source. When you activate a remote view, the view’s connection becomes the pipeline to the remote data source. See also connection.


name expression

A variable or array surrounded by parentheses that can replace a name in a command or function. Name expressions provide flexibility in Visual FoxPro commands and functions.


native data

Data stored in Visual FoxPro tables (.DBF files). See also database, local data, remote data.


non-compact single-entry index

A single-entry index file that is not optimized to save disk space. Non-compact single-entry index files should be created only if you need to maintain compatibility with versions of FoxPro prior to 2.0, or if you’re sharing data with FoxBASE+.


nonscrolling region

In a graphical Help system, an area that remains in place at the top of the topic while the rest of the topic scrolls. A nonscrolling region can contain text, hot spots, and graphics.


normalize

To minimize the duplication of information in a relational database through effective table design.


null value

Having no explicitly assigned value. NULL is not equivalent to zero or blank. A value of NULL is not considered to be greater than, less than, different than, or equivalent to any other value, including another value of NULL.


object

An instance of a class, combining both data and procedures. For example, a control on a running form is an object.


object-oriented programming (OOP)

A system of programming that permits an abstract, modular typing hierarchy, and features polymorphism, inheritance, and encapsulation.


object linking and embedding (OLE)

A protocol by which an object, such as an Excel spreadsheet or a Word document, can be linked to or embedded in a Visual FoxPro table or form. See also embed, link.


OLE server

An application or DLL that can be linked to or embedded in as an OLE object.  Also known as an ActiveX component. For example, a Visual FoxPro form or database can contain a Microsoft Excel worksheet; in this case, Microsoft Excel is the OLE server.


one-to-many relationship

A relationship between tables in which each record in the primary table can be associated with many records in the related table (each primary key value can appear many times in the related table).


one-to-one relationship

A relationship between tables in which each record in the primary table can be associated with only one record in the related table.


Open Database Connectivity (ODBC)

A standard protocol for database servers. You install ODBC drivers for various databases that enable Visual FoxPro to connect to the databases and access their data.


optimistic buffering

An efficient way to update records, because locks are only applied at the time the record is written, thus minimizing the time any single user monopolizes the system in a multi-user environment. When you use record or table buffering on remote tables, Visual FoxPro imposes optimistic locking. Contrast pessimistic buffering.


   option button group

A control array of option buttons. Option buttons are sometimes referred to as radio buttons.


outer join

An association between input sources in a query that allows you to select rows that match plus those that do not match the join condition. You can select all of the rows from one input source and matching rows from the other input source with a Left Outer Join, Right Outer Join, or Full Outer Join. You can also select all of the rows from both input sources, regardless of matching, with a Full Outer Join.


out-of-process

An executable component (an .EXE file) that runs in its own process.See also in-process.


page

A container class used to create tabbed dialog boxes. One screen or sheet of a form that has a collection of controls. Only one form page can be active at a time within the form.


page footer

A printed area at the bottom of every page of a report.


page header

A printed area at the top of every page of a report.


parameter

A value passed to a function or procedure. To pass a parameter to a function or procedure, you must include a PARAMETERS or LPARAMETERS command. See also argument.


parent table

The primary or controlling table in a one-to-one or one-to-many relationship. See also child table, primary table, related table.


partial seek

A partial seek occurs when the length of the expression is less than the length of the key. Visual FoxPro ignores diacritical marks when performing a partial seek. If diacritics are important, consider using SCAN FOR...ENDSCAN or LOCATE FOR...CONTINUE instead of SEEK.


pass by reference

A means of passing a variable to a function. The calling routine passes the address of the variable to the called routine, which can then use that address to retrieve or modify the variable. When the function changes the value of the passed variable, the variable’s original value in the calling program is also changed. See also argument, pass by value.


pass by value

A means of passing a variable to a function. A copy of the value of the variable is created and passed to the called routine. When this method is used, the called routine can modify the copy of the argument but it cannot modify the original argument. The variable’s value might be changed by the procedure or function, but the variable’s original value in the calling program is not changed. See also argument, pass by reference.


pass-through query

A query you can use to work directly with tables on a server which understands a dialect of SQL different from the one processed by the client application. You can use a pass-through query to return a snapshot of rows or execute non-row returning commands.


persistent relationship

Relationships between tables that last longer than just at run time. Tables must be in a database to have a persistent relationship.


pessimistic buffering

Prevents a user in a multi-user environment from accessing a particular record or table while another user is making changes to it. Provides the most secure environment for changing individual records, but can slow user operations. Contrast optimistic buffering.


pixel

The smallest element that can be displayed on a screen or printer. Pixels are screen-dependent. Contrast twip.


polymorphism

An object-oriented programming term. The ability to have methods with the same name, but different content, for related classes. The procedure to use is determined at run time by the class of the object. For example, related objects might both have Draw methods. A procedure, passed such an object as a parameter, can call the Draw method without needing to know what type of object the parameter is.


point

A unit of measurement for type whereby 12 points equal 1 pica, and 6 picas equal 1 inch; thus, 1 point equals 1/72 inch. See also twip.


precedence

The prioritized order in which operators are applied in evaluating a mathematical expression. In Visual FoxPro, operator precedence is: ( ) (subexpression grouping), ^ or ** (exponentiation), * and / (multiplication and division), % (modulus), and + and – (addition and subtraction).


primary index

An index that never permits duplicate values on the specified fields or expression. Primary indexes are principally used within the primary or “referenced” table for establishing referential integrity in a persistent relationship. You can create only one primary index for a table. Visual FoxPro returns an error if you specify a primary index on any field that already contains duplicate data. Contrast candidate index, regular index, unique index, primary key.


primary key

The column or columns whose values uniquely identify a row in a table.


primary table

The table whose columns are referenced by other tables in a one-to-one or one-to-many relationship.


private variable

A variable that is released when the routine it is defined in terminates. Private variables are the default in Visual FoxPro and require no special keywords to define. However, they can be scoped with the PRIVATE keyword if there is already a variable of the same name at a higher level. Contrast local variable, public variable.


procedure

A set of instructions that work as a unit; a subroutine. See also function.


progressive fetching

A query execution process that improves performance. Visual FoxPro executes a query and fetches a small subset of the result set rows into the local cursor. The default size of this subset is 100 rows. If your connection is operating in asynchronous mode, Visual FoxPro returns control to you or your program as soon as it fetches the first subset of data. During idle time, Visual FoxPro performs a background fetch of the remaining rows in the queried data, one subset at a time, into the local cursor. This scenario allows you to use the already fetched data in the cursor without having to wait for the rest of the data.


project

A file that keeps track of all programs, forms, menus, libraries, reports, labels, queries, and other types of files that are needed to create an application. Projects are maintained in the Project Manager and have a .PJX file extension.


projection list

In the SELECT - SQL command, the projection list is the list of fields, constants, and expressions that appear in the query output.


property

An attribute of a control, field, or database object that you set to define one of the object’s characteristics or an aspect of its behavior. For example, the Visible property affects whether a control can be seen at run time. You can change an object’s property settings with the Properties window.


public variable

Variables defined with the PUBLIC keyword are available to all procedures and functions, not just the ones they are defined in. Contrast local variable, private variable.


qualified

A table name preceded by the name of the table’s database and the “!” symbol. If you qualify the table name when you create a view, Visual FoxPro searches for the table both in the open database list, including the current and any non-current databases, and in the default search path for the table.


query

A request for the retrieval of information from a database, using criteria to extract specific records. Queries are created with the Query Designer.


record

A unit of storage in a table. Every table can contain a large number of records; each record is comprised of fields.


record-level rule

A validation rule, bound to a record, that is activated when a record is inserted or changed, and most often used to verify data entry and correctness. Validation rules do not apply when records are deleted. Record-level rules are activated after field-level rules and before triggers, and work during buffered updates. See also field-level rule. Contrast trigger.


resource file

1) A Visual FoxPro database table (FOXUSER.DBF) used to store information about the current state of the program, such as the location and size of the command window, current keyboard macros, which toolbars are displayed, and so on. 2) A file, often a DLL, that contains information used in a program that might need to be changed, such as text strings, bitmaps, fonts, and so on. For example, Visual FoxPro stores the literal text of its error messages, window captions, and dialog box controls in a runtime resource file so that you can swap resource files if you want to use the program in a different language.


referential integrity
referential integrity (RI)

The rules governing data consistency, specifically the relationships between the primary keys and foreign keys of different tables. Visual FoxPro addresses referential integrity with user-defined field- and record-level rules. The Referential Integrity Builder helps you set up rules to control how records are inserted, updated, or deleted in related tables.


registry

A database maintained by Windows that stores configuration information about the operating system, all Windows applications, ActiveX, OLE, and optional components such as ODBC. For example, the registry is where Windows stores the associations between file name extensions and applications, and where Visual FoxPro stores its application-specific configuration information.


regular index

An index that is not unique, primary, or candidate. You use a regular index for ordering and seeking records, but not to enforce the uniqueness of the data in those records. You also use a regular index as the “many” side of a one-to-many persistent relationship.


related table

The tables that make reference to another table’s columns. See also child table, parent table, primary table.


relation

A link between tables that allow data to be accessed from more than the currently selected table. The link is the join condition.


relational database

A database organized and accessed according to relationships between its tables, records, and fields.


relational operator

An operator that manipulates numeric and other values to produce a logical result. In Visual FoxPro, the relational operators are <, >,= =, <=, >=, and <>. See also arithmetic operator, logical operator.


remote call procedure

A network protocol-independent distributed interface that lets individual procedures of an application run on systems anywhere on the network.


remote data

Any data outside Visual FoxPro, in a source supported by ODBC, such as a Paradox or SQL database. See also data source, native data. Contrast local data.


remote view

A view that uses data sources outside of the current database, such as SQL Server.


report band

An area in a report that can contain text, data from table fields, calculated values, or user-defined functions, as well as pictures, lines, and boxes. Several different types of bands can appear in a report. See also detail band, group band, report footer band, report header band, title band, summary band.


report detail band

The area between the page header and the page footer, consisting of detail lines based on the records from the selected table or tables.


report footer band

A band in the Report Designer window that contains the data that appears at the bottom of a page (page numbers, section, and so on).


report header band

A band in the Report Designer window that contains information that appears once per report. Typically, items placed in a report header include a report title, column headings, and the current date.


resolving a reference

When you add a call to a component and rebuild a project, Visual FoxPro automatically locates and includes the new component in the project. Any references to additional components contained in the new component are also resolved and their files are added to the project. By automatically adding necessary files to the project and checking for compilation errors in components that have changed, you can isolate both environmental and logical connection errors between components.


rule

See constraints, field-level rule, record-level rule. Contrast trigger.


run time

The time during which an application is running. During run time, you can interact with an application. Contrast design time.


Rushmore technology

A data access technique that permits sets of records to be accessed very efficiently.


schema

A definition of the total database layout, including integrity checks and persistent relationships among tables and their indexes.


scope

The range of reference for an object or variable or a range of records in a view or table. For example, local variables can be referenced only within the procedure they were defined. Public variables are accessible from anywhere in the application. Objects, such as the current database, are in scope if they are in the defined search path. Record ranges can be specified with a Scope clause in many commands. See also lifetime.


On a Macintosh, a desk accessory that allows you save multiple objects that are frequently used, such as pictures, graphic images, icons, or text. You can then cut, copy, and paste these objects. The Scrapbook allows you place more than one object inside of it.


single-document interface (SDI) application

An application that can support only one document at a time. Multiple instances of an SDI application must be started to service both an embedded object and a user. See also multiple-document interface (MDI) application.


secondary window

In a graphical Help system, a window that is opened with a hot spot and contains a title bar and scroll bars but no menu bar.


self-join
self join

A join in which records from a table are combined with other records from the same table when there are matching values in the joined fields. A self join can be an inner join or an outer join.


server

A computer on a network that controls access to resources such as files, printers, remote data, and modems. See also client/server.


session

The instance of Visual FoxPro that is created when you start Visual FoxPro. The session ends when you exit Visual FoxPro. See also data session, work area.


set-based data

Information accessed by retrieving a set of data that meets specific criteria, rather than retrieving the entire contents of a database. Typically refers to large data stores, such as those maintained on a remote server, from which specific subsets of data are retrieved using SQL SELECT statements.


setting

The value of a property that determines how an object or a control looks or behaves. For example, if you set the SpecialEffect property of an edit region to 3D, the box will look three-dimensional.


setup code

The portion of a program that executes before the menu definition code in an .MPR file. Setup code might include code to open files, declare system variables, or place a previous menu system on a stack so it can be retrieved later without redefining it. See also cleanup code.


   shape

A control that creates a shape that can be displayed as several variations of a rectangle or a circle.


shortcut menu

Appears when the user right-clicks a selection, toolbar, or taskbar button, for example. The shortcut menu lists commands pertaining to that screen region or selection only.


The Apple system update to TeachText. Adds multiple windows and font and style selection.


sort order

The order in which records are displayed, either ascending (0-100) or descending (100-0). Alphabetic sort order depends on the locale.


   spinner

A control that allows you to increment or decrement numbers either by typing the numbers or clicking the UP and DOWN arrow keys.


SQL pass-through

A client/server term for creating SQL commands and passing them to the SQL database.


SQL Server

Microsoft SQL Server for Windows NT is a powerful, high-performance relational database management system for distributed client/server computing. SQL Server provides a unified data-management architecture that is powerful, reliable, and open to a wide range of applications and data sources.


stack

A region of reserved memory in which programs store operational information that can be pushed on or pulled off the stack. Visual FoxPro manages the stack in Visual FoxPro applications. If you create libraries with the Library Construction component of the Professional Edition of Visual FoxPro, these libraries can allocate space in the Visual FoxPro stack.


stored procedure

In Visual FoxPro, a procedure stored in a database. The procedure can contain any commands and functions allowed in a user-defined function. On a remote data source, a collection of SQL statements stored under a name in any SQL database.


string literal

A character string enclosed in matching single or double quotation marks. Can be used in character expressions. For example, "any characters" and 'any characters' are string literals.


structural compound index

An index file that is automatically opened every time its associated table is opened, and automatically updated when that table changes. A structural compound index always has the same base name as the table, but with a .CDX extension.


Structured Query Language (SQL)

A database query and programming language.


stub

An empty procedure or function sometimes used in early development or prototyping to create placeholders for routines that will be implemented later.


subclass

A new class definition of an object which uses another class definition as a starting point. This definition inherits any changes to the parent class.


subscript

An index number used to identify a particular element of an array.


summary band

An area of a report that appears once at the end of the report.


syntax

A representation of a command that specifies all the possible forms the command can take.


system object

An object that belongs to the operating system, rather than Visual FoxPro. This category includes Screen, Desktop, and Clipboard objects.


system variable

A variable that Visual FoxPro automatically creates and names with an underscore as the initial character. For example, _PAGENO is a system variable. Contrast variable.


tab

A user interface element that looks like the top of a file folder. You click the tab to select the folder. You can create tabs in Visual FoxPro using the page control tool in the Form Designer. See also page.


tab order

The order in which the focus moves from one field or object to the next as you press the TAB key.


table

The fundamental structure of a relational database management system. In Visual FoxPro, a table stores data in records (rows) and fields (columns). The data is usually about a particular category of things, such as customers, customer orders, employees, or inventory parts. Each Visual FoxPro table can be stored in its own file with a .DBF extension or contained in a database.


tags

Any of the separate index entries contained in a compound index file.


TCP/IP

Transfer Control Protocol/Internet Protocol. TCP/IP is the protocol that networks use to communicate with each other on the Internet.


template

A predefined class or form that is applied to each new class or form you create.


temporary relationship

Relationship between tables created using the SET RELATION command. Temporary relationships are purged when you exit Visual FoxPro. Contrast persistent relationship.


   text box

A control that allows you to enter or view text in a form. Typically, text boxes hold a single line of text. See also edit box.


text file

A file that contains information expressed in text form whose contents are interpreted as characters encoded using the ASCII format. Can be viewed and edited using various applications. Contrast binary file.


   timer

A control used to control recurring events in your application. The timer is not visible at run time.


title band

A report header that prints once at the beginning of a report.


   tool lock

A button on the Controls toolbar. When this button is pressed, the other control buttons stay active, rather than returning to the selection button.


toolbar

A set of buttons that you click to carry out common tasks. Toolbars can float in their own window, or you can dock them at the top, bottom, or sides of the main Visual FoxPro window. You can customize the toolbars provided with Visual FoxPro and you can create toolbars of your own design by using the base ToolBar class provided with Visual FoxPro. See also class, base class.


topN query

A query that retrieves a specified number or percentage of records from the overall record set that would otherwise be retrieved.


transaction

A series of processing steps that results in a specific function or activity being completed, ensuring that a set of actions is treated as a single unit of work.


trigger

Record-level event code that runs after an insert, update, or delete. Different actions can be attached to the different events. Triggers run last, after rules, and do not run during buffered updates unless TABLEUPDATE( ) is issued. They are most often used for cross-table integrity.


twip

A unit of measurement, implemented as 1/20 of a point, or 1/1440 of an inch. There are 567 twips to a centimeter. Twips are screen-independent measurements. See also point. Contrast pixel.


unary operator

An operator that applies to a single operand. In Visual FoxPro, the minus sign and the NOT operator are unary; all other operators are binary: they take two operands.


unique index

An index in which no two records are permitted to have the same index value. A requirement for a primary key. See also primary index, candidate index.


upsizing

Upsizing refers to duplicating in SQL Server or Oracle databases, as much as possible, the functionality of a set of tables in a Visual FoxPro database. The upsizing wizards in Visual FoxPro automate the process.


URL

Uniform Resource Locator. Identifies the full path of a document, graphic, or other file on the Internet or on an intranet. A URL expresses the protocol (such as FTP or HTTP) to be accessed and the file’s location. A URL may also specify an Internet e-mail address or a newsgroup. Some examples of URLs are:

http://www.someones.homepage/default.html

ftp://ftp.server.somewhere/ftp.file

gopher://server.name

file://Server/Share/File.doc

See also FTP, HTTP, World Wide Web (WWW).


user-defined class (UDC)

Similar to Visual FoxPro base classes, but defined by the user, and available for subclassing. This type of class has no visual representation.


user-defined function (UDF)

Code created by a user that returns a value. User-defined functions include stand-alone programs saved with .PRG extensions, as well as procedures and functions contained inside a program. See also function, parameter.


validation

The process of checking whether entered data meets certain conditions or limitations. See also field-level rule, record-level rule.


variable

A location in the computer’s memory where data is stored. You can change the contents of a variable but its name and storage area are reserved for use until you end the Visual FoxPro session or release the variable. Variables and their values are lost unless you save them to disk before quitting Visual FoxPro. See also constant, system variable.


view

A customized virtual table definition that can be local, remote, or parameterized. Views reference one or more tables, or other views. They can be updated, and they can reference remote tables.


view definition

A definition for the SQL statement for a view. The view definition is stored in the current database and contains the names, fields, and property settings for the tables used in the SQL statement.


visibility

The scope of a variable. See also scope.


visual editing

In Visual FoxPro, double-clicking an object whose application supports visual editing causes the application’s menus to merge with the Visual FoxPro menus, allowing you to edit the object’s data in the main Visual FoxPro window instead of a separate window dedicated to the application. You can also control visual editing in your application.


wildcard

A character that can be used to represent a character or sequence of characters in a pathname. A question mark (?) can represent a single character. An asterisk (*) represents any sequence of characters. For example, if you request a listing of *.TXT files in a particular application, you would see a list of all files ending with the extension TXT. See also file skeleton.


wizard

A sequence of dialog boxes that present specific questions about what you want to create. Once you answer the questions, the wizard completes the task.


work area

A numbered region that identifies a table. By choosing the work area in the Data Session window, you can open the associated table.


WWW
World Wide Web (WWW)

The portion of the global Internet that uses hypertext links to connect pages and resources in a way that lets you reach any page from any other page. Web browsers enable you to navigate the Web. When you use a Web browser, such as Microsoft Internet Explorer, the Web appears as a collection of text, pictures, sounds, and digital movies. See also FTP, home page, HTTP, URL.


Xbase

A standardized database programming language common to Visual FoxPro, Clipper, and dBASE.


zero-length string

An empty character string. You create zero-length strings by using quotation marks with no intervening spaces ("").


zoom

To enlarge a window or a page in the Print Preview toolbar. When you zoom an object that is already enlarged, Visual FoxPro shrinks it to its original size.


z-order

The visual layering of controls on a form along the form's z-axis (depth). The z-order determines which controls are in front of other controls.


Image Editor

To view and edit bitmaps, cursors, and icons, use the Image Editor, IMAGEDIT.EXE, located in the Visual FoxPro IMAGEDIT directory.

To use the Image Editor

•	In your Visual FoxPro group, choose the Image Editor icon.

 – Or –

•	Run IMAGEDIT.EXE.

For more information on viewing and editing images, see the Image Editor help file, IMAGEDIT.HLP in the Visual FoxPro IMAGEDIT directory.


Changes to the User's Guide

See Also

At the time that this file was compiled, no known changes are required for the User’s Guide.


See Also

Changes to the Developer's Guide
Changes to the Installation Guide
Changes to the Language Reference


Changes to the Developer's Guide

See Also

You can print this summary of changes by choosing Print Topic from the File menu. The changes are organized by chapter, page number, and section.

Chapter 10, “Using Controls”

Page 275    Remove AutoIncrement from the table of text box properties.


See Also

Changes to the Installation Guide
Changes to the Language Reference
Changes to the User's Guide


Changes to the Installation Guide

See Also

At the time that this file was compiled, no known changes are required for the Installation Guide.


See Also

Changes to the Developer's Guide
Changes to the Language Reference
Changes to the User's Guide


Changes to the Language Reference

See Also

You can print this summary of changes by choosing Print Topic from the File menu. The changes are organized by chapter, page number, and section.

Format Property

Page 192    In the table of valid settings for the TextBox and Column objects, add this setting:

K   Selects all the text when the control gets the focus.

REPORT Command

Page 350    A new RANGE clause has been added to this command since the documentation was printed. Using the RANGE clause, you can specify a range of pages to print. The syntax for the clause is:

RANGE nStartPage [, nEndPage]

In the Arguments section, add the following descriptions for the RANGE clause:

nStartPage

Specifies the first page printed.

NEndPage

Specifies the last page printed. If nEndPage is omitted, the last page printed defaults to 9,999.


See Also

Changes to the Developer's Guide
Changes to the Installation Guide
Changes to the User's Guide


ActiveX Controls Overview

See Also

Visual FoxPro includes a set of ActiveX controls (.OCX files) you can add to and distribute with your applications. ActiveX controls are added to a form in an application by using the Visual FoxPro OLE container control.

ActiveX controls are installed by default if you choose the Complete installation option when you install Visual FoxPro. If you did not choose this option, you can run Visual FoxPro Setup again at any time and install only the ActiveX controls. ActiveX controls are installed in the SYSTEM directory in Windows 95 or the SYSTEM32 directory in Windows NT.

Note   Many of the ActiveX controls that ship with Visual FoxPro were originally created for use with other applications. When an ActiveX control is placed on a form and you press F1 for Help for the control, the Help that displays is from the original application, not Visual FoxPro.

The following table lists the .OCX files shipped with Visual FoxPro and the ActiveX controls contained in each file.

File	Controls
COMCTRL32.OCX	ImageList Control ListView Control ProgressBar Control Slider Control StatusBar Control TabStrip Control Toolbar Control TreeView Control
COMDLG32.OCX	Common Dialogs Control
DBLIST32.OCX	MSDataCombo Control MSDataList Control
FOXHWND.OCX	Visual FoxPro HWND Control
FOXTLIB.OCX	Visual FoxPro Foxtlib Control
GRID32.OCX	Grid Control
MCI32.OCX	Microsoft Multimedia Control
MSACAL70.OCX	Calendar Control
MSCOMM32.OCX	Microsoft Comm Control
MSMAPI32.OCX	Microsoft MAPI Message Control Microsoft MAPI Session Control
MSOUTL32.OCX	Outline Control
PICCLP32.OCX	PicClip Control
RICHTX32.OCX	Rich Textbox Control
SYSINFO.OCX	SysInfo Control
TABCTL32.OCX	SSTab Control
THREED32.OCX	Threed Checkbox Control Threed Command Button Control Threed Frame Control Threed Group Push Button Control Threed Option Button Control Threed Panel Control
Note   If you install the Visual FoxPro online documentation, the MediaView 1.41 ActiveX control (MEDV141N.OCX) is installed. This ActiveX control supports browsing the online documentation only; it cannot be added to or distributed with your applications.

If you place the SysInfo control on a form, there is no Help available through F1. For information on this control, see the Help file for it in the SYSTEM or SYSTEM32 directory.

For additional information about adding ActiveX controls to your applications, see Chapter 16, “Adding OLE,” in the Developer’s Guide.


See Also

OLE Container Control,
Visual FoxPro Foxtlib Control,
Visual FoxPro HWND Control


Visual FoxPro Foxtlib Control

See Also

Visual FoxPro includes the Foxtlib ActiveX control (FOXTLIB.OCX) which you can add to and distribute with your applications. ActiveX controls are added to a form in an application with the Visual FoxPro OLE container control..

The Foxtlib ActiveX control lets you access type library information from within a Visual FoxPro application. Type libraries are used to store class information (properties, methods, and so on) for OLE servers that you can create in Visual FoxPro and Visual Basic. Type libraries are typically viewed by Object Browsers and referenced in other application such as Visual Basic or Visual C++ to allow direct object references to be made and compiled into code.

When you create an OLE server in the Project Manager or with the BUILD DLL or BUILD EXE commands, a type library (.TLB) file is generated. The type library file contains information about each class, such as the number of parameters it requires and their data types, the control’s return types, references to help topics or help files that provide more information about the class, and so on.

TYPELIB.VCX, a visual class library example that utilizes the Foxtlib ActiveX control, is installed in the SAMPLES\CLASSES directory.

For more information about creating custom OLE servers in Visual FoxPro, see “Creating OLE Servers” in Chapter 16, “Adding OLE” in the Developer’s Guide.

The following table lists the methods available for the Foxtlib ActiveX control. For additional information about these methods, consult the Microsoft Developers Network.

Method	Description
TLLoadTypeLib(cTypeLibName)	Loads the type library file specified with cTypeLibName. CTypeLibName must be a fully qualified path and file name. A positive integer handle to the type library file is returned; a value of 0 or less is returned if the type library file cannot be loaded.
TLRelease(nTypeLibHandle)	Releases the loaded type library whose handle is specified with nTypeLibHandle.
TLGetTypeInfoCount(nTypeLibHandle)	Returns the number of type infos in the type library whose handle is specified with nTypeLibHandle.
TLGetDocumentation(nTypeLibHandle, aDocArray, nMemberID, nType)	Creates a three-element array containing information about the type library whose handle is specified with nTypeLibHandle. ADocArray specifies the name of the array that is created. The 3-element array includes details on the name, document string, and help file for the member specified with nMemberID. nType specifies the member type: 0 -TypeInfo, or 1 - Member.
TLGetTypeInfo(nTypeLibHandle, nTypeInfoNum)	Returns an integer index for use with the TLGetTypeAttr( ), TlGetNames( ), and TLGetFuncDesc( ) methods. TLGetTypeInfo( ) returns 0 if the method fails. Use TLGetTypeInfo( ) to enumerate (beginning at 0) through all type infos in the type library whose handle is specified with nTypeLibHandle. NTypeInfoNum specifies the type info for which the index is returned.
TLGetTypeAttr(nTypeInfoIndex, aTypeArray)	Creates a one-dimensional array containing information about a type info. nTypeInfoIndex specifies the index number for the type info. aTypeArray specifies the name of the array that is created. The information contained in each element of the array is listed below:   1  GUID.   2  LocaleID.   3  Reserved.   4  Constructor ID.   5  Destructor ID.   6  Reserved.   7  Instance Size.   8  Type Kind.   9  Number of functions. 10  Number of variables/members. 11  Number of implemented  interfaces. 12  Size of type's virtual function  table. 13  Byte alignment of an instance  of this type. 14  Flags. 15  Major version number. 16  Minor version number.
TIGetFuncDesc(nTypeInfoIndex, aTypeArray, nFunctionIndex, aParmsArray)	Returns information for a function specified in a type info. The type info is specified with nTypeInfoIndex. nFunctionIndex specifies the index of the function for which information is returned. nFunctionIndex can be between 0  and the function count returned by aTypeArray[9] of the TLGetTypeAttr( ) method.  TIGetFuncDesc( ) creates two arrays whose names are specified with aTypeArray and aParmsArray. The aTypeArray contains information about the function. The aParmsArray array contains a listing of the parameters used by the function. The information contained in each element of aTypeArray is listed below:   1  ID.   2  Func kind - Specifies if the  function is virtual, static, or  dispatch-only.   3  Invoke kind - Invocation kind;  indicates if this is a property  function and if so, what type.    4  Callconv - Specifies the  function's calling convention.    5  Total number of  parameters.   6  Number of optional parameters.   7  For FUNC_VIRTUAL, specifies  the offset in the virtual function  table.   8  Count of permitted Scodes.   9  Flags. The Func kinds are listed below: FUNC_PUREVIRTUAL The function is accessed through the virtual function table and takes an implicit “this” pointer. FUNC_VIRTUAL The function is accessed the same as PUREVIRTUAL, except the function has an implementation. FUNC_NONVIRTUAL The function is accessed by static address and takes an implicit “this” pointer. FUNC_STATIC The function is accessed by static address and does not take an implicit “this” pointer. FUNC_DISPATCH The function can be accessed only through IDispatch. The Invoke kinds are listed below: INVOKE_FUNC The member is called using normal function invocation syntax. INVOKE_PROPERTYGET The function is invoked using normal property access syntax. INVOKE_PROPERTYPUT The function is invoked using property value assignment syntax. A typical programming language might represent changing a property in the same way as assignment; for example, Object.Property := Value. INVOKE_PROPERTYPUTREF The function is invoked using property reference assignment syntax. The Flags are listed below: FUNCFLAG_FRESTRICTED = 1 The function should not be accessible from macro languages. This flag is intended for system-level functions or functions that type browsers should not display. FUNCFLAG_FSOURCE = 0x2 The function returns an object that is a source of events. FUNCFLAG_FBINDABLE = 0x4 The function supports data binding. FUNCFLAG_FDISPLAYBIND = 0x10 The function is displayed to the user as bindable, that is, FUNC_FBINDABLE must also be set. FUNCFLAG_FDEFAULTBIND = 0x20 The function that best represents the object. Only one function in a type info may have this attribute. FUNCFLAG_FHIDDEN= 0x40 The function should not be displayed to the user, though it exists and is bindable.
TIGetNames(nTypeInfoIndex, aNameArray, aTypeArray[1])	Returns the number of functions for a type info and creates an array  The type info is specified with nTypeInfoIndex, and aNameArray specifies the name of the array that is created. aTypeArray[1] specifies the ID returned from the aTypeArray array in the TIGetFuncDesc( ) method.


See Also

ActiveX Controls Overview,
OLE Container Control


Visual FoxPro HWND Control

See Also

Visual FoxPro includes the HWND ActiveX control (FOXHWND.OCX) which you can add to and distribute with your applications. ActiveX controls are added to a form in an application with the Visual FoxPro OLE container control..

The HWND ActiveX control provides a window in which other ActiveX controls (such as the Microsoft Multimedia ActiveX control) can display images. Unlike the Visual FoxPro Image control, the HWND ActiveX control can be used to display icon and Windows metafiles.

The following table lists the properties, events, and methods available for the HWND ActiveX control.

Property, Event, or Method	Description
Appearance Property	Specifies the appearance of the HWND control. Available at design time and run time. The Appearance property can have the following values: 0 - (Default) Flat. 1 - 3-dimensional.
BackColor Property	Specifies the background color of the HWND control. Available at design time and run time. The BackColor property is a single numeric color value. For more information about color values that can be assigned to the BackColor property, see the Visual FoxPro BackColor, ForeColor Properties topic in Help.
BorderStyle Property	Specifies the border style of the HWND control. Available at design time and run time. The BorderStyle property can have the following values: 0 - (Default) No border. 1 - Single line border.
Picture Property	Specifies a picture object reference for the image displayed in the HWND control. Available at design time and run time. Use LOADPICTURE( ) to create an object reference for a bitmap, icon, or Windows meta file.
HWnd Property	Contains the handle to the window of the HWND control. Read-only at runtime.
Click Event	Occurs when the user presses and releases the left mouse button while the pointer is over the HWND control.
DblClick Event	Occurs when the user presses and releases the left mouse button twice in quick succession over the HWND control.
KeyDown Event	Occurs when the user presses a key when the HWND control has the focus. Two parameters, keycode and shift, are passed to the KeyDown event. Keycode   Contains a number which identifies the key pressed. For a list of codes for special keys and key combinations, see INKEY( ). Shift   Sets a bit if the key is pressed. This parameter is the sum of the bits, with the least-significant bits corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT key (bit 2). These bits correspond to the values 1, 2, and 4, respectively. This parameter indicates the state of these keys. Some, all, or none of the bits can be set, indicating that some, all, or none of the keys is pressed. For example, if both CTRL and ALT are pressed, the value of shift is 6.
KeyPress Event	Occurs when the user presses and releases a key when the HWND control has the focus. One parameter, keyascii, is passed to the KeyPress event. Keyascii   Contains a number which identifies the key pressed and released. For a list of codes for special keys and key combinations, see INKEY( ).
KeyUp Event	Occurs when the user releases a key when the HWND control has the focus. Two parameters, keycode and shift, are passed to the KeyUp event. Keycode   Contains a number which identifies the key released. For a list of codes for special keys and key combinations, see INKEY( ). Shift   Sets a bit if the key is released. This parameter is the sum of the bits, with the least-significant bits corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT key (bit 2 ). These bits correspond to the values 1, 2, and 4, respectively. This parameter indicates the state of these keys. Some, all, or none of the bits can be set, indicating that some, all, or none of the keys is pressed. For example, if both CTRL and ALT are pressed, the value of shift is 6.
MouseDown Event	Occurs when the user presses a mouse button while the pointer is over the HWND control. Four parameters, button, shift, x, and y, are passed to the MouseDown event. Button   Contains a number which specifies which button was pressed to trigger the event: 1 (left), 2 (right), or 4 (middle). Shift   Contains a number which specifies the state of the SHIFT, CTRL, and ALT keys when the button specified in the button argument was pressed. A bit is set if the key is down. The shift argument is the sum of the bits, with the least-significant bits corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT key (bit 2). These bits correspond to the values 1, 2, and 4, respectively. The shift parameter indicates the state of these keys. Some, all, or none of the bits can be set, indicating that some, all, or none of the keys are pressed. For example, if both CTRL and ALT are pressed, the value of shift is 6. x, y   Contains the current horizontal (x) and vertical (y) position of the mouse pointer within the form. These coordinates are always expressed in terms of the form's coordinate system specified, in the unit of measurement specified ScaleMode property setting.
MouseMove Event	Occurs when the user moves the mouse over the HWND control. The MouseMove event is triggered continually as the mouse pointer moves across the HWND control. Four parameters, button, shift, x, and y, are passed to the MouseMove event. Button   Contains a number which specifies the state of the mouse buttons as a sum of bits: 1 (left), 2 (right), or 4 (middle). Shift   Contains a number which specifies the state of the SHIFT, CTRL, and ALT keys: 1 (SHIFT), 2 (CTRL), 4 (ALT). A bit is set if the key is down. The shift parameter is the sum of the bits, with the least-significant bits corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT key (bit 2). These bits correspond to the values 1, 2, and 4, respectively. shift indicates the state of these keys. Some, all, or none of the bits can be set, indicating that some, all, or none of the keys are pressed. For example, if both CTRL and ALT are pressed, the value of shift is 6. x, y   Contains the current horizontal (x) and vertical (y) position of the mouse pointer within the form. These coordinates are always expressed in terms of the form's coordinate system specified, in the unit of measurement specified ScaleMode property setting.
MouseUp Event	Occurs when the user releases a mouse button while the pointer is over the HWND control. Four parameters, button, shift, x, and y, are passed to the MouseUp event. Button   Contains a number which specifies which button was released to trigger the event: 1 (left), 2 (right), or 4 (middle). Shift   Contains a number which specifies the state of the SHIFT, CTRL, and ALT keys when the button specified in the button argument was released. A bit is set if the key is down. The shift argument is the sum of the bits, with the least-significant bits corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT key (bit 2). These bits correspond to the values 1, 2, and 4, respectively. The shift parameter indicates the state of these keys. Some, all, or none of the bits can be set, indicating that some, all, or none of the keys are pressed. For example, if both CTRL and ALT are pressed, the value of shift is 6. x, y   Contains the current horizontal (x) and vertical (y) position of the mouse pointer within the Form. These coordinates are always expressed in terms of the Form's coordinate system specified, in the unit of measurement specified ScaleMode property setting.
Paint Event	Occurs when the HWND control requires repainting. The RestoreDisplay method is typically executed in the Paint event code.
RestoreDisplay Method	Restores the image stored to memory with the SaveDisplay method.
SaveDisplay Method	Save the currently displayed image to memory. Note that if a toolbar or a form with the AlwaysOnTop property set to true (.T.) is over the HWND control when the SaveDisplay method is executed, the image of the toolbar or form is saved with the image in the HWND control.
For additional information about adding ActiveX controls to your applications, see Chapter 16, “Adding OLE,” in the Developer’s Guide.


See Also

ActiveX Controls Overview,
OLE Container Control


_ActivateHandler( ) API Library Routine

See Also	Example

Adds a handler function to the end of the list of event handlers.

Syntax

unsigned int _ActivateHandler(FPFI handler)
FPFI handler	/* Event handler to be added. */

Remarks

_ActivateHandler( ) returns an integer identifier for this handler. Use this identifier to remove the handler from the event processor list with _DeActivateHandler( ).

The handler is invoked with two parameters: the WHANDLE of the window to which the event belongs, and a FAR (32-bit) pointer to an event record. If your handler doesn’t look for an event, or modifies an event for subsequent event handlers, it returns False (0) to indicate that the event must still be passed on to other handlers or to the Visual FoxPro interface routines. If the handler determines that the event doesn’t need to be passed on, it returns True (an integer other than 0) to indicate that the event has been handled.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_ActivateHandler( ) API Library Routine Example

The following example activates an event handler when the library is loaded. The event handler prints a message for every event and lets Visual FoxPro process the event as it does normally. The event handler is deactivated when the library is unloaded.

Visual FoxPro Code

SET LIBRARY TO ACTIHAND

WAIT WINDOW TO m.test TIMEOUT 5

SET LIBRARY TO

C Code

#include <pro_ext.h>

static int HandlerID;

//	This is the routine that is registered as an event handler.

FAR EventHandler(WHandle theWindow, EventRec FAR *ev)

{

_PutStr("\nEventHandler() called.");

return NO;	// event still needs to be handled by Visual FoxPro

}

FAR Activate()

{

HandlerID = _ActivateHandler(EventHandler);

}

//	When the library is unloaded we must deactivate the event handler

//	in a CALLONUNLOAD function.

FAR DeActivate()

{

_DeActivateHandler(HandlerID);

}

FoxInfo myFoxInfo[] = {

{"ACTIVATE",  Activate,	CALLONLOAD, ""},

{"DEACTIVATE", DeActivate, CALLONUNLOAD, ""}

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_DeActivateHandler( )
_FindWindow( )
_GlobalToLocal( )
_MousePos( )


_ActivateIdle( ) API Library Routine

See Also	Example

Adds an idle handler function to the end of the list of idle event handlers called when Visual FoxPro is waiting for user input or for an event to time out.

Syntax

unsigned int _ActivateIdle(FPFI handler)
FPFI handler	/* Event handler. */

Remarks

_ActivateIdle( ) returns an integer identifier for this routine. Use the identifier to remove the idle event handler from the idle loop with _DeActivateIdle( ).

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_ActivateIdle( ) API Library Routine Example

The following example activates an idle event handler when the library is loaded. The idle event handler just prints a message. The idle event handler is deactivated when the library is unloaded.

Visual FoxPro Code

SET LIBRARY TO ACTIIDLE

WAIT WINDOW TO m.test TIMEOUT 5

SET LIBRARY TO

C Code

#include <pro_ext.h>

static unsigned IdlerID;

//	This is the routine that is registered as an idle event handler.

void FAR IdleHandler(WHandle wh, EventRec *ev)

{

_PutStr("\nIdleHandler() called.");

}

void FAR Activate(ParamBlk FAR *parm)

{

IdlerID = _ActivateIdle((FPFI) IdleHandler);

}

//	When the library is unloaded we must deactivate the idle event

//	handlerin a CALLONUNLOAD function.

void FAR DeActivate(ParamBlk FAR *parm)

{

_DeActivateIdle(IdlerID);

}

FoxInfo myFoxInfo[] = {

{"ACTIVATE",    (FPFI) Activate,   CALLONLOAD,     ""},

{"DEACTIVATE",  (FPFI) DeActivate, CALLONUNLOAD,   ""}

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_DeActivateIdle( )
_FindWindow( )
_GlobalToLocal( )
_MousePos( )


_ActivateMenu( ) API Library Routine

See Also	Example

Displays the specified menu on the screen and immediately returns control to the calling routine.

Syntax

void _ActivateMenu(MENUID menuid)
MENUID menuid	/* Menu identifier.

Remarks

If you detect the press of a mouse button or a keystroke on the menu, you can call _MenuInteract( ) to determine which menu item the user chose.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_ActivateMenu( ) API Library Routine Example

The following example builds a menu with three items. _ActivateMenu( ) displays the menu. This menu is non-modal in that interaction is not forced as with _MenuInteract( ). Rather, when the user makes a selection the _OnSelection( ) routine is called, the selected item is printed on the screen, and the menu is disposed of.

Visual FoxPro Code

SET LIBRARY TO ACTIMENU

WAIT WINDOW "Make selection from menu." NOWAIT

SUSPEND

C Code

#include <pro_ext.h>

static MENUID menuId;

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 10;

_PutValue(&val);

}

FAR onSelection(long menuId, long itemId)

{

_PutStr("\nitemId = "); putLong(itemId);

}

FAR deactivateMenu(ParamBlk FAR *parm)

{

_DeActivateMenu(menuId);

_DisposeMenu(menuId);

}

FAR activateMenu(ParamBlk FAR *parm)

{

ITEMID itemId;

Point loc;

menuId = _GetNewMenuId();

_NewMenu(MPOPUP, menuId);

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<1st item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<2nd item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<3rd item");

loc.v = 10; loc.h = 20;

_SetMenuPoint(menuId, loc);

_ActivateMenu(menuId);

_OnSelection(menuId, -1, onSelection);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) activateMenu, CALLONLOAD, ""},

{"ONUNLOAD", (FPFI) deactivateMenu, CALLONUNLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_DeActivateMenu( )
_MenuId( )
_NewItem( )
_NewMenu( )
_OnSelection( )


_ALen( ) API Library Routine

See Also	Example

Returns information about the dimensions of the array whose name table index is nti.

Syntax

long _ALen(NTI nti, int mode)
NTI nti;	/* Array name table index. */
int mode;	/* Mode to determine return value. */

Remarks

If mode is AL_ELEMENTS, _ALen( ) returns the total number of elements in the array. If mode is AL_SUBSCRIPT1, _ALen( ) returns the value of the first subscript used to declare the array. If mode is AL_SUBSCRIPT2, _ALen( ) returns the value of the second subscript used to declare the array.

If nti doesn’t represent the name of an existing array, _ALen( ) returns  – 1 regardless of the value of mode.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_ALen( ) API Library Routine Example

The following example provides a Visual FoxPro API routine for each of the three possible mode values.

Visual FoxPro Code

SET LIBRARY TO ALEN

DIMENSION a[10, 11]

? ALENELEM(@a)  && returns 110

? ALENSUB1(@a)  && returns 10

? ALENSUB2(@a)  && returns 11

DIMENSION b[3]

? ALENELEM(@b)  && returns 3

? ALENSUB1(@b)  && returns 3

? ALENSUB2(@b)  && returns 0; no second subscript

c = .F.

? ALENELEM(@c)  && returns -1 because variable "c" is not an array

? ALENSUB1(@c)  && returns -1 because variable "c" is not an array

? ALENSUB2(@c)  && returns -1 because variable "c" is not an array

C Code

#include <pro_ext.h>

void FAR alenElem(ParamBlk FAR *parm)

{

_RetInt(_ALen(parm->p[0].loc.l_NTI, AL_ELEMENTS), 10);

}

void FAR alenSub1(ParamBlk FAR *parm)

{

_RetInt(_ALen(parm->p[0].loc.l_NTI, AL_SUBSCRIPT1), 10);

}

void FAR alenSub2(ParamBlk FAR *parm)

{

_RetInt(_ALen(parm->p[0].loc.l_NTI, AL_SUBSCRIPT2), 10);

}

FoxInfo myFoxInfo[] = {

{"ALENELEM", (FPFI) alenElem, 1, "R"},

{"ALENSUB1", (FPFI) alenSub1, 1, "R"},

{"ALENSUB2", (FPFI) alenSub2, 1, "R"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_FindVar( )
_Load( )
_NameTableIndex( )
_NewVar( )
_Release( )
_Store( )


_Alloca( ) API Library Routine

Example

Allocates a block of stack space for the calling routine.

Syntax

void FAR * _Alloca(unsigned int size)
unsigned int size;	/* Size of stack space to allocate in bytes. */

Remarks

_Alloca( ) returns a pointer to the block if the block is successfully allocated, or returns zero if the block isn’t allocated. _Alloca( ) automatically frees memory when the routine ends, so no corresponding release routine is necessary.

Caution   Some C compilers, such as MPW C, do not support memory allocation from the stack; calls to _Alloca( ) using such compilers will have unpredictable results. Instead, use local variables, or calls to _AllocHand( ) and _FreeHand( ), in your code to reserve memory.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_Alloca( ) API Library Routine Example

The following example duplicates the action of the Visual FoxPro REPLICATE( ) function. The memory temporarily used to duplicate the character comes from _Alloca( ).

Visual FoxPro Code

SET LIBRARY TO ALLOCA

x = xREPLICATE("x", 120)

? x

? LEN(x)

C Code

#include <pro_ext.h>

void FAR allocaEx(ParamBlk FAR *parm)

{

char FAR *rep;

char c = *(char *) _HandToPtr(parm->p[0].val.ev_handle);

rep = _Alloca((int) parm->p[1].val.ev_long + 1);

_MemFill(rep, c, (int) parm->p[1].val.ev_long);

    rep[parm->p[1].val.ev_long] = '\0';  // null terminate

_RetChar(rep);

}

FoxInfo myFoxInfo[] =

{

{"XREPLICATE", (FPFI) allocaEx, 2, "C,I"},

};

FoxTable _FoxTable =

{

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


_AllocHand( ) API Library Routine

See Also	Example

Returns a new MHANDLE of size hsize.

Syntax

MHANDLE _AllocHand(unsigned int hsize)
unsigned int hsize;	/* Size of new memory handle in bytes. */

Remarks

_AllocHand( ) returns 0 when there is insufficient memory to fulfill the request. Memory allocated with _AllocHand( ) isn’t initialized, and must be freed after use.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_AllocHand( ) API Library Routine Example

In The following example, a character is replicated in memory supplied by _AllocHand( ). The API function REPLTOMH( ) below returns the memory handle to Visual FoxPro. From Visual FoxPro the memory handle is passed to API functions, which expect a memory handle argument (passed as an integer, "I").

Visual FoxPro Code

SET LIBRARY TO ALLOCHAN

mh = REPLTOMH("x", 120)

? MHTOFOX(mh)

? LEN(MHTOFOX(mh))

? MHTOFOX(mh)

= FREEMH(mh)

C Code

#include <pro_ext.h>

//	Replicate char argument to memory allocated with _AllocHand().

//	Return the memory handle to Visual FoxPro.

void FAR replToMH(ParamBlk FAR *parm)

{

char FAR *rep;

char c = *(char *) _HandToPtr(parm->p[0].val.ev_handle);

MHANDLE mh;

if ((mh = _AllocHand((int) parm->p[1].val.ev_long + 1)) == 0)

{

_Error(182);  // "Insufficient memory"

}

_HLock(mh);

rep = _HandToPtr(mh);

_MemFill(rep, c, (int) parm->p[1].val.ev_long);

rep[parm->p[1].val.ev_long] = '\0';  // null terminate

_HUnLock(mh);

_RetInt(mh, 10);

}

//	Returns characters in memory handle.

//	Argument in call from Visual FoxPro

//	must be a valid Visual FoxPro memory handle.

void FAR MHToFoxString(ParamBlk FAR *parm)

{

char FAR *string;

MHANDLE mh = parm->p[0].val.ev_long;

_HLock(mh);

string = _HandToPtr(mh);

_RetChar(string);

_HUnLock(mh);

}

//	Frees memory handle.  Argument in call from

//	Visual FoxPro must be a valid

//	Visual FoxPro memory handle.

void FAR freeMH(ParamBlk FAR *parm)

{

_FreeHand((MHANDLE) parm->p[0].val.ev_long);

}

FoxInfo myFoxInfo[] = {

{"REPLTOMH", (FPFI) replToMH, 2, "C,I"},

{"MHTOFOX", (FPFI) MHToFoxString, 1, "I"},

{"FREEMH", (FPFI) freeMH, 1, "I"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_FreeHand( )
_GetHandSize( )
_HandToPtr( )
_HLock( )
_HUnLock( )
_MemAvail( )
_SetHandSize( )


_AllocMemo( ) API Library Routine

See Also	Example

Allocates size bytes of space in the memo file for a field and inserts the new block number in the associated record in the database.

Syntax

long _AllocMemo(Locator FAR *fld, long size)
Locator FAR *fld;	/* Pointer to locator that defines the memo field. */
long size;	/* Size of allocated space in bytes. */

Remarks

When _AllocMemo( ) is successful, it returns the location in the file to begin writing; otherwise, it returns  – 1.

Caution   Writing more than size bytes causes memo file corruption.

If you plan to replace a memo field using direct methods, be sure your routine calls _AllocMemo( ) before writing to the memo file, even if the new value is the same length or smaller than the original. This prevents problems in multi-user situations. _AllocMemo( ) reuses the previously allocated space when it’s safe to do so.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_AllocMemo( ) API Library Routine Example

The following example creates new memo field contents.

Visual FoxPro Code

SET LIBRARY TO ALLOMEMO

CREATE TABLE wMemo (memoField M)

APPEND BLANK

= NewMemo(@MemoField, "Hello, World.")

APPEND BLANK

= NewMemo(@MemoField, "Isn't this fun?")

C Code

#include <pro_ext.h>

FAR newMemo(ParamBlk FAR *parm)

{

Locator FAR *memoFldLoc;

FCHAN fchMemo;

int memoLen;

long loc;

if ((fchMemo = _MemoChan(-1)) == -1)

{

_UserError("_MemoChan() failed");

}

memoFldLoc = &parm->p[0].loc;

memoLen = parm->p[1].val.ev_length;

if ((loc = _AllocMemo(memoFldLoc, memoLen)) == -1)

{

_UserError("_AllocMemo() failed");

}

_FSeek(fchMemo, loc, FS_FROMBOF);

_HLock(parm->p[1].val.ev_handle);

_FWrite(fchMemo, _HandToPtr(parm->p[1].val.ev_handle), memoLen);

_HUnLock(parm->p[1].val.ev_handle);

}

FoxInfo myFoxInfo[] = {

{"NEWMEMO", (FPFI) newMemo, 2, "R,C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_DBReplace( )
_FindMemo( )
_MemoChan( )
_MemoSize( )


_BreakPoint( ) API Library Routine

Example

_BreakPoint( ) is a macro that generates the debugger breakpoint instruction, INT 3. This can be helpful for debugging external routines.

Syntax

void _BreakPoint(void any)
void any;	/* Pointer. */

Remarks

When a _BreakPoint( ) call is encountered, control transfers to your debugger. Most debuggers return control to the program line that includes the INT3 instruction, and you have to manually increment the instruction pointer (IP) past this instruction. At that time you can use your debugger to set additional breakpoints. Always remove any breakpoints before exiting the external routine. For more information about debugging, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_BreakPoint( ) API Library Routine Example

The following example uses the macro _BreakPoint( ) to place an INT 3 that debuggers recognize as a breakpoint.

Visual FoxPro Code

SET LIBRARY TO BPOINT

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

int RetValue;

_BreakPoint(); // debugger breaks execution here

_HLock(parm->p[0].val.ev_handle);

_HLock(parm->p[1].val.ev_handle);

RetValue = _StrCmp(_HandToPtr(parm->p[0].val.ev_handle),

_HandToPtr(parm->p[1].val.ev_handle));

_RetInt(RetValue, 10); // does return control here

_HUnLock(parm->p[0].val.ev_handle);

_HUnLock(parm->p[1].val.ev_handle);

}

FoxInfo myFoxInfo[] = {

{"STRCMP", (FPFI) Example, 2, "C,C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


_CountItems( ) API Library Routine

See Also	Example

Returns the number of menu titles or bars on the specified menu.

Syntax

int _CountItems(MENUID menuid)
MENUID menuid;	/* Menu identifier. */


_CountItems( ) API Library Routine Example

The following example creates a menu with three items, and calls _CountItems( ) to show that the function correctly returns the number of items on the menu. The routine then disposes of menu items, and calls _CountItems( ) again.

Visual FoxPro Code

SET LIBRARY TO CNTITEMS

C Code

#include <pro_ext.h>

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 10;

_PutValue(&val);

}

FAR CountItemsEx(ParamBlk FAR *parm)

{

MENUID menuId;

ITEMID itemId;

Point loc;

menuId = _GetNewMenuId();

_NewMenu(MPOPUP, menuId);

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<1st item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<2nd item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<3rd item");

loc.v = 10; loc.h = 20;

_SetMenuPoint(menuId, loc);

_ActivateMenu(menuId);

_PutStr("\n_CountItems() ="); putLong(_CountItems(menuId));

_Execute("WAIT");

_DisposeItem(menuId, _GetItemId(menuId, 1));

_PutStr("\n_CountItems() ="); putLong(_CountItems(menuId));

_Execute("WAIT");

_DisposeItem(menuId, _GetItemId(menuId, 0));

_PutStr("\n_CountItems() ="); putLong(_CountItems(menuId));

_Execute("WAIT");

_DisposeMenu(menuId);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) CountItemsEx, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_GetNewMenuId( )
_MenuId( )
_NewMenu( )


_DBAppend( ) API Library Routine

See Also	Example

Attempts to append a new record to the table open in the specified workarea.

Syntax

int _DBAppend(int workarea, int carryflag)
int workarea;	/* Work area number. */
int carryflag;	/* SET CARRY setting. */

Remarks

The current work area is represented by  – 1. _DBAppend( ) returns 0 if the routine is successful. If the routine fails, _DBAppend( ) returns a negative integer whose absolute value is a Visual FoxPro error number.

Values for carryflag

Value	Effect
1	Carries information from the previous record into the new record.
0	Makes the new record blank.
– 1	Uses the setting of SET CARRY to determine whether information from the previous record is carried to the new record.
_DBAppend( ) automatically performs any necessary locking. If it’s unable to lock the file header, _DBAppend( ) fails and returns a negative integer whose absolute value is a Visual FoxPro error number.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_DBAppend( ) API Library Routine Example

The following example uses _DBAppend( ) to append a record to the table open in the current work area.

Visual FoxPro Code

SET LIBRARY TO DBAPPEND

DO CreateTest

SET CARRY ON

= DBAPPEND(-1)	&& SET CARRY is ON, so carry

SET CARRY OFF

= DBAPPEND(1)	&& carry regardless of SET CARRY

= DBAPPEND(-1)	&& SET CARRY is OFF, so no carry

PROCEDURE CreateTest

CREATE TABLE test (ABC C(20))

APPEND BLANK

REPLACE ABC WITH "Golly month of"

APPEND BLANK

REPLACE ABC WITH "A twelfth of"

APPEND BLANK

REPLACE ABC WITH "Hello, world"

APPEND BLANK

REPLACE ABC WITH "When in the"

GO TOP

RETURN

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

int RetCode;

if ((RetCode = _DBAppend(-1, (int) parm->p[0].val.ev_long)) < 0) {

_Error(-RetCode);

}

}

FoxInfo myFoxInfo[] = {

{"DBAPPEND", (FPFI) Example, 1, "I"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_DBLock( )
_DBUnlock( )


_DBLock( ) API Library Routine

See Also	Example

Attempts to lock the current record or the table open in the work area specified by workarea.

Syntax

int _DBLock(int workarea, int RecOrFile)
int workarea;	/* Work area. */
int RecOrFile;	/* What is to be locked. */

Remarks

The RecOrFile parameter can be DBL_RECORD, to specify the current record, or DBL_FILE, to specify the table file. _DBLock( ) returns True (an integer other than 0) if the lock is successful, or False (0) if the lock isn’t successful.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_DBLock( ) API Library Routine Example

The following example provides two API functions you can call from Visual FoxPro: XRLOCK( ), which locks the current record of the current work area; and XFLOCK( ), which locks the table open in the current work area. XRLOCK( ) calls _DBLock( – 1, DBL_RECORD( )), and XFLOCK( ) calls _DBLock( – 1, DBL_FILE( )).

Visual FoxPro Code

SET LIBRARY TO DBLOCK

DO CreateTest

USE Test SHARED

GO 2

= XRLOCK()

LIST STAT  && shows that record #2 is locked

= XFLOCK()

LIST STAT  && shows that whole DBF is locked

PROCEDURE CreateTest

CREATE TABLE test (ABC C(20))

APPEND BLANK

REPLACE ABC WITH "Golly month of"

APPEND BLANK

REPLACE ABC WITH "A twelfth of"

APPEND BLANK

REPLACE ABC WITH "Hello, world"

APPEND BLANK

REPLACE ABC WITH "When in the"

GO TOP

RETURN

C Code

#include <pro_ext.h>

FAR xLockRecord(ParamBlk FAR *parm)

{

_DBLock(-1, DBL_RECORD);

}

FAR xLockFile(ParamBlk FAR *parm)

{

_DBLock(-1, DBL_FILE);

}

FoxInfo myFoxInfo[] =

{

{"XRLOCK", (FPFI) xLockRecord, 0, ""},

{"XFLOCK", (FPFI) xLockFile,   0, ""},

};

FoxTable _FoxTable =

{

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_DBAppend( )
_DBUnlock( )


_DBRead( ) API Library Routine

See Also	Example

Moves the current record pointer to the specified record in the specified work area.

Syntax

int _DBRead(int workarea, long record)
int workarea;	/* Work area. */
long record;	/* Record number. */

Remarks

_DBRead( ) returns 0 if the routine is successful. If the routine fails, _DBRead( ) returns a negative integer whose absolute value is a Visual FoxPro error number.

Specifying 0 for record is equivalent to issuing GO TOP; specifying  – 1 for record is equivalent to issuing GO BOTTOM.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_DBRead( ) API Library Routine Example

The following example provides similar functionality to that of the Visual FoxPro command GO. XGO(n) moves the current record pointer to record number n in the current work area.

Visual FoxPro Code

SET LIBRARY TO DBREAD

DO CreateTest

USE Test SHARED

GO BOTTOM

? RECNO()

= XGO(2)

? RECNO()

PROCEDURE CreateTest

CREATE TABLE test (ABC C(20))

APPEND BLANK

REPLACE ABC WITH "This is record 1"

APPEND BLANK

REPLACE ABC WITH "This is record 2"

APPEND BLANK

REPLACE ABC WITH "This is record 3"

APPEND BLANK

REPLACE ABC WITH "This is record 4"

GO TOP

RETURN

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

_DBRead(-1, parm->p[0].val.ev_long);

}

FoxInfo myFoxInfo[] = {

{"XGO", (FPFI) Example, 1, "I"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_DBRewind( )
_DBSkip( )
_DBUnwind( )


_DBRecCount( ) API Library Routine

See Also	Example

Returns the total number of records in the table open in the specified work area.

Syntax

long _DBRecCount(int workarea)
int workarea;	/* Work area. */

Remarks

If no table is open in the specified work area, _DBRecCount( ) returns a negative integer whose absolute value is a Visual FoxPro error number.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_DBRecCount( ) API Library Routine Example

The following example calls _DBRecCount( ) to count the number of records in the table open in the current work area.

Visual FoxPro Code

SET LIBRARY TO DBRECCNT

DO CreateTest

? DBRECCOUNT()	&& call API routine

? RECCOUNT()	&& call built-in Visual FoxPro Function

PROCEDURE CreateTest

CREATE TABLE test (ABC C(20))

APPEND BLANK

REPLACE ABC WITH "This is record 1"

APPEND BLANK

REPLACE ABC WITH "This is record 2"

APPEND BLANK

REPLACE ABC WITH "This is record 3"

APPEND BLANK

REPLACE ABC WITH "This is record 4"

GO TOP

RETURN

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

_RetInt(_DBRecCount(-1), 10);

}

FoxInfo myFoxInfo[] = {

{"DBRECCOUNT", (FPFI) Example, 0, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_DBRecNo( )


_DBRecNo( ) API Library Routine

See Also	Example

Returns the number of the current record in the table open in the specified work area.

Syntax

long _DBRecNo(int workarea)
int workarea;	/* Work area. */

Remarks

If no table is open in the specified work area, _DBRecNo( ) returns a negative integer whose absolute value is a Visual FoxPro error number. If the record pointer is at the end of file, _DBRecNo( ) returns a number that is 1 greater than that returned by _DBRecCount( ).

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_DBRecNo( ) API Library Routine Example

The following example provides functionality similar to that of the Visual FoxPro RECNO( ) function.

Visual FoxPro Code

SET LIBRARY TO DBRECNO

DO CreateTest

GO 3

? DBRECNO()

GO 6

? DBRECNO()

USE

? DBRECNO()  && returns -119

PROCEDURE CreateTest

CREATE TABLE test (ABC C(20))

APPEND BLANK

REPLACE ABC WITH "This is record 1"

APPEND BLANK

REPLACE ABC WITH "This is record 2"

APPEND BLANK

REPLACE ABC WITH "This is record 3"

APPEND BLANK

REPLACE ABC WITH "This is record 4"

APPEND BLANK

REPLACE ABC WITH "This is record 5"

APPEND BLANK

REPLACE ABC WITH "This is record 6"

GO TOP

RETURN

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

_RetInt(_DBRecNo(-1), 10);

}

FoxInfo myFoxInfo[] = {

{"DBRECNO", (FPFI) Example, 0, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_DBRecCount( )


_DBReplace( ) API Library Routine

See Also	Example

_DBReplace( ) places a new value in a field.

Syntax

int _DBReplace(Locator FAR *fld, Value FAR *val)
Locator FAR *fld;	/* Field to be replaced. */
Value FAR *val;	/* Value to be placed in field. */

Remarks

_DBReplace( ) returns 0 if the replacement is successful. If the replacement fails, _DBReplace( ) returns a negative integer whose absolute value is a Visual FoxPro error number. _DBReplace( ) can be used on a memo field to replace its value with a new value that’s shorter than 65,000 bytes. To perform operations on memo fields that are larger than 65,000 bytes, you must use direct memo field routines and buffered file input/output routines.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_DBReplace( ) API Library Routine Example

The following example provides functionality similar to the Visual FoxPro REPLACE command, but replaces the value of only one record at a time.

Visual FoxPro Code

SET LIBRARY TO DBREPLAC

DO CreateTest

? DBREPLACE(@ABC, "Replacement record 1")

? DBREPLACE(@ABC, 2)  && returns -302 - field ABC is character field

PROCEDURE CreateTest

CREATE TABLE test (ABC C(20))

APPEND BLANK

REPLACE ABC WITH "This is record 1"

APPEND BLANK

REPLACE ABC WITH "This is record 2"

APPEND BLANK

REPLACE ABC WITH "This is record 3"

APPEND BLANK

REPLACE ABC WITH "This is record 4"

GO TOP

RETURN

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

_RetInt(_DBReplace(&parm->p[0].loc, &parm->p[1].val), 10);

}

FoxInfo myFoxInfo[] = {

{"DBREPLACE", (FPFI) Example, 2, "R,?"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_DBLock( )
_DBUnlock( )


_DBRewind( ) API Library Routine

See Also	Example

Works like the Visual FoxPro GO TOP command in the specified work area, and then returns the current record number.

Syntax

long _DBRewind(int workarea)
int workarea;	/* Work area. */


_DBRewind( ) API Library Routine Example

The following example calls _DBRewind( ) for the table open in the current work area. This has the same effect as the Visual FoxPro GO TOP command.

Visual FoxPro Code

SET LIBRARY TO DBREWIND

DO CreateTest

GO BOTTOM

? RECNO()

? DBREWIND()	 && returns 1

? RECNO()    && yes, we're at record 1

PROCEDURE CreateTest

CREATE TABLE test (ABC C(20))

APPEND BLANK

REPLACE ABC WITH "This is record 1"

APPEND BLANK

REPLACE ABC WITH "This is record 2"

APPEND BLANK

REPLACE ABC WITH "This is record 3"

APPEND BLANK

REPLACE ABC WITH "This is record 4"

GO TOP

RETURN

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

_RetInt(_DBRewind(-1), 10);

}

FoxInfo myFoxInfo[] = {

{"DBREWIND", (FPFI) Example, 0, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_DBSkip( )
_DBUnwind( )


_DBSeek( ) API Library Routine

See Also	Example

Searches an indexed table in the current work area for the first record whose index key matches the value val.

Syntax

long _DBSeek(Value FAR *val)
Value FAR *val;	/* Sought value. */

Remarks

If _DBSeek( ) finds a matching record, it moves the record pointer to the matching record and returns the record number. The match must be exact unless you SET EXACT is set to OFF. If _DBSeek( ) doesn’t find a matching record, it returns 0. If no match is found and SET NEAR is set to ON, the record pointer is positioned immediately after the closest matching record. If SET NEAR is set to OFF, the record pointer is positioned at the end of the file.

If an error occurs, _DBSeek( ) returns a negative integer whose absolute value is a Visual FoxPro error number.

When seeking a numeric field, val must be set to ev_type ‘N’, even if that field has no decimal digits.  If val has an ev_type of ‘I’, _DBSeek( ) will return the internal error number -302, “Data type mismatch”.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_DBSeek( ) API Library Routine Example

The following example performs a seek on whatever index controls the order of the table open in the current work area. Note the "?" in the FoxInfo structure is required because the type of index expression is not known.

Visual FoxPro Code

SET LIBRARY TO DBSEEK

DO CreateTest

INDEX ON ABC TAG ABC

SET ORDER TO TAG ABC

= DBSEEK("This is record 3")  && seeks ABC = "This is record 3"

LIST NEXT 1

USE

PROCEDURE CreateTest

CREATE TABLE test (ABC C(20))

APPEND BLANK

REPLACE ABC WITH "This is record 1"

APPEND BLANK

REPLACE ABC WITH "This is record 2"

APPEND BLANK

REPLACE ABC WITH "This is record 3"

APPEND BLANK

REPLACE ABC WITH "This is record 4"

GO TOP

RETURN

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

_DBSeek(&parm->p[0].val);

}

FoxInfo myFoxInfo[] = {

{"DBSEEK", (FPFI) Example, 1, "?"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_DBRecCount( )
_DBRecNo( )


_DBSkip( ) API Library Routine

See Also	Example

_DBSkip( ) moves the record pointer in the specified work area the specified number of records.

Syntax

long _DBSkip(int workarea, long distance)
int workarea;	/* Work area. */
long distance;	/* Number of records to skip. */

Remarks

_DBSkip( ) respects the active index and filter expressions, just like the Visual FoxPro SKIP command. The distance may be positive or negative. _DBSkip( ) returns the record number of the new record.

Use _DBStatus( ) to check for end of file and beginning of file conditions. If you try to skip forward from the end of the file, or skip backwards from the beginning of the file, _DBSkip( ) returns a negative integer whose absolute value is a Visual FoxPro error number.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_DBSkip( ) API Library Routine Example

The following example works like the Visual FoxPro SKIP command.

Visual FoxPro Code

SET LIBRARY TO DBSKIP

ON ERROR DO expectError

DO CreateTest

USE

= DBSKIP(1) 	&& _Error() called: no DBF in use

USE test

GO TOP

= DBSKIP(-1)

= DBSKIP(-1)	&& _Error() called: at top of file

GO BOTT

= DBSKIP(1)

= DBSKIP(1)	&& _Error() called: at bottom of file

ON ERROR

PROCEDURE expectError

? "ERROR: " + MESSAGE()

RETURN

PROCEDURE CreateTest

CREATE TABLE test (ABC C(20))

APPEND BLANK

REPLACE ABC WITH "This is record 1"

APPEND BLANK

REPLACE ABC WITH "This is record 2"

APPEND BLANK

REPLACE ABC WITH "This is record 3"

APPEND BLANK

REPLACE ABC WITH "This is record 4"

GO TOP

RETURN

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *pblk)

{

int RetCode;

if ((RetCode = _DBSkip(-1, pblk->p[0].val.ev_long)) < 0) {

_PutStr("\nError encountered in example program.");

_Error(-RetCode);  // _DBSkip() returns negative error code

}

_RetInt(RetCode, 10);

}

FoxInfo myFoxInfo[] = {

{"DBSKIP", (FPFI) Example, 1, "I"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_DBRecCount( )
_DBRecNo( )


_DBStatus( ) API Library Routine

See Also	Example

Returns status flags for the specified work area.

Syntax

int _DBStatus(int workarea)
int workarea;	/* Work area. */

Remarks

If no table is open in the specified work area, _DBStatus( ) returns a negative integer whose absolute value is a Visual FoxPro error number. The following table shows returned status flags:

Flag	Setting
DB_BOF	Set under the same conditions as the Visual FoxPro function BOF( ).
DB_EOF	Set under the same conditions as the Visual FoxPro function EOF( ).
DB_RLOCKED	Set when the current record is locked, the table is locked, or the table is open exclusively.
DB_FLOCKED	Set when the table is locked or the table is open exclusively.
DB_EXCLUSIVE	Set when the table is open exclusively.
DB_READONLY	Set when the table is open without write access.
For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_DBStatus( ) API Library Routine Example

The following example displays the status of the table open in the current work area. It checks each bit in the value returned by _DBStatus( ) and displays an appropriate message to the screen.

Visual FoxPro Code

SET LIBRARY TO DBSTATUS

= DBSTATUS()  && displays status of DBF in current work area

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

int dbstatus = _DBStatus(-1);

_PutStr("\nStatus of DBF in current work area:");

if (dbstatus & DB_BOF)

_PutStr("\nBOF()");

if (dbstatus & DB_EOF)

_PutStr("\nEOF()");

if (dbstatus & DB_RLOCKED)

_PutStr("\nCurrent record is RLOCKed");

if (dbstatus & DB_FLOCKED)

_PutStr("\nDatabase is FLOCKed");

if (dbstatus & DB_EXCLUSIVE)

_PutStr("\nDatabase is open EXCLUSIVEly");

if (dbstatus & DB_READONLY)

_PutStr("\nDatabase is READONLY");

}

FoxInfo myFoxInfo[] = {

{"DBSTATUS", (FPFI) Example, 0, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_DBLock( )
_DBUnlock( )


_DBUnlock( ) API Library Routine

See Also	Example

Releases all user-obtained locks on records or the file in the work area specified by workarea.

Syntax

void _DBUnlock(int workarea)
int workarea;	/* Work area. */


_DBUnlock( ) API Library Routine Example

The following example uses _DBUnlock( ) to unlock all records of the table open in the current work area. The Visual FoxPro code demonstrates _DBUnlock( ) and verifies that it’s working properly.

Visual FoxPro Code

SET LIBRARY TO DBUNLOCK

DO CreateTest

USE Test SHARED

GO 2

= XRLOCK()

LIST STAT  && shows that record #2 is locked

= XUNLOCK()

LIST STAT  && shows no records are locked

= XFLOCK()

LIST STAT  && shows that whole DBF is locked

= XUNLOCK()

LIST STAT  && shows no records are locked

PROCEDURE CreateTest

CREATE TABLE test (ABC C(20))

APPEND BLANK

REPLACE ABC WITH "Golly month of"

APPEND BLANK

REPLACE ABC WITH "A twelfth of"

APPEND BLANK

REPLACE ABC WITH "Hello, world"

APPEND BLANK

REPLACE ABC WITH "When in the"

GO TOP

RETURN

C Code

#include <pro_ext.h>

FAR xLockRecord(ParamBlk FAR *parm)

{

_DBLock(-1, DBL_RECORD);

}

FAR xLockFile(ParamBlk FAR *parm)

{

_DBLock(-1, DBL_FILE);

}

FAR xUnLockFile(ParamBlk FAR *parm)

{

_DBUnLock(-1);

}

FoxInfo myFoxInfo[] = {

{"XRLOCK",  (FPFI) xLockRecord, 0, ""},

{"XFLOCK",  (FPFI) xLockFile,   0, ""},

{"XUNLOCK", (FPFI) xUnLockFile, 0, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_DBAppend( )
_DBLock( )
_DBReplace( )
_DBStatus( )
_DBWrite( )


_DBUnwind( ) API Library Routine

See Also	Example

Works like the Visual FoxPro GO BOTTOM command in the specified work area, and then returns the current record number.

Syntax

long _DBUnwind(int workarea)
int workarea;	/* Work area. */


_DBUnwind( ) API Library Routine Example

The following example calls _DBUnwind( ) for the table open in the current work area.

Visual FoxPro Code

SET LIBRARY TO DBUNWIND

DO CreateTest

? DBUNWIND()	&& returns new record #

SKIP

? EOF() 	&& now EOF() returns .T.

PROCEDURE CreateTest

CREATE TABLE test (ABC C(20))

APPEND BLANK

REPLACE ABC WITH "This is record 1"

APPEND BLANK

REPLACE ABC WITH "This is record 2"

APPEND BLANK

REPLACE ABC WITH "This is record 3"

APPEND BLANK

REPLACE ABC WITH "This is record 4"

GO TOP

RETURN

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

_RetInt(_DBUnwind(-1), 10);

}

FoxInfo myFoxInfo[] = {

{"DBUNWIND", (FPFI) Example, 0, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_DBRewind( )


_DBWrite( ) API Library Routine

See Also	Example

Writes to disk the current record in the specified work area and updates all affected indexes.

Syntax

int _DBWrite(int workarea)
int workarea;	/* Work area. */

Remarks

Any time the record pointer is moved to another record, this updating occurs automatically. If no field data has been replaced, _DBWrite( ) has no effect. _DBWrite( ) returns 0 if the routine is successful. If the routine fails, _DBWrite( ) returns a negative integer whose absolute value is a Visual FoxPro error number.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_DBWrite( ) API Library Routine Example

The following example carries out a _DBReplace( ) using the two calling parameters, one a table field passed by reference, the other a value of the appropriate type. It executes a LIST NEXT 1 Visual FoxPro command before and after a call to _DBWrite( ).

Visual FoxPro Code

SET LIBRARY TO DBWRITE

DO CreateTest

GO 3

=DBWRITE( @ABC, "Replacement Record 1")

PROCEDURE CreateTest

CREATE TABLE test (ABC C(20))

APPEND BLANK

REPLACE ABC WITH "This is record 1"

APPEND BLANK

REPLACE ABC WITH "This is record 2"

APPEND BLANK

REPLACE ABC WITH "This is record 3"

APPEND BLANK

REPLACE ABC WITH "This is record 4"

GO TOP

RETURN

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

int RetValue;

if (RetValue = _DBReplace(&parm->p[0].loc, &parm->p[1].val)) {

_UserError("\n_DBReplace() failed");

}

if (RetValue = _DBWrite(-1)) {

_Error(-RetValue);

}

_Execute("LIST NEXT 1");

}

FoxInfo myFoxInfo[] = {

{"DBWRITE", (FPFI) Example, 2, "R,?"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_DBLock( )
_DBReplace( )
_DBUnlock( )


_DeActivateHandler( ) API Library Routine

See Also	Example

_DeActivateHandler( ) removes the specified event handler from the event processor list.

Syntax

void _DeActivateHandler(unsigned int EventIdentifier)
unsigned int EventIdentifier;	/* ID of event handler to be removed from list. */

Remarks

You must remove each event handler, indicated by EventIdentifier, from the handler list when its library is unloaded.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_DeActivateHandler( ) API Library Routine Example

The following example activates an event handler when the library is loaded. The event handler prints a message for every event and lets Visual FoxPro process the message. The event handler is deactivated when the library is unloaded. As in the following example, _DeActivateHandler( ) is usually called from a CALLONUNLOAD function.

Visual FoxPro Code

SET LIBRARY TO DEACTHAN

C Code

#include <pro_ext.h>

static int HandlerID;

//	This is the routine that is registered as an event handler.

FAR EventHandler(WHandle theWindow, EventRec FAR *ev)

{

_PutStr("\nEventHandler() called.");

return NO;	// event still needs to be handled by Visual FoxPro

}

FAR Activate()

{

HandlerID = _ActivateHandler(EventHandler);

}

//	When the library is unloaded we must deactivate the event handler

//	in a CALLONUNLOAD function.

FAR DeActivate()

{

_DeActivateHandler(HandlerID);

}

FoxInfo myFoxInfo[] = {

{"ACTIVATE",  (FPFI) Activate, CALLONLOAD, ""},

{"DEACTIVATE", (FPFI)  DeActivate, CALLONUNLOAD, ""}

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_ActivateHandler( )
_FindWindow( )
_GlobalToLocal( )
_MousePos( )


_DeActivateIdle( ) API Library Routine

See Also	Example

Removes the specified routine from the idle loop.

Syntax

void _DeActivateIdle(unsigned int IdleIdentifier)
unsigned int IdleIdentifier;	/* Routine to be removed from idle list. */

Remarks

You must remove each idle routine from the idle routine list when its library is unloaded.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_DeActivateIdle( ) API Library Routine Example

The following example activates an idle event handler when the library is loaded. The idle event handler simply prints a message and is deactivated when the library is unloaded. As in the following example, _DeActivateIdle( ) is usually called from a CALLONUNLOAD function.

Visual FoxPro Code

SET LIBRARY TO DEACTIDL

C Code

#include <pro_ext.h>

static unsigned IdlerID;

//	This is the routine that is registered as an idle event handler.

void FAR IdleHandler(WHandle wh, EventRec *ev)

{

_PutStr("\nIdleHandler() called.");

}

void FAR Activate(ParamBlk FAR *parm)

{

IdlerID = _ActivateIdle((FPFI) IdleHandler);

}

//	When the library is unloaded we must deactivate the idle event

//	handler in a CALLONUNLOAD function.

void FAR DeActivate(ParamBlk FAR *parm)

{

_DeActivateIdle(IdlerID);

}

FoxInfo myFoxInfo[] = {

{"ACTIVATE",    (FPFI) Activate,   CALLONLOAD,     ""},

{"DEACTIVATE",  (FPFI) DeActivate, CALLONUNLOAD,   ""}

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_ActivateIdle( )
_FindWindow( )
_GlobalToLocal( )
_MousePos( )


_DeActivateMenu( ) API Library Routine

See Also	Example

Removes a menu from the screen.

Syntax

void _DeActivateMenu(MENUID menuid)
MENUID menuid;	/* Menu identifier. */

Remarks

The menu isn’t released from memory and can be reactivated with _ActivateMenu( ).

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_DeActivateMenu( ) API Library Routine Example

The following example activates and deactivates a menu several times.

Visual FoxPro Code

SET LIBRARY TO DEACTMEN

C Code

#include <pro_ext.h>

FAR DeActMenuEx(ParamBlk FAR *parm)

{

MENUID menuId;

ITEMID itemId;

Point loc;

menuId = _GetNewMenuId();

_NewMenu(MPOPUP, menuId);

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<1st item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<2nd item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<3rd item");

loc.v = 10; loc.h = 20;

_SetMenuPoint(menuId, loc);

_ActivateMenu(menuId);

_Execute("WAIT WINDOW 'Menu activated'");

_DeActivateMenu(menuId);

_Execute("WAIT WINDOW 'Menu deactivated'");

_ActivateMenu(menuId);

_Execute("WAIT WINDOW 'Menu activated'");

_DeActivateMenu(menuId);

_Execute("WAIT WINDOW 'Menu deactivated'");

_DisposeMenu(menuId);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) DeActMenuEx, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_ActivateMenu( )


_DefaultProcess( ) API Library Routine

See Also	Example

Provides the default event processing for an event returned by _GetNextEvent( ) when the event does not need special handling.

Syntax

void _DefaultProcess(EventRec FAR *event)
EventRec FAR *event;	/* Event to be processed. */

Remarks

This makes it easier for an external routine to use windows and still have them act consistently with the rest of the product.

Note   Don’t call _DefaultProcess( ) from an event handler.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_DefaultProcess( ) API Library Routine Example

The following example is a loop consisting of a call to _GetNextEvent( ) followed by a call to _DefaultProcess( ). All events during this procedure receive their default processing.

Visual FoxPro Code

SET LIBRARY TO DEFAPROC

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

EventRec ev;

int i;

for (i = 0; i < 16; i++)

{

_GetNextEvent(&ev);

_DefaultProcess(&ev);

}

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", Example, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_FindWindow( )
_GetNextEvent( )
_GlobalToLocal( )


_Dialog( ) API Library Routine

Example

Displays on the screen a dialog box that is the specified color scheme and contains the specified body text and button text.

Syntax

int _Dialog(int scheme, char FAR *body_text, char FAR *button1,
char FAR *button2, char FAR *button3, int default, int escape)
int scheme;	/* Color scheme number. */
char FAR *body_text;	/* Text in dialog. */
char FAR *button1;	/* Button prompt. */
char FAR *button2;	/* Button prompt. */
char FAR *button3;	/* Button prompt. */
int default;	/* Number of the default button. */
int escape;	/* Number of the button to press if Esc. */

Remarks

_Dialog( ) returns the number of the button the user chooses.

To specify fewer than three buttons for the displayed dialog box, specify 0 as a button prompt to leave any of the three buttons blank. The default parameter specifies which button to highlight in the dialog box as the default button, and the escape parameter specifies which button to process as chosen if the user presses Esc.

If you specify no buttons, Visual FoxPro displays the dialog box and waits for the user to press a key or click the left mouse button. If the user presses Esc, _Dialog( ) returns the escape value; otherwise, it returns the default value.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_Dialog( ) API Library Routine Example

The following example creates four dialog boxes with three, two, one, and no buttons.

Visual FoxPro Code

SET LIBRARY TO DIALOG

C Code

#include <pro_ext.h>

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 10;

_PutValue(&val);

}

void FAR dialogEx(ParamBlk FAR *parm)

{

int selection;

selection = _Dialog(DIALOG_SCHEME, "Example dialog with 3 buttons.",

"First", "Second", "Third", 2, 3);

_PutStr("\nItem selected ="); putLong(selection);

selection = _Dialog(DIALOG_SCHEME, "Example dialog with 2 buttons.",

"First", "Second", 0, 2, 2);

_PutStr("\nItem selected ="); putLong(selection);

selection = _Dialog(DIALOG_SCHEME, "Example dialog with 1 button.",

"First", (char *)0, (char *)0, 1, 1);

_PutStr("\nItem selected ="); putLong(selection);

selection = _Dialog(DIALOG_SCHEME, "Example dialog no buttons.",

(char *)0, (char *)0, (char *)0, 1, 2);

_PutStr("\nItem selected ="); putLong(selection);

}

FoxInfo myFoxInfo[] = {

{"DIALOGEX", (FPFI) dialogEx, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


_DisposeItem( ) API Library Routine

See Also	Example

Releases from memory the specified menu item, and frees all memory storage associated with this item.

Syntax

void _DisposeItem(MENUID menuid, ITEMID itemid)
MENUID menuid;	/* Menu identifier. */
ITEMID itemid;	/* Menu item identifier. */

Remarks

_DisposeItem( ) doesn’t release any submenus that are associated with the item.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_DisposeItem( ) API Library Routine Example

The following example creates a menu with three items and then uses _DisposeItem( ) to remove two of the items.

Visual FoxPro Code

SET LIBRARY TO DISPITEM

C Code

#include <pro_ext.h>

FAR DisposeItemEx(ParamBlk FAR *parm)

{

MENUID menuId;

ITEMID itemId;

Point loc;

menuId = _GetNewMenuId();

_NewMenu(MPOPUP, menuId);

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<1st item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<2nd item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<3rd item");

loc.v = 10; loc.h = 20;

_SetMenuPoint(menuId, loc);

_ActivateMenu(menuId);

_Execute("WAIT WINDOW 'Menu has three items'");

_DisposeItem(menuId, _GetItemId(menuId, 1));

_Execute("WAIT WINDOW 'Menu has two items'");

_DisposeItem(menuId, _GetItemId(menuId, 0));

_Execute("WAIT WINDOW 'Menu has one item'");

_DisposeMenu(menuId);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) DisposeItemEx, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_NewItem( )
_GetItemId( )


_DisposeMenu( ) API Library Routine

See Also	Example

Releases the specified menu and all its items and frees all memory associated with this menu.

Syntax

void _DisposeMenu(MENUID menuid)
MENUID menuid;	/* Menu identifier. */

Remarks

_DisposeMenu( ) doesn’t release any submenus that are associated with the menu.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_DisposeMenu( ) API Library Routine Example

The following example calls _DisposeMenu( ) after the user chooses a menu item.

Visual FoxPro Code

SET LIBRARY TO DISPMENU

C Code

#include <pro_ext.h>

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 10;

_PutValue(&val);

}

FAR onSelection(long menuId, long itemId)

{

_PutStr("\nitemId = "); putLong(itemId);

_DisposeMenu(menuId);

}

FAR activateMenu(ParamBlk FAR *parm)

{

MENUID menuId;

ITEMID itemId;

Point loc;

menuId = _GetNewMenuId();

_NewMenu(MPOPUP, menuId);

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<1st item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<2nd item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<3rd item");

loc.v = 10; loc.h = 20;

_SetMenuPoint(menuId, loc);

_ActivateMenu(menuId);

_OnSelection(menuId, -1, onSelection);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) activateMenu, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_GetNewMenuId( )
_MenuId( )
_NewMenu( )


_EdActive( ) API Library Routine

See Also	Example

Allows you to hide (deactivate) or show (activate) the selection range or the insertion point position in the specified window.

Syntax

void _EdActive(WHANDLE wh, int Show)
WHANDLE wh;	/* Handle of editing window.*/
int Show;	/* Boolean hide or show selection. */

Remarks

Specifying the Show parameter as TRUE shows the selection range or insertion point position, and specifying Show as FALSE hides the selection range or insertion point position.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_EdActive( ) API Library Routine Example

The following example opens an edit window for a file whose name is passed as a parameter and selects the first character in the file. Using _EdActive( ), the example activates and then deactivates the selection.

Visual FoxPro Code

SET LIBRARY TO EDACTIVE

fc = FCREATE("x", 0)

FOR i = 1 TO 90

= FPUTS(fc, REPL(ALLT(STR(i)), i), i)

ENDFOR

= FCLOSE(fc)

= EDACTIVE("x")	&& Call our API routine

C Code

#include <pro_ext.h>

FAR EdActiveEx(ParamBlk FAR *parm)

{

#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

WHANDLE wh;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

_HLock(parm->p[0].val.ev_handle);

pFILENAME[parm->p[0].val.ev_length] = '\0';

wh = _EdOpenFile(pFILENAME, FO_READONLY);

_HUnLock(parm->p[0].val.ev_handle);

_EdSelect(wh, 0, 1);

_EdActive(wh, TRUE);

_Execute("WAIT WINDOW 'Selection active'");

_EdActive(wh, FALSE);

_Execute("WAIT WINDOW 'Selection inactive'");

}

FoxInfo myFoxInfo[] = {

{"EDACTIVE", (FPFI) EdActiveEx, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_EdSelect( )


_EdCloseFile( ) API Library Routine

See Also	Example

Closes both the specified editing window and the file displaying in the window.

Syntax

int _EdCloseFile(WHANDLE wh, int option)
WHANDLE wh;	/* Handle of editing window. */
int option;	/* Closing options. */

Remarks

The option parameter can be one of the following:

Option parameter values

int	result
0	Immediately save.
1	Save after dialog box confirmation.
2	Open Save As dialog box.
_EdCloseFile( ) returns one of the following:

_EdCloseFile( ) return values

int	meaning
1	Cancel without saving file.
0	Save and close file.
– 1	Discard changes and close file.
For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_EdCloseFile( ) API Library Routine Example

The following example opens for editing a single file specified by a parameter, deletes a character, and closes the edit session three times. The first time, the routine calls _EdCloseFile( ) with the “Immediately save” option, the second time with the “Save after dialog box” option, and the third time with the “Open Save As dialog box” option. Each time, the routine shows the return value of _EdCloseFile( ).

Visual FoxPro Code

SET LIBRARY TO EDCLOSE

= EDCLOSE("x")

C Code

#include <pro_ext.h>

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 5;

_PutValue(&val);

}

FAR Example(ParamBlk FAR *parm)

{

#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

WHANDLE wh;

int retValue;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

_HLock(parm->p[0].val.ev_handle);

pFILENAME[parm->p[0].val.ev_length] = '\0';

// Open, delete a character, close "save without asking"

wh = _EdOpenFile(pFILENAME, FO_READWRITE);

_HUnLock(parm->p[0].val.ev_handle);

_EdSelect(wh, 0, 1);

_EdDelete(wh);

retValue = _EdCloseFile(wh, 0); // save without asking

_PutStr("\n_EdCloseFile() ="); putLong(retValue);

// Open, delete a character, close "save with asking"

_HLock(parm->p[0].val.ev_handle);

wh = _EdOpenFile(pFILENAME, FO_READWRITE);

_HUnLock(parm->p[0].val.ev_handle);

_EdSelect(wh, 0, 1);

_EdDelete(wh);

retValue = _EdCloseFile(wh, 1); // save with asking

_PutStr("\n_EdCloseFile() ="); putLong(retValue);

// Open, delete a character, close "save as"

_HLock(parm->p[0].val.ev_handle);

wh = _EdOpenFile(pFILENAME, FO_READWRITE);

_HUnLock(parm->p[0].val.ev_handle);

_EdSelect(wh, 0, 1);

_EdDelete(wh);

retValue = _EdCloseFile(wh, 2); // save as

_PutStr("\n_EdCloseFile() ="); putLong(retValue);

}

FoxInfo myFoxInfo[] = {

{"EDCLOSE", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_EdOpenFile( )
_EdRevert( )
_EdSave( )


_EdCopy( ) API Library Routine

See Also	Example

Copies the selected portion of the file in the specified editing window to the clipboard.

Syntax

void _EdCopy(WHANDLE wh)
WHANDLE wh;	/* Handle of editing window. */


_EdCopy( ) API Library Routine Example

The following example opens for editing a file specified by a parameter, copies the first character to the clipboard using _EdCopy( ), and pastes the character after the second character using _EdPaste( ).

Visual FoxPro Code

SET LIBRARY TO EDCOPY

= EDCOPY("x")

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

WHANDLE wh;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

pFILENAME[parm->p[0].val.ev_length] = '\0';

_HLock(parm->p[0].val.ev_handle);

wh = _EdOpenFile(pFILENAME, FO_READWRITE);

_HUnLock(parm->p[0].val.ev_handle);

_EdSelect(wh, 0, 1);

_EdCopy(wh);

_EdSetPos(wh, 2);

_EdPaste(wh);

}

FoxInfo myFoxInfo[] = {

{"EDCOPY", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_EdGetPos( )
_EdPaste( )
_EdSelect( )
_EdSetPos( )


_EdCut( ) API Library Routine

See Also	Example

Copies the selected portion of the file in the specified editing window to the clipboard, and deletes it from the specified window.

Syntax

void _EdCut(WHANDLE wh)
WHANDLE wh;	/* Handle of editing window. */


_EdCut( ) API Library Routine Example

The following example opens for editing a file specified by a parameter, cuts the first character to the clipboard using _EdCut( ), and pastes the character after the second character using _EdPaste( ).

Visual FoxPro Code

SET LIBRARY TO EDCUT

= EDCUT("x")

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

WHANDLE wh;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

pFILENAME[parm->p[0].val.ev_length] = '\0';

_HLock(parm->p[0].val.ev_handle);

wh = _EdOpenFile(pFILENAME, FO_READWRITE);

_HUnLock(parm->p[0].val.ev_handle);

_EdSelect(wh, 0, 1);

_EdCut(wh);

_EdSetPos(wh, 2);

_EdPaste(wh);

}

FoxInfo myFoxInfo[] = {

{"EDCUT", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_EdGetPos( )
_EdPaste( )
_EdSelect( )
_EdSetPos( )


_EdDelete( ) API Library Routine

See Also	Example

Deletes the selected portion of the file in the specified editing window.

Syntax

void _EdDelete(WHANDLE wh)
WHANDLE wh;	/* Handle of editing window. */

Remarks

If nothing is selected, _EdDelete( ) deletes the character at the current insertion point position.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_EdDelete( ) API Library Routine Example

The following example opens for editing a file specified by a parameter and deletes the first character in the file using _EdDelete( ).

Visual FoxPro Code

SET LIBRARY TO EDDELETE

= EDDELETE("x")

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

WHANDLE wh;

int retValue;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

pFILENAME[parm->p[0].val.ev_length] = '\0';

_HLock(parm->p[0].val.ev_handle);

wh = _EdOpenFile(pFILENAME, FO_READWRITE);

_HUnLock(parm->p[0].val.ev_handle);

_EdSelect(wh, 0, 1);

_EdDelete(wh);

}

FoxInfo myFoxInfo[] = {

{"EDDELETE", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_EdGetPos( )
_EdSelect( )
_EdSetPos( )


_EdGetChar( ) API Library Routine

See Also	Example

_EdGetChar( ) returns the character at the specified offset position in the file in the specified editing window.

Syntax

TEXT _EdGetChar(WHANDLE wh, EDPOS thePos)
WHANDLE wh;	/* Handle of editing window. */
EDPOS thePos;	/* Offset position in file of character to be returned. */


_EdGetChar( ) API Library Routine Example

The following example opens for editing a file specified by a parameter and displays on the screen the entire contents of the file.

Visual FoxPro Code

SET LIBRARY TO EDGETCHA

= EDGETCHAR("x")

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

WHANDLE wh;

EDENV EdEnv;

EDPOS edpos;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

_HLock(parm->p[0].val.ev_handle);

pFILENAME[parm->p[0].val.ev_length] = '\0';

wh = _EdOpenFile(pFILENAME, FO_READONLY);

_HUnLock(parm->p[0].val.ev_handle);

_EdGetEnv(wh, &EdEnv);

for (edpos = 0; edpos <= EdEnv.length; edpos++)

{

_PutChr(_EdGetChar(wh, edpos));

}

}

FoxInfo myFoxInfo[] = {

{"EDGETCHAR", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_EdGetPos( )
_EdSetPos( )


_EdGetEnv( ) API Library Routine

See Also	Example

_EdGetEnv( ) provides the editor environment information in *EDENV.

Syntax

void _EdGetEnv(WHANDLE wh, *EDENV theEdEnv)
WHANDLE wh;	/* Handle of editing window. */
*EDENV theEdEnv;	/* Environment settings. */

Remarks

The structure of *EDENV is listed below.

Note   In the comments below, an (R) indicates that this member is read-only and can’t be set using _EdSetEnv( ). A (B) indicates that this member takes on one of two Boolean values: 1 (True) or 0 (False).

typedef struct
{
char	filename[MAXFILENAME];	// (R)
EDPOS	length;	// # of bytes in text. (R)
unsigned short	lenLimit;	// Max allowable length. 0 = infinite.

unsigned short	dirty,	// Has the file been changed? (R, B)
autoIndent,	// Auto indent? (B)
backup,	// Make backup files? (B)
addLineFeeds,	// Add line feeds when saving? (B)
autoCompile,	// Shall we auto compile this thing? (B)
addCtrlZ,	// Add end of file ctrl-z? (B)
savePrefs,	// Save edit preferences? (B)
dragAndDrop,	// Allow drag-and-drop. (B)
readOnly,	// 0 = not r/o, 1 = file is r/o,
// 2 = file is r/w, opened r/o,
// 3 = file is r/o, opened r/o. (R)
status,	// Display status bar? (B)
lockPrefs,	// Can update the preferences ? (B)
insertMode;	// (B)

short	wrap;	// If < 0, new line at Return only.
EDPOS	selStart;	// Selection start. (R)
EDPOS	selEnd;	// Selection end. (R)
EDPOS	selAnchor;	// Selection anchor point. (R)
short	justMode;	// Justification (0 = left, 1 = right, 2 = center).
short	tabWidth;	// TAB size in spaces.

char	fontName[MAXFONTNAME];
short	fontSize;
short	fontStyle;	// 0 = plain, 1 = bold, 2 = italic, 3 = bold italic.
short	kind;	// Kind of editor session (R);
//   EDCOMMAND, EDPROGRAM, etc.
} EDENV;

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_EdGetEnv( ) API Library Routine Example

The following example opens an editing session for a file specified by a parameter and displays each field of the EDENV structure for that file as returned by _EdGetEnv( ).

Visual FoxPro Code

SET LIBRARY TO EDGETENV

= EDGETENV("x")

C Code

#include <pro_ext.h>

void putLong(unsigned long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 6;

_PutValue(&val);

}

FAR Example(ParamBlk FAR *parm)

{

#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

WHANDLE wh;

EDENV EdEnv;

EDPOS edpos;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

pFILENAME[parm->p[0].val.ev_length] = '\0';

_HLock(parm->p[0].val.ev_handle);

wh = _EdOpenFile(pFILENAME, FO_READONLY);

_HUnLock(parm->p[0].val.ev_handle);

_EdGetEnv(wh, &EdEnv);

_PutStr("\nfilename: ");        _PutStr(EdEnv.filename);

_PutStr("\nlength: ");          putLong(EdEnv.length);

_PutStr("\nlenLimit: ");        putLong(EdEnv.lenLimit);

_PutStr("\ndirty: ");           putLong(EdEnv.dirty);

_PutStr("\nautoIndent: ");      putLong(EdEnv.autoIndent);

_PutStr("\nbackup: ");          putLong(EdEnv.backup);

_PutStr("\naddLineFeeds: ");    putLong(EdEnv.addLineFeeds);

_PutStr("\nautoCompile: ");     putLong(EdEnv.autoCompile);

_PutStr("\naddCtrlZ: ");        putLong(EdEnv.addCtrlZ);

_PutStr("\nsavePrefs: ");       putLong(EdEnv.savePrefs);

_PutStr("\ndragAndDrop: ");     putLong(EdEnv.dragAndDrop);

_PutStr("\nreadOnly: ");        putLong(EdEnv.readOnly);

_PutStr("\nstatus: ");          putLong(EdEnv.status);

_PutStr("\nlockPrefs: ");       putLong(EdEnv.lockPrefs);

_PutStr("\ninsertMode: ");      putLong(EdEnv.insertMode);

_PutStr("\nwrap: ");            putLong(EdEnv.wrap);

_PutStr("\nselStart: ");        putLong(EdEnv.selStart);

_PutStr("\nselEnd: ");          putLong(EdEnv.selEnd);

_PutStr("\nselAnchor: ");       putLong(EdEnv.selAnchor);

_PutStr("\njustMode: ");        putLong(EdEnv.justMode);

_PutStr("\ntabWidth: ");        putLong(EdEnv.tabWidth);

_PutStr("\nfontName: ");        _PutStr(EdEnv.fontName);

_PutStr("\nfontSize: ");        putLong(EdEnv.fontSize);

_PutStr("\nfontStyle: ");       putLong(EdEnv.fontStyle);

_PutStr("\nkind: ");            putLong(EdEnv.kind);

}

FoxInfo myFoxInfo[] = {

{"EDGETENV", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_EdLastError( )
_EdSetEnv( )


_EdGetLineNum( ) API Library Routine

See Also	Example

Returns the line number of the passed offset position thePos in the file in the specified editing window.

Syntax

EDLINE _EdGetLineNum(WHANDLE wh, EDPOS thePos)
WHANDLE wh;	/* Handle of editing window. */
EDPOS thePos;	/* Offset position in the file. */


_EdGetLineNum( ) API Library Routine Example

The following example opens an editing session for a file specified by a parameter and gets the EDPOS for line 12 by calling _EdGetLinePos( ). It then calls _EdGetLineNum( ) on this EDPOS, and this returns 12. Next, it increments the EDPOS and each time calls _EdGetLineNum( ) until the returned EDLINE changes. At this point, it calls _EdGetLinePos( ) for line 13.

Visual FoxPro Code

SET LIBRARY TO EDGETLIN

= EDGETLPOS("x")

C Code

#include <pro_ext.h>

void putLong(unsigned long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 6;

_PutValue(&val);

}

FAR Example(ParamBlk FAR *parm)

{

#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

WHANDLE wh;

EDENV EdEnv;

EDPOS edpos;

EDLINE edlin, original;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

pFILENAME[parm->p[0].val.ev_length] = '\0';

_HLock(parm->p[0].val.ev_handle);

wh = _EdOpenFile(pFILENAME, FO_READONLY);

_HUnLock(parm->p[0].val.ev_handle);

edpos = _EdGetLinePos(wh, 12);

_PutStr("\n_EdGetLinePos(wh, 12) =");

putLong(edpos);

original = edlin = _EdGetLineNum(wh, edpos);

for (;;)

{

_PutStr("\n_EdGetLineNum(wh,");

putLong(edpos);

_PutStr(") = ");

putLong(edlin);

if (edlin != original)

{

break;

}

edpos++;

edlin = _EdGetLineNum(wh, edpos);

}

edpos = _EdGetLinePos(wh, 13);

_PutStr("\n_EdGetLinePos(wh, 13) ="); putLong(edpos);

}

FoxInfo myFoxInfo[] = {

{"EDGETLPOS", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_EdGetChar( )
_EdGetLinePos( )


_EdGetLinePos( ) API Library Routine

See Also	Example

Returns the offset position of the first character of the specified line in the file in the specified editing window.

Syntax

EDPOS _EdGetLinePos(WHANDLE wh, EDLINE theLine)
WHANDLE wh;	/* Handle of editing window. */
EDLINE theLine;	/* Line number. */


_EdGetLinePos( ) API Library Routine Example

The following example opens an editing session for a file specified by a parameter and gets the EDPOS for line 12 by calling _EdGetLinePos( ). It then calls _EdGetLineNum( ) on this EDPOS, and this returns 12. Next, it increments the EDPOS and each time calls _EdGetLineNum( ) until the EDLINE returned is changed. At this point, it calls _EdGetLinePos( ) for line 13.

Visual FoxPro Code

SET LIBRARY TO EDGETLPO

= EDGETLPOS("x")

C Code

#include <pro_ext.h>

void putLong(unsigned long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 6;

_PutValue(&val);

}

FAR Example(ParamBlk FAR *parm)

{

#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

WHANDLE wh;

EDENV EdEnv;

EDPOS edpos;

EDLINE edlin, original;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

pFILENAME[parm->p[0].val.ev_length] = '\0';

_HLock(parm->p[0].val.ev_handle);

wh = _EdOpenFile(pFILENAME, FO_READONLY);

_HUnLock(parm->p[0].val.ev_handle);

edpos = _EdGetLinePos(wh, 12);

_PutStr("\n_EdGetLinePos(wh, 12) =");

putLong(edpos);

original = edlin = _EdGetLineNum(wh, edpos);

for (;;)

{

_PutStr("\n_EdGetLineNum(wh,");

putLong(edpos);

_PutStr(") = ");

putLong(edlin);

if (edlin != original)

{

break;

}

edpos++;

edlin = _EdGetLineNum(wh, edpos);

}

edpos = _EdGetLinePos(wh, 13);

_PutStr("\n_EdGetLinePos(wh, 13) ="); putLong(edpos);

}

FoxInfo myFoxInfo[] = {

{"EDGETLPOS", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_EdGetLineNum( )


_EdGetPos( ) API Library Routine

See Also	Example

Returns the current offset position of the insertion point in the file in the specified editing window.

Syntax

EDPOS _EdGetPos(WHANDLE wh)
WHANDLE wh;	/* Handle of editing window. */

Remarks

If text is selected, _EdGetPos( ) returns the offset position of the anchor.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_EdGetPos( ) API Library Routine Example

The following example opens an edit session for a file specified by a parameter. After setting the current insertion point with _EdSetPos( ), a call to _EdGetPos( ) is made to verify that it returns the insertion point offset position. After selecting text with _EdSelect( ), a call to _EdGetPos( ) is made to verify that it returns the anchor point offset position.

Visual FoxPro Code

SET LIBRARY TO EDGETPOS

= EDGETPOS("x")

C Code

#include <pro_ext.h>

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 6;

_PutValue(&val);

}

FAR Example(ParamBlk FAR *parm)

{

#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

WHANDLE wh;

EDPOS edpos;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

pFILENAME[parm->p[0].val.ev_length] = '\0';

_HLock(parm->p[0].val.ev_handle);

wh = _EdOpenFile(pFILENAME, FO_READONLY);

_HUnLock(parm->p[0].val.ev_handle);

_EdSetPos(wh, 19);

_PutStr("\n_EdSetPos(wh, 19)");

edpos = _EdGetPos(wh);

_PutStr("\n_EdGetPos(wh) ="); putLong(edpos);

_EdSelect(wh, 5, 12);

_PutStr("\n_EdSelect(wh, 5, 12)");

edpos = _EdGetPos(wh);

_PutStr("\n_EdGetPos(wh) ="); putLong(edpos);

}

FoxInfo myFoxInfo[] = {

{"EDGETPOS", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_EdGetChar( )
_EdSetPos( )


_EdGetStr( ) API Library Routine

See Also	Example

Places the text between and including the specified offset positions into the specified address.

Syntax

void _EdGetStr(WHANDLE wh, EDPOS thePos, EDPOS thePos,
TEXT *theStr)
WHANDLE wh;	/* Handle of editing window. */
EDPOS thePos;	/* Starting offset position. */
EDPOS thePos;	/* Stopping offset position. */
TEXT *theStr;	/* Where to put the text. */


_EdGetStr( ) API Library Routine Example

The following example takes a file name as a parameter and returns the first 16 bytes of the file.

Visual FoxPro Code

SET LIBRARY TO EDGETSTR

? EDGETSTR("x") && returns the first 16 characters of file "x"

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

WHANDLE wh;

char FAR *buffer;

char FAR *pFileName;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

_HLock(parm->p[0].val.ev_handle);

pFileName = _HandToPtr(parm->p[0].val.ev_handle);

pFileName[parm->p[0].val.ev_length] = '\0';

wh = _EdOpenFile(pFileName, FO_READONLY);

_HUnLock(parm->p[0].val.ev_handle);

if ((buffer = _Alloca(17)) == 0) {

_Error(182); // "Insufficient memory"

}

_EdGetStr(wh, 0, 15, buffer);

buffer[16] = '\0';

_RetChar(buffer);

}

FoxInfo myFoxInfo[] = {

{"EDGETSTR", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_EdGetChar( )
_EdSetPos( )


_EdIndent( ) API Library Routine

See Also	Example

Indents the selected text in the file in the specified window the specified number of tab stops.

Syntax

void _EdIndent(WHANDLE wh, int tabstops)
WHANDLE wh;	/* Handle of editing window. */
int tabstops;	/* Number of tab stops. */

Remarks

You can specify a negative number for tabstops to cause a hanging indent for the selection.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_EdIndent( ) API Library Routine Example

The following example opens an editing session for a file specified by a parameter, and indents lines 13 and 15 in the file by a single tab stop.

Visual FoxPro Code

SET LIBRARY TO EDINDENT

= EDINDENT("x")

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

WHANDLE wh;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1)) {

_Error(182); // "Insufficient memory"

}

pFILENAME[parm->p[0].val.ev_length] = '\0';

_HLock(parm->p[0].val.ev_handle);

wh = _EdOpenFile(pFILENAME, FO_READWRITE);

_HUnLock(parm->p[0].val.ev_handle);

_EdSelect(wh, _EdGetLinePos(wh, 12), _EdGetLinePos(wh, 14));

_EdIndent(wh, 1);

}

FoxInfo myFoxInfo[] = {

{"EDINDENT", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_EdGetLineNum( )
_EdGetLinePos( )
_EdGetPos( )
_EdSetPos( )


_EdInsert( ) API Library Routine

See Also	Example

Inserts the specified number of bytes, starting with the specified TEXT * address, at the insertion point.

Syntax

void _EdInsert(WHANDLE wh, TEXT *theStr, unsigned long Bytes)
WHANDLE wh;	/* Handle of editing window. */
TEXT *theStr;	/* Address of beginning of insertion text. */
unsigned long Bytes;	/* Number of bytes to insert. */


_EdInsert( ) API Library Routine Example

The following example opens an editing session for a file specified by a parameter and inserts the line of text “Hello, world” as the new fourteenth line in the file.

Visual FoxPro Code

SET LIBRARY TO EDINSERT

= EDINSERT("x")

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

WHANDLE wh;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1)) {

_Error(182); // "Insufficient memory"

}

pFILENAME[parm->p[0].val.ev_length] = '\0';

_HLock(parm->p[0].val.ev_handle);

wh = _EdOpenFile(pFILENAME, FO_READWRITE);

_HUnLock(parm->p[0].val.ev_handle);

_EdSetPos(wh, _EdGetLinePos(wh, 13));

_EdInsert(wh, "Hello, world\n", _StrLen("Hello, world\n"));

}

FoxInfo myFoxInfo[] = {

{"EDINSERT", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_EdGetPos( )
_EdSetPos( )


_EdLastError( ) API Library Routine

See Also	Example

_EdLastError( ) returns the error number of the most recent editor error associated with the specified editing window.

Syntax

int _EdLastError(WHANDLE wh)
WHANDLE wh;	/* Handle of editing window. */


_EdLastError( ) API Library Routine Example

The following example displays the error code returned by _EdLastError( ) after a number of editor operations. Since editor errors are reserved for severe situations, such as low memory, The following example will usually display an error code of 0.

Visual FoxPro Code

SET LIBRARY TO EDLASTER

= EDLASTERR("x")  && displays _EdLastError() after operations on file "x"

C Code

#include <pro_ext.h>

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 10;

_PutValue(&val);

}

FAR Example(ParamBlk FAR *parm)

{

char FAR *pFileName;

WHANDLE wh;

EDENV EdEnv;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

_HLock(parm->p[0].val.ev_handle);

pFileName = (char FAR *) _HandToPtr(parm->p[0].val.ev_handle);

pFileName[parm->p[0].val.ev_length] = '\0';

wh = _EdOpenFile(pFileName, FO_READONLY);

_HUnLock(parm->p[0].val.ev_handle);

//	Position past end of file

_EdGetEnv(wh, &EdEnv);

_EdSetPos(wh, EdEnv.length + 128);

_PutStr("\n_EdLastError() ="); putLong(_EdLastError(wh));

//	_EdCopy() with no selection

_EdSetPos(wh, 1);

_EdCopy(wh);

_PutStr("\n_EdLastError() ="); putLong(_EdLastError(wh));

//	_EdScrollToSel() with no selection

_EdScrollToSel(wh, TRUE);

_PutStr("\n_EdLastError() ="); putLong(_EdLastError(wh));

}

FoxInfo myFoxInfo[] = {

{"EDLASTERR", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_EdGetEnv( )
_EdSetEnv( )


_EdOpenFile( ) API Library Routine

See Also	Example

Opens the specified file in a window, in order to begin an editing session.

Syntax

WHANDLE _EdOpenFile(TEXT *filename, int mode)
TEXT *filename;	/* File to open. */
int mode;	/* Mode option. */

Remarks

The following mode options are available: FO_READONLY, FO_WRITEONLY, and FO_READWRITE.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_EdOpenFile( ) API Library Routine Example

The following example opens an editor session for a file specified by a parameter.

Visual FoxPro Code

SET LIBRARY TO EDOPEN

= EDOPEN("x")  && opens editor session for file "x"

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

WHANDLE wh;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

pFILENAME[parm->p[0].val.ev_length] = '\0';

_HLock(parm->p[0].val.ev_handle);

wh = _EdOpenFile(pFILENAME, FO_READWRITE);

_HUnLock(parm->p[0].val.ev_handle);

}

FoxInfo myFoxInfo[] = {

{"EDOPEN", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_EdCloseFile( )
_EdRevert( )
_EdSave( )


_EdPaste( ) API Library Routine

See Also	Example

Copies the contents of the clipboard into the file in the specified editing window at the insertion point.

Syntax

void _EdPaste(WHANDLE wh)
WHANDLE wh;	/* Handle of editing window. */


_EdPaste( ) API Library Routine Example

The following example opens for editing a file specified by a parameter, copies the first character to the clipboard using _EdCopy( ), and pastes the character after the second character using _EdPaste( ).

Visual FoxPro Code

SET LIBRARY TO EDPASTE

= EDCOPY("x")

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

WHANDLE wh;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

pFILENAME[parm->p[0].val.ev_length] = '\0';

_HLock(parm->p[0].val.ev_handle);

wh = _EdOpenFile(pFILENAME, FO_READWRITE);

_HUnLock(parm->p[0].val.ev_handle);

_EdSelect(wh, 0, 1);

_EdCopy(wh);

_EdSetPos(wh, 2);

_EdPaste(wh);

}

FoxInfo myFoxInfo[] = {

{"EDCOPY", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_EdCopy( )
_EdCut( )
_EdGetPos( )
_EdSelect( )
_EdSetPos( )


_EdPosInView( ) API Library Routine

See Also	Example

Syntax

int _EdPosInView(WHANDLE wh, EDPOS thePos)
WHANDLE wh;	/* Handle of editing window. */
EDPOS thePos;	/* Offset position. */

Remarks

_EdPosInView( ) returns True (an integer other than 0) if the offset position in the file in the specified editing window is visible, or False (0) if not.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_EdPosInView( ) API Library Routine Example

The following example opens for editing a file specified by a parameter. After scrolling to the top of the file, the example calls _EdPosInView( ) to check whether the top of file and bottom of file are in view and the results are printed to the screen. Then the example scrolls to the bottom of the file, and again calls _EdPosInView( ) to check whether the top of file and bottom of file are in view.

Visual FoxPro Code

SET LIBRARY TO EDPOSINV

= POSINVIEW("x")

C Code

#include <pro_ext.h>

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 10;

_PutValue(&val);

}

FAR Example(ParamBlk FAR *parm)

{

#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

WHANDLE wh;

EDENV EdEnv;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

pFILENAME[parm->p[0].val.ev_length] = '\0';

_HLock(parm->p[0].val.ev_handle);

wh = _EdOpenFile(pFILENAME, FO_READONLY);

_HUnLock(parm->p[0].val.ev_handle);

_EdGetEnv(wh, &EdEnv);

_EdScrollToPos(wh, 0, FALSE);

_PutStr("\n_EdScrollToPos(wh, 0)");

_PutStr("\n_EdPosInView(wh, 0) =");

putLong(_EdPosInView(wh, 0));

_PutStr("\n_EdPosInView(wh, EdEnv.length) =");

putLong(_EdPosInView(wh, EdEnv.length));

_EdScrollToPos(wh, EdEnv.length, FALSE);

_PutStr("\n_EdScrollToPos(wh, EdEnv.length)");

_PutStr("\n_EdPosInView(wh, 0) =");

putLong(_EdPosInView(wh, 0));

_PutStr("\n_EdPosInView(wh, EdEnv.length) =");

putLong(_EdPosInView(wh, EdEnv.length));

}

FoxInfo myFoxInfo[] = {

{"POSINVIEW", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_EdGetPos( )


_EdRedo( ) API Library Routine

See Also	Example

Performs again the change made to the file in the specified editing window that was undone by the most recent _EdUndo( ).

Syntax

void _EdRedo(WHANDLE wh)
WHANDLE wh;	/* Handle of editing window. */


_EdRedo( ) API Library Routine Example

The following example opens for editing a file specified by a parameter. After inserting a new line, the new line is removed using _EdUndo( ), and then inserted again using _EdRedo( ).

Visual FoxPro Code

SET LIBRARY TO EDREDO

= EDREDO("x")

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

WHANDLE wh;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

pFILENAME[parm->p[0].val.ev_length] = '\0';

_HLock(parm->p[0].val.ev_handle);

wh = _EdOpenFile(pFILENAME, FO_READWRITE);

_HUnLock(parm->p[0].val.ev_handle);

_EdSetPos(wh, _EdGetLinePos(wh, 13));

_EdInsert(wh, "Hello, world\n", _StrLen("Hello, world\n"));

_Execute("WAIT WINDOW 'New line inserted.  Press any key to undo.'");

_EdUndo(wh);

_Execute("WAIT WINDOW 'Insertion undone.  Press any key to redo.'");

_EdRedo(wh);

}

FoxInfo myFoxInfo[] = {

{"EDREDO", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_EdUndo( )
_EdUndoOn( )


_EdRevert( ) API Library Routine

See Also	Example

Discards all changes made to the file displaying in the specified editing window since it was most recently saved with _EdSave( ).

Syntax

void _EdRevert(WHANDLE wh)
WHANDLE wh;	/* Handle of editing window. */


_EdRevert( ) API Library Routine Example

The following example opens for editing a file specified by a parameter. After some editing, insertion of a new line, indenting of two lines, and deletion of two lines, the changes are discarded using _EdRevert( ).

Visual FoxPro Code

SET LIBRARY TO EDREVERT

= EDREVERT("x")

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

WHANDLE wh;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

pFILENAME[parm->p[0].val.ev_length] = '\0';

_HLock(parm->p[0].val.ev_handle);

wh = _EdOpenFile(pFILENAME, FO_READWRITE);

_HUnLock(parm->p[0].val.ev_handle);

_EdSetPos(wh, _EdGetLinePos(wh, 13));

_EdInsert(wh, "Hello, world\r\n", _StrLen("Hello, world\n"));

_EdSelect(wh, _EdGetLinePos(wh, 14), _EdGetLinePos(wh, 16));

_EdIndent(wh, 1);

_EdSelect(wh, _EdGetLinePos(wh, 9), _EdGetLinePos(wh, 12));

_EdDelete(wh);

_EdRevert(wh);

}

FoxInfo myFoxInfo[] = {

{"EDREVERT", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_EdRedo( )
_EdUndo( )
_EdUndoOn( )


_EdSave( ) API Library Routine

See Also	Example

_EdSave( ) saves the file in the specified window without ending the editing session.

Syntax

void _EdSave(WHANDLE wh)
WHANDLE wh;	/* Handle of editing window. */


_EdSave( ) API Library Routine Example

The following example opens for editing a file specified by a parameter. The example inserts a new line, indents two lines, and deletes two lines. After the insertion of the new line, the example calls _EdSave( ). Then, after the indentation and deletion, the example calls _EdUndo( ) three times in an attempt to undo all of the editing, but the insertion made before the call to _EdSave( ) can’t be undone. The example performs two more editing operations, inserting two lines and deleting two lines, with a call to _EdSave( ) between them. Last, the example calls _EdRevert( ), but it too can only undo changes made since the last _EdSave( ).

Visual FoxPro Code

SET LIBRARY TO EDSAVE

= EDSAVE("x")

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

WHANDLE wh;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

pFILENAME[parm->p[0].val.ev_length] = '\0';

_HLock(parm->p[0].val.ev_handle);

wh = _EdOpenFile(pFILENAME, FO_READWRITE);

_HUnLock(parm->p[0].val.ev_handle);

_EdSetPos(wh, _EdGetLinePos(wh, 13));

_EdInsert(wh, "Hello, world\r\n", _StrLen("Hello, world\n"));

_EdSave(wh);

_EdSelect(wh, _EdGetLinePos(wh, 14), _EdGetLinePos(wh, 16));

_EdIndent(wh, 1);

_EdSelect(wh, _EdGetLinePos(wh, 9), _EdGetLinePos(wh, 12));

_EdDelete(wh);

_Execute("WAIT WINDOW 'Press any key to undo changes.'");

_EdUndo(wh);  // undo deletion

_EdUndo(wh);  // undo indent

_EdUndo(wh);  // attempt to undo insertion, but can't

_EdSelect(wh, _EdGetLinePos(wh, 14), _EdGetLinePos(wh, 16));

_EdIndent(wh, 1);

_EdSave(wh);

_EdSelect(wh, _EdGetLinePos(wh, 9), _EdGetLinePos(wh, 12));

_EdDelete(wh);

_EdRevert(wh);	// undoes deletion

}

FoxInfo myFoxInfo[] = {

{"EDSAVE", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_EdCloseFile( )
_EdOpenFile( )
_EdRevert( )


_EdScrollToPos( ) API Library Routine

See Also	Example

Ensures that the offset position you specify in the file in the designated editing window is visible.

Syntax

void _EdScrollToPos(WHANDLE wh, EDPOS thePos, int Center)
WHANDLE wh;	/* Handle of editing window. */
EDPOS thePos;	/* Offset position to make visible. */
int Center;	/* Whether or not to center position in window. */

Remarks

_EdScrollToPos( ) doesn’t move the insertion point. Specify Center as TRUE to center the position vertically in the window, or as FALSE to not center the position vertically.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_EdScrollToPos( ) API Library Routine Example

The following example opens for editing a file specified by a parameter. After scrolling to the top of the file by calling _EdScrollToPos( ), the procedure calls _EdPosInView( ) to check whether the top of file and bottom of file are in view, and prints the results on the screen. Then it scrolls to the bottom of the file by calling _EdScrollToPos( ), and again calls _EdPosInView( ) to check whether the top of file and bottom of file are in view.

Visual FoxPro Code

SET LIBRARY TO EDSCTOPO

= POSINVIEW("x")

C Code

#include <pro_ext.h>

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 10;

_PutValue(&val);

}

FAR Example(ParamBlk FAR *parm)

{

#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

WHANDLE wh;

EDENV EdEnv;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1)) {

_Error(182); // "Insufficient memory"

}

pFILENAME[parm->p[0].val.ev_length] = '\0';

_HLock(parm->p[0].val.ev_handle);

wh = _EdOpenFile(pFILENAME, FO_READONLY);

_HUnLock(parm->p[0].val.ev_handle);

_EdGetEnv(wh, &EdEnv);

_EdScrollToPos(wh, 0, FALSE);

_PutStr("\n_EdScrollToPos(wh, 0)");

_PutStr("\n_EdPosInView(wh, 0) =");

putLong(_EdPosInView(wh, 0));

_PutStr("\n_EdPosInView(wh, EdEnv.length) =");

putLong(_EdPosInView(wh, EdEnv.length));

_EdScrollToPos(wh, EdEnv.length, FALSE);

_PutStr("\n_EdScrollToPos(wh, EdEnv.length)");

_PutStr("\n_EdPosInView(wh, 0) =");

putLong(_EdPosInView(wh, 0));

_PutStr("\n_EdPosInView(wh, EdEnv.length) =");

putLong(_EdPosInView(wh, EdEnv.length));

}

FoxInfo myFoxInfo[] = {

{"POSINVIEW", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_EdPosInView( )


_EdScrollToSel( ) API Library Routine

See Also	Example

Ensures that the selected text in the designated window is visible.

Syntax

void _EdScrollToSel(WHANDLE wh, int Center)
WHANDLE wh;	/* Handle of editing window. */
int Center;	/* Whether to center anchor point in window. */

Remarks

Specify Center as TRUE to center the anchor point vertically in the window, or as FALSE to not center the anchor point.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_EdScrollToSel( ) API Library Routine Example

The following example opens for editing a file specified by a parameter. The example makes a selection near the bottom of the file. After the user presses a key in response to a Visual FoxPro WAIT command, the example scrolls the editing window to the selection by calling _EdScrollToSel( ). The example then repeats the operation for a selection made near the top of the file.

Visual FoxPro Code

SET LIBRARY TO EDSCTOSE

= TOSEL("x")

C Code

#include <pro_ext.h>

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 10;

_PutValue(&val);

}

FAR Example(ParamBlk FAR *parm)

{

#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

WHANDLE wh;

EDENV EdEnv;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

pFILENAME[parm->p[0].val.ev_length] = '\0';

_HLock(parm->p[0].val.ev_handle);

wh = _EdOpenFile(pFILENAME, FO_READONLY);

_HUnLock(parm->p[0].val.ev_handle);

_EdScrollToPos(wh, 0, TRUE);

_EdGetEnv(wh, &EdEnv);

_EdSelect(wh, EdEnv.length - 16, EdEnv.length);

_PutStr("\nMade selection at end of file.");

_Execute("WAIT WINDOW 'Press any key to scroll to selection.'");

_EdScrollToSel(wh, TRUE);

_EdSelect(wh, 1, 16);

_PutStr("\nMade selection at beginning of file.");

_Execute("WAIT WINDOW 'Press any key to scroll to selection.'");

_EdScrollToSel(wh, TRUE);

}

FoxInfo myFoxInfo[] = {

{"TOSEL", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_EdGetPos( )
_EdSelect( )
_EdSetPos( )


_EdSelect( ) API Library Routine

See Also	Example

Selects the range between the two specified offset positions, inclusive, of the file in the designated editing window.

Syntax

void _EdSelect(WHANDLE wh, EDPOS thePos, EDPOS thePos)
WHANDLE wh;	/* Handle of editing window. */
EDPOS thePos;	/* Beginning offset position of selection. */
EDPOS thePos;	/* Ending offset position of selection. */


_EdSelect( ) API Library Routine Example

The following example opens for editing a file specified by a parameter, selects the first character in the file using _EdSelect( ), copies the selection to the clipboard using _EdCopy( ), and pastes it after the second character using _EdPaste( ).

Visual FoxPro Code

SET LIBRARY TO EDSELECT

= EDCOPY("x")

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

WHANDLE wh;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

pFILENAME[parm->p[0].val.ev_length] = '\0';

_HLock(parm->p[0].val.ev_handle);

wh = _EdOpenFile(pFILENAME, FO_READWRITE);

_HUnLock(parm->p[0].val.ev_handle);

_EdSelect(wh, 0, 1);

_EdCopy(wh);

_EdSetPos(wh, 2);

_EdPaste(wh);

}

FoxInfo myFoxInfo[] = {

{"EDCOPY", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_EdCopy( )
_EdCut( )
_EdPaste( )


_EdSendKey( ) API Library Routine

See Also	Example

Simulates the key press associated with the ASCII character number specified by charNum.

Syntax

void _EdSendKey(WHANDLE wh, int charNum)
WHANDLE wh;	/* Handle of editing window. */
int charNum;	/* Number of character. */


_EdSendKey( ) API Library Routine Example

The following example opens for editing a file specified by a parameter. It inserts a line of text, “Hello, World”, by sending the individual characters with _EdSendKey( ). It then uses _EdSendKey( ) to send a carriage return and linefeed and to insert an ASCII escape character. Notice that the escape character isn’t interpreted as “discard editing session.”

Visual FoxPro Code

SET LIBRARY TO EDSENDKE

= SENDKEY("x")

C Code

#include <pro_ext.h>

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 10;

_PutValue(&val);

}

FAR Example(ParamBlk FAR *parm)

{

#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

WHANDLE wh;

EDENV EdEnv;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

pFILENAME[parm->p[0].val.ev_length] = '\0';

_HLock(parm->p[0].val.ev_handle);

wh = _EdOpenFile(pFILENAME, FO_READWRITE);

_HUnLock(parm->p[0].val.ev_handle);

// Insert a line of text using _EdSendKey()

_EdSetPos(wh, 0);

_EdSendKey(wh, 'H');

_EdSendKey(wh, 'e');

_EdSendKey(wh, 'l');

_EdSendKey(wh, 'l');

_EdSendKey(wh, 'o');

_EdSendKey(wh, ',');

_EdSendKey(wh, ' ');

_EdSendKey(wh, 'W');

_EdSendKey(wh, 'o');

_EdSendKey(wh, 'r');

_EdSendKey(wh, 'l');

_EdSendKey(wh, 'd');

_EdSendKey(wh, '.');

_EdSendKey(wh, 0x0d); // carriage return

_EdSendKey(wh, 0x0a); // line feed

_EdSendKey(wh, 0x1b); // esc char code is inserted in file

}

FoxInfo myFoxInfo[] = {

{"SENDKEY", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_EdInsert( )


_EdSetEnv( ) API Library Routine

See Also	Example

Determines various editor settings.

Syntax

void _EdSetEnv(WHANDLE wh, *EDENV theEdEnv)
WHANDLE wh;	/* Handle of editing window. */
*EDENV theEdEnv;	/* Editor settings. */

Remarks

For the structure of *EDENV, see _EdGetEnv( ).

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_EdSetEnv( ) API Library Routine Example

The following example opens for editing a file specified by a parameter. After indenting the first two lines of the file, it uses _EdSetEnv( ) to change the size of a tab stop to 6 characters and then to 9 characters.

Visual FoxPro Code

SET LIBRARY TO EDSETENV

= EDSETENV("x")

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

WHANDLE wh;

EDENV EdEnv;

EDPOS edpos;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

pFILENAME[parm->p[0].val.ev_length] = '\0';

_HLock(parm->p[0].val.ev_handle);

wh = _EdOpenFile(pFILENAME, FO_READWRITE);

_HUnLock(parm->p[0].val.ev_handle);

_EdGetEnv(wh, &EdEnv);

_EdSelect(wh, _EdGetLinePos(wh, 1), _EdGetLinePos(wh, 3));

_EdIndent(wh, 1);

_Execute("WAIT WINDOW 'Press any key\

to change tabs to 6 characters.'");

EdEnv.tabWidth = 6;

_EdSetEnv(wh, &EdEnv);

_Execute("WAIT WINDOW 'Press any key \

to change tabs to 9 characters.'");

EdEnv.tabWidth = 9;

_EdSetEnv(wh, &EdEnv);

}

FoxInfo myFoxInfo[] = {

{"EDSETENV", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_EdGetEnv( )
_EdLastError( )


_EdSetPos( ) API Library Routine

See Also	Example

Moves the insertion point to the specified offset position in the file in the specified editing window, unselecting any selected text.

Syntax

void _EdSetPos(WHANDLE wh, EDPOS thePos)
WHANDLE wh;	/* Handle of editing window. */
EDPOS thePos;	/* Specified offset position. */


_EdSetPos( ) API Library Routine Example

The following example opens for editing a file specified by a parameter. Using _EdSetPos( ), it sets the insertion point to position 19 of the file. It calls _EdGetPos( ) and inserts some text to verify that the insertion point has been set.

Visual FoxPro Code

SET LIBRARY TO EDSETPOS

= EDSETPOS('x')

C Code

#include <pro_ext.h>

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 6;

_PutValue(&val);

}

FAR Example(ParamBlk FAR *parm)

{

#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

WHANDLE wh;

EDPOS edpos;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

pFILENAME[parm->p[0].val.ev_length] = '\0';

_HLock(parm->p[0].val.ev_handle);

wh = _EdOpenFile(pFILENAME, FO_READWRITE);

_HUnLock(parm->p[0].val.ev_handle);

_EdSetPos(wh, 19);

_PutStr("\n_EdSetPos(wh, 19)");

edpos = _EdGetPos(wh);

_PutStr("\n_EdGetPos(wh) ="); putLong(edpos);

_EdInsert(wh, "*** Inserted at EDPOS = 19 ***",

_StrLen("*** Inserted at EDPOS = 19 ***"));

}

FoxInfo myFoxInfo[] = {

{"EDSETPOS", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_EdGetLineNum( )
_EdGetChar( )
_EdGetPos( )


_EdSkipLines( ) API Library Routine

See Also	Example

Moves the insertion point to the beginning of the line int lines from its current offset position thePos.

Syntax

EDPOS _EdSkipLines(WHANDLE wh, EDPOS thePos, int offset)
WHANDLE wh;	/* Handle of editing window. */
EDPOS thePos;	/* Current offset position. */
int offset;	/* Number of lines to skip. */

Remarks

You can specify a positive or negative number of lines.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_EdSkipLines( ) API Library Routine Example

The following example opens for editing a file specified by a parameter. It uses _EdSkipLines( ) to find the offset positions, then selects lines 3 and 4.

Visual FoxPro Code

SET LIBRARY TO EDSKIPLI

= SKIPLINE("x")

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

WHANDLE wh;

EDPOS edpos;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

pFILENAME[parm->p[0].val.ev_length] = '\0';

_HLock(parm->p[0].val.ev_handle);

wh = _EdOpenFile(pFILENAME, FO_READWRITE);

_HUnLock(parm->p[0].val.ev_handle);

// select next two lines

edpos = _EdSkipLines(wh, 0, 2); // skip to two lines from top

_EdSelect(wh, edpos, _EdSkipLines(wh, edpos, 2));

_Execute("WAIT WINDOW 'Using _EdSkipLines() \

to select lines 3 and 4'");

}

FoxInfo myFoxInfo[] = {

{"SKIPLINE", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_EdGetPos( )
_EdSetPos( )


_EdUndo( ) API Library Routine

See Also	Example

Undoes the single most recent change made to the file in the specified window.

Syntax

void _EdUndo(WHANDLE wh)
WHANDLE wh;	/* Handle of editing window. */

Remarks

When the user makes changes to a file, these changes are recorded in the undo buffer. _EdUndo( ) can be issued multiple times to undo multiple changes. You can’t undo a change made prior to issuing _EdSave( ).

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_EdUndo( ) API Library Routine Example

The following example opens a file specified by a parameter for editing. After inserting a new line, it uses _EdUndo( ) to delete the line, and then calls _EdRedo( ) to restore the inserted line.

Visual FoxPro Code

SET LIBRARY TO EDUNDO

= EDREDO("x")

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

WHANDLE wh;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

pFILENAME[parm->p[0].val.ev_length] = '\0';

_HLock(parm->p[0].val.ev_handle);

wh = _EdOpenFile(pFILENAME, FO_READWRITE);

_HUnLock(parm->p[0].val.ev_handle);

_EdSetPos(wh, _EdGetLinePos(wh, 13));

_EdInsert(wh, "Hello, world\n", _StrLen("Hello, world\n"));

_Execute("WAIT WINDOW 'New line inserted.\

Press any key to undo.'");

_EdUndo(wh);

_Execute("WAIT WINDOW 'Insertion undone.  Press any key to redo.'");

_EdRedo(wh);

}

FoxInfo myFoxInfo[] = {

{"EDREDO", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_EdRedo( )
_EdUndoOn( )


_EdUndoOn( ) API Library Routine

See Also	Example

Enables you to group a series of actions as a single action for use with _EdUndo( ) and _EdRedo( ).

Syntax

void _EdUndoOn(WHANDLE wh, int Grouped)
WHANDLE wh;	/* Window handle. */
int Grouped;	/* Toggle grouping off. */

Remarks

Actions that occur after you pass the Grouped parameter as FALSE with _EdUndoOn( ), or after you issue _EdUndo( ), are no longer grouped as a single action.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_EdUndoOn( ) API Library Routine Example

The following example shows how to use _EdUndoOn( ) to group edit operations that you can undo as a group using _EdUndo( ).

Visual FoxPro Code

SET LIBRARY TO EDUNDOON

= EDUNDOON("x")  && edit file "x"

C Code

#include <pro_ext.h>

#define TRUE	1

#define FALSE	0

FAR Example(ParamBlk FAR *parm)

{

char FAR *pFileName;

WHANDLE wh;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

_HLock(parm->p[0].val.ev_handle);

pFileName = (char FAR *) _HandToPtr(parm->p[0].val.ev_handle);

pFileName[parm->p[0].val.ev_length] = '\0';

wh = _EdOpenFile(pFileName, FO_READWRITE);

_HUnLock(parm->p[0].val.ev_handle);

_EdUndoOn(wh, TRUE); // start undo group

_EdSetPos(wh, _EdGetLinePos(wh, 13));

_EdInsert(wh, "Hello, world\n", _StrLen("Hello, world\n"));

_EdSelect(wh, _EdGetLinePos(wh, 14), _EdGetLinePos(wh, 16));

_EdIndent(wh, 1);

_EdUndoOn(wh, FALSE); // end undo group

_EdUndoOn(wh, TRUE); // start another undo group

_EdSelect(wh, _EdGetLinePos(wh, 9), _EdGetLinePos(wh, 12));

_EdDelete(wh);

_EdSetPos(wh, _EdGetLinePos(wh, 13));

_EdInsert(wh, "Hello, world\n", _StrLen("Hello, world\n"));

_Execute("WAIT WINDOW 'Press any key to undo changes.'");

_EdUndoOn(wh, TRUE); // undoes to start of undo group

}

FoxInfo myFoxInfo[] = {

{"EDUNDOON", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_EdRedo( )
_EdUndo( )


_Error( ) API Library Routine

See Also	Example

Signals the error specified by the value in code to the Visual FoxPro run time.

Syntax

void _Error(int code)
int code;	/* Internal Visual FoxPro error number. */

Remarks

The code parameter is a Visual FoxPro internal error number and can be passed as a positive or negative value. _Error( ) gives control to the Visual FoxPro error handler so that the error can be handled like any other Visual FoxPro error. Control of program flow doesn’t return to the routine that called _Error( ), even when the user chooses to ignore the error. Execution resumes at the next Visual FoxPro statement.

See the Visual FoxPro Error Numbers topic in Help for error numbers and their meanings.

Note   Do not use _Error( ) from an event handler.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_Error( ) API Library Routine Example

The following example calls _Error( ) when _DBSkip( ) returns an error number. The Visual FoxPro code shows how to cause _Error( ) to be called.

Visual FoxPro Code

SET LIBRARY TO ERROR

DO CreateTest

ON ERROR DO expectError

USE

= DBSKIP(1)  && _Error() called: no DBF in use

USE test

GO TOP

= DBSKIP(-1)

= DBSKIP(-1)	 && _Error() called: at top of file

GO BOTT

= DBSKIP(1)

= DBSKIP(1)  && _Error() called: at bottom of file

ON ERROR

PROCEDURE expectError

? "ERROR: " + MESSAGE()

RETURN

PROCEDURE CreateTest

CREATE TABLE test (ABC C(20))

APPEND BLANK

REPLACE ABC WITH "This is record 1"

APPEND BLANK

REPLACE ABC WITH "This is record 2"

APPEND BLANK

REPLACE ABC WITH "This is record 3"

APPEND BLANK

REPLACE ABC WITH "This is record 4"

GO TOP

RETURN

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *pblk)

{

int RetCode;

if ((RetCode = _DBSkip(-1, pblk->p[0].val.ev_long)) < 0) {

_PutStr("\nError encountered in example program.");

_Error(-RetCode);  // _DBSkip() returns negative error code

}

_RetInt(RetCode, 10);

}

FoxInfo myFoxInfo[] = {

{"DBSKIP", (FPFI) Example, 1, "I"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_ErrorInfo( )
_UserError( )


_ErrorInfo( ) API Library Routine

See Also	Example

Returns the external error number that corresponds to the Visual FoxPro internal error number specified by code.

Syntax

int _ErrorInfo(int code, char FAR *message)
int code;	/* Internal Visual FoxPro error number. */
char FAR *message;	/* Pointer to space for an error message. */

Remarks

The message parameter is a pointer to a character string that is the Visual FoxPro error message. If message isn’t a null pointer, Visual FoxPro fills in the error message text associated with the external error number.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_ErrorInfo( ) API Library Routine Example

The following example shows the information returned by _ErrorInfo( ).

Visual FoxPro Code

SET LIBRARY TO ERRORINF

= ERRORINFO(0)

= ERRORINFO(1)

C Code

#include <pro_ext.h>

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 10;

_PutValue(&val);

}

void FAR ErrorInfo(ParamBlk FAR *parm)

{

int ext;

char FAR *message;

if ((message =_Alloca(128)) == 0)

{

_Error(182); // "Insufficient memory"

}

ext = _ErrorInfo((int) parm->p[0].val.ev_long, message);

_PutChr('\n'); putLong(ext); _PutStr(" "); _PutStr(message);

}

FoxInfo myFoxInfo[] = {

{"ERRORINFO", (FPFI) ErrorInfo, 1, "I"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_Error( )
_UserError( )


_Evaluate( ) API Library Routine

See Also	Example

Compiles and executes a Visual FoxPro expression you specify with expr, placing the result in res.

Syntax

int _Evaluate(Value FAR *res, char FAR *expr)
Value FAR *res;	/* Address for result. */
char FAR *expr;	/* Expression. */

Remarks

You can specify any expression that can be evaluated by the Visual FoxPro EVALUATE( ) function. After the expression is evaluated, control usually returns to the C statement immediately following the call to _Evaluate( ). Exceptions include evaluating a Visual FoxPro expression that carries out a Visual FoxPro CANCEL or QUIT command.

_Evaluate( ) returns the Visual FoxPro internal error number for any errors that occur during evaluation of the Visual FoxPro expression, or returns 0 if no errors occur. The contents of res are valid only when _Evaluate( ) returns a value of 0.

Note   Do not call _Evaluate( ) from an event handler.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_Evaluate( ) API Library Routine Example

The following example has the same functionality as the Visual FoxPro EVALUATE( ) function.

Visual FoxPro Code

SET LIBRARY TO EVALUATE

? XEVAL("2 + 3")

? XEVAL("'a' + 'b'")

? XEVAL("SIN(PI()/2))")

C Code

#include <pro_ext.h>

FAR EvaluateEx(ParamBlk FAR *parm)

{

char FAR *expr;

Value result;

//	Null terminate character string

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length + 1))

{

_Error(182); // "Insufficient memory"

}

_HLock(parm->p[0].val.ev_handle);

expr = (char FAR *) _HandToPtr(parm->p[0].val.ev_handle);

expr[parm->p[0].val.ev_length] = '\0';

_Evaluate(&result, expr);

_RetVal(&result);

_HUnLock(parm->p[0].val.ev_handle);

}

FoxInfo myFoxInfo[] = {

{"XEVAL", (FPFI) EvaluateEx, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_Execute( )


_Execute( ) API Library Routine

See Also	Example

Compiles and executes the null-terminated statement you specify in stmt.

Syntax

int _Execute(char FAR *stmt)
char FAR *stmt;	/* Statement to execute. */

Remarks

The stmt parameter can be any command or function that can be executed from the Command window. When execution of the statement is complete, control normally returns to the C statement immediately following the call to _Execute( ). Exceptions include executing code that performs a Visual FoxPro CANCEL or QUIT command.

_Execute( ) returns the Visual FoxPro internal error number for any error that occurs during execution of the statement, or 0 if no error occurs.

Note   Do not call _Execute( ) from an event handler.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_Execute( ) API Library Routine Example

The following example uses _Execute( ) to execute the passed Visual FoxPro statement.

Visual FoxPro Code

SET LIBRARY TO EXECUTE

= EXEC("? 'Hello, world.'")

= EXEC("DISPLAY STATUS")

C Code

#include <pro_ext.h>

FAR ExecuteEx(ParamBlk FAR *parm)

{

char FAR *cmd;

// Null terminate character string

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

_HLock(parm->p[0].val.ev_handle);

cmd = (char FAR *) _HandToPtr(parm->p[0].val.ev_handle);

cmd[parm->p[0].val.ev_length] = '\0';

_Execute(cmd);

_HUnLock(parm->p[0].val.ev_handle);

}

FoxInfo myFoxInfo[] = {

{"EXEC", (FPFI) ExecuteEx, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_Evaluate( )


_FCHSize( ) API Library Routine

See Also	Example

Sets the size on disk of the specified file to the specified length.

Syntax

int _FCHSize(FCHAN chan, long length)
FCHAN chan;	/* File to change. */
long length;	/* New length for the file in bytes. */

Remarks

The specified length may extend or truncate the file. _FCHSize( ) returns 0 if it’s successful in changing the length of the file, or  – 1 if it fails.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_FCHSize( ) API Library Routine Example

The following example creates a file TEMP.TXT and sets its size to 8196 bytes using _FCHSize( ).

Visual FoxPro Code

SET LIBRARY TO FCHSIZE

DIR  temp.txt

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

FCHAN fchan = _FCreate("temp.txt", FC_NORMAL);

_FCHSize(fchan, 8196);

_FClose(fchan);

}

FoxInfo myFoxInfo[] = {

{"FCHSIZE", (FPFI) Example, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_FGets( )
_FPuts( )
_FWrite( )


_FClose( ) API Library Routine

See Also	Example

Terminates access to a file.

Syntax

int _FClose(FCHAN chan)
FCHAN chan;	/* File channel of file to close. */

Remarks

Any buffers that have been modified while the buffer is open are automatically flushed to disk. If the file has the TEMPORARY attribute, FClose( ) deletes the file. _FClose( ) returns 0 if the file is closed successfully, or  – 1 if the file isn’t closed successfully.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_FClose( ) API Library Routine Example

The following example creates a file TEMP.TXT, sets its size to 8196 bytes, and closes it using _FClose( ).

Visual FoxPro Code

SET LIBRARY TO FCLOSE

DIR temp.txt

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

FCHAN fchan = _FCreate("temp.txt", FC_NORMAL);

_FCHSize(fchan, 8196);

_FClose(fchan);

}

FoxInfo myFoxInfo[] = {

{"FCHSIZE", (FPFI) Example, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_FOpen( )


_FCopy( ) API Library Routine

See Also	Example

Attempts to copy len bytes from the offset position spos in source file sc to the offset position dpos in destination file dc.

Syntax

int _FCopy(FCHAN dc, long dpos, FCHAN sc, long spos, long len)
FCHAN dc;	/* File channel of destination file. */
long dpos;	/* Offset position to start copying to. */
FCHAN sc;	/* File channel of source file. */
long spos;	/* Offset position to start copying from. */
long len;	/* Number of bytes to copy. */

Remarks

_FCopy( ) returns True (an integer other than 0) if it succeeds, or False (0) if it fails.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_FCopy( ) API Library Routine Example

The following example creates two files. It writes the text “Hello, world” to the first of these files and then copies the contents of this file, beginning with the third byte, to the second file.

Visual FoxPro Code

SET LIBRARY TO FCOPY

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

FCHAN fchan1, fchan2;

int len;

fchan1 = _FCreate("temp1.txt", FC_NORMAL);

_FPuts(fchan1, "Hello, world.");

_FFlush(fchan1);

len = _FSeek(fchan1, 0, FS_FROMEOF); // determine length of file

fchan2 = _FCreate("temp2.txt", FC_NORMAL);

_FCopy(fchan2, 0, fchan1, 2, len - 2);

_FClose(fchan1);

_FClose(fchan2);

}

FoxInfo myFoxInfo[] = {

{"FCOPY", (FPFI) Example, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_FPuts( )
_FWrite( )


_FCreate( ) API Library Routine

See Also	Example

Assigns a Visual FoxPro channel to a new file.

Syntax

FCHAN _FCreate(char FAR *filename, int mode)
char FAR *filename;	/* Name of file to create. */
int mode;	/* File attributes. */

Remarks

If a file with the specified name already exists, _FCreate( ) truncates the existing file to zero bytes.

The mode parameter may be one or more of the following flags: FC_READONLY, FC_SYSTEM, FC_HIDDEN, and FC_TEMPORARY. You can combine these flags using the C | or + operator. An additional flag, FC_NORMAL, specifies that the file has none of the other attributes. FC_TEMPORARY files are automatically deleted when you call _FClose( ) to close the file.

_FCreate( ) returns the file channel if it succeeds in creating the file, or  – 1 if it fails.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_FCreate( ) API Library Routine Example

The following example uses _FCreate( ) to create a number of files using the various mode flags of _FCreate( ).

Visual FoxPro Code

SET LIBRARY TO FCREATE

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

FCHAN fchan;

fchan = _FCreate("normal.tmp", FC_NORMAL);

_FClose(fchan);

fchan = _FCreate("readonly.tmp", FC_READONLY);

_FClose(fchan);

fchan = _FCreate("hidden.tmp", FC_HIDDEN);

_FClose(fchan);

fchan = _FCreate("system.tmp", FC_SYSTEM);

_FClose(fchan);

fchan = _FCreate("temp.tmp", FC_TEMPORARY);

_FClose(fchan);

fchan = _FCreate("multi.tmp", FC_SYSTEM | FC_READONLY);

_FClose(fchan);

}

FoxInfo myFoxInfo[] = {

{"FCREATE", (FPFI) Example, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_FClose( )
_FOpen( )


_FEOF( ) API Library Routine

See Also	Example

Syntax

int _FEOF(FCHAN chan)
FCHAN chan;	/* File channel of file. */

Remarks

_FEOF( ) returns True (an integer other than 0) if the file pointer in the specified file is currently at the end of the file; or False (0) if not.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_FEOF( ) API Library Routine Example

The following example creates a file and sets its length to 8192 bytes. Then it moves the file pointer to the beginning of the file and calls _FEOF( ), which returns 0 (False). Next, it moves the file pointer to the end of the file and again calls _FEOF( ), which this time returns 1 (True).

Visual FoxPro Code

SET LIBRARY TO FEOF

C Code

#include <pro_ext.h>

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 10;

 PutValue(&val);

}

FAR Example(ParamBlk FAR *parm)

{

FCHAN fchan =  FCreate("temp.txt", FC NORMAL);

 FCHSize(fchan, 8196);

 FFlush(fchan);

 FSeek(fchan, 0, FS FROMBOF);

 PutStr("\n FSeek(fchan, 0, FS FROMBOF)");

 PutStr("\n FEOF(fchan) ="); putLong(_FEOF(fchan));

_FSeek(fchan, 0, FS_FROMEOF);

_PutStr("\n_FSeek(fchan, 0, FS_FROMEOF)");

_PutStr("\n_FEOF(fchan) ="); putLong(_FEOF(fchan));

}

FoxInfo myFoxInfo[] = {

{"FEOF", (FPFI) Example, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_FSeek( )


_FError( ) API Library Routine

See Also	Example

Returns the number of the last file operation error recorded for any file channel.

Syntax

int _FError(void any)
void any;	/* Pointer. */


_FError( ) API Library Routine Example

The following example uses _FOpen( ) to attempt to open a file called NOFILE.ABC, which presumably doesn’t exist. It then calls _FError( ), which returns error number 2, for “file not found.”

Visual FoxPro Code

SET LIBRARY TO FERROR

C Code

#include <pro_ext.h>

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 10;

_PutValue(&val);

}

FAR Example(ParamBlk FAR *parm)

{

FCHAN fchan = _FOpen("nofile.abc", FC_READONLY);

_PutStr("\nAttempted to _FOpen() a file which does not exist.");

_PutStr("\n_FError() ="); putLong(_FError());

}

FoxInfo myFoxInfo[] = {

{"FERROR", (FPFI) Example, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_FClose( )
_FCreate( )
_FOpen( )


_FFlush( ) API Library Routine

See Also	Example

Flushes to disk all modified buffers in memory for the specified file.

Syntax

int _FFlush(FCHAN chan)
FCHAN chan;	/* File channel of file to flush. */

Remarks

_FFlush( ) returns 0 if it is successful in flushing the buffers, or  – 1 if it fails.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_FFlush( ) API Library Routine Example

The following example creates a file and sets its length to 8196 bytes. Executing the Visual FoxPro command line DIR TEMP.TXT in the Command window shows that the size of the file on disk is still 0. However, after executing = XFFLUSH( ), issuing the command line DIR TEMP.TXT shows that the file on disk reflects the _FCHSize( ) call, and has a file size of 8196 bytes.

Visual FoxPro Code

SET LIBRARY TO FFLUSH

DIR temp.txt  && size on disk is still 0

WAIT WINDOW "File Size = 0"

= XFFLUSH()

DIR temp.txt  && size on disk is 8196

WAIT WINDOW "File Size Does Not Equal 0"

CLOSE ALL

C Code

#include <pro_ext.h>

static FCHAN fchan;

FAR CreateIt(ParamBlk FAR *parm)

{

fchan = _FCreate("temp.txt", FC_NORMAL);

_FCHSize(fchan, 8196);

}

FAR FFlushEx(ParamBlk FAR *parm)

{

_FFlush(fchan);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) CreateIt, CALLONLOAD, ""},

{"XFFLUSH", (FPFI) FFlushEx, 0, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_FPuts( )
_FWrite( )


_FGets( ) API Library Routine

See Also	Example

Copies to the buffer a single line from the specified file, starting at the current position in the file.

Syntax

int _FGets(FCHAN chan, char FAR *buffer, int maxlen)
FCHAN chan;	/* File channel of file from which to copy. */
char FAR *buffer;	/* Buffer address. */
int maxlen;	/* Maximum length of line in bytes. */

Remarks

_FGets( ) copies a line of maxlen length, delimited with a carriage return. The carriage return is translated to a null terminator and stored in the buffer. Line feeds are ignored and aren’t copied into the buffer. _FGets( ) returns the number of bytes copied to the buffer.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_FGets( ) API Library Routine Example

The following example opens a file specified by a parameter, and copies and shows each line in the file.

Visual FoxPro Code

SET LIBRARY TO FGETS

fc = FCREATE("x", 0)

= FPUTS(fc, REPL("X", 512), 512)

= FCLOSE(fc)

= XFGETS("x")

DELETE FILE x

C Code

#include <pro_ext.h>

#define BUFFSIZE 256

static char lineBuffer[BUFFSIZE];

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 10;

_PutValue(&val);

}

FAR Example(ParamBlk FAR *parm)

{

FCHAN fchan;

//	Null terminate file name

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

_HLock(parm->p[0].val.ev_handle);

((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

[parm->p[0].val.ev_length] = '\0';

if ((fchan=_FOpen((char FAR*)_HandToPtr(parm->p[0].val.ev_handle),

FC_NORMAL)) < 0)

{

_UserError("Could not open file.");

}

_HUnLock(parm->p[0].val.ev_handle);

while (!_FEOF(fchan))

{

_FGets(fchan, lineBuffer, BUFFSIZE);

_PutStr(lineBuffer); _PutChr('\n');

}

_FClose(fchan);

}

FoxInfo myFoxInfo[] = {

{"XFGETS", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_FRead( )
_FSeek( )


_FindMemo( ) API Library Routine

See Also	Example

Returns the memory address of the first character in the memo field fld for the current record in the selected work area.

Syntax

long _FindMemo(Locator FAR *fld)
Locator FAR *fld;	/* Memo field name. */

Remarks

_FindMemo( ) enables you to directly gain access to memo field contents for the current record. When the memo field for the current record is empty, or when fld is not the name of a memo field, _FindMemo( ) returns a negative integer whose absolute value is a Visual FoxPro error number.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_FindMemo( ) API Library Routine Example

The following example retrieves the contents of a memo field for the current record. It uses FindMemo( ) to find the location of the memo contents for the current record within the memo file. The example then moves the file pointer to this location with _FSeek( ), and stores the memo field contents in memory using _FRead( _MemoSize( )).

Visual FoxPro Code

SET LIBRARY TO FINDMEMO

CREATE TABLE WMemo (MemoField M)

APPEND BLANK

REPLACE MemoField WITH "Hello, World."

? GETMEMO(@MemoField)

C Code

#include <pro_ext.h>

FAR FindMemoEx(ParamBlk FAR *parm)

{

Locator FAR *memoFldLoc;

FCHAN fchMemo;

char FAR *memoContents;

int memoLen;

long loc;

if ((fchMemo = _MemoChan(-1)) == -1)

{

_UserError("_MemoChan() failed");

}

memoFldLoc = &parm->p[0].loc;

if ((loc = _FindMemo(memoFldLoc)) < 0)

{

_UserError("_FindMemo() failed");

}

if ((memoLen = _MemoSize(memoFldLoc)) < 0)

{

_UserError("_MemoSize() failed");

}

if ((memoContents = _Alloca(memoLen + 1)) == 0)

{

_Error(182); // "Insufficient memory"

}

_FSeek(fchMemo, loc, FS_FROMBOF);

_FRead(fchMemo, memoContents, memoLen);

memoContents[memoLen] = '\0';

_RetChar(memoContents);

}

FoxInfo myFoxInfo[] = {

{"GETMEMO", (FPFI) FindMemoEx, 1, "R"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_AllocMemo( )
_DBReplace( )
_MemoChan( )
_MemoSize( )


_FindVar( ) API Library Routine

See Also	Example

Provides a way to initialize a Locator so you can use _Store( ) to place data in an existing memory variable or field.

Syntax

int _FindVar(NTI nti, int where, Locator FAR *loc)
NTI nti;	/* NTI number of variable or field. */
int where;	/* Work area number. */
Locator FAR *loc;	/* Locator. */

Remarks

_FindVar( ) fills in the passed Locator with information about a variable or field named nti that exists in a work area specified by where.

•	If where is  – 1, nti is assumed to be a memory variable.

•	If where is 1 – 225, nti is assumed to be a field in the work area of the specified number.

•	If where is 0, _FindVar first checks to see if nti is a memory variable. If it’s not a memory variable, the current work area is checked for a field with the specified NTI.

_FindVar( ) returns True (an integer other than 0) if a variable or field nti is found in where; otherwise, _FindVar( ) returns False (0).

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_FindVar( ) API Library Routine Example

The following example displays the value of a Visual FoxPro variable in a very roundabout way.

Visual FoxPro Code

SET LIBRARY TO FINDVAR

TestVar= "This is a test"

= QMARK("TestVar")

C Code

#include <pro_ext.h>

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 10;

_PutValue(&val);

}

FAR NameTableIndexEx(ParamBlk FAR *parm)

{

NTI nti;

char FAR *name;

Locator loc;

Value val;

//	Null terminate character string, name of variable

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

_HLock(parm->p[0].val.ev_handle);

name = (char FAR *) _HandToPtr(parm->p[0].val.ev_handle);

name[parm->p[0].val.ev_length] = '\0';

nti = _NameTableIndex(name);

_FindVar(nti, 0, &loc);

_Load(&loc, &val);

_PutValue(&val);

}

FoxInfo myFoxInfo[] = {

{"QMARK", (FPFI) NameTableIndexEx, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_ALen( )
_Load( )
_NameTableIndex( )
_NewVar( )
_Release( )
_Store( )


_FindWindow( ) API Library Routine

See Also	Example

Places the handle of the window that the point pt belongs to on the screen into wh.

Syntax

int _FindWindow(WHANDLE FAR *wh, Point pt)
WHANDLE FAR *wh;	/* Pointer to window handle. */
Point pt;	/* Point. */

Remarks

_FindWindow( ) returns an integer indicating the portion of the window where the point is located. For example, _FindWindow( ) returns the value inContent if the point is inside the window.

Possible return values, as defined in PRO_EXT.H, are listed in the following table.

_FindWindow( ) Return Values

Value	Point Location
inBorder	In the window border
inHelp	In the help region
inContent	In the content/text area
inDrag	On the title bar
inGrow	On the size control
inGoAway	On the close box
inZoom	On the zoom control
inVUpArrow	On the up arrow in the vertical scroll bar
inVDownArrow	On the down arrow in the vertical scroll bar
inVPageUp	In the page up region of the vertical scroll bar
inVPageDown	In the page down region of the vertical scroll bar
inVThumb	On the thumb in the vertical scroll bar
inHUpArrow	On the right arrow in the horizontal scroll bar
inHDownArrow	On the left arrow in the horizontal scroll bar
inHPageUp	In the page right region of the horizontal scroll bar
inHPageDown	In the page left region of the horizontal scroll bar
inHThumb	On the thumb in the horizontal scroll bar
inMenuBar	On the menu bar
For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_FindWindow( ) API Library Routine Example

The following example waits for a left mouse button click and then uses _FindWindow( ) to get the window handle for the mouse down position.

Visual FoxPro Code

WAIT WINDOW  "Click mouse on a window" NOWAIT

SET LIBRARY TO FINDWIND

C Code

#include <pro_ext.h>

void putLong(long n, int width)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = width;

_PutValue(&val);

}

FAR FindWindowEx(ParamBlk FAR *parm)

{

WHANDLE wh;

Point mousePos;

int where;

//  Get mouse position when left button goes down

while (_InKey(0, MOUSEACTIVE | HIDECURSOR) != 151);

while (!_MousePos(&mousePos));

switch (where = _FindWindow(&wh, mousePos))

{

case inBorder:

_PutStr("\nMouse down inBorder"); break;

case inHelp:

_PutStr("\nMouse down inHelp"); break;

case inContent:

_PutStr("\nMouse down inContent"); break;

case inDrag:

_PutStr("\nMouse down inDrag"); break;

case inGrow:

_PutStr("\nMouse down inGrow"); break;

case inGoAway:

_PutStr("\nMouse down inGoAway"); break;

case inZoom:

_PutStr("\nMouse down inZoom"); break;

case inVUpArrow:

_PutStr("\nMouse down inVUpArrow"); break;

case inVDownArrow:

_PutStr("\nMouse down inVDownArrow"); break;

case inVPageUp:

_PutStr("\nMouse down inVPageUp"); break;

case inVPageDown:

_PutStr("\nMouse down inVPageDown"); break;

case inVThumb:

_PutStr("\nMouse down inVThumb"); break;

case inHUpArrow:

_PutStr("\nMouse down inHUpArrow"); break;

case inHDownArrow:

_PutStr("\nMouse down inHDownArrow"); break;

case inHPageUp:

_PutStr("\nMouse down inHPageUp"); break;

case inHPageDown:

_PutStr("\nMouse down inHPageDown"); break;

case inHThumb:

_PutStr("\nMouse down inHThumb"); break;

case inMenuBar:

_PutStr("\nMouse down inMenuBar"); break;

default:

_PutStr("\nMouse down someplace else"); break;

}

_GlobalToLocal(&mousePos, wh);

_PutStr("\nPosition relative to window:");

putLong(mousePos.v, 5);

_PutChr(' ');

putLong(mousePos.h, 5);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) FindWindowEx, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_MousePos( )


_FindWindowP( ) API Library Routine

See Also	Example

Places the handle of the window that the point pt belongs to on the screen into wh.

Syntax

int _FindWindowP(WHANDLE FAR *wh, Point pt)
WHANDLE FAR *wh;	/* Pointer to window handle. */
Point pt;	/* Point in pixels. */

Remarks

_FindWindowP( ) returns an integer indicating the portion of the window where the point is located. For possible return values, see _FindWindow( ).

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_FindWindowP( ) API Library Routine Example

The following example waits for a left mouse button click and then uses _FindWindowP( ) to get the window handle for the mouse down position.

Visual FoxPro Code

WAIT WINDOW "Click Mouse In Window" NOWAIT

SET LIBRARY TO FINDWINP

C Code

#include <pro_ext.h>

void putLong(long n, int width)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = width;

_PutValue(&val);

}

FAR FindWindowEx(ParamBlk FAR *parm)

{

WHANDLE wh;

Point mousePos;

int where;

//  Get mouse position when left button goes down

while (_InKey(0, MOUSEACTIVE | HIDECURSOR) != 151);

while (!_MousePosP(&mousePos));

switch (where = _FindWindowP(&wh, mousePos))

{

case inBorder:

_PutStr("\nMouse down inBorder"); break;

case inHelp:

_PutStr("\nMouse down inHelp"); break;

case inContent:

_PutStr("\nMouse down inContent"); break;

case inDrag:

_PutStr("\nMouse down inDrag"); break;

case inGrow:

_PutStr("\nMouse down inGrow"); break;

case inGoAway:

_PutStr("\nMouse down inGoAway"); break;

case inZoom:

_PutStr("\nMouse down inZoom"); break;

case inVUpArrow:

_PutStr("\nMouse down inVUpArrow"); break;

case inVDownArrow:

_PutStr("\nMouse down inVDownArrow"); break;

case inVPageUp:

_PutStr("\nMouse down inVPageUp"); break;

case inVPageDown:

_PutStr("\nMouse down inVPageDown"); break;

case inVThumb:

_PutStr("\nMouse down inVThumb"); break;

case inHUpArrow:

_PutStr("\nMouse down inHUpArrow"); break;

case inHDownArrow:

_PutStr("\nMouse down inHDownArrow"); break;

case inHPageUp:

_PutStr("\nMouse down inHPageUp"); break;

case inHPageDown:

_PutStr("\nMouse down inHPageDown"); break;

case inHThumb:

_PutStr("\nMouse down inHThumb"); break;

case inMenuBar:

_PutStr("\nMouse down inMenuBar"); break;

default:

_PutStr("\nMouse down someplace else"); break;

}

_GlobalToLocalP(&mousePos, wh);

_PutStr("\nPosition relative to window:");

putLong(mousePos.v, 5);

_PutChr(' ');

putLong(mousePos.h, 5);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", FindWindowEx, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_FindWindow( )
_MousePos( )


_FOpen( ) API Library Routine

See Also	Example

Assigns a Visual FoxPro channel to an existing file.

Syntax

FCHAN _FOpen(char FAR *filename, int mode)
char FAR *filename;	/* Name of existing file */
int mode;	/* Mode option. */

Remarks

The following mode options are available: FO_READONLY, FO_WRITEONLY, and FO_READWRITE. _FOpen( ) opens a file with exclusive access. _FOpen( ) returns the file channel if it’s successful in opening the file, or returns  – 1 if it can’t open the file.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_FOpen( ) API Library Routine Example

The following example creates a test file. It then opens the file in FO_READONLY mode and attempts to write to it. As a result _FError( ) returns 5 for “Access denied.” Next, the example opens the test file in FO_WRITEONLY mode, and attempts to read from it. Again, _FError( ) returns 5.

Visual FoxPro Code

SET LIBRARY TO FOPEN

C Code

#include <pro_ext.h>

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 10;

_PutValue(&val);

}

#define BUFFSIZE 256

static char lineBuffer[BUFFSIZE];

FAR Example(ParamBlk FAR *parm)

{

FCHAN fchan;

fchan = _FCreate("temp.tmp", FC_NORMAL);

_FCHSize(fchan, 8192);

_FClose(fchan);

fchan = _FOpen("temp.tmp", FO_READONLY);

_FPuts(fchan, "Hello, world");

_PutStr("\nAttempt to _FPuts() to file _FOpen()d FO_READONLY");

_PutStr("\n_FError() ="); putLong(_FError());

_FClose(fchan);

fchan = _FOpen("temp.tmp", FO_WRITEONLY);

_FGets(fchan, lineBuffer, BUFFSIZE);

_PutStr("\nAttempt to _FGets() from file _FOpen()d FO_WRITEONLY");

_PutStr("\n_FError() ="); putLong(_FError());

_FClose(fchan);

}

FoxInfo myFoxInfo[] = {

{"FOPEN", (FPFI) Example, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_FClose( )
_FCreate( )


_FPuts( ) API Library Routine

See Also	Example

Writes a specified null-terminated string to a file, followed by a carriage return/line feed pair.

Syntax

int _FPuts(FCHAN chan, char FAR *buffer)
FCHAN chan;	/* File channel of file to write to. */
char FAR *buffer;	/* String to write. */

Remarks

_FPuts( ) returns the total number of bytes it writes to the file.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_FPuts( ) API Library Routine Example

The following example creates a file, and writes the text “Hello, world.” to the file using _FPuts( ).

Visual FoxPro Code

SET LIBRARY TO FPUTS

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

FCHAN fchan;

fchan = _FCreate("temp.tmp", FC_NORMAL);

_FPuts(fchan, "Hello, world.");

_FClose(fchan);

}

FoxInfo myFoxInfo[] = {

{"FPUTS", (FPFI) Example, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_FFlush( )
_FSeek( )
_FWrite( )


_FRead( ) API Library Routine

See Also	Example

Copies to the buffer exactly length bytes from a file into buffer.

Syntax

int _FRead(FCHAN chan, char FAR *buffer, int length)
FCHAN chan;	/* File channel of file from which to copy. */
char FAR *buffer;	/* Buffer address. */
int length;	/* Number of bytes to be copied. */

Remarks

_FRead( ) doesn’t add a terminator to the end of the bytes in the buffer. No translation is performed on the bytes when they are stored in the buffer. _FRead( ) returns the number of bytes read.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_FRead( ) API Library Routine Example

The following example creates a test file and places text in it. The example then attempts to read 32 bytes from the file using _FRead( ).

Visual FoxPro Code

SET LIBRARY TO FREAD

C Code

#include <pro_ext.h>

#define BUFFSIZE 32

static char buffer[BUFFSIZE];

FAR Example(ParamBlk FAR *parm)

{

FCHAN fchan;

int bytesRead;

fchan = _FCreate("temp.tmp", FC_NORMAL);

_FPuts(fchan, "Hello, world.");

_FPuts(fchan, "Hello, world.");

_FPuts(fchan, "Hello, world.");

_FPuts(fchan, "Hello, world.");

_FPuts(fchan, "Hello, world.");

_FSeek(fchan, 0, FS_FROMBOF);

bytesRead = _FRead(fchan, buffer, BUFFSIZE - 1);

buffer[bytesRead] = '\0';

_PutStr(buffer);

_FClose(fchan);

}

FoxInfo myFoxInfo[] = {

{"FREAD", (FPFI) Example, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_FGets( )
_FSeek( )


_FreeHand( ) API Library Routine

See Also	Example

Releases a memory handle hand previously allocated by means such as _AllocHand( ).

Syntax

void _FreeHand(MHANDLE hand)
MHANDLE hand;	/* Memory handle. */


_FreeHand( ) API Library Routine Example

The following example allocates 1024 blocks of 16384-byte memory blocks, for a total of 16 MB, freeing each memory block using _FreeHand( ) before allocating the next.

Visual FoxPro Code

SET LIBRARY TO FREEHAND

C Code

#include <pro_ext.h>

void FAR Example(ParamBlk FAR *parm)

{

MHANDLE mh;

int i;

for (i = 0; i < 1024; i++)

{

if ((mh = _AllocHand(16384)) == 0)

{

_Error(182);  // "Insufficient memory"

}

_FreeHand(mh);

}

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) Example, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_AllocHand( )
_GetHandSize( )
_HandToPtr( )
_HLock( )
_HUnLock( )
_MemAvail( )
_SetHandSize( )


_FreeObject( )
_FreeObject( ) API Library Routine

See Also

Releases an object from the Visual FoxPro API data pool.

Syntax

int _FreeObject(Value FAR *objct)

Remarks

Use _FreeObject( ) to free an object from the Visual FoxPro API object table.

_FreeObject( )is used in the following cases:

1. If an object reference is returned from any Visual FoxPro API function (for example, _Evaluate( ) or _GetObjectProperty( )), you must use _FreeObject( ) to release the object when you are no longer using it.

2. If you keep a reference to an object across different Visual FoxPro API calls, you must first use _ObjectReference( ) to increment the count for the object. When you are no longer using the object, you must then use _ObjectRelease( ) to decrement the count for the object and then use _FreeObject( ) to release the object.

In addition to the previous rules, you should always clear the Value structure you pass to any Visual FoxPro API function that returns a value into the passed Value structure. For example, you can create and call a function that clears the structure prior to calling any function that returns a value into your structure. You can also create and call a function to cleanup any object references or unused handles.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


See Also

_ObjectReference( )
_ObjectRelease( )


_FSeek( ) API Library Routine

See Also	Example

Moves the file pointer to a new location as specified by position and mode.

Syntax

long _FSeek(FCHAN chan, long position, int mode)
FCHAN chan;	/* File channel. */
long position;	/* Position in file. */
int mode;	/* How to determine new location */

Remarks

If mode is 0 (absolute), the file pointer is set to the value of position. If mode is 1, (relative to file pointer), the value of position is added to the current file pointer position. If mode is 2 (relative to the end of the file), _FSeek( ) moves the file pointer past the end of the file. _FSeek( ) returns the new position of the file pointer. For example, _FSeek(chan, 0L, 2) moves the file pointer to the end of the file and returns the file length in bytes.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_FSeek( ) API Library Routine Example

The following example consists of one API routine which takes two parameters, a file name, and an integer. It opens the file. Using _FSeek( ) with the FS_FROMBOF flag, it then moves the file pointer to the offset position specified by the integer parameter, and reads a single byte from the file at that position.

Visual FoxPro Code

SET LIBRARY TO FSEEK

fc = FCREATE("x", 0)

= FPUTS(fc, "abcdefghijklmnopqrstuvwxyz", 26)

= FCLOSE(fc)

? XFSEEK("x", 2)  && displays 3rd byte of file x as an integer

? XFSEEK("x", 4)  && displays 5th byte of file x as an integer

DELETE FILE x

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

FCHAN fchan;

char x;

// Null terminate file name

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

_HLock(parm->p[0].val.ev_handle);

((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

[parm->p[0].val.ev_length] = '\0';

if ((fchan=_FOpen((char FAR*)_HandToPtr(parm->p[0].val.ev_handle),

FC_NORMAL)) < 0)

{

_UserError("Could not open file.");

}

_HUnLock(parm->p[0].val.ev_handle);

_FSeek(fchan, parm->p[1].val.ev_long, FS_FROMBOF);

_FRead(fchan, &x, 1);

_RetInt(x, 10);

_FClose(fchan);

}

FoxInfo myFoxInfo[] = {

{"XFSEEK", (FPFI) Example, 2, "C,I"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_FCopy( )
_FFlush( )
_FGets( )
_FPuts( )


_FWrite( ) API Library Routine

See Also	Example

Writes exactly length bytes from your buffer to a file specified by chan.

Syntax

int _FWrite(FCHAN chan, char FAR *buffer, int length)
FCHAN chan;	/* File channel of file to write to. */
char FAR *buffer;	/* Buffer address. */
int length;	/* Number of bytes to write. */

Remarks

_FWrite( ) doesn’t add a terminator to the file. No translation is performed on the bytes before they are written. _FWrite( ) returns the number of bytes written.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_FWrite( ) API Library Routine Example

The following example creates a test file and writes some data to it using _FWrite( ).

Visual FoxPro Code

SET LIBRARY TO FWRITE

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

FCHAN fchan;

fchan = _FCreate("temp.tmp", FC_NORMAL);

_FWrite(fchan, "Hello, world.", _StrLen("Hello, world."));

_FWrite(fchan, "\xd\xa", 2);

_FWrite(fchan, "1234567890", 10);

_FClose(fchan);

}

FoxInfo myFoxInfo[] = {

{"FWRITE", (FPFI) Example, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_FFlush( )
_FPuts( )
_FSeek( )


_GetAPIHandle( ) API Library Routine

Example

Returns the handle of the current FLL.

Syntax

void _GetAPIHandle( )


_GetAPIHandle( ) API Library Routine Example

The following example returns the handle of the current FLL.

Visual FoxPro Code

SET LIBR TO GETAPIHA.FLL

? GETAPIHAND( )

C Code

#include <pro_ext.h>

void getAPIHandle()

{

_RetInt((int) _GetAPIHandle(),15);

}

FoxInfo myFoxInfo[] =

{

{"GETAPIHAND",  (FPFI) getAPIHandle, 0, ""},

};

FoxTable _FoxTable =

{

(FoxTable  *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


_GetHandSize( ) API Library Routine

See Also	Example

Returns the usable number of bytes associated with a specified memory block handle hand.

Syntax

unsigned int _GetHandSize(MHANDLE hand)
MHANDLE hand;	/* Handle of memory block. */

Remarks

The usable number of bytes is always greater than or equal to the number of bytes most recently requested for this MHANDLE by _AllocHand( ) or by a successful _SetHandSize( ) call.

Note   _GetHandSize( ) doesn’t cause memory reorganization.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_GetHandSize( ) API Library Routine Example

The following example allocates memory blocks of various size from 1 to 215 and shows the value returned by _GetHandSize( ) for these allocations. Notice that the value returned by _GetHandSize( ) is only sometimes exactly equal to the size requested by _AllocHand( ); usually it’s a bit more.

Visual FoxPro Code

SET LIBRARY TO GETHANDS

C Code

#include <pro_ext.h>

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 5;

_PutValue(&val);

}

void FAR Example(ParamBlk FAR *parm)

{

MHANDLE mh;

unsigned int allocSize;

for (allocSize = 1;; allocSize *= 2)

{

if ((mh = _AllocHand(allocSize)) == 0)

{

_Error(182);  // "Insufficient memory"

}

_PutStr("\n_AllocHand("); putLong(allocSize); _PutStr(")");

_PutStr("\n_GetHandSize() ="); putLong(_GetHandSize(mh));

_FreeHand(mh);

if (allocSize == 32768)

{

break;

}

}

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) Example, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_AllocHand( )
_FreeHand( )
_HandToPtr( )
_HLock( )
_HUnLock( )
_MemAvail( )
_SetHandSize( )


_GetItemCmdKey( ) API Library Routine

See Also	Example

Copies the displayed keyboard shortcut string for the specified menu item to the buffer pointed to by the text parameter.

Syntax

int _GetItemCmdKey(MENUID menuid, ITEMID itemid, char FAR *text)
MENUID menuid;	/* Menu identifier. */
ITEMID itemid;	/* Menu item identifier. */
char FAR *text;	/* Where to store the shortcut string. */

Remarks

_GetItemCmdKey( ) returns the internal keyboard code for the keyboard shortcut. If there is no keyboard shortcut for the specified menu item, _GetItemCmdKey( ) returns 0.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_GetItemCmdKey( ) API Library Routine Example

The following example creates a menu with three items, setting up a keyboard shortcut for each item. It uses _GetItemCmdKey( ) to display the shortcut keys.

Visual FoxPro Code

SET LIBRARY TO GETICMDK

C Code

#include <pro_ext.h>

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 10;

_PutValue(&val);

}

FAR GetItemCmdKeyEx(ParamBlk FAR *parm)

{

MENUID menuId;

ITEMID itemId;

Point loc;

char FAR *shortcutString;

int intKeyCode;

menuId = _GetNewMenuId();

_NewMenu(MPOPUP, menuId);

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<1st item");

_SetItemCmdKey(menuId, itemId, altKey | 0x78, "Alt+1");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<2nd item");

_SetItemCmdKey(menuId, itemId, altKey | 0x79, "Alt+2");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<3rd item");

_SetItemCmdKey(menuId, itemId, altKey | 0x7a, "Alt+3");

loc.v = 10; loc.h = 20;

_SetMenuPoint(menuId, loc);

_ActivateMenu(menuId);

if ((shortcutString = _Alloca(64)) == 0)

{

_DisposeMenu(menuId);

_Error(182); // "Insufficient memory"

}

intKeyCode = _GetItemCmdKey(menuId, _GetItemId(menuId, 0),

shortcutString);

_PutStr("\nShortcut string = "); _PutStr(shortcutString);

_PutStr("\nInternal key code ="); putLong(intKeyCode);

intKeyCode = _GetItemCmdKey(menuId, _GetItemId(menuId, 1),

shortcutString);

_PutStr("\nShortcut string = "); _PutStr(shortcutString);

_PutStr("\nInternal key code ="); putLong(intKeyCode);

intKeyCode = _GetItemCmdKey(menuId, _GetItemId(menuId, 2),

shortcutString);

_PutStr("\nShortcut string = "); _PutStr(shortcutString);

_PutStr("\nInternal key code ="); putLong(intKeyCode);

_Execute("WAIT");

_DisposeMenu(menuId);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) GetItemCmdKeyEx, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_GetItemSubMenu( )
_NewItem( )
_SetItemCmdKey( )


_GetItemId( ) API Library Routine

See Also	Example

Returns the item identifier of the specified item in the specified menu.

Syntax

ITEMID _GetItemId(MENUID menuid, long index)
MENUID menuid;	/* Menu identifier. */
long index;	/* Menu item number. */

Remarks

You can use _GetItemId( ) to gather menu bar or menu identifiers, so you can perform an operation on all the items. _GetItemId( ) returns 0 when index exceeds the number of items on the menu.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_GetItemId( ) API Library Routine Example

The following example creates a menu with three items. It uses _GetItemId( ) to get the ITEMID of each menu item. After removing one item from the menu, you can see that the ITEMID isn’t always equal to the item index.

Visual FoxPro Code

SET LIBRARY TO GETIID

C Code

#include <pro_ext.h>

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 10;

_PutValue(&val);

}

FAR GetItemIdEx(ParamBlk FAR *parm)

{

MENUID menuId;

ITEMID itemId;

Point loc;

menuId = _GetNewMenuId();

_NewMenu(MPOPUP, menuId);

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<1st item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<2nd item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<3rd item");

loc.v = 10; loc.h = 20;

_SetMenuPoint(menuId, loc);

_ActivateMenu(menuId);

_PutStr("\nitemid for index 0 ="); putLong(_GetItemId(menuId, 0));

_PutStr("\nitemid for index 1 ="); putLong(_GetItemId(menuId, 1));

_PutStr("\nitemid for index 2 ="); putLong(_GetItemId(menuId, 2));

_Execute("WAIT WINDOW");

_DisposeItem(menuId, _GetItemId(menuId, 1));

_PutStr("\nitemid for index 0 ="); putLong(_GetItemId(menuId, 0));

_PutStr("\nitemid for index 1 ="); putLong(_GetItemId(menuId, 1));

_Execute("WAIT WINDOW");

_DisposeMenu(menuId);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) GetItemIdEx, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_GetItemSubMenu( )
_GetNewItemId( )


_GetItemSubMenu( ) API Library Routine

See Also	Example

Returns the menu item identifier of a submenu assigned to a menu item.

Syntax

MENUID _GetItemSubMenu(MENUID menuid, ITEMID itemid);
MENUID menuid;	/* Menu identifier */
ITEMID itemid;	/* Menu item identifier*/

Remarks

A submenu is treated as an independent menu. _GetItemSubMenu( ) returns the MENUID of the submenu assigned to a specified menu item, or a  – 1 if there is no submenu assigned to the menu item.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_GetItemSubMenu( ) API Library Routine Example

The following example creates a menu system and returns the sub menu ID.

Visual FoxPro Code

SET LIBRARY TO GETITEMS

C Code

#include <pro_ext.h>

MENUID SysMenuId, retMenuId;

MENUID PopupId;

ITEMID PadId;

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 10;

_PutValue(&val);

}

FAR onSelection(long menuId, long itemId)

{

_PutStr("\nitemId = "); putLong(itemId);

}

void FAR StartUp()

{

ITEMID Bar1Id;

ITEMID Bar2Id;

        int Error;

//

//	Add new menu title to SYSMENU.

//

    SysMenuId = _MenuId(_SYSMENU);

    PadId = _GetNewItemId(SysMenuId);

if (_NewItem(SysMenuId, PadId, _LASTITEM, "\\<Added menu title"))

    {

        _Error(623); /* "Menu item cannot be defined." */

    }

//

//	Define menu.

//

    PopupId = _GetNewMenuId();

    if (Error = _NewMenu(MPOPUP, PopupId))

    {

        _Error(-Error);

    }

Bar1Id = _GetNewItemId(PopupId);

//

//	WARNING: Call _NewItem() before another _GetNewItemId().

//

if (_NewItem(PopupId, Bar1Id, _LASTITEM, "\\<1st item"))

    {

        _Error(623); /* "Menu item cannot be defined." */

    }

Bar2Id = _GetNewItemId(PopupId);

if (_NewItem(PopupId, Bar2Id, _LASTITEM, "\\<2nd item"))

    {

        _Error(623); /* "Menu item cannot be defined." */

    }

//

//	Attach menu to menu title.

//

    _SetItemSubMenu(SysMenuId, PadId, PopupId);

    _PutStr("\nSubMenu Id = "); putLong(PopupId);

//

//  Set up selection action.

//

retMenuId = _GetItemSubMenu(SysMenuId,PadId);

_PutStr("\nThis is the return value from  _GetItemSubMenu.  retMenuId = "); putLong(retMenuId);

_OnSelection(PopupId, -1, onSelection);

}

void FAR ShutDown()

{

    _DisposeItem(SysMenuId, PadId);

    _DisposeMenu(PopupId);

}

FoxInfo myFoxInfo[] =

{

{"STARTUP",     (FPFI) StartUp,    CALLONLOAD,   ""},

{"SHUTDOWN",    (FPFI) ShutDown,   CALLONUNLOAD, ""},

};

FoxTable _FoxTable =

{

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_GetItemId( )
_NewItem( )
_SetItemText( )


_GetItemText( ) API Library Routine

See Also	Example

Copies the text of a menu bar or menu title to the buffer pointed to by text.

Syntax

void _GetItemText(MENUID menuid, ITEMID itemid, char FAR *text)
MENUID menuid;	/* Menu identifier. */
ITEMID itemid;	/* Menu item identifier. */
char FAR *text;	/* Buffer address for text. */

Remarks

The buffer must be at least 80 bytes long.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_GetItemText( ) API Library Routine Example

The following example creates a menu with three items and then retrieves the text of each item with _GetItemText( ).

Visual FoxPro Code

SET LIBRARY TO GETITEXT

C Code

#include <pro_ext.h>

FAR GetItemTextEx(ParamBlk FAR *parm)

{

MENUID menuId;

ITEMID itemId;

Point loc;

char FAR *itemText;

menuId = _GetNewMenuId();

_NewMenu(MPOPUP, menuId);

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<1st item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<2nd item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<3rd item");

loc.v = 10; loc.h = 20;

_SetMenuPoint(menuId, loc);

_ActivateMenu(menuId);

if ((itemText = _Alloca(80)) == 0)

{

_Error(182); // "Insufficient memory"

}

_GetItemText(menuId, _GetItemId(menuId, 0), itemText);

_PutStr("\nItem text of 1st item = "); _PutStr(itemText);

_GetItemText(menuId, _GetItemId(menuId, 1), itemText);

_PutStr("\nItem text of 2nd item = "); _PutStr(itemText);

_GetItemText(menuId, _GetItemId(menuId, 2), itemText);

_PutStr("\nItem text of 3rd item = "); _PutStr(itemText);

_Execute("WAIT WINDOW");

_DisposeMenu(menuId);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) GetItemTextEx, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_GetItemSubMenu( )
_NewItem( )
_SetItemText( )


_GetNewItemId( ) API Library Routine

See Also	Example

Returns an identifier that’s currently available for use as an item identifier in the specified menu.

Syntax

ITEMID _GetNewItemId(MENUID menuid)
MENUID menuid;	/* Menu identifier. */

Remarks

Every item in a menu must have an identifier that’s unique to that menu.

After using _GetNewItemId( ), add the new item to the menu with _NewItem( ) before using _GetNewItemId( ) again. If you don’t add the item to the menu, subsequent calls to _GetNewItemId( ) return the same ITEMID.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_GetNewItemId( ) API Library Routine Example

The following example creates a menu with three items. Before each item is added to the menu, a unique ITEMID is generated by calling _GetNewItemId( ).

Visual FoxPro Code

SET LIBRARY TO GETNWIID

C Code

#include <pro_ext.h>

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 10;

_PutValue(&val);

}

FAR GetNewItemId(ParamBlk FAR *parm)

{

MENUID menuId;

ITEMID itemId;

Point loc;

menuId = _GetNewMenuId();

_NewMenu(MPOPUP, menuId);

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<1st item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<2nd item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<3rd item");

loc.v = 10; loc.h = 20;

_SetMenuPoint(menuId, loc);

_MenuInteract(&menuId, &itemId);

_PutStr("\nmenuId ="); putLong(menuId);

_PutStr("\nitemId ="); putLong(itemId);

_DisposeMenu(menuId);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) GetNewItemId, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_GetItemId( )


_GetNewMenuId( ) API Library Routine

See Also	Example

Returns a menu identifier for use with other menu-related functions.

Syntax

MENUID _GetNewMenuId(void any)
void any;	/* Pointer. */

Remarks

Every menu must have a unique identifier.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_GetNewMenuId( ) API Library Routine Example

The following example builds a menu with three items. Before the example can create a menu using _NewMenu( ), it must use _GetNewMenuId( ) to generate a unique MENUID.

Visual FoxPro Code

SET LIBRARY TO GETNWMID

C Code

#include <pro_ext.h>

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 10;

_PutValue(&val);

}

FAR GetNewItemId(ParamBlk FAR *parm)

{

MENUID menuId;

ITEMID itemId;

Point loc;

menuId = _GetNewMenuId();

_NewMenu(MPOPUP, menuId);

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<1st item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<2nd item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<3rd item");

loc.v = 10; loc.h = 20;

_SetMenuPoint(menuId, loc);

_MenuInteract(&menuId, &itemId);

_PutStr("\nmenuId ="); putLong(menuId);

_PutStr("\nitemId ="); putLong(itemId);

_DisposeMenu(menuId);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) GetNewItemId, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_DisposeMenu( )
_MenuId( )


_GetNextEvent( ) API Library Routine

See Also	Example

Reads the next event into the EventRec and returns the event type.

Syntax

int _GetNextEvent(EventRec FAR *event)
EventRec FAR *event;	/* Event. */

Remarks

Null events are generated when no other activity has taken place. Idle routines shouldn’t call _GetNextEvent( ). You can call _GetNextEvent( ) from an event handler but you must be careful, because _GetNextEvent( ) calls the event handler recursively.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_GetNextEvent( ) API Library Routine Example

The following example is a loop consisting of a call to _GetNextEvent( ), followed by a call to _DefaultProcess( ). All events during this procedure receive their default processing.

Visual FoxPro Code

SET LIBR TO GETNXEV

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

EventRec ev;

int i;

for (i = 0; i < 16; i++) {

_GetNextEvent(&ev);

_DefaultProcess(&ev);

}

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", Example, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_ActivateHandler( )
_FindWindow( )
_GlobalToLocal( )
_MousePos( )


_GetObjectProperty( )
_GetObjectProperty( ) API Library Routine

See Also

Returns a property value for an object.

Syntax

int _GetObjectProperty(Value FAR *retval, Value FAR *objct,
char FAR *prop)

Remarks

The object to return a property for is specified with *objct, and the property to return is specified with *prop.

The value returned is placed in the *retval value structure.

Note   You must always fill the *retval structure with 0 prior to calling _GetObjectProperty( ).

_GetObjectProperty( ) returns 0 if it is successful; otherwise, the negative value of the corresponding Visual FoxPro error code is returned.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


See Also

_SetObjectProperty( )


_GetOSPrompt( ) API Library Routine

Returns the text a specified menu item. If the menu item contains an access key definition, the ampersand character is returned as well.

Syntax

void _GetOSPrompt(MENUID menuid, ITEMID itemid, char FAR *text)
MENUID menuid;	/* ID of menu from which to get prompt */
MENUID itemuid ;	/* Index (0-based) of menu item. */
char FAR *text;	/* Text of menu command. */

Remarks

Can be used for developing applications with language-independent access keys.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_GetOSPrompt( ) API Library Routine Example

The following example returns the text of the first command on the File menu.

Visual FoxPro Code

SET LIBRARY TO MENUPROMPT

C Code

#include <pro_ext.h>

void FAR menuprompt(ParamBlk FAR *parm)

{

char prompt[256] ;

MenuId men ;

men = _MenuId(_FILE);

_GetOSPrompt(men, 0, prompt); //File New...

_RetChar(prompt);

}

FoxInfo myFoxInfo[] = {

{"MENUPROMPT", (FPFI) menuprompt, 0, ""}

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_GetNewMenuId( )
_MenuId( )
_NewMenu( )


_GlobalToLocal( ) API Library Routine

See Also	Example

Translates a point in screen-relative coordinates to window-relative coordinates.

Syntax

void _GlobalToLocal(Point FAR *pt, WHANDLE wh)
Point FAR *pt;	/* Point. */
WHANDLE wh;	/* Window handle. */

Remarks

Before calling _GlobalToLocal( ), call _FindWindow( ) to determine which window owns the point.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_GlobalToLocal( ) API Library Routine Example

The following example waits for a left mouse button click and then uses _FindWindow( ) to get the window handle for the mouse position. _GlobalToLocal( ) takes both the window handle and the absolute mouse position as parameters, and returns the mouse position to a position relative to the window.

Visual FoxPro Code

SET LIBRARY TO GLTOLOC

C Code

#include <pro_ext.h>

void putLong(long n, int width)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = width;

_PutValue(&val);

}

FAR FindWindowEx(ParamBlk FAR *parm)

{

WHANDLE wh;

Point mousePos;

int where;

// Get mouse position when left button goes down

_Execute("WAIT WINDOW 'Click In A Window' NOWAIT");

while (_InKey(0, MOUSEACTIVE | HIDECURSOR) != 151);

while (!_MousePos(&mousePos));

switch (where = _FindWindow(&wh, mousePos))

{

case inBorder:

_PutStr("\nMouse down inBorder"); break;

case inHelp:

_PutStr("\nMouse down inHelp"); break;

case inContent:

_PutStr("\nMouse down inContent"); break;

case inDrag:

_PutStr("\nMouse down inDrag"); break;

case inGrow:

_PutStr("\nMouse down inGrow"); break;

case inGoAway:

_PutStr("\nMouse down inGoAway"); break;

case inZoom:

_PutStr("\nMouse down inZoom"); break;

case inVUpArrow:

_PutStr("\nMouse down inVUpArrow"); break;

case inVDownArrow:

_PutStr("\nMouse down inVDownArrow"); break;

case inVPageUp:

_PutStr("\nMouse down inVPageUp"); break;

case inVPageDown:

_PutStr("\nMouse down inVPageDown"); break;

case inVThumb:

_PutStr("\nMouse down inVThumb"); break;

case inHUpArrow:

_PutStr("\nMouse down inHUpArrow"); break;

case inHDownArrow:

_PutStr("\nMouse down inHDownArrow"); break;

case inHPageUp:

_PutStr("\nMouse down inHPageUp"); break;

case inHPageDown:

_PutStr("\nMouse down inHPageDown"); break;

case inHThumb:

_PutStr("\nMouse down inHThumb"); break;

case inMenuBar:

_PutStr("\nMouse down inMenuBar"); break;

default:

_PutStr("\nMouse down someplace else"); break;

}

_GlobalToLocal(&mousePos, wh);

_PutStr("\nPosition relative to window:");

putLong(mousePos.v, 5);

_PutChr(' ');

putLong(mousePos.h, 5);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) FindWindowEx, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_FindWindow( )
_MousePos( )


_GlobalToLocalP( ) API Library Routine

See Also	Example

Translates a point in screen-relative pixel coordinates to window-relative pixel coordinates.

Syntax

void _GlobalToLocalP(Point FAR *pt, WHANDLE wh)
Point FAR *pt;	/* Point. */
WHANDLE wh;	/* Window handle. */

Remarks

Before calling _GlobalToLocalP( ), call _FindWindow( ) to determine which window owns the point.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_GlobalToLocalP( ) API Library Routine Example

The following example waits for a left mouse button click and then uses _FindWindowP( ) to get the window handle for the mouse position. _GlobalToLocalP( ) takes the window handle and the absolute mouse position as parameters, and returns the mouse position to a position relative to the window.

Visual FoxPro Code

SET LIBRARY TO GLTOLOCP

C Code

#include <pro_ext.h>

void putLong(long n, int width)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = width;

_PutValue(&val);

}

FAR FindWindowEx(ParamBlk FAR *parm)

{

WHANDLE wh;

Point mousePos;

int where;

// Get mouse position when left button goes down

_Execute("WAIT WINDOW 'Click In A Window' NOWAIT" );

while (_InKey(0, MOUSEACTIVE | HIDECURSOR) != 151);

while (!_MousePosP(&mousePos));

switch (where = _FindWindowP(&wh, mousePos))

{

case inBorder:

_PutStr("\nMouse down inBorder"); break;

case inHelp:

_PutStr("\nMouse down inHelp"); break;

case inContent:

_PutStr("\nMouse down inContent"); break;

case inDrag:

_PutStr("\nMouse down inDrag"); break;

case inGrow:

_PutStr("\nMouse down inGrow"); break;

case inGoAway:

_PutStr("\nMouse down inGoAway"); break;

case inZoom:

_PutStr("\nMouse down inZoom"); break;

case inVUpArrow:

_PutStr("\nMouse down inVUpArrow"); break;

case inVDownArrow:

_PutStr("\nMouse down inVDownArrow"); break;

case inVPageUp:

_PutStr("\nMouse down inVPageUp"); break;

case inVPageDown:

_PutStr("\nMouse down inVPageDown"); break;

case inVThumb:

_PutStr("\nMouse down inVThumb"); break;

case inHUpArrow:

_PutStr("\nMouse down inHUpArrow"); break;

case inHDownArrow:

_PutStr("\nMouse down inHDownArrow"); break;

case inHPageUp:

_PutStr("\nMouse down inHPageUp"); break;

case inHPageDown:

_PutStr("\nMouse down inHPageDown"); break;

case inHThumb:

_PutStr("\nMouse down inHThumb"); break;

case inMenuBar:

_PutStr("\nMouse down inMenuBar"); break;

default:

_PutStr("\nMouse down someplace else"); break;

}

_GlobalToLocalP(&mousePos, wh);

_PutStr("\nPosition relative to window:");

putLong(mousePos.v, 5);

_PutChr(' ');

putLong(mousePos.h, 5);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", FindWindowEx, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_FindWindow( )
_MousePos( )


_HandToPtr( ) API Library Routine

See Also	Example

Translates a memory handle to a FAR (32-bit) pointer, which points to the memory allocated to this handle.

Syntax

void FAR * _HandToPtr(MHANDLE hand)
MHANDLE hand;	/* Memory handle. */

Remarks

Visual FoxPro may reorganize memory any time control is passed to it or to another routine outside of the current module.

Note   _HandToPtr( ) doesn’t cause memory reorganization.

The pointer returned by _HandToPtr( ) may become invalid any time control is passed back to Visual FoxPro, unless the MHANDLE is locked. Don’t keep pointers to unlocked memory handles across an external function call, unless it is documented that the call doesn’t cause memory reorganization.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_HandToPtr( ) API Library Routine Example

The following example displays its character parameter on the screen. It uses _HandToPtr( ) to translate the memory handle of the API parameter to a C pointer.

Visual FoxPro Code

SET LIBRARY TO HANDTOPT

= HANDTOPTR("Hello, world.")  && displays "Hello, world" on screen

C Code

#include <pro_ext.h>

void NullTerminate(Value FAR *cVal)

{

if (!_SetHandSize(cVal->ev_handle, cVal->ev_length + 1))

{

_Error(182); // "Insufficient memory"

}

((char FAR *) _HandToPtr(cVal->ev_handle))[cVal->ev_length] = '\0';

}

FAR Example(ParamBlk FAR *parm)

{

NullTerminate(&parm->p[0].val);

_HLock(parm->p[0].val.ev_handle);

_PutStr(_HandToPtr(parm->p[0].val.ev_handle));

_HUnLock(parm->p[0].val.ev_handle);

}

FoxInfo myFoxInfo[] = {

{"HANDTOPTR", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_AllocHand( )
_FreeHand( )
_GetHandSize( )
_HLock( )
_HUnLock( )
_MemAvail( )
_SetHandSize( )


_HLock( ) API Library Routine

See Also	Example

Locks a memory handle to prevent it from moving if Visual FoxPro requires memory reorganization.

Syntax

void _HLock(MHANDLE hand)
MHANDLE hand;	/* Memory handle. */

Remarks

_HLock( ) doesn’t cause memory reorganization. Unlock the MHANDLE as soon as the lock has served its purpose.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_HLock( ) API Library Routine Example

The following example displays its character parameter on the screen. It uses _HandToPtr( ) to translate the memory handle of the API parameter to a C pointer. Because Visual FoxPro may decide to reorganize memory during the call to _PutStr( ), to insure proper execution, the example locks the memory handle with _HLock( ). The example also calls _HUnLock( ) at the end, because the performance of Visual FoxPro can be adversely affected by locked memory handles.

Visual FoxPro Code

SET LIBRARY TO HLOCK

= HLOCK("Hello, world.") && displays "Hello, world" on screen

C Code

#include <pro_ext.h>

void NullTerminate(Value FAR *cVal)

{

if (!_SetHandSize(cVal->ev_handle, cVal->ev_length + 1))

{

_Error(182); // "Insufficient memory"

}

((char FAR *) _HandToPtr(cVal->ev_handle))[cVal->ev_length] = '\0';

}

FAR Example(ParamBlk FAR *parm)

{

NullTerminate(&parm->p[0].val);

_HLock(parm->p[0].val.ev_handle);

_PutStr(_HandToPtr(parm->p[0].val.ev_handle));

_HUnLock(parm->p[0].val.ev_handle);

}

FoxInfo myFoxInfo[] = {

{"HLOCK", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_AllocHand( )
_FreeHand( )
_GetHandSize( )
_HandToPtr( )
_HUnLock( )
_MemAvail( )
_SetHandSize( )


_HUnLock( ) API Library Routine

See Also	Example

Unlocks a memory handle so that Visual FoxPro can access it during memory reorganization.

Syntax

void _HUnLock(MHANDLE hand)
MHANDLE hand;	/* Memory handle. /

Remarks

_HUnLock( ) doesn’t cause memory reorganization.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_HUnLock( ) API Library Routine Example

The following example uses _RetDateStr( ) to return a Visual FoxPro date type, assuming that the character parameter is a proper date. It issues _HUnLock( ) when memory handles no longer need to be locked, because the performance of Visual FoxPro can be adversely affected by locked memory handles.

Visual FoxPro Code

SET LIBRARY TO HUNLOCK

? DATES("2/16/95")  && returns date {02/16/95}

C Code

#include <pro_ext.h>

void FAR dates(ParamBlk FAR *parm)

{

MHANDLE mh;

char FAR *instring;

if ((mh = _AllocHand(parm->p[0].val.ev_length + 1)) == 0)

{

_Error(182); // "Insufficient memory"

}

_HLock(parm->p[0].val.ev_handle);

instring = _HandToPtr(parm->p[0].val.ev_handle);

instring[parm->p[0].val.ev_length] = '\0';

_RetDateStr(instring);

_HUnLock(parm->p[0].val.ev_handle);

}

FoxInfo myFoxInfo[] = {

{"DATES", (FPFI) dates, 1, "C"}

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_AllocHand( )
_FreeHand( )
_GetHandSize( )
_HandToPtr( )
_HLock( )
_MemAvail( )
_SetHandSize( )


_InKey( ) API Library Routine

Example

Returns the first key typed during the timeout period.

Syntax

int _InKey(int timeout, int flag)
int timeout;	/* Timeout period. */
int flag;	/* Option(s). */

Remarks

The timeout period is specified as a number of Operating system timer ticks (1000/second). A timeout period of 0 causes Visual FoxPro to wait until the user presses a key. A negative timeout value causes _InKey( ) to return to the calling program immediately if the user doesn't press a key.

You can specify flag as one or both of the following options:

•	SHOWCURSOR or HIDECURSOR

•	MOUSEACTIVE

Use SHOWCURSOR to force the cursor to appear, or HIDECURSOR to force the cursor to disappear. If neither is specified, the cursor respects the SYS(2002) setting. The additional flag value MOUSEACTIVE causes _InKey( ) to treat mouse clicks as keystrokes. _InKey returns 151 for a mouse click. To specify two flag values, use the C | or + operator.

Note   Idle routines must not call _InKey( ).

You can write event handlers that call _InKey( ), but you must be careful because _InKey( ) calls the event handler recursively.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API” in the Developer’s Guide.


_InKey( ) API Library Routine Example

The following example calls _InKey( ) from Visual FoxPro with two flags.

Visual FoxPro Code

SET LIBRARY TO INKEY

#define SHOWCURSOR	1

#define HIDECURSOR	2

#define MOUSEACTIVE 4

= XINKEY(0, SHOWCURSOR + MOUSEACTIVE)

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

_RetInt(_InKey((int) parm->p[0].val.ev_long,

(int) parm->p[1].val.ev_long), 10);

}

FoxInfo myFoxInfo[] = {

{"XINKEY", (FPFI) Example, 2, "I,I"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


_Load( ) API Library Routine

See Also	Example

Places the value of the memory variable or current record field specified by loc into val.

Syntax

int _Load(Locator FAR *loc, Value FAR *val)
Locator FAR *loc;	/* Variable location. */
Value FAR *val;	/* Holds value of the variable. */

Remarks

_Load( ) returns 0 if the routine is successful. If the routine fails, it returns a negative integer whose absolute value is a Visual FoxPro error number. You can use _Load( ) to retrieve the contents of a memo field, but it doesn’t retrieve characters in the field after the first 65,000 bytes. If loc specifies a one-dimensional array, Visual FoxPro returns the value of the first element of the array.

If the setting of the Locator field l_offset is  – 1, Visual FoxPro returns a logical value structure that indicates whether the current record in the specified work area is deleted:

•	ev_length = .T. = DELETED( )

•	ev_length = .F. = NOT DELETED( )

Note   _Load( ) creates a handle only when the memory variable your program is loading is a character string (ev_type = 'C'). All other data types store their values in the Value structure itself. Your program must free the handles created with _Load( ).

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API” in the Developer’s Guide.


_Load( ) API Library Routine Example

The following example converts to uppercase a string argument passed by reference.

Visual FoxPro Code

SET LIBRARY TO LOAD

x = "abc"

= XUPPER(@x)

? x

C Code

#include <pro_ext.h>

void FAR Upper(ParamBlk FAR *parm)

{

char FAR *pString;

Value val;

int i;

//

//	_Load() and _Store are the functions of interest for pass-by-reference.

//

_Load(&parm->p[0].loc, &val);

//

//	FoxPro doesn't check the type of pass-by-reference arguments, so we do.

//

    if (val.ev_type != 'C')

{

_Error(9); // "Data type mismatch"

}

    pString = _HandToPtr(val.ev_handle);

for (i = 0; i < val.ev_length; i++)

{

if ('a' <= *pString && *pString <= 'z')

{

*pString += ('A' - 'a');

}

pString++;

}

_Store(&parm->p[0].loc, &val);

//

// We need to free the handle that we created with  _LOAD()

//

_FreeHand(val.ev_handle);

}

FoxInfo myFoxInfo[] =

{

{"XUPPER", (FPFI) Upper, 1, "R"},

};

FoxTable _FoxTable =

{

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_ALen( )
_FindVar( )
_NameTableIndex( )
_NewVar( )
_Release( )
_Store( )


_MemAvail( ) API Library Routine

See Also	Example

Determines whether enough memory is available for you to allocate a memory handle of size bytes.

Syntax

int _MemAvail(unsigned int size)
unsigned int size;	/* Size of memory handle in bytes. */

Remarks

The function returns True (an integer other than 0) if enough memory is available, or False (0) if not.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API” in the Developer’s Guide.


_MemAvail( ) API Library Routine Example

The following example builds a linked list of 1K memory handle allocations until available memory is used. It then frees allocations and returns the number of allocations made. _MemAvail( ) is used to terminate the first while loop.

Visual FoxPro Code

SET LIBRARY TO MEMAVAIL

? MEMAVAIL()  && displays approx. memory available in K

C Code

#include <pro_ext.h>

#define ALLOCSIZE 1024

FAR Example(ParamBlk FAR *parm)

{

int nHandles = 0;

MHANDLE head = 0, mh;

while (_MemAvail(ALLOCSIZE))

{

mh = _AllocHand(ALLOCSIZE);

*((MHANDLE *) _HandToPtr(mh)) = head;

head = mh;

nHandles++;

}

_RetInt(nHandles, 10);

while (head != 0)

{

mh = *((MHANDLE *) _HandToPtr(head));

_FreeHand(head);

head = mh;

}

}

FoxInfo myFoxInfo[] = {

{"MEMAVAIL", (FPFI) Example, 0, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_AllocHand( )
_FreeHand( )
_GetHandSize( )
_HandToPtr( )
_HLock( )
_HUnLock( )
_SetHandSize( )


_MemCmp( ) API Library Routine

See Also	Example

Compares two length byte memory areas.

Syntax

int _MemCmp(void FAR *ptr1, void FAR *ptr2, unsigned int length)
void FAR *ptr1;	/* First point to start compare. */
void FAR *ptr2;	/* Second point to start compare. */
unsigned int length;	/* How much to compare in bytes. */

Remarks

_MemCmp( ) compares each byte in the two areas, starting with the leftmost byte in each, until two bytes don’t match. _MemCmp( ) returns 0 if all bytes in the areas match, a positive number if the first unmatched byte in the first area is greater than the corresponding byte in the second area, or a negative number if the first unmatched byte in the second area is greater than the corresponding byte in the first area.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API” in the Developer’s Guide.


_MemCmp( ) API Library Routine Example

The following example uses _MemCmp( ) to compare two character parameters up to the length of the first unmatched byte.

Visual FoxPro Code

SET LIBRARY TO MEMCMP

? MEMCMP("Hello, world.", "Hello, world.")  && returns 0

? MEMCMP("Hello, world.", "Hello, wurld.")  && returns non-0

C Code

#include <pro_ext.h>

#define min(a, b) ((a) < (b) ? (a) : (b))

FAR Example(ParamBlk FAR *parm)

{

int LenToCmp, RetValue;

LenToCmp = min(parm->p[0].val.ev_length, parm->p[1].val.ev_length);

_HLock(parm->p[0].val.ev_handle);

_HLock(parm->p[1].val.ev_handle);

RetValue = _MemCmp(_HandToPtr(parm->p[0].val.ev_handle),

_HandToPtr(parm->p[1].val.ev_handle), LenToCmp);

_RetInt(RetValue, 10); // does return control here

_HUnLock(parm->p[0].val.ev_handle);

_HUnLock(parm->p[1].val.ev_handle);

}

FoxInfo myFoxInfo[] = {

{"MEMCMP", (FPFI) Example, 2, "C,C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_MemFill( )
_MemMove( )


_MemFill( ) API Library Routine

See Also	Example

Fills an area of memory starting at the location pointed to by ptr with length copies of the byte in character.

Syntax

void _MemFill(void FAR *ptr, int character, unsigned int length)
void FAR *ptr;	/* Starting point for fill. */
int character;	/* Character for fill. */
unsigned int length;	/* How many bytes to fill. */


_MemFill( ) API Library Routine Example

The following example uses _MemFill( ) to duplicate the functionality of the Visual FoxPro function REPLICATE( ).

Visual FoxPro Code

SET LIBRARY TO MEMFILL

x = xREPLICATE("x", 120)

? x

? LEN(x)

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

char FAR *rep;

char c = *(char *) _HandToPtr(parm->p[0].val.ev_handle);

rep = _Alloca((int) parm->p[1].val.ev_long + 1);

_MemFill(rep, c, (int) parm->p[1].val.ev_long);

    rep[parm->p[1].val.ev_long] = '\0';

_RetChar(rep);

}

FoxInfo myFoxInfo[] = {

{"XREPLICATE", (FPFI) Example, 2, "C,I"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_MemCmp( )
_MemMove( )


_MemMove( ) API Library Routine

See Also	Example

Copies length bytes starting from src to dest.

Syntax

void _MemMove(void FAR *dest, void FAR *src, unsigned int length)
void FAR *dest;	/* Destination. */
void FAR *src;	/* Starting position. */
unsigned int length;	/* How many bytes to move. */

Remarks

Overlapping moves are performed in the appropriate direction to prevent data corruption.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API” in the Developer’s Guide.


_MemMove( ) API Library Routine Example

The following example uses _MemMove( ) to implement a substring function. From Visual FoxPro, MEMMOVE(s, n1, n2) returns the substring of s starting from position n1 and through position n2.

Visual FoxPro Code

SET LIBRARY TO MEMMOVE

? MEMMOVE("Hello, world.", 8, 10)  && returns "wor"

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

int SubstrLen;

MHANDLE bufferHandle;

char FAR *FirstDest;

SubstrLen = parm->p[2].val.ev_long - parm->p[1].val.ev_long + 1;

if ((bufferHandle = _AllocHand(SubstrLen + 1)) == 0)

{

_Error(182); // "Insufficient memory"

}

_HLock(bufferHandle);

_HLock(parm->p[0].val.ev_handle);

FirstDest = (char FAR *) _HandToPtr(parm->p[0].val.ev_handle) +

parm->p[1].val.ev_long - 1;

_MemMove(_HandToPtr(bufferHandle), FirstDest, SubstrLen);

((char FAR *) _HandToPtr(bufferHandle))[SubstrLen] = '\0';

_RetChar(_HandToPtr(bufferHandle));

_HUnLock(bufferHandle);

_HUnLock(parm->p[0].val.ev_handle);

}

FoxInfo myFoxInfo[] = {

{"MEMMOVE", (FPFI) Example, 3, "C,I,I"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_MemCmp( )
_MemFill( )


_MemoChan( ) API Library Routine

See Also	Example

Returns the file channel of the memo file associated with the specified workarea.

Syntax

FCHAN _MemoChan(int workarea)
int workarea;	/* Work area number. */

Remarks

If no database is open in that work area or the database has no memo file, _MemoChan( ) returns  – 1.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API” in the Developer’s Guide.


_MemoChan( ) API Library Routine Example

The following example retrieves the contents of a memo field. _MemoChan( – 1) returns a file channel to the memo file for the current work area. This FCHAN is used as an argument to the low-level file I/O API callbacks.

Visual FoxPro Code

SET LIBRARY TO MEMOCHAN

CREATE TABLE WMemo (MemoField M)

APPEND BLANK

REPLACE MemoField WITH "Hello, World."

? GETMEMO(@MemoField)

C Code

#include <pro_ext.h>

FAR FindMemoEx(ParamBlk FAR *parm)

{

Locator FAR *memoFldLoc;

FCHAN fchMemo;

char FAR *memoContents;

int memoLen;

long loc;

if ((fchMemo = _MemoChan(-1)) == -1)

{

_UserError("_MemoChan() failed");

}

memoFldLoc = &parm->p[0].loc;

if ((loc = _FindMemo(memoFldLoc)) < 0)

{

_UserError("_FindMemo() failed");

}

if ((memoLen = _MemoSize(memoFldLoc)) < 0)

{

_UserError("_MemoSize() failed");

}

if ((memoContents = _Alloca(memoLen + 1)) == 0)

{

_Error(182); // "Insufficient memory"

}

_FSeek(fchMemo, loc, FS_FROMBOF);

_FRead(fchMemo, memoContents, memoLen);

memoContents[memoLen] = '\0';

_RetChar(memoContents);

}

FoxInfo myFoxInfo[] = {

{"GETMEMO", (FPFI) FindMemoEx, 1, "R"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_AllocMemo( )
_DBReplace( )
_FindMemo( )
_FOpen( )
_MemoSize( )


_MemoSize( ) API Library Routine

See Also	Example

Returns the length of the specified memo field in the memo file for the current record.

Syntax

long _MemoSize(Locator FAR *fld)
Locator FAR *fld;	/* Memo field address. */

Remarks

When the memo field for the current record is empty, or when fld isn’t a memo field, _MemoSize( ) returns a negative integer whose absolute value is a Visual FoxPro error number.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API” in the Developer’s Guide.


_MemoSize( ) API Library Routine Example

The following example retrieves the contents of a memo field for the current record. _MemoSize( ) is used to determine how much memory should be allocated for a buffer, and how many bytes should be read from the memo file.

Visual FoxPro Code

SET LIBRARY TO MEMOSIZE

CREATE TABLE WMemo (MemoField M)

APPEND BLANK

REPLACE MemoField WITH "Hello, World."

? GETMEMO(@MemoField)

C Code

#include <pro_ext.h>

FAR FindMemoEx(ParamBlk FAR *parm)

{

Locator FAR *memoFldLoc;

FCHAN fchMemo;

char FAR *memoContents;

int memoLen;

long loc;

if ((fchMemo = _MemoChan(-1)) == -1)

{

_UserError("_MemoChan() failed");

}

memoFldLoc = &parm->p[0].loc;

if ((loc = _FindMemo(memoFldLoc)) < 0)

{

_UserError("_FindMemo() failed");

}

if ((memoLen = _MemoSize(memoFldLoc)) < 0)

{

_UserError("_MemoSize() failed");

}

if ((memoContents = _Alloca(memoLen + 1)) == 0)

{

_Error(182); // "Insufficient memory"

}

_FSeek(fchMemo, loc, FS_FROMBOF);

_FRead(fchMemo, memoContents, memoLen);

memoContents[memoLen] = '\0';

_RetChar(memoContents);

}

FoxInfo myFoxInfo[] = {

{"GETMEMO", (FPFI) FindMemoEx, 1, "R"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_AllocMemo( )
_DBReplace( )
_FindMemo( )
_MemoChan( )


_MenuId( ) API Library Routine

See Also	Example

Returns the menu identifier that corresponds to the system-defined literal for the system menu or menu title.

Syntax

MENUID _MenuId(long literal)
long literal;	/* System-defined literal. */

Remarks

Literals are defined in the API include file PRO_EXT.H.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API” in the Developer’s Guide.


_MenuId( ) API Library Routine Example

The following example adds a menu title to the system menu. It then attaches a drop-down menu with two items on it. _MenuId( ) is used to obtain the MENUID of the system menu.

Visual FoxPro Code

SET LIBRARY TO MENUID

C Code

#include <pro_ext.h>

MENUID SysMenuId;

MENUID PopupId;

ITEMID PadId;

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 10;

_PutValue(&val);

}

FAR onSelection(long menuId, long itemId)

{

_PutStr("\nitemId = "); putLong(itemId);

}

void FAR StartUp()

{

ITEMID Bar1Id;

ITEMID Bar2Id;

int Error;

// Add new menu title to SYSMENU.

SysMenuId = _MenuId(_SYSMENU);

PadId = _GetNewItemId(SysMenuId);

if (_NewItem(SysMenuId, PadId, _LASTITEM, "\\<Added menu title"))

{

_Error(623); /* "Menu item cannot be defined." */

}

// Define menu.

PopupId = _GetNewMenuId();

if (Error = _NewMenu(MPOPUP, PopupId))

{

_Error(-Error);

}

Bar1Id = _GetNewItemId(PopupId);

// WARNING: Call _NewItem() before another _GetNewItemId().

if (_NewItem(PopupId, Bar1Id, _LASTITEM, "\\<1st item"))

{

_Error(623); /* "Menu item cannot be defined." */

}

Bar2Id = _GetNewItemId(PopupId);

if (_NewItem(PopupId, Bar2Id, _LASTITEM, "\\<2nd item"))

{

_Error(623); /* "Menu item cannot be defined." */

}

// Attach menu to menu title

_SetItemSubMenu(SysMenuId, PadId, PopupId);

// Set up selection action.

_OnSelection(PopupId, -1, onSelection);

}

void FAR ShutDown()

{

_DisposeItem(SysMenuId, PadId);

_DisposeMenu(PopupId);

}

FoxInfo myFoxInfo[] = {

{"STARTUP",	(FPFI) StartUp,	CALLONLOAD,""},

{"SHUTDOWN",	(FPFI) ShutDown,	CALLONUNLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_GetNewMenuId( )


_MenuInteract( ) API Library Routine

See Also	Example

Sets the itemid and the menuid to indicate which menu item was chosen, if any.

Syntax

int _MenuInteract(MENUID FAR *menuid, ITEMID FAR *itemid)
MENUID FAR *menuid;	/* Pointer to menu identifier. */
ITEMID FAR *itemid;	/* Pointer to menu item identifier. */

Remarks

If the user chooses any menu item, _MenuInteract( ) returns 1. If no item is chosen (for example, if the user presses ESC) _MenuInteract( ) returns 0.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API” in the Developer’s Guide.


_MenuInteract( ) API Library Routine Example

The following example builds a menu with three items, and then requires the user to interact with the menu by calling _MenuInteract( ).

Visual FoxPro Code

SET LIBRARY TO MENUINTE

C Code

#include <pro_ext.h>

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 10;

_PutValue(&val);

}

FAR GetNewItemId(ParamBlk FAR *parm)

{

MENUID menuId;

ITEMID itemId;

Point loc;

menuId = _GetNewMenuId();

_NewMenu(MPOPUP, menuId);

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<1st item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<2nd item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<3rd item");

loc.v = 10; loc.h = 20;

_SetMenuPoint(menuId, loc);

_MenuInteract(&menuId, &itemId);

_PutStr("\nmenuId ="); putLong(menuId);

_PutStr("\nitemId ="); putLong(itemId);

_DisposeMenu(menuId);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) GetNewItemId, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_OnSelection( )


_MousePos( ) API Library Routine

See Also	Example

Fills in pt with the current position of the mouse pointer.

Syntax

int _MousePos(Point FAR *pt)
Point FAR *pt;	/* Pointer. */

Remarks

_MousePos( ) returns True (an integer other than 0) if the left mouse button is down when the function is called, or False (0) if the left mouse button isn’t down.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API” in the Developer’s Guide.


_MousePos( ) API Library Routine Example

The following example displays the current mouse pointer position until it detects a left mouse button click.

Visual FoxPro Code

SET LIBRARY TO MOUSEPOS

C Code

#include <pro_ext.h>

void putLong(long n, int width)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = width;

_PutValue(&val);

}

FAR MousePosEx(ParamBlk FAR *parm)

{

Point mousePos;

while (!_MousePos(&mousePos))

{

_PutStr("\nvertical =");

putLong(mousePos.v, 5);

_PutStr("; horizontal =");

putLong(mousePos.h, 5);

}

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) MousePosEx, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_FindWindow( )
_GlobalToLocal( )


_MousePosP( ) API Library Routine

See Also	Example

Fills in pt with the current position of the mouse pointer in pixels.

Syntax

int _MousePosP(Point FAR *pt)
Point FAR *pt;	/* Pointer. */

Remarks

_MousePosP( ) returns True (an integer other than 0) if the left mouse button is down when the function is called, or False (0) if the left mouse button isn’t down.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API” in the Developer’s Guide.


_MousePosP( ) API Library Routine Example

The following example displays the current mouse pointer position until it detects a left mouse button click.

Visual FoxPro Code

SET LIBRARY TO MOUSEPOP

C Code

#include <pro_ext.h>

void putLong(long n, int width)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = width;

_PutValue(&val);

}

FAR MousePosPEx(ParamBlk FAR *parm)

{

Point mousePos;

while (!_MousePosP(&mousePos))

{

_PutStr("\nvertical =");

putLong(mousePos.v, 5);

_PutStr("; horizontal =");

putLong(mousePos.h, 5);

}

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) MousePosPEx, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_FindWindow( )
_GlobalToLocal( )


_NameTableIndex( ) API Library Routine

See Also	Example

Returns the name table index that corresponds to a given name, or returns  – 1 if that name isn’t in the name table.

Syntax

NTI _NameTableIndex(char FAR *name)
char FAR *name;	/* Name. */

Remarks

The name may be found in the name table even though a variable with the name name doesn’t exist. To determine whether a variable with the name name exists, use _FindVar( ), specifying the name table index returned by _NameTableIndex( ) as the nti parameter.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API” in the Developer’s Guide.


_NameTableIndex( ) API Library Routine Example

The following example releases a memory variable whose name is given as a character argument. Note that _NameTableIndex( ) finds the variable name after it has been released. Therefore, _NameTableIndex( ) is used in combination with _FindVar( ) to make sure the memory variable is currently defined.

Visual FoxPro Code

SET LIBRARY TO NTI

x = 123

= XRELEASE("x")

C Code

#include <pro_ext.h>

FAR ReleaseEx(ParamBlk FAR *parm)

{

NTI nti;

char FAR *name;

int exitCode;

Locator loc;

//	Null terminate character string, name of variable

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

_HLock(parm->p[0].val.ev_handle);

name = (char FAR *) _HandToPtr(parm->p[0].val.ev_handle);

name[parm->p[0].val.ev_length] = '\0';

if ((nti = _NameTableIndex(name)) == -1)

{

_HUnLock(parm->p[0].val.ev_handle);

_UserError("Cannot find variable in name table.");

}

_HUnLock(parm->p[0].val.ev_handle);

if (_FindVar(nti, -1, &loc))

{

_PutStr("\nVariable exists prior to _Release().");

}

if ((exitCode =_Release(nti)) < 0)

{

_Error(-exitCode);

}

_HLock(parm->p[0].val.ev_handle);

name = (char FAR *) _HandToPtr(parm->p[0].val.ev_handle);

name[parm->p[0].val.ev_length] = '\0';

if ((nti = _NameTableIndex(name)) != -1)

{

_PutStr("\n_NameTableIndex() still finds variable \

after it is released.");

}

_HUnLock(parm->p[0].val.ev_handle);

if (!_FindVar(nti, -1, &loc))

{

_PutStr("\nVariable does not exist after _Release().");

}

}

FoxInfo myFoxInfo[] = {

{"XRELEASE", (FPFI) ReleaseEx, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_ALen( )
_FindVar( )
_Load( )
_NewVar( )
_Release( )
_Store( )


_NewItem( ) API Library Routine

See Also	Example

Adds an item with the specified identifier itemid to the menu specified by menuid.

Syntax

int _NewItem(MENUID menuid, ITEMID itemid, ITEMID beforeid, char FAR *prompt)
MENUID menuid;	/* Menu identifier. */
ITEMID itemid;	/* New item identifier. */
ITEMID beforeid;	/* Identifier of item the new item precedes. */
char FAR *prompt;	/* Text for new menu item. */

Remarks

The type of the new menu item is automatically a menu title or a bar, depending on the type of menu into which the item is being inserted.

The beforeid parameter specifies the identifier of the item the new item is to precede. Specify beforeid as   – 1 to specify the new item will be the first item in the list, or as -2 to specify the item is to be added at the end of the list. The prompt specifies the text for the new menu item. _NewItem( ) returns 0 if it succeeds in adding an item, or   – 1 if not.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API” in the Developer’s Guide.


_NewItem( ) API Library Routine Example

The following example builds a menu with three items. It uses _NewItem( ) to add each item to the menu.

Visual FoxPro Code

SET LIBRARY TO NEWITEM

C Code

#include <pro_ext.h>

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 10;

_PutValue(&val);

}

FAR GetNewItemId(ParamBlk FAR *parm)

{

MENUID menuId;

ITEMID itemId;

Point loc;

menuId = _GetNewMenuId();

_NewMenu(MPOPUP, menuId);

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<2nd item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -1, "\\<1st item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<3rd item");

loc.v = 10; loc.h = 20;

_SetMenuPoint(menuId, loc);

_MenuInteract(&menuId, &itemId);

_PutStr("\nmenuId ="); putLong(menuId);

_PutStr("\nitemId ="); putLong(itemId);

_DisposeMenu(menuId);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) GetNewItemId, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_SetItemCmdKey( )
__SetItemSubMenu( )


_NewMenu( ) API Library Routine

See Also	Example

Creates a new menu of the specified menu type.

Syntax

int _NewMenu(int mtype, MENUID menuid)
int mtype;	/* Menu type. */
MENUID menuid;	/* Menu identifier. */

Remarks

You can specify MPOPUP or MBAR as the mtype parameter. The menu identifier must be unique.

Use _GetNewMenuId( ) to obtain an available menu id. _NewMenu( ) returns 0 if it succeeds in creating a new menu. If it’s unsuccessful, _NewMenu( ) returns a negative integer whose absolute value is a Visual FoxPro error number.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API” in the Developer’s Guide.


_NewMenu( ) API Library Routine Example

The following example uses _NewMenu( ) to create a menu.

Visual FoxPro Code

SET LIBRARY TO NEWMENU

C Code

#include <pro_ext.h>

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 10;

_PutValue(&val);

}

FAR GetNewItemId(ParamBlk FAR *parm)

{

MENUID menuId;

ITEMID itemId;

Point loc;

menuId = _GetNewMenuId();

_NewMenu(MPOPUP, menuId);

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<2nd item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -1, "\\<1st item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<3rd item");

loc.v = 10; loc.h = 20;

_SetMenuPoint(menuId, loc);

_MenuInteract(&menuId, &itemId);

_PutStr("\nmenuId ="); putLong(menuId);

_PutStr("\nitemId ="); putLong(itemId);

_DisposeMenu(menuId);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) GetNewItemId, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_ActivateMenu( )
_GetNewMenuId( )
_MenuId( )


_NewVar( ) API Library Routine

See Also	Example

Creates a variable or an array.

Syntax

int _NewVar(char FAR *name, Locator FAR *loc, int flag)
char FAR *name;	/* Variable name. */
Locator FAR *loc;	/* Place. */
int flag;	/* Scope. */

Remarks

The variable or array name must follow standard Visual FoxPro rules for variable names. The new variable is initialized to the logical value False.

The setting of the Locator field l_subs determines the variable or array type:

•	0 – a scalar variable

•	1 – a one-dimensional array of size l_sub1

•	2 – an array of size l_sub1 by l_sub2

For more information on the Locator structure, see Chapter 28, “Accessing the Visual FoxPro API” in the Developer’s Guide.

The flag parameter can be NV_PUBLIC or NV_PRIVATE. NV_PRIVATE variables are created as though they were created by the Visual FoxPro routine that called the external routine.

If _NewVar( ) successfully creates the variable, the field l_NTI is filled in with the non-negative NTI of the created variable, and _NewVar( ) returns this number. If _NewVar( ) fails, it returns a negative integer whose absolute value is an internal Visual FoxPro error number.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API” in the Developer’s Guide.


_NewVar( ) API Library Routine Example

The following example uses _NewVar( ) to create three variables.

Visual FoxPro Code

SET LIBRARY TO NEWVAR

*

*   As defined in "pro_ext.h"

*

#define NV_PUBLIC	0

#define NV_PRIVATE	1

= xNewVar('var', 0, 0, 0, NV_PUBLIC)

DISPLAY MEMORY LIKE var

= xNewVar('onedim', 1, 5, 0, NV_PUBLIC)

DISPLAY MEMORY LIKE onedim

= xNewVar('twodim', 2, 5, 6, NV_PUBLIC)

DISPLAY MEMORY LIKE twodim

C Code

#include <pro_ext.h>

void FAR NewVarEx(ParamBlk FAR *parm)

{

char FAR *varName;

Locator loc;

int flag;

int retValue;

// Null terminate character string

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

_HLock(parm->p[0].val.ev_handle);

varName = (char FAR *) _HandToPtr(parm->p[0].val.ev_handle);

varName[parm->p[0].val.ev_length] = '\0';

loc.l_subs = parm->p[1].val.ev_long;

loc.l_sub1 = parm->p[2].val.ev_long;

loc.l_sub2 = parm->p[3].val.ev_long;

flag = parm->p[4].val.ev_long;

if ((retValue = _NewVar(varName, &loc, flag)) < 0)

{

// _NewVar() returns negative Visual FoxPro error number

_Error(-retValue);

}

_HUnLock(parm->p[0].val.ev_handle);

}

FoxInfo myFoxInfo[] = {

{"XNEWVAR", (FPFI) NewVarEx, 5, "C,I,I,I,I"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_ALen( )
_FindVar( )
_Load( )
_NameTableIndex( )
_Release( )
_Store( )


_ObjectCmp( )
_ObjectCmp( ) API Library Routine

See Also

Compares the properties of two objects and returns 0 if their properties and property values are identical.

Syntax

int _ObjectCmp(Value FAR *objct1, Value FAR *objct2)

Remarks

0 is returned if the objects have identical properties and property values. 1 is returned if an object has a property that the other object doesn't have, or if the objects have identical properties but the values of one or more properties differ.

If an error occurs (for example, if you omit one of the objects), the negative value of the corresponding Visual FoxPro error code is returned.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API” in the Developer’s Guide.


See Also

_GetObjectProperty( )
_SetObjectProperty( )


_ObjectReference( )
_ObjectReference( ) API Library Routine

See Also

Increments the reference count of an object.

Syntax

int _ObjectReference(Value FAR *objct)

Remarks

CLEAR MEMORY or CLEAR ALL releases an API object from memory.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API” in the Developer’s Guide.


See Also

_FreeObject( )
_ObjectRelease( )


_ObjectRelease( )
_ObjectRelease( ) API Library Routine

See Also

Decrements the reference count of an object.

Syntax

int _ObjectRelease(Value FAR *objct)


See Also

_FreeObject( )
_ObjectReference( )


_OnSelection( ) API Library Routine

See Also	Example

Specifies a routine to execute when the user chooses the specified menu and item.

Syntax

void _OnSelection(MENUID menuid, ITEMID itemid, FPFI routine)
MENUID menuid;	/* Menu identifier. */
ITEMID itemid;	/* Item identifier. */
FPFI routine;	/* Routine to execute. */

Remarks

If you specify itemid as   – 1, the routine executes when the user chooses any item on the menu. A routine associated with an individual item overrides one associated with the entire menu. To cancel a selection routine for a specified menu and item, pass (FPFI)0 as the routine parameter.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API” in the Developer’s Guide.


_OnSelection( ) API Library Routine Example

The following example creates a menu with three items. It calls _OnSelection( ) with an ITEMID parameter of  –1, indicating that the function USERCHOICE( ) is to be called when the user chooses any item from this menu.

Visual FoxPro Code

SET LIBRARY TO ONSELECT

C Code

#include <pro_ext.h>

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 10;

_PutValue(&val);

}

FAR onSelection(long menuId, long itemId)

{

_PutStr("\nitemId = "); putLong(itemId);

_DisposeMenu(menuId);

}

FAR activateMenu(ParamBlk FAR *parm)

{

MENUID menuId;

ITEMID itemId;

Point loc;

menuId = _GetNewMenuId();

_NewMenu(MPOPUP, menuId);

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<1st item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<2nd item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<3rd item");

loc.v = 10; loc.h = 20;

_SetMenuPoint(menuId, loc);

_ActivateMenu(menuId);

_OnSelection(menuId, -1, onSelection);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) activateMenu, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_ActivateMenu( )
_MenuInteract( )


_PutChr( ) API Library Routine

See Also	Example

Displays the one character char at the output position in the current output window in its normal attribute (color 0).

Syntax

void _PutChr(int char)
int char;	/* Character to display. */

Remarks

_PutChr( ) treats special characters such as newline, carriage return, and bell as control characters and doesn’t display them on the screen.

To display the character that corresponds to one of these control characters, add 256 to the value of the character.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API” in the Developer’s Guide.


_PutChr( ) API Library Routine Example

The following example uses _PutChr( ) to display all 8-bit characters on the screen.

Visual FoxPro Code

SET LIBRARY TO PUTCHR

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

int ch;

for (ch = 0; ch < 256; ch++)

{

_PutChr(ch);

}

}

FoxInfo myFoxInfo[] = {

{"PUTCHR", (FPFI) Example, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_PutStr( )
_PutValue( )


_PutStr( ) API Library Routine

See Also	Example

Displays a null-terminated string at the output position in the current output window in its normal attribute (color 0).

Syntax

void _PutStr(char FAR *str)
char FAR *str;	/* String to display. */

Remarks

_PutStr( ) treats special characters such as newline, carriage return, and bell as control characters and doesn’t display them on the screen.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API” in the Developer’s Guide.


_PutStr( ) API Library Routine Example

The following example uses _PutStr( ) to display its character type parameter in uppercase on the screen.

Visual FoxPro Code

SET LIBRARY TO PUTSTR

= XUPPER("upper")  && displays "UPPER" on the screen

C Code

#include "pro_ext.h"

void NullTerminate(Value FAR *cVal)

{

if (!_SetHandSize(cVal->ev_handle, cVal->ev_length + 1))

{

_Error(182); // "Insufficient memory"

}

((char FAR *) _HandToPtr(cVal->ev_handle))[cVal->ev_length] = '\0';

}

FAR Example(ParamBlk FAR *parm)

{

char FAR *pString;

int i;

NullTerminate(&parm->p[0].val);

pString = _HandToPtr(parm->p[0].val.ev_handle);

for (i = 0; i < parm->p[0].val.ev_length; i++)

{

if ('a' <= *pString && *pString <= 'z')

{

*pString += ('A' - 'a');

}

pString++;

}

_HLock(parm->p[0].val.ev_handle);

_PutStr(_HandToPtr(parm->p[0].val.ev_handle));

_HUnLock(parm->p[0].val.ev_handle);

}

FoxInfo myFoxInfo[] = {

{"XUPPER", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_PutChr( )
_PutValue( )


_PutValue( ) API Library Routine

See Also	Example

Writes the value val at the output position in the current output window.

Syntax

void _PutValue(Value FAR *val)
Value FAR *val;	/* Value to display. */


_PutValue( ) API Library Routine Example

The following example uses _PutValue( ) to display its Character-type parameter in uppercase on the screen.

Visual FoxPro Code

SET LIBRARY TO PUTVALUE

= XUPPER("upper")  && displays "UPPER" on screen

C Code

#include "pro_ext.h"

void NullTerminate(Value FAR *cVal)

{

if (!_SetHandSize(cVal->ev_handle, cVal->ev_length + 1))

{

_Error(182); // "Insufficient memory"

}

((char FAR *) _HandToPtr(cVal->ev_handle))[cVal->ev_length] = '\0';

}

FAR Example(ParamBlk FAR *parm)

{

char FAR *pString;

int i;

NullTerminate(&parm->p[0].val);

pString = _HandToPtr(parm->p[0].val.ev_handle);

for (i = 0; i < parm->p[0].val.ev_length; i++)

{

if ('a' <= *pString && *pString <= 'z')

{

*pString += ('A' - 'a');

}

pString++;

}

_PutValue(&parm->p[0].val);

}

FoxInfo myFoxInfo[] = {

{"XUPPER", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_PutChr( )
_PutStr( )


_Release( ) API Library Routine

See Also	Example

Releases from memory the specified memory variable or array.

Syntax

int _Release(NTI n)
NTI n;	/* NTI number of variable or array to release. */

Remarks

_Release( ) returns 0 if it successfully releases the memory variable or array, or an integer whose absolute value is a Visual FoxPro error number if it fails.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_Release( ) API Library Routine Example

The following example releases a memory variable whose name is given as a character argument. _NameTableIndex( ) is used to find the NTI of the variable.

Visual FoxPro Code

SET LIBRARY TO RELEASE

x = 123

= XRELEASE("x")

C Code

#include <pro_ext.h>

FAR ReleaseEx(ParamBlk FAR *parm)

{

NTI nti;

char FAR *name;

int exitCode;

Locator loc;

// Null terminate character string, name of variable

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

_HLock(parm->p[0].val.ev_handle);

name = (char FAR *) _HandToPtr(parm->p[0].val.ev_handle);

name[parm->p[0].val.ev_length] = '\0';

if ((nti = _NameTableIndex(name)) == -1)

{

_HUnLock(parm->p[0].val.ev_handle);

_UserError("Cannot find variable in name table.");

}

_HUnLock(parm->p[0].val.ev_handle);

if (_FindVar(nti, -1, &loc))

{

_PutStr("\nVariable exists prior to _Release().");

}

if ((exitCode =_Release(nti)) < 0)

{

_Error(-exitCode);

}

_HLock(parm->p[0].val.ev_handle);

name = (char FAR *) _HandToPtr(parm->p[0].val.ev_handle);

name[parm->p[0].val.ev_length] = '\0';

if ((nti = _NameTableIndex(name)) != -1)

{

_PutStr("\n_NameTableIndex() still finds variable \

after it is released.");

}

_HUnLock(parm->p[0].val.ev_handle);

if (!_FindVar(nti, -1, &loc))

{

_PutStr("\nVariable does not exist after _Release().");

}

}

FoxInfo myFoxInfo[] = {

{"XRELEASE", (FPFI) ReleaseEx, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_ALen( )
_RetCurrency( )
_RetDateTimeStr( )
_FindVar( )
_Load( )
_NameTableIndex( )
_NewVar( )
_Store( )


_RetChar( ) API Library Routine

See Also	Example

Sets the library return value to a null-terminated string.

Syntax

void _RetChar(char FAR *string)
char FAR *string;	/* String. */

Remarks

If you need to return a string that might contain embedded null characters, use the _RetVal( ) function.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_RetChar( ) API Library Routine Example

The following example makes two calls to _RetChar( ), demonstrating that control returns to the API routine from _RetChar( ) and that the last _RetChar( ) determines the value returned to Visual FoxPro.

Visual FoxPro Code

SET LIBRARY TO RETCHAR

C Code

#include <pro_ext.h>

void FAR chars(ParamBlk FAR *parm)

{

char message[] = "Hello, world";

_RetChar(message);

}

FoxInfo myFoxInfo[] = {

{"CHARS", (FPFI) chars, 0, ""}

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_RetCurrency( )
_RetDateStr( )
_RetDateTimeStr( )
_RetFloat( )
_RetInt( )
_RetLogical( )
_RetVal( )


_RetCurrency( ) API Library Routine

See Also	Example

Sets the library return value to a currency value.

Syntax

void _RetCurrency(CCY money, int width)
CCY money;	/* CCY - LARGE_INTEGER. */
int width;	/* Number of columns to display. */

Remarks

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_RetCurrency( ) API Library Routine Example

The following example converts a numeric type value to currency type value.

Visual FoxPro Code

SET LIBRARY TO RETCURR

? xntom(100.1)

C Code

#include <pro_ext.h>

#include <math.h>

void FAR retcurr(ParamBlk FAR *parm)

{

CCY money;

money.HighPart = (long) (parm->p[0].val.ev_real*10000 / pow(2,32));

money.LowPart = (unsigned long) ((parm->p[0].val.ev_real - (double) (money.HighPart * pow(2,32)/10000.0)) *10000);

_RetCurrency(money,25);

}

FoxInfo myFoxInfo[] = {

{"XNTOM", (FPFI) retcurr, 1, "N"}

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_RetChar( )
_RetDateStr( )
_RetDateTimeStr( )
_RetFloat( )
_RetInt( )
_RetLogical( )
_RetVal( )


_RetDateStr( ) API Library Routine

See Also	Example

Sets the library return value to a date.

Syntax

void _RetDateStr(char FAR *string)
char FAR *string;	/* Date string. */

Remarks

Specify the date string in mm/dd/year format, in which the year may be either two or four digits.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_RetDateStr( ) API Library Routine Example

The following example converts a character string into a date data type and returns it to Visual FoxPro.

Visual FoxPro Code

SET LIBRARY TO RETDATES

? DATES("02/16/95")  && returns date {02/16/95}

C Code

#include <pro_ext.h>

void FAR dates(ParamBlk FAR *parm)

{

MHANDLE mh;

char FAR *instring;

if ((mh = _AllocHand(parm->p[0].val.ev_length + 1)) == 0)

{

_Error(182); // "Insufficient memory"

}

_HLock(parm->p[0].val.ev_handle);

instring = _HandToPtr(parm->p[0].val.ev_handle);

instring[parm->p[0].val.ev_length] = '\0';

_RetDateStr(instring);

_HUnLock(parm->p[0].val.ev_handle);

}

FoxInfo myFoxInfo[] = {

{"DATES", (FPFI) dates, 1, "C"}

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_RetChar( )
_RetCurrency( )
_RetDateTimeStr( )
_RetFloat( )
_RetInt( )
_RetLogical( )
_RetVal( )


_RetDateTimeStr( ) API Library Routine

See Also	Example

Sets the library return value to a datetime.

Syntax

void _RetDateTimeStr(char FAR *string)
char FAR *string;	/* Datetime string. */

Remarks

Specify the datetime string in mm/dd/year hh:mm:ss format, in which the year may be either two or four digits. See CTOT( ) for a list of valid datetime formats for the datetime string.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_RetDateTimeStr( ) API Library Routine Example

The following example converts a date type value to datetime type value.

Visual FoxPro Code

SET LIBRARY TO RETDT

? xctot("2/16/95 12:07am")

C Code

#include <pro_ext.h>

void FAR datetime(ParamBlk FAR *parm)

{

    MHANDLE mh;

    char FAR *instring;

if ((mh = _AllocHand(parm->p[0].val.ev_length + 1)) == 0) {

_Error(182); // "Insufficient memory"

}

_HLock(parm->p[0].val.ev_handle);

instring = _HandToPtr(parm->p[0].val.ev_handle);

instring[parm->p[0].val.ev_length] = '\0';

_RetDateTimeStr(instring);

_HUnLock(parm->p[0].val.ev_handle);

}

FoxInfo myFoxInfo[] = {

{"XCTOT", (FPFI) datetime, 1, "C"}

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

CTOT( )
_RetChar( )
_RetCurrency( )
_RetFloat( )
_RetInt( )
_RetLogical( )
_RetVal( )


_RetFloat( ) API Library Routine

See Also	Example

Sets the library return value to a float value.

Syntax

void _RetFloat(double flt, int width, int dec)
double flt;	/* Double precision floating point value. */
int width;	/* Number of columns for number display. */
int dec;	/* Number of decimal places. */

Remarks

The width parameter specifies the number of columns Visual FoxPro uses when displaying the number, including a decimal point if one is needed. If you don’t know the width, use 20. The dec parameter specifies the number of decimal places in the number. You must correctly set the number of decimal places to guarantee that Visual FoxPro correctly processes the number. If the number of decimal places isn’t zero, the width must be at least two greater than dec.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_RetFloat( ) API Library Routine Example

The following example uses _RetFloat( ) to return the floating point representation of a Visual FoxPro date parameter.

Visual FoxPro Code

SET LIBRARY TO RETFLOAT

? RETFLOAT({2/16/95})  && returns float representation of date {2/16/95}

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

_RetFloat(parm->p[0].val.ev_real, 20, 4);

}

FoxInfo myFoxInfo[] = {

{"RETFLOAT", (FPFI) Example, 1, "D"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_RetChar( )
_RetCurrency( )
_RetDateStr( )
_RetDateTimeStr( )
_RetInt( )
_RetLogical( )
_RetVal( )


_RetInt( ) API Library Routine

See Also	Example

Sets the library return value to a numeric value.

Syntax

void _RetInt(long ival, int width)
long ival;	/* Long integer value. */
int width;	/* Number of columns to display number. */

Remarks

The width parameter specifies the number of columns Visual FoxPro uses when displaying the number. If you don’t know the width, use 10.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_RetInt( ) API Library Routine Example

The following example performs some operations on the table open in the current work area. It displays the value returned by _RecCount( ).

Visual FoxPro Code

SET LIBRARY TO RETINT

? CTEST()

C Code

#include  <pro_ext.h>

#define nl _PutChr('\n')

long FAR CTest()

{

long rc,rec;

int workarea = -1;

int flag = 0;

int rn,recn;

rc = _DBRewind(workarea);

_PutStr("top");  nl;

rc = _DBSkip(workarea, 5);

_PutStr("skipped 5");  nl;

rc = _DBAppend(workarea,flag);

_PutStr("Appending");   nl;

rc = _DBRewind(workarea);

_PutStr("top");  nl;

rn = _DBRecCount(workarea);

_RetInt(rn, 10);

rec = rn;

return rn;

}

FoxInfo myFoxInfo[] = {

{"CTEST", (FPFI) CTest,0 , ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *)0, sizeof(myFoxInfo) / sizeof(FoxInfo), myFoxInfo

};


See Also

_RetChar( )
_RetCurrency( )
_RetDateStr( )
_RetDateTimeStr( )
_RetFloat( )
_RetLogical( )
_RetVal( )


_RetLogical( ) API Library Routine

See Also	Example

Sets the library return value to a logical value.

Syntax

void _RetLogical(int flag)
int flag;	/* Flag. */

Remarks

_RetLogical( ) considers zero to be False, and any non-zero value to be True.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_RetLogical( ) API Library Routine Example

The following example is a coin flip. It returns .T. or .F. based on the library function RAND( ).

Visual FoxPro Code

SET LIBRARY TO RETLOGIC

? RETLOGICAL()  && returns .T. or .F. pseudo-randomly

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

_RetLogical(rand() % 2);

}

FoxInfo myFoxInfo[] = {

{"RETLOGICAL", (FPFI) Example, 0, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_RetChar( )
_RetCurrency( )
_RetDateStr( )
_RetDateTimeStr( )
_RetFloat( )
_RetInt( )
_RetVal( )


_RetVal( ) API Library Routine

See Also	Example

Returns any Visual FoxPro data type, except Memo.

Syntax

void _RetVal(Value FAR *val)
Value FAR *val;	/* Pointer to value structure. */

Remarks

_RetVal( ) passes a complete Visual FoxPro Value structure. You must call _RetVal( ) to return a string that contains embedded null characters.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_RetVal( ) API Library Routine Example

The following example uses _RetVal( ) to return its Character-type parameter converted to uppercase.

Visual FoxPro Code

SET LIBRARY TO RETVAL

? XUPPER("upper")  && returns "UPPER"

C Code

#include "pro_ext.h"

void NullTerminate(Value FAR *cVal)

{

if (!_SetHandSize(cVal->ev_handle, cVal->ev_length + 1)) {

_Error(182); // "Insufficient memory"

}

((char FAR *) _HandToPtr(cVal->ev_handle))[cVal->ev_length] = '\0';

}

FAR Example(ParamBlk FAR *parm)

{

char FAR *pString;

int i;

NullTerminate(&parm->p[0].val);

pString = _HandToPtr(parm->p[0].val.ev_handle);

for (i = 0; i < parm->p[0].val.ev_length; i++)

{

if ('a' <= *pString && *pString <= 'z')

{

*pString += ('A' - 'a');

}

pString++;

}

_RetVal(&parm->p[0].val);

}

FoxInfo myFoxInfo[] = {

{"XUPPER", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_RetChar( )
_RetCurrency( )
_RetDateStr( )
_RetDateTimeStr( )
_RetFloat( )
_RetInt( )
_RetLogical( )


_SetHandSize( ) API Library Routine

See Also	Example

Changes the amount of memory allocated to the memory block handle hand.

Syntax

int _SetHandSize(MHANDLE hand, unsigned int size)
MHANDLE hand;	/* Memory block handle. */
unsigned int size;	/* New number of bytes. */

Remarks

_SetHandSize( ) returns True (an integer other than 0) if the reallocation is successful, or False (0) if the reallocation fails. The data associated with the MHANDLE is preserved. If hand is a locked MHANDLE, _SetHandSize( ) fails.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_SetHandSize( ) API Library Routine Example

The following example uses _SetHandSize( ) to change the amount of memory allocated to an MHANDLE.

Visual FoxPro Code

SET LIBRARY TO SETHANDS

= HANDTOPTR("Hello, world.") && displays "Hello, world" on screen

C Code

#include <pro_ext.h>

void NullTerminate(Value FAR *cVal)

{

if (!_SetHandSize(cVal->ev_handle, cVal->ev_length + 1))

{

_Error(182); // "Insufficient memory"

}

((char FAR *) _HandToPtr(cVal->ev_handle))[cVal->ev_length] = '\0';

}

FAR Example(ParamBlk FAR *parm)

{

NullTerminate(&parm->p[0].val);

_HLock(parm->p[0].val.ev_handle);

_PutStr(_HandToPtr(parm->p[0].val.ev_handle));

_HUnLock(parm->p[0].val.ev_handle);

}

FoxInfo myFoxInfo[] = {

{"HANDTOPTR", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_AllocHand( )
_FreeHand( )
_GetHandSize( )
_HandToPtr( )
_HLock( )
_HUnLock( )
_MemAvail( )


_SetItemCmdKey( ) API Library Routine

See Also	Example

Sets both the keyboard shortcut for the specified menu item, and the displayed text for the keyboard shortcut.

Syntax

void _SetItemCmdKey(MENUID menuid, ITEMID itemid, int key, char FAR *text)
MENUID menuid;	/* Menu identifier. */
ITEMID itemid;	/* Menu item identifier. */
int key;	/* Shortcut key. */
char FAR *text;	/* Displayed text. */

Remarks

If you don’t want to display a keyboard shortcut, pass text as a pointer to a null string. If you want the system to generate the default displayed text, pass (char FAR *)0.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_SetItemCmdKey( ) API Library Routine Example

The following example sets up a menu with three items and assigns a keyboard shortcut to each item.

Visual FoxPro Code

SET LIBRARY TO SETICMDK

C Code

#include <pro_ext.h>

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 10;

_PutValue(&val);

}

FAR onSelection(long menuId, long itemId)

{

_PutStr("\nitemId = "); putLong(itemId);

_DisposeMenu(menuId);

}

FAR SetItemCmdKeyEx(ParamBlk FAR *parm)

{

MENUID menuId;

ITEMID itemId;

Point loc;

menuId = _GetNewMenuId();

_NewMenu(MPOPUP, menuId);

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<1st item");

_SetItemCmdKey(menuId, itemId, altKey | 0x178, "Alt+1");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<2nd item");

_SetItemCmdKey(menuId, itemId, altKey | 0x179, "Alt+2");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<3rd item");

_SetItemCmdKey(menuId, itemId, altKey | 0x17a, "Alt+3");

loc.v = 10; loc.h = 20;

_SetMenuPoint(menuId, loc);

_ActivateMenu(menuId);

_OnSelection(menuId, -1, onSelection);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) SetItemCmdKeyEx, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_GetItemCmdKey( )
_GetItemId( )


_SetItemSubMenu( ) API Library Routine

See Also	Example

Assigns a submenu to the specified menu item.

Syntax

void _SetItemSubMenu(MENUID menuid, ITEMID itemid,
MENUID submenuid)
MENUID menuid;	/* Menu identifier. */
ITEMID itemid;	/* Menu item identifier. */
MENUID submenuid;	/* Submenu identifier. */

Remarks

You can use _SetItemSubMenu( ) to attach a menu to a menu title or to a submenu to a menu item.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_SetItemSubMenu( ) API Library Routine Example

The following example adds a menu title to the system menu. Using _SetItemSubMenu( ), it then attaches a menu with two items to this menu title.

Visual FoxPro Code

SET LIBRARY TO SETISUBM

C Code

#include <pro_ext.h>

MENUID SysMenuId;

MENUID PopupId;

ITEMID PadId;

void putLong(long n)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = 10;

_PutValue(&val);

}

FAR onSelection(long menuId, long itemId)

{

_PutStr("\nitemId = "); putLong(itemId);

}

void FAR StartUp()

{

ITEMID Bar1Id;

ITEMID Bar2Id;

int Error;

// Add new menu title to SYSMENU.

SysMenuId = _MenuId(_SYSMENU);

PadId = _GetNewItemId(SysMenuId);

if (_NewItem(SysMenuId, PadId, _LASTITEM, "\\<Added menu title"))

{

_Error(623); /* "Menu item cannot be defined." */

}

// Define menu.

PopupId = _GetNewMenuId();

if (Error = _NewMenu(MPOPUP, PopupId))

{

_Error(-Error);

}

Bar1Id = _GetNewItemId(PopupId);

// WARNING: Call _NewItem() before another _GetNewItemId().

if (_NewItem(PopupId, Bar1Id, _LASTITEM, "\\<1st item"))

{

_Error(623); /* "Menu item cannot be defined." */

}

Bar2Id = _GetNewItemId(PopupId);

if (_NewItem(PopupId, Bar2Id, _LASTITEM, "\\<2nd item"))

{

_Error(623); /* "Menu item cannot be defined." */

}

// Attach menu to menu title

_SetItemSubMenu(SysMenuId, PadId, PopupId);

// Set up selection action.

_OnSelection(PopupId, -1, onSelection);

}

void FAR ShutDown()

{

_DisposeItem(SysMenuId, PadId);

_DisposeMenu(PopupId);

}

FoxInfo myFoxInfo[] = {

{"STARTUP",	 (FPFI) StartUp,	CALLONLOAD,   ""},

{"SHUTDOWN",	(FPFI) ShutDown,   CALLONUNLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_MenuId( )
_NewMenu( )


_SetItemText( ) API Library Routine

See Also	Example

Changes the displayed text for the specified menu item.

Syntax

void _SetItemText(MENUID menuid, ITEMID itemid, char FAR *text)
MENUID menuid;	/* Menu identifier. */
ITEMID itemid;	/* Menu item identifier. */
char FAR *text;	/* Text. */

Remarks

The menu item can be either a menu title or a bar.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_SetItemText( ) API Library Routine Example

The following example builds a menu with three items. It then changes the item text using _SetItemText( ).

Visual FoxPro Code

SET LIBRARY TO SETITEXT

C Code

#include <pro_ext.h>

FAR SetItemTextEx(ParamBlk FAR *parm)

{

MENUID menuId;

ITEMID itemId;

Point loc;

menuId = _GetNewMenuId();

_NewMenu(MPOPUP, menuId);

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<1st item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<2nd item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<3rd item");

loc.v = 10; loc.h = 20;

_SetMenuPoint(menuId, loc);

_ActivateMenu(menuId);

_Execute("WAIT WINDOW 'Original item text'");

_SetItemText(menuId, _GetItemId(menuId, 0),

"This was the 1st item");

_SetItemText(menuId, _GetItemId(menuId, 1),

"This was the 2nd item");

_SetItemText(menuId, _GetItemId(menuId, 2),

"This was the 3rd item");

_Execute("WAIT WINDOW 'New item text'");

_DisposeMenu(menuId);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) SetItemTextEx, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_GetItemId( )
_GetItemText( )


_SetMenuPoint( ) API Library Routine

See Also	Example

Specifies the screen position of the upper-left corner, loc, of a menu.

Syntax

void _SetMenuPoint(MENUID menuid, Point loc)
MENUID menuid;	/* Menu identifier. */
Point loc;	/* Position of upper-left corner of the menu. */

Remarks

Normally, a menu is automatically positioned based upon its size and how the user invoked it. This routine is provided to override automatic positioning.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_SetMenuPoint( ) API Library Routine Example

A menu is created and then activated at three different screen positions specified by _SetMenuPoint( ).

Visual FoxPro Code

SET LIBRARY TO SETMNPNT

C Code

#include <pro_ext.h>

FAR SetMenuPointEx(ParamBlk FAR *parm)

{

MENUID menuId;

ITEMID itemId;

Point loc;

menuId = _GetNewMenuId();

_NewMenu(MPOPUP, menuId);

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<1st item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<2nd item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<3rd item");

loc.v = 10; loc.h = 20;

_SetMenuPoint(menuId, loc);

_MenuInteract(&menuId, &itemId);

loc.v = 15; loc.h = 30;

_SetMenuPoint(menuId, loc);

_MenuInteract(&menuId, &itemId);

loc.v = 20; loc.h = 40;

_SetMenuPoint(menuId, loc);

_MenuInteract(&menuId, &itemId);

_DisposeMenu(menuId);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) SetMenuPointEx, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_NewMenu( )


_SetMenuPointP( ) API Library Routine

See Also	Example

Specifies in pixels the screen position of the upper-left corner, loc, of a menu.

Syntax

void _SetMenuPointP(MENUID menuid, Point loc)
MENUID menuid;	/* Menu identifier. */
Point loc;	/* Position of upper left corner of the menu. */

Remarks

Normally, a menu is automatically positioned based upon its size and how the user invoked it. This routine is provided to override automatic positioning.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_SetMenuPointP( ) API Library Routine Example

The following example creates a menu and then activates it at three different screen positions specified by _SetMenuPointP( ).

Visual FoxPro Code

SET LIBRARY TO SETMNPTP

C Code

#include <pro_ext.h>

FAR SetMenuPointPEx(ParamBlk FAR *parm)

{

MENUID menuId;

ITEMID itemId;

Point loc;

menuId = _GetNewMenuId();

_NewMenu(MPOPUP, menuId);

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<1st item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<2nd item");

itemId = _GetNewItemId(menuId);

_NewItem(menuId, itemId, -2, "\\<3rd item");

loc.v = 40; loc.h = 80;

_SetMenuPointP(menuId, loc);

_MenuInteract(&menuId, &itemId);

loc.v = 80; loc.h = 160;

_SetMenuPointP(menuId, loc);

_MenuInteract(&menuId, &itemId);

loc.v = 160; loc.h = 320;

_SetMenuPointP(menuId, loc);

_MenuInteract(&menuId, &itemId);

_DisposeMenu(menuId);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", SetMenuPointPEx, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_NewMenu( )


_SetObjectProperty( )
_SetObjectProperty( ) API Library Routine

See Also

Sets a property for an object.

Syntax

int _SetObjectProperty(Value FAR *objct, char FAR *prop, Value FAR *val,
int fAdd)

Remarks

The first parameter *objct is an object reference; the second parameter *prop is the name of the property to set; the third parameter *val is the new property value.

The last parameter fAdd is either 0 or a non-zero value that specifies if the property is added to the object if the property does not exist. If fAdd is a non-zero value and property you specify does not exist for the object, the property is added to the object as a user-defined property, and contains the property value you specify with *val. If fAdd is 0 and the property you specify does not exist for the object, the property isn't added to the object.

_SetObjectProperty( ) returns 0 if it is successful; otherwise, the negative value of the corresponding Visual FoxPro error code is returned.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


See Also

_GetObjectProperty( )


_Store( ) API Library Routine

See Also	Example

Replaces the memory variable specified by loc with the value val.

Syntax

int _Store(Locator FAR *loc, Value FAR *val)
Locator FAR *loc;	/* Memory variable locator. */
Value FAR *val;	/* Value to store. */

Remarks

Reference individual array elements by setting l_subs to the number of subscripts you specified and l_sub1 and l_sub2 to the actual subscripts. The first element of an array is numbered 1. If loc specifies an array and l_subs is 0, _Store( ) stores the value in val to all elements in the array.

_Store( ) returns 0 if it is successful. If it fails, _Store( ) returns a negative integer whose absolute value is a Visual FoxPro error number. If _Store( ) runs out of memory while storing to an array, some values of some array elements may have been set, and others may not have been.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_Store( ) API Library Routine Example

The following example converts to uppercase a string argument passed by reference.

Visual FoxPro Code

SET LIBRARY TO STORE

x = "abc"

= XUPPER(@x)

? x

C Code

#include <pro_ext.h>

void FAR Upper(ParamBlk FAR *parm)

{

char FAR *pString;

Value val;

int i;

//

//	_Load() and _Store are the functions of interest for pass-by-reference.

//

_Load(&parm->p[0].loc, &val);

//

//	FoxPro doesn't check the type of pass-by-reference arguments, so we do.

//

if (val.ev_type != 'C') {

_Error(9); // "Data type mismatch"

}

    pString = _HandToPtr(val.ev_handle);

for (i = 0; i < val.ev_length; i++)  {

if ('a' <= *pString && *pString <= 'z') {

*pString += ('A' - 'a');

}

pString++;

}

_Store(&parm->p[0].loc, &val);

//

// We need to free the handle that we created with  _LOAD()

//

_FreeHand(val.ev_handle);

}

FoxInfo myFoxInfo[] = {

{"XUPPER", (FPFI) Upper, 1, "R"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_ALen( )
_FindVar( )
_Load( )
_NameTableIndex( )
_NewVar( )
_Release( )


_StrCmp( ) API Library Routine

See Also	Example

Compares each byte in two null-terminated strings, starting with the leftmost byte.

Syntax

int _StrCmp(char FAR *string1, char FAR *string2)
char FAR *string1;	/* First comparison string. */
char FAR *string2;	/* Second comparison string. */

Remarks

_StrCmp( ) returns 0 if string1 and string2 match, a positive number if the first unmatched byte in string1 is greater than the corresponding byte in string2, or a negative number if the first unmatched byte in string1 is less than the corresponding byte in string2.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_StrCmp( ) API Library Routine Example

The following example uses _StrCmp( ) to compare two strings passed as parameters.

Visual FoxPro Code

SET LIBRARY TO STRCMP

? STRCMP("Hello, world.", "Hello, world.")  && matches; returns 0

? STRCMP("Hello, world.", "Hello, wurld.")  && no match; returns non-0

C Code

#include <pro_ext.h>

void NullTerminate(Value FAR *cVal)

{

if (!_SetHandSize(cVal->ev_handle, cVal->ev_length + 1))

{

_Error(182); // "Insufficient memory"

}

((char FAR *) _HandToPtr(cVal->ev_handle))[cVal->ev_length] = '\0';

}

FAR Example(ParamBlk FAR *parm)

{

int RetValue;

NullTerminate(&parm->p[0].val);

NullTerminate(&parm->p[1].val);

_HLock(parm->p[0].val.ev_handle);

_HLock(parm->p[1].val.ev_handle);

RetValue = _StrCmp(_HandToPtr(parm->p[0].val.ev_handle),

_HandToPtr(parm->p[1].val.ev_handle));

_RetInt(RetValue, 10); // does return control here

_HUnLock(parm->p[0].val.ev_handle);

_HUnLock(parm->p[1].val.ev_handle);

}

FoxInfo myFoxInfo[] = {

{"STRCMP", (FPFI) Example, 2, "C,C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_StrCpy( )
_StrLen( )


_StrCpy( ) API Library Routine

See Also	Example

Copies a null-terminated string from src to dest.

Syntax

void _StrCpy(char FAR *dest, char FAR *src)
char FAR *dest;	/* Destination location. */
char FAR *src;	/* Source location. */

Remarks

_StrCpy( ) doesn’t support overlapping moves. Overlapping moves are required when src and dest have some bytes in common. If overlapping moves are required, use _MemMove( ).

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_StrCpy( ) API Library Routine Example

The following example is passed a Visual FoxPro array of type Character. It then replaces the second element using _Store( ).

Before calling MYFUNC( ), the Visual FoxPro example code creates an array and initializes it to type Character. MYFUNC( ) passes this array by reference.

Visual FoxPro Code

SET LIBRARY TO STRCPY

? STRCPY("Hello", " world")	&& returns "Hello world"

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

#define p0 (parm->p[0].val)

#define p1 (parm->p[1].val)

if (!_SetHandSize(p0.ev_handle, p0.ev_length + p1.ev_length))

_Error(182); // "Insufficient memory"

_HLock(p0.ev_handle);

_HLock(p1.ev_handle);

((char FAR *) _HandToPtr(p1.ev_handle))[p1.ev_length] = '\0';

_StrCpy((char FAR *) _HandToPtr(p0.ev_handle) + p0.ev_length,

_HandToPtr(p1.ev_handle));

_RetChar(_HandToPtr(p0.ev_handle));

_HUnLock(p0.ev_handle);

_HUnLock(p1.ev_handle);

}

FoxInfo myFoxInfo[] = {

{"STRCPY", (FPFI) Example, 2, "C,C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_StrCmp( )
_StrLen( )


_StrLen( ) API Library Routine

See Also	Example

Returns the length in bytes of the specified null-terminated string.

Syntax

int _StrLen(char FAR *string)
char FAR *string;	/* String to be measured. */


_StrLen( ) API Library Routine Example

The following example is similar to the Visual FoxPro function LEN( ), but can’t handle strings with embedded ‘\0’.

Visual FoxPro Code

SET LIBRARY TO STRLEN

? STRLEN("Hello") && returns 5

C Code

#include <pro_ext.h>

void NullTerminate(Value FAR *cVal)

{

if (!_SetHandSize(cVal->ev_handle, cVal->ev_length + 1)) {

_Error(182); // "Insufficient memory"

}

((char FAR *) _HandToPtr(cVal->ev_handle))[cVal->ev_length] = '\0';

}

FAR Example(ParamBlk FAR *parm)

{

NullTerminate(&parm->p[0].val);

_HLock(parm->p[0].val.ev_handle);

_RetInt(_StrLen(_HandToPtr(parm->p[0].val.ev_handle)), 10);

_HUnLock(parm->p[0].val.ev_handle);

}

FoxInfo myFoxInfo[] = {

{"STRLEN", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_StrCmp( )
_StrCpy( )


_UserError( ) API Library Routine

See Also	Example

Reports an error with the null-terminated text you specify in message.

Syntax

void _UserError(char FAR *message)
char FAR *message;	/* Error message. */

Remarks

The Visual FoxPro internal code for this error is 98. The code returned by the Visual FoxPro ERROR( ) function is 1098. The Visual FoxPro MESSAGE( ) function returns to the user your specified message. Control is passed to the Visual FoxPro error handler and doesn’t return.

Note   Do not call _UserError( ) in a CALLUNLOAD routine: the library will not load, due to the _UserError( ) call, and no message will be displayed.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_UserError( ) API Library Routine Example

The following example calls _UserError( ), demonstrating that execution doesn’t return to the API routine after _UserError( ).

Visual FoxPro Code

SET LIBRARY TO EXAMPLE

= EXAMPLE()

C Code

#include <pro_ext.h>

FAR UserErrorEx(ParamBlk FAR *parm)

{

_UserError("This is a _UserError() example.");

_PutStr("This should never be displayed.");

}

FoxInfo myFoxInfo[] = {

{"EXAMPLE", (FPFI) UserErrorEx, 0, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_Error( )
_ErrorInfo( )


_WAttr( ) API Library Routine

See Also	Example

Returns the attribute byte for the specified color index in the specified window’s color scheme.

Syntax

int _WAttr(WHANDLE wh, int color)
WHANDLE wh;	/* Window handle. */
int color;	/* Color index. */


_WAttr( ) API Library Routine Example

The following example goes through each color of each color scheme, showing its attribute byte as returned by _WAttr( ).

Visual FoxPro Code

SET LIBRARY TO WATTR

C Code

#include <pro_ext.h>

void putLong(long n, int width)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = width;

_PutValue(&val);

}

FAR WAttrEx(ParamBlk FAR *parm)

{

int scheme;

int color;

WHANDLE wh;

int attrib, savePen;

for (scheme = 0; scheme <= 25; scheme++)

{

wh = _WOpen(2, 10, 23, 70, WEVENT, scheme, (Scheme FAR *) 0,

WO_SYSTEMBORDER);

for (color = WA_NORMAL; color <= WA_ISSHADOW; color++)

{

attrib  = _WAttr(wh, color);

savePen = _WAttr(_WGetPort(), WA_PENCOLOR);

_WSetAttr(_WGetPort(), WA_PENCOLOR, attrib);

_PutStr("\nScheme:"); putLong(scheme, 5);

_PutStr("; Color:"); putLong(color, 5);

_PutStr("; Attribute byte:"); putLong(attrib, 5);

_WSetAttr(_WGetPort(), WA_PENCOLOR, savePen);

}

_WClose(wh);

_Execute("WAIT");

}

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) WAttrEx, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WSetAttr( )


_WBottom( ) API Library Routine

See Also	Example

Returns the row on the screen where the bottom of the specified window is located.

Syntax

int _WBottom(WHANDLE wh)
WHANDLE wh;	/* Window handle. */


_WBottom( ) API Library Routine Example

The following example displays the position of the frontmost window.

Visual FoxPro Code

SET LIBRARY TO WBOTTOM

= WPOSITION()

C Code

#include <pro_ext.h>

void putLong(long n, int width)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = width;

_PutValue(&val);

}

void FAR Example(ParamBlk FAR *parm)

{

WHANDLE wh = _WOnTop();

_PutStr("\ntop	="); putLong(_WTop(wh), 5);

_PutStr("\nleft   ="); putLong(_WLeft(wh), 5);

_PutStr("\nbottom ="); putLong(_WBottom(wh), 5);

_PutStr("\nright  ="); putLong(_WRight(wh), 5);

}

FoxInfo myFoxInfo[] = {

{"WPOSITION", (FPFI) Example, 0, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WHeight( )
_WLeft( )
_WRight( )
_WTop( )
_WWidth( )


_WBottomP( ) API Library Routine

See Also	Example

Returns the position on the screen in pixels where the bottom of the specified window is located.

Syntax

int _WBottomP(WHANDLE wh)
WHANDLE wh;	/* Window handle. */

Remarks

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_WBottomP( ) API Library Routine Example

The following example displays the position of the frontmost window.

Visual FoxPro Code

SET LIBRARY TO WBOTTOM

=WPOSITION()

C Code

#include <pro_ext.h>

void putLong(long n, int width)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = width;

_PutValue(&val);

}

void FAR Example(ParamBlk FAR *parm)

{

WHANDLE wh = _WOnTop();

_PutStr("\ntop	="); putLong(_WTopP(wh), 5);

_PutStr("\nleft   ="); putLong(_WLeftP(wh), 5);

_PutStr("\nbottom ="); putLong(_WBottomP(wh), 5);

_PutStr("\nright  ="); putLong(_WRightP(wh), 5);

}

FoxInfo myFoxInfo[] = {

{"WPOSITION", Example, 0, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WHeightP( )
_WLeftP( )
_WRightP( )
_WTopP( )
_WWidthP( )


_WClear( ) API Library Routine

See Also	Example

Erases the contents of the specified window by changing the content area to the default background color.

Syntax

void _WClear(WHANDLE wh)
WHANDLE wh;	/* Window handle. */

Remarks

The logical cursor position is unchanged.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_WClear( ) API Library Routine Example

The following example creates a window and fills it with Xs. When the user presses a key in response to a Visual FoxPro WAIT command, _WClear( ) clears the window.

Visual FoxPro Code

SET LIBRARY TO WCLEAR

C Code

#include <pro_ext.h>

FAR WClearEx(ParamBlk FAR *parm)

{

WHANDLE wh;

int row, col;

wh = _WOpen(2,2,20,70,WEVENT | CLOSE,WINDOW_SCHEME,(Scheme FAR *) 0,

WO_SYSTEMBORDER);

_WShow(wh);

for (row = 0; row < _WHeight(wh); row++)

{

for (col = 0; col < _WWidth(wh); col++)

{

_WPutChr(wh, 'X');

}

_WPutChr(wh, '\n');

}

_Execute("WAIT WINDOW 'Press any key to clear window'");

_WClear(wh);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) WClearEx, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WClearRect( )


_WClearRect( ) API Library Routine

See Also	Example

Erases the specified rectangular area of the specified window by changing the area to the default background color.

Syntax

void _WClearRect(WHANDLE wh, Rect r)
WHANDLE wh;	/* Window handle. */
Rect r;	/* Rectangle to clear. */

Remarks

The output position is unchanged.

The area of the rectangle extends from the top left coordinate to, but not including, the bottom right coordinate. This means that you should declare the bottom and right coordinates to be one more than the intended size of the rectangle.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_WClearRect( ) API Library Routine Example

The following example creates a window and fills it with Xs. After the user presses a key in response to a Visual FoxPro WAIT command, _WClearRect( ) clears a rectangular region of the window.

Visual FoxPro Code

SET LIBRARY TO WCLRECT

C Code

#include <pro_ext.h>

FAR WClearEx(ParamBlk FAR *parm)

{

WHANDLE wh;

int row, col;

Rect r;

wh = _WOpen(2,2,20,70,WEVENT | CLOSE,WINDOW_SCHEME,(Scheme FAR *) 0,

WO_SYSTEMBORDER);

_WShow(wh);

for (row = 0; row < _WHeight(wh); row++)

{

for (col = 0; col < _WWidth(wh); col++)

{

_WPutChr(wh, 'X');

}

}

_Execute("WAIT WINDOW 'Press any key to clear window rectangle'");

r.top	 = 2;

r.left	 = 2;

r.bottom = 15;

r.right  = 65;

_WClearRect(wh, r);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) WClearEx, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WClear( )


_WClearRectP( ) API Library Routine

See Also	Example

Erases the specified rectangular area of a window by changing it to the default background color.

Syntax

void _WClearRectP(WHANDLE wh, Rect r)
WHANDLE wh;	/* Window handle. */
Rect r;	/* Rectangle to clear. */

Remarks

The rectangular area is specified in pixels. The output position is unchanged.

The area of the rectangle extends from the top left position to, but not including, the bottom right position. This means that you should declare the bottom and right positions to be one pixel more than the intended size of the rectangle.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_WClearRectP( ) API Library Routine Example

The following example creates a window and fills it with Xs. After the user presses a key in response to the Visual FoxPro WAIT command, _WClearRectP( ) clears a rectangular region of the window.

Visual FoxPro Code

SET LIBRARY TO WCLRECTP

C Code

#include <pro_ext.h>

FAR WClearEx(ParamBlk FAR *parm)

{

WHANDLE wh;

int row, col;

Rect r;

wh = _WOpen(2, 2, 20, 70, CLOSE, WINDOW_SCHEME, (Scheme FAR *) 0,

WO_SYSTEMBORDER);

_WShow(wh);

for (row = 0; row < _WHeight(wh); row++)

{

for (col = 0; col < _WWidth(wh); col++)

{

_WPutChr(wh, 'X');

}

}

_Execute("WAIT WINDOW 'Press any key to clear window rectangle'");

r.top	 = 20;

r.left	 = 20;

r.bottom = 100;

r.right  = 300;

_WClearRectP(wh, r);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", WClearEx, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WClear( )


_WClose( ) API Library Routine

See Also	Example

Closes the specified window and releases all memory associated with the window.

Syntax

void _WClose(WHANDLE wh)
WHANDLE wh;	/* Window handle. */

Remarks

If the window is displayed on the screen, _WClose( ) removes it from the screen.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_WClose( ) API Library Routine Example

The following example creates and displays a window. After the user presses a key in response to a Visual FoxPro WAIT command, _WClose( ) closes the window.

Visual FoxPro Code

SET LIBRARY TO WCLOSE

C Code

#include <pro_ext.h>

FAR Ex(ParamBlk FAR *parm)

{

WHANDLE wh;

int row, col;

Rect r;

wh = _WOpen(2, 2, 20, 70, 0, WINDOW_SCHEME, (Scheme FAR *) 0,

WO_SYSTEMBORDER);

_WShow(wh);

_Execute("WAIT WINDOW 'Press any key to close window'");

_WClose(wh);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) Ex, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WOpen( )


_WFindTitle( ) API Library Routine

See Also	Example

Returns the WHANDLE of the window with the specified title.

Syntax

WHANDLE _WFindTitle(TEXT *title)
TEXT *title;	/* Window title. */


_WFindTitle( ) API Library Routine Example

The following example hides the window whose title is passed as an argument.

Visual FoxPro Code

SET LIBRARY TO WFINDTIT

CREATE TABLE X (X C(10))

BROWSE NOWAIT

SET LIBR TO WFINDTIT

= WHIDE("X")

C Code

#include <pro_ext.h>

void FAR WFindTitleEx(ParamBlk FAR *parm)

{

//	For readability:

#define pTITLE ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

WHANDLE wh;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+1))

{

_Error(182); // "Insufficient memory"

}

_HLock(parm->p[0].val.ev_handle);

pTITLE[parm->p[0].val.ev_length] = '\0';

wh = _WFindTitle(pTITLE);

_HUnLock(parm->p[0].val.ev_handle);

_WHide(wh);

}

FoxInfo myFoxInfo[] = {

{"WHIDE", (FPFI) WFindTitleEx, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WSetTitle( )


_WGetCursor( ) API Library Routine

See Also	Example

Returns the current output position in the specified window.

Syntax

Point _WGetCursor(WHANDLE wh)
WHANDLE wh;	/* Window handle. */


_WGetCursor( ) API Library Routine Example

The following example creates a window and draws a diagonal pattern of Xs in this window. It positions the cursor before writing each X using _WPosCursor( ), and gets that same position using _WGetCursor( ).

Visual FoxPro Code

SET LIBRARY TO WGETCURS

C Code

#include <pro_ext.h>

void putLong(long n, int width)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = width;

_PutValue(&val);

}

FAR Example(ParamBlk FAR *parm)

{

WHANDLE wh;

Point putPos, getPos;

wh = _WOpen(4,4,20,70,0,WINDOW_SCHEME,(Scheme FAR *) 0,

WO_SYSTEMBORDER);

_WShow(wh);

for (putPos.v = 2; putPos.v < 14; putPos.v++)

{

putPos.h = putPos.v;

_WPosCursor(wh, putPos);

getPos = _WGetCursor(wh);

_WPutChr(wh, 'X');

_PutStr("\nCursor position:");

putLong(getPos.v, 5);

putLong(getPos.h, 5);

_Execute("WAIT WINDOW");

}

_WClose(wh);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) Example, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WPosCursor( )


_WGetCursorP( ) API Library Routine

See Also	Example

Returns in pixels the current output position in the specified window.

Syntax

Point _WGetCursorP(WHANDLE wh)
WHANDLE wh;	/* Window handle. */

Remarks

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_WGetCursorP( ) API Library Routine Example

The following example creates a window and draws a diagonal pattern of Xs in this window. It positions the cursor before writing each X using _WPosCursorP( ), and gets that same position using _WGetCursorP( ).

Visual FoxPro Code

SET LIBRARY TO WGETCURP

C Code

#include <pro_ext.h>

void putLong(long n, int width)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = width;

_PutValue(&val);

}

FAR Example(ParamBlk FAR *parm)

{

WHANDLE wh;

Point putPos, getPos;

wh = _WOpen(4,4,20,70,0,WINDOW_SCHEME,(Scheme FAR *)0,

WO_SYSTEMBORDER);

_WShow(wh);

for (putPos.v = 10; putPos.v < 100; putPos.v += 10)

{

putPos.h = putPos.v;

_WPosCursorP(wh, putPos);

_WPutChr(wh, 'X');

getPos = _WGetCursorP(wh);

_PutStr("\nCursor position:");

putLong(getPos.v, 5);

putLong(getPos.h, 5);

_Execute("WAIT");

}

_WClose(wh);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", Example, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WPosCursor( )


_WGetObjectClientWindow( )
_WGetObjectClientWindow( ) API Library Routine

See Also

Returns the handle of the client window in which the specified object is contained.

Syntax

_WGetObjectClientWindow(Value FAR *objct)


See Also

_WGetObjectWindow( )


_WGetObjectWindow( )
_WGetObjectWindow( ) API Library Routine

See Also

Returns the handle of the frame window in which the specified object is contained.

Syntax

_WGetObjectWindow(Value FAR *objct)


See Also

_WGetObjectClientWindow( )


_WGetPort( ) API Library Routine

See Also	Example

Returns the WHANDLE of the window that is currently selected for user output.

Syntax

WHANDLE _WGetPort(void any)
void any;	/* Pointer. */


_WGetPort( ) API Library Routine Example

The following example displays the window handle returned by _WGetPort( ) as the current output port is changed.

Visual FoxPro Code

SET LIBRARY TO WGETPORT

C Code

#include <pro_ext.h>

void putLong(long n, int width)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = width;

_PutValue(&val);

}

FAR Example(ParamBlk FAR *parm)

{

WHANDLE wh;

WHANDLE oldPort;

wh = _WOpen(2,10,23,70,WEVENT | CLOSE,WINDOW_SCHEME,(Scheme FAR *)0,

WO_SYSTEMBORDER);

_WShow(wh);

_PutStr("\n1) _WGetPort() ="); putLong(_WGetPort(), 10);

oldPort = _WSetPort(wh);

_PutStr("\n2) _WSetPort(wh) ="); putLong(oldPort, 10);

_PutStr("\n3) _WGetPort() ="); putLong(_WGetPort(), 10);

oldPort = _WSetPort(oldPort);

_PutStr("\n4) _WSetPort(oldPort) =");  putLong(oldPort, 10);

_PutStr("\nShould be back where we started.");

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) Example, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WhToHwnd( )


_WHeight( ) API Library Routine

See Also	Example

Returns the number of rows in the content area of the specified window.

Syntax

int _WHeight(WHANDLE wh)
WHANDLE wh;	/* Window handle. */


_WHeight( ) API Library Routine Example

The following example shows the height and width in rows and columns of the frontmost window.

Visual FoxPro Code

SET LIBRARY TO WHEIGHT

=WDIMEN()

C Code

#include <pro_ext.h>

void putLong(long n, int width)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = width;

_PutValue(&val);

}

void FAR Example(ParamBlk FAR *parm)

{

WHANDLE wh = _WOnTop();

_PutStr("\nheight ="); putLong(_WHeight(wh), 5);

_PutStr("\nwidth  ="); putLong(_WWidth(wh), 5);

}

FoxInfo myFoxInfo[] = {

{"WDIMEN", (FPFI) Example, 0, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WBottom( )
_WLeft( )
_WRight( )
_WTop( )
_WWidth( )


_WHeightP( ) API Library Routine

See Also	Example

Returns the height in pixels of the content area of the specified window.

Syntax

int _WHeightP(WHANDLE wh)
WHANDLE wh;	/* Window handle. */

Remarks

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_WHeightP( ) API Library Routine Example

The following example displays the height and width in pixels of the frontmost window.

Visual FoxPro Code

SET LIBRARY TO WHEIGHTP

=WDIMEN()

C Code

#include <pro_ext.h>

void putLong(long n, int width)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = width;

_PutValue(&val);

}

void FAR Example(ParamBlk FAR *parm)

{

WHANDLE wh = _WOnTop();

_PutStr("\nheight ="); putLong(_WHeightP(wh), 5);

_PutStr("\nwidth  ="); putLong(_WWidthP(wh), 5);

}

FoxInfo myFoxInfo[] = {

{"WDIMEN", Example, 0, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WBottomP( )
_WLeftP( )
_WRightP( )
_WTopP( )
_WWidthP( )


_WHide( ) API Library Routine

See Also	Example

Removes a window from the screen, but keeps track of its contents so you can display it again.

Syntax

void _WHide(WHANDLE wh)
WHANDLE wh;	/* Window handle. */


_WHide( ) API Library Routine Example

The following example hides the window whose title is passed as an argument.

Visual FoxPro Code

SET LIBRARY TO WHIDE

CREATE TABLE X (X C(10))

BROWSE NOWAIT

WAIT WINDOW "Press A Key To Hide Window"

SET LIBR TO WFINDTIT

= WHIDE("X")

WAIT WINDOW "Window Is Hidden"

C Code

#include <pro_ext.h>

void FAR Example(ParamBlk FAR *parm)

{

//	For readability---

#define pTITLE ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

WHANDLE wh;

if (!_SetHandSize(parm->p[0].val.ev_handle,

parm->p[0].val.ev_length+ 1))

{

_Error(182); // "Insufficient memory"

}

_HLock(parm->p[0].val.ev_handle);

pTITLE[parm->p[0].val.ev_length] = '\0';

wh = _WFindTitle(pTITLE);

_HUnLock(parm->p[0].val.ev_handle);

_WHide(wh);

}

FoxInfo myFoxInfo[] = {

{"WHIDE", (FPFI) Example, 1, "C"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WShow( )


_WhToHwnd( ) API Library Routine

See Also	Example

Returns the Windows HWND of the specified WHANDLE.

Syntax

HWND_WhToHwnd(WHANDLE wh)
WHANDLE wh;	/* Window handle. */

Remarks

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_WhToHwnd( ) API Library Routine Example

The following example creates a window and then obtains the Windows HWND for the window with the callback _WhToHwnd( ). Then, to verify the value returned by _WhToHwnd( ), the example uses the HWND as an argument to a Windows function.

Visual FoxPro Code

SET LIBRARY TO WHTOHWND

C Code

#include <windows.h>

#include <pro_ext.h>

void putLong(long n, int width)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = width;

_PutValue(&val);

}

FAR WhToHwndEx(ParamBlk FAR *parm)

{

RECT Rect;

HWND hwnd;

WHANDLE wh;

Value val;

wh = _WOpenP(10,10,120,240,CLOSE,WINDOW_SCHEME, (Scheme FAR *) 0,

WO_SYSTEMBORDER);

_WShow(wh);

//	Get Windows window handle and use as a parameter

//	to a Windows function

hwnd = _WhToHwnd(wh);

GetWindowRect(hwnd, &Rect); // Windows function

_PutStr("\ntop	="); putLong(Rect.top, 5);

_PutStr("\nleft   ="); putLong(Rect.left, 5);

_PutStr("\nbottom ="); putLong(Rect.bottom, 5);

_PutStr("\nright  ="); putLong(Rect.right, 5);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", WhToHwndEx, CALLONLOAD,  ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WFindTitle( )
_WOpen( )


_WLeft( ) API Library Routine

See Also	Example

Returns the column on the screen where the left edge of the specified window is located.

Syntax

int _WLeft(WHANDLE wh)
WHANDLE wh;	/* Window handle. */


_WLeft( ) API Library Routine Example

The following example shows the position of the frontmost window.

Visual FoxPro Code

SET LIBRARY TO WLEFT

=WPOSITION()

C Code

#include <pro_ext.h>

void putLong(long n, int width)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = width;

_PutValue(&val);

}

void FAR Example(ParamBlk FAR *parm)

{

WHANDLE wh = _WOnTop();

_PutStr("\ntop	="); putLong(_WTop(wh), 5);

_PutStr("\nleft   ="); putLong(_WLeft(wh), 5);

_PutStr("\nbottom ="); putLong(_WBottom(wh), 5);

_PutStr("\nright  ="); putLong(_WRight(wh), 5);

}

FoxInfo myFoxInfo[] = {

{"WPOSITION", (FPFI) Example, 0, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WBottom( )
_WHeight( ),_WRight( )
_WTop( )
_WWidth( )


_WLeftP( ) API Library Routine

See Also	Example

Returns the position on the screen in pixels where the left edge of the window is located.

Syntax

int _WLeftP(WHANDLE wh)
WHANDLE wh;	/* Window handle. */

Remarks

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_WLeftP( ) API Library Routine Example

The following example shows the position in pixels of the frontmost window.

Visual FoxPro Code

SET LIBRARY TO WLEFTP

=WPOSITION()

C Code

#include <pro_ext.h>

void putLong(long n, int width)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = width;

_PutValue(&val);

}

void FAR Example(ParamBlk FAR *parm)

{

WHANDLE wh = _WOnTop();

_PutStr("\ntop	="); putLong(_WTopP(wh), 5);

_PutStr("\nleft   ="); putLong(_WLeftP(wh), 5);

_PutStr("\nbottom ="); putLong(_WBottomP(wh), 5);

_PutStr("\nright  ="); putLong(_WRightP(wh), 5);

}

FoxInfo myFoxInfo[] = {

{"WPOSITION", Example, 0, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WBottomP( )
_WHeightP( )
_WRightP( )
_WTopP( )
_WWidthP( )


_WMainWindow( ) API Library Routine

See Also	Example

Returns the WHANDLE of the main Visual FoxPro window.

Syntax

WHANDLE _WMainWindow(void any)
void any;	/* Pointer. */


_WMainWindow( ) API Library Routine Example

The following example writes a message to the main Visual FoxPro window.

Visual FoxPro Code

SET LIBRARY TO WMAIN

= EXWMAIN()

C Code

#include <pro_ext.h>

void FAR Example(ParamBlk FAR *parm)

{

WHANDLE wh = _WMainWindow();

WPutStr(wh, "\nThis is the FoxPro main window or desktop.");

}

FoxInfo myFoxInfo[] = {

{"EXWMAIN", Example, 0, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WhToHwnd( )


_WMove( ) API Library Routine

See Also	Example

Moves the specified window to the new location specified by pt.

Syntax

void _WMove(WHANDLE wh, Point pt)
WHANDLE wh;	/* Window handle. */
Point pt;	/* New location. */

Remarks

The pt parameter specifies the position of the upper-left corner of the window in rows and columns. The new position can place the window partially or completely off the screen.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_WMove( ) API Library Routine Example

The following example moves the frontmost window diagonally 10 rows down and 10 columns to the right.

Visual FoxPro Code

SET LIBRARY TO WMOVE

=WMOVE()

C Code

#include <pro_ext.h>

void FAR WMoveEx(ParamBlk FAR *parm)

{

WHANDLE wh = _WOnTop();

Point newPos;

newPos.v = _WTop(wh)  + 10;

newPos.h = _WLeft(wh) + 10;

_WMove(wh, newPos);

}

FoxInfo myFoxInfo[] = {

{"WMOVE", (FPFI) WMoveEx, 0, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WSIZE( )


_WMoveP( ) API Library Routine

See Also	Example

Moves the specified window to a new location specified by pt.

Syntax

void _WMoveP(WHANDLE wh, Point pt)
WHANDLE wh;	/* Window handle. */
Point pt;	/* New location. */

Remarks

The pt parameter specifies the location of the upper-left corner of the window in pixels. The new position can place the window partially or completely off the screen.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_WMoveP( ) API Library Routine Example

The following example moves the frontmost window diagonally 40 pixels down and 40 pixels to the right.

Visual FoxPro Code

SET LIBRARY TO WMOVEP

=WMOVEP()

C Code

#include <pro_ext.h>

void FAR WMovePEx(ParamBlk FAR *parm)

{

WHANDLE wh = _WOnTop();

Point newPos;

newPos.v = _WTopP(wh)  + 40;

newPos.h = _WLeftP(wh) + 40;

_WMoveP(wh, newPos);

}

FoxInfo myFoxInfo[] = {

{"WMOVEP", WMovePEx, 0, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WSizeP( )


_WOnTop( ) API Library Routine

See Also	Example

Returns the WHANDLE of the frontmost window.

Syntax

WHANDLE _WOnTop(void any)
void any;	/* Pointer. */

Remarks

Normally, keystrokes belong to the frontmost window. Handler routines need to act appropriately.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_WOnTop( ) API Library Routine Example

The following example displays position information about the frontmost window.

Visual FoxPro Code

SET LIBRARY TO WONTOP

=WPOSITION()

C Code

#include <pro_ext.h>

void putLong(long n, int width)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = width;

_PutValue(&val);

}

void FAR Example(ParamBlk FAR *parm)

{

WHANDLE wh = _WOnTop();

_PutStr("\ntop	="); putLong(_WTop(wh), 5);

_PutStr("\nleft   ="); putLong(_WLeft(wh), 5);

_PutStr("\nbottom ="); putLong(_WBottom(wh), 5);

_PutStr("\nright  ="); putLong(_WRight(wh), 5);

}

FoxInfo myFoxInfo[] = {

{"WPOSITION", Example, 0, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WSendBehind( )
_WShow( )
_WTop( )


_WOpen( ) API Library Routine

See Also	Example

Creates a new window at the coordinates specified by the top, left, bottom, and right parameters.

Syntax

WHANDLE _WOpen(int top, int left, int bottom, int right, int flag,
int scheme_num, Scheme FAR *scheme, char FAR *bord)
int top;	/* Row of top coordinate. */
int left;	/* Column of left coordinate. */
int bottom;	/* Row of bottom coordinate.  */
int right;	/* Column of right coordinate. */
int flag;	/* Attributes. */
int scheme_num;	/* Color scheme. */
Scheme FAR *scheme;	/* Points to color scheme to use. */
char FAR *bord;	/* Border type. */

Remarks

The window coordinates may be off the screen, but the height can’t exceed 120 and the width can’t exceed 264. Additional memory is allocated to hold the off-screen image of this window.

The flag parameter determines the attributes for this window. The flag may be one or more of the following flag values. You can combine multiple flag values using the C-language | or + operator. Typical window borders are defined in PRO_EXT.H.

flag Value	Window attribute
WCURSOR	The insertion point may be displayed in this window.
ZOOM	The user may zoom the window.
ADJ	The user may adjust the size of the window.
CLOSE	The user may close the window.
MOVE	The user may move the window.
AUTOSCROLL	The window scrolls when output rolls off the bottom line.
WEVENT	The window receives, activates, and deactivates events.
SHADOW	The window casts a shadow.
WMODAL	The user can’t send this window to the back.
WMINIMIZE	The user can minimize this window.
The scheme_num may be any valid color scheme number, or   – 1 to indicate that the scheme parameter points to the color scheme to use.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_WOpen( ) API Library Routine Example

The following example creates windows using a number of different color schemes and borders. In particular, note the custom color scheme

Visual FoxPro Code

SET LIBRARY TO WOPEN

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

WHANDLE wh;

Scheme customScheme =

{

(char) (BLACK_ON	| WHITE),

(char) (RED_ON	| BLACK	| BLINK),

(char) (WHITE_ON	| WHITE	| BRIGHT),

(char) (CYAN_ON	| BLUE	| BRIGHT),

(char) (GREEN_ON	| BROWN),

(char) (BROWN_ON	| BROWN	| BRIGHT),

(char) (MAGENTA_ON	| MAGENTA	| BRIGHT),

(char) (RED_ON	| MAGENTA	| BRIGHT | BLINK),

(char) (BROWN_ON	| GREEN	| BRIGHT),

(char) (BLACK_ON	| CYAN),

(char) (BLUE_ON	| CYAN),

};

_Execute("WAIT WINDOW 'Press any key to see a window \

in WINDOW_SCHEME with WO_DOUBLEBOX border'");

wh = _WOpen(2,2,20,70,WEVENT | CLOSE,WINDOW_SCHEME,(Scheme FAR *) 0,

WO_DOUBLEBOX);

_WShow(wh);

_Execute("WAIT WINDOW 'Press any key to see a window \

in ALERT_SCHEME with WO_SINGLEBOX border'");

_WClose(wh);

wh = _WOpen(2,2,20,70,WEVENT | CLOSE,ALERT_SCHEME, (Scheme FAR *) 0,

WO_SINGLEBOX);

_WShow(wh);

_Execute("WAIT WINDOW 'Press any key to see a window \

in WINDOW_SCHEME with WO_PANELBORDER border'");

_WClose(wh);

wh = _WOpen(2,2,20,70,WEVENT | CLOSE,WINDOW_SCHEME,(Scheme FAR *) 0,

WO_PANELBORDER);

_WShow(wh);

_Execute("WAIT WINDOW 'Press any key to see a window \

in a custom scheme with WO_SYSTEMBORDER border'");

_WClose(wh);

wh = _WOpen(2,2,20,70,WEVENT | CLOSE,-1,(Scheme FAR *) customScheme,

WO_SYSTEMBORDER);

_WShow(wh);

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) Example, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WClose( )
_WSelect( )
_WSetTitle( )
_WShow( )


_WOpenP( ) API Library Routine

See Also	Example

Creates a new window at the positions specified by the top, left, bottom, and right parameters.

Syntax

WHANDLE _WOpenP(int top, int left, int bottom, int right, int flag,
int scheme_num, Scheme FAR *scheme, char FAR *bord)
int top;	/* Top coordinate in pixels. */
int left;	/* Left coordinate in pixels. */
int bottom;	/* Bottom coordinate in pixels. */
int right;	/* Right coordinate in pixels. */
int flag;	/* Attributes. */
int scheme_num;	/* Color scheme. */
Scheme FAR *scheme;	/* Points to color scheme to use. */
char FAR *bord;	/* Border type. */

Remarks

The window positions may be off the screen. Additional memory is allocated to hold the off-screen image of this window.

The flag parameter determines the attributes for this window. The flag may be one or more of the flag values in the table below. You can combine multiple flag values using the C | or + operator. Typical window borders are defined in PRO_EXT.H.

flag Value	Window attribute
WCURSOR	The insertion point may be displayed in this window.
ZOOM	The user may zoom the window.
ADJ	The user may adjust the size of the window.
CLOSE	The user may close the window.
MOVE	The user may move the window.
AUTOSCROLL	The window scrolls when output rolls off the bottom line.
WEVENT	The window receives, activates, and deactivates events.
SHADOW	The window casts a shadow.
WMODAL	The user can’t send this window to the back.
WMINIMIZE	The user can minimize this window.
The scheme_num may be any valid color scheme number, or   – 1 to indicate that the scheme parameter points to the color scheme to use.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_WOpenP( ) API Library Routine Example

The following example creates windows using a number of different color schemes and borders. In particular, note the custom color scheme.

Visual FoxPro Code

SET LIBRARY TO WOPENP

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

WHANDLE wh;

char customScheme[12] =

{

BLACK_ON	| WHITE,

RED_ON	| BLACK	| BLINK,

WHITE_ON	| WHITE	| BRIGHT,

CYAN_ON	| BLUE	| BRIGHT,

GREEN_ON	| BROWN,

BROWN_ON	| BROWN	| BRIGHT,

MAGENTA_ON	| MAGENTA	| BRIGHT,

RED_ON	| MAGENTA	| BRIGHT | BLINK,

BROWN_ON	| GREEN	| BRIGHT,

BLACK_ON	| CYAN,

BLUE_ON	| CYAN,

};

_Execute("WAIT WINDOW 'Press any key to see a window \

in WINDOW_SCHEME with WO_DOUBLEBOX border'");

wh = _WOpenP(10, 10, 160, 320, WEVENT | CLOSE, WINDOW_SCHEME,

(Scheme FAR *)0, WO_DOUBLEBOX);

_WShow(wh);

_Execute("WAIT WINDOW 'Press any key to see a window \

in ALERT_SCHEME with WO_SINGLEBOX border'");

_WClose(wh);

wh = _WOpenP(10, 10, 160, 320, WEVENT | CLOSE, ALERT_SCHEME,

(Scheme FAR *)0, WO_SINGLEBOX);

_WShow(wh);

_Execute("WAIT WINDOW 'Press any key to see a window \

in WINDOW_SCHEME with WO_PANELBORDER border'");

_WClose(wh);

wh = _WOpenP(10, 10, 160, 320, WEVENT | CLOSE, WINDOW_SCHEME,

(Scheme FAR *)0, WO_PANELBORDER);

_WShow(wh);

_Execute("WAIT WINDOW 'Press any key to see a window \

in a custom scheme with WO_SYSTEMBORDER border'");

_WClose(wh);

wh = _WOpenP(10,10,160,320,WEVENT | CLOSE,-1,customScheme,

WO_SYSTEMBORDER);

_WShow(wh);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", Example, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WClose( )
_WSelect( )
_WSetTitle( )
_WShow( )


_WPosCursor( ) API Library Routine

See Also	Example

Positions the output position in the specified window at the location specified in rows and columns by pt.

Syntax

void _WPosCursor(WHANDLE wh, Point pt)
WHANDLE wh;	/* Window handle. */
Point pt;	/* Location for the output position. */

Remarks

_WPosCursor( ) doesn’t make the insertion point appear. Normally, the insertion point is visible only when Visual FoxPro is waiting for input.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_WPosCursor( ) API Library Routine Example

The following example creates a window and draws a diagonal pattern of Xs in this window. It positions the cursor before writing each X using _WPosCursor( ), and gets that same position using _WGetCursor( ).

Visual FoxPro Code

SET LIBRARY TO WPOSCUR

C Code

#include <pro_ext.h>

void putLong(long n, int width)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = width;

_PutValue(&val);

}

FAR Example(ParamBlk FAR *parm)

{

WHANDLE wh;

Point putPos, getPos;

wh = _WOpen(4,4,20,70,0,WINDOW_SCHEME,(Scheme FAR *) 0,

WO_SYSTEMBORDER);

_WShow(wh);

for (putPos.v = 2; putPos.v < 14; putPos.v++)

{

putPos.h = putPos.v;

_WPosCursor(wh, putPos);

_WPutChr(wh, 'X');

getPos = _WGetCursor(wh);

_PutStr("\nCursor position:");

putLong(getPos.v, 5);

putLong(getPos.h, 5);

_Execute("WAIT");

}

_WClose(wh);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) Example, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WGetCursor( )


_WPosCursorP( ) API Library Routine

See Also	Example

Positions the output position of the specified window at the location specified in pixels by pt.

Syntax

void _WPosCursorP(WHANDLE wh, Point pt)
WHANDLE wh;	/* Window handle. */
Point pt;	/* Location for output position. */

Remarks

_WPosCursor( ) doesn’t make the insertion point appear. Normally, the insertion point is visible only when Visual FoxPro is waiting for input.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_WPosCursorP( ) API Library Routine Example

The following example creates a window and draws a diagonal pattern of Xs in this window. It positions the cursor before writing each X using _WPosCursorP( ), and gets that same position using _WGetCursorP( ).

Visual FoxPro Code

SET LIBRARY TO WPOSCURP

C Code

#include <pro_ext.h>

void putLong(long n, int width)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = width;

_PutValue(&val);

}

FAR Example(ParamBlk FAR *parm)

{

WHANDLE wh;

Point putPos, getPos;

wh = _WOpen(4,4,20,70,0,WINDOW_SCHEME,(Scheme FAR *)0,

WO_SYSTEMBORDER);

_WShow(wh);

for (putPos.v = 10; putPos.v < 100; putPos.v += 10)

{

putPos.h = putPos.v;

_WPosCursorP(wh, putPos);

_WPutChr(wh, 'X');

getPos = _WGetCursorP(wh);

_PutStr("\nCursor position:");

putLong(getPos.v, 5);

putLong(getPos.h, 5);

_Execute("WAIT");

}

_WClose(wh);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", Example, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WGetCursorP( )


_WPutChr( ) API Library Routine

See Also	Example

Displays one character char at the output position in the specified window and in the current color.

Syntax

void _WPutChr(WHANDLE wh, int char)
WHANDLE wh;	/* Window handle. */
int char;	/* Character to display. */

Remarks

Special characters such as newline, carriage return, and bell are treated as control characters and aren’t displayed on the screen.

To show the character that corresponds to one of these control characters, add 256 to the value of the character.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_WPutChr( ) API Library Routine Example

The following example uses _WPutChr( ) to display all 8-bit values in a new window.

Visual FoxPro Code

SET LIBRARY TO WPUTCHR

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

int i;

WHANDLE wh;

wh = _WOpen(2,2,20,70,WEVENT | CLOSE,WINDOW_SCHEME,(Scheme FAR *) 0,

WO_SYSTEMBORDER);

_WShow(wh);

for (i = 0; i < 256; i++)

_WPutChr(wh, i);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) Example, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WPutStr( )


_WPutStr( ) API Library Routine

See Also	Example

Displays a null-terminated string at the output position in the specified window and in the current color.

Syntax

void _WPutStr(WHANDLE wh, char FAR *theStr)
WHANDLE wh;	/* Window handle. */
char FAR *theStr;	/* String to display. */

Remarks

Output that normally causes the window to scroll produces undefined results in windows that don’t have the AUTOSCROLL attribute set.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_WPutStr( ) API Library Routine Example

The following example uses _WPutStr( ) to display a string containing all 8-bit values (except '\0') in a new window.

Visual FoxPro Code

SET LIBRARY TO WPUTSTR

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

int i;

WHANDLE wh;

char String[256];

wh = _WOpen(2,2,20,70,WEVENT | CLOSE,WINDOW_SCHEME,(Scheme FAR *) 0,

WO_SYSTEMBORDER);

_WShow(wh);

for (i = 0; i < 255; i++)

String[i] = i + 1;

String[255] = '\0';

_WPutStr(wh, String);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) Example, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WPutChr( )


_WRight( ) API Library Routine

See Also	Example

Returns the column on the screen where the right edge of the specified window is located.

Syntax

int _WRight(WHANDLE wh)
WHANDLE wh;	/* Window handle. */


_WRight( ) API Library Routine Example

The following example shows the position of the frontmost window.

Visual FoxPro Code

SET LIBRARY TO WRIGHT

=WPOSITION()

C Code

#include <pro_ext.h>

void putLong(long n, int width)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = width;

_PutValue(&val);

}

void FAR Example(ParamBlk FAR *parm)

{

WHANDLE wh = _WOnTop();

_PutStr("\ntop	="); putLong(_WTop(wh), 5);

_PutStr("\nleft   ="); putLong(_WLeft(wh), 5);

_PutStr("\nbottom ="); putLong(_WBottom(wh), 5);

_PutStr("\nright  ="); putLong(_WRight(wh), 5);

}

FoxInfo myFoxInfo[] = {

{"WPOSITION", (FPFI) Example, 0, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WBottom( )
_WHeight( )
_WLeft( )
_WTop( )
_WWidth( )


_WRightP( ) API Library Routine

See Also	Example

Returns the position on the screen in pixels where the right edge of the specified window is located.

Syntax

int _WRightP(WHANDLE wh)
WHANDLE wh;	/* Window handle. */

Remarks

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_WRightP( ) API Library Routine Example

The following example displays the position of the frontmost window.

Visual FoxPro Code

SET LIBRARY TO WRIGHTP

=WPOSITION()

C Code

#include <pro_ext.h>

void putLong(long n, int width)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = width;

_PutValue(&val);

}

void FAR Example(ParamBlk FAR *parm)

{

WHANDLE wh = _WOnTop();

_PutStr("\ntop	="); putLong(_WTopP(wh), 5);

_PutStr("\nleft   ="); putLong(_WLeftP(wh), 5);

_PutStr("\nbottom ="); putLong(_WBottomP(wh), 5);

_PutStr("\nright  ="); putLong(_WRightP(wh), 5);

}

FoxInfo myFoxInfo[] = {

{"WPOSITION", Example, 0, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WBottomP( )
_WHeightP( )
_WLeftP( )
_WTopP( )
_WWidthP( )


_WScroll( ) API Library Routine

See Also	Example

Scrolls a portion of the contents of a window left or right and up or down.

Syntax

void _WScroll(WHANDLE wh, Rect r, int dv, int dh)
WHANDLE wh;	/* Window handle. */
Rect r;	/* Portion to scroll. */
int dv;	/* Left or right. */
int dh;	/* Up or down. */

Remarks

•	The r parameter describes the portion of the window to be scrolled.

•	The dv parameter describes the number of characters to scroll the window left or right. If dv is negative, the window contents scroll to the left. If dv is positive, the window contents scroll to the right.

•	The dh parameter describes the number of characters to scroll the window up or down. If dh is negative, the window contents scroll up. If dh is positive, the window contents scroll down.

If both dv and dh are 0, _WScroll( ) clears the characters inside the rectangle.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_WScroll( ) API Library Routine Example

The following example opens a window and draws a rectangular pattern of Xs. This rectangle is also the scroll rectangle. First, the example scrolls the rectangle up two positions and to the left two positions. Next, it scrolls the rectangle down by four positions and to the right four positions.

Visual FoxPro Code

SET LIBRARY TO WSCROLL

C Code

#include <pro_ext.h>

FAR WScrollEx(ParamBlk FAR *parm)

{

WHANDLE wh;

Point pos;

Rect rect;

wh = _WOpen(2,2,20,70,WEVENT | CLOSE,WINDOW_SCHEME,(Scheme FAR *) 0,

WO_SYSTEMBORDER);

_WShow(wh);

rect.top	= 6;

rect.left	= 6;

rect.bottom = 12;

rect.right	= 12;

for (pos.v = rect.top; pos.v < rect.bottom; pos.v++)

{

for (pos.h = rect.left; pos.h < rect.right; pos.h++)

{

_WPosCursor(wh, pos);

_WPutChr(wh, 'X');

}

}

_Execute("WAIT WINDOW 'Press any key to _WScroll(wh,rect,-2,-2)'");

_WScroll(wh, rect, -2, -2);

_Execute("WAIT WINDOW 'Press any key to _WScroll(wh,rect,+4,+4)'");

_WScroll(wh, rect, +4, +4);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) WScrollEx, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WClear( )


_WScrollP( ) API Library Routine

See Also	Example

Scrolls a portion of the contents of a window left or right and up or down.

Syntax

void _WScrollP(WHANDLE wh, Rect r, int dv, int dh)
WHANDLE wh;	/* Window handle. */
Rect r;	/* Portion to scroll. */
int dv;	/* Left or right. */
int dh;	/* Up or down. */

Remarks

•	The r parameter describes the portion of the window to be scrolled.

•	The dv parameter describes the number of pixels to scroll the window left or right. If dv is negative, the window contents scroll to the left. If dv is positive, the window contents scroll to the right.

•	The dh parameter describes the number of pixels to scroll the window up or down. If dh is negative, the window contents scroll up. If dh is positive, the window contents scroll down.

If both dv and dh are 0, _WScrollP( ) clears the characters inside the rectangle.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_WScrollP( ) API Library Routine Example

The following example opens a window and draws a rectangular pattern of Xs. This rectangle is also the scroll rectangle. First, _WScrollP( ) scrolls the rectangle up and left. Next, it scrolls the rectangle down and right.

Visual FoxPro Code

SET LIBRARY TO WSCROLLP

C Code

#include <pro_ext.h>

FAR WScrollEx(ParamBlk FAR *parm)

{

WHANDLE wh;

Point pos;

Rect rect;

wh = _WOpenP(2, 2, 160, 320, WEVENT | CLOSE, WINDOW_SCHEME,

(char *) 0, WO_SYSTEMBORDER);

    _WShow(wh);

rect.top	= 40;

rect.left	= 40;

rect.bottom = 100;

rect.right	= 100;

for (pos.v = rect.top; pos.v < rect.bottom; pos.v += 6)

{

for (pos.h = rect.left; pos.h < rect.right; pos.h +=6)

{

_WPosCursorP(wh, pos);

            _WPutChr(wh, 'X');

}

}

_Execute("WAIT 'Press any key to _WScroll(wh, rect, -20, -20)'");

_WScrollP(wh, rect, -20, -20);

_Execute("WAIT 'Press any key to _WScroll(wh, rect, +40, +40)'");

_WScrollP(wh, rect, +40, +40);

}

FoxInfo myFoxInfo[] =

{

{"ONLOAD", WScrollEx, CALLONLOAD, ""},

};

FoxTable _FoxTable =

{

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WClear( )


_WSelect( ) API Library Routine

See Also	Example

Brings the specified window to the frontmost position on the screen.

Syntax

void _WSelect(WHANDLE wh)
WHANDLE wh;	/* Window handle. */


_WSelect( ) API Library Routine Example

The following example creates five overlapping windows. The windows are each moved to the frontmost position using _WSelect( ), starting with the first window created.

Visual FoxPro Code

SET LIBRARY TO WSELECT

C Code

#include <pro_ext.h>

FAR WSelectEx(ParamBlk FAR *parm)

{

WHANDLE wh[5];

int i;

for (i = 0; i < 5; i++)

{

wh[i] = _WOpen(4 + 2*i,4 + 2*i,12 + 2*i,40 + 2*i,WEVENT | CLOSE,

WINDOW_SCHEME, (Scheme FAR *) 0, WO_SYSTEMBORDER);

_WShow(wh[i]);

}

for (i = 0; i < 5; i++)

{

_Execute("WAIT WINDOW 'Press key to _WSelect() next window'");

_WSelect(wh[i]);

}

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) WSelectEx, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WOnTop( )
_WShow( )


_WSendBehind( ) API Library Routine

See Also	Example

Sends the specified window to the backmost position on the screen.

Syntax

void _WSendBehind(WHANDLE wh)
WHANDLE wh;	/* Window handle. */


_WSendBehind( ) API Library Routine Example

The following example creates five overlapping windows. _WSendBehind( ) sends each window to the backmost position, starting with the last window created.

Visual FoxPro Code

SET LIBRARY TO WSENDBEH

C Code

#include <pro_ext.h>

FAR WSendBehindEx(ParamBlk FAR *parm)

{

WHANDLE wh[5];

int i;

for (i = 0; i < 5; i++)

{

wh[i] = _WOpen(4 + 2*i,4 + 2*i,12 + 2*i,40 + 2*i,WEVENT | CLOSE,

WINDOW_SCHEME, (Scheme FAR *) 0, WO_SYSTEMBORDER);

_WShow(wh[i]);

}

for (i = 4; i >= 0; i--)

{

_Execute("WAIT WINDOW 'Press key to _WSendBehind() next window'");

_WSendBehind(wh[i]);

}

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) WSendBehindEx, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WOnTop( )
_WSelect( )


_WSetAttr( ) API Library Routine

See Also	Example

Changes the attribute for the specified color scheme index in the indicated window’s color scheme to the new attribute attr.

Syntax

void _WSetAttr(WHANDLE wh, int color, int attr)
WHANDLE wh;	/* Window handle. */
int color;	/* Color scheme. */
int attr;	/* Attribute. */


_WSetAttr( ) API Library Routine Example

The following example goes through each color of each scheme, using _WSetAttr( ) to set the pen color, and then displaying some text in each color.

Visual FoxPro Code

SET LIBRARY TO WSETATTR

C Code

#include <pro_ext.h>

void putLong(long n, int width)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = width;

_PutValue(&val);

}

FAR WAttrEx(ParamBlk FAR *parm)

{

int scheme;

int color;

WHANDLE wh;

int attrib, savePen;

for (scheme = 0; scheme <= 25; scheme++)

{

wh = _WOpen(2,10,23,70,WEVENT,scheme,(Scheme FAR *)0,

WO_SYSTEMBORDER);

for (color = WA_NORMAL; color <= WA_ISSHADOW; color++)

{

attrib  = _WAttr(wh, color);

savePen = _WAttr(_WGetPort(), WA_PENCOLOR);

_WSetAttr(_WGetPort(), WA_PENCOLOR, attrib);

_PutStr("\nScheme:"); putLong(scheme, 5);

_PutStr("; Color:"); putLong(color, 5);

_PutStr("; Attribute byte:"); putLong(attrib, 5);

_WSetAttr(_WGetPort(), WA_PENCOLOR, savePen);

}

_WClose(wh);

_Execute("WAIT");

}

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) WAttrEx, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WClear( )
_WClearRect( )


_WSetPort( ) API Library Routine

See Also	Example

Changes the user output window to be the specified window.

Syntax

WHANDLE _WSetPort(WHANDLE wh)
WHANDLE wh;	/* Window handle. */

Remarks

_WSetPort( ) returns the handle of the previous user output window.

Note   If your routine changes the user output window, be sure to restore the user output window before returning to Visual FoxPro.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_WSetPort( ) API Library Routine Example

The following example creates a window and makes this the output port. It writes some text to this window before switching back to the original output port.

Visual FoxPro Code

SET LIBRARY TO WSETPORT

C Code

#include <pro_ext.h>

void putLong(long n, int width)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = width;

_PutValue(&val);

}

FAR Example(ParamBlk FAR *parm)

{

WHANDLE wh;

WHANDLE oldPort;

wh = _WOpen(2,10,23,70,WEVENT | CLOSE,WINDOW_SCHEME,(Scheme FAR *)0,

WO_SYSTEMBORDER);

_WShow(wh);

_PutStr("\n1) _WGetPort() ="); putLong(_WGetPort(), 10);

oldPort = _WSetPort(wh);

_PutStr("\n2) _WSetPort(wh) ="); putLong(oldPort, 10);

_PutStr("\n3) _WGetPort() ="); putLong(_WGetPort(), 10);

oldPort = _WSetPort(oldPort);

_PutStr("\n4) _WSetPort(oldPort) =");  putLong(oldPort, 10);

_PutStr("\nShould be back where we started.");

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) Example, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WGetPort( )


_WSetTitle( ) API Library Routine

See Also	Example

Changes the title of the specified window to title.

Syntax

void _WSetTitle(WHANDLE wh, char FAR *title)
WHANDLE wh;	/* Window handle. */
char FAR *title;	/* Window title. */

Remarks

To remove a title from a window, pass (char FAR *)0 as the new title.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_WSetTitle( ) API Library Routine Example

The following example creates a window and defines its title text with _WSetTitle( )

Visual FoxPro Code

SET LIBRARY TO WSETTITL

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

WHANDLE wh;

char FAR *buffer;

wh = _WOpen(4,4,20,70,CLOSE | WEVENT,WINDOW_SCHEME,(Scheme FAR *)0,

WO_SYSTEMBORDER);

_WSetTitle(wh, "This is a window title");

_WShow(wh);

if ((buffer = _Alloca(128)) == 0)

{

_Error(182); // "Insufficient memory"

}

_WTitle(wh, buffer);

_PutStr("\nThe window title is \"");

_PutStr(buffer);

_PutChr('"');

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) Example, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WFindTitle( )


_WShow( ) API Library Routine

See Also	Example

Displays a hidden window on the screen.

Syntax

void _WShow(WHANDLE wh)
WHANDLE wh;	/* Window handle. */

Remarks

When you create a window, it is hidden by default until you use _WShow( ) to make it visible.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_WShow( ) API Library Routine Example

The following example contains two API routines. WINOPEN( ) opens a window but doesn’t call _WShow( ), illustrating that the window is hidden until _WShow( ) displays it on the screen.

Visual FoxPro Code

SET LIBRARY TO WSHOW

wh = WOPEN()

= WSHOW(wh)

C Code

#include <pro_ext.h>

FAR WOpen(ParamBlk FAR *parm)

{

_RetInt(_WOpen(2, 2, 20, 70, WEVENT | CLOSE, WINDOW_SCHEME,

(Scheme FAR *) 0, WO_SYSTEMBORDER), 10);

}

FAR WShow(ParamBlk FAR *parm)

{

_WShow(parm->p[0].val.ev_long);

}

FoxInfo myFoxInfo[] = {

{"WOPEN", (FPFI) WOpen, 0, ""},

{"WSHOW", (FPFI) WShow, 1, "I"},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WHide( )
_WOpen( )
_WSelect( )


_WSize( ) API Library Routine

See Also	Example

Sets new dimensions of the specified window to the height and width specified by h and v in the pt parameter.

Syntax

void _WSize(WHANDLE wh, Point pt)
WHANDLE wh;	/* Window handle. */
Point pt;	/* Position. */


_WSize( ) API Library Routine Example

The following example creates a window, and then expands its width and height.

Visual FoxPro Code

SET LIBRARY TO WSIZE

C Code

#include <pro_ext.h>

FAR WSizeEx(ParamBlk FAR *parm)

{

WHANDLE wh;

Point dim;

wh = _WOpen(2,2,10,10,CLOSE | WEVENT,WINDOW_SCHEME,(Scheme FAR *)0,

WO_SYSTEMBORDER);

_WShow(wh);

dim.v = 8;

//	Grow in width

for (dim.h = 8; dim.h < 60; dim.h += 4)

{

_WSize(wh, dim);

_Execute("WAIT WINDOW 'Press Any Key To Change Size'");

}

//	Grow in height

for (dim.v = 8; dim.v < 20; dim.v += 2)

{

_WSize(wh, dim);

_Execute("WAIT WINDOW 'Press Any Key To Change Size'");

}

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) WSizeEx, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WMove( )


_WSizeP( ) API Library Routine

See Also	Example

Sets the new dimensions of the window to the height and width specified in pixels by h and v in the pt parameter.

Syntax

void _WSizeP(WHANDLE wh, Point pt)
WHANDLE wh;	/* Window handle. */
Point pt;	/* Position. */

Remarks

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_WSizeP( ) API Library Routine Example

The following example creates a window, and expands its width and then its height.

Visual FoxPro Code

SET LIBRARY TO WSIZEP

C Code

#include <pro_ext.h>

FAR WSizeEx(ParamBlk FAR *parm)

{

WHANDLE wh;

Point dim;

wh = _WOpenP(6,6,20,20,CLOSE | WEVENT,WINDOW_SCHEME,(Scheme FAR *)0,

WO_SYSTEMBORDER);

_WShow(wh);

dim.v = 14;

//	Grow in width

for (dim.h = 14; dim.h < 480; dim.h += 40)

{

_WSizeP(wh, dim);

_Execute("WAIT");

}

//	Grow in height

for (dim.v = 14; dim.v < 240; dim.v += 40)

{

_WSizeP(wh, dim);

_Execute("WAIT WINDOW 'Press Any Key To Change Window Size'");

}

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", WSizeEx, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WBottomP( )
_WLeftP( )
_WRightP( )
_WTopP( )


_WTitle( ) API Library Routine

See Also	Example

Puts the null-terminated title of the window wh in title.

Syntax

void _WTitle(WHANDLE wh, char FAR *title)
WHANDLE wh;	/* Window handle. */
char FAR *title;	/* Window title. */


_WTitle( ) API Library Routine Example

The following example creates and shows a window with both a title and a footer. _WTitle( ) retrieves the title text, which is then displayed on the screen.

Visual FoxPro Code

SET LIBRARY TO WTITLE

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

WHANDLE wh;

char FAR *buffer;

wh = _WOpen(4,4,20,70,CLOSE | WEVENT,WINDOW_SCHEME,(Scheme FAR *) 0,

WO_SYSTEMBORDER);

_WSetTitle(wh, "This is a window title");

_WShow(wh);

if ((buffer = _Alloca(128)) == 0)

{

_Error(182); // "Insufficient memory"

}

_WTitle(wh, buffer);

_PutStr("\nThe window title is \"");

_PutStr(buffer);

_PutChr('"');

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) Example, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WSetTitle( )


_WTop( ) API Library Routine

See Also	Example

Returns the row on the screen where the top of the window is located.

Syntax

int _WTop(WHANDLE wh)
WHANDLE wh;	/* Window handle. */


_WTop( ) API Library Routine Example

The following example displays the row position of the frontmost window.

Visual FoxPro Code

SET LIBRARY TO WTOP

=WPOSITION()

C Code

#include <pro_ext.h>

void putLong(long n, int width)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = width;

_PutValue(&val);

}

void FAR Example(ParamBlk FAR *parm)

{

WHANDLE wh = _WOnTop();

_PutStr("\ntop	="); putLong(_WTop(wh), 5);

_PutStr("\nleft   ="); putLong(_WLeft(wh), 5);

_PutStr("\nbottom ="); putLong(_WBottom(wh), 5);

_PutStr("\nright  ="); putLong(_WRight(wh), 5);

}

FoxInfo myFoxInfo[] = {

{"WPOSITION", (FPFI) Example, 0, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WBottom( )
_WHeight( )
_WLeft( )
_WRight( )
_WWidth( )


_WTopP( ) API Library Routine

See Also	Example

Returns the position on the screen in pixels where the top of the window is located.

Syntax

int _WTopP(WHANDLE wh)
WHANDLE wh;	/* Window handle. */

Remarks

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_WTopP( ) API Library Routine Example

The following example displays the position of the frontmost window in pixels.

Visual FoxPro Code

SET LIBRARY TO WTOPP

=WPOSITION()

C Code

#include <pro_ext.h>

void putLong(long n, int width)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = width;

_PutValue(&val);

}

void FAR Example(ParamBlk FAR *parm)

{

WHANDLE wh = _WOnTop();

_PutStr("\ntop	="); putLong(_WTopP(wh), 5);

_PutStr("\nleft   ="); putLong(_WLeftP(wh), 5);

_PutStr("\nbottom ="); putLong(_WBottomP(wh), 5);

_PutStr("\nright  ="); putLong(_WRightP(wh), 5);

}

FoxInfo myFoxInfo[] = {

{"WPOSITION", Example, 0, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WBottomP( )
_WHeightP( )
_WLeftP( )
_WRightP( )
_WWidthP( )


_WWidth( ) API Library Routine

See Also	Example

Returns the number of columns in the content area of the specified window.

Syntax

int _WWidth(WHANDLE wh)
WHANDLE wh;	/* Window handle. */


_WWidth( ) API Library Routine Example

The following example shows the height and width in rows and columns of the frontmost window.

Visual FoxPro Code

SET LIBRARY TO WWIDTH

=WDIMEN()

C Code

#include <pro_ext.h>

void putLong(long n, int width)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = width;

_PutValue(&val);

}

void FAR Example(ParamBlk FAR *parm)

{

WHANDLE wh = _WOnTop();

_PutStr("\nheight ="); putLong(_WHeight(wh), 5);

_PutStr("\nwidth  ="); putLong(_WWidth(wh), 5);

}

FoxInfo myFoxInfo[] = {

{"WDIMEN", (FPFI) Example, 0, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WBottom( )
_WHeight( )
_WLeft( )
_WRight( )
_WTop( )


_WWidthP( ) API Library Routine

See Also	Example

Returns the width in pixels of the content area of the specified window.

Syntax

int _WWidthP(WHANDLE wh)
WHANDLE wh;	/* Window handle. */

Remarks

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_WWidthP( ) API Library Routine Example

The following example displays the height and width in pixels of the frontmost window.

Visual FoxPro Code

SET LIBRARY TO WWIDTHP

=WDIMEN()

C Code

#include <pro_ext.h>

void putLong(long n, int width)

{

Value val;

val.ev_type = 'I';

val.ev_long = n;

val.ev_width = width;

_PutValue(&val);

}

void FAR Example(ParamBlk FAR *parm)

{

WHANDLE wh = _WOnTop();

_PutStr("\nheight ="); putLong(_WHeightP(wh), 5);

_PutStr("\nwidth  ="); putLong(_WWidthP(wh), 5);

}

FoxInfo myFoxInfo[] = {

{"WDIMEN", Example, 0, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WBottom( )
_WHeightP( )
_WLeftP( )
_WRightP( )
_WTopP( )


_WZoom( ) API Library Routine

See Also	Example

Minimizes or maximizes the specified window, or returns it to normal.

Syntax

void _WZoom(WHANDLE wh, int newstate)
WHANDLE wh;	/* Window handle. */
int newstate;	/* State of window after zoom. */

Remarks

You can specify the newstate parameter as WZ_MINIMIZE, WZ_NORMAL, or WZ_MAXIMIZE, which are defined in the PRO_EXT.H file.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, “Accessing the Visual FoxPro API,” in the Developer’s Guide.


_WZoom( ) API Library Routine Example

The following example creates and displays a window. It then calls _WZoom( ) for this window with each possible parameter.

Visual FoxPro Code

SET LIBRARY TO WZOOM

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)

{

WHANDLE wh;

int row, col;

wh = _WOpen(2,2,20,70,WEVENT | CLOSE,WINDOW_SCHEME,(Scheme FAR *) 0,

WO_SYSTEMBORDER);

_WShow(wh);

_Execute("WAIT WINDOW 'Press any key to minimize window'");

_WZoom(wh, WZ_MINIMIZED);

_Execute("WAIT WINDOW 'Press any key to normalize window'");

_WZoom(wh, WZ_NORMAL);

_Execute("WAIT WINDOW 'Press any key to maximize window'");

_WZoom(wh, WZ_MAXIMIZED);

_Execute("WAIT WINDOW 'Press any key to normalize window'");

_WZoom(wh, WZ_NORMAL);

}

FoxInfo myFoxInfo[] = {

{"ONLOAD", (FPFI) Example, CALLONLOAD, ""},

};

FoxTable _FoxTable = {

(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

};


See Also

_WMove( )
_WSIZE( )


Visual FoxPro System Events (API Library Contruction)
Visual FoxPro System Events (API Library Construction)

See Also

Note   For an alphabetical listing of all API library construction functions, type the following in the Search box: API library routines.

In this table, each Visual FoxPro event is listed along with the layout of its event record fields and a description of when the event occurs.

Event	EventRec Fields	Description
nullEvent	what = nullEvent where.h = horizontal mouse location where.v = vertical mouse location when = ticks since startup	Occurs when no other events  are pending. This is the most frequently occuring event and, for performance reasons, should be used sparingly.
mouseDownEvent	what = mouseDownEvent where.h = horizontal mouse location where.v = vertical mouse location mbState = left mouse button when = ticks since startup	Occurs whenever the left mouse button is pressed. Trap for the mouseDownEvent and use this in combination with the where point and _FindWindow function to see if the user clicked on the close menu box or on other parts of a window. (A closeEvent is not generated when you click on the close menu box of a window.)
keyDownEvent	what = keyDownEvent where.h = horizontal mouse location where.v = vertical mouse location message = key code  (see Appendix A) modifier = modifier key when = ticks since startup	Occurs whenever a key is pressed on the keyboard or whenever the keyboard buffer is played.
deactivateEvent	what = deactivateEvent where.h = horizontal mouse location where.v = vertical mouse location message = WHANDLE to window when = ticks since startup	Occurs whenever a window becomes deactivated by clicking on the close menu box, activating another window or using the DEACTIVATE WINDOW command. A deactivateEvent is usually followed by an activateEvent.
activateEvent	what = activateEvent where.h = horizontal mouse location where.v = vertical mouse location message = WHANDLE to window when = ticks since startup	Occurs whenever a window is activated. This includes system and user windows as well as dialogs, so it is suggested that whenever you receive this type of event, you check to see if it pertains to your window. An activateEvent is usually preceded by a deactivateEvent.
menuHitEvent	what = menuHitEvent misc = MENUID misc2 = BAR # when = ticks since startup modifier = modifier key	Occurs when a user makes a selection from a menu-type item. Menu-type items include menus, popups and scrollable lists. Because menuHitEvents occur very often, it is best to use the _OnSelection function to do a certain task upon a menu selection so you can eliminate a lot of extra event checking.
closeEvent	what = closeEvent message = WHANDLE to window when = ticks since startup	Occurs when a window is removed from memory with the RELEASE WINDOW command or by exiting Visual FoxPro. To check if a user closed a window by clicking on the close menu box, check for a mouseDownEvent.
hideEvent	what = hideEvent when = ticks since startup	Occurs when a window is hidden with the HIDE WINDOW command.
showEvent	what = showEvent when = ticks since startup	Occurs when a window is shown with the SHOW WINDOW command.
hotkeyEvent	what = hotkeyEvent where.h = horizontal mouse location where.v = vertical mouse location message = key code (see FoxPro Key Codes chapter) modifier = modifier key when = ticks since startup	Occurs when the user presses a key that has actions assigned to it with the ON KEY LABEL command.
sizeEvent	what = sizeEvent when = ticks since startup	Occurs only when a ZOOM WINDOW or SIZE WINDOW command is issued. To check for an instance of a user clicking on the size control of a window, check for a mouseDownEvent.
zoomEvent	what = zoomEvent when = ticks since startup	Occurs only when the ZOOM WINDOW command is executed. To check for the instance of a user clicking on the zoom control, check for a mouseDownEvent.


See Also

Visual FoxPro Key Codes


Visual FoxPro Key Codes (API Library Construction)

See Also	Example

Note   For an alphabetical listing of all API library construction functions, search for this phrase in Help: API library routines.

Most keyboard keys have a constant value even when combined with different modifier keys (SHIFT, CTRL and ALT). All regular keys on the keyboard (alphabet and special characters) have a key code of their ASCII value.

Key code and key modifier values are returned in the EventRec structure. The key code can be found in EventRec.message and the key modifiers can be found in EventRec.modifiers.

Visual FoxPro interprets some keys as having a different value depending on the modifier with which they are combined. For example, if SHIFT+F10 is pressed, the corresponding fields in the EventRec would be:

•	EventRec.message = 15D (Hex)

•	EventRec.modifier = 1000 (Hex)

Similarly, if CTRL+F10 is pressed, the EventRec values would be:

•	EventRec.message = 167 (Hex)

•	EventRec.modifiers = 2000 (Hex)

When more than one modifier is used with a key, the modifier values are added together. For example, if you press CTRL+SHIFT+F10, the following values are returned:

•	EventRec.message = 167 (Hex)

•	EventRec.modifiers = 3000 (Hex)

The EventRec.modifiers value in the preceding example is 0x3000 because both the CTRL and SHIFT modifiers were included in the key press. Thus, the SHIFT key modifier (0x1000) was added to the CTRL key modifier (0x2000) to produce a value of 0x3000.

The manner in which Visual FoxPro interprets keys (specifically keys with modifiers) is inherent to Visual FoxPro. Other programs may interpret keys differently. If a key is pressed in combination with one or multiple modifier keys (SHIFT, CTRL and ALT), the uppermost nibble represents the modifiers that were used.

The following table demonstrates that the F8 key has a different key code depending on the modifier used.

Keys pressed	Modifier	Key value of F8
F8	None	\x142
SHIFT+F8	SHIFT	\x15B
CTRL+F8	CTRL	\x165
ALT+F8	ALT	\x16F
Macintosh keyboard	MS-DOS/Windows equivalent
	CTRL
CTRL+OPTION	ALT
Each special key that can be combined with modifiers has a unique value when combined with each modifier. If a special key is combined with multiple modifiers, the unique value assigned to the key is its value for one of the modifiers according to the following rules:

1.	First check to see if the key combination pressed includes the ALT key because the main key will be assigned its ALT key value.

1.	If the key combination does not include ALT, check to see if the CTRL key modifier was used because the main key will be assigned its CTRL key value.

2.	If no ALT or CTRL key modifier is used, check to see if the SHIFT key modifier was used because the main key will be assigned its SHIFT key value.

1.	Finally, if no modifiers were used, the main key is assigned its value based on no modifiers.

Special Key Codes

The following table lists the key values assigned by Visual FoxPro to special keys on the keyboard.

Key	Key code (Hex)	Key modifier
LEFTMOUSE	100	None
F1	13B	None
F2	13C	None
F3	13D	None
F4	13E	None
F5	13F	None
F6	140	None
F7	141	None
F8	142	None
F9	143	None
F10	144	None
HOME	147	None
UPARROW	148	None
PGUP	149	None
LEFTARROW	14B	None
RIGHTARROW	14D	None
END	14F	None
DNARROW	150	None
PGDN	151	None
INS	152	None
DEL	153	None
F11	185	None
F12	186	None
BACKTAB	10F	shiftKey
SHIFT+F1	154	shiftKey
SHIFT+F2	155	shiftKey
SHIFT+F3	156	shiftKey
SHIFT+F4	157	shiftKey
SHIFT+F5	158	shiftKey
SHIFT+F6	159	shiftKey
SHIFT+F7	15A	shiftKey
SHIFT+F8	15B	shiftKey
SHIFT+F9	15C	shiftKey
SHIFT+F10	15D	shiftKey
SHIFT+F11	187	shiftKey
SHIFT+F12	188	shiftKey
CTRL+A	001	ctrlKey
CTRL+B	002	ctrlKey
CTRL+C	003	ctrlKey
CTRL+D	004	ctrlKey
CTRL+E	005	ctrlKey
CTRL+F	006	ctrlKey
CTRL+G	007	ctrlKey
CTRL+H	008	ctrlKey
CTRL+I	009	ctrlKey
CTRL+ENTER	00A	ctrlKey
CTRL+J	00A	ctrlKey
CTRL+K	00B	ctrlKey
CTRL+L	00C	ctrlKey
CTRL+M	00D	ctrlKey
CTRL+N	00E	ctrlKey
CTRL+O	00F	ctrlKey
CTRL+P	010	ctrlKey
CTRL+Q	011	ctrlKey
CTRL+R	012	ctrlKey
CTRL+S	013	ctrlKey
CTRL+T	014	ctrlKey
CTRL+U	015	ctrlKey
CTRL+V	016	ctrlKey
CTRL+W	017	ctrlKey
CTRL+X	018	ctrlKey
CTRL+Y	019	ctrlKey
CTRL+Z	01A	ctrlKey
CTRL+LBRACKET	01B	ctrlKey
CTRL+BACKSLASH	01C	ctrlKey
CTRL+RBRACKET	01D	ctrlKey
CTRL+CARET	01E	ctrlKey+shiftKey
CTRL+HYPHEN	01F	ctrlKey
CTRL+SPACEBAR	020	ctrlKey
CTRL+F1	15E	ctrlKey
CTRL+F2	15F	ctrlKey
CTRL+F3	160	ctrlKey
CTRL+F4	161	ctrlKey
CTRL+F5	162	ctrlKey
CTRL+F6	163	ctrlKey
CTRL+F7	164	ctrlKey
CTRL+F8	165	ctrlKey
CTRL+F9	166	ctrlKey
CTRL+F10	167	ctrlKey
CTRL+LEFTARROW	173	ctrlKey
CTRL+RIGHTARROW	174	ctrlKey
CTRL+END	175	ctrlKey
CTRL+PGDN	176	ctrlKey
CTRL+HOME	177	ctrlKey
CTRL+PGUP	184	ctrlKey
CTRL+F11	189	ctrlKey
CTRL+F12	18A	ctrlKey
CTRL+UPARROW	18D	ctrlKey
CTRL+DNARROW	191	ctrlKey
CTRL+INS	192	ctrlKey
CTRL+DEL	193	ctrlKey
CTRL+TAB	194	ctrlKey
ALT+Q	110	altKey
ALT+W	111	altKey
ALT+E	112	altKey
ALT+R	113	altKey
ALT+T	114	altKey
ALT+Y	115	altKey
ALT+U	116	altKey
ALT+I	117	altKey
ALT+O	118	altKey
ALT+P	119	altKey
ALT+A	11E	altKey
ALT+S	11F	altKey
ALT+D	120	altKey
ALT+F	121	altKey
ALT+G	122	altKey
ALT+H	123	altKey
ALT+J	124	altKey
ALT+K	125	altKey
ALT+L	126	altKey
ALT+Z	12C	altKey
ALT+X	12D	altKey
ALT+C	12E	altKey
ALT+V	12F	altKey
ALT+B	130	altKey
ALT+N	131	altKey
ALT+M	132	altKey
ALT+F1	168	altKey
ALT+F2	169	altKey
ALT+F3	16A	altKey
ALT+F4	16B	altKey
ALT+F5	16C	altKey
ALT+F6	16D	altKey
ALT+F7	16E	altKey
ALT+F8	16F	altKey
ALT+F9	170	altKey
ALT+F10	171	altKey
ALT+1	178	altKey
ALT+2	179	altKey
ALT+3	17A	altKey
ALT+4	17B	altKey
ALT+5	17C	altKey
ALT+6	17D	altKey
ALT+7	17E	altKey
ALT+8	17F	altKey
ALT+9	180	altKey
ALT+0	181	altKey
ALT+F11	18B	altKey
ALT+F12	18C	altKey
ALT+HOME	197	altKey
ALT+UPARROW	198	altKey
ALT+PGUP	199	altKey
ALT+LEFTARROW	19B	altKey
ALT+RIGHTARROW	19D	altKey
ALT+END	19F	altKey
ALT+DNARROW	1A0	altKey
ALT+PGDN	1A1	altKey
ALT+INS	1A2	altKey
ALT+DEL	1A3	altKey


Visual FoxPro Key Codes Example

FAR EventHandler(WHandle theWindow, EventRec FAR *ev)

{

switch(ev->what)

{

case keyDownEvent:	/* Check the keyDownEvent */

if (ev->modifiers & shiftCodeMask)	/* A modifier was pressed. */

{

if (ev->modifiers & altKey)	/* Check for the ALT Key */

_PutStr("ALT Key Code should be used.\n");

else

if (ev->modifiers & ctrlKey)	/* CTRL Key */

_PutStr("CTRL Key Code should be used.\n");

else

if (ev->modifiers & shiftKey)	/* SHIFT Key */

_PutStr("SHIFT Key Code should be used.\n");

}

else

_PutStr("Regular Key Code should be used.\n");

return NO;	/* Let Visual FoxPro have Key also */

break;

default:

return NO;

}

}

Note   shiftCodeMask, altKey, ctrlKey, and shiftKey are all defined in PRO_EXT.H and PRO_EXT.INC as follows:

#define  shiftCodeMask  0xf000

#define  shiftKey  0x1000

#define  ctrlKey  0x2000

#define  altKey  0x4000


See Also

Visual FoxPro System Events


Using Macros

See Also

If you find yourself using the same keystrokes over and over, or if you would like to automate some keystroke tasks for your users, you can record and save these keystrokes in macros by using the Macros dialog box. This section covers the following topics:

•	Recording macros

•	Editing macros

•	Clearing macro definitions

•	Creating, saving, and restoring macro sets

•	Setting a default macro set

Note   To use macros, any keyboard you use must have function keys F1 to F9, and a CTRL key or an ALT key.

To access the Macros dialog box

•	From the Tools menu, choose Macros.


See Also

CLEAR Command
Clearing Macro Definitions
Creating, Saving, and Restoring Macro Sets
Editing Macros
Macros Dialog Box
ON KEY LABEL Command
PLAY MACRO Command
Recording Macros
RESTORE MACROS Command
SAVE MACROS Command
SET FUNCTION Command
Setting a Default Macro Set


Recording Macros

See Also

You can record keystroke macros in Visual FoxPro through the Macros dialog box.

To record a macro

1	From the Tools menu, choose Macros.

2	In the Macros dialog box, choose Record.

3	Press the key or type the key combination you want to define.

4	Enter a name for the macro or accept the default and then choose OK.

Visual FoxPro begins recording every keystroke.

Note   Macro names cannot contain spaces.

To stop recording a macro

1	From the Tools menu, choose Macros.

2	In the Stop Recording Macro dialog box, choose from the following:

•	To save the macro as is, choose OK.

•	To continue recording, choose Continue.

•	To discard the macro, choose Discard.

•	To insert a literal keystroke (the literal meaning of a key instead of any meaning currently assigned to it), choose Insert Literal.

•	To insert a pause, select Seconds, add the amount of time, and choose Insert Pause.


See Also

Macros Dialog Box
ON KEY LABEL Command
SET FUNCTION Command
Stop Recording Macro Dialog Box


Clearing Macro Definitions

See Also

You can clear macro key definitions through the Macros dialog box.

To clear a macro definition

1	From the Macros dialog box, select a macro from the Individual Macro list.

2	Choose Clear.


See Also

Macros Dialog Box


Editing Macros

See Also

You can edit existing macros through the Macros dialog box.

To edit a macro

1	From the Macros dialog box, select a macro from the Individual Macro list and then choose Edit.

2	Modify the macro contents.

3	Choose OK.


See Also

CLEAR Commands
Macros Dialog Box
SET FUNCTION Command


Creating, Saving, and Restoring Macro Sets

See Also

A macro set is a defined set of keys and their associated macros stored in a file with the extension .FKY. You can create macro sets through the Macros dialog box.

To create a macro set

1	From the Macros dialog box, create individual key macros.

2	Choose Save.

3	In the Save Current Macros To box, enter a name for the macro set and choose Save.

To restore a macro set

1	From the Macros dialog box, choose Restore.

2	Select a macro set file and then choose OK.


See Also

CLEAR Commands
Macros Dialog Box
RESTORE MACROS Command
SAVE MACROS Command


Setting a Default Macro Set

See Also

A default macro set exists when Visual FoxPro starts. You can create and set your own default macro set through the Macros dialog box.

To set a default macro set

1	From the Macros dialog box, create or restore a macro set.

2	Choose Set Default.


See Also

Creating, Saving, and Restoring Macro Sets
Macros Dialog Box
RESTORE MACROS Command


Microsoft Office Compatible 97

Visual FoxPro is a Microsoft Office Compatible 97 product, which means that many of its basic features (including toolbars, menus, and accelerator keys) are similar to those used by Microsoft Office. If you are already using Office or an Office Compatible 97 product, then you will see that many tasks can be completed in a similar manner in Visual FoxPro. These similarities will make it easier for you to use Office Compatible 97 products together.

Look for the Microsoft Office Compatible 97 logo when purchasing software. For more information about the Microsoft Office Compatible 97 program, and for a complete listing of Microsoft Office Compatible 97 products, please see our Web site at http://www.microsoft.com/msoffice/ofccomp or call Microsoft Customer Service at 1-800-426-9400. Customers outside the United States should contact their local Microsoft office.

Office Compatible Features Supported By Visual FoxPro

Visual FoxPro includes the following Office Compatible features:

•	Windows NT and Windows 95 logo design features set.

•	Main menu bar and accelerator keys.

•	Drop-down menus with accelerator keys.

•	Popup menus.

•	Basic dialog boxes, including Open, Save As, and Print.

•	HTML support through the WWW Search Page Wizard.

•	Standard toolbar and toolbar configuration dialog boxes.

•	Office Compatible Help Topic.

Using Visual FoxPro with Microsoft Office

You can integrate Visual FoxPro for Windows with other Office applications in many ways. The following list describes some of the ways you can use Visual FoxPro.

•	From Visual FoxPro, launch Microsoft Excel and open a spreadsheet using Automation. You can do this using the Visual FoxPro interface or programmatically using CREATEOBJECT( ) or GETOBJECT( ) functions.

•	Embed a Microsoft Word document in an OLE container control and place it on a form.

•	Drag selected text from a Microsoft Word document and drop it in a RichEditBox control.

Note   Other Microsoft Office products use CTRL+Y for redo, but in Visual FoxPro use CTRTL+R for redo, and for backward compatibility with earlier versions of FoxPro, use CRTL+Y to add a record to a Browse window.


Visual FoxPro and Other Programming Languages

See Also

Most programming languages have similar basic features. If you are familiar with one programming language, you can easily translate this knowledge to another language. Choose an item below to see a comparison of Visual FoxPro with BASIC, C/C++, and Pascal.

To compare	See
Whether the language is case-sensitive	Case Sensitivity
How variables are declared	Variable Declaration
How to insert comments in programs	Comments
How to store values to variables	Assignment Statements
The structure of IF statements	IF Statements
The structure of CASE statements	CASE Statements
The structure of FOR loops	FOR Loops
The structure of WHILE loops	WHILE Loops
How parameters are passed by value	Parameter Passing by Value
How parameters are passed by reference	Parameter Passing by Reference


See Also

Assignment Statements
Case Sensitivity
CASE Statements
Comments
FOR Loops
IF Statements
Parameter Passing by Reference
Parameter Passing by Value
Variable Declaration
WHILE Loops


Case Sensitivity

See Also

Neither Visual FoxPro nor BASIC are case-sensitive programming languages.

Visual FoxPro	BASIC
Not case-sensitive	Not case-sensitive
Pascal	C/C++
Case-sensitive	Case-sensitive


See Also

Assignment Statements
CASE Statements
Comments
FOR Loops
IF Statements
Parameter Passing by Reference
Parameter Passing by Value
Variable Declaration
WHILE Loops


Variable Declaration

See Also

When you store a value to a variable and the variable does not exist, Visual FoxPro implicitly declares it. Languages that require explicit declaration of variables will return an error.

In Visual FoxPro, you do not assign a data type to a variable (although it is recommended that you name your variable with a prefix suggesting the data type you will use it for). Other languages require that you assign a data type to a variable when you declare it.

Visual FoxPro	BASIC
Variables are implicitly declared; no data typing.	Variables can be implicitly declared; variable name dictates data type.
Pascal	C/C++
Variables must be explicitly declared and assigned a data type.	Variables must be explicitly declared and assigned a data type.


See Also

Assignment Statements
Case Sensitivity
CASE Statements
Comments
FOR Loops
IF Statements
Parameter Passing by Reference
Parameter Passing by Value
WHILE Loops


Comments

See Also

Each language has its own format for adding comments to programs. Visual FoxPro, C, and C++ have different formats for whole line comments and comments on partial lines.

Visual FoxPro	BASIC
* full line USE    && end of line NOTE multiline ;      comment	' comment
Pascal	C/C++
{ comment }	// comment /* multiline    comment */


See Also

Assignment Statements
Case Sensitivity
CASE Statements
FOR Loops
IF Statements
Parameter Passing by Reference
Parameter Passing by Value
Variable Declaration
WHILE Loops


Assignment Statements

See Also

Pascal requires a colon in the assignment statement.

Visual FoxPro	BASIC
nVal = 7 –or– STORE 7 to nVal	nVal = 7
Pascal	C/C++
nVal := 7	nVal = 7
Note   In Visual FoxPro, you can also assign values to fields in a table with the REPLACE command.


See Also

Case Sensitivity
CASE Statements
Comments
FOR Loops
IF Statements
Parameter Passing by Reference
Parameter Passing by Value
Variable Declaration
WHILE Loops


IF Statements

See Also

Each language offers equivalent IF functionality.

Visual FoxPro	BASIC
IF nCnt < nMax  nTot = nTot * nCnt  nCnt = nCnt + 1 ENDIF	If nCnt < nMax Then  nTot = nTot * nCnt  nCnt = nCnt + 1 End If
Pascal	C/C++
if nCnt < nMax then  begin   nTot:=nTot * nCnt;   nCnt:=nCnt + 1;  end	if(nCnt < nMax) {  nTot *= nCnt;  nCnt++;  }


See Also

Assignment Statements
Case Sensitivity
CASE Statements
Comments
FOR Loops
Parameter Passing by Reference
Parameter Passing by Value
Variable Declaration
WHILE Loops


CASE Statements

See Also

Only Pascal does not offer defaults in CASE statements.

Visual FoxPro	BASIC
DO CASE  CASE n = 0   ? 'Zero'  CASE n > 0   ? 'Pos'  OTHERWISE   ? 'Neg' ENDCASE	Select Case n  Case 0   Print 'Zero'  Case Is > 0   Print 'Pos'  Case Else   Print 'Neg' End Select
Pascal	C/C++
case n of  0: writeln("Zero");  1: writeln("One"); end	switch(n) {  case 0:   printf("Zero\n");   break;  case 1:   printf("One\n");   break;  default:   printf("?\n");}


See Also

Assignment Statements
Case Sensitivity
Comments
FOR Loops
IF Statements
Parameter Passing by Reference
Parameter Passing by Value
Variable Declaration
WHILE Loops


FOR Loops

See Also

Each language offers a FOR statement; C/C++ has the most flexibility for expressions.

Visual FoxPro	BASIC
FOR n = 1 TO 10  ? n ENDFOR	For n = 1 to 10  Print n Next n
Pascal	C/C++
for n := 1 to 10 do   writeln(n);	for(n=1; n<11; n++)  printf("%d\n",n);


See Also

Assignment Statements
Case Sensitivity
CASE Statements
Comments
IF Statements
Parameter Passing by Reference
Parameter Passing by Value
Variable Declaration
WHILE Loops


WHILE Loops

See Also

Each language offers equivalent WHILE loop functionality.

Visual FoxPro	BASIC
DO WHILE n < 100  n = n + n ENDDO	Do While n < 100  n = n + n Loop
Pascal	C/C++
while n < 100 do  n := n + n;	while(n < 100)  n += n;


See Also

Assignment Statements
Case Sensitivity
CASE Statements
Comments
FOR Loops
IF Statements
Parameter Passing by Reference
Parameter Passing by Value
Variable Declaration


Parameter Passing by Value

See Also

Each language permits passing parameters by value.

Visual FoxPro	BASIC
=ABC(X)	ABC ByVal X
Pascal	C/C++
procedure ABC (x:integer);	ABC(X);


See Also

Assignment Statements
Case Sensitivity
CASE Statements
Comments
FOR Loops
IF Statements
Parameter Passing by Reference
Variable Declaration
WHILE Loops


Parameter Passing by Reference

See Also

You can pass parameters by reference two ways in Visual FoxPro.

Visual FoxPro	BASIC
=ABC(@X) –or– DO ABC WITH X	ABC X
Pascal	C/C++
procedure ABC  var x:integer);	ABC(&VAR);


See Also

Assignment Statements
Case Sensitivity
CASE Statements
Comments
FOR Loops
IF Statements
Parameter Passing by Value
Variable Declaration
WHILE Loops


Reserved Words

Reserved words in Visual FoxPro include functions, system variables, properties, events, methods, commands, and clauses. When programming, avoid using reserved words as names (for example, window, table, and field names). If you use a reserved word as a name, it might generate a syntax error.

The following are all Visual FoxPro reserved words.

Symbols

!	!=	[
]	^	$
%	)	*
**	+	,
-	->	.
.AND.	.F.	.N.
.NOT.	.NULL.	.OR.
.T.	.Y.	/
/R	:	::
;	<	<=
<>	<??>	=
==	>	>=
?	??	???
@	#	#DEFINE
#ELIF	#ELSE	#ENDIF
#IF	#ITSEXPRESSION	#READCLAUSES
#REGION	#SECTION	#UNDEF
#WNAME
A

ABS	ACCELERATE	ACCEPT
ACCESS	ACLASS	ACOPY
ACOS	ACTIVATE	ACTIVATECELL
ACTIVECOLUMN	ACTIVECONTROL	ACTIVEFORM
ACTIVEOBJECTID	ACTIVEPAGE	ACTIVEROW
ADATABASES	ADBOBJECTS	ADD
ADDCOLUMN	ADDITEM	ADDITIVE
ADDLISTITEM	ADDOBJECT	ADDRELATIONTOENV
ADDTABLETOENV	ADEL	ADIR
AELEMENT	AERROR	AFIELDS
AFONT	AFTER	AFTERCLOSETABLES
AFTERDOCK	AFTERROWCOLCHANGE	AGAIN
AINDENT	AINS	AINSTANCE
ALEN	ALIAS	ALIGNMENT
_ALIGNMENT	ALL	ALLOWADDNEW
ALLOWHEADERSIZING	ALLOWRESIZE	ALLOWROWSIZING
ALLOWTABS	ALLTRIM	ALT
ALTER	ALTERNATE	ALWAYSONTOP
AMEMBERS	AND	ANSI
ANSITOOEM	ANY	APLABOUT
APP	APPEND	APPLICATION
APRINTERS	ARRAY	AS
ASC	ASCAN	ASCENDING
ASCII	_ASCIICOLS	_ASCIIROWS
ASELOBJ	ASIN	ASORT
ASSERT	ASSERTS	ASSIST
_ASSIST	ASUBSCRIPT	ASYNCHRONOUS
AT	ATAN	ATC
ATCC	ATCLINE	ATGETCOLORS
ATLINE	ATLISTCOLORS	ATN2
ATTRIBUTES	AT_C	AUSED
AUTOACTIVATE	AUTOCENTER	AUTOCLOSETABLES
AUTOFORM	AUTOMATIC	AUTOOPENTABLES
AUTORELEASE	AUTOREPORT	AUTOSAVE
AUTOSIZE	AUTOVERBMENU	AUTOYIELD
AVAILNUM	AVERAGE	AVG
B

BACKCOLOR	BACKSTYLE	BAR
BASECLASS	BATCHMODE	BATCHUPDATECOUNT
_BEAUTIFY	BEFORE	BEFOREDOCK
BEFOREOPENTABLES	BEFOREROWCOLCHANGE	BEGIN
BELL	BELLSOUND	BETWEEN
BINTOC	BINTOC	BITAND
BITCLEAR	BITLSHIFT	BITMAP
BITNOT	BITOR	BITRSHIFT
BITSET	BITTEST	BITXOR
BLANK	BLINK	BLOCKSIZE
BOF	BORDER	BORDERCOLOR
BORDERSTYLE	BORDERWIDTH	BOTTOM
BOUND	BOUNDCOLUMN	BOUNDTO
BOX	_BOX	BROWSE
BROWSEALIGNMENT	BROWSECELLMARG	BROWSEDESTWIDTH
_BROWSER	BROWSEREFRESH	BRSTATUS
BUCKET	BUFFERING	BUFFERMODE
BUFFERMODEOVERRIDE	BUFFERS	BUILD
_BUILDER	BUILDERLOCK	BUTTONCOUNT
BUTTONINDEX	BUTTONS	BY
C

_CALCMEM	CALCULATE	_CALCVALUE
CALL	CANACCELERATE	CANCEL
CANDIDATE	CANGETFOCUS	CANLOSEFOCUS
CAPSLOCK	CAPTION	CARRY
CASCADE	CASE	CATALOG
CD	CDOW	CDX
CEILING	CENTER	CENTRAL
CENTURY	CGA	CHANGE
CHAR	CHARACTER	CHDIR
CHECK	CHECKBOX	CHILDALIAS
CHILDORDER	CHR	CHRSAW
CHRTRAN	CHRTRANC	CIRCLE
CLASS	CLASSLIB	CLASSLIBRARY
CLEAR	CLICK	CLIPCONTROLS
CLIPRECT	_CLIPTEXT	CLOCK
CLONEOBJECT	CLOSABLE	CLOSE
CLOSEEDITOR	CLOSETABLES	CLS
CMONTH	CNT	CNTBAR
CNTPAD	CODEPAGE	COL
COLLATE	COLOR	COLORSCHEME
COLORSOURCE	COLUMN	COLUMNCOUNT
COLUMNHEADERS	COLUMNLINES	COLUMNORDER
COLUMNS	COLUMNWIDTHS	COM1
COM2	COMBOBOX	COMMAND
COMMANDBUTTON	COMMANDGROUP	COMMENT
COMPACT	COMPATIBLE	COMPILE
COMPLETED	COMPOBJ	COMPRESS
COMPUTE	CONCAT	CONFIRM
CONNECTBUSY	CONNECTHANDLE	CONNECTION
CONNECTIONS	CONNECTNAME	CONNECTSTRING
CONNECTTIMEOUT	CONNSTRING	CONSOLE
CONTAINER	CONTINUE	CONTROL
CONTROLBOX	CONTROLCOUNT	CONTROLINDEX
CONTROLS	CONTROLSOURCE	_CONVERTER
COPIES	COPY	COS
COT	COUNT	COVERAGE
_COVERAGE	CPCOMPILE	CPCONVERT
CPCURRENT	CPDBF	CPDIALOG
CPNOTRANS	CREATE	CREATEOBJECT
CREATEOFFLINE	CRSBUFFERING	CRSFETCHMEMO
CRSFETCHSIZE	CRSMAXROWS	CRSMETHODUSED
CRSNUMBATCH	CRSSHARECONNECTION	CRSUSEMEMOSIZE
CRSWHERECLAUSE	CTOBIN	CTOBIN
CTOD	CTOT	CURDATE
CURDIR	_CUROBJ	CURRENCY
CURRENTCONTROL	CURRENTX	CURRENTY
CURRLEFT	CURRSYMBOL	CURSOR
CURSORSOURCE	CURTIME	CURVAL
CURVATURE	CUSTOM	CYCLE
D

DATABASE	DATABASES	DATAENVIRONMENT
DATASESSION	DATASESSIONID	DATASOURCE
DATASOURCEOBJ	DATATOCLIP	DATATYPE
DATE	DATEFORMAT	DATEMARK
DATETIME	DAY	DAYNAME
DAYOFMONTH	DAYOFWEEK	DAYOFYEAR
DB4	DBALIAS	DBC
DBFDBLCLICK	_DBLCLICK	DBMEMO3
DBUSED	DB_BUFLOCKROW	DB_BUFLOCKTABLE
DB_BUFOFF	DB_BUFOPTROW	DB_BUFOPTTABLE
DB_COMPLETTE	DB_DELETEINSERT	DB_KEYANDMODIFIED
DB_KEYANDTIMESTAMP	DB_KEYANDUPDATABLE	DB_LOCALSQL
DB_NOPROMPT	DB_PROMPT	DB_REMOTESQL
DB_TRANSAUTO	DB_TRANSMANUAL	DB_TRANSNONE
DB_UPDATE	DDEABORTTRANS	DDEADVISE
DDEENABLED	DDEEXECUTE	DDEINITIATE
DDELASTERROR	DDEPOKE	DDEREQUEST
DDESETOPTION	DDESETSERVICE	DDESETTOPIC
DDETERMINATE	DEACTIVATE	DEBUG
DEBUGOUT	DECIMALS	DECLARE
DEFAULT	DEFAULTFILEPATH	DEFAULTSOURCE
DEFAULTVALUE	DEFBUTTON	DEFBUTTONORIG
DEFHEIGHT	DEFINE	DEFINEWINDOWS
DEFLEFT	DEFTOP	DEFWIDTH
DEGREES	DELETE	DELETECOLUMN
DELETED	DELETEMARK	DELETETABLES
DELETETRIGGER	DELIMITED	DELIMITERS
DESC	DESCENDING	DESCRIPTION
DESIGN	DESKTOP	DESTROY
DEVELOPMENT	DEVICE	_DIARYDATE
DIF	DIFFERENCE	DIMENSION
DIR	DIRECTORY	DIRTY
DISABLED	DISABLEDBACKCOLOR	DISABLEDBYEOF
DISABLEDFORECOLOR	DISABLEDITEMBACKCOLOR	DISABLEDITEMFORECOLOR
DISABLEDPICTURE	DISKSPACE	DISPLAY
DISPLAYVALUE	DISPLOGIN	DISPPAGEHEIGHT
DISPPAGEWIDTH	DISPWARNINGS	DISTINCT
DLL	DLLS	DMY
DO	DOC	DOCK
DOCKED	DOCKPOSITION	DOCMD
DOCREATE	DOCUMENTFILE	DODEFAULT
DOEVENTS	DOEVENTS	DOHISTORY
DOS	_DOS	DOSCROLL
DOSMEM	DOUBLE	DOVERB
DOW	DOWNCLICK	DOWNPICTURE
DRAG	DRAGDROP	DRAGICON
DRAGMODE	DRAGOVER	DRAGSTATE
DRAW	DRAWMODE	DRAWSTYLE
DRAWWIDTH	DRIVER	DROP
DROPDOWN	DROPOFFLINE	DTOC
DTOR	DTOS	DTOT
DUPLEX	DYNAMICALIGNMENT	DYNAMICBACKCOLOR
DYNAMICCURRENTCONTROL	DYNAMICFONTBOLD	DYNAMICFONTITALIC
DYNAMICFONTNAME	DYNAMICFONTOUTLINE	DYNAMICFONTSHADOW
DYNAMICFONTSIZE	DYNAMICFONTSTRIKETHRU	DYNAMICFONTUNDERLINE
DYNAMICFORECOLOR
E

EACH	ECHO	EDIT
EDITBOX	EDITFLAGS	EDITWORK
EGA25	EGA43	EJECT
ELIF	ELSE	EMPTY
EMS	EMS64	ENABLED
ENABLEDBYREADLOCK	ENCRYPT	ENCRYPTION
END	ENDCASE	ENDDEFINE
ENDDO	ENDFOR	ENDFUNC
ENDIF	ENDPRINTJOB	ENDPROC
ENDSCAN	ENDTEXT	ENDWITH
ENVIRONMENT	ENVLEVEL	EOF
ERASE	ERASEPAGE	ERROR
ERRORMESSAGE	ESCAPE	EVALUATE
EVENTS	EVENTTRACKING	EXACT
EXCEPT	EXCLUSIVE	EXE
EXISTS	EXIT	EXP
EXPORT	EXPRESSION	EXTENDED
EXTERNAL
F

F	F11F12	FCHSIZE
FCLOSE	FCOUNT	FCREATE
FDOW	FEOF	FERROR
FETCH	FETCHMEMO	FETCHSIZE
FFLUSH	FGETS	FIELD
FIELDS	FILE	FILER
FILES	FILL	FILLCOLOR
FILLSTYLE	FILTER	FIND
FIRSTELEMENT	FIXED	FKLABEL
FKMAX	FLDLIST	FLOAT
FLOCK	FLOOR	FLUSH
FOLDCONST	FONT	FONTBOLD
FONTCLASS	FONTITALIC	FONTMETRIC
FONTNAME	FONTOUTLINE	FONTSHADOW
FONTSIZE	FONTSTRIKETHRU	FONTUNDERLINE
FOOTER	FOPEN	FOR
FORCE	FORCEFOCUS	FORECOLOR
FOREIGN	FORM	FORMAT
FORMATCHANGE	FORMCOUNT	FORMINDEX
FORMPAGECOUNT	FORMPAGEINDEX	FORMS
FORMSCLASS	FORMSET	FORMSETCLASS
FORMSETLIB	FORMSLIB	FOUND
FOX2X	FOXCODE	FOXDOC
_FOXDOC	FOXFONT	FOXGEN
FOXGRAPH	_FOXGRAPH	FOXPLUS
FOXPRO	FOXVIEW	FPUTS
FREAD	FREE	FREEZE
FRENCH	FROM	FSEEK
FSIZE	FULLNAME	FULLPATH
FUNCTION	FV	FW2
FWEEK	FWRITE
G

GATHER	GENERAL	_GENGRAPH
_GENMENU	_GENPD	_GENSCRN
_GENXTAB	GERMAN	GET
GETBAR	GETCOLOR	GETCP
GETDIR	GETENV	GETEXPR
GETFILE	GETFLDSTATE	GETFONT
GETNEXTMODIFIED	GETOBJECT	GETPAD
GETPICT	GETPRINTER	GETS
GLOBAL	GO	GOFIRST
GOLAST	GOMONTH	GOTFOCUS
GOTO	GRAPH	GRID
GRIDHORZ	GRIDLINECOLOR	GRIDLINES
GRIDLINEWIDTH	GRIDSHOW	GRIDSHOWPOS
GRIDSNAP	GRIDVERT	GROUP
GROW
H

HALFHEIGHT	HALFHEIGHTCAPTION	HASCLIP
HAVING	HEADER	HEADERGAP
HEADERHEIGHT	HEADING	HEADINGS
HEIGHT	HELP	HELPCONTEXTID
HELPFILTER	HELPON	HELPTO
HIDDEN	HIDE	HIDESELECTION
HIGHLIGHT	HISTORY	HMEMORY
HOSTNAME	HOTKEY	HOUR
HOURS	HOURS	HPROJ
HWND
I

ICON	ID	IDLETIMEOUT
IDXCOLLATE	IF	IFDEF
IFNDEF	IGNOREINSERT	IIF
IMAGE	IMEMODE	IMESTATUS
IMPORT	IN	INCLUDE
INCREMENT	INCREMENTALSEARCH	INDBC
_INDENT	INDEX	INDEXES
INDEXTOITEMID	INFORMATION	INIT
INITIALSELECTEDALIAS	INKEY	INLIST
INPUT	INPUTMASK	INRESIZE
INSERT	INSERTTRIGGER	INSMODE
INSTRUCT	INT	INTEGER
INTEGRALHEIGHT	INTENSITY	INTERACTIVECHANGE
INTERSECT	INTERVAL	INTO
IS	ISALPHA	ISCOLOR
ISDIGIT	ISEXCLUSIVE	ISFLOCKED
ISFLOCKED	ISLEADBYTE	ISLOWER
ISNULL	ISOMETRIC	ISREADONLY
ISRLOCKED	ISRLOCKED	ISUPPER
ITALIAN	ITEMBACKCOLOR	ITEMDATA
ITEMFORECOLOR	ITEMIDDATA	ITEMIDTOINDEX
ITEMTIPS
J

JAPAN	JOIN	JUSTREADLOCKED
K

KEY	KEYBOARD	KEYBOARDHIGHVALUE
KEYBOARDLOWVALUE	KEYCOLUMNS	KEYCOMP
KEYFIELD	KEYFIELDLIST	KEYMATCH
KEYPRESS	KEYPREVIEW	KEYSET
L

LABEL	LAST	LASTKEY
LASTPROJECT	LCASE	LEDIT
LEFT	LEFTC	LEFTCOLUMN
LEN	LENC	LENGTH
LEVEL	LIBRARY	LIKE
LINE	LINENO	LINESLANT
LINKED	LINKMASTER	LIST
LISTBOX	LISTCOUNT	LISTINDEX
LISTITEM	LISTITEMID	_LMARGIN
LOAD	LOADPICTURE	LOADPICTURE
LOCAL	LOCATE	LOCFILE
LOCK	LOCKDATASOURCE	LOCKSCREEN
LOG	LOG10	LOGERRORS
LOGOUT	LONG	LOOKUP
LOOP	LOSTFOCUS	LOWER
LPARAMETER	LPARAMETERS	LPARTITION
LTRIM	LUPDATE
M

MAC	_MAC	MACDESKTOP
MACHELP	MACKEY	MACROS
MAIL	MARGIN	MARK
MASTER	MAX	MAXBUTTON
MAXHEIGHT	MAXLEFT	MAXLENGTH
MAXMEM	MAXRECORDS	MAXTOP
MAXWIDTH	_MBROWSE	_MBR_APPND
_MBR_CPART	_MBR_DELET	_MBR_FONT
_MBR_GOTO	_MBR_GRID	_MBR_LINK
_MBR_MODE	_MBR_MVFLD	_MBR_MVPRT
_MBR_SEEK	_MBR_SP100	_MBR_SP200
_MBR_SZFLD	MCOL	MD
_MDATA	_MDA_APPND	_MDA_AVG
_MDA_BROW	_MDA_CALC	_MDA_COPY
_MDA_COUNT	_MDA_LABEL	_MDA_PACK
_MDA_REPRT	_MDA_RINDX	_MDA_SETUP
_MDA_SORT	_MDA_SP100	_MDA_SP200
_MDA_SP300	_MDA_SUM	_MDA_TOTAL
MDI	_MDIARY	MDIFORM
MDOWN	MDX	MDY
_MEDIT	_MED_CLEAR	_MED_COPY
_MED_CUT	_MED_CVTST	_MED_FIND
_MED_FINDA	_MED_GOTO	_MED_INSOB
_MED_LINK	_MED_OBJ	_MED_PASTE
_MED_PREF	_MED_PSTLK	_MED_REDO
_MED_REPL	_MED_REPLA	_MED_SLCTA
_MED_SP100	_MED_SP200	_MED_SP300
_MED_SP400	_MED_SP500	_MED_UNDO
MEMLIMIT	MEMLINES	MEMO
MEMORY	MEMOS	MEMOWIDTH
MEMOWINDOW	MEMVAR	MENU
MENUS	MESSAGE	MESSAGEBOX
MESSAGES	_MFILE	_MFILER
_MFIRST	_MFI_CLALL	_MFI_CLOSE
_MFI_EXPORT	_MFI_IMPORT	_MFI_NEW
_MFI_OPEN	_MFI_PGSET	_MFI_PREVU
_MFI_PRINT	_MFI_QUIT	_MFI_REVRT
_MFI_SAVAS	_MFI_SAVE	_MFI_SEND
_MFI_SETUP	_MFI_SP100	_MFI_SP200
_MFI_SP300	_MFI_SP400	MIDDLE
MIDDLECLICK	MIN	MINBUTTON
MINHEIGHT	MINIMIZE	MINUS
MINUTE	MINWIDTH	MKDIR
_MLABEL	_MLAST	MLINE
_MLINE	_MMACRO	_MMBLDR
MOD	MODAL	MODIFY
MODULE	MONO43	MONTH
MONTHNAME	MOUSE	MOUSEDOWN
MOUSEICON	MOUSEMOVE	MOUSEPOINTER
MOUSEUP	MOUSEWHEEL	MOVABLE
MOVE	MOVED	MOVERBARS
MOVERS	_MPROG	_MPROJ
_MPR_BEAUT	_MPR_CANCL	_MPR_COMPL
_MPR_DO	_MPR_DOCUM	_MPR_FORMWZ
_MPR_GENER	_MPR_GRAPH	_MPR_RESUM
_MPR_SP100	_MPR_SP200	_MPR_SP300
_MPR_SUSPEND	_MRC_APPND	_MRC_CHNGE
_MRC_CONT	_MRC_DELET	_MRC_GOTO
_MRC_LOCAT	_MRC_RECAL	_MRC_REPL
_MRC_SEEK	_MRC_SP100	_MRC_SP200
_MRECORD	_MREPORT	MRKBAR
MRKPAD	MROW	_MRQBE
_MSCREEN	_MSM_DATA	_MSM_EDIT
_MSM_FILE	_MSM_FORMAT	_MSM_PROG
_MSM_RECRD	_MSM_SYSTM	_MSM_TEXT
_MSM_TOOLS	_MSM_VIEW	_MSM_WINDO
_MST_ABOUT	_MST_ASCII	_MST_CALCU
_MST_CAPTR	_MST_DBASE	_MST_DIARY
_MST_FILER	_MST_HELP	_MST_HPHOW
_MST_HPSCH	_MST_MACRO	_MST_OFFICE
_MST_PUZZL	_MST_SP100	_MST_SP200
_MST_SP300	_MST_SPECL	_MSYSMENU
_MSYSTEM_MTABLE	_MTB_APPND	_MTB_CPART
_MTB_DELET	_MTB_DELRC	_MTB_GOTO
_MTB_LINK	_MTB_MVFLD	_MTB_MVPRT
_MTB_PROPS	_MTB_RECAL	MTB_SP100
_MTB_SP200	_MTB_SP300	_MTB_SP400
_MTB_SZFLD	MTON	MULTILOCKS
MULTISELECT	MVARSIZ	MVCOUNT
MWINDOW	_MWINDOW	_MWIZARDS
_MWI_ARRAN	_MWI_CLEAR	_MWI_CMD
_MWI_COLOR	_MWI_DEBUG	_MWI_HIDE
_MWI_HIDEA	_MWI_MIN	_MWI_MOVE
_MWI_ROTAT	_MWI_SHOWA	_MWI_SIZE
_MWI_SP100	_MWI_SP200	_MWI_TOOLB
_MWI_TRACE	_MWI_VIEW	_MWI_ZOOM
_MWZ_ALL	_MWZ_FORM	_MWZ_FOXDOC
_MWZ_IMPORT	_MWZ_LABEL	_MWZ_MAIL
_MWZ_PIVOT	_MWZ_QUERY	_MWZ_REPRT
_MWZ_SETUP	_MWZ_TABLE	_MWZ_UPSIZING
N

N	NAME	NAPTIME
NATIVE	NDX	NEAR
NEGOTIATE	_NETWARE	NETWORK
NEWINDEX	NEWITEMID	NEXT
NOALIAS	NOAPPEND	NOCLEAR
NOCLOSE	NOCONSOLE	NOCPTRANS
NODATA	NODATAONLOAD	NODEBUG
NODEFAULT	NODEFINE	NODELETE
NODUP	NOEDIT	NOEJECT
NOENVIRONMENT	NOFLOAT	NOFOLLOWNOGROW
NOINIT	NOLGRID	NOLINK
NOLOCK	NOMARGIN	NOMDI
NOMENU	NOMINIMIZE	NOMODIFY
NOMOUSE	NONE	NOOPTIMIZE
NOOVERWRITE	NOPROMPT	NOREAD
NOREFRESH	NOREQUERY	NORGRID
NORM	NORMAL	NORMALIZE
NOSAVE	NOSHADOW	NOSHOW
NOSPACE	NOT	NOTAB
NOTE	NOTIFY	NOTIFYCONTAINER
NOUPDATE	NOVALIDATE	NOVERIFY
NOW	NOWAIT	NOWINDOW
NOWRAP	NOZOOM	NPV
NTOM	NULL	NULLDISPLAY
NULLSTRING	NUMBER	NUMBEROFELEMENTS
NUMLOCK	NVL
O

OBJECTS	OBJNUM	OBJREF
OBJTOCLIENT	OBJVAR	OCCURS
ODBCHDBC	ODBCHSTMT	ODOMETER
OEMTOANSI	OF	OFF
OLDVAL	OLEBASECONTROL	OLEBOUNDCONTROL
OLECLASS	OLECLASSID	OLECLASSIDISPOUT
OLECONTROL	OLECONTROLCONTAINER	OLEIDISPATCHINCOMING
OLEIDISPATCHOUTGOING	OLEIDISPINVALUE	OLEIDISPOUTVALUE
OLEOBJECTS	OLEPUBLIC	OLEREQUESTPENDINGTIMOU
OLESERVERBUSYRAISEERRO	OLESERVERBUSYTIMOUT	OLETYPEALLOWED
ON	ONETOMANY	ONLY
ONRESIZE	OPEN	OPENEDITOR
OPENTABLES	OPENVIEWS	OPENWINDOW
OPTIMIZE	OPTIONBUTTON	OPTIONGROUP
OR	ORACLE	_ORACLE
ORDER	ORIENTATION	OS
OTHERWISE	OUTER	OUTPUT
OUTSHOW	OVERLAY	OVERWRITE
P

PACK	PACKETSIZE	PAD
PADC	PADL	PADR
_PADVANCE	PAGE	PAGECOUNT
PAGEFRAME	PAGEHEIGHT	_PAGENO
PAGEORDER	PAGES	PAGEWIDTH
PAINT	PALETTE	PANEL
PANELLINK	PAPERLENGTH	PAPERSIZE
PAPERWIDTH	PARAMETERS	PARENT
PARENTALIAS	PARENTCLASS	PARTITION
PASSWORD	PASSWORDCHAR	PATH
PATTERN	PAUSE	PAYMENT
_PBPAGE	PCOL	_PCOLNO
_PCOPIES	PDOX	_PDPARMS
_PDRIVER	PDSETUP	_PDSETUP
_PECODE	_PEJECT	PEN
_PEPAGE	_PFORM	PFS
PI	PICTURE	PIVOT
PIXELS	PLAIN	PLAY
_PLENGTH	_PLINENO	_PLOFFSET
POINT	POP	POPUPS
POWER	_PPITCH	_PQUALITY
PRECISION	PREFERENCE	_PRETEXT
PREVIEW	PRIMARY	PRIMARYKEY
PRINT	PRINTER	PRINTJOB
PRINTQUALITY	PRINTSTATUS	PRIVATE
PRMBAR	PRMPAD	PROCEDURE
PROCEDURES	PRODUCTION	PROGRAM
PROGRAMMATICCHANGE	PROGWORK	PROJECT
PROJECTCLICK	PROMPT	PROPER
PROTECTED	PROW	PRTINFO
_PSCODE	PSET	_PSPACING
PUBLIC	PUSH	PUTFILE
PV	_PWAIT
Q

QPR	QUARTER	QUERY
QUERYTIMEOUT	QUERYUNLOAD	QUIT
R

RADIANS	RAND	RANDOM
RANGE	RANGEHIGH	RANGELOW
RAT	RATC	RATLINE
RD	RDLEVEL	READ
READACTIVATE	READBORDER	READCOLORS
READCYCLE	READDEACTIVATE	READERROR
READEXPRESSION	READFILLER	READKEY
READLOCK	READMETHOD	READMOUSE
READONLY	READSAVE	READSHOW
READSIZE	READTIMEOUT	READVALID
READWHEN	RECALL	RECCOUNT
RECENTLYUSEDFILES	RECNO	RECORD
RECORDMARK	RECORDSOURCE	RECORDSOURCETYPE
RECOVER	RECSIZE	RECT
RECTCLASS	REDIT	REFERENCE
REFERENCES	REFRESH	REGIONAL
REINDEX	RELATEDCHILD	RELATEDTABLE
RELATEDTAG	RELATION	RELATIONALEXPR
RELATIVE	RELATIVECOLUMN	RELATIVEROW
RELEASE	RELEASEERASE	RELEASETYPE
RELEASEWINDOWS	REMOTE	REMOVE
REMOVEITEM	REMOVELISTITEM	REMOVEOBJECT
RENAME	REPEAT	REPLACE
REPLICATE	REPORT	REPROCESS
REQUERY	REQUESTDATA	RESET
RESHEIGHT	RESIZABLE	RESIZE
RESOURCE	RESOURCEON	RESOURCES
RESOURCETO	REST	RESTORE
RESTRICT	RESUME	RESWIDTH
RETRY	RETURN	REVERTOFFLINE
RGB	RGBSCHEME	RIGHT
RIGHTC	RIGHTCLICK	RIGHTTOLEFT
RLOCK	_RMARGIN	RMDIR
ROLLBACK	ROUND	ROW
ROWHEIGHT	ROWSET	ROWSOURCE
ROWSOURCETYPE	RPD	RTOD
RTRIM	RULEEXPRESSION	RULETEXT
RUN	RUNSCRIPT	RUNTIME
RVIEW
S

SAFETY	SAME	SAMPLE
SAVE	SAVEAS	SAVEASCLASS
SAVEPICTURE	SAVEPICTURE	SAY
SCALE	SCALEMODE	SCALEUNITS
SCAN	SCATTER	_SCCTEXT
SCHEME	SCOLS	SCOREBOARD
SCREEN	_SCREEN	SCROLLSCROLLBARS
SCROLLED	SDF	SDIFORM
SEC	SECOND	SECONDS
SEEK	SELECT	SELECTED
SELECTEDBACKCOLOR	SELECTEDFORECOLOR	SELECTEDID
SELECTEDITEMBACKCOLOR	SELECTEDITEMFORECOLOR	SELECTION
SELECTONENTRY	SELFEDIT	SELLENGTH
SELSTART	SELTEXT	SENDUPDATES
SEPARATOR	SET	SETALL
SETDEFAULT	SETFLDSTATE	SETFOCUS
SETUP	SETVAR	SHADOWS
SHAPE	SHARECONNECTION	SHARED
SHEET	SHELL	_SHELL
SHIFT	SHOW	SHOWOLECONTROLS
SHOWOLEINSERTABLE	SHOWTIPS	SHOWVCXS
SHOWWHATSTHIS	SHOWWINDOW	SHUTDOWN
SIGN	SIN	SINGLE
SIZABLE	SIZE	SIZE<HEIGHT>
SIZE<MAXLENGTH>	SIZE<WIDTH>	SKIP
SKIPFORM	SKPBAR	SKPPAD
SOME	SORT	SORTED
SORTWORK	SOUNDEX	SOURCENAME
SOURCETYPE	SPACE	SPARSE
SPECIALEFFECT	_SPELLCHK	SPINNER
SPINNERHIGHVALUE	SPINNERLOWVALUE	SPLITBAR
SQL	SQLASYNCHRONOUS	SQLBATCHMODE
SQLCOMMIT	SQLCONNECTTIMEOUT	SQLDISPLOGIN
SQLDISPWARNINGS	SQLIDLETIMEOUT	SQLL
SQLQUERYTIMEOUT	SQLROLLBACK	_SQLSERVER
SQLSTRINGCONNECT	SQLTRANSACTIONS	SQLWAITTIME
SQRT	SROWS	STANDALONE
_STARTUP	STATUS	STATUSBAR
STATUSBARTEXT	STD	STEP
STICKY	STORE	STR
STRCONV	STRETCH	STRICTDATEENTRY
STRING	STRTRAN	STRUCTURE
STUFF	STUFFC	STYLE
SUBCLASS	SUBSTR	SUBSTRC
SUBSTRING	SUM	SUMMARY
SUSPEND	SYLK	SYS
SYSFORMATS	SYSMENUS	SYSMETRIC
SYSTEM	SYSTEMREFCOUNT
T

TAB	TABHIT	TABINDEX
TABLE	TABLEREFRESH	TABLEREVERT
TABLES	TABLEUPDATE	TABORDERING
TABS	_TABS	TABSTOP
TABSTRETCH	TABSTYLE	TAG
_TALLY	TALK	TAN
TARGET	TEDIT	TERMINATEREAD
TEXT	_TEXT	TEXTBOX
TEXTHEIGHT	TEXTMERGE	TEXTWIDTH
THIS	THISFORM	THISFORMSET
_THROTTLE	TIME	TIMEOUT
TIMER	TIMESTAMP	TIMESTAMPDIFF
TITLES	TMPFILES	TO
TOOLBAR	TOOLTIPTEXT	TOP
TOPIC	TOPINDEX	TOPITEMID
TOTAL	TRANSACTION	TRANSACTIONS
TRANSFORM	_TRANSPORT	TRAP
TRBETWEEN	TRIGGER	_TRIGGERLEVEL
TRIM	TRUNCATE	TTOC
TTOD	TTOPTION	TXNLEVEL
TXTWIDTH	TYPE	TYPEAHEAD
U

UCASE	UDFPARMS	UIENABLE
UNDEFINE	UNDOCK	UNION
UNIQUE	_UNIX	UNLOAD
UNLOCK	UNLOCKDATASOURCE	UNPACK
UPCLICK	UPDATABLE	UPDATABLEFIELDLIST
UPDATE	UPDATED	UPDATENAME
UPDATENAMELIST	UPDATETRIGGER	UPDATETYPE
UPPER	UPSIZING	USA
USE	USED	USEMEMOSIZE
USERID	USERS
V

VAL	VALID	VALIDATE
VALUE	VALUEDIRTY	VALUES
VAR	VARREAD	VERB
VERSION	_VFP	VGA25
VGA50	VIEW	VIEWS
VISIBLE	VOLUME
W

WAIT	WAITTIME	WASACTIVE
WASOPEN	WBORDER	WCHILD
WCOLS	_WEBDEVONLY	_WEBMENU
_WEBMSFTHOMEPAGE	_WEBVFPHOMEPAGE	_WEBVFPONLINESUPPORT
WEEK	WEXIST	WFONT
WHATSTHISBUTTON	WHATSTHISHELP	WHATSTHISHELPID
WHATSTHISMODE	WHEN	WHEREWHERETYPE
WHILE	WIDTH	WINDCMD
WINDHELP	WINDMEMO	WINDMENU
WINDMODIFY	WINDOWLIST	WINDOWNTILIST
WINDOWS	_WINDOWS	WINDOWSTATE
WINDOWTYPE	WINDQUERY	WINDSCREEN
WINDSNIP	WINDSTPROC	WITH
_WIZARD	WIZARDPROMPT	WK1
WK3	WKS	WLAST
WLCOL	WLROW	WMAXIMUM
WMINIMUM	WONTOP	WORDWRAP
WORKAREA	WOUTPUT	WP
WPARENT	WR1	WRAP
_WRAP	WREAD	WRITEEXPRESSION
WRITEMETHOD	WRK	WROWS
WTITLE	WVISIBLE
X

XCMDFILE	XL5	XLS
Y

Y	YEAR	YRESOLUTION
Z

ZAP	ZOOM	ZORDER
ZORDERSET


Restricted Files

See Also

Visual FoxPro contains many files that are licensed for your use for design, development, and testing purposes only. See LICENSE.TXT, located in your Visual FoxPro directory, for a list of restricted files.

If your application contains any of these files, remove them. Under the terms of the Microsoft License Agreement you received with this product, you are not permitted to ship these files in your application or on your disks.

The Setup Wizard checks for these files and will exclude them from distributable disk sets. Do not assign these filenames to any files you will distribute. The Setup Wizard will exclude any file that has a name identical to one on this list.

For information on files you can distribute in your application, see Distributable Files.


See Also

Distributable Files
Setup Wizard


Sample Applications Overview

The Visual FoxPro sample applications have been developed to help you get started using Visual FoxPro. As you examine each sample, you can see how the sample functions, how it is coded, and how you can apply its features in your own applications.

To open a sample application project in the Project Manager, click Open. To run a sample application, click Run.

	Sample	Access
	Solutions Sample Over 90 separate examples illustrating how to accomplish specific tasks in Visual FoxPro, from simple data entry forms, to dynamically adjusted tabbed dialogs, to Windows API calls.	Open Run
	Tasmanian Traders An integrated Visual FoxPro application with logon security, order entry functionality, order history, invoices, and other real world implementations.	Open Run
	Client/Server An application that illustrates some of the features that make Visual FoxPro an ideal front end development tool for client/server applications, including offline views, upsizing, and concurrency.	Open Run
	OLE Servers Three separate samples of custom OLE Servers and how they can be used in Visual FoxPro.
Visual FoxPro also provides Sample Class Libraries and Utility Programs with functionality you can easily include in your applications.


Visual FoxPro Solutions Sample

See Also

The Solutions sample includes more than 90 examples of specific tasks in Visual FoxPro, from simple data entry forms to dynamically adjusted tabbed dialogs to Windows API calls.

The interface (SOLUTION.SCX) for the Solutions Sample application provides several features:

•	Two ways to view the contents of the Solutions Sample:

•	A tree (outline) view which shows the hierarchy of the components in the application.

•	A filtered list view of the components in the application which provides an alphabetical list of all components that will filter the list according to your sort specifications.

•	An expand/collapse button for viewing all of the components in the tree view.

•	A brief description of a selected sample.

•	The option to run the code and/or view the code by opening it in the appropriate designer.

•	 A description of how specific features were implemented on any form via a Behind the Scenes button.

To run the Solutions Sample application

•	Enter the following in the Command window:

DO (HOME() + 'samples\solution\solution')

 – Or –

1	From the Program menu, choose Do.

2	Choose the Samples folder.

3	Choose the Solution folder.

4	Double-click Solution.app.

From the main Solution Samples form, you will see that the samples are organized into the following categories: Controls, Databases, Forms, Menus, Ole, Reports, Toolbars, and Winapi. To see all of the components in this treeview, choose the Expand All [image] button and scroll through the components.

Once you have found a sample or component that interests you, highlight it to select it. You can then do one or all of the following:

•	Read a brief description of the sample in the description area at the bottom of the main Solutions form.

•	Run the sample by choosing Run Sample.

•	See the code by choosing See Code.

After you close the form or designer that is opened, you are returned to the main Solutions form.


See Also

Client Server Sample
OLE_Server_Samples
Sample Applications Overview
Tasmanian Traders Sample


Tasmanian Traders Sample

See Also

The Tasmanian Traders sample is an example of an integrated Visual FoxPro application. The application is an order entry system for a fictional import and export company that sells specialty foods from around the world.

Tasmanian Traders provides order entry functionality, allowing users to:

•	Create new orders.

•	Add items to orders directly.

•	Select items from previous orders.

•	Calculate line item extensions, subtotals, and order totals adjusted for discounts and freight.

The application also illustrates user-level security by requiring users to log onto the application before seeing or editing data.

Each step in the development of the Tasmanian Traders application has been documented as follows:

•	Creating the Specification

•	Designing the Database

•	Creating Table Structures and Relationships

•	Security

•	Data Integrity

•	Database Maintenance

•	Comments about Creating the Database

•	Designing and Creating Classes

•	Application-Level Functionality

•	Form-Level Functionality

•	Control-Level Functionality

•	Comments about the Classes

•	Writing, Testing, and Debugging the Application Code

•	Forms

•	Reports

•	Menus and Toolbars

•	Error Handling

•	Debugging

•	The Main Program

•	Comments About the Code

To run Tasmanian Traders

•	Enter the following line of code in the Command window:

DO (HOME() + 'samples\tastrade\tastrade')

 – Or –

1	From the Program menu, choose Do.

2	Choose the Samples folder.

3	Choose the Tastrade folder.

4	Double-click on TASTRADE.APP.

To open the project for the Tasmanian Traders application

•	Type the following in the Command window:

MODIFY PROJECT (HOME() + 'samples\tastrade\tastrade')


See Also

Creating the Specification
Designing and Creating Classes
Designing the Database
Sample Applications Overview
Tasmanian Traders Class Libraries
Writing, Testing, and Debugging the Application Code


Creating the Specification for Tasmanian Traders; Tasmanian Traders Sample, creating the specification
Creating the Specification for Tasmanian Traders

See Also

Before any code was written for Tasmanian Traders, a specification detailing the system requirements, functionality, and appearance was written, revised, and refined. The specification is over 30 pages long and includes the following required elements.

Functionality   The application provides order entry functionality, which must include features that allow users to create new orders; add items to orders directly or select items from previous orders; and calculate line item extensions, subtotals, and order totals adjusted for discounts and freight. The application must provide security by requiring users to log onto the application before seeing or editing data.

Excluded Functionality   The application will not manage accounts receivable, billing, or inventory.

Interface Requirements   The interface must meet Windows standards. It should be as attractive and intuitive as possible. These subjective interface requirements were difficult to specify in detail. Consequently, they underwent quite a few changes through the development cycle.

International Requirements   Because the application will be localized into multiple languages, coding must conform to standards required by the internal localization tools.

Visual FoxPro Features   As a sample, the application must illustrate many of the new features of Visual FoxPro, demonstrate how to coordinate menus and toolbars, and provide sample reports.

System Requirements   The application must run with the minimum processor and memory requirements that Visual FoxPro requires, and in a screen display of 640 x 480 pixels.

In refining the specification, prototypes of the main forms in the application were developed quickly, without functional code. These prototypes were used to demonstrate several usage scenarios to clients. Client feedback about the interface and the functionality was then incorporated into the specification.

As development progressed, client feedback was incorporated directly into the application without being added to the specification document first. The finished Tasmanian Traders application is noticeably different from the application described in the original specification.


See Also

Designing and Creating Classes
Designing the Database
Sample Applications Overview
Tasmanian Traders Class Libraries
Writing, Testing, and Debugging the Application Code


Designing the TASTRADE Database

See Also

The key tasks in designing the database were:

•	Creating table structures and relationships.

•	Implementing security.

•	Maintaining data integrity.

Creating Table Structures and Relationships

The process of creating table structures and relationships in TASTRADE is discussed in Chapter 5, "Designing Databases," in the Visual FoxPro Developer's Guide. To see the tables and relationships in the TASTRADE database, open the Database Designer.

Because the central entity in this application is an order, the table involved in the most relationships is the Orders table. Other entities directly or indirectly support an order:

•	A customer places an order.

•	An employee creates or "takes" an order.

•	A shipper delivers the order.

•	Orders contain line items which, in turn, contain products.

Two tables, Suppliers and Category, support the Products table although they do not directly supply information for an order. Suppliers are the source of the products while the Category table provides information that can be used to manage the products. In Tasmanian Traders, these entities aren't very significant. In other applications, for example, an inventory management application, they would be.

In addition to the logical design of the database, security and data integrity are important when creating the database.

Implementing Security

Database security involves restricting access to data. Unauthorized users should not have access to any data while other users should not have full access to certain data. For example, you might not want order-entry personnel to be able to change employee information or customer credit limits.

To implement security, two fields were added to the Employee table: Group_ID and Password. To gain access to information in the database, a user must complete a login form and supply the appropriate password. When the user logs in, Tasmanian Traders can determine the access level of that user from the value in the Group_ID field.

Because a login form is a common element in many applications, a class was created for the login form: Login in LOGIN.VCX. This form class contains text boxes for a user to enter a user ID and a password. Properties of the class are used to specify the table and the field for the password. Generic code is called in the Click event of the OK command button to validate the password the user entered. A property of the form (uRetVal) is set on whether a user entered the right password.

For this application, a subclass, LoginPicture, was created for the Login class. LoginPicture includes all the functionality of the Login class, plus a picture of the user, a text description of the user, and a hint for the password. None of these objects would be desirable in a login form outside the context of Tasmanian Traders.

A login form provides a level of security in a stand-alone application, but because any user with a copy of Visual FoxPro can open the database and view or change data outside of the application, the data isn't really very secure. In a real-world context, network security and/or data encryption would be used to increase security. In the world of this sample application, however, all Visual FoxPro users should have access to the data from inside or outside the application. Therefore, the login user names and passwords need to be apparent to anybody logging in to the application, and the data is not encrypted by the application.

Maintaining Data Integrity

Protecting data integrity involves making sure that authorized users don't add, change, or delete data that would make parts of the database invalid or inaccurate.

Data integrity management at the database level applies whether a user is changing values through the forms in the application or directly in a Browse window. Thus, data integrity, in the form of referential integrity and enforcing business rules, is handled in the database.

Referential Integrity

Referential integrity was implemented at the database level using the Referential Integrity Builder. For all parent tables in the database, when a key value is changed, that change is also made in the child tables (Cascade on Updating). When a user deletes a record in a parent table, the associated records in the child tables are also deleted (Cascade on Deleting). Users cannot delete records in other parent tables if there are related records in a child table (Restrict on Deleting). A user cannot insert records into child tables that don't match records in the parent tables (Restrict on Inserting).

Each of the tables in Tastrade (except for Order_Line_Items) has a primary key field. Because Visual FoxPro requires a non-null and not empty value for this field and automatically prevents a duplicate value from being entered in the field, no code has to be written to prevent duplicate primary keys. To make it even easier for a user, however, NewID( ), a stored procedure, generates a new value for the primary keys of most tables. The next primary key value for each appropriate table is stored in the Setup table. NewID returns this value and calculates a new value for the next available key. NewID( ) is the default value (set in the Table Designer) of Orders.Order_id, Products.Product_id, and other primary key fields in the database.

For the Customer table, however, it would not be worth the time and effort to generate new Customer_id values for the user. The user must supply the primary key value for a new record added in the Customer or Add Customer form. The primary key for the Customer table is Customer_id. The naming scheme for customer identification is based on the name of the company. For example, the Customer_id for the B's Beverages company is BSBEV.

Business Rules

The TASTRADE database needed a rule to ensure that orders couldn't be saved without at least one associated line item. The stored procedure ValOrder( ) manages this requirement. In addition, ValOrder( ) makes sure that the order total is not above the customer's Max_order_amt or below the customer's Min_order_amt. In Tasmanian Traders, if an order total is above the minimum or maximum order amounts for a customer, a message box gives the user the option to override the rule. In a stricter data scenario, you wouldn't allow a user to override the rule.

ValOrder( ) calls the RemainingCredit( ) and CalcMinOrdAmount( ) stored procedures. Because the database doesn't store information about which orders a customer has or has not paid for, it isn't possible to get information on a customer's outstanding balance. The RemainingCredit( ) procedure assumes that all orders are outstanding.

Form-Level Validation

Form-level data validation includes restricting user access to data by enabling and disabling appropriate controls. Optimistic row buffering is set at the form level for all data-bound forms. The Order Entry form has optimistic table buffering set for the table displayed in the grid. The optimistic row and table buffering is used to revert records when users decide that they don't want to save their changes.

Database Maintenance

To allow a user to reindex the tables and check the validity of the database, the Rebuild form was added to the application. The Rebuild form uses the REINDEX and the VALIDATE DATABASE commands.

As an alternative to using the REINDEX command, you could extract the index expressions using the TAG( ) and KEY( ) functions, delete all the tags with DELETE TAG ALL, and recreate all the indexes using the INDEX ON command. This method would minimize the .CDX file.

Comments on Creating the Database

During development, some of the table names and field names were changed to illustrate the long name capabilities of Visual FoxPro. Consequently, views and indexes had to be recreated, and the ControlSource property of bound controls on forms and reports had to be manually changed.

After login, users originally had to select an action from a menu on an otherwise blank screen. Later in the development process, the Startup_action field in the User_level table was added. Information in this field is used to specify the part of the application that should be run right after login.

There are two free tables (not included in the database) in the Tastrade project: Behindsc and Repolist. Behindsc is the table used to store Behind the Scenes information, which describes how specific functionality in the application was implemented. It does not contain data for use by the application. Repolist is a table listing available reports, along with a descriptive name and a type for each report. These tables are used internally by the application; they do not constitute part of the data stored in the database by the user. Either of them could have been included in the database, but were not because they work independently of the data that is stored in the TASTRADE database.


See Also

Creating the Specification
Designing and Creating Classes
Sample Applications Overview
Tasmanian Traders Class Libraries
Writing, Testing, and Debugging the Application Code


Designing and Creating the Tasmanian Trader Classes

See Also

Six class libraries were created for Tasmanian Traders. Most of the Visual FoxPro base classes were subclassed so that the basic "look and feel" of the application could be easily maintained across components. As much generic functionality as possible was included at the class level so that the classes could be easily maintained and reused.

In deciding what classes to create, as much consideration was given to maintenance and future projects as to the current project. The goal was to encapsulate as much generic functionality in classes as possible. As a result, the underlying classes contain a lot of built-in functionality and they are designed to be integrated, but it isn't easy for someone to open the project, look at the components, and understand how the application works. Because the components in Tasmanian Traders are integrated so closely, you can't just take one or two of them, add them to another project that is organized differently, and expect them to work. You can quickly and easily expand Tasmanian Traders, though, or other applications built around the same model, by subclassing the appropriate classes.

Instead of adding the AddNew, Save, Delete, Restore and table navigation methods to the form class, the developers could have created a custom class to hold table operation methods and added an object based on that class to form classes or directly to forms. This would provide more flexibility because the functionality could be added to any form (or even container or control classes) later in the development process, regardless of its parent class. On the other hand, this would provide an additional layer of reference whenever the methods were called and, if the custom class were contained in a different .VCX file, another file would have to be opened when the forms opened. Because the class structure was clearly delineated before the forms were created and all forms bound to data were to inherit from tsBaseForm, the methods were included in tsBaseForm.

In Tasmanian Traders, a toolbar provides user access to functionality that is common to all forms. An alternative would be to create a class of command buttons to provide this functionality and add an object based on the class to each form. The advantage of this would be that the user might more easily associate the buttons with the form, and a user could more easily access the command buttons with the keyboard. On the other hand, Microsoft Office standards call for toolbars, so users are familiar with them. More importantly, the toolbar didn't take up any additional space on the forms and didn't add any additional controls on forms that already had quite a few controls. Additionally, the toolbar can be customized more easily at run time based on the access level of the user.

The environment settings were saved in a class so they could be set and restored in a single operation. Another benefit of saving environment settings in a class and restoring them in the code associated with the Destroy event is the fact that it is easy to recover when crashes occur in testing. Issuing RELEASE ALL causes the object Destroy events to fire, restoring the original environment settings.


See Also

Creating the Specification
Designing the Database
Sample Applications Overview
Tasmanian Traders Class Libraries
Writing, Testing, and Debugging the Application Code


Writing, Testing, and Debugging Tasmanian Traders

See Also

Code in the stored procedures in the database, class methods, form methods, menus, and programs was tested and debugged as it was being written.

This topic covers writing, testing, and debugging the Tastrade application in the following areas:

•	Forms

•	Reports

•	Menus and Toolbars

•	Error Handling

•	Testing and Debugging

This topic also provides a synopsis of what happens when the Main Program is initially executed. At the end of the topic, there are additional Comments about the Code.

Forms

TASTRADE includes Form classes (stored in .VCX files) and forms (stored in .SCX files) based on Form classes. See the section on Designing and Creating the Tasmanian Trader Classes for information about Form classes. The following list includes all the forms (.SCX files) in Tasmanian Traders [ParentClass listed in brackets].

Form Name	Description
BehindSc.SCX [tsBaseForm]	Behind the Scenes form.
ViewCode [tsTextForm]	Displays the code from Behind the Scenes.
Category [tsMaintForm]	Maintenance form for CATEGORY.DBF.
ChngPswd [tsBaseForm]	Allows user to change password.
CustAdd [tsBaseForm]	Allows user to enter information for a new customer.
Customer [tsMaintForm]	Maintenance form for CUSTOMER.DBF.
Employee [tsMaintForm]	Maintenance form for CUSTOMER.DBF.
GetInv [form]	Allows user to specify a date range in the Orders report.
GetTitle [form]	Allows user to filter the employees to be displayed in the ListEmpl report. GetInv and GetTitle are based on the Visual FoxPro base form class so that they can be run in reports launched from Project Manager without having to open libraries.
OrdEntry [OrderEntry]	Order Entry form.
OrdHist [OrderEntry]	Order History form.
Product [tsMaintForm]	Maintenance form for Products.dbf.
Rebuild [tsBaseForm]	Allows administrative user to reindex and check validity of the database.
Reports [tsBaseForm]	Allows user to specify a report to run.
Shipper [tsMaintForm]	Maintenance form for SHIPPER.DBF.
Supplier [tsMaintForm]	Maintenance form for SUPPLIER.DBF.
Most forms with controls that aren't bound to data (for example, IntroForm and About) are saved as classes in .VCX files and created with the CREATEOBJECT( ) function. Sometimes a form that is data-bound is called directly as a class. For example, the Login class exposes properties to set the data for its controls. The default values of these properties are set to Tasmanian Traders tables and fields. The subclass, LoginPicture, is used directly in the application; there is no .SCX file for these forms.

The advantage to running a Form class directly is that you can create the form and show it in two separate operations:

•	Form = CREATEOBJECT("IntroForm")

•	Form.Show

If you do this, you can adjust property settings after creating the object but before displaying it.

The advantage of creating a form in the Form Designer is access to a data environment and the properties, events, and methods associated with the data environment object. It is also more convenient to design and test forms in this way because you can run them directly from the Form Designer or from the Project Manager.

Most of the data-bound forms in the application contain tables in their data environments. If the application had included a form that allowed a user to simultaneously update multiple tables, a view would have been created for that purpose.

Reports

Reports can be developed any time after the database is in place. Tasmanian Traders is not a report-intensive application, so the reports were created relatively late in the development process. Each report contains a local view in its data environment. Two of the reports allow the user to specify parameters for the report:

•	The Orders report prints invoices for specified date ranges.

•	The ListEmpl report allows the user to filter the employee listing by job description.

The views in the data environments of these reports were created with parameters. When the report data environments opens the views, Visual FoxPro, by default, presents the user with a generic dialog asking for the parameters. To customize this behavior for Tasmanian Traders, the AutoOpenTables properties of the data environments were set to false (.F.). In the Init of the data environment, custom forms are run to get the parameter variables. Then the OpenTables method of the data environment is called.

Queries were considered as sources for the reports, but weren't used because they would require extra files (.QPRs) to maintain and track. Views, on the other hand, were contained in the database DBC file and can be conveniently displayed and modified in the Database Designer, as well as added directly to the data environment. SQL SELECT statements, however, are used as needed, as in the RemainingCredit stored procedure.

Menus and Toolbars

The main menu in the application is defined in MAIN.MNX. The single toolbar used in the application is based on the tsToolbar class in TSBASE.VCX.

Cleanup code in the menu checks the user level of the person who has logged in to the application, and releases pads and bars to which the user should not have access. Code in the procedure associated with Return to Visual FoxPro on the File menu calls the Cleanup( ) method of the application object, which issues CLEAR EVENTS and restores the Visual FoxPro menu system.

Code associated with the Click event of buttons on the toolbar calls methods of the active form for functionality. In this way, the functionality associated with a form is encapsulated with the form.

To coordinate the menus and toolbars in the application, code in the menu items calls the Click event code of the command buttons on the toolbars. An expression in the Skip For clause enables or disables the menu items based on the state of the corresponding command button on the toolbar. For a detailed description of coordinating menus and toolbars, search Help for "coordinating toolbars and menus."

Error Handling

The goal for error handling was to anticipate errors and prevent them from appearing in code, if possible. For example, code in MAIN.PRG is included to adjust the relative path setting if MAIN.PRG (in VFP\SAMPLES\MAINSAMP\PROGS) is run instead of TASTRADE.APP (in VFP\SAMPLES\MAINSAMP). Before code in a method sets or reads properties of the application object from outside the object, it first checks to make sure the application object exists:

IF TYPE("oApp") == "O"

* do some code

ENDIF

If choosing a control would cause an error in a particular situation, that control is disabled.

Not all errors can be anticipated in code, however. Error handling, when necessary, is managed in the code associated with the Error event of an object.

When an error occurs in method code, Visual FoxPro checks for error handling code associated with the Error event of the object. If no code has been written at the object level for the Error event, the Error event code inherited from the ParentClass, or from another class up the class hierarchy, is executed.

If no code has been written for the Error event anywhere in the class hierarchy, Visual FoxPro checks for an ON ERROR routine. If no ON ERROR routine exists, Visual FoxPro displays the default Visual FoxPro error message. Open the Help Contents, choose Technical Reference, and choose Error Messages to see the default Visual FoxPro error messages.

Tasmanian Traders checks for three types of errors that could occur at the database level: field rule violated, primary key violated, and failed trigger. Because the forms in Tasmanian Traders have a BufferMode setting of 2 - Optimistic, the only times these errors could occur are when the user moves to a different record (causing the buffer to be flushed) or saves changes to the current record. Both of these tasks are handled through methods at the form level (inherited methods from tsBaseForm), so Visual FoxPro first checks for error handling code in the Error event of the form. For example, the following code is associated with the Error event of the Customer form:

DO CASE

CASE nError = 1884  && Primary key violated

THISFORM.pageframe1.page1.cntCustomerInfo.Error(nError, cMethod, nLine)

CASE nError = 1582  && Field rule violated

THISFORM.pageframe1.page1.cntCustomerInfo.Error(nError, cMethod, nLine)

OTHERWISE

tsMaintForm::Error(nError, cMethod, nLine)

ENDCASE

If the primary key or a field rule is violated, the error information is passed to the control it relates to, cntCustomerInfo, so that the control's error code can present a more specific error message than the Visual FoxPro default error message, restore old values as appropriate, and set the focus to the appropriate control.

If another error is encountered, the Customer form passes the error to the parent class, tsMaintForm, which inherits error handling code from tsBaseForm. If the error indicates a failed trigger, code associated with the Error event of tsBaseForm displays the corresponding error message stored in the aErrorMsg[ ] property of the Customer form: "Insert trigger failed," "Update trigger failed," or "Delete trigger failed." (A custom error message unique to the each form can be created by initializing the appropriate element of the aErrorMsg[ ] array in the Init of that form.) Any other errors are handled by giving the user the option to Abort, Retry, or Ignore.

There is one ON ERROR setting in Tasmanian Traders in the RestoreWindowPos( ) method of tsBaseForm:

ON ERROR llError = .T.

The code that restores the window postions checks the value of llError. If an error occurs during the reading of the saved window positions from the .INI file, the form's default Top and Left properties determine the form's position.

Testing and Debugging

Testing and debugging was an integral part of all the implementation stages of the development process. As soon as any of the components in Tasmanian Traders were somewhat functional, they were tested. As soon as any bugs were encountered, they were isolated using the Visual FoxPro debugging tools and fixed.

An application-level constant defined in TASTRADE.H was used in the development of Tasmanian Traders to facilitate testing and debugging:

#DEFINE DEBUGMODE .T.

Conditional code automatically logged any user in as the Applications Developer (Leverling) if DEBUGMODE is True (.T.) so that the developers didn't have to go through that process every time they ran the application to test it.

The Utilities menu of the main Tasmanian Traders menu bar is active when a user, or a tester, logs in as an Applications Developer. This menu provides access to the Trace, View, and Debug windows, as well as the ability to cancel, resume, and suspend code.

The Main Program

Code in MAIN.PRG is the main program of the application. When you run the application, the code in MAIN.PRG is executed first. This code:

1.	Declares the API functions used in reading and writing to the application .INI file.

2.	Saves some environment settings. These environment settings (CURDIR( ), PATH, and CLASSLIB) need to be set before the application object can be created.

3.	Adjusts the path in case a user runs MAIN.FXP instead of TASTRADE.APP.

4.	Sets the class libraries to MAIN and TSGEN.

5.	Creates an application object based on TASTRADE in MAIN.VCX:

oApp = CREATEOBJECT("TasTrade")

The following actions occur as a result of this object creation:

1.	The Init event of the parent class (APPLICATION) is invoked. Code associated with this event creates an environment object and saves other environment settings:

THIS.AddObject("oEnvironment", "Environment")

THIS.oEnvironment.Set( )

1.	The default section of the TASTRADE.INI file is read with GetPrivString to determine if the Introductory Screen should be displayed.

2.	If specified in the .INI, IntroForm (Introductory Screen) is displayed.

3.	The Login( ) method of the class is called in the Init event of TASTRADE.

4.	The Login( ) method calls the DoFormRetVal( ) method of the class.

5.	DoFormRetVal( ) takes the parameter from Login and creates and shows an instance of the LogInPicture class.

6.	When the user logs in, the user's access level is returned and stored as a property, cUserLevel, of the application object.

7.	Calls the Do( ) method of the application object:

oApp.Do( )

Code in the Do( ) method performs the following actions:

1.	Runs the menu program for the application:

THIS.DoMenu( )

1.	Determines, based initially on the user's access level, the component of the application to run:

lcAction = THIS.GetStartupAction( )

* The GetStartupAction method returns

* the value in the Action field of the User

1.	Runs that component, for example Order Entry:

IF !EMPTY(lcAction)

&lcAction

ENDIF

1.	Establishes the event wait state with READ EVENTS.

Comments about the Code

For localization purposes, all strings that will be translated into different languages have to be defined with the #DEFINE preprocessor directive. The defined constants have to end in _LOC so that localization tools can identify them for translation. These are defined in the include file STRINGS.H.

Most of the code in the application is written in class or form methods so that it can be encapsulated with the appropriate objects. Stored procedures allow code specifically used in data maintenance or validation to be stored in the database.

UTILITY.PRG, the procedure library for the application, includes four functions:

•	IsTag( ) to make sure that an index tag exists before it is referenced.

•	NotYet( ) used during development as features are being added.

•	FileSize( ) to return the size of a file passed as a parameter.

•	FormIsObject( ) which returns .T. if the active form is an object based on the Form base class.

One could create a class to hold these utilities, but an object created just to provide access to these procedures adds an unnecessary level of abstraction.


See Also

Sample Applications Overview
Creating the Specification
Designing the Database
Designing and Creating Classes
Tasmanian Traders Class Libraries


Tasmanian Traders Class Libraries

Six class libraries were created for Tasmanian Traders. Some of the key decisions in developing Tasmanian Traders concerned the level at which certain functionality should be incorporated:

•	The application level

•	The form level

•	The control level


Application Class Functionality
Tastrade Sample: Application Class Functionality

See Also

A generic Application class, Application, was created in TSGEN.VCX with functionality generic to most applications. This class provides the following functionality:

•	Save the Visual FoxPro environment.

•	Set up the environment.

•	Restore the original Visual FoxPro environment.

•	Run the main menu.

•	Manage application toolbars.

•	Manage the user login procedure.

•	Manage forms.

A subclass of the Application class, Tastrade, in MAIN.VCX provides additional functionality specific to Tasmanian Traders:

•	Display the start up screen.

•	Run the initial component.

An object, oApp, is created in MAIN.PRG from the Tastrade class.

The following sections list and describe the Application class functionality.

Save the Visual FoxPro Environment

The Application Class saves the Visual FoxPro environment when the application runs.  The Visual FoxPro environment includes SET command settings such as PATH, TALK, CARRY, and so on. In the Init event of the Application class, code adds a new object to Application based on the Environment class in TSGEN.VCX. In the Init event of the Environment class, code stores the existing Visual FoxPro environment settings to properties of the class so that they can be restored later.

Code associated with the Init event also stores the caption of the main Visual FoxPro window to the cOldWindCaption property of the Application class. These stored settings are restored when an object based on the Application class is released.

Another environment factor in Visual FoxPro is the standard toolbars that are active when an application is run. The Application method ReleaseToolbars( ) stores the names of system toolbars as well as information about whether they were open or closed when the application was run.

Code associated with the Init event of the Application class also pushes the current system menu onto the menu stack so that it can be restored later.

Set Up the Environment

Other code in the Init event of the Application class establishes the run-time environment. This code:

•	Calls the Set( ) method of the Environment class, which sets the class and procedure libraries, whether deleted records are displayed (CLASSLIB, PROCEDURE, DELETED), and other application-specific environment settings.

•	Opens the database for the application.

•	Calls the ReleaseToolbars( ) method to release all the system toolbars that were active when the application was run.

•	Sets the window title of the main Visual FoxPro window to the value stored in the cMainWindCaption property of the Application class.

Restore the Original Visual FoxPro Environment

When the application quits, code in the Cleanup( ) method of the Application class restores the original caption of the main Visual FoxPro window, closes the database, clears windows, issues CLEAR EVENTS, restores the initial menu, and calls the ShowToolbars( ) method to reopen the Visual FoxPro system toolbars that were displayed before TASTRADE.APP was run.

When CLEAR EVENTS is issued, program execution continues beyond the READ EVENTS command and code in MAIN.PRG releases oApp. When the Application object is released, the Destroy event of the Environment class occurs because it is a member of the Application class.

In the Destroy event of the Environment object, the Reset( ) method of the Environment object is called to restore the Visual FoxPro environment settings that were in effect when the Environment object was created.

Run the Main Menu and Establish the Event Loop

Additional code in the Application object runs the main menu associated with the application and establishes the event loop. The Do( ) method of the Application class is called in MAIN.PRG as soon as the Application object is created. The Do( ) method runs the main menu program and issues READ EVENTS.

Manage Application Toolbars

The Application object also keeps track of application toolbars. A property at the form level indicates the toolbar to be associated with each form. Because there is only one toolbar in this application, this property setting is the same for all the forms in the application.

Forms in the application call the ShowNavToolbar( ) method of the Application class to display the toolbar. The application knows whether the toolbar already exists and shows it only when necessary, incrementing the nFormInstanceCount property.

The ReleaseNavToolbar( ) method of the application, called in the Destroy event of the forms, decrements the nFormInstanceCount property and removes the toolbar after the last form is released.

Manage the User Login Procedure

Most applications in which security is an issue provide some form of login procedure. To manage this procedure, the Login( ) method of the Application class calls the DoFormRetVal( ) method, passing the class name of the login screen. When the user logs in, a property of the Application class, cUserLevel, stores the user level for that user.

This property is used in the menu cleanup code to remove menu items that shouldn’t be visible to a particular user.

Manage Forms

Except for the forms used in reports to set ranges of values for the reports, the forms in Tasmanian Traders are displayed through methods of the Application class. The DoForm( ) method accepts the name of a form and one parameter that can optionally be passed to the form. The DoFormRetVal( ) method accepts the name of a form class and returns a value specified in the form.

Display the Start Up Screen

The subclass of the Application class, Tastrade, in MAIN.VCX provides additional functionality specific to Tasmanian Traders. The Init event calls the parent class code in the Application class and, if the start up splash screen should be displayed, calls DoFormRetVal("introform" ).

Run the Initial Component When a User Logs In

The subclass of the Application class, Tastrade, in MAIN.VCX provides additional functionality specific to Tasmanian Traders. Code in the Do( ) method overrides the default behavior of the Do( ) method of the Application class. Code in the Do( ) method calls the GetStartupAction( ) method, which returns the component of the application to run after a user logs in. If a default component is specified for a user, code in the Do( ) method runs this initial component.


See Also

Tastrade Sample: Control Class Functionality
Tastrade Sample: Form Class Functionality
Tasmanian Traders Class Libraries


Form Class Functionality
Tastrade Sample: Form Class Functionality

See Also

Tasmanian Traders includes three types of forms:

1.	Modal forms that return a value (for example, the Login form).

2.	Data entry forms (for example, the Customer and Order Entry forms).

3.	Lookup forms (FindCustomer and FindOrder).

4.	General purpose forms (for example, the About and Introductory forms).

The following list depicts the form classes and their hierarchies in Tasmanian Traders.

Form Class	Class Library
tsFormRetVal	TSBASE.VCX
- IntroForm	TSGEN.VCX
- Login	LOGIN.VCX
- LoginPicture	LOGIN.VCX
- FindCustomer	TSGEN.VCX
- FindOrder	TSGEN.VCX
tsBaseForm	TSBASE.VCX
- tsMaintForm	TSBASE.VCX
- tsTextForm	TSBASE.VCX
- OrderEntry	ORDERS.VCX
- About	ABOUT.VCX
Modal Forms

All forms that return a value are derived at some level from tsFormRetVal in TSBASE.VCX. All the data entry form classes are based on tsBaseForm in TSBASE.VCX.

tsFormRetVal prevents access to other components while active.

Property Settings

AutoCenter =	.T.
BackColor =	Light Gray
BorderStyle =	2-Double wide
FontSize =	8
MaxButton =	.F.
MinButton =	.F.
WindowType =	1-Modal
Custom Properties

uRetVal:	Holds the form's return value. Can be any data type; the "u" prefix stands for "unknown." uRetVal is .T. by default.
To create an instance of a subclass, call Application.DoFormRetVal.

Data Entry Forms

Forms for data entry are based on the tsBaseForm class and are closely integrated with the tsToolbar class. tsBaseForm is the parent class of most forms in the Tasmanian Traders application. It provides the following functionality:

•	Table navigation

•	Management of user access to data

•	Interface coordination

Property Settings

BufferMode =	2-Optimistic
Custom Properties

aerrormsg[3] =	An array of error messages. This allows generic error handling code to be written in the parent class and custom error messages to be defined in each subclass. The following default values are defined in the code associated with the Init event of particular forms:
aerrormsg[1] =	"Insert trigger failed!"
aerrormsg[2] =	"Update trigger failed!"
aerrormsg[3] =	"Delete trigger failed!"
cToolBar:	Holds the name of the toolbar to run when the form is run.
lAllowEdits:	Whether or not the current record can be edited.
lAllowDelete:	Whether or not the current record can be deleted.
lAllowNew:	Whether or not the user is allowed to add new records
Functionality Associated with Events

Init:	1. Restores the previous window position.
	2. Adds the form's caption to the menu.
	3. Displays the navigation toolbar.
	4. Initializes the custom error message array, aerrormsg[ ].
Activate:	1. Selects the alias specified in the InitialSelectedAlias property of the form's data environment.
	2. Refreshes the navigation toolbar.
	3. Refreshes the menu.
	4. Sets the message of the status bar to the form's Caption property.
Error:	Defines generic error handling code for all forms.
Destroy:	1. Removes the form's caption from the menu.
	2. Saves the position of the window in the TASTRADE.INI file.
QueryUnload:	Checks whether data has changed, and prompts the user to save changes if necessary.
Unload:	Clears the status bar.
Custom Methods

First:	Advances the record pointer to the first record.
Next:	Advances the record pointer to the next record.
Prior:	Advances the record pointer to the previous record.
Last:	Advances the record pointer to the last record.
These four methods all share the following behavior:

1.	Call the form's custom DataChanged( ) method to check for changes.

2.	Call the form's custom AskToSave( ) method to prompt the user to save any changes.

Custom Methods

Save:	Saves the current record.
Delete:	Deletes the current record.
AddNew:	Adds a new record.
Restore:	Restores original field values (cancels changes).
AddToMenu:	Adds the form's caption to the Window menu.
RemoveFromMenu:	Removes the form's caption from the Window menu.
AskToSave:	Prompts user to save changes, not to save changes, or to cancel the last operation.
DataChanged:	Returns .T. if any data on the current form has changed.
WriteBuffer:	Code to flush the value of the current control to the record buffer.
RefreshForm:	Custom refresh routine.
SaveWindowPos:	Writes the Top and Left properties of the form to the application's INI file.
RestoreWindowPos:	Reads the Top and Left properties of the form from the application's INI file and sets them.
WaitMode:	Changes the mouse cursor to an hourglass for all controls on a form.
Lookup Forms

The FindCustomer and FindOrder forms display the customer and order tables, respectively, in a grid and allow the user to change the index tag. The key value from the selected row is returned to the calling form when the user closes the form.

General Purpose Forms

There are two general purpose forms.

AboutBox Form

AboutBox in ABOUT.VCX accepts parameters in its Init event for caption texts and a logo bitmap. This class uses API functions to retrieve information from either the WIN.INI file for Windows 3.x, or the system registry otherwise, to display information about the user's system.

IntroForm

IntroForm in TSGEN.VCX is the initial splash screen. Code associated with the Click event of chkShowAtStartUp in this class writes a value to the TASTRADE.INI file to specify whether the splash screen should be displayed in the future when Tasmanian Traders is run.


See Also

Tastrade Sample: Application Class Functionality
Tastrade Sample: Control Class Functionality
Tastrade Sample: Form Class Functionality
Tasmanian Traders Class Libraries


Control Class Functionality;Tastrade sample application
Tastrade Sample: Control Class Functionality

See Also

Most of the Visual FoxPro base control classes were subclassed to provide additional default functionality or a consistent appearance. Whenever groups of controls were needed in more than one place in Tasmanian Traders, a class was created.

Because the application had to run in a 640 x 480 display, the default font of these controls was set to be 8 point rather than 10 point, to save space on the forms.

The control classes are listed below by library.

TSBASE.VCX Class Library

Class	Description
ts3dShape	The class for shape controls, used mostly for accentuating or enclosing parts of a form
tsComboBox	The class for all combo boxes in the application.
tsCommandButton	The class for all command buttons in the application.
tsEditBox	The class for all edit boxes in the application.
tsGrid	The SumColumn method is used to automatically sum a value in a grid column. This class is added to the List page of the page frame in the tsMaintForm class.
tsLabel	The class for all labels in the application.
tsListBox	The class used for all list boxes in the application.
tsTextBox	The class for all text boxes in the application.
OrdTextbox	A subclass of tsTextbox which is used in Order Entry and Order History forms.
tsToolBarButton	The class for all command buttons that appear on toolbars in the application.

TSGEN.VCX Class Library

Class	Description
CustomerInfo	Includes labels and text boxes for the following fields in the customer table
DateRange	A custom control based on the Visual FoxPro Control base class.
Splitter	Used in Behind the Scenes to resize the list of features and the description edit box.
tsMaintForm	The class for all maintenance forms in the application.
tsToolBar	The class for the toolbar in the application.


See Also

Tastrade Sample: Form Class Functionality
Tastrade Sample: Application Class Functionality
Tasmanian Traders Class Libraries


Client/Server Sample

See Also

The Client/Server sample illustrates some of the features listed below that make Visual FoxPro an ideal front end development tool for client/server applications:

•	Working with local tables, local views, and remote views.

•	Upsizing local tables to the back end.

•	Using 2- and 3- tier client/server models.

•	Updating data.

•	Managing update conflicts.

•	Working with online and offline views.

To run the Client/Server sample application

•	Enter the following line of code in the Command window:

DO (HOME() + 'samples\csapp\sample')

 – Or –

1	From the Program menu, choose Do.

2	Choose the Samples folder.

3	Choose the CSApp folder.

4	Double-click SAMPLE.APP.

To open the project for the Client/Server sample application

•	Enter the following line of code in the Command window:

MODIFY PROJECT (HOME() + 'samples\csapp\sample')

For information about	See
The database in the Client/Server sample application	Client/Server Sample Application Database
The classes used in the Client/Server sample application	Client/Server Sample Application Classes
Implementing data updates in the Client/Server sample application	Updating Data in the Client/Server Sample Application
The 3-tier model in the Client/Server sample application	Implementing Business Rules in the Client/Server Sample Application
Enforcing business rules in the Client/Server sample application	Implementing Business Rules in the Client/Server Sample Application
Upsizing the table in the Client/Server sample application	Updating Data in the Client/Server Sample Application
Creating online and offline views in the Client/Server sample application	Updating Data in the Client/Server Sample Application
Providing concurrency and managing data conflicts in the Client/Server sample application	Managing Data Conflicts in the Client/Server Sample Application
Note   Code examples in these topics have been edited to emphasize particular lines. To see the full code, including error checking and verification, open the classes and programs in the project.


See Also

Client/Server Sample Application Classes
Client/Server Sample Application Database
Implementing Business Rules in the Client/Server Sample Application
Managing Data Conflicts in the Client/Server Sample Application
Sample Applications Overview
Updating Data in the Client/Server Sample Application


Client/Server Sample Application Classes

See Also

Most of the functionality in the Client/Server sample application is built into classes. Objects based on these classes are created in response to user actions.

CSEngine

When you run the application, an object is created in CSMAIN.PRG based on the CSEngine class in CSPROCS.PRG:

oEngine = CREATEOBJECT("csengine")

The CSEngine class provides generic environment setup and cleanup and utility method, as well as methods that manage application functionality.

Method	Description
DropTable	Deletes a table on the back end database.
ExecuteTempSPT	Execute SQL pass through commands and manage errors generated by the pass through.
ServerStart	Create the business rule object that validates employee salaries.
ServerStop	Releases the business rule object.
ServerValidateRow	Validates data using the business object.
For information about these and other methods in the CSEngine class, look at the code in CSPROCS.PRG.

OpenDBC

After creating the oEngine object, code in CSMAIN.PRG creates an object based on the OpenDBC form in SAMPLE.VCX:

oStartForm = CREATEOBJECT('OpenDBC')

The OpenDBC form allows a user to open the sample database, exclusively or shared, to close the database, and to modify the connection to the back end database. You’ll need a connection to a back-end database to upsize the table in this sample and access it as a remote view.

There is also code to create and show this form in the Click event of the Database button on the SampleApp form.

OpenDBC is a modal form. When you choose OK in the OpenDBC form, the following code is executed and program execution is continued.

RELEASE THISFORM

oEngine.Start = .T.

If the OpenDBC form was created in CSMAIN.PRG, the following code executes when OpenDBC is closed, creating an instance of the SampleApp class in SAMPLE.VCX:

IF oEngine.Start

oCSApp = CREATEOBJECT('SampleApp')

oCSApp.Show

ENDIF

SampleApp

SampleApp is the main form in the Client/Server sample application. This form contains a page frame with two pages. Controls on the first page allow you to open the table, local view, and remote view; upsize the table; restore the original data in the table; and toggle the views online and offline. Controls on the second page allow you to see and edit data in the selected table or view.

Code in the SampleApp form provides access to more encapsulated functionality by creating two additional objects as needed: Salaryrule and Conflicts.

SalaryRule

SalaryRule is a class in an OLE server. The project for the OLE server is BIZRULES.PJX and the class is defined in BIZRULES.PRG:

DEFINE CLASS salaryrule AS Custom OLEPUBLIC

Code associated with the Click event of the chkRules check box makes a call to the StartServer method of CSEngine. Code in the StartServer method creates an instance of the SalaryRule class:

this.oServer = CREATEOBJECT('Bizrules.SalaryRule')

For more information, see Implementing Business Rules in the Client/Server Sample Application.

Conflicts

The Conflicts form class displays current value, old value and changed values of fields in a record with a data conflict. An instance of the Conflicts class is created in the ResolveConflicts method of the SampleApp form:

frmConflicts = CREATEOBJECT('Conflicts')

frmConflicts.Show

For more information on conflict resolution, see Managing Data Conflicts in the Client/Server Sample Application.


See Also

Client/Server Sample Application Classes
Client/Server Sample Application Database
Implementing Business Rules in the Client/Server Sample Application
Managing Data Conflicts in the Client/Server Sample Application
Sample Applications Overview
Updating Data in the Client/Server Sample Application


Client/Server Sample Application Database

See Also

The database in the Client/Server sample application is small and designed only to show the basics of client/server implementation.

Selecting the Database

You can select the database for the Client/Server sample in Step 1 in the Open Database dialog box. The sample requires CS.DBC, installed in the same directory that the other files in the Client/Server sample are installed. If your default directory is the Visual FoxPro SAMPLES\CSAPP directory, or if this directory is in your path, the database is automatically selected for you.

The CS database contains the following.

Tables	Description
employee	A table with employee ids, names, addresses, and so on.
emp_init	A back up table for employee. After you change the data in the employee table while trying out the options in the sample, you can restore the original data from this table by choosing the Reset Initial Data button in the SampleApp form.
Views	Description
emp_view_local	A local view containing all the fields and records from the employee table.
emp_view_remote	A remote view containing all the fields and records from the employee table
Connection	Description
emp_connection	A connection to a data source for the emp_view_remote view. You need to establish this connection before you can open emp_view_remote.
Opening the Database

Step 2 in the Open Database dialog box allows you to open or close the database.

Code associated with the Click event of the Open button opens the database. Before opening the database, the DatabaseIsOpened property of the Engine object is set to true (.T.), assuming that the database will be opened.

OEngine.DatabaseIsOpened = .T.

lcExclusive = IIF(this.parent.chkExclDatabase.value = 1, 'EXCLUSIVE', 'SHARED')

OPEN DATABASE (OEngine.DatabaseFile) &lcExclusive

If the database cannot be opened, the Error event of the Open button is triggered, the DatabaseIsOpened property of the Engine object is set to false (.F.), and an error message is displayed.

Modifying the Remote Connection

Step 3 in the Open Database dialog box allows you to open the Visual FoxPro Connection Designer to set up a remote connection. You’ll need a connection to a back-end database to upsize the table in this sample and access it as a remote view, and you’ll need to modify the connection to provide a user ID, password, and connection string.

For information about setting up remote connections, see Chapter 8, “Creating Views,” in the Visual FoxPro Developer’s Guide.


See Also

Client/Server Sample Application Classes
Client/Server Sample Application Database
Implementing Business Rules in the Client/Server Sample Application
Managing Data Conflicts in the Client/Server Sample Application
Sample Applications Overview
Updating Data in the Client/Server Sample Application


Selecting a Data Cursor in the Client/Server Sample Application

See Also

The first page on the SampleApp form allows you to open the table, view, or remote view. The code associated with the Click event of cmdOpen uses the USE command to open the local table, local view, or remote view, based on the Value of the opgCursorType option button group.

The lblStatus label displays status information about the table or view. Code in the GetStatus method of attempts to open the table or view exclusively and updates the label caption. If the table or view could not be opened exclusively, it is opened shared. If it could not be opened shared, the Caption of lblStatus is set to indicate that the table or view is already opened exclusively.


See Also

Client/Server Sample Application Classes
Client/Server Sample Application Database
Implementing Business Rules in the Client/Server Sample Application
Managing Data Conflicts in the Client/Server Sample Application
Sample Applications Overview
Updating Data in the Client/Server Sample Application


Updating Data in the Client/Server Sample Application

See Also

When you edit data in the table and the buffering is No Buffering (CURSORSETPROP(“Buffering”, 1)) the changes are made directly to the table data. You cannot choose Update or Revert.

When you choose any other buffering option, you have the option to update or revert changes made to the data.

When you are updating buffered data, locally or remotely, use the TABLEUPDATE( ) function. The arguments in this function allow you to determine the update scope and whether or not to force updates. For example, the following lines of code are executed in the Click event of the Update button in the SampleApp form:

lnUpdateType = THIS.Parent.opgUpdate.Value - 1

llForce = THIS.Parent.chkForce.Value

llUpdate = TABLEUPDATE(lnUpdateType, llForce)

The lnUpdateType value is determined by the option button chosen in the Update Scope area.

There are three options for the update scope.

Row Update

When the first argument in the TABLEUPDATE( ) function is 0, only the current row is updated, regardless of whether table or row buffering is enabled. Changes made in any other rows are not written to the data source.

Table Update

When the first argument in the TABLEUPDATE( ) function is 1, the rows in the table that have been changed are updated, beginning with the first updated row. If a data conflict is encountered, that is, if the CURVAL( ) for a field in the row is different from the OLDVAL( ) for that field, table updating is stopped on the row that generated the conflict.

Table Update All

When the first argument in the TABLEUPDATE( ) function is 2, the rows in the table that have been changed are updated, beginning with the first updated row. All rows without a data conflict are updated.

Other options are specified in the Update Options area.

Forcing Updates

The second argument in the TABLEUPDATE( ) function specifies whether or not to force updates. If you choose Force in the Update Options area, the second argument in the TABLEUPDATE( ) function is true (.T.) and your changes will automatically override any changes that might have been made to the data after you began editing. There cannot be any conflicts to resolve if you force updates.

Note   If the user has changed the primary key of a record, the row cannot be updated and is deleted in you local cursor.

Resolving Conflicts

If Resolve Conflicts is selected, the Client/Server sample application finds conflicts when they occur and allows you to see the conflicting data and decide to override the existing changes or discard your own changes. If Resolve Conflicts is not selected, your data will not be updated if a conflict is detected:

IF THIS.parent.chkConflicts.Value

THISFORM.ResolveConflicts

ELSE

WAIT WINDOW "Update failed" NOWAIT TIMEOUT 5

ENDIF

For more information about resolving conflicts, see Managing Data Conflicts in the Client/Server Sample Application.

Business Rules

If Business Rules is selected, the Client/Server sample application enforces the business rules established for this application.  For information about the Business Rules option, see Implementing Business Rules in the Client/Server Sample Application.

Upsizing the Employee Table

The code for upsizing the database is associated with the Click event of cmdUpsize in the Client/Server Application form. The code performs these actions:

1.	Connects to the backend data source.

2.	Drops the table if it already exists.

3.	Creates a character string that includes the SQL CREATE TABLE command.

4.	Executes the SQL command by calling SQLEXEC( ) with the character string as an argument.

5.	Opens the employee table.

6.	Opens the remote view in the database.

7.	Appends the records from the local table to the remote view.

8.	Updates the remote view with TABLEUPDATE( ).

Creating an Offline View

The code to create or drop the offline view is associated with the Offline method of the SampleApp form.

IF lcMode = "create"

=CREATEOFFLINE(lcView)

ELSE

=DROPOFFLINE(lcView)

ENDIF


See Also

Client/Server Sample Application Classes
Client/Server Sample Application Database
CREATEOFFLINE( )
CURSORSETPROP( )
CURVAL( )
DROPOFFLINE( )
Implementing Business Rules in the Client/Server Sample Application
Managing Data Conflicts in the Client/Server Sample Application
OLDVAL( )

Sample Applications Overview
SQLEXEC( )
TABLEUPDATE( )


Managing Data Conflicts in the Client/Server Sample Application

See Also

If the data in the source table is changed while another user is editing it, there is a possible conflict.  You have several ways of resolving this conflict in the Update Options area of the Client/Server Sample form.

Update Options Area

If you select Force in the Update Options area, any changes to the data that were made after you started editing are written over when you update the data with your changes.

If you choose Resolve Conflicts in the Update Options area, the Client/Server sample application finds conflicts when they occur and allows you to see the conflicting data and decide to override the existing changes or discard your own changes. If you do not choose Resolve Conflicts, your data will not be updated if a conflict is detected:

IF THIS.parent.chkConflicts.Value

THISFORM.ResolveConflicts

ELSE

WAIT WINDOW "Update failed" NOWAIT TIMEOUT 5

ENDIF

If you choose Business Rules in the Update Options area, the applications updates the data according to your business rules.  For more information about the Business Rules option, see Implementing Business Rules.

To generate a data conflict

1	Run two separate instances of Visual FoxPro to simulate multiple users accessing the database.

2	Run the Client/Server sample application in each instance.

3	Enable buffering in both sessions.

4	Make sure the Force check box is not selected in either instance of Visual FoxPro.

5	Make changes in each session to the same fields in the same row of the table.

6	Update the table in one of the sessions.

7	Update the table in the other session.

When you choose to update the table the second time, the following line of code in the Click event of cmdUpdate attempts to update the table.

llUpdate = TABLEUPDATE(lnUpdateType, llForce)

If llForce is set to true (.T.), changes made in the other session are overridden. If llForce is set to false (.F.) a data conflict is detected and the TABLEUPDATE( ) function returns false. If llUdate is set to false, the ResolveConflicts method is called:

IF llUpdate

WAIT WINDOW "Update succeded" NOWAIT TIMEOUT 5

ELSE

frmConflicts = CREATEOBJECT('Conflicts')

frmConflicts.Show

ENDIF

Code in the Activate event of the Conflicts form creates a cursor with three blank records to display the current values, the old values, and the changed values of the row

=AFIELDS('aEmployee')

SELECT 0

CREATE CURSOR CS_CONFLICTS FROM ARRAY aEmployee

APPEND BLANK

APPEND BLANK

APPEND BLANK

Code associated with the Next method of the Conflicts form populates the cursor with Populate which is the conflict grid with the old, new, and changed values. For example, the following FOR loop fills a record with the old values in the table:

FOR m.i = 1 TO ALEN(aEmployee, 1)

REPLACE (aEmployee[m.i,1]) WITH ;

OLDVAL(aEmployee[m.i,1], lcEmployee)

ENDFOR

When users can see exactly what the data conflicts are, they are in a better position to decide whether to override the new values, revert the changes they made, or ignore the conflict.

Code in the Click event of cmdUpdate on the Conflicts form forces the update:

llUpdate = TABLEUPDATE(.F., .T.)

Code in the Click event of cmdRevert throws away the changes the user made:

lnRows = TABLEREVERT(.F.)

If the user chooses Ignore in the Conflicts form, processing continues on the other conflicts in the table.


See Also

Client/Server Sample Application Classes
Client/Server Sample Application Database
Implementing Business Rules in the Client/Server Sample Application
Sample Applications Overview
Updating Data in the Client/Server Sample Application


Implementing Business Rules in the Client/Server Sample Application

See Also

The Client/Server sample application uses a custom OLE server to enforce business rules. This architecture, known as the 3-tier model, allows implementation of business rules in the middle tier, separate from the actual data and separate from the client interface. Multiple applications and multiple databases can all use the same set of business rules, coded and maintained in a single location.

The custom OLE server in the Client/Server sample application is Bizrules. The project for the OLE server is BIZRULES.PJX and the class is defined in BIZRULES.PRG:

DEFINE CLASS SalaryRule AS Custom OLEPUBLIC

Code in the CSEngine class provides an interface to the business object with the ServerStart, ServerStop, ServerIsStarted, and ServerValidateRow methods.

The ServerStart method creates an instance of the SalaryRule class. The ServerValidateRow method passes values to the server for validation:

lcError = THIS.oServer.Validate(m.cTitle, m.nSalary, m.dBirth, m.dHire, m.cCountry)

The Validate method of the SalaryRule class enforces a common set of business rules and returns a list of error messages, one for every rule that failed. For example, the following section of code from the Validate method makes sure that the salary falls within a range specified in the BIZRULES.DBF table:

PROCEDURE validate

PARAMETERS lcTitle, lnSalary, ldBirth, ldHire, lcCountry

SELECT bizrules

LOCATE FOR lcTitle = ALLTRIM(title)

IF EOF()

* Display error message

ELSE

IF !BETWEEN(lnSalary, min_salary, max_salary)

* Display error message

ENDIF

ENDIF


See Also

Client/Server Sample Application Classes
Client/Server Sample Application Database
Managing Data Conflicts in the Client/Server Sample Application
Sample Applications Overview
Updating Data in the Client/Server Sample Application


OLE Server Samples

See Also

An OLE automation server exposes properties and methods that can be set and called from other OLE-capable applications.

All you need to do to create an OLE server is :

1.	Create a project.

2.	Add a .VCX file with an OLE Public class or a .PRG file that defines a class with the OLEPUBLIC keyword.

3.	Create a .DLL or an .EXE file.

An OLE automation server can be deployed locally or remotely, exposing business functionality through methods that can be called and properties that can be set.

Visual FoxPro provides three samples of OLE servers that you can create.

Sample	Description	Project
Pool Manager	An example of a remote job manager that you can direct to perform certain tasks, like printing reports. The pool manager processes will do the task and send a notification when the job is finished.	Open
Gopher	Simulates a smart search business object which locates a customer that may be contained in 1 of many different databases.	Open
Fox ISAPI	Manages sending selected records of Visual FoxPro data as HTML back to an Internet browser.	Open


See Also

Sample Applications Overview


Pool Manager OLE Server Sample

This is an example of a Pool Manager implemented in a custom OLE Server. A client can send jobs to this Pool Manager, which can be located on a remote computer, and have it handle the job processing. This allows you to continue working because the resources of the pool manager handle all the work. The jobs in this sample are dummy simulation jobs.

To open the project for the pool manager sample

•	Type the following in the Command window:

MODIFY PROJECT (HOME() + 'samples\servers\poolmgr\pool')

To run the pool manager sample

1	Open POOL.PJX and choose Build.

2	In the Build Options dialog box, select Build Executable and choose OK to create POOL.EXE. The server is registered when you build the executable file.

3	Run POOL.SCX

Pool Init Event

The first code to execute when you run the Pool form is the Init event, which creates a poolmgr object:

* Pool Init

SET PROC TO jobmgr.prg

THIS.oPoolMgr = CreateObject('Pool.Poolmgr')

When the oPoolMgr object is created, an array is dimensioned to keep track of jobs and a timer object, based on the PoolTimer class, is created to check for new or completed jobs.

Pool AddJob Method

When the user chooses the Print, Fax, or Excel Chart buttons on the pool form, the AddJob method of the form is called. AddJob performs the following:

1.	Redimensions an array to keep track of outstanding jobs

2.	Creates an object based on a specific subclass of NewJob: FaxJob, PrintJob, or GraphJob. These classes are defined in JOBMGR.PRG, and take a reference to the form as an argument.

3.	Passes the job object to the NewJob method of the PoolMgr object:

PARAMETER cJobType

LOCAL oNewJobRef

IF ALEN(THIS.aJobs)>1 OR TYPE("THIS.aJobs[1]") = "O"

DIMENSION THIS.aJobs[ALEN(THIS.aJobs)+1]

ENDIF

oNewJobRef = CreateObject(m.cJobType,THIS)

THIS.oPoolMgr.NewJob(m.oNewJobRef)

PoolMgr NewJob Method

The NewJob method of the PoolMgr object redimensions the two dimensional PoolMgr job array and stores a reference to the job object in the first element of the new row and 0 to the second element, indicating that this is a new job.

PARAMETER oNewJob

IF TYPE("oNewJob") # "O" OR ISNULL(m.oNewJob)

RETURN .F.

ENDIF

IF ALEN(THIS.aJobObjs,1) > 1 ;

  OR ISNULL(THIS.aJobObjs[1])

DIMENSION THIS.aJobObjs[ALEN(THIS.aJobObjs,1)+1,2]

ENDIF

THIS.aJobObjs[ALEN(THIS.aJobObjs,1),1] = oNewJob

THIS.aJobObjs[ALEN(THIS.aJobObjs,1),2] = 0

PoolTimer Timer Event

Every three seconds, the PoolTimer timer event code is executed. This code loops through the job array. If the second element is 0, indicating a new job, then a new PrintJob, FaxJob, or GraphJob object (subclasses of Job in POOLMGR.PRG) is created to manage the job. For example, the following line creates an object based on PrintJob and stores a reference to it in the timer’s aJobs array:

THIS.aJobs[ALEN(THIS.aJobs)] = CREATEOBJECT('Pool.PrintJob')

The second element in the array for that row is then set to 1 to indicate that the job has been started and the SetupJob method of the new object is called. A reference to the job object is passed to the SetupJob method:

THIS.aJobs[ALEN(THIS.aJobs)].SetupJob(THIS.Parent.aJobObjs[m.i,1])

The Job Class

The Job class is defined in POOLMGR.PRG:

DEFINE CLASS Job AS FORM

When an object based on the Job class, or any of its subclasses, is created, the StartJob method of the object is called.

PROCEDURE SetupJob

PARAMETER oJob

THIS.oJob = m.oJob

THIS.Caption = THIS.oJob.Jobtype

THIS.Visible = .T.

ENDPROC

The PrintJob class, for example, is a subclass of Job. If the object created is based on PrintJob, the StartJob method does the default processing of the parent class StartJob method, setting the caption of the form and displaying a label. Then the INKEY( ) function is called to set a timeout of 10 seconds. In a functional implementation of this sample, instead of the INKEY( ) function, you would include code at this point to process the print job.

DEFINE CLASS PrintJob AS Job OLEPublic

PROCEDURE StartJob

DoDefault()

=INKEY(10)

THIS.EndJob()

ENDPROC

ENDDEFINE

The EndJob method of the object calls the JobDone method of the original job object and releases the PrintJob, FaxJob, or GraphJob object.

PROCEDURE EndJob

THIS.lbl1.caption = "Ending job..."

THIS.oJob.JobDone()

THIS.oJob = .null.

THIS.Visible = .F.

THISFORM.Release

ENDPROC

Code in the JobDone method of the original job object notifies the form that the job has been completed by calling the JobDone method of the form.

PROCEDURE jobdone

IF TYPE("THIS.oFormRef")="O"

THIS.oFormRef.JobDone(THIS.JobType)

ENDIF

ENDPROC

Finally, the JobDone method of the form displays the status of the job in the list box on the form:

PARAMETER cJob

THIS.lstJobs.AddItem(m.cJob+" job is complete.")

The Life of the Job Object

The job object (based on the PrintJob, FaxJob, or GraphJob class defined in JOBMGR.PRG) is:

1.	Created in the AddJob method of the Pool form.

2.	Passed to the NewJob method of the PoolMgr class.

3.	Stored in the PoolMgr class to an element in an array

4.	Passed in the Timer event of the timer object in PoolMgr to the SetupJob method of the PrintJob, FaxJob, or GraphJob object (as defined in POOLMGR.PRG, not JOBMGR.PRG, and created in the Timer event).

5.	Stored to a property of the PrintJob, FaxJob, or GraphJob class in the SetupJob method.

6.	Set to .NULL. in the EndJob method of the PrintJob, FaxJob, or GraphJob object, after the JobDone method of the job is called.


Gopher OLE Server Sample

This example simulates a smart search business object which locates a customer that may be contained in one of many different databases. What actually happens is that code in the BeforeOpenTables event of the data environment creates an object based on the gopher class and prompts a user for the database to use. Code in the gopher class opens the appropriate database. This strategy allows us to use Visual FoxPro in a 3-tiered model where user services are not tightly bound to data services as is the case in many of today's client-server environments.

While this example only provides a choice between the Visual FoxPro TESTDATA and TASTRADE sample databases, you can use this basic approach to provide a smart search business object which knows how and where to look across a corporate network for necessary databases.

To open the project for the gopher sample

•	Type the following in the Command window:

MODIFY PROJECT (HOME() + 'samples\servers\gopher\foxsrch')

To run the gopher sample

1	Open the FOXSRCH project in the Visual FoxPro SAMPLES\SERVERS\GOPHER directory.

2	Select SRCHDATA.PRG in the Project Manager and choose Modify.

3	Change the following line so that FOXHOME is defined to reflect your Visual FoxPro home directory:

#DEFINE FOXHOME "\VFP4\"

4	Save and close SRCHDATA.PRG.

5	In the Project Manager, choose Build.

6	In the Build Options dialog box, select Build Executable and choose OK to create FOXSEARCH.EXE. The server is registered when you build the executable file.

7	Run WING1.SCX in the Visual FoxPro SAMPLES\SERVERS\GOPHER directory.

The following code is included in the BeforeOpenTables event of the Data Environment in Wing1.SCX:

LOCAL oGopher,lUseRemote

THIS.AddObject("cursor1","cursor")

THIS.cursor1.Alias = "employee"

lUseRemote=(MESSAGEBOX("Do you want to use Remote Data?",36) = 6)

oGopher=CreateObject("FoxSearch.Gopher")

oGopher.UpdateDE(THIS,m.lUseRemote)

RELEASE oGopher

The following code defines the Gopher class. The UpdateDE method takes an object reference to a data environment and a logical value as parameters. Based on the value of the logical value, the UpdateDE method sets different CursorSource values for a cursor in the data environment.

#DEFINE FOXHOME	"\VFP\"

DEFINE CLASS Gopher AS Custom OLEPUBLIC

oDERef = ""

PROCEDURE UpdateDE

PARAMETER oNewDE,lRemote

IF TYPE("oNewDE")#"O" OR ISNULL(m.oNewDE)

RETURN .F.

ENDIF

THIS.oDERef = m.oNewDE

IF !m.lRemote

* Use local data

THIS.oDERef.cursor1.database = FOXHOME + "SAMPLES\DATA\TESTDATA.DBC"

THIS.oDERef.cursor1.cursorsource = "Employee"

ELSE

* Use remote data (simiulated)

THIS.oDERef.cursor1.database = FOXHOME + "SAMPLES\TASTRADE\DATA\TASTRADE.DBC"

THIS.oDERef.cursor1.cursorsource = "Employee"

ENDIF

THIS.oDERef = ""

ENDPROC

ENDDEFINE


Fox ISAPI OLE Server Sample

This sample illustrates creating an executable file or OLE .DLL with ISAPI functionality that can be accessed from within Visual FoxPro as a stand-alone program, from OLE clients, and from an Internet browser. Changes you make to the class can enhance the application, no matter how it is run.

To open the project for the Fox ISAPI sample

•	Type the following in the Command window:

MODIFY PROJECT (HOME() + 'samples\servers\foxisapi\foxis')

Running the Fox ISAPI Sample

You can run the Fox ISAPI sample four different ways. When you are trying out the code, it’s a good idea to go run the sample in this order:

Running from Within Visual FoxPro

To run the Fox ISAPI sample from within Visual FoxPro, run the following code in the Command window.

SET CLASSLIB TO isapi

ox = CREATEOBJECT("employee")

ox.show

Running as an Independent Executable

You can build the sample into an executable file with the following line of code:

BUILD EXE foxis FROM foxis

The compiled file, FOXIS.EXE, is a Windows program that can be added to the start menu, started from the Explorer, and so on.

Running as an OLE Server

Once the sample has been compiled into an executable file or a .DLL, it is registered as an OLE server in the Windows registry. You can create an object based on the employee class from any OLE controller, for example Excel,Visual Basic, and Visual FoxPro 3.0:

ox = CreateObject("foxis.employee")

ox.show

Running from an Internet Browser

You can even run the Fox ISAPI sample from an internet browser, which could be on another machine

; such as a 286 running MS-DOS, a Unix machine, a Macintosh, or a Personal Digital Assistant.

The rest of this topic deals with running the Fox ISAPI sample from an Internet Browser and covers the following areas:

•	System Requirements for Internet Use

•	Setting Up the Fox ISAPI Sample for Internet Access

•	Debugging the Server

•	The ISForm Class

•	Entry Points into the ISForm Class

•	Keeping the Server Active

•	Sending HTML Back to the Client

•	Creating and Using Cookies

•	Error Handling

•	Tables Used in the Fox ISAPI Sample

System Requirements for Internet Use

To run this sample from an Internet browser, you must be running:

•	Windows NT 3.51 with Service Pack 4 or Windows NT 4.0 RC1 or higher.

•	An ISAPI-compatible Web Server, such as Microsoft's Internet Information Server (IIS). IIS comes with Windows NT 4.0 and can be downloaded free from http://www.microsoft.com.

If you're using Windows NT 4.0, you need to run the DCOMCNFG utility to configure DCOM to give rights to the IIS service to instantiate OLE objects.

To configure Windows NT 4.0 DCOM

1	At the Command prompt, type DCOMCNFG and press Enter.

2	In the Applications tab, select the name of the OLE server. When you build the server, the application is “employee” by default.

3	In the Default Security tab of the Distributed COM Configuration Properties dialog box, choose Edit Default for each area: Default Access Permissions, Default Launch Permissions, and Default Configuration Permissions.

4	In the Registry Value Permissions dialog box for each area, choose Add.

5	In the Add Names box of the Add Users and Groups dialog box, type your WWW server’s name and your login user name.

You can see the server’s name in the Microsoft Internet Service Manager Properties window. If your machine name is FOO, the following line in the Add Names box sets up a default user:

\FOO\IUSR_FOO

If your machine name is FOO and you login as JOHN, the following line in the Add Names box sets up permissions for you when you login:

\FOO\JOHN

Setting Up the Fox ISAPI Sample for Internet Access

To set up the Fox ISAPI sample, you set a property in the server, compile an executable file, and create HTML pages to access the server.

Set up the OLE Server

You need to set one property and build an .EXE to set up the OLE server.

To set up the OLE server

1	Open the FOXIS project.

2	Modify the Employee class in ISAPI.VCX.

3	Set the cScriptDir property of the Employee class to reference your Internet server scripts directory. For example:

C:\INETSRV\SCRIPTS

You might want to copy the entire project into that directory so that all the different ways of running the application will be able to access the data.

4	Copy the TESTDATA.DBC files (including EMPLOYEE.DBF) into the scripts directory. If you want the employees sorted in last name order, use the following code:

USE EMPLOYEE

INDEX ON UPPER(last_name+first_name) TAG name.

5	Copy HTML.* and *.GIF from the Visual FoxPro SAMPLES\SERVERS\FOXISAPI directory to the Internet server root directory (or other directory configured for your web service).

6	Copy FOXISAPI.DLL to your INETSRV\SCRIPTS directory.

Preliminary Testing

You can test the Fox ISAPI sample application at various levels to see if you are configured correctly.

To see if the code works

1	From the Program menu choose Do.

2	Select MAIN.PRG in the Visual FoxPro SAMPLES\SERVERS\FOXISAPI directory.

3	Choose Do.

To see if the .EXE works

1	Build the executable file:

BUILD EXE c:\inetsrv\scripts\foxis.exe FROM foxis

2	Enter the following command at the Command prompt:

Test to see if it works from the Command prompt, start the .EXE:

START FOXIS.EXE

To see if the OLE server works

•	Run the following commands:

OX= CREATEOBJECT("FOXIS.EMPLOYEE")

OX.SHOW        && See if it works as a custom server

?OX.STARTUP()  && See if it returns html

It is much easier to debug custom servers from an OLE controller (such as Visual FoxPro) before instantiating it in FOXISAPI.

Set up the HTML page

To get things started, you need a HTML page that contains a reference to a URL. For example, take the following code and put it in the WWWROOT\default.htm file.

<a HREF="/scripts/foxisapi.dll/FoxIS.employee.startup"> <i>VFP OLE CUSTOM SERVER DEMO PAGE</i> </a>

Then use a browser (which can be on the same machine) and connect to YourMachineName. For example, if your machine name was "foobar," then type "foobar" as the URL to go to. This would bring up the DEFAULT.HTM page on the server named "foobar"

A CreateObject("foxis.employee") is initiated and the Startup method is invoked on the object, which returns a generated HTML page. If the Custom Server hasn't been built yet, then the FOXISAPI.DLL returns an HTML error page.

Then use your web browser to hit the href above. If you get an error HTML page that says “FOXISAPI error”, then you know the DLL is being loaded and is working.

 <FORM ACTION = "/scripts/foxisapi.dll/foxis.employee.cmd">

<INPUT NAME="Cmd" VALUE = "Reset">

<INPUT TYPE="submit" VALUE="Dos Command">

</FORM>

You can actually put in any valid MS-DOS command and it will be executed on the server machine.  If the command is "Reset" (default), then it will make the custom server release the first instance as well as it's own, thus releasing the OLE server completely.

In addition, you can evaluate any Visual FoxPro expression. However, if the Visual FoxPro expression displays a modal interface, like the MESSAGEBOX( ) function does, the server will hang waiting for a response that cannot be provided.

<FORM ACTION = "/scripts/foxisapi.dll/foxis.employee.cmd?FOXCMD">

<INPUT NAME="Cmd">

<INPUT TYPE="submit" VALUE="Fox Expression">

like "today is "+ cdow(date()) or 45 * 3 or SYS(2004)

</FORM>

Debugging the Server

A Windows NT service has no Desktop, therefore no user interface will appear on the server machine. This means you should debug your server applications before deploying them.

To trace through FOXISAPI.DLL with Visual C++ 4.0

1	Open FOXISAPI.MAK.

2	Remove the comment mark from the following line in HttpExtensionProc:

//	_asm int 3

3	Rebuild the project.

4	Start MSDEV with the process id (PID) of INETINFO.EXE. You can get the process id in the Windows NT Task Manager.

This process applies to both Windows NT 4.0 and Windows NT 3.51

Tip   When debugging, you don't have to shut down the web server to change the OLE server. You can just terminate the EXE server process by sending a reset value to the cmd method, as described above, or by using the Win32 SDK tools TLIST, KILL, PVIEW, or the Task Manager in Windows NT 4.0.

The ISForm Class

The “engine” of the sample is the ISForm class in ISAPI.VCX.

Entry Points into the ISForm Class

The following methods can be called from the Web browser, by way of FOXISAPI.DLL, to return HTML pages.

Method	Returns
Cmd	Evaluation of a Visual FoxPro expression or the results of a MS-DOS command.
DoSave	Saves the user changes to the data and returns the employee HTML page.
Skipit	The employee information for the specified employee in the table. Skipit takes cookie information passed in as a parameter from the Web browser, checks the cookies table to find the previous record number, and moves the record pointer forward or backward relative to the record number stored in the cookies table. The new record number is written back to the cookies table and the genHTML method is called.
Startup	The employee information for the first employee in the table. Startup creates an new cookie id for the user and sends it back as a hidden input area in the HTML.
Keeping the Server Active

Normally, for each request from a web client, the OLE server is instantiated, generates an HTML page, and is released with the Release( ) call in CallObject( ) in FOXISAPI.CPP. This means the entire Visual FoxPro runtime will start up and shut down for each request.

If the OLE Custom Server is registered as Multi-Use, and the Release( ) is not called, then the first request will start up the server but subsequent requests will use the same instance of the server, making performance much better. Code in FOXISAPI.DLL and in the Load, Cmd, DoSave, Startup, and Skipit methods of the ISForm manage keeping the same instance of the server active.

Variables in the DLL

Two variables are declared: pdispObj and pdispDoRelease. When the server is initially created, pdispObj is the dispatch handle to the OLE object. The pdispDoRelease variable is set to the same value as pdispObj and passed by reference as a parameter to the method of the ISForm server that was requested by the Web browser. Code in the Visual FoxPro ISForm OLE server can change the value of pdispDoRelease.

Tip   For more information about this sample, see the comments in the code in ISForm and FOXISAPI.CPP.

The Form Load Event

When the ISForm is created, code in the Load event creates two public variables, gpInstance and gpDisp. The first time the ISForm server is loaded, the gpInstance variable is set to 1. Subsequent instances increment this variable. When an instance is released, gpInstance is decremented.

The Entry Point Methods

When a method (Cmd, DoSave, Skipit, or Startup) of the ISForm is invoked through FOXISAPI.DLL, the .DLL passes a dispatch pointer by reference as a parameter to the method.

The first time the server is run, the instance count is set to 1 and the dispatch pointer is stored to the global variable. Then value 0 is stored to the dispatch pointer.

IF m.gnInstance = 1

IF TYPE("pDisp") $ "NI"

gpDisp = m.pDisp

pDisp = 0

ENDIF

ENDIF

At this point, two variables point to the same dispatch pointer value: gpDisp in the ISForm OLE server and pdispObj in FOXISAPI.DLL. The value of pdispDoRelease in the .DLL is 0, as changed in the ISForm OLE Server.

Subsequent times the server is called the instance count in incremented, a new pdispObj is generated in the .DLL, stored to pdispDoRelease, and passed by reference to the requested method. Because the gnInstance value is not 1, the gpDisp variable is not changed. From this point on, gpDisp in the OLE server holds a different value than pdispObj and pdispDoRelease in the .DLL.

Code in the DLL

The following C++ code in FOXISAPI.CPP manages releasing the server. After the first instance is created, subsequent instances are released normally with the Release( ) call in CallObject( ) in FOXISAPI.CPP because pdispObj and pdispDoRelease are set to the same non-zero value.

if (pdispDoRelease != 0) {

pdispObj->Release();  //nonzero, so release the current object

if (pdispObj != pdispDoRelease) {

__try {

(pdispDoRelease)->Release();

} __except  (EXCEPTION_EXECUTE_HANDLER) {

}

}

}

The Destroy event of the ISForm decrements the instance count. When there is only one instance, pdispDoRelease has been set to 0 and the release code is not called. if the pdispObject and pdispDoRelease are the same, subsequent instances are released, but the original instance is not released.

Releasing the Server

To force a release, pdispDoRelease cannot be 0 and must be a different value than pdispObject. The following HTML text sends a value to the server that affects a release:

 <FORM ACTION = "/scripts/foxisapi.dll/foxis.employee.cmd">

<INPUT NAME="Cmd" VALUE = "Reset">

<INPUT TYPE="submit" VALUE="Dos Command">

</FORM>

The following code in the cmd method sets the pdispDoRelease value to the dispatch value of the first instance.

CASE "RESET"$upper(m.p1)

m.pDisp= m.gpDisp

Code in the .DLL will now release the current instance and the original instance that has been kept in existence to prevent the Visual FoxPro runtime from having to be reloaded each time the server was called.

Sending HTML Back to the Client

The GenHTML method of the ISForm class is called from each of the entry point methods. The HTML returned from the genHTML method is returned to the web browser through the Internet Information Server.

If the mode parameter passed to the GenHTML method is not “FORM,” the genHTML method simply looks up the value in a table and sends back preformatted HTML.

IF m.mode != "FORM"

=SEEK(m.mode,"html")

rv = html.html

    RETURN m.rv

ENDIF

If the mode parameter is “FORM,” code in genHTML identifies each of the labels and textboxes on the form, sorts them in top to bottom and left-to-right order, evaluates the Captions and ControlSources of the controls, and uses Visual FoxPro’s text merge capabilities to construct the appropriate HTML text to approximate the display of the form.

If you add additional labels and text boxes to the form, they are automatically displayed in the generated HTML.

Creating and Using Cookies

As a web server this application can be hit dozens of times by various clients, and we need to keep track of user state. In this case, we only track the current record number for that user. We could present the user with a login screen, and use the username as a key for the cookie, but instead we generate a cookie value in the MakeCookie method and pass it as a hidden value in the HTML sent back to the user. Each time the user chooses to go to a different record, we can read the cookie value from the HTTP string sent to the .DLL, locate the cookie in the Cookies table, find the current record number and move the record number relative to this number.

The following property and methods are used in the cookie manipulation process:

•	Cookie property

•	GetCookie method

•	MakeCookie method

•	WriteCookieInfo method

Error Handling

If an error occurs, code in the Error event of the ISForm class calls the GenHTML method with a parameter of “ERROR.” GenHTML reads the pre-formatted HTML text for errors and returns it to the Error event code. The Error event code substitutes error information for placeholders in the HTML:

LOCAL rv

rv = THIS.GenHTML("ERROR")

rv = strtran(m.rv,"%METHOD%",m.cMethod)

rv = strtran(m.rv,"%ERRORNO%",STR(m.nError,4))

rv = strtran(m.rv,"%ERRORMSG%",Message(1))

rv = strtran(m.rv,"%LINENO%",STR(m.nLine,4))

THIS.ErrorHTML = m.rv

When the ErrorHTML property isn’t empty, GenHTML sends the value of ErrorHTML back to the client.

Tables Used in the Fox ISAPI Sample

In addition to the employee table used for data entry and display, the Fox ISAPI sample uses the following table.

Table	Description
HTML	Holds HTML text to be sent back to the Web browser as a header for FoxCMD and DosCMD evaluations or in case of an error.
Cookies	Keeps track of record numbers for various web browsers. The unique cookie field value is passed as a hidden value in HTML text sent to a particular user.


Sample Class Libraries

The Visual FoxPro sample class library provide encapsulated functionality that you can easily add to your applications. SOLUTION.APP in the Visual FoxPro SAMPLES\SOLUTION directory illustrates using most of the sample classes. The sample classes are contained in the following files:

•	Buttons Class Library

•	Samples Class Library

•	TypeLib Class Library

•	Utility Class Library

•	Registry Program

Buttons Class Library

BUTTONS.VCX contains the following classes.

Class	Description
cmdOK	A command button that releases the form it is added to. If the form is contained in a form set, cmdOK releases the form set.
cmdCancel	A subclass of cmdOK with the Caption property set to “Cancel.”
cmdHelp	A command button that invokes help with the HelpContextID of the form it is added to.
MailBtn	A container with a command button, a Microsoft MAPI Message control, and a Microsoft MAPI Session control. Code in the Click event of the command button logs on to mail and composes a message containing the values in the current record of a table. For an example of using the MailBtn class, see SENDMAIL.SCX in the Visual FoxPro SAMPLES\SOLUTION\OLE directory.
VCR	A set of table navigation buttons that allow a user to move the record pointer to the next, prior, top, and bottom records of a table. Set the Skiptable property to the alias of the table you want to move the record pointer in. If Skiptable is empty, the record pointer is moved in the currently selected work area.
Samples Class Library

SAMPLES.VCX contains the following classes.

Class	Description
cboFontName	A combo box that displays all the currently available fonts in the system.
cboFontSize	A combo box that displays all the available point sizes for a particular font. Pass a font name to the FillList method to populate the combo box. The nLargestFont and nSmallestFont properties delimit the maximum and minimum font sizes displayed. You can use this control in conjuction with the cboFontName class. In the InteractiveChange event of the cboFontName object, call the FillList method of the cboFontSize object: THISFORM.cboFontSize1.FillList(THIS.Value) For an example of using this class, see the tbrEditing class in the same class library.
Clock	A container that displays the current date and time. The “Display a system clock” component in the Solutions sample also uses the Clock class.
datachecker	A custom class that manages resolving data conflicts. Code in the Error event of the VCR class in BUTTONS.VCX calls the CheckConflicts method of this class if an attempt to write buffered data to a table encounters changed values: nConflictStatus = ;    THIS.DataChecker1.CheckConflicts() The “Run multiple instances of a form” component in the Solutions sample also uses this class to check for data conflicts. For more information, open the class and read the comments in the code.
Distinct_values _combo	A combo box that is populated on initialization with the distinct values in the ControlSource alias. For example, if you add this class to a form and set the ControlSource to “customer.country”, the combo box will be populated with the countries in the customer table without displaying the country names more than once.
frmNoTitle	A form with properties set so that no title is displayed. If you want to display information in a separate window, you can create an object based on this class and use form graphics methods. The “Display line animation on a form” component in the Solutions sample also uses a form with no title to display the animation.
lookup_combo	A combo box that makes it easy to display values from one field, for example a company name, while binding a ControlSource to another field, for example a company id number. This class has four custom properties: order_column: Column to sort the table by (optional). lookup_table: Table to fill the combo box from. display_column: Column in the table to display. return_column: Column whose value is written to the ControlSource.
MoverLists	A container with two list boxes and four command buttons. A user can move selected items from one list to the other list by clicking the command buttons or dragging and dropping. You need to make sure the RowSourceType of each list box is set to 0 and use the AddItem method to add items to the source list box. MoverLists has three custom properties: CanDropIcon: Cursor to be displayed over a valid target in a drag and drop operation. NoDropIcon: Cursor to be displayed when dropping will not add the selected items to the list box. DragThreshold: Number of pixels before the drag operation begins. The “Move items between list boxes” component in the Solutions sample illustrates the use of this class.
print_reports	A modal form that allows a user to preview a report, print it, or direct it to a file. You can set the cReport property of the class to the name of the report or pass the report name in as a parameter: o = CREATEOBJECT(print_reports, ;    “myreport.frx”)
QBF	A container with three command buttons. Add this class and the VCR class to a form with data-bound controls. When the user chooses Enter QBF, the values in the controls are blanked out. Values that the user enters in the controls specify the filter to be set on the table when the user chooses Query. The controls need to have a ControlSource set and the Parent of the controls needs to be the form, not another container. The “Create a query by example form” component in the Solutions sample illustrates the use of this class.
Resizable	A custom class that manages resizing and repositioning the controls on a form at run time, maintaining their relative sizes and positions. Add the class to a form and, in the Resize event of the form, call the AdjustControls method: THIS.Resizable2.AdjustControls Resizable has two custom properties you need to set: RepositionList: A string containing all the classes for which objects are repositioned. ResizeList: A string containing all the classes for which objects are resized. The “Resize and reposition controls at run time” component in the Solutions sample illustrates the use of this class.
RTFcontrols	A container class containing cboFontName, cboFontSize and command buttons for Bold, Italic, and ForeColor. The cboFontSize control is refreshed in the InteractiveChange event of cboFontName, but no additional functionality is coded with the Bold, Italic and ForeColor command buttons. The “Use the RichText control” component in the Solutions sample illustrates the use of this class.
SoundPlayer	This class can be used to play a non-visual multimedia file, such as a .WAV audio file. See Sample Multimedia Classes for details.
StopWatch	A container class with a timer and labels to display stop watch values. StopWatch has three custom methods you’ll want to use: Start: Starts the stop watch. Stop: Stops the stop watch Reset: Resets the displayed time to 0:00 The “Display a stop watch” component in the Solutions sample illustrates the use of this class.
tbrEditing	tbrEditing has a custom property and a method you’ll want to use: nAppliesTo Property: This property can be set to 1, 2, or 3.  1. User choices affect the current control on the active form. 2. User choices affect all text boxes and edit boxes on the active form. 3. User choices affect all controls on the active form. Refresh: Accepts an object reference as a parameter and sets all the editing controls to the appropriate values of the object. Call the Refresh method in the GotFocus event of a control. The “Change font attributes” component in the Solutions sample illustrates the use of this class.
videoframe	This class can be used to play a visual multimedia file, such as a video for Windows file. See Sample Multimedia Classes for details.
Typelib Class Library

TYPELIB.VCX contains the following class.

Class	Description
typelib	A container class that contains a Foxtlib .OCX control. The ExportTypeLib method of this class calls the methods of the Foxtlib control to read type library information from .OLB, .TLB, and .EXE files. The “View type library information” component in the Solutions sample illustrates the use of this class.
Utility Class Library

UTILITY.VCX contains the following classes.

Class	Description
arraylib	A custom class with methods for inserting array elements, deleting array elements, and scanning array columns.
execsp	A custom class with methods that facilitate SQL pass through and executing stored procedures on a remote database.
filelib	A custom class with methods that perform common string tasks used when manipulating file names, for example, removing the extension, adding a backslash to a path, and so on.
menulib	A container class with methods that create a shortcut menu from an array. The “Create dynamic shortcut menus” component in the Solutions sample illustrates the use of this class.
Registry Program

REGISTRY.PRG contains the following classes.

Class	Description
FileReg	A subclass of the Registry class that provides methods for reading the application associated with particular file extensions and the path to the application.
FoxReg	A subclass of the Registry class that provides methods for reading and writing Visual FoxPro settings in the Windows Registry.
ODBCReg	A subclass of the Registry class that provides methods for reading ODBC data source and driver information.
OldINIReg	A subclass of the Registry class that provides methods for reading and writing to an .INI file.
Registry	A custom class that provides methods for accessing Windows API functions for manipulating the Windows Registry.
For examples of using the registry classes, run SOLUTION.APP in the VFP\SAMPLES\SOLUTION directory.


Sample Multimedia Classes

Two of the classes (SoundPlayer and VideoFrame) and in the Visual FoxPro SAMPLES\CLASSES\SAMPLES.VCX class library allow you to use the MCI (Multimedia Command Interface) to play multimedia files.

The documentation for the MCI commands is in Chapter 7 of the Windows SDK Multimedia Programmer's Reference.

Sound Player Class

This class can be used to play a non-visual multimedia file, such as a .WAV audio file. It allows you to specify the file to be played, and then provides built-in methods to easily play the media file.

Property	Description
AutoOpen	Specifies whether the sound file should be automatically opened and displayed when the object is instantiated. The default value is true (.T.).
AutoPlay	Specifies whether the sound file should be automatically played when it is opened. The default value is true (.T.).
AutoRepeat	Specifies whether the sound file plays continuously.  The default value is false (.F.).
ControlSource	Specifies the column that contains the sound file reference. If empty, the class expects a static file name to be in the SoundFile property.
MCIAlias	Specifies the alias to be used by MCI. If left empty, the alias defaults to the Name property of the class.  Normally this can be left empty, but if the user wants to play the same sound file twice at the same time, a different alias would need to be specified for each.
SoundFile	Holds the name of a sound file to play, for example   “C:\WINDOWS\CHIMES.WAV“
Method	Description
OpenSound	Opens the sound file.
PlaySound	Plays the sound file. The file must be opened with the OpenSound method before it can be played.
PauseSound	Pauses the playing of a sound file. Play can be continued by calling the PlaySound method.
SetPosition	Allows the user to specify the position of the media file.  It can be executed at any time after the file has been opened.  Valid values are "Start," "End," or a specific millisecond into the sound.
CloseSound	Closes the sound file and releases all resources associated with it.
VideoFrame Class

The VideoFrame class can be used to play a visual multimedia file, such as a video for Windows file. This class allows you to position and size the video to be played, and then provides built-in methods to easily play the media file.

For an example of using this class, see VIDEO.SCX in the Visual FoxPro SAMPLES\SOLUTION\FORMS directory.

Property	Description
AutoOpen	Specifies whether the video file should automatically opened and displayed when the object is instantiated.  The default value is true (.T.).
AutoPlay	Specifies whether the video file should automatically play when it is opened. The default value is true (.T.).
AutoRepeat	Specifies whether the video file will loop the video.  Setting this to .T. will cause the video to play continuously. The default value is false (.F.).
ControlSource	Specifies a Field that contains the video file reference.  If empty, the class expects a static file name to be in the VideoFile property.
MCIalias	Specifies the alias to be used by MCI. If left empty, the alias defaults to the Name property of the class.  Normally this can be left empty, but if the user wants to play the same video file twice at the same time, a different alias would need to be specified for each.
VideoFile	Holds the name of a video file to play, for example:  "C:\VFP\SAMPLES\SOLUTION\FORMS\FOX.AVI"
Method	Description
CloseVideo	Closes the video file and releases all resources associated with it.
DoMCI	Called by the other methods to execute MCI commands.  It can also be called by a user to execute a specific MCI command.
OpenVideo	Opens the video file and shows the first frame.
PauseVideo	Pauses a playing video.  The video can be restarted by using the PlayVideo method
PlayVideo	Plays the video file.  The video file must be opened in the OpenVideo method before it can be played.
SetPosition	Allows the user to specify the position of the media file.  It can be executed at any time after the video file has been opened.  Valid values are "Start", "End", or a specific millisecond into the video.


Utility Programs

See Also

These tools are provided with Visual FoxPro to help speed the process of application development.

Utility	Description
ADDLABEL.APP	Adds label sizes to the new label dialog box in the label designer.
ANALYZER.APP	Dynamically traces the structure and symbols in Visual FoxPro application files
Code Analyzer	Provides visual controls, a menu, and keyboard options to navigate through application file code by using output from the Documenting Wizard.
CPZERO.PRG	Removes the code page mark from any file that has a table file structure.
GENDBC.PRG	Generates a program that can re-create a database.
HEXEDIT.APP	Examines or changes address, byte, and ASCII values of data in a file.
RACMGR32.EXE	Configures and stores the registry settings for remote data connections including server configuration, client access configuration, System Security Policy options, and authentication levels
Transformer	Maps values of properties of existing forms, class libraries, and projects according to specific conditions.


See Also

ADDLABEL.APP
ANALYZER.APP
CPZERO.PRG
GENDBC.PRG
HEXEDIT.APP
RACMGR32.EXE
Sample Applications Overview
Transformer


ADDLABEL.APP

See Also

Located in the Visual FoxPro TOOLS\ADDLABEL directory, ADDLABEL.APP allows you to add custom label sizes to the new label dialog box in the label designer by adding new sizes to the Windows Registry.

Syntax

DO ADDLABEL.APP

Adding Label Sizes

If you don't see a label size that you need in the Label Designer, you can add label sizes to the New Label dialog box by adding new label definitions.

To add a label definition

1	Run ADDLABEL.APP.

2	In the Custom Labels dialog box, choose New.

3	In the New Label Definition dialog box, .

4	In the Label Name box of the Create New Label Layout dialog box, enter a name for the new label definition. This name will be displayed in the New Label dialog box when you create a new label.

5	In the text boxes that are displayed over the label illustration, type values for label height, width and margins. You also need to specify how many labels to print in a row in the Number Across spinner.

6	Choose Add.


See Also

Sample Applications Overview


CPZERO.PRG

See Also	Example

Located in VFP\TOOLS\CPZERO. CPZERO.PRG removes the code page mark from any file that has a table file structure. After removing the mark, CPZERO applies another mark that you specify.

Typically, you use CPZERO with files from other platforms or earlier versions of FoxPro. If these files do not have code page marks when you open them, Visual FoxPro prompts you for a code page. If you specify the wrong code page, however, the data in the files won't display properly. To correct the code page, use CPZERO.

Syntax

DO CPZERO [WITH "filename"[, codepage_number]]

Arguments

filename   Specifies the name of the file and must be delimited with single or double quotation marks. If filename is not included, a Locate File dialog box is displayed.

codepage_number   Specifies the desired code page number. If it is not included, the Code Page dialog box is displayed.

Note   Before you run CPZERO on a table, make sure it is closed.


Sample Files Example

* Remove the code page from MYFILE.DBF and specify 437

* as the new code page.

*

DO CPZERO WITH "MYFILE.DBF",437


See Also

Code Pages Supported by Visual FoxPro
CPCONVERT( ) Function
CPCURRENT( ) Function
CPDBF( ) Function
GETCP( ) Function
Sample Applications Overview
SET CPDIALOG Command
SET NOCPTRANS Command


GENDBC.PRG

See Also	Example

Located in VFP\TOOLS\GENDBC, this tool generates a program that can re-create a database. Use this program to:

•	Generate code you can analyze to learn how a database is created via program code.

•	Generate code that can be placed in your program code eliminating the need to ship your databases with your application.

•	Generate code that can be placed in your program code to re-create the database if a customer’s data is corrupt.

Syntax

DO GENDBC WITH filename

Parameters

filename   A character string that contains the name of an output file. The filename can contain path information and an extension. If no extension is supplied, the default extension .PRG is used.

Note   This program will only work on the currently active database.


Sample Files Example

* Creates MYDATA.PRG which contains code to

* re-create the database MyDatabase.

*

OPEN DATABASE MyDatabase

DO gendbc WITH "MyData.PRG"

*

*

* Creates MAIN.PRG in the C:\VFP directory which

* contains code to re-create the database Main.

*

SET DATABASE TO Main

DO gendbc WITH "c:\vfp\main"


See Also

Sample Applications Overview


Transformer

See Also

The Transformer (TRANSFRM.APP) in the VFP\TOOLS\TRANSFRM directory is a conversion utility that enables you to map values of properties of existing forms, class libraries, and projects according to specific conditions, such as original font name or background color, or design time platform.

Note   The Transformer is not supported by Microsoft Support Services either electronically or via telephone.

Transformer Tabs

Files   Specify or add one or more project (.PJX), form (.SCX), or class library (.VCX) files, or folders on which to run conversion rules; specify the scope of a search; or create a log file.

Rules   Specify one or more rules to apply or to deny to the files listed in the Files tab of the Transformer; mark files for inclusion or exclusion; override property defaults; or modify existing search rules.

Log   View the results of the conversion process you define in the Files and Rules tabs of the Transformer.

Window Options

Close   Closes the Transformer and returns to Visual FoxPro.

Transform   Starts the Transformer conversion using the specified rules on the specified files. Click the Create Log Only check box to run the Transformer as an analysis tool that identifies files and changes without affecting the target files.

Help   Accesses this topic.

To generate conversion rules with the Transformer

•	From the Program menu, choose Do.

– Or –

•	Type the following in the Command window:

DO TRANSFRM.APP


See Also

BackColor
Files Tab, Visual FoxPro Transformer
FontBold
Log Tab, Visual FoxPro Transformer
Rules Tab, Visual FoxPro Transformer
Utility programs


Files Tab, Visual FoxPro Transformer

See Also

Specify one or more project (.PJX), form (.SCX), or class library (.VCX) files, or folders on which to run conversion rules.

Tab Options

Add File   Specify the target project, form, or class library file.

Add Folder   Specify the target folder. You can use wildcard characters as templates for any file or folder you specify.

Remove   Remove the highlighted file from the Selected File list.

Search Subdirectories   Directs the Transformer to search all folders contained in the listed target folder.

Create Log Only   Directs the Transformer to only create a log of the process you define in the Rules tab. This checkbox also displays on the Log tab.

Log To File   Directs the Transformer to copy the process log to a file you specify in the edit box by accepting the default file, TRANSFRM.LOG, or by using the Dialog button.


See Also

Transformer
Utility programs


Rules Tab, Visual FoxPro Transformer

See Also

Specify one or more rules to apply or to deny to the files listed in the Files tab of the Transformer.

Tab Options

Property   Specifies a property for which you want to specify a rule. If you specify no value, the current rule will apply globally and can affect the application of other rules in the current Transformer session.

Value   Specifies the value you want the property to be.

Condition   Specifies the current condition that triggers the change. If you don't specify a condition, only modified properties in the target file(s) (displayed as bold in the property window) are changed to the value you specify in Value. Use the Dialog button to build a complex rule in the Expression Builder.

Files   Specifies one or more files you wish to modify. You can use wildcard characters as templates for files. You can also specify files to exclude by using the Exclude check box.

Classes   Specifies one or more files you wish to modify. You can use wildcard characters as templates for class libraries. You can also specify class libraries to exclude by using the Exclude check box.

Add   Adds a rule to the Selected Rules list.

Clear   Clears the rules from the Selected Rules list.

Font Rule   Displays the rule Transformer generates from your edit box input. For font properties, the Transformer creates a best fit solution using the FontInfo field of specified files and font metrics calculations.

Edit   Enables editing of the selected rule.

Remove   Removes the highlighted rule from the Selected Rule list.

Open   Opens an existing Transformer rules table (.DBF) so you can select from saved rules.

Save   Saves current Selected Rules to a Transformer rules table (.DBF).

Files - Exclude   Specifies one or more files or file templates you want to exclude from the conversion process.

Classes - Exclude   Specifies one or more class libraries or class library file templates you want to exclude from the conversion process.

Override Defaults   Specifies that the Transformer should replace the conditional value even if it is a default in the specified target. Normally, the Transformer modifies or remaps only properties that have been set (display as bold in the property window), but does not modify default values.


See Also

FONTMETRIC( ) Function
Transformer
Utility programs


Log Tab, Visual FoxPro Transformer

See Also

View the results of the conversion process you define in the Files and Rules tabs of the Transformer.

Tab Options

Create Log Only   Directs the Transformer to only create a log of the process you define in the Rules tab. This check box also displays on the Files tab.

Zoom   Opens a movable resizable window to display the Transformer log.


See Also

Transformer
Utility programs


Code Analyzer

See Also

The Code Analyzer (ANALYZER.APP) in the VFP\TOOLS\ANALYZER directory provides a way to dynamically trace the structure and symbols in Visual FoxPro application files. Code Analyzer provides visual controls, a menu, and keyboard options to navigate through application file code by using output from the Documenting Wizard.

Syntax

DO ANALYZER.APP WITH “filename”

Arguments

filename   Specifies the name of the file. Must be delimited with single or double quotation marks.

Code Analyzer Tabs

Symbols   Provides access to all the user symbols in the open code document.

Hierarchies   Provides display of either the calling tree hierarchy or the class hierarchy of your program.


See Also

Documenting Wizard
Hierarchies Tab, Code Analyzer
Symbols Tab, Code Analyzer
Utility programs


Symbols Tab, Code Analyzer

See Also

This tab displays the symbols available in your documented code and provides a way to navigate through the code and between symbols. The tab contains the following controls.

Tab Options

Goto    Opens a text window or moves the cursor to the first occurrence of the symbol selected in the Files grid.

Next    Moves the text window cursor to the next occurrence of the symbol selected in the Files grid.

Symbols    Displays all the symbols available in the documented file.

Files    Displays the procedures and files in which the selected symbol occurs.


See Also

ANALYZER.APP
Utility programs


Hierarchies Tab, Code Analyzer

See Also

This tab provides display of either the calling tree hierarchy or the class diagram of your program. The tab contains the following controls:

Tab options

Files   Displays either the calling tree hierarchy or the class diagram of your program.

Option   Selects the alternate displays of the Files outline control.


See Also

ANALYZER.APP
Utility programs


HexEdit

See Also

The HexEdit tool (HEXEDIT.APP) in the VFP\TOOLS\HEXEDIT directory provides a way to examine address values, or examine or change byte and ASCII values of data in a file. HexEdit is a visual equivalent of the MS-DOS Debug program DUMP Command.

Caution   If you want to edit the file, make sure it is not in use or otherwise locked.

Syntax

DO HEXEDIT.APP

When you choose a file, HexEdit displays a dialog box with the following control options.

Note   If you want to edit the file, make sure it is not in use or otherwise locked.

Dialog Options

Select File   Displays the Open dialog box so you can change the current file.

Address   Displays the file offset address of the first byte of data in a 16-byte block displayed in the next columns.

0…F   Displays sixteen 2-digit numbers, representing the hexadecimal byte value in that file location.

Text  Displays the ASCII representation of the byte value in the corresponding location in the byte value columns.

Save Edits   Saves changes to the open file.

Undo Edits   Discards all edits to the open file.

Find   Enables you to specify a character to seek in the file. You can also choose to search forward or backward from anywhere in the file.

Jump   Enables you to specify either a hexadecimal or decimal address to edit.

Close   Closes HexEdit and the open file.


See Also

Utility programs
Visual FoxPro Key Codes


Remote Automation Connection Manager

See Also

The Remote Automation Connection Manager (RACMGR32.EXE) in the WINDOWS\SYSTEM directory provides a way to configure and store the registry settings for remote data connections including server configuration, client access configuration, System Security Policy options, and authentication levels.

For detailed information, see the section “Using Remote Automation” in Chapter 16, “Adding OLE“ in the Developer’s Guide.


See Also

Utility Programs


Switching from dBASE Overview

See Also

If you have dBASE programs or files you want to use with Visual FoxPro, there are several different approaches you can take.

To	See
Run your existing dBASE programs (.PRG files) unmodified in Visual FoxPro	Running Existing dBASE Programs
Use existing dBASE tables in Visual FoxPro, or add them to a Visual FoxPro project	Using dBASE Tables in Visual FoxPro
Convert dBASE catalogs (.CAT files) into Visual FoxPro projects	Converting dBASE .CAT Files into Visual FoxPro Projects
Convert existing dBASE forms in Visual FoxPro forms	Converting dBASE Forms
Convert existing dBASE reports or labels into Visual FoxPro reports or labels	Converting dBASE Reports and Labels
Run existing dBASE queries (.QBE files) as programs in Visual FoxPro	Running dBASE Queries in Visual FoxPro
Refer to general information about dBASE compatibility issues	dBASE Compatibility Issues


See Also

Converting dBASE .CAT Files into Visual FoxPro Projects
Converting dBASE Forms
Converting dBASE Reports and Labels
dBASE Compatibility Issues
Running Existing dBASE Programs
Running dBASE Queries in Visual FoxPro
Using dBASE Tables in Visual FoxPro


Running Existing dBASE Programs

See Also

All dBASE III PLUS and most dBASE IV programs will run unmodified in Visual FoxPro. You can run dBASE programs from the Project Manager, from the Command window, or via the menu system.

When you run a dBASE program, Visual FoxPro recompiles the .PRG file into an .FXP file and runs the .FXP.

To increase the likelihood that a dBASE program will run smoothly, issue the command SET COMPATIBLE DB4 in the Command window before running a dBASE program. If the program does not run properly, it may contain unsupported dBASE IV commands, functions, or clauses.

For more information, see Unsupported dBASE IV Commands, Functions, and Clauses.

Note   Visual FoxPro recompiles dBASE programs, so the source code (.PRG) or design file (.QBE, .SCR, .FRG, .LBL) must be available.

Because of the differences in SQL implementation, dBASE IV .PRS programs cannot be run in Visual FoxPro. See SQL Differences Between dBASE IV and Visual FoxPro for more information about differences in SQL implementation.

To run a dBASE IV program

1	In the Command window, type SET COMPATIBLE DB4.

2	Choose one of the following options:

•	In the Project Manager, choose Code, select the dBASE program you want to run, and then choose Run.

 – Or –

•	In the Command window, type DO, followed by the name of the dBASE program you want to run.

•	Choose Do from the Program menu, and then select the name of the dBASE program.

Run Time Errors

If a dBASE program produces a run time error or unexpected results, you can debug the program using the Visual FoxPro debugger.

Syntax Errors

If a syntax error occurs when you are running a program, Visual FoxPro highlights the error line in an editing window. You can use the Help file to check the proper syntax and usage for the command or function that caused the error.

Debugging Tips

•	Make sure that the program does not include unsupported commands, functions, and clauses listed in Unsupported dBASE IV Commands, Functions, and Clauses.

•	Make sure that the dBASE program does not have a procedure, function, variable, or an array named with any Visual FoxPro reserved words.


See Also

Command Window
Debugger Window
Project Manager
SQL Differences Between dBASE IV and Visual FoxPro
Trace Window
Unsupported dBASE IV Commands, Functions, and Clauses


Using dBASE Tables in Visual FoxPro

See Also

dBASE tables (.DBF files) are automatically converted to Visual FoxPro format when you open them in Visual FoxPro. You can then use the tables as you would any other Visual FoxPro tables.

If your dBASE tables contain memo fields, a prompt appears asking if you want to convert the memos to Visual FoxPro format. Then another prompt asks you if you want to remove dBASE soft carriage returns. Choose Yes if the memos contain normal text; choose No if they contain binary data.

You must open tables exclusively for memo conversion to take place.

No backup copy is made of the tables before conversion. If you want to use the tables again in dBASE, you need to copy the table as a FoxPlus type table. In the Command window, type the following:

COPY TO Filename TYPE FOXPLUS

To use a dBASE table in Visual FoxPro

•	In the Command window, type:

USE <database name> EXCLUSIVE

 – Or –

•	From the File menu, choose Open and select the dBASE table you want to use.

Encrypted Tables

If your table is encrypted, you need to decrypt it in dBASE before you can use it in Visual FoxPro.

Indexes

Visual FoxPro uses a different indexing algorithm than dBASE, so if the table being converted has an associated dBASE .MDX or .NDX index, Visual FoxPro automatically creates a Visual FoxPro .CDX or .IDX index for the table.

To use a dBASE IV table with an index and without a memo field in dBASE after Visual FoxPro has converted it, open the file in dBASE and reindex. This step is necessary only if you have changed any of the data.

Tables with Memo Files

If a dBASE table has one or more memo fields, Visual FoxPro automatically converts the memo file so that it is compatible with Visual FoxPro. You cannot use a dBASE IV table with a memo field in dBASE after it has been converted to Visual FoxPro.

The Visual FoxPro file format for memo fields allows you to store an amount of data limited only by your hard disk space.


See Also

Command Window
COPY TO Command
Index File Structure
Memo File Structure
Project Manager
USE Command


Converting dBASE .CAT Files into Visual FoxPro Projects

See Also

If you have existing dBASE catalogs (.CAT files), you can convert them into Visual FoxPro projects (.PJX files).

To convert a dBASE catalog

1	From the File menu, choose Open.

2	Select the name of the dBASE catalog file, and then choose OK.

When you open a dBASE catalog, Visual FoxPro does some or all of the following, depending on the catalog contents:

•	Converts tables to Visual FoxPro format.

•	Converts screens to forms so that you can modify them with the Form Designer.

•	Converts reports and labels so that you can modify them with the Report Designer.

•	Adds dBASE queries (.QBE files) to the Project Manager as programs under the Code tab so that you can run them.


See Also

Converting dBASE Forms
Converting dBASE Reports and Labels
dBASE Compatibility Issues
Running dBASE Queries in Visual FoxPro


Converting dBASE Forms

See Also

When you add a dBASE screen to a Visual FoxPro project and modify it, you are presented with two conversion options:

•	Visual Conversion

•	Full Conversion

In a visual conversion, the objects on the dBASE screen are converted into Visual FoxPro objects on a new form. The Converter sets basic properties for the objects, such as size and placement, but does not attempt to apply event or method code to the objects.

Code associated with the screen is placed in a .PRG file with a name you assign. Use a visual conversion when you want to write new code to make the form work, taking advantage of features of the new Visual FoxPro object model.

If you use the full conversion option, your screen will function immediately as a FoxPro 2.x/dBASE READ-compatible form.For more information about working with converted forms, see Converting FoxPro 2.6 Screens.


See Also

Form Designer
Visual FoxPro Converter Dialog Box


Converting dBASE Reports and Labels

See Also

Visual FoxPro converts dBASE reports and labels when you modify them in Visual FoxPro.

When Visual FoxPro converts reports and labels, Visual FoxPro creates an .FRX file with the information from the dBASE .FRM file, and an .LBX file with the information from the dBASE .LBL file.

Visual FoxPro converts all bands, fields, calculated fields, hidden fields, picture templates, and functions for fields. Visual FoxPro also converts style attributes such as underline, bold, italic, and colors. Fonts are not converted. However, Visual FoxPro supports all Windows-based fonts including TrueType fonts, giving you even greater control over this area than before.

Wordwrap bands are converted to a series of one-line text fields in Visual FoxPro reports. Band spacing and pitch information is not converted. Visual FoxPro does not use a global ruler or a word-wrap paragraph ruler, so this information is not retained. Converted reports will have a right margin equal to the width of the report. The left margin is not changed but can be set in the Visual FoxPro Report Designer.

If you have reports with tab characters, you might need to rearrange fields to achieve the desired appearance.

Differences After Conversion

Since empty report bands print in dBASE, Visual FoxPro adds null characters to these bands so they will also print in Visual FoxPro.

dBASE reports do not store complete environment information, only database aliases. As a result, upon opening a converted report, you might get an error such as "Customer.dbf not found." Visual FoxPro reports can save database names, relations, skips, and index information. Once in the Report Designer, use the data environment to set up the environment the way you want it, and then save that information with that report. No more such errors will appear.

Hard-Coded Reports

Hard-coded reports are recompiled as a .PRG file in Visual FoxPro. You can run the report in the same way you run a program in the Program Manager: select the file and then choose Run.


See Also

Data Environment Designer
Report Designer


Running dBASE Queries in Visual FoxPro

See Also

A dBASE query is a file with a .QBE extension that consists primarily of the dBASE IV commands required to execute the query. You can run a dBASE query (.QBE) in Visual FoxPro without making changes.

dBASE queries are brought into the Project Manager as programs under the Code tab; you cannot modify them in the Query Designer.

To run a dBASE query (.QBE)

•	In the Command window, type:

DO <query name>.QBE

 – Or –

•	In the Project Manager, choose Code, select the name of the query, and then choose Run.


See Also

DO Command
Project Menu
SELECT - SQL Command


dBASE Compatibility Issues

See Also

When you move from dBASE to Visual FoxPro, you might need to consider some of the following compatibility issues:

•	Compatibility Issues for dBASE and Visual FoxPro

•	Commands and Functions Affected by SET COMPATIBLE

•	Other Issues in dBASE IV Compatibility

•	International Differences Between dBASE and Visual FoxPro

•	Keyboard Differences Between dBASE and Visual FoxPro

•	Language Differences Between dBASE IV and Visual FoxPro


See Also

Compatibility Issues for dBASE and Visual FoxPro
Commands and Functions Affected by SET COMPATIBLE
International Differences Between dBASE and Visual FoxPro
Keyboard Differences Between dBASE and Visual FoxPro
Language Differences Between dBASE IV and Visual FoxPro
Other Issues in dBASE IV Compatibility
SET COMPATIBLE Command


Compatibility Issues for dBASE and Visual FoxPro

See Also

Both dBASE III PLUS and dBASE IV files can be used in Visual FoxPro.

Sharing Files Between dBASE and Visual FoxPro

Although you can share files simultaneously between dBASE and Visual FoxPro, it is not recommended, because Visual FoxPro and dBASE have incompatible file locking mechanisms. In addition, because of the necessity of recreating index and memo field files for each application, tables are difficult to maintain.

dBASE III PLUS

The Visual FoxPro language is a superset of dBASE III PLUS. Your dBASE III PLUS programs can run unchanged in Visual FoxPro.

dBASE IV

The only significant areas of incompatibility with dBASE IV are security, network functions, and the more rarely used SQL and transaction processing functions. Most SQL programs (.PRS files) will need to be rewritten in Visual FoxPro. Visual FoxPro has some SQL and transaction commands with the same names as dBASE IV commands.

Enhancing Compatibility with dBASE IV

You can maximize compatibility by issuing the following command:

SET COMPATIBLE DB4

This command changes the way Visual FoxPro executes certain commands and functions to match the behavior of dBASE. Setting COMPATIBLE to DB4 is a great way to get your application up and running. Eventually, as you add Visual FoxPro features, you might find it easier to move away from using the compatibility feature.


See Also

SET COMPATIBLE Command


Commands and Functions Affected by SET COMPATIBLE

See Also

All file processing commands with a drive reference (for example, SET DEFAULT TO C:\VFP\SAMPLES\DATA) are affected by SET COMPATIBLE.

Additional Commands and Functions Affected by SET COMPATIBLE

@ ... GET with a RANGE clause	@ ... SAY with CHR(7)
@ ... SAY scrolling	@ ... SAY when STATUS is ON
ACTIVATE SCREEN	ACTIVATE WINDOW
APPEND MEMO	DECLARE
DIMENSION	GO | GOTO with SET TALK ON
FSIZE( )	INKEY( )
LASTKEY( )	LIKE( )
MENU and POPUP commands	PLAY MACRO
READ with an @ ... GET VALID clause	READ with a numeric PICTURE clause
READ - Nested READs	RUN | !
SET COLOR TO	SET("BORDER")
SET FIELDS	SET MESSAGE
SET PRINTER <file>	STORE
SUM	TRANSFORM( ) with a numeric PICTURE clause
SELECT( )	SYS(2001, "COLOR")
For a full description of how each of these commands is affected, see SET COMPATIBLE.

Template Programming

The dBASE IV template language is different from and independent of dBASE, so dBASE template programs cannot be used in Visual FoxPro and will have to be rewritten. However, you don't have to learn another template language. Visual FoxPro supports template programming natively. Visual FoxPro commands that can be used in template programming include:

•	\ | \\

•	SET TEXTMERGE DELIMITERS

•	SET TEXTMERGE

•	_TEXT

•	_PRETEXT

•	TEXT ... ENDTEXT


See Also

SET COMPATIBLE Command


Other Issues in dBASE IV Compatibility

See Also

In addition to the few language and syntax differences, the following differences between Visual FoxPro and dBASE should be noted.

Parameter Passing

In dBASE IV, parameters are passed by reference to both procedures and functions. In Visual FoxPro, parameters are passed by reference to procedures and by value to functions.

To pass parameters by reference to functions, add the command SET UDFPARMS TO REFERENCE to your program, or explicitly use @ in front of the variables.

Changing Work Areas in a User-Defined Function

In Visual FoxPro, if you change the selected work area in a UDF, the newly selected work area remains selected when the UDF returns control to the calling program. Upon return from a UDF, dBASE IV reselects the work area that had been selected before the function was called.

SET MULTILOCKS

SET MULTILOCKS ON is implicit in dBASE IV. You must explicitly set multilocks on in Visual FoxPro by issuing the command SET MULTILOCKS ON in the Command window.

Reading Keystrokes

dBASE IV and Visual FoxPro use different keyboard shortcut keys in the interactive environment. If a dBASE IV application uses the READKEY( ) or LASTKEY( ) functions to check the user's last action and respond appropriately, errors might result.

Hard-Coded File Extensions

If you have hard-coded file extensions in your dBASE programs, you need to change some of the extensions. The following table shows Visual FoxPro equivalent extensions for each type of dBASE file that a program might use. This table assumes that the Converter has converted all associated dBASE files.

dBASE File	Visual FoxPro File
.DBF	No change needed
.DBT	.FPT
.FMT	.SCX
.FRG	No change needed
.FRM	.FRX
.LBG	No change needed
.LBL	.LBX
.MDX	.CDX
.NDX	.IDX
.PRG	No change needed
.QBE	No change needed


See Also

LASTKEY( ) Function
READKEY( ) Function
SET MULTILOCKS Command
SET UDFPARMS Command


International Differences Between dBASE and Visual FoxPro

See Also

dBASE provides international support through language drivers, the ASCIISORT and LANGTABLES configuration items, and the SET LDCHECK command. These are ignored in Visual FoxPro.

Visual FoxPro provides extensive international features, including automatic translation of accented characters (ä, é ,ô, and so on). Automatic translation of accented characters can occur in tables, programs, and text files. Visual FoxPro provides flexible support for multiple collation sequences, allowing you to order tables for a specific language.

Visual FoxPro provides its international features through the codepage and COLLATE configuration items and several commands and functions.

When opening dBASE tables, you should issue the command SET CPDIALOG ON in the Command window, so that the Code Page dialog box will appear, allowing you to set the appropriate code page for the table.


 See Also

Code Pages Supported by Visual FoxPro
IDXCOLLATE( ) Function
Regional Tab, Options Dialog Box
SYS(15) - Character Translation


Keyboard Differences Between dBASE and Visual FoxPro

See Also

When a Browse window is active in dBASE, the F1 through F10 function keys provide different functionality. In Visual FoxPro, the function keys always provide the same functionality.

The first table below lists the standard dBASE and Visual FoxPro actions for each function key.

The second table lists the dBASE actions for the function keys when a Browse window is active. These actions are not supported in Visual FoxPro.

Visual FoxPro and dBASE Function Key Assignments

Key	Action
F1	Activate online Help
F2	Set (displays the View window)
F3	List
F4	Dir(ectory)
F5	Display Structure
F6	Display Status
F7	Display Memory
F8	Display
F9	Append
F10	Activate/deactivate the system menu bar (same as Alt)
dBASE Browse Window Function Key Assignments
(Not supported in Visual FoxPro)

Key	Action
F1	Activate online Help
F2	Toggle between Browse and Edit mode
F3	Previous field
F4	Next field
F5	No effect
F6	Extend select (select text in a memo field)
F7	Move (move selected text in a memo field)
F8	Copy (copy selected text in a memo field)
F9	Zoom memo field window to full screen
F10	Activate the Browse menu bar
DOWN ARROW	Activate the append record prompt


See Also

FKLABEL( ) Function


Language Differences Between dBASE IV and Visual FoxPro

See Also

The Visual FoxPro language supports practically all the commands and functions available in dBASE IV. However, there are several dBASE IV commands and functions that are not supported in Visual FoxPro, and others that behave in a different manner in Visual FoxPro.

The following topics describe the dBASE IV commands and functions that are not supported in Visual FoxPro and those that behave differently in Visual FoxPro.

To	See
Find out which dBASE commands are supported	Supported dBASE IV Commands and Functions
Find out about commands and functions not supported in Visual FoxPro, or unsupported command clauses unique to dBASE IV	Unsupported dBASE IV Commands, Functions, and Clauses
Differences in SQL support between dBASE IV and Visual FoxPro (dBASE IV SQL commands and functions not supported in Visual FoxPro)	SQL Differences Between dBASE IV and Visual FoxPro


See Also

SQL Commands Overview
SQL Differences Between dBASE IV and Visual FoxPro
Supported dBASE IV Commands and Functions
Unsupported dBASE IV Commands, Functions, and Clauses


Supported dBASE IV Commands and Functions

See Also

Visual FoxPro supports the following dBASE IV commands and functions. See Unsupported dBASE IV Commands, Functions, and Clauses for a list of the dBASE IV commands, functions, and clauses that are not supported in Visual FoxPro.

DBASE Command or Function	Visual FoxPro Equivalent
@ ... SCROLL	See @ ... SCROLL
BARCOUNT( )	See CNTBAR( )
BARPROMPT( )	See BARPROMPT( )
BLANK	See BLANK
DESCENDING( )	See DESCENDING( )
FOR( )	See FOR( )
FDATE( )	See FDATE( )
FLDCOUNT( )	Same as FCOUNT( )
FLDLIST( )	See FLDLIST( )
FTIME( )	See FTIME( )
HOME( )	Same as SYS(2004)
ID( )	Same as SYS(0)
ISBLANK( )	See ISBLANK( )
ISREADONLY( )	See ISREADONLY( )
KEYMATCH( )	See KEYMATCH( )
MEMORY(0)	Same as SYS(1001)
MEMORY(1)	Same as SYS(1001)
MEMORY(2)	Same as SYS(12)
MEMORY(3)	Same as SYS(1001)
MEMORY(4)	Same as SYS(23)
MEMORY(5)	Same as SYS(23)
MEMORY(6)	Same as SYS(1016)
ON BAR	See ON BAR
ON EXIT BAR	Same as ON SELECTION BAR
ON EXIT MENU	Same as ON SELECTION MENU
ON EXIT PAD	Same as ON SELECTION PAD
ON EXIT POPUP	Same as ON SELECTION POPUP
ON MENU	Same as ON SELECTION MENU
ON MOUSE	Same as ON KEY LABEL
ON PAD	Same as ON SELECTION PAD
ON POPUP	Same as ON SELECTION POPUP
PADPROMPT( )	Same as PRMPAD( )
PCOUNT( )	Same as PARAMETERS( )
PRTINFO( )	See PRTINFO( )
REPLACE FROM ARRAY	See REPLACE FROM ARRAY
SET("ATTRIBUTES")	See SET( )
SET DIRECTORY	Same as SET DEFAULT
SET("DIRECTORY")	Same as SYS(5) + SYS(2003)
SET("DISPLAY")	See SET( )
SET FIELDS	See SET FIELDS
SET FORMAT	See SET FORMAT
SET KEY	See SET KEY
SET("LIBRARY")	See SET( )
SET MBLOCK	See SET BLOCKSIZE
SET("MBLOCK")	See SET( )
SET VIEW	See SET VIEW
SYS(1037)	Print Setup Dialog. See SYS(1037)
TAG( )	See TAG( )
TAGCOUNT( )	See TAGCOUNT( )
TAGNO( )	See TAGNO( )
UNIQUE( )	See UNIQUE( )
WINDOW( )	Same as WOUTPUT( )


See Also

Unsupported dBASE IV Commands, Functions, and Clauses


Unsupported dBASE IV Commands, Functions, and Clauses

See Also

Almost all of the hundreds of commands and functions in dBASE IV work exactly the same way in Visual FoxPro. The degree of compatibility is extremely high, and even more so with dBASE IV 1.0 and 1.1. However, the following commands, functions, and clauses differ in dBASE and Visual FoxPro.

@ ... GET   In Visual FoxPro, the dBASE REQUIRED clause in @ ... GET is ignored.

@ ... SCROLL   In Visual FoxPro, the dBASE WRAP clause is ignored.

ACCESS( )   In Visual FoxPro, the dBASE function ACCESS( ) always returns 0.

APPEND   In Visual FoxPro, the dBASE NOORGANIZE clause in APPEND is ignored.

APPEND FROM   In Visual FoxPro, the dBASE NOVERIFY and REINDEX clauses in APPEND FROM are ignored.

APPEND FROM ARRAY   In Visual FoxPro, the dBASE REINDEX clause in APPEND FROM ARRAY is ignored.

Arrays and Functions   During program execution, Visual FoxPro looks for functions before arrays. If you run a dBASE program in Visual FoxPro and the program has an array with the same name as a Visual FoxPro function or a user-defined function, Visual FoxPro executes the Visual FoxPro or user-defined function.

BARCOUNT( )   BARCOUNT( ) is provided for dBASE compatibility. In dBASE, BARCOUNT( ) returns the number of bars in a defined popup, regardless of whether or not the popup has been activated. BARCOUNT( ) in Visual FoxPro calculates the number of bars of active popups. BARCOUNT( ) returns 0 in Visual FoxPro if a popup has been defined but not activated.

BEGIN TRANSACTION   Visual FoxPro supports this command only for tables in a database. Marks the beginning of a transaction. Use ROLLBACK to revert to original state. END TRANSACTION saves the transaction.

BROWSE   In Visual FoxPro, the dBASE NOORGANIZE clause in BROWSE is ignored.

In Visual FoxPro, any setup or cleanup code in a format file specified in the BROWSE FORMAT clause is ignored.

CALL( )   In Visual FoxPro, the dBASE CALL( ) function generates an error. Use CALL instead.

CERROR( )   In Visual FoxPro, the dBASE CERROR( ) function is not supported.

CHANGE( )   In Visual FoxPro, the dBASE CHANGE( ) function always returns false (.F.).

CLEAR SCREEN   In Visual FoxPro, the dBASE CLEAR SCREEN command is ignored. Use RELEASE to clear screen type variables.

CLOSE PRINTER   In Visual FoxPro, the dBASE CLOSE PRINTER command is identical to SET PRINTER TO.

COMPLETED( )   In Visual FoxPro, the dBASE COMPLETED( ) function always returns false (.F.).

CONVERT   In Visual FoxPro, the dBASE CONVERT command generates an error.

DEBUG   In Visual FoxPro, the dBASE DEBUG command generates an error. Use the Visual FoxPro Debugger instead.

DEXPORT   In Visual FoxPro, the dBASE DEXPORT command generates an error.

DGEN( )   In Visual FoxPro, the dBASE DGEN( ) function generates an error.

END TRANSACTION   In Visual FoxPro, the END TRANSACTION command is supported only for tables in a database. Saves the changes made during a transaction.

FCREATE( ) and FOPEN( )   In dBASE IV, the second parameter in the FCREATE( ) and FOPEN( ) functions can be "R" (read-only), "W" (write-only), "A" (append-only), "RW" or "WR (read and write), or "RA" or "AR" (read and append). Visual FoxPro supports these file attributes. The following table lists the Visual FoxPro behavior for these dBASE parameters.

FCREATE( )

dBASE Parameter	Visual FoxPro Behavior
RW or WR	Creates a file with read and write privileges and sets the MS-DOS archive attribute.
A	Creates a file with read and write privileges and sets the MS-DOS archive attribute.
RA or AR	Creates a file with read and write privileges and sets the MS-DOS archive attribute.
R	Creates a file with read-only privileges and sets the MS-DOS read-only attribute.
FOPEN( )

dBASE Parameter	Visual FoxPro Behavior
RW or WR	Opens the file with read and write privileges  and positions the file pointer at the beginning of the file.
A	Opens the file with read-only privileges  and positions the file pointer at the end of the file.
RA or AR	Opens the file with read and write privileges  and positions the file pointer at the end of the file.
R	Opens the file with read-only privileges  and positions the file pointer at the beginning of the file.
FLDLIST( )   In dBASE, FLDLIST( ) returns a field name followed by the -> operator and the table alias. In Visual FoxPro, FLDLIST( ) returns a field name followed by a period and the table alias.

ID( )   ID( ) in dBASE returns the name of the machine that dBASE is running on. ID( ) in Visual FoxPro returns the name of the machine that Visual FoxPro is running on and the number of the machine in the network. If no network is present, ID( ) in Visual FoxPro returns the machine name and 1.

ISMARKED( )   The ISMARKED( ) function is not supported in Visual FoxPro.

LKSYS( )   The LKSYS( ) function is not supported in Visual FoxPro.

MEMORY( )   In dBASE, issuing MEMORY( ) without a numeric argument returns the same value as MEMORY(0). This value is the amount of memory available to dBASE.

In Visual FoxPro, MEMORY( ) returns the amount of memory below 640K that is available to RUN an external program.

MEMORY(7)   In Visual FoxPro, the dBASE function MEMORY(7) always returns 0.

NETWORK( )   In Visual FoxPro, the dBASE function NETWORK( ) always returns true (.T.).

ON SELECTION POPUP   In Visual FoxPro, the dBASE BLANK clause in ON SELECTION POPUP is ignored.

_PDRIVER   In Visual FoxPro, if the printer driver you specify in _PDRIVER has a file name extension, you must include the file name extension with the printer driver file name. In dBASE, a .PR2 file name extension is assumed. You need only include a file name extension when the printer driver file name has an extension other than .PR2.

PROTECT   In Visual FoxPro, the dBASE PROTECT command generates an error.

RESET   In Visual FoxPro, the dBASE RESET command is ignored.

ROLLBACK   Visual FoxPro has a ROLLBACK command that works for tables in a database. Returns records to the state they were in before BEGIN TRANSACTION was issued.

RUN( )   The dBASE RUN( ) function is not supported in Visual FoxPro. Use the RUN command instead.

SAVE SCREEN   In Visual FoxPro, a screen saved in a procedure with SAVE SCREEN is private to the procedure. In dBASE, a screen saved in a procedure is public.

To emulate the dBASE behavior in Visual FoxPro, declare a public variable and then save the screen to the public variable.

SET CATALOG   In Visual FoxPro, the dBASE SET CATALOG command is ignored.

SET DBTRAP   In Visual FoxPro, the dBASE SET DBTRAP command is ignored. DBTRAP is always off in Visual FoxPro.

SET DESIGN   In Visual FoxPro, the dBASE SET DESIGN command is ignored. DESIGN is always on in Visual FoxPro.

SET EXCLUSIVE   In Visual FoxPro and dBASE IV version 2.0, SET EXCLUSIVE is ON by default. In dBASE IV version 1.5, SET EXCLUSIVE is OFF by default.

SET FIELDS   In dBASE, you can add /R to a field in the SET FIELDS command to make it read-only. This switch is ignored in Visual FoxPro.

SET IBLOCK   In Visual FoxPro, the dBASE SET IBLOCK command is ignored.

SET INSTRUCT   In Visual FoxPro, the dBASE SET INSTRUCT command is ignored. INSTRUCT is always off in Visual FoxPro.

SET LDCHECK   In Visual FoxPro, the dBASE SET LDCHECK command is ignored. LDCHECK is always off in Visual FoxPro.

SET MBLOCK   In dBASE, the value you specify for the memo field block size with SET MBLOCK is multiplied by 64.

SET MESSAGE   In Visual FoxPro, the dBASE AT clause in SET MESSAGE is ignored.

SET PRECISION   In Visual FoxPro, the dBASE SET PRECISION command is ignored. Visual FoxPro always uses 16 digits for calculations.

SET SQL   In Visual FoxPro, the dBASE SET SQL command is ignored. SQL is always on in Visual FoxPro.

SET TRAP   In Visual FoxPro, the dBASE SET TRAP command is ignored. TRAP is always on in Visual FoxPro.

SET("BORDER")   In Visual FoxPro, the border characters are returned. In dBASE, SET("BORDER") returns ASCII values for the border characters.

SET("CATALOG")   In Visual FoxPro, SET("CATALOG") always returns OFF.

SET("DBTRAP")   In Visual FoxPro, SET("DBTRAP") always returns OFF.

SET("DESIGN")   In Visual FoxPro, SET("DESIGN") always returns ON.

SET("FIELDS",1)   In Visual FoxPro, when FIELDS is set to LOCAL and COMPATIBLE is set to FOXPLUS or OFF, aliases are not returned with the field’s names.

SET("IBLOCK")   In Visual FoxPro, SET("IBLOCK") always returns 0.

SET("INSTRUCT")   In Visual FoxPro, SET("INSTRUCT") always returns OFF.

SET("LDCHECK")   In Visual FoxPro, SET("LDCHECK") always returns OFF.

SET("PRECISION")   In Visual FoxPro, SET("PRECISION") always returns 16.

SET("SQL")   In Visual FoxPro, SET("SQL") always returns ON.

SET("TRAP")   In Visual FoxPro, SET("TRAP") always returns ON.

SET("VIEW")   In Visual FoxPro, SET("VIEW") always returns the null string ("").

SYSPROC Configuration Item   In dBASE, you can include the SYSPROC configuration item in the dBASE configuration file to open a procedure file. The procedure file remains open during the entire dBASE session.

In Visual FoxPro, you can use SET LIBRARY to open an external API library file.

USE   In Visual FoxPro, the dBASE NOSAVE and NOLOG clauses in USE are ignored.


See Also

Supported dBASE IV Commands and Functions
USE Command


SQL Differences Between dBASE IV and Visual FoxPro

See Also

There are significant differences in the support of SQL in dBASE IV and Visual FoxPro, and some dBASE IV SQL commands are not supported in Visual FoxPro.

dBASE SQL

To work with dBASE IV data in SQL, you create a SQL database and perform operations on it in a special SQL mode. Programs using SQL must be separate and distinct from other dBASE programs (.PRS v .PRG programs). The semicolon is a continuation character for dBASE commands and a required command termination character for SQL commands.

Visual FoxPro SQL

Visual FoxPro supports the SQL commands ALTER TABLE, CREATE CURSOR, CREATE TABLE, DELETE, INSERT, SELECT, and UPDATE. SQL is fully integrated in Visual FoxPro. You can use SQL commands exactly as you would use any other Visual FoxPro commands, interspersing Visual FoxPro and SQL commands if you want. The semicolon is a continuation character for all Visual FoxPro and SQL commands.

Because of the significant differences between the implementation of SQL in dBASE IV and in Visual FoxPro, complex dBASE IV SQL programs may not run in Visual FoxPro and will have to be rewritten.


See Also

SQL Commands Overview


Table File Structure (.DBC, .DBF, .FRX, .LBX, .MNX, .PJX, .SCX, .VCX)

See Also

Visual FoxPro uses tables to store data that defines different file types. The file types that are saved as table files are:

•	Table (.DBF)

•	Database (.DBC)

•	Form (.SCX)

•	Label (.LBX)

•	Menu (.MNX)

•	Project (.PJX)

•	Report (.FRX)

•	Visual Class Library (.VCX)

Because these files are actually tables, you can use and browse them in the same way that you browse any .DBF file.

A table file is made up of a header record and data records. The header record defines the structure of the table and contains any other information related to the table. It starts at file position zero. The data records1 follow the header (in consecutive bytes) and contain the actual text of the fields.

For information about the table structures of the different file types, see Table Structures of Table Files.

The length of a record (in bytes) is determined by summing the defined lengths of all fields. Integers in table files are stored with the least significant byte first.

Table Header Record Structure

Byte offset	Description
0	Type of file 0x02 FoxBASE 0x03 FoxBASE+/dBASE III PLUS, no memo 0x30 Visual FoxPro 0x43 dBASE IV SQL table files, no memo 0x63 dBASE IV SQL system files, no memo 0x83 FoxBASE+/dBASE III PLUS, with memo 0x8B dBASE IV with memo 0xCB dBASE IV SQL table files, with memo 0xF5 FoxPro 2.x (or earlier) with memo 0xFB FoxBASE
1 – 3	Last update (YYMMDD)
4 – 7	Number of records in file
8 – 9	Position of first data record
10 – 11	Length of one data record (including delete flag)
12 – 27	Reserved
28	Table Flags 0x01 file has a structural .CDX 0x02 file has a Memo field 0x04 file is a database (.DBC) Note that this byte can contain the sum of any of the above values. For example, 0x03 indicates the table has a structural .CDX  and a Memo field.
29	Code page mark
30 – 31	Reserved, contains 0x00
32 – n	Field subrecords The number of fields determines the number of field subrecords. There is one field subrecord for each field in the table.
n+1	Header record terminator (0x0D)
n+2 to n+264	A 263-byte range that contains the backlink information (the relative path of an associated database (.DBC)). If the first byte is 0x00 then the file is not associated with a database. Hence, database files themselves always contain 0x00.
1 The data in the data file starts at the position indicated in bytes 8 to 9 of the header record. Data records begin with a delete flag byte. If this byte is an ASCII space (0x20) the record is not deleted; if the first byte is an asterisk (0x2A) the record is deleted. The data from the fields named in the field subrecords follows the delete flag.

Field Subrecords Structure

Byte offset	Description
0 – 10	Field name (maximum of 10 characters; if less than 10, it is padded with null character (0x00))
11	Field Type:  C – Character Y – Currency N – Numeric F – Float D – Date T – DateTime B – Double I – Integer L – Logical M – Memo G – General C – Character (binary) M – Memo (binary) P – Picture
12 – 15	Displacement of field in record
16	Length of field (in bytes)
17	Number of decimal places
18	Field Flags 0x01  System Column (not visible to user) 0x02 Column can store null values 0x04 Binary column (for CHAR and MEMO only)
19 – 32	Reserved
For information about limitations on characters per record, maximum fields, and so on, see Visual FoxPro System Capacities.

Remarks

Visual FoxPro does not modify the header of a file that has been saved to a FoxPro 2.x file format unless one of the following features has been added to the file:

•	Null value support

•	DateTime, Currency, and Double data types

•	CHAR or MEMO field is marked as Binary

•	A table is added to a database (.DBC) file

Tip   You can use the following formula to return the number of fields in a table file: (x – 296/32). In the formula, x is the position of the first record (bytes 8 to 9 in the table header record), 296 is 263 (backlink info) + 1 (header record terminator) + 32 (first field subrecord), and 32 is the length of a field subrecord.


See Also

Code Pages Supported by Visual FoxPro
Data and Field Types
Table Structures of Table Files (.DBC, .FRX, .LBX, .MNX, .PJX, .SCX, .VCX)


Table Structures of Table Files (.DBC, .FRX, .LBX, .MNX, .PJX, .SCX, .VCX)

See Also

The descriptions of the table structures are stored in files located in the FILESPEC directory. The FILESPEC directory contains two projects: 50SPEC.PJX and 26SPEC.PJX. 50SPEC.PJX contains tables and reports that document Visual FoxPro version 5.0 table files. 26SPEC.PJX contains tables and reports that document FoxPro version 2.6 table files.

To see the descriptions for any table structure, print the appropriate report. The following tables list the file types and their associated reports. Some file types require more than one report because there are too many columns to fit across a single page.

Note   All the reports are formatted for landscape printing.

Visual FoxPro

To see the table structure of a…	Print this report	Which uses
Database1	50DBC.FRX	50DBC.DBF
Form and Visual Class Library	50SCX1.FRX 50SCX2.FRX 50SCX3.FRX	50SCX.DBF
Menu	50MNX.FRX	50MNX.DBF
Project	50PJX1.FRX 50PJX2.FRX	50PJX.DBF
Report and  Label	50FRX1.FRX 50FRX2.FRX	50FRX.DBF
1 The database properties can be printed from 50DBCPRO.FRX.
FoxPro version 2.6

To see the table structure of a…	Print this report	Which uses
Screen	26SCX1.FRX 26SCX2.FRX	26SCX.DBF
Menu	26MNX.FRX	26MNX.DBF
Project	26PJX1.FRX 26PJX2.FRX	26PJX.DBF
Report and  Label	26FRX1.FRX 26FRX2.FRX	26FRX.DBF


See Also

Table File Structure (.DBC, .DBF, .FRX, .LBX, .MNX, .PJX, .SCX, .VCX)


Memo File Structure (.FPT)

See Also

Memo files contain one header record and any number of block structures. The header record contains a pointer to the next free block and the size of the block in bytes. The size is determined by the SET BLOCKSIZE command when the file is created. The header record starts at file position zero and occupies 512 bytes. The SET BLOCKSIZE TO 0 command sets the block size width to 1.

Following the header record are the blocks that contain a block header and the text of the memo. The table file contains block numbers that are used to reference the memo blocks. The position of the block in the memo file is determined by multiplying the block number by the block size (found in the memo file header record). All memo blocks start at even block boundary addresses. A memo block can occupy more than one consecutive block.

Memo Header Record

Byte offset	Description
00 – 03	Location of next free block1
04 – 05	Unused
06 – 07	Block size (bytes per block)1
08 – 511	Unused
1 Integers stored with the most significant byte first.
Memo Block Header and Memo Text

Byte offset	Description
00 – 03	Block signature 1 (indicates the type of data in the block) 0 – picture (picture field type) 1 – text (memo field type)
04 – 07	Length 1 of memo (in bytes)
08 – n	Memo text (n = length)
1 Integers stored with the most significant byte first.


See Also

Table File Structure (.DBC, .DBF, .FRX, .LBX, .MNX, .PJX, .SCX, .VCX)


Index File Structure (.IDX)

See Also

Index files contain one header record and one or many node records. The header record contains information about the root node, the current file size, the length of the key, index options and signature, and printable ASCII representations of the key1 and FOR expressions. The header record starts at file position zero.

The remaining node records contain an attribute, number of keys present, and pointers to nodes on the left and right (on the same level) of the current node. They also contain a group of characters encompassing the key value and either a pointer to a lower level node or an actual table record number. The size of each record that is output to a file is 512 bytes.

Index Header Record

Byte offset	Description
00 – 03	Pointer to the root node
04 – 07	Pointer to the free node list ( -1 if not present)
08 – 11	Pointer to the end of file (file size)
12 – 13	Length of key
14	Index options (any of the following numeric values or their sums): 1 – a unique index  8 – index has FOR clause
15	Index signature (for future use)
16 – 235	Key expression (uncompiled; up to 220 characters)1,3
236 – 455	FOR expression (uncompiled; up to 220 characters ending with a null value byte)
456 – 511	Unused
Index Node Record

Byte offset	Description
00 – 01	Node attributes (any of the following numeric values or their sums): 0 – index node  1 – root node  2 – leaf node
02 – 03	Number of keys present (0, 1 or many)
04 – 07	Pointer to the node directly to left of the current node (on same level; -1 if not present)
08 – 11	Pointer to the node directly to right of the current node (on same level; -1 if not present)
12 – 511	Up to 500 characters containing the key value for the length of the key with a four-byte hexadecimal number stored in normal left-to-right format: If the node is a leaf (attribute = 02 or 03) then the four bytes contain an actual table number in hexadecimal format; otherwise, the 4 bytes contain an intra-index pointer.2 The key/four-byte hexadecimal number combinations will occur the number of times indicated in bytes 02 – 03.
Notes

1.	The type of the key is not stored in the index. It must be determined by the key expression.

2.	Anything other than character strings, numbers used as key values, and the four-byte numbers in the leaf node are represented in reversed bytes (Intel 8086 format).

3.	Numbers are a special case when used as a key. They are converted through the following algorithm so they can be sorted using the same ASCII collating sequence as characters:

•	Convert the number to IEEE floating point format.

•	Swap the order of the bytes from Intel 8086 order to left-to-right order.

•	If the number was negative, take the logical complement of the number (swap all 64 bits, 1 to 0 and 0 to 1); otherwise, invert only the leftmost bit.

Example of an Ordered Tree Structure

Finding a key in the structure below requires searching a single path between the root and leaf nodes. Nodes at the lowest level are leaf nodes. Because the keys are sorted, all keys in the sub-tree are less than or equal to the parent node.

In the illustration above, the letters are used as the key values. Each key would also have a four-byte hexadecimal number. The numbers associated with the keys in the leaf nodes would be actual table numbers — all keys in other nodes would have intra-index pointers associated with them.

Bytes 12-511 in the index node record could be viewed as follows:

The key value/hexadecimal number combination occurs in bytes 12 – 511 n times where n is the number of keys present.


See Also

Compact Index File Structure (.IDX)
Compound Index File Structure (.CDX)
Table File Structure (.DBC, .DBF, .FRX, .LBX, .MNX, .PJX, .SCX, .VCX)


Compact Index File Structure (.IDX)

See Also

Compact Index Header Record

Byte offset	Description
00 – 03	Pointer to root node
04 – 07	Pointer to free node list ( -1 if not present)
08 – 11	Reserved for internal use
12 – 13	Length of key
14	Index options (any of the following numeric values or their sums): 1 – a unique index  8 – index has FOR clause  32  – compact index format  64  – compound index header
15	Index signature
16 – 19	Reserved for internal use
20 – 23	Reserved for internal use
24 – 27	Reserved for internal use
28 – 31	Reserved for internal use
32 – 35	Reserved for internal use
36 – 501	Reserved for internal use
502 – 503	Ascending or descending: 0  = ascending  1  = descending
504 – 505	Reserved for internal use
506 – 507	FOR expression pool length1
508 – 509	Reserved for internal use
510 – 511	Key expression pool length1
512 – 1023	Key expression pool (uncompiled)
1 This information tracks the space used in the key expression pool.
Compact Index Interior Node Record

Byte offset	Description
00 – 01	Node attributes (any of the following numeric values or their sums): a. 0 – index node b. 1 – root node c. 2 – leaf node
02 – 03	Number of keys present (0, 1 or many)
04 – 07	Pointer to node directly to left of current node (on same level, -1 if not present)
08 – 11	Pointer to node directly to right of current node (on same level; -1 if not present)
12 – 511	Up to 500 characters containing the key value for the length of the key with a four-byte hexadecimal number (stored in normal left-to-right format): This node always contains the index key, record number and intra-index pointer.2 The key/four-byte hexadecimal number combinations will occur the number of times indicated in bytes 02 – 03.
Compact Index Exterior Node Record

Byte offset	Description
00 – 01	Node attributes (any of the following numeric values or their sums): 0 – index node 1 – root node 2 – leaf node
02 – 03	Number of keys present (0, 1 or many)
04 – 07	Pointer to the node directly to the left of current node (on same level; -1 if not present)
08 – 11	Pointer to the node directly to right of the current node (on same level; -1 if not present)
12 – 13	Available free space in node
14 – 17	Record number mask
18	Duplicate byte count mask
19	Trailing byte count mask
20	Number of bits used for record number
21	Number of bits used for duplicate count
22	Number of bits used for trail count
23	Number of bytes holding record number, duplicate count and trailing count
24 – 511	Index keys and information2
2 Each entry consists of the record number, duplicate byte count and trailing byte count, all compacted. The key text is placed at the logical end of the node, working backwards, allowing for previous key entries.


See Also

Compound Index File Structure (.CDX)
Index File Structure (.IDX)
Table File Structure (.DBC, .DBF, .FRX, .LBX, .MNX, .PJX, .SCX, .VCX)


Compound Index File Structure (.CDX)

See Also

All compound indexes are compact indexes.

One file structure exists to track all the tags in the .CDX file. This structure is identical to the compact index file structure with one exception — the leaf nodes at the lowest level of this structure point to one of the tags in the compound index.

All tags in the index have their own complete structure that is identical to the compact index structure for an .IDX file.


See Also

Index File Structure (.IDX)
Compact Index File Structure (.IDX)
Table File Structure (.DBC, .DBF, .FRX, .LBX, .MNX, .PJX, .SCX, .VCX)


Macro File Format (.FKY)

See Also

File Header

Byte offset	Description
01 – 03	Signature, Hex 79FF
04 – 15	Ignored
16 – 17	Number of macros (binary)
18 – end	The macros
Individual Macros

Byte offset	Description
00 – 19	Macro name
20 – 21	Macro length (in keystrokes, binary)
22 – 23	Keystroke (two bytes, binary)
24 – end	Macro keystrokes


See Also

Table File Structure (.DBC, .DBF, .FRX, .LBX, .MNX, .PJX, .SCX, .VCX)


Code Pages Supported by Visual FoxPro

See Also

A code page is a set of characters specific to a language or hardware platform. Accented characters are not represented by the same values across platforms and code pages. In addition, some characters available in one code page are not available in another.

Code page	Platform	Code page identifier
437	U.S. MS-DOS	x01
620 1	Mazovia (Polish) MS-DOS	x69
737 1	Greek MS-DOS (437G)	x6A
850	International MS-DOS	x02
852	Eastern European MS-DOS	x64
861	Icelandic MS-DOS	x67
865	Nordic MS-DOS	x66
866	Russian MS-DOS	x65
895 1	Kamenicky (Czech) MS-DOS	x68
857	Turkish MS-DOS	x6B
1250	Eastern European Windows	xC8
1251	Russian Windows	xC9
1252	Windows ANSI	x03
1253	Greek Windows	xCB
1254	Turkish Windows	xCA
10000	Standard Macintosh	x04
10006	Greek Macintosh	x98
10007 1	Russian Macintosh	x96
10029	Macintosh EE	x97
1 Not detected when you include CODEPAGE=AUTO in your configuration file.


See Also

SET COLLATE


File Extensions and File Types

See Also

This table lists the extensions and their associated file types that are used with Visual FoxPro.

Extension	File type
.ACT	Documenting Wizard action diagram
.APP	Generated application
.CDX	Compound index
.DBC	Database
.DBF	Table
.DCT	Database memo
.DCX	Database index
.DLL	Windows Dynamic Link Library
.ERR	Compilation error
.ESL	Visual FoxPro support library
.EXE	Executable program
.FKY	Macro
.FLL	Visual FoxPro Dynamic Link Library
.FMT	Format File
.FPT	Table memo
.FRT	Report memo
.FRX	Report
.FXP	Compiled program
.H	Header file (for inclusion in a Visual FoxPro or C/C++ program)
.HLP	Graphical Help
.IDX	Index, compact index
.LBT	Label memo
.LBX	Label
.LST	Documenting Wizard list
.MEM	Variable save
.MNT	Menu memo
.MNX	Menu
.MPR	Generated menu program
.MPX	Compiled menu program
.OCX	OLE control
.PJT	Project memo
.PJX	Project
.PRG	Program
.QPR	Generated query program
.QPX	Compiled query program
.SCT	Form memo
.SCX	Form
.SPR	Generated Screen Program (previous versions of FoxPro only)
.SPX	Compiled Screen Program (previous versions of FoxPro only)
.TBK	Memo backup
.TXT	Text
.VCT	Visual class library memo
.VCX	Visual class library
.VUE	FoxPro 2.x view
.WIN	Window file


See Also

Compact Index File Structure (.IDX)
Compound Index File Structure (.CDX)
Index File Structure (.IDX)
Memo File Structure (.FPT)
Table File Structure (.DBC, .DBF, .FRX, .LBX, .MNX, .PJX, .SCX, .VCX)
Table Structures of Table Files (.DBC, .FRX, .LBX, .MNX, .PJX, .SCX, .VCX)


Keyboard Shortcuts

See Also

The tables in this topic show Visual FoxPro shortcuts for running menu commands, manipulating windows, accessing Help, and using default macro definitions.

Menu commands

Shortcut	Command	Applies to
CTRL+A	Select All (Edit Menu)	Editing text
CTRL+C	Copy (Edit Menu)
CTRL+D	Do (Program Menu)
CTRL+E	Delete Item (Menu Menu)	Designing menus
CTRL+E	Do <program> (Program Menu)	Programs
CTRL+F	Find (Edit Menu)
CTRL+H	Change Partitions (Table Menu)	Browse windows
CTRL+I	Insert Item (Menu Menu)	Designing menus
CTRL+J	Project Info (Project Menu)	Projects
CTRL+L	Replace (Edit Menu)
CTRL+M	Resume (Program Menu)	Programs
CTRL+N	New (File Menu)
CTRL+O	Open (File Menu)
CTRL+P	Print (File Menu)
CTRL+Q	Run Query (Query Menu)	Queries When the Query Designer is not active, CTRL+Q closes the active window or dialog box.
CTRL+R	Redo (Edit Menu)
CTRL+S	Save (File Menu)
CTRL+T	Toggle Deletion Mark (Table Menu)	Browse windows
CTRL+V	Paste (Edit Menu)
CTRL+W	Closes current text window or dialog box and saves changes.
CTRL+X	Cut (Edit Menu)
CTRL+Y	Append New Record (Table Menu)	Browse windows
CTRL+Z	Undo (Edit Menu)
Window manipulation

Shortcut	Action
CTRL+F1	Cycles windows
CTRL+F2	Displays Command window
CTRL+F4	Closes active window
CTRL+F5	Restores maximized window
CTRL+F6	Cycles windows
CTRL+F7	Moves active window
CTRL+F8	Sizes active window
CTRL+F9	Minimizes active window
CTRL+F10	Maximizes active window
CTRL+ALT+SHIFT	Hides all child windows while the keys are pressed down. Hiding windows makes it easy to see output displayed in the main application window.
Help

F1	Displays Help Contents or context-sensitive Help on active items (for example, a highlighted keyword in the Command window or the current property in the Properties window).
SHIFT+F1	Enables user-prompted context-sensitive Help. The insertion pointer changes to a question mark so that you can click on an item (for example, a menu command or toolbar) to display context-sensitive Help.
Properties Window

CTRL+ALT+alpha	Selects the next property in the properties list that begins with the alpha character. For example, pressing CTRL+ALT+B selects the next property that begins with B.
CTRL+PAGE DOWN	Move to next object in drop-down Object list.
CTRL+PAGE UP	Move to previous object in drop-down Object list.
CTRL+END	Move to last object in drop-down Object list.
CTRL+HOME	Move to first object in drop-down Object list.
Default Macros Definitions

F2	SET
F3	LIST
F4	DIRECTORY
F5	DISPLAY STRUCTURE
F6	DISPLAY STATUS
F7	DISPLAY MEMORY
F8	DISPLAY
F9	APPEND
Note   The macro definitions apply to the Command window. You can change the macro definitions with the Macros command on the Tools menu.


See Also

Tools Menu


Visual FoxPro System Capacities

See Also

Some capacities may be limited by available memory.

Category	Feature	Number

Table and Index Files

	Maximum # of records per table file	1 billion
	Maximum size of a table file	2 gigabytes
	Maximum # of characters per record	65,500
	Maximum # of fields per record	255
	Maximum # of tables open at one time	2551
	Maximum # of characters per table field	254
	Maximum # of bytes per index key in a non-compact index 2	100
	Maximum # of bytes per index key in a compact index 2	240
	Maximum # of open index files per table	unlimited1
	Maximum # of open indexes in all work areas	unlimited1
	Maximum # of relations	unlimited
	Maximum length of relational expressions	unlimited
Field Characteristics

	Maximum size of character fields	254
	Maximum size of numeric (and float) fields	20
	Maximum number of characters in field names in a free table	10
	Maximum number of characters in field names in a table contained in a database	128
	Minimum value of an integer	-2,147,483,647
	Maximum value of an integer	2,147,483,647
	Digits of precision in numeric computations	16
Variables and Arrays

	Default # of variables	1,024
	Maximum # of variables	65,000
	Maximum # of arrays	65,000
	Maximum # of elements per array	65,000
Program and Procedure Files

	Maximum # of lines in source program files	unlimited
	Maximum size of compiled program  modules 3	64K
	Maximum # of procedures per file	unlimited
	Maximum # of nested DO calls	128
	Maximum # of READ nesting levels	5
	Maximum # of nested structured programming commands	384
	Maximum # of passed parameters	27
	Maximum # of transactions	5
Report Designer Capacities

	Maximum # of objects in a report definition	unlimited1
	Maximum length of a report definition	20 inches
	Maximum # of grouping levels	128
      Other Capacities

	Maximum # of open windows (all types)	unlimited1
	Maximum # of open Browse windows	255
	Maximum # of characters per character string	2 gigabytes
	Maximum # of characters per command line	8,192
	Maximum # of characters per label control on a report	252
	Maximum # of characters per macro subst. Line	8,192
	Maximum # of open files	System limit
	Maximum keystrokes in keyboard macro	1,024
	Maximum fields that can be selected by a SQL SELECT statement	255
1 Limited by memory and available file handles. .CDX files use only one file handle. 2 If the collating sequence is set to MACHINE, each character uses one byte. If the collating sequence is not set to MACHINE, each character uses two bytes. If the indexed field supports null values, one additional byte is used in the index key. Note that non-machine indexes are always compact. 3 A program module is one procedure. A program or application can contain an unlimited number of program modules.


See Also

Table File Structure (.DBC, .DBF, .FRX, .LBX, .MNX, .PJX, .SCX, .VCX)


Special Terms for Configuration Files

The following table lists special terms you can use in configuration files.

Note   You can also use the SET command, system variables, the COMMAND command, and the _STARTUP setting in configuration files.

For details, see the section “Creating a Configuration File,” in Chapter 3, “Configuring Visual FoxPro,” in the Installation Guide and Master Index.

Special terms available in configuration files

Term	Description
EDITWORK path	Specifies where the text editor should place its work files. Because work files can become large, specify a location with plenty of free space. Default is the startup directory.
INDEX extension	Specifies the extension for Visual FoxPro index files. Default is .IDX.
LABEL extension	Specifies the extension for Visual FoxPro label definition files. Default is .LBX.
MVCOUNT	Sets the maximum number of variables that Visual FoxPro can maintain. This value can range from 128 to 65,000; default is 1024.
OUTSHOW ON | OFF	Disables the ability to hide all windows in front of the current output by pressing SHIFT+CTRL+ALT. Default is ON.
PROGWORK path	Specifies where Visual FoxPro keeps the program cache file. For faster performance, especially in a multiuser environment, specify a fast disk (such as a local disk or RAM disk, if available). Allow at least 256K for the cache (however, the file can grow larger). Default is the startup directory.
REPORT extension	Specifies the extension for Visual FoxPro report definition files. Default is .FRX.
RESOURCE path[\file]	Specifies the location of the FOXUSER resource file. The file argument is optional; if not included, Visual FoxPro looks for the FOXUSER.DBF file. If the specified file does not exist, it is created. Default is the startup directory (path) and FOXUSER.DBF (file).
SORTWORK path	Specifies where commands such as SORT and INDEX should place work files. Because work files can become up to twice as large as the tables being sorted, specify a location with plenty of free space. For faster performance, especially in a multiuser environment, specify a fast disk (such as a local disk ). Default is the startup directory.
TEDIT [/N] editor	Specifies the name of the text editor used when you edit program files with MODIFY COMMAND or MODIFY FILE. Include the optional clause /N with TEDIT to specify a Windows text editor (for example, Microsoft Word for Windows). Default is the Visual FoxPro editor.
TITLE title	Specifies the title that appears in the caption bar of the main Visual FoxPro window. Default is “Microsoft Visual FoxPro.”
TMPFILES drive:	Specifies where temporary EDITWORK, SORTWORK, and PROGWORK work files are stored if they have not been specified with any of the other options. Because work files can become very large, specify a location with plenty of free space. For faster performance, especially in a multiuser environment, specify a fast disk (such as a local disk ). Default is the startup directory.
For more details about optimizing performance, see Chapter 15, “Optimizing Applications,” in the Developer’s Guide.


Command-Line Switches

You can add switches to the Visual FoxPro command line to affect how the program starts.

To use a command-line switch

•	Add the switch after VFP.EXE on the command line.

If the command-line switch includes a file name, do not put any spaces between the switch and the file name.

Switches

-A   Ignores the default configuration file and Windows registry settings. This is equivalent to starting Visual FoxPro with the configuration settings it had when first installed, which can be useful for debugging settings that might cause Visual FoxPro to start incorrectly.

For details about configuring the Visual FoxPro environment, see Chapter 3, “Configuring Visual FoxPro” in the Installation Guide and Master Index.

-Cfile   Specifies a configuration file (including path if necessary) other than the default (CONFIG.FPW). Create the configuration file using any text editor.

For details about configuring the Visual FoxPro environment, see Chapter 3, “Configuring Visual FoxPro” in the Installation Guide and Master Index.

-Dfile   Specifies a runtime .DLL file (including path if necessary) other than the default. Using this switch allows you to try different versions of the runtime DLL, for example, different releases.

For more information, see “Including a Run-Time Library” in Chapter 27, “Extending Visual FoxPro with External Libraries,” in the Developer’s Guide.

-Lfile   Specifies a resource file (including path if necessary) other than the default. Using this switch allows you to use Visual FoxPro in a language other than the current language specified by the system.

-R   Refreshes the Windows registry with information about Visual FoxPro, such as associations for Visual FoxPro files. Using this switch is similar to double-clicking a .REG file. The -R switch does not update the registry with settings from the Options dialog.

-T   Suppresses the display of the Visual FoxPro sign-on screen (banner).

For example, to start Visual FoxPro with a custom configuration file, you would alter the command to something like this:

C:\VFP\VFP.EXE -CMYCONFIG.FPW

To start Visual FoxPro without a sign-on screen, use this command:

C:\VFP\VFP.EXE -T


Error Messages A-Z

1815	"cursor" must be created with SELECT ... INTO TABLE.
1832	"field | variable" is not unique and must be qualified.
1130	'field' phrase is not found.
1165	"field" is not related to the current work area.
1196	"file" is not a Visual FoxPro .EXE file.
1309	"file" is not an object file.
1298	"name" band is too large to fit on page.
1929	"name" can only be used within a method.
1932	"name" cannot be closed while suspended.
1462	"name" internal consistency error.
1737	"name" is a method, event, or object.
1740	"name" is a read-only property.
226	"name" is not a file variable.
225	"name" is not a variable.
1294	"name" is not a valid resource file.
232	"name" is not an array.
1924	"name" is not an object.
1983	"name" objects cannot return a value.
1429	"OLE error".
78	** or ^ domain error.
***	*bad date*
***	*Interrupted*
1550	.DBC internal consistency error.
115	.DIF file header is invalid.
117	.DIF type indicator is invalid.
116	.DIF vector is invalid - .DBF field mismatch.
120	.SYLK file dimension bounds are invalid.
121	.SYLK file format is invalid.
119	.SYLK file header is invalid.
A

1727	A .DBF-style Help file is required.
1771	A member object with this name already exists.
1538	A stored procedure is executing.
1961	A subdirectory or file "name" already exists.
1889	A table in multiple relationships can only have one child order.
13	Alias is not found.
24	Alias name is already in use.
103	Allowed DO nesting level exceeded.
1870	ALTER TABLE operation interrupted.
1211	An IF | ELSE | ENDIF statement is missing
1781	An object’s control source cannot be set to its Value property.
1098	API function _UserError( ) was called.
1726	API library is not found.
1711	API library revision mismatch.  Rebuild library.
1178	Application file "file" is not closed.
1936	Application object not initialized.
1972	Array "name" is in use.
230	Array dimensions are invalid.
1764	Array is not a member of the parent object.
1974	Arrays cannot be assigned to array elements.
B

1542	Base table fields have been changed and no longer match view fields. View field properties cannot be set.
1590	BEGIN TRANSACTION command failed.  Nesting level is too deep.
38	Beginning of file encountered.
227	Box dimensions are invalid.
1164	Browse structure has changed.
1163	Browse table is closed.
C

1651	CANCEL or SUSPEND is not allowed.
62	Cannot access characters beyond string.
1106	Cannot access file; transaction is in progress.
1152	Cannot access the selected table.
1421	Cannot activate the OLE server.
1741	Cannot add "name".  Class definition is cyclical.
1755	Cannot add an object to this class.
1769	Cannot add this object to a Column.
1768	Cannot add this object to a Grid.
1537	Cannot add this table: it belongs to database "name".
***	Cannot allocate screen map.
1672	Cannot append from password protected file.
1795	Cannot arrange an untransported form.
1952	Cannot base a view on itself.
2002	Cannot build a DLL without OLE public classes.
1689	Cannot build without a main program.
2012	Cannot call SetFocus from within a When, Valid, RangeHigh or RangeLow event.
1573	Cannot change modality of a visible form.
1758	Cannot change property "name" in SetAll method.
1770	Cannot clear a class that is in use.
176	Cannot clear menu that is in use.
177	Cannot clear popup that is in use.
1951	Cannot clear the object in use.
1546	Cannot close table during execution of a table-bound expression.
1535	Cannot close this database because it is being used by a project.
1971	Cannot compile until the current COMPILE command has completed.
102	Cannot create file "file".
1102	Cannot create file.
2019	Cannot create offline view on a currently modified view.
***	Cannot create program workspace.
169	Cannot define menu item.
1572	Cannot delete a database object while it is open in a designer.
1307	Cannot divide by 0.
1871	Cannot DROP all existing columns.
1754	Cannot find entry point "name" in the DLL.
1562	Cannot find object "name" in the database.
***	Cannot find spell check program.
***	Cannot find the beautify program.
1944	Cannot find the builder program.
1798	Cannot find the converter program.
1693	Cannot find the menu-generation program.
1791	Cannot find the text generation program.
***	Cannot find the spell check program.
***	Cannot find the wizard program.
1563	Cannot find view "name" in the current database.
1846	Cannot GROUP by aggregate field.
1671	Cannot import from password-protected file.
1547	Cannot insert an empty row from a view into its base table(s).
1566	Cannot issue the PACK command on a database while its objects have open cursors.
1720	Cannot issue the SET FORMAT command while a READ command is in progress on a format file.
1753	Cannot load 32-bit DLL "name".
1527	Cannot locate ODBC library, ODBC32.DLL.
1412	Cannot locate the COMSPEC environment variable.
2006	Cannot locate your Web browser.
1731	Cannot modify a base class.
1948	Cannot modify a class that is in use.
1844	Cannot nest aggregate functions.
1926	Cannot nest class definitions.
1254	Cannot nest key labels.
1337	Cannot nest the PRINTJOB command.
***	Cannot open configuration file.
101	Cannot open file.
2013	Cannot open persistent table buffer directly.
1930	Cannot redefine "name".
174	Cannot redefine a menu that is in use.
175	Cannot redefine popup that is in use.
170	Cannot release menu item.
1253	Cannot rename the current directory.
1153	Cannot rename the file to different device.
1970	Cannot reopen project file "name".
1976	Cannot resolve backlink.
2017	Cannot reuse offline view in different mode.
***	Cannot run on MS-DOS before version 3.0.
1191	Cannot save form: an object has an invalid name
1706	Cannot sort .IDX files in descending order.
1909	Cannot update project from project metafile.
111	Cannot update the cursor.
1157	Cannot update the file.
292	Cannot use 0 or negative as the argument for LOG10( ).
1979	Cannot visually modify a class based on a nonvisual class.
1978	Cannot visually modify a class of this type.
1502	Cannot write to the record because it is in use.
1761	Class "name" already exists.
1434	Class "name" has not been registered.
1776	Class "name" is in use.
1752	Class "name" is in use by MODIFY CLASS.
1576	Class "name" is not found in the class library.
1762	Class "name" is not found.
1313	Class creation canceled.
1733	Class definition "name" is not found.
1950	Class definition "name" is recursive.
1747	Class file "name" is invalid.
1746	Class file name for "name" is not valid.
1751	Class file version is greater than the current version.
1993	Class library file "name" is not found.
1949	Class name is invalid.
1914	Code page number is invalid.
1915	Collating sequence "name" is not found.
1728	Color scheme is reserved.
1642	Color set resource is not found.
1695	COLUMN | FORM | ALIAS | NOOVERWRITE | WIDTH are only allowed with the FROM clause.
1698	COLUMN | ROW | ALIAS | NOOVERWRITE | SIZE | SCREEN are only allowed with the FROM clause.
223	Column number must be between 0 and 255.
1657	Column number must be between 0 and the right margin.
1579	Command cannot be issued on a table with cursors in table buffering mode.
1593	Command cannot be issued within a transaction.
1220	Command contains invalid character.
36	Command contains unrecognized phrase/keyword.
1297	Command is allowed only in interactive mode.
1221	Command is missing required clause.
1981	Compile error in file "name".
1252	Compiled code for this line is too long.
1541	Connection "name" is busy.
1466	Connection handle is invalid.
1497	Connection name is invalid.
1526	Connectivity error: "name".
1522	Connectivity internal consistency error.
1725	Constant is already created with #DEFINE.
1509	Conversion canceled.  Adjust the memo BLOCKSIZE.
1799	Conversion is canceled.
1168	Could not add icon to executable file.
1181	Could not add version resource to executable file.
1988	Currency value is out of range.
1166	Cursor is corrupt or in wrong format.
44	Cyclic relation.
D

1966	Data environment is already loaded.
1967	Data environment is already unloaded.
1549	Data session #number cannot be released with open transaction(s).
1599	Data session #number was forced to ROLLBACK all transactions to avoid deadlock.
1732	Data type is invalid for this property.
9	Data type mismatch.
1534	Database "alias" is not open.
1569	Database "name": File access denied.
1561	Database is invalid. Please validate.
1570	Database is read-only.
1709	Database object is being used by someone else.
1773	Database object type is invalid.
1544	DataType property for field "name" is invalid.
1232	DIMENSION contains variable declaration without required subscript arguments.
1963	Directory is not found.
216	Display mode is not available.
1907	Drive specifier is invalid.
1156	Duplicate field names.
E

4	End of file encountered.
1591	END TRANSACTION command cannot be issued without a corresponding BEGIN TRANSACTION command.
1214	ENDTEXT does not have corresponding TEXT statement.
1473	Environment-level property is invalid.
1957	Error accessing printer spooler.
1779	Error adding "name" to the object. Duplicate member/property name.
1112	Error closing the file.
1941	Error code is not valid.
1424	Error copying the OLE object to Clipboard.
1973	Error creating table:  "name".
1423	Error creating the OLE object.
1735	Error in the class definition.
1258	Error in the PICTURE clause.
1574	Error initializing application object.
1508	Error initializing OLE.
1554	Error instantiating cursor.  Table "alias" cannot be opened.  Object will be ignored.
1736	Error instantiating the object.
1958	Error loading printer driver.
1995	Error loading the data environment.  Table is in use.
1881	Error loading file - record number n. "object" <or one of its members>. "Issue": "error".
1797	Error occurred in conversion.
1584	Error reading a property from the database.  The property is ignored.
1104	Error reading file.
1296	Error reading the resource.
1422	Error saving the OLE object.
2005	Error with "name" - "property": "error".
1105	Error writing to file.
1977	Exclusive open required to update this file.  Please reopen.
1523	Execution was canceled by the user.
46	Expression evaluated to an illegal value.
67	Expression evaluator failed.
1148	Expression has been re-entered while the filter is executing.
1759	Expression is invalid.  Use a valid expression  for "name" property.
1940	Expression is not valid outside of WITH/ENDWITH.
1947	Expression is too complex.
293	Expression used with ACOS( ) is out of range.
291	Expression used with ASIN( ) is out of range.
F

***	Fatal error nExpr reporting error nExpr.
1001	Feature is not available.
1580	Feature is not supported for non-.DBC tables.
1953	Feature is only available if the object is in design mode.
1530	Fetching canceled; remote table is closed.
1581	Field "name" does not accept null values.
1582	Field "name" validation rule is violated.
1647	Field expression contains an invalid data type.
1913	Field must be a General field.
350	Field must be a Memo field.
1712	Field name is a duplicate or invalid.
1713	Field width or number of decimal places is invalid.
2014	Fields marked as update keys will be cleared.
1529	File "name" already exists as part of a database.
1553	File "name" is a database.
1551	File "name" is an invalid database.
1552	File "name" is not a database.
1933	File "name" is not closed.
1558	File "name" is not part of a database.
1565	File "name" is part of a database.
1718	File "name"  is read-only.
1190	File "name"  is too large.
1705	File access is denied.
7	File already exists.
1184	File cannot be closed because outstanding references exist.
1503	File cannot be locked.
1	File does not exist.
108	File is in use by another user.
3	File is in use.
1113	File is not open.
1708	File is open in another work area.
1338	File is the wrong version.
1637	File must be opened exclusively to convert the Memo file.
110	File must be opened exclusively.
1918	File name is too long.
1750	File was created in a later version of Visual FoxPro than the current version.
91	File was not placed in memory using the LOAD command.
1140	FILTER expression exceeds allowed size.
1749	Form (.SCX) file must contain at least one Form.
1991	Form file "name" is from a previous version of FoxPro. It must be converted to the current format before it can be executed.
1686	Form file "name" is invalid.
11	Function argument value, type, or count is invalid.
1999	Function is not implemented.
1536	Function is not supported on native tables.
1525	Function is not supported on remote tables.
1300	Function name is missing ).
1304	Function name is missing (.
1504	Function not supported for SQL pass-through cursors.
1586	Function requires row or table buffering mode.
G - H

1986	GDI memory is low, close one or more windows and try again.
1489	General fields cannot be used in the WHERE condition of an update statement. Change the WhereType property of the view.
I

1167	Icon is corrupt or in wrong format.
1587	Illegal nested OLDVAL( ) or CURVAL( ).
1910	Illegal printer driver recursion.
1887	Illegal recursion in rule evaluation.
1960	Illegal redefinition of variable "name".
1594	Illegal to attempt a file lock in a transaction after taking prior record locks.
1679	Import only Worksheet A for Lotus 1-2-3 version 3.0 files.
1241	Improper data type in the group expression.
1994	Include file "name" is not found.
1471	Incorrect column format.
1470	Incorrect property name.
1886	Index does not accept NULL.
114	Index does not match the table.  Delete the index file and re-create the index.
23	Index expression exceeds maximum length.
19	Index file does not match table.
1683	Index tag is not found.
1684	Index tag or file name must be specified.
1002	Input/output operation failure.
1588	INSERT cannot be issued when row or table buffering is enabled or when integrity constraints are in effect.
1308	Insufficient stack space.
1000	Internal consistency error.
1243	Internal error: Too many characters in the report.
231	Invalid argument used with the SET function.
1477	Invalid call issued while executing a SQLCOLUMNS( ) sequence.
1474	Invalid call issued while executing a SQLEXEC( ) sequence.
1475	Invalid call issued while executing a SQLMORERESULTS( ) sequence.
1476	Invalid call issued while executing a SQLTABLES( ) sequence.
1783	Invalid class specified for @...Class command.
***	Invalid compact EXE file.  Rebuild EXE.
1959	Invalid coordinates.
1578	Invalid database table name.
1245	Invalid expression in label definition file.
1111	Invalid file descriptor.
1510	Invalid file format.  If this is a dBASE file, it must be converted first.  To convert it, type MODIFY LABEL labelfilename.
112	Invalid key length.
2011	Invalid operation for offline view.
2008	Invalid operation for offline view while being used online.
2007	Invalid operation for offline view while offline.
1115	Invalid operation for the cursor.
***	Invalid or duplicate field name.
***	Invalid or missing EXE file.
202	Invalid path or file name.
1103	Invalid seek offset.
31	Invalid subscript reference.
1479	Invalid update column name "name".
1652	Invalid use of a Visual FoxPro function as an array.
1223	Invalid variable reference.
J - K

1124	Key exceeds allowed size.
1117	Key field length does not match.
1255	Key label "label" is invalid.
1257	Key string is too long.
356	Keyboard macro file format is invalid.
L

54	Label file is invalid.
1653	Label nesting error.
221	Left margin including indent must be less than the right margin.
21	Length of variable strings exceeds amount of memory.
1691	Library file "name" is invalid.
18	Line is too long.
222	Line number must be less than page length.
1194	Link command failed.
1911	Localized product is required for this environment.
58	LOG( ): Zero or negative used as argument.
***	Logical expression required.
1662	Lotus 1-2-3 version 1.0 file format is invalid.
297	Lotus 1-2-3 version 2.0 file format is invalid.
1678	Lotus 1-2-3 version 3.0 file format is invalid.
M

355	Macro is not defined.
1609	Maximum menu item length (50) is exceeded.
1607	Maximum menu items allowed (128) is exceeded.
1608	Maximum menus allowed (25) is exceeded.
1431	Maximum number of OLE arguments is exceeded.
392	Maximum record length exceeded in the import file.
1943	Member "name" does not evaluate to an object.
1760	Member "name" is a class member.
1975	Member object "name" has not been instantiated.
1756	Member object removed – cannot complete the Save operation.
41	Memo file "name" is missing or is invalid.
55	Memory file is invalid.
2000	Memory is low, so streaming output updating has been disabled.
1687	Menu file is invalid.
178	Menu has not been activated with ACTIVATE MENU.
179	Menu has not been activated with ACTIVATE POPUP.
168	Menu has not been defined with DEFINE MENU.
165	Menu has not been defined with DEFINE POPUP.
167	Menu item position must be a positive number.
1611	Menu items and titles must be type Character.
287	Menu size is too small.
181	Menu specified in ACTIVATE MENU is already in use.
182	Menu specified in ACTIVATE POPUP is already in use.
164	Menu title has not been defined with DEFINE PAD.
279	Menu was not pushed.
1765	Method contains syntax errors.  Method is not saved.
1661	Microsoft Excel file format is invalid.
1723	Mismatched #IF/#ELSIF/#ELSE/#ENDIF.
1256	Mismatched braces in key label.
1724	Missing #ENDIF.
1193	Missing .RTT section.
1306	Missing comma (,).
152	Missing expression.
1231	Missing operand.
1670	Multiplan version 4.0 file format is invalid.
1875	Multiple warnings occurred performing the requested index modifications.
1710	MULTISELECT or MOVER clause is not supported for PROMPT style menus.
1145	Must be a character or numeric key field.
1226	Must be a file variable.
1225	Must be a variable or array.
94	Must specify additional parameters.
N

96	Nesting error.
1488	No connection associated with this cursor
1520	No database is open or set as the current database.
1878	No default value to DROP.
47	No fields found to process.
138	No fields were found to copy.
1492	No key columns specified for the update table "name".  Use the KeyFieldList property of the cursor.
1605	No menu is defined.
1604	No menu item is defined.
166	No menu items have been defined for this menu.
1621	No menu titles have been defined for this menu.
1964	No PageFrame or Page is found in FormSet or Form with WindowType set to READ or READ MODAL.
1238	No PARAMETER statement is found.
1649	No previous PRINTJOB command to correspond to this command.
1879	No primary key.
1796	No records are found for the current platform.
1463	No result set has been returned by the server.
1877	No rule to DROP.
1774	No sheet is found.
1612	No such menu or menu item is defined.
52	No table is open in the current work area.
1491	No update tables are specified.  Use the Tables property of the Cursor object.
45	Not a character expression.
27	Not a numeric expression.
15	Not a table.
1682	Not a user-defined window.
256	Not a valid Framework II database/spreadsheet.
255	Not a valid RapidFile database.
1149	Not enough memory for buffer.
1150	Not enough memory for file map.
1151	Not enough memory for filename.
1600	Not enough memory to open a table with the USE command.
1696	NOWAIT/SAVE/NOENVIRONMENT/IN/WINDOW clauses are not allowed with the FROM clause.
39	Numeric overflow.  Data was lost.
O

1766	Object "name" is not found.
1923	Object "name" is not found.
1985	Object already has a data environment; cannot use another one with the SaveAs method.
1744	Object class is invalid for this container.
1719	Object file "name" is in use and cannot be removed from memory.
1195	Object file "file" was compiled in a previous version of FoxPro.
2009	Object is not an offline view.
1938	Object is not contained in a "name".
1575	Object name is invalid.
1942	Objects cannot be assigned to arrays.
1987	Objects cannot be programmatically added to the Form Designer’s FormSet.
1989	Objects cannot be programmatically deleted from the Form Designer.
1528	ODBC entry point missing, "name".
2015	Offline view must be used online for this command
2010	Offline views must be used exclusively when being used online.
2003	OLE Changed Properties stream is the wrong version. Subclassed properties ignored.
1426	OLE error code 0x"name".
1427	OLE IDispatch exception code "name".
1428	OLE IDispatch exception code "number" from "name": "name".
1420	OLE object is invalid or corrupted.
1965	One of the members of this class is based on a nonvisual class.  Cannot write .VCX file.
1968	One of the members of this Form or FormSet is based on a nonvisual class. Cannot write .SCX file.
1436	Only insertable objects are allowed in General fields.
1885	Only structural tags can be defined as candidate.
1912	Operation is invalid for a General field.
34	Operation is invalid for a Memo, General, or Picture field.
107	Operator/operand type mismatch.
P

1413	Page frame cannot be sized that small.
1688	Paradox file format is invalid.
1767	Parent object will not allow this property setting for "name".
1217	Picture error in GET statement.
1108	Picture too big, corrupt, or in wrong format.
***	Popup too big, first nExpr entries shown.
1722	Preprocessor expression is invalid.
1681	PREVIEW clause is not allowed with OFF/NOCONSOLE or TO PRINT/FILE.
1883	Primary key already exists.
1567	Primary key property is invalid; please validate database.
1956	Printer access denied.
1643	Printer driver is corrupted.
1644	Printer driver is not found.
125	Printer is not ready.
124	Printer redirection is invalid.
1162	Procedure "procedure" is not found.
1937	Procedure file "name" is not found.
***	Product has not been properly installed.
1202	Program is too large.
1946	Project file "name" is in the wrong version.
1685	Project file is invalid.
1169	Project file is read-only.
1763	Property "name" already exists.
1738	Property "name" is not a method or event.
1734	Property "name" is not found.
1757	Property "name" is protected.
1743	Property "name" is read-only.
1138	Property does not have a default value.
1467	Property is invalid for local cursors.
1468	Property is invalid for table cursors.
1559	Property is not found.
1739	Property setting will not take effect until data environment reloaded.
1560	Property value is invalid.
1469	Property value is out of bounds.
Q

1716	Queue "queue" is not found.
R

2018	Reconnect of offline view failed.
109	Record is in use by another user.
20	Record is not in index.
130	Record is not locked.
5	Record is out of range.
1126	Record is too long.
1583	Record validation rule is violated.
1206	Recursive macro definition.
1880	Related table is not found in current database.
1882	Related tag is not found or not primary or candidate.
1183	Relation already exists.
1555	Relational expression is not valid.
2016	Removing a class member is not allowed.
1645	Report contains a nesting error.
50	Report file "name" is invalid.
1592	ROLLBACK command cannot be issued without a corresponding BEGIN TRANSACTION command.
30	Row or column position is off the screen.
1598	Rule and trigger code must balance transaction usage.
1405	RUN|! command failed.
1411	RUN|! command string is too long.
S

1490	Saving a converted form as a class is not supported.
1507	Screen code is too large for available memory.
1851	SELECTs are not UNION compatible.
1715	Server "server" is not found.
1540	Session number is invalid.
***	Source code not found.
***	Source code out of date.
1845	SQL expression is too complex.
1499	SQL parameter "name" is invalid.
1493	SQL parameter is missing.
1465	SQL pass-through internal consistency error.
1498	SQL SELECT statement is invalid.
1472	SQL statement parameter is required for non-prepared SqlExec() calls.
1811	SQL: Aggregate on non-numeric expression.
1802	SQL: Cannot locate table.
1806	SQL: Column "field | variable" is not found.
1819	SQL: DISTINCT is invalid.
1831	SQL: Error building temporary index.
1801	SQL: Error correlating fields.
1818	SQL: FROM clause is required.
1807	SQL: GROUP BY clause is invalid.
1803	SQL: HAVING clause is invalid.
1828	SQL: Illegal GROUP BY in subquery.
1830	SQL: Index is not found.
1800	SQL: Internal error.
1822	SQL: Invalid aggregate field.
1865	SQL: Invalid SET expression in UPDATE.
1866	SQL: Invalid TOP specification.
1810	SQL: Invalid use of subquery.
1839	SQL: Operation was canceled.
1808	SQL: ORDER BY clause is invalid.
1809	SQL: Out of memory.
1814	SQL: Queries of this type are not supported.
1820	SQL: SELECT contains invalid *.
1826	SQL: SELECT is invalid.
1804	SQL: Statement is invalid.
1812	SQL: Statement too long.
1825	SQL: Subquery is invalid.
1842	SQL: Subquery nesting is too deep.
1841	SQL: Too many columns referenced.
1864	SQL: Too many fields in UPDATE.
1805	SQL: Too many subqueries.
1834	SQL: Too many UNIONs.
1867	SQL: TOP requires an ORDER BY.
1813	SQL: Use of UNION in subquery is invalid.
1833	SQL: WHERE clause is invalid.
61	SQRT argument cannot be negative.
95	Statement is not allowed in interactive mode.
1931	Statement is not in a procedure.
1927	Statement is not valid in a class definition.
1928	Statement is only valid within a class definition.
1934	Statement only valid within a method.
1903	String is too long to fit.
1707	Structural .CDX file is not found.
1235	Structure is invalid.
1212	Structure nesting is too deep.
1860	Subquery returned more than one record.
1234	Subscript is outside defined range.
1236	Suspend program before using RESUME.
1673	Symphony version 1.0 file format is invalid.
1674	Symphony version 1.1 file format is invalid.
1242	Syntax error in the field expression.
10	Syntax error.
T

228	Tab stops must be in ascending order.
1548	Table "alias" has one or more non-structural indexes open.  Please close them and retry the Begin Transaction.
1564	Table "name" already exists in the database.
1577	Table "name" is referenced in a relation.
1545	Table buffer for alias "name" contains uncommitted changes.
1596	Table buffering is not enabled.
1556	Table cannot be browsed because cursor object is no longer valid.
26	Table has no index order set.
17	Table number is invalid.
1690	Table operation is invalid during indexing.
1589	Table or row buffering requires that SET MULTILOCKS is set to ON.
1888	Tag name is too long.
1147	Target table is already engaged in a relation.
1792	Text generation is canceled.
1954	The builder program is already running.
1478	The ChildOrder property of a relation object in the data environment is no longer valid.  The relation is being removed.
2020	The class file associated with this field cannot be found - class association cleared.
1969	The clipboard contained one or more objects that could not be added to the container.  Those objects were not pasted.
1935	The current object does not inherit from class "name".
1945	The current object has been released.
1742	The data source for this object must be a variable reference.
1557	The database must be opened exclusively.
1997	The default value for field "name" does not evaluate to the correct type for the field.
1962	The directory is not empty.
1984	The fields in table "name" did not match the entries in the database.
1131	The file specified in the FROM clause is empty.
1699	The IN clause is not supported for this window.
1998	The index expression for index "name" contains an invalid reference to a Memo, General, or Picture field.
42	The LOCATE command must be issued before the CONTINUE command.
1571	The name "name" is already used for another object.  Please choose a different name.
2001	The name of the object file for "file" is already used by another program in the project.
1793	The network request is not supported.
1438	The ActiveX control module failed to register correctly.
***	The Remote View Wizard was unable to obtain column information for this remote table. This may be the result of an ODBC error, or the remote table may not be owned by the current user.
1524	The selected printer driver does not support direct access.
1531	The table changes cannot be performed as the index or filter expression for index name would be invalid.
2004	The table file "name" has moved.  Please validate database "name" and try again.
1659	The table has memo fields that cannot be converted while open read-only.
1778	The table must be converted before appending.
1982	The TO clause can only be used with modal Forms and FormSets.
1996	The validation rule for field "name" does not evaluate to a logical or NULL type.
1213	There is a missing keyword in the FOR ... ENDFOR or DO CASE ... ENDCASE command structure.
56	There is not enough disk space for "name".
43	There is not enough memory to complete this operation.
1780	This array element has been defined as an object and cannot be redefined in the class definition.
1777	This command is not supported for views.
1784	This object is derived from a base class and does not have a parent class.
1782	This OLE property cannot be an expression.
1521	This operation not supported for class member objects.
1533	This property is read-only.
1916	To use this feature, set CODEPAGE=AUTO in your CONFIG.FPW file and restart Visual FoxPro.
1229	Too few arguments.
1230	Too many arguments.
1310	Too many characters are specified in the PICTURE clause.
1872	Too many columns.
1694	Too many extensions are specified.
6	Too many files open.
1201	Too many names used.
1250	Too many PROCEDURE commands are in effect.
1249	Too many READ commands are in effect.
1161	Too many records to browse or edit in the demo version.
22	Too many variables.
1116	Too many windows open.
1646	Total field type must be Date or Numeric.
1246	Total label width exceeds allowed size.
1539	Trigger failed.
1532	Type conversion is not supported.
1501	Type conversion is not supported for output parameters.
1543	Type conversion required by the DataType property for field ‘"name"’ is invalid.
U

1410	Unable to create temporary work files.
1717	Unable to generate a printer driver.
***	Unable to locate desired version of Visual FoxPro.
***	Unable to process error.
1437	Unable to register the ActiveX control.
1884	Uniqueness of index "name" is violated.
***	Unknown error code nExpr.
104	Unknown function key.
1925	Unknown member "name".
16	Unrecognized command verb.
1141	Unrecognized index file revision.  Re-create the index.
1692	Unresolvable REGIONAL name conflict.
1595	Update conflict.  Some of your changes in the current row batch were committed.  Use TABLEUPDATE( ) with the lForce parameter to commit the update or the manual transaction to roll back the update.
1585	Update conflict.  Use TABLEUPDATE( ) with the lForce parameter to commit the update or TABLEREVERT( ) to roll back the update.
1097	User defined functions are not allowed.
V

12	Variable "variable" is not found.
1134	Variable must be in the selected table.
1494	View definition has been changed.
1568	View fields have been changed. The Update and Key field properties have been reset to the default values.
127	View file is invalid.
1597	Views require either DB_BUFOPTROW or DB_BUFOPTTABLE.
***	Visual FoxPro cannot start.
W

1485	Warning:  Invalid data conversion(s) starting at record "name".
1486	Warning:  Invalid memo field conversions starting at record "name".
1496	Warning:  No information is available to check remote update conflicts.
1483	Warning:  The connection packet size cannot be set.
1480	Warning:  The connection sync/async mode cannot be set.
1481	Warning:  The connection timeout cannot be set.
1487	Warning:  The connection transaction mode cannot be set.
1495	Warning:  The key defined by the KeyField property for table "alias" is not unique.
1484	Warning:  The next "cExpr" modified records have already been updated remote.
1482	Warning:  The query timeout cannot be set.
1908	Width or decimal place argument is invalid.
1955	WIN.INI/registry is corrupted.
1714	Window "name" has not been defined.
1632	Window file format is invalid.
215	Window has not been activated with ACTIVATE WINDOW.
214	Window has not been defined with DEFINE WINDOW.
332	Window specified in DEFINE WINDOW has invalid coordinates.
1939	WITH/ENDWITH mismatch.
1775	Worksheet "name" is not found.
1680	Worksheet A for Lotus 1-2-3 version 3.0 file is hidden.
X - Z

1772	You may not change the RecordSource of a BROWSE object.
1127	You must use a logical expression with a FOR or WHILE clause.
37	You must use a logical expression with FILTER.


Error Messages by Number


Error Messages A-Z


Error Messages by Number

***

***	*bad date*
***	Cannot allocate screen map.
***	Cannot create program workspace.
***	Cannot find spell check program.
***	Cannot find the beautify program.
***	Cannot find the spell check program.
***	Cannot find the wizard program.
***	Cannot open configuration file.
***	Cannot run on MS-DOS before version 3.0.
***	Fatal error nExpr reporting error nExpr.
***	*Interrupted*
***	Invalid compact EXE file.  Rebuild EXE.
***	Invalid or duplicate field name.
***	Invalid or missing EXE file.
***	Logical expression required.
***	Popup too big, first nExpr entries shown.
***	Product has not been properly installed.
***	Source code not found.
***	Source code out of date.
***	The Remote View Wizard was unable to obtain column information for this remote table. This may be the result of an ODBC error, or the remote table may not be owned by the current user.
***	Unable to locate desired version of Visual FoxPro.
***	Unable to process error.
***	Unknown error code nExpr.
***	Visual FoxPro cannot start.
0001

1	File does not exist.
3	File is in use.
4	End of file encountered.
5	Record is out of range.
6	Too many files open.
7	File already exists.
9	Data type mismatch.
10	Syntax error.
11	Function argument value, type, or count is invalid.
12	Variable "variable" is not found.
13	Alias is not found.
15	Not a table.
16	Unrecognized command verb.
17	Table number is invalid.
18	Line is too long.
19	Index file does not match table.
20	Record is not in index.
21	Length of variable strings exceeds amount of memory.
22	Too many variables.
23	Index expression exceeds maximum length.
24	Alias name is already in use.
26	Table has no index order set.
27	Not a numeric expression.
30	Row or column position is off the screen.
31	Invalid subscript reference.
34	Operation is invalid for a Memo, General, or Picture field.
36	Command contains unrecognized phrase/keyword.
37	You must use a logical expression with FILTER.
38	Beginning of file encountered.
39	Numeric overflow.  Data was lost.
41	Memo file "name" is missing or is invalid.
42	The LOCATE command must be issued before the CONTINUE command.
43	There is not enough memory to complete this operation.
44	Cyclic relation.
45	Not a character expression.
46	Expression evaluated to an illegal value.
47	No fields found to process.
50	Report file "name" is invalid.
52	No table is open in the current work area.
54	Label file is invalid.
55	Memory file is invalid.
56	There is not enough disk space for "name".
58	LOG( ): Zero or negative used as argument.
61	SQRT argument cannot be negative.
62	Cannot access characters beyond string.
67	Expression evaluator failed.
78	** or ^ domain error.
91	File was not placed in memory using the LOAD command.
94	Must specify additional parameters.
95	Statement is not allowed in interactive mode.
96	Nesting error.
100

101	Cannot open file.
102	Cannot create file "file".
103	Allowed DO nesting level exceeded.
104	Unknown function key.
107	Operator/operand type mismatch.
108	File is in use by another user.
109	Record is in use by another user.
110	File must be opened exclusively.
111	Cannot update the Cursor object.
112	Invalid key length.
114	Index does not match the table.  Delete the index file and re-create the index.
115	.DIF file header is invalid.
116	.DIF vector is invalid - .DBF field mismatch.
117	.DIF type indicator is invalid.
119	.SYLK file header is invalid.
120	.SYLK file dimension bounds are invalid.
121	.SYLK file format is invalid.
124	Printer redirection is invalid.
125	Printer is not ready.
127	View file is invalid.
130	Record is not locked.
138	No fields were found to copy.
152	Missing expression.
164	Menu title has not been defined with DEFINE PAD.
165	Menu has not been defined with DEFINE POPUP.
166	No menu items have been defined for this menu.
167	Menu item position must be a positive number.
168	Menu has not been defined with DEFINE MENU.
169	Cannot define menu item.
170	Cannot release menu item.
174	Cannot redefine a menu that is in use.
175	Cannot redefine popup that is in use.
176	Cannot clear menu that is in use.
177	Cannot clear popup that is in use.
178	Menu has not been activated with ACTIVATE MENU.
179	Menu has not been activated with ACTIVATE POPUP.
181	Menu specified in ACTIVATE MENU is already in use.
182	Menu specified in ACTIVATE POPUP is already in use.
200

202	Invalid path or file name.
214	Window has not been defined with DEFINE WINDOW.
215	Window has not been activated with ACTIVATE WINDOW.
216	Display mode is not available.
221	Left margin including indent must be less than the right margin.
222	Line number must be less than page length.
223	Column number must be between 0 and 255.
225	"name" is not a variable.
226	"name" is not a file variable.
227	Box dimensions are invalid.
228	Tab stops must be in ascending order.
230	Array dimensions are invalid.
231	Invalid argument used with the SET function.
232	"name" is not an array.
255	Not a valid RapidFile database.
256	Not a valid Framework II database/spreadsheet.
279	Menu was not pushed.
287	Menu size is too small.
291	Expression used with ASIN( ) is out of range.
292	Cannot use 0 or negative as the argument for LOG10( ).
293	Expression used with ACOS( ) is out of range.
297	Lotus 1-2-3 version 2.0 file format is invalid.
300

332	Window specified in DEFINE WINDOW has invalid coordinates.
350	Field must be a Memo field.
355	Macro is not defined.
356	Keyboard macro file format is invalid.
392	Maximum record length exceeded in the import file.
1000

1000	Internal consistency error.
1001	Feature is not available.
1002	Input/output operation failure.
1097	User defined functions are not allowed.
1098	API function _UserError( ) was called.
1100

1102	Cannot create file.
1103	Invalid seek offset.
1104	Error reading file.
1105	Error writing to file.
1106	Cannot access file; transaction is in progress.
1108	Picture too big, corrupt, or in wrong format.
1111	Invalid file descriptor.
1112	Error closing the file.
1113	File is not open.
1115	Invalid operation for the cursor.
1116	Too many windows open.
1117	Key field length does not match.
1124	Key exceeds allowed size.
1126	Record is too long.
1127	You must use a logical expression with a FOR or WHILE clause.
1130	'field' phrase is not found.
1131	The file specified in the FROM clause is empty.
1134	Variable must be in the selected table.
1138	Property does not have a default value.
1140	FILTER expression exceeds allowed size.
1141	Unrecognized index file revision.  Re-create the index.
1145	Must be a character or numeric key field.
1147	Target table is already engaged in a relation.
1148	Expression has been re-entered while the filter is executing.
1149	Not enough memory for buffer.
1150	Not enough memory for file map.
1151	Not enough memory for filename.
1152	Cannot access the selected table.
1153	Cannot rename the file to different device.
1156	Duplicate field names.
1157	Cannot update the file.
1161	Too many records to browse or edit in the demo version.
1162	Procedure "procedure" is not found.
1163	Browse table is closed.
1164	Browse structure has changed.
1165	"field" is not related to the current work area.
1166	Cursor is corrupt or in wrong format.
1167	Icon is corrupt or in wrong format.
1168	Could not add icon to executable file.
1169	Project file is read-only.
1178	Application file "file" is not closed.
1181	Could not add version resource to executable file.
1183	Relation already exists.
1184	File cannot be closed because outstanding references exist.
1190	File "name"  is too large.
1191	Cannot save form: an object has an invalid name
1193	Missing .RTT section.
1194	Link command failed.
1195	Object file "file" was compiled in a previous version of FoxPro.
1196	"file" is not a Visual FoxPro .EXE file.
1200

1201	Too many names used.
1202	Program is too large.
1206	Recursive macro definition.
1211	An IF | ELSE | ENDIF statement is missing.
1212	Structure nesting is too deep.
1213	There is a missing keyword in the FOR ... ENDFOR or DO CASE ... ENDCASE command structure.
1214	ENDTEXT does not have corresponding TEXT statement.
1217	Picture error in GET statement.
1220	Command contains invalid character.
1221	Command is missing required clause.
1223	Invalid variable reference.
1225	Must be a variable or array.
1226	Must be a file variable.
1229	Too few arguments.
1230	Too many arguments.
1231	Missing operand.
1232	DIMENSION contains variable declaration without required subscript arguments.
1234	Subscript is outside defined range.
1235	Structure is invalid.
1236	Suspend program before using RESUME.
1238	No PARAMETER statement is found.
1241	Improper data type in the group expression.
1242	Syntax error in the field expression.
1243	Internal error: Too many characters in the report.
1245	Invalid expression in label definition file.
1246	Total label width exceeds allowed size.
1249	Too many READ commands are in effect.
1250	Too many PROCEDURE commands are in effect.
1252	Compiled code for this line is too long.
1253	Cannot rename the current directory.
1254	Cannot nest key labels.
1255	Key label "label" is invalid.
1256	Mismatched braces in key label.
1257	Key string is too long.
1258	Error in the PICTURE clause.
1294	"name" is not a valid resource file.
1296	Error reading the resource.
1297	Command is allowed only in interactive mode.
1298	"name" band is too large to fit on page.
1300

1300	Function name is missing ).
1304	Function name is missing (.
1306	Missing comma (,).
1307	Cannot divide by 0.
1308	Insufficient stack space.
1309	"file" is not an object file.
1310	Too many characters are specified in the PICTURE clause.
1313	Class creation canceled.
1337	Cannot nest the PRINTJOB command.
1338	File is the wrong version.
1400

1405	RUN|! command failed.
1410	Unable to create temporary work files.
1411	RUN|! command string is too long.
1412	Cannot locate the COMSPEC environment variable.
1413	Page frame cannot be sized that small.
1420	OLE object is invalid or corrupted.
1421	Cannot activate the OLE server.
1422	Error saving the OLE object.
1423	Error creating the OLE object.
1424	Error copying the OLE object to Clipboard.
1426	OLE error code 0x"name".
1427	OLE IDispatch exception code "name".
1428	OLE IDispatch exception code "number" from "name": "name".
1429	"OLE error".
1431	Maximum number of OLE arguments is exceeded.
1434	Class "name" has not been registered.
1436	Only insertable objects are allowed in General fields.
1437	Unable to register the ActiveX control.
1438	The ActiveX control module failed to register correctly.
1462	"name" internal consistency error.
1463	No result set has been returned by the server.
1465	SQL pass-through internal consistency error.
1466	Connection handle is invalid.
1467	Property is invalid for local cursors.
1468	Property is invalid for table cursors.
1469	Property value is out of bounds.
1470	Incorrect property name.
1471	Incorrect column format.
1472	SQL statement parameter is required for non-prepared SqlExec() calls.
1473	Environment-level property is invalid.
1474	Invalid call issued while executing a SQLEXEC( ) sequence.
1475	Invalid call issued while executing a SQLMORERESULTS( ) sequence.
1476	Invalid call issued while executing a SQLTABLES( ) sequence.
1477	Invalid call issued while executing a SQLCOLUMNS( ) sequence.
1478	The ChildOrder property of a relation object in the data environment is no longer valid.  The relation is being removed.
1479	Invalid update column name \"name"\.
1480	Warning:  The connection sync/async mode cannot be set.
1481	Warning:  The connection timeout cannot be set.
1482	Warning:  The query timeout cannot be set.
1483	Warning:  The connection packet size cannot be set.
1484	Warning:  The next "cExpr" modified records have already been updated remote.
1485	Warning:  Invalid data conversion(s) starting at record "name".
1486	Warning:  Invalid memo field conversions starting at record "name".
1487	Warning:  The connection transaction mode cannot be set.
1488	No connection associated with this cursor
1489	General fields cannot be used in the WHERE condition of an update statement. Change the WhereType property of the view.
1490	Saving a converted form as a class is not supported.
1491	No update tables are specified.  Use the Tables property of the Cursor object.
1492	No key columns specified for the update table "name".  Use the KeyFieldList property of the cursor.
1493	SQL parameter is missing.
1494	View definition has been changed.
1495	Warning:  The key defined by the KeyField property for table "alias" is not unique.
1496	Warning:  No information is available to check remote update conflicts.
1497	Connection name is invalid.
1498	SQL SELECT statement is invalid.
1499	SQL parameter "name" is invalid.
1500

1501	Type conversion is not supported for output parameters.
1502	Cannot write to the record because it is in use.
1503	File cannot be locked.
1504	Function not supported for SQL pass-through cursors.
1507	Screen code is too large for available memory.
1508	Error initializing OLE.
1509	Conversion canceled.  Adjust the memo BLOCKSIZE.
1510	Invalid file format.  If this is a dBASE file, it must be converted first.  To convert it, type MODIFY LABEL labelfilename.
1520	No database is open or set as the current database.
1521	This operation not supported for class member objects.
1522	Connectivity internal consistency error.
1523	Execution was canceled by the user.
1524	The selected printer driver does not support direct access.
1525	Function is not supported on remote tables.
1526	Connectivity error: "name".
1527	Cannot locate ODBC library, ODBC32.DLL.
1528	ODBC entry point missing, "name".
1529	File "name" already exists as part of a database.
1530	Fetching canceled; remote table is closed.
1531	The table changes cannot be performed as the index or filter expression for index name would be invalid.
1532	Type conversion is not supported.
1533	This property is read-only.
1534	Database "alias" is not open.
1535	Cannot close this database because it is being used by a project.
1536	Function is not supported on native tables.
1537	Cannot add this table: it belongs to database "name".
1538	A stored procedure is executing.
1539	Trigger failed.
1540	Session number is invalid.
1541	Connection "name" is busy.
1542	Base table fields have been changed and no longer match view fields. View field properties cannot be set.
1543	Type conversion required by the DataType property for field ‘"name"’ is invalid.
1544	DataType property for field ‘"name"’ is invalid.
1545	Table buffer for alias "name" contains uncommitted changes.
1546	Cannot close table during execution of a table-bound expression.
1547	Cannot insert an empty row from a view into its base table(s).
1548	Table "alias" has one or more non-structural indexes open.  Please close them and retry the Begin Transaction.
1549	Data session #number cannot be released with open transaction(s).
1550	.DBC internal consistency error.
1551	File "name" is an invalid database.
1552	File "name" is not a database.
1553	File "name" is a database.
1554	Error instantiating cursor object.  Table "alias" cannot be opened.  Object will be ignored.
1555	Relational expression is not valid.
1556	Table cannot be browsed because cursor object is no longer valid.
1557	The database must be opened exclusively.
1558	File "name" is not part of a database.
1559	Property is not found.
1560	Property value is invalid.
1561	Database is invalid. Please validate.
1562	Cannot find object "name" in the database.
1563	Cannot find view "name" in the current database.
1564	Table "name" already exists in the database.
1565	File "name" is part of a database.
1566	Cannot issue the PACK command on a database while its objects have open cursors.
1567	Primary key property is invalid; please validate database.
1568	View fields have been changed. The Update and Key field properties have been reset to the default values.
1569	Database "name": File access denied.
1570	Database is read-only.
1571	The name "name" is already used for another object.  Please choose a different name.
1572	Cannot delete a database object while it is open in a designer.
1573	Cannot change modality of a visible form.
1574	Error initializing application object.
1575	Object name is invalid.
1576	Class "name" is not found in the class library.
1577	Table "name" is referenced in a relation.
1578	Invalid database table name.
1579	Command cannot be issued on a table with cursors in table buffering mode.
1580	Feature is not supported for non-.DBC tables.
1581	Field "name" does not accept null values.
1582	Field "name" validation rule is violated.
1583	Record validation rule is violated.
1584	Error reading a property from the database.  The property is ignored.
1585	Update conflict.  Use TABLEUPDATE( ) with the lForce parameter to commit the update or TABLEREVERT( ) to roll back the update.
1586	Function requires row or table buffering mode.
1587	Illegal nested OLDVAL( ) or CURVAL( ).
1588	INSERT cannot be issued when row or table buffering is enabled or when integrity constraints are in effect.
1589	Table or row buffering requires that SET MULTILOCKS is set to ON.
1590	BEGIN TRANSACTION command failed.  Nesting level is too deep.
1591	END TRANSACTION command cannot be issued without a corresponding BEGIN TRANSACTION command.
1592	ROLLBACK command cannot be issued without a corresponding BEGIN TRANSACTION command.
1593	Command cannot be issued within a transaction.
1594	Illegal to attempt a file lock in a transaction after taking prior record locks.
1595	Update conflict.  Some of your changes in the current row batch were committed.  Use TABLEUPDATE( ) with the lForce parameter to commit the update or the manual transaction to roll back the update.
1596	Table buffering is not enabled.
1597	Views require either DB_BUFOPTROW or DB_BUFOPTTABLE.
1598	Rule and trigger code must balance transaction usage.
1599	Data session #number was forced to ROLLBACK all transactions to avoid deadlock.
1600

1600	Not enough memory to open a table with the USE command.
1604	No menu bar is defined.
1605	No menu is defined.
1607	Maximum menu items allowed (128) is exceeded.
1608	Maximum menus allowed (25) is exceeded.
1609	Maximum menu item length (50) is exceeded.
1611	Menu items and titles must be type Character.
1612	No such menu or menu item is defined.
1621	No menu titles have been defined for this menu.
1632	Window file format is invalid.
1637	File must be opened exclusively to convert the Memo file.
1642	Color set resource is not found.
1643	Printer driver is corrupted.
1644	Printer driver is not found.
1645	Report contains a nesting error.
1646	Total field type must be Date or Numeric.
1647	Field expression contains an invalid data type.
1649	No previous PRINTJOB command to correspond to this command.
1651	CANCEL or SUSPEND is not allowed.
1652	Invalid use of a Visual FoxPro function as an array.
1653	Label nesting error.
1657	Column number must be between 0 and the right margin.
1659	The table has memo fields that cannot be converted while open read-only.
1661	Microsoft Excel file format is invalid.
1662	Lotus 1-2-3 version 1.0 file format is invalid.
1670	Multiplan version 4.0 file format is invalid.
1671	Cannot import from password-protected file.
1672	Cannot append from password protected file.
1673	Symphony version 1.0 file format is invalid.
1674	Symphony version 1.1 file format is invalid.
1678	Lotus 1-2-3 version 3.0 file format is invalid.
1679	Import only Worksheet A for Lotus 1-2-3 version 3.0 files.
1680	Worksheet A for Lotus 1-2-3 version 3.0 file is hidden.
1681	PREVIEW clause is not allowed with OFF/NOCONSOLE or TO PRINT/FILE.
1682	Not a user-defined window.
1683	Index tag is not found.
1684	Index tag or file name must be specified.
1685	Project file is invalid.
1686	Form file "name" is invalid.
1687	Menu file is invalid.
1688	Paradox file format is invalid.
1689	Cannot build without a main program.
1690	Table operation is invalid during indexing.
1691	Library file "name" is invalid.
1692	Unresolvable REGIONAL name conflict.
1693	Cannot find the menu-generation program.
1694	Too many extensions are specified.
1695	COLUMN | FORM | ALIAS | NOOVERWRITE | WIDTH are only allowed with the FROM clause.
1696	NOWAIT | SAVE | NOENVIRONMENT | IN | WINDOW clauses are not allowed with the FROM clause.
1698	COLUMN | ROW | ALIAS | NOOVERWRITE | SIZE | SCREEN are only allowed with the FROM clause.
1699	The IN clause is not supported for this window.
1700

1705	File access is denied.
1706	Cannot sort .IDX files in descending order.
1707	Structural .CDX file is not found.
1708	File is open in another work area.
1709	Database object is being used by someone else.
1710	MULTISELECT or MOVER clause is not supported for PROMPT style menus.
1711	API library revision mismatch.  Rebuild library.
1712	Field name is a duplicate or invalid.
1713	Field width or number of decimal places is invalid.
1714	Window "name" has not been defined.
1715	Server "server" is not found.
1716	Queue "queue" is not found.
1717	Unable to generate a printer driver.
1718	File "name"  is read-only.
1719	Object file "name" is in use and cannot be removed from memory.
1720	Cannot issue the SET FORMAT command while a READ command is in progress on a format file.
1722	Preprocessor expression is invalid.
1723	Mismatched #IF/#ELSIF/#ELSE/#ENDIF.
1724	Missing #ENDIF.
1725	Constant is already created with #DEFINE.
1726	API library is not found.
1727	A .DBF-style Help file is required.
1728	Color scheme is reserved.
1731	Cannot modify a base class.
1732	Data type is invalid for this property.
1733	Class definition "name" is not found.
1734	Property "name" is not found.
1735	Error in the class definition.
1736	Error instantiating the object.
1737	"name" is a method, event, or object.
1738	Property "name" is not a method or event.
1739	Property setting will not take effect until data environment reloaded.
1740	"name" is a read-only property.
1741	Cannot add "name".  Class definition is cyclical.
1742	The data source for this object must be a variable reference.
1743	Property "name" is read-only.
1744	Object class is invalid for this container.
1746	Class file name for "name" is not valid.
1747	Class file "name" is invalid.
1749	Form (.SCX) file must contain at least one Form.
1750	File was created in a later version of Visual FoxPro than the current version.
1751	Class file version is greater than the current version.
1752	Class "name" is in use by MODIFY CLASS.
1753	Cannot load 32-bit DLL "name".
1754	Cannot find entry point "name" in the DLL.
1755	Cannot add an object to this class.
1756	Member object removed – cannot complete the Save operation.
1757	Property "name" is protected.
1758	Cannot change property "name" in SetAll method.
1759	Expression is invalid.  Use a valid expression  for "name" property.
1760	Member "name" is a class member.
1761	Class "name" already exists.
1762	Class "name" is not found.
1763	Property "name" already exists.
1764	Array is not a member of the parent object.
1765	Method contains syntax errors.  Method is not saved.
1766	Object "name" is not found.
1767	Parent object will not allow this property setting for "name".
1768	Cannot add this object to a Grid.
1769	Cannot add this object to a Column.
1770	Cannot clear a class that is in use.
1771	A member object with this name already exists.
1772	You may not change the RecordSource of a BROWSE object.
1773	Database object type is invalid.
1774	No sheet is found.
1775	Worksheet "name" is not found.
1776	Class "name" is in use.
1777	This command is not supported for views.
1778	The table must be converted before appending.
1779	Error adding "name" to the object. Duplicate member/property name.
1780	This array element has been defined as an object and cannot be redefined in the class definition.
1781	An object’s control source cannot be set to its Value property.
1782	This OLE property cannot be an expression.
1783	Invalid class specified for @...Class command.
1784	This object is derived from a base class and does not have a parent class.
1791	Cannot find the text generation program.
1792	Text generation is canceled.
1793	The network request is not supported.
1795	Cannot arrange an untransported form.
1796	No records are found for the current platform.
1797	Error occurred in conversion.
1798	Cannot find the converter program.
1799	Conversion is canceled.
1800

1800	SQL: Internal error.
1801	SQL: Error correlating fields.
1802	SQL: Cannot locate table.
1803	SQL: HAVING clause is invalid.
1804	SQL: Statement is invalid.
1805	SQL: Too many subqueries.
1806	SQL: Column "field | variable" is not found.
1807	SQL: GROUP BY clause is invalid.
1808	SQL: ORDER BY clause is invalid.
1809	SQL: Out of memory.
1810	SQL: Invalid use of subquery.
1811	SQL: Aggregate on non-numeric expression.
1812	SQL: Statement too long.
1813	SQL: Use of UNION in subquery is invalid.
1814	SQL: Queries of this type are not supported.
1815	"cursor" must be created with SELECT ... INTO TABLE.
1818	SQL: FROM clause is required.
1819	SQL: DISTINCT is invalid.
1820	SQL: SELECT contains invalid *.
1822	SQL: Invalid aggregate field.
1825	SQL: Subquery is invalid.
1826	SQL: SELECT is invalid.
1828	SQL: Illegal GROUP BY in subquery.
1830	SQL: Index is not found.
1831	SQL: Error building temporary index.
1832	"field | variable" is not unique and must be qualified.
1833	SQL: WHERE clause is invalid.
1834	SQL: Too many UNIONs.
1839	SQL: Operation was canceled.
1841	SQL: Too many columns referenced.
1842	SQL: Subquery nesting is too deep.
1844	Cannot nest aggregate functions.
1845	SQL expression is too complex.
1846	Cannot GROUP by aggregate field.
1851	SELECTs are not UNION compatible.
1860	Subquery returned more than one record.
1864	SQL: Too many fields in UPDATE.
1865	SQL: Invalid SET expression in UPDATE.
1866	SQL: Invalid TOP specification.
1867	SQL: TOP requires an ORDER BY.
1870	ALTER TABLE operation interrupted.
1871	Cannot DROP all existing columns.
1872	Too many columns.
1875	Multiple warnings occurred performing the requested index modifications.
1877	No rule to DROP.
1878	No default value to DROP.
1879	No primary key.
1880	Related table is not found in current database.
1881	Error loading file - record number n. "object" <or one of its members>. "Issue": "error".
1882	Related tag is not found or not primary or candidate.
1883	Primary key already exists.
1884	Uniqueness of index "name" is violated.
1885	Only structural tags can be defined as candidate.
1886	Index does not accept NULL.
1887	Illegal recursion in rule evaluation.
1888	Tag name is too long.
1889	A table in multiple relationships can only have one child order.
1900

1903	String is too long to fit.
1907	Drive specifier is invalid.
1908	Length or decimal place argument is invalid.
1909	Cannot update project from project metafile.
1910	Illegal printer driver recursion.
1911	Localized product is required for this environment.
1912	Operation is invalid for a General field.
1913	Field must be a General field.
1914	Code page number is invalid.
1915	Collating sequence "name" is not found.
1916	To use this feature, set CODEPAGE=AUTO in your CONFIG.FPW file and restart Visual FoxPro.
1918	File name is too long.
1923	Object "name" is not found.
1924	"name" is not an object.
1925	Unknown member "name".
1926	Cannot nest class definitions.
1927	Statement is not valid in a class definition.
1928	Statement is only valid within a class definition.
1929	"name" can only be used within a method.
1930	Cannot redefine "name".
1931	Statement is not in a procedure.
1932	"name" cannot be closed while suspended.
1933	File "name" is not closed.
1934	Statement only valid within a method.
1935	The current object does not inherit from class "name".
1936	Application object not initialized.
1937	Procedure file "name" is not found.
1938	Object is not contained in a "name".
1939	WITH/ENDWITH mismatch.
1940	Expression is not valid outside of WITH/ENDWITH.
1941	Error code is not valid.
1942	Objects cannot be assigned to arrays.
1943	Member "name" does not evaluate to an object.
1944	Cannot find the builder program.
1945	The current object has been released.
1946	Project file "name" is in the wrong version.
1947	Expression is too complex.
1948	Cannot modify a class that is in use.
1949	Class name is invalid.
1950	Class definition "name" is recursive.
1951	Cannot clear the object in use.
1952	Cannot base a view on itself.
1953	Feature is only available if the object is in design mode.
1954	The builder program is already running.
1955	WIN.INI/registry is corrupted.
1956	Printer access denied.
1957	Error accessing printer spooler.
1958	Error loading printer driver.
1959	Invalid coordinates.
1960	Illegal redefinition of variable "name".
1961	A subdirectory or file "name" already exists.
1962	The directory is not empty.
1963	Directory is not found.
1964	No PageFrame or Page is found in FormSet or Form with WindowType set to READ or READ MODAL.
1965	One of the members of this class is based on a nonvisual class.  Cannot write .VCX file.
1966	Data environment is already loaded.
1967	Data environment is already unloaded.
1968	One of the members of this Form or FormSet is based on a nonvisual class. Cannot write .SCX file.
1969	The clipboard contained one or more objects that could not be added to the container.  Those objects were not pasted.
1970	Cannot reopen project file "name".
1971	Cannot compile until the current COMPILE command has completed.
1972	Array "name" is in use.
1973	Error creating table:  "name".
1974	Arrays cannot be assigned to array elements.
1975	Member object "name" has not been instantiated.
1976	Cannot resolve backlink.
1977	Exclusive open required to update this file.  Please reopen.
1978	Cannot visually modify a class of this type.
1979	Cannot visually modify a class based on a nonvisual class.
1981	Compile error in file "name".
1982	The TO clause can only be used with modal Forms and FormSets.
1983	"name" objects cannot return a value.
1984	The fields in table ‘"name"’ did not match the entries in the database.
1985	Object already has a data environment; cannot use another one with the SaveAs method.
1986	GDI memory is low, close one or more windows and try again.
1987	Objects cannot be programmatically added to the Form Designer’s FormSet.
1988	Currency value is out of range.
1989	Objects cannot be programmatically deleted from the Form Designer.
1991	Form file "name" is from a previous version of FoxPro. It must be converted to the current format before it can be executed.
1993	Class library file "name" is not found.
1994	Include file "name" is not found.
1995	Error loading the data environment.  Table is in use.
1996	The validation rule for field "name" does not evaluate to a logical or NULL type.
1997	The default value for field "name" does not evaluate to the correct type for the field.
1998	The index expression for index "name" contains an invalid reference to a Memo, General, or Picture field.
1999	Function is not implemented.
2000

2000	Memory is low, so streaming output updating has been disabled.
2001	The name of the object file for "file" is already used by another program in the project.
2002	Cannot build a DLL without OLE public classes.
2003	OLE Changed Properties stream is the wrong version. Subclassed properties ignored.
2004	The table file "name" has moved.  Please validate database "name" and try again.
2005	Error with "name" - "property": "error".
2006	Cannot locate your Web browser.
2007	Invalid operation for offline view while offline.
2008	Invalid operation for offline view while being used online.
2009	Object is not an offline view.
2010	Offline views must be used exclusively when being used online.
2011	Invalid operation for offline view.
2012	Cannot call SetFocus from within a When, Valid, RangeHigh or RangeLow event.
2013	Cannot open persistent table buffer directly.
2014	Fields marked as update keys will be cleared.
2015	Offline view must be used online for this command
2016	Removing a class member is not allowed.
2017	Cannot reuse offline view in different mode.
2018	Reconnect of offline view failed.
2019	Cannot create offline view on a currently modified view.
2020	The class file associated with this field cannot be found - class association cleared.


Error Message Parameters

Using SYS(2018), you can return the file, field, or variable name as a parameter for the error messages listed here. Error messages that have optional error message parameters may not always return a parameter through SYS(2018).

"cursor" must be created with SELECT ... INTO TABLE.  (1815)

"field | variable" is not unique and must be qualified.  (1832)

"field" is not related to the current work area.  (1165)

"file" is not a Visual FoxPro .EXE file.  (1196)

"file" is not an object file.  (1309)

"name" band is too large to fit on page.  (1298)

"name" can only be used within a method.  (1929)

"name" cannot be closed while suspended.  (1932)

"name" internal consistency error.  (1462)

"name" is a method, event, or object.  (1737)

"name" is a read-only property.  (1740)

"name" is not a file variable.  (226)

"name" is not a variable.  (225)

"name" is not an array.  (232)

"name" is not an object.  (1924)

"name" objects cannot return a value.  (1983)

A subdirectory or file "name" already exists.  (1961)

Application file "file" is not closed.  (1178)

Array "name" is in use.  (1972)

Cannot add "name".  Class definition is cyclical.  (1741)

Cannot add this table: it belongs to database "name". (1537)

Cannot change property "name" in SetAll method.  (1758)

Cannot create file "file".  (102)

Cannot find entry point "name" in the DLL.  (1754)

Cannot find object "name" in the database.  (1562)

Cannot find view "name" in the current database.  (1563)

Cannot load 32-bit DLL "name".  (1753)

Cannot redefine "name".  (1930)

Cannot reopen project file "name".  (1970)

Class "name" already exists.  (1761)

Class "name" has not been registered.  (1434)

Class "name" is in use.  (1776)

Class "name" is in use by MODIFY CLASS. (1752)

Class "name" is not found in the class library.  (1576)

Class "name" is not found.  (1762)

Class definition "name" is not found.  (1733)

Class definition "name" is recursive.  (1950)

Class file "name" is invalid.  (1747)

Class file name for "name" is not valid.  (1746)

Class library file "name" is not found.  (1993)

Collating sequence "name" is not found.  (1915)

Compile error in file "name".  (1981)

Connection "name" is busy.  (1541)

Connectivity error: "name".  (1526)

Data session #number cannot be released with open transaction(s).  (1549)

Data session #number was forced to ROLLBACK all transactions to avoid deadlock.  (1599)

Database "alias" is not open.  (1534)

Database "name": File access denied.  (1569)

DataType property for field "name" is invalid.  (1544)

Error adding "name" to the object. Duplicate member/property name.  (1779)

Error creating table:  "name".  (1973)

Error instantiating cursor object.  Table "alias" cannot be opened.  Object will be ignored.  (1554)

Error loading file - record number n. "object" <or one of its members>. "Issue": "error". (1881)

Error with "name" - "property": "error". (2005)

Expression is invalid.  Use a valid expression  for "name" property.  (1759)

Fatal error expN reporting error expN.

Field "name" does not accept null values.  (1581)

Field "name" validation rule is violated.  (1582)

File "name" already exists as part of a database.  (1529)

File "name" is a database.  (1553)

File "name" is an invalid database.  (1551)

File "name" is not a database.  (1552)

File "name" is not closed.  (1933)

File "name" is not part of a database.  (1558)

File "name" is part of a database.  (1565)

File "name" is read-only. (1718)

File "name" is too large. (1190)

Form file "name" is from a previous version of FoxPro. It must be converted to the current format before it is executed.  (1991)

Form file "name" is invalid.  (1686)

Illegal redefinition of variable "name".  (1960)

Include file "name" is not found.  (1994)

Invalid file format.  If this is a dBASE file, it must be converted first.  To convert it, type MODIFY LABEL labelfilename.  (1510)

Invalid update column name "name".  (1479)

Key label "label" is invalid.  (1255)

Library file "name" is invalid.  (1691)

Member "name" does not evaluate to an object.  (1943)

Member "name" is a class member.  (1760)

Member object "name" has not been instantiated.  (1975)

Memo file "name" is missing or is invalid.  (41)

No key columns specified for the update table \"name"\.  Use the \"KeyFieldList\" property of the Cursor object.  (1492)

Object "name" is not found.  (1766)

Object "name" is not found.  (1923)

Object file "file" was compiled in a previous version of FoxPro.  (1195)

Object file "name" is in use and cannot be removed from memory.  (1719)

Object is not contained in a "name".  (1938)

ODBC entry point missing, "name".  (1528)

"OLE error".  (1429)

OLE error code 0x"name".  (1426)

OLE IDispatch exception code "name".  (1427)

OLE IDispatch exception code "number" from "name": "name".  (1428)

Parent object will not allow this property setting for "name".  (1767)

Popup too big, first expN entries shown.

Procedure "procedure" is not found.  (1162)

Procedure file "name" is not found.  (1937)

Project file "name" is in the wrong version.  (1946)

Property "name" already exists.  (1763)

Property "name" is not a method or event.  (1738)

Property "name" is not found.  (1734)

Property "name" is protected.  (1757)

Property "name" is read-only.  (1743)

Queue "queue" is not found.  (1716)

Report file "name" is invalid. (50)

Server "server" is not found.  (1715)

SQL parameter "name" is invalid.  (1499)

SQL: Column "field | variable" is not found.  (1806)

Table "alias" has one or more non-structural indexes open.  Please close them and retry the Begin Transaction.  (1548)

Table "name" already exists in the database.  (1564)

Table "name" is referenced in a relation.  (1577)

Table buffer for alias "name" contains uncommitted changes.  (1545)

The current object does not inherit from class "name".  (1935)

The default value for field "name" does not evaluate to the correct type for the field.  (1997)

The fields in table "name" did not match the entries in the database.  (1984)

The index expression for index "name" contains an invalid reference to a Memo, General, or Picture field.  (1998)

The name "name" is already used for another object.  Please choose a different name.  (1571)

The name of the object file for "file" is already used by another program in the project. (2001)

The table changes cannot be performed as the index or filter expression for index name would be invalid.  (1531)

The validation rule for field "name" does not evaluate to a logical or NULL type.  (1996)

There is not enough disk space for "name".  (56)

Type conversion required by the DataType property for field "name" is invalid.  (1543)

Uniqueness of index "name" is violated.  (1884)

Unknown error code expN.

Unknown member "name".  (1925)

Variable "variable" is not found.  (12)

Warning:  Invalid data conversion(s) starting at record "number".  (1485)

Warning:  Invalid memo field conversion(s) starting at record "number".  (1486)

Warning:  The key defined by the KeyField property for table "alias" is not unique.  (1495)

Warning:  The next "string" modified records have already been updated remote.  (1484)

Window "name" has not been defined. (1714)

Worksheet "name" is not found.  (1775)


Help Contents: Interface Reference
Dialog Boxes

A

About Microsoft Visual FoxPro Dialog Box

Add Files to Source Control Dialog Box

Add Table Or View Dialog Box

Advanced Options Dialog Box

Append From Dialog Box

Append From Options Dialog Box

Arrange Tables and Views Dialog Box

B

Breakpoints Dialog Box

Browse Window

Build Options Dialog Box

C

Calculate Field Dialog Box

Check In Files Dialog Box

Check Out Files Dialog Box

Choose Field/Variable Dialog Box

Class Info Dialog Box

Code Page Dialog Box

Code Window

Column Footer Dialog Box

Column Header Dialog Box

Comment Dialog Box

Command Window

Compile Dialog Box

Converter Dialog Box

Coverage Dialog Box

Create Dialog Box

Customize Toolbar Dialog Box

D

Data Grouping Dialog Box

Database Properties Dialog Box

Data Session Window

Debugger Window

Delete (Records) Dialog Box

Description Dialog Box

Detail Dialog Box

Do Dialog Box

E

Edit Links Dialog Box

Edit Relationship Dialog Box

Edit Property/Method Dialog Box

Edit Properties Dialog Box

Editing Window

Event Tracking Dialog Box

Execution Throttle Dialog Box

Export Dialog Box

Export Options Dialog Box

Expression Builder

Expression Builder Options Dialog Box

F

Field Picker Dialog Box

Find Dialog Box

Find Table or View Dialog Box

Font Dialog Box

Form Template Dialog Box

Format (Field) Dialog Box

Form Set Template Dialog Box

G

General Field Window

General Options Dialog Box

Generate Menu Dialog Box

Get Latest Version of Files Dialog Box

Go To Line Dialog Box

Go To Record Dialog Box

Group Footer Dialog Box

Group Header Dialog Box

H

Having Dialog Box

I

Import Dialog Box

Include File Dialog Box

Insert Object Dialog Box

Insert Object Reference Dialog Box

Insert System Menu Bar Dialog Box

J

Join Condition Dialog Box

K

L

Locate Record Dialog Box

M

Macros Dialog Box

Menu Options Dialog Box

More Windows Dialog Box

N

New Dialog Box

New Class Dialog Box

New <File> Dialog Box

New Label Dialog Box

New Local View Dialog Box

New Macro Dialog Box

New Method Dialog Box

New Property Dialog Box

New Remote View Dialog Box

New Table Dialog Box

O

Open Dialog Box

Options Dialog Box

Overwrite Macro Dialog Box

P

Page Footer Dialog Box

Page Header Dialog Box

Page Setup Dialog Box

Paste Special Dialog Box

Print Dialog Box

Print File Dialog Box

Print When Dialog Box

Procedures and Functions Dialog Box

Project Information Dialog Box

Project Manager Window

Prompt Options Dialog Box

Properties Window

Q

Query Destination Dialog Box

Quick Report Dialog Box

R

Recall Records Dialog Box

Rectangle/Line Dialog Box

Replace Field Dialog Box

Remove Files from Source Control Dialog Box

Rename Files Dialog Box

Replace Dialog Box

Report Expression Dialog Box

Report Picture Dialog Box

Report Variables Dialog Box

Round Rectangle Dialog Box

S

Save As Dialog Box

Save As Class Dialog Box

Scope Dialog Box

Select Connection Or Data Source Dialog Box

Select Directory Dialog Box

Set Grid Scale Dialog Box

Set Index Order Dialog Box

Spelling Dialog Box

Spelling Options Dialog Box

Stop Recording Macro Dialog Box

Summary Dialog Box

T

Tab Order Dialog Box

Title Dialog Box

Title/Summary Dialog Box

Toolbars Dialog Box

Trace Window

U

Undo Check Out of Files Dialog Box

Update Project List Dialog Box

V

View Field Properties Dialog Box

View Parameters Dialog Box

W

Wizard Selection Dialog Box

Work Area Properties Dialog Box

X

Y

Z

Zoom <property>


Language Reference A-Z

Symbols

#DEFINE ... #UNDEF Preprocessor Directive

#IF ... #ENDIF Preprocessor Directive

#IFDEF | #IFNDEF ... #ENDIF Preprocessor Directive

#INCLUDE Preprocessor Directive

:: Scope Resolution Operator

! Command

$ Operator

% Operator

& Command

&& Command

* Command

= Command

\ | \\ Command

? | ?? Command

??? Command

@ ... BOX Command

@ ... CLASS Command

@ ... CLEAR Command

@ ... EDIT - Edit Boxes Command

@ ... FILL Command

@ ... GET - Check Boxes Command

@ ... GET - Combo Boxes Command

@ ... GET - Command Buttons Command

@ ... GET - List Boxes Command

@ ... GET - Option Buttons Command

@ ... GET - Spinners Command

@ ... GET - Text Boxes Command

@ ... GET - Transparent Buttons Command

@ ... MENU Command

@ ... PROMPT Command

@ ... SAY Command

@ ... SAY - Pictures & OLE Objects Command

@ ... SCROLL Command

@ ... TO Command

A

ABS( ) Function

ACCEPT Command

ACLASS( ) Function

ACOPY( ) Function

ACOS( ) Function

Activate Event

ACTIVATE MENU Command

ACTIVATE POPUP Command

ACTIVATE SCREEN Command

ACTIVATE WINDOW Command

ActivateCell Method

ActiveColumn Property

ActiveControl Property

ActiveForm Property

ActivePage Property

ActiveRow Property

ADATABASES( ) Function

ADBOBJECTS( ) Function

ADD CLASS Command

ADD TABLE Command

AddColumn Method

AddItem Method

AddListItem Method

AddObject Method

ADEL( ) Function

ADIR( ) Function

AELEMENT( ) Function

AERROR( ) Function

AFIELDS( ) Function

AFONT( ) Function

AfterCloseTables Event

AfterDock Event

AfterRowColChange Event

AINS( ) Function

AINSTANCE( ) Function

ALEN( ) Function

Alias Property

ALIAS( ) Function

Align Property

Alignment Property

_ALIGNMENT System Variable

AllowAddNew Property

AllowHeaderSizing Property

AllowRowSizing Property

AllowTabs Property

ALLTRIM( ) Function

ALTER TABLE - SQL Command

AlwaysOnTop Property

AMEMBERS( ) Function

ANSITOOEM( ) Function

APPEND Command

APPEND FROM Command

APPEND FROM ARRAY Command

APPEND GENERAL Command

APPEND MEMO Command

APPEND PROCEDURES Command

Application Object

Application Property

APRINTERS( ) Function

ASC( ) Function

ASCAN( ) Function

_ASCIICOLS System Variable

_ASCIIROWS System Variable

ASELOBJ( ) Function

ASIN( ) Function

ASORT( ) Function

ASSIST Command

_ASSIST System Variable

ASSERT Command

ASUBSCRIPT( ) Function

AT( ) Function

AT_C( ) Function

ATAN( ) Function

ATC( ) Function

ATCC( ) Function

ATCLINE( ) Function

ATLINE( ) Function

ATN2( ) Function

AUSED( ) Function

AutoActivate Property

AutoCenter Property

AutoCloseTables Property

AutoOpenTables Property

AutoRelease Property

AutoSize Property

AutoVerbMenu Property

AutoYield Property

AVERAGE Command

B

BackColor, ForeColor Properties

BackStyle Property

BAR( ) Function

BARCOUNT( ) Function

BARPROMPT( ) Function

BaseClass Property

_BEAUTIFY System Variable

BeforeDock Event

BeforeOpenTables Event

BeforeRowColChange Event

BEGIN TRANSACTION Command

BETWEEN( ) Function

BINTOC( ) Function

BITAND( ) Function

BITCLEAR( ) Function

BITLSHIFT( ) Function

BITNOT( ) Function

BITOR( ) Function

BITRSHIFT( ) Function

BITSET( ) Function

BITTEST( ) Function

BITXOR( ) Function

BLANK Command

BOF( ) Function

BorderColor Property

BorderStyle Property

BorderWidth Property

Bound Property

BoundColumn Property

BoundTo Property

Box Method

_BOX System Variable

BROWSE Command

_BROWSER System Variable

BufferMode Property

BufferModeOverride Property

BUILD APP Command

BUILD DLL Command

BUILD EXE Command

BUILD PROJECT Command

_BUILDER System Variable

ButtonCount Property

Buttons Property

C

_CALCMEM System Variable

CALCULATE Command

_CALCVALUE System Variable

CALL Command

CANCEL Command

Cancel Property

CANDIDATE( ) Function

CAPSLOCK( ) Function

Caption Property

CD | CHDIR Command

CDOW( ) Function

CDX( ) Function

CEILING( ) Function

Century Property

CHANGE Command

CheckBox Control

ChildAlias Property

ChildOrder Property

CHR( ) Function

CHRSAW( ) Function

CHRTRAN( ) Function

CHRTRANC( ) Function

Circle Method

Class Property

ClassLibrary Property

CLEAR Commands

CLEAR EVENTS Command

Clear Method

CLEAR RESOURCES Command

Click Event

ClipControls Property

_CLIPTEXT System Variable

CloneObject Method

ClosableProperty

CLOSE Commands

CLOSE DATABASES Command

CLOSE MEMO Command

CLOSE TABLES Command

CloseTables Method

Cls Method

CMONTH( ) Function

CNTBAR( ) Function

CNTPAD( ) Function

COL( ) Function

ColorScheme Property

ColorSource Property

Column Object

ColumnCount Property

ColumnLines Property

ColumnOrder Property

Columns Property

ColumnWidths Property

ComboBox Control

CommandButton Control

CommandGroup Control

Comment Property

COMPILE Command

COMPILE DATABASE Command

COMPILE FORM Command

COMPOBJ( ) Function

Container Object

CONTINUE Command

Control Object

ControlBox Property

ControlCount Property

Controls Property

ControlSource Property

_CONVERTER System Variable

COPY FILE Command

COPY INDEXES Command

COPY MEMO Command

COPY PROCEDURES Command

COPY STRUCTURE Command

COPY STRUCTURE EXTENDED Command

COPY TAG Command

COPY TO Command

COPY TO ARRAY Command

COS( ) Function

COUNT Command

_COVERAGE System Variable

CPCONVERT( ) Function

CPCURRENT( ) Function

CPDBF( ) Function

CREATE Command

CREATE CLASS Command

CREATE CLASSLIB Command

CREATE COLOR SET Command

CREATE CONNECTION Command

CREATE CURSOR - SQL Command

CREATE DATABASE Command

CREATE FORM Command

CREATE FROM Command

CREATE LABEL Command

CREATE MENU Command

CREATE PROJECT Command

CREATE QUERY Command

CREATE REPORT Command

CREATE REPORT - Quick Report Command

CREATE SCREEN Command

CREATE SCREEN - Quick Screen Command

CREATE SQL VIEW Command

CREATE TABLE - SQL Command

CREATE TRIGGER Command

CREATE VIEW Command

CREATEBINARY( ) Function

CREATEOBJECT( ) Function

CREATEOFFLINE( ) Function

CTOBIN( ) Function

CTOD( ) Function

CTOT( ) Function

CURDIR( ) Function

_CUROBJ System Variable

CurrentControl Property

CurrentX, Current Y Properties

Cursor Object

CURSORGETPROP( ) Function

CURSORSETPROP( ) Function

CursorSource Property

CURVAL( ) Function

Curvature Property

Custom Object

D

Database Property

DataEnvironment Object

DataToClip Method

DataSession Property

DataSessionID Property

DATE( ) Function

DateFormat Property

DateMark Property

DATETIME( ) Function

DAY( ) Function

DBC( ) Function

DBF( ) Function

DBGETPROP( ) Function

DblClick Event

_DBLCLICK System Variable

DBSETPROP( ) Function

DBUSED( ) Function

DDE Functions

DDEAbortTrans( ) Function

DDEAdvise( ) Function

DDEEnabled( ) Function

DDEExecute( ) Function

DDEInitiate( ) Function

DDELastError( ) Function

DDEPoke( ) Function

DDERequest( ) Function

DDESetOption( ) Function

DDESetService( ) Function

DDESetTopic( ) Function

DDETerminate( ) Function

Deactivate Event

DEACTIVATE MENU Command

DEACTIVATE POPUP Command

DEACTIVATE WINDOW Command

DEBUG Command

DEBUGOUT Command

DECLARE Command

DECLARE - DLL Command

Default Property

DefaultFilePath Property

DEFINE BAR Command

DEFINE BOX Command

DEFINE CLASS Command

DEFINE MENU Command

DEFINE PAD Command

DEFINE POPUP Command

DEFINE WINDOW Command

DefOLELCID Property

DELETE Command

DELETE - SQL Command

DELETE CONNECTION Command

DELETE DATABASE Command

DELETE FILE Command

DELETE TAG Command

DELETE TRIGGER Command

DELETE VIEW Command

DeleteColumn Method

Deleted Event

DELETED( ) Function

DeleteMark Property

DESCENDING( ) Function

Desktop Property

Destroy Event

_DIARYDATE System Variable

DIFFERENCE( ) Function

DIMENSION Command

DIR or DIRECTORY Command

DIRECTORY( ) Function

DisabledBackColor, DisabledForeColor Properties

DisabledItemBackColor, DisabledItemForeColor Properties

DisabledPicture Property

DISKSPACE( ) Function

DISPLAY Command

DISPLAY CONNECTIONS Command

DISPLAY DATABASE Command

DISPLAY DLLS

DISPLAY FILES Command

DISPLAY MEMORY Command

DISPLAY OBJECTS Command

DISPLAY PROCEDURES Command

DISPLAY STATUS Command

DISPLAY STRUCTURE Command

DISPLAY TABLES Command

DISPLAY VIEWS Command

DisplayValue Property

DMY( ) Function

DO Command

DO CASE ... ENDCASE Command

DO FORM Command

DO WHILE ... ENDDO Command

Dock Method

Docked Property

DockPosition Property

DoCmd Method

DocumentFile Property

DODEFAULT( ) Function

DOEVENTS Command

_DOS System Variable

DoScroll Method

DoVerb Method

DOW( ) Function

DownClick Event

DownPicture Property

Drag Method

DragDrop Event

DragIcon Property

DragMode Property

DragOver Event

Draw Method

DrawMode Property

DrawStyle Property

DrawWidth Property

DROP TABLE Command

DROP VIEW Command

DropDown Event

DROPOFFLINE( ) Function

DTOC( ) Function

DTOR( ) Function

DTOS( ) Function

DTOT( ) Function

DynamicAlignment Property

DynamicBackColor, DynamicForeColor Properties

DynamicCurrentControl Property

DynamicFontBold, DynamicFontItalic, DynamicFontStrikethru, DynamicFontUnderline Properties

DynamicFontName Property

DynamicFontOutline Property

DynamicFontShadow Property

DynamicFontSize Property

DynamicInputMask Property

E

EDIT Command

EditBox Control

EJECT Command

EJECT PAGE Command

EMPTY( ) Function

Enabled Property

END TRANSACTION Command

EOF( ) Function

ERASE Command

ERROR Command

Error Event

ERROR( ) Function

ErrorMessage Event

Eval Method

EVALUATE( ) Function

Exclusive Property

EXIT Command

EXP( ) Function

EXPORT Command

EXTERNAL Command

F

FCHSIZE( ) Function

FCLOSE( ) Function

FCOUNT( ) Function

FCREATE( ) Function

FDATE( ) Function

FEOF( ) Function

FERROR( ) Function

FFLUSH( ) Function

FGETS( ) Function

FIELD( ) Function

FILE( ) Function

FillColor Property

FillStyle Property

Filter Property

FILTER( ) Function

FIND Command

FirstElement Property

FKLABEL( ) Function

FKMAX( ) Function

FLDLIST( ) Function

FLOCK( ) Function

FLOOR( ) Function

FLUSH Command

FontBold, FontItalic, FontStrikethru, FontUnderline Properties

FontCondense, FontExtend Properties

FONTMETRIC( ) Function

FontName Property

FontOutline Property

FontShadow Property

FontSize Property

FOPEN( ) Function

FOR EACH ... ENDFOR Command

FOR ... ENDFOR Command

FOR( ) Function

Form Object

Format Property

FormCount Property

Forms Property

FormSet Object

FOUND( ) Function

_FOXDOC System Variable

FPUTS( ) Function

FREAD( ) Function

FREE TABLE Command

FSEEK( ) Function

FSIZE( ) Function

FTIME( ) Function

FullName Property

FULLPATH( ) Function

FUNCTION Command

FV( ) Function

FWRITE( ) Function

G

GATHER Command

_GENGRAPH System Variable

_GENMENU System Variable

_GENPD System Variable

_GENSCRN System Variable

_GENXTAB System Variable

GETBAR( ) Function

GETCOLOR( ) Function

GETCP( ) Function

GETDIR( ) Function

GETENV( ) Function

GETEXPR Command

GETFILE( ) Function

GETFLDSTATE( ) Function

GETFONT( ) Function

GETNEXTMODIFIED( ) Function

GETOBJECT( ) Function

GETPAD( ) Function

GETPEM( ) Function

GETPICT( ) Function

GETPRINTER( ) Function

GO | GOTO Command

GOMONTH( ) Function

GotFocus Event

Grid Control

GridLineColor Property

GridLines Property

GridLineWidth Property

H

HalfHeightCaption Property

Header Object

HEADER( ) Function

HeaderHeight Property

Height Property

HELP Command

Help Method

HelpContextID Property

HIDE MENU Command

Hide Method

HIDE POPUP Command

HIDE WINDOW Command

HideSelection Property

Highlight Property

HighlightRow Property

HOME( ) Function

HostName Property

HOUR( ) Function

Hours Property

I

Icon Property

IDXCOLLATE( ) Function

IF ... ENDIF Command

IIF( ) Function

Image Control

IMEMode Property

IMESTATUS( ) Function

IMPORT Command

Increment Property

IncrementalSearch Property

INDBC( ) Function

_INDENT System Variable

INDEX Command

IndexToItemID Method

Init Event

InitialSelectedAlias Property

INKEY( ) Function

INLIST( ) Function

INPUT Command

InputMask Property

INSERT Command

INSERT - SQL Command

INSMODE( ) Function

INT( ) Function

IntegralHeight Property

InteractiveChange Event

Interval Property

ISALPHA( ) Function

ISBLANK( ) Function

ISCOLOR( ) Function

ISDIGIT( ) Function

ISEXCLUSIVE( ) Function

ISFLOCKED( ) Function

ISLEADBYTE( ) Function

ISLOWER( ) Function

ISMOUSE( ) Function

ISNULL( ) Function

ISREADONLY( ) Function

ISRLOCKED( ) Function

ISUPPER( ) Function

ItemBackColor, ItemForeColor Properties

ItemData Property

ItemIDData Property

ItemIDToIndex Method

ItemTips Property

J

JOIN Command

K

KEY( ) Function

KEYBOARD Command

KeyboardHighValue, KeyboardLowValue Properties

KEYMATCH( ) Function

KeyPress Event

KeyPreview Property

L

LABEL Command

Label Control

LASTKEY( ) Function

Left Property

LEFT( ) Function

LEFTC( ) Function

LeftColumn Property

LEN( ) Function

LENC( ) Function

LIKE( ) Function

LIKEC( ) Function

Line Control

Line Method

LINENO( ) Function

LineSlant Property

LinkMaster Property

LIST Commands

LIST CONNECTIONS Command

LIST DATABASE Command

LIST DLLS

LIST OBJECTS Command

LIST PROCEDURES

List Property

LIST TABLES Command

LIST VIEWS Command

ListBox Control

ListCount Property

ListIndex Property

ListItem Property

ListItemID Property

_LMARGIN System Variable

LOAD Command

Load Event

LOADPICTURE( ) Function

LOCAL Command

LOCATE Command

LOCFILE( ) Function

LOCK( ) Function

LockScreen Property

LOG( ) Function

LOG10( ) Function

LOOKUP( ) Function

LostFocus Event

LOWER( ) Function

LPARAMETERS Command

LTRIM( ) Function

LUPDATE( ) Function

M

_MAC System Variable

Margin Property

MAX( ) Function

MaxButton Property

MaxHeight Property

MaxLeft Property

MaxLength Property

MaxTop Property

MaxWidth Property

MCOL( ) Function

MD | MKDIR Command

MDIForm Property

MDOWN( ) Function

MDX( ) Function

MDY( ) Function

MEMLINES( ) Function

MEMORY( ) Function

MemoWindow Property

MENU Command

MENU TO Command

MENU( ) Function

Message Event

MESSAGE( ) Function

MESSAGEBOX( ) Function

MiddleClick Event

MIN( ) Function

MinButton Property

MinHeight Property

MINUTE( ) Function

MinWidth Property

MLINE( ) Function

_MLINE System Variable

MOD( ) Function

MODIFY CLASS Command

MODIFY COMMAND Command

MODIFY CONNECTION Command

MODIFY DATABASE Command

MODIFY FILE Command

MODIFY FORM Command

MODIFY GENERAL Command

MODIFY LABEL Command

MODIFY MEMO Command

MODIFY MENU Command

MODIFY PROCEDURE Command

MODIFY PROJECT Command

MODIFY QUERY Command

MODIFY REPORT Command

MODIFY SCREEN Command

MODIFY STRUCTURE Command

MODIFY VIEW Command

MODIFY WINDOW Command

MONTH( ) Function

MOUSE Command

MouseDown Event

MouseMove Event

MouseIcon Property

MousePointer Property

MouseUp Event

MouseWheel Event

Movable Property

Move Method

MOVE POPUP Command

MOVE WINDOW Command

Moved Event

MoverBars Property

MRKBAR( ) Function

MRKPAD( ) Function

MROW( ) Function

MTON( ) Function

MultiSelect Property

MWINDOW( ) Function

N

Name Property

NDX( ) Function

NewIndex Property

NewItemID Property

NoDataOnLoad Property

NORMALIZE( ) Function

NOTE Command

NTOM( ) Function

NullDisplay Property

NumberOfElements Property

NUMLOCK( ) Function

NVL( ) Function

O

Object Property

Objects Collection

OBJNUM( ) Function

OBJTOCLIENT( ) Function

OBJVAR( ) Function

OCCURS( ) Function

OEMTOANSI( ) Function

OLDVAL( ) Function

OLE Bound Control

OLE Container Control

OLEClass Property

OLELCID Property

OLERequestPendingTimeout Property

OLEServerBusyRaiseError Property

OLEServerBusyTimeout Property

OLETypeAllowed Property

ON BAR Command

ON ERROR Command

ON ESCAPE Command

ON EXIT BAR Command

ON EXIT MENU Command

ON EXIT PAD Command

ON EXIT POPUP Command

ON KEY Command

ON KEY = Command

ON KEY LABEL Command

ON PAD Command

ON PAGE Command

ON READERROR Command

ON SELECTION BAR Command

ON SELECTION MENU Command

ON SELECTION PAD Command

ON SELECTION POPUP Command

ON SHUTDOWN Command

ON( ) Function

OneToMany Property

OPEN DATABASE Command

OpenTables Method

OpenViews Property

OpenWindow Property

OptionButton Control

OptionGroup Control

Order Property

ORDER( ) Function

OS( ) Function

P

PACK Command

PACK DATABASE Command

PAD( ) Function

PADL( ) | PADR( ) | PADC( ) Functions

_PADVANCE System Variable

Page Object

PageCount Property

PageFrame Control

PageHeight Property

_PAGENO System Variable

PageOrder Property

Pages Property

PageWidth Property

Paint Event

Panel Property

PanelLink Property

PARAMETERS Command

PARAMETERS( ) Function

Parent Object Reference

ParentAlias Property

ParentClass Property

Partition Property

PasswordChar Property

PAYMENT( ) Function

_PBPAGE System Variable

PCOL( ) Function

_PCOLNO System Variable

PCOUNT( )

_PCOPIES System Variable

_PDRIVER System Variable

_PDSETUP System Variable

_PECODE System Variable

_PEJECT System Variable

PEMSTATUS( ) Function

_PEPAGE System Variable

PI( ) Function

Picture Property

PLAY MACRO Command

_PLENGTH System Variable

_PLINENO System Variable

_PLOFFSET System Variable

Point Method

POP KEY Command

POP MENU Command

POP POPUP Command

POPUP( ) Function

_PPITCH System Variable

_PQUALITY System Variable

_PRETEXT System Variable

PRIMARY( ) Function

Print Method

PRINTJOB ... ENDPRINTJOB Command

PRINTSTATUS( ) Function

PRIVATE Command

PRMBAR( ) Function

PRMPAD( ) Function

PROCEDURE Command

PROGRAM( ) Function

ProgrammaticChange Event

PROMPT( ) Function

PROPER( ) Function

PROW( ) Function

PRTINFO( ) Function

_PSCODE System Variable

PSet Method

_PSPACING System Variable

PUBLIC Command

PUSH KEY Command

PUSH MENU Command

PUSH POPUP Command

PUTFILE( ) Function

PV( ) Function

_PWAIT System Variable

Q

QueryUnload Event

QUIT Command

Quit Method

R

RAND( ) Function

RangeHigh Event

RangeLow Event

RAT( ) Function

RATC( ) Function

RATLINE( ) Function

RD | RMDIR Command

RDLEVEL( ) Function

READ Command

READ EVENTS Command

READ MENU Command

ReadActivate Event

ReadBackColor Property

ReadCycle Property

ReadDeactivate Event

ReadExpression Method

ReadForeColor Property

READKEY( ) Function

ReadLock Property

ReadMethod Method

ReadMouse Property

ReadObject Property

ReadOnly Property

ReadSave Property

ReadShow Event

ReadTimeout Property

ReadValid Event

ReadWhen Event

RECALL Command

RECCOUNT( ) Function

RECNO( ) Function

RecordMark Property

RecordSource Property

RecordSourceType Property

RECSIZE( ) Function

Refresh Method

REFRESH( ) Function

REGIONAL Command

REINDEX Command

RELATION( ) Function

Relation Object

RelationalExpr Property

RelativeColumn Property

RelativeRow Property

RELEASE Command

RELEASE BAR Command

RELEASE CLASSLIB Command

RELEASE LIBRARY Command

RELEASE MENUS Command

Release Method

RELEASE PAD Command

RELEASE POPUPS Command

RELEASE PROCEDURE Command

RELEASE WINDOWS Command

ReleaseType Property

REMOVE CLASS Command

REMOVE TABLE Command

RemoveItem Method

RemoveListItem Method

RemoveObject Method

RENAME Command

RENAME CLASS Command

RENAME CONNECTION Command

RENAME TABLE Command

RENAME VIEW Command

REPLACE Command

REPLACE FROM ARRAY Command

REPLICATE( ) Function

REPORT Command

Requery Method

REQUERY( ) Function

RequestData Method

Reset Method

ResetToDefault Method

Resizable Property

Resize Event

RESTORE FROM Command

RESTORE MACROS Command

RESTORE SCREEN Command

RESTORE WINDOW Command

RESUME Command

RETRY Command

RETURN Command

RGB( ) Function

RGBSCHEME( ) Function

RIGHT( ) Function

RIGHTC( ) Function

RightClick Event

RightToLeft Property

RLOCK( ) Function

_RMARGIN System Variable

ROLLBACK Command

ROUND( ) Function

ROW( ) Function

RowHeight Property

RowSource Property

RowSourceType Property

RTOD( ) Function

RTRIM( ) Function

RUN Command

S

SAVE MACROS Command

SAVE SCREEN Command

SAVE TO Command

SAVE WINDOWS Command

SaveAs Method

SaveAsClass Method

SAVEPICTURE( ) Function

ScaleMode Property

SCAN ... ENDSCAN Command

SCATTER Command

_SCCTEXT System Variable

SCHEME( ) Function

SCOLS( ) Function

_SCREEN System Variable

SCROLL Command

ScrollBars Property

Scrolled Event

SEC( ) Function

SECONDS( ) Function

Seconds Property

SEEK Command

SEEK( ) Function

SELECT Command

SELECT - SQL Command

SELECT( ) Function

Selected Property

SelectedBackColor, SelectedForeColor Properties

SelectedID Property

SelectedItemBackColor, SelectedItemForeColor Properties

SelectOnEntry Property

SelLength Property

SelStart Property

SelText Property

Separator Object

SET Command

SET ALTERNATE Command

SET ANSI Command

SET ASSERTS Command

SET AUTOSAVE Command

SET BELL Command

SET BLOCKSIZE Command

SET BORDER Command

SET BRSTATUS Command

SET CARRY Command

SET CENTURY Command

SET CLASSLIB Command

SET CLEAR Command

SET CLOCK Command

SET COLLATE Command

SET COLOR OF Command

SET COLOR OF SCHEME Command

SET COLOR SET Command

SET COLOR TO Command

SET COMPATIBLE Command

SET CONFIRM Command

SET CONSOLE Command

SET COVERAGE Command

SET CPCOMPILE Command

SET CPDIALOG Command

SET CURRENCY Command

SET CURSOR Command

SET DATABASE Command

SET DATASESSION Command

SET DATE Command

SET DEBUG Command

SET DEBUGOUT

SET DECIMALS Command

SET DEFAULT Command

SET DELETED Command

SET DELIMITERS Command

SET DEVELOPMENT Command

SET DEVICE Command

SET DISPLAY Command

SET DOHISTORY Command

SET ECHO Command

SET ESCAPE Command

SET EVENTLIST

SET EVENTTRACKING Command

SET EXACT Command

SET EXCLUSIVE Command

SET FDOW Command

SET FIELDS Command

SET FILTER Command

SET FIXED Command

SET FORMAT Command

SET FULLPATH Command

SET FUNCTION Command

SET FWEEK Command

SET HEADINGS Command

SET HELP Command

SET HELPFILTER Command

SET HOURS Command

SET INDEX Command

SET INTENSITY Command

SET KEY Command

SET KEYCOMP Command

SET LIBRARY Command

SET LOCK Command

SET LOGERRORS Command

SET MACKEY Command

SET MARGIN Command

SET MARK OF Command

SET MARK TO Command

SET MEMOWIDTH Command

SET MESSAGE Command

SET MULTILOCKS Command

SET NEAR Command

SET NOCPTRANS Command

SET NOTIFY Command

SET NULL Command

SET NULLDISPLAY Command

SET ODOMETER Command

SET OLEOBJECT

SET OPTIMIZE Command

SET ORDER Command

SET PALETTE Command

SET PATH Command

SET PDSETUP Command

SET POINT Command

SET PRINTER Command

SET PROCEDURE Command

SET READBORDER Command

SET REFRESH Command

SET RELATION Command

SET RELATION OFF Command

SET REPROCESS Command

SET RESOURCE Command

SET SAFETY Command

SET SECONDS Command

SET SEPARATOR Command

SET SKIP Command

SET SKIP OF Command

SET SPACE Command

SET STATUS Command

SET STATUS BAR Command

SET STEP Command

SET SYSFORMATS Command

SET SYSMENU Command

SET TALK Command

SET TEXTMERGE Command

SET TEXTMERGE DELIMITERS Command

SET TOPIC Command

SET TOPIC ID Command

SET TRBETWEEN Command

SET TYPEAHEAD Command

SET UDFPARMS Command

SET UNIQUE Command

SET VIEW Command

SET WINDOW OF MEMO Command

SET( ) Function

SetAll Method

SETFLDSTATE( ) Function

SetFocus Method

SetVar Method

Shape Control

_SHELL System Variable

SHOW GET Command

SHOW GETS Command

SHOW MENU Command

Show Method

SHOW OBJECT Command

SHOW POPUP Command

SHOW WINDOW Command

ShowTips Property

ShowWhatsThis Method

ShowWindow Property

SIGN( ) Function

SIN( ) Function

Sizable Property

SizeBox Property

SIZE POPUP Command

SIZE WINDOW Command

SKIP Command

SKPBAR( ) Function

SKPPAD( ) Function

SORT Command

Sorted Property

SOUNDEX( ) Function

SPACE( ) Function

Sparse Property

SpecialEffect Property

_SPELLCHK System Variable

Spinner Control

SpinnerHighValue, SpinnerLowValue Properties

SplitBar Property

SQL Commands Overview

SQLCANCEL( ) Function

SQLCOLUMNS( ) Function

SQLCOMMIT( ) Function

SQLCONNECT( ) Function

SQLDISCONNECT( ) Function

SQLEXEC( ) Function

SQLGETPROP( ) Function

SQLMORERESULTS( ) Function

SQLPREPARE( ) Function

SQLROLLBACK( ) Function

SQLSETPROP( ) Function

SQLSTRINGCONNECT( ) Function

SQLTABLES( ) Function

SQRT( ) Function

SROWS( ) Function

_STARTUP System Variable

StartMode Property

StatusBar Property

StatusBarText Property

STORE Command

STR( ) Function

STRCONV( ) Function

Stretch Property

StrictDateEntry Property

STRTRAN( ) Function

STUFF( ) Function

STUFFC( ) Function

Style Property

SUBSTR( ) Function

SUBSTRC( ) Function

SUM Command

SUSPEND Command

SYS( ) Functions Overview

SYS(0) - Network Machine Information

SYS(1) - Julian System Date

SYS(2) - Seconds Since Midnight

SYS(3) - Legal File Name

SYS(5) - Default Drive or Volume

SYS(6) - Current Printer Device

SYS(7) - Current Format File

SYS(9) - Visual FoxPro Serial Number

SYS(10) - String from Julian Day Number

SYS(11) - Julian Day Number

SYS(12) - Available Memory in Bytes

SYS(13) - Printer Status

SYS(14) - Index Expression

SYS(15) - Character Translation

SYS(16) - Executing Program File Name

SYS(17) - Processor in Use

SYS(18) - Current Control

SYS(20) - Transform German Text

SYS(21) - Controlling Index Number

SYS(22) - Controlling Tag or Index Name

SYS(23) - Visual FoxPro EMS Memory Usage

SYS(24) - EMS Memory Limit

SYS(100) - Console Setting

SYS(101) - Device Setting

SYS(102) - Printer Setting

SYS(103) - Talk Setting

SYS(1001) - Visual FoxPro Memory

SYS(1016) - User Object Memory Use

SYS(1023) - Enable Help Diagnostic Mode

SYS(1024) - Disable Help Diagnostic Mode

SYS(1037) - Page Setup Dialog Box

SYS(1269) - Property Information

SYS(1270) - Object Location

SYS(1271) - Object's .SCX File

SYS(1272) - Object Hierarchy

SYS(1500) - Activate a System Menu Item

SYS(2000) - File Name Wildcard Match

SYS(2001) - SET ... Command Status

SYS(2002) - Turn Insertion Point On or Off

SYS(2003) - Current Directory or Folder

SYS(2004) - Visual FoxPro Start Directory

SYS(2005) - Current Resource File

SYS(2006) - Current Graphics Card

SYS(2007) - Check Sum Value

SYS(2010) - CONFIG.SYS File Settings

SYS(2011) - Current Lock Status

SYS(2012) - Memo Field Blocksize

SYS(2013) - System Menu Name String

SYS(2014) - Minimum Path

SYS(2015) - Unique Procedure Name

SYS(2016) - SHOW GETS WINDOW Name

SYS(2017) - Display Startup Screen

SYS(2018) - Error Message Parameter

SYS(2019) - Configuration File Name and Location

SYS(2020) Function - Default Disk Size

SYS(2021) - Filtered Index Expression

SYS(2022) - Disk Cluster (Block) Size

SYS(2023) - Temporary Path

SYS(2029) - Table Type

SYS(2333) - ActiveX Dual Interface Support

SYS(3004) - Return Locale ID

SYS(3005) - Set Locale ID

SYS(3006) - Set Language and Locale IDs

SYS(3050) - Set Buffer Memory Size

SYS(3051) - Set Lock Retry Interval

SYS(3052) - Override SET REPROCESS Locking

SYS(3053) - ODBC Environment Handle

SYS(3054) - Rushmore Optimization Level

SYSMETRIC( ) Function

System Variables Overview

System Menu Names

T

TabIndex Property

TABLEREVERT( ) Function

TABLEUPDATE( ) Function

Tabs Property

_TABS System Variable

TabStop Property

TabStretch Property

TabStyle Property

Tag Property

TAG( ) Function

TAGCOUNT( ) Function

TAGNO( ) Function

_TALLY System Variable

TAN( ) Function

TARGET( ) Function

TerminateRead Property

TEXT ... ENDTEXT Command

_TEXT System Variable

Text Property

TextBox Control

TextHeight Method

TextWidth Method

THIS Object Reference

THISFORM Object Reference

THISFORMSET Object Reference

_THROTTLE System Variable

TIME( ) Function

Timer Control

Timer Event

ToolBar Object

ToolTipText Property

Top Property

TopIndex Property

TopItemID Property

TOTAL Command

TRANSFORM( ) Function

_TRANSPORT System Variable

_TRIGGERLEVEL System Variable

TRIM( ) Function

TTOC( ) Function

TTOD( ) Function

TXNLEVEL( ) Function

TXTWIDTH( ) Function

TYPE Command

TYPE( ) Function

U

UIEnable Event

Undock Event

UNIQUE( ) Function

_UNIX System Variable

Unload Event

UNLOCK Command

UpClick Event

UPDATE - SQL Command

UPDATE Command

UPDATED( ) Function

UPPER( ) Function

USE Command

USED( ) Function

V

VAL( ) Function

Valid Event

VALIDATE DATABASE Command

Value Property

VARREAD( ) Function

Version Property

VERSION( ) Function

_VFP System Variable

View Property

Visible Property

W

WAIT Command

WBORDER( ) Function

WCHILD( ) Function

WCOLS( ) Function

WEEK( ) Function

WEXIST( ) Function

WFONT( ) Function

WhatsThisButton Property

WhatsThisHelp Property

WhatsThisHelpID Property

WhatsThisMode Method

When Event

Width Property

WindowList Property

WindowState Property

_WINDOWS System Variable

WindowType Property

WITH ... ENDWITH Command

_WIZARD System Variable

WLAST( ) Function

WLCOL( ) Function

WLROW( ) Function

WMAXIMUM( ) Function

WMINIMUM( ) Function

WONTOP( ) Function

WordWrap Property

WOUTPUT( ) Function

WPARENT( ) Function

_WRAP System Variable

WREAD( ) Function

WriteExpression Method

WriteMethod Method

WROWS( ) Function

WTITLE( ) Function

WVISIBLE( ) Function

X

Y

YEAR( ) Function

Z

ZAP Command

ZoomBox Property

ZOOM WINDOW Command

ZOrder Method


Classes and Objects

A

Application Object

B

C

CheckBox Control

Column Object

ComboBox Control

CommandButton Control

CommandGroup Control

Container Object

Control Object

Cursor Object

Custom Object

D

DataEnvironment Object

E

EditBox Control

F

Form Object

FormSet Object

G

Grid Control

H

Header Object

I

Image Control

J

K

L

Label Control

Line Control

ListBox Control

M

N

O

Objects Collection

OLE Bound Control

OLE Container Control

OptionButton Control

OptionGroup Control

P

Page Object

PageFrame Control

Q

R

Relation Object

S

Separator Object

Shape Control

Spinner Control

T

TextBox Control

THIS Object Reference

THISFORM Object Reference

THISFORMSET Object Reference

Timer Control

ToolBar Object

U

V

W

X

Y

Z


Properties

A

ActiveColumn Property

ActiveControl Property

ActiveForm Property

ActivePage Property

ActiveRow Property

Alias Property

Align Property

Alignment Property

AllowAddNew Property

AllowHeaderSizing Property

AllowRowSizing Property

AllowTabs Property

AlwaysOnTop Property

Application Property

AutoActivate Property

AutoCenter Property

AutoCloseTables Property

AutoOpenTables Property

AutoRelease Property

AutoSize Property

AutoVerbMenu Property

AutoYield Property

B

BackColor, ForeColor Properties

BackStyle Property

BaseClass Property

BorderColor Property

BorderStyle Property

BorderWidth Property

Bound Property

BoundColumn Property

BoundTo Property

BufferMode Property

BufferModeOverride Property

ButtonCount Property

Buttons Property

C

Cancel Property

Caption Property

Century Property

ChildAlias Property

ChildOrder Property

Class Property

ClassLibrary Property

ClipControls Property

ClosableProperty

ColorScheme Property

ColorSource Property

ColumnCount Property

ColumnLines Property

ColumnOrder Property

Columns Property

ColumnWidths Property

Comment Property

ControlBox Property

ControlCount Property

Controls Property

ControlSource Property

CurrentControl Property

CurrentX, Current Y Properties

CursorSource Property

Curvature Property

D

Database Property

DataSession Property

DataSessionID Property

DateFormat Property

DateMark Property

Default Property

DefaultFilePath Property

DefOLELCID Property

DeleteMark Property

Desktop Property

DisabledBackColor, DisabledForeColor Properties

DisabledItemBackColor, DisabledItemForeColor Properties

DisabledPicture Property

DisplayValue Property

Docked Property

DockPosition Property

DocumentFile Property

DownPicture Property

DragIcon Property

DragMode Property

DrawMode Property

DrawStyle Property

DrawWidth Property

DynamicAlignment Property

DynamicBackColor, DynamicForeColor Properties

DynamicCurrentControl Property

DynamicFontBold, DynamicFontItalic, DynamicFontStrikethru, DynamicFontUnderline Properties

DynamicFontName Property

DynamicFontOutline Property

DynamicFontShadow Property

DynamicFontSize Property

DynamicInputMask Property

E

Enabled Property

Exclusive Property

F

FillColor Property

FillStyle Property

Filter Property

FirstElement Property

FontBold, FontItalic, FontStrikethru, FontUnderline Properties

FontCondense, FontExtend Properties

FontName Property

FontOutline Property

FontShadow Property

FontSize Property

Format Property

FormCount Property

Forms Property

FullName Property

G

GridLineColor Property

GridLines Property

GridLineWidth Property

H

HalfHeightCaption Property

HeaderHeight Property

Height Property

HelpContextID Property

HideSelection Property

Highlight Property

HighlightRow Property

Hours Property

HostName Property

I

Icon Property

Increment Property

IncrementalSearch Property

InitialSelectedAlias Property

InputMask Property

IntegralHeight Property

Interval Property

IMEMode Property

ItemBackColor, ItemForeColor Properties

ItemData Property

ItemIDData Property

ItemTips Property

J

K

KeyboardHighValue, KeyboardLowValue Properties

KeyPreview Property

L

Left Property

LeftColumn Property

LineSlant Property

LinkMaster Property

List Property

ListCount Property

ListIndex Property

ListItem Property

ListItemID Property

LockScreen Property

M

Margin Property

MaxButton Property

MaxHeight Property

MaxLeft Property

MaxLength Property

MaxTop Property

MaxWidth Property

MDIForm Property

MemoWindow Property

MinButton Property

MinHeight Property

MinWidth Property

MouseIcon Property

MousePointer Property

Movable Property

MoverBars Property

MultiSelect Property

N

Name Property

NewIndex Property

NewItemID Property

NoDataOnLoad Property

NullDisplay Property

NumberOfElements Property

O

Object Property

OLEClass Property

OLELCID Property

OLERequestPendingTimeout Property

OLEServerBusyRaiseError Property

OLEServerBusyTimeout Property

OLETypeAllowed Property

OneToMany Property

OpenViews Property

OpenWindow Property

Order Property

P

PageCount Property

PageHeight Property

PageOrder Property

Pages Property

PageWidth Property

Panel Property

PanelLink Property

Parent Object Reference

ParentAlias Property

ParentClass Property

Partition Property

PasswordChar Property

Picture Property

Q

R

ReadCycle Property

ReadLock Property

ReadMouse Property

ReadObject Property

ReadOnly Property

ReadSave Property

ReadTimeout Property

RecordMark Property

RecordSource Property

RecordSourceType Property

RelationalExpr Property

RelativeColumn Property

RelativeRow Property

ReleaseType Property

Resizable Property

RightToLeft Property

RowHeight Property

RowSource Property

RowSourceType Property

S

ScaleMode Property

ScrollBars Property

Seconds Property

Selected Property

SelectedBackColor, SelectedForeColor Properties

SelectedID Property

SelectedItemBackColor, SelectedItemForeColor Properties

SelectOnEntry Property

SelLength Property

SelStart Property

SelText Property

ShowTips Property

ShowWindow Property

Sizable Property

SizeBox Property

Sorted Property

Sparse Property

SpecialEffect Property

SpinnerHighValue, SpinnerLowValue Properties

SplitBar Property

StartMode Property

StatusBar Property

StatusBarText Property

Stretch Property

StrictDateEntry Property

Style Property

T

TabIndex Property

Tabs Property

TabStop Property

TabStretch Property

TabStyle Property

Tag Property

TerminateRead Property

Text Property

ToolTipText Property

Top Property

TopIndex Property

TopItemID Property

U

V

Value Property

Version Property

View Property

Visible Property

W

WhatsThisButton Property

WhatsThisHelp Property

WhatsThisHelpID Property

WhatsThisMode Method

Width Property

WindowList Property

WindowState Property

WindowType Property

WordWrap Property

X

Y

Z

ZoomBox Property


Events

A

Activate Event

AfterCloseTables Event

AfterDock Event

AfterRowColChange Event

B

BeforeDock Event

BeforeOpenTables Event

BeforeRowColChange Event

C

Click Event

D

DblClick Event

Deactivate Event

Deleted Event

Destroy Event

DoCmd Method

DownClick Event

DragDrop Event

DragOver Event

DropDown Event

E

Error Event

ErrorMessage Event

F

G

GotFocus Event

H

I

Init Event

InteractiveChange Event

J

K

KeyPress Event

L

Load Event

LostFocus Event

M

Message Event

MiddleClick Event

MouseDown Event

MouseMove Event

MouseUp Event

MouseWheel Event

Moved Event

N

O

P

Paint Event

ProgrammaticChange Event

Q

QueryUnload Event

R

RangeHigh Event

RangeLow Event

ReadActivate Event

ReadDeactivate Event

ReadShow Event

ReadValid Event

ReadWhen Event

Resize Event

RightClick Event

S

Scrolled Event

T

Timer Event

U

UIEnable Event

Undock Event

Unload Event

UpClick Event

V

Valid Event

W

When Event

X

Y

Z


Methods

A

ActivateCell Method

AddColumn Method

AddItem Method

AddListItem Method

AddObject Method

B

Box Method

C

Circle Method

Clear Method

CloneObject Method

CloseTables Method

Cls Method

D

DataToClip Method

DeleteColumn Method

Dock Method

DoScroll Method

DoVerb Method

Drag Method

Draw Method

E

Eval Method

F

G

H

Help Method

Hide Method

I

IndexToItemID Method

ItemIDToIndex Method

J

K

L

Line Method

M

Move Method

N

O

P

Point Method

Print Method

PSet Method

Q

Quit Method

R

ReadExpression Method

ReadMethod Method

Refresh Method

Release Method

RemoveItem Method

RemoveListItem Method

RemoveObject Method

Requery Method

RequestData Method

Reset Method

ResetToDefault Method

S

SaveAs Method

SaveAsClass Method

SetAll Method

SetFocus Method

SetVar Method

Show Method

ShowWhatsThis Method

T

TextHeight Method

TextWidth Method

U

V

W

WriteExpression Method

WriteMethod Method

X

Y

Z

ZOrder Method


System_Variables
System Variables

A

_ALIGNMENT

_ASCIICOLS

_ASCIIROWS

_ASSIST

B

_BEAUTIFY

_BOX

_BROWSER

_BUILDER

C

_CALCMEM

_CALCVALUE

_CLIPTEXT

_CONVERTER

_COVERAGE

_CUROBJ

D

_DBLCLICK

_DIARYDATE

_DOS

E

F

_FOXDOC

G

_GENGRAPH

_GENMENU

_GENPD

_GENSCRN

_GENXTAB

H

I

_INDENT

J

K

L

_LMARGIN

M

_MAC

_MLINE

N

O

P

_PADVANCE

_PAGENO

_PBPAGE

_PCOLNO

_PCOPIES

_PDRIVER

_PDSETUP

_PECODE

_PEJECT

_PEPAGE

_PLENGTH

_PLINENO

_PLOFFSET

_PPITCH

_PQUALITY

_PRETEXT

_PSCODE

_PSPACING

_PWAIT

Q

R

_RMARGIN

S

_SCCTEXT

_SCREEN

_SHELL

_SPELLCHK

_STARTUP

T

_TABS

_TALLY

_TEXT

_THROTTLE

_TRANSPORT

_TRIGGERLEVEL

U

_UNIX

V

_VFP System Variable

W

_WINDOWS

_WIZARD

_WRAP

X

Y

Z


New Language Elements

The following language elements have been added for Visual FoxPro.

A

AllowAddNew Property

AllowHeaderSizing Property

AllowRowSizing Property

Application Object

Application Property

ASSERT Command

AutoVerbMenu Property

AutoYield Property

B

BINTOC( ) Function

BoundTo Property

BUILD DLL Command

C

Century Property

CLEAR RESOURCES Command

_COVERAGE System Variable

CREATEBINARY( ) Function

CREATEOFFLINE( ) Function

CTOBIN( ) Function

D

DataToClip Method

DateFormat Property

DateMark Property

DEBUG Command

DEBUGOUT Command

DefaultFilePath Property

DIRECTORY( ) Function

DoCmd Method

DODEFAULT( ) Function

DOEVENTS Command

DROP TABLE Command

DROP VIEW Command

DROPOFFLINE( ) Function

DynamicInputMask Property

E

Eval Method

F

FOR EACH ... ENDFOR Command

FullName Property

G

H

Help Method

HighlightRow Property

Hours Property

I

IMEMode Property

IntegralHeight Property

ISFLOCKED( ) Function

ISRLOCKED( ) Function

ItemTips Property

J

K

L

LOADPICTURE( ) Function

M

MiddleClick Event

MouseIcon Property

MouseWheel Event

N

NullDisplay Property

O

Objects Collection

OLERequestPendingTimeout Property

OLEServerBusyRaiseError Property

OLEServerBusyTimeout Property

OpenViews Property

P

Q

Quit Method

R

RequestData Method

RightToLeft Property

S

SAVEPICTURE( ) Function

_SCCTEXT System Variable

Seconds Property

SET ASSERTS Command

SET COVERAGE Command

SET DEBUGOUT

SET EVENTLIST

SET EVENTTRACKING Command

SET NULLDISPLAY Command

SetVar Method

ShowWhatsThis Method

ShowWindow Property

SplitBar Property

SQLPREPARE( ) Function

StartMode Property

StatusBar Property

StrictDateEntry Property

SYS(1500) - Activate a System Menu Item

SYS(2333) - ActiveX Dual Interface Support

SYS(3054) - Rushmore Optimization Level

T

TabStyle Property

Text Property

U

V

Version Property

_VFP System Variable

W

WhatsThisButton Property

WhatsThisHelp Property

WhatsThisHelpID Property

WhatsThisMode Method

X

Y

Z


Enhanced Language Elements

The following language elements have been enhanced for Visual FoxPro.

Null Values	Periods around the NULL keyword are no longer required.
APPEND FROM Command	New CHARACTER clause.
BorderStyle Property	Applies to ComboBox and Spinner Controls.
BUILD APP Command	New RECOMPILE option.
BUILD EXE Command	New RECOMPILE option.
CLOSE Command	New DEBUGGER option.
ColorSource Property	Applies to Forms, new 5 - Windows Control Panel option.
ComboBox Control	Supports BorderStyle, BoundTo, Format, and InputMask properties
COPY TO Command	New CHARACTER clause.
CREATE FROM Command	New DATABASE and NAME clauses.
CURSORGETPROP( ) Function	New CompareMemo and Prepared options.
CURSORSETPROP( ) Function	New CompareMemo and Prepared options.
DBGETPROP( ) Function	New CompareMemo, DisplayClass, DisplayClassLibrary, Offline, and Prepared options.
DBSETPROP( ) Function	New CompareMemo, Offline, and Prepared options.
DEFINE CLASS Command	New HIDDEN and OLEPUBLIC clauses.
DISKSPACE( ) Function	Supports optional volume name.
Format Property	Applies to ComboBox Control, new YS and YL codes.
IMPORT Command	New DATABASE and NAME clauses.
InputMask Property	Applies to ComboBox Control.
ListBox Control	Supports BoundTo, ItemTips, and ShowInTaskBar properties.
MCOL( ) Function	New scalemode option.
MD | MKDIR Command	Can now create an entire path.
MROW( ) Function	New scalemode option.
REPORT Command	New WINDOW clause.
SELECT - SQL Command	New DATABASE, FORCE, JOIN, NAME, and TOP clauses.
SET CLASSLIB Command	New IN clause.
SET DATE Command	New SHORT, LONG, and TAIWAN clauses.
SET HOURS Command	Now scoped to data session.
SET SECONDS Command	Now scoped to data session.
SET SYSFORMATS Command	Uses SET DATE SHORT format.
SET("DATE") Function	New 1 argument.
SET("PRINTER") Function	New 2 argument.
SORT Command	New DATABASE and NAME clauses.
Spinner Control	Supports BorderStyle property.
TOTAL Command	New DATABASE and NAME clauses.
TTOC( ) Function	New 2 argument.
USE Command	New ADMIN and ONLINE clauses.


Backward-Compatible Language Elements

The following language elements are included for backward compatibility with previous versions of FoxPro.

@ ... BOX Command

@ ... EDIT - Edit Boxes Command

@ ... GET - Command Buttons Command

@ ... GET - Check Boxes Command

@ ... GET - Combo Boxes Command

@ ... GET - List Boxes Command

@ ... GET - Option Buttons Command

@ ... GET - Spinners Command

@ ... GET - Text Boxes Command

@ ... GET - Transparent Buttons Command

@ ... MENU Command

@ ... PROMPT Command

@ ... SAY Command

@ ... SAY - Pictures & OLE Objects Command

@ ... TO Command

_ALIGNMENT System Memory Variable

_ASSIST System Memory Variable

_BEAUTIFY System Memory Variable

_BOX System Memory Variable

_CUROBJ System Memory Variable

_FOXDOC System Memory Variable

_GENGRAPH System Memory Variable

_GENPD System Memory Variable

_GENSCRN System Memory Variable

_GENXTAB System Memory Variable

_INDENT System Memory Variable

_LMARGIN System Memory Variable

_PADVANCE System Memory Variable

_PBPAGE System Memory Variable

_PCOLNO System Memory Variable

_PCOPIES System Memory Variable

_PDRIVER System Memory Variable

_PDSETUP System Memory Variable

_PECODE System Memory Variable

_PEJECT System Memory Variable

_PEPAGE System Memory Variable

_PLENGTH System Memory Variable

_PLINENO System Memory Variable

_PLOFFSET System Memory Variable

_PPITCH System Memory Variable

_PQUALITY System Memory Variable

_PSCODE System Memory Variable

_PSPACING System Memory Variable

_PWAIT System Memory Variable

_RMARGIN System Memory Variable

_STARTUP System Memory Variable

_TABS System Memory Variable

_TRANSPORT System Memory Variable

_WRAP System Memory Variable

ACCEPT Command

ANSITOOEM( ) Function

ASSIST Command

CALL Command

CLEAR READ Command

COL( ) Function

ColorScheme Property

CREATE SCREEN Command

CREATE SCREEN - Quick Screen Command

DEFINE BOX Command

ErrorMessage Event

FIND Command

INPUT Command

INSERT Command

JOIN Command

LOAD Command

MDIForm Property

MDOWN( ) Function

MENU Command

MENU TO Command

MemoWindow Property

Message Event

MODIFY SCREEN Command

OBJNUM( ) Function

OBJVAR( ) Function

OEMTOANSI( ) Function

ON KEY Command

ON KEY = Command

ON READERROR Command

RDLEVEL( ) Function

READ Command

READ MENU Command

ReadActivate Event

ReadBackColor Property

ReadCycle Property

ReadDeactivate Event

ReadForeColor Property

READKEY( ) Function

ReadLock Property

ReadMouse Property

ReadObject Property

ReadSave Property

ReadShow Event

ReadTimeout Property

ReadValid Event

ReadWhen Event

ROW( ) Function

SET BORDER Command

SET BRSTATUS Command

SET CLEAR Command

SET COLOR OF Command

SET COLOR TO Command

SET DELIMITERS Command

SET DOHISTORY Command

SET FORMAT Command

SET INTENSITY Command

SET STATUS Command

SET STATUS BAR Command

SET WINDOW OF MEMO Command

SHOW GET Command

SHOW GETS Command

SHOW OBJECT Command

SYS(15) - Character Translation

SYS(18) - Current Control

SYS(20) - Transform German Text

SYS(2016) - SHOW GETS WINDOW Name

SYS(2017) - Display Startup Screen

UPDATE Command

UPDATED( ) Function

VARREAD( ) Function

WREAD( ) Function


Help Contents: Professional Reference
External Routines by Category

Debugging Routines

Environment Routines

Error Handling Routines

Event Handling Routines

File Input and Output Routines

Memory Management Routines

Variable and Array Routines

Memo Field Input and Output Routines

Menu Routines

Object Routines

Routines to Return Results to Visual FoxPro

Statement and Expression Routines

String Manipulation Routines

Table Input and Output Routines

Text Editor and Clipboard Manipulation Routines

Window Manipulation Routines


Help Contents: Professional Reference
External Routines A-Z

A

_ActivateHandler( )

_ActivateIdle( )

_ActivateMenu( )

_ALen( )

_Alloca( )

_AllocHand( )

_AllocMemo( )

B

_BreakPoint( )

C

_CountItems( )

D

_DBAppend( )

_DBLock( )

_DBRead( )

_DBRecCount( )

_DBRecNo( )

_DBReplace( )

_DBRewind( )

_DBSeek( )

_DBSkip( )

_DBStatus( )

_DBUnlock( )

_DBUnwind( )

_DBWrite( )

_DeActivateHandler( )

_DeActivateIdle( )

_DeActivateMenu( )

_DefaultProcess( )

_Dialog( )

_DisposeItem( )

_DisposeMenu( )

E

_EdActive( )

_EdCloseFile( )

_EdCopy( )

_EdCut( )

_EdDelete( )

_EdGetChar( )

_EdGetEnv( )

_EdGetLineNum( )

_EdGetLinePos( )

_EdGetPos( )

_EdGetStr( )

_EdIndent( )

_EdInsert( )

_EdLastError( )

_EdOpenFile( )

_EdPaste( )

_EdPosInView( )

_EdRedo( )

_EdRevert( )

_EdSave( )

_EdScrollToPos( )

_EdScrollToSel( )

_EdSelect( )

_EdSendKey( )

_EdSetEnv( )

_EdSetPos( )

_EdSkipLines( )

_EdUndo( )

_EdUndoOn( )

_Error( )

_ErrorInfo( )

_Evaluate( )

_Execute( )

F

_FCHSize( )

_FClose( )

_FCopy( )

_FCreate( )

_FEOF( )

_FError( )

_FFlush( )

_FGets( )

_FindMemo( )

_FindVar( )

_FindWindow( )

_FindWindowP( )

_FOpen( )

_FPuts( )

_FRead( )

_FreeHand( )

_FreeObject( )

_FSeek( )

_FWrite( )

G

_GetAPIHandle( )

_GetHandSize( )

_GetItemCmdKey( )

_GetItemId( )

_GetItemSubMenu( )

_GetItemText( )

_GetNewItemId( )

_GetNewMenuId( )

_GetNextEvent( )

_GetObjectProperty( )

_GlobalToLocal( )

_GlobalToLocalP( )

H

_HandToPtr( )

_HLock( )

_HUnLock( )

I

_InKey( )

J

K

L

_Load( )

M

_MemAvail( )

_MemCmp( )

_MemFill( )

_MemMove( )

_MemoChan( )

_MemoSize( )

_MenuId( )

_MenuInteract( )

_MousePos( )

_MousePosP( )

N

_NameTableIndex( )

_NewItem( )

_NewMenu( )

_NewVar( )

O

_ObjectCmp( )

_ObjectReference( )

_ObjectRelease( )

_OnSelection( )

P

_PutChr( )

_PutStr( )

_PutValue( )

Q

R

_Release( )

_RetChar( )

_RetCurrency( )

_RetDateStr( )

_RetDateTimeStr( )

_RetFloat( )

_RetInt( )

_RetLogical( )

_RetVal( )

S

_SetHandSize( )

_SetItemCmdKey( )

_SetItemSubMenu( )

_SetItemText( )

_SetMenuPoint( )

_SetMenuPointP( )

_SetObjectProperty( )

_Store( )

_StrCmp( )

_StrCpy( )

_StrLen( )

T

U

_UserError( )

V

W

_WAttr( )

_WBottom( )

_WBottomP( )

_WClear( )

_WClearRect( )

_WClearRectP( )

_WClose( )

_WFindTitle( )

_WGetCursor( )

_WGetCursorP( )

_WGetObjectClientWindow( )

_WGetObjectWindow( )

_WGetPort( )

_WHeight( )

_WHeightP( )

_WHide( )

_WhToHwnd( )

_WLeft( )

_WLeftP( )

_WMainWindow( )

_WMove( )

_WMoveP( )

_WOnTop( )

_WOpen( )

_WOpenP( )

_WPosCursor( )

_WPosCursorP( )

_WPutChr( )

_WPutStr( )

_WRight( )

_WRightP( )

_WScroll( )

_WScrollP( )

_WSelect( )

_WSendBehind( )

_WSetAttr( )

_WSetPort( )

_WSetTitle( )

_WShow( )

_WSize( )

_WSizeP( )

_WTitle( )

_WTop( )

_WTopP( )

_WWidth( )

_WWidthP( )

_WZoom( )

X

Y

Z


Help Contents: Professional Reference
Environment Routines

These API routines allow you to return information about the Visual FoxPro environment.

_GetAPIHandle( )

Returns the handle of the current FLL.


Help Contents: Professional Reference
String Manipulation Routines

These API routines allow you to manipulate strings.

_StrCmp( )

Compares two null-terminated strings.

_StrCpy( )

Copies a null-terminated string from src to dest.

_StrLen( )

Returns the length in bytes of a null-terminated string.


Help Contents: Professional Reference
Text Editor and Clipboard Manipulation Routines

These API routines allow you to manipulate the Visual FoxPro text editor, the file open in the text editor, and the clipboard.

_EdActive( )

Hides or shows the selection range or insertion point.

_EdCloseFile( )

Closes the specified file while saving without asking, prompting before saving, or saving as another file.

_EdCopy( )

Copies selected area to the clipboard.

_EdCut( )

Copies selected area to the clipboard and deletes it from the editor.

_EdDelete( )

Deletes the selected area. If there is no selection, deletes character at current pos.

_EdGetChar( )

Gets the character at EDPOS.

_EdGetEnv( )

Reads various editor settings.

_EdGetLineNum( )

Returns the line number for the position EDPOS.

_EdGetLinePos( )

Returns the EDPOS for the beginning of the line EDLINE.

_EdGetPos( )

Returns current editor POS, or returns anchor point if there’s a selection.

_EdGetStr( )

Gets the text between EDPOS and EDPOS inclusive, and places it in TEXT.

_EdIndent( )

Indents the selected text by int tab stops. Int can be negative in order to format a hanging indent.

_EdInsert( )

Inserts BYTES of TEXT.

_EdLastError( )

Returns the error number of the last editor error.

_EdOpenFile( )

Starts an editor session on this file.

_EdPaste( )

Copies clipboard text into the editor at current position.

_EdPosInView( )

Returns TRUE if the editor position is visible.

_EdRedo( )

Redoes the most recent undo.

_EdRevert( )

Reverts to a saved file.

_EdSave( )

Saves the file without closing the editing window.

_EdScrollToPos( )

Makes sure that EDPOS passed is on the screen, but doesn't move insertion point. BOOL means center EDPOS vertically.

_EdScrollToSel( )

Makes sure the selection anchor point is on the screen. BOOL means center anchor point vertically.

_EdSelect( )

Selects the range from EDPOS to EDPOS. To move the insertion point, set both EDPOSes the same.

_EdSendKey( )

Simulates key press given by int.

_EdSetEnv( )

Sets various editor settings.

_EdSetPos( )

Moves insertion point, and has side affect of unselecting anything currently selected.

_EdSkipLines( )

Moves insertion point from EDPOS to beginning of line int.

_EdUndo( )

Undoes the most recent changes.

_EdUndoOn( )

Groups the actions performed after _EdUndoOn( ) is passed until it is passed again as a single action for undo purposes.


Help Contents: Professional Reference
Routines to Return Results to Visual FoxPro

These API routines allow you to return results to Visual FoxPro as a specified data type.

_RetChar( )

Sets the function return value to a null-terminated string.

_RetCurrency( )

Sets the library return value to a currency value.

_RetDateStr( )

Sets the function return value to a date. The date is specified in mm/dd/year format, where the year may be either two or four digits.

_RetDateTimeStr( )

Sets the library return value to a datetime.

_RetFloat( )

Sets the function return value to a float value.

_RetInt( )

Sets the function return value to a numeric value.

_RetLogical( )

Sets the function return value to a logical value. Zero is considered False. Any non-zero value is considered True.

_RetVal( )

Passes a complete Visual FoxPro Value structure, so it can return any Visual FoxPro data type except for memo. You must call _RetVal( ) to return a string that contains embedded null characters.


Help Contents: Professional Reference
Memory Management Routines

These API routines allow you to manipulate and allocate memory for your API functions.

_Alloca( )

Allocates a block of stack space for the calling routine. Memory is automatically freed when the routine exits.

_AllocHand( )

Returns a new MHANDLE of size hsize. A value of zero is returned when there is insufficient memory to fulfill the request. Memory allocated with _AllocHand( ) isn’t initialized.

_FreeHand( )

Releases an MHANDLE previously allocated by means such as _AllocHand( ).

_GetHandSize( )

Returns the usable number of bytes associated with an MHANDLE.

_HandToPtr( )

Translates an MHANDLE to a FAR (32-bit) pointer, which points to the memory allocated to this MHANDLE.

_HLock( )

Locks an MHANDLE to prevent it from moving if Visual FoxPro requires memory reorganization.

_HUnLock( )

Unlocks an MHANDLE, allowing it to participate in Visual FoxPro memory reorganization.

_MemAvail( )

Returns True if a request to allocate a handle of size bytes will succeed. Otherwise, _MemAvail( ) returns False.

_MemCmp( )

Compares two length byte memory areas.

_MemFill( )

Fills an area of memory starting at the location pointed to by ptr with length copies of the byte in character.

_MemMove( )

Copies length bytes from src to dest.

_SetHandSize( )

Changes the amount of memory allocated to an MHANDLE. The routine returns True if the reallocation is successful or False if the reallocation fails.


Help Contents: Professional Reference
Variable and Array Routines

These API routines allow you to manipulate memory variables and memory variable arrays.

_ALen( )

Returns information about the dimensions of the array whose name table index is nti.

_FindVar( )

Provides a way to initialize a Locator so you can use _Store( ) to place data in an existing memory variable.

_Load( )

Fetches the value of the memory variable or table variable specified by loc and places it into val.

_NameTableIndex( )

Returns the name table index that corresponds to a given name, or -1 if that name isn’t in the name table.

_NewVar( )

Creates a variable or an array.

_Release( )

Frees a memory variable or an array.

_Store( )

Replaces the memory variable specified by loc with the value val.


Help Contents: Professional Reference
File Input and Output Routines

These API routines allow you to directly create and manipulate files.

_FCHSize( )

Sets the file size on disk to the specified length. The specified length may extend or truncate the file.

_FClose( )

Terminates access to a file. Any buffers that have been modified while the buffer is open are automatically flushed to disk.

_FCopy( )

Attempts to copy len bytes from position spos in file sc to position dpos in file dc.

_FCreate( )

Assigns a Visual FoxPro channel to a new file.

_FEOF( )

Returns True if the file is currently at the end of file; otherwise, returns False.

_FError( )

Returns the last file operation error recorded for any channel.

_FFlush( )

Ensures that all modified buffers in memory have been flushed out to disk.

_FGets( )

Reads a single line of maxlen length, delimited with a carriage return, from a file.

_FOpen( )

Assigns a Visual FoxPro channel to an existing file.

_FPuts( )

Writes a null-terminated string to a file, followed by a carriage return/line feed pair.

_FRead( )

Reads exactly length bytes from a file into buffer.

_FSeek( )

Moves the file pointer to a new location as specified by position and mode.

_FWrite( )

Writes exactly length bytes from your buffer to a file. No terminator is added to the file.


Help Contents: Professional Reference
Table Input and Output Routines

These API routines allow you manipulate Visual FoxPro tables.

_DBAppend( )

Attempts to append a new record to the table in the specified workarea.

_DBLock( )

Attempts to lock the current table record or file in a work area specified by workarea.

_DBRead( )

Moves the current record pointer to the specified record in the specified workarea.

_DBRecCount( )

Returns the total number of records in the table open in the specified workarea.

_DBRecNo( )

Returns the number of the current record in the table in the specified workarea.

_DBReplace( )

Places a new value in a field.

_DBRewind( )

Performs a GOTO TOP in the specified workarea and returns the resultant record number.

_DBSeek( )

Searches an indexed table in the current work area for the first record whose index key matches the value val.

_DBSkip( )

Performs a SKIP in the specified workarea of the distance specified.

_DBStatus( )

Returns status flags for the specified workarea.

_DBUnlock( )

Releases all user-obtained locks on records or the file in the work area specified by workarea.

_DBUnwind( )

Performs a GOTO BOTTOM in the specified workarea and returns the resultant record number.

_DBWrite( )

Writes to disk the current record in the specified workarea and updates any affected indexes.


Help Contents: Professional Reference
Memo Field Input and Output Routines

These API routines allow you to manipulate memo fields in a Visual FoxPro table.

_AllocMemo( )

Allocates size bytes of space in the memo file for a field and inserts the new block number in the associated record in the table.

_FindMemo( )

Returns the location in the memo file to begin reading to access a memo field directly.

_MemoChan( )

Returns the Visual FoxPro channel of the memo file associated with the specified workarea.

_MemoSize( )

Returns the length of the memo field in the memo file.


Help Contents: Professional Reference
Event Handling Routines

These API routines allow you to create event handlers and process Visual FoxPro events.

_ActivateHandler( )

Adds a function handler to the end of the list of event handlers.

_ActivateIdle( )

Adds a routine to the list of routines called when Visual FoxPro is waiting for user input or for an event to time out.

_DeActivateHandler( )

Removes the specified handler from the event processor list.

_DeActivateIdle( )

Removes the specified routine from the idle loop.

_DefaultProcess( )

Provides the default event processing for an event returned by _GetNextEvent( ) when the event doesn’t need special handling.

_GetNextEvent( )

Reads the next event into the EventRec and returns the event type.

_InKey( )

Returns the next key typed during the timeout period. The timeout period is specified as a number of MS-DOS timer ticks.

_MousePos( )

Fills in pt with the current position of the mouse.

_MousePosP( )

Fills in pt with the current position of the mouse in pixels.


Help Contents: Professional Reference
Window Manipulation Routines

These API routines allow you to create, manipulate, and release windows, and manipulate the main Visual FoxPro window.

_Dialog( )

Presents the user with a dialog that is the specified color scheme number scheme and contains the specified body text and button text.

_FindWindow( )

Places the WHANDLE of the window that the point pt belongs to on the screen into wh.

_FindWindowP( )

Places the handle of the window that the point pt belongs to on the screen into wh.

_GlobalToLocal( )

Translates a point in screen-relative coordinates to window-relative coordinates.

_GlobalToLocalP( )

Translates a point in screen-relative coordinates to window-relative pixel coordinates.

_PutChr( )

Writes one character char to the current output window in its normal attribute (color 0).

_PutStr( )

Writes a null-terminated string to the current output window in its normal attribute (color 0).

_PutValue( )

Formats the value val and writes it to the current output window.

_WAttr( )

Returns the attribute byte for the color index in the specified window's scheme.

_WBottom( )

Returns the row on the screen where the bottom of the window is located.

_WBottomP( )

Returns the position on the screen in pixels where the bottom of the specified window is located.

_WClear( )

Erases the contents of the specified window by changing the content area to the default background color.

_WClearRect( )

Erases a rectangular area of a window by changing it to the default background color.

_WClearRectP( )

Erases the specified rectangular portion of a window by changing it to the default background color.

_WClose( )

Closes a window and releases all memory associated with that window.

_WFindTitle( )

Passes the title of a window, and returns the WHANDLE.

_WGetCursor( )

Returns the position of the logical cursor in the specified window.

_WGetCursorP( )

Returns in pixels the current output position in the specified window.

_WGetPort( )

Returns the WHANDLE of the window that’s currently selected for user output.

_WHeight( )

Returns the number of rows in the content area of a window.

_WHeightP( )

Returns the height in pixels of the content area of the specified window.

_WHide( )

Removes a window from the screen but keeps track of its contents so that it can be displayed again if desired.

_WLeft( )

Returns the column on the screen where the left edge of the window is located.

_WLeftP( )

Returns the position on the screen in pixels where the left edge of the window is located.

_WMainWindow( )

Returns the WHANDLE of the main Visual FoxPro window.

_WMove( )

Moves the specified window to a new location specified by pt.

_WMoveP( )

Moves the specified window to a new location specified by pt.

_WhToHwnd( )

Passes the WHANDLE, and returns the Windows HWND.

_WOnTop( )

Returns the WHANDLE of the frontmost window.

_WOpen( )

Creates a new window at the coordinates specified by top, left, bottom and right.

_WOpenP( )

Creates a new window at the coordinates specified by top, left, bottom and right.

_WPosCursor( )

Positions the logical cursor of the specified window at the location specified by pt.

_WPosCursorP( )

Positions the logical cursor of the specified window at the location specified in pixels by pt.

_WPutChr( )

Writes one character char to the specified window in the current color.

_WPutStr( )

Writes a null-terminated string to the specified window in the current color.

_WRight( )

Returns the column on the screen where the right edge of the window is located.

_WRightP( )

Returns the position on the screen in pixels where the right edge of the window is located.

_WScroll( )

Scrolls a portion of the contents of a window left or right and up or down.

_WScrollP( )

Scrolls a portion of the contents of a window left or right and up or down.

_WSetAttr( )

Changes the attribute for the specified color scheme index in the indicated window's color scheme to the new attribute attr.

_WSelect( )

Brings the specified window to the frontmost position on the screen.

_WSendBehind( )

Sends the specified window to the rearmost position on the screen.

_WSetPort( )

Changes the user output window to be the specified window.

_WSetTitle( )

Changes the title of a window.

_WShow( )

Redisplays a hidden window on the screen.

_WSize( )

Sets the new dimensions of the window to the height and width specified by h and v in pt.

_WSizeP( )

Sets the new dimensions of the window to the height and width specified by h and v in pt.

_WTitle( )

Puts the null-terminated title of the window wh in title.

_WTop( )

Returns the row on the screen where the top of the window is located.

_WTopP( )

Returns the position on the screen in pixels where the top of the window is located.

_WWidth( )

Returns the number of columns in the content area of a window.

_WWidthP( )

Returns the width in pixels of the content area of the specified window.

_WZoom( )

Zooms a window to a new state.


Help Contents: Professional Reference
Menu Routines

These API routines allow you to create, manipulate, and release menus.

_ActivateMenu( )

Displays the specified menu on the screen and immediately returns control to the calling routine.

_CountItems( )

Returns the number of menu titles or bars on the specified menu.

_DeActivateMenu( )

Removes a menu from the screen.

_DisposeItem( )

Releases the specified menu item and frees all storage associated with this item.

_DisposeMenu( )

Releases the specified menu and all its items and frees all storage associated with this menu.

_GetItemCmdKey( )

Copies the displayed keyboard shortcut string for the specified menu item to the buffer pointed to by the text parameter.

_GetItemId( )

Returns the item identifier of the index item in the specified menu.

_GetItemSubMenu( )

Returns the menu item identifier or a submenu assigned to a menu item.

_GetItemText( )

Copies the text of a menu bar or menu title to the buffer pointed to by text.

_GetNewItemId( )

Returns an identifier that is currently available for use as an item identifier in the specified menu.

_GetNewMenuId( )

Returns an identifier that’s available for use as a menu identifier.

_MenuId( )

Returns the actual menu identifier that corresponds to the system-defined literal for the system menu title or menu.

_MenuInteract( )

Sets the itemid and the menuid to indicate which menu item was selected, if any.

_NewItem( )

Adds an item with the specified itemid to the menu specified by menuid.

_NewMenu( )

Creates a new menu of the specified menu type.

_OnSelection( )

Specifies a routine to execute when the specified menu and item are selected.

_SetItemCmdKey( )

Sets the keyboard shortcut for the specified menu item, as well as the displayed text for the keyboard shortcut.

_SetItemSubMenu( )

Assigns a submenu to a menu item. This can be used to attach a menu to a title, or a submenu to a menu item.

_SetItemText( )

Changes the displayed text for a menu item. The item may either be a pad or a bar.

_SetMenuPoint( )

Specifies the upper left corner, loc, of a menu.

_SetMenuPointP( )

Specifies in pixels the screen position of the upper left corner, loc, of a menu.


Help Contents: Professional Reference
Object Routines

These API routines allow you to manipulate Visual FoxPro objects and controls.

_FreeObject( )

Releases an object from the Visual FoxPro API data pool.

_GetObjectProperty( )

Returns a property value for an object.

_ObjectCmp( )

Compares the properties of two objects and returns 0 if their properties and property values are identical.

_ObjectReference( )

Increments the reference count of an object.

_ObjectRelease( )

Decrements the reference count of an object.

_SetObjectProperty( )

Sets a property for an object.

_WGetObjectClientWindow( )

Returns the handle of the client window in which the specified object is contained.

_WGetObjectWindow( )

Returns the handle of the frame window in which the specified object is contained.


Help Contents: Professional Reference
Statement and Expression Routines

These API routines allow you to compile and execute Visual FoxPro commands.

_Evaluate( )

Compiles and executes a Visual FoxPro expression contained in expr, placing the result in res.

_Execute( )

Compiles and executes the null-terminated statement in stmt.


Help Contents: Professional Reference
Error Handling Routines

These API routines allow you to determine the cause of an error and the error type.

_Error( )

Signals the error specified by the value in code to the Visual FoxPro runtime.

_ErrorInfo( )

Returns the external error number that reflects the internal error number specified by code.

_UserError( )

Reports an error with the null-terminated text specified in the message.


Help Contents: Professional Reference
Debugging Routines

These API routines allow you to debug your API libraries.

_BreakPoint( )

A macro that generates the debugger breakpoint instruction, INT 3. This can be helpful for debugging external routines


Color Palette Toolbar

See Also

Use the Color Palette toolbar to specify colors for a control on a form or report.

This toolbar contains the following buttons.

Button		Description
	Foreground Color	Sets the default foreground color for controls.
	Background Color	Sets the default background color for controls.
	Other Colors	Displays the Windows Color dialog box, where you can define custom colors.


See Also

Background Color Property
Colors Overview
Foreground Color Property
View Menu


Database Designer Toolbar

See Also

The Database Designer toolbar is displayed when the Database Designer is active.

This toolbar contains the following buttons.

Button		Description
	New Table	Creates a new table using a wizard or designer.
	Add Table	Adds an existing table to a database.
	Remove Table	Removes the selected table from the database or deletes it from the disk.
	New Remote View	Creates a remote view using a wizard or a designer.
	New Local View	Creates a local view using a wizard or a designer.
	Modify…	Opens the selected table or query in the Table Designer or Query Designer.
	Browse	Displays the selected table or view in the Browse window for editing.
	Edit Stored Procedures	Displays a Visual FoxPro stored procedure in the Editing window.
	Connections	Displays the Connections dialog box so you can access available connections or add new connections through the Connections Designer.


See Also

ADD TABLE Command
Add Table Dialog Box
BROWSE Command
Browse Window
Connections Dialog Box
CREATE SQL VIEW Command
CREATE TABLE Command
Database Designer
Editing Window
MODIFY COMMAND Command
MODIFY STRUCTURE Command
New Local View Dialog Box
New Remote View Dialog Box
New Table Dialog Box
Query Designer.
REMOVE TABLE Command
Table Designer


Form Controls Toolbar

See Also

You can create controls on your form with the Form Controls toolbar. Click the button for the control you want, position the mouse pointer on the form, and click the form to place the control or drag it to size.

This toolbar is automatically displayed when you open the Form Designer, but can be displayed any time by selecting it in the Toolbars dialog box, which you can access from the View menu. However, the toolbar buttons are not enabled unless you are working on a form.

This toolbar contains the following buttons.

Button		Description
	Select Objects	Resizes and moves controls. After you create a control, the Select Objects button is automatically reselected, unless the Button Lock button is pressed down.
	View Classes	Allows you to select and display a registered class library. After you select a class, the toolbar only displays buttons for the classes in the selected library.
	Label	Creates a label control, used for text that you don't want the user to change, such as a caption above check boxes or under a graphic.
	Text Box	Creates a text box control, used to hold a single line of text that the user can either enter or change. For more information, see Text Box Builder.
	Edit Box	Creates an edit box control, used to hold multiple lines of text that the user can either enter or change. For more information, see Edit Box Builder.
	Command Button	Creates a command button control, used to carry out a command.
	Command Group	Creates a command group control, used to group related commands together. For more information, see Command Group Builder.
	Option Group	Creates an option group control, used to display multiple options from which the user can select only one. For more information, see Option Group Builder.
	Check Box	Creates a check box control, which offers the user a choice between a true-or-false condition, or displays multiple choices from which the user can select more than one.
	Combo Box	Creates a combo box control, used to create a drop-down combo box or a drop-down list box so that the user can select one of a list of items or enter a value by hand. For more information, see Combo Box Builder.
	List Box	Creates a list box control, used to display a list of items from which the user can select. The list can be scrolled if it has more items than can be displayed at one time. For more information, see List Box Builder.
	Spinner	Creates a spinner control, used to accept numeric input that falls within a given range.
	Grid	Creates a grid control, used to display data in a spreadsheet-like grid. For more information, see Grid Builder.
	Image	Displays a graphical image on your form.
	Timer	Creates a timer control, which allows you to run processes at specific times or intervals. This control is invisible at run time.
	PageFrame	Displays multiple pages of controls.
	OLE Container Control	Allows you to add OLE objects to your application.
	OLE Bound Control	Like OLE container controls, enables you to add OLE objects to your application. Unlike OLE container controls, however, OLE bound controls are bound to a General field.
	Line	Use to draw a variety of line styles on your form at design time.
	Shape	Use to draw a variety of shapes on your form at design time. You can draw a rectangle, rounded rectangle, square, rounded square, oval, or circle.
	Separator	Puts space between toolbar controls.
	Builder Lock	Opens a builder for whatever new control you add to the form.
	Button Lock	Allows you to add multiple controls of the same type without having to click the control button on the toolbar more than once.
	Container	Places a container object on the current form.


See Also

Controls and Objects
Form Designer
Toolbars Dialog Box


Form Designer Toolbar

See Also

The Form Designer toolbar is automatically displayed with the Form Designer.

This toolbar contains the following buttons.

Button		Description
	Set Tab Order	Switches between Design mode and Tab Order mode for setting the tab order of objects. Disabled unless the form contains one or more objects.
	Data Environment	Displays the Data Environment Designer.
	Properties Window	Displays a window reflecting settings for the current object.
	Code Window	Displays the Code window for the current object so you can view and edit the code.
	Form Controls Toolbar	Shows or hides the Form Controls toolbar.
	Color Palette Toolbar	Shows or hides the Color Palette toolbar.
	Layout Toolbar	Shows or hides the Layout toolbar.
	Quick Form…	Runs the Form Builder, which gives you an easy, interactive way to add fields to the form as controls and define the form’s style and layout.
	Auto Format	Runs the AutoFormat Builder, which gives you an easy, interactive way to apply formatting styles to selected controls. One or more controls must be selected to enable this button.


See Also

AutoFormat Builder
Code Window
Color Palette Toolbar
Data Environment Designer
Form Builder
Form Controls Toolbar
Form Designer
Layout Toolbar
Properties Window
Quick Form


Layout Toolbar

See Also

Use the Layout toolbar to align and manipulate the locations of controls on a report or form.

This toolbar contains the following buttons.

Button		Description
	Align Left Sides	Aligns selected controls on the leftmost edge. Enabled when you select more than one control.
	Align Right Sides	Aligns selected controls on the rightmost edge. Enabled when you select more than one control.
	Align Top Edges	Aligns selected controls on the topmost edge. Enabled when you select more than one control.
	Align Bottom Edges	Aligns selected controls on the bottommost edge. Enabled when you select more than one control.
	Align Vertical Centers	Aligns the selected controls' centers on a vertical axis. Enabled when you select more than one control.
	Align Horizontal Centers	Aligns the selected controls' centers on a horizontal axis. Enabled when you select more than one control.
	Same Width	Adjusts the width of the selected controls to the widest control.
	Same Height	Adjusts the height of the selected controls to the tallest control.
	Same Size	Adjusts the size of the selected controls to the largest control.
	Center Horizontally	Aligns the selected controls' centers on a vertical axis in the middle of the form.
	Center Vertically	Aligns the selected controls' centers on a horizontal axis in the middle of the form.
	Bring to Front	Positions the selected controls in front of all other controls.
	Send to Back	Positions the selected controls behind all other controls.


See Also

Align Submenu
Format Menu
Horizontal Spacing Submenu
Size Submenu
Vertical Spacing Submenu
View Menu


Print Preview Toolbar

See Also

Changes the previewed page and zooms the view in or out.

This toolbar contains the following buttons.

Button		Description
	First Page	Displays the first page.
	Previous Page	Shows how the previous page of the report will be printed.
	Page Number	Displays the Go To Page dialog box.
	Next Page	Shows how the next page of the report will be printed.
	Last Page	Shows how the last page of the report will be printed.
	Zoom	Scales the text in the preview window by 75%, 50%, 25%, or 10% of its actual size.
	Close Preview	Closes Print Preview window.


See Also

File Menu


Query Designer Toolbar

See Also

The Query Designer toolbar is automatically displayed with the Query Designer.

This toolbar contains the following buttons.

Button		Description
	Add Table	Displays the Add Table Or View dialog box so you can add a table or view to the query.
	Remove Table	Removes the selected table from the top pane of the designer window. For details, see Query Menu.
	Add Join	Creates a join condition between two tables in the query.
	View SQL	Displays the SQL statement your query is building. For details, see Query Menu.
	Maximize/Minimize Top Pane	Enlarges or reduces the top pane of the Query Designer.
	Query Destination	Displays the Query Destination dialog box, which allows you to send the results of your query to eight different outputs.


See Also

Add Join
Maximize/Minimize Top Pane (View Menu)
Query Menu
Query and View Designer


Report Controls Toolbar

See Also

You can create controls on your report or label with the Report Controls toolbar. Click the button for the control you want, position the mouse pointer on the report, and click the report to place the control or drag it to size.

On a report, you can double-click any control to display a dialog box for setting options.

This toolbar is displayed automatically when you open the Report Designer.

This toolbar contains the following buttons.

Button		Description
	Select Objects	Resizes and moves controls. After you create a control, the Select Objects button is automatically reselected, unless the Button Lock button is pressed down.
	Label	Creates a label control, used for text that you don't want the user to change, such as a caption above check boxes or under a graphic.
	Field	Creates a field control, used to display the contents of a table’s field, memory variable, or other expression.
	Line	Use to draw a variety of line styles on your report at design time.
	Rectangle	Use to draw rectangles on your report.
	Rounded Rectangle	Use to draw rectangles with rounded corners and ellipse shapes on your report.
	Picture/OLE Bound Control	Use to display a picture or contents of a general data field on your report.
	Button Lock	Allows you to add multiple controls of the same type without having to click the control button on the toolbar more than once.


See Also

Report Designer


Report Designer Toolbar

See Also

The Report Designer toolbar is displayed when the Report Designer is open.

This toolbar contains the following buttons.

Button		Description
	Data Grouping	Displays the Data Grouping dialog box so you can create data groups and specify their properties.
	Report Controls Toolbar	Shows or hides the Report Controls toolbar.
	Color Palette Toolbar	Shows or hides the Color Palette toolbar.
	Layout Toolbar	Shows or hides the Layout toolbar.


See Also

Report Designer
Report Menu
View Menu


Standard Toolbar

See Also

The Standard toolbar contains buttons for performing the most common actions in Visual FoxPro. This toolbar is displayed by default.

This toolbar contains the following buttons.

Button		Description
	New	Creates new files using designers and wizards.
	Open	Opens an existing file or creates a new file.
	Save	Saves changes to the active file. For more information, see File Menu.
	Print	Prints a text file, report, label, or the contents of the Command window or Clipboard.
	Print Preview	Shows you the results of your work without printing it. For more information, see File Menu.
	Spelling	Checks spelling. Available when editing text or memo field.
	Cut	Removes selected text, controls, or anything else that is selectable, to the Clipboard.  For details, see Edit Menu.
	Copy	Duplicates selected text, controls, or anything else that is selectable. For details, see Edit Menu.
	Paste	Places cut or copied text, controls, or anything else that is selectable at the insertion point position. For details, see Edit Menu.
	Undo	Reverses the most recent action. For details, see Edit Menu.
	Redo	Reverses the most recent Undo command. For details, see Edit Menu.
	Run	Executes the Run Query, Run Form, Do <Program>, or Run Report. commands.
	Database	Specifies the current database.
	Command Window	Shows commands as they are executed, and provides space for typing commands.
	Data Session Window	Provides an easy way to open tables, establish relations, and set work area properties.
	Form Wizard	Runs a Visual FoxPro form wizard. These include the Form Wizard and One-To-Many Form Wizard.
	Report Wizard	Runs a Visual FoxPro report wizard. These include the Report Wizard, Group/Total Report Wizard, and One-To-Many Report Wizard.
	AutoForm Wizard	Creates a form without using a wizard.
	AutoReport Wizard	Creates a report without using a wizard.
	Help	Displays online Help.


See Also

Data Session Window
Edit Menu
File Menu
Form Wizard
Help Menu
Report Wizard
Tools Menu
Window Menu


View Designer Toolbar

See Also

The View Designer toolbar is displayed when the View Designer is open.

This toolbar contains the following buttons.

Button		Description
	Add Table	Displays the Add Table Or View dialog box so you can add a table or view to the designer window.
	Remove Table	Removes the selected table from the top pane of the designer window. For details, see Query Menu.
	Add Join	Creates a join condition between two tables in the view.
	View SQL	Displays the SQL statement your view is building. For details, see Query Menu.
	Maximize/Restore Top Pane	Enlarges or reduces the top pane of the View Designer.


See Also

ADD TABLE Command
Join Condition Dialog Box
Query Menu
REMOVE TABLE Command
View Designer
View Menu


Accessibility for People with Disabilities

Microsoft is committed to making its products and services easier for everyone to use. This help file provides information about the following products and services, which make Microsoft Windows and Microsoft Visual FoxPro more accessible for people with disabilities:

•	Microsoft services for people who are deaf or hard-of-hearing.

•	Access Pack for Microsoft Windows, a software utility that makes using Microsoft Windows easier for people with motion or hearing disabilities.

•	Keyboard layouts for single-handed users.

•	Microsoft software documentation on audio cassettes, floppy disks, and compact disk (CD).

•	Third-party utilities to enhance accessibility.

•	Hints for customizing Microsoft Windows.

•	More information about products and services for people with disabilities.

Note   The information in this section applies only to users who purchased Windows in the United States. If you purchased Windows outside the United States, your Windows package contains a subsidiary information card listing Microsoft support telephone numbers and addresses. You can contact your subsidiary to find out whether the type of products and services described in this Help file are available in your area.


Microsoft Services for People Who Are Deaf or Hard of Hearing
Microsoft Services for People Who Are Deaf or Hard-of-Hearing

Through a text telephone (TT/TDD) service, Microsoft provides people who are deaf or hard-of-hearing with complete access to Microsoft product and customer services.  Your calling options are listed below:

•	You can contact Microsoft Sales Information Center on a text telephone by dialing (800) 892-5234 between 6:30 A.M. and 5:30 P.M. Pacific time.

•	For technical assistance you can contact Microsoft Support on a text telephone at (206) 635-4948 between 6:00 A.M. and 6:00 P.M. Pacific time, Monday through Friday, excluding holidays. In Canada, dial (905) 568-9641 between 8:00 A.M. and 8:00 P.M. Eastern time, Monday through Friday, excluding holidays.

Note   Microsoft support is subject to Microsoft prices, terms, and conditions in place at the time the service is used.


Access Pack for Microsoft Windows

Microsoft distributes Access Pack for Microsoft Windows, which provides people with motion or hearing disabilities better access to computers running Microsoft Windows.  (If you are running Microsoft Windows 95, these same Access Pack features are already built in. See online Help for more information.) Access Pack for Microsoft Windows contains features that:

•	Allow single-finger typing of SHIFT, CTRL, and ALT key combinations.

•	Ignore accidental keystrokes.

•	Adjust the rate at which a character is repeated when you hold down a key, or turn off character repeating entirely.

•	Prevent extra characters if you unintentionally press a key more than once.

•	Enable you to control the mouse cursor by using the keyboard.

•	Enable you to control the computer keyboard and mouse by using an alternate input device.

•	Provide a visual cue when the computer beeps or makes sounds.

Access Pack for Microsoft Windows is included on the Microsoft Windows Driver Library in the file ACCESS.EXE. If you have a modem, you can download Microsoft Windows Driver Library components, including the following, from network services:

•	CompuServe(r)

•	GEnie(TM)

•	Microsoft OnLine

•	Microsoft Download Service (MSDL), which you can reach by calling (206) 936-MSDL (936-6735) any time except between 1:00 A.M. and 2:30 A.M. Pacific time. Use the following communications settings:

Setting	Specify
Baud Rate	1200, 2400, 9600, or 14400
Parity	None
Data bits	8
Stop bits	1
•	Various user-group bulletin boards (such as the bulletin-board services on the Association of PC User Groups network).

People within the United States who do not have a modem can order the Access Pack for Microsoft Windows by calling Microsoft Information Center at (800) 426-9400 (voice) or (800) 892-5234 (text telephone).  In Canada, you can call (905) 568-3503 (voice) or (905) 568-9641 (text telephone).


Keyboard Layouts for Single-Handed Users

Microsoft distributes Dvorak keyboard layouts that make the most frequently typed characters on a keyboard more accessible to people who have difficulty using the standard “QWERTY” layout. There are three Dvorak layouts: one for two-handed users, one for people who type with their left hand only, and one for people who type with their right hand only. The left-handed or right-handed keyboard layouts can also be used by people who type with a single finger or a wand. You do not need to purchase any special equipment in order to use these features.

Microsoft Windows already supports the two-handed Dvorak layout, which can be useful for coping with or avoiding types of repetitive-motion injuries associated with typing. To get this layout, choose International from the Windows Control Panel. The two layouts for people who type with one hand are distributed as Microsoft Application Note GA0650. It is also contained in file GA0650.ZIP on most network services or GA0650.EXE on the Microsoft Download Service. For instructions on obtaining this application note, see Access Pack for Microsoft Windows.


Microsoft Documentation in Alternative Formats

People who have difficulty reading or handling printed documentation can obtain most Microsoft publications from Recording for the Blind, Inc. Recording for the Blind distributes these documents to registered members of their distribution service either on audio cassettes or on floppy disks. The Recording for the Blind collection contains more than 80,000 titles, including Microsoft product documentation and books from Microsoft Press. You can contact Recording for the Blind at the following address or phone numbers:

Recording for the Blind, Inc.
20 Roszel Road
Princeton, NJ 08540

Phone: (609) 452-0606
Fax: (609) 987-8116


Third Party Utilities to Enhance Accessibility
Third-Party Utilities to Enhance Accessibility

A wide variety of third-party hardware and software products are available to make personal computers easier to use for people with disabilities. Among the different types of products available for the MS-DOS and Microsoft Windows operating systems are:

•	Programs that enlarge or alter the color of information on the screen for people with visual impairments.

•	Programs that describe information on the screen in braille or synthesized speech for people who are blind or have difficulty reading.

•	Hardware and software utilities that modify the behavior of the mouse and keyboard.

•	Programs that enable users to “type” using a mouse or their voice.

•	Word or phrase prediction software that allows one to type more quickly and with fewer keystrokes.

•	Alternate input devices, such as single switch or puff-and-sip devices, for those who cannot use a mouse or a keyboard.

For more information on obtaining third-party utilities, see More Information. For more information about customizing Windows for people with low vision, see Customizing Windows.


Customizing Microsoft Windows

There are many ways you can adjust the appearance and behavior of Microsoft Windows to suit varying eyesight and motor skills without requiring any additional software or hardware. These include ways to adjust the appearance as well as the behavior of the mouse and keyboard. The specific methods available depend on which operating system you are using. Application notes are available describing the specific methods available for each operating system.

See the appropriate application note for information related to customizing your operating system for people with disabilities. For information on obtaining application notes, see Access Pack for Microsoft Windows.

Operating System	Application note number
Microsoft Windows 3.0	WW0786.TXT
Microsoft Windows 3.1	WW0787.TXT
Microsoft Windows for Workgroups 3.1	WG0788.TXT
Microsoft Windows95.	WN1062


More Information about Products and Services with Disabilities

For more information on Microsoft products and services for people with disabilities, contact:

Microsoft Sales Information Center
One Microsoft Way
Redmond, WA 98052-6393

Voice telephone: (800) 426-9400
Text telephone: (800) 892-5234
Fax: (206) 635-6100

The Trace R&D Center at the University of Wisconsin-Madison produces a book and a compact disc that describe products that help people with disabilities use computers. The book, titled “Trace ResourceBook,” provides descriptions and photographs of about 2,000 products. The compact disc, titled “Co-Net CD,” provides a database of more than 18,000 products and other information for people with disabilities. It is issued twice a year. To obtain these directories, contact:

Trace R&D Center
S-151 Waisman Center
1500 Highland Avenue
Madison, WI 53705-2280

Voice telephone: (608) 263-2309
Text telephone: (608) 263-5408
Fax: (608) 262-8848

For general information and recommendations on how computers can help specific people, you should consult a trained evaluator who can best match your needs with the available solutions. An assistive technology program in your area will provide referrals to programs and services that are available to you. To locate the assistive technology program nearest you, you can contact:

National Information System
Center for Developmental Disabilities
Benson Building
University of South Carolina
Columbia, SC 29208

Voice/text telephone (803) 777-4435
Fax:  (803) 777-6058


Browse Window

See Also

The Browse window displays the records in the active table.

When you are browsing a table in the Browse window, you can view records in two different modes, Browse and Edit. You can switch modes by choosing Browse or Edit from the View menu.

Note   When you open a table using Open from the File menu, you have to choose Browse <table> from the View menu in order to see the table.

To select fields, click a cell or press TAB, ENTER, or the arrow keys. Move a column to a new position by clicking on the field name, dragging the column where you want it, and releasing the mouse button.

To enter a null value in a field that accepts null values, press CTRL+0. As long as a field that contains a null value remains active, nothing is displayed in it. After you activate a different field, the one containing the null value will display the string defined by the SET NULLDISPLAY command (for example, “.NULL.”)

If you choose Append from the View menu, the Browse window adds a new, blank record. When you fill in the new record, the Browse window automatically adds another new record.

Note   In some cases, if you browse a table or cursor generated by a crosstab query, the field names start with a character and a dash, indicating the data type of the field. For example, a numeric field starts with N-.


See Also

BROWSE Command
SET BRSTATUS Command
SET REFRESH Command


Code Window

See Also

Use the Code window to write, display, and edit form, event, and method code. You can open as many Code windows as you want, so you can easily view, copy, and paste the code from different forms.

The Code window appears when you double-click a form or form control in the Form Designer, double-click in the Data Environment window, or double-click an event or method in the Properties window. Doing this has the same effect as choosing the Code command on the View menu.

Window Options

Object   Lists the current form, form set, data environment, toolbar objects, cursor, relation, and all the controls on the current form.

Procedure   Lists all the events recognized by Visual FoxPro for the form, form set, data environment, cursor, relation, or control displayed in the Object box. When you select an event or method from the Procedure box, the parameters passed to the event or method (if any) are displayed in the editing region of the Code window. Event names in boldface text contain code.

Tip   If you need help on syntax for functions, statements, properties, events, or methods while working in the Code window, type the keyword or the property, event, or method name, select it, and press F1 for online Help. You can also select an event or method in the Procedure box and press F1 for information about the selected event or method. Press PAGE DOWN to jump to the next event or method that has code in it.


See Also

Form Designer
Properties Window
View Menu


Command Window

See Also

The Command window is a Visual FoxPro system window. When you choose menu commands, Visual FoxPro language commands are echoed in the Command window.

You can also type Visual FoxPro commands directly into the Command window. In the Command window, you can:

•	Delete text by pressing ESC if you haven’t already pressed ENTER to execute the command.

•	Re-issue a previous command by placing the cursor anywhere on the command line and then pressing ENTER.

•	Re-issue a block of code by selecting it, and then pressing ENTER.

•	Split lengthy commands by typing a semicolon after a space in the command where you want it to break and then pressing ENTER.

•	Move text within the Command window and to other editing windows. Select the desired text and drag it to the desired spot.

•	Copy text within the Command window and paste it into other editing windows without using Edit menu commands. Select the desired text, hold down CTRL, and then drag the text to the desired spot.

You can change font, line spacing and indentation by selecting the appropriate command from the Format menu.

Right-click in the Command window to display a shortcut menu with these options:

•	Cut, Copy, Paste. Move or delete characters to and from the Command window.

•	Build Expression. Display the Expression Builder window, in which you can define an expression using commands, literals, fields, or other expressions. The expression you build is pasted into the Command window when you click OK.

•	Execute Selection. Execute the text selected in the Command window as a new command.

•	Clear. Remove the list of previously-executed commands from the Command window.

•	Properties. Display the Edit Properties window in which you can change edit behavior, tab width, fonts, and syntax coloring options for the Command window.


See Also

Command Window Shortcut Menu
Edit Properties window
Expression Builder window
Format Menu
Window Menu


Editing Window

See Also

Provides text and program file editing. If you have selected Modify Selected File in the Projects tab of the Options dialog box, the Editing window opens when you double-click a text or program file in the Project Manager.

In the Editing window, you can:

•	Move text within the Command window and to other editing windows. Select the desired text and drag it to the desired spot.

•	Copy text within the Command window and paste it into other editing windows without using Edit menu commands. Select the desired text, hold down CTRL, and then drag the text to the desired spot.

Change font, line spacing, and indentation by selecting the appropriate command from the Format menu.


See Also

Editing Window Shortcut Menu
Format Menu
Projects Tab, Options Dialog Box


General Field Window

See Also

This window is displayed when you double-click a General field’s type designator in a browsed table, or press CTRL + PAGE UP or CTRL + PAGE DOWN to open the General Field window from the keyboard.

With this window displayed, you can create or insert OLE objects by using the Insert Object command on the Edit menu. You can edit the existing object by double-clicking it or by selecting Bitmap Image object Edit or object Open from the Edit menu.


See Also

Edit Menu
General Field Type
Table Designer


Project Manager Window

See Also

Use the Project Manager to organize and manage your files in projects. A project is a collection of files, data, documents, and Visual FoxPro objects that is saved as a file with a .PJX extension. When the Project Manager window is active, Visual FoxPro displays the Project menu on the menu bar.

The items in the Project Manager are organized in an outline-like view that you can expand or collapse. A plus sign appears next to a symbol if there are one or more items of that type in the project. Click the plus sign next to a symbol to see items in the list. Click the minus sign to collapse an expanded list.

As with toolbars, you can dock the Project Manager by dragging it to the top of your screen or double-clicking the title bar. When it is docked, it automatically collapses and shows only the tabs.

Window Options

Tabs

Display items by category. When the Project Manager is collapsed, you can tear off tabs by dragging them away from the Project Manager. To replace a tab, just drag it back to its original position, or click the Close box.

Click the pushpin button to keep a tab on top of other windows.

Expanding/Collapsing Button

Expands and collapses the Project Manager. When the Project Manager is collapsed you can “tear off” tabs by placing the mouse pointer over a tab and dragging it away from the Project Manager.

Items List

Lists the items contained in the project in an outline-like view. Icons appear to the left of the item to identify its type.

The symbol [image] A circle with a slash through it appears next to items that are excluded from the project.

When files are included in the project, they are compiled into a single .APP file when the project is built. All included files are read-only at run time. In the Programs, Forms, Queries, or Menus group, the name of the main program file appears in bold.

Project Manager Buttons

New   Creates a new file or object. This button has the same effect as the New File command on the Project menu. The new file or object’s type is the same as that of the currently selected item.

Note   Files created from the File menu are not automatically included in a project. Files created from the New File command on the Project menu (or the New button in the Project Manager) are automatically included in a project.

Add   Adds an existing file to the project. This button has the same effect as the Add File command on the Project menu.

Modify   Opens the selected item in the appropriate designer. This button has the same effect as the Modify File command on the Project menu.

Browse   Opens a table in a Browse window. This command has the same effect as the Browse File command on the Project menu, and is enabled only when a table is selected.

Close   Closes an open database. This command has the same effect as the Close File command on the Project menu, and is enabled only when a table is selected. If the selected database is already closed, this button changes to Open.

Open   Opens a database. This command has the same effect as the Open File command on the Project menu, and is enabled only when a table is selected. If the selected database is already open, this button changes to Close.

Remove   Removes the selected file or object from the project. Visual FoxPro asks you if you want to just remove the file from the project or if you want to remove it from the project and delete it from disk. This command has the same effect as the Remove File command on the Project menu.

Build   Builds a project or application and can also build an executable or OLE server. This command has the same effect as the Build command on the Project menu.

Preview   Displays the selected report or label in Print Preview mode. Enabled when you select a report or label in the Project Manager. This command has the same effect as the Preview File command on the Project menu.

Run   Runs the selected query, form, or program. Enabled when you select a query, form, menu, or program in the Project Manager. This command has the same effect as the Run File command on the Project menu.


See Also

Browse Window
File Menu
Project Menu


Properties Window

See Also

The Properties window contains the list of properties, events, and methods for a selected form, data environment, cursor, relation, or control. These are properties you set or change at design time, or programmatically.

You can also select several objects, and then display the Properties window. In that case, the Properties window displays the properties that the selected objects have in common.

You can choose to open the Properties window from the View menu. Or, click the right mouse button in the Form Designer or Data Environment Designer, and then choose Properties from the Form Designer shortcut menu.

Window Options

Object

Identifies the currently selected object. Click the drop-down arrow on the right to see a list that includes the current form, form set, and all the controls on the form. If the Data Environment Designer is open, the Object list includes the data environment and all cursors and relationships in the data environment. From the list, you can select the form or a control whose properties you want to change.

Tabs

Display properties, events, and methods by category:

•	All   Displays all properties, events, and methods.

•	Data   Displays properties associated with what and how data is displayed or manipulated by the object.

•	Methods   Displays methods and events.

•	Layout   Displays all layout properties.

•	Other   Displays miscellaneous and user-defined properties.

Property Settings Box

Allows you to change the value of the property selected in the properties list. A drop-down arrow appears on the right if the selected property requires a predefined setting. A dialog button appears on the right if the setting requires a file name or a color.

Click the Accept button (the check mark) to confirm the change you made to a property. Click the Cancel button (the X mark) to cancel your change and restore the previous setting.

Some properties (e.g. BackColor) display a dialog button to allow you to set properties from a dialog box.

Click the Function button (the Fx mark) to open the Expression Builder. Properties can be set to literal values or the values returned by functions or expressions.

Properties List

This two-column list shows all properties that can be changed at design time and their current settings. For properties that have predefined settings, double-click the property name in the Properties list to cycle through the available choices. For predefined properties with only two choices, double-click to switch between the choices. Select any property and press F1 to get Help on that property.

Note   Properties that can be edited at design time, for example ArrayProps, do not show up as non-default properties when you choose the Non-Default Properties Only option from the Properties shortcut menu in the Properties window.

Property settings that are expressions are prefaced with an equal sign (=). Properties, events, and methods that are read-only are in italics.


See Also

Expression Builder
Properties Window Shortcut Menu
View Menu


Data Session Window

See Also

You can use the Data Session window to open and display tables or views, establish temporary relationships, and set work area properties.

Window Options

Current Session   Displays the name of the current data session.

Aliases   Displays the view name or table name without the file extension.

Relations   Indicates the temporary relationship established between the tables or views in the Aliases box.

Properties   Displays the Work Area Properties dialog box, in which you can modify the structure of a table, select index files and fields, and define data filters. If no tables or views are listed in the Aliases box, an Open dialog box appears to allow you to open a table or view.

Browse   Displays the table or view selected in the Aliases box in a Browse window, where you can examine, edit, or append data.

Open   Displays an Open dialog box, similar to the Add Table or View dialog box, so you can select a table or view to open.

Close   Removes the selected table or view and any associated files from the Aliases box.

Relations   Defines the relations between tables or views, using the Expression Builder. The Set Index Order dialog box appears before the Expression Builder dialog box when no index order has been set between the two tables.

1-To-Many   Displays the Create One-To-Many Relationships dialog box, which allows you to establish a one-to-many temporary relationship between child tables and parent tables. This button is enabled when you establish relations between two or more tables by selecting them in the View dialog box and then clicking Relations.


See Also

Browse Window
Create One-To-Many Relationships
Expression Builder
Open Dialog Box
Work Area Properties


Wizards Overview

Wizards are interactive programs that help you quickly accomplish common tasks such as creating forms, formatting reports, and setting up queries.

By answering questions or choosing options on the series of wizard screens, you are telling the wizard to build a file or perform a task based on your responses. For example, if you choose the Report Wizard, you can select the type of report you want to create. The wizard then asks which table you want to use and provides choices for formatting the report.

You can start a wizard when you create a new file from within the Project Manager or when you choose New from the File menu. Simply choose the Wizard option when prompted. You can also start a wizard by selecting the Wizards submenu on the Tools menu.

To	Use this wizard
Create a Visual FoxPro application	Application Wizard
Create a cross-tab query	Cross-Tab Wizard
Format and produce text files from your code in projects and program files	Documenting Wizard
Create a form	Form Wizard
Create a graph	Graph Wizard
Create a report with grouping and totals	Group/Total Report Wizard
Import or append data	Import Wizard
Create mailing labels	Label Wizard
Create a view	Local View Wizard
Create a mail merge file	Mail Merge Wizard
Create a one-to-many form	One-To-Many Form Wizard
Create a one-to-many report	One-To-Many Report Wizard
Create an Oracle database that duplicates, as much as possible, the functionality of a Visual FoxPro database	Oracle Upsizing Wizard
Create a pivot table	PivotTable Wizard
Create a query	Query Wizard
Create a remote view	Remote View Wizard
Create a report	Report Wizard
Create distribution disks from the files in your distribution tree	Setup Wizard
Create a SQL Server database that duplicates, as much as possible, the functionality of a Visual FoxPro database	SQL Upsizing Wizard
Create a table	Table Wizard
Create a Web page that allows Web page visitors to search and retrieve records from your Visual FoxPro table	WWW Search Page Wizard


Application Wizard

See Also

Creates a fully functional application including a project file, tables, reports, forms, and a complete project-specific class library. Alternatively, creates an application framework that includes only the project file and a starter class library subclassed from the Visual FoxPro base classes, ready for you to populate with new or existing tables and documents.

After running the Application Wizard, you can modify and customize the application or framework as required for your application. For details, see the Application Wizard Object Members, Application Wizard Object Methods, and Application Wizard Object Properties topics.

To run the Application Wizard

1	From the Wizards submenu on the Tools menu, choose All.

2	In the Wizard Selection dialog box, choose Application Wizard.

Wizard Steps

Step 1 - Choose Project Location

Step 2 - Choose Database

Step 3 - Choose Documents

Step 4 - Configure Menu

Step 5 - Finish


See Also

Application Wizard Object Members
Application Wizard Object Methods.
Application Wizard Object Properties
Application Wizard Step 1 - Choose Project Location
Application Wizard Step 2 - Choose Database
Application Wizard Step 3 - Choose Documents
Application Wizard Step 4 - Configure Menu
Application Wizard Step 5 - Finish
Wizards Overview


Application Wizard: Step 1 - Choose Project Location

See Also

Allows you to specify whether to create a complete application or just an application framework. If you choose to create a complete application, you can either include in the application a database and forms or reports you have already created, or you can create a new application from scratch using a database template. If you choose to create a framework, you can go back later and add components to the framework.

Also allows you to name your project and specify the directory for the application or framework files. If you specify a directory that does not exist, the Application Wizard creates the directory for you.

Step Options

Complete application   Specifies that you want to go through all steps of the Application Wizard to build an application from existing elements, or create an application from scratch.

Framework   Specifies that you want to create only the project framework; the Application Wizard takes you through only steps 1 and 5.

Create project directory structure   If you choose this option, the wizard creates a directory structure with separate directories for data, forms, libraries, menus, and so on. All directories are created beneath the directory you specify. If you do not choose this option, the wizard places all data and documents in the same directory as the project file in the directory you specify.

Note   If you attempt to add files to the application framework by running the Application Wizard a second time, all the files created previously by the Application Wizard (but not your own files that you explicitly added) are erased and replaced with new files.

Whether you create a complete application or a framework, the Application Wizard creates a directory and project structure for a future application, and a project file (.PJX and .PJT files) in the directory you specify, containing the following files.

File Type	File Name
Forms	ABOUT.SCX, an “About” dialog box that you can fill in and that is called from your application’s Help menu. Qckstart.SCX, a dialog box with a list of the application’s forms for you to fill in, which allows users to jump directly to any form you list.
Classes	APPWIZ.VCX, standard class libraries for the About and QuickStart forms, and for the application object itself. For details, see Application Wizard Object Members. Name.VCX, a library containing the cApplication object, subclassed from the APPWIZ.VCX library.
Program	name.PRG, the main program for the project, which creates the application object and displays the application’s menu. You can modify this program to suit the startup sequence of your application.
Menu	name.MNX, the application’s main menu. If you created only a framework, the application contains a modified version of the Visual FoxPro menu.
Text	APPWIX.TXT, a text file describing the template files from which the wizard creates application-specific files name.TXT, a file that issues an #INCLUDE command to include the FOXPRO.H file in your application.
*name represents the name you assign the project on Step 1 of the Application Wizard.

After running the wizard, you can modify the project using the Project Manager, either to add new or existing files, or to modify the files created by the wizard.

Note   By default, the project file will be created in the current Visual FoxPro directory. If you want to create a self-contained directory structure, change the default directory created by the Application Wizard.


See Also

Application Wizard
Application Wizard Object Members
Application Wizard Object Methods
Application Wizard Object Properties
Application Wizard Step 1 - Choose Project Location
Application Wizard Step 2 - Choose Database
Application Wizard Step 3 - Choose Documents
Application Wizard Step 4 - Configure Menu
Application Wizard Step 5 - Finish


Application Wizard: Step 2 - Choose Database

See Also

Allows you to select an existing database or create a new database using a database template for the application. This step appears only when you choose Complete application in Step 1.

If you select an existing database, the database specified will be included in the final Project file. If you select a database template, the database will contain sample data, in addition to forms and reports appropriate for that database. Using a database template will allow you to create a fully functional database application that is ready to use immediately.


See Also

Application Wizard
Application Wizard Step 1 - Choose Project Location
Application Wizard Step 3 - Choose Documents
Application Wizard Step 4 - Configure Menu
Application Wizard Step 5 - Finish


Application Wizard: Step 3 - Choose Documents

See Also

Displays the forms, reports, and labels that will be created for your application, and allows you to specify additional documents or remove them from the default list.

By default, the wizard creates two forms: an About form, and a QuickStart form that lists all the forms available in the project. The QuickStart form is automatically marked as the default startup form.

If you specify a database template, the Application Wizard automatically includes the documents associated with the database template.

You can include more documents by choosing Add to display the Open dialog box, then choosing the form, report, or other document you want to include.

You can remove any document contained in the list by selecting it, then choosing Remove.

Note   You cannot remove the QuickStart and About forms by choosing Remove.

All forms, reports, and labels you include in the application are automatically added to the application’s project file and application menu. In addition, if you include the QuickStart form in your application, all other forms will be accessible through the QuickStart form. Files added under the Other icon are not added to the menu created by the Application Wizard.

The documents you include from a database template are created in the corresponding directory. For example, if you include a form based on a template, the wizard creates a new form of that name in your Forms directory.

However, if you add your own documents to the list, the documents are referenced (not copied). For example, if you add the form MYFORM.SCX from another application, the Application Wizard creates a reference to that form in the new application, but does not make a second copy of it.

You can also specify which form will be used as the startup form for the application. Whatever form is highlighted when you click the Startup button will be the designated startup form. Startup forms show a [image] icon and the word (startup) to distinguish them from non-startup forms. You do not have to specify a startup form.

Note   The Startup form is not the application’s main file.


See Also

Application Wizard
Application Wizard Object Members
Application Wizard Object Methods
Application Wizard Object Properties
Application Wizard Step 1 - Choose Project Location
Application Wizard Step 2 - Choose Database
Application Wizard Step 4 - Configure Menu
Application Wizard Step 5 - Finish


Application Wizard: Step 4 - Configure Menu

See Also

Allows you to select what menus and menu options appear in the application. Menus and menu options that have the word (excluded) after their names won’t appear on the menu. Choose Exclude to remove an item from a menu, and Include to re-add an item.

Note   If you exclude a menu name, all menu options under that menu are also excluded. If you exclude the Forms or Reports menus, you will not be able to access from the menu the forms or reports and labels that were added to the application.


See Also

Application Wizard
Application Wizard Step 1 - Choose Project Location
Application Wizard Step 2 - Choose Database
Application Wizard Step 3 - Choose Documents
Application Wizard Step 5 - Finish


Application Wizard: Step 5 - Finish

See Also

Allows you to specify what happens when you choose Finish. You can save your application,

•	Selecting Save project will generate the project, menu, and program files and return to Visual FoxPro. Choose this option if you intend to work with the project at a later time.

•	Selecting Save project and modify it will generate the project, menu, and program files and will open the newly created project after returning to Visual FoxPro. Choose this option if you want to display the new project in the Visual FoxPro Project Manager

•	Selecting Save application and run it will generate the project, menu, program files, and build the application as an .APP file, and will then will run the newly generated .APP file. Choose this option to compile the new option and run it.

If you choose Framework only at Step 1, you can save or save and modify your project.


See Also

Application Wizard
Application Wizard Object Members
Application Wizard Object Methods.
Application Wizard Object Properties
Application Wizard Step 1 - Choose Project Location
Application Wizard Step 2 - Choose Database
Application Wizard Step 3 - Choose Documents
Application Wizard Step 4 - Configure Menu


Application Wizard Object Methods

See Also

When the Application Wizard creates a new project, it creates an application wizard object called cApplication, subclassed from the wzApplication object in the APPWIZ.VCX library. When the application runs, the main program (projname.PRG) creates an instance of the application wizard object cApplication, then calls its methods to control the application.

The application wizard object contains code for standard methods, and includes a set of new methods.

The following new methods are defined for the wzApplication and cApplication objects.

Application Wizard Object Customized Methods

Event	Description
DestroyEvent	Clears events and restores the environment.
InitEvent	Saves the environment and resets the list of application forms.
The following new methods are defined for the wzApplication and cApplication objects.

Application Wizard Object New Methods

Event	Description
BeforeReadEvents	Contains any procedure that should be executed before the application’s READ EVENTS loop is started. The default is to do nothing.
ClearEvents	Clears any pending read events.
DoForm	Executes a form.
DoLabel	Executes a label.
DoMenu	Executes a menu.
DoProgram	Executes a .PRG, .APP, or .EXE program.
DoReport	Executes an .FRX report.
FileNotFoundMsgBox	Displays a File Not Found message box.
GetCaption	Returns the caption of the application.
GetIcon	Returns the icon of the application.
OnShutDown	Confirms with a message box that the user wants to exit Visual FoxPro.
ReadEvents	Starts read events mode after performing any initialization procedure.
RefreshFormsCollection	Refreshes the list of the application’s forms from collection arrays and counters.
Release	Releases the application.
ReleaseForm	Releases specific form or all active forms from memory.
ReleaseForms	Releases all application forms from memory.
ReleaseFormsCollection	Releases all forms listed in collection arrays and counters.
ResetFormsCollection	Clears the list of the application’s forms in collection arrays and counters.
RestoreEnvironment	Restores the application’s caption and icon.
SaveEnvironment	Saves the application’s caption and icon into custom properties.
SetCaption	Sets the caption of the application’s main window.
SetIcon	Sets the icon of the application.
Show	Displays the application’s startup menu and form.


See Also

Application Wizard Object Members
Application Wizard Object Properties


Application Wizard Object Properties

See Also

When the Application Wizard creates a new project, it creates an application wizard object called cApplication, subclassed from the wzApplication object in the APPWIZ.VCX library. When the application runs, the main program (projname.PRG) creates an instance of the application wizard object cApplication, then uses the object’s properties calls its methods to control the application.

In addition, the wizard creates a form called QckStart, which is subclassed from the Wzquickstartform form in the APPWIZ.VCX library.

The following new properties are defined for the wzApplication and cApplication objects.

Application Wizard Object Properties

Property	Description
aFormNames[ ]	Array containing names of all forms.
AForms[ ]	Array containing all forms.
CCaption	Used to store form caption.
CIcon	Used to store form icon.
CLastCopy	Used to temporarily store form caption when the environment is saved.
CLastIcon	Used to temporarily store form icon when environment is saved.
cStartupForm	Contains name of form executed when the application object is shown.
cStartupMenu	Contains name of menu executed when the application object is shown.
lCascadeForms	Specifies whether forms are cascaded if multiple instances of the same form are opened in the same top and left positions of the desktop (default = .T.).
lReadEvents	Specifies that the READ EVENTS command should be issued from within the form’s ReadEvents method.
nFormCount	Forms collection count for application object.
NPixeloffset	Specifies the number of pixels by which multiple instances of the same form should be offset.
The following new properties are defined for the wzQuickStartForm and QckStart forms.

Quick Start Form Properties

Property	Description
aCommands[ ]	List of all forms defined in the application.
nFileCount	Count of all forms defined in the application.


See Also

Application Wizard Object Members
Application Wizard Object Methods


Application Wizard Object Members

See Also

When the Application Wizard creates a new project, it automatically generates two forms for the new application, a Quick Start form and an About form, subclassed respectively from the wzQuickStartForm and Wzaboutdialog forms in the APPWIZ.VCX library.

The subclassed forms are containers for the following objects.

Wzaboutdialog Members

Object	Class	Description
cmdOK	Commandbutton	Releases the form.
WzQuickStartForm Members

Object	Class	Description
cmdClose	Commandbutton	Closes the  QuickStart form.
cmdRun	Commandbutton	Runs the form currently selected in the list box.
lblForms	Label	Text label.
LstForms	Listbox	Contains a list of all forms defined in the application, generated automatically in the list box’s Init method. When the user double-clicks the name of a form, the form is run.


See Also

Application Wizard Object Methods
Application Wizard Object Properties


Cross-Tab Wizard

See Also

Creates a cross-tab query for displaying the results of a query in a spreadsheet format.

To run the Cross-Tab Wizard

1	From the Wizards submenu on the Tools menu, choose Query.

2	In the Wizard Selection dialog box, choose Cross-Tab Wizard.

Wizard Steps

Step 1 - Select Fields

Step 2 - Define Layout

Step 3 - Add Summary Information

Step 4 - Finish

After you save the cross-tab query, you can open and modify it later like any other query in the Query Designer.


See Also

Graph Wizard
Local View Wizard
Query Wizard
Remote View Wizard
Wizards Overview


Cross-Tab Wizard: Step 1 - Select Fields

See Also

You can select fields from only a single table or view.


See Also

Cross-Tab Wizard: Step 2 - Define Layout
Cross-Tab Wizard: Step 3 - Add Summary Information
Cross-Tab Wizard: Step 4 - Finish


Cross-Tab Wizard: Step 2 - Define Layout

See Also

Your cross-tab query results will display a column for each unique value that exists for the table field that you drag to the Data box.


See Also

Cross-Tab Wizard: Step 1 - Select Fields
Cross-Tab Wizard: Step 3 - Add Summary Information
Cross-Tab Wizard: Step 4 - Finish


Cross-Tab Wizard: Step 3 - Add Summary Information

See Also

You can add a column that contains summary information and subtotals by selecting the appropriate radio button from the Summary and Subtotals areas. The totals will appear in the rightmost column of your cross-tab query results.


See Also

Cross-Tab Wizard: Step 1 - Select Fields
Cross-Tab Wizard: Step 2 - Define Layout
Cross-Tab Wizard: Step 4 - Finish


Cross-Tab Wizard: Step 4 - Finish

See Also

To display the results in a Browse window, select Save and run cross-tab query.

To view null values select the Display Null Values check box.

After you save the cross-tab query, you can open and modify it later like any other query in the Query Designer.


See Also

Cross-Tab Wizard: Step 1 - Select Fields
Cross-Tab Wizard: Step 2 - Define Layout
Cross-Tab Wizard: Step 3 - Add Summary Information


Form Wizard

See Also

Creates a form for data entry from a single table. The size of the form is based on your Maximum design area setting on the Forms tab of the Options dialog box.

To run the Form Wizard

1	From the Wizards submenu on the Tools menu, choose Form.

2	In the Wizard Selection dialog box, choose Form Wizard.

Wizard Steps

Step 1 - Select Fields

Step 2 - Choose Form Style

Step 3 - Sort Records

Step 4 - Finish

After you save the form, you can open and modify it later like any other form in the Form Designer.


See Also

Wizards Overview


Form Wizard: Step 1 - Select Fields

See Also

You can select fields from only a single table or view.


See Also

Form Wizard Step 2 - Choose Form Style
Form Wizard Step 3 - Sort Records
Form Wizard Step 4 - Finish


Form Wizard: Step 2 - Choose Form Style

See Also

Allows you to specify what the controls on your form will look like.

When you click any of the styles listed in the Style text box, the wizard displays a picture in the magnifying glass as an example of the style.

The button type applies to your form’s navigation buttons. The navigation buttons that the wizard creates on your form are as follows.

Button	Description
Top	Moves record pointer to first record.
Prev	Moves record pointer back one record.
Next	Moves record pointer forward one record.
Bottom	Moves record pointer to last record.
Find	Displays the Search dialog box.
Print	Prints a report.
Add	Adds a new record to the end of the table.
Edit	Allows user to change values in current record.
Delete	Deletes current record.
Exit	Closes form.
Note   After the wizard saves a form, you can add additional fields to it using the same styles by selecting Quick Form on the Form menu to bring up the Form Builder.

All controls created by the Form Wizard and the Form Builder are in the WIZARDS\WIZSTYLE.VCX directory. If you want to modify the styles, modify the classes in this file using the Class Designer.


See Also

Form Wizard Step 1 - Select
Form Wizard Step 3 - Sort Records
Form Wizard Step 4 - Finish


Form Wizard: Step 3 - Sort Records

See Also

Select the fields in the order that you would like to sort the records within each group. You can also choose an index tag.


See Also

Form Wizard Step 1 - Select
Form Wizard Step 2 - Choose Form Style
Form Wizard Step 4 - Finish


Form Wizard: Step 4 - Finish

See Also

If you chose a large number of fields in Step 1 and want to make sure they all fit on the form, select Add pages for fields that do not fit. Any extra fields will spill over to extra pages on the page frame.

To preview the form before exiting the Form Wizard, click the Preview button.

After you save the form, you can open and modify it later like any other form in the Form Designer.


See Also

Form Wizard Step 1 - Select
Form Wizard Step 2 - Choose Form Style
Form Wizard Step 3 - Sort Records


Graph Wizard

See Also

The Graph Wizard creates a graph from a Visual FoxPro table using Microsoft Graph.

The larger your table is, the longer it will take the wizard to process your graph. You might consider limiting the scope of records in a large table by creating a view before you run the Graph Wizard.

To run the Graph Wizard

1	From the Wizards submenu on the Tools menu, choose Query.

2	In the Wizard Selection dialog box, choose Graph Wizard.

Wizard Steps

Step 1 - Select Fields

Step 2 - Define Layout

Step 3 - Select Graph Style

Step 4 - Finish


See Also

Cross-Tab Wizard
Local View Wizard
Query Wizard
Remote View Wizard
Wizards Overview


Graph Wizard: Step 1 - Select Fields

See Also

You can select fields from only a single table or view. This table must include at least one numeric field.

Note   If you choose a general or OLE field in this step, the field will not be available in the next step for defining the graph layout.


See Also

Graph Wizard Step 2 - Define Layout
Graph Wizard Step 3 - Select Graph Style
Graph Wizard Step 4 - Finish


Graph Wizard: Step 2 - Define Layout

See Also

Drag one or more of the available numeric fields from the Available fields window to the Data series box. Drag another field from the Available fields window to the Axis box beneath the graph picture.


See Also

Graph Wizard Step 1 - Select Fields
Graph Wizard Step 3 - Select Graph Style
Graph Wizard Step 4 - Finish


Graph Wizard: Step 3 - Select Graph Style

See Also

Each graph style plots the data in a different manner. Look at the pictures on the buttons to choose a style that meets your needs.


See Also

Graph Wizard Step 1 - Select Fields
Graph Wizard Step 2 - Define Layout
Graph Wizard Step 4 - Finish


Graph Wizard: Step 4 - Finish

See Also

If you choose to save the graph to a table, the wizard creates a table with a single record containing a General field that stores an OLE object for your graph. After the wizard is finished, it leaves your new table open. To view the graph, browse the new table and double-click the Olegraph field.

To create a legend for the graph, select Add a legend to the graph. To preview the graph, click the Preview button. To graph null values, select Show Null Values.

If you choose to create a query, the wizard saves a query that sends its results to a graph. After the wizard saves the query, you can open and modify it like any other query in the Query Designer.


See Also

Graph Wizard Step 1 - Select Fields
Graph Wizard Step 2 - Define Layout
Graph Wizard Step 3 - Select Graph Style


Group/Total Report Wizard

See Also

The Group/Total Report Wizard creates a summary report. The wizard prompts you with simple questions as you go through a brief series of steps, in which you specify the table and fields that you want to use to create controls on your report.

To run the Group/Total Report Wizard

1	From the Wizards submenu on the Tools menu, choose Report.

2	In the Wizard Selection dialog box, choose Group/Total Wizard.

Wizard Steps

Step 1 - Select Fields

Step 2 - Group Records

Step 3 - Sort Records

Step 4 - Choose Report Style

Step 5 - Finish


See Also

One-To-Many Report Wizard
Report Wizard
Wizards Overview


Group/Total Report Wizard: Step 1 - Select Fields

See Also

You can select fields from only a single table or view.


See Also

Group/Total Report Wizard Step 2 - Group Records
Group/Total Report Wizard Step 3 - Sort Records
Group/Total Report Wizard Step 4 - Choose Report Style
Group/Total Report Wizard Step 5 - Finish


Group/Total Report Wizard: Step 2 - Group Records

See Also

You can use data grouping to categorize and sort your records so that they are easier to read. Once you select a field in one of the Group by boxes, you can choose Modify to further change the grouping. You can also select Totals or Subtotals as appropriate.


See Also

Group/Total Report Wizard Step 1 - Select Fields
Group/Total Report Wizard Step 3 - Sort Records
Group/Total Report Wizard Step 4 - Choose Report Style
Group/Total Report Wizard Step 5 - Finish


Group/Total Report Wizard: Step 3 - Sort Records

See Also

Select the fields in the order that you would like to sort the records within each group. Fields that you selected as groupings in Step 2 are not available in this step.


See Also

Group/Total Report Wizard Step 1 - Select Fields
Group/Total Report Wizard Step 2 - Group Records
Group/Total Report Wizard Step 4 - Choose Report Style
Group/Total Report Wizard Step 5 - Finish


Group/Total Report Wizard: Step 4 - Choose Report Style

See Also

When you choose any of the styles, the wizard updates the graphic in the magnifying glass as an example of the font, layout, and formatting of the report.


See Also

Group/Total Report Wizard Step 1 - Select Fields
Group/Total Report Wizard Step 2 - Group Records
Group/Total Report Wizard Step 3 - Sort Records
Group/Total Report Wizard Step 5 - Finish


Group/Total Report Wizard: Step 5 - Finish

See Also

If the number of fields that you have selected cannot fit on a single line within the width of your report, the fields will wrap to the following line. If you do not want the fields to wrap, clear Wrap fields that do not fit. Click the Preview button to view the layout of the report prior to closing the wizard.

After you save the report, you can open and modify it like any other report in the Report Designer.


See Also

Group/Total Report Wizard Step 1 - Select Fields
Group/Total Report Wizard Step 2 - Group Records
Group/Total Report Wizard Step 3 - Sort Records
Group/Total Report Wizard Step 4 - Choose Report Style


Import Wizard

See Also

The Import Wizard imports data into Visual FoxPro tables from other file formats.

To run the Import Wizard

•	From the Wizards submenu on the Tools menu, choose Import.

Wizard Steps

Step 1 - Identify Data

Step 2 - Determine Data Format

Step 2a - Describe Data

Step 3 - Define Imported Fields

Step 3a - Specify International Options

Step 4 - Finish


See Also

Wizards Overview


Import Wizard: Step 1 - Identify Data

See Also

Allows you to choose the Locate buttons to specify source and destination files. You also define the file type, and select if the destination file will be a new table or an existing table.


See Also

Import Wizard Step 2 - Determine Data Format
Import Wizard Step 2a - Describe Data
Import Wizard Step 3 - Define Imported Fields
Import Wizard Step 3a - Specify International Options
Import Wizard Step 4 - Finish


Import Wizard: Step 2 - Determine Data Format

See Also

Allows you to specify the type of separator for the data, and the point at which the Import Wizard should begin importing fields.

Data Format

Delimited   Specifies that the fields in the file are separated by a character.

Fixed Width   Specifies that the fields in the file are aligned in columns.

Field Names In Row   Allows you to specify which row contains the field names for the file. The Import Wizard automatically replaces spaces with underscores and reduces field name size to fit the 10 character maximum.

Begin Import at Row   Allows you to specify the row with which to begin importing data. This option lets you to avoid importing header data.

Worksheet   Specifies the name of the worksheet if you are importing a worksheet.

Field Grid   For a text file, displays the record number and data as it is found in the file. For other types of files, displays the file data as it will appear when you have completed the Import Wizard.


See Also

Import Wizard Step 1 - Identify Data
Import Wizard Step 2a - Describe Data
Import Wizard Step 3 - Define Imported Fields
Import Wizard Step 3a - Specify International Options
Import Wizard Step 4 - Finish


Import Wizard: Step 2a - Describe Data

See Also

Allows you to manually add column breaks or delete column breaks if you have chosen Fixed Width in the Data Format area of Step 2. If you have chosen Delimited from the Data Format area of Step 2, select what delimeter separates the text strings in the selected file. View the effect of the delimeter selected in the Field grid.

Note   Step 2a of the Import Wizard only appears if you have chosen to import a text (.TXT) file.


See Also

Import Wizard Step 1 - Identify Data
Import Wizard Step 2 - Determine Data Format
Import Wizard Step 3 - Define Imported Fields
Import Wizard Step 3a - Specify International Options
Import Wizard Step 4 - Finish


Import Wizard: Step 3 - Define Imported Fields

See Also

Allows you to specify the name of the columns in the table, the data type of the columns, and the width of the columns. Click below the existing heading of the column in the Field grid and edit the information listed in the Name, Type, Width, and Decimal boxes.

If you don’t want to import a specific column, click below the existing heading, then press DELETE. The space for the column will still be visible (without a column heading name), but when you finish the wizard and import the data, that column will be ignored.


See Also

Import Wizard Step 1 - Identify Data
Import Wizard Step 2 - Determine Data Format
Import Wizard Step 2a - Describe Data
Import Wizard Step 3a - Specify International Options
Import Wizard Step 4 - Finish


Import Wizard: Step 3a - Specifying International Options
Import Wizard: Step 3a - Specify International Options

See Also

Allows you to specify alternative settings for internationalization of the data to be imported into the table. You can select to change the Code Page, currency symbol, thousand separator, decimal separator and date format.


See Also

Import Wizard Step 1 - Identify Data
Import Wizard Step 2 - Determine Data Format
Import Wizard Step 2a - Describe Data
Import Wizard Step 3 - Define Imported Fields
Import Wizard Step 4 - Finish


Import Wizard: Step 4 - Finish

See Also

To view the table after your data is imported, open the table and browse it.


See Also

Import Wizard Step 1 - Identify Data
Import Wizard Step 2 - Determine Data Format
Import Wizard Step 2a - Describe Data
Import Wizard Step 3 - Define Imported Fields
Import Wizard Step 3a - Specify International Options


Label Wizard

See Also

Creates labels from a table.

To run the Label Wizard

•	From the Wizards submenu on the Tools menu, choose Label.

Wizard Steps

Step 1 - Select Tables

Step 2 - Choose Label Type

Step 3 - Define Layout

Step 4 - Sort Records

Step 5 - Finish


See Also

Wizards Overview


Label Wizard: Step 1 - Select Tables

See Also

Select a table or view.


See Also

Label Wizard Step 2 - Choose Label Type
Label Wizard Step 3 - Define Layout
Label Wizard Step 4 - Sort Records
Label Wizard Step 5 - Finish


Label Wizard: Step 2 - Choose Label Type

See Also

The wizard lists the standard label types that are installed with Visual FoxPro. The wizard also lists any label types you create using the AddLabel application in \VFP\TOOLS.

For information about other label types, see ADDLABEL.APP.


See Also

Label Wizard Step 1 - Select Tables
Label Wizard Step 3 - Define Layout
Label Wizard Step 4 - Sort Records
Label Wizard Step 5 - Finish


Label Wizard: Step 3 - Define Layout

See Also

Add the fields in the order you want them to appear on the label. You can use the punctuation, space, and newline buttons to format the label. Use the Text box to add text.

As you add items to the label, the picture in the wizard window is updated to show approximately how your label will look. Check this picture to see if the fields you have chosen will fit on the label. The text lines will extend beyond the bottom edge of the label if there are too many lines.


See Also

Label Wizard Step 1 - Select Tables
Label Wizard Step 2 - Choose Label Type
Label Wizard Step 4 - Sort Records
Label Wizard Step 5 - Finish


Label Wizard: Step 4 - Sort Records

See Also

Select the fields or index tag in the order that you would like to sort the records.


See Also

Label Wizard Step 1 - Select Tables
Label Wizard Step 2 - Choose Label Type
Label Wizard Step 3 - Define Layout
Label Wizard Step 5 - Finish


Label Wizard: Step 5 - Finish

See Also

You can choose Preview to verify your choices before finishing.

After you save the label, you can open and modify it like any other label in the Label Designer.


See Also

Label Wizard Step 1 - Select Tables
Label Wizard Step 2 - Choose Label Type
Label Wizard Step 3 - Define Layout
Label Wizard Step 4 - Sort Records


Local View Wizard

See Also

Creates views using native data. If you do not have a database open, you are prompted to open a database or create one.

To run the Local View Wizard

1	From the Wizards submenu on the Tools menu, choose Query.

2	In the Wizard Selection dialog box, choose Local View Wizard.

Wizard Steps

Step 1 - Select Fields

Step 2 - Relate Tables

Step 2a - Include Records

Step 3 - Filter Records

Step 4 - Sort Records

Step 4a - Limit Records

Step 5 - Finish


See Also

Cross-Tab Wizard
Graph Wizard
Query Wizard
Remote View Wizard
Wizards Overview


Local View Wizard: Step 1 - Select Fields

See Also

You can select fields from several tables or views. First, select fields from one table or view and move them to the Selected fields box; then select fields from another table or view and move those.


See Also

Cross-Tab Wizard
Graph Wizard
Local View Wizard: Step 2 - Relate Tables
Local View Wizard: Step 2a - Include Records
Local View Wizard: Step 3 - Filter Records
Local View Wizard: Step 4 - Sort Records
Local View Wizard: Step 4a - Limit Records
Local View Wizard: Step 5 - Finish
Query Wizard
Remote View Wizard


Local View Wizard: Step 2 - Relate Tables

See Also

Select the desired fields from the two drop-down list boxes and then choose Add. If you use multiple tables in your view you must relate the tables by indicating which fields contain matching data in each table.


See Also

Cross-Tab Wizard
Graph Wizard
Local View Wizard: Step 1 - Select Fields
Local View Wizard: Step 2a - Include Records
Local View Wizard: Step 3 - Filter Records
Local View Wizard: Step 4 - Sort Records
Local View Wizard: Step 4a - Limit Records
Local View Wizard: Step 5 - Finish
Query Wizard
Remote View Wizard


Local View Wizard: Step 2a - Include Records

See Also

Limit your query by choosing only matching rows from both tables or all rows from either table. By default, only matching records are included.

If you want to create an inner join, select Only matching rows. If you want to create an outer join, select all of the rows from one of the tables.


See Also

Cross-Tab Wizard
Graph Wizard
Local View Wizard: Step 1 - Select Fields
Local View Wizard: Step 2 - Relate Tables
Local View Wizard: Step 3 - Filter Records
Local View Wizard: Step 4 - Sort Records
Local View Wizard: Step 4a - Limit Records
Local View Wizard: Step 5 - Finish
Query Wizard
Remote View Wizard


Local View Wizard: Step 3 - Filter Records

See Also

You can reduce the number of records by creating expressions that filter records from the selected tables or views. You can create two expressions and connect them with And, which returns only records meeting both specified criteria, or Or, which returns records meeting either criteria.

Choose Preview to see the records that will be returned based on the supplied filter criteria.


See Also

Cross-Tab Wizard
Graph Wizard
Local View Wizard: Step 1 - Select Fields
Local View Wizard: Step 2 - Relate Tables
Local View Wizard: Step 2a - Include Records
Local View Wizard: Step 4 - Sort Records
Local View Wizard: Step 4a - Limit Records
Local View Wizard: Step 5 - Finish
Query Wizard
Remote View Wizard


Local View Wizard: Step 4 - Sort Records

See Also

Select up to three fields or an index tag to determine the order in which your view results will be sorted. Select Ascending to sort the view in ascending order or Descending to sort the view in descending order.


See Also

Cross-Tab Wizard
Graph Wizard
Local View Wizard: Step 1 - Select Fields
Local View Wizard: Step 2 - Relate Tables
Local View Wizard: Step 2a - Include Records
Local View Wizard: Step 3 - Filter Records
Local View Wizard: Step 4a - Limit Records
Local View Wizard: Step 5 - Finish
Query Wizard
Remote View Wizard


Local View Wizard: Step 4a - Limit Records

See Also

You can further limit the number of records in the view, based on either a percent of the records returned, or an actual number of records. For example, to see the top 10 items, choose Number of records and enter 10 in the Portion value box.


See Also

Cross-Tab Wizard
Graph Wizard
Local View Wizard: Step 1 - Select Fields
Local View Wizard: Step 2 - Relate Tables
Local View Wizard: Step 2a - Include Records
Local View Wizard: Step 3 - Filter Records
Local View Wizard: Step 4 - Sort Records
Local View Wizard: Step 5 - Finish
Query Wizard
Remote View Wizard


Local View Wizard: Step 5 - Finish

See Also

After you save the view, you can open and modify it like any other view in the View Designer.


See Also

Cross-Tab Wizard
Graph Wizard
Local View Wizard: Step 1 - Select Fields
Local View Wizard: Step 2 - Relate Tables
Local View Wizard: Step 2a - Include Records
Local View Wizard: Step 3 - Filter Records
Local View Wizard: Step 4 - Sort Records
Local View Wizard: Step 4a - Limit Records
Query Wizard
Remote View Wizard


Mail Merge Wizard

See Also

Creates either a data source for a Microsoft Word merged document or a text file that can be used by any word processor.

You must have a current version of Microsoft Word and ODBC installed on your computer in order to create a Microsoft Word merged document. Visual FoxPro Setup can install ODBC. For information about merged documents, see Microsoft Word Help.

To run the Mail Merge Wizard

•	From the Wizards submenu on the Tools menu, choose Mail Merge.

Wizard Steps

Step 1 - Select Fields

Step 2 - Choose Word Processor

Step 3 - Select Document Type

Step 4 - Choose Document Style

Step 5 - Finish


See Also

Wizards Overview


Mail Merge Wizard: Step 1 - Select Fields

See Also

You can select fields from only a single table or view.


See Also

Mail Merge Wizard Step 2 - Choose Word Processor
Mail Merge Wizard Step 3 - Select Document Type
Mail Merge Wizard Step 4 - Choose Document Style
Mail Merge Wizard Step 5 - Finish


Mail Merge Wizard: Step 2 - Choose Word Processor

See Also

You must have a current version of Microsoft Word installed on your computer if you select Microsoft Word. If you select Comma-delimited text file, the wizard will skip Steps 3 and 4 and go straight to the Finish screen.


See Also

Mail Merge Wizard Step 1 - Select Fields
Mail Merge Wizard Step 3 - Select Document Type
Mail Merge Wizard Step 4 - Choose Document Style
Mail Merge Wizard Step 5 - Finish


Mail Merge Wizard: Step 3 - Select Document Type

See Also

Create a new document or add the data to an existing one.


See Also

Mail Merge Wizard Step 1 - Select Fields
Mail Merge Wizard Step 2 - Choose Word Processor
Mail Merge Wizard Step 4 - Choose Document Style
Mail Merge Wizard Step 5 - Finish


Mail Merge Wizard: Step 4 - Choose Document Style

See Also

Select one of the Microsoft Word merge document types.


See Also

Mail Merge Wizard Step 1 - Select Fields
Mail Merge Wizard Step 2 - Choose Word Processor
Mail Merge Wizard Step 3 - Select Document Type
Mail Merge Wizard Step 5 - Finish


Mail Merge Wizard: Step 5 - Finish

See Also

If you have chosen to create a Microsoft Word document, the wizard will open the document in Microsoft Word. If you have chosen to create a text file, the wizard will prompt you to save.


See Also

Mail Merge Wizard Step 1 - Select Fields
Mail Merge Wizard Step 2 - Choose Word Processor
Mail Merge Wizard Step 3 - Select Document Type
Mail Merge Wizard Step 4 - Choose Document Style


One-To-Many Form Wizard

See Also

Creates a form for data entry from two related tables. The size of the form is based on your Maximum design area setting on the Forms tab of the Options dialog box.

To run the One-To-Many Form Wizard

1	From the Wizards submenu on the Tools menu, choose Form.

2	In the Wizard Selection dialog box, choose One-To-Many Form Wizard.

Wizard Steps

Step 1 - Select Parent Table Fields

Step 2 - Select Child Table Fields

Step 3 - Relate Tables

Step 4 - Choose Form Style

Step 5 - Sort Records

Step 6 - Finish


See Also

Form Designer
Wizards Overview


One-To-Many Form Wizard: Step 1 - Select Parent Table Fields

See Also

You can select fields from only a single table or view.


See Also

One-To-Many Form Wizard Step 2 - Select Child Table Fields
One-To-Many Form Wizard Step 3 - Relate Tables
One-To-Many Form Wizard Step 4 - Choose Form Style
One-To-Many Form Wizard Step 5 - Sort Records
One-To-Many Form Wizard Step 6 - Finish


One-To-Many Form Wizard: Step 2 - Select Child Table Fields

See Also

You can select fields from only a single table or view.


See Also

One-To-Many Form Wizard Step 1 - Select Parent Table Fields
One-To-Many Form Wizard Step 3 - Relate Tables
One-To-Many Form Wizard Step 4 - Choose Form Style
One-To-Many Form Wizard Step 5 - Sort Records
One-To-Many Form Wizard Step 6 - Finish


One-To-Many Form Wizard: Step 3 - Relate Tables

See Also

You can accept or select the fields that determine the relationship between the tables from the fields list.


See Also

One-To-Many Form Wizard Step 1 - Select Parent Table Fields
One-To-Many Form Wizard Step 2 - Select Child Table Fields
One-To-Many Form Wizard Step 4 - Choose Form Style
One-To-Many Form Wizard Step 5 - Sort Records
One-To-Many Form Wizard Step 6 - Finish


One-To-Many Form Wizard: Step 4 - Choose Form Style

See Also

When you click any of the styles listed in the Style box, the wizard displays a picture in the magnifying glass as an example of the style.

The button type applies to your form’s navigation buttons. The navigation buttons that the wizard creates on your form are as follows.

Button	Description
Top	Moves record pointer to first record.
Prev	Moves record pointer back one record.
Next	Moves record pointer forward one record.
Bottom	Moves record pointer to last record.
Find	Displays the Search dialog box.
Print	Prints a report.
Add	Adds a new record to the end of the table.
Edit	Allows user to change values in current record.
Delete	Deletes current record.
Exit	Closes form.
Note   After the wizard saves a form, you can add additional fields to it using the same styles by selecting Quick Form on the Form menu.

All controls created by the Form Wizard and the Form Builder are in WIZARDS\WIZSTYLE.VCX. If you want to modify the styles, modify the classes in this file.


See Also

One-To-Many Form Wizard Step 1 - Select Parent Table Fields
One-To-Many Form Wizard Step 2 - Select Child Table Fields
One-To-Many Form Wizard Step 3 - Relate Tables
One-To-Many Form Wizard Step 5 - Sort Records
One-To-Many Form Wizard Step 6 - Finish


One-To-Many Form Wizard: Step 5 - Sort Records

See Also

Select the fields in the order that you would like to sort the records in the parent table. You can also choose an index tag.


See Also

One-To-Many Form Wizard Step 1 - Select Parent Table Fields
One-To-Many Form Wizard Step 2 - Select Child Table Fields
One-To-Many Form Wizard Step 3 - Relate Tables
One-To-Many Form Wizard Step 4 - Choose Form Style
One-To-Many Form Wizard Step 6 - Finish


One-To-Many Form Wizard: Step 6 - Finish

See Also

To view the form before you exit the One-To-Many Form Wizard, click the Preview button.

After you save the form with the wizard, you can open and modify it like any other form in the Form Designer.


See Also

One-To-Many Form Wizard Step 1 - Select Parent Table Fields
One-To-Many Form Wizard Step 2 - Select Child Table Fields
One-To-Many Form Wizard Step 3 - Relate Tables
One-To-Many Form Wizard Step 4 - Choose Form Style
One-To-Many Form Wizard Step 5 - Sort Records


One-To-Many Report Wizard

See Also

Creates a report that groups records from a parent table with records from a child table. The wizard prompts you with simple questions as you go through a brief series of steps, in which you specify the table and fields that you want to use to create controls on your report.

To run the One-To-Many Report Wizard

1	From the Wizards submenu on the Tools menu, choose Report.

2	In the Wizard Selection dialog box, choose One-To-Many Report Wizard.

Wizard Steps

Step 1 - Select Parent Table Fields

Step 2 - Select Child Table Fields

Step 3 - Relate Tables

Step 4 - Sort Records

Step 5 - Choose Report Style

Step 6 - Finish


See Also

Group/Total Report Wizard
Report Wizard
Wizards Overview


One-To-Many Report Wizard: Step 1 - Select Parent Table Fields

See Also

You can select fields from only a single table or view.


See Also

One-To-Many Report Wizard Step 2 - Select Child Table Fields
One-To-Many Report Wizard Step 3 - Relate Tables
One-To-Many Report Wizard Step 4 - Sort Records
One-To-Many Report Wizard Step 5 - Choose Report Style
One-To-Many Report Wizard Step 6 - Finish


One-To-Many Report Wizard: Step 2 - Select Child Table Fields

See Also

You can select fields from only a single table or view.


See Also

One-To-Many Report Wizard Step 1 - Select Parent Table Fields
One-To-Many Report Wizard Step 3 - Relate Tables
One-To-Many Report Wizard Step 4 - Sort Records
One-To-Many Report Wizard Step 5 - Choose Report Style
One-To-Many Report Wizard Step 6 - Finish


One-To-Many Report Wizard: Step 3 - Relate Tables

See Also

You can accept or select from the fields list the fields that determine the relationship between the tables.


See Also

One-To-Many Report Wizard Step 1 - Select Parent Table Fields
One-To-Many Report Wizard Step 2 - Select Child Table Fields
One-To-Many Report Wizard Step 4 - Sort Records
One-To-Many Report Wizard Step 5 - Choose Report Style
One-To-Many Report Wizard Step 6 - Finish


One-To-Many Report Wizard: Step 4 - Sort Records

See Also

Select the fields or index tags in the order that you would like to sort the records.


See Also

One-To-Many Report Wizard Step 1 - Select Parent Table Fields
One-To-Many Report Wizard Step 2 - Select Child Table Fields
One-To-Many Report Wizard Step 3 - Relate Tables
One-To-Many Report Wizard Step 5 - Choose Report Style
One-To-Many Report Wizard Step 6 - Finish


One-To-Many Report Wizard: Step 5 - Choose Report Style

See Also

When you click any of the styles, the wizard updates the graphic in the magnifying glass as an example of the style.


See Also

One-To-Many Report Wizard Step 1 - Select Parent Table Fields
One-To-Many Report Wizard Step 2 - Select Child Table Fields
One-To-Many Report Wizard Step 3 - Relate Tables
One-To-Many Report Wizard Step 4 - Sort Records
One-To-Many Report Wizard Step 6 - Finish


One-To-Many Report Wizard: Step 6 - Finish

See Also

If the number of fields that you have selected cannot fit on a single line within the width of your report, the fields will wrap to the following line. If you do not want the fields to wrap, clear Wrap fields that do not fit. Click the Preview button to view the report without exiting the wizard.

After you save the report, you can open and modify it like any other report in the Report Designer.


See Also

One-To-Many Report Wizard Step 1 - Select Parent Table Fields
One-To-Many Report Wizard Step 2 - Select Child Table Fields
One-To-Many Report Wizard Step 3 - Relate Tables
One-To-Many Report Wizard Step 4 - Sort Records
One-To-Many Report Wizard Step 5 - Choose Report Style


PivotTable Wizard

See Also

Creates pivot tables. Pivot tables are interactive worksheet tables that allow you to summarize and analyze data from existing tables. You can choose either to save a pivot table directly in Microsoft Excel or to add one as an object on a form.

You must have Microsoft Excel with Microsoft Query installed on your computer in order to create a pivot table. For more information about pivot tables, see Microsoft Excel Help.

To run the PivotTable Wizard

•	From the Wizards submenu on the Tools menu, choose PivotTable.

Wizard Steps

Step 1 - Select Fields

Step 2 - Layout

Step 3 - Finish


See Also

Wizards Overview


PivotTable Wizard: Step 1 - Select Fields

See Also

You can select fields from only a single table or view.


See Also

PivotTable Wizard Step 2 - Layout
PivotTable Wizard Step 3 - Finish


PivotTable Wizard: Step 2 - Define Layout

See Also

The pivot table will contain a column for each unique value in the field that you drag to the Columns box, and a row for each unique value in the field that you drag to the Rows box. If you drag a field to the Page box, the pivot table will contain a drop-down list from which you can select the different pages. There will be one page for each unique value that exists in the field you drag to the Page box.


See Also

PivotTable Wizard Step 1 - Select Fields
PivotTable Wizard Step 3 - Finish


PivotTable Wizard: Step 3 - Finish

See Also

If you select Create a Microsoft Excel pivot table, the wizard will display your finished pivot table in Microsoft Excel.

If you select Create a new form containing an embedded pivot table, the wizard will create a new form containing the embedded pivot table and open it in the Form Designer. Double-click the embedded object to modify it in the Form Designer.


See Also

PivotTable Wizard Step 1 - Select Fields
PivotTable Wizard Step 2 - Layout


Query Wizard

See Also

Creates a selection of records based on some rules you specify.

To run the Query Wizard

1	From the Wizards submenu on the Tools menu, choose Query.

2	In the Wizard Selection dialog box, select Query Wizard.

Wizard Steps

Step 1 - Select Fields

Step 2 - Relate Tables

Step 2a - Include Records

Step 3 - Filter Records

Step 4 - Sort Records

Step 4a - Limit Records

Step 5 - Finish


See Also

Cross-Tab Wizard
Graph Wizard
Local View Wizard
Remote View Wizard
Wizards Overview


Query Wizard: Step 1 - Select Fields

See Also

You can select fields from several tables or views. First, select fields from one table or view and move them to the Selected fields box; then select fields from another table or view and move those.


See Also

Cross-Tab Wizard
Graph Wizard
Local View Wizard
Query Wizard: Step 2 - Relate Tables
Query Wizard: Step 2a - Include Records
Query Wizard: Step 3 - Filter Records
Query Wizard: Step 4 - Sort Records
Query Wizard: Step 4a - Limit Records
Query Wizard: Step 5 - Finish
Remote View Wizard


Query Wizard: Step 2 - Relate Tables

See Also

You can select matching fields from the fields lists to determine the relationship between the tables or views.

For more information about relationships, see “Relating Tables” in Chapter 3, “Collecting Tables into a Database,” of the User’s Guide.


See Also

Cross-Tab Wizard
Graph Wizard
Local View Wizard
Query Wizard: Step 1 - Select Fields
Query Wizard: Step 2a - Include Records
Query Wizard: Step 3 - Filter Records
Query Wizard: Step 4 - Sort Records
Query Wizard: Step 4a - Limit Records
Query Wizard: Step 5 - Finish
Remote View Wizard


Query Wizard: Step 2a - Include Records

See Also

Limit your query by choosing only matching rows from both tables or all rows from either table. By default, only matching records are included.

If you want to create an inner join, select Only matching rows. If you want to create an outer join, select all the records from one of the two tables.


See Also

Cross-Tab Wizard
Graph Wizard
Local View Wizard
Query Wizard: Step 1 - Select Fields
Query Wizard: Step 2 - Relate Tables
Query Wizard: Step 3 - Filter Records
Query Wizard: Step 4 - Sort Records
Query Wizard: Step 4a - Limit Records
Query Wizard: Step 5 - Finish
Remote View Wizard


Query Wizard: Step 3 - Filter Records

See Also

You can reduce the number of records by creating expressions that filter records from the selected tables or views. You can create two expressions and connect them with And, which returns only records meeting both specified criteria, or Or, which returns records meeting either criteria.

Choose Preview to see the records that will be returned based on the supplied filter criteria.


See Also

Cross-Tab Wizard
Local View Wizard
Query Wizard: Step 1 - Select Fields
Query Wizard: Step 2 - Relate Tables
Query Wizard: Step 2a - Include Records
Query Wizard: Step 4 - Sort Records
Query Wizard: Step 4a - Limit Records
Query Wizard: Step 5 - Finish
Remote View Wizard


Query Wizard: Step 4 - Sort Records

See Also

Select up to three fields or an index tag to determine the order in which your query results will be sorted. Select Ascending to sort the results in ascending order, or Descending to sort them in descending order.


See Also

Cross-Tab Wizard
Local View Wizard
Query Wizard: Step 1 - Select Fields
Query Wizard: Step 2 - Relate Tables
Query Wizard: Step 2a - Include Records
Query Wizard: Step 3 - Filter Records
Query Wizard: Step 4a - Limit Records
Query Wizard: Step 5 - Finish
Remote View Wizard


Query Wizard: Step 4a - Limit Records

See Also

You can further limit the number of records in the view, based on either a percent of the records returned, or an actual number of records. For example, to see the top 10 items, choose Number of records and enter 10 in the Portion value box. Choose Preview to see the records returned based on the imposed limit.


See Also

Cross-Tab Wizard
Local View Wizard
Query Wizard: Step 1 - Select Fields
Query Wizard: Step 2 - Relate Tables
Query Wizard: Step 2a - Include Records
Query Wizard: Step 3 - Filter Records
Query Wizard: Step 4 - Sort Records
Query Wizard: Step 5 - Finish
Remote View Wizard


Query Wizard: Step 5 - Finish

See Also

After you save the query, you can open and modify it like any other query in the Query Designer.


See Also

Cross-Tab Wizard
Local View Wizard
Query Wizard: Step 1 - Select Fields
Query Wizard: Step 2 - Relate Tables
Query Wizard: Step 2a - Include Records
Query Wizard: Step 3 - Filter Records
Query Wizard: Step 4 - Sort Records
Query Wizard: Step 4a - Limit Records
Remote View Wizard


Remote View Wizard

See Also

Creates views using remote data (ODBC). You must have an existing database to store your view in as well as an existing data source or connection. If you do not have a database open, you are prompted to select an existing database or create one.

Before you run the Remote View Wizard, you can set options for remote view and connection defaults on the Remote Data tab of the Options dialog box. You can create connections in the Connection Designer.

To run the Remote View Wizard

1	From the Wizards submenu on the Tools menu, choose Query.

2	In the Wizard Selection dialog box, choose Remote View Wizard.

Wizard Steps

Step 1 - Choose Data Source

Step 2 - Select Fields

Step 3 - Relate Tables

Step 3a - Include Records

Step 4 - Sort Records

Step 5 - Filter Records

Step 6 - Finish

For more information about defining data sources, connections, or ODBC, see Chapter 1, “Installing Visual FoxPro,” in the Installation Guide or Chapter 6, “Querying and Updating Multiple Tables,” in the User's Guide.


See Also

Cross-Tab Wizard
Graph Wizard
Local View Wizard
Query Wizard
Wizards Overview


Remote View Wizard: Step 1 - Choose Data Source

See Also

The wizard lists the available ODBC data sources or existing connections on your computer. If the box is empty, you need to define your data sources and connections before you run the wizard. If your remote data source requires a password, you will be prompted for it when you click Next.


See Also

Cross-Tab Wizard
Graph Wizard
Local View Wizard
Query Wizard
Remote View Wizard: Step 2 - Select Fields
Remote View Wizard: Step 3 - Relate Tables
Remote View Wizard: Step 3a - Include Records
Remote View Wizard: Step 4 - Sort Records
Remote View Wizard: Step 5 - Filter Records
Remote View Wizard: Step 6 - Finish


Remote View Wizard: Step 2 - Select Fields

See Also

In the Tables box, the wizard lists the tables available from the data source you specified in the previous step. In the list of tables, you select a table, and then the wizard lists fields that are available from that table. You can select as many fields as you need and move them into the Selected fields box. If you want fields from another table, you can continue to select tables and select more fields.


See Also

Cross-Tab Wizard
Graph Wizard
Local View Wizard
Query Wizard
Remote View Wizard: Step 1 - Select Data Source
Remote View Wizard: Step 3 - Relate Tables
Remote View Wizard: Step 3a - Include Records
Remote View Wizard: Step 4 - Sort Records
Remote View Wizard: Step 5 - Filter Records
Remote View Wizard: Step 6 - Finish


Remote View Wizard: Step 3 - Relate Tables

See Also

To make sure that related records are matched appropriately in your view results, the wizard specifies a join between the tables in your view. The join is based on relationships established within your database.

If a relationship does not currently exist and the wizard could not suggest fields for a join, you need to choose the fields. Typically, tables include fields for this purpose and usually have the same name.

To specify a join, select the desired fields from the two drop-down list boxes and then choose Add. You must specify a join between the tables before moving on to the next step.


See Also

Cross-Tab Wizard
Graph Wizard
Local View Wizard
Query Wizard
Remote View Wizard: Step 1 - Select Data Source
Remote View Wizard: Step 2 - Select Fields
Remote View Wizard: Step 3a - Include Records
Remote View Wizard: Step 4 - Sort Records
Remote View Wizard: Step 5 - Filter Records
Remote View Wizard: Step 6 - Finish


Remote View Wizard: Step 3a - Include Records

See Also

The join specified in the previous step includes only records where the value in the field from the first table is the same as the value in the second table. Your tables probably store some records that do not match on that field.

If you want to include non-matching records with the matching records, you can choose other options in this step.


See Also

Cross-Tab Wizard
Graph Wizard
Local View Wizard
Query Wizard
Remote View Wizard: Step 1 - Select Data Source
Remote View Wizard: Step 2 - Select Fields
Remote View Wizard: Step 3 - Relate Tables
Remote View Wizard: Step 4 - Sort Records
Remote View Wizard: Step 5 - Filter Records
Remote View Wizard: Step 6 - Finish


Remote View Wizard: Step 4 - Sort Records

See Also

Select up to three fields to determine the order in which your view results will be sorted. Select Ascending to sort the view in ascending order, or Descending to sort the view in descending order.


See Also

Cross-Tab Wizard
Graph Wizard
Local View Wizard
Query Wizard
Remote View Wizard: Step 1 - Select Data Source
Remote View Wizard: Step 2 - Select Fields
Remote View Wizard: Step 3 - Relate Tables
Remote View Wizard: Step 3a - Include Records
Remote View Wizard: Step 5 - Filter Records
Remote View Wizard: Step 6 - Finish


Remote View Wizard: Step 5 - Filter Records

See Also

Limit the records in your view by creating filter expressions that select the records you want from the tables or views. Select a field and a comparison operator, and then type a value you want to search for. For example, if you want all of the records for the city of London, select the field for city names and type “London” in the Value box.

To use more than one filter, you can create two expressions and connect them with AND or OR. If you want to retrieve records that match both filters, use AND. If you want to retrieve records that match at least one of the filters, use OR.

Choose Preview to see the records that will be returned based on the filter you specified.


See Also

Cross-Tab Wizard
Graph Wizard
Local View Wizard
Query Wizard
Remote View Wizard: Step 1 - Select Data Source
Remote View Wizard: Step 2 - Select Fields
Remote View Wizard: Step 3 - Relate Tables
Remote View Wizard: Step 3a - Include Records
Remote View Wizard: Step 4 - Sort Records
Remote View Wizard: Step 6 - Finish


Remote View Wizard: Step 6 - Finish

See Also

You can preview the results of your view or you can choose one of the other options.

If you want to save the view in the database but do not want to browse the results or modify it in the View Designer, choose Save remote view. If you want to look at the records your view retrieves, choose Save remote view and browse. If you want to modify the view, choose Save remote view and modify it in the View Designer.


See Also

Cross-Tab Wizard
Graph Wizard
Local View Wizard
Query Wizard
Remote View Wizard: Step 1 - Select Data Source
Remote View Wizard: Step 2 - Select Fields
Remote View Wizard: Step 3 - Relate Tables
Remote View Wizard: Step 3a - Include Records
Remote View Wizard: Step 4 - Sort Records
Remote View Wizard: Step 5 - Filter Records


Report Wizard

See Also

Creates reports using one table. The wizard prompts you with simple questions as you go through a brief series of steps, in which you specify the table and fields that you want to use to create controls on your report.

To run the Report Wizard

1	From the Wizards submenu on the Tools menu, choose Report.

2	In the Wizard Selection dialog box, choose Report Wizard.

Wizard Steps

Step 1 - Select Fields

Step 2 - Choose Report Style

Step 3 - Define Report Layout

Step 4 - Sort Records

Step 5 - Finish


See Also

Group/Total Report Wizard
One-To-Many Report Wizard
Wizards Overview


Report Wizard: Step 1 - Select Fields

See Also

You can select fields from one table or view.


See Also

Report Wizard Step 2 - Choose Report Style
Report Wizard Step 3 - Define Report Layout
Report Wizard Step 4 - Sort Records
Report Wizard Step 5 - Finish


Report Wizard: Step 2 - Choose Report Style

See Also

When you click any of the styles, the wizard updates the graphic in the magnifying glass as an example of the style.


See Also

Report Wizard Step 1 - Select Fields
Report Wizard Step 3 - Define Report Layout
Report Wizard Step 4 - Sort Records
Report Wizard Step 5 - Finish


Report Wizard: Step 3 - Define Report Layout

See Also

When you specify a number of columns or select a layout option, the wizard updates the graphic in the magnifying glass as an example of the selection.


See Also

Report Wizard Step 1 - Select Fields
Report Wizard Step 2 - Choose Report Style
Report Wizard Step 4 - Sort Records
Report Wizard Step 5 - Finish


Report Wizard: Step 4 - Sort Records

See Also

Select the fields or an index tag in the order that you would like to sort the records.


See Also

Report Wizard Step 1 - Select Fields
Report Wizard Step 2 - Choose Report Style
Report Wizard Step 3 - Define Report Layout
Report Wizard Step 5 - Finish


Report Wizard: Step 5 - Finish

See Also

If the number of fields that you have selected cannot fit on a single line within the width of your report, the fields will wrap to the following line. If you do not want the fields to wrap, clear Wrap fields that do not fit. Click the Preview button to view the report without leaving the wizard.

After you save the report, you can open and modify it like any other report in the Report Designer.


See Also

Report Wizard Step 1 - Select Fields
Report Wizard Step 2 - Choose Report Style
Report Wizard Step 3 - Define Report Layout
Report Wizard Step 4 - Sort Records


Table Wizard

See Also

Creates tables based on typical table structures. The Table Wizard lets you select a table that fits your needs from the list of sample tables. You can customize the table’s structure and fields as you step through the wizard. You can also modify the table later after the wizard has saved the table.

If you have one or more databases open, the Table Wizard automatically adds the new table to the current database. If no databases are open, the wizard creates a free table.

To run the Table Wizard

•	From the Wizards submenu on the Tools menu, choose Table.

Wizard Steps

Step 1 - Select Fields

Step 2 - Modify Field Settings

Step 3 - Index the Table

Step 4 - Finish


See Also

Wizards Overview


Table Wizard: Step 1 - Select Fields

See Also

Click a table in the Sample tables box to see the fields you can add to your table. You can select fields from more than one table. If you want to add one of your own tables to the Sample tables box, choose Add.


See Also

Table Wizard: Step 2 - Modify Field Settings
Table Wizard: Step 3 - Index the Table
Table Wizard: Step 4 - Finish


Table Wizard: Step 2 - Modify Field Settings

See Also

Change field settings for the table you are creating. For example, you can change a character field’s maximum width.

Note   If you are creating a free table, you cannot change field captions.


See Also

Table Wizard: Step 1 - Select Fields
Table Wizard: Step 3 - Index the Table
Table Wizard: Step 4 - Finish


Table Wizard: Step 3 - Index the Table

See Also

Select the field that will be the primary index key in the new table. You can also designate other fields as secondary index keys.


See Also

Table Wizard: Step 1 - Select Fields
Table Wizard: Step 2 - Modify Field Settings
Table Wizard: Step 4 - Finish


Table Wizard: Step 4 - Finish

See Also

After you save the table, you can open it later and modify its structure like any other table in the Table Designer.

You can enter data into your new table by selecting Save table and browse it. Click Finish so that the new table will be displayed in a Browse window. Then choose Append New Record from the Table menu to add records to the table.


See Also

Table Wizard: Step 1 - Select Fields
Table Wizard: Step 2 - Modify Field Settings
Table Wizard: Step 3 - Index the Table


Documenting Wizard

See Also

The Documenting Wizard formats and produces text files from your code in projects and program files. For example, the wizard can indent your source code, capitalize reserved words and variables, and produce a report of the keywords in the program.

The wizard does not modify your code and only creates a text file to document the code. If you want the wizard to perform specific tasks, see Customizing the Documenting Wizard.

To run the Documenting Wizard

•	From the Wizards submenu on the Tools menu, choose Documenting.

Wizard Steps

Step 1 - Choose Source File

Step 2 - Set Capitalization

Step 3 - Set Indentation

Step 4 - Add Headings

Step 5 - Select Reports

Step 6 - Finish


See Also

Customizing the Documenting Wizard
Wizards Overview


Documenting Wizard: Step 1 - Choose Source File

See Also

You can enter the name of a project file or a specific program file. If you choose a project file, the Documenting Wizard documents all the programs in the project, including the event code for forms, class library code, and so on.


See Also

Customizing the Documenting Wizard
Step 2 - Set Capitalization
Step 3 - Set Indentation
Step 4 - Add Headings
Step 5 - Select Reports
Step 6 - Finish


Documenting Wizard: Step 2 - Set Capitalization

See Also

Allows you to choose how the Documenting Wizard should capitalize keywords and symbols in your code. Keywords are all the reserved words in the Visual FoxPro programming language, such as MODIFY. Symbols are the variables and names that you define in your code.

Options

UPPERCASE   Keywords and symbols are displayed in all uppercase letters. For example: ADDOBJECT and OMYFORM.

lowercase   Keywords and symbols are displayed in all lowercase letters. For example: addobject and omyform.

MixedCase   Keywords are displayed with the first letter of each “word” in the keyword capitalized. For example: AddObject.

Match first occurrence   Symbols are displayed according to the capitalization of the first occurrence in the file.

No change   Keywords and symbols are not modified.


See Also

Customizing the Documenting Wizard
Step 1 - Choose Source File
Step 3 - Set Indentation
Step 4 - Add Headings
Step 5 - Select Reports
Step 6 - Finish


Documenting Wizard: Step 3 - Set Indentation
Documenting Wizard Name: Step 3 - Set Indentation

See Also

Allows you to specify how the Documenting Wizard will indent lines in your program. The wizard can indent specific types of lines, and you can adjust how many spaces to use when indenting.

Options

Type of Indent    Choose whether the wizard should indent using tabs or spaces. To turn off indentation, choose No Change.

Spaces    If you are indenting using spaces, set the number of spaces used for each level of indentation.

Text to indent   Specify the type of line that the wizard should indent. Choices are Comments, Controls structures (such as loops, if blocks, and DO CASE structures), and statements that are split across multiple lines.


See Also

Customizing the Documenting Wizard
Step 1 - Choose Source File
Step 2 - Set Capitalization
Step 4 - Add Headings
Step 5 - Select Reports
Step 6 - Finish


Documenting Wizard: Step 4 - Add Headings

See Also

Allows you to specify whether the Documenting Wizards inserts headings into your programs. Headings are comments about the code that are relevant to the code they precede. They can be placed at the beginning of files, procedures, class definitions, and methods to make your formatted code easier to read.

Specify the type of code block for which you want to insert headings.


See Also

Customizing the Documenting Wizard
Step 1 - Choose Source File
Step 2 - Set Capitalization
Step 3 - Set Indentation
Step 5 - Select Reports
Step 6 - Finish


Documenting Wizard: Step 5 - Select Reports

See Also

Allows you to specify the types of reports that the Documenting Wizard creates. (The reports are actually text files.) The wizard can produce the types of reports listed in the following table.

Report Type	File Name	Remarks
Action Diagram	project.ACT	Shows the hierarchical relations within your code. If you are not working with ASCII code page 1250 and ANSI code page 1252, see the directive “*# document ACTIONCHARS” in Customizing the Documenting Wizard.
Cross-Reference	XREF.LST	Lists all the user-defined symbols.
File Listing	FILES.LST	Lists all the files in the project.
Source Code Listing	project.LST	Puts all formatted code in a single file.
Tree Diagram	TREE.LST	Shows the procedure calling tree.
The wizard also automatically creates the following files.

File Name	Description
FILES.DBF	Table with a record for each file in the project.
FDXREF.DBF	Table with a record for each instance of user symbols in the code.
FDXREF.DBF contains a field named Flag for identifying the keywords. The identifiers are the following.

Flag	Description
B	Base class
C	Class name
D	Defined PROC or FUNC (not method)
F	Function call: myproc( ) or DO myproc
K	Keyword
M	Method definition
N	Name of file
O	Object
P	Property of an object
R	User symbol reference
V	User symbols (variable) definition (PARA, PRIV, PUBL, DIME)


See Also

Customizing the Documenting Wizard
Step 1 - Choose Source File
Step 2 - Set Capitalization
Step 3 - Set Indentation
Step 4 - Add Headings
Step 6 - Finish


Documenting Wizard: Step 6 - Finish

See Also

By default, the wizard does not overwrite your existing files. Specify Overwrite existing files to overwrite your existing code files with the new ones that the wizard saves.

If you select the Place files in a single directory option and then click Finish, the wizard will prompt you to choose a single directory where it will save all the files that it creates.

If you select the Place files in a new directory tree and then click Finish, the wizard will prompt you to choose a directory where it will create a copy of the project’s source tree and save the new, formatted program files in the appropriate directories of the new tree.

When you select Cross-reference keywords, the wizard creates or adds to a table of keywords called FDXREF.DBF. After running the wizard, you can use the table to create reports of the keywords you are using in your application. The wizard adds one record to FDXREF.DBF for each instance a of Visual FoxPro keyword in your code.

When this option is selected the wizard matches keywords in your code with the first field, named Token, in the file FDKEYWRD.DBF. The second column, Code, in FDKEYWRD.DBF contains an identifier that tells the wizard how to treat the keyword when analyzing your code. The following table describes the identifier codes.

Code	Description
I	Indent
U	Undent (remove indent)
R	Reset indentation to 0 (or 1 if in DefineClass)
F	Proc or function
D	While or Case: DO clause
O	Object (Spinner, CommandButton)
P	Property (Scalemode, DecimalPoints)
M	Method (Init, KeyPress)
C	ClauseUsed only as a Clause: can't start a statement
Note   Depending on the size of your code, this option may enlarge FDXREF.DBF by a large number of records. Before running the wizard and choosing the option to create keyword cross-references, be sure you have enough disk space.


See Also

Customizing the Documenting Wizard
Step 1 - Choose Source File
Step 2 - Set Capitalization
Step 3 - Set Indentation
Step 4 - Add Headings
Step 5 - Select Reports


Customizing the Documenting Wizard

See Also

In addition to the options that you choose when running the Documenting Wizard, you can customize additional options outside the wizard.

Indentation in CASE Structures

By default, the wizard looks for indentation in a CASE structure like this:

DO CASE

CASE case1=1

case2=2

CASE case3=3

case4=4

ENDCASE

Some developers prefer to indent the lines between DO CASE and ENDCASE an additional level like this:

DO CASE

CASE case1=1

case2=2

CASE case3=3

case4=4

ENDCASE

If you indent your CASE structures like the second example, specify this in FDKEYWRD.DBF. To specify this coding style in FDKEYWRD.DBF change the value of the Code field to “UU” for the ENDCASE record.

Wizard Directives

You can place special directives in your code files that instruct the Documenting Wizard to perform specific tasks when analyzing the code.

You can place directives in:

•	Your project’s main program file to instruct the wizard how to analyze all code files in the project.

•	Individual code files to instruct the wizard how to analyze specific files.

The syntax of the directives begins with an asterisk so that Visual FoxPro will treat them as comments and ignore them when compiling programs. The directives are not case-sensitive. The syntax of the directives is:

*# document directive

It is a good idea to place the directives near the beginning of the main program file so that the Documenting Wizard encounters the instruction when it begins analyzing.

The Documenting Wizard directives are described below.

*# document ACTIONCHARS "abcdef"   By default, when the wizard creates an Action Diagram or a Tree Diagram, the wizard uses six characters that appear as lines and square corners when viewed under ASCII code page 1250 or under ANSI code page 1252 in FoxFont. Not all the characters map to line characters when viewed under other code pages. The six default characters and their corresponding FoxFont characters are listed below as a, b, c, d, e, and f.

abcdef	Default Chr( ) Value	As viewed in FoxFont
a	32	(space)
b	196
c	179
d	218
e	192
f	195
Tip   When using other code pages, insert the following code in your main program file to ensure that the lines in your diagrams map to line-like characters (the first character of the string enclosed in quotes is a space):

*# document ACTIONCHARS " -|+++"

For a list of supported code pages, see Code Pages Supported by Visual FoxPro.

*# document XREF cMode   Enables cross-referencing of variables. The default is ON.

CMode	Description
ON	Enables cross-referencing of variables
OFF	Disables cross-referencing of variables
SUSPEND	Disables cross-referencing of variables in the current file until the Documenting Wizard encounters the next instance of: *# document XREF ON
*# document EXPANDKEYWORDS cMode   Enables the expansion of keywords. For example, “DEFI WIND” would be expanded to “DEFINE WINDOW.” The default is OFF.

Warning   Not all keywords in Visual FoxPro begin with a unique string of four characters. For example, “REPL” could be short for“REPLACE” or “REPLICATE.” Be careful if you include this directive and choose to overwrite existing files.

cMode	Description
ON	Enables keyword expansion
OFF	Disables keyword expansion
SUSPEND	Disables keyword expansion in the current file until the next instance of: *# document EXPANDKEYWORDS ON
*# document XREFKEYWORDS cMode   This directive corresponds to the Cross-Reference Keywords option on “Step 6 - Finish” in the Documenting Wizard. The default is OFF.

CMode	Description
ON	Enables cross-referencing of keywords
OFF	Disables cross-referencing of keywords
SUSPEND	Disables cross-referencing of keywords in the current file until the next instance of: *# document XREFKEYWORDS ON
*# document ARRAYBRACKETS cMode   The default is OFF.

CMode	Description
ON	The Documenting Wizard assumes that square brackets are used for arrays and that parentheses are used for functions and methods.
OFF	The Documenting Wizard treats both square brackets and parentheses as arrays.
*# document ACTIONINDENTLENGTH nSpace   nSpace is the number of character spaces that you want the Documenting Wizard to use for indentation. The minimum value allowed is 2.


See Also

Documenting Wizard
Wizards Overview


Setup Wizard

See Also

The Setup Wizard creates distribution disks from the files in your distribution tree. To learn about the distribution process and how to prepare your distribution tree before running the Setup Wizard, see Chapter 26, “Creating Distribution Disks,” in the Developer’s Guide.

To run the Setup Wizard

•	From the Wizards submenu on the Tools menu, choose Setup.

Wizard Steps

Step 1 - Locate Files

Step 2 - Specify Components

Step 3 - Create Disk Image Directory

Step 4 - Specify Setup Options

Step 5 - Specify Default Destination Folder

Step 6 - Change File Settings

Step 7 - Finish


See Also

Wizards Overview


Setup Wizard: Step 1 - Locate Files

See Also

The directory that you specify for your distribution tree must contain all files and subdirectories you want to create in a user’s environment (except for Automation servers). The Setup Wizard uses this directory tree as the source for files that it will compress into the disk image subdirectories.

The wizard records the options you set for each distribution tree and uses them as default values the next time you create a setup routine from the same distribution tree.

Note   You cannot use the DISTRIB directory that the wizard creates as the directory for your distribution tree. Also, it is a good idea to place your source tree outside the Visual FoxPro directory.


See Also

Setup Wizard
Step 2 - Specify Components
Step 3 - Create Disk Image Directory
Step 4 - Specify Setup Options
Step 5 - Specify Default Destination Folder
Step 6 - Change File Settings
Step 7 - Finish


Setup Wizard: Step 2 - Specify Components

See Also

Select the system features your application uses and the operating systems on which users can install your application. The wizard will create a setup routine that includes all necessary system files for the system features you specify.

The following table lists the sizes of files that could be included with your setup routine.

Option	Size	Select this option if your application
Visual FoxPro 5.0 Runtime	3.5 MB	Requires the Visual FoxPro Runtime (VFP500.DLL) to execute. This .DLL will automatically be included with your application’s files, and will be installed correctly on the user’s computer.
Microsoft 5.0 Graph Runtime	2.2 MB	Includes forms that use Graph 5.0 controls.
ODBC Drivers	4.3 MB	Communicates with tables other than Visual FoxPro .DBFs. When you select this option the ODBC Drivers dialog box appears so that you can select the necessary drivers.
OLE servers	(varies)	Is a custom OLE server (Automation component) consisting of an .EXE or .DLL file. For details, see “Including an OLE Server,” below.
The sizes listed above represent the bytes used after the files have been installed on a user’s hard disk. When the user runs the setup these sizes might be slightly exaggerated.

Including an OLE Server

To include an OLE Server as part of the application to install, you must provide additional information for the Setup Wizard.

To include an OLE server

1	In Step 2 of the Setup Wizard, choose the option OLE Servers.

2	In the Add OLE Servers dialog box, choose Add.

3	In the Open dialog box, select the .EXE or .DLL file for the server, then choose OK. The server’s accompanying .TLB and .VBR (EXE only) files must be available in the same location as the file you select.

Note   The server file and its accompanying files can exist either inside or outside the distribution source directory.

4	If your OLE server is an .EXE file, you register it as a local or remote server. To do so, select it in the list of available servers, click Details to display the OLE Server Details dialog box, and then provide the following information:

•	Register as   Specifies whether the server should be registered as local or remote. A server registered locally will use a server installed on the user’s computer; a server registered remotely will use a server on another computer on the network.

•	Network Address   Specifies the network machine name where the remote server is located. Leave this setting empty if you want users to enter this information during installation.

•	Network Protocol   Specifies the protocol used for the remote connection. Leave this setting empty if you want users to enter this information during installation.

•	Authentication   Specifies the authentication for access to the computer where the remote server is located. This information is optional.

•	Install server locally   If the server is registered for remote use, this option also installs the server locally so that it can later be registered locally if the remote one is unavailable.

1	If you want the setup routine to register remote servers automatically, choose Install remote automation components.

2	Repeat Steps 2 through 4 for each server you want to include.

For each server you add, you can view the version information stamped in a server resource as set via the Build Options dialog when the server was built.

To view version about an OLE server

•	In the Add OLE Servers dialog box, select the server, then click Version.


See Also

Setup Wizard
Step 1 - Locate Files
Step 3 - Create Disk Image Directory
Step 4 - Specify Setup Options
Step 5 - Specify Default Destination Folder
Step 6 - Change File Settings
Step 7 - Finish


Setup Wizard: Step 3 - Create Disk Image Directory

See Also

The wizard creates a distribution subdirectory containing disk images for each type of disk you specify. If you select the Netsetup option, the wizard will create a single directory that will contain all the files.

You can create the disk image directory before you run the wizard. If you want the wizard to create the directory for you, type a directory name in the text box. If you have run the Setup Wizard before, the wizard uses the location you specified last time as the default.


See Also

Setup Wizard
Step 1 - Locate Files
Step 2 - Specify Components
Step 4 - Specify Setup Options
Step 5 - Specify Default Destination Folder
Step 6 - Change File Settings
Step 7 - Finish


Setup Wizard: Step 4 - Specify Setup Options

See Also

The Setup Wizard creates installation dialog boxes with the title you specify in the Setup dialog box caption box. It also places the copyright statement in the Copyright information dialog box that the user can access from the About command on the Setup application’s control menu. The Post-setup executable entry is optional.

Note   In order to advance to Step 5, you must move the insertion point outside the Setup dialog box caption and Copyright information boxes.


See Also

Setup Wizard
Step 1 - Locate Files
Step 2 - Specify Components
Step 3 - Create Disk Image Directory
Step 5 - Specify Default Destination Folder
Step 6 - Change File Settings
Step 7 - Finish


Setup Wizard: Step 5 - Specify Default Destination

See Also

The setup routine will place your application in the directory you specify in the Default directory box. Avoid selecting directory names that are already used by Windows programs (such as Visual FoxPro, Windows itself, and so on).

If you specify a name in the Program group box, the setup program will create a program group for your application when the user installs it, and will make the application available on the user’s Start menu.

By selecting options under User can modify, you can allow the user to change the names of the default directory and program group that the installation process creates.


See Also

Setup Wizard
Step 1 - Locate Files
Step 2 - Specify Components
Step 3 - Create Disk Image Directory
Step 4 - Specify Setup Options
Step 6 - Change File Settings
Step 7 - Finish


Setup Wizard: Step 6 - Change File Settings

See Also

The wizard lists your files in a grid. You can change the settings for any file by clicking the item that you want to change. The following table describes the settings displayed in each column.

Column	Description
File	Specifies the file name as it will be created on the user’s machine.
Target Dir	The file can be installed on the user’s machine in the Application directory, Windows directory, or Windows System directory.
PM Item	If you select this option, the wizard displays the Program Manager Item dialog box so you can specify program item properties: description, command line, and icon. In the command line, you can use an embedded %s sequence to replace the application directory. The “s” must be lowercase. Use the %s sequence when you install files in application subdirectories. This ensures that files will be installed in the correct subdirectory in case your users specify a name for the application directory other than the default name. In the following example, MYDATA.DBF is installed in the MAINDATA subdirectory of the application directory: %s\MAINDATA\MYDATA.DBF If you specify an icon that is outside your source tree, the setup routine will install the icon in your application directory.
ActiveX	If you select this option, the installation process will register ActiveX controls during setup on a user’s machine. This does not register a design-time license for the control on the user’s machine. It is a good idea to have your setup register ActiveX controls to ensure that your user always uses the correct version of the control.
Visual FoxPro allows an ActiveX control to be created or instantiated only if the control and its license have been purchased and installed on your machine. License information is saved with the form or class that allows distributed forms to run successfully on users’ machines. Users will not be able to modify these forms at design time unless they also purchase a design-time license from the control’s vendor.

You may distribute visual class libraries that contain ActiveX controls. New controls based on these visual classes may be added to running forms. Users may not modify these visual classes, create controls based on them, or subclass them.

ActiveX controls may be developed and distributed without charge or licensing requirements. However, most will be designed so that they fail without a license. There are currently two types of licenses for ActiveX controls: design-time and run-time. A design-time license allows you to create new ActiveX controls. A run-time license allows you to run a form that contains an ActiveX control.

 For more information about distributing applications with ActiveX controls, see “Including ActiveX Components,” in Chapter 25, “Building an Application for Distribution,” in the Developer’s Guide.


See Also

Setup Wizard
Step 1 - Locate Files
Step 2 - SpecifyComponents
Step 3 - Create Disk Image Directory
Step 4 - Specify Setup Options
Step 5 - Specify Default Destination Folder
Step 7 - Finish


Setup Wizard: Step 7 - Finish

See Also

When you choose Finish, the wizard records the configuration for use the next time you create distribution disks from the same distribution tree. It then starts creating the application disk images.

The wizard creates and compresses several unique files the first time it runs. This step causes the first execution of the wizard to consume more time than subsequent executions. The wizard saves these files to use whenever you use the Setup Wizard again.

After the wizard creates the disk images you specified, you can copy the images to master disks, and then copy and combine the disks with the rest of your distribution package. After you create a set of master disks, you can delete the disk image subdirectories. Retain the COMPRESS subdirectory so that if you use the Setup Wizard to create a new set of distribution disks, the wizard will only need to compress files you’ve changed since you created the previous set of disks.


See Also

Setup Wizard
Step 1 - Locate Files
Step 2 - Specify Components
Step 3 - Create Disk Image Directory
Step 4 - Specify Setup Options
Step 5 - Specify Default Destination Folder
Step 6 - Change File Settings


SQL Server Upsizing Wizard

See Also

The SQL Server Upsizing Wizard creates a SQL Server database that duplicates, as much as possible, the functionality of Visual FoxPro database. You can use the SQL Server Upsizing Wizard to:

•	Move local data to a remote server.

•	Transform local base tables and local views into remote base tables and remote views.

•	Migrate a local application to a client/server application.

For more documentation related to the SQL Server Upsizing Wizard, including a preview of information you might want to gather before using the wizard, see Chapter 20, “Upsizing Visual FoxPro Databases,” in the Developer’s Guide.

Note   Upsizing can take a long time, depending on the size of your data, the amount of network traffic and the number of concurrent demands being handled by your server. Large tables may require several hours to upsize.

To run the SQL Server Upsizing Wizard

1	From the Wizards submenu on the Tools menu, choose Upsizing.

2	In the Wizard Selection dialog box, choose SQL Server Upsizing Wizard.

Wizard Steps

Step 1 - Select Local Database

Step 2 - Select Data Source

Step 3 - Choose Tables

Step 4 - Map Field Data Types

Step 5 - Select Target Database

Step 6 - Set Database Properties

Step 7 - Specify Log Properties

Step 8 - Set Upsizing Options

Step 9 - Finish


See Also

Wizards Overview


SQL Server Upsizing Wizard: Step 1 - Local Database Selection
SQL Server Upsizing Wizard: Step 1 - Select Local Database

See Also

In the first step, you choose which local database you want to upsize.

Options

Database to upsize   Lists the currently open databases. Select the database to you want to upsize. If you don’t have a database open, choose the Open button to select and open a database.


See Also

SQL Server Upsizing Wizard
Step 2 - Select Data Source
Step 3 - Choose Tables
Step 4 - Map Field Data Types
Step 5 - Select Target Database
Step 6 - Set Database Properties
Step 7 - Specify Log Properties
Step 8 - Set Upsizing Options
Step 9 - Finish


SQL Server Upsizing Wizard: Step 2 - Date Source Selection
SQL Server Upsizing Wizard: Step 2 - Select Data Source

See Also

In this step, you specify options to select the ODBC SQL Server data source or named connection you want to use.

Options

ODBC data sources   Choose this option button to display SQL Server ODBC data sources. When selected, the adjoining list is titled Available data sources.

Connections   Choose this option button to display connections stored in the open database that connect to SQL Server data sources. When selected, the adjoining list is titled Existing connections.

Available data sources   Lists the ODBC data sources that connect to the SQL Server. This list is displayed when the ODBC data sources option button is selected. The Available Data Sources list box lists SQL Server data sources.

Note   The words “SQL Server” must appear in the data source name for Visual FoxPro to identify the data source as a SQL Server data source. If your data source uses a third-party driver to connect to SQL Server, it might not be identified as a SQL Server data source. Use the All checkbox to display all data sources that are not explicitly identified with the “SQL Server” keywords in the title.

Existing connections   Lists the connections stored in the open database that connect to SQL Server data sources. This list is displayed when the Connections option button is selected. The Existing connections list box lists named connections that connect to SQL Server data sources.

All   Lists all connections or all ODBC data sources available on your system whose titles either explicitly include a known SQL Server-related keyword, are not explicitly identified as a non-SQL Server data sources or connections, and are not Microsoft Desktop Drivers. The list displayed depends upon whether you have the ODBC data sources or the Connections option button selected.

The SQL Server Upsizing Wizard uses the data source or connection you chose to determine which database to display as a possible destination database in Step 5. If the connection does not specify a database, the wizard displays the database that is the default for the data source.

Next   Connects to SQL Server and displays the SQL Server Login dialog box. If you used a named connection with a saved password, the wizard logs you on to the SQL Server you’ve selected without prompting you for ODBC login information.

Using a Named Connection

If you use a named connection to access your data source, the SQL Server Upsizing Wizard associates the named connection with any remote views it creates during upsizing. If the connection definition includes a password, the “Save Password With View” option in Step 8 of the SQL Server Upsizing Wizard is automatically checked for you and disabled; this prevents the password from being removed from the connection definition.

Using a Data Source

If you use a data source name rather than a connection name to log on to the data source, and you choose to have the wizard create remote views, the SQL Server Upsizing Wizard creates a named connection called “Upsize” (or “Upsize2,” “Upsize3,” and so on, if a connection definition exists with the suggested name).


See Also

SQL Server Upsizing Wizard
Step 1 - Select Local Database
Step 3 - Choose Tables
Step 4 - Map Field Data Types
Step 5 - Select Target Database
Step 6 - Set Database Properties
Step 7 - Specify Log Properties
Step 8 - Set Upsizing Options
Step 9 - Finish


SQL Server Upsizing Wizard: Step 3 - Target Database
SQL Server Upsizing Wizard: Step 3 - Choose Tables

See Also

In this step you select the Visual FoxPro tables you want to export to SQL Server.

Options

Available tables   Lists all the tables stored in the database you’ve chosen to upsize.

Selected tables   Lists the tables you’ve chosen to upsize into the database on the server.

You must select at least one table, and you can choose the >> button to export all tables.

When you choose Next, the SQL Server Upsizing Wizard reads the list of tables you’ve selected to upsize and tries to open those tables for exclusive use in the database you choose to upsize. Any tables that can’t be opened exclusively won’t be available to upsize. The tables are opened exclusively to prevent other users from changing the data in the tables during the upsizing process, which helps to ensure the accuracy of exported data. If any tables are already open and shared, the wizard closes them and then reopens them exclusively; this might cause you to lose any temporary relations established with the SET RELATION or SET SKIP commands.

Choosing Tables to Export

It’s very important to choose the tables you export carefully, as this choice has a significant impact on the performance of your application. Exporting all tables might result in excessive (and slow) server queries. A well-designed client/server database usually consists of a mix of local and remote tables.

In general, keep tables which change rarely or infrequently in your local database, such as a table of state names and abbreviations. Export tables that change frequently and are accessed by many users, such as a table of orders.

The SQL Server Upsizing Wizard exports the table’s field names, data types, and data. For information about storing tables in the best location, see Chapter 19, “Designing Client/Server Applications,” in the Developer’s Guide. For information on optimizing client/server applications, see Chapter 22, “Optimizing Client/Server Performance,” in the Developer’s Guide.


See Also

SQL Server Upsizing Wizard
Step 1 - Select Local Database
Step 2 - Select Data Source
Step 4 - Map Field Data Types
Step 5 - Select Target Database
Step 6 - Set Database Properties
Step 7 - Specify Log Properties
Step 8 - Set Upsizing Options
Step 9 - Finish


SQL Server Upsizing Wizard: Step 4 - Database Device (SQL Server)
SQL Server Upsizing Wizard: Step 4 - Map Field Data Types

See Also

In this step, Visual FoxPro displays the default data type mappings used to convert local data to remote data, as tables are upsized to the server. You can choose to change these default mappings.

You can’t change the default mapping for a key field to a data type that prevents the field from being indexed. You can change the default mapping of a field that is part of an index key if you choose a data type that is indexable; however, you might want to change the data types for the other fields in the key to match. Visual FoxPro warns you if you change the default data type mapping for a field that is not a key field but is used in a Visual FoxPro index. If you make a mistake, click Default to reset the data types.

Options

Table   Select the table whose fields you want to map from the list of all the tables you’ve chosen to upsize.

Timestamp column   Select this checkbox to add a timestamp column to the server version of the table.

Identity column   Select this check box to add an identity column to the server version of the table.

Default   Choose this button to reset all table field settings for all fields in the selected table back to their defaults. This button in effect undoes any changes you have entered for a specific table in Step 4.

Field Name   Lists the fields contained in the table you selected in the Table list.

FoxPro Type   Lists the Visual FoxPro data type for the field.

Server Type   Lists the server data type to which Visual FoxPro data in this field will be mapped when the table is copied to the server. Click in this field to display a drop-down list from which you can select a different server data type.

Width   Specifies the width of the field.

Precision   Specifies the decimal precision of the field, when applicable.

Creating Timestamp Columns

A SQL Server timestamp column contains a unique value, generated by SQL Server, that is updated whenever the server record is updated. Using a timestamp field on an updatable remote table can increase performance and reliability.

If you update fields using the Visual FoxPro SQL WhereType values DB_KEYANDMODIFIED or DB_KEYANDUPDATABLE, Visual FoxPro must check all modified or all updatable fields to determine whether they were changed by another user. Because text or image fields can be many megabytes in size, comparing these fields for changes can be network-intensive and time-consuming, thereby reducing performance. Reliability can also be affected, because converting the value of a floating point field between client and server might cause the value to appear to have changed when it has not.

When you add a timestamp field to a remote table and update using the SQL WhereType value DB_KEYANDTIMESTAMP, Visual FoxPro uses only the value in the timestamp field to determine whether a record has been changed before updating it. Because Visual FoxPro can compare the value in the timestamp field more quickly than it can evaluate the contexts of large text or image fields, you can increase performance on remote data. However, if you use the SQL WhereType value DB_KEYANDTIMESTAMP, any change in the remote record is recognized as an update conflict, whether or not the changed remote field is in the list of fields you’ve set as modifiable in your remote view.

If you prefer to update fields using the Visual FoxPro SQL WhereType values DB_KEYANDMODIFIED, you might improve performance by setting the remote view’s Compare Memo property to false (.F.). When CompareMemo is set to false, Memo fields are removed from the list of remote view fields compared against the data in the remote server row.


See Also

SQL Server Upsizing Wizard
Step 1 - Select Local Database
Step 2 - Select Data Source
Step 3 - Choose Tables
Step 5 - Select Target Database
Step 6 - Set Database Properties
Step 7 - Specify Log Properties
Step 8 - Set Upsizing Options
Step 9 - Finish


SQL Server Upsizing Wizard: Step 5 - Log Device (SQL Server)
SQL Server Upsizing Wizard: Step 5 - Select Target Database

See Also

In this step you select the database on the data source server to which you want to copy tables.

After you have connected to a server and have chosen a data source, the tables you want to upsize, and the field data type mapping, you can use an existing database or create a new database as the destination for your upsized local database. If you chose a named connection in Step 2, you can use the database named in the connection or create a new database as the destination.

Options

Available databases on ‘database name’   This list is displayed when you select the Existing option button to add Visual FoxPro tables to an existing SQL Server database. Select the database into which you want to copy Visual FoxPro tables when you upsize.

New database name   This text box is displayed when the New option button is selected. Enter a name for the new database you want to create on the remote server to which you are upsizing. The name can be up to 30 characters in length and can include letters, digits, and the symbols #, $, and _. Spaces are not allowed.

If you upsize to an existing database, the wizard jumps to Step 8.


See Also

SQL Server Upsizing Wizard
Step 1 - Select Local Database
Step 2 - Select Data Source
Step 3 - Choose Tables
Step 4 - Map Field Data Types
Step 6 - Set Database Properties
Step 7 - Specify Log Properties
Step 8 - Set Upsizing Options
Step 9 - Finish


SQL Server Upsizing Wizard: Step 6 - Tables to Upsize
SQL Server Upsizing Wizard: Step 6 - Set Database Properties

See Also

If you chose to create a new SQL Server database in Step 5, the wizard displays this step to enable you to select the database device and size for your database. You can choose to create your new SQL Server database on an existing device, or create a new device.

Selecting an Existing Device

Database device   Displays all the devices on the SQL Server you logged on to, including default devices. Select a device with sufficient free space for your database.

Default Devices

If one or more devices have been set as default devices on your SQL Server, the SQL Server Upsizing Wizard includes a Default entry in the list of available devices. The Default entry can represent more than one device. Choosing the default device does not ensure you’ll have enough room to upsize your database. The SQL Server Upsizing Wizard checks the devices specified as default to make sure there’s enough room for the database.

Tip   To place your database on multiple devices, make those devices (and no others) default devices. When you run the SQL Server Upsizing Wizard, select Default for your database.

For more information on setting the default status of devices, see your SQL Server documentation for a description of the sp_diskdefault system procedure.

Size   Displays the size in MB of the database device selected in the adjoining Database Device list box.

Free Space   Displays the amount of free space remaining on the database device selected in the Database Device list box.

Database size   Enter the amount of space, in MB, you want to allocate for the new database. The size of a new database must be at least 2 MB because that is the minimum allowed by SQL Server.

Creating a New Device

If existing devices are too full, you might want to create a new device. You must be a system administrator to create new SQL Server devices.

To create a new SQL Server device

1	Select Create new device from the list of devices.

If you are a system administrator, a dialog box appears. Otherwise, an error message appears.

2	Type a name for the new device.

The device name must be 30 characters or less and consist of letters, digits, and the symbols #, $, or _. Spaces are not allowed.

3	Choose OK.

The new device name is added to the devices list box.

4	Type a device size.

The device size must be at least 2 MB. The combined size of new devices cannot exceed available disk space.

If you are a system administrator, the SQL Server Upsizing Wizard displays the amount of space on the server drive storing the Master SQL Server database.

Important   The size of a device cannot be changed once it has been set. Make sure you create sufficiently large devices.

The selected new device is created after you choose the Finish button. The SQL Server Upsizing Wizard creates the new device in the same directory as the Master database device. If you add a new device to the list but don’t select the new device as the database device, the new device is not created.

The SQL Server Upsizing Wizard can generate a report that includes the logical name, physical name, and other information about new devices you create.

Device Number Limitations

Every SQL Server device is given a number when it is created. However, the available pool of device numbers is limited. The default value is 10, although the number might be different on your server. The SQL Server Upsizing Wizard searches for an available device number. If all device numbers are taken, you won’t be able to create a new device.

Note   To increase the number of SQL Server device numbers available, see your SQL Server documentation for a description of the sp_configure system procedure.


See Also

SQL Server Upsizing Wizard
Step 1 - Select Local Database
Step 2 - Select Data Source
Step 3 - Choose Tables
Step 4 - Map Field Data Types
Step 5 - Select Target Database
Step 7 - Specify Log Properties
Step 8 - Set Upsizing Options
Step 9 - Finish


SQL Server Upsizing Wizard: Step 7 - Field Data Types
SQL Server Upsizing Wizard: Step 7 - Specify Log Properties

See Also

In this step you can specify the size and device to store a transaction log. A transaction log is created for your database by SQL Server, and can be used to reconstruct the database in the event of a serious system problem.

Options

Log Device   Displays a list of log devices on the remote server. Select the device you want to use for the transaction log.

Ideally, a database and its corresponding log should be placed on devices that are on separate physical disks. These devices must be created before you start the SQL Server Upsizing Wizard, as the wizard creates all new devices on the same physical disk — the disk where the master database device resides.

If you have only one physical disk, you should place the database and its log on separate devices, so that you can use the SQL server DUMP TRANSACTION command.

Size   Displays the size in MB of the database device selected in the adjoining Log Device list box.

Free Space   Displays the amount of free space remaining on the log device selected in the Log Device list box.

Log Size   Enter the amount of space, in MB, you want to allocate for the transaction log. For more information on how to determine the log size you need, see “Specifying Log Size” in this topic.

Database Size   Displays the amount of space allocated for the new database in Step 6.

Specifying Log Size

As a general guideline, you allocate 10 to 20 percent of the size of the new SQL Server database; this guideline is dependent upon a number of considerations that are discussed in your SQL Server documentation.

You can enter a value of 0 for the log size, which causes the wizard to place the log (a table called syslogs) on the same device as the database. When the log size is set to 0, the log consumes the minimum amount of space on the server, but also fills up very quickly.

When you upsize to a new database, the SQL Server Upsizing Wizard dumps the transaction log every time it fills up. The dump makes a backup copy of a database and its transaction log in a form that can be read in with LOAD DATABASE. For more information on the SQL Server DUMP TRANSACTION command and on estimating the amount of space to allocate for a transaction log, see your SQL Server documentation.

Note   You can increase the size of a log or move it to a new device. For details, see your SQL Server documentation for a description of the ALTER DATABASE command and the sp_logdevice system procedure.


See Also

SQL Server Upsizing Wizard
Step 1 - Select Local Database
Step 2 - Select Data Source
Step 3 - Choose Tables
Step 4 - Map Field Data Types
Step 5 - Select Target Database
Step 6 - Set Database Properties
Step 8 - Set Upsizing Options
Step 9 - Finish


SQL Server Upsizing Wizard: Step 8 - Upsizing Options
SQL Server Upsizing Wizard: Step 8 - Set Upsizing Options

See Also

In Step 8, you can control how the SQL Server Upsizing Wizard exports your tables. You can also specify the changes you want the SQL Server Upsizing Wizard to make to the local database. You can create upsizing reports, redirect views to use remote data, create new remote views on tables that are upsized, and save passwords with views.

Specifying Table Attributes to Upsize

By default, the SQL Server Upsizing Wizard exports a table’s structure and its data. Along with field names and data types, you can also export:

•	Indexes

•	Defaults

•	Relationships (referential integrity constraints)

•	Validation rules

The SQL Server Upsizing Wizard can export additional table properties and create timestamp columns on certain SQL Server tables. The SQL Server Upsizing Wizard can also modify your Visual FoxPro database so that your queries, forms, and reports use the data in your new SQL Server tables, rather than the data in the local Visual FoxPro database.

Visual FoxPro indexes and defaults become SQL Server indexes and defaults. If you choose to export validation rules, the SQL Server Upsizing Wizard attempts to export field- and row-level validation rules to SQL Server, where they become stored procedures called from SQL Server triggers. Exported table relationships also become part of the triggers.

Tip   If you export table relationships, be sure to export indexes as well or you might experience mediocre performance.

Options

Table Attributes to Upsize

Indexes   Select to upsize Visual FoxPro .CDX indexes.

Defaults   Select to upsize default values for table fields.

Relationships   Select to upsize relationships stored in the database you are upsizing.

Use declarative referential integrity   Enabled when upsizing to a SQL Server version 6.x database. Select to create SQL constraints to enforce referential integrity.

Validation rules   Select to upsize field and table validation rules.

Structure only, no data   Select to upsize the empty table structure, without copying table data to the SQL Server data source.

Changes to Make Locally

Create upsizing report   Creates a series of reports documenting the results of the upsizing process.

Redirect views to remote data   Changes the definition of local views in the database you are upsizing to remote views that use the upsized server tables as base tables. Your queries, forms, and reports then use views on the data in the new SQL Server data source rather than the original Visual FoxPro data.

Create remote views on tables   When you upsize a local table, you need a remote view to access the upsized table on the remote server. The SQL Server Upsizing Wizard can create new, remote views as you upsize. As the SQL Server Upsizing Wizard creates new remote views, it renames all local versions of tables by adding the suffix “_local” to the table name.

Note   Creating remote views on tables as you upsize is not recommended, because these unoptimized views select all the data in the table rather than selecting only the information your application needs. The preferred method is to create parameterized views. You can either create a local parameterized view, which you then upsize by choosing Redirect views to remote data, or create a new parameterized remote view on the table after you’ve completed the upsizing process. For information on creating parameterized views, see Chapter 8, “Creating Views,” in the Developer’s Guide.

Save password with views   By default, you must enter your password and login ID when opening a remote view in a new session with Visual FoxPro. Select this option to store your password locally with the remote view definition in your database.

Note   This checkbox is automatically checked for you and disabled if you used a named connection in Step 2 - Select Data Source to access your data source, and that named connection includes a password. This prevents the password from being removed from the connection definition.

Creating Upsizing Reports

When you select Create Upsizing Report, Visual FoxPro generates upsizing reports that document the tables, views, fields, indexes, and referential integrity constraints the SQL Server Upsizing Wizard creates on SQL Server. The SQL Server Upsizing Wizard places the reports in a new project, using the following report names:

•	RptErrors

•	RptField

•	RptIndex

•	RptRels

•	RptTable

•	RptViews

The upsizing reports include information about any devices and databases that are created, information about any errors encountered during the upsizing process, and a complete explanation of the way in which each Visual FoxPro object is mapped to a SQL Server object. You can view or print these reports after upsizing is complete.

Upsizing All Tables Used By a Local View

If you upsize all the tables used by a local view, the local view is renamed by adding the suffix “_local” to the existing local view name. The SQL Server Upsizing Wizard creates a new view based on the SQL statement of the local view, substituting the remote table names for the local table names. The KeyField and other update properties of the view are preserved.

Upsizing Some of the Tables Used By a Local View

If you upsize only some of the tables used by a local view, the SQL Server Upsizing Wizard does not rename the local views. Instead, it renames the Visual FoxPro tables you export with the suffix “local.” For example, if you export a table named “Employees,” the table is renamed “Employees_local” in your database. The SQL Server Upsizing Wizard then creates a remote view for each of the tables you exported. Each view selects all fields and all records from the remote table.

Note   Visual FoxPro handles local and remote data in different ways. The data access design of an application using local data may become very inefficient when applied as-is to remote data.


See Also

SQL Server Upsizing Wizard
Step 1 - Select Local Database
Step 2 - Select Data Source
Step 3 - Choose Tables
Step 4 - Map Field Data Types
Step 5 - Select Target Database
Step 6 - Set Database Properties
Step 7 - Specify Log Properties
Step 9 - Finish


SQL Server Upsizing Wizard: Step 9 - Finish

See Also

In the final step, you can choose to:

•	Upsize without generating SQL code.

•	Only generate SQL code for upsizing.

•	Upsize and generate SQL code.

Options

Upsize   Select to begin creating databases and tables, as applicable, on the remote server.

Save generated SQL   Select to have the upsizing wizard generate the SQL script necessary to upsize your database and then stop without beginning to create databases and tables on your remote server.

You can use this option to provide a SQL upsizing script that you then customize to meet the needs of your application. Once you’ve modified and saved the SQL script, you then run the script to complete the upsizing process. This two-step process provides tremendous flexibility, allowing you to use Visual FoxPro to generate the large majority of the code you’ll need, yet providing a method for fine tuning the upsized installation.

Upsize and save generate SQL   Select to upsize your database and save the SQL script generated by the wizard.

To upsize your database

1	Select the upsizing option you want.

2	Choose the Finish button.

The SQL Server Upsizing Wizard creates devices and databases if necessary, and begins exporting Visual FoxPro objects to SQL Server.

The first and third upsizing options are available only if you have CREATE TABLE permission on the server. If you choose either of the options that save generated SQL code, all the SQL code generated by the SQL Server Upsizing Wizard is stored on your hard disk.

Note   Upsizing can take a long time, depending on the size of your data, the amount of network traffic, and the number of concurrent demands being handled by your server. Large tables can require several hours to export.

Troubleshooting

If any errors occur while the SQL Server Upsizing Wizard is exporting data, you are asked whether you want to save error information. If you choose to save error information, an error report is generated.

Most upsizing errors occur because there isn’t enough space on your server’s database or log device, or because your remote database is not large enough to accept the data you’re exporting to the server. Make sure that you select devices with ample free space and that you set your database size sufficiently high.

Database or Log Full

The SQL Server Upsizing Wizard runs out of space and stops if the SQL database you selected or created is too small. To resolve these problem, you can increase the space for the database or the log. These solutions can involve dropping (removing) the database or the log from the upsizing process.

To increase the space for a new database or log

1	Drop the database.

2	If the SQL Server Upsizing Wizard changed the names of any local tables, restore tables to their original names by:

•	Copying your backup version of your local database’s .DBC file onto your system, overwriting the altered .DBC file.

 – Or –

•	Renaming local tables to their original names.

1	When you run the SQL Server Upsizing Wizard again, specify a larger database or log size.

To increase the space for an existing database

1	Increase the size of the database.

2	If the SQL Server Upsizing Wizard changed the names of any local tables, rename them to their original names.

3	Run the SQL Server Upsizing Wizard again.

To increase the space for an existing log

1	Increase the size of the log.

 – Or –

Dump the transaction log.

2	If the SQL Server Upsizing Wizard changed the names of any local tables, rename them with their original names.

3	Run the SQL Server Upsizing Wizard again.

You should overwrite tables from the previous partial upsizing to make sure all table relationships are created.

For information on increasing the database or log size, see the ALTER DATABASE command in your SQL Server documentation.

For information on dumping the transaction log, see the DUMP TRANSACTION command in your SQL Server documentation.

Device Full

The device on which a database or log is located can fill up. You can extend the database or log to another device using the ALTER DATABASE command or the SQL Server Administrator, or you can create a larger device.

To create a larger device

1	Drop the device.

2	Restart SQL Server.

3	Create a larger device.

Caution   Dropping a device deletes all databases and logs on the device, not just the database to which you are upsizing.

You can use the sp_dropdevice system procedure to drop a device. For more information, see your SQL Server documentation.


See Also

SQL Server Upsizing Wizard
Step 1 - Select Local Database
Step 2 - Select Data Source
Step 3 - Choose Tables
Step 4 - Map Field Data Types
Step 5 - Select Target Database
Step 6 - Set Database Properties
Step 7 - Specify Log Properties
Step 8 - Set Upsizing Options


Oracle Upsizing Wizard

See Also

The Oracle Upsizing Wizard creates an Oracle database that duplicates, as much as possible, the functionality of Visual FoxPro database. You can use the Oracle Upsizing Wizard to:

•	Move local data to a remote server.

•	Transform local base tables and local views into remote base tables and remote views.

•	Migrate a local application to a client/server application.

To run the Oracle Upsizing Wizard

1	From the Wizards submenu on the Tools menu, choose Upsizing.

2	In the Wizard Selection dialog box, choose Oracle Upsizing Wizard.

Wizard Steps

Step 1 - Select Local Database

Step 2 - Select Data Source

Step 3 - Choose Tables

Step 4 - Map Field Data Types

Step 5 - Select Tablespaces

Step 6 - Select Tablespace Files

Step 7 - Specify Clusters

Step 8 - Specify Cluster Tables

Step 9 - Specify Cluster Key

Step 10 - Set Upsizing Options

Step 11 - Finish


See Also

Wizards Overview


Oracle Upsizing Wizard: Step 1 - Select Local Database

See Also

In the first step, you choose which local database you want to upsize. If you don’t have a database open, choose Open to select and open a database.


See Also

Oracle Upsizing Wizard
Step 2 - Select Data Source
Step 3 - Choose Tables
Step 4 - Map Field Data Types
Step 5 - Select Tablespaces
Step 6 - Select Tablespace Files
Step 7 - Specify Clusters
Step 8 - Specify Cluster Tables
Step 9 - Specify Cluster Key
Step 10 - Set Upsizing Options
Step 11 - Finish


Oracle Upsizing Wizard: Step 2 - Select Data Source

See Also

In this step, you specify options to select the ODBC Oracle data source or named connection you want to use.

Dialog Box Options

ODBC data sources   Choose this option button to display Oracle ODBC data sources. When selected, the adjoining list is titled Available data sources.

Connections   Choose this option button to display connections stored in the open database that connect to Oracle data sources. When selected, the adjoining list is titled Existing connections.

Available data sources   Lists the ODBC data sources that connect to Oracle. This is list is displayed when the ODBC data sources option button is selected. The Available data sources list box lists Oracle data sources. If you have other ODBC data sources or named connections, they aren’t displayed unless you also select the All checkbox.

Note   The word “Oracle” must appear in the data source caption for Visual FoxPro to identify the data source as an Oracle data source. If your data source uses a third party meta driver to connect to Oracle, it might not be identified as an Oracle data source. Use the All checkbox to display data sources that are not explicitly identified with the “Oracle” keyword in the title.

Existing connections   Lists the connections stored in the open database that connect to Oracle data sources. This is list is displayed when the Connections option button is selected. The Existing connections list box lists named connections that connect to Oracle data sources.

All   Lists all connections or all ODBC data sources available on your system whose title either explicitly includes a known Oracle-related keyword or is not explicitly identified as a non-Oracle data source or connection. The list displayed depends upon whether you have the ODBC data sources or the Connections option button selected.

The Oracle Upsizing Wizard uses the data source or connection you choose to determine the Oracle server and user name for log-on.

Next   Displays the ODBC Login dialog box. If you used a named connection with a saved password, the wizard logs you on to the Oracle you’ve selected without prompting you for ODBC login information.

Verifying Server Permissions

The Oracle Upsizing Wizard also verifies the level of permission your username has been granted on the Oracle data source. Each permission in the list below controls the upsizing option for which it is required. If your username lacks some necessary permissions on the Oracle data source, you may still complete the steps in the Oracle Upsizing Wizard and generate and save the Oracle SQL upsizing script.

Permissions required on the Oracle data source to complete the upsizing process:

ALTER TABLE

ALTER USER

CREATE ANY CLUSTER

CREATE ANY INDEX

CREATE ANY TABLE

CREATE CLUSTER

CREATE INDEX

CREATE TABLE

CREATE TABLESPACE

Using a Named Connection

If you use a named connection to access your data source, the Oracle Upsizing Wizard associates the named connection with any remote views it creates during upsizing. If the connection definition includes a password, the “Save Password With View” option in Step 10 of the Oracle Upsizing Wizard is automatically checked for you and disabled. By checking and disabling this check box, the Oracle Upsizing Wizard prevents the password from being removed from the connection definition.

Using a Data Source

If you use a data source name rather than a connection name to log on to the data source, and you choose to have the wizard create remote views, the Oracle Upsizing Wizard creates a named connection called “Upsize” (or “Upsize2”, “Upsize3”, and so on, if a connection definition exists with the suggested name).


See Also

Oracle Upsizing Wizard
Step 1 - Select Local Database
Step 3 - Choose Tables
Step 4 - Map Field Data Types
Step 5 - Select Tablespaces
Step 6 - Select Tablespace Files
Step 7 - Specify Clusters
Step 8 - Specify Cluster Tables
Step 9 - Specify Cluster Key
Step 10 - Set Upsizing Options
Step 11 - Finish


Oracle Upsizing Wizard: Step 3 - Target Database
Oracle Upsizing Wizard: Step 3 - Choose Tables

See Also

In this step you select the Visual FoxPro tables you want to export to Oracle.

Dialog Box Options

Available tables   Lists all the tables stored in the database you’ve chosen to upsize.

Selected tables   Lists the tables you’ve chosen to copy into the upsized database on the Oracle server.

You must select at least one table, and you can choose the >> button to export all tables.

When you choose Next, the Oracle Upsizing Wizard reads the list of tables you’ve selected to upsize and tries to open those tables for exclusive use in the database you chose to upsize. Any tables that can’t be opened exclusively won’t be available to upsize. The tables are opened exclusively to prevent other users from changing the data in the tables during the upsizing process, which helps to ensure the accuracy of exported data. If any tables are already open and shared, the wizard closes them and then reopens them exclusively; this might cause you to lose any temporary relations established with the SET RELATION or SET SKIP commands.

Enhancing Performance by Choosing the Right Tables to Export

It’s very important to choose the tables you export carefully, as this choice has a significant impact on the performance of your application. Exporting all tables might result in excessive (and slow) server queries. A well-designed client/server database usually consists of a mix of local and remote tables. In general, keep tables which change rarely or infrequently in your local database, such as a table of state names and abbreviations. Export tables that change frequently and are accessed by many users, such as a table of orders.

The Oracle Upsizing Wizard exports the table’s field names, data types, and data.

For information about storing tables in the best location, see Chapter 19, “Designing Client/Server Applications,” in the Developer’s Guide. For information on optimizing client/server applications, see Chapter 22, “Optimizing Client/Server Performance,” in the Developer’s Guide.


See Also

Oracle Upsizing Wizard
Step 1 - Select Local Database
Step 2 - Select Data Source
Step 4 - Map Field Data Types
Step 5 - Select Tablespaces
Step 6 - Select Tablespace Files
Step 7 - Specify Clusters
Step 8 - Specify Cluster Tables
Step 9 - Specify Cluster Key
Step 10 - Set Upsizing Options
Step 11 - Finish


Oracle Upsizing Wizard: Step 4 - Database Device (Oracle)
Oracle Upsizing Wizard: Step 4 - Map Field Data Types

See Also

In this step, Visual FoxPro displays the default data type mappings used to convert local data to remote data, as tables are upsized to the server. You can choose to change these default mappings.

You can’t change the default mapping for a key field to a data type that prevents the field from being indexed. You can change the default mapping of a field that is part of an index key if you choose a data type that is indexable; however, you might want to change the data types for the other fields in the key to match. Visual FoxPro warns you if you change the default data type mapping for a field that is not a key field but is used in a Visual FoxPro index. If you make a mistake, click Defaults to reset the data types.

Dialog Box Options

Table   Select the table whose fields you want to map from the list of all the tables you’ve chosen to upsize.

Field Name   Lists the fields contained in the table you selected in the Table drop-down list.

FoxPro Type   Lists the Visual FoxPro data type for the field.

Server Type   Lists the server data type to which Visual FoxPro data in this field will be mapped when the table is copied to the server. Click in this field to display a drop-down list from which you can select a different server data type.

Width   Specifies the width of the field

Precision   Specifies the decimal precision of the field, when applicable.

Note   Empty Visual FoxPro date fields are upsized to NULL values in the Oracle database. If a date column in your Oracle database doesn’t accept NULL values, replace empty date fields in your Visual FoxPro table with not empty dates before upsizing.


See Also

Oracle Upsizing Wizard
Step 1 - Select Local Database
Step 2 - Select Data Source
Step 3 - Choose Tables
Step 5 - Select Tablespaces
Step 6 - Select Tablespace Files
Step 7 - Specify Clusters
Step 8 - Specify Cluster Tables
Step 9 - Specify Cluster Key
Step 10 - Set Upsizing Options
Step 11 - Finish


Oracle Upsizing Wizard: Step 5 - Select Tablespaces

See Also

In this step you select or create tablespaces on the Oracle server. These tablespaces will become the destination for your upsized local database and indexes.

You can choose to upsize to existing tablespaces, or optionally create new tablespaces. To help you determine whether a specific tablespace contains enough free space for your upsized table or index, Visual FoxPro displays both the unused space in the selected tablespaces and the size of your Visual FoxPro tables and indexes.

Dialog Box Options

FoxPro tables size   Displays the space in KB occupied by the FoxPro tables you’ve chosen to upsize.

Table tablespace size   Displays the free space available, in KB, in the tablespace named in the drop-down list box below.

FoxPro index size  Displays the space in KB occupied by the FoxPro indexes you’ve chosen to upsize.

Index tablespace size   Displays the free space available, in KB, in the tablespace named in the drop-down list box below.

Existing   Choose this option button to display a list of existing tablespaces in the drop-down list box.

New   Choose this option button to create a new tablespace.

If you choose to upsize Visual FoxPro tables to an existing Oracle tablespace, you could go to Step 6 to select a new data file for an existing tablespace, or go to Step 7.

If you chose to create a new tablespace, name your new Oracle tablespace in this step by entering the name for the tablespace in the drop-down list box. The displayed tablespace size for a new tablespace is zero. You’ll allocate space for the tablespace by adding a data file to the tablespace in the next step.


See Also

Oracle Upsizing Wizard
Step 1 - Select Local Database
Step 2 - Select Data Source
Step 3 - Choose Tables
Step 4 - Map Field Data Types
Step 6 - Select Tablespace Files
Step 7 - Specify Clusters
Step 8 - Specify Cluster Tables
Step 9 - Specify Cluster Key
Step 10 - Set Upsizing Options
Step 11 - Finish


Oracle Upsizing Wizard: Step 6 - Select Tablespace Files

See Also

In this step you can extend the storage of the tablespaces you selected in Step 5. You extend the storage of a tablespace by adding a new datafile.

Dialog Box Options

Tablespaces   Displays the name of the selected tablespaces for tables and indexes. Use this drop-down list to select the tablespace you want to extend.

New datafile   Enter a name for the datafile you want to create.

Existing datafiles  Displays a list of existing files associated with the tablespace. Use this list as a reference to avoid assigning a name to your new datafile that conflicts with an existing filename; new datafiles are not included in this list.

Free space in tablespace   Displays the free space available in the tablespace named in the drop-down list box.

FoxPro data size   Displays the space in KB occupied by the FoxPro tables and indexes you’ve chosen to upsize into the selected tablespace.

Datafile size   Enter the number that represents the size, in KB, you want to assign to your new datafile.

You can only add datafiles in this step. To remove or modify existing datafiles, see your Oracle documentation.


See Also

Oracle Upsizing Wizard
Step 1 - Select Local Database
Step 2 - Select Data Source
Step 3 - Choose Tables
Step 4 - Map Field Data Types
Step 5 - Select Tablespaces
Step 7 - Specify Clusters
Step 8 - Specify Cluster Tables
Step 9 - Specify Cluster Key
Step 10 - Set Upsizing Options
Step 11 - Finish


Oracle Upsizing Wizard: Step 7 - Specify Clusters

See Also

In this step you create clustered tables. If you want to create Oracle clustered tables, the Upsizing Wizard provides an easy-to-follow three-step process in steps 7, 8 and 9. If you don’t want to create clustered tables, simply choose Next>>; the Upsizing Wizard then skips automatically to Step 10.

You can create more than one cluster in this step. Add new clusters by selecting <Create new cluster> in the cluster list, editing the cluster name, specifying the cluster type, either the index name or the hash key, and the cluster row size. The cluster is added to the list when you select the Add button.

Dialog Box Options

Cluster name   Displays the name of the selected cluster. When you create a new cluster, enter a name for the new cluster in this text box.

Cluster list   Displays the names of existing clusters. Choose <Create new cluster> to begin entering information about a new cluster. If the cluster list is empty when you select Next>, the Upsizing Wizard skips to Step 10.

Default   Displays a list of proposed default clusters. Default clusters are based on the Parent-Child relation list in the open database. The cluster name is based on the parent table name. Each cluster includes the parent table’s related child tables. The default cluster list includes a distinct cluster for each parent table that isn’t participating as a child in the previous relation.

Index   Specifies an indexed cluster. After you create an indexed cluster, you must create an index on the cluster key.

Hash   Specifies a hash cluster.

Hash keys   Specifies the number of hash values for a hash cluster. Oracle 7 rounds the value of HASH KEYS up to the nearest prime number to obtain the actual number of hash keys. The minimum value is 2. This text box is enabled only when the Hash option button is selected.

Size   Specifies the amount of space in kilobytes to store all rows within the same cluster key value or same hash key. If you omit this value, Oracle 7 reserves one data block for each cluster key value or hash value.

Add   Choose this button to add the cluster information to the cluster list.

Remove   Choose this button to remove the selected cluster from the cluster list.

Required System Privileges

You must have CREATE CLUSTER system privileges to create a cluster in your own schema. The owner of the schema containing the cluster must have either more space on the tablespace containing the cluster or have UNLIMITED TABLESPACE system privileges.


See Also

Oracle Upsizing Wizard
Step 1 - Select Local Database
Step 2 - Select Data Source
Step 3 - Choose Tables
Step 4 - Map Field Data Types
Step 5 - Select Tablespaces
Step 6 - Select Tablespace Files
Step 8 - Specify Cluster Tables
Step 9 - Specify Cluster Key
Step 10 - Set Upsizing Options
Step 11 - Finish


Oracle Upsizing Wizard: Step 8 - Specify Cluster Tables

See Also

In this step, you select the tables to be included in each cluster. You specify the tables to be included in different clusters by selecting a different cluster name, and then selecting tables for that cluster.

Each cluster should include at least one table. If a listed cluster does not have at least one table assigned to it, you should move back to Step 7 and remove the cluster.

The cluster columns must correspond in both datatype and size for columns in each of the clustered tables; they need not correspond in value. You cannot specify integrity constraints as part of the definition of a cluster key column.

Dialog Box Options

Clusters   Displays the cluster name. To select a different cluster, expand the list and select a cluster name.

Available tables   Displays a list of tables from which you can choose to be included in the cluster. Tables already participating in another cluster are not displayed.

Selected tables   Displays the tables you’ve selected to be included in the cluster.

Verify   Tests the selected tables to ensure that their common columns correspond in both datatype and size. If the selected tables don’t pass the verification test, the Upsizing Wizard remains on this step.


See Also

Oracle Upsizing Wizard
Step 1 - Select Local Database
Step 2 - Select Data Source
Step 3 - Choose Tables
Step 4 - Map Field Data Types
Step 5 - Select Tablespaces
Step 6 - Select Tablespace Files
Step 7 - Specify Clusters
Step 9 - Specify Cluster Key
Step 10 - Set Upsizing Options
Step 11 - Finish


Oracle Upsizing Wizard: Step 9 - Specify Cluster Key

See Also

In this step, you specify the key for the cluster. The cluster columns must correspond in both datatype and size for columns in each of the clustered tables; they need not correspond in value. You cannot specify integrity constraints as part of the definition of a cluster key column.

Dialog Box Options

Clusters   Displays the cluster name. To select a different cluster, expand the list and select a cluster name.

Tables   Displays the table name. The first table you select should be the primary table in the cluster. To select a different table, click the DOWN ARROW and select a table name from the expanded list.

Available fields   Displays a list of fields in the specified cluster and table. You can choose any of these fields to be included in the cluster key.

Selected fields   Displays the fields selected to be included in the cluster key. Primary key fields are automatically included in this list; you can remove them or include additional fields from the list of available fields. The selected column list for the primary table becomes the pattern for the cluster key; the column names will become the names of the columns in the cluster.

Verify   Tests the selected fields to ensure they correspond in both datatype and size. If the selected fields don’t pass the verification test, the Upsizing Wizard remains on this step.


See Also

Oracle Upsizing Wizard
Step 1 - Select Local Database
Step 2 - Select Data Source
Step 3 - Choose Tables
Step 4 - Map Field Data Types
Step 5 - Select Tablespaces
Step 6 - Select Tablespace Files
Step 7 - Specify Clusters
Step 8 - Specify Cluster Tables
Step 10 - Set Upsizing Options
Step 11 - Finish


Oracle Upsizing Wizard: Step 10 - Set Upsizing Options

See Also

In Step 10, you can control how the Oracle Upsizing Wizard exports your tables. You can also specify the changes you want the Oracle Upsizing Wizard to make to the local database. You can create upsizing reports, redirect views to use remote data, create new remote views on tables that are upsized, and save passwords with views.

Specifying Table Attributes to Upsize

By default, the Oracle Upsizing Wizard exports a table’s structure and its data. Along with field names and data types, you can also export:

•	Indexes

•	Defaults

•	Relationships (referential integrity constraints)

•	Validation rules

The Oracle Upsizing Wizard can export additional table properties. The Oracle Upsizing Wizard can also modify your Visual FoxPro database so that your queries, forms, and reports use the data in your new Oracle tables, rather than the data in the local Visual FoxPro database.

Visual FoxPro indexes and defaults become Oracle indexes and defaults. If you choose to export validation rules, the Oracle Upsizing Wizard attempts to export field- and table-level validation rules to Oracle, where they become Oracle constraints. Exported table relationships also become part of the constraints.

Tip   If you export table relationships, be sure to export indexes as well or you might experience mediocre performance.

Dialog Box Options

Table Attributes to Upsize

Indexes   Select to upsize Visual FoxPro .CDX indexes.

Defaults   Select to upsize default values for table fields.

Relationships   Select to upsize relationships stored in the database you are upsizing.

Use declarative referential integrity   Select to establish relationships to enforce referential integrity.

Validation rules   Select to upsize field and table validation rules.

Structure only, no data   Select to upsize the empty table structure, without copying table data to the Oracle data source.

Changes to Make Locally

Create upsizing report   Select to create a series of reports documenting the results of the upsizing process.

Redirect views to remote data   Select to change the definition of views in the database you are upsizing so that your queries, forms, and reports use views on the data in the new Oracle data source rather than the original Visual FoxPro data.

Create remote views on tables   When you upsize a local table, you need a remote view to access the upsized table on the remote server. The Oracle Upsizing Wizard can create new, remote views as you upsize. As the Oracle Server Upsizing Wizard creates new remote views, it renames all local versions of tables by adding the suffix “_local” to the table name.

Note   Creating remote views on tables as you upsize is not recommended, because these unoptimized views select all the data in the table rather than selecting only the information your application needs. The preferred method is to create parameterized views. You can either create a local parameterized view, which you then upsize by choosing Redirect views to remote data, or create a new parameterized remote view on the table after you’ve completed the upsizing process.

Save password with views   By default, you must enter your password and login ID when opening a remote view in a new session with Visual FoxPro. Select this option to store your password locally with the remote view definition in your database.

Creating Upsizing Reports

When you select Create Upsizing Report, Visual FoxPro generates upsizing reports that document the tables, views, fields, indexes, and referential integrity constraints the Oracle Upsizing Wizard creates on Oracle. The Oracle Upsizing Wizard places the reports in a new project, using the following report names:

•	RptErrors

•	RptField

•	RptIndex

•	RptRels

•	RptTable

•	RptViews

The upsizing reports include information about any devices and databases that are created, information about any errors encountered during the upsizing process, and a complete explanation of the way in which each Visual FoxPro object is mapped to a Oracle object. You can view or print these reports after upsizing is complete.

Upsizing All Tables in a View

If you upsize all the tables in a local view, the local view is renamed by adding the suffix “_local” to the existing local view name. The Oracle Upsizing Wizard creates a new view based on the SQL statement of the local view, substituting the remote table names for the local table names. The KeyField and other update properties of the view are preserved.

Upsizing Some of the Tables in a View

If you upsize only some of the tables in a view, the Oracle Upsizing Wizard does not rename the local views. Instead, it renames the Visual FoxPro tables you export with the suffix “_local.” For example, if you export a table named “Employees,” the table is renamed “Employees_local” in your database. The Oracle Upsizing Wizard then creates a remote view for each of the tables you exported. Each view selects all fields and all records from the remote table.

Note   Visual FoxPro handles local and remote data in different ways, which might cause upsized applications to function improperly.


See Also

Oracle Upsizing Wizard
Step 1 - Select Local Database
Step 2 - Select Data Source
Step 3 - Choose Tables
Step 4 - Map Field Data Types
Step 5 - Select Tablespaces
Step 6 - Select Tablespace Files
Step 7 - Specify Clusters
Step 8 - Specify Cluster Tables
Step 9 - Specify Cluster Key
Step 11 - Finish


Oracle Upsizing Wizard: Step 11 - Set Upsizing Options
Oracle Upsizing Wizard: Step 11 - Finish

See Also

In the final step, you can choose to:

•	Upsize without generating SQL code.

•	Only generate and save SQL code for upsizing.

•	Upsize and save generated SQL code.

To upsize your database

1	Select the upsizing option you want.

2	Choose the Finish button.

The Oracle Upsizing Wizard creates devices and databases if necessary, and begins exporting Visual FoxPro objects to Oracle.

The first and third upsizing options are available only if you have the necessary permission on the server. If you choose either of the options that save generated SQL code, all the SQL code generated by the Oracle Upsizing Wizard is stored on your hard disk.

Note   Upsizing can take a long time, depending on the size of your data, the amount of network traffic and the number of concurrent demands being handled by your server. Large tables can require several hours to export.


See Also

Oracle Upsizing Wizard
Step 1 - Select Local Database
Step 2 - Select Data Source
Step 3 - Choose Tables
Step 4 - Map Field Data Types
Step 5 - Select Tablespaces
Step 6 - Select Tablespace Files
Step 7 - Specify Clusters
Step 8 - Specify Cluster Tables
Step 9 - Specify Cluster Key
Step 10 - Set Upsizing Options


WWW Search Page Wizard

See Also

The WWW Search Page Wizard creates a Web page that allows Web page visitors to search and retrieve records from a Visual FoxPro table. The wizard asks you to specify the table to be searched, the search field, and information about how to format the Web pages it creates.

The wizard creates an HTML page for entering search information, a parameterized query for retrieving the records from your table, and a results page for displaying the records the query retrieved.

Note   The wizard currently constructs queries that use only the = operator, not the LIKE operator. Therefore, you cannot enter wildcard characters, such as * or %, in the Search field of the Web page. Using the wildcards with the = operator returns an empty result set.

To run the WWW Search Page Wizard

•	Type the following command in the Command window:

DO HOME()+"TOOLS\INETWIZ\WWWPAGE.APP"

Wizard Steps

Step 1 - Select Table

Step 2 - Choose Search Field

Step 3 - Set Search Page Options

Step 4 - Set Up Search Page

Step 5 - Select Result Fields

Step 6 - Set Up Results Page

Step 7 - Finish


See Also

Cross-Tab Wizard
Local View Wizard
Graph Wizard
Query Wizard
Step 1 - Select Table
Step 2 - Choose Search Field
Step 3 - Set Search Page Options
Step 4 - Set Up Search Page
Step 5 - Select Result Fields
Step 6 - Set Up Results Page
Step 7 - Finish
Wizards Overview
World Wide Web, defined


WWW Search Page Wizard: Step 1 - Select Table

See Also

The wizard lists the available tables. To display the tables from your database, select it in the Databases and Tables box. If your database does not appear in this list, choose Browse to see more files.

Choose a table that has at least one index key in order to ensure optimal performance during searches.

Note   Choose a table located on the HTTP server, or that has the same structure and relative path as the one you intend to use on the server. If you choose a table that has a different structure or path than the file on the server, data might not be available during the search.


See Also

Cross-Tab Wizard
Local View Wizard
Graph Wizard
Query Wizard
Step 2 - Choose Search Field
Step 3 - Set Search Page Options
Step 4 - Set Up Search Page
Step 5 - Select Result Fields
Step 6 - Set Up Results Page
Step 7 - Finish
WWW Search Page Wizard


WWW Search Page Wizard: Step 2 - Choose Search Field

See Also

The wizard lists the indexes your table has available. The wizard allows you to choose only an index expression to ensure that the query is fully optimized. If the field you want to search does not appear in the list, you need to modify the table and add an index to that field.


See Also

Cross-Tab Wizard
Local View Wizard
Graph Wizard
Query Wizard
Step 1 - Select Table
Step 3 - Set Search Page Options
Step 4 - Set Up Search Page
Step 5 - Select Result Fields
Step 6 - Set Up Results Page
Step 7 - Finish
WWW Search Page Wizard


WWW Search Page Wizard: Step 3 - Set Search Page Options

See Also

The wizard adds the title and description you provide to the search page. The title you provide appears at the top of the page in a Web browser. The title should describe what your page is for, but should be succinct.

The description is the short paragraph that follows the title and centered below the title. You can use the description to state the purpose of the site and how to do a search.

You can also provide the user with tips on how to enter information in the search page, what to expect after the query is run, or about the information in your table. For example, if your data is in all capitals, you can tell them to press CAPS LOCK before entering their search criteria.


See Also

Cross-Tab Wizard
Local View Wizard
Graph Wizard
Query Wizard
Step 1 - Select Table
Step 2 - Choose Search Field
Step 4 - Set Up Search Page
Step 5 - Select Result Fields
Step 6 - Set Up Results Page
Step 7 - Finish
WWW Search Page Wizard


WWW Search Page Wizard: Step 4 - Set Up Search Page

See Also

If you want to add graphics to your Web page, you can specify the images (.GIF or JPEG) you want as the header and background images. These images are optional, but add to the visual interest of a page.

The header image appears between the title and description. The background image is tiled as the background for the page.

Tip   Use small and simple images for the background. Large or busy images do not display well when tiled for background.

Using the image files you specify, the wizard creates a subdirectory (IMG) to store the images referenced in your page.

To allow your Web page visitor to download the data as text, you can select Provide the ability to download the result set as a file. If you select this option, the wizard adds a check box to the Web page for the visitor to select and download the data found by the query.


See Also

Cross-Tab Wizard
Local View Wizard
Graph Wizard
Query Wizard
Step 1 - Select Table
Step 2 - Choose Search Field
Step 3 - Set Search Page Options
Step 5 - Select Result Fields
Step 6 - Set Up Results Page
Step 7 - Finish
WWW Search Page Wizard


WWW Search Page Wizard: Step 5 - Select Results Fields
WWW Search Page Wizard: Step 5 - Select Result Fields

See Also

The wizard lists the fields available for display on the results page. The list includes all of the fields in the selected search table. Select the fields in the order you want them to appear on the results page. For example, if you want the results to display the product picture, product name, category, and description from your Products table, first choose the fields storing the product picture, then the product name field, and so on.

You can select up to five fields.


See Also

Cross-Tab Wizard
Local View Wizard
Graph Wizard
Query Wizard
Step 1 - Select Table
Step 2 - Choose Search Field
Step 3 - Set Search Page Options
Step 4 - Set Up Search Page
Step 6 - Set Up Results Page
Step 7 - Finish
WWW Search Page Wizard


WWW Search Page Wizard: Step 6 - Set Up Result Page

See Also

Because a Web results page is not really very different from a search page: you can place both a header and background image on this page as well. The placement of the images is the same as that for the search page images: the header image will appear between the title and description, and the background image will be tiled throughout the entire page.

On this page, you can also specify the maximum number of records returned on the result page. The default value is 10, which is a typical number of return entries for a Web search page.

Finally, you can specify the data source name of the ODBC data source that the Web server will use to manage the search and search results.


See Also

Cross-Tab Wizard
Local View Wizard
Graph Wizard
Query Wizard
Step 1 - Select Table
Step 2 - Choose Search Field
Step 3 - Set Search Page Options
Step 4 - Set Up Search Page
Step 5 - Select Result Fields
Step 7 - Finish
WWW Search Page Wizard


WWW Search Page Wizard: Step - Finish
WWW Search Page Wizard: Step 7 - Finish

See Also

After specifying the options for your pages, you are ready to create them. Choose Finish to display the Save As dialog box and provide a name and the directory for your Web pages. The wizard creates three files in the directory you specify, as listed in the following table.

File created by wizard	Description
name.HTM	HTML file used as the search page
name.HTX	HTML file used as the results page. The page includes a template that is filled in with the records returned by the search.
Name.IDC	Specifications for your search, including the SQL statement that will be used to find the records the user is seeking


See Also

Cross-Tab Wizard
Local View Wizard
Graph Wizard
Query Wizard
Step 1 - Select Table
Step 2 - Choose Search Field
Step 3 - Set Search Page Options
Step 4 - Set Up Search Page
Step 5 - Select Result Fields
Step 6 - Set Up Results Page
WWW Search Page Wizard