Reference To Foxpro Functions
Reference To Foxpro Functions
FOXPRO
FUNCTIONS
Complied By:
Chandrakant Bhosale
#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.
#IFDEF | #IFNDEF ... #ENDIF Preprocessor Directive
#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:
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.
#INCLUDE Preprocessor Directive
#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.
:: Scope Resolution Operator
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
& 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.
TipWhenever 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).
For additional information on name expressions, see Overview of the
Language.
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 , 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
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
\ | \\ Command
10
Font style
11
r
B
Bold
Italic
Normal
Outline
Opaque
Shadow
Strikeout
Transparent
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
12
printer you're using. You can direct control codes to the printer in several
different ways:
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.
@ ... BOX Command
Included for backward compatibility. Use the Shape control instead.
@ ... CLASS Command
13
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
CommandButto
n
OLEBoundControl
CommandGrou
p
OptionButton
Container
OptionGroup
Control
Page
Cursor
PageFrame
Custom
Relation
DataEnvironme
nt
Separator
EditBox
Shape
Grid
Spinner
Header
TextBox
Image
Timer
Label
NAME ObjectName
Specifies the name of the object reference variable to create. The objectoriented 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 objectoriented programming methods of Visual FoxPro. For additional information
about backward compatibility with FoxPro 2.x controls, see Controls and
Objects.
14
15
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.
@ ... 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 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.
16
17
Arguments
nExpression
Specifies the numeric expression whose absolute value ABS( ) returns.
ACCEPT Command
Included for backward compatibility. Use the TextBox control instead.
18
19