• No results found

DEACTIVATE WINDOW

In document dBase IV Language Reference (Page 151-159)

The DEACTIVATE WINDOW command deactivates specified windows and removes them fi:'om the screen, without releasing them firom memory.

Syntax

DEACTIVATE WINDOW window name list

Usage

This command deactivates windows in the window name list by erasing them firom the screen. The windows are not released fi-om memory, and you can bring them back to the screen with the ACTIVATE WINDOW command.

When you DEACTIVATE a window, any window that was previously ACTIVATEd becomes current again. DEACTIVATEing all windows with the ALL option restores full-screen mode.

See Also

ACTIVATE SCREEN, ACTIVATE WINDOW, DEFINE WINDOW, MOVE WINDOW, RESTORE WINDOW, SAVE WINDOW

I

LANGUAGE REFERENCE 2-95

DEBUG

DEBUG gives you access to the dBASE IV program debugger.

Syntax

DEBUG filename procedure name [WITH parameter list

Usage

This command, like DO, executes a program or procedure, but also calls dBASE full-screen debugger.

The debugger screen contains four windows that allow you to run a program or procedure and see the commands as they are executing, edit the program or procedure, set breakpoints to halt program execution, and display the results of expressions while the program is executing.

The screen is divided into a debug window, an edit window, a breakpoint window, and a display window.

The debug window, at the bottom of the screen, displays the current work area, database file, program file, procedure, record number, line number, master index file, and the ACTION: prompt. Pressing Esc or any-where on the screen returns you to the ACTION: prompt in the debug window.

If you enter an E at the ACTION: prompt, the edit window becomes active.

This window, at the top of the screen, shows the program or procedure being executed. When the edit window is active, you can access the dBASE IV editor and make changes to the program. You must save the file to avoid los-ing the changes. Once the changes are made, the debugger continues execu-tion from the old The debugger may execute a command line that is not the line you expect to be executed, depending on how you changed the file.

If you enter a B at the ACTION: prompt, the breakpoint window, on the right side of the screen, becomes active. You may enter one or more condi-tions in the breakpoint window that will be evaluated after each line of code is executed. If one of the conditions evaluates to true the program is halted and the debug screen reappears.

If you enter a D at the ACTION: prompt, the display window, on the left side of the screen, becomes active. You may enter dBASE expressions on the left of this window. The results are displayed on the right of the display window.

2-96 COMMANDS

DEBUG

At the ACTION: prompt, you may also enter the following:

• L Line — Specify which line to execute next.

• N Next — Execute the next command in the current procedure, then return to the ACTION: prompt. If there is a DO in the current procedure, the called procedure will execute outside the debugger environment, although the breakpoint watch will remain in effect. If you precede the N with a number, you direct the debugger to execute that number of commands in the current procedure before returning to the ACTION:

prompt.

• P Program Trace — Show the program trace information, which includes the current program, procedure, and line number.

• Q Quit — Quit the debugger and cancel the program.

• R Run — Run the program until a breakpoint or error is encountered.

• S Step — Execute the next command, then return to the ACTION:

prompt. If you precede the S with a number, you direct the debugger to step through that number of commands before returning to the ACTION: prompt. Unlike N, procedures called from the current proce-dure are executed within the debugger environment.

• X Exit — Exit the program and return to the dot prompt. From the dot prompt, RESUME passes control back to the debugger.

You can only operate one DEBUG session at a time; it possible to start a second while the first is suspended.

— Execute either or 1N. If a Step, S, was last executed, will execute a 1S. If a Next, N, was last executed, will execute a 1N. By default, executes a

F1 Help and F9 Zoom are toggle keys:

Pressing F1 Help anywhere on the screen brings up or removes the Help panel, a brief description of the debug commands you can enter at the ACTION: prompt.

Pressing F9 Zoom removes the debugger windows from the screen to show the underlying screen information, or replaces the debugger windows on the screen.

Options

The WITH parameter allows you to pass parameters in the same way as DO.

The parameter list may contain any valid dBASE IV expressions. Note that DEBUG with parameter list can accept a of eight constants, which includes a filename. The number of variables is not limited.

LANGUAGE REFERENCE 2-97

I

DEBUG

See Also

COMPILE, DO, MODIFY COMMAND, SET DEBUG, SET ECHO, SET PROCEDURE, SET STEP, SET TALK, SET TRAP

2-98 COMMANDS

DECLARE

DECLARE creates one- or two-dimensional arrays of memory variables.

Syntax

DECLARE array name 1 number of rows

number of columns array name 2 number of rows number of columns

In this paradigm, the curly braces indicate optional items. The square brack-ets are a required part of the DECLARE command syntax.

Defaults

The array is public if the DECLARE command is entered at the dot prompt, private if the command is in a program file. You may create a public array in a program file with the PUBLIC command.

PUBLIC ARRAY

creates a public array, called Parts, if the command is used in a program file.

DECLARE

creates a private array, called Parts, if you use the command in a program file. If you use the command from the dot prompt, the array is public.

Usage

The array definition list consists of the array names and array dimensions.

Like memory variables, array names can be up to ten characters long. They can contain letters, numbers, and underscores. They must begin with a letter and cannot contain embedded blank spaces. The array name cannot be the same as a dBASE IV command.

The array dimensions consist of one or two numbers in square brackets. The first number is the number of rows in the array; the second is the number of columns in the array. If only one number is used, the array is one-dimen-sional. If two are used, they are separated by a comma and the array is two-dimensional. The maximum number of dimensions is two.

I

LANGUAGE REFERENCE 2-99

DECLARE

creates a one-dimensional array (a row).

Specifying just the number of columns in a row is the same as declaring a one-row array, as in:

DECLARE Cost

Cost is the array name, and it contains fifteen elements. The elements are numbered starting at

creates a two-dimensional array called Items, which has eight rows and three columns. It contains 24 elements, numbered by row and column position.

The DECLARE command creates a set of memory variables, each of which initially contains a logical false value. Array elements assume a data type only when information is STOREd to them. For example:

TO

initializes the element with a date value.

One array may contain elements of different data types.

NOTE

Any array, no matter how complex, is still handled as a memory vari-able. This means you can replace an array with a variable of the same name without seeing a warning message or needing to approve the replacement. caution when you create or replace memory vari-ables with names similar to those of arrays present in memory.

The array name uses one slot from the same memvar pool used by other memory variables. Each array element, however, does not use a slot from this memvar pool, but is stored in a separate block allocated to the ele-ments If an array declaration exceeds available memory, the error message

Memory appears. After declaring an array, the elements are treated like any other memory variable. The elements are referred to by their array name and position in the array, beginning from left to right and top to bottom. For example, Cost[4] or are sample element names.

2-100 COMMANDS

DECLARE

All commands and functions which can be used with memory variables can also be used with array elements, as long as the array has been declared and the element is within the range of the array declaration. Some com-mands, such as COPY and APPEND, have special forms (COPY TO ARRAY and APPEND FROM ARRAY) to handle arrays. Commands that manipulate memory variables (such as CLEAR ALL, CLEAR MEMORY, LIST/DISPLAY MEMORY, RELEASE, RESTORE, and SAVE) support arrays as well as mem-ory variables.

If you reference array coordinates that do not exist, the error message Bad array dimension(s) appears. If you reference an array name that has not been DECLAREd, the message Not an array appears.

Examples

Using the Transact database file, store the number of orders and the sum of the Total—bill field to an array called Details:

CALCULATE TO ARRAY Details

for 12 o r d e r s f o r $10080.00

Using the same database file in a program use two arrays to detail the breakdown of orders by

USE Transact ORDER

DECLARE Declare one row f o r each c l i e n t .

DO WHILE EOFO

Orders [Mcnt, 13 C l i e n t j d Save C l i e n t i d .

CALCULATE CNTO, TO ARRAY

WHILE Orders [Mcnt,

Save count of o r d e r s . Orders [Mcnt, [ 2 ] Save t o t a l f o r

"Orders" AT 12, AT 24 headings.

DO WHILE Mcnt M c l i e n t s

AT AT 20

LANGUAGE REFERENCE 2-101

I

DECLARE

See Also

APPEND, AVERAGE, CALCULATE, CLEAR ALL, CLEAR MEMORY, COPY, COUNT, LIST/DISPLAY MEMORY, PUBLIC, RELEASE, RESTORE, SAVE, SUM

2-102 COMMANDS

In document dBase IV Language Reference (Page 151-159)