100% found this document useful (1 vote)
2K views1,328 pages

Ms Foxpro Language Reference

Ms Foxpro Language Reference

Uploaded by

z. e.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
100% found this document useful (1 vote)
2K views1,328 pages

Ms Foxpro Language Reference

Ms Foxpro Language Reference

Uploaded by

z. e.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 1328
Language Reference = Relational Database Management System for MS-DOS. and Windows. Language Reference = Co Relational Database Management System for MS-DOS. and Windows™ Information in this document is subject to change without notice. Companies, names, and data used in examples herein are fictitious unless otherwise noted. No part of thas document may be reproduced or transmitted in any form or by any means, clocironi ae mechanical, for any purpose, without the express written permission’ of Microsof, ‘orporation, ©1989-1983 Microsoft Corporation. All rights reserved. Microsoft: the Fox Head logo, Foxtask,, FoxGraph, FoxPro, Ms, MS.DOS, and Multiplan are registered trademarks and Rushmore and Windows are trademarks of Microsalt Corporation in the United States of America and other countries, Paradox is a registered trademark of Ansa Software, a Borland Company. Macintosh and MultiFinder are registered trademarks of Apple Computer, Ine. RapidFile is a registered trademark and Framework Il is a trademark of Ashton-Tate Corporation. HP and LaserJet are registered trademarks of Hewlett-Packard Company. Lotus, Symphony, and 1-23 are registered trademarks of Lotus Development Corporation, Netware and Novell are registered trademarks of Novell, Inc. Desqview is a rogistered trademark of Quarterdeck Office Systems, UNIX is a registered trademark of UNIX Systems Laboratories. Document No, Fx87557-1299 Printed in Ireland: 03, Contents Overview of the FoxPro Language Command Window . . . . 12 Creating Programs. . . 13 Saving Programs. 13 Modifying Programs 14 Executing Programs... . 14 Additional Program Information . 14 FoxPro Online Help Facility ss 215 Online Help in FoxPro for MS-DOS. . . . 15 Online Help in FoxPro for Windows . 15 Understanding the Language corcaw 17 Syntax Conventions... .......- vee LT Expressions... . “ a 19 Additional Abbreviations . . . 1-16 Specifying Record Range 118 ‘Table/.DBF Work Areas . 1-21 Functions and Memo Fields. 1-23 ‘Typographic Conventions 1-24 Commands and Functions by Category Key FoxPro Commands and Functions. . . . - 22 Command and Function Categories Data Types : Character Functions. Numeric Functions . Date and Time Functions Data Conversion ‘Tables/.DBFs ea Field Manipulation . . ‘Table/.DBF Manipulation Record Manipulation . Indexes : Relations Contents Programming ............- Debugging and Error Handling Program Execution Structured Programming Low-Level File Functions . Memory Variable Manipulation Array Manipulation . . . Event Handlers DDE and OLE Input and Output Data Formatting Printing ........ Menu Bars and Popups Windows . . . ‘Typing, Keyboard and Mouse Reports and Labels FoxPro Environment .. . . . Environment . . File Management FoxPro in a Multi-User Environment Network Commands and Functions Commands and Functions Alphabetically ‘This chapter contains complete descriptions of the FoxPro commands and functions. The chapter is or- ganized alphabetically and begins on page 3-1. System Memory Variables Alphabetically ‘This chapter contains complete descriptions of the FoxPro system memory variables. The chapter is or- ganized alphabetically and begins on page 4-1. Index ii Contents 1 Overview of the FoxPro Language ESI IO PERRIN DO FoxPro” is a product developed for data management — the catalog- ing, tracking and processing of information. Although you can per- form many data management operations non-procedurally through the FoxPro interface, accessing the tremendous power of FoxPro requires some knowledge of the FoxPro programming language. This manual is a,complete language reference for FoxPro on two plat- forms — MS-DOS” and Microsoft” Windows™. FoxPro is used generi- cally in this manual to refer to both FoxPro for MS-DOS and FoxPro for Windows. Whenever a language feature is unique to FoxPro for MS- DOS or FoxPro for Windows, the platform is noted and the feature is fully documented. See the table at the beginning of the Commands and Functions Alphabetically chapter for a complete listing of new and enhanced language features in FoxPro 2.5. This chapter contains a variety of topics that will help you use the FoxPro programming language, including an explanation of the con- ventions this manual uses to describe the syntax of FoxPro commands and_funetions. Overview of the FoxPro Language LL Command Window Command Window 12 When you use the interface, FoxPro generates commands in the Com- mand window that correspond to your actions. The Command window provides a gateway between the interface and the FoxPro language. ‘The Command window contains a history of all the commands created during an interactive FoxPro session, providing a means to learn the FoxPro language. By examining the commands that are generated when you use the interface, you can quickly learn the language. A command generated in the Command window can be re-exeeuted by moving the cursor to the line containing the command and pressing Enter. After a long interactive FoxPro session, a lengthy list of FoxPro commands is generated in the Command window. You can copy and paste these commands into a FoxPro program. A program can be repeatedly run, making it easy to execute literally thousands of commands again and again. A FoxPro command can be directly executed by typing it into the Command window and pressing Enter. 'To re-execute a command, move the cursor to the line containing the command and press Enter. Since the Command window is a special editing window, you can e commands using the editing tools available in FoxPro. You can edit, insert, delete, cut, copy or paste text in the Command window. For more information about the Command window, see the Window Menu chapter in the FoxPro User's Guide. Overview of the FoxPro Language Creating Programs Creating Programs FoxPro programs, composed of FoxPro commands, provide incredible power to manipulate data. You can execute a series of commands that you enter into a FoxPro program file. Running a program has many advantages over entering individual commands in the Command window: * Programs execute multiple commands automatically, saving time and lots of typing. * Programs can be modified and run again. * Programs can run other programs. * Certain structured programming commands can be used only in programs, * Programs run in FoxPro provide unparalleled performance. FoxPro programs are text files containing a series of commands. You can create a program in FoxPro in one of these ways: * Choose New... from the File menu. The New dialog appears. Choose the Program radio button, then choose OK in FoxPro for MS-DOS or New in FoxPro for Windows. * In the Command window, type the command MODIFY COMMAND and press Enter. FoxPro opens a new window named UNTITLED.PRG. You can now enter your program into this window. If you have used FoxPro interactively and want to save the lly commands generated in the Command window, you can copy and paste them directly into a program editing window. You can also copy program examples from the help file and paste them directly into a program. Copying program examples from xy way to learn how FoxPro com- the help file is a quick and es mands and functions work. Saving Programs. After you create a program, be sure to save it. To save an untitled program, choose Save As... from the File menu. Enter a name for the program in the Save As dialog that appears. Once you save your pro- gram you can execute the program or modify it. Overview of the FoxPro Language L13 Creating Programs Modifying Programs After you save your program, you can modify it. First, open the pro- gram in one of these ways: * Choose Open... from the File menu. A dialog appears with a list of available files. Choose the Program option from the Type popup. From the list of files, choose the program you want to modify, then choose OK in FoxPro for MS-DOS or Open in FoxPro for Windows. * In the Command window, type the command MODIFY COMMAND followed by a space and the name of the program to modify, then press Enter. The program is opened for editing. For example, to modify a program named MYPROGRM, enter this command in the Command window: MODIFY COMMAND myprogrm + In the Command window, type the command MODIFY COMMAND ? then press Enter. From the list of files, choose the program you want to modify, then choose OK in FoxPro for MS-DOS or Open in FoxPro for Windows. After you open the program you can make changes. When you finish making your changes, be sure to save the program. Executing Programs After you create a program, you can execute it. To execute a program: * Choose Do... from the Program menu. From the program list, choose the program to execute, then choose OK in FoxPro for MS-DOS or Do in FoxPro for Windows. * Type the command DO followed by a space and the name of the program to execute, then press Enter. For example, to execute the program named MYPROGRM, enter this command in the Command window: DO myprogrm Additional Program Information For complete information on creating, editing and saving program files, see the Text Editing section of the Interface Basics chapter in the FoxPro User’s Guide. For information on executing program files, see the Program Menu chapter in the FoxPro User’s Guide or the DO command in this manual Overview of the FoxPro Language FoxPro Online Help Facility FoxPro Online Help Facility An online help facility is always available in FoxPro. The online help facility contains specific information about evry FoxPro command, funetion and system memory variable, as well as general information about FoxPro. Context-sensitive help is available for FoxPro system windows, dialogs and menu options. Press Fl when a system window or dialog is frontmost to see help information about it. To get help for 2 command or function in the Command window or a program, select the com- mand or funetion and press F1 Online Help in FoxPro for MS-DOS To access online help in FoxPro for MS-DOS, press F or choose Help... from the System menu. The Help window is displayed with an exten- sive list of topies. Choose a topic in the Help window to see details about the topic. You can get help on related topics in the help facility by choosing options from the See Also popup. You can also select text in a help topic and choose the Look Up push button. If the text you select is a help topic, help information appears for the topic. If a help topic does not correspond to the text you select, a dialog is displayed containing a list of help topies. For more information about help in FoxPro for MS-DOS, refer to SET HELP in this manual or the System Menu chapter in the FoxPro User's Guide. Online Help in FoxPro for Windows To access online help in FoxPro for Windows, press F1 or choose Help... from the Help menu. The Help window opens. FoxPro for Windows supports two styles of help: * ppF-style help, familiar to FoxPro for MS-DOS users. * Windows-style help, familiar to Windows users, Overview of the FoxPro Language Lis FoxPro Online Help Facility L16 Windows-style help is the default, help system. You can change from one style to another in the Command window or in a program: © To change to FoxPro ppr-style help, issue Se’ HELP TO FOXHEL®.DBF in the Command window or a program. FoxPro _DBF-style help behaves identically to the online help for FoxPro for MS-DOS, described in the previous section except you choose Contents from the Help menu to display the Help window. * To change to Windows-style help, issue SET HELP TO FOXHELP.#LP in the Command window or a program. With Windows-style help, you ean: * Display information about the current window or dialog at any time by pressing the F1 key * Get help on a menu option by pressing Shift+F1, then solecting the menu option, * Search for topics associated with a word or phrase by choosing ‘Search for Help on... from the Help menu. * Add notes or comments to a topic by choosing Annotate... from the Edit menu in the Help window, then typing your notes. A paper clip symbol appears in topies with annotations. To view the annotation, click the paper clip. * Mark a topic you refer to frequently so that you can access it quickly. You do this by choosing Define... from the Bookmark menu in the Help window, then specifying a bookmark name for the current topic. Bookmarks that you define are added to the bottom of the Bookmark menu. * Print help topies by choosing Print Topie from the the Help window. menu in * Copy the contents of help topics to the clipboard by choosing Copy... from the Edit menu in the Help window and selecting the topic you want copied. For more information about the online help facility in FoxPro for Win- dows, refer to the Help Menu chapter in the FoxPro for Windows User's Guide, the System Menu chapter in the FoxPro for MS-DOS User's Guide or SET HELP in this manual. Overview of the FoxPro Language Understanding the Language ‘The FoxPro language consists of two element * Commands that perform an action, For example, you can use the BROWSE command to look at the contents of a table/,DBF * Functions that return a value. For example, the DATE( ) function returns the system date from your computer. Functions contain a pair of parentheses that distinguish them from commands Commands and functions can be combined to create a FoxPro sfate- ment. Funetions are not used by themselves, but are always com- bined with a FoxPro command. For example, the question mark (?) is a command that sends output to the sereen. DATE() is a function that returns the current system date. They can be combined to output the system date to the screen: 2 DATEL ) The STORE command assigns a value to a memory variable. In this example, the TIME’ ) function returns the current system time, and this value is placed in the memory variable BEGINTIME: STORE TIME( ) 10 begintime Syntax Conventions FoxPro commands and functions consist of one or more components. These components determine how a command or function can be used. Look at the eyntax of a typical FoxPro command, ‘The REPLACE com: mand is used to update fields in a table/.DBF record. Here's the syn- tax for the REPLACE command: REPLACE WITH [ADDITIVE] [, WITH [ADDITIVE] .. [] [FOR ] [WHILE ] [NOOPTIMIZE] Overview of the FoxPro Language La? Understanding the Language The following table lists the components of the REPLACE command. ‘Component the REPLACE Command Type Key Words REPLACE, WITH, ADDITIVE, FOR, WHILE, NOOPTIMIZE Expressions expr, expr2, expL1, expL2 Names fieldi, field2 This manual uses special typographic conventions in command and function syntax. These conventions indicate whether a component of a command or function should be entered as shown or supplied by you, whether the component is required or optional, and so on. UPPER- UPPERCASE designates a FoxPro key word. Every CASE FoxPro command and function contains at least one key word. FoxPro uses key words to identify a command or function, Key words are also called reserved words since FoxPro reserves these special words for internal use. Some examples of key words in the REPLACE command are REPLACE (which FoxPro identifies as a command), WITH, ADDITIVE, FOR and WHILE. WITH, ADDITIVE, FOR and WHILE are also referred to as clauses because they are additional parts of the main command. <> Angle brackets < > surrounding lower-case text indieate information that you provide, This information can be file name, an expression, a memory variable name and so on. You replace the text and angle brackets with the ap- propriate name or expression. Do not include the angle brackets when entering the command. ) Parentheses must be included in all FoxPro funetions. Include the parentheses as they appear in the function's syntax, Lis Overview of the FoxPro Language Understanding the Language tl Square brackets indicate a portion of a FoxPro command or function that is optional. Do not type the brackets. For example, the REPLACE command supports numerous options, and you have the choice of including these op- tions. The ADDITIVE, , FOR , WHILE and NOOPTIMIZE clauses are placed in square brackets to indicate they are optional. A vertical bar separating options indicates that you can enter only one of the options. Do not type the vertical bar. An ellipsis indicates that a command or function or a portion of a command or function can be continued in a similar fashion. For example, the INLIST() function sup- ports a large number of arguments. The ellipsis in the INLIST’ ) syntax indicates that you can include more ar- guments than the three listed: INLIST(, [, ...]) Expressions A FoxPro expression is a combination of field values, functions, memory variable values, array clement values, constants and operators. There are four types of FoxPro expressions — character, numeric, date and logical. Expressions are denoted in FoxPro commands and functions as shown in the following table: Character = Numeric ‘Date | Logical Character, Numeric, Date or Logical List of expressions separated by commas Overview of the FoxPro Language 119 Understanding the Language L110 When more than one expression of the same type appears in a com- mand or function, a number is added to indicate its position in the command or function. For example, the syntax for the CHRTRAN ) funetion is: CHRTRAN(, , ) CHRTRAN( ) requires three character expression arguments: , and Fields, functions, memory variables and array elements that are com- bined to create an expression must be the same data type. If they are different types, FoxPro displays an “Operator/operand type mismatch” message. Character Expressions Character expressions are composed of the following: * Character type fields * Functions that return character values. * Memory variables and array elements that contain character data. * Character type constants, called séring literals. A string literal is a character string surrounded by single or double quotation marks. For example, ‘Washington’ or "Washington’. The quotation marks must match. "That is, you cannot begin a character string with a single quotation mark and end it with a double quota- tion mark. You can embed a quotation mark in a character string by surrounding the character string with quotation marks of the opposite type. For example, "Don’t touch!” is a legitimate string literal. Throughout the FoxPro documentation you will see the null string mentioned. The null string is a character string of Iength 0 — it contains no characters. The null string can be expressed with a pair of quotation marks with no space be- tween them — ‘’ or". Overview of the FoxPro Language Understanding the Language ‘The following operators can be used with character expressions: Character Expression Operators ‘Operator Operation Character expression concatenation (two strings are joined together) Character expression concatenation (trailing blanks are moved from the end of the first string to the end of the second string) | Character expression comparison You can use character expression operators to: * Concatenate strings. For example: ‘Good ‘ + ‘Morning!' * Concatenate a string and a field. For example: "Please respond by " + invoice.date * Concatenate two fields and remove trailing blanks. For example: customer.first - cu omer. last * Concatenate a string and a memory variable. For example: "pear " + mfirstnane Numeric Expressions Numeric expressions are composed of the following: * Numeric type fields. * Functions that return numeric values. * Memory variables and array elements that contain numeric data. * Numeric constants. Numeric constants are numbers — 0, 1, -1, 3.1415 and so on. Overview of the FoxPro Language Lill ‘Understanding the Language Numeric Expression Operators (in order of precedence) Operator Operation () | Parentheses used to group expressions | Exponentiation ww Multiplication and division % Modulus (Remainder) Addition and subtraction Date Expressions Date expressions are composed of the following: * Date type fields, © Functions that return date values. * Memory variables and array elements that contain dates. * Date constants Date constants are numbers — 1, 2, 8, 100 and so on, Date constants represent days, and you ean add or subtract a date constant (a number of days) to or from a given date, A date is specified by surrounding it with braces. For example, the following command creates the date type memory variable XMAS and stores the date 12/25/92 to it: STORE (12 92} TO xa The following commands both create an empty date type memory variable BLANKDATE: sTore { / / } TO blarkdate 0 blank FoxPro treats an invalid date as an empty date. L112 Overview of the FoxPro Language Understanding the Language Logical Expressions Logical expressions have one of two values — true or false. .T. and -P. are used to specify true and false in FoxPro. Logical expressions are composed of the following: * Logical type fields. * Functions that return logical values, * Memory variables and array elements that contain logical values, * Other expression types (character, numeric or date) separated by special relational operators. For example: invoice.date amount > 15000 (06/0 FoxPro evaluates logical expressions from left to right, and only for as long as is necessary. In the following example the AND operator is used to create a logical expression. If any of the values in the expres sion are false (F.), the entire expression is false, When FoxPro en- counters the first logical false (.F.), it doesn’t evaluate the rest of the expression. AND .T. AND 7. () Parentheses used to group expressions 1,NOT Logical negative AND Logical AND oR Logical inclusive OR Overview of the FoxPro Language L1i3 Understanding the Language Logical expression relational operators are used with all data types to return a logical value, The following relational operators can be used with all data types create a logical expression. Less than Greater than Equal to Not equal to Less than or equal to Greater than or equal to Character string comparison ‘The following commands demonstrate how the relational operators can be used with numeric, date and character type data: 21>2 && Dig 2 {01/01/92} <= {01/01/92} —-&& Displays .7. Names. Certain FoxPro commands and functions require you to supply a name, Some examples of names used in FoxPro are: * Table/.pBF file names. * Table/.DBF alias names. © Table/ DBF field names. © Index file names * File names. * Memory variable and array names. * Window names, * Menu names. © Popup names. Lid Overview of the FoxPro Language Understanding the Language In the following table, the first column lists names as they appear in the syntax of commands and functions. The second column describes what to include in the command or function. File name Field name List of field names Memory variable array name Memory variable or array clement name List of memory variable names «menu name> Menu name Menu pad name Popup name | List of popup names | Window name List of window names When including a list of names, the names must be separated by com- mas. A name is not an expression, a memory variable or array ele- ment or a field. A name should not be surrounded by quotation marks. ‘The REPLACE command used as an example requires that you include at least one name, field1, a field name. Overview of the FoxPro Language L115 ‘Understanding the Language Name Expressions Although a name cannot be a memory variable or an array element, you can create a name expression that substitutes the value of a char- acter type memory variable or array element as the name. Name ex- pressions provide flexibility in FoxPro commands and functions. Store the name to the memory variable (or array element), ‘Then, you can substitute the name into a command or function by enclosing the memory variable in parentheses. For example, the REPLACE command requires a field name, You can store a field name to a memory variable and use a name expression in REPLACE where the field name occurs: STORE ‘city’ TO mvarcits REPLACE (mercity) WITH "Recnond’ Here the field name CITY is stored to the memory variable MVARCITY. ‘The name expression (mvarcity) replaces the memory variable with the field name for use by the REPLACE command. A similar process called macro substitution enables memory variables to replace names. In macro substitution, you place an ampersand (&) before the memory variable to tell FoxPro to use the value of the memory variable as a name. For more information about macro sub- stitution, see the & topic in this manual. A command or function containing a name expression executes faster than one containing macro substitution, so use a name expression instead of macro sub- stitution whenever possible Additional Abbreviations L116 ‘The following table contains terms and abbreviations commonly used in the description of FoxPro commands and functions. Abbreviation Work area alias array Array name border string | Border definition string column Screen or window column command FoxPro command Overview of the FoxPro Language Understanding the Language Abbreviation Meaning delimiter Separation character dir Directory drive Disk drive name Index expression key list Set of expressions, fields, and so on macro name Keyboard macro name memo field Memo field name memvar Memory variable or array element pad name Menu pad name parm list | List of parameters path | Diak directory specification port Serial or parallel output port name procedure name Procedure file name row Screen or window row | Range of table/.DBF records skel File specification skeleton statements | Set of FoxPro commands text lines ‘Text that is not a FoxPro command ubject in FoxPro help file topic t work area ‘Table/DBF work area Overview of the FoxPro Language LL-17 Understanding the Language Speci 11-18 g Record Range with Scope, FOR and WHILE When a command operates on records in a table/.DBF, you can typical- ly specify a range of records that the command affects. You specify the record range using scope, FOR and WHILE clauses. Scope When a scope is included, the command acts on a specific range of records in the table/,DBF, You can include one of the following clauses to specify a record range: * ALL ~The command acts on all records in the table/ DBF. © NEXT - The command acts on a range of records beginning with the current record and continuing for the specified number of records, NEXT 1 acts on the current, record, © RECORD ~The command sets on the specified table/DBF record number . * REST ~The command acts on a range of records beginning with the current record and ending with the last record in the table/ DBF. FOR ‘The record range of a command can also be specified using FOR and WHILE clauses. When a FOR clause is used, each record that meets the specified logi- cal condition is affected by the command. Rushmore Technology and FOR Clauses ‘The Rushmore Technology is a patent-pending data access technique that permits sets of records to be accessed very efficiently, at speeds comparable to single-record indexed access. Using the Rushmore Technology, some complex database operations run hundreds or even thousands of times faster than before. FoxPro enables personal com- puters to handle truly gigantic databases, containing millions of records, at speeds comparable to mainframe database systems. In its simplest form, Rushmore speeds up single table/DBF commands utilizing FoR clauses that specify sets of records in terms of existing indexes. You can take advantage of Rushmore anywhere that a FOR clause appears. Rushmore is designed so that its speed is proportion- al to the number of records retrieved, Overview of the FoxPro Language Understanding the Language Potentially Optimizable Commands FOR Clauses AVERAGE couNT JOIN REPORT BROWSE LAB SCAN CALCULATE LIST sort CHANGE LOCATE suM —— | ———4 COPY TO | EXPORT RECALL TOTAL, COPY TO ARRAY | INDEX REPLACE The data retrieval optimization that Rushmore provides on the FOR clause expression. The FOR clause expression may be simple or complex, and data retrieval speeds can be enhanced by in- cluding an optimizable FOR expression. dependent. Optimizable expressions can be combined with the AND, OR and NOT logical operators to form a complex FOR clause expression. When basic expressions are combined into a complex expression, the result- ing expression may also be optimizable. A basic optimizable expression takes one of the following forms: or expressions must exactly match the expression on which an index is constructed and must not contain aliases. must be one of the following: <, >, =, < as <>,4, I=, can be any expression, including memory variables and fields from unrelated tables/.DBFs, Overview of the FoxPro Language L1-19 ‘Understanding the Language For example, if you have indexes on the following expressions: firstname custro ER (Lastname nirecate adr then the following are basic optimizable expressions: firstname = 'Fred’ custno 1000 UPPER lastnane) = ‘SMUT hinedate < (12/30/90) If you issue this command: STORE ‘WAS! IGTON A TO x then the following are also basic optimizable expressions: SUBSTR(X, 8,3) For additional information on Rushmore, see the Optimizing Your Ap- plication chapter in the FoxPro Developer's Guide. WHILE ‘The WHILE expression causes the command to act on each record for as long as the logical expression evaluates to true. The first time the expression evaluates to false, the command ceases without considering any remaining records. This expression is typically used with a table/DBF that’s been sorted or indexed on the field(s) included in the WHILE expression. Scope, FOR and WHILE expressions can all be used in the same FoxPro command. When FOR and WHILE are both specified, the WHILE ex- pression takes precedence and the FOR clause is usod to filter the records selected by WHILE. 11-20 Overview of the FoxPro Language Understanding the Language Table/.DBF Work Areas In FoxPro for Windows and the 32-bit Extended version of FoxPro for MS-DOS, you can open and manipulate tables/.DBPs in 225 work areas. Work areas can be identified with the letters A through J for the first ton works areas, the numbers 1— 225 or by the table/DBF alias if a table/DBF is open in a work area. In the Standard version of FoxPro for MS-DOS you can open and manipulate tables/DBFs in 25 work areas. Work areas can be iden- tified with the letters A through J for the first ten work areas, the numbers 1 ~ 25, or the table/.DBF alias if a table/DBF is open in a work area, To open a table/.DBF in a work area other than the current work area, you must specify or select the work area. When a table/DBF is opened, it is given an alias by which it can be identified. Unless you specify otherwise, the alias is the name of the table/DBF (excluding the .DBF extension). Default Alias If you open the file named CUSTOMER.DBF in work area A with the following commands, the alias CUSTOMER is automatically assigned: SLECT A The alias can then be used to identify the table/DBF in a command or function, User Assigned Alias ‘You can assign an alias to a table/.DBF when you open the file, You can open CUSTOMER.DBF (in work area A) and assign it an alias of PEOPLE with this command: ‘The alias PEOPLE can then be used to refer to the table/.DBF. An alias can consist of up to 10 letters, digits or underscores and it must begin with a letter or an underscore. FoxPro automatically creates an alias if the alias you provide contains an unsupported alias character. For complete information on assigning table/.DBF aliases, see the USE command. Overview of the FoxPro Language L121 Understanding the Language L122 FoxPro Assigned Alias There are instances where FoxPro will automatically assign an alias to a table/DBF. Ifa single table/DBF is opened simultaneously in multiple work areas by including the AGAIN key word in USE and you do not specify an alias when opening the table/DBF in each work area, a default alias is assigned automatically In FoxPro for Windows and the 32-bit Extended version of FoxPro for MS-DOS, the default aliases assigned in the first ten work areas are the work area letters A through J; the aliases assigned in work areas 11 through 225 are W11 through W225. In the Standard version of FoxPro for MS-DOS the default aliases as- signed in the first ten work areas are the work area letters A through J; the aliases assigned in work areas 11 through 25 are Wii through was. If a conflict occurs with aliases, a default alias is assigned. Using an Alias If CUSTOMER DBF is opened in work area C (or work area 3) and the default alias of CUSTOMER is assigned, you can move to this work area from another with any one of the following SELECT commands: SFLECT C SELECT 3 SELECT custaner You can also refer to fields in other work areas by prefacing the field name with the alias pointer. Preface the field name with the alias name or the work area letter and a period or the -> operator. If you're in work area C and you want to access a field called CON- ‘TACT from CUSTOMER.DBF open in work area A, use one of the follow- ing: If you're in a work area other than A, CUSTOMER.DBF is open in work area A and has the alias PEOPLE, you can use one of these commands: people-lastnane A. Lastname Overview of the FoxPro Language Understanding the Language Referencing a Work Area ‘You can reference 2 work area before a table/.DBF is opened by using the work area letter or number as shown below: SELECT A SELECT 1 Memory Variables Occasionally, memory variables are created with the same names as field names. If a memory variable has a name that’s the same as a field name, FoxPro always gives the field precedence over the memory variable. You can reference a memory variable with the same name as a field by including the M period or M-> prefix to refer to the memory variable. For example: Functions and Memo Fields FoxPro memo fields ean contain any data whatsoever, including nulls, assembler code, printer drivers, and so on, and they can be any length. However, not all string and character funetions can be used with memo fields. The following functions are the only ones that operate directly on unlimited length memo fields: # LEN( ) AT) ATC. ) ATLINE! ATCLINE( ) MEMLINES( ) ‘MLINE( ) SUBSTRO ) In addition, the REPLACE command permits an arbitrary length memo field or a substring of an arbitrary length memo field to replace another memo field. ‘Memo fields can be stored as memory resident strings. These strings can then be manipulated with all functions that operate on character data. String length is limited to 64K in the Standard version of FoxPro for MS-DOS, and is limited only by available memory in FoxPro for Windows and the 32-bit Extended version of FoxPro for MS-DOS, Overview of the FoxPro Language 11-23 Understanding the Language Typographic Conventions While most of the material in this manual deals directly with the FoxPro language, some of the commands have counterparts in the FoxPro interface. When describing actions that occur in the interface, this manual uses the following conventions. Controls When we refer to FoxPro controls, such as lists, menus, menu options, popups, popup options, push buttons, radio buttons and check boxes, the name of the control appears in bold type. For exemple: Choose Save from the File menu. Windows and Dialogs Names of FoxPro system windows and dialogs always appear in regular text with an initial capital. For example: ‘Type this statement in the Command window to open the View win- dow. Input and Output Examples of commands that you can type into the Command window or a program appear in Cour‘er font. For example: STORE ant_due ~ ant_paid 0 new bal When you issue a command or function that causes output to appear. the resulting output appears in the documentation in Courier Bold. For example: USE custaner AVERAGE yrdpuxch FOR sti 46 recoris averaged. ‘YIMPCRH 3628.19 ee L124 Overview of the FoxPro Language 2 Commands and Functions by Category FoxPro contains over 600 commands, functions and system memory variables. If you are not familiar with the FoxPro language, this chapter will help you focus on the commands and functions that meet your needs ‘This chapter is divided into two sections: * The first section, Key FoxPro Commands and Functions, lists the common commands and functions you can use to carry out basic tasks in FoxPro. If you are new to FoxPro, familiarize yourself with these commands and functions, ‘The second section, Command and Function Categories, presents the FoxPro commands and functions in an abbreviated form, grouped into categories based on purpose. Consult this section if you know what task you'd like to accomplish but are not sure of the command or function to use. Commands and Functions by Category L21 Key FoxPro Commands and Functions Key FoxPro Commands and Functions L22 ‘This section provides new users with an overview of FoxPro com- mands and functions for accomplishing basic tasks. These commands and fonctions represent the most powerful and frequently used com- mands and functions in the FoxPro language. Once you understand these commands and functions, you'll be ready to create FoxPro programs. While there are many other commands and functions you will want to learn about, this list provides a good starting point. Many FoxPro commands and functions provide backward com- patibility with Foxnast+® and other Xbase products. This is noted in the descriptions of these commands and functions in the Commands and Functions Alphabetically chapter. It isn't necessary for you to become familiar with these commands and functions. For additional information about a specific command or function, see the Commands and Functions Alphabetically chapter. Key Commands and Functions ‘Command or Function Description ‘Evaluates and the results. expressions outputs Displays and formats a specified expression, field, memory variable or array element. If you eee use the Screen Builder to create your data entry screens, you may not have to use @ ... SAY. Creates an editing region or a control. If you use @ ... GET the Screen Builder to create your data entry screens, you may not have to use @ ... GET, ; s Display ACTIVATE WINDOW | neRINE WINDOW. acces Returns a character expression with leading and trailing blanks removed. Po Adds records to the end of the current table/.DBF from another file. 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 charact Commands and Funetions by Category Key FoxPro Commands and Funetions Key Commands and Functions ‘Command or igh Funetion Description Determines if the record pointer is positioned BOR at the beginning of a table/DBF. : "Opens the Browse window, in which you can REOMEE: view and/or edit table/.DBF records. CANCEL Cancels execution of the current. program file. = Copies the contents of the current table/DBF to a new file, count Counts table/DBF records. CREATE Creates a new table/.DBF. DEFINE WINDOW _| Creates a window. DELETE Marks records in a table/.DBF for deletion REED» Returns true if the current record is marked for deletion, DISPLAY Displays table/ DBF records or expressions, DISPLAY MEMORY Displays the contents of memory variables and arrays. pispLay status Displays the status of the FoxPro environment. DISPLAY : ise? STRUCTURE Displays the structure of a table/DRF. po Executes a FoxPro program, nas Executes a sot of commands based on a Eaten logical condition owns Executes commands inside a loop while a logical condition remains true, EMPTY( ) Determines if an expression is blank. OR ) Returns true if the record pointer is 2 positioned at the end of a table/ par. BR I Attempts to lock a table/DBF and returns true if successful. Executes statements in a loop a specified number of times. Returns true if CONTINUE, FIND, LOCATE or SEEK is successful, FOR ... ENDFOR FOUND, ) Commands and Funetions by Category 12:3 Key FoxPro Commands and Functions L2-4 Key Commands and Functions ‘Command or Function Description Copies the contents of memory variables or array elements to fields. IF ... ENDIF Conditionally processes commands. GATHER INDEX Creates an index file to order a table/.DBF. INSHRTINTO | Appends a record to an existing table/.DRF. ‘LABEL Creates labels from a table.DBF and a label file LOCATE Locates a table/,DBF record. Attempts to lock a table/-DBF record or records. LOCK( } Returns a lower-case charact character expression. LOWER ) er string from a Opens a text editing window for a FoxPro program. ‘MODIFY FILE Opens a text editing window for a text file. MODIFY COMMAND ‘Opens the Label Design window in FoxPro for MODIFY LABEL MS-DOS or the Report Layout Window in FoxPro for Windows. MODIFY MENU Opens a Menu Design window. MODIFY PROJECT Opens a Project window. MODIFY QUERY Opens an RQBE window, MODIFY REPORT Opens the Report Layout window. MODIFY SCREEN Opens the Screen Design Window MODIFY STRUCTURE, Modifies the structure of a table/DBF Specifies a command that executes when an error occurs. ON ERROR Removes all records marked for deletion, and reduces the size of a memo file. PACK ‘Assigns data passed from a calling program PARAMETERS to local memory variables. Hides specified memory variables or arrays PRIVATE that were defined in a calling program from the current program. Commands and Functions by Category Key FoxPro Commands and Functions Key Commands and Functions Command or Function Description SGENORE Identifies the beginning of a procedure in a program file. Quit Exits FoxPro. READ Activates objects created with @ ... GETS and @... EDITS REPLACE Updates table/ DBF records REPORT Produces a report. Moves the record pointer through the current "AN table(DBF and executes a block of commands | for each record, SEEK | Searches the current indexed table/DBF. SELECT Activates the specified work area, SELECT — SQL Retrieves data from one or more tables/.DBFS. Opens one or more index files for use with SET INDI SET INDEX the current table/ DBP. Designates a controlling master index file or master tag. SET ORDER Creates a relationship between two or more tables/.DBPs, SET RELATION Creates one-to-many relationships between SEE SKIP tables/DBFs. Determines whether or not FoxPro displays command results. SHOW GETS Redisplays all objects. SET TALK SKIP Moves the record pointer. SORT Sorts a table/.DBF. Stores data to a memory variable or a memory variable array Returns an upper-case character string from a character expression. STORE UPPER Commands and Functions by Category 12-5 Command and Function Categories Command and Function Categories The table below shows the command and function categories, grouped by their general purpose, and the page number in this chapter where you can find each category and its associated commands and func- tions, For additional information about specific command or func- tion, see the Commands and Functions Alphabetically chapter. Data Types Character Functions 12-7 Numeric Functions L2-10 Date and Time Functions L2- 12 Data Conversion L2- 13 Field Manipulation 12-14 Table/.DBF Manipulation 12-15 Record Manipulation 12-17 Indexes 12-19 Relations 12-20 Programming | Debugging and Error Handling Program Execution Structured Programming Low-Level File Functions Memory Variable Manipulation Array Manipulation Event Handlers DDE and OLE Input and Data Formatting Output Printing ‘Menu Bars and Popups ‘Windows ‘Typing, Keyboard and Mouse Reports and Labels FoxPro Environment Environment —_ File Management FoxPro in a multi-user environment Network Commands & Functions 126 Commands and Funetions by Category Data Types ~ Character Functions Data Type: Character Functions Funetions in this category operate on character type data. $— Determines whether a character string is contained inside another character string or memo field, ALLTRIM( ) — Returns the specified character expression with the leading and trailing blanks removed. ANSITOOEM( ) — In FoxPro for Windows, converts each character in a character expression to the corresponding character in the MS-DOS (OEM) character set. ASC( ) - Returns the ASCII code for the leftmost character in a char- acter string. AT( ) — Returns the position from the left (as an integer) of the first occurrence of a character expression within another character expres- sion or memo field, ATC( ) — Returns the from the left position (as an integer) of the first occurrence of a character expression within another character expres- sion or memo field. Unlike the aT ) function, aTC( ) is not case sensi- tive. ATCLINE( ) — Returns the line number of the first occurrence of a character expression within another character expression or memo field. ATOLINE( } is not case sensitive. ATLINE( ) — Returns the line number of the first occurrence of @ char- acter expression within another character expression or memo field. BETWEEN( ) ~ Determines whether the value of an expression lies between the values of two other expressions of the same data type. CHR( ) ~ Returns the character associated with the specified numeric ASCII code. CHRTRAN( ) - Translates a character string using two other strings as translation tables. CTOD( )— Converts a character type date to a date type date. DIFFERENCE( ) ~ Returns a number representing a relative phonetic difference between two character strings. DTOC( )— Converts a date to a character type date. EMPTY( ) — Determines whether or not an expression is empty, Commands and Functions by Category L27 Data Types — Character Functions L28 INLIST( ) — Determines whether or not an expression matches one in a series of expressions of the same data type. INT( ) — Converts a number to its integer value by discarding the decimal portion. ISALPHA( ) — Returns true (.T.) if the leftmost character in the specified character expression is an alphabetical character. ISDIGIT( ) — Returns true (T.) if the leftmost character of the specified character expression is a digit (0 - 9). ISLOWER( ) — Returns true (‘T.) if the leftmost character in the specified character expression is a lower-case alphabetic character. ISUPPER( ) — Returns true (.7.) if the leftmost character in a charac- ter expression is an upper-case alphabetic character. LEFT( ) — Returns a specified number of characters, starting from the leftmost character in a character string. LEN( ) - Returns the number of characters in a character expression. LIKE( ) — Determines whether or not a character expression, which can contain wildcard characters, matches another character expres- sion. LOWER( ) - Returns a specified character expression in all lower-case letters. LTRIM( ) — Returns the specified character expression with leading blanks remo MAX( ) — Returns the expression with the highest ASC or numerie value, or latest date, from a list of character, numeric or date expres- sions, MIN( ) - Returns the expression with the lowest ASCII or numeric value, or earliest date, in a series of character, numeric or date ex- pressions. OCCURS ) ~ Returns the number of occurrences of a charaeter string within another character string. OEMTOANSK ) ~ In FoxPro for Windows, converts each character in a character expression to the corresponding character in the ANSI character set. PADC( ) - Returns the specified expression padded on both sides with a specified character. PADL( ) — Returns the specified expression padded on the left with a specified character. Commands and Funetions by Category Data Types ~ Character Functions PADR( ) — Returns the specified expression padded on the right with a specified character. PROPER( ) ~ Returns the specified character expression with the ini- tial letter of each word upper-case and the remaining characters lower-case. RAT( ) — Searches a character string or memo field for the last occur- rence of another character string and returns as an integer the posi- tion where it was found. RATLINE( ) ~ Searches a character string or memo field for the last occurrence of another character string and returns as an integer the line number where it was found. The value returned is dependent upon the value specified by the SkT MEMOWLDTH command. REPLICATE( ) — Returns a character string that contains a specified character expression repeated a given number of times. RIGHT( ) — Returns the specified number of characters from the rightmost position in a character string, RTRIM( ) — Returns the specified character expression with all trail- ing blanks removed. SOUNDEX( ) ~ Returns a phonetic code representing a character ex- pression, SPACE( ) ~ Returns a character string composed of a specified num- ber of spaces STR( ) — Returns the character string equivalent of a numeric expres- sion. STRTRAN( ) ~ Searches a character expression for occurrences of a second character expression, then replaces each occurrence with a third character expression, STUFF( )— Returns a character string resulting from the replacement of a specified portion of one character expression with another charac- ter expression. SUBSTR( ) ~ Returns a specified number of characters from the given expression or memo field. SYS(10) - Returns a character type date from a numeric day number. SYS(15) — Returns a character from a translation table. SYS(20) - ‘Transforms a character expression containing German text to a character string. SYS(2007) — Returns the check sum value of a character string. Commands and Functions by Category 12-9 Data Types - Numeric Functions TRANSFORN( ) ~ Formats a character or numeric expression using PICTURE and FUNCTION eodes. TRIM( ) — Returns the specified character expression with all trailing blanks removed. TXTWIDTH( ) — Returns the length of a character expression in a specific font in FoxPro for Windows. TYPE( ) — Returns the data type of the expression (character, numeric, logical, date or memo). UPPER( ) — Returns the specified character expression in upper-case. Numeric Functions 12-10 You use the commands and functions in this category to operate on and/or return numeric data. % — Returns the remainder obtained by dividing a numeric expression by another numeric expression. ABS( ) — Returns the absolute value of a specified numeric expres- sion. ACOS( ) ~ Returns the are cosine of a specified numeric expression. ASIN( )— Returns the are sine of a specified numeric expression. ATAN( ) ~ Returns the are tangent of a specified numeric expression, ATN2( )— Returns the arc tangent from the specified sine and cosine values. BETWEEN( ) — Determines whether or not the value of an expression lies between the values of two other expressions of the same data type. CALCULATE - Performs financial and stati ical operations. CEILING( ) ~ Returns the nearest integer that is greater than or equal to the specified numeric expression. COS )— Returns the cosine of an angle. DTOR( )- Converts degrees to radians EMPTY( ) ~ Determines whether or not a numeric expression equals zero. EXP( ) — Returns the value of e*, where x is the specified numeric expression. FLOOR( ) - Returns the nearest integer less than or equal to the specified numeric expression. Commands and Funetions by Category Data Types ~ Numeric Functions FV( )~ Returns the future value of an investment. INLIST( ) — Determines whether or not an expression matches one in a series of expressions of the same data type. INT( ) — Returns the integer portion of a numeric expression, LOG( ) - Returns the natural logarithm (base e) of the specified numeric expression. LOG10( ) - Returns the common logarithm (base 10) of the specified numerie expression. MAX( ) - Returns the expression with the highest ASCII or numeric value, or latest date, from a list of character, numeric or date expres- sions. MIN( ) — Returns the expression with the lowest ASCII or numeric value, or the earliest date, in a series of character, numeric or date expressions, MOD( ) ~ Returns the remainder from a division operation. PAYMENT( ) ~ Returns the amount of each periodic payment on a fixed interest loan. PI(_) ~ Returns the numeric constant r. PV( ) - Returns the present value of an investment. RAND( ) — Returns a random number between 0 and 1. ROUND( ) ~ Returns a numeric expression rounded to a specified number of decimal places. RTOD( ) ~ Converts radians to degrees. SET DECIMALS - Specifies the number of decimal places displayed in numeric results. SIGN( ) - Returns -1 if the numeric expression is negative or 1 if the numeric expression is positive, SIN( ) - Returns the sine of an angle. SQRT( ) - Returns the square root of the specified numeric expres- sion TAN( )— Returns the tangent of an angle. VAL( ) ~ Returns a numeric expression from a specified character ex- pression composed of numbers Commands and Functions by Category L2-11 Data Types — Date and Time Functions Date and Time Functions L2-12 You use the functions in this section to generate and manipulate date and time data, BETWEEN( ) - Determines whether or not the value of an expression lies between the values of two other expressions of the same data type. CDOW( ) ~ Returns the day of the week from a given date expression. CMONTH( )~ Returns the name of the month for a given date. CTOD( )~ Returns a date type date for a given character type date. DATE( ) ~ Returns the current system date. DAY( )— Returns the numeric day of the month for a given date. DMY( ) - Returns a date expression in Day Month Year format. DOW( ) ~ Returns the numeric day of the week for a given date. DTOC( ) ~ Returns a character type date for a specified date expres- sion. DTOS( ) - Returns a character string date in YYYYMMDD format for a specified date expression. EMPTY( ) - Determines whether or not an expression is empty, GOMONTH( ) - Returns the date that is a specified number of months before or after a given date. INLIST( ) — Determines whether or not an expression is contained in a series of expressions of the same data type. MAX( ) ~ Returns the expression with the highest ASC or numeric value, or latest date, from a list of character, numeric or date expres- sions, MDY( ) — Returns the specified date expression in Month Day Year format, MIN( ) — Returns the expression with the lowest ASC or numeric value, or earliest date, from a list of character, numerie or date ex- pressions, MONTH( ) - Returns the numeric month for a given date. SECONDS( )— Returns the number of seconds elapsed since midnight in the format seconds.thousandths. SET HOURS - Sets the system clock to a 12- or 24-hour format. Commands and Funetions by Category Data Types — Data Conversion SET MARK TO — Specifies a delimiter in the display of date expres- sions. SYS(1) — Returns the Julian day number for the current system date. SYS(2) — Returns the number of seconds elapsed since midnight. SYS(10) — Returns a character type date from a specified Julian day number. SYS(11) - Returns a Julian day number equivalent to a given date. TIME( ) ~ Returns the current system time. YEAR( )~ Returns the year from the specified date expression. Data Conversion ‘You use the functions in this category to convert data from one type to another, ANSITOOEM( ) — In FoxPro for Windows, converts each character in a character expression to the corresponding character in the MS-DOS (OEM) character set. CHR( ) - Returns the character corresponding to the specified ASCII number. CTOD( ) - Returns a date type date from a specified character type date. OEMTOANSK( ) — In FoxPro for Windows, converts each character in a character expression to the corresponding character in the ANSI character set. SYS(10) ~ Returns a character type date from a specified Julian day number, SYS(15) ~ Returns a character from a translation table. TRANSFORM( ) - Formats character and numeric expressions using PICTURE and FUNCTION codes. Commands and Functions by Category 12-13 ‘Tables/.DBFs ~ Field Manipulation Tables/.DBFs Field Manipulation L214 You use the commands and functions in this section to manipulate table/.DBF fields. AFIELDS( ) — Places table/.DBF structure information into an array. DELETED( ) — Returns true (-T.) if the current record is marked for deletion. FCOUNT( ) - Returns the number of fields in the current or a specified table DBF. FIELD( ) — Returns the name of a field, referenced by number, in the current or specified table/.DBF. FSIZE( ) — Returns the size in bytes of a specified field. GATHER — Stores the contents of memory variables or array elements to fields. LUPDATE( ) ~ Returns the date a table DBF was last updated. NDX( ) - Returns the name of an open .IDX index file for a table/.DBF in the selected or a specified work area. SCATTER ~ Copies data from the current record to an array or a set, of memory variables. SET BLOCKSIZE ~ Specifies how FoxPro allocates disk space for the storage of memo fields. SET EXACT - Specifies whether an exact character for character match of two strings is necessary in order for FoxPro to consider the strings equal. SET TEXTMERGE - Enables or disables evaluation of table/DBF fields, memory variables, functions and expressions that are sur- rounded by text merge delimiters. SET TEXTMERGE DELIMITERS — Specifies the text merge delimiters ‘SYS(14) - Returns the key expression of an index file or index tag. Commands and Functions by Category ‘Tables/. DBFs ~ Table/.DBF Manipulation Table/.DBF Manipulation You use the commands and functions in this section to create, manipulate and monitor tables/.DBFs. ALIAS( )~ Returns the alias of a specified work area. APPEND — Enables you to add records to the end of a table/.DBF. APPEND FROM — Adds records to the end of a table/.DBF from another file. AVERAGE — fields. Computes the arithmetic mean of numeric expressions or BOF( ) — Returns true (.T.) if the record pointer is positioned at the beginning of a table/DBF. BROWSE - Opens a Browse window so you can view and/or edit table/.DBF records. CHANGE or EDIT — Displays fields for editing, CLEAR FIELDS ~ Releases all fields created with SET FIELDS TO. CLOSE DATABASES ~ Closes all open table/.DBP, index, memo and format files, CLOSE MEMO ~ COPY MEMO - Copies the contents of a memo field to a text file. COPY STRUCTURE - Copies the structure of a table/DBF to another table/.DBF, ses memo editing windows. COPY STRUCTURE EXTENDED — Copies information about the struc- ture of one table/.DBF into records in a new table/DBF, COPY TO — Copies the contents of the current table/DBF to another table DBF. COUNT - Counts specified records. CREATE — Creates a new table/ DBF. CREATE FROM - Creates a new table/.DBF whose structure is ob- tained from a COPY STRUCTURE EXTENDED table/DBF. CREATE QUERY - Opens the RQBE window so you can create a query. CREATE TABLE — Creates a table/.DBF with specified fields. DBF( ) ~ Returns the path and name of the table/DBF open in the specified work area. Commands and Functions by Category 12-15 ‘Tables/.DBFs ~ Table/.DBF Manipulation 12-16 DELETE ~ Marks records for deletion. DELETED( ) - Returns true ('T.) if the current record is marked for deletion. DISPLAY STRUCTURE — Displays the structure of a table/.DBF, EOF( ) — Returns true (.T.) if the record pointer is positioned at the end of a table/ DBF. EXPORT — Copies data from a FoxPro table/-DBF to a file with a dif- ferent format. FLUSH — Saves table/ DBF and index modifications to disk. IMPORT — Imports data from a different file format to create a new FoxPro table/-DBF. JOIN — Creates a table/ DBF by joining two existing tables/.DBFs. MEMLINES( ) ~ Returns the number of line: a memo field. MLINE( ) - Returns a specific line from a memo field as a character string. MODIFY GENERAL — Opens an editing window for a general field in FoxPro for Windows. MODIFY MEMO — Opens an editing window for a memo field. MODIFY QUERY - Opens the RQBE window in which you can modify or create a query. MODIFY STRUCTURE ~ Allows you to modify the current table/.DBF structure, PACK — Removes all records marked for deletion and reduces the size of a memo file. RECALL — Unmarks records that are marked for deletion. REPLACE ~— Updates one or more fields with data from one or more expressions. SELECT — Activates the specified work area. SELECT ~ SQL - Retrieves data from one or more tables/.DBFs. SET ANSI ~ Specifies how SQL string comparisons are made. SET AUTOSAVE ~ Determines whether or not FoxPro flushes data buffers to disk when you exit a READ or return to the Command win- dow. Commands and Functions by Category ‘Tables/.DBFs ~ Record Manipulation SET DELETED ~ Specifies whether or not FoxPro processes records marked for deletion. SET FIELDS - Specifies access to all fields or only those fields in- cluded in a field list. SET OPTIMIZE ~ Enables or disables Rushmore optimization. SORT — Sorts records in the current table/.DBF and outputs the sorted data to a new table/.DBF. SUM - Totals all or specified numeric field values in the current table/.DBF. TOTAL — Creates summary records in a new table/.DBF, with one record for each group of identically-keyed records in the current table/-DBR. UPDATE ~ Updates fields in the current table/.DBF with data from another table! DBF. USE - Opens a table/DBF and associated index files. USED( ) — Returns true (.T.) if a table/.DBF is open in a specified work area. ZAP — Removes all records from a table/.DBF. Record Manipulation ‘You use the commands and functions in this section to select records within a table/DBF or position the record pointer. APPEND — Adds a record to the end of a table/DBF. APPEND FROM ~ Adds records to a table/.DBF from another file. APPEND GENERAL — Imports OLE objects into a general field. APPEND MEMO — Copies the contents of a file to a memo field. BOF( ) — Returns true ('T.) if the record pointer is positioned at the beginning of a table/ DBF. CONTINUE ~ Continues the previous LOCATE. EOF( ) - Returns true (,T.) if the record pointer is positioned at the end of a table/.DBF. FILTER( )— Returns the filter expression specified by SET FILTER for the current or specified table/.DBF. Commands and Functions by Category L217 ‘Tables/.DBFs — Record Manipulation FOUND( ) — Returns true (.T.) if most recent CONTINUE, FIND, LOCATE or SEEK was successful. GO or GOTO ~ Positions the record pointer at the specified record number. INSERT ~ Inserts a new record into a table/.DBF. INSERT - SQL - Appends a record to the end of a table/ DBF. LOCATE — Sequentially searches the selected table/DBF for the first record that matches a given expression. LOOKUP( ) - Searches a table/DBF for the first record with a field matching the specified expression and, if it is found, moves the record pointer to the record and returns the value of a specified field in that record. RECCOUNT( ) ~ Returns the number of records in a table/ DBF. RECNO( )— Returns the current record number. RECSIZE( ) — Returns the size of a table/.DBF record. SEEK — Searches the current indexed table/DRF for the first occur- rence of a record whose index key expression matches the specified expression, and positions the record pointer on the record if it is found SEEK( ) — Searches the current indexed table/.DBF for the first occur- rence of a record whose index key expression matches the specified expression, and positions the record pointer on the record. Returns true (.T.) if the search was successful SET FILTER - Specifies a condition that records in the selected table/.DBF must meet to be accessible. SET NEAR — Determines where the record pointer is positioned after SEEK unsuccessfully searches for a record. SET RELATION — Links or unlinks two or more open tables/.DBFs. SET SKIP — Sct a one-to-many relation between two related tables/.DBFs. SKIP — Moves the record pointer forward or backward in the current or specified table/.DBF. Commands and Funetions by Category Tables/.DBFs ~ Indexes Indexes You use the commands and funetions in this section to perform opera- tions on and return information about index files. CDX(_) — Returns the names of open .CDX compound index files. CLOSE INDEX ~ Closes all open index files in the selected work area. COPY INDEXES ~ Copies single-entry index files to a compound index file. COPY TAG — Creates a single-entry index file from a tag in a com- pound index file DELETE TAG — Removes a tag or tags from a .CDX compound index file INDEX ~ Creates an index file to display a table/.DBF in logical order. KEY( ) — Returns the key index expression of the master (controlling) index file. MDX( )~ Returns the names of open .CDX compound index files. NDX( ) — Returns the name of an open index in a specified work area. ORDER( ) ~ Returns the name of the controlling index file or tag for the current or specified table/.DBF. REINDEX ~ Rebuilds all open index files for the current table/:DBF. ‘SET INDEX — Selects one or more index files for use with the current table DBF. SET ORDER — Designates a controlling index file or tag for the cur- rent or specified table/.DBR. SET UNIQUE - Specifies whether or not records with duplicate index key values appear in an index file. SYS(14) ~ Returns the index expression of an index file. SYS(21) ~ Returns the index position number of the controlling index for the current table/.DBF. SYS(2021) — Returns the index filter expression for a single-entry index file or a tag, for the current or specified tableDBF. TAG( ) — Returns a tag name from a .CDX compound index file, or the name of an .IDX single-entry index file. Commands and Functions by Category 12-19 ‘Tables’. DBFs ~ Relations 12-20 You use the commands and functions in this section to establish or break relations between tables/.DBFs. RELATION( ) — Returns the relational expression for the current or specified table/DBF. SELECT - SQL — Retrieves data from one or more tables/DBFs, SET RELATION ~ Links or unlinks two or more open tables/.DBFs. SET RELATION OFF - Breaks an established relation between the current table/DBF and another open table/DBF. SET SKIP — Creates one-to-many relationships between related tables/.DBFs. TARGET( )— Returns the alias of a table/.DBF that is the target for a relation, Commands and Funetions by Category Programming - Debugging and Error Handling Programming Debugging and Error Handling You use the commands and functions in this section to perform various debugging operations for FoxPro programs ERROR( ) — Returns the error number for an error that triggered an ON ERROR routine. EXTERNAL - Alerts the Project Manager to an undefined reference. LINENO( ) - Returns the line number of the line being executed in a program. MESSAGE( ) - Returns the current error message or the contents of the program line that caused the error. NOTE | * | && — Indicates non-executing comments in a program. ON ERROR ~— Specifies a command that executes when an error oc- curs. ON READERROR ~ Specifies a command that executes in response to a data input error. ON( ) — Returns the command assigned to ON ERROR, ON ESCAPE, ON KEY, ON KEY LABEL, ON PAGE or ON READERROR. PROGRAM( ) ~ Returns the name of the program currently being ex- ecuted or the name of the program that was executing when the last error occurred. RETRY — Returns control to the calling program and re-executes the most. recently executed command in that program. SET DEBUG — Enables or disables access to the Debug and Trace windows, SET DEVELOPMENT - Causes FoxPro to compare the creation date and time of a program file with those of its compiled object file when you run the program. SET ECHO -— Activates the Trace window for program debugging. SET TALK — Determines whether or not FoxPro displays command processing information. SET TRBETWEEN - Enables or disables tracing between breakpoints in the Trace window. Commands and Functions by Category L221 Programming ~ Program Execution SYS(2018) — Returns the error message parameter for the most recent error. VARREAD( ) ~ Returns the name of the current memory variable, array element or field used to create the current @ ... GET field or control. WAIT — Halts FoxPro operation until you press a key or click the mouse, Program Execution 12.22 You use the commands and functions in this section to perform ac- tions associated with executing, suspending and terminating FoxPro programs. BUILD APP — Creates an application APP file from a project file. BUILD EXE ~ For owners of the FoxPro Distribution Kit, ereates an executable (EXE) file from a project. BUILD PROJECT - Creates and builds a project file. CALL — Executes a binary file that has been placed in memory with LOAD. CANCEL - Cancels execution of the currently running program. CLEAR PROGRAM - Clears the compiled program buffer, CLOSE ALL — Closes all files in all work areas and selects work area 1. CLOSE PROCEDURE - Closes the file you opened with SET PROCE DURE. COMPILE — Compiles one or more program files and creates an object file for each source file, CREATE PROJECT - Opens the Project window and enables you to create a project file. #DEFINE ... #UNDEF ~ Creates and releases compile-time constants. DO ~ Executes a command or procedure file FUNCTION — Defines the start of a routine. #IF ... #ENDIF — Conditionally includes or excludes source code at compile time. LOAD — Places a binary file in memory to be executed with CALL. Commands and Funetions by Category Programming — Program Execution MODIFY PROJECT ~ Opens the Project window and enables you to modify or create a project file. PARAMETERS — Assigns data passed from a calling program to local memory variables. PARAMETERS( ) — Returns the number of parameters that were passed to the most recently called procedure. PROCEDURE - Identifies the beginning of a procedure within a pro- gram file, RELEASE LIBRARY — Closes an external library file. RELEASE MODULE - Releases a loaded binary file from memory. RESUME ~ Resumes the execution of a suspended program. RETURN ~ Returns control to the calling program. RUN | ! — Runs an external command or application from within FoxPro. SET ESCAPE — Determines whether or not pressing the Escape key interrupts program and command execution. SET LIBRARY ~ Opens an external library file. SET LOGERRORS ~ Determines whether or not FoxPro sends com- pilation error messages to a text file SET PROCEDURE — Opens a procedure file. SET SYSMENU — Enables or disables access to the FoxPro system menu bar during program execution. SET UDFPARMS - Specifies whether parameters are passed to a user-defined function (UDF) by value or reference. ‘SUSPEND — ‘SYS(2015) — Returns a unique procedure name. juspends program execution. WAIT — Halts FoxPro operation until you press a key or click the mouse Commands and Functions by Category 12-23 Programming ~ Structured Programming Structured Programming You use the command and functions in this section to control program execution and branching within a FoxPro program. DO CASE ... ENDCASE - Executes the first statement block after DO CASE and before ENDCASE whose associated conditional statement evaluates to true (.T.), DO WHILE ... ENDDO ~ Executes a block of statements w ditional loop. acon- EXIT — Exits a DO WHILE, FOR ... ENDFOR or SCAN ... ENDSCAN loop. FOR ... ENDFOR ~ Exccutes statements in a loop a specified number of times, #IF ... ENDIF — Conditionally includes or excludes source code at compile time. IF ... ENDIF — Conditionally executes a set of commands based on the outcome of a logical expression. lIF(_) — Returns one of two values depending on the value of a logical expression, SCAN ... ENDSCAN - Moves the record pointer through the current table/ DBF and executes a block of commands for each record that meets the specified conditions. Low-Level File Functions L224 You use the following functions to create and manipulate files and communication ports at a low level. Low-level file functions should be used carefully, especially when manipulating tables/.DBFs. FCHSIZE( ) — Changes the size of a file opened with a low-level file funetion, FCLOSE( ) — Closes a file or communication port opened with a low- level file function, FCREATE( ) - Creates and opens a low-level file. FEOF( ) ~ Determines whether or not the file pointer is positioned at the end of a file FERROR( ) ~ Returns 0 if the last low-level function was successfully executed; otherwise, returns a value corresponding to the cause of the error. FFLUSH( ) — Flushes to disk a file opened with a low-level file func- tion, Commands and Functions by Category Programming — Memory Variable Manipulation FGETS( ) — Returns a series of bytes from a file or a communication port opened with a low-level file function. FOPEN( ) — Opens a file or communication port for use with low-level file functions. FPUTS( ) — Writes a character string, carriage return and line feed to a file or a communication port opened with a low-level file function. FREAD( ) ~ Returns as a character string a specified number of bytes from a file or a communication port. FSEEK( ) — Moves the file pointer in a file opened with a low-level file function, FWRITE( ) - Writes a character string to a file or communication port opened with a low-level file function. HEADER( ) — Returns the number of bytes in the header of the cur- rent or specified table/ DBF. Memory Variable Manipulation ‘You use the commands and functions in this section to assign values to memory variables. & — Performs macro substitution on the memory variable it precedes. Assigns the value on the right of the sign to the memory variable on the left. ACOPY( )~ Copies elements from one array to another array ADEL( ) — Deletes an element, row or column from an array. ADIR( ) ~ Places information about specified files into an array. AELEMENT( ) — Returns an array element’s number from its row and column subscripts, AFIELDS( ) ~ Places table/.DBF structure information into an array AINS( ) - Inserts an element, row or column into an array. ALEN( ) - Returns the number of elements, rows or columns in an array. ASCAN( ) — Searches an array for an expression. ASORT( ) - Sorts elements in an array in ascending or descending order. Commands and Functions by Category 12-25 Programming ~ Memory Variable Manipulation L226 ASUBSCRIPT( ) ~ Returns a row or column element from an array element number. AVERAGE ~ Computes the arithmetic mean of numeric expressions or fields. CLEAR ALL — Releases from memory all memory variables and all user-defined menu bars, popups and Windows, closes all tables/.DBFs and associated files, and selects work area 1. CLEAR MEMORY — Removes all public and private memory variables from memory. COUNT ~ Counts the number of records that meet the specified eondi- tions, optionally storing the result in a memory variable. DISPLAY or LIST MEMORY — Displays the current contents of memory variables. GETEXPR - Invokes the Expression Builder dialog and stores the user-constructed expression to a memory variable. PARAMETERS ~— Identifies variables passed from a calling program. PRIVATE ~ Makes previously defined memory variables unavailable to the currently executing program. PUBLIC — Defines global memory variables, REGIONAL - Creates regional memory variables, RELEASE - Releases memory variables, libraries, or the definitions of user-defined menus, menu pads, popups, popup options and windows. RESTORE FROM ~ Restores memory variables from a memory vari- able file or a memo field. SAVE TO ~ Saves memory variables to a memory variable file or a memo field. STORE ~ Assigns a value to a memory variable or initializes an array, SUM — Totals all or specified numeric field values in the current table/DBF. WAIT — Halts FoxPro operation until you press a key or click the mouse. Commands and Functions by Category Programming — Array Manipulation Array Manipulation You use the commands and functions in this category to work with arrays. ACOPY( )— Copies elements from one array to another array. ADEL( ) ~ Deletes an element, row or column from an array. ADIR( ) ~ Places information about specified files into an array. AELEMENT( ) - Returns the number of an array element from the element’s subscripts. AFIELDS( ) — Places table/.DBF structure information into an array. AFONT() - In FoxPro for Windows, places information about avail- able fonts into an array. AINS( ) — Inserts an element, row or column into an array ALEN( ) — Returns the number of elements, rows or columns in an array. APPEND FROM ARRAY ~ Adds records to the current table/.DBF and fills the records with data from an array. ASCAN( ) - Searches an array for an expression. ASORT( ) - Sorts a memory variable array in ascending or descend- ing order. ASUBSCRIPT( ) - Returns a row or column element from an array element number. COPY TO ARRAY — Copies data from the current table/DBF to an array. DECLARE — Creates one or more arrays. DIMENSION - Creates one or more arrays. GATHER — Stores the contents of memory variables or array elements to fields. INSERT FROM ARRAY -— Inserts records into the current table/.DBF immediately after the selected record and fills them with data from an array. SCATTER — Copies data from the current record to an array or a set of memory variables. Commands and Functions by Category L227 Programming ~ Event Handlers Event Handlers 12-28 These commands and functions specify the action FoxPro takes when a given event occurs. ON ERROR - Specifies a command that executes when an error oc- curs. ON ESCAPE - Specifies 2 command that executes when you press Escape during program and command execution. ON KEY — Specifies a command that executes when you press any key during program execution, ON KEY LABEL ~ Specifies a command that executes when you press a specific key, ON PAD — Assigns a routine to a menu pad on a menu bar. ON SELECTION PAD ~ Specifies a command that executes when you choose a specific menu bar pad. ON SELECTION POPUP — Assigns a routine to a menu popup. ON( ) ~ Returns the command assigned to ON ERROR, ON FS KEY, ON KEY LABEL, ON PAGE or ON READERROR. TAPE, ON Commands and Functions by Category Programming ~ DDE and OLE DDE and OLE You use the commands and functions in the section, available only in FoxPro for Windows, to operate with other Windows-based applica- tions. @ ... SAY — Displays an OLE object. APPEND GENERAL — Imports OLE objects into a general field. DDEAbortTrans(_) - Aborts an asynchronous DDE transaction. DDEAdvise( ) ~ Creates a DDE notify link or an automatic link. DDEEnabled( ) - Enables or disables DDE processing or returns its status. DDEExecute( ) — Sends a command to another application. DDElnitiate( ) — Establishes a channel between FoxPro for Windows and another Windows-based application. DDELastError( )~ Returns an error number for the last DDE funetion, DDEPoke( ) - Sends data between client and server applications. DDERequest( ) ~ Requests data from a server application. DDESetOption( ) ~ Changes or returns DDE sottings DDESetService( ) ~ Creates, releases or modifies service names and settings. DDESetTopic( ) - Creates or releases a topic name for 2 service name. DDETerminate( ) — Closes a channel established with DDEInitiate( MODIFY GENERAL — Opens a general field editing window. RUN |! — Runs an external command or application from within FoxPro, Commands and Functions by Category 12-29 Input and Output — Data Formatting Input and Output Data Formatting 12-30 You use these commands and functions to format and display data from records, fields, memory variables or arrays. Entries in this sec- tion also support general display features, \1 \— Outputs the line of text that follows \ or \\ to the text merge file specified with SET TEXTMERGE TO and/or to the screen 2 — Displays the value of the specified expression on the next line. 7? — Displays the value of the specified oxpression at the current posi- tion on the current line. @ ... SAY ~ Formats and displays a specified expression, field, memory variable or array element. @ ... GET ~ Creates an editing region for a field, memory variable or array element. @ ... GET — Check Boxes — Creates check boxes. +» GET — Invisible Buttons — Creates invisible buttons. -. GET — Lists ~ Creates lists -» GET — Popups — Creates menu popups. +» GET — Push Buttons ~ Creates push buttons. GET — Radio Buttons ~ Creates radio buttons. +» GET — Spinners — Creates spinners in FoxPro for Windows. . Edit — Text Edit Regions — Creates text editing regions. BOX ~ Draws a box using specified coordinates, ©8888 088600 «+ CLEAR ~ Clears a portion of the screen or active window. @ .., FILL ~ Changes colors within an area of the screen or a win- dow. ACTIVATE SCREEN - Sends all subsequent output to the screen in- stead of to the current window. AFONT( ) — Places information about available Windows fonts into an array. APPEND ~ Adds a record to the end of a table/.DBF. Commands and Functions by Category Input and Output ~ Data Formatting BROWSE - Opens a Browse window so you can view and/or edit table! DBF records. CHANGE or EDIT ~ Displays fields for editing. CLEAR — Erases the contents of the screen or eurrent output window. CLEAR GETS ~ Releases all pending GET statements CLEAR READ - Exits the active RWAD. CLOSE FORMAT - Closes the format file open in the current work area. COL( )- Returns the current column position of the cursor. CREATE SCREEN — Opens the Screen Design window and enables you to create a sereen. DISPLAY or LIST — Displays records from a table/.DBF. FONTMETRIC( ) ~ Returns Windows font attributes. INKEY( ) - Returns a number corresponding to the first key or mouse click in the typeahead buffer. MODIFY SCREEN — Displays the Sereen Design window and enables you to modify or create a screen. OBJNUM( ) — Returns the object number of the specified @ ... GET object: RDLEVEL( )- Returns the current READ level. READ ~ Activates @ ... GET objects and @ .. EDIT objects for editing. READKEY( ) ~ Returns an integer that represents the key pressed by the user in order to exit an editing command. ROW( ) - Returns the current row position of the cursor. SCOLS{ ) ~ Returns the number of columns available on the screen. SCROLL - Scrolls an area of a user-defined window, the desktop (- FoxPro for MS-DOS) or the main FoxPro window (FoxPro for Windows) up, down, left. or right. SET BLINK — Blinks screen elements or increases the number of colors available in FoxPro for MS-DOS. Commands and Functions by Category L231 Input and Output ~ Data Formatting 12-32 SET CARRY — Determines whether or not FoxPro carries data for- ward from the current record to the new record created with APPEND or INSERT. ‘SET CLEAR — Determines whether or not SET FORMAT 10 and QUIT clear the screen. SET COLOR - Controls the color of the desktop (FoxPro for MS-DOS), the main FoxPro window (FoxPro for Windows), windows, dialogs, and soon. SET CONFIRM -— Specifies whether or not Enter or tab must he pressed to exit an input field SET CONSOLE ~ Enables or disables output to the desktop (FoxPro for MS-DOS) or the main FoxPro window (FoxPro for Windows), SET CURSOR — In FoxPro for MS-DOS, determines whether or not the cursor displays during a pending @ ... GET, INKEY( ), or WAIT. SET DECIMALS — Sets the number of decimal places displayed in cer- tain output operations. SET DEVICE — Directs the output of @ ... SAY commands to the sereen, a printer or a file, SET FIXED - Fixes the number of decimal places in the display of numeric data. SET HEADINGS ~ Determines whether or not column titles are dis- played for each field in the DISPLAY, LIST, SUM and AVERAGE com- mands. SET MARK TO - Specifies a delimiter sions. the display of date expres- SET MEMOWIDTH ~ Sets the width of memo field output for LIST and DISPLAY and sets the default width for REPORT. SET MESSAGE — Defines a message for display at the bottom of the desktop in FoxPro for MS-DOS or in the status bar in FoxPro for Win- dows. Also specifies the location of messages in menu bar and popup commands SET ODOMETER - Determines the reporting interval of the record counter for commands that. process records. SET PALETTE ~ Specifies if the FoxPro for Windows color palette is used. SET SPACE — Determines whether or not a space displays between fields or expressions when you use the ? or ?? commands. Commands and Funetions by Category Input and Output — Data Formatting SET TEXTMERGE — Enables or disables evaluation of fields, memory variables, functions and expressions that are surrounded by text merge delimiters. SET TEXTMERGE DELIMITERS - Specifies the delimiters for text merge. SHOW GET - Redisplays a single specified SHOW GETS - Redisplays all @ ... GET objects. SHOW OBJECT - Redisplays the @ ... GET object that has the specified object number. GET object. SROWS( ) ~ Returns the number of rows available on the screen. ‘SYS(100) ~ Returns the current SET CONSOLE setting. ‘SYS(101) ~ Returns the current SET DEVICE setting, SYS(2002) — In FoxPro for MS-DOS, turns the cursor on or off. TEXT ... ENDTEXT — Outputs lines of text, the results of expressions and functions and the contents of memory variables. TRANSFORM ) - Formats character and numeric expressions using PICTURE and FUNCTION codes. UPDATED( ) - Returns true (.T.) if you changed any data during the most recent Commands and Functions by Category 12-33 Input and Output - Printing Printing L234 ‘These commands and functions print or display data from records or memory variables on the screen to a printer or to an output file. \I\— Outputs the line of text that follows \ or \ to the text merge file specified with SET TEXTMERGE and/or to the screen. ? — Displays the value of the specified expression on the next line. 2? — Displays the value of the specified expression at the current. posi- tion on the current line. 222 — Sends output directly to the printer, bypassing the printer driver. @ ... SAY — Formats and displays a specified expression at a specified row and column position. CLOSE ALTERNATE - Closes an open ALTERNATE file. DEFINE BOX — Draws a box around printed text. DISPLAY or LIST - Displays the contents of records in the current table/DBF and the results of expressions. EJECT — Sends a form feed to the printer. EJECT PAGE - Sends a conditional page advance to the printer PCOL( )— Returns the current column position of printer output. PRINTSTATUS( ) ~ Returns true (.T.) if the printer is ready or false CP) if it is not. PROW( ) - Returns the current row position of the printer output. SET MARGIN ~ Specifies the left margin in printed output. SET PDSETUP ~ Loads a printer driver setup. SET PRINTER — Enables or disables output to the printer and routes printer output to a file or to a port. SYS(6) - Returns the current SET PRINTER TO setting SYS(13)— Returns the status of the printer, SYS(102) — Returns the current SET PRINTER ON | OFF setting TYPE — Displays the contents of an ASCII file. Commands and Functions by Category Input and Output ~ Menu Bars and Popups Menu Bars and Popups You use these commands and functions to develop, display and ac- tivate user-defined menu bars and popups. ACTIVATE POPUP — Displays and activates a popup created with DEFINE POPUP or a FoxPro menu system popup. BAR( ) — Returns the number of the most recently chosen option from a popup defined with DEFINE POPUP or a FoxPro menu system popup. CLEAR MENUS - Releases all menu bars from memory and clears them from the desktop (FoxPro for MS-D0s), the main FoxPro window or a user-defined window. CLEAR POPUPS - Releases all popups from memory and clears an active popup from the screen, CNTBAR( ) — Returns the number of bars on a popup defined with DEFINE POPUP or on a FoxPro menu system popup. CNTPAD( ) ~ Returns the number of pads on a user-defined menu bar or the FoxPro system menu bar. CREATE MENU — Displays the Menu Design window and enables you to create a menu system. DEACTIVATE MENU — Deactivates a user-defined menu bar and removes it from the sereen, but does not remove the menu bar defini- tion from memory. DEACTIVATE POPUP ~ Deactivates a popup defined with DEFINE POPUP and removes it from the screen, but does not remove the popup definition from memory. DEFINE BAR — Creates a menu option on a popup defined with DEFINE POPUP or a FoxPro menu system popup. DEFINE MENU ~ Creates a menu bar. DEFINE PAD ~ Creates a pad on a user-defined menu bar or the FoxPro system menu bar. DEFINE POPUP ~ Creates a popup. GETBAR( ) - Returns the number of bars on a popup defined with DEFINE POPUP or a FoxPro menu system popup. GETPAD( ) — Returns the name of a menu pad from its position on a user-defined menu bar or on the FoxPro system menu bar. MODIFY MENU — Displays the menu design window and enables you to modify or create a menu system. Commands and Functions by Category 12-35 Input and Output ~ Menu Bars and Popups 12-36 MOVE POPUP — Moves a popup to a new location MRKBAR( ) — Returns whether or not a bar in a popup defined with DEFINE POPUP or in a FoxPro menu system popup is marked with SET MARK OF. MRKPAD( ) - Determines whether or not a pad on a user-defined menu bar or on the FoxPro system menu bar is marked with SET MARK OF, ON BAR — Activates a popup or menu bar when an option on © popup is chosen. ON PAD —Activates a popup or menu bar when a menu pad is chosen. ON SELECTION BAR — Specifies a command that executes when you choose a bar on a popup. ON SELECTION MENU - Specifics a command that executes when you choose any pad on a menu bar defined with DEFINE MENU. ON SELECTION PAD — Specifies a command that executes when you choose a specific pad on a user-defined menu bar or on the FoxPro system menu bar. ON SELECTION POPUP - Specifies a command that executes when you choose any bar on a popup defined with DEFINE POPUP or a popup in the FoxPro menu system. PAD( ) - Returns the name of the menu pad that was last chosen from a menu bar, POP MENU - Pulls the specified user-defined menu bar or FoxPro system menu bar off the stack POP POPUP - Pulls the specified popup off the stack. POPUP( ) ~ Returns the name of the aetive popup. PRMBAR( ) ~ Returns the text from an option on a popup. PRMPAD( ) ~ Returns the text from a menu pad. PROMPT( ) — Returns the option chosen from an active menu bar or Popup. PUSH MENU — Places a menu bar definition on the stack. PUSH POPUP — Places a popup definition on the stack. RELEASE BAR - Removes one or all bars from a popup. RELEASE MENUS ~ Releases all or specified user-defined menu bar definitions from memory. Commands and Functions by Category Input and Output ~ Windows RELEASE PAD - Removes specified pads from a user-defined or the FoxPro system menu bar. RELEASE POPUPS — Releases all or specified popup definitions es- tablished with DEFINE POPUP from memory. SET BORDER ~ Defines a border for popups created with DEFINE POPUP and for windows created with DEFINE WINDOW. SET MARK OF - Specifies a mark character for a user-defined menu pad or a bar on a popup defined with DEFINE POPUP. SET SKIP OF — Enables or disables a menu bar, menu pad, popup, or popup bar, for a user-defined menu or the FoxPro system menu. SIZE POPUP ~ Changes the size of a popup. SKPBAR( ) — Determines whether a menu bar is enabled or is abled with SET SKIP OF. SKPPAD( ) — Determines whether a menu pad is enabled or disabled with SET SKIP OF. SHOW MENU - Displays a user-defined menu bar without activating it, SYS(2013) — Returns the names of the FoxPro system menu bar, each pad in the system menu har, menu system popups and each option in the menu system popups. Windows You use these commands and functions to develop, display and ac- tivate user-defined windows, ACTIVATE WINDOW ~ Displays and activates one or more user- defined windows or FoxPro system windows. CLEAR WINDOWS - Releases all user-defined window definitions from memory and removes the windows from the sereen. CREATE SCREEN — Displays the screen layout window and enables you to create a sereen, DEACTIVATE WINDOW ~ Deactivates specific user-defined windows or FoxPro system windows and removes them from the screen, but does not remove the window definitions from memory. DEFINE WINDOW ~ Creates a window and specifies its attributes. HIDE WINDOW ~ Hides an active user-defined window or FoxPro sys- tem window. Commands and Functions by Category 12.87 Input and Output ~ Windows 12-38 MODIFY SCREEN - Displays the screen layout window and enables you to modify or create a screen. MODIFY WINDOW - In FoxPro for Windows, modifies a defined win- dow. MOVE WINDOW - Moves a window to a specified screen location. RELEASE WINDOWS ~ Releases specified window definitions from memory and removes the windows from the screen. RESTORE WINDOW ~ Restores all or specified window definitions to memory from a window file or a memo field. SAVE WINDOW - Saves all or specified window definitions to a win- dow file or a memo field. SET BORDER — Defines a border for popups created with DEFINE POPUP and for windows created with DEFINE WINDOW. SET SHADOWS - In FoxPro for MS-DOS, places or removes shadows from all user-defined windows, popups created with DEFINE POPUP, and FoxPro system windows and popups. SHOW WINDOW - Displays one or more user-defined windows or FoxPro system windows without activating them. SYS(2016) - Returns the window name specified with the most recent SHOW GETS WINDOW WBORDER( ) ~ Returns true (.T.) if a window has a border. WCHILD( ) - Returns either the number of child windows or the names of child windows, for the current or specified parent window. WCOLS( )- Returns the number of columns in a specified window. WEXIST( ) — Returns true (.T.) if the specified window exists. WFONT( ) — Returns the name, size or style of the current. font for a window in FoxPro for Windows. WLAST( ) ~ Returns the name of the window that was active prior to the current window, or true (.T.) if the named window was active prior to the current window. WLCOL( ) - Returns the column coordinate of the top left corner of ‘the current or specified window. WLROW( ) ~ Returns the row coordinate of the top left corner of the current or specified window. Commands and Functions by Category Input and Output ~ Typing, Keyboard and Mouse WMAXIMUM( ) — Returns true (..) if the specified window is maxi- mized. WMINIMUM( ) ~ Returns true (.T.) if the specified window is mini- mized. WONTOP( ) - Returns true (-.) if the specified window is in front of all other active windows. WOUTPUT( ) ~ Returns true (.T.) if output is currently being directed to the specified window. WPARENT( ) - Returns the name of the parent window of the current or specified child window. WREAD( ) — Returns true (.T.) if specified window is involved in the current READ, WROWS( ) — Returns the number of rows in a specified window. WTITLE( ) - Returns the title assigned to the current or specified window. WVISIBLE( ) ~ Returns true (.T.) if the specified window is not hid- den ZOOM WINDOW - Changos the size of a user-defined window or a FoxPro system window Typing, Keyboard and Mouse ‘These commands and functions affect keyboard entry and the mouse. CAPSLOCK( ) - Returns the current mode of the CapsLock key, or sets the CapsLock key mode on or off. CHRSAW( ) ~ Checks the keyboard buffer for the presence of a char- acter. CLEAR MACROS - Releases all keyboard macros from memory in- cluding any Function key assignments. CLEAR TYPEAHEAD - Clears the keyboard typeahead buffer. INSMODE( ) — Returns the current mode of the Insert key, or sets the Insert key mode on or off. KEYBOARD ~ Places the specified character expression in the key- board buffer. LASTKEY( ) — Returns a value corresponding to the last key pressed. Commands and Functions by Category 12-39 Input and Output — Typing, Keyboard and Mouse 12-40 MCOL( ) - Returns the column position of the mouse pointer on the screen or in a window. MDOWN( ) - Returns a logical value corresponding to the state of the left mouse button. MROW( ) ~ Returns the screen or window row position of the mouse pointer. NUMLOCK( ) — Returns the current mode of the NumLock key, or sets the mode of the NumLock key on or off. ON KEY — Specifies a command that executes when you press any key during program execution ON KEY LABEL - Specifies a command that executes when you press a specific key. PLAY MACRO ~ Executes a keyboard macro. POP KEY ~ Restores ON KEY LABELs placed on the “stack” with PUSH KEY, PUSH KEY - Places all current ON KEY LABELs on a “stack” in memory. RESTORE MACROS - Restores a set of keyboard macros to memory from a disk file or a memo field. SAVE MACROS - Saves a set of keyboard macros to a keyboard macro file or a memo field. SET FUNCTION — Assigns a character string to a function key. SET KEYCOMP - Controls FoxPro keystroke navigation on different platforms. SET MACKEY - Specifies a key or key combination that displays the Macros dialog. SET TYPEAHEAD - Specifies the maximum number of characters that can be stored in the typeahead buffer. ‘SYS(2008) — In FoxPro for MS-DOS, specifies the shape of the insert and overwrite cursors. ‘S¥S(2009) ~ Swaps the insert and overwrite cursors. Commands and Functions by Category Input and Output - Reports and Labels Reports and Labels ‘You use these commands to control report creation and output. CREATE LABEL — Creates labels and saves them to a label definition file, CREATE REPORT — Opens the Report Layout window and enables you to create a report and save it to a report definition file. LABEL - Prints labels from a table/.DBF and a label definition file. MODIFY LABEL — Allows you to create or edit labels and save them to a label definition file. MODIFY REPORT - Opens the Report Layout window and enables you to create or edit a report and save it to a report definition file. REPORT - Prints a report from a table/DBF and a report definition file, Commands and Functions by Category L241 FoxPro Environment ~ Environment FoxPro Environment Environment 12-42 You use these commands and functions to manage a wide range of FoxPro system and environment parameters. ADIR( ) ~ Places information about specified files into an array. CAPSLOCK( ) - Returns the current mode of the CapsLock key, or sets the CapsLock key mode on or off. COL( ) — Returns the current column position of the cursor. CREATE COLOR SET ~ Creates a new color set from the current color settings. DIR or DIRECTORY — Displays the contents of a disk directory. DISKSPACE( ) - Returns the number of bytes available on the default disk drive. DISPLAY STATUS or LIST STATUS — Displays the status of the FoxPro environment. DOS - Contains a logical true (T.) if you are using FoxPro for Ms- pos, FKLABEL( ) ~ Returns the name of the Function key corresponding to a numeric expression. FKMAX( ) — Returns the number of programmable function keys or Function key combinations available on your keyboard. FONTMETRIC( ) ~ Returns font attributes for installed Windows fonts in FoxPro for Windows. GETDIR( ) — Displays the Select Directory dialog and returns the directory you choose. GETENV( ) - Returns the contents of a specified MS-DOS environment variable, GETFILE( ) ~ Displays the Open dialog and returns the name of the file you choose. GETFONT( ) - Displays the FoxPro for Windows Font dialog and returns the name of the font you choose, HELP ~ Invokes the online help facility. Commands and Functions by Category FoxPro Environment ~ Environment INKEY( ) — Returns a number corresponding to the first key or mouse click in the typeahead buffer. INSMODE( ) — Returns the current mode of the Insert key, or sets the Insert key mode on or off ISCOLOR( ) - Determines whether or not your computer's graphics card can display color. LOCFILE( ) — Returns the path of the specified file name. % The dividend (the number being divided) The divisor (the number the dividend is divided by) MOKXx ) The modulus operator % returns the remainder obtained when dividing a numeric expression by another numeric expression, The modulus operator and MOI ) return identical results The modulus operator % is an arithmetic operator like + (addition), - (subtraction), * (multiplication), / (division) and “ (exponentiation). When these operators are combined in a numeric expression, % has the same precedence as * and /. See the Overview of the FoxPro Language chapter in this manual for a further discussion of operators and their order of precedence. is the dividend (the numeric expression being divided). ‘The number of decimal places in determines the number of decimals places in the result. is the divisor (the numeric expression dividing the dividend ). A positive number is returned if is positive and a negative number is returned if is negative. cannot be zero. 236% 2 (4*9) % (90/9) IF (YEAR(DATE( )) % 4 = + 'No Summer Olympics ics: his year’) Language Reference & Purpose ‘Macro substitution Syntax & [. ] Description Macro substitution treats the contents of a memory variable or array element as a character string literal. When an ampersand & precedes a character type memory variable or array clement, 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. Whenever possible, use a name expression instead of macro substitution, A name expression operates like macro sub- stitution. However, a name expression is limited to passing character strings as names. Use a name expression for sig- nificantly faster processing if a command or funetion accepts a name (a file name, window name, popup name... ). See the Overview of the FoxPro Language chapter in this manual for additional information on name expressions. While the following commands are acceptable: STORE ‘Customer’ TD dbf_file STORE ‘company’ TO tagname USS Sdbf_file ORDER &tagnane use a name expression instead: USE (dof_file) ORDER (tagname) Language Reference 13-9 Parameters 13.10 Macro substitution is useful for substituting a key word in a com- mand. In the following example, the TALK setting is saved to a memory variable so the setting can be restored later in the program. ‘The original TALK setting is restored with macro substitution. SER(*TALK’) TO TALK OFF vetalk Additional program code K TO Ssavetalka& Restore original TALK setting This is the name of the memory variable or array element to refer- ence in the macro substitution. Do not include the M. prefix that distinguishes memory variables from fields. This causes a syntax error. The macro should not exceed the maximum statement length permitted in FoxPro. A variable cannot reference itself recursively in macro substitution. For example, the following generates an error message: SW 2 aX ange x Macro substitution statements that appear in DO WHILE, FOR and SCAN are only evaluated at the start of the loop and are not reevaluated on subsequent iterations. Any changes to the memory Variable or array clement that occur within the loop are not reeng- nized. .sexpC> The optional . (period) delimiter and character expression is used to append additional characters to a macro. The character ex- pression appended to the macro with . can also be a macro, Language Reference $s Purpose Syntax Parameters Returns See Also Description Parameters Returns true if a character expression is contained in another character expression $ Search string String to be searched Logical ATC) This function returns true (T.) if a character expression is con- tained in another character expression. If the character expression isn’t found, false (.F.) is returned. This function isn’t Rushmore op- timizable. , The character expression is searched for an occurrence of , If is found in isn’t found in , .F. is returned. This funetion is ease sensitive (upper- and lower-case are respected) and can be character type memory 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/.DBFs, memory variables or array elements. For example, if MEMO.FLD is a memo field, the following is perfectly acceptable: ST FOR 'FOK" § UPPER (meno_£1d) Language Reference L311 Example 13-12 ‘The following example creates a table/DBF called MEMOTEST con- taining one memo ficld. Three records are appended to the table/.DBF and a Browse window is opened to display the 3 records. $ is used to list the records which contain the string “FOX”. The files created for the example are then deleted. CLOSE DATABASES CLEAR CREATE CURSOR memotest (: C(3}, meno M) INSERT INTO marotest (text, memo) VALUES (/Fox’, Fox’) INERT INTO mamotest (text, mew) VALLES ("Cat") ’Cac‘) INSERT INTO memotest: (text, memo) VALUES (‘FOX', ‘FOX') LIST FIELDS memo, text FOR ‘FOX’ § UPPER (meno) Language Reference Purpose Syntax See Also Evaluates one or more expressions = [, ... J , User-Defined Functions Description The = command evaluates one or more expressions , ... and discards the return values. This is particularly useful when a 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 memory variable, array element or field. For example, to turn insert mode on you can issue the command: = INSOE(.7.) INSMODE normally returns a true (T.) or false (.F.) value. In this example the function is executed but the return value is discarded. ‘There are two other 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 memory variables and array elements. In these two cases the equal sign = is an operator and not a command. Language Reference L313 iw LIN Purpose Outputs lines of text ‘Syntax \ | \\ See Also PRETEXT, SET TEXTMERGE, SET TEXTMERGE DELIMITERS, TEXT, TEXT ... ENDTEXT Description The \ and \\ commands facilitate text merge in FoxPro, Text L314 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 desktop (FoxPro for MS-DOS) or the main FoxPro window (FoxPro for Windows). SET TEXTMERGE NOSHOW suppresses output to the desktop or main FoxPro window. When you use \, the output line is preceded by a carriage return and a linefeed. When you use \\, the output line isn't preceded by a carriage return and linefeed. Any spaces preceding \ and \\ are not included in the output line, but spaces following \ and \\ are. ‘You can embed an expression in the text line. If the expression is enclosed in the text merge delimiters (<< >> by default) and TEXTMERGE is SET ON, the expression is evaluated and its value is output as text. Language Reference vw Example U5: custoner SED TEXIMERE ON SET TEXIMERGE 10 lecter.txt \<>, <>- \\ceDAN(IATE( ))>>, <<¥EAR(DATE( } >>. \ \ \Dear <> \ \additional Text \ \thank you, \ \xY@ Corporation CLOSE ALL MODIFY FILE letter.txt NOEDIT Language Reference L315 219 2122 Purpose Syntax Remarks See Also Description Clauses 13.16 Evaluates expressions and outputs the results 2 | 22 [PICTURE ] | [FUNCTION ] [AT ] [FONT [, ] ISTYLE | ] [. ]... FONT clause — FoxPro for Windows only 0, @ ... SAY, SET MEMOWIDTH, SET PRINTER ? and % evaluate expressions and send the results to the desktop (FoxPro for MS-DOS), the main FoxPro window (FoxPro for Windows), an active user-defined window or the printer. If SET PRINTER is ON, the expression results are directed to the printer and the desktop, the main FoxPro window or an active user- defined window. If SET PRINTER is ON and SET CONSOLE is OFF, the results are only directed to the printer. ? A single question mark sends a carriage return and line feed before the expression results. ‘The results are displayed on the next line of the desktop, main FoxPro window or the active user-defined window and printed at the left margin of a page unless a function code or the _ALIGNMENT system memory variable specifies otherwise. If the expressions are omitted, a blank line is printed. A space is placed between the expression results when multiple expressions are included. 2 ‘Two question marks display the expression results on the current line at the current position of the desktop, main FoxPro window or an active user-defined window or printer — a carriage return and line feed isn't sent before the results Language Reference PICTURE If the PICTURE clause is present, the result of is displayed according to the format specified by . can consist of function codes, picture codes or a combination of both. You can use the same picture and function codes available in @... SAY. Refer to @ ... SAY for a list of picture and function codes. Function codes affect the overall format of the result; picture codes act on individual characters in the result. If function codes are used in , 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(s) signals the end of the function codes and the start of the picture codes. FUNCTION ‘The FUNCTION character expression offers another method of including function codes in ? and ?? output. If the function clause is included, the function codes are not preceded by @. Function codes must be preceded by @ when included in PICTURE. Ven> ‘Vcn> is a special function eode that can be used with ? and ??. This code enables the results of a character expression to stretch vertical- ly in a limited number of columns. is the number of columns in the output. ? “This is an example of how the V FUNCTION ‘V10" AT AT is used to specify the column number where the output is displayed. This option lets you align output in columns to create a table/.DBF. The numeric expression can be a UDF that returns a numeric value, FONT [, ] — FoxPro for Windows only The character expression is the name of the font, and the numeric expression is the font size. For example, the fol- lowing command displays the system date in 16 point Roman font: 2 DATE( ) FONT ‘ROMAN’, 16 If you include the FONT clause but omit the font size , a 10 point font is used. Language Reference L317 L318 If the FONT clause is omitted and ? | 2? output is placed in the main FoxPro window, the main FoxPro window font is used for the out- put. If the FONT clause is omitted 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, Windows substitutes a font with similar font characteristics. STYLE | In FoxPro for Windows, include the STYLE clause to specify a font style for ? | 2? output. ‘The styles that are available for a font are determined by Windows. If the font style you specify is not avail- able, Windows substitutes a font style with similar characteristics. ‘The font style is specified with . If the STYLE clause is omitted, the standard font style is used. Character __Font Style Transparent U Underline You can include more than one character to specify a combination of font styles. For example, the following command displays the sys- tem date in Bold Italic: 2 DATE( ) STYLE "BI Language Reference 217 In FoxPro for MS-DOS, the STYLE clause lets you specify the font style and size of output sent to the printer with ? and 7”. The ex- pression included in a STYLE clause is sent to three proce- dures, PDOBJST, PDOBJECT and PDOBJEND, in the current FoxPro printer driver program, ‘These procedures determine how output from ? and ?? are printed. ‘The STYLE clause is ignored when output from ? and ?? is sent to the desktop or a user-defined window. Example Language Reference 13-19 Sends output directly to the printer 22? 2 @ ... GET, CHR ) @ ... SAY, Description Three question marks direct the contents of directly to the printer without incrementing the printer column or row. 7”? allows you to send printer control codes directly to a printer without ad- vancing the print head. Printer control codes allow you to reset the printer, change type styles and sizes, enable or disable boldface printing, etc, ‘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 Cunt ) to send sci! characters directly to the printer. * Use braces | | to send printer codes or ASCII characters * Use a combination of CHR ) and braees. * Codes can be sent to the printer before printing begins and after printing ends with the pscope and _PECODE system memory variables. See the System Memory Variables chapter in this manual for more information. Printer control codes vary from printer to printer, ‘The best source for information on printer control codes is the manual which accom- panied your printer. Language Reference @ ... SAY @ SAY Purpose —_Displays output at a specified row and column position Syntax @ SAY [FUNCTION ] [PICTURE ] [SIZE , ] [FONT [, ] [COLOR SCHEME I COLOR ] Remarks FONT and STYLE clauses, support for RGB color pairs — FoxPro for Windows only See Also @ ... GET, CREATE SCRI ET COLOR, SET CURRENCY, SET DEVICE, SHOW GETS, User-Defined Functions Description Use this command to display formatted output on the desktop in FoxPro for MS-DOS, the main FoxPro window in FoxPro for Windows or a user-defined window. It can also be used to format output for a printer. If you use the Screen Builder to create your data entry screens, you may not have to use @ SAY at all. The Screen Builder automat- ieally generates the @ .. SAYs You can combine @ ... SAY and @ ... GET into a single command. If both the SAY and GET clauses are included, specify a single set of coordinates where @ ... SAY output begins. A space is automatically inserted between the @ ... SAY output and the @ GET text editing region If you issue SEP DEVICE TO SCREEN, output from @ ... SAY appears on the desktop, the main FoxPro window or an active user-defined window, SET DEVICE TO SCREEN is the startup default. If you issue SET DEVICE TO PRINTER, output is directed to the printer. Language Reference 13-21 @ ... SAY Clauses 13-22 row, column> Row and column are numeric expressions with values 0 or greater that determine where @ ... SAY output appears. The first row is number 0 on the desktop, main FoxPro window or a user-defined window. In FoxPro for MS-DOS, row 0 is the row the FoxPro system menu bar occupies, See SET SYSMENU in this chap- ter for information about manipulating the system menu bar so you can place output on row 0. In FoxPro for Windows, row 0 is the row immediately under the FoxPro system menu bar. Rows are numbered from top to bottom, For printers, the first row is 1 and the physical page size and the number of lines per page determines the maximum row number. ‘The first column is number 0 on the desktop, main FoxPro window or a.user-defined window. Columns are numbered from left to right. For printers, the first column is 1 and the physical page size deter- mines the maximum column number. When @ ... SAY output is directed toa user-defined window, the row and column coordinates are relative to the user-defined window, not the desktop in FoxPro for MS-DOS or the main FoxPro window in FoxPro for Windows. In FoxPro for Windows, a position in the main FoxPro window or in a user-defined window is determined by the font of the main FoxPro window or the user-defined window. Most fonts Microsoft Windows uses can be displayed in a wide variety of sizes, and some are proportionally spaced. A row corresponds to the height of the cur- rent font; a column corresponds to the average width of a letter in the current font. See the Font topic in the FoxPro online help for additional information about fonts. ‘To facilitate precise positioning of output in the main FoxPro win- dow or in 2 user-defined window, you can use decimal fractions for row and column coordinates in FoxPro for Windows. is evaluated and displayed or printed starting at . It can be a user-defined function (UDF). Language Reference @ ... SAY FUNCTION | PICTURE You can include the FUNCTION clause, the PICTURE clause or both to control how is displayed or printed, FUNCTION codes can be included in @ PICTURE clause. In this case, the PICTURE clause must start with @. Also, a PICTURE clause can contain FUNCTION codes, PICTURE codes or both. Since a FUNCTION clause affects the entire expression it can contain only FUNCTION codes. FUNCTION Code Left justifies numeric data within the display region. CR is displayed after a positive number to indicate a credit. Can be used with numeric data only. Uses the current SET DATE format. Edits date type data as a BRITISH date. Trim leading and trailing blanks from DB is displayed after negative numbers to indicate a debit, Use only with numeric data is displayed as all blanks if its numeric value is 0. Use only with numeric data, Encloses negative numbers in parentheses. Use only with numerie data Converts alphabetic characters to upper-case. Use with character data only. Displays numeric data using scientific notation. Use with numeric data only. Displays data in currency format. The currency symbol appears before or after the field value depending on the current setting of SET CURRENCY Use with numeric data only Language Reference Li @ SAY A PICTURE expression can include any characters, but only the char- acters listed below actively participate in display and printing. PICTURE Code ‘Allows any character. Allows logical Y, y, N and n only. Converts y and n to Y and N, respectively. Converts lower-case letters to upper-case letters, Displays the current eurrency symbol specified by SET CURRENCY. By default, the symbol is placed immediately before or after the field. However, the curreney symbol and its placement (SET CURRENCY), the separator character (SET SEPARATOR) and the decimal character (SET POINT) can all be changed. Asterisks are displayed in front of the numeric value. Use with a dollar sign § for check protection. Specifies the decimal point position. Use to separate digits to the left of the decimal point. Example The following example combines two FUNCTION codes to format a numeric value. The $$ codes create a floating dollar sign and the C code places CR after the number, cus 2, 2 SAY 1.15 AN $1.15 oR ON “CSS SIZE , The SIZE clause lets you control the length and height of a @ ... SAY display or print region. FoxPro creates a region one row high by default. Include the op- tional SIZE clause to create a region that is more than one row high. The height of the region in rows is specified by , and the width in columns by . The @ .. SAY output word wraps at the width specified hy for rows In FoxPro for Windows, the @ .. SAY font determines the size of the editing region. The @ ... SAY font is specified with the FONT clause. If the FONT clause is omitted, the @ ... SAY output uses the font of its parent window (the main FoxPro window or a user-defined win- dow). 13-24 Language Reference @ .. SAY FONT [, ] — FoxPro for Windows only ‘The character expression is the name of the font, and the numeric expression is the font size. For example, the fol- lowing command displays the @ ... SAY text in 16 point Roman fo Se example’ FONT ‘ROMAN’, 16 ‘ont If you include the FONT clause but omit the font size , a 10 point font is used. If the font yon specify is not available, Windows substitutes a font with similar font characteristies. STYLE — FoxPro for Windows only In FoxPro for Windows, include the STYLE clause to specify 2 font style for @ ... SAY output. The styles that are available for a font are determined by Windows. If the font style you specify is not available, Windows substitutes a font style with similar charac- teristies. The font style is specified with . If the STYLE clause is omitted, the standard font style is used. Character __ Font Style Bold Italie 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 specifies Bold Italic: @ 2, 2 SAY ‘Font clause exemple’ SIME ‘BI ‘Language Reference 13-25 @ ... SAY Example 26 COLOR SCHEME I COLOR If you do not include a COLOR clause, the color of @ ... SAY output is determined by the color scheme for the desktop or the main FoxPro window; if @ ... SAY output is directed to a user-defined window, the window's color scheme determines the color of @ ... SAY output. Only the first color pair in a color scheme or color pair list affects the color of @ ... SAY output. The color of @ ... SAY output can be specified by including the num- ber of an existing color scheme in the COLOR SCHEME clause or a set of color pairs in the COLOK clause. A color scheme is a set of 10 predefined color pairs. The color pairs in a color scheme can be changed with SET COLOR OF SCHEME. In FoxPro for MS-DOS the color pairs in a color scheme can also be changed in the Color Picker. A color pair is a set of two letters separated by a forward slash. The first color letter specifies the foreground color and the second letter specifies the background color. For example, this color pair specifies a red foreground on a white background: For a list of colors and their corresponding color letters, see the SET COLOR commands section in this chapter or the Color Table by Color Pair topic in the online help facility. In FoxPro for Windows, a color pair can also be specified with a set of 6 RGB (Red Green Blue) color values separated by commas. The first 3 color values specify the foreground color and the second 3 color values specify the background color. ‘The color values can range from 0 through 255. In FoxPro for Windows, the RAW color pair in the example above can also be specified with this RGB color pair: #GB(255,0,0, 255,255,255) @ 2, 2 SY "this is red on 4, 2 SAY “This is Color Schene 16" COLDR SCHEME 16 WINDOWS —&& Poxere for Windows. 6, 2 SAY ‘This is red on white’ COLOR RGB(255,0,0,255, 255,225) Language Reference @ ... SAY —BMPs and OLE Objects @ SAY — BMPs and OLE Objects Purpose Syntax Remarks See Also Language Rt Displays BMPs and OLE objects or calls the OLE server to execute the OLE object verb @ SAY BITMAP | [CENTER] [ISOMETRIC | STRETCH] [SIZE , ] or @ SAY VERB | FoxPro for Windows only APPEND GENERAL, CREATE SCREEN, MODIFY GENERAL, SET DEVICE, SET PALETTE, SHOW GETS ion Use this command to display .BMPs (Bitmap pictures) and OLE (Ob- ject Linking and Embedding) objects in the main FoxPro window or a user-defined window. .BMPs and OLE objects can also be directed to the printer with @ ... SAY. If you issue SET DEVICE TO SCREEN, output appears in the main FoxPro window or an active user-defined window. SET DEVICE TO SCREEN is the startup default. If you issue SET DEVICE TO PRINTER, output is directed to the printer. The second syntax form for this command is used to call the OLE server to service a verb for an OLE object. An OLE verb is a power- ful tool for manipulating OLE objects. Use the VERB clause to ex- ecute commands associated with the OLE object. For example, you can start the application that created the OLE object, or edit or print an OLE object. For additional information about OLE objects, see the Object Linking and Embedding chapter in the FoxPro for Windows Developer's Guide. eference 13-27 SAY Clauses Example 13.28 BMPs and OLE Objects Row and column are numeric expressions with values 0 or greater that determine where the .BMP or OLE object appears. The first row is number 0 in the main FoxPro window or a user-defined window. Rows are numbered from top to bottom. The first column is number 0 in the main FoxPro window or a user-defined window. Columns are numbered from left to right. For printers, the first row and column is 1. The physical page size and the number of lines per page determines the maximum row number. A position in the main FoxPro window or in a user-defined window is determined by the font of the main FoxPro window or the user-defined window. Most fonts Microsoft Windows uses can be displayed in a wide variety of sizes, and some are proportionally spaced, A row cor- responds to the height of the current font; a column corresponds to the average width of a letter in the current font. ‘To facilitate precise positioning of a .BMP or an OLE object in the main FoxPro window or in a user-defined window, you can use decimal fractions for row and column coordinates. When a BMP or OLE object is displayed in a user-defined window, the row and column coordinates are relative to the user-defined win- dow, not the main FoxPro window. BITMAP | ‘The .BMP or OLE object specified with or is displayed starting at the position specified by the row and column coordinates. BMPs are stored in files on disk, OLE objects are stored in fields of the general data type. If you use the Screen Builder to create your data entry screens, you may not have to use this form of @ ... SAY at all, The Screen Builder automatically generates the @ ... SAYs. To display a .BMP (bitmap picture) in the main FoxPro window or in a user-defined window, specify the name of the file containing the picture in and include BITMAP. The BITMAP key word must follow the BMP file name. The BMP file name must be delimited with single or double quotation marks or square brackets. If the file name is stored in a memory variable or an array element, you can include the memory variable or array element without the delimiters. If the .BMP file resides in a directory other than the current default directory, include a path name with the file name. IEDR @ 2, 2 SAY ‘\windows\areade.tmp! BORD Language Reference @ ... SAY — BMPs and OLE Objects CENTER Include the CENTER key word to center a BMP or OLE object within the area specified by the SIZE clause. If the SIZE clause is omitted, the .BMP or OLE object is centered in the rectangular region bounded by the row and column coordinates and the lower right corner of the main FoxPro window or user-defined window, ISOMETRIC | STRETCH If the area specified with the SIZE clause is too small to contain a BMP or OLE object, the picture is clipped to fit in the area. You can prevent a picture or OLE object from being clipped by including ISOMETRIC or STRETCH. If ISOMETRIC is included, the picture or object is scaled so that its proportions are maintained. The picture is shrunk or expanded to fit within the specified area and isn't distorted If STRETCH is included, the pieture or object is scaled horizontally, vertically or in both directions to fit the picture or object within the area specified by the size clause. The picture or object’s proportions are not maintained. SIZE , ‘You can specify the size of a BMP or OLE object with the s clause. If the SIZE clause is omitted, a BMP or an OLE object is displayed at its default size. The numeric expression specifies the height of the BMP or OLE object. The height of the BMP or OLB object is a multiple of the height of the font in the active window. For example, if is 2, the height of the BMP or OLE object is twice the height of the font in the active window. The numeric expression specifies the width of the BMP or OLE object. The width of the EMP or OLE object is a multiple of the width of the font in the active window. For example, if is, 2, the width of the BMP or OLE object is twice the width of the font in the active window, If the area specified with the SIZE clause is too small to contain 2 BMP or OLE object, the picture or object is clipped. Include ISOMETRIC or STRETCH to prevent a BMP from being clipped, Language Reference 13.29 @ .., SAY — BMPs and OLE Objects VERB | Include the VERB clause to execute a command verb in the registra- tion database for an OLE object. Run REGEDIT /V to see what command verbs are available for each installed OLE server, The command verbs and their cor- responding numbers are displayed. ‘The command verb can be either a numerie expression or a character expression . Command verb numbers start at 0 For example, if the OLE object is a sound and the third command verb ( = 2) in the registration database is PLAY, issuing either @ 2, 2 SAY sounds VERB 2 or @ 2, 2 SAY sounds VERB ‘FLAY’ plays the sound contained in the general field named SOUNDS. The OLE object contained in SOUNDS isn’t displayed. The verb EDIT is supported for most OLE objects. For additional information about OLE objects, see the Object Linking and Embedding chapter in the FoxPro for Windows Developer's Guide. Language Reference @ @ ... GET GET Purpose Syntax Remarks See Also Creates an editing region @ GET | [FUNCTION ] IPICTURE ] [FONT [, ]] [STYLE ] [DEFAULT ] [ENABLE | DISABLE] IMESSAGE ] [[OPEN] WINDOW ] [RANGE [] [, ]] [SIZE , ] IVALID | [ERROR }] [WHEN ] [COLOR SCHEME I COLOR ] FONT and STYLE clauses and support for RGB color pair — FoxPro for Windows only OPEN WINDOW included for backward compatibility — use @ EDIT instead @ ... SAY, @ ... EDIT, CREATE SCREEN, CUROBJ, FONTMETRIC( ), OBJNUM( ), READ, SET COLOR, SET CURRENCY, SET DEVICE, SHOW GETS, SHOW OBJECT, VARREAD( }, User-Defined Functions Description ‘Use this command to create an editing region for the contents of a memory variable, array element or field. Use READ or READ CYCLE to activate @ .. GET editing regions. You can combine @ ... SaY and @ ... GET into a single command. If both the SAY and GET clauses are included, specify a single set of coor- dinates where the @ ... SAY output begins, A space is automatically inserted between the @ ... SAY output and the @ ... GET editing region. In FoxPro for Windows, @ ... CET editing regions are surrounded by a black border if the BORDER clause is included in READ, If you use the Sereen Builder to create your data entry screens, you may not have to use @... GET or @... SAY at all. The Screen Builder automatically generates the @ .. GETs or @ ... SAYs. Language Reference 13-31 @ ... GET Row and column are numeric expressions with values 0 or greater that determine where the @ ... GET editing region is displayed. The first row is number 0 on the desktop, main FoxPro window or a user-defined window. Rows are numbered from top to bottom. The first column is number 0 on the desktop, main FoxPro window or a user-defined window. Columns are numbered from left to right. When the editing region is placed in a user-defined window, the row and column coordinates are relative to the user-defined window, not the desktop (FoxPro for MS-Dos) or the main FoxPro window (FoxPro for Windows). In FoxPro for Windows, a position in the main FoxPro window or in a user-defined window is determined by the font of the main FoxPro window or the user-defined window. Most fonts Microsoft Windows uses can be displayed in a wide variety of sizes, and some are proportionally spaced. A row corresponds to the height of the cur- rent font; a column corresponds to the average width of a letter in the current font. To facilitate precise positioning of an @ ... GET editing region in the main FoxPro window or in a user-defined window, you can use decimal fractions for row and column coordinates in FoxPro for Windows. | @ ... GET ereates an editing region for the memory variable or array element specified in or the field specified in . @ ... GET can be used to create an editing region for a memo field When you use @ ... GET with a memo field, the word Memo is dis- played. When READ is issued and the memo field is selected, place the cursor on the word Memo and press Ctrl+Home, Ctrl+PgUp or Ctrl+PgDn to open the memo editing window. You can also double- click on Memo to open the editing window. ‘To exit the memo editing window and save your editing changes in FoxPro for MS-DOS, click the window's close box or press Ctrl+W. Press Escape to discard your changes. ‘To exit the memo editing window and save your changes in FoxPro for Windows, choose Close from the window's Control menu or press Ctrl+W. Press Escape to discard your changes. A better method for editing memo fields is using @ ... BDIT instead of @ ... GBT. @ ... EDIT creates a text editing window with a scroll bar, and the contents of the memo field are dis- played when @ ... EDIT is issued. ‘Language Reference FUNCTION | PICTURE When creating a text editing region with @ ... GRT, you can include the FUNCTION clause, the PICTURE clause or both to create an edit- ing mask. These clauses contain special codes that control how the memory variable, array element or field is displayed and edited. FUNCTION codes can be included in a PICTURE clause. In this case, the PICTURE clause must start with @, Also, a PICTURE clause can contain FUNCTION codes, PICTURE codes or both. Sinee a FUNCTION clause affects the entire expression it can contain only FUNCTION codes. FUNCTION Code Allows alphabetic characters only (no spaces or symbols). Left-justifies numeric data within the output field. Uses the current SET DATE format. Edits date type data as a BRITISH date. Centers text within a field, | Right-justifies text within a field. Selects an entire field for editing when the cursor is, moved to the field. Displays leading zeros (instead of spaces) in numeric output. Use with numeric data only. Creates multiple preset choices. The list comma-delimited collection of items. — Individual items within the list cannot contain embedded commas. If or initially do not contain one of the items in the list when READ is M _ issued, the first item in the list is displayed. To scroll through the list, press the Spacebar or type the first letter of an item. To choose one of the items and move to the next control, press Enter. Use only with character data. Displays a format mask in an @ ... GET editing region. ‘These mask characters are not stored to the field when you exit the @ ... GET editing region Use only with character or numeric data. Language Reference 13-33 @ GET FUNCTION Code Purpose Limits the display width to n characters. You can scroll within the region with the cursor control keys. Use only with character data. ‘Trims leading and trailing blanks from or . Displays or as blank if its numeric value is 0. Use with numeric data only. Converts alphabetic characters to upper-case. Use with character data only. Displays numeric data using scientific notation, Use with numeric data only. Displays data in a currency format. The currency symbol appears before or after the value depending on the current setting of SBT CURRENCY. If CURRENCY is SET LEFT, the $ function code cannot be used. Use with numeric data only. PICTURE Codes A PICTURE e: acters listed PICTURE xpression can include any characters, but only the char- below actively participate in display and editing. Purpose ‘Allows alphabetic characters only. Allows logical data only. Allows letters and digits only. Allows any character. Allows logical Y, y, N and n only. Converts y and n to Y and N, respectively Allows only digits in character data. Allows digits and signs in numeric data. Allows digits, blanks and signs, Converts lower-case letters to upper-case letters. Language Reference © ... GET Purpose Displays the current currency symbol specified by § CURRENCY. — By default, the symbol immediately before or after the field. Howeve g currency symbol and its placement (SET CURRENCY), the separator character (SET SEPARATOR) and the decimal character (SET POINT) can all be changed. an only be used in @ ... GET when SET CURRENCY i LEFT » | Asterisks are displayed in front of a numeric value. Use with a dollar sign $ for check protection. Specifies the decimal point position Use to separate digits to the left of the decimal point. FONT [, ] — FoxPro for Windows only The character expression is the name of the font and the numeric expression is the font size. For example, this short program example displays the CONTACT field for editing. In FoxPro for Windows the text in the editing region is displayed in 16 point Roman font: If you include the FONT clause but omit the font size , a 10 point. font is used. If the FONT clause is omitted and the editing region is placed in the main FoxPro window, the main FoxPro window font is used. If the FONT clause is omitted and the editing region is placed in a user- defined window, the user-defined window font is used. If the font you specify is not available, Windows substitutes a font with font characteristics similar to the requested font. Language Reference 13-36 GET STYLE — FoxPro for Windows only In FoxPro for Windows, include the STYLE clause to specify a font style for an @ ... GET editing region. The styles that are available for a font are determined by Windows. If the font style you specify is not available, Windows substitutes a font style with similar char- acteristics. ‘The font style is specified with . If the STYLE clause is omitted, the standard font style is used. Outline Opaque Shadow | Transparent Underline If you include T to create a transparent editing region, the back- ground color is ignored by the region. You can include more than one character to specify a combination of font styles. For example, the following short program create an @.... GET text editing region. The CONTACT field appears in the edit- ing region appears in Bold Italic in FoxPro for Windows. DATABASES (ase _WINDONS @ 2, 2 CET contact STYLE *BI’ CASE _Dos @ 2, 2 GED contact NOCASE READ Language Reference @ ... GET DEFAULT If you specify a memory variable for the @ ... GET editing region that doesn't exist, it is automatically created and initialized if you include DEFAULT. However, an array clement isn't created if you specify an array element in a DEFAULT clause. The DEFAULT clause is ignored if the memory variable already exists or you specify a field. able doesn't exist, the error message “Variable not found” is displayed. © If the DEFAULT clause isn’t included and the memory vari- ‘The DEFAULT expression determines the type of memory variable created and its initial value. ENABLE | DISABLE Including DISABLE prevents access to an @ ... GET editing region. ‘The editing region is displayed in the disabled colors and cannot be selected. By default, @ .. GET editing regions are enabled. You ean include ENABLE as a reminder in a program that a GET editing region can be accessed If all the GETs in user-defined window are disabled, the win- dow won't remain on top. If all the GETs in the current READ are disabled, the READ is terminated. MESSAGE ‘The MESSAGE clause character expression is displayed when the @ ... GET editing region is selected. In FoxPro for MS-DOS the message is centered on the last line of the desktop and tem- porarily cancels any SET MESSAGE expression. In FoxPro for Windows, the message is placed in the Windows-style status bar. If the Windows-style status bar has been turned off with SET STATUS BAR OFF, the message is placed on the last line of the main FoxPro window. Language Reference 13.37 @ ... GET [OPEN] WINDOW Include the WINDOW clause to edit a memo field in a user-defined window. The user-defined window must first be created with DEFINE WINDOW. The word Memo is displayed when you issue @.... GET WINDOW. To open the memo editing window, double-click Memo or place the cursor on the word Memo and press Ctrl+Home, Ctrl+PgUp or Ctrl4PgDn. If OPEN is included, the memo editing window is automatically opened when READ or READ CYCLE is issued. ‘To exit the window and save your editing changes in FoxPro for ‘MS-DOS, click the window's close box (if available) or press Ctrl+W. Press Escape to discard your changes. To exit the window and save your editing changes in FoxPro for Windows, choose Close from the window's Control menu (if avail- able) or press Ctrl+W. Press Escape to discard your changes. ‘A better method for editing memo fields is using @ .. EDIT instead of @ ... GET. @ ... EDIT creates a text editing window with a scroll bar, and the contents of the memo field are dis- played when @ ... EDIT is issued RANGE [] [, ] Use the RANGE clause with character, date and numeric data to specify a range of acceptable values. If the value you enter in the @ ... GET editing region isn't within the specified range, a message showing the correct range is displayed. To override the default range message, use ON READERROR. The lower boundary of the range is specified with , the upper boundary with . and must be char- acter, numeric or date expressions that correspond to the data in the memory variable, array element or field. Either or can be omitted, but not both. If one boundary is omitted, the data you enter is checked against the specified boundary only. ‘The range isn’t checked if you press Enter without changing the memory variable, array element or field. Language Reference @ ... GET SIZE , SIZE lets you control the length and height of an @ ... GET text edit- ing region. By default, a text editing region is one row high. The size of the region is determined by the length of the memory vari- able, array element or field or a PICTURE clause, ‘The height of the text editing region in rows is specified with and the width in columns is specified with . In FoxPro for Windows, the editing region font determines the size of the editing region. The editing region font is specified with the FONT clause. If the FONT clause is omitted, the editing region uses the font of its parent window (the main FoxPro window or a user- defined window). VALID | Use VALID to validate input. When you attempt to exit the GET editing region, the VALID expression is evaluated. A VALID clause greatly simplifies data validation when used with a user-defined function (UDF). If a UDF is called within a VALID clause in @ ... GET, the UDF should return a logical or numeric value. Unlike the RANGE clause, a VALID clause is always executed when you exit the GET editing region unless you press Escape. The RANGE clause is only executed when a change is made to the memory variable, array clement or a field. If evaluates to a logical true (.T.), the input is considered correct and the editing region is exited. If evaluates to false (.F.), the value you entered is con- sidered incorrect and a message is displayed directing you to reenter the data after pressing the Spacebar. If a UDF validation routine performs a replacement on a field and the validation routine then returns false, the field replacement oc- curs but the previous field value is restored when you return from the UDF to the GET editing region Language Reference 13-39 @ ... GET A VALID clause that includes a numeric expression is used to specify which object is activated after you exit the GET editing region. Ob- jects are @ ... GBT input fields, check boxes, lists, popups, spinners, text editing regions and each individual button in a set of push, radio and invisible buttons. The numeric expression has one of the three effects: + When is 0, the cursor remains in the GET editing region. ‘The MESSAGE and BRROR error messages are suppressed. A special error message routine can be written as part of a UDF called by VALID. Ifa UDF validation routine performs a replacement on a field and the validation routine returns 0, the field replacement oc- curs but the previous field value is restored when you return to the GET editing region. + When is positive, specifies the number of objects to advance. For example, when the cursor is posi- tioned on a GET editing region and VALID returns 1, the next object is activated. If is greater than the number of remaining objects, the READ is terminated (unless READ CYCLE is issued to activate the objects). + When is negative, specifies the number of ‘objects to move back. For example, when the cursor is posi- tioned on a GET editing region and VALID returns -1, the pre- vious object is activated. If moves back past the first object, the READ is terminated (unless READ CYCLE is issued to activate the objects). ERROR ERROR lets you specify a custom error message displayed when a VALID clause evaluates to false (F.). FoxPro displays in place of the default error message. WHEN WHEN allows or prohibits access to a GET editing region based on the value of , which must be true (.T.) before the GET edit- ing region can be accessed, If WHEN is specified and is false (F), the GE editing region cannot. be accessed and the next object is activated. 3-40 @ ... GET COLOR SCHEME I COLOR If you do not include a COLOR clause, the colors of an @ ... Gi editing region are determined by the color scheme for the desktop or the main FoxPro window; if an @ 1 editing region is placed in a user-defined window, the window's color scheme determines the editing region’s colors. Only the second color pair in a color scheme or color pair list affects the color of an ® ... GET editing region. The color of an @ ... GET editing region can be specified by including the number of an existing color scheme in the COLOR SCHEME clause or a set of color pairs in the COLOR clause. A color scheme is a set of 10 predefined color pairs. ‘The olor pairs in a color scheme can be changed with SET COLOR OF SCHEME, In FoxPro for MS-DOS the color pairs in a color scheme can also be changed in the Color Picker. A color pair is a set of two letters separated by a forward slash. The first color letter specifies the foreground color and the second letter specifies the background eolor For example, this color pair specifies a red foreground on a white background For a list of colors and their corresponding color letters, see the SET COLOR commands section in this chapter or the Color ‘Table by Color Pair topic in the online help facility. In FoxPro for Windows, a color pair can also be specified with a set of 6 RGB (Red Green Blue) color values separated by commas. The first 3 color values specify the foreground color and the second 3 color values specify the background color. The color values can range from 0 through 255. In FoxPro for Windows, the RW color pair in the example above can also be specified with this RGB color pair: Only color pairs 2, 5, 6 and 10 in a color scheme or color pair list affect the @ ... GET editing region colors, Language Reference L341 Example 13-42 Check Box Attribut @ ... GET editing region ‘Message Selected @ ... GET editing region Disabled @ .,. GET editing region The following example demonstrates how you can combine @ ... SAY and @ ... GET into a single command and the COLOR, PICTURE, RANGE and WHEN clauses, “Two tables/DBFs are opened and a rela- tion is set between the CUSTOMER and OFFICES tables! DBFs to ex- tract information from both tables/.DBFs. TALK OFF B = DATABASES comer INO be Parent ces INO GRIER on 66 Chil SET RELATICN TO cno INTO cffices §& Set the rel @ 1, 070 18, 79 DOUBLE @ 3, 13 SAY ‘Company: ' GED company COLOR art/b, r/w @ 5, 13 SAY ‘Contact: * GET contact COLOR or+/b, rw 2’ GRY address COLOR @ 9, 13 SAY ‘City: GH city Oo 13 sy *s CET state zip COLOR gr URE '999999.99" ; 999999," Language Reference Controls Controls NN What They Are Control Summary The next cight sections discuss the controls available in FoxPro. Controls supply or request information and can designate, confirm or cancel actions. They can appear on the desktop in FoxPro for MS-DOS, in the main FoxPro window in FoxPro far Windows, and in user-defined windows and dialogs. Check boxes, radio buttons and popups are examples of commonly used controls. If you use the Screen Builder to create your data entry sereens, you may not have to use the commands to create controls at all. The Screen Builder automatically generates the commands that create the controls. Most controls are created with different variations of @ ... GET. Text editing regions are created with @ ... EDIT, Issue READ or READ CYCLE to activate controls, ‘The FoxPro interface uses controls extensively, ‘The FoxPro User's Guide and the FoxPro Getting Started manuals describe controls and their operation. Here is a summary of each FoxPro control and its use. FoxPro con- trols include check boxes, invisible buttons, list, popups, push but- tons, radio buttons, spinners and text editing regions. Check Boxes On the screen, a check box is a box with descriptive text to the right. A check box in FoxPro for MS-DOS looks like this: {XI Titles A check box in FoxPro for Windows looks like this: Titles A check box is used to toggle between two states such as true (.T.) and false (.F.) or yes and no. In FoxPro for Windows, a BMP (bitmap picture) can be used as a check box. Language Reference 13-43 Controls L344 Invisible Buttons Invisible buttons are rectangular regions of the desktop, the main FoxPro window or a user-defined window that you can select and choose. Characters and pictures (in FoxPro for Windows) are often placed over the hot” invisible button regions, allowing you to create custom designed buttons. Use @ ... SAY to place characters and pictures over the invisible but- tons. Lists A list is a vertieal list of options inside a box, often with a scroll bar to the right. Lists are often used to display the directories, files or fields from which you can choose. Popups ‘A popup is a rectangle containing a set of options. When you select a popup, FoxPro displays a list of options, only one of which you can choose. Popups in FoxPro for MS-DOS look like this: Popups in FoxPro for Windows look like this cash [3] Push Buttons In FoxPro for 3 choose. -DOS, a push button is descriptive text that you can Push buttons in FoxPro for MS-DOS look like this: « OK > < Cancel > In FoxPro for Windows, a push button is a raised rectangle with text on top, and BMPs can be used as push buttons. Push buttons in FoxPro for Windows look like this: = ‘Typically, a push button is used to trigger an action. Language Reference Controls Radio Buttons As their name suggests, radio buttons are similar to the buttons of a ear radio — choosing a button makes your choice current and releases your previous choice. A bullet ina button indicates that it is the current choice. Radio buttons are typically used to display several options, of which you can only choose one of the options. Radio buttons in FoxPro for MS-DOS look like this: G) None > Single ©) Double Radio buttons in FoxPro for Windows look like this: In FoxPro for Windows, BMPs can be used as radio buttons. ‘Spinners — FoxPro for Windows only A spinner is a control that lets you “spin” through a set of numeric values displayed in a text box, Clicking on the up and down arrows changes the numeric value. You can also enter a value directly into the spinner's text box. The value in the spinner is stored to a memory variable, an array element or a field. Spinners look like this: Text Editing Regions A text editing region is a rectangular region in which you ean modify or enter text. ‘The text you enter is stored to a memory vari- able, an array element or a field. All standard FoxPro editing features, such as cutting, copying and pasting, are available in a text editing region. Unlike other FoxPro controls, this command uses EDIT in its syntax instead of GET. ‘Text editing regions are typically used to update and modify memo fields and long character fields, Language Reference Laas Controls How They Work L346 ‘The @ ... GET command creates most controls (@ ... EDIT creates text editing regions). ‘The FUNCTION and PICTURE clauses of @ ... GET determine which type of control is created. The FUNCTION and PICTURE clauses also contain the prompts associated with most kinds of controls. Many controls trigger an action. The action to be taken is specified by the VALID clause. Controls are activated by READ or RBAD CYCLE. Depending on the options you specify, READ or READ CYCLE can either terminate or continue when a control is chosen. Hot Keys You can define hot keys for check boxes, popups, push buttons and radio buttons, Hot keys provide x shortcut method of choosing a button or option. A hot key is a key that you can press to immedi- ately choose the desired item. ‘The hot key usually corresponds to first letter in a prompt or option; the letter is highlighted (FoxPro for MS-DOS) or underlined (FoxPro for Windows). A hot key is created by placing a back slash and a less than sign (\<) before the hot key character. Place any other special charac- ters (\i, \\, ... ) before the \< hot key designator. For example: \N\etioe key Disabled Controls To make a control (or part of it) unavailable for use, you can disable it. Disabled controls, buttons and options appear in disabled colors and cannot be selected or chosen. ‘Syntax Summary ‘The following table summarizes the different syntax, options, and defaults for the various controls. Refer to the individual commands for information on these controls. Language Reference Controt Invisible button List Popup Push button Radio bution Spinner Language Reference PICTURE Co PICTURE/FUNCTION N7Nomtermmating ‘T- Terminating N- Non-terminating T. Terminating H- Horizontal V- Vertical N - Nomterminating T- Terminating Yon-terminating minating Non-terminating T- Terminating H-- Horizontal V- Vertical Non-terminaiing T- Terminating H.- Horizontal Funetion tables in the Spinner topic 1- Centered 4 Right-justified Non-terminating, Vertical Terminating Non-terminating Terminating Vertical Non-termin Vertical ‘Terminating Left justified Controls Ve Hot key A - Disable \W = Disable NIA \< Hot key \"_ - Disable \< + Hot kev \\. - Disable ML = Default \2_- Escape Ne = Hot Key AX = Disable NA 1347 @ ... GET —Check Boxes @ Purpose Syntax Remarks See Also Description With thi 13-48 GET — Check Boxes Creat: es a check box or a picture check box @ GET | FUNCTION | PICTURE [FONT [, ]] [STYLE ] [DEFAULT ] [SIZE , ] [ENABLE | DISABLE] [MESSAGE ] [VALID | ] [WHEN ] [COLOR SCHEME | COLOR ] FONT and STYLE clauses, picture check boxes and support for RGB color pairs — FoxPro for Windows only @ ... SAY,@ ... GET, Controls, CUROBJ, OBJNUM( ), READ, SET KEYCOMP, SHOW GET, User-Defined Functions variation of @ ... GET you can create a check box or a picture check box. A check box is used to toggle between two states, such as true (.T.) and false (.F.) or yes and no. If you use the Screen Builder to create your data entry sereens, you may not have to use this command at alll. ‘The Sereen Builder auto- matically generates the commands that create check boxes and pic- ture check boxes. A check box is box with descriptive text to its right. The string of text, called a prompt. indicates what the check box controls. The text of the prompt is specified by the FUNCTION or PICTURE clause. When a condition is true, an X is displayed. Only one check box may be created in a single @ .. GET. Issue READ or READ CYCLE to activate a check box. You can create a pieture check box in FoxPro for Windows. A .BMP (bitmap picture) on a button replaces the check box and the check box prompt. A check box in FoxPro for MS-DOS looks like this: (x) Titles Language Reference @ ... GET — Cheek Boxes In FoxPro for MS-DOS, pressing the Spacebar or Enter or clicking the check box toggles the check box from one state to the other. A check box in FoxPro for Windows looks like this: In FoxPro for Windows, pressing the Spacebar or Enter or clicking the check box toggles the check box from one state to the other if KEYCOMP is set to DOS, If KEYCOMP is set to WINDOWS, which is the default, you can toggle the check box state by pressing the Spacebar or clicking on the check box. Press Enter to move to the next object. Clauses — Row and column are numeric expressions with values 0 or greater that determine where the check box appears: ‘The first row is number 0 on the desktop, main FoxPro window or a user-defined window. In FoxPro for MS-DOS, row 0 is the row the FoxPro system menu bar occupies. See SET SYSMENU in this chap- ter for information about manipulating the system menu bar so you can place output on row 0. In FoxPro for Windows, row 0 is the row immediately under the FoxPro system menu bar. Rows are num- hered from top to bottom. ‘The first column is number 0 on the desktop, main FoxPro window or a user-defined window. Columns are numbered from left to right. When a check box is placed in a user-defined window, the row and column coordinates are relative to the user-defined window, not the desktop in FoxPro for MS-DOS or the main FoxPro window in FoxPro for Windows. In FoxPro for \dows, a position in the main FoxPro window or in a user-defined window is determined by the font of the main FoxPro window or the user-defined window. Most fonts Microsoft Windows uses can be displayed in a wide variety of sizes, and some are proportionally spaced. A row corresponds to the height of the cur- rent font; a column corresponds to the average width of a letter in the current font. See the Font topic in the FoxPro online help for additional information about fonts. ‘To facilitate precise positioning of a check box in the main FoxPro window or in a user-defined window, you can use decimal fractions for row and column coordinates in FaxPro for Windows. Language Reference L349 13-50 | When you check or uncheck a check box, your choice is stored to a memory variable, an array element or a field, which you specify with or , The or must be of numeric or logical type. When a check box is initially displayed on the screen or in a win- dow, the box is checked if or contains a non-zero numeric value or a true (.T.) value. ‘The box isn't checked if or is zero or false (.F-) READ or READ CYCLE activates the check box. The state of the check box when the READ is terminated determines the value stored to the memory variable, array element or field — 1 or .T. if checked and 0 or .F, if unchecked FUNCTION I PICTURE When creating a check box, you must include the FUNCTION clause, the PICTURE clause or both. There is no advantage for any of the three methods. The FUNCTION clause or the PICTURE clause con- tains the check box specification code *C The FUNCTION clause character expression must. begin with "Cc. To create the prompt, include a space after *C followed by the text of the prompt. For example, this clause creates a check box with the prompt Titles: FUNCTION * Titles' ‘The PICTURE clause character expression uses the same syntax as the FUNCTION clause character expression, except the PIC- ‘TURE clause expression must begin with @ followed by *C. For ex- ample, this clause creates a check box with the prompt Titles: You can also include both the FUNCTION and PICTURE clauses to create a check bex. If both are included, the FUNCTION character expression must contain *C to create the check box. The PICTURE character expression must include the prompt. For example: NC ay aa ‘The following examples illustrate the various forms of syntax you can use to create a check box. In all the examples the check box is placed in the second row and column. The state of the box (checked or unchecked) is stored to the memory variable MCHOICE. Each ex- ample creates the same check box. Language Reference @ ... GET —Check Boxes FUNCTION clause only: STORE 1 10 choice @ 2,2 GED mchoice FINCTION '*C Titles’ STOKE 1 10 mehoice STORE ‘*C Titles’ @ 2,2 GET mchoice READ PICTURE clause only: SIORE 1 10 mehoice @ 2,2 GHY mchoice PICIURE ‘@4C Titles" READ STORE 190 mh @ 2,2 GET mchoice PICTURE ‘@*C’ + ‘ Titles’ sts FUNCTION and PICTURE clauses: STORE 1 70 mchoice @ 2,2 GET mchoice FUNCT READ N #C! PICTURE * Titles’ Picture Check Boxes In FoxPro for Windows, a check box ean also be a .BMP (bitmap picture) displayed on a button. A picture check box mimics the be- havior of a check box with a text prompt. The .BMP is displayed but the check box isn't displayed. Like checking a check box, choosing the picture toggles the value of or between .T. and .F. or 1 and 0. To use a BMP in a check box, add B to the check box specification code. The FUNCTION and PICTURE clause specification codes that create a check box are *C or @°C, respectively. To create a check box with picture prompts, use the codes *CB and @°CB, The pictures aren't clipped, reduced or enlarged to fit the check box button. Use the SIZE clause to adjust the size of | the check box button to accommodate the picture. o Language Reference 13.51 @.. GET — Check Boxes Picture Masks and Check Boxes In FoxPro for Windows, a picture check box has three states: up, down and disabled, FoxPro automatically controls the appearance a picture check box when it is in each of these three states, but you can override the default appearance by using a picture mask. A mask is a monochrome .BMP file with an -MSK extension. FoxPro automatically looks for a mask for a .BMP file in the same directory where the .BMP file is located. The mask must have the same base name as the .BMP file and an extension of .MSK. ‘A mask is used to control the transparent areas of a picture check box. By default, the white areas are transparent. If a mask is present, the white areas of' the mask, not the BMP, are transparent. In most eases, a mask isn’t necessary. If you don’t need anything in your picture to appear white and your .BMP has a white background, the picture check box will appear as desired in the up, down and disabled states When a picture check box has a mask and is in the up or down state, any white areas in the BMP appear transparent, allowing the color of the button face to show through. However, you can main- tain the white color of certain areas. Suppose that you have a .BMP of a dog on a white background and white eyes, and the button face is red. You want the background of the button to appear red but you want the dog's eyes to be white, not red. Make a mask that is the same size as the BMP but in- cludes only two colors, black and white. Leave the background of the mask white but make the dog — including his eyes — complete- ly black. When the button is displayed, the background is red to match the button face but the dog's eyes are white. When a picture check box is disabled, any white areas in the BMP appear transparent so the color of the button face shows through. Any non-white areas appear dark grey. If the button has a MSK, all white areas in the mask are transparent so the color of the button face show through, and all black areas appear dark grey. Language Reference

You might also like