Copyright: ObjectPAL Reference, v.5.0
Citation: Copyright ® 1985, 1994 Borland International.


ObjectPAL Contents

See Also

Choose from the following topics for more information:

ObjectPAL Reference Manual

Order the ObjectPAL Reference Manual

General Information

Introduction to ObjectPAL

Syntax Notation

ObjectPAL Glossary

Pasting Sample Code Into Your Methods

Printing ObjectPAL Reference Topics

ObjectPAL Language

Basic Language Elements

List of Built-in Methods

Changes and New Features

New and Changed Run-time Library Methods

New Properties

New Constants

Run-time Library Types and Methods

Alphabetical List of Run-time Library Methods

List of ObjectPAL Types

Workgroup Methods

Properties and Constants

Properties and Property Values

UIObject Properties

Types of Constants

Properties Unique to Graph Objects


See Also

Libraries

Scripts

The ObjectPAL Debugger

The ObjectPAL Editor


New and Changed Run-time Library Methods

See Also

Alphabetical List of 4.5 Methods

Alphabetical List of 5.0 Methods

4.5 Methods By Type

5.0 Methods By Type


See Also for New and Changed Run-time Library Methods
See Also

New Properties

New Constants


New ObjectPAL Properties

See Also

AttachedHeader (5.0)

AvgCharSize (5.0)

BottomBorder (5.0) (read-only)

Breakable (5.0)

ByRows (5.0)

CalculatedField (5.0)

CheckedValue (5.0)

ColumnPosition (5.0)

ColumnWidth (5.0)

CurrentColumn (5.0)

CurrentRow (5.0)

DeleteColumn (5.0)

DeleteWhenEmpty (5.0)

FirstRow (5.0)

FrameObjects (5.0)

GridLines.QueryLook (5.0)

GridValue (5.0)

GroupObjects (5.0)

GroupRecords (5.0)

Header (5.0)

HeadingHeight (5.0)

InsertColumn (5.0)

InsertField (5.0)

LeftBorder (5.0) (read-only)

List.Value (5.0)

Margins.Bottom (5.0)

Margins.Left (5.0)

Margins.Right (5.0)

Margins.Top (5.0)

NextTabStop (5.0)

OtherBandName (5.0)

PageSize (5.0)

PageTiling (5.0)

Picture (enhanced for 5.0)

PositionalOrder (5.0)

PrinterDocument (5.0)

RefreshOption (5.0)

RemoveGroupRepeats (5.0)

RepeatHeader (5.0)

RightBorder (5.0) (read-only)

RowHeight (5.0)

SeeMouseMove (5.0)

Series.Marker.Size (5.0)

Series.Marker.Style (5.0)

SeriesName (5.0)

ShowGrid (5.0)

SnapToGrid (5.0)

SpecialField (5.0)

StandardToolbar (5.0)

StartPageNumbers (5.0)

SummaryModifier (5.0)

TitleBoxName (5.0)

TopBorder (5.0) (read-only)

UncheckedValue (5.0)

UpdateLink (5.0)

WideScrollBar (5.0)

Width (5.0)

XAxisName (5.0)

XAxis.Ticks.TimeFormat (5.0)

XAxis.Ticks.TimeStampFormat (5.0)

Xseparation (5.0)

YAxisName (5.0)

YAxis.Graph_Title.Text (5.0)

YAxis.Ticks.TimeFormat (5.0)

YAxis.Ticks.TimeStampFormat (5.0)

Yseparation (5.0)

ZAxisName (5.0)

ZAxis.Graph_Title.Text (5.0)

ZAxis.Ticks.NumberFormat (5.0)

ZAxis.Ticks.TimeFormat (5.0)

ZAxis.Ticks.TimeStampFormat (5.0)


See Also for New Properties
See Also

New and Changed Run-time Library Methods

New Constants


New ObjectPAL Constants

See Also

ActionEditCommands

EditInsertObject (5.0)

EditPasteLink (5.0)

EditSaveCrosstab (5.0)

AggModifiers (5.0)

CumulativeAgg

CumUniqueAgg

RegularAgg

UniqueAgg

DateRangeTypes (5.0)

ByDay

ByMonth

ByQuarter

ByWeek

ByYear

FileBrowserFileTypes

fbDM (5.0)

fbPrintStyle (5.0)

fbScreenStyle (5.0)

fbSQL (5.0)

FrameStyles

Windows3dFrame (5.0)

Windows3dGroup (5.0)

MenuCommands

MenuChangedPriv (5.0)

MenuChangedWork (5.0)

MenuChangingProv (5.0)

MenuChangingWork (5.0)

MenuFormViewData (5.0)

MenuHelpToolbar (5.0)

MenuHelpCoach (5.0)

MenuOpenProjectView (5.0)

PageTilingOptions (5.0)

StackPages

TileHorizontal

TileVertical

PrintColor (5.0)

PrintColor

PrintMonochrome

PrintDuplex (5.0)

Horizontal

Simplex

Vertical

PrinterOrientation (5.0)

Landscape

Portrait

PrinterSizes (5.0)

10x14	EnvC6

11x17	EnvC65

A3	EnvDL

A4	EnvItaly

A4Small	EnvMonarch

A5	EnvPersonal

B4	ESheet

B5	Executive

CSheet	FanfoldLegalGerman

DSheet	FanfoldStandardGerman

Env9	FanfoldUS

Env10	Folio

Env11	Ledger

Env12	Legal

Env14	Letter

EnvB4	LetterSmall

EnvB5	Note

EnvB6	Quarto

EnvC3	Statement

EnvC4	Tabloid

EnvC5

PrintQuality (5.0)

Draft

High

Low

Medium

PrintSources (5.0)

auto

Cassette

Envelope

EnvManual

LargeCapacity

LargeFmt

Lower

Manual

Middle

OnlyOne

SmallFmt

Tractor

Upper

SpecialFieldTypes (5.0)

DateField

NofFieldsField

NofPagesField

NofRecsField

PageNumField

RecordNoField

TableNameField

TimeField

UIObjectTypes

BandTool (5.0)

PageBrkTool (5.0)

UpdateLink (5.0)

OLEUpdateManual

OLEUpdateAutomatic


See Also for New Constants
See Also

New and Changed Run-time Library Methods

New Properties


Syntax Notation

See Also

The following table shows the conventions for ObjectPAL syntax notation.

Convention	Sample	Meaning
Bold font	beep( )	Required element (method name or parentheses). Type exactly as shown. Parentheses are required, even if the method takes no arguments.
Bold italic font	tableName	Required element (argument). Replace with a variable, expression, or literal value.
[ ]  (Square brackets)	[ , fieldName ]	Informational element indicating an optional argument. You can choose whether to include this argument.
*  (Asterisk)	[ , fieldName ] *	Informational element indicating a repeatable argument. You can choose whether to repeat this argument.
{ | }  (Braces and bar)	{ Yes | No }	You must choose one of the values separated by the vertical bar.
Version number after method name	isDesign   (5.0)	The number indicates the version of Paradox when the method was added. If there's no number, the method was in the first version.


See Also for Syntax Notation

Required elements

Informational elements

ObjectPAL Prototypes

Alternate Syntax


Required elements

See Also

In ObjectPAL syntax, required elements are shown in bold or bold italic type. For example, in the following prototype the required elements are: the method name load, the parentheses, and the argument formName. The rest of the prototype consists of informational elements.

load ( const formName String ) Logical

The following elements are required when shown as part of the prototype:

Required element	Description

Name	The name of the method or procedure.

Parentheses	Parentheses are required, even if the method or procedure takes no arguments.

Argument	If an argument is shown as part of the syntax, it must be included unless it is enclosed by square brackets (which make it optional). An argument can be a variable, an expression, or a literal (hard-coded) value. Lists of arguments are separated by commas.


See Also for Required Elements

Syntax notation

Informational elements

ObjectPAL Prototypes


Informational elements

See Also

Informational elements are not part of the ObjectPAL syntax you type for the method or procedure; they just tell you how the method or procedure works. The following table describes ObjectPAL informational elements.

Element	Description

Square brackets	Square brackets indicate an optional argument. If a prototype shows an argument enclosed in square brackets, you can include that argument or not, depending on what you want to do. For example, the square brackets in the following prototype indicate that formTitle is an optional argument.
attach ( [ const formTitle String ] ) Logical

There is one exception to this rule: when an argument is an array (or DynArray), the syntax for the argument shows square brackets following the Array (or DynArray) keyword. For instance, the following syntax shows that enumPrinters takes a resizeable array as an argument:
enumPrinters ( var printers Array[ ] String ) Logical

Keywords	Keywords shown in normal type provide information about the arguments for a method or procedure. An argument preceded by the keyword var is passed by reference. An argument preceded by the keyword const is passed as a constant. An argument itself, without either keyword, is passed by value.
The keyword that follows each argument specifies its data type (for example, String, Number, Table, or Logical).
If a method or procedure returns a value, the keyword at the end of the prototype specifies its data type. Most, but not all ObjectPAL methods and procedures return values.

Asterisks	An asterisk ( * ) indicates that an argument can be repeated. For example, the following prototype shows that message takes one required argument, reqTxt, and one or more optional arguments, represented by optTxt.
message ( const reqTxt String [ , const optTxt String ] * )


See Also for Informational Elements

Syntax notation

Informational elements

ObjectPAL Prototypes


ObjectPAL Prototypes

See Also

Syntax statements (also called prototypes) are presented for each ObjectPAL method and procedure. An ObjectPAL prototype consists of required elements (shown in bold or bold italic type) and informational elements (shown in normal type). You must include required elements in the code you type, but don't include the informational elements.

For example, here is a prototype:

sample ( var argOne Type [ , const argTwo Type ] ) Type

The method name sample, the argument argOne, and the parentheses are required. The argument argTwo is optional, and the rest of the prototype consists of informational elements. In ObjectPAL code, the following statements are valid:

; One argument, variable x stores the return value.

x = sample(custName)

; Two arguments, the return value is not used.

sample(custName, custAddress)


See Also for ObjectPAL Prototypes

Syntax notation

Required elements

Informational elements


Alternate Syntax

See Also

ObjectPAL supports an alternate syntax. The standard syntax uses dot notation to specify an object, a method name, and one or more arguments. For example,

object.methodName ( argument [ , argument ] )

where object is an object name or UIObject variable, methodName represents the name of the method, and argument represents one or more arguments.

The alternate syntax does not use dot notation. Instead, it specifies the object as the first argument to the method. For example,

methodName ( object , argument [ , argument ] )

For example, the following statement uses the standard ObjectPAL syntax to return a lowercase version of a string:

theString.lower()

The following statement uses the alternate syntax:

lower(theString)

For clarity and consistency, it's best to use standard syntax whenever possible. However, the alternate syntax can be convenient in some situations, for example, when defining the calculation for a calculated field.


See Also for Alternate Syntax

Syntax notation

Using ObjectPAL in Calculated Fields

Paradox Help: Calculating with ObjectPAL methods


Using ObjectPAL in Calculated Fields

See Also

A calculated field can use any of the following elements:

Literal values.

Variables, provided they are declared within the scope of the calculated field, and have been assigned a value.

Object properties.

Basic language elements.

Custom methods attached to other objects (or to the field itself). You must first declare a UIObject variable within the scope of the calculated field and use an attach statement to associate the variable with a UIObject.

Any method or procedure in the ObjectPAL run-time library (RTL) that returns a value (including a Logical value).

Special functions (like Sum and Avg) provided specifically for use in calculated fields.

Note:	ObjectPAL supports an alternate syntax that can be useful when defining a calculated field.

The following table describes these elements.

Element	Comments

5	Literal value.

"a"	Literal value.

x	Variable. Must be declared within the scope of the calculated field. Must be assigned a value.

x + 5	Simple expression. Rules for working with variables apply.

self.Name	Property. Displays the field's name as a String.

theBox.Color	Property. Displays an integer value representing the object's color.

iif(State.Value = "CA", 0.075, 0)	Basic language element iif. Value of calculated field depends on value of State field object.

uio.objCustomMethod()	Custom method attached to another object. The custom method must return a value.

tc.open("orders.db")	RTL method. Field displays True if the open succeeds; otherwise, it displays False. TCursor must be declared within the scope of the field.

Avg([DIVEITEM.Sale Price])	Special function. Operates on the Sale price field of the Diveitem table. The table must be in the form's data model. Quotes are not used, spaces are allowed.

tc.cAverage("Sale Price")	RTL method. The TCursor must be declared and opened previously. The table does not have to be in the data model. If a field name contains spaces, quotes are required.


See Also for Using ObjectPAL in Calculated Fields

Syntax notation

Alternate Syntax

Paradox Help: Calculating with ObjectPAL methods


Derived Methods

See Also

Many object types include methods derived from similar methods defined for another type. For example, the Script type includes methods derived from the Form type. The diagram below shows that the Script type includes eleven methods: seven methods derived from the Form type, and four methods defined specifically for the Script type. The methods derived from the Form type are listed with the other Form methods, but the information applies equally to the Script type.

Some of the new methods for this version are derived from methods in other types. For example, the new save method for the Script type is derived from the Form type, but the new method operates on Script variables, the older one on Form variables. In cases like this, Help displays information about the original method, and does not duplicate it for the additional type. So, for example, when you're browsing the methods for the Script type and request help on the save method, Help displays information about the save method defined for the Form type. All the information that applies to forms also applies to scripts.

Methods for the Script Type

Form		Script
deliver		attach
enumSource		create
enumSourceToFile		load
methodDelete		run
methodGet
methodSet
save


See Also for Derived Methods

Syntax notation


Printing ObjectPAL Reference Topics

To print some or all of the ObjectPAL reference help topics:

1. Choose one of the groups below.

2. Select the topics you want to print from the Print Group dialog box.

3. Make sure your printer is properly connected to your system and is online.

4. Choose Print.

The Help system then prints the topics you chose. Each topic is sent to the printer as a separate print job. This means that you may want to set Form Feed off if your printer has such an option.

Alphabetical

List of Methods from A-E

List of Methods from F-L

List of Methods from M-Z

List of 4.5 Methods

List of 5.0 Methods

By Type

Basic Language Elements

Built-in Methods

Data Model Objects

Database

Query

SQL

Table

TCursor

System Data Objects

DDE

FileSystem

Library

Session

System

TextStream

Data Types

AnyType

Array

Binary

Currency

Date

DateTime

DynArray

Graphic

Logical

LongInt

Memo

Number

OLE

Point

Record

SmallInt

String

Time

Design Objects

Menu

PopUpMenu

UIObject

Display Managers

Application

Form

Report

Script

TableView

Events

ActionEvent

ErrorEvent

Event

KeyEvent

MenuEvent

MouseEvent

MoveEvent

StatusEvent

TimerEvent

ValueEvent


TimerEvent

The Timer type consists only of derived methods from the Event type.


Application

The Application type consists only of derived methods from the Form type.


Pasting Sample Code Into Your Methods

You can copy and paste the examples into your own code through the Clipboard.

From the Help window menu choose Edit | Copy, then select the block of code you want and click Copy.

Place the insertion point in your code where you want to insert the example, then choose Edit | Paste from the Paradox menu.


Alphabetical List of ObjectPAL Types

See Also

Choose a type to see a list of the methods and procedures of that type. For each method and procedure you'll find syntax, a description, and sample code.

A

ActionEvent

AnyType

Application

Array

B

Binary

C

Currency

D

Database

Date

DateTime

DDE

DynArray

E

ErrorEvent

Event

F

FileSystem

Form

G

Graphic

H-K

KeyEvent

L

Library

Logical

LongInt

M

Memo

Menu

MenuEvent

MouseEvent

MoveEvent

N

Number

O

OLE

P

Point

PopUpMenu

Q

Query

R

Record

Report

S

Script

Session

SmallInt

SQL

StatusEvent

String

System

T

Table

TableView

TCursor

TextStream

Time

TimerEvent

U

UIObject

V-Z

ValueEvent


Object Type Categories

List of Data Model Objects

List of Data Types

List of Design Objects

List of Display Managers

List of Events

List of System Data Objects


Data Model Objects
List of Data Model Objects

Choose a type to see a list of the methods and procedures of that type. For each method and procedure you'll find syntax, a description, and sample code.

Database

Query

Table

TCursor

SQL


System Data Objects
List of System Data Objects

Choose a type to see a list of the methods and procedures of that type. For each method and procedure you'll find syntax, a description, and sample code.

DDE

FileSystem

Library

Session

Script

System

TextStream


Data Types
List of Data Types

Choose a type to see a list of the methods and procedures of that type. For each method and procedure you'll find syntax, a description, and sample code.

AnyType	DynArray	OLE

Array	Graphic	Point

Binary	Logical	Record

Currency	LongInt	SmallInt

Date	Memo	String

DateTime	Number	Time


Design objects
List of Design Objects

Choose a type to see a list of the methods and procedures of that type. For each method and procedure you'll find syntax, a description, and sample code.

Menu

PopUpMenu

UIObject


Display managers
List of Display Managers

Choose a type to see a list of the methods and procedures of that type. For each method and procedure you'll find syntax, a description, and sample code.

Application

Form

Report

Script

TableView


Events
List of Events

Choose a type to see a list of the methods and procedures of that type. For each method and procedure you'll find syntax, a description, and sample code.

ActionEvent	MouseEvent

ErrorEvent	MoveEvent

Event	StatusEvent

KeyEvent	TimerEvent

MenuEvent	ValueEvent


TimerEvent Type

Methods in the TimerEvent type process information used by the timer method built into every design object. Use setTimer, defined for the UIObject type, to specify when to send timer events to an object, then modify the object's built-in timer method to control how the object responds when a timer goes off. Use killTimer, defined for the UIObject type, to turn off an object's timer. The following example shows how to use these methods with TimerEvents.

In this example, assume that a form contains a multi-record object bound to the Customer table. The record container in the multi-record object is named custRecordMRO.

Suppose you have a data-entry program, and you want to give the user 60 seconds to edit a record. After 60 seconds, you want to alert the user. To accomplish this, the built-in action method for custRecordMRO tests every action. If the action is DataArriveRecord, the method stops any old timers with killTimer and sets a new timer for the record object with setTimer. When the timer goes off, a message pops up alerting the user. To make it easy to change the time, a constant is defined in the Const window for custRecordMRO, as follows:

; custRecordMRO::Const
const
  alertTime = 60000     ; data-entry alert at 60 seconds
endConst

The following code is for the action method for custRecordMRO.

; custRecordMRO::action
method action(var eventInfo ActionEvent)
if eventInfo.id() = DataArriveRecord then ; when opening to a new record
  self.killTimer()         ; just in case it hasn't expired
                           ; yet, kill the old timer
  self.setTimer(alertTime) ; start timer for this record
endif
endMethod

This code is attached to the timer method for custRecordMRO.

; custRecordMRO::timer
method timer(var eventInfo TimerEvent)
self.killTimer()
beep()
msgInfo("Alert", "You have been processing this record for " +
                 "one minute now.")
endMethod

The Timer type consists only of derived methods from the Event type.

Methods for the TimerEvent Type

Event		TimerEvent
errorCode		(All TimerEvent methods are derived methods from the Event type.)
getTarget
isFirstTime
isPreFilter
isTargetSelf
reason
setErrorCode
setReason


Alphabetical List of 4.5 Methods

See Also

Database::beginTransaction

Database::commitTransaction

System::dlgExport

System::dlgImportASCIIFix

System::dlgImportASCIIVar

System::dlgImportSpreadsheet

Form::dmGetProperty

Form::dmLinkToFields

Form::dmLinkToIndex

Form::dmSetProperty

Form::dmUnlink

Session::enumAliasLoginInfo

System::errorHasErrorCode

System::errorHasNativeErrorCode

System::errorNativeCode

SQL::executeSQL

System::executeString

System::exportASCIIFix

System::exportASCIIVar

System::exportSpreadsheet

TCursor::forceRefresh

UIObject::forceRefresh

Session::getAliasProperty

System::importASCIIFix

System::importASCIIVar

System::importSpreadsheet

TCursor::isOnSQLServer

TCursor::isOpenOnUniqueIndex

Database::rollBackTransaction

System::sendKeys

System::sendKeysActionID

Session::setAliasPassword

Session::setAliasProperty

TCursor::setBatchOff

TCursor::setBatchOn

Database::transactionActive

TCursor::update

SQL::writeSQL


4.5 Methods By Type

See Also

Database::beginTransaction

Database::commitTransaction

Database::rollBackTransaction

Database::transactionActive

Form::dmGetProperty

Form::dmLinkToFields

Form::dmLinkToIndex

Form::dmSetProperty

Form::dmUnlink

Session::enumAliasLoginInfo

Session::getAliasProperty

Session::setAliasPassword

Session::setAliasProperty

SQL::executeSQL

SQL::writeSQL

System::dlgExport

System::dlgImportASCIIFix

System::dlgImportASCIIVar

System::dlgImportSpreadsheet

System::errorHasErrorCode

System::errorHasNativeErrorCode

System::errorNativeCode

System::executeString

System::exportASCIIFix

System::exportASCIIVar

System::exportSpreadsheet

System::importASCIIFix

System::importASCIIVar

System::importSpreadsheet

System::sendKeysActionID

System::sendKeys

TCursor::forceRefresh

TCursor::isOnSQLServer

TCursor::isOpenOnUniqueIndex

TCursor::setBatchOff

TCursor::setBatchOn

TCursor::update

UIObject::forceRefresh


See Also for New Methods

Alphabetical List of 4.5 Methods

4.5 Methods By Type

Alphabetical List of 5.0 Methods

5.0 Methods By Type


Alphabetical List of 5.0 Methods

The following table lists methods that were added or changed for version 5.0. Some of these are derived methods from other types.

New	Changed
Session::addProjectAlias	Session::addAlias
UIObject::bringToFront	TCursor::attach
OLE::canLinkFromClipboard	Database::beginTransaction
Binary::clipboardErase	Table::cCount
Binary::clipboardHasFormat	TCursor::cCount
System::compileInformation	Table::create
UIObject::copyToToolbar	Form::dmGet
Library::create	Form::dmGetProperty
Script::create (derived from Form type)	Form::dmHasTable
Table::createIndex	Form::dmLinkToFields
TCursor::createIndex	Form::dmLinkToIndex
Library::deliver  (derived from Form type)	Form::dmPut
Report::deliver  (derived from Form type)	Form::dmRemoveTable
Script::deliver  (derived from Form type)	Form::dmSetProperty
Report::design  (derived from Form type)	Form::dmUnlink
System::desktopMenu	Session::enumAliasNames
System::disablePreviousError	Session::enumDatabaseTables
Report::dmAddTable  (derived from Form type)	Session::enumDriverCapabilities
Form::dmAttach	Table::enumFieldStruct
TCursor::dmAttach	TCursor::enumFieldStruct
Form::dmBuildQueryString	Session::enumFolder
Report::dmBuildQueryString  (derived from Form type)	Table::enumIndexStruct
Form::dmEnumLinkFields	TCursor::enumIndexStruct
Report::dmEnumLinkFields  (derived from Form type)	Session:enumOpenDatabases
Report::dmGetProperty  (derived from Form type)	Table::enumRefIntStruct
Report::dmHasTable  (derived from Form type)	TCursor::enumRefIntStruct
Report::dmLinkToFields  (derived from Form type)	Form::enumTableLinks
Report::dmLinkToIndex  (derived from Form type)	Table::enumSecStruct
Report::dmRemoveTable  (derived from Form type)	TCursor::enumSecStruct
Report::dmSetProperty  (derived from Form type)	UIObject::enumUIObjectProperties
Report::dmUnlink  (derived from Form type)	Session::enumUsers
Table::dropGenFilter	Table::fieldType
TCursor::dropGenFilter	TCursor::fieldType
UIObject::dropGenFilter	String::format
System::enableExtendedCharacters	Query::getQueryRestartOptions (previously in the Database type)
Binary::enumClipboardFormats	Query::isExecuteQBELocal (previously in the Database type)
Form::enumDataModel	Form::load
Report::enumDataModel  (derived from Form type)	Report::load
Database::enumFamily	TCursor::nRecords
System::enumPrinters	Report::open
OLE::enumServerClassNames	Report::print
Report::enumSource (derived from Form type)	Query::readFromFile (replaces executeQBEFile)
Script::enumSource (derived from Form type)	SQL::readFromFile (replaces executeSQLFile)
Report::enumSourceToFile (derived from Form type)	Query::readFromString (replaces executeQBEString)
Script::enumSourceToFile (derived from Form type)	SQL::readFromString (replaces executeSQLString)
Report::enumTableLinks (derived from Form type)	TCursor::recNo
System::exportParadoxDOS	TCursor::seqNo
System::formatGetSpec	Query::setQueryRestartOptions (previously in the Database type)
System::formatStringToDate	System::sleep
System::formatStringToNumber
Script::formReturn (derived from Form type)
AnyType::fromHex
System::getDefaultPrinterStyleSheet
System::getDefaultScreenStyleSheet
Report::getFileName (derived from Form type)
Table::getGenFilter
TCursor::getGenFilter
UIObject::getGenFilter
TCursor::getIndexName
Form::getProtoProperty
Report::getProtoProperty  (derived from Form type)
SQL::getQueryRestartOptions
TCursor::getRange
Table::getRange
UIObject::getRange
Form::getSelectedObjects
Form::getStyleSheet
Report::getStyleSheet  (derived from Form type)
Form::hideToolbar
OLE::insertObject
TCursor::instantiateView
SQL::isAssigned
Form::isDesign
Report::isDesign  (derived from Form type)
OLE::isLinked
Database::isSQLServer
Form::isToolbarShowing
TCursor::isView
OLE::linkFromClipboard
Library::load (derived from Form type)
Report::load (derived from Form type)
Script::load (derived from Form type)
Session::loadProjectAliases
Report::menuAction (derived from Form type)
Library::methodDelete (derived from Form type)
Script::methodDelete (derived from Form type)
Library::methodGet  (derived from Form type)
Script::methodGet  (derived from Form type)
Library::methodSet  (derived from Form type)
Script::methodSet  (derived from Form type)
Report::moveTo (derived from Form type)
System::printerGetInfo
System::printerGetOptions
System::printerSetCurrent
System::printerSetOptions
System::projectViewerClose
System::projectViewerIsOpen
System::projectViewerOpen
Binary::readFromClipboard
Query::readFromFile (replaces Database::executeQBEFile)
Query::readFromString (replaces Database::executeQBEString)
Session::removeProjectAlias
Script::run (derived from Form type)
Library::save (derived from Form type)
Report::save (derived from Form type)
Script::save (derived from Form type)
Session::saveProjectAliases
Form::saveStyleSheet
Report::saveStyleSheet  (derived from Form type)
Form::selectCurrentTool
Report::selectCurrentTool (derived from Form type)
UIObject::sendToBack
System::setDefaultPrinterStyleSheet
System::setDefaultScreenStyleSheet
Table::setGenFilter
TCursor::setGenFilter )
UIObject::setGenFilter
Form::setMenu
Report::setMenu
FileSystem::setPrivDir
Form::setProtoProperty
Report::setProtoProperty (derived from Form type)
SQL::setQueryRestartOptions
Table::setRange
TCursor::setRange
UIObject::setRange
Form::setSelectedObjects
Form::setStyleSheet
Report::setStyleSheet (derived from Form type)
FileSystem::setWorkingDir
Form::showToolbar
AnyType::toHex
OLE::updateLinkNow
Query::wantInMemoryTCursor
SQL::wantInMemoryTCursor
Report::windowClientHandle (derived from Form type)
Binary::writeToClipboard


5.0 Methods By Type

The following table lists methods that were added or changed for version 5.0. Some of these are derived methods from other types.

New	Changed
AnyType::fromHex	Database::beginTransaction
AnyType::toHex	Form::dmGet
Binary::clipboardErase	Form::dmGetProperty
Binary::clipboardHasFormat	Form::dmHasTable
Binary::enumClipboardFormats	Form::dmLinkToFields
Binary::readFromClipboard	Form::dmLinkToIndex
Binary::writeToClipboard	Form::dmPut
Database::enumFamily	Form::dmRemoveTable
Database::isSQLServer	Form::dmSetProperty
FileSystem::setPrivDir	Form::dmUnlink
FileSystem::setWorkingDir	Form::enumTableLinks
Form::dmAttach	Form::load
Form::dmBuildQueryString	Query::executeQBE
Form::dmEnumLinkFields	Query::getQueryRestartOptions (previously in the Database type)
Form::enumDataModel	Query::isExecuteQBELocal (previously in the Database type)
Form::getProtoProperty	Query::readFromFile (replaces executeQBEFile)
Form::getSelectedObjects	Query::readFromString (replaces executeQBEString)
Form::getStyleSheet	Query::setQueryRestartOptions (previously in the Database type)
Form::hideToolbar	Query::writeQBE
Form::isDesign	Report::load
Form::isToolbarShowing	Report::open
Form::saveStyleSheet	Report::print
Form::selectCurrentTool	Session::addAlias
Form::setMenu	Session::enumAliasNames
Form::setProtoProperty	Session::enumDatabaseTables
Form::setSelectedObjects	Session::enumDriverCapabilities
Form::setStyleSheet	Session::enumFolder
Form::showToolbar	Session::enumUsers
Library::create	Session:enumOpenDatabases
Library::deliver  (derived from Form type)	SQL::readFromFile (replaces executeSQLFile)
Library::load (derived from Form type)	SQL::readFromString (replaces executeSQLString)
Library::methodDelete (derived from Form type)	String::format
Library::methodGet  (derived from Form type)	System::sleep
Library::methodSet  (derived from Form type)	Table::cCount
Library::save (derived from Form type)	Table::create
OLE::canLinkFromClipboard	Table::enumFieldStruct
OLE::enumServerClassNames	Table::enumIndexStruct
OLE::insertObject	Table::enumRefIntStruct
OLE::isLinked	Table::enumSecStruct
OLE::linkFromClipboard	Table::fieldType
OLE::updateLinkNow	TCursor::attach
Query::readFromFile (replaces Database::executeQBEFile)	TCursor::cCount
Query::readFromString (replaces Database::executeQBEString)	TCursor::enumFieldStruct
Query::wantInMemoryTCursor	TCursor::enumIndexStruct
Report::deliver  (derived from Form type)	TCursor::enumRefIntStruct
Report::design  (derived from Form type)	TCursor::enumSecStruct
Report::dmAddTable  (derived from Form type)	TCursor::fieldType
Report::dmBuildQueryString  (derived from Form type)	TCursor::nRecords
Report::dmEnumLinkFields  (derived from Form type)	TCursor::recNo
Report::dmGetProperty  (derived from Form type)	TCursor::seqNo
Report::dmHasTable  (derived from Form type)	UIObject::enumUIObjectProperties
Report::dmLinkToFields  (derived from Form type)
Report::dmLinkToIndex  (derived from Form type)
Report::dmRemoveTable  (derived from Form type)
Report::dmSetProperty  (derived from Form type)
Report::dmUnlink  (derived from Form type)
Report::enumDataModel  (derived from Form type)
Report::enumSource (derived from Form type)
Report::enumSourceToFile (derived from Form type)
Report::enumTableLinks (derived from Form type)
Report::getFileName (derived from Form type)
Report::getProtoProperty  (derived from Form type)
Report::getStyleSheet  (derived from Form type)
Report::isDesign  (derived from Form type)
Report::load (derived from Form type)
Report::menuAction (derived from Form type)
Report::methodDelete (derived from Form type)
Report::methodGet  (derived from Form type)
Report::methodSet  (derived from Form type)
Report::moveTo (derived from Form type)
Report::save (derived from Form type)
Report::saveStyleSheet  (derived from Form type)
Report::selectCurrentTool (derived from Form type)
Report::setMenu
Report::setProtoProperty (derived from Form type)
Report::setStyleSheet (derived from Form type)
Report::windowClientHandle (derived from Form type)
Script::create (derived from Form type)
Script::deliver  (derived from Form type)
Script::enumSource (derived from Form type)
Script::enumSourceToFile (derived from Form type)
Script::formReturn (derived from Form type)
Script::load (derived from Form type)
Script::methodDelete (derived from Form type)
Script::methodGet  (derived from Form type)
Script::methodSet  (derived from Form type)
Script::run (derived from Form type)
Script::save (derived from Form type)
Session::addProjectAlias
Session::loadProjectAliases
Session::removeProjectAlias
Session::saveProjectAliases
SQL::isAssigned
SQL::getQueryRestartOptions
SQL::setQueryRestartOptions
SQL::wantInMemoryTCursor
System::compileInformation
System::desktopMenu
System::disablePreviousError
System::enableExtendedCharacters
System::enumPrinters
System::exportParadoxDOS
System::formatGetSpec
System::formatStringToDate
System::formatStringToNumber
System::getDefaultPrinterStyleSheet
System::getDefaultScreenStyleSheet
System::printerGetInfo
System::printerGetOptions
System::printerSetCurrent
System::printerSetOptions
System::projectViewerClose
System::projectViewerIsOpen
System::projectViewerOpen
System::setDefaultPrinterStyleSheet
System::setDefaultScreenStyleSheet
Table::createIndex
Table::dropGenFilter
Table::getGenFilter
Table::getRange
Table::setGenFilter
Table::setRange
TCursor::createIndex
TCursor::dmAttach
TCursor::dropGenFilter
TCursor::getGenFilter
TCursor::getIndexName
TCursor::getRange
TCursor::instantiateView
TCursor::isView
TCursor::setGenFilter )
TCursor::setRange
UIObject::bringToFront
UIObject::copyToToolbar
UIObject::dropGenFilter
UIObject::getGenFilter
UIObject::getRange
UIObject::sendToBack
UIObject::setGenFilter
UIObject::setRange


Paradox for Windows 5.0 ObjectPAL Reference Order Form
ObjectPAL Reference Guide Order Form

To order a printed version of this ObjectPAL reference material,

In the U.S., please fax your order to 408-431-4123. For faster service, call toll-free 1-800-621-3132.

In Canada, please fax your order to 416-229-6123. For faster service, call tol-free 1-800-461-3327.

Or, choose File | Print Topic to print this topic, complete the information, and mail it to:

U.S. Customers	Canadian Customers

Documentation Order Processing	Borland Canada

Borland International, Inc.	5001 Yonge Street, #1400

100 Borland Way	Willowdale, Ontario

P. O. Box 660005	Canada M2N0P6

Scotts Valley, CA 95067-0005

(Please print)

Product Name_________________________________________________________

Name________________________________________________________________

Company Name________________________________________________________

Street Address_________________________________________________________

City______________________________________________   State______________

Zip/Postal Code_____________________   Country___________________________

Daytime Phone (________)_______________________________________________

     (in case we have a question about your order)

The cost of the ObjectPAL Reference is U.S.$29.95 plus $5.00 shipping and handling and sales tax where applicable.*

ObjectPAL Reference	$  29.95	*Residents in CA, CO, CT, DC, FL, GA, IL, MA, MD, MI,

State sales tax	$_______	 MN, MO, MC, NJ, NY, OH, PA, TN, TX, UT, VA, WA:

Freight*	$    5.00	 Please add appropriate sales tax. CO, MI, NY, PA,

TOTAL	$_______	 TX, WA residents: please add tax to freight charges

Please make your check payable to Borland International, Inc. and enclose it with this form. Or fill in your credit card name, number, expiration date, your printed name, and signature.

___ Check enclosed	___ MasterCard	___ Visa	___ American Express

Card number  __ __ __ __ - __ __ __ __ - __ __ __ __ - __ __ __ __

Expiration date __ __ - __ __

Name as it appears on the card___________________________________________

Signature_____________________________________________________________

Please allow two to three weeks for delivery. Pricing and offer good in the United States only.

For international orders: Please refer to the "Three Good Reasons" card for the telephone number of the Borland office nearest you. Prices and shipping may vary by country.

Part # PDX1200WW23680


Types of Constants

Choose from the following types of constants for more information:

ActionClasses

ActionDataCommands

ActionEditCommands

ActionFieldCommands

ActionMoveCommands

ActionSelectCommands

AggModifiers

ButtonStyles

ButtonTypes

Colors

CompleteDisplay

DateRangeTypes

ErrorReasons

EventErrorCodes

ExecuteOptions

FieldDisplayTypes

FileBrowserFileTypes

FontAttributes

FrameStyles

General

GraphBindTypes

GraphicMagnification

GraphLabelFormats

GraphLegendPosition

GraphMarkers

GraphTypeOverRide

GraphTypes

IdRanges

Keyboard

KeyBoardStates

LibraryScope

LineEnds

LineStyles

LineThickness

LineTypes

MenuChoiceAttributes

MenuCommands

MenuReasons

MouseShapes

MoveReasons

PageTilingOptions

PatternStyles

PrintColor

PrintDuplex

PrinterOrientation

PrinterSizes

PrintQuality

PrintSources

QueryRestartOptions

RasterOperations

ReportOrientation

ReportPrintPanel

ReportPrintRestart

SpecialFieldTypes

StatusReasons

TableFrameStyles

TextAlignment

TextDesignSizing

TextSpacing

UIObjectTypes

UpdateLink

ValueReasons

WindowStyles


ActionClasses

Constant	Data type	Description

DataAction	SmallInt	Data actions are for navigating in a table and for such tasks as record locking and record posting.

EditAction	SmallInt	Most Edit actions alter data within a field

FieldAction	SmallInt	Field actions are a special category of Move action that enable movement between field objects.

MoveAction	SmallInt	Move actions have to do with moving within a field object

SelectAction	SmallInt	Select actions are equivalent to Move actions


ActionDataCommands

Constant	Data type	Description

DataArriveRecord	SmallInt	Indicates a change to the current record, regardless of the reason. Some possible reasons: navigation, editing, network refresh, and scrolling.

DataBegin	SmallInt	Moves to first record in the table associated with the given UIObject. Will force recursive action (DataUnlockRecord) if current record has been modified. If Error encountered, will call error method. Invoked by Toolbar "first record" button, Record | First menu action.

DataBeginEdit	SmallInt	Used to enter Edit mode on the form. Normally always allowed. Invoked by (1st) F9, menu choice View | Edit Data or Edit icon on toolbar.

DataBeginFirstField	SmallInt	Moves to the first field in the first record of the table associated with the given UIObject. Invoked by Ctrl+Home.

DataCancelRecord	SmallInt	Used to discard changes to record. Succeeds by default, but user could block it. Invoked by Edit | Undo, Alt+Backspace, or Record | Cancel Changes menu item. Also used internally when moving off a locked but unmodified record.

DataDeleteRecord	SmallInt	Deletes the current record. Errors encountered will call error method. This action is irreversible except for dBASE tables.

Invoked by Record | Delete or Ctrl+Del.

DataDesign	SmallInt	Switches from running the form into Design mode. Invoked by F8.

DataDitto	SmallInt	Copies into the current field the value of the corresponding field in the prior record. Invoked by Ctrl+D.

DataEnd	SmallInt	Moves to final record in the table associated with the given UIObject. Will force recursive action (DataUnlockRecord) if current record has been modified. Error encountered will call error method. Invoked by Toolbar "last record" button.

DataEndEdit	SmallInt	Used to exit Edit mode on the form. Invoked by (second) F9 Edit Data on the Toolbar, or View | View Data menu action.

DataEndLastField	SmallInt	Moves to the last field of the last record of the table associated with a UIObject. Invoked by [Ctrl+Home].

DataFastBackward	SmallInt	Moves backward one "set" of records (where a "set" is defined as the number of rows in a table frame or MRO). Invoked by Record | Previous Set, [Shift+F11] or Previous Set icon on Toolbar.

DataFastForward	SmallInt	Moves forward one "set" of records (where a "set" is defined as the number of rows in a table frame or MRO). Invoked by Record | Next Set, [Shift+F11] or Next Set icon on Toolbar.

DataHideDeleted	SmallInt	Alters the mode of the form so that deleted records will be hidden (available only for dBASE tables). Invoked by Form | Hide Deleted.

DataInsertRecord	SmallInt	Will insert a new (blank) record before the current record. Record state will appear as "locked", and blank record will not exist in the underlying table until the record is eventually modified and unlocked. Invoked by Record | Insert, or Ins. Note that records created in this way can be discarded either via DataDeleteRecord or DataCancelRecord before they have been unlocked. Moving off such a record without making any changes will internally use DataCancelRecord to discard it. Invoked by Ins or Record | Insert menu choice.

DataLockRecord	SmallInt	Used to lock the current record. Errors encountered will call error method. Invoked by F5.

DataLookup	SmallInt	Used to invoke lookup table for current field, to accept user's choice of new value, and, if appropriate, to update all corresponding fields governed by lookup. Available only for fields that have been defined as lookup fields. Invoked by Ctrl + Spacebar.

DataLookupMove	SmallInt	A special form of lookup which allows the user to choose a new master record for this detail. Invoked by Record | Move Help or Ctrl+Shift+Space.

DataNextRecord	SmallInt	Moves (if possible) to next sequential record in the table associated with the UIObject. Will force recursive action(DataUnlockRecord) if current record has been modified. Errors encountered will call error method. Invoked by Record | Next menu choice, Toolbar "next record" button, F12, and so forth.

DataNextSet	SmallInt	Moves forward one "set" of records (where a "set" is defined as the number of rows in a table frame or MRO. Invoked by PgDn.

DataPostRecord	SmallInt	Just like DataUnlockRecord, but the record lock will not be released. As a consequence, if changes to key fields mean the record will move to a new position in the table, the table's position "flies with" that record (meaning it will still be the current record). Invoked by Ctrl+F5 or Record | PostRecord menu choice.

DataPrint	SmallInt	Prints a Form or Table window. Invoked by File | Print menu choice or printer icon on toolbar.

DataPriorRecord	SmallInt	Moves (if possible) to previous record in the table associated with the UIObject. Will force recursive action(DataUnlockRecord) if current record has been modified. Errors encountered will call error method. Invoked by Record | Previous menu choice, Toolbar "prior record" button, F11, and so forth.

DataPriorSet	SmallInt	Moves backward one "set" of records (where a "set" is defined as the number of rows in a table frame or MRO, or 1 in the case of a single record form). Will force recursive action(DataUnlockRecord) if current record has been modified. Errors encountered will call error method. invoked by PgUp.

DataRecalc	SmallInt	Forces an object and all objects it contains to refetch and recompute all their data. Invoked by Ctrl+F3

DataRefresh	SmallInt	Notification of a refresh of a value in a record displayed on the screen.

DataRefreshOutside	SmallInt	Notification of a refresh of a value in a record not displayed on the screen.

DataSaveCrosstab	SmallInt	Writes given crosstab to CROSSTAB.DB. Different from EditSaveCrosstab, which brings up a dialog box asking user the name of the crosstab table to create.

DataSearch	SmallInt	Brings up a dialog box to allow the user to search for a specific value within a specified field. Invoked by Record | Locate | Value or Ctrl+Z.

DataSearchNext	SmallInt	Will search for the next record containing the value last specified in response to the last DataSearch action. Invoked by Record | Locate Next or Ctrl+A.

DataSearchRecord	SmallInt	Brings up a dialog box to allow the user to search for a record by specifying the record number. Invoked by Record | Locate | Record Number.

DataSearchReplace	SmallInt	Brings up a dialog to allow the user to search for a specific value within a specified field and to replace it with a different value. Invoked by Record | Locate and Replace, or Ctl+Shift+Z.

DataShowDeleted	SmallInt	Alters the mode of the form so that deleted records will be shown (available only for dBASE tables). They will look no different from normal records, but status line will reflect their state. Invoked by Form | Show Deleted.

DataTableView	SmallInt	Used to bring up a Table View of the master table of a form. If this form was originally invoked as preferred form of existing Table View, this just returns focus to that Table View. Invoked by F7, Table View on the Toolbar or View | Table View.

DataToggleDeleted	SmallInt	Used to reverse the state of "show deleted records" for dBASE tables.

DataToggleDeleteRecord	SmallInt	Used to reverse the deleted state of records in dBASE tables.

DataToggleEdit	SmallInt	Used to reverse the Edit state of the form. Recursively calls action (DataBeginEdit) or action (DataEndEdit) as appropriate. Invoked by F9 Edit Data on the Toolbar.

DataToggleLockRecord	SmallInt	Used to reverse the lock state of the current record. Actually just recursively uses action (DataLockRecord) or action (DataUnlockRecord) as appropriate. Errors encountered will call error method.

DataUnDeleteRecord	SmallInt	For dBASE tables, will match previously deleted record as "undeleted."

DataUnlockRecord	SmallInt	Used to commit the record modifications to the table and then (if successful) to unlock the record. Error encountered will call error method. Invoked by Record | Unlock or Shift+F5.


ActionEditCommands

Constant	Data type	Description

EditCommitField	SmallInt	Write current field's modifications to record buffer (without leaving field).

EditCopySelection	SmallInt	Copies selected area of text to Clipboard. Invoked by Edit | Copy menu choice or Ctrl+Ins.

EditCopyToFile	SmallInt	Invokes a dialog box to copy selection to a file. Invoked by Edit | Copy To menu choice.

EditCutSelection	SmallInt	Copies selected area of text to Clipboard and deletes it. Invoked by Edit | Cut menu choice or Ctrl+Del.

EditDeleteBeginLine	SmallInt	Deletes from current position to beginning of line.

EditDeleteEndLine	SmallInt	Deletes from current position to end of line.

EditDeleteLeft	SmallInt	Deletes one character position to the left. Invoked by Backspace in Field View.

EditDeleteLeftWord	SmallInt	Deletes up to and including beginning of word to the left of current character position.

EditDeleteLine	SmallInt	Deletes line on which current position is found.

EditDeleteRight	SmallInt	Deletes one character position to the right. Invoked by Del in Field View.

EditDeleteRightWord	SmallInt	Deletes up to and including end of word to the right of current character position.

EditDeleteSelection	SmallInt	Deletes currently selected area of text. Invoked by Edit | Delete menu choice.

EditDeleteWord	SmallInt	Deletes word around the current position. Invoked by Ctrl+Backspace.

EditDropDownList	SmallInt	Used by dropdown edit fields. Will drop down the associated pick list. Invoked by Alt+Down or click on edit field's list icon.

EditEnterFieldView	SmallInt	Enters Field View for current field (allowing arrow keys to move around within the field). Begins by moving current position to end of field and dehighlighting it. Invoked by F2, View | Field View or the Field View icon on toolbar.

EditEnterMemoView	SmallInt	Enters "memo" view on memos or OLE fields. Invoked by Shift+F2 or View | Memo View.

EditEnterPersistFieldView	SmallInt	Enters "persistent Field View," meaning arrow keys always move within character positions within a field, even when moving to new fields. Invoked by Ctrl+F2 or View | Persistent Field View.

EditExitFieldView	SmallInt	Exits Field View (meaning arrow keys will move between fields again) and highlights entire field. Invoked by F2, View | Field View or Field View icon on toolbar.

EditExitMemoView	SmallInt	Exits "memo" view on memos or OLE fields, meaning Enter and Tab will once again move between fields. Invoked by Shift+F2 or View | Memo View.

EditExitPersistField View	SmallInt	Exits "presistent Field View" meaning arrow keys move between fields. Invoked by Ctrl+F2 or View | Persistent Field View.

EditHelp	SmallInt	Invokes the help subsystem. Invoked by F1.

EditInsertBlank	SmallInt	Inserts a blank character at current position.

EditInsertLine	SmallInt	Inserts a blank line at current position.

EditInsertObject (5.0)	SmallInt	Used only by OLE fields, inserts linked or embedded object into current field.

EditLaunchServer	SmallInt	Used only by OLE fields, will invoke the server application appropriate for current field.

EditPaste	SmallInt	Paste from the Clipboard to current position (replacing current selection if appropriate). Invoked by Shift+Ins or Edit | Paste.

EditPasteFromFile	SmallInt	Invokes a dialog box, allowing user to select file to insert at current position. Invoked by Edit | Paste From.

EditPasteLink (5.0)	SmallInt	Used only by OLE fields, pastes an object from the Clipboard and estabilshes a link to the underlying file. Invoked by Edit | Paste Link.

EditProperties	SmallInt	Invokes the property inspection menu for given object. Only unbound field objects, bound graphic fields, and bound formatted memo fields support this. Invoked by mouse right click, Properties | Current Object or F6.

EditReplace	SmallInt	Toggles overstrike mode in a field object.

EditSaveCrosstab (5.0)	SmallInt	Invokes a dialog box to allow user to save a crosstab. Invoked by Edit | Save Crosstab

EditTextSearch	SmallInt	Invokes a dialog box to allow user to search and replace text within current field. Invoked by Edit | Search Text.

EditToggleFieldView	SmallInt	Reverses current state of Field View. Recursively calls action (EditEnterFieldView) or action (EditExitFieldView). Invoked by F2 Field View on the Toolbar or Edit | Field View.

EditUndoField	SmallInt	Discards current fields modifications and reverts to value in current record buffer. Invoked by Esc.


ActionFieldCommands

Constant	Data type	Description

FieldBackward	SmallInt	Used to move one field backward in tab order. This will search for the prior UIObject marked as a "Tab Stop" in left-right/top-down order. Invoked by Shift+xTab.

FieldDown	SmallInt	Used to move to field below current field, whether in Field View or not. Invoked by Alt+ [image].

FieldEnter	SmallInt	Used to commit modifications to a field (if any) and to move one field forward in tab order. Invoked by Enter.

FieldFirst	SmallInt	Used to move to first field within a record. Invoked by Alt+Home.

FieldForward	SmallInt	Used to move one field forward in tab order. This will search for the next UIObject marked as a "Tab Stop" in left-right / top-down order. Invoked by Tab.

FieldGroupBackward	SmallInt	Used to move one "super" tab group backward (for example, between different table frames on the same form). Invoked by F3.

FieldGroupForward	SmallInt	Used to move one "super" tab group forward (for example, between different table frames on the same form). Invoked by F4.

FieldLast	SmallInt	Used to move to last field within a record. Invoked by Alt+End or by End (when not in Field View).

FieldLeft	SmallInt	Used to move to field to left of current field.

FieldNextPage	SmallInt	Used to move to next sequential page in multi-page form. Invoked by Form | Page | Next or Shift+F4.

FieldPriorPage	SmallInt	Used to move to prior page in multi-page form. Invoked by Form | Page | Previous or Shift+F3.

FieldRight	SmallInt	Used to move to field to right of current field, whether in Field View or not. Invoked by Alt+ [image].

FieldRotate	SmallInt	Used to rotate columns within a table frame. Invoked by Ctrl+R.

FieldUp	SmallInt	Used to move to field above current field, whether in Field View or not. Invoked by Alt+ [image].


ActionMoveCommands

Constant	Data type	Description

MoveBegin	SmallInt	In Memo View, moves to beginning of  document. Otherwise, moves to first field in first record of table. Invoked by Ctrl+Home.

MoveBeginLine	SmallInt	In Memo View, moves to beginning of line; otherwise, moves to first field in record. Invoked by Home.

MoveBottom	SmallInt	In Memo View, moves to bottom line of the text region. Otherwise, moves to last record in table.

MoveBottomLeft	SmallInt	In Memo View, moves to beginning of last line on screen.

MoveBottomRight	SmallInt	In Memo View, moves to end of last line on screen. Invoked by Ctrl+PgDn.

MoveDown	SmallInt	Moves down as appropriate. In Memo View, moves down one line on multiline fields. Otherwise, moves to next "Tab Stop" object below current object. Table frame objects move to next record. Invoked by [image].

MoveEnd	SmallInt	In Memo View, moves to end of document; otherwise, moves to last field in last record of table. Invoked by Ctrl+End.

MoveEndLine	SmallInt	In Memo View, moves to end of line; otherwise, moves to last field in record. Invoked by End.

MoveLeft	SmallInt	Moves left as appropriate. In Memo View, moves one character position left; otherwise, moves to next Tab Stop object to left of current object. Invoked by [image].

MoveLeftWord	SmallInt	In Memo View, moves insertion point to beginning of word to the left of current insertion point. Invoked by Ctrl+ [image].

MoveRight	SmallInt	Moves right as appropriate. In Memo View, moves one character position right; otherwise, moves to next Tab Stop object to right of current object. Invoked by [image].

MoveRightWord	SmallInt	In Memo View, moves insertion point to beginning of word to the right of current insertion point. Invoked by Ctrl+ [image].

MoveScrollDown	SmallInt	Scrolls image down (effectively moving viewing area up) by appropriate amount. Active fields scroll by even lines of text. Tables move to new record. In Memo View, scroll toward the bottom of the text. The insertion point remains on the same line of the display region unless the last line of the text is visible, in which case the insertion point moves down one line until the last line is reached. Invoked by Ctrl+ [image].

MoveScrollLeft	SmallInt	Scrolls image to left (effectively moving viewing area to the right) by appropriate amount. Active fields scroll roughly one character position. Tables move to new column.

MoveScrollPageDown	SmallInt	Scrolls image down (effectively moving viewing area up) by logical size of object (for example, complete page of document). Invoked by PgDn.

MoveScrollPageLeft	SmallInt	Scrolls image left (effectively moving viewing area right) by logical size of object (for example, complete page of document).

MoveScrollPageRight	SmallInt	Scrolls image right (effectively moving viewing area left) by logical size of object (for example, complete page of document).

MoveScrollPageUp	SmallInt	Scrolls image up (effectively moving viewing area down) by logical size of object (for example, complete page of document). Invoked by PgUp.

MoveScrollRight	SmallInt	Scrolls image to right (effectively moving viewing area to the left) by appropriate amount. Active fields scroll roughly one character position. Tables move to new column.

MoveScrollScreenDown	SmallInt	Scrolls image down (effectively moving viewing area up) by size of viewing area (for example, size of field). In Memo View, moves down in the document by the height of the display area.

MoveScrollScreenLeft	SmallInt	Scrolls image left (effectively moving viewing area right) by size of viewing area (for example, size of field).

MoveScrollScreenRight	SmallInt	Scrolls image right (effectively moving viewing area left) by size of viewing area (for example, size of field).

MoveScrollScreenUp	SmallInt	Scrolls image up (effectively moving viewing area down) by size of viewing area (for example, size of field). In Memo View, moves up in the document by the height of the display area.

MoveScrollUp	SmallInt	Scroll image up (effectively moving viewing area down) by appropriate amount. Active fields scroll by even lines of text. In Memo View, scroll toward the top of the document by one line of text. The insertion point stays at the same line position unless the top line of the document is visible, in which case the insertion point moves up one line if it can. Invoked by Ctrl+ [image].

MoveTop	SmallInt	In Memo View, move the insertion point to the first line of text visible in the display region; otherwise, moves to first record in table.

MoveTopLeft	SmallInt	In Memo View, moves to the top left of the display region; otherwise, moves to top left field. Invoked by Ctrl+PgUp.

MoveTopRight	SmallInt	In Memo View, moves to the top right of the display region; otherwise, moves to top right field.

MoveUp	SmallInt	Moves up as appropriate. In Memo View, moves up one line on multiline fields; otherwise, it moves to next Tab Stop object above current object. Table frame objects move to prior record. Invoked by [image].


ActionSelectCommands

Constant	Data type	Description

SelectBegin	SmallInt	In Memo View, selects from current position to beginning of document; otherwise, selects from current position to first field in first record of table. Invoked by Shift+Ctrl+Home.

SelectBeginLine	SmallInt	In Memo View, selects from current position to beginning of line; otherwise, selects from current position to first field in record. Invoked by Shift+Home.

SelectBottom	SmallInt	In Field View and Memo View, select from current position to bottom of the display region; otherwise, selects from current position to last record in table.

SelectBottomLeft	SmallInt	In Memo View, selects from current position to beginning of last line in display region. Invoked by Shift+Ctrl+PgUp.

SelectBottomRight	SmallInt	In Memo View, selects from current position to end of last line in displa region. Invoked by Shift+Ctrl+PgDn.

SelectDown	SmallInt	Selects down as appropriate. In Field View or Memo View, selects down one line on multiline fields. Cannot extend selection across fields in forms. Table frame objects select to next record. Invoked by Shift+ [image].

SelectEnd	SmallInt	In Field View or Memo View, selects from current position to end of document; otherwise, selects from current position to last field in last record of table. Invoked by Shift+Ctrl+End.

SelectEndLine	SmallInt	In Field View or Memo View, selects from current position to end of line; otherwise, selects from current position to last field in recod. Invoked by Shift+End.

SelectLeft	SmallInt	Selects left as appropriate. In Field View or Memo View, selects one character position left; otherwise, selects next Tab Stop object to left of current object. Invoked by Shift+ [image].

SelectLeftWord	SmallInt	In Field View or Memo View, if the insertion point is between words, selects word to the left of insertion point. If the insertion point is within a word, selects to the beginning of that word. Invoked by Shift+Ctrl+ [image].

SelectRight	SmallInt	Selects right as appropriate. In Field View or Memo View, selects one character position right. Invoked by Shift+ [image].

SelectRightWord	SmallInt	In Field View or Memo View, selects to the beginning of the next following word. If the insertion point precedes one or more spaces or tabs, selection only includes those spaces or tabs. Invoked by Shift+Ctrl+ [image].

SelectScrollDown	SmallInt	Selects image down (effectively moving viewing area up) by appropriate amount. Active fields select even lines of text. Tables select new record. Invoked by Shift+Crtl+ [image].

SelectScrollLeft	SmallInt	Selects image on left (effectively moving viewing area to the right) by appropriate amount. Active fields select roughly one character position. Tables select to new column.

SelectScrollPageDown	SmallInt	Selects image down (effectively moving viewing area up) by logical size of object (for example, complete page of document).

SelectScrollPageLeft	SmallInt	Selects image left (effectively moving viewing area right) by logical size of object (for example, complete page of document).

SelectScrollPageRight	SmallInt	Selects image right (effectively moving viewing area left) by logical size of object (for example, complete page of document).

SelectScrollPageUp	SmallInt	Selects image up (effectively moving viewing area down) by logical size of object (for example, complete page of document).

SelectScrollRight	SmallInt	Selects image on right (effectively moving viewing area to the left) by appropriate amount. Active fields select roughly one character position. Tables select new column.

SelectScrollScreenDown	SmallInt	Selects image down (effectively moving viewing area up) by size of viewing area (for example, size of field). Invoked by Shift+PgDn.

SelectScrollScreenLeft	SmallInt	Selects image left (effectively moving viewing area right) by size of viewing area (for example, size of field).

SelectScrollScreenRight	SmallInt	Selects image right (effectively moving viewing area left) by size of viewing area (for example, size of field).

SelectScrollScreenUp	SmallInt	Selects image up (effectively moving viewing area down) by size of viewing area (for example, size of field). Invoked by Shift+PgUp.

SelectScrollUp	SmallInt	Select image up (effectively moving viewing area down) by appropriate amount. Active fields select by even lines of text.

SelectSelectAll	SmallInt	Selects the entire field.

SelectTop	SmallInt	In Field View or Memo View, selects from current position to top of display region; otherwise, selects from current position to first record in table.

SelectTopLeft	SmallInt	In Field View or Memo View, selects from current position to beginning of screen; otherwise, selects from current position to top left field. Invoked by Shift+Crtl+PgUp.

SelectTopRight	SmallInt	In Field View or Memo View, selects from current position to end of top line of screen; otherwise, selects from current position to top right field. Invoked by Shift+Crtl+PgDn.

SelectUp	SmallInt	Selects up as appropriate. In Field View or Memo View, selects up one line on multiline fields; otherwise, it selects next Tab Stop object above current object. Table frame objects select to prior record. Invoked by Shift+ [image].


AggModifiers
AggModifiers	5.0

Constant	Data type	Description

CumulativeAgg	SmallInt	A cumulative summary that keeps a running total that extends from the start of the report to the end of the current group.

CumUniqueAgg	SmallInt	A cumulative summary that counts only the unique non-null values from the start of the report to the end of the current group.

RegularAgg	SmallInt	A normal summary that considers all non-null values in the set, including duplicates.

UniqueAgg	SmallInt	A unique summary that counts only the unique non-null values in the set. Duplicates are ignored.


ButtonStyles

Constant	Data type	Description

BorlandButton	SmallInt	Gives a button the 3D look of buttons in Borland products.

Windows3dButton	SmallInt	Gives a button the 3D look of buttons in other Windows products.

WindowsButton	SmallInt	Gives a button the flat look of buttons in other Windows products.


ButtonTypes

Constant	Data type	Description

CheckboxType	SmallInt	Displays a button as a check box.

PushButtonType	SmallInt	Displays a button as a push button.

RadioButtonType	SmallInt	Displays a button as a radio button.


Colors

Constant	Data type

Black	LongInt

Blue	LongInt

Brown	LongInt

DarkBlue	LongInt

DarkCyan	LongInt

DarkGray	LongInt

DarkGreen	LongInt

DarkMagenta	LongInt

DarkRed	LongInt

Gray	LongInt

Green	LongInt

LightBlue	LongInt

Magenta	LongInt

Red	LongInt

Translucent	LongInt

Transparent	LongInt

White	LongInt

Yellow	LongInt


CompleteDisplay

Constant	Data type	Description

DisplayAll	SmallInt	Specifies CompleteDisplay for all field objects in the form.

DisplayCurrent	SmallInt	Specifies CompleteDisplay for the current field object.


DateRangeTypes
DateRangeTypes	5.0

Constant	Data type	Description

ByDay	SmallInt	Group report records by day.

ByMonth	SmallInt	Group report records by month.

ByQuarter	SmallInt	Group report records by quarter (3 months).

ByWeek	SmallInt	Group report records by week.

ByYear	SmallInt	Group report records by year.


ErrorReasons

Constant	Data type	Description

ErrorCritical	SmallInt	Displays a message in a model dialog box.

ErrorWarning	SmallInt	Displays a message in the status area.


EventErrorCodes

Constant	Data type	Description

Can_Arrive	SmallInt	Grants permission to arrive at an object.

Can_Depart	SmallInt	Grants permission to leave an object.

CanNotArrive	SmallInt	Grants permission to arrive at an object (blocks the move).

CanNotDepart	SmallInt	Grants permission to leave an object (blocks the move).


ExecuteOptions

Constant	Data type	Description

ExeHidden	SmallInt	Hides the application window and passes activation to another window.

ExeMinimized	SmallInt	Minimizes the application window and activates the top-level window in the window-manager's list.

ExeShowMaximized	SmallInt	Activates the application window and displays it as a maximized window.

ExeShowMinimized	SmallInt	Activates the application window and displays it minimized (as an icon).

ExeShowMinimizedNoActivate	SmallInt	Displays the application as an icon. The window that is currently active remains active.

ExeShowNoActivate	SmallInt	Displays the application window at its most recent size and position. The currently active window remains active.

ExeShowNormal	SmallInt	Activates and displays a window


FieldDisplayTypes

Constant	Data type	Description

BitmapField	SmallInt	Enables a field object to display a bitmap.

CheckboxField	SmallInt	Displays a field as a check box.

ComboField	SmallInt	Displays a field as a drop-down edit list (also called a combo box).

EditField	SmallInt	Displays an unlabeled field.

LabeledField	SmallInt	Displays a labeled field.

ListField	SmallInt	Displays a list box.

OleField	SmallInt	Enables a field to contain OLE data.

RadioButtonField	SmallInt	Displays a field as one or more radio buttons.


FileBrowserFileTypes

Constant	Data type	Description

fbAllTables	LongInt	All table types supported by Paradox (*.db, *.dbf, etc.)

fbASCII	LongInt	Text files (*.txt).

fbBitmap	LongInt	Bitmap graphics (*.bmp).

fbConfig	LongInt	Configuration files (*.cfg).

fbDBase	LongInt	dBASE tables (*.dbf).

fbDM (5.0)	LongInt	Data model files (*.dm).

fbExcel	LongInt	Excel worksheets (*.xls).

fbFiles	LongInt	All files (*.*).

fbForm	LongInt	Paradox forms (*.fsl, *.fdl).

fbGraphic	LongInt	Graphic files (*.bmp, *.eps, *.gif, *.pcx, *.tif).

fbIni	LongInt	Initialization files (*.ini).

fbLibrary	LongInt	ObjectPAL libraries (*.lsl, *.ldl).

fbLotus1	LongInt	Lotus 1-2-3 version 1 worksheets (*.wks).

fbLotus2	LongInt	Lotus 1-2-3 version 2 worksheets (*.wk1).

fbParadox	LongInt	Paradox tables (*.db).

fbPrintStyle (5.0)	LongInt	Printer style sheets (*.fp).

fbQuattro	LongInt	Quattro worksheets (*.wkq).

fbQuattroPro	LongInt	Quattro Pro worksheets (*.wq1).

fbQuattroProWindows	LongInt	Quattro Pro for Windows notebooks (*.wb1).

fbQuery	LongInt	Query files (*.qbe).

fbReport	LongInt	Paradox reports (*.rsl, *.rdl).

fbScreenStyle (5.0)	LongInt	Form style sheets (*.ft).

fbScript	LongInt	ObjectPAL scripts (*.ssl, *.sdl).

fbSQL (5.0)	LongInt	SQL files (*.sql).

fbTable	LongInt	Paradox tables (*.db).

fbTableView	LongInt	Paradox table view files (*.tv).

fbText	LongInt	All text files (*.txt, *.pxt, *.rtf).


FontAttributes

Constant	Data type	Description

FontAttribBold	SmallInt	Example: bold

FontAttribItalic	SmallInt	Example: italic

FontAttribNormal	SmallInt	Example: normal

FontAttribStrikeOut	SmallInt	Example: strike out

FontAttribUnderline	SmallInt	Example: underline


FrameStyles

Constant	Data type	Description

DashDotDotFrame	SmallInt	A repeating sequence of one dash followed by two dots.

DashDotFrame	SmallInt	A repeating sequence of one dash followed by one dot.

DashedFrame	SmallInt	A repeating sequence of dashes.

DottedFrame	SmallInt	A repeating sequence of dots.

DoubleFrame	SmallInt	Two concentric boxes.

Inside3DFrame	SmallInt	The frame appears pushed into the form.

NoFrame	SmallInt	No frame.

Outside3DFrame	SmallInt	The frame appears popped out of the form.

ShadowFrame	SmallInt	A drop shadow.

SolidFrame	SmallInt	A single solid box (no dashes or dots).

WideInsideDoubleFrame	SmallInt	Two concentric boxes; the inside box is wide.

WideOutsideDoubleFrame	SmallInt	Two concentric boxes; the outside box is wide.

Windows3dFrame (5.0)	SmallInt	Uses the default Windows 3D frame style.

Windows3dGroup (5.0)	SmallInt	Uses the default Windows 3D group border.


General

Constant	Data type	Description

No	Logical	False

Off	Logical	False

On	Logical	True

PI	Number	3.14159265358979323846

Yes	Logical	True


GraphBindTypes

Constant	Data type	Description

Graph1DSummary	SmallInt	Specifies a one-dimensional summary graph. Enables summary operators.

Graph2DSummary	SmallInt	Specifies a two-dimensional summary graph. Enables summary operators and group-by specification.

GraphTabular	SmallInt	Specifies a tabular graph (default).


GraphicMagnification

Constant	Data type	Description

Magnify100	SmallInt	Displays the graph at its actual size.

Magnify200	SmallInt	Displays the graph at twice its actual size.

Magnify25	SmallInt	Displays the graph at a quarter of its actual size.

Magnify400	SmallInt	Displays the graph at four times its actual size.

Magnify50	SmallInt	Displays the graph at half its actual size.

MagnifyBestFit	SmallInt	Resizes the graph as necessary to fit the graph in the frame.


GraphLabelFormats

Constant	Data type	Description

GraphHideY	SmallInt	Hide Y-value (2-D and 3-D Pie and Column graphs only).

GraphPercent	SmallInt	Display Y-value as a percent (2-D and 3-D Pie and Column graphs only).

GraphShowY	SmallInt	Display Y-value in the units used in the table (2-D and 3-D Pie and Column graphs only).


GraphLegendPosition

Constant	Data type	Description

LegendCenter	SmallInt	Display the legend centered below the graph.

LegendLeft	SmallInt	Display the legend to the left of the graph.


GraphMarkers

Constant	Data type	Description

MarkerBoxedCross	SmallInt	Marker is a box with a cross in it.

MarkerBoxed_Plus	SmallInt	Marker is a box with a plus sign in it.

MarkerCross	SmallInt	Marker is a cross.

MarkerFilledBox	SmallInt	Marker is a filled box.

MarkerFilledCircle	SmallInt	Marker is a filled circle.

MarkerFilledDownTriangle	SmallInt	Marker is a filled triangle pointing down.

MarkerFilledTriangle	SmallInt	Marker is a filled triangle pointing up.

MarkerFilledTriangles	SmallInt	Marker is two filled triangles pointing at each other.

MarkerHollowBox	SmallInt	Marker is a hollow (unfilled) box.

MarkerHollowCircle	SmallInt	Marker is a hollow circle.

MarkerHollowDownTriangle	SmallInt	Marker is a hollow triangle pointing down.

MarkerHollowTriangle	SmallInt	Marker is a hollow triangle pointing up.

MarkerHollowTriangles	SmallInt	Marker is two hollow triangles pointing at each other.

MarkerHorizontalLine	SmallInt	Marker is a horizontal line.

MarkerPlus	SmallInt	Marker is a plus sign.

MarkerVerticalLine	SmallInt	Marker is a vertical line.


GraphTypeOverRide

Constant	Data type	Description

GraphArea	SmallInt	Displays specified series as an area graph.

GraphBar	SmallInt	Displays specified series as a bar graph.

GraphDefault	SmallInt	Displays specified series in the default graph type.

GraphLine	SmallInt	Displays specified series as a line graph.


GraphTypes

Constant	Data type	Description

Graph2DArea	SmallInt	2-dimensional area graph.

Graph2DBar	SmallInt	2-dimensional bar graph.

Graph2DColumns	SmallInt	2-dimensional column graph.

Graph2DLine	SmallInt	2-dimensional line graph.

Graph2DPie	SmallInt	2-dimensional pie graph.

Graph2DRotatedBar	SmallInt	2-dimensional rotated bar graph.

Graph2DStackedBar	SmallInt	2-dimensional stacked bar graph.

Graph3DArea	SmallInt	3-dimensional area graph.

Graph3DBar	SmallInt	3-dimensional bar graph.

Graph3DColumns	SmallInt	3-dimensional column graph.

Graph3DPie	SmallInt	3-dimensional pie graph.

Graph3DRibbon	SmallInt	3-dimensional ribbon graph.

Graph3DRotatedBar	SmallInt	3-dimensional rotated bar graph.

Graph3DStackedBar	SmallInt	3-dimensional stacked bar graph.

Graph3DStep	SmallInt	3-dimensional step graph.

Graph3DSurface	SmallInt	3-dimensional surface graph.

GraphXY	SmallInt	XY graph.


IdRanges

Constant	Data type	Description

UserAction	SmallInt	The minimum value for a user-defined action constant.

UserActionMax	SmallInt	The maximum value for a user-defined action constant.

UserError	SmallInt	The minimum value for a user-defined error constant.

UserErrorMax	SmallInt	The maximum value for a user-defined error constant.

UserMenu	SmallInt	The minimum value for a user-defined menu ID constant.

UserMenuMax	SmallInt	The maximum value for a user-defined menu ID constant.


Keyboard

Constant	Data type	Description

VK_ADD	SmallInt	Add key

VK_BACK	SmallInt	Backspace key

VK_CANCEL	SmallInt	Used for control-break processing

VK_CAPITAL	SmallInt	Capital key

VK_CLEAR	SmallInt	Clear key

VK_CONTROL	SmallInt	Ctrl key

VK_DECIMAL	SmallInt	Decimal key

VK_DELETE	SmallInt	Delete key

VK_DIVIDE	SmallInt	Divide key

VK_DOWN	SmallInt	 key

VK_END	SmallInt	End key

VK_ESCAPE	SmallInt	Escape key

VK_EXECUTE	SmallInt	Execute key

VK_F1	SmallInt	F1 key

VK_F10	SmallInt	F10 key

VK_F11	SmallInt	F11 key

VK_F12	SmallInt	F12 key

VK_F13	SmallInt	F13 key

VK_F14	SmallInt	F14 key

VK_F15	SmallInt	F15 key

VK_F16	SmallInt	F16 key

VK_F2	SmallInt	F2 key

VK_F3	SmallInt	F3 key

VK_F4	SmallInt	F4 key

VK_F5	SmallInt	F5 key

VK_F6	SmallInt	F6 key

VK_F7	SmallInt	F7 key

VK_F8	SmallInt	F8 key

VK_F9	SmallInt	F9 key

VK_HELP	SmallInt	Help key

VK_HOME	SmallInt	Home key

VK_INSERT	SmallInt	Insert key

VK_LBUTTON	SmallInt	Left mouse button

VK_LEFT	SmallInt	 key

VK_MBUTTON	SmallInt	Middle mouse button (3-button mouse)

VK_MENU	SmallInt	Menu key

VK_MULTIPLY	SmallInt	Multiply key

VK_NEXT	SmallInt	Page Down key

VK_NUMLOCK	SmallInt	Num Lock key

VK_NUMPAD0	SmallInt	Key pad 0 key

VK_NUMPAD1	SmallInt	Key pad 1 key

VK_NUMPAD2	SmallInt	Key pad 2 key

VK_NUMPAD3	SmallInt	Key pad 3 key

VK_NUMPAD4	SmallInt	Key pad 4 key

VK_NUMPAD5	SmallInt	Key pad 5 key

VK_NUMPAD6	SmallInt	Key pad 6 key

VK_NUMPAD7	SmallInt	Key pad 7 key

VK_NUMPAD8	SmallInt	Key pad 8 key

VK_NUMPAD9	SmallInt	Key pad 9 key

VK_PAUSE	SmallInt	Pause key

VK_PRINT	SmallInt	OEM specific

VK_PRIOR	SmallInt	Page Up key

VK_RBUTTON	SmallInt	Right mouse button

VK_RETURN	SmallInt	Return key

VK_RIGHT	SmallInt	 key

VK_SELECT	SmallInt	Select key

VK_SEPARATOR	SmallInt	Separator key

VK_SHIFT	SmallInt	Shift key

VK_SNAPSHOT	SmallInt	Printscreen key for Windows 3.0 and later

VK_SPACE	SmallInt	Space

VK_SUBTRACT	SmallInt	Subtract key

VK_TAB	SmallInt	Tab key

VK_UP	SmallInt	 key


KeyBoardStates

Constant	Data type	Description

Alt	SmallInt	Alt is pressed.

Control	SmallInt	Ctrl is pressed.

LeftButton	SmallInt	The left mouse button is clicked.

RightButton	SmallInt	The right mouse button is clicked.

Shift	SmallInt	Shift is pressed.


LibraryScope

Constant	Data type	Description

GlobalToDesktop	SmallInt	Makes variables in an ObjectPAL library available to one or more forms.

PrivateToForm	SmallInt	Makes variables in an ObjectPAL library available to one form only.


LineEnds

Constant	Data type	Description

ArrowBothEnds	SmallInt	Adds arrows to both ends of a line (only if LineType = StraightLine)

ArrowOneEnd	SmallInt	Adds an arrow to the terminal end of a line (only if LineType = StraightLine)

NoArrowEnd	SmallInt	Displays a line without arrows at either end.


LineStyles

Constant	Data type	Description

DashDotDotLine	SmallInt	A repeating sequence of one dash followed by two dots.

DashDotLine	SmallInt	A repeating sequence of one dash followed by one dot.

DashedLine	SmallInt	A repeating sequence of dashes.

DottedLine	SmallInt	A repeating sequence of dots.

NoLine	SmallInt	No line.

SolidLine	SmallInt	An unbroken line.


LineThickness

Constant	Data type	Description

LWidth10Points	SmallInt	Specifies a thickness of 10 printer's points.

LWidth1Point	SmallInt	Specifies a thickness of 1 printer's point.

LWidth2Points	SmallInt	Specifies a thickness of 2 printer's points.

LWidth3Points	SmallInt	Specifies a thickness of 3 printer's points.

LWidth6Points	SmallInt	Specifies a thickness of 6 printer's points.

LWidthHairline	SmallInt	Specifies a very thin line.

LWidthHalfFoint	SmallInt	Specifies a thickness of one half of a printer's point.


LineTypes

Constant	Data type	Description

CurvedLine	SmallInt	Specifies a curved (eliptical) line.

StraightLine	SmallInt	Specifies a straight line.


MenuChoiceAttributes

Constant	Data type	Description

MenuChecked	SmallInt	Insert a checkmark before the menu item.

MenuDisabled	SmallInt	Menu item cannot be selected. Menu stays open.

MenuEnabled	SmallInt	Menu item can be selected. Menu closes.

MenuGrayed	SmallInt	Menu item displayed in gray characters (dimmed).

MenuHilited	SmallInt	Menu item is highlighted.

MenuNotChecked	SmallInt	Display menu item without a checkmark.

MenuNotGrayed	SmallInt	Display the menu item normally (not dimmed).

MenuNotHilited	SmallInt	Display menu item without a highlight.


MenuCommands

Constant	Data type	Description

MenuBuild (4.5)	SmallInt	Reports when the Desktop is building a form's menu.

MenuCanClose	SmallInt	Asks for permission to continue after choosing Close from the Control menu.

MenuChangedPriv (5.0)	SmallInt	Reports when the private directory (:PRIV:) has been changed. Forms that remain open after the change can use this information to make adjustments, as needed.

MenuChangedWork (5.0)	SmallInt	Reports when the working directory (:WORK:) has been changed. Forms that remain open after the change can use this information to make adjustments, as needed.

MenuChangingPriv (5.0)	SmallInt	Reports when the private directory (:PRIV:) is about to change. Setting the error code to a nonzero value allows a form to stay open after the change; setting the error code to zero closes the form before changing the directory. Same as choosing File | Private Directory.

MenuChangingWork (5.0)	SmallInt	Reports when the working directory (:WORK:) is about to change. Setting the error code to a nonzero value allows a form to stay open after the change; setting the error code to zero closes the form before changing the directory. Same as choosing File | Working Directory.

MenuControlClose	SmallInt	Same as choosing Close from the Control menu.

MenuControlKeyMenu	SmallInt	Control menu was invoked by a keypress.

MenuControlMaximize	SmallInt	Same as choosing Maximize from the Control menu.

MenuControlMinimize	SmallInt	Same as choosing Minimize from the Control menu.

MenuControlMouseMenu	SmallInt	Control menu was invoked by a mouse click.

MenuControlMove	SmallInt	Same as choosing Move from the Control menu.

MenuControlNextWindow	SmallInt	Same as choosing Next Window from the Control menu.

MenuControlPrevWindow	SmallInt	Same as choosing Prev Window from the Control menu.

MenuControlRestore	SmallInt	Same as choosing Restore from the Control menu.

MenuControlSize	SmallInt	Same as choosing Size from the Control menu.

MenuEditCopy	SmallInt	Edit | Copy

MenuEditCopyTo	SmallInt	Edit | Copy To

MenuEditCut	SmallInt	Edit | Cut

MenuEditDelete	SmallInt	Edit | Delete

MenuEditLinks	SmallInt	For OLE objects only.

MenuEditPaste	SmallInt	Edit | Paste

MenuEditUndo	SmallInt	Edit | Undo

MenuFileAliases	SmallInt	File | Aliases

MenuFileExit	SmallInt	File | Exit

MenuFileExport	SmallInt	File | Utiltities | Export

MenuFileImport	SmallInt	File | Utilitites | Import

MenuFileMultiBlankZero	SmallInt	File | System Settings | Blank As Zero

MenuFileMultiUserAutoRefresh	SmallInt	File | System Settings | Auto Refresh

MenuFileMultiUserDrivers	SmallInt	File | System Settings | Drivers

MenuFileMultiUserLock	SmallInt	File | Multiuser | Set Locks

MenuFileMultiUserLockInfo	SmallInt	File | Multiuser | Display Locks

MenuFileMultiUserRetry	SmallInt	File | Multiuser | Set Retry

MenuFileMultiUserUserName	SmallInt	File | Multiuser | User Name

MenuFileMultiUserWho	SmallInt	File | Multiuser | Who

MenuFilePrint	SmallInt	File | Print

MenuFilePrinterSetup	SmallInt	File | Printer Setup

MenuFilePrivateDir	SmallInt	File | Private Directory

MenuFileTableAdd	SmallInt	File | Utilties | Add

MenuFileTableCopy	SmallInt	File | Utilties | Copy

MenuFileTableDelete	SmallInt	File | Utilties | Delete

MenuFileTableEmpty	SmallInt	File | Utilties | Empty

MenuFileTableInfoStructure	SmallInt	File | Utilties | Info Structure

MenuFileTablePasswords	SmallInt	File | Utilties | Passwords

MenuFileTableRename	SmallInt	File | Utilties | Rename

MenuFileTableRestructure	SmallInt	File | Utilties | Restructure

MenuFileTableSort	SmallInt	File | Utilties | Sort

MenuFileTableSubtract	SmallInt	File | Utilties | Subtract

MenuFileWorkingDir	SmallInt	File | Working Directory

MenuFolderOpen	SmallInt	File | Open | Folder

MenuFormDesign	SmallInt	Form | Design

MenuFormEditData	SmallInt	Form | Edit Data

MenuFormFieldView	SmallInt	Form | Field View

MenuFormNew	SmallInt	File | New | Form

MenuFormOpen	SmallInt	File | Open | Form

MenuFormOrderRange	SmallInt	Form | Order/Range

MenuFormPageFirst	SmallInt	Form | Page | First

MenuFormPageGoto	SmallInt	Form | Page | Go To

MenuFormPageLast	SmallInt	Form | Page | Last

MenuFormPageNext	SmallInt	Form | Page | Next

MenuFormPagePrevious	SmallInt	Form | Page | Previous

MenuFormShowDeleted	SmallInt	Form | Show Deleted

MenuFormTableView	SmallInt	Form | Table View

MenuFormViewData (5.0)	SmallInt	Form | View Data

MenuHelpAbout	SmallInt	Help | About

MenuHelpContents	SmallInt	Help | Contents

MenuHelpKeyboard	SmallInt	Help | Keyboard

MenuHelpToolbar (5.0)	SmallInt	Help | Toolbar

MenuHelpSupport	SmallInt	Help | Support Info

MenuHelpCoach (5.0)	SmallInt	Help | Coaches

MenuHelpUsingHelp	SmallInt	Help | Using Help

MenuInit	SmallInt	Generated by clicking a menu item

MenuInsertObject	SmallInt	For OLE objects only.

MenuLibraryNew	SmallInt	File | New | Library

MenuLibraryOpen	SmallInt	File | Open | Library

MenuOpenProjectView (5.0)	SmallInt	Tools | Project Viewer

MenuPasteFrom	SmallInt	Edit | Paste From

MenuPasteLink	SmallInt	Edit | Paste Link

MenuPropertiesCurrent	SmallInt	Properties | Current Object

MenuPropertiesDesigner	SmallInt	Properties | Designer

MenuPropertiesDesktop	SmallInt	Properties | Desktop

MenuPropertiesExpandedRuler	SmallInt	Properties | Expanded Ruler

MenuPropertiesFormRestoreDefaults	SmallInt	Properties | Form Options | Restore Defaults

MenuPropertiesFormSaveDefaults	SmallInt	Properties | Form Options | Save Defaults

MenuPropertiesHorizontalRuler	SmallInt	Properties | Form Options | Horizontal Ruler

MenuPropertiesVerticalRuler	SmallInt	Properties | Form Options | Vertical Ruler

MenuPropertiesZoom100	SmallInt	Properties | Zoom | 100%

MenuPropertiesZoom200	SmallInt	Properties | Zoom | 200%

MenuPropertiesZoom25	SmallInt	Properties | Zoom | 25%

MenuPropertiesZoom400	SmallInt	Properties | Zoom | 400%

MenuPropertiesZoom50	SmallInt	Properties | Zoom | 50%

MenuPropertiesZoomBestFit	SmallInt	Properties | Zoom | Best Fit

MenuPropertiesZoomFitHeight	SmallInt	Properties | Zoom | Fit Height

MenuPropertiesZoomFitWidth	SmallInt	Properties | Zoom | Fit Width

MenuQueryNew	SmallInt	File | New | Query

MenuQueryOpen	SmallInt	File | Open | Query

MenuRecordCancel	SmallInt	Record | Cancel Changes

MenuRecordDelete	SmallInt	Record | Delete

MenuRecordFastBackward	SmallInt	Record | Previous Set

MenuRecordFastForward	SmallInt	Record | Next Set

MenuRecordFirst	SmallInt	Record | First

MenuRecordInsert	SmallInt	Record | Insert

MenuRecordLast	SmallInt	Record | Last

MenuRecordLocateNext	SmallInt	Record | Locate Next

MenuRecordLocateRecordNumber	SmallInt	Record | Locate | Record Number

MenuRecordLocateSearchAndReplace	SmallInt	Record | Locate | and Replace

MenuRecordLocateValue	SmallInt	Record | Locate | Value

MenuRecordLock	SmallInt	Record | Lock

MenuRecordLookup	SmallInt	Record | Lookup Help

MenuRecordMove	SmallInt	Record | Move Help

MenuRecordNext	SmallInt	Record | Next

MenuRecordPost	SmallInt	Record | Post/Keep Locked

MenuRecordPrevious	SmallInt	Record | Previous

MenuReportNew	SmallInt	File | New | Report

MenuReportOpen	SmallInt	File | Open | Report

MenuSave	SmallInt	File | Save

MenuScriptNew	SmallInt	File | New | Script

MenuScriptOpen	SmallInt	File | Open | Script

MenuSearchText	SmallInt	Edit | Search Text

MenuSelectAll	SmallInt	Edit | Select All

MenuTableNew	SmallInt	File | New | Table

MenuTableOpen	SmallInt	File | Open | Table

MenuWindowArrangeIcons	SmallInt	Window | Arrange Icons

MenuWindowCascade	SmallInt	Window | Cascade

MenuWindowCloseAll	SmallInt	Window | Close All

MenuWindowTile	SmallInt	Window | Tile


MenuReasons

Constant	Data type	Description

MenuControl	SmallInt	Triggered by choosing an item from the control menu.

MenuDesktop	SmallInt	Triggered by choosing an item from a built-in Paradox menu.

MenuNormal	SmallInt	Triggered by choosing an item from a custom ObjectPAL menu or by clicking a Toolbar button.


MouseShapes

Constant	Data type	Description

MouseArrow	LongInt	Standard pointer arrow.

MouseCross	LongInt	Pointer is a cross.

MouseIBeam	LongInt	Pointer is an I-beam (text insertion cursor).

MouseUpArrow	LongInt	Pointer is an arrow pointing up.

MouseWait	LongInt	Pointer is an hourglass.


MoveReasons

Constant	Data type	Description

PalMove	SmallInt	Caused by an ObjectPAL statement.

RefreshMove	SmallInt	Caused when data is updated, for example, by scrolling through a table.

ShutDownMove	SmallInt	Caused when the form closes.

StartupMove	SmallInt	Caused when the form opens.

UserMove	SmallInt	Caused by the user.


PageTilingOptions
PageTilingOptions	5.0

Constant	Data type	Description

StackPages	SmallInt	Pages are "stacked" one on top of the other.

TileHorizontal	SmallInt	Pages are tiled horizontally.

TileVertical	SmallInt	Pages are tiled vertically.


PatternStyles

Constant	Data type

BricksPattern	SmallInt

CrosshatchPattern	SmallInt

DiagonalCrosshatchPattern	SmallInt

DottedLinePattern	SmallInt

EmptyPattern	SmallInt

FuzzyStripesDownPattern	SmallInt

HeavyDotPattern	SmallInt

HorizontalLinesPattern	SmallInt

LatticePattern	SmallInt

LeftDiagonalLinesPattern	SmallInt

LightDotPattern	SmallInt

MaximumDotPattern	SmallInt

MediumDotPattern	SmallInt

RightDiagonalLinesPattern	SmallInt

ScalesPattern	SmallInt

StaggeredDashPattern	SmallInt

ThickHorizontalLinesPattern	SmallInt

ThickStripesDownPattern	SmallInt

ThickStripesUpPattern	SmallInt

ThickVerticalLinesPattern	SmallInt

VerticalLinesPattern	SmallInt

VeryHeavyDotPattern	SmallInt

WeavePattern	SmallInt

ZigZagPattern	SmallInt


PrintColor
PrintColor	(5.0)

Constant	Data type	Description

prnPrintColor	LongInt	Print in color (color printers only).

prnPrintMonochrome	LongInt	Print in monchrome.


PrintDuplex
PrintDuplex	(5.0)

Constant	Data type	Description

prnHorizontal	LongInt	Double-sided printing where the left and right edges of consecutive pages can be bound. Also called "bind on edge" printing.

prnSimplex	LongInt	Single-sided printing.

prnVertical	LongInt	Double-sided printing where the top and bottom edges of consecutive pages can be bound. Also called "bind on top" printing.


PrinterOrientation
PrinterOrientation	(5.0)

Constant	Data type	Description

prnLandscape	LongInt	Landscape (long) orientation.

prnPortrait	LongInt	Portrait (tall) orientation.


PrinterSizes
PrinterSizes	(5.0)

Constant	Data type	Description

prn10x14	LongInt	10 by 14 inches.

prn11x17	LongInt	11 by 17 inches.

prnA3	LongInt	A3 297 x 420 mm.

prnA4	LongInt	A4 210 x 297 mm.

prnA4Small	LongInt	A4 Small 210 x 297 mm.

prnA5	LongInt	A5 148 x 210 mm.

prnB4	LongInt	B4 250 x 354.

prnB5	LongInt	B5 182 x 257 mm.

prnCSheet	LongInt	C size sheet.

prnDSheet	LongInt	D size sheet.

prnEnv9	LongInt	Envelope #9 3 7/8 x 8 7/8 inches.

prnEnv10	LongInt	Envelope #10 4 1/8 x 9 1/2 inches.

prnEnv11	LongInt	Envelope #11 4 1/2 x 10 3/8 inches.

prnEnv12	LongInt	Envelope #12 4 \276 x 11 inches.

prnEnv14	LongInt	Envelope #14 5 x 11 1/2 inches.

prnEnvB4	LongInt	Envelope B4  250 x 353 mm.

prnEnvB5	LongInt	Envelope B5  176 x 250 mm.

prnEnvB6	LongInt	Envelope B6  176 x 125 mm.

prnEnvC3	LongInt	Envelope C3  324 x 458 mm.

prnEnvC4	LongInt	Envelope C4  229 x 324 mm.

prnEnvC5	LongInt	Envelope C5 162 x 229 mm.

prnEnvC6	LongInt	Envelope C6 114 x 162 mm.

prnEnvC65	LongInt	Envelope C65 114 x 229 mm.

prnEnvDL	LongInt	Envelope DL 110 x 220mm.

prnEnvItaly	LongInt	Envelope 110 x 230 mm.

prnEnvMonarch	LongInt	Envelope Monarch 3.875 x 7.5 inches.

prnEnvPersonal	LongInt	6 3/4 Envelope 3 5/8 x 6 1/2 inches.

prnESheet	LongInt	E size sheet.

prnExecutive	LongInt	Executive 7 1/4 x 10 1/2 inches.

prnFanfoldLegalGerman	LongInt	German Legal Fanfold 8 1/2 x 13 inches.

prnFanfoldStandardGerman	LongInt	German Std Fanfold 8 1/2 x 12 inches.

prnFanfoldUS	LongInt	US Std Fanfold 14 7/8 x 11 inches.

prnFolio	LongInt	Folio 8 1/2 x 13 inches.

prnLedger	LongInt	Ledger 17 x 11 inches.

prnLegal	LongInt	Legal 8 1/2 x 14 inches.

prnLetter	LongInt	Letter 8 1/2 x 11 inches.

prnLetterSmall	LongInt	Letter Small 8 1/2 x 11 inches.

prnNote	LongInt	Note 8 1/2 x 11 inches.

prnQuarto	LongInt	Quarto 215 x 275 mm.

prnStatement	LongInt	Statement 5 1/2 x 8 1/2 inches.

prnTabloid	LongInt	Tabloid 11 x 17 inches.


PrintQuality
PrintQuality	(5.0)

Constant	Data type	Description

prnDraft	LongInt	Draft quality (lowest quality, fastest print time).

prnHigh	LongInt	High quality (highest quality, slowest print time).

prnLow	LongInt	Low quality.

prnMedium	LongInt	Meduim quality.


PrintSources
PrintSources	(5.0)

Constant	Data type	Description

prnauto	LongInt	Paper source selected automatically.

prnCassette	LongInt	Cassette.

prnEnvelope	LongInt	Envelope, automatic feed.

prnEnvManual	LongInt	Envelope, manual feed.

prnLargeCapacity	LongInt	Large capacity paper source.

prnLargeFmt	LongInt	Large format paper source.

prnLower	LongInt	Lower paper tray.

prnManual	LongInt	Manual feed.

prnMiddle	LongInt	Middle paper tray.

prnOnlyOne	LongInt	Single paper tray.

prnSmallFmt	LongInt	Small format paper source.

prnTractor	LongInt	Tractor feed paper.

prnUpper	LongInt	Upper paper tray.


QueryRestartOptions

Constant	Data type	Description

QueryDefault	SmallInt	Use the options specified interactively using the Query Restart Options dialog box.

QueryLock	SmallInt	Lock all other users out of the tables needed while the query is running. If Paradox cannot lock a table, it does not run the query. This is the least polite to other users. And you must wait until all the locks can be secured before the query will run.

QueryNoLock	SmallInt	Run the query even if someone changes the data while it's running.

QueryRestart	SmallInt	Start the query over. Specify QueryRestart when you want to make sure you get a snapshot of the data as it existed at some instant. Another user might change the data after the query is completed but before the Answer table is displayed, but at least you got a snapshot. This is just the nature of multi-user work.


RasterOperations

Constant	Data type	Description

MergePaint	LongInt	Inverts the source graphic and combines it with the destination using the Boolean OR operator.

NotSourceCopy	LongInt	Inverts the source graphic and copies it to the destination.

NotSourceErase	LongInt	Combines the source graphic and the destination and inverts the result using the Boolean OR operator.

SourceAnd	LongInt	Combines the source graphic and the destination using the Boolean AND operator.

SourceCopy	LongInt	Copies an unchaged source graphic to the destination.

SourceErase	LongInt	Inverts the destination and combines it with the source graphic using the Boolean AND operator.

SourceInvert	LongInt	Combines the source graphic and the destination using the Boolean XOR operator.

SourcePaint	LongInt	Combines the source graphic and the destination using the Boolean OR operator.


ReportOrientation

Constant	Data type	Description

PrintDefault	SmallInt	Use the current Windows default orientation.

PrintLandscape	SmallInt	Use landscape (long) orientation.

PrintPortrait	SmallInt	Use portrait (tall) orientation.


ReportPrintPanel

Constant	Data type	Description

PrintClipToWidth	SmallInt	Clips (trims) all data that does not fit across the page (within the margins).

PrintHorizontalPanel	SmallInt	Prints additional pages as needed to fit all the data. Each of these pages immediately follows the page it extends.

PrintOverflowPages 	SmallInt	Same as PrintHorizontalPanel.

PrintVerticalPanel 	SmallInt	Creates a secondary page for each page of the report, even if it doesn't overflow.


ReportPrintRestart

Constant	Data type	Description

PrintFromCopy	SmallInt	Prints the report from copies of the tables in the report's data model.

PrintLock	SmallInt	Locks tables in the report's data model before printing.

PrintNoLock	SmallInt	Prints without locking tables in the report's table model.

PrintRestart	SmallInt	Restarts print job when data changes in tables in the report's data model.

PrintReturn	SmallInt	Cancel the print job when data changes in tables in the report's data model.


SpecialFieldTypes
SpecialFieldTypes	5.0

Constant	Data type	Description

DateField	SmallInt	Displays the current system date.

NofFieldsField	SmallInt	Displays the number of fields in the current table.

NofPagesField	SmallInt	Displays the number of pages in the current form or report.

NofRecsField	SmallInt	Displays the number of records in the current table.

PageNumField	SmallInt	Displays the current page number.

RecordNoField	SmallInt	Displays the current record number.

TableNameField	SmallInt	Displays the name of the current table.

TimeField	SmallInt	Displays the current system time.


StatusReasons

Constant	Data type	Description

ModeWindow1	SmallInt	The status bar area second from the left.

ModeWindow2	SmallInt	The status bar area third from the left.

ModeWindow3	SmallInt	The rightmost status bar area.

StatusWindow	SmallInt	The leftmost (and largest) status bar area.


TableFrameStyles

Constant	Data type	Description

tf3D	SmallInt	Table frame has a 3D frame.

tfDoubleLine	SmallInt	Table frame has a double-box frame.

tfNoGrid	SmallInt	Table frame has no grid.

tfSingleLine	SmallInt	Table frame has a box frame.

tfTripleLine	SmallInt	Table frame has a triple-box frame.


TextAlignment

Constant	Data type	Description

TextAlignBotton	SamllInt	Bottom of text is aligned (table window only)

TextAlignCenter	SmallInt	Text is centered horizontally.

TextAlignJustify	SmallInt	Text is justified right and left (does not apply to table window).

TextAlignLeft	SmallInt	Text is left-justified.

TextAlignRight	SmallInt	Text is right-justified.

TextAlignTop	SmallInt	Top of text is aligned (table window only)

TextAlignVCenter	SmallInt	Text is centered vertically (table window only).


TextDesignSizing

Constant	Data type	Description

TextFixedSized	SmallInt	Text box does not change size.

TextGrowOnly	SmallInt	Text box grows to accommodate text.

TextSizeToFit	SmallInt	Text box grows or shrinks as necessary to accommodate text.


TextSpacing

Constant	Data type	Description

TextDoubleSpacing	SmallInt	2 lines.

TextDoubleSpacing2	SmallInt	2.5 lines.

TextSingleSpacing	SmallInt	1 line.

TextSingleSpacing2	SmallInt	1.5 lines.

TextTripleSpacing	SmallInt	3 lines.


UIObjectTypes

Constant	Data type	Description

BandTool (5.0)	SmallInt	Creates a report band.

BoxTool	SmallInt	Creates a box.

ButtonTool	SmallInt	Creates a button.

ChartTool	SmallInt	Creates a graph.

EllipseTool	SmallInt	Creates an ellipse.

FieldTool	SmallInt	Creates a field.

GraphicTool	SmallInt	Creates a graphic object.

LineTool	SmallInt	Creates a line.

OleTool	SmallInt	Creates an OLE object.

PageBrkTool (5.0)	SmallInt	Creates a page break in a report.

RecordTool	SmallInt	Creates a record.

TableFrameTool	SmallInt	Creates a table frame.

TextTool	SmallInt	Creates a text box.

XtabTool	SmallInt	Creates a crosstab object.


UpdateLink
UpdateLink	5.0

Constant	Data type	Description

OLEUpdateManual	SmallInt	Specifies manual updates to an OLE object. Changes in the underlying object are not automatically reflected in the Paradox table.

OLEUpdateAutomatic	SmallInt	Specifies automatic updates to an OLE object. Changes in the underlying object are automatically reflected in the Paradox table.


ValueReasons

Constant	Data type	Description

EditValue	SmallInt	The built-in newValue method of a radio button field, list, or drop-down edit list has been triggered (for example, by poking a radio button or choosing a list item), but the field value has not been committed (for example, by moving off the field).

FieldValue	SmallInt	A field's built-in newValue method has been triggered, and the value has been committed.

StartupValue	SmallInt	A field's built-in newValue method has been triggered because the form has opened.


WindowStyles

Constant	Data type	Description

WinDefaultCoordinate	LongInt	Displays a window at its default size and position.

WinStyleBorder	LongInt	Specifies a sizing border.

WinStyleControlMenu	LongInt	Specifies a system-control menu.

WinStyleDefault	LongInt	Specifies default displays attributes.

WinStyleDialog	LongInt	Specifies dialog box attributes.

WinStyleDialogFrame	LongInt	Specifies a dialog box frame.

WinStyleHScroll	LongInt	Specifies a horizontal scroll bar.

WinStyleHidden	LongInt	Makes a window invisible.

WinStyleMaximize	LongInt	Displays a window at full size.

WinStyleMaximizeButton	LongInt	Specifies a miximize button.

WinStyleMinimize	LongInt	Displays a window as an icon (minimized).

WinStyleMinimizeButton	LongInt	Specifies a minimize button.

WinStyleModal	LongInt	Makes a window modal.

WinStyleThickFrame	LongInt	Specifies a thick frame.

WinStyleTitleBar	LongInt	Specifies a title bar.

WinStyleVScroll	LongInt	Specifies a vertical scroll bar.


Basic Language Elements

See Also

Basic language elements are the fundamental structural elements of ObjectPAL. Most of these elements are not bound to specific object types; they work for all object types. You can use these elements to assign values, call functions from DLLs, build control structures like if...then...else...endIf loops, while...endWhile loops, and switch...case...endSwitch structures. You can also declare methods, procedures, constants, variables, and data types.

Here are the basic language elements:

= (assignment)	passEvent

const	proc

disableDefault	quitLoop

doDefault	return

enableDefault	scan

for	switch

forEach	try

if	type

iif	uses

loop	var

method	while


See Also for Basic Language Elements
See Also

Built-in Object Variables

Keywords


= (equals)
=

See Also	Example	Basic Language Elements

Keyword

Syntax

itemSpec = expression

Description

The = statement assigns the value of expression to itemSpec. Any previous value stored in itemSpec is lost. When assigning a value to an object, information in itemSpec can include the containership path.

In a statement containing more than one = statement, the first = does the assignment, all others compare two values or expressions.

When you use = with UIObjects, you assign the value of one UIObject to another UIObject. For example, suppose a form contains two fields, fieldOne and fieldTwo. The following statement copies the value of fieldTwo into fieldOne.

fieldOne = fieldTwo ; fieldOne gets the value of fieldTwo

You can also use = with UIObject variables. ObjectPAL uses attach the way C and Pascal use pointers. For example,

var ui UIObject endVar
ui.attach(fieldOne) ; tells ui to "point to" fieldOne
ui.view() ; displays the value of ui (same as fieldOne) in a dialog box.
ui = fieldTwo ; ui gets the value of fieldTwo (fieldOne value changes, too)
ui.view() ; displays the value of ui (same as fieldTwo) in a dialog box
ui.color = Red ; sets the color of ui and therefore of fieldOne to red

The following statement assigns to ui everything ObjectPAL knows about fieldOne:

ui.attach(fieldOne)

In contrast, the following statement assigns to ui (and to fieldOne) only the value of fieldTwo:

ui = fieldTwo


Example for = (assignment)
= Example

var
   x AnyType
   ar Array[5] AnyType
   w Logical
   y, z SmallInt
   fred, sam UIObject
endVar
x = 5.14                ; x gets a value of 5.14 (the data type is Number)
ar[1] = "Hello"         ; element 1 of ar gets the value of "Hello" (String)
y = 5                   ; y gets the value of 5
z = 12                  ; z gets the value of 12
x ="foo"                ; x gets a new value: the String "foo"
myTable.myField = y + z ; the field myField gets the value of y + z
amountField = tempAmountField
bigBox.bigCircle.smallBox.smallCircle.color = Blue
; the color property of smallCircle gets the value of Blue
; the first = assigns a value, all others compare
w = (y = z) ; w gets a value of True if y = z,
            ; otherwise, w gets a value of False
fred.attach(fieldOne) ; makes fred a "pointer" to fieldOne
sam = fred ; assigns the value of fred to sam


See Also for = (assignment)
See Also

Containers

Properties

Variables


const

See Also	Example	Basic Language Elements

Keyword

Declares constants.

Syntax

const

constName = { dataType ( value ) | value }

endConst

Description

const declares one or more constant values, where dataType, if included, specifies the data type of the constant. If dataType is omitted, the data type is inferred from value as either a LongInt, a Number, a SmallInt, or a String.


Example for const
const Example

const
   a = -1000                         ; SmallInt, inferred
   x = 123.45                        ; Number, inferred
   newYear = Date ("01/01/99")       ; Date, assigned
   companyName = String ("Borland")  ; String, assigned
endconst


See Also for const
See Also

var


disableDefault

See Also	Example	Basic Language Elements

Keyword

Disables the default code for a built-in method.

Syntax

disableDefault

Description

disableDefault prevents an event's built-in code from executing for the current call to a built-in method. Normally, the built-in code executes implicitly at the end of a method, just before the endMethod keyword. Using disableDefault in a method disables the implicit call to the built-in code.


Example for disableDefault
disableDefault Example

The following example sets the value of a field to "hello" when the user types a character. The call to disableDefault prevents the built-in code from executing, so the character does not display in the field. The message statement displays the character in the status window.

method keyChar(var eventInfo KeyEvent)
   self.value = "hello"      ; hello appears in the field
   disableDefault            ; disable the built-in code
   message(eventInfo.char()) ; displays the character in the status window
endMethod


See Also for disableDefault
See Also

doDefault

enableDefault

passEvent


doDefault

See Also	Example1	Example2	Basic Language Elements

Keyword

Executes the default code for a built-in method.

Syntax

doDefault

Description

doDefault executes the built-in code for an event immediately, instead of at the end of the method. Using doDefault in a method disables the implicit call to the built-in code. If a method contains more than one doDefault statement, only the first one executes; others are ignored.

As a general rule, if you attach code to an object's built-in open method, you should call doDefault before calling any other method or procedure. The call to doDefault executes the built-in code so you can be sure the object is completely opened and initialized.


Example 1 for doDefault
doDefault Example 1

The following example demonstrates the effect of a call to doDefault. In the following method, the button pushes in, waits two seconds, then the system beeps and the button pops out. The built-in code is called implicitly, just before the endMethod statement:

method pushButton(var eventInfo Event)
   sleep(2000)
   beep()
endMethod

In the following method, the call to doDefault makes the button pop out before it sleeps and beeps, and it disables the implicit code at the end of the method:

method pushButton(var eventInfo Event)
   doDefault
   sleep(2000)
   beep()
endMethod


Example 2 for doDefault
doDefault Example 2

The following example shows how to call doDefault when you attach code to an object's built-in open method. The following code is attached to the built-in open method of an unbound field object named greetingFld. The code calls doDefault to execute the built-in code, then sets the value of the field object.

greetingFld::open
method open(var eventInfo Event)
doDefault
self.Value = "Hello " + getNetUserName()
endMethod


See Also for doDefault
See Also

disableDefault

enableDefault

passEvent


enableDefault

See Also	Example	Basic Language Elements

Keyword

Enables the default code for a built-in method.

Syntax

enableDefault

Description

enableDefault allows the built-in code to execute normally at the end of a method, just before the endMethod statement. Compare enableDefault to doDefault, which executes the built-in code immediately.


Example for enableDefault
enableDefault Example

method menuAction(var eventInfo MenuEvent)

var theChoice String endVar
disableDefault
theChoice = eventInfo.menuChoice()
switch
   case theChoice = "Open" : doOpen()
   case theChoice = "Quit" : doQuit()
   otherwise               : enableDefault
endSwitch
endMethod


See Also for enableDefault
See Also

disableDefault

doDefault

passEvent


for

See Also	Example	Basic Language Elements

Keyword

Executes a sequence of statements a specified number of times.

Syntax

for counter [ from startVal  [ to endVal ] [ step stepVal ]

   Statements

endFor

Description

for executes a sequence of Statements as many times as is specified by a counter, which is stored in counter and controlled by the optional from, to, and step keywords. Any combination of these can be used to specify the number of times the statements in the loop are executed. You don't have to declare counter explicitly, but a for loop runs faster if you do.

The arguments startVal, endVal, and stepVal are values or expressions representing the beginning counter value, ending counter value, and the number by which to increment the counter each time through the loop. These values can be any data type represented by AnyType, except Point, Memo, Graphic, String, OLE, and Binary. Also, counter must be a literal value or a single-valued variable; it can't be an array element or record field value.

You can use for without the from, to, and step keywords:

If startVal is omitted, the counter starts at the current value of counter.

If endVal is omitted, the for loop executes indefinitely.

If stepVal is omitted, the counter increments by 1 each time through the loop.

startVal, endVal, and stepVal are stored in a temporary buffer; they are not evaluated each time through the loop.

If quitLoop is used within the body of statements in the for loop, the for ...endFor loop is exited. If loop is used within the body of statements, statements following loop are skipped, the counter is incremented, and iteration continues from the top of the for loop.

If step is positive and a to clause is present, iteration continues as long as the value of counter is less than or equal to the value of endVal. If step is negative, iteration will continue as long as the value of counter is greater than or equal to the value of endVal. In either case, once the value of counter reaches or exceeds the limit set by step, the for loop stops executing, but counter keeps its value, as shown in the example.

If counter has not previously been assigned a value, from creates the variable and assigns to it the value of startVal.


Example for for
for Example

Following is a simple for loop. Notice the value of the counter variable i after the for loop is completed:

var i SmallInt endVar
for i from 1 to 3
   i.view("Inside for loop") ; i = 1, i = 2, i = 3
endFor
i.view("Outside for loop")   ; i = 4


See Also for for
See Also

loop

quitLoop

while


forEach

See Also	Example	Basic Language Elements

Keyword

Repeats the specified statement sequence over elements within a DynArray.

Syntax

forEach VarName in DynArrayName

   Statements

endForEach

Description

forEach steps through the elements in a DynArray. The argument VarName is a String variable used as a placeholder for the DynArray indexes. The arguemnt DynArrayName is a DynArray variable that identifies the DynArray to step through. If DynArrayName does not exist, the forEach statement causes an error when the method is compiled. The Statements clause represents one or more ObjectPAL statements to execute for each index in the DynArray.

In general, you cannot use the for statement to step through a DynArray because the indexes of a DynArray are not necessarily integers. Because DynArray indexes are not integers, DynArray elements are not ordered sequentially. The forEach statement operates on DynArray elements in an arbitrary order. You should not rely on a specific ordering of indexes.

If the quitLoop statement is used within the body of statements in the forEach loop, the forEach...endForEach loop is exited. If the loop statement is used within the body of Statements, the statements following loop are skipped and iteration continues from the top of the forEach loop.

Do not call removeItem or empty to modify a DynArray in a forEach loop.


Example for forEach
forEach Example

The following example uses the forEach statement to display the elements in the DynArray created by the sysInfo statement:

var
   SystemArray DynArray[] AnyType
   Element AnyType
endVar
sysInfo(SystemArray)
forEach Element IN SystemArray
   message(Element, " : ", SystemArray[Element])
   sleep(1500)
endForEach


See Also for forEach
See Also

for

loop

quitLoop

while


if

See Also	Example	Basic Language Elements

Keyword

Executes one of two sequences of statements, depending on the value of a logical condition.

Syntax

if Condition then

Statements1

[ else

Statements2 ]

endIf

Description

When ObjectPAL comes to an if statement, it evaluates whether the Condition is true. If so, it executes the statements listed in Statements1 in sequence. If not, it skips Statements1 and, if the optional else keyword is present, executes the statements in Statements2. In either case, execution continues after the endIf keyword.

An if construction can span several lines, especially if there are many statements in Statements1 or Statements2. It is good practice to indent the then and else clauses to show the flow of control:

if Condition then
   Statements1
else
   Statements2
endIf
The following is an example of an if statement:
if Stock < 100 then
   AddStock()        ; execute a custom method called AddStock()
   Stock = Stock + 10 ; then, add 10 to the value of Stock
endIf

if statements can be nested; that is, any of the statements in Statements1 or Statements2 can also be if statements. Nested if statements must be fully contained within the controlling if structure, in other words, each nested if statement must have an endIf within the nest. Each if...endIf set must enclose code or code and another complete if...endIf set:

if Condition then
   if Condition then
      Condition
   endIf
endIf


Example for if
if Example

The following example provides code for a nested if statement:

if skillLevel = "Beginner" then
   if skillBox.color = "Red" or skillBox.color = "Yellow" then
      skillBox.color = "Green"
   endIf
endIf


See Also for if
See Also

for

iif

switch

while


iif

See Also	Example	Basic Language Elements

Keyword

Returns one of two values depending on the value of a logical condition.

Syntax

iif ( Condition, ValueIfTrue, ValueIfFalse )

Description

iif (immediate if) allows branching within a single statement. You can use iif anywhere you can use any other expression. iif is especially useful in calculated fields on forms or reports because if...endIf statements are illegal there.


Example for iif
iif Example

a = iif(x > 1, b, c) ; if x > 1, a = b; else a = c


See Also for iif
See Also

if


loop

See Also	Example	Basic Language Elements

Keyword

Passes control to the top of the nearest enclosing for, forEach, scan, or while loop.

Syntax

loop

Description

When executed within a for, forEach, scan, or while structure, loop skips the statements between it and the endFor, endForEach, endScan, or endWhile and returns to the beginning of the structure. Otherwise, loop causes an error.


Example for loop
loop Example

var x SmallInt endVar

for x from 1
   if x <> 5 then
      loop ; go back to for statement, get next value of x
      message("This never appears") ; this statement never executes
   else
      quitLoop                      ; break out of the loop
   endIf
endFor
message(x) ; displays 5


See Also for loop
See Also

for

forEach

quitLoop

scan

while


method

See Also	Example	Basic Language Elements

Keyword

Defines an ObjectPAL method.

Syntax

method Name ( parameterDesc [, parameterDesc ] * ] ) [ returnType ]

[ type section ]

[ const section ]

[ var section ]

Statements

endMethod

Description

method marks the beginning of a method. At a minimum, you must provide the following:

The method name, in Name

Parentheses, even if the method has no arguments

The Statements that comprise the method

The definition ends with the mandatory endMethod keyword.

Additionally, you can declare constants, data types, variables and procedures before the method keyword, and you can declare variables and constants after method.

Also optional are one or more parameter descriptions (up to a maximum of 29), represented in the prototype by parameterDesc, where each description takes the form

[var | const] parameter type

The optional returnType declares the data type of the value returned by the method. returnType is optional because a method may or may not return a value. However, if the method returns a value, you must specify the data type of the value.

Methods and procedures are similar. The key differences are:

Methods are visible and exportable to other objects, while procedures are private within a containership hierarchy.

A method can contain a procedure definition, but a procedure can't contain a method definition.

Note:  The scope of a method depends on where it is declared.


Example for method
method Example

method pushButton (var eventInfo Event)
   var
      txt String
      myNum Number
   endVar
   myNum = 123.321
   txt = String(myNum)
   msgInfo("myNum = ", txt)
endMethod


See Also for method
See Also

proc


passEvent

See Also	Example	Basic Language Elements

Keyword

Passes the event to the object's container.

Syntax

passEvent

Description

passEvent passes the event packet to the object's container. Using passEvent in a method does not affect the implicit call to the built-in code.


Example for passEvent
passEvent Example

The code in the following example is attached to a field object. It executes when the pointer is in the field object. If Shift is held down when the mouse is pressed, the code calls disableDefault to prevent the built-in code from executing and calls passEvent to send the event to the field object's container. This technique is useful when you want several objects to respond the same way to a given event.

method mouseDown(var eventInfo MouseEvent)
   if eventInfo.isShiftKeyDown() then
      disableDefault
      passEvent ; let container handle it
   endIf
endMethod


See Also for passEvent
See Also

disableDefault

doDefault

enableDefault


proc

See Also	Example	Basic Language Elements

Keyword

Defines an ObjectPAL procedure.

Syntax

proc ProcName ( [ parameterDesc [, parameterDesc ] * ] ) [ returnType ]

[ const section ]

[ type section ]

[ var section ]

Statements

endProc

Description

proc begins the definition of a procedure. You provide the following:

The procedure name, in ProcName

Parentheses, even if the procedure has no arguments

Zero or more parameter descriptions (up to a maximum of 29), represented in the prototype by parameterDesc, where each description takes the form

[var | const] parameter type

Use returnType to declare the data type of the value returned by the procedure (if it returns a value)

Sections to declare variables, constants, and types

The Statements that comprise the procedure

The definition ends with the mandatory endProc keyword.

You can use return in the body of a procedure to return a value to the calling method or procedure.

A procedure used in an expression must return a value, such as

x = NumValidRecs("Orders")   ; NumValidRecs is a procedure

Procedures and methods are similar. The key differences are:

Methods are visible and exportable to other objects, while procedures are private within a containership hierarchy.

A method can contain a procedure definition, but a procedure can't contain a method definition.

Note:  The scope of a procedure depends on where it is declared.


Example for proc
proc Example

proc inc (x SmallInt) SmallInt
   return x + 1
endProc
method pushButton(var eventInfo Event)
   var x SmallInt endVar
   x = 5
   x = inc(x) ; calls the procedure
   message(x) ; displays 6
endMethod


See Also for proc
See Also

method


quitLoop

See Also	Example	Basic Language Elements

Keyword

Terminates the for, forEach, scan, or while loop in which it appears.

Syntax

quitLoop

Description

quitLoop exits immediately from the closest enclosing for, forEach, scan, or while loop. The method continues with the statement following the closest endFor, endForEach, endScan, or endWhile.

quitLoop causes an error if executed outside of any for, scan, or while structure.


Example for quitLoop
quitLoop Example

In the following example, quitLoop is used in a for loop that determines whether an array has any unassigned elements:

var
   myArray Array[12]
   notAssigned Logical
endVar
notAssigned = False
for i from 1 to myArray.length()
   if not isAssigned(myArray[i]) then
      notAssigned = True
      quitLoop
   endIf
endFor


See Also for quitLoop
See Also

loop

return


return

See Also	Example	Basic Language Elements

Keyword

Returns control from a method or procedure, optionally passing back a value.

Syntax

return [ Expression ]

Description

return is used to return control from the current procedure or method to the procedure or method that called it, whether or not the method or procedure is declared to return a value. The following apply to return:

If return is executed within the body of a procedure, the procedure is exited.

If return is executed within a method (but outside the body of a procedure), the method is exited.

You can optionally return the value of Expression when returning from either a procedure or a method. If a procedure is called in an expression, then the procedure must return a value, which becomes the value of the procedure call.

y = myProc(x) + 3      ; myProc is a procedure

If a procedure is called in a standalone context, then any returned value is ignored. For example:

myProc(x)

If no Expression is supplied, return must not be followed by anything else on the line other than a comment.

The following data types cannot be returned: DDE, Database, Query, Session, Table, or TCursor.

It is not necessary to use return to pass control back to a higher-level method or procedure, since this happens automatically when a lower-level method or procedure finishes. However, if the method or procedure is declared to return a value, you must use return to return the value; the value won't be returned automatically.


Example for return
return Example

Following is a simple example that adds 1 to the value of a variable and returns the new value to the calling method:

proc addOne (x SmallInt) SmallInt
   return x + 1
endProc

In a built-in method, a return statement executes the built-in code unless you explicitly disable it. For example, the following code calls return when the user types a "?" into a field object. The call to disableDefault prevents the built-in code from displaying the "?" in the field object.

method keyChar(var eventInfo KeyEvent)
   if eventInfo.char() = "?" then
      disableDefault
      return
   endIf
endMethod


See Also for return
See Also

quitLoop


scan

See Also	Example	Basic Language Elements

Keyword

Scans the TCursor and executes ObjectPAL instructions.

Syntax

scan tcVar [ for booleanExpression ] :

Statements

endScan

The colon is required, even if you omit the for keyword.

Description

scan scans tcVar (TCursor) and executes Statements (ObjectPAL instructions) for each record. scan always begins at the first record of the table, and steps through each record in sequence. When statements in the scan loop change an indexed field, that record moves to its sorted position in the table, so it's possible to encounter the same record more than once in the same loop.

If you supply the for clause, Statements execute only for those records that satisfy the condition; all others are skipped. If the table is empty or if no records meet the condition, the scan has no effect.

Note:	The colon is required, even if you omit the for keyword.

scan is extremely powerful in that you can first prototype a statement sequence for a single record of a table, then place that sequence inside a scan loop to make it work on an entire table.

You can use loop, return, and quitLoop in the body of the scan. loop skips the remaining statements between it and endScan, moves to the next record, and returns to the top of the scan loop. quitLoop terminates the scan altogether, leaving the record being scanned as the current record.

Since scan repeats an entire statement sequence for each record, don't include actions that only need to be performed once for the table. Put those statements outside the scan loop. scan automatically moves from record to record through the table, so there's no need to call nextRecord.


Example for scan
scan Example

The following example uses a scan loop to update the Employee table. It scans the Dept field of each record, and if the value is "Personnel", changes it to "Human Resources".

var
    empTC TCursor
endVar

empTC.open("employee.db") ; These statements need only be executed once,
empTC.edit()              ; so they're placed outside the loop.

scan empTC for empTC.Dept = "Personnel":  ; the colon is required
   empTC.Dept = "Human Resources"
endScan

empTC.endEdit()
empTC.close()


See Also for scan
See Also

if

for

while


switch

See Also	Example	Basic Language Elements

Keyword

Executes one of a set of alternative statement sequences, depending on which of several conditions is met.

Syntax

switch

CaseList

[ otherWise: Statements ]

endSwitch

CaseList is any number of statements in the following form:

case Condition : Statements

Description

switch uses the values of the Condition statements in CaseList to determine which sequence of Statements should be executed, if any. switch works like multiple if statements, and each CaseList works like a single if statement.

The case Conditions are evaluated in the order in which they appear:

If one has a value of True, the corresponding Statements sequence is executed and the rest are skipped.

If none has the value True, and the optional otherWise clause is present, the Statements in otherWise are executed.

If none has the value True and no otherWise clause is present, switch has no effect.

Thus, one set of Statements is executed at most. The method resumes with the next statement after endSwitch.


Example for switch
switch Example

The following example creates an array of 100 random numbers, then uses the bubble sort algorithm to sort them in numerical order:

method pushButton(var eventInfo Event)
var
   sz, i , itmp, j,k SmallInt
   a Array[100] SmallInt
   tmp Number
endVar

   sz = 100
   a.fill(0)

for i from 1 to sz step 1
   tmp = Rand()
   switch
         case tmp < .1 : a[i] = 1
         case tmp < .2 : a[i] = 2
         case tmp < .3 : a[i] = 3
         case tmp < .4 : a[i] = 4
         case tmp < .5 : a[i] = 5
         case tmp < .6 : a[i] = 6
         case tmp < .7 : a[i] = 7
         case tmp < .8 : a[i] = 8
         case tmp < .9 : a[i] = 9
         otherwise:      a[i] = 10
   endSwitch
endFor

for i from 1 to sz-1 step 1
   for j from 1 to sz-i step 1
      if a[j] <> a[j+1] then
         a.exchange(j, j+1)
      endIf
   endFor
endFor

endMethod


See Also for switch
See Also

if

while


try

See Also	Example	Basic Language Elements

Keyword

Marks a block of statements to try, and specifies a response should an error occur.

Syntax

try

[ Statements ] ; the transaction block

onFail

[ Statements ] ; the recovery block

[ reTry ]         ; optional

EndTry

Description

The mechanism for building error recovery into an application is the try...onFail block.

The transaction block is a set of Statements, all of which you want to succeed. If the transaction succeeds, the program skips to endTry. If the transaction fails, the recovery block executes. You can call reTry to execute the transaction block again.

A trial is caused to fail by the program calling the System procedure fail at some point within the transaction block, or within procedures called by the transaction block. This stops system functions from returning status errors or null values to their callers.

A fail call can be nested in several procedure calls deep from where the block began. Their local variables are removed from the stack, and any special objects (such as large Text blocks) are deallocated. If reference objects (such as tables) are in use, they are closed, and any pending updates are canceled. It's as if the transaction had never started. What remains are changes to variables outside the block, or data added successfully to tables and committed before the failure occurred.

If during a recovery block you decide that the error code is not one you expected, or is more serious than can be handled at this level, call fail again to pass that error code. If no higher-level try...onFail block exists, the whole application fails, cancels existing actions, closes resources, and exits.

By default, a try...onFail block traps critical errors only. Use errorTrapOnWarnings if you want a try...onFail block to trap warnings, too. For more information about critical errors and warnings, refer to the Guide to ObjectPAL.


Example for try
try Example

The following example tries to set the Color property of some design objects, and uses a try...onFail block to handle the situation if the property cannot be set.

method pushButton(var eventInfo Event)
var s String endVar
box1.box2.color = Blue                     ; this works
s = "box5"                                 ; box5 doesn't exist

try
   box1.(s).color = Red                    ; try to set color of box5
onFail                                     ; handle the error
   msgStop("Error", "Couldn't find " + s)
   s = "box2"                              ; box2 exists
   reTry                                   ; try again
endTry

s = "box6"                                 ; box6 doesn't exist
try
   box1.(s).color = Green
onFail
   fail(peObjectNotFound, "The object " + s + "does not exist.")
endTry
endMethod


See Also for try
See Also

System::fail


type

See Also	Example	Basic Language Elements

Keyword

Declares data types.

Syntax

type

[ newTypeName = existingType ] *

endType

Description

Using type, you can define new data types (based on existing ObjectPAL types). Once defined, you can use these types to declare variables in methods.

For example, an application to track the number of parts in a warehouse might declare a type partQuantity, then declare a variable to be of type partQuantity, like this:

type
   partQuantity = SmallInt ; declare a new type
endType

var                  ; use the new type to declare a variable
   pQty partQuantity ; pQty is a SmallInt
endVar               ; because partQuantity is a SmallInt

Later, if the number of parts approaches 32,767 (the maximum value of a SmallInt), you need only change the type definition, for example,

type
   partQuantity = LongInt ; change the declaration
endType

var                  ; use the new type to declare a variable
   pQty partQuantity ; pQty is now a LongInt
endVar               ; because partQuantity is a LongInt


Example for type
type Example

A useful type is the record. Records defined in an object's type window have no connection to tables. Instead, they are similar to records in Pascal and STRUCTs in C, because they allow you to join several related elements of data together under one name. For example, the following code declares a record Employee that you can use to declare variables in methods and procedures:

type
   Employee = record
              LastName   String
              FirstName  String
              Title      String
              Salary     Currency
              DateHired  Date
              endRecord
endType


See Also for type
See Also

var


uses

See Also	Example1	Example2	Example3	Basic Language Elements

Keyword

Declares external library routines to use in a method or procedure.

Syntax

uses { libraryName | ObjectPAL }

routineName ( parameterList )

[ routineName ( parameterList ) ] *

endUses

Description

The uses block, declared in an object's Uses window, makes routines stored in external libraries available to ObjectPAL methods. The routines must fit one of the following descriptions:

Routines written in ObjectPAL and stored in an ObjectPAL library.

Routines written in ObjectPAL and attached to a form. The syntax for calling methods attached to a form is the same as for calling them from a library.

Routines written in assembly language, C, C++, or Pascal and stored in an ObjectPAL library or a Windows Dynamic-link library (DLL). A DLL is a library of executable code or data that you can link to your application at runtime. Using DLLs you can add features and functions without modifying your compiled ObjectPAL application.

A uses block for an ObjectPAL library differs slightly from a uses block for a DLL, so they're discussed separately.

uses block for an ObjectPAL library

To use methods stored in an ObjectPAL library or attached to a form, write a uses block in an object's Uses window. Here's the syntax:

uses ObjectPAL

   [ methodName ( [ var | const ] argList ) [ returnType ] ] *

endUses

The keyword ObjectPAL is required to indicate that you're calling methods from an ObjectPAL library or a form, rather than from a DLL.

You must open a library before calling a method from it; you must open and run a form before calling a method from it.

Next, methodName represents the name of the method to call, and argList represents a comma-separated list of argument/data type pairs, optionally preceded by the keywords var and const, as appropriate.

The optional argument returnType specifies the data type of the value (if any) returned by the method.

Within a single Uses window, you can declare more than one library method, and methods from more than one library.

Arguments and data types declared in the Uses window must be declared exactly as they are in the library. See the examples for more information.

uses block for a DLL

To use routines stored in a DLL, write a uses block in one of the following places:

A design object's Uses window

A window for a built-in method

A window for a custom method

A window for a custom procedure

Where you write the block depends on the desired scope (availability) of the routine.

No matter where you write it, the basic structure (shown in the following pseudocode) is the same:

uses libraryName

   routineName ( parameterList ) returnType

endUses

The argument libraryName specifies the DLL file name, where libraryName is a valid DOS filename of up to eight characters. Paradox assumes a file-name extension of .DLL or .EXE. Windows searches for the file in this order:

1. The current directory.

2. The Windows directory (the directory containing WIN.COM). You can use the FileSystem procedure windowsDir to get this information (typically, it's C:\WINDOWS).

3. The Windows system directory (the directory containing such system files as KERNEL.EXE). You can use the FileSystem procedure windowsSystemDir to get this information (typically, it's C:\WINDOWS\SYSTEM).

4. The directories listed in the PATH environment variable. Refer to your DOS documentation for more information.

5. The list of directories mapped in a network.

Note:	(to advanced Windows programmers): If you're calling a routine from a previously-loaded DLL (for example, a DLL loaded automatically by Windows), you can use libraryName to specify the DLL's module name instead of the filename. Consult your programming language's documentation for more information about DLL module names.

A uses block can contain one or more routineNames, and each routineName can have its own parameterList. A parameterList specifies one or more argument names and data types. If the routine returns a value, the returnType specifies the return value's data type. ObjectPAL checks your specifications for these arguments for exact matches with those declared in the routine; that's all the checking it does.

Declare a uses block in an object's Uses window, and within that window, declare one uses block for each library or DLL you want to use. You don't have to declare every routine the library or DLL contains, just the ones you want to use. Once declared, routines are available to all methods attached to that object, and to all objects that object contains.

In a uses block, declare data types using the following keywords:

Data type	ObjectPAL	C	Pascal

16-bit integer	CWORD	int	Integer

32-bit integer	CLONG	long	Longint

64-bit floating-point number	CDOUBLE	double	Double

80-bit floating-point number	CLONGDOUBLE	long double	Extended

pointer	CPTR	char far *	PChar

binary or graphic data	CHANDLE	Handle (Windows)	THandle (Windows)

These keywords are valid only within a uses block. Don't use them anywhere else. See the examples for more information.


Example 1 for uses
uses Example 1

The following example declares two library methods, buildMenu and calcInterest. buildMenu takes one argument, a String constant named pageName. calcInterest takes two arguments: a Number variable named intRate (passed by reference) and a SmallInt variable named nPeriods (passed by value).

uses ObjectPAL
   buildMenu(var pageName String)
   calcInterest(var intRate Number, nPeriods SmallInt) Number
endUses]

The following code, attached to a button's Uses window, declares the calcInterest method so the button can use it. Notice that you don't have to declare every method in a library, just the ones you want to use.

uses ObjectPAL
      calcInterest(var intRate Number, nPeriods SmallInt) Number
endUses

The following code, attached to a button's built-in pushButton method, opens the library and calls these methods.

method pushButton(var eventInfo Event)
   var
      mathLib Library
      intRate Number
      nPeriods SmallInt
      interest Number
   endVar

   if mathiLib.open("mathlib.lsl") then
      intRate = mortgage.intRate.value
      nPeriods = mortgage.nYears.value * 12
      interest = mathLib.calcInterest(intRate, nPeriods)
      interest.view("Interest")
   endIf
endMethod

In this example, dot notation specifies where to find the calcInterest method. The following statement says to look in the library represented by the Library variable mastLib.

interest = mathLib.calcInterest(intRate, nPeriods)

The concept for calling a method attached to another form is the same: use dot notation to specify the form to search for the method. The following assumes that the Form variable codeForm has been previously declared, the form has been opened, and the method getObjHelp has been declared in an appropriate Uses window.

interest = codeForm.getObjHelp(self.name)


Example 2 for uses
uses Example 2

To use a routine in a method, declare variables to use as arguments, then call the routine. For example,

; this goes in an object's Uses window
uses myStuff ; reads routines from MYSTUFF.DLL
   doSomething(thisNum CLONG, thatNum CLONG) CDOUBLE ; declare a routine
endUses

; this modifies an object's mouseUp method
method mouseUp(var eventInfo MouseEvent)
var
   thisNum, thatNum LongInt ; declare variables to pass to the routine
   myResult Number
endVar

thisNum = 3,155,111
thatNum = 5,535,345
myResult = doSomething(thisNum, thatNum) ; call the routine, return a result

In this example, arguments in the uses block are declared using CLONG and CDOUBLE, and variables in the method were declared using LongInt and Number. That's because ObjectPAL data types are more complex (and powerful) than corresponding data types in C or Pascal:

CWORD corresponds to SmallInt.

CLONG corresponds to LongInt.

CDOUBLE and CLONGDOUBLE correspond to Number.

CPTR corresponds to String.

CHANDLE corresponds to Binary and Graphic.

Note:	Do not modify the contents of a passed CPTR.


Example 3 for uses
uses Example 3

The following example uses routines from MINMAX.DLL, written using Borland's Pascal for Windows. The Pascal code for the DLL is:

{ this is the Pascal code that defines the DLL }
library MinMax;

function Min(X, Y: Integer): Integer; export;
begin
   if X < Y then Min := X else Min := Y;
end;

function Max(X, Y: Integer): Integer; export;
begin
   if X > Y then Max := X else Max := Y;
end;

exports
   Min index 1,
   Max index 2;

begin
end.

The following ObjectPAL code uses the routines in the DLL. The code for the Uses window appears first, followed by the code that modifies a button's pushButton method:

; the following goes in a button's Uses window
 uses MinMax ; load routines from MINMAX.DLL
   Min (x CWORD, y CWORD) CWORD ; declare the routines to use
   Max (x CWORD, y CWORD) CWORD
endUses

The following code modifies a button's built-in pushButton method:

method pushButton(var eventInfo Event)
   var
      x, y, z SmallInt
   endVar
   x = 2
   y = 6
   z = Min(x, y)          ; call Min from the DLL
   msgInfo("Min", z)
   z = Max(x, y)          ; call Max from the DLL
   msgInfo("Max", z)
endMethod


See Also for uses
See Also

Calling C Routines

Library Type

Notes on using graphic and binary data

Passing by pointer

Passing by value

Returning values


More about calling C routines
Calling C Routines

See Also	Example	uses

Windows uses the same calling convention used by Pascal. The Pascal calling convention entails the following:

Parameters are pushed onto the stack in the order in which they appear in the function call.

The code that restores the stack is part of the called function (rather than the calling function).

The Pascal calling convention differs from the calling convention used in C. In C, parameters are pushed onto the stack in reverse order, and the calling function is responsible for restoring the stack. When writing a DLL in a language that does not ordinarily use the Pascal calling convention, such as C, you must ensure that the Pascal calling convention is used for any function that is called by Windows. In C, this requires the use of the PASCAL keyword when the function is declared.

The examples in the following tables assume that these ObjectPAL variables have been declared:

si	SmallInt

li	LongInt

nu	Number

gr	Graphic

st	String

When passing a value to a C procedure, the ObjectPAL variable must be declared and typed explicitly. However, AnyType is not allowed.

Using C++

Linking C++ modules with C modules requires the use of a linkage specification. Prototypes for C functions within C++ modules must be in one of the following forms:

extern "C" declaration
extern "C" { declarations }

For example, if a C module contains these functions:

char *SCopy(char*, char*);
void ClearScreen(void)

they must be declared in a C++ module in one of the following ways:

extern "C" char *SCopy(char*, char*);
extern "C" void ClearScreen(void);

or

extern "C" {
char *SCopy(char*, char*);
void ClearScreen(void);
}

Failure to do so will result in "Undefined symbol" errors during link. For further examples, see the standard header files.

All C and C++ functions that you want ObjectPAL to call must be exported in the .DEF file.


Example for More about calling C routines
Calling C Routines Example

The following example shows how to use ObjectPAL to call a function from the Windows API. It calls the Windows API function MessageBox to display a dialog box.

The following code is attached to a button's Uses window.

Uses USER ; By default, the MesageBox function is in C:\WINDOWS\SYSTEM\USER.EXE
   MessageBox(hWnd CWORD, msgTxt CPTR, msgCaption CPTR, boxStyle CWORD) CWORD
endUses

The following code is attached to a button's built-in pushButton method. It calls MessageBox and passes it the text for the mesage and the caption.

method pushButton(var eventInfo event)
   MessageBox(0, "Your message here", "Your caption here", 0)
endMethod


See Also for More about calling C Routines
See Also

Notes on Using Graphic and Binary Data

Passing by Pointer

Passing by Value

Returning Values


Passing by Value

See Also	uses

The following table presents the syntaxes for passing various data types by value to a C procedure. ObjectPAL passes and returns floating point values by value, as required by the Borland C++ compiler. Other C compilers may have different requirements. To ensure compatibility, pass values by pointer.

C data type	C syntax	In USES block	ObjectPAL call

Long double	void pascal far _loadds cproc(long double value)	cproc(value 	cproc(si)

CLONGDOUBLE)	cproc(li)

cproc(nu)

Double	void pascal far _loadds cproc(double value)	cproc(value CDOUBLE)	cproc(si),

cproc(li)

cproc(nu)

Long int	void pascal far _loadds cproc(long int value)	cproc(value CLONG)	cproc(si)

cproc(li)

Int	void pascal far _loadd cproc(int value)	cproc(value CWORD)	cproc(si)

String	void pascal far _loadds cproc(char * value)	cproc(value CPTR)	cproc(st)

Graphic	void pascal far _loadds cproc(HANDLE value)	cproc(value CHANDLE)	cproc(gr)

Binary	void pascal far _loadds cproc(HANDLE value)	cproc(value CHANDLE)	cproc(gr)


See Also for Passing by value
See Also

Calling C Routines

Notes on Using Graphic and Binary Data

Passing by Pointer

Returning Values


Passing by Pointer

See Also	uses

To pass information if the C procedure takes pointers to information, the pointer points directly to the corresponding value in the ObjectPAL variable. For example, if you want an int* and you pass a SmallInt, you will get a pointer that points directly to the int inside the SmallInt variable. You will be able to modify the value of the SmallInt. This could be extremely dangerous for novice C programmers, since you can corrupt ObjectPAL by overwriting memory (writing past the bounds of the memory pointer).

Use pointers to

Change the information (this should be done by function return values if possible).

Pass floating point values to C procedures that were not compiled using the Borland C compiler. Different C compilers use different conventions for passing and returning floating point values (double and long double). The only way to pass compiler-independent information is by pointer.

The following table presents the syntaxes for passing various data types by pointer to a C procedure.

C data type	C syntax	In USES block	ObjectPAL call

LONG DOUBLE *	void pascal far _loadds cproc(long double * value)	cproc(value CPTR)	cproc(nu)

LONG INT *	void pascal far _loadds cproc(long int * value)	cproc(value CPTR)	cproc(li)

INT *	void pascal far _loadds cproc(int * value)	cproc(value CPTR)	cproc(si)

STRING *	void pascal far _loadds cproc(char * value)	cproc(value CPTR)	cproc(st)


See Also for Passing by pointer
See Also

Calling C Routines

Notes on Using Graphic and Binary Data

Passing by Value

Returning Values


Returning Values

See Also	uses

The following table presents the syntaxes for returning values of various data types from a C procedure.

C data type	C syntax	In USES block	ObjectPAL call

Long double	long double pascal far _loadds cproc(void)	cproc() CLONGDOUBLE	nu = cproc()

Double	double pascal far _loadds cproc(void)	cproc() CDOUBLE	nu = cproc()

Long int	long int pascal far _loadds cproc(void)	cproc() CLONG	nu = cproc()

li = cproc()

Int	long int pascal far _loadds cproc(void)	cproc() CWORD	nu = cproc()

li = cproc()

sm = cproc()

Char	char * pascal far _loadds cproc(void)	cproc() CPTR	st = cproc()


See Also for Returning values
See Also

Calling C Routines

Notes on Using Graphic and Binary Data

Passing by Pointer

Passing by Value


Notes on Graphic and Binary data (CHANDLE)

See Also	uses

Graphic and Binary data are passed via CHANDLE. In C terms this is a HANDLE typedef. A CHANDLE is a handle to Windows memory. To use it, include:

void pascal far _loadds cproc(HANDLE value)
{
   huge * ptr = (huge *) GlobalLock(value);
   // .... use ptr.
   // ...  do not use GlobalFree(value)
   GlobalUnlock(value)
}

For a Binary variable, HANDLE is a handle to memory that directly contains the information contained in the binary BLOB. There is no "header" information. You can read or modify the data, but you cannot change its size.

For a Graphic variable, HANDLE is Windows Bitmap.

Use this as you would any other bitmap HANDLE.


See Also for Returning values
See Also

Calling C Routines

Passing by Pointer

Passing by Value

Returning Values


var

See Also	Example	Basic Language Elements

Keyword

Declares variables.

Syntax

var

   [ varName [ , varName ] * varType ]*

endVar

Description

The var...endVar block declares variables by associating a variable name varName with a data type varType. When you declare more than one variable of the same type on the same line, use commas to separate the names.

Note:	A variable's scope depends on where it is declared.


Example for var
var Example

var
   myChars, xx String
   myNum Number
   orders, sales, parts TCursor
   proteus AnyType
   myBox UIObject
   a, b Array[5] SmallInt
   myOtherNum Number
endVar


See Also for var
See Also

method


while

See Also	Example	Basic Language Elements

Keyword

Repeats a sequence of statements as long as a specified condition is True.

Syntax

while Condition

[ Statements ]

endWhile

Description

while starts by evaluating the logical expression Condition. If Condition is False, the Statements are not executed. If the value is True, the Statements between the Condition and endWhile are executed in sequence. Control then returns to the top of the loop, and the Condition is evaluated again. The steps are repeated until the Condition evaluates to False, at which point the loop is exited and control advances to the next statement after endWhile.

You can use loop within the body of the while to force control back to the top of the loop, skipping the statements between loop and endWhile. You can also use quitLoop to jump out of the loop altogether. You can also nest while statements within each other to any level.

while and for are similar but are generally used for different reasons. Use for to execute a sequence of statements a known number of times. Use while to execute a sequence of statements an arbitrary number of times.


Example for while
while Example

; this example creates an array of last names
var
   myNames TCursor
   namesArray Array[] String
   n SmallInt
endVar

myNames.open("names.db")
namesArray.grow(1)
namesArray[1] = myNames."Last name"
n=1

while myNames.nextRec()
   n = n + 1
   namesArray.grow(1)
   namesArray[n] = myNames."Last name"
endWhile


See Also for while
See Also

for

forEach

if

loop

quitLoop

scan


Keywords

The keywords in this list cannot be used to name objects, variables, arrays, methods, or procedures. The case of the words is irrelevant; they cannot be used in any combination of uppercase or lowercase.

Also, as a general rule, you should not use object type names, names of basic language elements, names of methods and procedures in the run-time library, or names of built-in methods.

Keywords

active

and

array

as

case

caseInsensitive

const

container

create

Database

descending

disableDefault

doDefault

DynArray

else

enableDefault

endConst

endCreate

endFor

endForEach

endIf

endIndex

endMethod

endProc

endQuery

endRecord

endScan

endSort

endSwitch

endSwitchMenu

endTry

endType

endUses

endVar

endWhile

for

forEach

from

if

iif

in

index

indexStruct

is

key

lastMouseClicked

lastMouseRightClicked

like

loop

maintained

method

not

ObjectPAL

of

on

onFail

or

otherwise

passEvent

primary

proc

query

quitLoop

record

refIntStruct

retry

return

scan

secStruct

self

sort

step

struct

subject

switch

switchMenu

tag

then

to

try

type

unique

uses

var

where

while

with

without


See Also

System::enumRTLClassNames

System::enumtRTLConstants

System::enumRTLMethods


Built-in Object Variables

See Also

ObjectPAL provides built-in object variables. You can use them to refer to UIObjects. They are particularly useful for creating generalized code. For example, when the following statement executes, it stes the color of the active object (the object that has focus)---you don't have to specify the object by name.

active.Color = Blue

The built-in object variables are

active

container

lastMouseClicked

lastMouseRightClicked

self

subject


See Also

Built-in methods

Keywords


Properties and Property Values

See Also

Choose from the following properties for more information:

Alignment

Arrived

AttachedHeader (5.0)

AutoAppend (4.5)

AvgCharSize (5.0)

BlankRecord

Border

BottomBorder (5.0) (read-only)

Breakable (5.0)

ButtonType

ByRows (5.0)

CalculatedField (5.0)

Caption

CenterLabel

CheckedValue (5.0)

Class

Color

Columnar (4.5)

ColumnPosition (5.0)

ColumnWidth (5.0)

CompleteDisplay

ContainerName

ControlMenu

CurrentColumn (5.0)

CurrentRecordMarker.Color

CurrentRecordMarker.LineStyle

CurrentRecordMarker.Show

CurrentRow (5.0)

CursorColumn

CursorLine

CursorPos

DataSource

Default

DefineGroup

DeleteColumn (5.0)

Deleted

DeleteWhenEmpty (5.0)

Design.ContainObjects

Design.PinHorizontal

Design.PinVertical

Design.Selectable (4.5)

Design.SizeToFit

DesignModified (4.5)

DesignSizing

DesktopForm

DialogForm

DialogFrame

DisplayType

Editing (4.5)

End

FieldName

FieldNo

FieldRights

FieldSize

FieldType

FieldUnits2

FieldValid

FieldView

First

FirstRow (5.0)

FitHeight

FitWidth

FlyAway

Focus

Font.Color

Font.Size

Font.Style

Font.Typeface

Format.DateFormat

Format.LogicalFormat

Format.NumberFormat

Format.TimeFormat

Format.TimeStampFormat

Frame.Color

Frame.Style

Frame.Thickness

FrameObjects (5.0)

FullName

FullSize

Grid.Color

Grid.GridStyle

Grid.RecordDivider

GridLines.Color

GridLines.ColumnLines

GridLines.HeadingLines

GridLines.LineStyle

GridLines.QueryLook (5.0)

GridLines.RowLines

GridLines.Spacing

GridValue (5.0)

GroupObjects (5.0)

GroupRecords (5.0)

Header (5.0)

HeadingHeight (5.0)

Headings

HorizontalScrollBar

IndexField

InsertColumn (5.0)

InsertField (5.0)

Inserting

Invisible

Justification

KeyField

LabelText

LeftBorder (5.0) (read-only)

Line.Color

Line.LineStyle

Line.Thickness

LineEnds

LineSpacing

LineStyle

LineType

List.Count

List.Selection

List.Value (5.0)

Locked

LookupTable

LookupType

Magnification

Manager

MarkerPos

Margins.Bottom (5.0)

Margins.Left (5.0)

Margins.Right (5.0)

Margins.Top (5.0)

MaximizeButton

Maximum

MemoView

MinimizeButton

Minimum

Modal

MouseActivate

Name

NCols

Next

NextTabStop (5.0)

NoEcho

NRecords

NRows

OtherBandName (5.0)

OverStrike

Owner

PageSize (5.0)

PageTiling (5.0)

Pattern.Color

Pattern.Style

PersistView

Picture (enhanced for 5.0)

Position

PositionalOrder (5.0)

PrecedePageHeader

Prev

PrinterDocument (5.0)

PrintOn1stPage

Range

RasterOperation

Readonly

RecNo

Refresh

RefreshOption (5.0)

RemoveGroupRepeats (5.0)

RepeatHeader (5.0)

Required

RightBorder (5.0) (read-only)

RowHeight (5.0)

RowNo

Scroll

SeeMouseMove (5.0)

Select (4.5)

SelectedText

SeqNo

ShowGrid (5.0)

Shrinkable

Size

SizeToFit

SnapToGrid (5.0)

SortOrder

SpecialField (5.0)

StandardMenu

StandardToolbar (5.0)

Start

StartPageNumbers (5.0)

Style

SummaryModifier (5.0)

TabStop

TableName

Text

ThickFrame

Thickness

Title

TopBorder (5.0) (read-only)

TopLine

Touched

Translucent

UncheckedValue (5.0)

UpdateLink (5.0)

Value

VerticalScrollBar

Visible

WideScrollBar (5.0)

Width (5.0)

WordWrap

Xseparation (5.0)

Yseparation (5.0)


See Also for Properties and Property Values
See Also

Properties Unique to Graph Objects

UIObject Properties


Alignment

Data Type

SmallInt

Description

Specifies the position of text relative to a field object or a text object.

Values

Center, Justify, Left, Right


Arrived

Data Type

Logical

Description

Specifies whether the focus has arrived at the object.

Values

True, False


AttachedHeader
AttachedHeader (5.0)

Data Type

Logical

Description

Determines whether a table frame's header is attached to the table frame. True = attached; False = not attached, and selection handles appear around the header object.

Values

True, False


AutoAppend
AutoAppend (4.5)

Data Type

Logical

Description

Setting an object's AutoAppend property has the same effect as inspecting a table in the Data Model dialog box and choosing Auto-Append from its menu. This property is valid only for an object bound to a table in the data model.

By default, when you're editing data in a form and you move the cursor past the end of a table, Paradox automatically inserts a blank record (in other words, AutoAppend = True). You can prevent this by setting the object's AutoAppend property to False. When AutoAppend is set to False, you can insert a record by pressing Ins, by choosing Record|Insert, or by executing an ObjectPAL statement such as active.action(DataInsertRecord).

Values

True, False


AvgCharSize
AvgCharSize (5.0)

Data Type

Point

Description

Read-only property that gives the average width and height of a character in the current font.

Values

>0


BlankRecord

Data Type

Logical

Description

Reports whether a record is blank.

Values

True, False


Border

Data Type

Logical

Description

Reports whether a form's window has a border.

Values

True, False


BottomBorder
BottomBorder (5.0)

Data Type

LongInt

Description

Returns the size of an object's bottom border (in twips). An object's border represents the area in which you cannot embed another object.

Values

N/A


Breakable

Data Type

Logical

Description

Specifies whether an object can be split across page breaks in a report. Read-only for elliptical lines.

Values

True, False


ButtonType

Data Type

SmallInt

Description

Specifies the display type of a button.

Values

CheckBoxType, PushButtonType, RadioButtonType


ByRows
ByRows (5.0)

Data Type

Logical

Description

Determines the record layout of a multirecord object in a form or report. If ByRows = True, record layout is top-down, then left-right. If ByRows = False, record layout is left-right, then top-down.

Values

True, False


CalculatedField
CalculatedField (5.0)

Data Type

Logical

Description

Specifies whether a field is a calculated field.

Values

True, False


Caption

Data Type

Logical

Description

Reports whether a form has a caption (title) bar.

Values

True, False


CenterLabel

Data Type

Logical

Description

Specifies whether a label is centered within a button.

Values

True, False


CheckedValue
CheckedValue (5.0)

Data Type

String

Description

Specifies the string that the checkbox or radio button will write to its parent field object when a checkbox or radio button is chosen.

Values

N/A


Class

Data Type

String

Description

Returns the class of a UIObject.

Values

Band, Bitmap, Box, Button, Cell, Crosstab, EditRegion, Ellipse, Field, Form, Graph, Group, Header, Line, List, Multirecord, OLE, Page, Record, TableFrame, Text


Color

Data Type

LongInt

Description

Specifies the display color of an object.

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


Columnar
Columnar (4.5)

Data Type

Logical

Description

The Columnar property is valid for multi-record objects in Report Design windows. It is not valid for objects in forms. When Columnar is True, each individual record expands or contracts individually when you print or preview the report. This means that the multi-record object does not display the records in a fixed-size grid. When Columnar is False, the multi-record object displays the records in a fixed grid. By setting Columnar to True, you can usually fit more records on a single page than you can with Columnar set to False.

Values

True, False


ColumnPosition
ColumnPosition (5.0)

Data Type

SmallInt

Description

Specifies the position (starting with 1) to which you want to move the current column of a table frame.

Values

>0


ColumnWidth
ColumnWidth (5.0)

Data Type

LongInt

Description

Specifies the width in twips of the current column of a table frame.

Values

>0


CompleteDisplay

Data Type

Logical

Description

Specifies whether to display the complete contents of a field.

Values

True, False


ContainerName

Data Type

String

Description

Reports the name of an object's container.

Values

N/A


ControlMenu

Data type

Logical

Description

Read/write. Specifies whether a form has a control menu. If ControlMenu is True (the default value), the form has one; otherwise, it does not.

Values

True, False


CurrentColumn
CurrentColumn (5.0)

Data Type

SmallInt

Description

At run time, this property applies to crosstabs, multirecord objects, and table frames. It determines the active column. It is especially useful for working with crosstabs: all cells in a crosstab have the same name, so it is almost impossible to address the one you want. Using CurrentColumn and CurrentRow, you can move to the cell you want and then have your code address the active object, its container, etc.

At design time, it also applies to table frames (the table frame need not be selected). Setting this property in the designer does not necessarily cause any change in visual appearance. In design time, it is useful for controlling column rotation and resizing.

Values

>0


CurrentRecordMarker.Color

Data Type

LongInt

Description

Specifies the display color of the current record of a table view.

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


CurrentRecordMarker.LineStyle

Data Type

SmallInt

Description

Specifies the style of the line that marks the current record in a table view.

Values

DashDotDotLine, DashDotLine, DashedLine, DottedLine, NoLine, SolidLine


CurrentRecordMarker.Show

Data Type

Logical

Description

Specifies whether to highlight the current record in a table view.

Values

True, False


CurrentRow
CurrentRow (5.0)

Data Type

SmallInt

Description

At run time, this property applies to crosstabs, multirecord objects, and table frames. It determines the active row. It is especially useful for working with crosstabs: all cells in a crosstab have the same name, so it is almost impossible to address the one you want. Using CurrentColumn and CurrentRow, you can move to the cell you want and then have your code address the active object, its container, etc.

At design time, it also applies to table frames (the table frame need not be selected). Setting this property in the designer does not necessarily cause any change in visual appearance. In design time, it is useful for controlling column rotation and resizing.

Values

>0


CursorColumn

Data Type

LongInt

Description

The horizontal position of the insertion point in a field object, where position 0 is to the left of the first character.

Values

N/A


CursorLine

Data Type

LongInt

Description

The vertical position of the insertion point in a field object, where the first line is line 1.

Values

N/A


CursorPos

Data Type

LongInt

Description

The position of the insertion point in a field object, relative to the first character in the field. Counting begins with 0, the position to the left of the first character.

Values

N/A


DataSource

Data Type

String

Description

The name of the table that provides items in a list. It fills a list with values from a specified field (column) of a table.

Values

N/A


Default

Data Type

String

Description

The default value of a field.

Values

N/A


DefineGroup

Data Type

Logical

Description

Specifies whether a report band defines a group.

Values

True, False


DeleteColumn
DeleteColumn (5.0)

Data Type

SmallInt

Description

Write-only. Specifies the number of the column to delete from a table frame.

Values

>0


Deleted

Data Type

Logical

Description

Reports whether a record in a dBASE table has been flagged as deleted.

Values

True, False


DeleteWhenEmpty
DeleteWhenEmpty (5.0)

Data Type

Logical

Description

Causes the field to be deleted from the report if it has no data (including any labels, buttons, and so on).

Values

True, False


Design.ContainObjects

Data Type

Logical

Description

Specifies whether an object can contain other objects.

Values

True, False


Design.PinHorizontal

Data Type

Logical

Description

Specifies whether to prevent an object from moving horizontally.

Values

True, False


Design.PinVertical

Data Type

Logical

Description

Specifies whether to prevent an object from moving vertically.

Values

True, False


Design.Selectable
Design.Selectable (4.5)

Data Type

Logical

Description

The Design.Selectable property is valid for UIObjects in forms and reports in design windows and at runtime. It specifies whether an object can be selected. When Design.Selectable is True, you can select the object, and selection handles appear around the object. When Design.Selectable is False, you cannot select the object, so there are no handles; however, you can still inspect the object to view its menu.

Values

True, False


Design.SizeToFit

Data Type

Logical

Description

Specifies whether the object will change size to accomodate its contents.

Values

True, False


DesignModified
DesignModified (4.5)

Data Type

Logical

Description

Paradox sets a form's (or report's) DesignModified property to True when its design is changed, whether by an interactive user or ObjectPAL statements, either in a design window or at run time. When you close a form (or report) and DesignModified is True, Paradox displays a dialog box asking if you want to save it. When DesignModified is False, Paradox closes the it without displaying the dialog box or saving it, and changes are lost.

Values

True, False


DesignSizing

Data Type

SmallInt

Description

Specifies design time sizing for a text box.

Values

TextFixedSize, TextGrowOnly, TextSizeToFit


DesktopForm

Data Type

Logical

Description

Specifies whether a form's menus are used by other forms on the Desktop.

Values

True, False


DialogForm

Data Type

Logical

Description

Specifies whether a form will open as a dialog box.

Values

True, False


DialogFrame

Data Type

Logical

Description

When True and DialogForm and Border are also True, form has a conventional dialog box frame.

Values

True, False


DisplayType

Data Type

SmallInt

Description

Returns the display type of a field object.

Values

CheckBoxField, ComboField, EditField, LabeledField, ListField, RadioButtonField


Editing
Editing (4.5)

Data Type

Logical

Description

Valid for objects (including forms) bound to tables. Editing returns True if the table associated with an object is in Edit mode. For field objects, Editing indicates whether that field is active and using a temporary "edit" object (such as being in field view).

When you put a form into Edit mode (for example, by pressing F9 or clicking the Edit Data button on the Toolbar), you automatically put all associated tables into Edit mode.

Values

True, False


End

Data Type

Point

Description

Specifies the coordinates of the end of a line. See also: Start.

Values

N/A


FieldName

Data Type

String

Description

Specifies the name of the field to which a field object or list is bound.

This is not a new property; it was altered slightly in version 5.0 so that, in addition to setting a value like "Quant" or "Bookord->Quant" or "[Bookord.Quant]", you can also specify "sum(Bookord.Quant)", thus allowing aggregated values to be placed. This property's return value is no longer simply the field name (like "Quant"), but a string just as you would see if you clicked the Copy Field button in the Define Field dialog.

To use these new features to greatest advantage, do either (or both) of the following:

Change code that uses expressions like active.TableName + "." + active.FieldName to just active.FieldName.

Use calculations like these:

actField = active.FieldName

 	x = actField.SubStr( actField.search( "." ) + 1, actField.Size() )

Values

N/A


FieldNo

Data Type

SmallInt

Description

Reports the position of a field in a table, where the first field is field 1.

Values

N/A


FieldRights

Data Type

String

Description

Reports the user's field rights.

Values

ReadOnly, ReadWrite, All


FieldSize

Data Type

SmallInt

Description

The field's size (for alphanumeric and dBASE number fields).

Values

N/A


FieldType

Data Type

String

Description

The field's data type.

Values

N/A


FieldUnits2

Data Type

SmallInt

Description

Indicates the number of decimal places in a dBASE number field. For a Paradox table (or any other driver or field type that does not require field units to be specified), this method returns 0.

Values

N/A


FieldValid

Data Type

Logical

Description

Reports whether a field passes its own value checks.

Values

True, False


FieldView

Data Type

Logical

Description

Reports whether a field is in Field View.

Values

True, False


First

Data Type

String

Description

Returns the name of the first child object in a container.

Values

N/A


FirstRow
FirstRow	(5.0)

Data Type

String

Description

Read-only. FirstRow returns the name of the first record object within a table frame or multirecord object.

Values

N/A


FitHeight

Data Type

Logical

Description

Specifies whether an edit region expands vertically to accommodate text.

Values

True, False


FitWidth

Data Type

Logical

Description

Specifies whether an edit region or crosstab cell expands horizontally to accommodate text.

Values

True, False


FlyAway

Data Type

Logical

Description

Reports whether a record has moved to its sorted position in a table.

Values

True, False


Focus

Data Type

Logical

Description

Reports whether an object's built-in setFocus method has been called. Set to False when the object's built-in removeFocus method is called.

Values

True, False


Font.Color

Data Type

LongInt

Description

Specifies the color of characters displayed in a field object or a text object.

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


Font.Size

Data Type

SmallInt

Description

Specifies (in printer's points) the size of characters displayed in a field object or a text object.

Values

>0


Font.Style

Data Type

SmallInt

Description

Specifies the style of characters displayed in a field object or a text object.

Values

FontAttribBold, FontAttribItalic, FontAttribNormal, FontAttribStrikeout, FontAttribUnderline


Font.Typeface

Data Type

String

Description

Specifies the typeface of characters displayed in a field object or a text object.

Values

Depends on system.


Format.DateFormat

Data Type

String

Description

Specifies the format for date values.

Values

Format specification


Format.LogicalFormat

Data Type

String

Description

Specifies the format for logical values.

Values

Format specification


Format.NumberFormat

Data Type

String

Description

Specifies the format for number values.

Values

Format specification


Format.TimeFormat

Data Type

N/A

Description

Specifies the format for time values.

Values

Format specification


Format.TimeStampFormat

Data Type

String

Description

Specifies the format for time stamps.

Values

Format specification


Frame.Color

Data Type

LongInt

Description

Specifies the color of an object's frame.

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


Frame.Style

Data Type

SmallInt

Description

Specifies the style of an object's frame.

Values

3DWindows, 3DWindowsGroup, DashDotDotFrame, DashDotFrame, DashedFrame, DottedFrame, DoubleFrame, Inside3DFrame, NoFrame, Outside3DFrame, ShadowFrame, SolidFrame, WideInsideDoubleFrame, WideOutsideDoubleFrame


Frame.Thickness

Data Type

SmallInt

Description

Specifies the thickness of an object's frame in pixels.

Values

N/A


FrameObjects
FrameObjects (5.0)

Data Type

Logical

Description

Specifies whether the dotted frame shows around objects in the designers. If FrameObjects is true, creates a 1 pixel region in which embedding cannot occur.

Values

True, False


FullName

Data Type

String

Description

Returns the full name (including containership path) of an object in a form.

Values

N/A


FullSize

Data Type

Point

Description

In scrolling object, returns actual size if you could see the whole thing.

Values

N/A


Grid.Color

Data Type

LongInt

Description

Specifies the color of the grid in a table frame.

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


Grid.GridStyle

Data Type

SmallInt

Description

Specifies the style of grid lines in a table frame.

Values

tf3D, tfDoubleLine, tfNoGrid, tfSingleLine, tfTripleLine


Grid.RecordDivider

Data Type

Logical

Description

Specifies whether dividing lines are displayed between records in a table frame.

Values

True, False


GridLines.Color

Data Type

LongInt

Description

Specifies the color of grid lines in a Table window.

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


GridLines.ColumnLines

Data Type

Logical

Description

Specifies whether to display column lines in a Table window.

Values

True, False


GridLines.HeadingLines

Data Type

Logical

Description

Specifies whether to display heading lines in a Table window.

Values

True, False


GridLines.LineStyle

Data Type

SmallInt

Description

Specifies the style of grid lines in a Table window.

Values

DashDotDotLine, DashDotLine, DashedLine, DottedLine, NoLine, SolidLine


GridLines.QueryLook
GridLines.QueryLook (5.0)

Data Type

Logical

Description

Specifies whether a Table window displays grid lines in the same style as a Query Editor window.

Values

True, False


GridLines.RowLines

Data Type

Logical

Description

Specifies whether to display grid lines in a Table window.

Values

True, False


GridLines.Spacing

Data Type

SmallInt

Description

Specifies the spacing of gridlines in a Table window.

Values

TextSingleSpacing, TextDoubleSpacing, TextTripleSpacing


GridValue
GridValue (5.0)

Data Type

Point

Description

GridValue determines the minimum grid interval in twips. Note there is no control (except through the UI) of the number of these intervals shown as major or minor intervals when ShowGrid is on. This does, however, give more control of the granularity of the grid than does the dialog in the UI.

Values

>0


GroupObjects
GroupObjects (5.0)

Data Type

Logical

Description

Write-only. Specifies whether to group selected objects in forms and reports. If true, GroupObjects is identical to choosing the "Group" menu item. If false, GroupObjects is identical to choosing the "Ungroup" menu item.

Values

True, False


GroupRecords
GroupRecords (5.0)

Data Type

SmallInt

Description

GroupRecords determines the number of records in a group in a report.

Values

>0


Header
Header (5.0)

Data Type

String

Description

Read-only. Header returns the name of a table frame's header object (if it has one).

Values

N/A


HeadingHeight
HeadingHeight (5.0)

Data Type

LongInt

Description

Determines (in twips) the height of the heading in a Table window.

Values

>0


Headings

Data Type

String

Description

Specifies which report headings to print.

Values

"GroupOnly", "PageAndGroup"


HorizontalScrollBar

Data Type

Logical

Description

Specifies whether a table frame has a horizontal scroll bar.

Values

True, False


IndexField

Data Type

Logical

Description

Reports whether a field object is bound to an indexed field in a table.

Values

True, False


InsertColumn
InsertColumn (5.0)

Data Type

SmallInt

Description

Write-only. Specifies where (which column) to insert a column in a table frame.

Values

>0


InsertField
InsertField (5.0)

Data Type

Point

Description

Write-only property. Inserts a field object into a text box. Specify the field size using a Point value. The upper left corner of the field is at (0, 0) relative to the text box.

Values

N/A


Inserting

Data Type

Logical

Description

Returns True when a record is being inserted anywhere in a form.

Values

True, False


Invisible

Data Type

Logical

Description

Invisible applies only to boxes and lines in reports. Like the Visible property, which applies to objects in forms, Invisible determines whether an object is visible at run time. However, unlike Visible, when you use Invisible to hide an object, contained objects are not hidden. Set Invisible to True to hide an object, set Invisible to False to show an object.

Values

True, False


Justification

Data Type

SmallInt

Description

Specifies the justification of data in a Table window.

Values

TextAlignTop, TextAlignBottom, TextAlignVCenter, TextAlignLeft, TextAlignRight, TextAlignCenter


KeyField

Data Type

Logical

Description

Reports whether a field object is bound to a key field in a table.

Values

True, False


LabelText

Data Type

String

Description

Specifies the text displayed in a button's label.

Values

N/A


LeftBorder
LeftBorder(5.0)

Data Type

LongInt

Description

Returns the size of an object's left border (in twips). An object's border represents the area in which you cannot embed another object.

Values

N/A


Line.Color

Data Type

LongInt

Description

Specifies the color of a line for an ellipse.

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


Line.LineStyle

Data Type

SmallInt

Description

Specifies the style of a line for an ellipse.

Values

DashDotDotLine, DashDotLine, DashedLine, DottedLine, NoLine, SolidLine


Line.Thickness

Data Type

SmallInt

Description

Specifies the thickness of a line for an ellipse.

Values

N/A


LineEnds

Data Type

SmallInt

Description

Specifies whether (or where) to place arrows at the end of a line.

Values

ArrowBothEnds, ArrowOneEnd, NoArrowEnd


LineSpacing

Data Type

SmallInt

Description

Specifies the number of blank lines to print between each line of text in a field object or a text object.

Values

TextDoubleSpacing, TextDoubleSpacing2, TextSingleSpacing, TextSingleSpacing2, TextTripleSpacing


LineStyle

Data Type

SmallInt

Description

Specifies the style of a line.

Values

DashDotDotLine, DashDotLine, DashedLine, DottedLine, NoLine, SolidLine


LineType

Data Type

SmallInt

Description

Specifies the type of a line.

Values

CurvedLine, StraightLine


List.Count

Data Type

SmallInt

Description

Specifies the number of items in a list.

Values

N/A


List.Selection

Data Type

SmallInt

Description

Specifies the item selected from a list.

Values

N/A


List.Value
List.Value (5.0)

Data Type

AnyType

Description

Determines the value of an item in a list.

Values

N/A


Locked

Data Type

Logical

Description

Reports whether the table bound to a design object is locked.

Values

True, False


LookupTable

Data Type

String

Description

The name of the lookup table for a field object.

Values

N/A


LookupType

Data Type

String

Description

Specifies the type of table lookup.

Values

JustCurrentField, AllCorresponding


Magnification

Data Type

SmallInt

Description

Specifies the display magnification of a bitmap object. You can also enter a literal value.

Values

Magnify25, Magnify50, Magnify100, Magnify200, Magnify400, MagnifyBestFit


Manager

Data Type

String

Description

Returns UIObject name of a form.

Values

N/A


MarkerPos

Data Type

LongInt

Description

The "other end" of a selection. See also CursorPos.

Values

N/A


Margins.Bottom
Margins.Bottom (5.0)

Data Type

LongInt

Description

Determines the height of a report's bottom margin in twips.

Values

>0


Margins.Left
Margins.Left (5.0)

Data Type

LongInt

Description

Determines the width of a report's left margin in twips.

Values

>0


Margins.Right
Margins.Right (5.0)

Data Type

LongInt

Description

Determines the width of a report's right margin in twips.

Values

>0


Margins.Top
Margins.Top (5.0)

Data Type

LongInt

Description

Determines the height of a report's top margin in twips.

Values

>0


MaximizeButton

Data Type

Logical

Description

Determines whether a form's window has a maximize box.

Values

True, False


Maximum

Data Type

String

Description

Specifies the maximum value allowed in a field.

Values

N/A


MemoView

Data Type

Logical

Description

Specifies whether a field object is in memo view mode.

Values

True, False


MinimizeButton

Data Type

Logical

Description

Reports or specifies whether a form's window has a minimize box.

Values

True, False


Minimum

Data Type

String

Description

Specifies the maximum value allowed in a field.

Values

N/A


Modal

Data Type

Logical

Description

Specifies whether a dialog form is modal.

Values

True, False


MouseActivate

Data Type

Logical

Description

Specifies whether a dialog form gets focus as the result of a MouseEvent.

Values

True, False


NCols

Data Type

SmallInt

Description

Returns the number of columns in a table frame or multi-record object.

Values

N/A


NRecords

Data Type

LongInt

Description

Reports the number of records in the table bound to a design object. This property returns the number of records in the underlying table, not the number of records displayed in the object.

Note:	When you read NRecords after setting a filter, the returned value does not represent the number of records in the filtered set. To get that information, attach a TCursor to the UIObject and call cCount. When you read NRecords after setting a range, the returned value represents the number of records in the set defined by the range.

Values

N/A


NRows

Data Type

SmallInt

Description

Returns the number of rows in a table frame or multi-record object.

Values

N/A


Name

Data Type

String

Description

Specifies the name of a design object.

Values

N/A


Next

Data Type

String

Description

Returns the name of the next object in the same container.

Values

N/A


NextTabStop
NextTabStop (5.0)

Data Type

String

Description

Determines the object name of the next tab stop on a form or report. When you read NextTabStop, it returns a UIObject; when you write it, you must assign a String.

Values

N/A


NoEcho

Data Type

Logical

Description

Specifies whether characters typed into a field object are displayed.

Values

True, False


OtherBandName
OtherBandName (5.0)

Data Type

String

Description

Returns the name of a report band's counterpart (the "other" band in a pair of bands). Given a header band, it returns the name of the corresponding footer band. Given a footer band, it returns the name of the corresponding header band. Given a record band, it returns the name of that record band.

Values

N/A


OverStrike

Data Type

Logical

Description

Specifies whether a field or text object is in overstrike (as opposed to insert) mode.

Values

True, False


Owner

Data Type

String

Description

Name of the logical container of an object, irrespective of intermediate cosmetic objects.

Values

N/A


PageSize
PageSize (5.0)

Data Type

Point

Description

PageSize determines the size of a page in a report in a design window. This property was added because there is no page object in a banded report designer.

Values

>0


PageTiling
PageTiling (5.0)

Data Type

SmallInt

Description

PageTiling determines how to arrange pages in a form. It uses PageTiling constants.

Values

StackPages, TileHorizontal, TileVertical


Pattern.Color

Data Type

LongInt

Description

Specifies the color of a pattern.

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


Pattern.Style

Data Type

SmallInt

Description

Specifies the style of a pattern.

Values

BricksPattern, CrosshatchPattern, DiagonalCrosshatchPattern, DottedLinePattern, EmptyPattern, FuzzyStripesDownPattern, HeavyDotPattern, HorizontalLinesPattern, LatticePattern, LeftDiagonalLinesPattern, LightDotPattern, MaximumDotPattern, MediumDotPattern, RightDiagonalLinesPattern, ScalesPattern, StaggeredDashesPattern, ThickHorizontalLinesPattern, ThickStripesDownPattern, ThickStripesUpPattern, ThickVerticalLinesPattern, VerticalLinesPattern, VeryHeavyDotPattern, WeavePattern, ZigZagPattern


PersistView

Data Type

Logical

Description

Specifies whether to remain in Field View or Memo View.

Values

True, False


Picture

Data Type

String

Description

A template that formats the value of a field. You can use picture string characters to define a picture for a bound or unbound field object in a form (this feature was added in version 5.0). The maximum length of an ObjectPAL picture string is 255 characters; the maximum size of a picture defined interactively is 175 characters. If a bound field object has a picture defined in the data model, the proprety does not override it: the table picture takes precedence.

Values

N/A


Position

Data Type

Point

Description

Specifies the coordinates of the upper left corner of a design object, relative to its container.

Values

N/A


PositionalOrder
PositionalOrder (5.0)

Data Type

SmallInt

Description

For Page objects, specifies the page number. For Band objects, specifies the position the band occupies, counting from the top. The Report header always has PositionalOrder of 1, the Page header always has PositionalOrder of 2, and so on. Only the PositionalOrder of group bands can be set. Can be used to rearrange groups or to swap header and footer.

Values

>0


PrecedePageHeader

Data Type

Logical

Description

Specifies whether a report band should appear before the page header.

Values

True, False


Prev

Data Type

String

Description

Returns the name of the previous object in the same container.

Values

N/A


PrinterDocument
PrinterDocument (5.0)

Data Type

Logical

Description

Specifies whether the document is designed for printer or screen. The setting determines which fonts are used, and which frame widths are available for the various frame styles.

Values

True, False


PrintOn1stPage

Data Type

Logical

Description

Specifies whether to print a report band on the first page of the report.

Values

True, False


Range
Range	(5.0)

Data Type

SmalInt

Description

Range is used on report bands to convert a group on a field to a group on a range of that field (or to change the range on a range group). Semantics are the same as the range value in the define group dialog (dependant on field type). The DateRangeType constants are provided for use with date and timestamp fields: ByDay, ByWeek, ByMonth, ByQuarter, and ByYear.

Values

Depends on field type.


RasterOperation

Data Type

LongInt

Description

Specifies how to blend the colors in two overlapping design objects.

Values

MergePaint, NotSourceCopy, NotSourceErase, SourceAnd, SourceCopy, SourceErase, SourceInvert, SourcePaint


Readonly

Data Type

Logical

Description

Specifies whether a field object is read-only.

Values

True, False


RecNo

Data Type

LongInt

Description

Reports the position of a record. (This can be a time-consuming operation for dBASE tables.)

Values

N/A


Refresh

Data Type

Logical

Description

Reports when data displayed onscreen is being changed, either across a network, by an ObejctPAL statement, or user action.

Values

True, False


RefreshOption
RefreshOption (5.0)

Data Type

SmallInt

Description

Determines what to do when data changes while printing a report. It uses ReportPrintRestart constants.

Values

PrintFromCopy, PrintLock, PrintNoLock, PrintRestart, PrintReturn


RemoveGroupRepeats
RemoveGroupRepeats (5.0)

Data Type

Logical

Description

Use RemoveGroupRepeats to retain or suppress repeated group values within a record band. When RemoveGroupRepeats is False, Paradox displays the value of the grouped field for each record, including duplicates, in the record band. When it is True, Paradox prints the value for the first record of the group only.

Values

True, False


RepeatHeader
RepeatHeader (5.0)

Data Type

Logical

Description

Determines whether the header is repeated on each page of a report. If True, the header is repeated; otherwise, it is not repeated.

Values

True, False


Required

Data Type

Logical

Description

Reports whether a field object must be assigned a value for the record to be valid.

Values

True, False


RightBorder
RightBorder (5.0)

Data Type

LongInt

Description

Returns the size of an object's right border (in twips). An object's border represents the area in which you cannot embed another object.

Values

N/A


RowHeight
RowHeight (5.0)

Data Type

LongInt

Description

Determines the height (in twips) of a row in a Table window.

Values

>0


RowNo

Data Type

SmallInt

Description

Reports the row number of a record displayed in a table frame, mutli-record object, or table view, starting with 1.

Values

N/A


Scroll

Data Type

Point

Description

How far you've scrolled.

Values

N/A


SeeMouseMove
SeeMouseMove (5.0)

Data Type

Logical

Description

When SeeMouseMove is True, the form responds to mouse movements (mouseEnter, mouseMove, and mouseExit) even when the form does not have focus. This can be useful in forms used as custom Toolbars. When SeeMouseMove is False (the default), the form does not respond to mouse movements unless it has focus. This property is saved with the form.

Values

True, False


Select
Select (4.5)

Data Type

Logical

Description

The Select property is valid for UIObjects in a Form Design window or a Report Design window. It specifies whether an object is selected. When Select is True, selection handles appear around the frame of the selected object, just as if you had selected it interactively. When Select is False, there are no handles. This property is not valid while the form or report is running.

Values

True, False


SelectedText

Data Type

String

Description

Returns the selected text in a field object.

Values

N/A


SeqNo

Data Type

LongInt

Description

The actual sequence number of a record as displayed, taking filters and indexes into account. Returns <N/A> when table is from a dynaset or has a filter.

Values

N/A


ShowGrid

Data Type

Logical

Description

Specifies whether the form or report grid is visible.

Values

True, False


Shrinkable

Data Type

Logical

Description

Specifies whether a report band can be shrunk.

Values

True, False


Size

Data Type

Point

Description

Specifies the coordinates of the lower right corner of a design object, relative to its upper left corner.

Values

N/A


SizeToFit

Data Type

Logical

Description

When True, the form opens at the size of the underlying page. When False, the form opens at the size it was saved.

Values

True, False


SnapToGrid
SnapToGrid (5.0)

Data Type

Logical

Description

When SnapToGrid is True, design objects jump to the closest minor division of the grid when moved or resized. Internally generated resizes (such as when you add text to a text object or define a field object) do not snap to the grid.

When SnapToGrid is False, object size and position are not affected by the grid.

Values

True, False


SortOrder

Data Type

Logical

Description

Specifies the sort order of a report. True = Descending order, False = Ascending order.

Values

Ascending, Descending


SpecialField
SpecialField (5.0)

Data Type

SmallInt

Description

SpecialField determines the type of a special field. It uses SpecialFieldTypes constants. On the types that require a table, the current table for the field is used. If there is no current table, the master table of the form or report is assumed.

Values

DateField, NofFieldsField, NofPagesField, NofRecsField, PageNumField, RecordNoField, TableNameField, TimeField


StandardMenu

Data Type

Logical

Description

Specifies whether a form or report uses the standard Paradox menus. Set it to True to use Paradox menus; otherwise, set it to False.

Values

True, False


StandardToolBar
StandardToolbar (5.0)

Data Type

Logical

Description

Specifies whether a form or report uses the standard Toolbar. Set it to True to use the standard Toolbar; otherwise, set it to False.

Values

True, False


Start

Data Type

Point

Description

Specifies the coordinates of the start of a line. See also: End.

Values

N/A


StartPageNumbers
StartPageNumbers (5.0)

Data Type

SmallInt

Description

Determines the starting value for page numbers in a report.

Values

>0


Style

Data Type

SmallInt

Description

Reports or specifes the display style of a button.

Values

BorlandButton, Windows3dButton, WindowsButton


SummaryModifier
SummaryModifier (5.0)

Data Type

SmallInt

Description

SummaryModifier determines how to modify aggregator fields in reports. It uses AggModifiers constants.

Values

CumulativeAgg, CumUniqueAgg, RegularAgg, UniqueAgg


TabStop

Data Type

Logical

Description

Specifies whether a field object is a tab stop.

Values

True, False


TableName

Data Type

String

Description

Specifies the name of a table to which a design object is bound.

Values

N/A


Text

Data Type

String

Description

Specifies the characters displayed in a text object.

Values

N/A


ThickFrame

Data Type

Logical

Description

When True, and DialogForm and Border also True, specifies a thick window frame instead of the usual pixel-wide frame.

Values

True, False


Thickness

Data Type

SmallInt

Description

Specifies the thickness of a line.

Values

LWidth10Points, LWidth1Point, LWidth2Points, LWidth3Points, LWidth6Points, LWidthHairline, LWidthHalfPoint


Title

Data Type

String

Description

Specifies the text of a form's caption.

Values

N/A


TopBorder
TopBorder (5.0)

Data Type

LongInt

Description

Returns the size of an object's top border (in twips). An object's border represents the area in which you cannot embed another object.

Values

N/A


TopLine

Data Type

LongInt

Description

The number of the line currently displayed at the top of a text object.

Values

N/A


Touched

Data Type

Logical

Description

True when user has made changes not yet committed.

Values

True, False


Translucent

Data Type

Logical

Description

Specifies whether the color of an object is translucent.

Values

True, False


UncheckedValue
UncheckedValue (5.0)

Data Type

String

Description

Specifies the value that a button will write to its parent field object when the button is unchecked. This property is supported only by checkboxes.

Values

N/A


UpdateLink
UpdateLink (5.0)

Data Type

SmallInt

Description

Determines the update method for an OLE object. The constant OLEUpdateAutomatic specifies automatic updates (the OLE object in the Paradox table is updated whenever the underlying object is changed), the constant OLEUpdateManual specifies manual updates (the user must update the OLE object manually).

Values

OLEUpdateAutomatic, OLEUpdateManual


Value

Data Type

String

Description

Specifies the value of a design object.

Values

N/A


VerticalScrollBar

Data Type

Logical

Description

Specifies whether an object has a vertical scroll bar. Not valid for all UIObjects. Refer to chart.

Values

True, False


Visible

Data Type

Logical

Description

Specifies whether an object is displayed in a form at run time. Setting Visible to True makes the object (and the objects it contains) visible; setting Visible to False hides the object and the objects it contains.

Values

True, False


WideScrollBar
WideScrollBar (5.0)

Data Type

Logical

Description

Determines whether a scroll bar is wide or narrow (the default). If True, the scroll bar is wide; otherwise, it is narrow.

Values

True, False


Width
Width (5.0)

Data Type

LongInt

Description

Determines the width (in twips) of a column in a Table window.

Values

>0


WordWrap

Data Type

Logical

Description

Specifies whether to wrap lines that exceed the width of a field object.

Values

True, False


Xseparation
Xseparation (5.0)

Data Type

LongInt

Description

Specifies the distance (in twips) between records in the indicated direction.

Values

>0


Yseparation
Yseparation (5.0)

Data Type

LongInt

Description

Specifies the distance (in twips) between records in the indicated direction.

Values

>0


Properties Unique to Graph Objects

See Also

Choose from the following graph object properties for more information.

BackWall.Color

BackWall.Pattern.Color

BackWall.Pattern.Style

Background.Color

Background.Pattern.Color

Background.Pattern.Style

BaseFloor.Color

BaseFloor.Pattern.Color

BaseFloor.Pattern.Style

BindType

CurrentSeries

CurrentSlice

GraphType

Label.Font.Color

Label.Font.Size

Label.Font.Style

Label.Font.Typeface

Label.LabelFormat

Label.LabelLocation

Label.NumberFormat

LeftWall.Color

LeftWall.Pattern.Color

LeftWall.Pattern.Style

LegendBox.Color

LegendBox.Font.Color

LegendBox.Font.Size

LegendBox.Font.Style

LegendBox.Font.Typeface

LegendBox.LegendPos

LegendBox.Pattern.Color

LegendBox.Pattern.Style

MaxGroups

MaxXValues

MinXValues

Options.Elevation

Options.Rotation

Options.ShowAxes

Options.ShowGrid

Options.ShowLabels

Options.ShowLegend

Options.ShowTitle

Series.Color

Series.Graph_Title.Font.Color

Series.Graph_Title.Font.Size

Series.Graph_Title.Font.Style

Series.Graph_Title.Font.Typeface

Series.Graph_Title.Text

Series.Graph_Title.UseDefault

Series.Line.Color

Series.Line.LineStyle

Series.Line.Thickness

Series.Marker.Size (5.0)

Series.Marker.Style (5.0)

Series.Pattern.Color

Series.Pattern.Style

Series.TypeOverride

SeriesName (5.0)

Slice.Color

Slice.Explode

Slice.Pattern.Color

Slice.Pattern.Style

TitleBox.Color

TitleBox.Graph_Title.Font.Color

TitleBox.Graph_Title.Font.Size

TitleBox.Graph_Title.Font.Style

TitleBox.Graph_Title.Font.Typeface

TitleBox.Graph_Title.Text

TitleBox.Graph_Title.UseDefault

TitleBox.Pattern.Color

TitleBox.Pattern.Style

TitleBox.Subtitle.Font.Color

TitleBox.Subtitle.Font.Size

TitleBox.Subtitle.Font.Style

TitleBox.Subtitle.Font.Typeface

TitleBox.Subtitle.Text

TitleBox.Subtitle.UseDefault

TitleBoxName (5.0)

XAxisName (5.0)

XAxis.Graph_Title.Font.Color

XAxis.Graph_Title.Font.Size

XAxis.Graph_Title.Font.Style

XAxis.Graph_Title.Font.Typeface

XAxis.Graph_Title.Text

XAxis.Graph_Title.UseDefault

XAxis.Scale.AutoScale

XAxis.Scale.HighValue

XAxis.Scale.Increment

XAxis.Scale.Logarithmic

XAxis.Scale.LowValue

XAxis.Ticks.Alternate

XAxis.Ticks.DateFormat

XAxis.Ticks.Font.Color

XAxis.Ticks.Font.Size

XAxis.Ticks.Font.Style

XAxis.Ticks.Font.Typeface

XAxis.Ticks.NumberFormat

XAxis.Ticks.TimeFormat (5.0)

XAxis.Ticks.TimeStampFormat (5.0)

YAxisName (5.0)

YAxis.Graph_Title.Font.Color

YAxis.Graph_Title.Font.Size

YAxis.Graph_Title.Font.Style

YAxis.Graph_Title.Font.Typeface

YAxis.Graph_Title.Text (5.0)

YAxis.Graph_Title.UseDefault

YAxis.Scale.AutoScale

YAxis.Scale.HighValue

YAxis.Scale.Increment

YAxis.Scale.Logarithmic

YAxis.Scale.LowValue

YAxis.Ticks.Alternate

YAxis.Ticks.DateFormat

YAxis.Ticks.Font.Color

YAxis.Ticks.Font.Size

YAxis.Ticks.Font.Style

YAxis.Ticks.Font.Typeface

YAxis.Ticks.NumberFormat

YAxis.Ticks.TimeFormat (5.0)

YAxis.Ticks.TimeStampFormat (5.0)

ZAxisName (5.0)

ZAxis.Graph_Title.Font.Color

ZAxis.Graph_Title.Font.Size

ZAxis.Graph_Title.Font.Style

ZAxis.Graph_Title.Font.Typeface

ZAxis.Graph_Title.Text (5.0)

ZAxis.Graph_Title.UseDefault

ZAxis.Scale.AutoScale

ZAxis.Scale.HighValue

ZAxis.Scale.Increment

ZAxis.Scale.Logarithmic

ZAxis.Scale.LowValue

ZAxis.Ticks.Alternate

ZAxis.Ticks.DateFormat

ZAxis.Ticks.Font.Color

ZAxis.Ticks.Font.Size

ZAxis.Ticks.Font.Style

ZAxis.Ticks.Font.Typeface

ZAxis.Ticks.NumberFormat (5.0)

ZAxis.Ticks.TimeFormat (5.0)

ZAxis.Ticks.TimeStampFormat (5.0)


See Also for Properties Unique to Graph Objects
See Also

Properties and Property Values

UIObject Properties


BackWall.Color

This property applies only to graph objects.

Data Type

LongInt

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


BackWall.Pattern.Color

This property applies only to graph objects.

Data Type

LongInt

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


BackWall.Pattern.Style

This property applies only to graph objects.

Data Type

SmallInt

Values

BricksPattern, CrosshatchPattern, DiagonalCrosshatchPattern, DottedLinePattern, EmptyPattern, FuzzyStripesDownPattern, HeavyDotPattern, HorizontalLinesPattern, LatticePattern, LeftDiagonalLinesPattern, LightDotPattern, MaximumDotPattern, MediumDotPattern, RightDiagonalLinesPattern, ScalesPattern, StaggeredDashesPattern, ThickHorizontalLinesPattern, ThickStripesDownPattern, ThickStripesUpPattern, ThickVerticalLinesPattern, VerticalLinesPattern, VeryHeavyDotPattern, WeavePattern, ZigZagPattern


Background.Color

This property applies only to graph objects.

Data Type

LongInt

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


Background.Pattern.Color

This property applies only to graph objects.

Data Type

LongInt

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


Background.Pattern.Style

This property applies only to graph objects.

Data Type

SmallInt

Values

BricksPattern, CrosshatchPattern, DiagonalCrosshatchPattern, DottedLinePattern, EmptyPattern, FuzzyStripesDownPattern, HeavyDotPattern, HorizontalLinesPattern, LatticePattern, LeftDiagonalLinesPattern, LightDotPattern, MaximumDotPattern, MediumDotPattern, RightDiagonalLinesPattern, ScalesPattern, StaggeredDashesPattern, ThickHorizontalLinesPattern, ThickStripesDownPattern, ThickStripesUpPattern, ThickVerticalLinesPattern, VerticalLinesPattern, VeryHeavyDotPattern, WeavePattern, ZigZagPattern


BaseFloor.Color

This property applies only to graph objects.

Data Type

LongInt

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


BaseFloor.Pattern.Color

This property applies only to graph objects.

Data Type

LongInt

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


BaseFloor.Pattern.Style

This property applies only to graph objects.

Data Type

SmallInt

Values

BricksPattern, CrosshatchPattern, DiagonalCrosshatchPattern, DottedLinePattern, EmptyPattern, FuzzyStripesDownPattern, HeavyDotPattern, HorizontalLinesPattern, LatticePattern, LeftDiagonalLinesPattern, LightDotPattern, MaximumDotPattern, MediumDotPattern, RightDiagonalLinesPattern, ScalesPattern, StaggeredDashesPattern, ThickHorizontalLinesPattern, ThickStripesDownPattern, ThickStripesUpPattern, ThickVerticalLinesPattern, VerticalLinesPattern, VeryHeavyDotPattern, WeavePattern, ZigZagPattern


BindType

This property applies only to graph objects.

Data Type

SmallInt

Values

Graph1DSummary, Graph2DSummary, GraphTabular


CurrentSeries

This property applies only to graph objects.

Data Type

SmallInt

Values

N/A


CurrentSlice

This property applies only to graph objects.

Data Type

SmallInt

Values

N/A


GraphType

This property applies only to graph objects.

Data Type

SmallInt

Values

Graph2DArea, Graph2DBar, Graph2DColumns, Graph2DLine, Graph2DPie, Graph2DRotatedBar, Graph2DStackedBar, Graph3DArea, Graph3DBar, Graph3DColumns, Graph3DPie, Graph3DRibbon, Graph3DRotatedBar, Graph3DStackedBar, Graph3DStep, Graph3DSurface, GraphXY


Label.Font.Color

This property applies only to graph objects.

Data Type

LongInt

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


Label.Font.Size

This property applies only to graph objects.

Data Type

SmallInt

Values

Depends on system


Label.Font.Style

This property applies only to graph objects.

Data Type

SmallInt

Values

FontAttribBold, FontAttribItalic, FontAttribNormal, FontAttribStrikeout, FontAttribUnderline


Label.Font.Typeface

This property applies only to graph objects.

Data Type

String

Values

Depends on system


Label.LabelFormat

This property applies only to graph objects.

Data Type

SmallInt

Values

GraphHideY, GraphPercent, GraphShowY


Label.LabelLocation

This property applies only to graph objects.

Data Type

SmallInt

Values

Above, Below, Bottom, Center, Left, Middle, Right, Top


Label.NumberFormat

This property applies only to graph objects.

Data Type

N/A

Values

Format specification


LeftWall.Color

This property applies only to graph objects.

Data Type

LongInt

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


LeftWall.Pattern.Color

This property applies only to graph objects.

Data Type

LongInt

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


LeftWall.Pattern.Style

This property applies only to graph objects.

Data Type

SmallInt

Values

BricksPattern, CrosshatchPattern, DiagonalCrosshatchPattern, DottedLinePattern, EmptyPattern, FuzzyStripesDownPattern, HeavyDotPattern, HorizontalLinesPattern, LatticePattern, LeftDiagonalLinesPattern, LightDotPattern, MaximumDotPattern, MediumDotPattern, RightDiagonalLinesPattern, ScalesPattern, StaggeredDashesPattern, ThickHorizontalLinesPattern, ThickStripesDownPattern, ThickStripesUpPattern, ThickVerticalLinesPattern, VerticalLinesPattern, VeryHeavyDotPattern, WeavePattern, ZigZagPattern


LegendBox.Color

This property applies only to graph objects.

Data Type

LongInt

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


LegendBox.Font.Color

This property applies only to graph objects.

Data Type

LongInt

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


LegendBox.Font.Size

This property applies only to graph objects.

Data Type

SmallInt

Values

Depends on system


LegendBox.Font.Style

This property applies only to graph objects.

Data Type

SmallInt

Values

FontAttribBold, FontAttribItalic, FontAttribNormal, FontAttribStrikeout, FontAttribUnderline


LegendBox.Font.Typeface

This property applies only to graph objects.

Data Type

String

Values

Depends on system


LegendBox.LegendPos

This property applies only to graph objects.

Data Type

SmallInt

Values

Bottom, Right


LegendBox.Pattern.Color

This property applies only to graph objects.

Data Type

LongInt

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


LegendBox.Pattern.Style

This property applies only to graph objects.

Data Type

SmallInt

Values

BricksPattern, CrosshatchPattern, DiagonalCrosshatchPattern, DottedLinePattern, EmptyPattern, FuzzyStripesDownPattern, HeavyDotPattern, HorizontalLinesPattern, LatticePattern, LeftDiagonalLinesPattern, LightDotPattern, MaximumDotPattern, MediumDotPattern, RightDiagonalLinesPattern, ScalesPattern, StaggeredDashesPattern, ThickHorizontalLinesPattern, ThickStripesDownPattern, ThickStripesUpPattern, ThickVerticalLinesPattern, VerticalLinesPattern, VeryHeavyDotPattern, WeavePattern, ZigZagPattern


MaxGroups

This property applies only to graph objects.

Data Type

SmallInt

Values

Depends on graph


MaxXValues

This property applies only to graph objects.

Data Type

SmallInt

Values

Depends on graph


MinXValues

This property applies only to graph objects.

Data Type

SmallInt

Values

Depends on graph


Options.Elevation

This property applies only to graph objects.

Data Type

SmallInt

Values

0 to 90 degrees


Options.Rotation

This property applies only to graph objects.

Data Type

SmallInt

Values

0 to 90 degrees


Options.ShowAxes

This property applies only to graph objects.

Data Type

Logical

Values

True, False


Options.ShowGrid

This property applies only to graph objects.

Data Type

Logical

Values

True, False


Options.ShowLabels

This property applies only to graph objects.

Data Type

Logical

Values

True, False


Options.ShowLegend

This property applies only to graph objects.

Data Type

Logical

Values

True, False


Options.ShowTitle

This property applies only to graph objects.

Data Type

Logical

Values

True, False


Series.Color

This property applies only to graph objects.

Data Type

LongInt

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


Series.Graph_Title.Font.Color

This property applies only to graph objects.

Data Type

LongInt

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


Series.Graph_Title.Font.Size

This property applies only to graph objects.

Data Type

SmallInt

Values

Depends on system


Series.Graph_Title.Font.Style

This property applies only to graph objects.

Data Type

SmallInt

Values

FontAttribBold, FontAttribItalic, FontAttribNormal, FontAttribStrikeout, FontAttribUnderline


Series.Graph_Title.Font.Typeface

This property applies only to graph objects.

Data Type

String

Values

Depends on system


Series.Graph_Title.Text

This property applies only to graph objects.

Data Type

String

Values

N/A


Series.Graph_Title.UseDefault

This property applies only to graph objects.

Data Type

Logical

Values

True, False


Series.Line.Color

This property applies only to graph objects.

Data Type

LongInt

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


Series.Line.LineStyle

This property applies only to graph objects.

Data Type

SmallInt

Values

DashDotDotLine, DashDotLine, DashedLine, DottedLine, NoLine, SolidLine


Series.Line.Thickness

This property applies only to graph objects.

Data Type

SmallInt

Values

LWidth10Points, LWidth1Point, LWidth2Points, LWidth3Points, LWidth6Points, LWidthHairline, LWidthHalfPoint


Series.Marker.Size
Series.Marker.Size (5.0)

This property applies only to graph objects.

Data Type

SmallInt

Values

MarkerSize0, MarkerSize2, MarkerSize4, MarkerSize8, MarkerSize12, MarkerSize18, MarkerSize24, MarkerSize36, MarkerSize54, MarkerSize72


Series.Marker.Style

This property applies only to graph objects.

Data Type

SmallInt

Values

MarkerBoxedCross, MarkerBoxed_Plus, MarkerCross, MarkerFilledBox, MarkerFilledCircle, MarkerFilledDownTriangle, MarkerFilledTriangle, MarkerFilledTriangles, MarkerHollowBox, MarkerHollowCircle, MarkerHollowDownTriangle, MarkerHollowTriangle, MarkerHollowTriangles, MarkerHorizontalLine, MarkerPlus, MarkerVerticalLine


Series.Pattern.Color

This property applies only to graph objects.

Data Type

LongInt

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


Series.Pattern.Style

This property applies only to graph objects.

Data Type

SmallInt

Values

BricksPattern, CrosshatchPattern, DiagonalCrosshatchPattern, DottedLinePattern, EmptyPattern, FuzzyStripesDownPattern, HeavyDotPattern, HorizontalLinesPattern, LatticePattern, LeftDiagonalLinesPattern, LightDotPattern, MaximumDotPattern, MediumDotPattern, RightDiagonalLinesPattern, ScalesPattern, StaggeredDashesPattern, ThickHorizontalLinesPattern, ThickStripesDownPattern, ThickStripesUpPattern, ThickVerticalLinesPattern, VerticalLinesPattern, VeryHeavyDotPattern, WeavePattern, ZigZagPattern


Series.TypeOverride

This property applies only to graph objects.

Data Type

SmallInt

Values

Graph2DArea, Graph2DBar, Graph2DLine, None


SeriesName
SeriesName (5.0)

This property applies only to graph objects.

Data Type

String

Values

N/A


Slice.Color

This property applies only to graph objects.

Data Type

LongInt

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


Slice.Explode

This property applies only to graph objects.

Data Type

Logical

Values

True, False


Slice.Pattern.Color

This property applies only to graph objects.

Data Type

LongInt

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


Slice.Pattern.Style

This property applies only to graph objects.

Data Type

SmallInt

Values

BricksPattern, CrosshatchPattern, DiagonalCrosshatchPattern, DottedLinePattern, EmptyPattern, FuzzyStripesDownPattern, HeavyDotPattern, HorizontalLinesPattern, LatticePattern, LeftDiagonalLinesPattern, LightDotPattern, MaximumDotPattern, MediumDotPattern, RightDiagonalLinesPattern, ScalesPattern, StaggeredDashesPattern, ThickHorizontalLinesPattern, ThickStripesDownPattern, ThickStripesUpPattern, ThickVerticalLinesPattern, VerticalLinesPattern, VeryHeavyDotPattern, WeavePattern, ZigZagPattern


TitleBox.Color

This property applies only to graph objects.

Data Type

LongInt

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


TitleBox.Graph_Title.Font.Color

This property applies only to graph objects.

Data Type

LongInt

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


TitleBox.Graph_Title.Font.Size

This property applies only to graph objects.

Data Type

SmallInt

Values

Depends on system


TitleBox.Graph_Title.Font.Style

This property applies only to graph objects.

Data Type

SmallInt

Values

FontAttribBold, FontAttribItalic, FontAttribNormal, FontAttribStrikeout, FontAttribUnderline


TitleBox.Graph_Title.Font.Typeface

This property applies only to graph objects.

Data Type

String

Values

Depends on system


TitleBox.Graph_Title.Text

This property applies only to graph objects.

Data Type

String

Values

N/A


TitleBox.Graph_Title.UseDefault

This property applies only to graph objects.

Data Type

Logical

Values

True, False


TitleBox.Pattern.Color

This property applies only to graph objects.

Data Type

LongInt

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


TitleBox.Pattern.Style

This property applies only to graph objects.

Data Type

SmallInt

Values

BricksPattern, CrosshatchPattern, DiagonalCrosshatchPattern, DottedLinePattern, EmptyPattern, FuzzyStripesDownPattern, HeavyDotPattern, HorizontalLinesPattern, LatticePattern, LeftDiagonalLinesPattern, LightDotPattern, MaximumDotPattern, MediumDotPattern, RightDiagonalLinesPattern, ScalesPattern, StaggeredDashesPattern, ThickHorizontalLinesPattern, ThickStripesDownPattern, ThickStripesUpPattern, ThickVerticalLinesPattern, VerticalLinesPattern, VeryHeavyDotPattern, WeavePattern, ZigZagPattern


TitleBox.Subtitle.Font.Color

This property applies only to graph objects.

Data Type

LongInt

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


TitleBox.Subtitle.Font.Size

This property applies only to graph objects.

Data Type

SmallInt

Values

Depends on system


TitleBox.Subtitle.Font.Style

This property applies only to graph objects.

Data Type

SmallInt

Values

FontAttribBold, FontAttribItalic, FontAttribNormal, FontAttribStrikeout, FontAttribUnderline


TitleBox.Subtitle.Font.Typeface

This property applies only to graph objects.

Data Type

String

Values

Depends on system


TitleBox.Subtitle.Text

This property applies only to graph objects.

Data Type

String

Values

N/A


TitleBox.Subtitle.UseDefault

This property applies only to graph objects.

Data Type

Logical

Values

True, False


TitleBoxName
TitleBoxName (5.0)

This property applies only to graph objects.

Data Type

String

Values

N/A


XAxisName
XAxisName (5.0)

This property applies only to graph objects.

Data Type

String

Values

N/A


XAxis.Graph_Title.Font.Color

This property applies only to graph objects.

Data Type

LongInt

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


XAxis.Graph_Title.Font.Size

This property applies only to graph objects.

Data Type

SmallInt

Values

Depends on system


XAxis.Graph_Title.Font.Style

This property applies only to graph objects.

Data Type

SmallInt

Values

FontAttribBold, FontAttribItalic, FontAttribNormal, FontAttribStrikeout, FontAttribUnderline


XAxis.Graph_Title.Font.Typeface

This property applies only to graph objects.

Data Type

String

Values

Depends on system


XAxis.Graph_Title.Text

This property applies only to graph objects.

Data Type

String

Values

N/A


XAxis.Graph_Title.UseDefault

This property applies only to graph objects.

Data Type

Logical

Values

True, False


XAxis.Scale.AutoScale

This property applies only to graph objects.

Data Type

Logical

Values

True, False


XAxis.Scale.HighValue

This property applies only to graph objects.

Data Type

Number

Values

Depends on graph


XAxis.Scale.Increment

This property applies only to graph objects.

Data Type

Number

Values

Depends on graph


XAxis.Scale.Logarithmic

This property applies only to graph objects.

Data Type

Logical

Values

True, False


XAxis.Scale.LowValue

This property applies only to graph objects.

Data Type

Number

Values

Depends on graph


XAxis.Ticks.Alternate

This property applies only to graph objects.

Data Type

Logical

Values

True, False


XAxis.Ticks.DateFormat

This property applies only to graph objects.

Data Type

N/A

Values

Format specification


XAxis.Ticks.Font.Color

This property applies only to graph objects.

Data Type

LongInt

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


XAxis.Ticks.Font.Size

This property applies only to graph objects.

Data Type

SmallInt

Values

Depends on system


XAxis.Ticks.Font.Style

This property applies only to graph objects.

Data Type

SmallInt

Values

FontAttribBold, FontAttribItalic, FontAttribNormal, FontAttribStrikeout, FontAttribUnderline


XAxis.Ticks.Font.Typeface

This property applies only to graph objects.

Data Type

String

Values

Depends on system


XAxis.Ticks.NumberFormat

This property applies only to graph objects.

Data Type

N/A

Values

Format specification


XAxis.Ticks.TimeFormat
XAxis.Ticks.TimeFormat (5.0)

This property applies only to graph objects.

Data Type

String

Values

N/A


XAxis.Ticks.TimeStampFormat
XAxis.Ticks.TimeStampFormat (5.0)

This property applies only to graph objects.

Data Type

String

Values

N/A


YAxisName
YAxisName (5.0)

This property applies only to graph objects.

Data Type

String

Values

N/A


YAxis.Graph_Title.Font.Color

This property applies only to graph objects.

Data Type

LongInt

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


YAxis.Graph_Title.Font.Size

This property applies only to graph objects.

Data Type

SmallInt

Values

Depends on system


YAxis.Graph_Title.Font.Style

This property applies only to graph objects.

Data Type

SmallInt

Values

FontAttribBold, FontAttribItalic, FontAttribNormal, FontAttribStrikeout, FontAttribUnderline


YAxis.Graph_Title.Font.Typeface

This property applies only to graph objects.

Data Type

String

Values

Depends on system


YAxis.Graph_Title.Text
YAxis.Graph_Title.Text (5.0)

This property applies only to graph objects.

Data Type

String

Values

N/A


YAxis.Graph_Title.UseDefault

This property applies only to graph objects.

Data Type

Logical

Values

True, False


YAxis.Scale.AutoScale

This property applies only to graph objects.

Data Type

Logical

Values

True, False


YAxis.Scale.HighValue

This property applies only to graph objects.

Data Type

Number

Values

Depends on graph


YAxis.Scale.Increment

This property applies only to graph objects.

Data Type

Number

Values

Depends on graph


YAxis.Scale.Logarithmic

This property applies only to graph objects.

Data Type

Logical

Values

True, False


YAxis.Scale.LowValue

This property applies only to graph objects.

Data Type

Number

Values

Depends on graph


YAxis.Ticks.Alternate

This property applies only to graph objects.

Data Type

Logical

Values

True, False


YAxis.Ticks.DateFormat

This property applies only to graph objects.

Data Type

N/A

Values

Format specification


YAxis.Ticks.Font.Color

This property applies only to graph objects.

Data Type

LongInt

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


YAxis.Ticks.Font.Size

This property applies only to graph objects.

Data Type

SmallInt

Values

Depends on system


YAxis.Ticks.Font.Style

This property applies only to graph objects.

Data Type

SmallInt

Values

FontAttribBold, FontAttribItalic, FontAttribNormal, FontAttribStrikeout, FontAttribUnderline


YAxis.Ticks.Font.Typeface

This property applies only to graph objects.

Data Type

String

Values

Depends on system


YAxis.Ticks.NumberFormat

This property applies only to graph objects.

Data Type

N/A

Values

Format specification


YAxis.Ticks.TimeFormat
YAxis.Ticks.TimeFormat (5.0)

This property applies only to graph objects.

Data Type

String

Values

N/A


YAxis.Ticks.TimeStampFormat
YAxis.Ticks.TimeStampFormat (5.0)

This property applies only to graph objects.

Data Type

String

Values

N/A


ZAxisName
ZAxisName (5.0)

This property applies only to graph objects.

Data Type

String

Values

N/A


ZAxis.Graph_Title.Font.Color

This property applies only to graph objects.

Data Type

LongInt

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


ZAxis.Graph_Title.Font.Size

This property applies only to graph objects.

Data Type

SmallInt

Values

Depends on system


ZAxis.Graph_Title.Font.Style

This property applies only to graph objects.

Data Type

SmallInt

Values

FontAttribBold, FontAttribItalic, FontAttribNormal, FontAttribStrikeout, FontAttribUnderline


ZAxis.Graph_Title.Font.Typeface

This property applies only to graph objects.

Data Type

String

Values

Depends on system


ZAxis.Graph_Title.Text
ZAxis.Graph_Title.Text (5.0)

This property applies only to graph objects.

Data Type

String

Values

N/A


ZAxis.Graph_Title.UseDefault

This property applies only to graph objects.

Data Type

Logical

Values

True, False


ZAxis.Scale.AutoScale

This property applies only to graph objects.

Data Type

Logical

Values

True, False


ZAxis.Scale.HighValue

This property applies only to graph objects.

Data Type

Number

Values

Depends on graph


ZAxis.Scale.Increment

This property applies only to graph objects.

Data Type

Number

Values

Depends on graph


ZAxis.Scale.Logarithmic

This property applies only to graph objects.

Data Type

Logical

Values

True, False


ZAxis.Scale.LowValue

This property applies only to graph objects.

Data Type

Number

Values

Depends on graph


ZAxis.Ticks.Alternate

This property applies only to graph objects.

Data Type

Logical

Values

True, False


ZAxis.Ticks.DateFormat
ZAxis.Ticks.DateFormat (5.0)

This property applies only to graph objects.

Data Type

String

Values

N/A


ZAxis.Ticks.Font.Color

This property applies only to graph objects.

Data Type

LongInt

Values

Black, Blue, Brown, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, Gray, Green, LightBlue, Magenta, Red, White, Yellow, Transparent


ZAxis.Ticks.Font.Size

This property applies only to graph objects.

Data Type

SmallInt

Values

Depends on system


ZAxis.Ticks.Font.Style

This property applies only to graph objects.

Data Type

SmallInt

Values

FontAttribBold, FontAttribItalic, FontAttribNormal, FontAttribStrikeout, FontAttribUnderline


ZAxis.Ticks.Font.Typeface

This property applies only to graph objects.

Data Type

String

Values

Depends on system


ZAxis.Ticks.NumberFormat
ZAxis.Ticks.NumberFormat (5.0)

This property applies only to graph objects.

Data Type

String

Values

N/A


ZAxis.Ticks.TimeFormat
ZAxis.Ticks.TimeFormat (5.0)

This property applies only to graph objects.

Data Type

String

Values

N/A


ZAxis.Ticks.TimeStampFormat
ZAxis.Ticks.TimeStampFormat (5.0)

This property applies only to graph objects.

Data Type

String

Values

N/A


UIObject Properties

See Also

Choose from the following UIObjects for a list of applicable properties.

Band

Bitmap

Box

Button

Cell

Crosstab

EditRegion

Ellipse

Field

Form

Graph

Group

Header

Line

List

Multirecord

OLE

Page

Record

TableFrame

TableView

Text

TVData

TVHeading


See Also for UIObject Properties
See Also

Properties and Property Values

Properties Unique to Graph Objects


Band
Band Properties

Arrived (read-only)

BottomBorder (read-only) (5.0)

Breakable

Class (read-only)

ContainerName (read-only)

DefineGroup

FieldName

First (read-only)

Focus (read-only)

FullName (read-only)

FullSize (read-only)

GroupRecords (5.0)

Headings

LeftBorder (read-only) (5.0)

Manager (read-only)

Name

Next (read-only)

OtherBandName (read-only) (5.0)

Owner (read-only)

Position

PositionalOrder (5.0)

PrecedePageHeader

Prev (read-only)

PrintOn1stPage

Range (5.0)

RightBorder (read-only) (5.0)

Scroll

Select (4.5)

Shrinkable

Size

SortOrder

StartPageNumbers (read-only) (5.0)

TopBorder (read-only) (5.0)


Bitmap
Bitmap Properties

Arrived (read-only)

BottomBorder (read-only) (5.0)

Class (read-only)

ContainerName (read-only)

Design.ContainObjects

Design.PinHorizontal

Design.PinVertical

Design.Selectable (4.5)

Design.SizeToFit

First (read-only)

Focus (read-only)

Frame.Color

Frame.Style

Frame.Thickness

FullName (read-only)

FullSize (read-only)

HorizontalScrollBar

LeftBorder (read-only) (5.0)

Magnification

Manager (read-only)

Name

Next (read-only)

NextTabStop (5.0)

Owner (read-only)

Position

Prev (read-only)

RasterOperation

RightBorder (read-only) (5.0)

Scroll

Select (4.5)

Size

TopBorder (read-only) (5.0)

Value

VerticalScrollBar

Visible


Box
Box Properties

Arrived (read-only)

BottomBorder (read-only) (5.0)

Breakable

Class (read-only)

Color

ContainerName (read-only)

Design.ContainObjects

Design.PinHorizontal

Design.PinVertical

Design.Selectable (4.5)

First (read-only)

Focus (read-only)

Frame.Color

Frame.Style

Frame.Thickness

FullName (read-only)

FullSize (read-only)

Invisible (5.0)

LeftBorder (read-only) (5.0)

Manager (read-only)

Name

Next (read-only)

Owner (read-only)

Pattern.Color

Pattern.Style

Position

Prev (read-only)

RightBorder (read-only) (5.0)

Select (4.5)

Shrinkable

Size

TopBorder (read-only) (5.0)

Translucent

Visible


Button
Button Properties

Arrived (read-only)

BottomBorder (read-only) (5.0)

ButtonType

CenterLabel

CheckedValue (5.0)

Class (read-only)

ContainerName (read-only)

Design.ContainObjects

Design.PinHorizontal

Design.PinVertical

Design.Selectable (4.5)

First (read-only)

FitHeight

FitWidth

Focus (read-only)

FullName (read-only)

FullSize (read-only)

LabelText

LeftBorder (read-only) (5.0)

Manager (read-only)

Name

Next (read-only)

NextTabStop (5.0)

Owner (read-only)

Position

Prev (read-only)

RightBorder (read-only) (5.0)

Select (4.5)

Size

Style

TabStop

TopBorder (read-only) (5.0)

UncheckedValue (5.0)

Value

Visible


Cell
Cell Properties

Arrived (read-only)

BottomBorder (read-only) (5.0)

Class (read-only)

Color

ContainerName (read-only)

Design.ContainObjects

Design.PinHorizontal

Design.PinVertical

Design.Selectable (4.5)

Design.SizeToFit

First (read-only)

FitWidth

Focus (read-only)

FullName (read-only)

FullSize (read-only)

HorizontalScrollBar

LeftBorder (read-only) (5.0)

Manager (read-only)

Name

Next (read-only)

NextTabStop (5.0)

Owner (read-only)

Position

Prev (read-only)

RightBorder (read-only) (5.0)

Scroll

Select (4.5)

Size

TopBorder (read-only) (5.0)

VerticalScrollBar


Crosstab
Crosstab Properties

Arrived (read-only)

Breakable

Class (read-only)

Color

ContainerName (read-only)

CurrentColumn (5.0)

CurrentRow (5.0)

Design.ContainObjects

Design.PinHorizontal

Design.PinVertical

Design.Selectable (4.5)

Design.SizeToFit

First (read-only)

FitHeight

FitWidth

Focus (read-only)

FullName (read-only)

FullSize (read-only)

Grid.Color

Grid.GridStyle

HorizontalScrollBar

Manager (read-only)

Name

Next (read-only)

NextTabStop (5.0)

Owner (read-only)

Position

Prev (read-only)

Scroll

Select (4.5)

Size

TableName

Touched (read-only)

Translucent

VerticalScrollBar

Visible


EditRegion
EditRegion Properties

Alignment

Arrived (read-only)

AvgCharSize (read-only) (5.0)

BottomBorder (read-only) (5.0)

Breakable

Class (read-only)

Color

CompleteDisplay

ContainerName (read-only)

Design.ContainObjects

Design.PinHorizontal

Design.PinVertical

Design.Selectable (4.5)

Design.SizeToFit

DisplayType (read-only)

First (read-only)

FitHeight

FitWidth

Focus (read-only)

Font.Color

Font.Size

Font.Style

Font.Typeface

Format.DateFormat

Format.LogicalFormat

Format.NumberFormat

Format.TimeFormat

Format.TimeStampFormat

Frame.Color

Frame.Style

Frame.Thickness

FullName (read-only)

FullSize (read-only)

LeftBorder (read-only) (5.0)

Magnification

Manager (read-only)

Name

Next (read-only)

NextTabStop (5.0)

NoEcho

Owner (read-only)

Position

Prev (read-only)

RasterOperation

Readonly

RightBorder (read-only) (5.0)

Scroll

Select (4.5)

Size

TabStop

Text

TopBorder (read-only) (5.0)

Translucent

Value

Visible

WordWrap


Ellipse
Ellipse Properties

Arrived (read-only)

BottomBorder (read-only) (5.0)

Class (read-only)

Color

ContainerName (read-only)

Design.ContainObjects

Design.PinHorizontal

Design.PinVertical

Design.Selectable (4.5)

First (read-only)

Focus (read-only)

FullName (read-only)

FullSize (read-only)

LeftBorder (read-only) (5.0)

Line.Color

Line.LineStyle

Line.Thickness

Manager (read-only)

Name

Next (read-only)

NextTabStop (5.0)

Owner (read-only)

Pattern.Color

Pattern.Style

Position

Prev (read-only)

RightBorder (read-only) (5.0)

Select (4.5)

Shrinkable

Size

TopBorder (read-only) (5.0)

Translucent

Visible


Field
Field Properties

Alignment

Arrived (read-only)

AutoAppend (4.5)

AvgCharSize (read-only) (5.0)

BlankRecord (read-only)

BottomBorder (read-only) (5.0)

Breakable

CalculatedField (5.0)

Class (read-only)

Color

CompleteDisplay

ContainerName (read-only)

CursorColumn

CursorLine

CursorPos

Default (read-only)

Deleted (read-only)

DeleteWhenEmpty (5.0)

Design.ContainObjects

Design.PinHorizontal

Design.PinVertical

Design.Selectable (4.5)

Design.SizeToFit

DisplayType

Editing (read-only) (4.5)

FieldName

FieldNo (read-only)

FieldRights (read-only)

FieldSize (read-only)

FieldType (read-only)

FieldUnits2 (read-only)

FieldValid (read-only)

First (read-only)

FitHeight

FitWidth

FlyAway (read-only)

Focus (read-only)

Font.Color

Font.Size

Font.Style

Font.Typeface

Format.DateFormat

Format.LogicalFormat

Format.NumberFormat

Format.TimeFormat

Format.TimeStampFormat

Frame.Color

Frame.Style

Frame.Thickness

FullName (read-only)

FullSize (read-only)

HorizontalScrollBar

IndexField (read-only)

Inserting (read-only)

KeyField (read-only)

LabelText

LeftBorder (read-only) (5.0)

Locked (read-only)

LookupTable (read-only)

LookupType (read-only)

Magnification

Manager (read-only)

MarkerPos

Maximum (read-only)

Minimum (read-only)

Name

Next (read-only)

NextTabStop (5.0)

NoEcho

NRecords (read-only)

OverStrike

Owner (read-only)

Pattern.Color

Pattern.Style

Picture (enhanced for 5.0)

Position

Prev (read-only)

RasterOperation

Readonly

RecNo (read-only)

Refresh (read-only)

Required (read-only)

RightBorder (read-only) (5.0)

RowNo (read-only)

Scroll

Select (4.5)

SelectedText

SeqNo (read-only)

Size

SpecialField (5.0)

SummaryModifier (5.0)

TableName

TabStop

Text

TopBorder (read-only) (5.0)

TopLine

Touched (read-only)

Translucent

UpdateLink (5.0)

Value

VerticalScrollBar

Visible

WideScrollBar (5.0)

WordWrap


Form
Form Properties

Arrived (read-only)

AutoAppend (4.5)

BlankRecord (read-only)

Border

Caption

Class (read-only)

ContainerName (read-only)

ControlMenu

Deleted (read-only)

DesignModified (4.5)

DesktopForm

DialogForm

DialogFrame

Editing (read-only) (4.5)

FieldView (read-only)

First (read-only)

FlyAway (read-only)

Focus (read-only)

FrameObjects (5.0)

FullName (read-only)

FullSize (read-only)

GridValue (5.0)

GroupObjects (5.0)

HorizontalScrollBar

Inserting (read-only)

Locked (read-only)

Manager (read-only)

MaximizeButton

MemoView (read-only)

MinimizeButton

Modal

MouseActivate

Name

Next (read-only)

NRecords (read-only)

PageTiling (5.0)

PersistView (read-only)

Position

Prev (read-only)

PrinterDocument (5.0)

RecNo (read-only)

Refresh (read-only)

Scroll

SeeMouseMove (5.0)

SeqNo (read-only)

ShowGrid  (5.0)

Size (read-only)

SizeToFit

SnapToGrid (5.0)

StandardMenu

StandardToolbar (5.0)

TableName (read-only)

ThickFrame

Title

Touched (read-only)

VerticalScrollBar


Graph
Graph Properties

Arrived (read-only)

Background.Color

Background.Pattern.Color

Background.Pattern.Style

BackWall.Color

BackWall.Pattern.Color

BackWall.Pattern.Style

BaseFloor.Color

BaseFloor.Pattern.Color

BaseFloor.Pattern.Style

BindType

BottomBorder (read-only) (5.0)

Class (read-only)

Color

ContainerName (read-only)

CurrentSeries

CurrentSlice

Design.ContainObjects

Design.PinHorizontal

Design.PinVertical

Design.Selectable (4.5)

First (read-only)

Focus (read-only)

Frame.Color

Frame.Style

Frame.Thickness

FullName (read-only)

FullSize (read-only)

GraphType

Label.Font.Color

Label.Font.Size

Label.Font.Style

Label.Font.Typeface

Label.LabelFormat

Label.LabelLocation

Label.NumberFormat

LeftBorder (read-only) (5.0)

LeftWall.Color

LeftWall.Pattern.Color

LeftWall.Pattern.Style

LegendBox.Color

LegendBox.Font.Color

LegendBox.Font.Size

LegendBox.Font.Style

LegendBox.Font.Typeface

LegendBox.LegendPos

LegendBox.Pattern.Color

LegendBox.Pattern.Style

Manager (read-only)

MaxGroups

MaxXValues

MinXValues

Name

Next (read-only)

NextTabStop (5.0)

Options.Elevation

Options.Rotation

Options.ShowAxes

Options.ShowGrid

Options.ShowLabels

Options.ShowLegend

Options.ShowTitle

Owner (read-only)

Pattern.Color

Pattern.Style

Position

Prev (read-only)

RightBorder (read-only) (5.0)

Scroll

Select (4.5)

Series.Color

Series.Graph_Title.Font.Color

Series.Graph_Title.Font.Size

Series.Graph_Title.Font.Style

Series.Graph_Title.Font.Typeface

Series.Graph_Title.Text

Series.Graph_Title.UseDefault

Series.Line.Color

Series.Line.LineStyle

Series.Line.Thickness

Series.Marker.Size (5.0)

Series.Marker.Style (5.0)

Series.Pattern.Color

Series.Pattern.Style

Series.TypeOverride

SeriesName (5.0)

Size

Slice.Color

Slice.Explode

Slice.Pattern.Color

Slice.Pattern.Style

TableName

TabStop

TitleBox.Color

TitleBox.Graph_Title.Font.Color

TitleBox.Graph_Title.Font.Size

TitleBox.Graph_Title.Font.Style

TitleBox.Graph_Title.Font.Typeface

TitleBox.Graph_Title.Text

TitleBox.Graph_Title.UseDefault

TitleBox.Pattern.Color

TitleBox.Pattern.Style

TitleBox.Subtitle.Font.Color

TitleBox.Subtitle.Font.Size

TitleBox.Subtitle.Font.Style

TitleBox.Subtitle.Font.Typeface

TitleBox.Subtitle.Text

TitleBox.Subtitle.UseDefault

TitleBoxName (5.0)

TopBorder (read-only) (5.0)

Touched (read-only)

Translucent

Visible

XAxisName (5.0)

XAxis.Graph_Title.Font.Color

XAxis.Graph_Title.Font.Size

XAxis.Graph_Title.Font.Style

XAxis.Graph_Title.Font.Typeface

XAxis.Graph_Title.Text

XAxis.Graph_Title.UseDefault

XAxis.Scale.AutoScale

XAxis.Scale.HighValue

XAxis.Scale.Increment

XAxis.Scale.Logarithmic

XAxis.Scale.LowValue

XAxis.Ticks.Alternate

XAxis.Ticks.DateFormat

XAxis.Ticks.Font.Color

XAxis.Ticks.Font.Size

XAxis.Ticks.Font.Style

XAxis.Ticks.Font.Typeface

XAxis.Ticks.NumberFormat

XAxis.Ticks.TimeFormat (5.0)

XAxis.Ticks.TimeStampFormat (5.0)

YAxisName (5.0)

YAxis.Graph_Title.Font.Color

YAxis.Graph_Title.Font.Size

YAxis.Graph_Title.Font.Style

YAxis.Graph_Title.Font.Typeface

YAxis.Graph_Title.Text (5.0)

YAxis.Graph_Title.UseDefault

YAxis.Scale.AutoScale

YAxis.Scale.HighValue

YAxis.Scale.Increment

YAxis.Scale.Logarithmic

YAxis.Scale.LowValue

YAxis.Ticks.Alternate

YAxis.Ticks.DateFormat

YAxis.Ticks.Font.Color

YAxis.Ticks.Font.Size

YAxis.Ticks.Font.Style

YAxis.Ticks.Font.Typeface

YAxis.Ticks.NumberFormat

YAxis.Ticks.TimeFormat (5.0)

YAxis.Ticks.TimeStampFormat (5.0)

ZAxisName (5.0)

ZAxis.Graph_Title.Font.Color

ZAxis.Graph_Title.Font.Size

ZAxis.Graph_Title.Font.Style

ZAxis.Graph_Title.Font.Typeface

ZAxis.Graph_Title.Text (5.0)

ZAxis.Graph_Title.UseDefault

ZAxis.Scale.AutoScale

ZAxis.Scale.HighValue

ZAxis.Scale.Increment

ZAxis.Scale.Logarithmic

ZAxis.Scale.LowValue

ZAxis.Ticks.Alternate

ZAxis.Ticks.DateFormat

ZAxis.Ticks.Font.Color

ZAxis.Ticks.Font.Size

ZAxis.Ticks.Font.Style

ZAxis.Ticks.Font.Typeface

ZAxis.Ticks.NumberFormat (5.0)

ZAxis.Ticks.TimeFormat (5.0)

ZAxis.Ticks.TimeStampFormat (5.0)


Group
Group Properties

Arrived (read-only)

BottomBorder (read-only) (5.0)

Breakable

Class (read-only)

ContainerName (read-only)

Design.PinHorizontal

Design.PinVertical

Design.Selectable (4.5)

First (read-only)

Focus (read-only)

FullName (read-only)

FullSize (read-only)

LeftBorder (read-only) (5.0)

Manager (read-only)

Name

Next (read-only)

Owner (read-only)

Position

Prev (read-only)

RightBorder (read-only) (5.0)

Select (4.5)

Size

TopBorder (read-only) (5.0)

Visible


Header
Header Properties

Arrived (read-only)

BottomBorder (read-only) (5.0)

Class (read-only)

Color

ContainerName (read-only)

Design.ContainObjects

Design.PinHorizontal

Design.PinVertical

Design.Selectable (4.5)

First (read-only)

Focus (read-only)

FullName (read-only)

FullSize (read-only)

Invisible

LeftBorder (read-only) (5.0)

Manager (read-only)

Name

Next (read-only)

NextTabStop (5.0)

Owner (read-only)

Position

Prev (read-only)

RightBorder (read-only) (5.0)

Scroll

Select (4.5)

Size

TopBorder (read-only) (5.0)

Translucent

Visible


Line
Line Properties

Arrived (read-only)

BottomBorder (read-only) (5.0)

Breakable

Class (read-only)

Color

ContainerName (read-only)

Design.PinHorizontal

Design.PinVertical

Design.Selectable (4.5)

End

First (read-only)

Focus (read-only)

FullName (read-only)

FullSize (read-only)

Invisible

LeftBorder (read-only) (5.0)

LineEnds

LineStyle

LineType

Manager (read-only)

Name

Next (read-only)

Owner (read-only)

Position

Prev (read-only)

RightBorder (read-only) (5.0)

Select (4.5)

Size

Start

Thickness

TopBorder (read-only) (5.0)

Visible


List
List Properties

Arrived (read-only)

BottomBorder (read-only) (5.0)

Class (read-only)

ContainerName (read-only)

DataSource

Design.PinHorizontal

Design.PinVertical

Design.Selectable (4.5)

First (read-only)

FitHeight

FitWidth

Focus (read-only)

FullName (read-only)

FullSize (read-only)

LeftBorder (read-only) (5.0)

List.Count

List.Selection

List.Value

Manager (read-only)

Name

Next (read-only)

Owner (read-only)

Position

Prev (read-only)

RightBorder (read-only) (5.0)

Scroll

Select (4.5)

Size

TopBorder (read-only) (5.0)

Visible

WideScrollBar (5.0)


Multirecord
Multirecord Properties

Arrived (read-only)

AutoAppend (4.5)

BlankRecord (read-only)

BottomBorder (read-only) (5.0)

Breakable

ByRows (5.0)

Class (read-only)

Color

Columnar (4.5)

ContainerName (read-only)

CurrentColumn (5.0)

CurrentRow (5.0)

Deleted (read-only)

Editing (4.5)

First (read-only)

FirstRow (read-only) (5.0)

FitHeight

FitWidth

FlyAway (read-only)

Focus (read-only)

Frame.Color

Frame.Style

Frame.Thickness

FullName (read-only)

FullSize (read-only)

Inserting (read-only)

LeftBorder (read-only) (5.0)

Locked (read-only)

Manager (read-only)

Name

NCols

Next (read-only)

NRecords (read-only)

NRows

Owner (read-only)

Pattern.Color

Pattern.Style

Position

Prev (read-only)

Readonly (read-only)

RecNo (read-only)

Refresh (read-only)

RightBorder (read-only) (5.0)

RowNo (read-only)

Scroll

Select (4.5)

SeqNo (read-only)

Size

TableName

TopBorder (read-only) (5.0)

Touched

Translucent

VerticalScrollBar

Visible

WideScrollBar (5.0)

Xseparation (5.0)

Yseparation (5.0)


OLE
OLE Properties

Arrived (read-only)

BottomBorder (read-only) (5.0)

Class (read-only)

ContainerName (read-only)

Design.ContainObjects

Design.PinHorizontal

Design.PinVertical

Design.Selectable (4.5)

Design.SizeToFit

First (read-only)

Focus (read-only)

Frame.Color

Frame.Style

Frame.Thickness

FullName (read-only)

FullSize (read-only)

HorizontalScrollBar

LeftBorder (read-only) (5.0)

Magnification

Manager (read-only)

Name

Next (read-only)

NextTabStop (5.0)

Owner (read-only)

Position

Prev (read-only)

RightBorder (read-only) (5.0)

Scroll

Select (4.5)

Size

TopBorder (read-only) (5.0)

UpdateLink (5.0)

Value

VerticalScrollBar

Visible

WideScrollBar (5.0)


Page
Page Properties

Arrived (read-only)

BottomBorder (read-only) (5.0)

Class (read-only)

Color

ContainerName (read-only)

First (read-only)

Focus (read-only)

FullName (read-only)

FullSize (read-only)

LeftBorder (read-only) (5.0)

Manager (read-only)

Name

Next (read-only)

Owner (read-only)

Pattern.Color

Pattern.Style

Position (read-only)

PositionalOrder (5.0)

Prev (read-only)

RightBorder (read-only) (5.0)

Scroll

Select (4.5)

Size

TopBorder (read-only) (5.0)

Translucent

Visible


Record
Record Properties

Arrived (read-only)

AutoAppend (4.5)

BlankRecord (read-only)

BottomBorder (read-only) (5.0)

Breakable

Class (read-only)

Color

ContainerName (read-only)

Deleted (read-only)

DeleteWhenEmpty (5.0)

Design.ContainObjects

Design.PinHorizontal

Design.PinVertical

Design.Selectable (4.5)

Design.SizeToFit

Editing (read-only) (4.5)

First (read-only)

FitHeight

FitWidth

FlyAway (read-only)

Focus (read-only)

Frame.Color

Frame.Style

Frame.Thickness

FullName (read-only)

FullSize (read-only)

Inserting (read-only)

LeftBorder (read-only) (5.0)

Locked (read-only)

Manager (read-only)

Name

Next (read-only)

NRecords (read-only)

Owner (read-only)

Pattern.Color

Pattern.Style

Position

Prev (read-only)

Readonly

RecNo (read-only)

Refresh (read-only)

RightBorder (read-only) (5.0)

RowNo (read-only)

Scroll

Select (4.5)

SeqNo (read-only)

Shrinkable

Size

TableName (read-only)

TopBorder (read-only) (5.0)

Touched

Translucent

Visible


TableFrame
TableFrame Properties

Arrived (read-only)

AttachedHeader (read-only) (5.0)

AutoAppend (4.5)

BlankRecord (read-only)

BottomBorder (read-only) (5.0)

Breakable

Class (read-only)

Color

ColumnPosition (5.0)

ColumnWidth (5.0)

ContainerName (read-only)

CurrentColumn (5.0)

CurrentRow (5.0)

DeleteColumn (5.0)

Deleted (read-only)

DeleteWhenEmpty (5.0)

Design.PinHorizontal

Design.PinVertical

Design.Selectable (4.5)

Design.SizeToFit

Editing (read-only) (4.5)

First (read-only)

FirstRow (read-only) (5.0)

FitHeight

FitWidth

FlyAway (read-only)

Focus (read-only)

FullName (read-only)

FullSize (read-only)

Grid.Color

Grid.GridStyle

Grid.RecordDivider

Header (read-only) (5.0)

HorizontalScrollBar

InsertColumn (5.0)

Inserting (read-only)

LeftBorder (read-only) (5.0)

Locked (read-only)

Manager (read-only)

Name

NCols

Next (read-only)

NextTabStop (5.0)

NRecords (read-only)

NRows

Owner (read-only)

Pattern.Color

Pattern.Style

PersistView (read-only)

Position

Prev (read-only)

Readonly (read-only)

RecNo (read-only)

Refresh (read-only)

RepeatHeader (5.0)

RightBorder (read-only) (5.0)

RowNo (read-only)

Scroll

Select (4.5)

SeqNo (read-only)

Size

TableName

TopBorder (read-only) (5.0)

Touched

Translucent

VerticalScrollBar

Visible

WideScrollBar (5.0)


TableView
TableView Properties

Arrived (read-only)

BlankRecord (read-only)

BottomBorder (read-only) (5.0)

Class (read-only)

Color

ContainerName (read-only)

CurrentRecordMarker.Color

CurrentRecordMarker.LineStyle

CurrentRecordMarker.Show

Deleted (read-only)

Editing (read-only) (4.5)

FieldName (read-only)

FieldNo (read-only)

FieldView (read-only)

Focus (read only)

FullName (read-only)

FullSize (read-only)

GridLines.Color

GridLines.ColumnLines

GridLines.HeadingLines

GridLines.LineStyle

GridLines.QueryLook (5.0)

GridLines.RowLines

GridLines.Spacing

HeadingHeight (5.0)

Inserting (read-only)

LeftBorder (read-only) (5.0)

Locked (read-only)

Manager (read-only)

MemoView (read-only)

Name (read-only)

NCols (read-only)

NRecords (read-only)

NRows (read-only)

Owner (read-only)

PersistView (read-only)

Position

Readonly (read-only)

RecNo (read-only)

Refresh (read-only)

RightBorder (read-only) (5.0)

RowHeight (5.0)

RowNo

Scroll

Select (4.5)

SeqNo (read-only)

Size

TableName (read-only)

TopBorder (read-only) (5.0)

Touched (read-only)


Text
Text Properties

Alignment

Arrived (read-only)

AvgCharSize (read-only) (5.0)

BottomBorder (read-only) (5.0)

Breakable

Class (read-only)

Color

ContainerName (read-only)

CursorColumn

CursorLine

CursorPos

Design.ContainObjects

Design.PinHorizontal

Design.PinVertical

Design.Selectable (4.5)

Design.SizeToFit

DesignSizing

First (read-only)

FitHeight

FitWidth

Focus (read-only)

Font.Color

Font.Size

Font.Style

Font.Typeface

Frame.Color

Frame.Style

Frame.Thickness

FullName (read-only)

FullSize (read-only)

HorizontalScrollBar

InsertField (5.0)

LeftBorder (read-only) (5.0)

LineSpacing

Manager (read-only)

MarkerPos

Name

Next (read-only)

OverStrike

Owner (read-only)

Pattern.Color

Pattern.Style

Position

Prev (read-only)

RightBorder (read-only) (5.0)

Scroll

Select (4.5)

SelectedText

Size

Text

TopBorder (read-only) (5.0)

TopLine

Translucent

Value

VerticalScrollBar

Visible

WideScrollBar (5.0)

WordWrap


TVData
TVData Properties

Alignment

Arrived (read-only)

BlankRecord (read-only)

BottomBorder (read-only) (5.0)

Class (read-only)

Color

CompleteDisplay

ContainerName (read-only)

Default (read-only)

Deleted (read-only)

Design.ContainObjects

Design.PinHorizontal

Design.PinVertical

Design.Selectable (4.5)

Design.SizeToFit

Editing (read-only) (4.5)

FieldName (read-only)

FieldNo (read-only)

FieldRights (read-only)

FieldSize (read-only)

FieldType (read-only)

FieldUnits2 (read-only)

First (read-only)

Focus (read only)

Font.Color

Font.Size

Font.Style

Font.Typeface

Format.DateFormat

Format.LogicalFormat

Format.NumberFormat

Format.TimeFormat

Format.TimeStampFormat

FullName (read-only)

FullSize (read-only)

IndexField (read-only)

Inserting

KeyField (read-only)

LeftBorder (read-only) (5.0)

Locked (read-only)

LookupTable (read-only)

LookupType (read-only)

Magnification

Manager (read-only)

Maximum (read-only)

Minimum (read-only)

Name

NextTabStop (5.0)

NRecords (read-only)

Owner (read-only)

Picture (read-only)

Position

RecNo (read-only)

Refresh (read-only)

Required (read-only)

RightBorder (read-only) (5.0)

RowNo (read-only)

Scroll

Select (4.5)

SeqNo (read-only)

Size

TableName (read-only)

TopBorder (read-only) (5.0)

Touched (read-only)

UpdateLink (5.0)

Value

Width (5.0)


TVHeading
TVHeading Properties

Alignment

Arrived (read-only)

BottomBorder (read-only) (5.0)

Class (read-only)

Color

ContainerName (read-only)

Design.ContainObjects

Design.PinHorizontal

Design.PinVertical

Design.Selectable (4.5)

Design.SizeToFit

Focus (read-only)

Font.Color

Font.Size

Font.Style

Font.Typeface

FullName (read-only)

FullSize (read-only)

LeftBorder (read-only) (5.0)

Manager (read-only)

Name

Owner (read-only)

Position

RightBorder (read-only) (5.0)

Scroll

Select (4.5)

Size

TopBorder (read-only) (5.0)


List of Built-in Methods

See Also

The following table lists built-in methods for internal and external events, and the special built-in methods. Choose one of the following methods for more information:

Internal	External	Special

arrive	action	pushButton

canArrive	error	changeValue

canDepart	keyChar	newValue

close	keyPhysical

depart	menuAction

mouseEnter	mouseClick

mouseExit	mouseDouble

open	mouseDown

removeFocus	mouseMove

setFocus	mouseRightDouble

timer	mouseRightDown

mouseRightUp

mouseUp

status


See Also

About Built-in Methods

Attaching Code to Built-in Methods

Built-in Object Variables

Keywords

Sequence of Execution


About Built-in Methods

See Also	Built-in Methods

Every object in a form (and the form itself) has built-in methods for handling events. Built-in methods have the same names as the events that trigger them. For example, changing a value trigger's an object's built-in changeValue method, pressing the mouse button triggers the built-in mouseDown method, and releasing the mouse button triggers the built-in mouseUp method. The behavior of an object is simply the combined effects of its built-in methods.

There are three kinds of built-in methods in ObjectPAL:

Built-in methods for internal events

Built-in methods for external events

Special built-in methods

Built-in Methods for Internal Events

Internal events are generated internally by ObjectPAL. Like all events, internal events go to the form first, which dispatches them to the target object. Internal events do not bubble up through the containership hierarchy.

Built-in Methods for External Events

External events are typically generated by user actions, although they can also be generated by ObjectPAL statements. Processing for all external events begins with the form, which acts as a dispatcher. An external event bubbles up the containership hierarchy if an object doesn't handle it.

Note:	Unless otherwise noted, the default behavior for most objects and built-in methods is to pass the event up the containership hierarchy.

Special Built-in Methods

Special built-in methods are additional methods built into a few specific objects.


See Also

Attaching Code to Built-in Methods

Sequence of Execution


Attaching Code to Built-in Methods

See Also	Built-in Methods

You can attach code to any built-in method by opening an ObjectPAL Editor window and typing some code. For example, every design object has a built-in mouseClick method that performs some default behavior when you click that object. To change that behavior, inspect the object, choose Methods from the Properties menu, then choose mouseClick from the list of methods to open an ObjectPAL Editor window. Type your code and save it. Now your code executes whenever this object's mouseClick method is called.

The built-in code executes too, after your code (just before the endMethod keyword).

The built-in code is implicit and executes automatically. But, if you want to change the default behavior--for example, call the built-in code before your code, or block it from executing--you can. First, though, you should understand the default behavior for each built-in method.

As a general rule, if you attach code to an object's built-in open method, you should call doDefault before calling any other method or procedure. The call to doDefault executes the built-in code so you can be sure the object is completely opened and initialized.


See Also

About Built-in Methods

Sequence of Execution

disableDefault

doDefault

enableDefault


Sequence of Execution

See Also	Built-in Methods

The following figure shows the sequence in which built-in methods execute when you move from one field object to another (for example, by pressing Tab). In this example, the field object you're moving from is named fromField, the one you're moving to is named toField.


See Also

About Built-in Methods

Attaching Code to Built-in Methods


open (built-in method)
open

Built-in Methods

open is called once for every object on the form, starting from the form and working down each container in turn. For every object, the default code for the open method calls the open method for each of its child objects (that is, the objects one level below it in the containership hierarchy). In other words, by default, the form's open calls the open for each page in the form, and each page's open calls open for each object on the page, and so on.

Note:	The form's open method opens all tables in the form's data model before any other objects are opened. If aliases are required to open any of the tables, specify them before executing the default code for open.

An error from any object prevents a form from opening. Also, explicitly setting an error code in an open methods event packet prevents a form from opening.

As a general rule, if you attach code to an object's built-in open method, you should call doDefault before calling any other method or procedure. The call to doDefault executes the built-in code so you can be sure the object is completely opened and initialized.

Note:	Paradox compiles out of date forms (forms created in an earlier version of Paradox) before opening them. In this case, tables in the form's data model are opened before any ObjectPAL code executes.


close (built-in method)
close

Built-in Methods

close is called once for every object on a form being closed. By default, a form's close method closes all tables attached to the form.


canArrive (built-in method)
canArrive

Built-in Methods

canArrive is called when moving to an object. It asks whether the object (usually a field object) can be made active. Paradox calls this method by working through the object's containers, triggering canArrive for each object until it reaches the object itself. At any level of the containership, an error denies permission, blocking the move.

By default, Paradox blocks canArrive for objects that are not tab stops, and for a crosstab object if the target is not a cell.


arrive (built-in method)
arrive

Built-in Methods

arrive is called only after the target and its containers have allowed a canArrive. As with canArrive, Paradox calls arrive on the target object's containers, finishing at the target. Pages, table frames, and multi-record objects all move to the first tab stop object they contain if they are the final destination of the move.

A successful arrive on a record or a field object makes it current (and opens an editing window for the field object, if appropriate).

arrive can have further effects on a field object, depending on its display type. If it's a drop-down edit list, focus moves to the list. If it's a radio button, focus moves to the first button.


setFocus (built-in method)
setFocus

Built-in Methods

setFocus is called after a successful arrive or when focus is returned to the form after going away to another window. This method is called for each of the active object's containers, starting with the outermost container, before it is called for the active object itself.

On an edit field, the default code for setFocus highlights the current selection and starts blinking the insertion point. At this time, also, the object's Focus property is set to True, and the form displays a status message reporting the number of the current record and the total number of records.

When a button gets focus, a rectangle displays around the label.


canDepart (built-in method)
canDepart

Built-in Methods

canDepart is called when trying to move off any object. This is the place to put code to block a departure: any error blocks the move. Field objects try to post their contents (triggering changeValue), and record objects try to commit the current record if changes have been made. If the record is locked, the form calls action(DataUnlockRecord) or action(DataPostRecord).

Switching to another window does not move off an object, it only changes focus. Use setFocus and removeFocus to respond to focus events.


removeFocus (built-in method)
removeFocus

Built-in Methods

removeFocus removes the flashing insertion point and highlight (if appropriate) from a field object, and removes the rectangle from a button. The object's Focus property is set to False.

This method is called for the active object and all its containers, starting with the active object, when the user activates some other window or moves to some other object.


depart (built-in method)
depart

Built-in Methods

depart is called after all containers of the current object have granted permission to leave the field via canDepart and removeFocus. Use canDepart to block a move; depart is reserved for closing edit regions, repainting, and performing general cleanup.


mouseEnter (built-in method)
mouseEnter

Built-in Methods

mouseEnter is called whenever the pointer crosses into an object. It is called only on the transition into the object, not on every move across it.

By default, field objects set the pointer to the I-beam, and form, page, and button objects set it to an arrow.

If a button was the last object to receive a click and the mouse button is still down, the button's value toggles between True and False.


mouseExit (built-in method)
mouseExit

Built-in Methods

mouseExit is called when the pointer leaves an object. An object that sets the shape of the pointer on mouseEnter sets it to an arrow in mouseExit.

If a button was the last object to receive a click and the mouse button is still down, its value toggles between True and False.


timer (built-in method)
timer

Built-in Methods

timer is called each time a timer interval elapses. Use the UIObject method setTimer to set timer intervals.


mouseDown (built-in method)
mouseDown

Built-in Methods

mouseDown is called when the logical left mouse button is pressed. The event packet for this method contains the mouse coordinates in twips, relative to the target object.

An active field object enters Field View, positions the insertion point and begins a drag-selection.

When the form handles a mouseDown, it calls mouseExit for all objects no longer under the mouse, and calls mouseEnter for all objects now under the mouse. The form then dispatches the mouseDown to the object the mouse was pointing at.

This method toggles a button's value between True and False.


mouseUp (built-in method)
mouseUp

Built-in Methods

mouseUp is called when the left mouse button is released. It's called for the last object to receive a mouseDown, even if the button is released outside the object, so the object always sees the mouseDown/mouseUp pair.

An active field object ends the selection; a field object that is not active performs a self.moveTo().

When the form handles a mouseUp, it calls mouseExit for all objects no longer under the mouse, and calls mouseEnter for all objects now under the mouse. The form then dispatches the mouseUp to the object that received the last click.

This method toggles a button's value between True and False. If mouseUp is called and the pointer is inside a button, it triggers the button's pushButton method. For any other type of object, it triggers the object's built-in mouseClick method.


mouseDouble (built-in method)
mouseDouble

Built-in Methods

mouseDouble is called when the left mouse button is double-clicked. In Windows convention, a mouseDown and mouseUp are delivered first.

Field objects enter field view on a mouseDouble.

When the form handles a mouseUp, it calls mouseExit for all objects no longer under the mouse, and calls mouseEnter for all objects now under the mouse. The form then dispatches the mouseDouble to the object that received the last click.


mouseRightDown (built-in method)
mouseRightDown

Built-in Methods

mouseRightDown is called when the logical left mouse button is pressed. The event packet for this method contains the mouse coordinates in twips, relative to the target object.

An active field object enters Field View, positions the insertion point and begins a drag-selection.

When the form handles a mouseRightDown, it calls mouseExit for all objects no longer under the mouse, and calls mouseEnter for all objects now under the mouse. The form then dispatches the mouseRightDown to the object the mouse was pointing at.

This method toggles a button's value between True and False.


mouseRightUp (built-in method)
mouseRightUp

Built-in Methods

mouseRightUp is called when the left mouse button is released. It's called for the last object to receive a mouseRightDown, even if the button is released outside the object, so the object always sees the mouseRightDown/mouseRightUp pair.

When the form handles a mouseRightUp, it calls mouseExit for all objects no longer under the mouse, and calls mouseEnter for all objects now under the mouse. The form then dispatches the mouseRightUp to the object that received the last click.

This method toggles a button's value between True and False. If mouseRightUp is called and the pointer is inside a button, it triggers the button's pushButton method.

In addition, the following field objects display a pop-up menu when they get a mouseRightUp: formatted memo, graphic, OLE, and unbound (undefined).


mouseRightDouble (built-in method)
mouseRightDouble

Built-in Methods

mouseRightDouble is called when the left mouse button is double-clicked. In Windows convention, a mouseRightDown and mouseRightUp are delivered first.

When the form handles a mouseRightUp, it calls mouseExit for all objects no longer under the mouse, and calls mouseEnter for all objects now under the mouse. The form then dispatches the mouseRightDouble to the object that received the last click.


mouseClick (built-in method)
mouseClick

Built-in Methods

mouseClick is called when the logical left mouse button is pressed and released when the pointer is inside the boundaries of an object. mouseClick is not called if the user moves the mouse outside the object before releasing the mouse button.

mouseClick is actually generated from within the mouseUp method.

The mapping from mouseUp to mouseClick happens at the first container object which does something with mouseUp. In other words, mouseUp in a box bubbles to its container, and so forth. Only the field object, the button object, the list object, and the form intercept mouseUp, so those are the spots where the translation occurs. If you click on an object inside a button, that object's mouseClick will be called. If that object allows the default (bubbling), then the button will ultimately receive that mouseClick, triggering its own pushButton method. In this way, you can have code execute on objects you click inside the button, but still trigger the button's pushButton method. Setting the error code in mouseUp will inhibit the mouseClick, and setting the error code in mouseClick will inhibit a pushButton.


mouseMove (built-in method)
mouseMove

Built-in Methods

mouseMove is called whenever the mouse moves within an object. The event packet for this method contains the coordinates of the pointer (in twips).

An active edit field checks the state of Shift. If Shift is down (physically or logically), the selection is extended. An active graphic field scrolls the graphic, if necessary.

When you press and hold the mouse button inside an object, mouseMove is called until you release it, even when the pointer moves outside the object.

When the form handles a mouseMove, it calls mouseExit for all objects no longer under the mouse, and calls mouseEnter for all objects now under the mouse.


keyPhysical (built-in method)
keyPhysical

Built-in Methods

keyPhysical is called when a key is pressed and each time a key autorepeats. It goes to the form first, and the form dispatches it to the active object. Then, the active object's built-in code sorts out whether a keystroke represents an action or a character to display in a field, and calls the appropriate action or keyChar method.

For example, suppose a field object within a table object is active, and the user presses Enter. The keystroke triggers keyPhysical, which interprets it as a request for an action and maps it to action(FieldEnter), which in turn triggers the built-in action method. In contrast, when the user presses K, the keystroke triggers keyPhysical, which interprets it as a character and and triggers the keyChar method.

Technically, the event packet for keyPhysical contains information from the Windows WM_KEYDOWN message and an optional WM_CHAR. Therefore, it provides both the virtual key code as well as the ANSI character. Although you can attach code to this method, it's best if you don't, except for special character handling. For example, if you want to intercept the F9 key explicitly (rather than handle the eventual action(DataToggleEdit)) this is the method to use.


keyChar (built-in method)
keyChar

Built-in Methods

keyChar is called when a keyPhysical is not interpreted by Paradox. That is, keyChar gets called for every keyPhysical that does not map to an action (see the action built-in method). It goes to the form first, and the form dispatches it to the active object.

When editing a field, the system locks the record before inserting the first character.

If a button receives a keyChar equal to pressing Spacebar (for example, keyChar(VK_SPACE)), it calls the button's pushButton method.


menuAction (built-in method)
menuAction

Built-in Methods

menuAction is called whenever the user chooses an item from a menu (or clicks a Toolbar button that executes a menu action). It goes to the form first, and the form dispatches it to the active object.


error (built-in method)
error

Built-in Methods

error is called when an error occurs. By default, objects (except the form) pass errors to their containers. You can attach code to the default method to make an object handle an error, or pass it, or both. For more information about errors and error handling, refer to the Guide to ObjectPAL.


status (built-in method)
status

Built-in Methods

status is called before a message is displayed in one of the areas in the status bar. Among other things, you can attach code to the built-in status method to redirect messages to other areas, or to change the text of the message.


action (built-in method)
action

Built-in Methods

action is called when keyPhysical maps some keystroke to an action, when menuAction maps a menu choice to an action, or when other methods want some action performed. It goes to the form first, and the form dispatches it to the target object. For example, by default, pressing F2 in a field triggers action(EditToggleFieldView) after its keyPhysical method executes, and clicking the Forward navigation button triggers action(DataNextRecord) after its menuAction method executes.

action is very important method. It is discussed in detail in the Guide to ObjectPAL.


pushButton (built-in method)
pushButton

Built-in Methods

Defined only for button objects and fields displayed as list boxes, pushButton is called when the user releases the mouse on a button. This method is actually not called directly by the form, but by the default mouseUp method for buttons. You can also call this method directly to accomplish the normal action associated with pressing a button object.

By default, buttons change their appearance when clicked. For example, a push button pushes in and pops out, check boxes check or uncheck, and radio buttons push in or pop out. Focus moves to a button when you click it (unless its Tab Stop property is set to False).

When a button's Tab Stop property is set to True and the button is the active object, there are two ways to trigger its pushButton method using the keyboard:

Press Spacebar. The button keeps focus.

Press Enter. Focus moves to the next object in the tab order.


changeValue (built-in method)
changeValue

Built-in Methods

Defined only for field objects, changeValue asks for permission to change the value of a field. It is called before the value is stored, so you can check the value and do something with it (such as performing additional validity checks). It is not called when someone changes a value across a network or through a lookup with fill-all-corresponding.

The following statement triggers Quant's changeValue method, even if Quant is already 10, and it triggers it immediately, without waiting for the method to finish executing.

Quant = 10

Using changeValue with field objects

The built-in code for changeValue commits the changes to the value; until the built-in code executes, Paradox uses the old, unchanged value. For example, suppose a field object has a value of 10, and you move to it and enter a value of 23. Then, when you move off that field object, you trigger its changeValue method, to which the following code has been attached:

method changeValue(var eventInfo ValueEvent)

   msgInfo("before the change", self.value) ; displays 10

   doDefault

   msgInfo("after the change", self.value) ; displays 23

endMethod

When this method executes, the first dialog box displays the old value, 10, because the built-in code has not yet executed. Then, the call to doDefault executes the built-in code, which commits the changed value, and the second dialog box displays the changed value.

Within an object's changeValue method, you can use the ValueEvent method newValue (not to be confused with the built-in newValue method, discussed previously) to get the incoming value before the built-in code executes. For example, suppose as before that a field object has a value of 10, and you move to it, enter a value of 23, and trigger its changeValue method, to which the following code has been attached:

method changeValue(var eventInfo ValueEvent)

   msgInfo("before the change", self.value) ; Displays 10

   msgInfo("the new (incoming) value",

           eventInfo.newValue())            ; Displays 23

   doDefault

   msgInfo("after the change", self.value)  ; Displays 23

endMethod

The first dialog box displays the old, unchanged value. The second dialog box calls eventInfo.newValue to display the new, incoming valuebut that value has not yet been committed. The call to doDefault executes the built-in code, which commits the change, and the third dialog box displays the changed value.

You can block an attempted change to a value by calling eventInfo.setErrorCode and specifying a nonzero value. You can also test (or alter) the incoming value (for example, to round up to the nearest dollar amount), using eventInfo.setNewValue. For example, the following code is attached to a field object's built-in changeValue method. It executes when the user changes the field's value and attempts to post (commit) the change. The code calls eventInfo.newValue to get the user's value before it is posted. If it is greater than 50, the call to eventInfo.setErrorCode prevents the user from posting the value or leaving the field.

method changeValue(var eventInfo ValueEvent)

var

atNewVal	AnyType

endVar

atNewVal = eventInfo.newValue()

if atNewVal > 50 then

eventInfo.setErrorCode(CanNotDepart)

message("Enter a value less than 50.")

endIf

endMethod


newValue (built-in method)
newValue

Built-in Methods

Defined only for field objects, newValue is called to report that a field object has a new value. For example, when scrolling through a table, moving to the next record triggers newValue. When a field is displayed as radio buttons, newValue is called when you click a button. Note that simply typing into a field object does not trigger newValue (but does set the Touched property to True). In any case, changeValue is not called until you try to move off the field object or otherwise try to commit changes. Also, a form's open method triggers newValue for each field object in the form.

Labeled and unlabeled field objects

The following figure shows the sequence in which built-in methods execute when you move from one field object (labeled or unlabeled) to another after editing a value. The field object you're moving from is named fromField; the one you're moving to is named toField.

Note:	newValue is called when Paradox needs to refresh the value of the field object (in this case, to update the display). Calls to newValue are not part of the canDepart sequence. However, newValue is not necessarily the last method to execute.

Radio buttons and lists

The following figure shows the sequence in which built-in methods execute when you move from one field object (radio buttons, list, or drop-down edit list) to another after editing a value. The sequence is the same as for regular fields, except for an additional newValue call when you choose a radio button or a list item. The table also gives the ValueReason constant for each newValue. The field object you're moving from is named fromField; the one you're moving to is named toField.


ActionEvent Type

See Also

ActionEvents are generated primarily by editing and navigating in a table. The ActionEvent type includes several methods defined for the Event type.

The only built-in method that is triggered by an ActionEvent is action. Typically, when you work with ActionEvents, you'll also work with ObjectPAL action constants. For example, to prevent users from editing a table, you could do something like this:

; thisTableFrame::action
method action(var eventInfo ActionEvent)
; If the user tries to switch to Edit mode, display a dialog box
if eventInfo.id() = DataBeginEdit then  ; DataBeginEdit is a constant.
  msgStop("Stop", "You can't edit this table.")
  eventInfo.setErrorCode(UserError) ; UserError is a constant.
endif
endMethod

The action constants are grouped as follows:

ActionDataCommands

ActionEditCommands

ActionFieldCommands

ActionMoveCommands

ActionSelectCommands

You can also use user-defined action constants.

For more information and examples, refer to the Guide to ObjectPAL.

The ActionEvent type includes several derived methods from the Event type.

Methods for the ActionEvent Type

Event		ActionEvent
errorCode		actionClass
getTarget		id
isFirstTime		setId
isPreFilter
isTargetSelf
reason
setErrorCode
setReason


See Also for ActionEvent Type
See Also

User-Defined Action Constants


User-Defined Action Constants

ActionEvent Type

You can define your own action constants, but you must keep them within a specific range. Because this range is subject to change in future versions of Paradox, ObjectPAL provides the IdRanges constants UserAction and UserActionMax to represent the minimum and maximum values allowed.

For example, suppose that you want to define two action constants, ThisAction and ThatAction. In a Const window, define, values for your custom constants as follows:

Const
   ThisAction = 1
   ThatAction = 2
EndConst

Then, to use one of these constants, add it to UserAction. For example,

method action(var eventInfo ActionEvent)
   if eventInfo.id() = UserAction + ThisAction then
      doSomething()
   endIf
endMethod

By adding UserAction to your own constant, you guarantee yourself a value above the minimum. To keep the value under the maximum, use the value of UserActionMax. One way to check the value is with a message statement:

message(UserActionMax)

In this version of Paradox, the difference between UserAction and UserActionMax is 2047. That means the largest value you can use for an action constant is UserAction + 2047.


ActionEvent::actionClass
actionClass

See Also	Example	ActionEvent Type

Method

Returns the class number of an ActionEvent.

Syntax

actionClass ( ) SmallInt

Description

actionClass returns an integer value representing an ActionEvent class. Use ActionClasses constants to find out which class the integer value represents.


Example for ActionEvent::actionClass
actionClass Example

The following example uses actionClass to prevent the user from making any changes to a field object. This code is attached to a field's built-in action method. See id for an example that traps for the user entering Edit mode.

; Site_Notes::action
method action(var eventInfo ActionEvent)
; check for any attempt to edit, and block it
if eventInfo.actionClass() = EditAction then
  ; allow user to start and end field view
  if NOT (eventInfo.id() = EditEnterFieldView) AND
     NOT (eventInfo.id() = EditToggleFieldView) AND
     NOT (eventInfo.id() = EditExitFieldView) then
    eventInfo.setErrorCode(UserError)
    beep()
    message("Sorry. Can't make changes to this field.")
  endif
endif
endMethod


See Also for ActionEvent::actionClass
See Also

id

setId

Event::getTarget


ActionEvent::id
id

See Also	Example	ActionEvent Type

Beginner

Method

Returns the ID number of an ActionEvent.

Syntax

id ( ) SmallInt

Description

id returns the ID number of an ActionEvent. ObjectPAL defines constants for these ID numbers (for example, DataBeginEdit), so you don't have to remember numeric values.

The action constants grouped as follows:

ActionDataCommands

ActionEditCommands

ActionFieldCommands

ActionMoveCommands

ActionSelectCommands

You can also use user-defined action constants.


Example for ActionEvent::id
id Example

The following example uses id to prevent the user from entering Edit mode on a form. This code is attached to a form's built-in action method:

; thisForm::action
method action(var eventInfo ActionEvent)
if eventInfo.isPreFilter()
  then
    ; code here executes for each object in form
  else
    ; code here executes just for form itself
    if eventInfo.id() = DataBeginEdit then
      eventInfo.setErrorCode(UserError)     ; don't start Edit mode
      msgStop("Sorry", "View only - can't edit this form")
    endif
endif
endMethod


See Also for ActionEvent::id
See Also

actionClass

setId


ActionEvent::setId
setId

See Also	Example	ActionEvent Type

Method

Specifies an ActionEvent.

Syntax

setId ( const actionId SmallInt  )

Description

setId specifies the ActionEvent represented by the constant actionId. ObjectPAL provides constants (for example, DataNextRecord) for ActionEvents so you don't have to remember numeric values.

The action constants grouped as follows:

ActionDataCommands

ActionEditCommands

ActionFieldCommands

ActionMoveCommands

ActionSelectCommands

You can also use user-defined action constants.


Example for ActionEvent::setId
setId Example

In the following example, the Toolbar record-movement buttons are remapped to move within a memo field. Assume that a form contains a multi-record object, SITES, bound to the Sites table. The following code is attached to the action method for the Site_Notes field object:

; Site_Notes::action
method action(var eventInfo ActionEvent)
var
  actID  SmallInt
endVar
; if Site Notes is in Field View, remap record-movement
; actions to move within the memo field
if self.Editing then
  actID = eventInfo.id()
  switch
    case actID = DataPriorRecord  : eventInfo.setId(MoveBeginLine)
    case actID = DataNextRecord   : eventInfo.setID(MoveEndLine)
    case actID = DataFastBackward : eventInfo.setID(MoveBegin)
    case actID = DataFastForward  : eventInfo.setID(MoveEnd)
    case actID = DataBegin        : eventInfo.setID(FieldBackward)
    case actID = DataEnd          : eventInfo.setID(FieldForward)
 endswitch
endif
endMethod


See Also for ActionEvent::setId
See Also

id


AnyType Type

Changes

An AnyType variable can store any one of the data types listed in the following table.

Type	Description

AnyType	A catch-all for basic data types

Array	An indexed collection of data

Binary	Machine-readable data

Currency	Used to manipulate currency values

Date	Calendar data

DateTime	Calendar and clock data combined

DynArray	A dynamic array

Graphic	A bitmap image

Logical	True or False

LongInt	Used to represent relatively large integer values

Memo	Holds lots of text

Number	Floating-point values

OLE	A link to another application

Point	Information about a location on the screen

Record	A user-defined structure

SmallInt	Used to represent relatively small integer values

String	Letters

Time	Clock data

An AnyType can never be a complex type such as TCursor or TextStream. An AnyType variable inherits characteristics from the value assigned to it. That is, it behaves like a String when assigned a String value, like a Number when assigned a Number value, and so forth.

AnyType data objects are included in ObjectPAL so you can use variables for basic data types without declaring them first. (Remember that it's better to declare variables whenever possible.)

Methods for the AnyType Type

AnyType

blank

dataType

fromHex

isAssigned

isBlank

isFixedType

toHex

unAssign

view


Changes to AnyType type methods

The following table lists new methods and methods that were changed for version 5.0.

New	Changed

fromHex	(None)

toHex


AnyType::blank
blank

See Also	Example	AnyType Type

Beginner

Method/Procedure

Returns a blank value.

Syntax

1. ( Method ) blank ( )

2. ( Procedure ) blank ( ) AnyType

Description

blank generates a blank value to assign to a variable or field. A blank value is not the same as a numeric value of zero, but you can use Session type method blankAsZero to treat blank values as zeros in certain calculations. You can use the Session type method isBlankZero to find out whether Blank=Zero is on or off.


Example for AnyType::blank
blank Example

The following example assumes that a form has a table frame bound to the Lineitem table, and a button named thisButton. When a user presses thisButton, the code scans the Qty field in Lineitem, and replaces non-blank values with blank values. This code is attached to the built-in pushButton method for thisButton:

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
endVar

if tc.attach(LINEITEM) then              ; attach tc to table frame
  tc.edit()                              ; edit the table frame
  scan tc for tc.Qty.isBlank() = False : ; look for non-blank Qty fields
    tc.Qty.blank()                       ; put a blank value in Qty
  endScan
  tc.endEdit()                           ; end edit mode
endif

endMethod


See Also for AnyType::blank
See Also

isBlank


AnyType::dataType
dataType

See Also	Example	AnyType Type

Method

Returns a string representing the data type of a variable.

Syntax

dataType ( ) String

Description

dataType returns a string representing the data type of a variable or expression: Binary, Currency, Date, DateTime, Graphic, Logical, LongInt, OLE, Memo, Number, Point, SmallInt, String, or Time. In comparison statements, you need to use one of the string values shown here. For example, the following is coded incorrectly because it compares "String" with "string".

var s AnyType endVar
s = "This is a String data type."
msgInfo("Test", s.dataType() = "string")  ; displays False- should use "String"

Note:	This method works for all ObjectPAL types, not just AnyType.


Example for AnyType::dataType
dataType Example

The following example assumes a form has a button and a graphic field named bmpField. The following code loads a DynArray with several different types of data, then uses dataType to display the data type of each value in the DynArray. This code is attached to the button's built-in pushButton method:

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  mixedTypes DynArray[] AnyType
endVar

mixedTypes["Make"]  = "Ford"          ; String
mixedTypes["Model"] = "Cobra"         ; String
mixedTypes["Year"]  = 1969            ; SmallInt (not Date)
mixedTypes["Color"] = Black           ; LongInt - used here as a constant
mixedTypes["Photo"] = bmpField.value  ; Graphic

FOREACH element in mixedTypes    ; display a message for each element

  msgInfo("dataType(" + element + ")", dataType(mixedTypes[element]))

ENDFOREACH

endMethod


See Also for AnyType::dataType
See Also

isAssigned


AnyType::fromHex
fromHex	5.0

See Also	Example	AnyType Type

Procedure

Converts a hexadecimal number to a decimal number.

Syntax

fromHex ( const value String ) LongInt

Description

fromHex converts a hexadecimal number value to a decimal number. The value must range from 0x00000000 to 0xFFFFFFFF.


Example for AnyType::fromHex
fromHex Example

In the following example, the pushButton method for a button named convertHex converts a hexadecimal string variable to a decimal number.

; convertHex::pushButton

method pushButton(var eventInfo Event)

var

s	String

li	LongInt

endVar

;Hexadecimal value to convert.

s = "0x0756B5B3"

s.view("Hex value to convert")

li = fromHex(s)

li.view("0x0756B5B3") ; Displays 123123123.

endMethod


See Also for AnyType::fromHex
See Also

toHex


AnyType::isAssigned
isAssigned

See Also	Example	AnyType Type

Method

Reports whether a variable has been assigned a value.

Syntax

isAssigned ( ) Logical

Description

isAssigned returns True if the variable has been assigned a value; otherwise, it returns False.

Note:	This method works for all ObjectPAL types, not just AnyType.


Example for AnyType::isAssigned
isAssigned Example

The following example uses isAssigned to test the value of i before assigning a value to it. If i has been assigned, this code increments i by one. The following code goes in a button's Var window:

; thisButton::var
var
  i SmallInt
endVar

This code is attached to the button's built-in pushButton method:

; thisButton::pushButton
method pushButton(var eventInfo Event)

if i.isAssigned() then ; if i has a value
  i = i + 1            ; increment i
else
  i = 1                ; otherwise, initialize i to 1
endif
                       ; now show the value of i
message("The value of i is : " + String(i))

endMethod


See Also for AnyType::isAssigned
See Also

dataType

unAssign


AnyType::isBlank
isBlank

See Also	Example	AnyType Type

Beginner

Method

Reports whether an expression has a blank value.

Syntax

isBlank ( ) Logical

Description

isBlank returns True if the expression has a blank value; otherwise, it returns False. Blank string values are denoted by "". Other blank values can be generated using blank. Note that blank values are not the same as 0, spaces ("   "), or unassigned values.


Example for AnyType::isBlank
isBlank Example

The following code (attached to a button's pushButton method) uses isBlank to test various values, and displays the results in a dialog box:

; thisButton::pushButton
method pushButton(var eventInfo Event)

msgInfo("Is the empty string blank?", isBlank(""))      ; True
msgInfo("Is a string of spaces blank?", isBlank("   ")) ; False
msgInfo("Is 5 a blank?", isBlank(5))                    ; False
msgInfo("Is blank blank?", isBlank(blank()))            ; True

endMethod


See Also for AnyType::isBlank
See Also

blank


AnyType::isFixedType
isFixedType

See Also	Example	AnyType Type

Method

Reports whether a variable's data type has been explicitly declared.

Syntax

isFixedType ( ) Logical

Description

isFixedType returns True if the variable has been declared using a var...Endvar block; otherwise, it returns False.


Example for AnyType::isFixedType
isFixedType Example

The following code demonstrates when isFixedType returns True. This code is attached to a button's built-in pushButton method:

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  x SmallInt                  ; declare x
endVar

message(x.isFixedType())      ; displays True
sleep(2000)

testMe = 4                    ; testMe was not declared
message(testMe.isFixedType()) ; displays False

endMethod


See Also for AnyType::isFixedType
See Also

dataType

isAssigned


AnyType::toHex
toHex	5.0

See Also	Example	AnyType Type

Procedure

Converts a decimal number to a hexadecimal number.

Syntax

toHex ( const value LongInt ) String

Description

toHex converts a decimal number value to a hexadecimal number.


Example for AnyType::toHex
to Hex Example

In the following example, the pushButton method for a button named convertDecimal converts a long integer value to a hexadecimal string.

; convertDecimal::pushButton

method pushButton(var eventInfo Event)

var

s	String

li	LongInt

endVar

li = 123123123

li.view("Value to convert")

s = toHex(li)

s.view("123123123") ; Displays 0x0756B5B3.

endMethod


See Also for AnyType::toHex
See Also

fromHex


AnyType::unAssign
unAssign

See Also	Example	AnyType Type

Method

Sets a variable's state to unAssigned.

Syntax

unAssign ( )

Description

unAssign sets a variable's state to unAssigned. The unAssigned state is not the same as a value of 0, nor is it the same as Blank.


Example for AnyType::unAssign
unAssign Example

The following example demonstrates unAssign. This code is attached to a button's pushButton method:

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  x AnyType
endVar

msgInfo("Is x assigned?", x.isAssigned()) ; displays False
x = 5
msgInfo("Is x assigned?", x.isAssigned()) ; displays True
x.unAssign()
msgInfo("Is x assigned?", x.isAssigned()) ; displays False

endMethod


See Also for AnyType::unAssign
See Also

blank

isAssigned


AnyType::view
view

See Also	Example1	Example2	AnyType Type

Beginner

Method

Displays in a dialog box the value of a variable.

Syntax

view ( [ const title String ] )

Description

view displays, in a modal dialog box, the value of a variable. ObjectPAL execution suspends until the user closes this dialog box. You have the option to specify, in title, a title for the dialog box. If you don't specify a title, the variable's data type appears.

The user can change the value displayed in a view dialog box, as long as the data type is not an Array, DynArray, or Record. view cannot display Binary, Graphic, Memo, or OLE AnyTypes. The following table summarizes AnyTypes that can be displayed, and those which the user can modify.

Type	Can be viewed	Can be modified

Array	yes	no

Binary	no	no

Currency	yes	yes

Date	yes	yes

DateTime	yes	yes

DynArray	yes	no

Graphic	no	no

Logical	yes	yes

LongInt	yes	yes

Memo	no	no

Number	yes	yes

OLE	no	no

Point	yes	yes

Record	yes	no

SmallInt	yes	yes

String	yes	yes

Time	yes	yes


Example 1 for AnyType::view
view Example 1

The following example shows how to tell whether the user clicked the OK button or the Cancel button (or closed the view dialog box another way, for example, by pressing Esc). When the user clicks OK, the value displayed in the dialog box is assigned to the variable. If the user closes the dialog box any other way, the value is not assigned.

The following code assigns an initial value to the variable, then tests to see if the user has changed it. If the user has entered a valid value, the value is entered into the ShipVia field object in a form bound to the Orders table (assuming the form is in edit mode).

This code is attached to a field object's built-in arrive method:

; shipViaFld::pushButton

method arrive(var eventInfo MoveEvent)

var

stShipVia,

stPrompt	String

endVar

stPrompt  = "Enter Express or Regular."

stShipVia = stPrompt

stShipVia.view("Ship via:")

if stShipVia = stPrompt then

; User closed the dialog box without changing the value.

return

else

; User entered a value and clicked OK.

if stShipVia = "Express" or

stShipVia = "Regular" then

orders.shipVia.Value = stShipVia ; Or self.Value = stShipVia

else

msgStop("Stop", stPrompt)

endIf

endIf

endMethod


Example 2 for AnyType::view
view Example 2

The following example uses a view dialog box to prompt the user for a date. If the user enters a valid date, the code displays the day of the week for that date; otherwise, an error message is displayed.

; showDOW::pushButton
method pushButton(var eventInfo Event)
var
  theDate AnyType
  fullDays Array[7] String
endvar

fullDays[1] = "Sunday"
fullDays[2] = "Monday"
fullDays[3] = "Tuesday"
fullDays[4] = "Wednesday"
fullDays[5] = "Thursday"
fullDays[6] = "Friday"
fullDays[7] = "Saturday"

 ; initialize theDay variable
theDate = today()
 ; now show today's date in a dialog and prompt the user to enter a new date
theDate.view("Enter a Date")

 ; it's possible the user could enter an invalid date (like "Saturday")
 ; so this try..fail block attempts to convert theDate to a Date with
 ; dateVal() and if successful, displays the day of the week that
 ; theDate falls on
try
  msgInfo("Day of the week", String(theDate) + " falls on a\n" +
             fullDays[dowOrd(dateVal(theDate))])
onfail
  msgStop("Error!", theDate + " is not a valid date.")
endtry

endMethod


See Also for AnyType::view
See Also

isAssigned

unAssign


Application Type

Changes

An Application variable provides a handle for working with the Desktop window of the current Paradox application. You can use an Application variable in your code to control the size, position, and appearance of the Desktop. Methods added in version 5.0 let you change the working directory and the private directory at run-time.

Although you can have more than one application running at the same time, Application objects can't communicate or operate on each other. An Application variable refers to the current Paradox desktop only; you can, however, use Session variables to open multiple channels to the database engine (see the Session type).

Since there can be only one current application, to get an application handle, you merely declare a variable of type Application. While an Application variable is in scope, it serves as a handle: you use that variable to access the methods in the Application type. For instance, in the following example, an Application variable called thisApp is declared, then used in the method's code.

; downSize::pushButton
method pushButton(var eventInfo Event)
var
  thisApp     Application
endVar
thisApp.maximize() ; Maximize the Desktop.

endMethod

The Application type consists of derived methods from the Form type.

Methods for the Application Type

Form		Application
bringToTop		The Application type consists of derived methods from the Form type.
getTitle
hide
isMaximized
isMinimized
isVisible
maximize
minimize
setPosition
setTitle
show
windowClientHandle
windowHandle


Changes to Application type methods

The following table lists new methods and methods that were changed for version 5.0.

New	Changed

(None)	(None)


Array Type

An Array holds values (called items or elements) in cells similar to the way mail slots hold mail. An ObjectPAL array is one-dimensional, like a single row of slots, where each slot holds one item.

To use arrays in methods, you must declare them by specifying a name, size (number of items), and a data type for the items.

Note: In ObjectPAL, array items are counted beginning with 1, not with 0, as in some other languages.

Note: ObjectPAL also supports dynamic arrays. See the method and procedures for DynArray for more information.

The Array type includes several derived methods from the AnyType type.

Methods for the Array Type

AnyType		Array
blank		addLast
dataType		append
isAssigned		contains
isBlank		countOf
isFixedType		empty
		exchange
		fill
		grow
		indexOf
		insert
		insertAfter
		insertBefore
		insertFirst
		isResizeable
		remove
		removeAllItems
		removeItem
		replaceItem
		setSize
		size
		view


Array::addLast
addLast

See Also	Example	Array Type

Method

Inserts an item at the end of a resizeable array.

Syntax

addLast ( const value AnyType )

Description

addLast inserts value after the last item in a resizeable array. The array grows, if necessary, to make room for the new item. If you need to add more than one element to an array, it is usually preferable to use grow or setSize to allocate more space in the array rather than several addLast statements. For example, the following code uses addLast in a for loop to add 10 new elements to the ar array. Note that this use of addLast forces ObjectPAL to re-allocate space in the array 10 times; once each cycle through the loop.

for i from 11 to 20
  ar.addLast(i * 10)
endfor

The following code accomplishes the same as the previous code, but executes faster because ObjectPAL allocates space only once:

ar.grow(10)    ; increase array size by 10 elements
for i from 11 to 20
  ar[i] = (i * 10)
endfor


Example for Array::addLast
addLast Example

The following example adds an element to a resizeable array each time thisButton is pressed. The pushButton method for thisButton increments the value of the newest element by 10 and displays the contents of the array in a view dialog box. The code immediately following goes in the Var window for thisButton:

; thisButton::Var
var
  ar Array[] SmallInt  ; declare ar as a resizeable array
  i  SmallInt          ; incrementing variable
endVar

The following code is attached to the built-in pushButton method for thisButton:

; thisButton::pushButton
method pushButton(var eventInfo Event)

                       ; initialize or increment i
i = iif(isAssigned(i), i + 10, 0)

if ar.size() = 0 then  ; true if this is the first time the button was pressed
  ar.setSize(0)        ; initialize size
endif

ar.addLast(i)          ; add another element to ar, and assign
                       ; the new element with the value of i

  ; display size of array in the title, and the value of
  ; each element in a view dialog box
ar.view("Size of ar array is " + strVal(ar.size()))

endMethod


See Also for Array::addLast
See Also

append

insert

insertAfter

insertBefore

insertFirst


Array::append
append

See Also	Example	Array Type

Method

Appends the contents of one array to another.

Syntax

append ( const newArray Array[ ] String )

Description

append appends the items of newArray to a resizeable array. The array grows, if necessary, to make room for the added items.


Example for Array::append
append Example

The following code creates two resizeable arrays, addMe and baseArray, and loads them with numeric values. The following example demonstrates append by appending the addMe array to baseArray, then displays the results in a view dialog box. This code is attached to a button's built-in pushButton method:

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
   baseArray, addMe Array[] SmallInt
   i SmallInt
endVar

baseArray.setSize(3)
addMe.setSize(3)        ; now both arrays can store 3 values
for i from 1 to 3
   baseArray[i] = i     ; baseArray[1] = 1, [2] = 2, [3] = 3
   addMe[i] = (i + 3)   ;     addMe[1] = 4, [2] = 5, [3] = 6
endFor

baseArray.append(addMe) ; add the addMe array to baseArray
                        ; this grows baseArray to 6 elements

  ; now display the size of baseArray in the title of a view dialog
  ; and show baseArray elements within the dialog
baseArray.view("baseArray size: " + strVal(baseArray.size()))
endMethod


See Also for Array::append
See Also

addLast

insert

insertAfter

insertFirst


Array::contains
contains

See Also	Example	Array Type

Method

Searches the items of an array for a pattern of characters.

Syntax

contains ( const value AnyType ) Logical

Description

contains returns True if any item of an array exactly matches value; otherwise, it returns False.


Example for Array::contains
contains Example

The following example defines and loads a resizeable array named dogs when a form opens. Once the form's open method loads the array with dog names, the code displays the contents of the array in a dialog box. A button on the form contains code that uses the contains method to search the array for a particular name. If contains doesn't find the name, the built-in pushButton method attached to the button uses insertFirst to add the name to the top of the array.

The following code is attached to the form's Var window:

; thisForm::Var
var
  dogs Array[] String   ; resizeable array
endVar

The following code is attached to the form's built-in open method:

; thisForm::open
method open(var eventInfo Event)
if eventInfo.isPreFilter()
  then
    ;code here executes for each object in form
  else
    ;code here executes just for form itself

    dogs.setSize(4)     ; now dogs can store 4 values
    dogs[1] = "Bruno"   ; add some dog names
    dogs[2] = "Frodo"
    dogs[3] = "Yipper"
    dogs[4] = "Juneau"

      ; show the contents of the dogs array in a view dialog
    dogs.view("dogs is initialized with these values")
endif
endMethod

This code is attached to the button's pushButton method:

; thisButton::pushButton
method pushButton(var eventInfo Event)

if dogs.contains("Bandit") = False then
  dogs.insertFirst("Bandit")  ; add new name to the top of the list
                              ; display contents of the array in a dialog
  dogs.view("dogs size: " + strVal(dogs.size()))
else                          ; "Bandit" must already exist
  msgInfo("Once is enough", "The dogs array already contains Bandit.")
endif

endMethod


See Also for Array::contains
See Also

countOf


Array::countOf
countOf

See Also	Example	Array Type

Method

Counts the occurrences of a value in an array.

Syntax

countOf ( const value AnyType ) LongInt

Description

countOf compares value to each item in an array and returns the number of exact matches, or 0 if no match is found.


Example for Array::countOf
countOf Example

This code (attached to a button's pushButton method) creates and loads a fixed array, then uses countOf to display the number of like values in the array:

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  zoo Array[4] String
  i   SmallInt
endVar
for i from 1 to 3
  zoo[i] = "cat"       ; add three "cat" values
endFor
zoo[4] = "dog"         ; add one "dog" value

msgInfo("How many cats?", zoo.countOf("cat"))   ; displays 3
msgInfo("How many dogs?", zoo.countOf("dog"))   ; displays 1
msgInfo("How many apes?", zoo.countOf("ape"))   ; displays 0

endMethod


See Also for Array::countOf
See Also

contains


Array::empty
empty

See Also	Example	Array Type

Method

Removes all items from an array.

Syntax

empty ( )

Description

empty removes all items from an array. A fixed-size array stays the same size, and all items become unassigned. A resizeable array is reset to a size of 0.


Example for Array::empty
empty Example

The following example shows how empty functions for a fixed array. The code immediately following declares a fixed array in a form's Var window. This array is global to all objects on the form.

; thisForm::Var
Var
  ar Array[5] AnyType  ; declare a fixed array
endVar

The following code is attached to a button's pushButton method. When this button (fillButton) is pressed, the code assigns numeric values to each element in the ar array:

; fillButton::pushButton
method pushButton(var eventInfo Event)
ar[1] = 234    ; load the array with numbers
ar[2] = 356
ar[3] = 98
ar[4] = 989
ar[5] = 2341
               ; view the contents of the array
ar.view("Contents of the ar array")
endMethod

The following code is attached to a button's pushButton method. When this button (emptyButton) is pressed, the code empties the ar array and displays the contents of the array. Since ar is a fixed array, the number of elements does not change; there are still five elements, but each value becomes unassigned.

; emptyButton::pushButton
method pushButton(var eventInfo Event)
ar.empty()       ; empty the ar array
                 ; view the contents of the array
ar.view("Contents of the ar array")
endMethod


See Also for Array::empty
See Also

remove

removeAllItems


Array::exchange
exchange

See Also	Example	Array Type

Method

Swaps the contents of two cells in an array.

Syntax

exchange ( const index1 LongInt, const index2 LongInt )

Description

exchange swaps the contents of the cells at index1 and index2 in an array.


Example for Array::exchange
exchange Example

See the example for indexOf.


See Also for Array::exchange
See Also

contains

countOf

indexOf


Array::fill
fill

See Also	Example	Array Type

Method

Fills an array with a value.

Syntax

fill ( const value AnyType )

Description

fill assigns value to every item of an array.


Example for Array::fill
fill Example

This code creates a fixed array and fills the array with string values. This code is attached to a button's pushButton method:

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  myArray Array[4] String
endVar

myArray.fill("Hello")  ; fill myArray with Hello
myArray.view()         ; display four Hello's in a dialog

endMethod


See Also for Array::fill
See Also

append

insert


Array::grow
grow

See Also	Example	Array Type

Method

Increases the size of a resizeable array.

Syntax

grow ( const increment LongInt )

Description

grow appends increment cells to a resizeable array, or removes cells if the value of increment is negative. If you try to remove more cells than the array has, an error occurs.


Example for Array::grow
grow Example

The following example uses grow to increase and shrink the size of a resizeable array. This code is attached to a button's pushButton method.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  ar Array[] SmallInt
endVar

ar.setSize(2)
ar[1] = 6
ar[2] = 123
message(ar.size()) ; displays 2
sleep(1000)
ar.grow(3)
message(ar.size()) ; displays 5
sleep(1000)
ar.grow(-3)
message(ar.size()) ; displays 2
sleep(1000)

endMethod


See Also for Array::grow
See Also

addLast

insert

insertFirst

isResizeable


Array::indexOf
indexOf

See Also	Example	Array Type

Method

Returns the position of an item in an array.

Syntax

indexOf ( const value AnyType ) LongInt

Description

indexOf returns the index of the first occurrence of value in an array, or 0 if an exact match is not found.


Example for Array::indexOf
indexOf Example

The following example assumes a form has an undefined field object named thisField. When a user right-clicks on the field, a pop-up menu appears, offering a list of payment types. The item selected is inserted into the field. When the user next right-clicks on the field, the last menu item selected is the first in the list of menu choices. The following code goes in the Var window for thisField:

; thisField::Var
Var
  payArray  Array[5] String
  payMenu   PopUpMenu
endVar

The following code is attached to the open method for thisField. When the field first opens, this code assigns values to the array that is used for the pop-up menu:

; thisField::open
method open(var eventInfo Event)
payArray[1] = "Check"      ; initialize array elements
payArray[2] = "Cash"
payArray[3] = "Visa"
payArray[4] = "MasterCard"
payArray[5] = "AmEx"
endMethod

The following code is attached to the mouseRightUp method for thisField. This code displays the pop-up menu and inserts the selection into thisField. The indexOf method is used here to get the ordinal value of the selected menu item; the selection is then moved, with the exchange method, to the beginning of the array .

; thisField::mouseRightUp
method mouseRightUp(var eventInfo MouseEvent)
var
  choiceIndex SmallInt
  choice      String
endVar

disableDefault                ; don't display the normal menu
payMenu.addArray(payArray)    ; add the array to the pop-up menu
choice = payMenu.show()       ; show the menu- assign selection to choice
self.value = choice           ; enter menu selection into field

  ; now prepare the pop-up menu for the next right click
payMenu.empty()                        ; empty the menu
choiceIndex = payArray.indexOf(choice) ; get the array index of the selection
payArray.exchange(choiceIndex, 1)      ; move the selection to the top
endMethod


See Also for Array::indexOf
See Also

contains

countOf


Array::insert
insert

See Also	Example	Array Type

Method

Inserts one or more empty cells into an array.

Syntax

Insert ( Const Index LongInt [, Const NumberOfItems LongInt ] )

Description

Insert inserts numberOfItems empty cells into a resizeable array. if numberOfItems is not specified, one cell is inserted. indexes of subsequent items are increased by the number of inserted cells.


Example for Array::insert
insert example

The following example inserts empty elements at two locations in a resizeable array and displays the results. this code is attached to a button's pushbutton method:

; thisbutton::pushbutton
method pushbutton(var eventinfo event)
var
  myArray Array[] SmallInt
endVar
myArray.setSize(20)   ; allocates space for 20 items
myArray.fill(1)       ; fills the array with 1's
myArray.insert(5)     ; inserts an empty cell at position 5
myArray.insert(12, 4) ; inserts 4 empty cells at position 12
myArray.view()
endMethod


See Also for Array::insert
See Also

insertAfter

insertBefore


Array::insertAfter
insertAfter

See Also	Example	Array Type

Method

Inserts an item into an array after a specified item.

Syntax

insertAfter ( const keyItem AnyType, const insertedItem AnyType )

Description

insertAfter inserts insertedItem into a resizeable array at a position one greater than the first occurrence of keyItem. If keyItem is not found, insertedItem is not inserted, and indexes do not change. If insertedItem is inserted, indexes of subsequent items increase by 1.


Example for Array::insertAfter
insertAfter Example

The following example loads a resizeable array, then uses insertAfter to insert a new element after an existing array element. This code is attached to a button's pushButton method:

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  zoo Array[] String
endVar
zoo.setSize(0)
zoo.addLast("ape")      ; [1] = "ape"
zoo.addLast("cow")      ; [2] = "cow"
zoo.addLast("dog")      ; [3] = "dog"

zoo.insertAfter("ape", "bear")
  ; displays size: 4 in the title; zoo[ape, bear, cow, dog]
zoo.view("zoo size: " + strVal(zoo.size()))

endMethod


See Also for Array::insertAfter
See Also

insert

insertBefore


Array::insertBefore
insertBefore

See Also	Example	Array Type

Method

Inserts an item into an array before a specified item.

Syntax

insertBefore ( const keyItem AnyType, const insertedItem AnyType )

Description

insertBefore searches a resizeable array for keyItem, and inserts insertedItem at keyItem's position. Indexes of keyItem (and subsequent items) are increased by 1. If keyItem is not found, insertedItem is not inserted, and indexes do not change.


Example for Array::insertBefore
insertBefore Example

The following example adds an element to a resizeable array with insertBefore. This code is attached to a button's pushButton method:

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  foodChain Array[] String
endVar

foodChain.grow(3)         ; start array out with 3 elements
foodChain[1] = "Hawk"
foodChain[2] = "Snake"
foodChain[3] = "Fly"

  ; insert an element- this increases the array to 4 elements
foodChain.insertBefore("Fly", "Frog")
  ; displays size: 4 in title; [Hawk, Snake, Frog, Fly]
foodChain.view("foodChain size: " + strVal(foodChain.size()))

endMethod


See Also for Array::insertBefore
See Also

insert

insertAfter


Array::insertFirst
insertFirst

See Also	Example	Array Type

Method

Inserts an item at the beginning of an array.

Syntax

insertFirst ( const value AnyType )

Description

insertFirst inserts value at the beginning of a resizeable array. Indexes of subsequent items are increased by 1.


Example for Array::insertFirst
insertFirst Example

The following example creates a resizeable array, then adds a new element to the beginning of the array. This code is attached to a button's built-in pushButton method:

method pushButton(var eventInfo Event)
var
  myZoo Array[] String
endVar
myZoo.setSize(2)   ; start the array with two elements
myZoo[1] = "lion"
myZoo[2] = "tiger"

                   ; insert an element at beginning of array-
                   ; this increases the array to three elements
myZoo.insertFirst("bear")
                   ; displays size: 3 in title; [bear, lion, tiger]
myZoo.view("myZoo size: " + strVal(myZoo.size()))

endMethod


See Also for Array::insertFirst
See Also

addLast

append

insert

insertAfter

insertBefore


Array::isResizeable
isResizeable

See Also	Example	Array Type

Method

Reports whether an array can be resized.

Syntax

isResizeable ( ) Logical

Description

isResizeable returns True if an array can be resized; otherwise, it returns False.


Example for Array::isResizeable
isResizeable Example

This code checks to see if a particular array can be resized before attempting to increase its size. This code is attached to a button's pushButton method:

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  myArray Array[] String
endVar
if myArray.isResizeable() = True then  ; if array can be resized
  myArray.grow(5)                      ; add 5 cells to it
else
  msgStop("Problem", "Array cannot be resized.")
endif
endMethod


See Also for Array::isResizeable
See Also

grow

size


Array::remove
remove

See Also	Example1	Example2	Array Type

Method

Removes one or more items from an array.

Syntax

remove ( const index SmallInt [ const numberOfItems SmallInt ] )

Description

remove deletes numberOfItems items (or 1 item, if numberOfItems is not specified) at index in an array. Indexes of subsequent items are decreased by numberOfItems (or 1, if numberOfItems is not specified).


Example 1 for Array::remove
remove Example 1

The following example removes a single item from a resizeable array. Note that it is common to use the indexOf method to determine which element you want to remove. This code is attached to a button's built-in pushButton method:

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  myZoo Array[] String
endVar

myZoo.setSize(3)         ; start myZoo out with three elements
myZoo[1] = "lion"
myZoo[2] = "tiger"
myZoo[3] = "bear"

myZoo.remove(myZoo.indexOf("tiger"))  ; same as myZoo.remove(2)

                         ; title displays size: 2
                         ; dialog diasplays myZoo[lion, bear]
myZoo.view("myZoo size: " + strVal(myZoo.size()))

endMethod


Example 2 for Array::remove
remove Example 2

The following example shows how to use remove to eliminate more than one element from a resizeable array. This code is attached to a button's pushButton method:

; thatButton::pushButton
method pushButton(var eventInfo Event)
var
  myNums Array[] SmallInt
  i      SmallInt
endVar

myNums.grow(9)      ; start myNums with nine elements
for i from 1 to 9   ; assign nine elements
   myNums[i] = i
endFor

                    ; displays myNums[1, 2, 3, 4, 5, 6, 7, 8, 9]
myNums.view("Before removing elements")
                    ; remove four items, starting with third element
myNums.remove(3, 4) ; myNums = [1, 2, 7, 8, 9]
                    ; displays myNums[1, 2, 7, 8, 9]
myNums.view("After removing elements")
endMethod


See Also for Array::remove
See Also

insert

removeItem

removeAllItems


Array::removeAllItems
removeAllItems

See Also	Example	Array Type

Method

Removes all occurrences of an array item.

Syntax

removeAllItems ( const value AnyType )

Description

removeAllItems deletes all occurrences of value from an array. Indexes of subsequent items are decreased by 1.


Example for Array::removeAllItems
removeAllItems Example

The following example shows how removeAllItems works with a resizeable array. The following code is attached to a button's built-in pushButton method:

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
   myZoo Array[] String
endVar
myZoo.setSize(5)
myZoo[1] = "ape"
myZoo[2] = "cow"
myZoo[3] = "pig"
myZoo[4] = "cow"
myZoo[5] = "lion"

  ; display current contents of array in a dialog
myZoo.view("Before removing elements")

  ; removes all occurrences of cow
myZoo.removeAllItems("cow")

  ; now,
  ; myZoo[1] = "ape"
  ; myZoo[2] = "pig"
  ; myZoo[3] = "lion"

  ; display new contents of array in a dialog
myZoo.view("After removing elements")

endMethod


See Also for Array::removeAllItems
See Also

remove

removeItem


Array::removeItem
removeItem

See Also	Example	Array Type

Method

Deletes a specified item from an array.

Syntax

removeItem ( const value AnyType )

Description

removeItem deletes the first occurrence of value from an array. Indexes of subsequent items are decreased by 1.


Example for Array::removeItem
removeItem Example

The following example uses removeItem to eliminate an item from a resizeable array. This code is attached to a button's built-in pushButton method:

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  myZoo Array[] String
endVar

myZoo.setSize(4)
myZoo[1] = "ape"
myZoo[2] = "lion"
myZoo[3] = "tiger"
myZoo[4] = "lion"

  ; this displays [ape, lion, tiger, lion]
myZoo.view("Before removing a lion")

  ; remove first occurrence of "lion"
myZoo.removeItem("lion")

  ; this displays [ape, tiger, lion] in a dialog
myZoo.view("After removing a lion")

endMethod


See Also for Array::removeItem
See Also

remove

removeAllItems

replaceItem


Array::replaceItem
replaceItem

See Also	Example	Array Type

Method

Overwrites an item in an array with another item.

Syntax

replaceItem ( const keyItem AnyType, const newItem AnyType )

Description

replaceItem searches an array for keyItem, and replaces the first occurrence of keyItem with newItem.


Example for Array::replaceItem
replaceItem Example

The following example replaces an item in a resizeable array, and displays the initial value and the results in a dialog box. This code is attached to a button's built-in pushButton method:

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  foodChain Array[] String
endVar

foodChain.setSize(3)
foodChain[1] = "Shark"
foodChain[2] = "Elephant"
foodChain[3] = "Minnow"

  ; display contents of array in a dialog box
foodChain.view("Before replaceItem...")

foodChain.replaceItem("Elephant", "Tuna")
  ; display contents of array in a dialog box ([Shark, Tuna, Minnow])
foodChain.view("After replaceItem...")

endMethod


See Also for Array::replaceItem
See Also

removeItem


Array::setSize
setSize

See Also	Example	Array Type

Method

Specifies the size of an array.

Syntax

setSize ( const size LongInt )

Description

setSize saves space for size items in a resizeable array. If setSize makes the array smaller, the array is truncated.


Example for Array::setSize
setSize Example

The following example declares a resizeable array in the variable declaration section, then uses setSize to initialize the size of the array to three elements. The code fills each element of the array, then issues setSize again, this time to resize the array to two elements. The result of making the array smaller (shown in a dialog box) is the elimination of the third (and last) element. This code is attached to a button's built-in pushButton method:

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  myArray Array[] SmallInt
endVar

myArray.setSize(3)          ; size is 3

myArray[1] = 123
myArray[2] = 2353
myArray[3] = 18

  ; display size: 3 in title; [123, 2353, 18] in a dialog box
myArray.view("myArray size: " + strVal(myArray.size()))

myArray.setSize(2)          ; size is 2- myArray[3] truncated

  ; display size: 2 in title; [123, 2353] in a dialog box
myArray.view("Now myArray size: " + strVal(myArray.size()))

endMethod


See Also for Array::setSize
See Also

grow

isResizeable


Array::size
size

See Also	Example	Array Type

Method

Returns the number of items in an array.

Syntax

size ( ) LongInt

Description

size returns the total number of items in an array, even if one or more elements are blank.


Example for Array::size
size Example

See the example for setSize.


See Also for Array::size
See Also

grow

setSize


Array::view
view

See Also	Example	Array Type

Method

Displays in a dialog box the contents of an array.

Syntax

view ( [ const title String ] )

Description

view displays in a modal dialog box the contents of an array. ObjectPAL execution suspends until the user closes this dialog box. You have the option to specify, in title, a title for the dialog box. If you omit title, the title is "Array."

Unlike many other data types, Array values displayed in a view dialog box can not be changed interactively. See AnyType for more information regarding other data types and the view method.


Example for Array::view
view Example

The following example displays the contents of an array in a dialog box without a custom title, then with a custom title. Note that title can be any expression that evaluates to a string. This code is attached to a button's pushButton method:

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  ar Array[]  SmallInt
  i           SmallInt
endVar

ar.setSize(10)
for i from 1 to 10
  ar[i] = i * 10
endfor

ar.view()        ; displays 10, 20, 30, etc (no title)
                 ; this displays "ar size: 10" in the title
ar.view("ar size: " + strVal(ar.size()))

endMethod


See Also for Array::view
See Also

contains


Binary Type

Changes

A binary object (sometimes called a binary large object, or BLOB) contains data that only a computer can read and interpret. An example of a binary object is a sound file: a human can't read or interpret the file in its raw form, but a computer can.

When you declare a Binary variable, you create a handle to a binary object, a variable you can refer to in your code to move binary data back and forth between a disk file and a binary field in a table, or from a disk file or a table to a method or procedure.

The Binary type includes several derived methods from the AnyType type.

Methods for the Binary Type

AnyType		Binary
blank		clipboardErase
dataType		clipboardHasFormat
isAssigned		enumClipboardFormats
isBlank		readFromClipboard
isFixedType		readFromFile
		size
		writeToClipboard
		writeToFile


Changes to Binary type methods

The following table lists new methods and methods that were changed for version 5.0.

New	Changed

clipboardErase	(None)

clipboardHasFormat

enumClipboardFormats

readFromClipboard

writeToClipboard


Binary::clipboardErase
clipboardErase	5.0

See Also	Example	Binary Type

Method

Clears the Windows Clipboard.

Syntax

clipboardErase ( )

Description

clipboardErase clears the Windows Clipboard on the users system.


Example for Binary::clipboardErase
clipboardErase Example

See the example for clipboardHasFormat.


See Also for Binary::clipboardErase
See Also

enumClipboardFormats

clipboardHasFormat

readFromclipboard

writeToClipboard


Binary::clipboardHasFormat
clipboardHasFormat	5.0

See Also	Example	Binary Type

Procedure

Reports whether a format name is on the Windows Clipboard.

Syntax

clipboardHasFormat ( const formatName String ) Logical

Description

clipboardHasFormat returns True if the format name formatName is in the Windows Clipboard on a users system; otherwise, it returns False.


Example for Binary::clipboardHasFormat
clipboardHasFormat Example

In the following example, the pushButton method for a button named clearClipboard checks the Windows Clipboard for a Borland Form Object and if it is there, clears the Clipboard.

;btnClearClipboard::pushButton

method pushButton(var eventInfo Event)

var

b	Binary

endVar

if clipboardHasFormat("Borland Form Object") then

b.clipBoardErase()

message("Clipboard cleared")

else

message("Borland form object not on Clipboard")

endIf

endMethod


See Also for Binary::clipboardHasFormat
See Also

enumClipboardFormats

clipboardErase

readFromclipboard

writeToClipboard


Binary::enumClipboardFormats
enumClipboardFormats	5.0

See Also	Example	Binary Type

Method

Creates an array listing the formats currently on the Windows Clipboard.

Syntax

enumClipboardFormats ( var formatNames Array[] String ) SmallInt

Description

enumClipboardFormats creates an array formatNames that lists the formats currently on the Windows Clipboard on the users system. You must declare the array before you call this method.


Example for Binary::enumClipboardFormats
enumClipboardFormats Example

The following code writes the Clipboard format names to an array named ar, then displays ar in a view dialog box.

;btnShowClipboard :: pushButton

method pushButton(var eventInfo Event)

var

b 	Binary

ar	Array[] String

endVar

b.enumClipboardFormats( ar )

ar.view("Formats in Windows Clipboard")

endmethod


See Also for Binary::enumClipboardFormats
See Also

clipboardErase

clipboardHasFormat

readFromclipboard

writeToClipboard


Binary::readFromClipboard
readFromClipboard	5.0

See Also	Example	Binary Type

Method

Reads a binary object from the Clipboard.

Syntax

readFromClipboard ( const clipboardFormat String ) Logical

Description

readFromClipboard reads a binary object clipboardFormat from the Clipboard to a variable of type Binary. If the Clipboard contains a Binary object that can be copied to the Binary variable, readFromClipboard returns True. If the Clipboard is empty or does not contain a valid Binary, readFromClipboard returns False.


Example for Binary::readFromClipboard
readFromClipboard Example

See the example for writeToClipboard.


See Also for Binary::readFromClipboard
See Also

enumClipboardFormats

clipboardErase

clipboardHasFormat

writeToClipboard


Binary::readFromFile
readFromFile

See Also	Example	Binary Type

Method

Reads data from a file and stores it in a Binary variable.

Syntax

readFromFile ( const fileName String ) Logical

Description

readFromFile reads binary data from the disk file named in fileName. This method returns True if successful; otherwise, it returns False.


Example for Binary::readFromFile
readFromFile Example

The following statements declare a Binary variable theSound, read binary data from a file into theSound, then assign the value of the variable to a Binary field in a table. (Assume SOUNDS.DB is a Paradox table with the following structure: SoundName, A32; SoundData, B.)

; getFile::pushButton
method pushButton(var eventInfo Event)
var
  soundsTC TCursor
  theSound Binary
endVar
if theSound.readFromFile("noise.bin") then ; True if readFromFile succeeds
  if soundsTC.open("sounds.db") then
     soundsTC.edit()
     soundsTC.insertRecord()
     soundsTC.SoundName = "Noise"
     soundsTC.SoundData = theSound  ; put file contents in a binary field
     soundsTC.endEdit()
     soundsTC.close()
  endIf
endIf

endMethod


See Also for Binary::readFromFile
See Also

size

writeToFile

Methods and procedures defined for FileSystem.


Binary::size
size

See Also	Example	Binary Type

Method

Returns the number of bytes in a Binary variable.

Syntax

size ( ) LongInt

Description

size returns a value representing the number of bytes stored in a Binary variable.


Example for Binary::size
size Example

The following example steps through the records in a table that contain Binary fields. The example tests the size of each Binary field. If there's enough free disk space, the code writes the data to a disk file. (Assume SOUNDS.DB is a Paradox table with the following structure: SoundName, A32; SoundData, B.) This code is attached to a custom method named writeBinFiles:

method writeBinFiles()
var
  binVar    Binary
  fs        FileSystem
  soundsTC  TCursor
  freeSpace LongInt
endVar

if soundsTC.open("Sounds.db") then
  scan soundsTC for not isBlank(soundsTC.SoundData) :
    binVar = soundsTC.SoundData     ; binVar = SoundData field value
    freeSpace = fs.freeDiskSpace("B")
    if freeSpace > binVar.size() then     ; if there's room on B:
binVar.writeToFile(soundsTC.SoundName)     ; write binVar to file
    else          ; else the file won't fit on B:
      msgStop("Stop", "The disk in drive B: is full.")
      return
    endIf
  endScan
endif

endMethod


See Also for Binary::size
See Also

readFromFile

writeToFile

Methods and procedures defined for FileSystem.


Binary::writeToClipboard
writeToClipboard	5.0

See Also	Example	Binary Type

Method

Writes a binary object to the Clipboard.

Syntax

writeToClipboard ( const clipboardFormat String ) Logical

Description

writeToClipboard writes (copies) a binary object to the Windows Clipboard. Specify the clipboard format to use with the parameter clipboardFormat. writeToClipboard returns True if successful; otherwise, it returns False.


Example for Binary::writeToClipboard
writeToClipboard Example

In the following example, a form contains two buttons. The button named btnStoreClip stores part of the Windows Clipboard, the Native portion, to a file called NATIVE.CLP. The second button named btnRetrieveClip retrieves the clip from the file and writes it to the clipboard.

The following code is attached to btnStoreClip.

;btnStoreClip :: pushButton

method pushButton(var eventInfo Event)

var

b	Binary

endVar

if not b.readFromClipboard("Native") then

msgInfo("Instructions", "First copy somthing to the clipboard.")

endIf

b.writeToFile("Native.clp")

endmethod

The following code is attached to btnRetrieveClip.

;btnRetrieveClip :: pushButton

method pushButton(var eventInfo Event)

var

b	Binary

endVar

if not b.readFromFile("Native.clp") then

beep()

message("File does not exist")

endIf

b.writeToClipBoard("Native")

endMethod


See Also for Binary::writeToClipboard
See Also

enumClipboardFormats

clipboardErase

clipboardHasFormat

readFromclipboard


Binary::writeToFile
writeToFile

See Also	Example	Binary Type

Method

Writes the data stored in a Binary variable to a disk file.

Syntax

writeToFile ( const fileName String ) Logical

Description

writeToFile writes the data stored in a Binary variable to the disk file specified in fileName. This method returns True if successful; otherwise, it returns False.


Example for Binary::writeToFile
writeToFile Example

The following example steps through the records in a table that contains Binary fields. It tests the size of each Binary field. If there's enough free disk space, the code writes the data to a disk file. (Assume SOUNDS.DB is a Paradox table with the following structure: SoundName, A32; SoundData, B.) This code is attached to a custom method named writeBinFiles:

method writeBinFiles()
var
  binVar    Binary
  fs        FileSystem
  soundsTC  TCursor
  freeSpace LongInt
endVar

if soundsTC.open("Sounds.db") then
  scan soundsTC for not isBlank(soundsTC.SoundData) :
    binVar = soundsTC.SoundData   ; binVar = SoundData field value
    freeSpace = fs.freeDiskSpace("B")
    if freeSpace  binVar.size() then         ; if there's room on B:
      binVar.writeToFile(soundsTC.SoundName) ; write binVar to file
    else                                     ; else the file won't fit
                                             ; on B:
      msgStop("Stop", "The disk in drive B: is full.")
      return
    endIf
  endScan
endif

endMethod


See Also for Binary::writeToFile
See Also

readFromFile

size

Methods and procedures defined for FileSystem


Currency Type

Currency values can range from 3.4 * ± 10-4930 to 1.1 * ± 104930 precise to six decimal places. The number of decimal places displayed depends on the user's Control Panel settings. However, the value stored in a table does not---a table stores the full six decimal places.

The Currency type includes several derived methods from the Number and AnyType types.

Methods for the Currency Type

AnyType		Number		Currency
blank		abs		currency
dataType		acos
isAssigned		asin
isBlank		atan
isFixedType		atan2
view		ceil
		cos
		cosh
		exp
		floor
		fraction
		fv
		ln
		log
		max
		min
		mod
		number
		numVal
		pmt
		pow
		pow10
		pv
		rand
		round
		sin
		sinh
		sqrt
		tan
		tanh
		truncate


Currency::Currency
currency

See Also	Example1	Example2	Currency Type

Procedure

Casts a value as Currency.

Syntax

currency ( const value AnyType ) Currency

Description

currency casts (converts) the data type of value to Currency.


Example 1 for Currency::Currency
currency Example 1

In the following example, a number is stored to a String variable, then cast to a Currency type for use in a calculation. The pushButton method for showDouble displays the type of the variable, then calculates and displays the result of the string cast as Currency and multiplied by 2:

; showDouble::pushButton
method pushButton(var eventInfo Event)

var
  numstr   String
endVar

numStr = "12.34"
msgInfo("The data type of numStr is:", dataType(numStr))
; before multiplying numStr by two, it must be cast
; to a numeric type
msgInfo("Double " + numStr, currency(numStr) * 2)
endMethod


Example 2 for Currency::Currency
currency Example 2

In the following example, the pushButton method for the watchPrecision button calculates a number using variables of type Number, then performs the same calculation with the values cast to Currency. The result of the two calculations varies slightly.

; watchPrecision::pushButton
method pushButton(var eventInfo Event)

var
  x, y, z Number
endVar

x = 1.2 / 3.323        ; stores greatest precision
y = 4.9 / 7.3
z = 2.0 * x * y        ; calculates on full values
msgInfo("Result of Number calculation",
         format("W14.6", z))     ; displays .484790
x = Currency(1.2 / 3.323)        ; stores precision to 6th decimal place
y = Currency(4.9 / 7.3)
z = 2.0 * x * y                  ; calculates on 6 decimal precision values
msgInfo("Result of Currency calculation",
         format("W14.6", z))     ; displays .484791

endMethod


See Also for Currency::Currency
See Also

number


Database Type

Changes

A Database variable provides a handle to a database (a directory). When you start a Paradox application, Paradox opens the default database (the working directory). The default database stores the path to the current working directory. If all you want to do is work with those tables, you don't have to open any other database. To work with tables stored elsewhere, declare a Database variable and use an open statement to create a handle to another database. (You could specify the full path to each table each time you wanted to use it, but code that uses Database variables is easier to maintain.)

Using open and an alias, you can specify which database to open, as shown in the following example:

var
   custInfo Database
endVar
; addAlias is defined for the Session type
addAlias("CustomerInfo", "Standard", "D:\\pdoxwin\\tables\\custdata")
custInfo.open("CustomerInfo") ; opens the CustomerInfo database
                              ; CustomerInfo must be a valid alias

Paradox now knows about two databases: the default database and CustomerInfo. The variable custInfo is a handle to the CustomerInfo database---that is, you can use custInfo in statements to refer to the CustomerInfo database. For example, suppose you have two files named ORDERS.DB (one in your working directory, and one in CustomerInfo), and you want to find out if these files are tables. The following example tests ORDERS.DB in the working directory first, then uses custInfo as a handle for the CustomerInfo database and tests ORDER.DB there:

var
   custInfo Database
endVar
addAlias("CustomerInfo", "Standard", "D:\\pdoxwin\\tables\\custdata")
custInfo.open("CustomerInfo")

if isTable("orders.db") then        ; test ORDERS.DB in the default database
   msgInfo("Working directory", "ORDERS.DB is a table.")
endIf

if custInfo.isTable("orders.db") then   ; use custInfo as a handle for
                                        ; the CustomerInfo database
   msgInfo("CustomerInfo", "ORDERS.DB is a table.")
endIf

If you use open but don't specify a database, Paradox assumes you want a handle for the default database. For example, this syntax gives you a handle for the default database, which you could pass to a custom method that requires a database handle.

var defaultDb Database endVar
defaultDb.open() ; opens the default database

Using a handle to the default database can also make code more readable, especially when you're working with several databases at once.

Methods for the Database Type

DateBase

beginTransaction

close

commitTransaction

delete

enumFamily

isAssigned

isSQLServer

isTable

open

rollBackTransaction

transactionActive


Changes to Database type methods

The following table lists new methods and methods that were changed for version 5.0.

New	Changed

enumFamily	beginTransaction

isSQLServer	Database::executeQBE was removed. Use Query::executeQBE instead.

Database::executeQBEFile was replaced by Query::readFromFile

Database::executeQBEString was replaced by Query::readFromString

getQueryRestartOptions was moved to the Query type.

Database::isExecuteQBEFileLocal was removed. Use Query::isExecuteQBELocal instead.

Database::isExecuteQBEStringLocal was removed. Use Query::isExecuteQBELocal instead.

setQueryRestartOptions was moved to the Query type.

isExecuteQBELocal was moved to the Query type.

Database::writeQBE was removed. Use Query::writeQBE instead.


Database::beginTransaction
beginTransaction	4.5

See Also	Example	Database Type	Changes

Method

Starts a transaction.

Syntax

beginTransaction ( [ const isoLevel String ] ) Logical

Description

beginTransaction starts a transaction on a database that supports transactions. Standard databases (for example, Paradox and dBASE) do not support transactions. Most SQL databases do support transactions.

The optional argument isoLevel (added in version 5.0) specifies an isolation level to use when transactions are supported. If you do not specify an isolation level in isoLevel, the highest (most isolated) isolation level supported by the server is used. The following table lists valid values for isoLevel from lowest isolation level to highest.

isoLevel value	Description

DirtyRead	The transaction can read uncommitted changes made by other transactions.

ReadCommitted	Changes made by other transactions affect data read by this transaction.

RepeatableRead	Data previously read in this transaction is not affected by changes made by other transactions.

Only one transaction is allowed for each database. This method returns True if successful; otherwise, it returns False. While the transaction is active, statements (except passthrough SQL statements) that operate on any table associated with the specified database are included as part of the transaction.


Example for Database::beginTransaction
beginTransaction Example

The following example processes a withdrawal of cash from an automatic teller machine. The call to beginTransaction starts a transaction consisting of three operations: debiting the customer's account, debiting the cash on hand, and dispensing cash to the customer. The result of each operation is stored in a DynArray. When all the operations have been completed, this code checks each item in the DynArray and either calls commitTransaction (if all items are True) or rollbackTransaction (if any item is False).

This example uses beginTransaction, commitTransaction, rollbackTransaction, transactionActive, enumAliasNames, and getAliasProperty.

method pushButton(var eventInfo Event)
   var
      db                   Database
      opResult             DynArray[ ] Logical
      Element              AnyType
      All_OK               Logical
      serverType,
      myAlias,
      custID               String
      aliasNamTC           TCursor
      xAmount              Currency
      xDate                Date
      xTime                Time
   endVar

   ; initialize variables
   myAlias = "ITCHY"
   custID = "RHALL001"
   xAmount = Currency(120.00)
   xDate = today() ; returns current date
   xTime = time()  ; returns current time

   ; use alias to get database handle to server
   if not db.open(myAlias) then
errorShow("Could not open the database.")

      return ; exit the method
   endIf

   if db.transactionActive() then
      db.commitTransaction()       ; commit any previous transaction
   endIf

   db.beginTransaction()           ; begin a transaction

   ; execute the operations for this transaction
   ; debitAccount, debitCashOnHand, and dispenseCash
   ; are custom procs assumed to be defined elsewhere
   ; after calling debitAccount and debitCashOnHand, the code
   ; calls transactionActive to check the transaction status
   ; before calling dispenseCash

   opResult["Debit customer account"] =

            debitAccount(custID, xAmount)
   opResult["Debit cash on hand"] =
            debitCashOnHand(xAmount, xDate, xTime)

   ; the following if...then...else block is not required
   ; it's included to show one way to use transactionActive

   if db.transactionActive() then  ; make sure everything is OK
      msgInfo("Transaction Status", "In a Transaction")
   else
      errorShow("NOT in a Transaction")
      return
   endIf

   opResult["Dispense cash"] = dispenseCash(xAmount)

   All_OK = True                 ; initialize to True

   forEach element in opResult   ; Check operation results
      if opResult[element] = False then
         All_OK = False
         quitLoop
      endIf
   endForEach

   ; inform user of transaction status
   if All_OK then
      if db.commitTransaction() then
         msgInfo("Transaction Status","Transaction committed.")
      else
         errorShow("Transaction NOT committed")
      endIf
   else
      if msgQuestion("Transaction failed",

                     "View results?") = "Yes" then
         opResult.view("Operation results")
      endIf

      if db.rollbackTransaction() then
         msgInfo("Transaction Status",

                 "Transaction rolled back.")
      else
         errorShow("Transaction NOT rolled back.")
      endIf
   endIf

endMethod


See Also for Database::beginTransaction
See Also

commitTransaction

rollbackTransaction

transactionActive


Changes to Database::beginTransaction

The optional argument isoLevel (added in version 5.0) specifies an isolation level to use when transactions are supported.


Database::close
close

See Also	Example	Database Type

Method

Closes a database.

Syntax

close ( ) Logical

Description

close ends the association between a Database variable and a database, making the variable unassigned. close returns True if it succeeds; otherwise, it returns False.


Example for Database::close
close Example

The following code opens the database with the alias someTables. If the Orders table doesn't exist in someTables, this code closes someTables and opens another database with the alias moreTables. This code assumes that both aliases have been defined elsewhere and are valid.

; sumButton::pushButton
method pushButton(var eventInfo Event)
var
  db Database
  tc TCursor
endVar
db.open("someTables")              ; open the database alias someTables
if db.isTable("Orders.db") then    ; if Orders.db is in the database,
  tc.open("Orders.db", db)         ; open a TCursor for it
                                   ; calculate the total balance due
  msgInfo("Balance Due", tc.cSum("Balance Due"))
else
  db.close()                       ; close someTables database
  db.open("moreTables")            ; and open another one
  if db.isTable("Orders.db") then
    tc.open("Orders.db", db)
    msgInfo("Balance Due", tc.cSum("Balance Due"))
  endIf
endIf
endMethod


See Also for Database::close
See Also

open


Database::commitTransaction
commitTransaction	4.5

See Also	Example	Database Type

Method

Commits all changes within a transaction.

Syntax

commitTransaction( ) Logical

Description

commitTransaction commits all changes made within a transaction on a database that supports transactions. Standard databases (for example, Paradox and dBASE) do not support transactions. Most SQL databases do support transactions.

commitTransaction returns True if successful; otherwise, returns False. This method does not check the results of the operations in the transaction; it's up to you to evaluate the results of the operations and decide whether to commit the transaction or roll it back.


Example for Database::commitTransaction
commitTransaction Example

See the example for beginTransaction.


See Also for Database::commitTransaction
See Also

beginTransaction

rollbackTransaction

transactionActive


Database::delete
delete

See Also	Example	Database Type

Method/Procedure

Deletes a table from a database.

Syntax

1. delete ( const tableName String [, const tableType String ] ) Logical

2. delete ( const tableVar Table ) Logical

Description

delete removes a table and any associated index files or table view files from the database without asking for confirmation. If you use syntax 1, and if the file extension is not standard or not supplied, you can use the optional argument tableType to specify the type of the table to delete ("Paradox" or "dBASE"). If tableType is not specified or not standard, "Paradox" is assumed. If you use syntax 2, you can use the argument tableVar to specify a Table variable. However, this method uses only the name and type of the table described by the Table variable, not its database association.

The operation cannot be undone. This method returns True if the table is successfully deleted; otherwise, it returns False. If the table is open, delete fails.


Example for Database::delete
delete Example

In the following example, the pushButton method for delTable deletes a table from the database with the alias megaData.

; delTable::pushButton
method pushButton(var eventInfo Event)
var
  myDb Database
  tableName String
endVar
tableName = "OldTable.dbf"
myDb.open("megadata")
if isTable(tableName) then
  myDb.delete(tableName, "dBASE") ; removes OldTable.dbf from megadata
endif
endMethod


See Also for Database::delete
See Also

isTable


Database::enumFamily
enumFamily	5.0

See Also	Example	Database Type

Method/Procedure

Lists the files in a table family.

Type

Database

Syntax

enumFamily ( var members DynArray[] String, const tableName String ) Logical

Description

enumFamily lists the files in the table family of the table tableName. It assigns values to the dynamic array members that you pass as an argument. The value of tableName must include a file extension if the actual table name includes one. In other words, if you specify "ORDERS", this method will not list family for ORDERS.DB; instead, it will look for a table named ORDERS.

The indexes of the resulting DynArray are the full file names (for example, "C:\PDOXWIN\TABLES\ORDERS.DB") of the family members, and the corresponding value is one of the following strings:

Blobfile

Form

Index

Report

SecondaryIndex

SecondaryIndex2

Table

Unknown

ValCheck


Example for Database::enumFamily
enumFamily Example

The following code writes the family information from the Orders table to a dynamic array dyn then a forEach loop displays each element in a message information dialog box.

;btnFamilyInfo :: pushButton

method pushButton(var eventInfo Event)

var

dyn	DynArray[] String

sElement	String

endVar

enumFamily(dyn, "ORDERS.DB")

forEach sElement in dyn

msgInfo(sElement, dyn[sElement])

endForEach

; You could also do dyn.view().

endmethod


See Also for Database::enumFamily
See Also

isTable

TCursor::familyRights


Database::isAssigned
isAssigned

See Also	Example	Database Type

Method

Reports whether a Database variable has been assigned a value.

Syntax

isAssigned ( ) Logical

Description

isAssigned returns True if the Database variable has been assigned a value; otherwise, it returns False.


Example for Database::isAssigned
isAssigned Example

For the following example, a form has an unassigned field named coRating and a button named showRating. Code attached to showRating's pushButton method uses isAssigned to determine whether the Database variable db is assigned. If it's not, an alias is established and assigned to the Database variable. Once the variable is defined, the code opens a TCursor for the NewCust table contained in the database. The TCursor locates a value in the Company field, then displays that company's credit rating in the coRating field on the form. Following is the code attached to the pushButton method for showRating:

; showRating::pushButton
method pushButton(var eventInfo Event)
var
  db Database
  tc TCursor
endVar

if not isAssigned(db) then
  addAlias("myTables", "Standard", "c:\\pdoxwin\\myTables")
  db.open("myTables")
endif

tc.open("NewCust.dbf", db)
if tc.locatePattern("Company", "Thompson's..") then
  coRating.value = tc.Rating
else
  message("Error", "Thompson's.. not found.")
endif

endMethod


See Also for Database::isAssigned
See Also

isTable


Database::isSQLServer
isSQLServer

See Also	Example	Database Type

Method

Reports whether a Database is opened on a SQL server.

Syntax

isSQLServer ( ) Logical

Description

isSQLServer returns True if the Database variable opened on a SQL server; otherwise, it returns False.


Example for Database::isSQLServer
isSQLServer Example

For the following example, a form has an unassigned field named coRating and a button named showRating. Code attached to showRating's pushButton method uses isAssigned to determine whether the Database variable db is assigned. If it's not, an alias is established and assigned to the Database variable. Once the variable is defined, the code opens a TCursor for the NewCust table contained in the database. The TCursor locates a value in the Company field, then displays that company's credit rating in the coRating field on the form. Following is the code attached to the pushButton method for showRating:

; showRating::pushButton

method pushButton(var eventInfo Event)

var

db Database

endVar

db.open(":fred:")

if db.isSQLServer() then

msgInfo(":FRED:", "Is on a SQL server.")

else

msgInfo(":FRED:", "Is not on a SQL server.")

endIf

endMethod


See Also for Database::isSQLServer
See Also

isAssigned

isTable


Database::isTable
isTable

See Also	Example	Database Type

Method/Procedure

Reports whether a table exists in a database.

Syntax

1. isTable ( const tableName String [, const tableType String ] ) Logical

2. isTable ( const tableVar Table ) Logical

Description

isTable returns True if a specifed table is found in the database; otherwise, it returns False.

If you use syntax 1, you can specify a table name and a table type in arguments tableName and tableType. If you use syntax 2, you can specify a Table variable in tableVar. However, this method uses only the name and type of the table described by the Table variable, not the database association.


Example for Database::isTable
isTable Example

The following code uses isTable to determine whether the Orders table exists in a given database. This code is attached to the built-in pushButton method for thisButton.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  db        Database
  testMe    String
  testMeToo Table
  myTable   TableView
endVar

db.open()                        ; opens the default database
testMe = "Orders.db"
if db.isTable(testMe) then
  myTable.open(testMe)
else
  message(testMe, " is not a table!")
endIf

testMeToo.attach("sales.db")
if testMeToo.isTable() then
  tot = testMeToo.cSum("Total sales")
  msgInfo("total sales:", tot)
endMethod


See Also for Database::isTable
See Also

isAssigned


Database::open
open

See Also	Example	Database Type

Method/Procedure

Opens a database.

Syntax

1. open ( ) Logical

2. open ( const aliasName String ) Logical

3. open ( const ses Session ) Logical

4. open ( const aliasName String, const ses Session ) Logical

5. open ( [ const aliasName String,] [ const ses Session, ]
             [ const parms DynArray ] ) Logical

Description

open opens a database. In syntax 1, where no arguments are given, open opens the default database in the current session. In syntax 2, you specify in aliasName a database to open in the current session. Syntax 3 lets you open the default database in the session specified in ses. Use syntax 4 to open a specified database in a specified session. In syntax 5, the parms argument respresents a list of parameters and values to use when opening a database on a SQL server. The items in the parameter list correspond to the fields in the Alias Manager dialog box for a given alias. The items will vary depending on the type of server you're connecting to; refer to your server documentation for more information.

If you use syntax 2, 4 or 5, aliasName must be a valid alias in the current session or the ses session. The colons around the alias name are optional.

Syntaxes 3, 4 and 5 require that a valid session variable has been opened; the current session is assumed in syntax 1 and 2.

When you use syntax 5, the settings in the parms DynArray override values set previously, both in code and interactively. For example, if the OPEN MODE parameter was previously set to READ/WRITE, the following statement would set it to READ ONLY when you open the database.

dbParmsDA["OPEN MODE"] = "READ ONLY"

When you use parms to specify parameters, the Alias Manager dialog box does not open, even if a password is required.

open returns True if it is able to open the specified database; otherwise, it returns False.


Example for Database::open
open Example

For the following example, the pushButton method for thisButton opens four databases in the current session.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  dDb, myDb, pDb, rDb  Database
  dbParmsDA            DynArray[] AnyType
  currSes              Session
endVar

currSes.open()          ; get a handle to the current session

dDb.open()              ; associate dDb with the default database
myDb.open("custInfo")   ; associate myDb with the Custinfo database
                        ; (custInfo is an alias defined elsewhere)
pDb.open("PRIV")        ; associate pDb with the Private directory

; specify parameters for SQL database
dbParmsDA["OPEN MODE"] = "READ/WRITE"
dbParmsDA["Password"]  = "tycobb"

rDb.open("remote", currSes, dbParmsDA) ; (remote is an alias defined elsewhere)
endMethod


See Also for Database::open
See Also

close

Session


Database::rollBackTransaction
rollBackTransaction	4.5

See Also	Example	Database Type

Method

Rolls back (undoes) all changes within a transaction on a server when transactions are supported.

Syntax

rollbackTransaction ( ) Logical

Description

rollbackTransaction rolls back (undoes) the effects of all operations within a transaction. Returns True if successful; otherwise, returns False.


Example for Database::rollBackTransaction
rollBackTransaction Example

See the example for beginTransaction.


See Also for Database::rollBackTransaction
See Also

beginTransaction

commitTransaction

transactionActive


Database::transactionActive
transactionActive	4.5

See Also	Example	Database Type

Method

Reports whether a transaction is currently active in a specified database.

Syntax

transactionActive ( ) Logical

Description

transactionActive reports whether a transaction is currently active in a specified database. Paradox allows only one active transaction for each database, so it's a good idea to call transactionActive before beginning a transaction.


Example for Database::transactionActive
transactionActive Example

See the example for beginTransaction.


See Also for Database::transactionActive
See Also

beginTransaction

commitTransaction

rollbackTransaction


Date Type

In ObjectPAL, date values can be represented in either month/day/year, day-Month-year, or day.month.year format. Dates must be cast (explicitly declared). For example,

var
  d Date
endVar
d = date("12/21/1997")

assigns to d the date December 21, 1997. Don't omit the quotes around the date value---if you do, ObjectPAL performs division on the values.

The Date type includes methods defined for the AnyType type and the DateTime type. Refer to AnyType and DateTime for more information.

Date values are formatted as specified by the formatSetDateDefault method (System type), or by ObjectPAL formatting statements.

Dates in the 20th century can be specified using two digits for the year, as in

myDay = date("11/09/59")        ; November 9, 1959

Dates in the 2nd through the 10th centuries must include three digits of the year (as in 12/17/243); dates in the 11th through 19th centuries must have four digits (12/17/1043). The year cannot be omitted completely.

Note:	Paradox treats all dates in the B.C. era as leap years. Support for B.C. era dates was added in version 5.0.

The Date type includes several derived methods from the DateTime and AnyType types.

The Date type includes several methods defined for the DateTime type. Refer to DateTime for more information.

Methods for the Date Type

AnyType		DateTime		Date
blank		day		date
dataType		daysInMonth		dateVal
isAssigned		dow		today
isBlank		dowOrd
isFixedType		doy
view		isLeapYear
		month
		moy
		year


Date::date
date

See Also	Example	Date Type

Beginner

Procedure

Returns a Date value.

Syntax

1. date ( const value AnyType ) Date

2. date ( ) Date

Description

date casts (converts) value as a date. If the the date supplied in value is invalid, the method fails. If you do not supply value, date returns the current system date as a Date value.


Example for Date::Date
date Example

The following example casts a string value as a date, uses the date value in a calculation, then displays the result in a dialog box:

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  s String
  d Date
endVar

s = "11/11/99"   ; s is a String value
d = date(s) + 7  ; convert String type to a Date type

d.view()         ; show value of d in a dialog box (11/18/99)
                 ; dialog box title displays "Date"
endMethod


See Also for Date::Date
See Also

dateVal


Date::dateVal
dateVal

See Also	Example	Date Type

Procedure

Returns a value as a date.

Syntax

dateVal ( const value AnyType ) Date

Description

dateVal returns a value as a date.


Example for Date::dateVal
dateVal Example

In the following example, the pushButton method for a button uses dateVal to get the date equivalent of a String value and displays the value in a dialog box:

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  s String
  d Date
endVar

s = "11/11/99"   ; s is a String value
d = dateVal(s)   ; d holds the date equivalent of s

d.view()         ; show value of d in a dialog box (11/11/99)
                 ; dialog box title displays "Date"
endMethod


See Also for Date::dateVal
See Also

date


Date::today
today

See Also	Example	Date Type

Procedure

Returns the current date.

Syntax

today ( ) Date

Description

today returns the current date, according to the system clock/calendar.


Example for Date::today
today Example

The following example displays the current date in a dialog box:

; CurrentDate::pushButton
method pushButton(var eventInfo Event)
msgInfo("Today's Date", today())       ; displays the current date
endMethod


See Also for Date::today
See Also

date

DateTime::day

DateTime::month

DateTime::year


DateTime Type

A DateTime variable stores data in the form hour-minute-second-millisecond year-month-day. DateTime values are used only in ObjectPAL calculations; you cannot store a DateTime value in a Paradox table. DateTime values must be cast (explicitly declared). For example, the following statements assign to the DateTime variable dt a time of 10 minutes and 40 seconds past eleven o'clock and a date of December 21, 1997.

var dt DateTime endVar
dt = DateTime("11:10:40 am 12/21/97")

The quotes around the value are required.

You can use the following characters as separators: blank, tab, space, comma (,), hyphen (-), slash (/), period (.), colon (:), and semicolon (;). DateTime values are formatted as specified by the formatSetDateTimeDefault procedure (System type), or by ObjectPAL formatting statements.

You must specify a DateTime value completely; you can't omit any of the fields, but you can specify a value of zero for any field.

See also methods and procedures defined for the Date type and the Time type. Also, both the Date and Time types include methods derived from the DateTime type.

The DateTime type includes several derived methods from the AnyType type.

Methods for the DateTime Type

AnyType		DateTime
blank		dateTime
dataType		day
isAssigned		daysInMonth
isBlank		dow
isFixedType		dowOrd
view		doy
		hour
		isLeapYear
		milliSec
		minute
		month
		moy
		second
		year


DateTime::DateTime
dateTime

See Also	Example	DateTime Type

Beginner

Method

Returns a DateTime value.

Syntax

1. dateTime ( const value AnyType ) DateTime

2. dateTime ( ) DateTime

Description

dateTime casts (converts) value as a DateTime data type. If value is not supplied, dateTime returns the current system date and time as a DateTime value.


Example for DateTime::DateTime
dateTime Example

The following statements assign to the DateTime variable dt a time of 10 minutes and 40 seconds past eleven o'clock and a date of December 21, 1997. This code assumes the current date and time format is in the form hh:mm:ss am/pm mm/dd/yy.

var dt DateTime endVar
dt = dateTime("11:10:40 am 12/21/97")

The quotes around the value are required.

You can use the following characters as separators: blank, tab, space, comma (,), hyphen (-), slash (/), period (.), colon (:), and semicolon (;). DateTime values are formatted as specified by formatSetDateTimeDefault (System type), or by ObjectPAL formatting statements.

You must specify a DateTime value completely; you cannot omit any of the fields, but you can specify a value of zero for any field.


See Also for DateTime::DateTime
See Also

day

hour

month

year


DateTime::day
day

See Also	Example	DateTime Type

Beginner

Method

Extracts the day of the month from a date.

Syntax

day ( ) SmallInt

Description

day extracts the day of the month from a DateTime value and returns a value between 1 and 31. If the DateTime is invalid, the method fails.


Example for DateTime::day
day Example

In the following example, a button's pushButton method displays the current day of the month in a dialog box. This code assumes the current date and time format is in the form hh:mm:ss am/pm mm/dd/yy.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  theDay DateTime
endVar
theDay = DateTime("12:00:00 am 12/22/92")

  ; displays 22 in a dialog box
msgInfo("Day of the month", theDay.day())

endMethod


See Also for DateTime::day
See Also

dow

dowOrd

doy

month

moy

year


DateTime::daysInMonth
daysInMonth

See Also	Example	DateTime Type

Beginner

Method

Returns the number of days in a month.

Syntax

daysInMonth ( ) SmallInt

Description

Given a valid DateTime value, daysInMonth returns the number of days in that month. If the DateTime is not valid, the method fails.


Example for DateTime::daysInMonth
daysInMonth Example

In the following example, the pushButton method for the FebDays button displays the number of days in February 1992. This code assumes the current date and time format is in the form hh:mm:ss am/pm mm/dd/yy.

; FebDays::pushButton
method pushButton(var eventInfo Event)
var
  daysInFeb SmallInt
endVar
daysInFeb = daysInMonth(DateTime("5:15:35 AM 2/1/92"))
msgInfo("Number of days", "There are " + String(daysInFeb) +
            " days in February 1992")

  ; displays "There are 29 days in February 1992" in a dialog box
  ; (1992 is a leap year)
endMethod


See Also for DateTime::daysInMonth
See Also

day

dow

dowOrd

moy


DateTime::dow
dow

See Also	Example	DateTime Type

Beginner

Method

Returns the day of the week.

Syntax

dow ( ) String

Description

Given a valid DateTime value, dow returns the first three letters of the day of the week of that DateTime. If the DateTime is not valid, the method fails.


Example for DateTime::dow
dow Example

The following example displays, in a dialog box, the day of week for a given DateTime. This code assumes the current date and time format is in the form hh:mm:ss am/pm mm/dd/yy.

; showDay::pushButton
method pushButton(var eventInfo Event)
var
  theDate DateTime
endVar

theDate = DateTime("11:20:15 pm 3/9/93")

  ; displays "Tue" in a dialog box
msgInfo("Day of Week", strVal(theDate) + " falls on a " + dow(theDate))

endMethod


See Also for DateTime::dow
See Also

dateTime

day

dowOrd

doy

moy


DateTime::dowOrd
dowOrd

See Also	Example	DateTime Type

Beginner

Method

Returns the number of a day of the week.

Syntax

dowOrd ( ) SmallInt

Description

Given a valid DateTime value, dowOrd returns an integer from 1 to 7 representing that day's position in the week. Sunday is day 1, Monday is day 2, and so on. If the DateTime is not valid, the method fails.


Example for DateTime::dowOrd
dowOrd Example

The following example displays the day of the week as an entire word (such as "Monday") rather than an abbreviation or a number. This code uses dowOrd to retrieve the appropriate subscript of a fixed array, then displays the value of the array element in a dialog box. This code is attached to the pushButton method for the fullDay button. This example assumes the current date and time format is in the form hh:mm:ss am/pm mm/dd/yy.

; fullDay::pushButton
method pushButton(var eventInfo Event)
var
  fullDays Array[7] String
  givenDate         DateTime
endVar

fullDays[1] = "Sunday"
fullDays[2] = "Monday"
fullDays[3] = "Tuesday"
fullDays[4] = "Wednesday"
fullDays[5] = "Thursday"
fullDays[6] = "Friday"
fullDays[7] = "Saturday"

givenDate = DateTime("5:35:20 AM 12/25/93")
  ; this displays "Saturday" in a dialog box
msgInfo("Day of the week", fullDays[dowOrd(givenDate)])

endMethod


See Also for DateTime::dowOrd
See Also

dateTime

day

dow

doy

moy


DateTime::doy
doy

See Also	Example	DateTime Type

Beginner

Method

Returns the number of a day of the year.

Syntax

doy ( ) SmallInt

Description

Given a valid DateTime, doy returns an integer from 1 to 366 representing that day's position in the year. January 1 is day 1, February 1 is day 32, and so on. If the DateTime is not valid, the method fails.


Example for DateTime::doy
doy Example

The following example displays a day's position in a specified year. This code is attached to a button's pushButton method. This example assumes the current date and time format is in the form hh:mm:ss am/pm mm/dd/yy.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  theDate DateTime
endVar

theDate = DateTime("5:35:20 AM 6/1/92")

  ; this displays "5:35:20, 6/1/92 is
  ; 153 days past the first of the year"
msgInfo("Date", String(theDate) + " is " + String(theDate.doy()) +
                " days past the first of the year.")

endMethod


See Also for DateTime::doy
See Also

dow

moy


DateTime::hour
hour

See Also	Example	DateTime Type

Beginner

Method

Extracts as a number the hour from a DateTime.

Syntax

hour ( ) SmallInt

Description

Given a valid DateTime, hour returns an integer representing the hour of the day in 24-hour format. This method fails if the DateTime is not valid.


Example for DateTime::hour
hour Example

The following code extracts the hour from a given DateTime and displays it in a dialog box. Note that even though the DateTime given is in 12-hour format, hour returns the 24-hour equivalent.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  dt DateTime
endVar

dt = DateTime("8:15:18 pm 12/29/92")
msgInfo("Hour", dt.hour())     ; displays 20 in a dialog

endMethod


See Also for DateTime::hour
See Also

day

month

minute

milliSec

year


DateTime::isLeapYear
isLeapYear

See Also	Example	DateTime Type

Beginner

Method

Reports whether a year has 366 days.

Syntax

isLeapYear ( ) Logical

Description

Given a valid DateTime, isLeapYear returns True if the year within DateTime has 366 days; otherwise, it returns False. This method fails if the DateTime is not valid.

Note:	Paradox treats all dates in the B.C. era as leap years, so isLeapYear always returns True for B.C. era dates. Support for B.C. era dates was added in version 5.0.


Example for DateTime::isLeapYear
isLeapYear Example

For the following example, the pushButton method for the testLeapYr button displays a True if the given DateTime is a leap year; otherwise the method displays False. This code assumes the current date and time format is in the form hh:mm:ss am/pm mm/dd/yy.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  bDay     DateTime
  leapYear Logical
endVar

bDay = DateTime("5:35:20 AM 6/1/92")

leapYear = bDay.isLeapYear()
leapYear.view("bDay")          ; displays True

endMethod


See Also for DateTime::isLeapYear
See Also

year


DateTime::milliSec
milliSec

See Also	Example	DateTime Type

Beginner

Method

Extracts as a number the milliseconds from a DateTime.

Syntax

milliSec ( ) SmallInt

Description

Given a valid DateTime, milliSec returns an integer representing the milliseconds. This method fails if the DateTime is not valid.


Example for DateTime::milliSec
milliSec Example

The following example constructs a DateTime value from integer calculations, then displays the milliseconds portion of the DateTime in a dialog box.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  dt DateTime
  oneSecond, oneMinute, oneHour LongInt
endVar
oneSecond = 1000                ; milliseconds
oneMinute = oneSecond * 60
oneHour   = oneMinute * 60

  ; the following statement assigns dt a DateTime value
  ; of "1:20:30.4 pm 00/00/00" (the statement does not
  ; assign a date, so DateTime sets date portion to 0)
dt = DateTime(13 * oneHour   +
              20 * oneMinute +  ; specifies 1:20 pm
              30 * oneSecond +  ; + 30 seconds
              400)              ; + 400 milliseconds

msgInfo("Milliseconds", dt.milliSec())   ; displays 400

endMethod


See Also for DateTime::milliSec
See Also

hour

minute

second


DateTime::minute
minute

See Also	Example	DateTime Type

Beginner

Method

Extracts as a number the minutes from a DateTime.

Syntax

minute ( ) SmallInt

Description

Given a valid DateTime, minute returns an integer representing the minutes. This method fails if the DateTime is not valid.


Example for DateTime::minute
minute Example

For the following example, the pushButton method for thisButton displays the minutes portion of a given DateTime. This code assumes the current date and time format is in the form hh:mm:ss am/pm mm/dd/yy.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  dt DateTime
endVar

dt = DateTime("9:20:15 am 8/2/93")

msgInfo("Minutes", dt.minute())    ; displays 20

endMethod


See Also for DateTime::minute
See Also

hour

milliSec

second


DateTime::month
month

See Also	Example	DateTime Type

Beginner

Method

Extracts as a number the month from a DateTime.

Syntax

month ( ) SmallInt

Description

Given a valid DateTime, month returns an integer representing the position in the year of that date's month. January is month 1, February is month 2, and so on. This method fails if the DateTime is not valid.


Example for DateTime::month
month Example

The following example displays the month of the year as an entire word (such as "August") rather than an abbreviation or a number. This code uses month to retrieve the appropriate subscript of a fixed array, then displays the value of the array element in a dialog box. This code is attached to the pushButton method for the fullMonth button. This example assumes the current date and time format is in the form hh:mm:ss am/pm mm/dd/yy.

; fullMonth::pushButton
method pushButton(var eventInfo Event)
var
  fullMonth Array[12] String
  orderDate DateTime
endVar

fullMonth[1] =  "January"
fullMonth[2] =  "February"
fullMonth[3] =  "March"
fullMonth[4] =  "April"
fullMonth[5] =  "May"
fullMonth[6] =  "June"
fullMonth[7] =  "July"
fullMonth[8] =  "August"
fullMonth[9] =  "September"
fullMonth[10] = "October"
fullMonth[11] = "November"
fullMonth[12] = "December"

orderDate = DateTime("5:35:20 AM 9/18/93")

  ; this displays "September" in a dialog box
msgInfo("Order Month", fullMonth[month(orderDate)])

endMethod


See Also for DateTime::month
See Also

moy


DateTime::moy
moy

See Also	Example	DateTime Type

Beginner

Method

Extracts as a string the month from a DateTime.

Syntax

moy ( ) String

Description

Given a valid DateTime, moy returns the first three letters of the name of that date's month. This method fails if the DateTime is not valid.


Example for DateTime::moy
moy Example

For the following example, the pushButton method for thisButton displays the abbreviated month name of a specified DateTime. This code assumes the current date and time format is in the form hh:mm:ss am/pm mm/dd/yy.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  orderDate DateTime
endVar

orderDate = DateTime("2:09:00 AM 3/3/97")
msgInfo("Order date", orderDate.moy())    ; displays Mar

endMethod


See Also for DateTime::moy
See Also

month


DateTime::second
second

See Also	Example	DateTime Type

Beginner

Method

Extracts as a number the seconds from a DateTime.

Syntax

second ( ) SmallInt

Description

Given a valid DateTime, second returns an integer representing the seconds. This method fails if the DateTime is not valid.


Example for DateTime::second
second Example

The following example constructs a DateTime value from integer calculations, then displays the seconds portion of the DateTime in a dialog box.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  dt DateTime
  oneSecond, oneMinute, oneHour LongInt
endVar
oneSecond = 1000                 ; milliseconds
oneMinute = oneSecond * 60
oneHour   = oneMinute * 60

  ; the following statement assigns dt a DateTime value
  ; of "1:20:30.4 pm 00/00/00" (the statement does not
  ; assign a date, so DateTime sets date portion to 0)
dt = DateTime(13 * oneHour   +
              20 * oneMinute +   ; specifies 1:20 pm
              30 * oneSecond +   ; + 30 seconds
              400)               ; + 400 milliseconds

msgInfo("Seconds", dt.second())  ; displays 30

endMethod


See Also for DateTime::second
See Also

hour

milliSec

minute


DateTime::year
year

See Also	Example	DateTime Type

Beginner

Method

Extracts as a number the year from a DateTime.

Syntax

year ( ) SmallInt

Description

Given a valid DateTime, year returns an integer representing the year within the DateTime. If the DateTime is invalid, this method fails.


Example for DateTime::year
year Example

For the following example, the pushButton method for the yearButton button displays the four-digit year for a specified DateTime. This code assumes the current date and time format is in the form hh:mm:ss am/pm mm/dd/yy.

; yearButton::pushButton
method pushButton(var eventInfo Event)
var
  orderDate DateTime
endVar

orderDate = DateTime("2:15:24 pm 3/3/97")
msgInfo("Order date", orderDate.year())   ; displays 1997

endMethod


See Also for DateTime::year
See Also

day

isLeapYear

month

moy


DDE Type

Dynamic data exchange (DDE) is a Windows protocol that lets Paradox share data with other applications that behave according to the DDE protocol. Using DDE methods, you have access to data created and stored in another application. You can also use DDE methods to send commands and data to other applications.

Note:	When you use DDE to access Paradox from another application, the application name for Paradox is PDOXWIN.

Note:	Paradox and ObjectPAL also support OLE, another protocol for sharing data between applications. Refer to the OLE type and to the Guide to ObjectPAL, and the User's Guide for more information.

Methods for the DDE Type

DDE

close

execute

open

setItem


DDE::close
close

See Also	Example	DDE Type

Method

Closes a DDE link.

Syntax

close ( )

Description

close ends a DDE conversation by closing the link between Paradox and the other application. It does not affect the other application.


Example for DDE::close
close Example

The following code opens the ObjectVision form ADDRESS.OVD, gets the values of the Name field and the Company field, then calls close to close the  DDE link:

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  getNames DDE
  name, company AnyType
endVar

; link to an ObjectVision form
getNames.open("vision", "C:\\vision\\sample\\Address.ovd")

getNames.setItem("Name")          ; item is field "Name"
name = getNames                   ; set name = field "Name"

getNames.setItem("Company")       ; item is field "Company"
company = getNames                ; sets company = field "Company"

msgInfo("From Address.ovd",       ; display info from ObjectVision
        "Name : " + name + "\n" +
        "Company : " + company )

getNames.close()                  ; close the link

endMethod


See Also for DDE::close
See Also

open

setItem


DDE::execute
execute

See Also	Example	DDE Type

Method

Sends a command via a DDE link.

Syntax

execute ( const command String )

Description

execute sends the string command to an application via a DDE link. The nature of command will vary from one application to another. For example, a string that makes perfect sense to a word processing program may not be understood by a spreadsheet, and spreadsheets from different manufacturers may use different commands to perform similar activities.


Example for DDE::execute
execute Example

The following code uses the ObjectVision function @SETTITLE to specify the text to display in the ObjectVision title bar.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  d1 DDE
endVar

; open a link to the ObjectVision form named Address
d1.open("vision", "C:\\vision\\forms\\Address.ovd")

; execute the ObjectVision @SETTITLE command
d1.execute("[@SETTITLE(\"I'm in charge!\")]")

endMethod


See Also for DDE::execute
See Also

setItem

open

close


DDE::open
open

See Also	Example	DDE Type

Method

Opens a DDE link to another application.

Syntax

1. open ( const server String ) Logical

2. open ( const server String, const topic String ) Logical

3. open ( const server String, const topic String, const item String ) Logical

Description

open creates a DDE link to the application server, and tells server to open the document topic (optional) at a location specified in item (optional).

This method returns True if application server is successfully opened; otherwise it returns False. If the server application cannot open topic, or if item cannot be found in topic, this method fails.

The nature of item varies from one application to another. For example, a string that makes perfect sense to a word processing program may not be understood by a spreadsheet, and spreadsheets from different manufacturers may use different commands to perform similar activities.


Example for DDE::open
open Example

The following code opens two DDE links (represented by the DDE variables d1 and d2) to the ObjectVision form ADDRESS.OVD.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  d1, d2 DDE
  name, company AnyType
endVar

d1.open("vision", "C:\\vision\\forms\\Address.ovd", "Name")
d2.open("vision", "C:\\vision\\forms\\Address.ovd", "Company")

name = d1            ; name takes value from "Name"
company = d2         ; company takes value from "Company"

                     ; display info from ObjectVision fields
msgInfo("Address.ovd Info",
        "Name : " + name + "\n" +
        "Company : " + company )

d1.close()                         ; close DDE links
d2.close()

endMethod


See Also for DDE::open
See Also

close

setItem

execute


DDE::setItem
setItem

See Also	Example	DDE Type

Method

Specifies an item in a DDE conversation.

Syntax

setItem ( const item String )

Description

setItem is used in a DDE link with application and topic established. The argument item specifies a new item. The nature of item varies from application to application. For example, a string that makes perfect sense to a word processing program may not be understood by a spreadsheet, and spreadsheets from different manufacturers may use different commands to do the same thing.


Example for DDE::setItem
setItem Example

The following code opens a DDE link to the ObjectVision form ADDRESS.OVD, then calls setItem to link first to the Name field, then to the Company field in the ObjectVision form.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  getNames DDE
  name, company AnyType
endVar

; link to an ObjectVision form
getNames.open("vision", "C:\\vision\\sample\\Address.ovd")

getNames.setItem("Name")          ; item is field "Name"
name = getNames                   ; set name = field "Name"

getNames.setItem("Company")       ; item is field "Company"
company = getNames                ; sets company = field "Company"

msgInfo("From Address.ovd",       ; display info from ObjectVision
        "Name : " + name + "\n" +
        "Company : " + company )

getNames.close()                  ; close the link

endMethod


See Also for DDE::setItem
See Also

execute

close


DynArray Type

A DynArray is a flexibly structured dynamic array. A dynamic array is a compact storage structure for any combination of data types. Using a DynArray, you can look up values quickly, even when the dynamic array contains a large number of items.

These arrays are dynamic because you do not specify their size; the dimensions of a DynArray automatically change as items are added to it or removed from it. A DynArray's size is limited only by system memory.

Note:	ObjectPAL also supports fixed-size and resizeable arrays. See the Array type for more information.

Unlike fixed-size arrays, the indexes of dynamic arrays are not integers; dynamic array indexes (also called keys) can be any valid ObjectPAL expression that evaluates to a String. Each index in a dynamic array is associated with a value.

The DynArray type includes several derived methods from the AnyType type.

Methods for the DynArray Type

AnyType		DynArray
blank		contains
dataType		empty
isAssigned		getKeys
isBlank		removeItem
isFixedType		size
		view


DynArray::contains
contains

See Also	Example	DynArray Type

Method

Searches the indexes in a DynArray for a value.

Syntax

contains ( const value AnyType ) Logical

Description

contains returns True if the index of any element in a DynArray matches value character for character; otherwise, it returns False. contains is not case sensitive.


Example for DynArray::contains
contains Example

The following example uses contains to test whether a dynamic array index corresponds to a menu item. In this example, the form's open method creates a menu and assigns several values to a dynamic array. When the user selects an item from the menu, the form's menuAction method compares the menu selection with indexes in the DynArray. If a DynArray index is defined for the selected menu item, the menuAction method displays the value associated with that DynArray element; otherwise it displays the value of another element.

This code goes in the form's Var window:

; thisForm::Var
var
  msg DynArray[] AnyType    ; stores messages
  m1             Menu       ; menu bar
  p1             PopUpMenu  ; pop-up attached to menu item
  choice         String     ; user's menu selection
endVar

The code immediately following is attached to the open method of a form:

; thisForm::open
method open(var eventInfo Event)
if eventInfo.isPreFilter()
  then
    ;code here executes for each object in form
  else
    ;code here executes just for form itself

    p1.addText("Time")             ; add items to the pop-up menu
    p1.addText("Date")
    p1.addText("Colors")

    m1.addPopUp("&Utilities", p1)  ; attach the pop-up to a menu bar item
    m1.show()                      ; show the menu bar

      ; Now initialize the msg dynamic array. msg Indexes correspond to
      ; the pop-up menu items generated above. msg values are values that
      ; appear in a dialog box when the user selects a menu. Note that
      ; msg does NOT contain a "Colors" index.
    msg["Time"] = time()           ; show current date for "Time" selection
    msg["Date"] = date()           ; show current date for "Date" selection
    msg["Error"] = "Sorry, this menu selection is not implemented."

endif
endMethod

This code is attached to the menuAction method of a form:

; thisForm::menuAction
method menuAction(var eventInfo MenuEvent)
if eventInfo.isPreFilter()
  then
    ;code here executes for each object in form

    choice = eventInfo.menuChoice()

    if isBlank(choice) = False then    ; if user selected a menu
      if msg.contains(choice) then     ; if selection matches an index in
                                       ; the msg dynamic array
        msgInfo(choice, msg[choice])   ; display the value of that element
      else                             ; else selection didn't match an element
        msgStop("Stop!", msg["Error"]) ; display the value of another element
      endif
    endif

  else
    ;code here executes just for form itself
endif
endMethod


See Also for DynArray::contains
See Also

getKeys

AnyType::view


DynArray::empty
empty

See Also	Example	DynArray Type

Method

Removes all items from a dynamic array.

Syntax

empty ( )

Description

empty removes all items from an dynamic array. The size of the DynArray becomes 0.


Example for DynArray::empty
empty Example

The following example shows how empty functions for a dynamic array. The code immediately following declares a dynamic array in a form's Var window. This dynamic array is global to all objects on the form.

; thisForm::Var
Var
  myCar DynArray[] AnyType  ; declare a dynamic array
endVar

The following code is attached to the pushButton method of the fillButton. When this button is pressed, the code assigns several elements of the myCar DynArray.

; fillButton::pushButton
method pushButton(var eventInfo Event)

myCar["Make"]  = "Porshe"  ; load the DynArray
myCar["Model"] = "911 sc"
myCar["Color"] = "Dark Blue"
myCar["Year"]  = 1986
  ; display myCar DynArray and indicate size in the title (4)
myCar.view("myCar size: " + String(myCar.size()))
endMethod

The following code is attached to the pushButton method of the emptyButton button. When this button is pressed, the code empties the myCar array and displays its contents.

; emptyButton::pushButton
method pushButton(var eventInfo Event)
myCar.empty()     ; empty the myCar DynArray

  ; display myCar DynArray and indicate size in the title (0)
myCar.view("myCar size: " + String(myCar.size()))
endMethod


See Also for DynArray::empty
See Also

contains


DynArray::getKeys
getKeys

See Also	Example	DynArray Type

Method

Loads a resizeable array with indexes of an existing DynArray.

Syntax

getKeys ( var keyNames Array[ ] String )

Description

getKeys creates the resizeable array specified in keyNames and assigns to the values of each element the index in the DynArray. In other words, this method stores all index values from a DynArray in a resizeable array. If keyNames exists, it is overwritten without asking for confirmation. Index values are sorted into the new array such that the lowest index value becomes keyNames[1], and so on.


Example for DynArray::getKeys
getKeys Example

The following example assigns several elements to the myCar DynArray, then uses getKeys to create an array that stores myCar indexes. The results are displayed in a view dialog box.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  myCar DynArray[] AnyType
  ar    Array[] String
endVar

; add some elements to the DynArray
myCar["Make"]  = "Porshe"  ; load the DynArray
myCar["Model"] = "911 sc"
myCar["Color"] = "Dark Blue"
myCar["Year"]  = 1986

; now grow ar to 4 items then view the
; new array in a dialog box
myCar.getKeys(ar)
ar.view()

; displays
;  Color      (ar[1])
;  Make       (ar[2])
;  Model      (ar[3])
;  Year       (ar[4])

endMethod


See Also for DynArray::getKeys
See Also

contains


DynArray::removeItem
removeItem

See Also	Example	DynArray Type

Method

Deletes a specified item from a DynArray.

Syntax

removeItem ( const value AnyType )

Description

removeItem deletes the element (specified by its index) in value from a DynArray. removeItem is case insensitive.


Example for DynArray::removeItem
removeItem Example

The following example concatenates two values in a dynamic array, then uses removeItem to remove the obsolete element.

The code immediately following is attached to a form's Var window:

; thisForm::Var
var
  CustInfo DynArray[] AnyType
endVar

This code is attached to the pushButton method for the getCustInfo button. This code loads the dynamic array with street address information. Your application might have a custom method that loads the dynamic array from a table, or from information entered by the user.

; getCustInfo::pushButton
method pushButton(var eventInfo Event)
  ; load the DynArray
CustInfo["Company"] = "Ultra-Fast Computers"
CustInfo["Street"]  = "1234 Able Street"
CustInfo["City"]    = "Anywhere"
CustInfo["State"]   = "Your State"
CustInfo["Zip"]     = "99444"
CustInfo["ZipExt"]  = "9344"

  ; display contents of the CustInfo Dynarray
CustInfo.view("Contents of CustInfo")
endMethod

In the code that follows, the value of the ZipExt element (if it exists) is concatenated to the value of the Zip element. Since the ZipExt element is no longer needed, this code removes it from the dynamic array. The following code is attached to the pushButton method for the catZipExt button.

; catZipExt::pushButton
method pushButton(var eventInfo Event)
if CustInfo.contains("ZipExt") then
  CustInfo["Zip"] = CustInfo["Zip"] + "-" + CustInfo["ZipExt"]
  CustInfo.removeItem("ZipExt")       ; remove obsolete element
else
  msgInfo("Once is enough", "Zip code has been concatenated")
endif
  ; display the results
CustInfo.view("Contents of CustInfo")
endMethod


See Also for DynArray::removeItem
See Also

empty

contains


DynArray::size
size

See Also	Example	DynArray Type

Method

Returns the number of elements in a DynArray.

Syntax

size ( ) LongInt

Description

size returns the number of elements in a DynArray.


Example for DynArray::size
size Example

For the following example, the pushButton method for thisButton creates a dynamic array, then displays its size in a dialog box.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  dy DynArray[] String
endVar

dy["Name"]     = "MAST"           ; load the DynArray
dy["Business"] = "Diving"
dy["Contact"]  = "Jane Doherty"

  ; this displays "dy has 3 elements"
msgInfo("dy", "dy has " + string(dy.size()) + " elements.")
endMethod


See Also for DynArray::size
See Also

contains


DynArray::view
view

See Also	Example	DynArray Type

Method

Displays the contents of a DynArray in a dialog box

Syntax

view ( [ const title String ] )

Description

view list the indexes and elements of a DynArray in a modal dialog box. ObjectPAL execution suspends until the user closes this dialog box. You can specify a title for the dialog box in title, or you can omit title to display "DynArray" instead. view sorts the DynArray on its index before displaying the dialog box.

Unlike many other data types, DynArray values displayed in a view dialog box cannot be changed interactively. See AnyType::view for information regarding other data types and view.


Example for DynArray::view
view Example

For the following example, the pushButton method for the thisButton button creates a dynamic array, then displays its contents sorted in a dialog box.

;thisButton::pushButton
method pushButton(var eventInfo Event)
var
  dy DynArray[] String
endVar

dy["one"] = "first"
dy["two"] = "second"
dy["three"] "third"
dy.view("This DynArray contains:")
  ; displays the following:
  ; This DynArray contains:
  ; one     first
  ; three   third
  ; two     second
endMethod


See Also for DynArray::view
See Also

contains


ErrorEvent Type

See Also

The ErrorEvent type provides methods you can use to get and set information about errors that occur as ObjectPAL code executes. The only built-in method triggered by an ErrorEvent is error.

The ErrorEvent type includes several derived methods from the Event type.

Methods for the ErrorEvent Type

Event		ErrorEvent
errorCode		reason
getTarget		setReason
isFirstTime
isPreFilter
isTargetSelf
setErrorCode


See Also for ErrorEvent Type
See Also

User-defined Error Constants


User-defined Error Constants

ErrorEvent Type

You can define your own error constants, but you must keep them within a specific range. Because this range is subject to change in future versions of Paradox, ObjectPAL provides the IdRanges constants UserError and UserErrorMax to represent the minimum and maximum values allowed.

For example, suppose that you want to define two error constants, ThisError and ThatError. In a Const window, define, values for your custom constants as follows:

Const

ThisError = 1

ThatError = 2

EndConst

Then, to use one of these constants, add it to UserError. For example,

method error(var eventInfo ErrorEvent)

if eventInfo.id() = UserError + ThisError then

doSomething()

endIf

endMethod

By adding UserError to your own constant, you guarantee yourself a value above the minimum. To keep the value under the maximum, use the value of UserErrorMax. One way to check the value is with a message statement:

message(UserErrorMax)

In this version of Paradox, the difference between UserError and UserErrorMax is 2046. That means the largest value you can use for an error constant is UserError + 2046. (The error code 0 is reserved to mean "no error.")


ErrorEvent::reason
reason

See Also	Example	ErrorEvent Type

Method

Reports why an error occurred.

Syntax

reason ( ) SmallInt

Description

reason returns an integer value to report why an ErrorEvent occurred. ObjectPAL provides ErrorReasons constants for testing the value returned by reason:

Note:	Do not confuse reason with errorCode, which returns a value to indentify an error.


Example for ErrorEvent::reason
reason Example

The following code is attached to the built-in error method for the form. This code reports the error code, the reason, and the message associated with the error.

; thisForm::error
method error(var eventInfo ErrorEvent)
if eventInfo.isPreFilter()
  then
    ; code here executes for each object in form
    msgInfo("Error", eventInfo.errorCode())
    if eventInfo.reason() = ErrorWarning then
      msgInfo("Warning Error", errorMessage())
    else
      msgInfo("Critical Error", errorMessage())
    endif
    disableDefault
  else
    ; code here executes just for form itself

endif
endMethod


See Also for ErrorEvent::reason
See Also

setReason

Event::errorCode


ErrorEvent::setReason
setReason

See Also	Example	ErrorEvent Type

Method

Specifies a reason for generating an ErrorEvent.

Syntax

setReason ( const reasonId SmallInt )

Description

setReason specifies a reason for generating an ErrorEvent. This method takes an ErrorReasons constant as an argument.


Example for ErrorEvent::setReason
setReason Example

The following example creates an ErrorEvent, sets the reason to ErrorCritical, then sends the ErrorEvent to the form.

; sendAnError::pushButton
method pushButton(var eventInfo Event)
var
  ev  ErrorEvent
endVar
ev.setErrorCode(1)         ; set an error code of 1 (any nonzero will do)
ev.setReason(ErrorWarning) ; set the reason to ErrorWarning
thisForm.error(ev)         ; send the error to the form
endMethod


See Also for ErrorEvent::setReason
See Also

reason


Event Type

The Event type is the base type from which the other event types (for example, ActionEvent) are derived. Many of the methods listed here are used by the other event types as derived methods.

The following built-in methods are triggered by Events: open, close, setFocus, removeFocus, newValue, and pushButton.

Methods for the Event Type

Event

errorCode

getTarget

isFirstTime

isPreFilter

isTargetSelf

reason

setErrorCode

setReason


Event::errorCode
errorCode

See Also	Example	Event Type

Beginner

Method

Reports the status of an error flag.

Syntax

errorCode ( ) SmallInt

Description

errorCode returns a nonzero error code if there is an error; otherwise, errorCode returns 0. To test for a specific error, use the ObjectPAL Errors constants (for example, peDiskError) or a user-defined error constant. To create a list of the Error constants and the corresponding error messages, use enumRTLErrors. You can also use the Constants browser in the ObjectPAL IDE to browse through the list of Error constants.


Example for Event::errorCode
errorCode Example

In the following example, assume that a form contains a field object bound to the Quant field of the Orders table. When the field's value changes, this code executes the built-in code for this method, then checks to see if an error occurred.

; Quant::changeValue
method changeValue(var eventInfo ValueEvent)
   doDefault

   ; check the event to see if it has an error
   if eventInfo.errorCode() <> 0 then
      errorShow() ; Display the error message in a dialog box.
   endif
endMethod


See Also for Event::errorCode
See Also

setErrorCode


Event::getTarget
getTarget

See Also	Example	Event Type

Method

Creates a handle to the target of an Event.

Syntax

getTarget ( var target UIObject )

Description

getTarget returns in target the handle of the UIObject that was the target of the most recent Event. The target does not change as the event bubbles up the the containership hierarchy.


Example for Event::getTarget
getTarget Example

The following example assumes that a number of fields from the Customer table are placed on a form. As the user moves from field to field, the setFocus method on the form identifies the target of the event, finds out if the target is a field, and, if so, changes the current field's color to light blue. This provides a more dramatic visual clue to the user than the normal highlight. The field's previous color is stored in the global variable oldFieldColor. When the focus is removed from the field, the form's removeFocus method restores the field to its original color. The previous field color is stored in a variable declared in the Var window of the form, as shown in the following code:

; thisForm::Var
Var
  oldFieldColor LongInt     ; to store the previous color of the field
endVar

The following code is attached to the setFocus method of the form:

; thisForm::setFocus
method setFocus(var eventInfo Event)
var
  targObj    UIObject
endVar
if eventInfo.isPreFilter()
  then
    ; code here executes for each object in form
    ; get the target
    eventInfo.getTarget(targObj)
    if targObj.Class = "Field" then  ; if it's a field, change its color
      oldFieldColor = targObj.Color  ; save old color in var global to form
      targObj.Color = LightBlue      ; highlight field on focus
    endif
  else
    ; code here executes just for form itself

endif
endMethod

This code is attached to the form's removeFocus method:

; thisForm::removeFocus
method removeFocus(var eventInfo Event)
var
  targObj  UIObject
endVar
if eventInfo.isPreFilter()
  then
    ; code here executes for each object in form
    ; get the target
    eventInfo.getTarget(targObj)
    if targObj.Class = "Field" then  ; if it's a field,
      targObj.Color = oldFieldColor  ; restore color from global var
    endif
  else
    ; code here executes just for form itself

endif
endMethod


See Also for Event::getTarget
See Also

isPreFilter


Event::isFirstTime
isFirstTime

See Also	Example	Event Type

Method

Reports whether the form is handling an event for the first time before dispatching it.

Syntax

isFirstTime ( ) Logical

Description

isFirstTime reports whether the form is handling an event before dispatching it to the target object, or whether the event has been dispatched and has subsequently bubbled up the containership hierarchy. This method returns True if the form is handling the event for the first time; otherwise, it returns False. Use isFirstTime in built-in methods attached to the form.


Example for Event::isFirstTime
isFirstTime Example

The following example shows how you can use isFirstTime with isTargetSelf to evaluate an event in a form-level method. This code replaces the default code for the form's pushButton method, which normally tests isPreFilter.

; thisForm::pushButton
method pushButton(var eventInfo Event)
var
  targObj   UIObject
endVar
; This example breaks out isFirstTime and isTargetSelf from isPreFilter.
; Three valid possibilities.
; Form's own event :

  ; isTargetSelf = True, isFirstTime = True

; Dispatched events (prefiltered events):

  ; isTargetSelf = False, isFirstTime = True

; Bubbled events (explicitly passed):

   ; isTargetSelf = False, isFirstTime = False

; For the form, isTargetSelf is never True when isFirstTime is False.

eventInfo.getTarget(targObj)    ; get the target to targObj
switch
  case eventInfo.isTargetSelf() AND eventInfo.isFirstTime() :
  ; This happens only when the form is handling its own event.
       msgInfo("Status",

               "This line will not execute for pushButton events.")

  case NOT eventInfo.isTargetSelf() AND eventInfo.isFirstTime() :
    ; This happens only when the form is dispatching an event
    ; for another object. isPrefilter returns True.

       msgInfo("Status", "Dispatching a pushButton event to "
                         + targObj.Name + ".")

  case NOT eventInfo.isTargetSelf() AND NOT eventInfo.isFirstTime() :
    ; The event has been explicitly bubbled back to the form.
    ; isPrefilter returns False.

       msgInfo("Status", "A pushButton Event " +

               "has been explicitly bubbled back to the form.")
endswitch

endMethod

The following code is attached to the pushButton method for the form's testPassEvent button. When the form's pushButton method has prefiltered the event and dispatched it back to the button, the button's pushButton method returns it to the form with the command passEvent. When the event returns to the form, the methods isTargetSelf, isFirstTime, and isPrefilter all return False.

; testPassEvent::pushButton
method pushButton(var eventInfo Event)
passEvent    ; bubble the event up the heirarchy
endMethod


See Also for Event::isFirstTime
See Also

isPreFilter

About Built-in Methods


Event::isPreFilter
isPreFilter

See Also	Example	Event Type

Method

Reports whether the form is handling an event on its own behalf.

Syntax

isPreFilter ( ) Logical

Description

isPreFilter reports whether the form is handling an event on its own behalf or on behalf of another object. It returns True only when the target is some object other than the form, and the form has not already handled this Event. isPreFilter is logically equivalent to the form evaluating the following statement:

if (NOT eventInfo.isTargetSelf()) AND eventInfo.isFirstTime()

This method returns True for all internal methods, and for all external methods when they first reach the form. When the external methods bubble back to the form, this method returns False. See About Built-in Methods for information about internal and external methods.

Note:	Form methods are not prefiltered. In other words, when an Event occurs for the form, isPreFilter returns False.


Example for Event::isPreFilter
isPreFilter Example

See the example for getTarget.


See Also for Event::isPreFilter
See Also

isFirstTime

About Built-in Methods


Event::isTargetSelf
isTargetSelf

See Also	Example	Event Type

Method

Reports whether an object is the target of an Event.

Syntax

isTargetSelf ( ) Logical

Description

isTargetSelf reports whether an object is the target of an Event. Use isTargetSelf in built-in methods attached to the form.


Example for isTargetSelf
isTargetSelf Example

See the example for isFirstTime.


See Also for isTargetSelf
See Also

isFirstTime

About Built-in Methods


Event::reason
reason

See Also	Example	Event Type

Method

Reports why an Event occurred.

Syntax

reason ( ) SmallInt

Description

reason returns an integer value to report why an event occurred. The return value depends on the type of event. ObjectPAL provides the ValueReasons constants for testing the value returned by reason for Events. ErrorReasons constants are defined for ErrorEvents, MenuReasons constants for MenuEvents, MoveReasons constants for MoveEvents, and StatusReasons constants for StatusEvents

The reason method is valid for the other event types (ActionEvent, KeyEvent, MouseEvent, and ValueEvent), but it returns zero. setReason is also valid for ActionEvent, KeyEvent, MouseEvent, and ValueEvent, but you can use it only to set user-defined Reason constants (an advanced technique).


Example for Event::reason
reason Example

In the following example, assume that a form contains a multirecord object bound to the Orders table, and that the Ship_VIA field is a set of radio buttons. Assume also that the form is in Edit mode. The following newValue method for Ship_VIA displays a message indicating why newValue was called. When the form opens, the Reason will be StartupValue.

; Ship_VIA::newValue
method newValue(var eventInfo Event)
; show why the newValue method was called
msgInfo("newValue reason",

    iif(eventInfo.reason() = StartupValue, "StartupValue",
    iif(eventInfo.reason() = FieldValue, "FieldValue", "EditValue")))
endMethod

When the user scrolls through the table or clicks the nextRec button, the Reason will be FieldValue.

; nextRec::pushButton
method pushButton(var eventInfo Event)
action(DataNextRecord)    ; this triggers a newValue for Ship_Via
                          ; with a Reason constant FieldValue
endMethod

When the user chooses a different radio button on Ship_VIA or clicks the changeRadio button, the Reason will be EditValue.

; changeRadio::pushButton
method pushButton(var eventInfo Event)
ORDERS.Ship_Via = "US Mail"    ; this triggers a newValue for Ship_Via
                               ; with a Reason of EditValue
endMethod


See Also for Event::reason
See Also

MoveEvent

StatusEvent

ErrorEvent

ValueEvent

setReason

About Built-in Methods


Event::setErrorCode
setErrorCode

See Also	Example	Event Type

Beginner

Method

Sets the error code for an Event.

Syntax

setErrorCode ( const errorId SmallInt )

Description

setErrorCode sets the error code in the event packet. If errorId is 0, it means "no error." Any nonzero value for errorId indicates an error; to indicate a specific error, use an EventErrorCodes constant or a user-defined error constant.

Calling setErrorCode is not the same as calling errorLog, which adds error information directly to the error stack. setErrorCode adds the error code to the current event packet; this code may or may not be added to the error stack, depending on how custom code and built-in code handles it. For more information about the event packet and the error stack, refer to the Guide to ObjectPAL.


Example for Event::setErrorCode
setErrorCode Example

See the example for errorCode.


See Also for Event::setErrorCode
See Also

errorCode

About Built-in Methods


Event::setReason
setReason

See Also	Example	Event Type

Method

Specifies a reason for generating a move.

Syntax

setReason ( const reasonId SmallInt )

Description

setReason specifies in reasonId a reason for generating an Event in an object's built-in newValue method, where reasonId is a ValueReasons constant.

Note:	ErrorReasons constants are defined for ErrorEvents, MenuReasons constants for MenuEvents, MoveReasons constants for MoveEvents, and StatusReasons constants for StatusEvents

See the entry for setReason in those sections for examples. setReason is also valid for ActionEvent, KeyEvent, MouseEvent, and ValueEvent, but you can use it only to set user-defined Reason constants (an advanced technique).


Example for Event::setReason
setReason Example

In the following example, assume that a form contains a multi-record object bound to the Orders table, and that the Ship_VIA field is a set of radio buttons. The following newValue method for Ship_VIA displays a message indicating why newValue was called.

; Ship_VIA::newValue
method newValue(var eventInfo Event)
; show why the newValue method was called
msgInfo("newValue reason",
        iif(eventInfo.reason() = StartupValue, "StartupValue",
        iif(eventInfo.reason() = FieldValue, "FieldValue", "EditValue")))
endMethod

The following code demonstrates how to set a reason for an event and send the event to an object.

; triggerValReason::pushButton
method pushButton(var eventInfo Event)
var
  ev  Event
endVar
ev.setReason(FieldValue)       ; set a reason constant for the event
ORDERS.Ship_VIA.newValue(ev)   ; send the event to the Ship_VIA field
endMethod


See Also for Event::setReason
See Also

reason

About Built-in Methods


FileSystem Type

Changes

FileSystem variables provide access to and information about disk files, drives, and directories. A FileSystem variable provides a handle, a variable you can use in ObjectPAL statements to work with a directory or a file. In many cases, the first step in working with FileSystem variables is using findFirst to see if any information is present. It may be helpful to think of this step as initializing the FileSystem variable.

Methods for the FileSystem Type

FileSystem

accessRights

clearDirLock

copy

delete

deleteDir

drives

enumFileList

existDrive

findFirst

findNext

freeDiskSpace

fullName

getDir

getDrive

getFileAccessRights

getValidFileExtensions

isDir

isFile

isFixed

isRemote

isRemovable

makeDir

name

privDir

rename

setDir

setDirLock

setDrive

setFileAccessRights

setPrivDir

setWorkingDir

size

splitFullFileName

startUpDir

time

totalDiskSpace

windowsDir

windowsSystemDir

workingDir


Changes to FileSystem type methods

The following table lists new methods and methods that were changed for version 5.0.

New	Changed

clearDirLock

setDirLock

setPrivDir	fullName

setWorkingDir


FileSystem::accessRights
accessRights

See Also	Example	FileSystem Type

Method

Reports access rights (also called file attributes) of a file.

Syntax

accessRights ( ) String

Description

accessRights returns a String describing access rights. Return values can be one or more of the following: A, D, H, R, S, V (for archive, directory, hidden, read only, system, and volume, respectively). If the returned value is an empty string, the file has no attributes set. You must use findFirst before using accessRights.


Example for FileSystem::accessRights
accessRights Example

The following example checks the attributes of the file MEMO14.TXT. It calls findFirst to make sure the file exists, then calls accessRights. If the file is not marked read-only, this code calls a custom procedure named launchEditor (which we assume is defined elsewhere) to edit the file.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  fileName String
  fs       FileSystem
endVar

fileName = "c:\\pdoxwin\\myfiles\\memo14.txt"

if fs.findFirst(fileName) then

  ; if file attributes include R (read only)
  if search(fs.accessRights(), "R") > 0 then
    msgStop(fileName, "This file is marked read-only.")
  else
    ; run notepad editor for the file
    execute("NotePad.exe " + fileName)
  endIf
else
  msgStop("Error", "Can't find " + fileName)
endIf

endMethod


See Also for FileSystem::accessRights
See Also

getFileAccessRights

setFileAccessRights


FileSystem::clearDirLock
clearDirLock	5.0

See Also	Example	FileSystem Type

Procedure

Unlocks a specified directory.

Syntax

clearDirLock ( const dirName String ) Logical

Description

clearDirLock removes a directory lock placed on the directory specified in dirName. This method returns True if it succeeds; otherwise, it returns False.


Example for FileSystem::clearDirLock
clearDirLock Example

See the example for setDirLock.


See Also for FileSystem::clearDirLock
See Also

setDirLock


FileSystem::copy
copy

See Also	Example	FileSystem Type

Method

Copies a file.

Syntax

copy ( const srcName, String dstName String ) Logical

Description

copy returns True if copy has been successful in copying source file srcName to destination file dstName; otherwise, it returns False. If dstName exists, copy overwrites it without asking for confirmation. copy can copy only one file at a time. You can't use DOS wildcard characters with copy.


Example for FileSystem::copy
copy Example

The code in the following example searches the current directory for the file specified in the variable sourceFile. If the file exists, this code copies it and gives the new file the name specified in destFile.

; copyButton::pushButton
method pushButton(var eventInfo Event)
var
  fs FileSystem
  sourceFile, destFile String
endVar

sourceFile = "memo14.txt"
destFile = "memo14.bak"

if fs.findFirst(sourceFile) then
  if fs.copy(sourceFile, destFile) then
    message(sourceFile + " copied to " + destFile)
  else
    message("Copy failed...")
  endif
else
  msgInfo(sourceFile, "File not found.")
endIf

endMethod


See Also for FileSystem::copy
See Also

rename

delete


FileSystem::delete
delete

See Also	Example1	Example2	FileSystem Type

Method

Deletes a file.

Syntax

delete ( const name String ) Logical

Description

delete returns True if it deletes the file specified in name; otherwise, it returns False. delete can delete only one file at a time. You cannot use DOS wildcard characters with delete.


Example 1 for FileSystem::delete
delete Example 1

The following example displays a dialog box asking if the user wants to delete the file specified in the variable fileName. If the user chooses Yes, the call to delete deletes the file:

; delOne::pushButton
method pushButton(var eventInfo Event)
var
  fs FileSystem
  oldFile String
endVar

fileName = "MyText.old"

if fs.findFirst(fileName) then
  if msgYesNoCancel("Delete?", fileName) = "Yes" then
    fs.delete(fileName)
  endIf
else
  msgInfo(fileName, "File not found.")
endIf

endMethod


Example 2 for FileSystem::delete
delete Example 2

The following example uses a while loop to delete all files in the current directory that have an extension of .OLD.

; delAll::pushButton
method pushButton(var eventInfo Event)
var
  fs FileSystem
endVar

if fs.findFirst("*.old") then
  fs.delete(fs.name())
  while fs.findNext()
    fs.delete(fs.name())
  endWhile
else
  msgInfo("*.OLD", "File not found.")
endIf

endMethod


See Also for FileSystem::delete
See Also

deleteDir


FileSystem::deleteDir
deleteDir

See Also	Example1	Example2	FileSystem Type

Method

Deletes a directory.

Syntax

deleteDir ( const name String ) Logical

Description

deleteDir returns True if deleteDir was successful in deleting the directory specified in name; otherwise, it returns False. deleteDir does not prompt for confirmation.


Example 1 for FileSystem::deleteDir
deleteDir Example 1

The following example tries to delete the directory C:\DOS. If the operation fails (for example, because the directory is not empty), a dialog box displays an error message.

; delDOS::pushButton
method pushButton(var eventInfo Event)
var
  fs FileSystem
endVar

if fs.findFirst("c:\\dos") then
 if not fs.deleteDir("c:\\dos") then
   msgStop("Error", "Could not delete directory.")
 endIf
endIf

endMethod

You can delete a directory only if the directory is empty (contains no files). The following examples use enumFileList to find if a directory is empty. As the examples show, the way to use enumFileList depends on the directory path and file specification. In this example, enumFileList creates an array containing one item (the directory name) when the directory is empty:

; delDir1::pushButton
method pushButton(var eventInfo event)
var
  fs FileSystem
  fileNames Array[] String
endVar

fs.enumFileList("c:\\scan\\subscan", fileNames)

; compare size to 1 because directory has no filespec
if fileNames.size() = 1 then
  fs.deleteDir("c:\\scan\\subscan")
else
  msgStop("Stop", "Directory is not empty.")
endIf

endMethod


Example 2 for FileSystem::deleteDir
deleteDir Example 2

In the following example, enumFileList creates an array containing two items (one each for the current directory and its parent directory) because of the *.* file specification at the end of the path.

; delDir2::pushButton
method pushButton(var eventInfo event)
var
  fs FileSystem
  fileNames Array[] String
endVar

fs.enumFileList("c:\\scan\\subscan\\*.*", fileNames)

; compare size to 2 because directory has the *.* filespec
if fileNames.size() = 2 then ; size = 2 because of *.* filespec
  fs.deleteDir("c:\\scan\\subscan")
else
  msgStop("Stop", "Directory is not empty.")
endIf

endMethod


See Also for FileSystem::deleteDir
See Also

delete

makeDir


FileSystem::drives
drives

See Also	Example	FileSystem Type

Method

Returns the letters of the drives attached to the system and known to Windows.

Syntax

drives ( ) String

Description

drives returns a string containing only the letters (no colons) of the drives attached to the system and known to Windows.


Example for FileSystem::drives
drives Example

The following example displays a dialog box listing the drive ID letters of the drives attached to the system:

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  fs FileSystem
endVar

; this displays a list of attached drives
; example:  ABCHJKXY
msgInfo("Drives", fs.drives())

endMethod


See Also for FileSystem::drives
See Also

existDrive


FileSystem::enumFileList
enumFileList

See Also	Example	FileSystem Type

Method

Lists information about files.

Syntax

1. enumFileList ( const fileSpec String, var arrayName Array[ ] String )

2. enumFileList ( const fileSpec String, const tableName String )

Description

enumFileList lists information about files matching the criteria in fileSpec. If fileSpec is *.*, the array or table includes records for the current directory (.) and the parent directory (..).

In syntax 1, the data is written to the array specified in arrayName. You must declare arrayName before calling this method. The resulting array contains file names and extensions only, not paths.

In syntax 2, the data is written to the table specified in tableName. If the table does not exist, Paradox creates it automatically before enumerating the file list. If tableName does not specify a path, Paradox creates the table in :WORK:. If the table exists and is open, data is appended to it; if it is closed, data is overwritten.

Here is the structure of the table:

Field name	Type	Description

Name	A20	File name (and extension, if any).

Size	N	File size in bytes.

Attributes	A10	DOS file attributes.

Date	A10	Date of last modification.

Time	A10	Time of last modification.

File names are listed in the order they're listed in the directory---not necessarily in alphabetical order.


Example for FileSystem::enumFileList
enumFileList Example

The following example demonstrates both syntaxes of enumFileList. First, enumFileList searches the specified directory for forms and uses syntax 1 to create an array of file names, which is displayed in a pop-up menu. Then enumFileList uses syntax 2 to create a table of information on the files and displays it in a Table window.

; demoButton::pushButton
method pushButton(var eventInfo Event)
var
  fs FileSystem
  formDir, theForm String
  formNames Array[] String
  tv tableView
  p PopUpMenu
endVar

formDir = "C:\\pdoxwin\\sample\\*.f?l"

if fs.findFirst(formDir) then          ; if one *.f?l is found
  fs.enumFileList(formDir, formNames)  ; create an array of *.f?l files
  p.addArray(formNames)                ; show the array in a pop-up menu
  theForm = p.show()                   ; display a pop-up menu of filenames
endIf

if fs.findFirst(formDir) then          ; if one *.f?l is found
  fs.enumFileList(formDir, "forms.db") ; create FORMS.DB listing *.f?l files
  tv.open("forms.db")                  ; display FORMS.DB table
endIf

endMethod


See Also for FileSystem::enumFileList
See Also

getValidFileExtensions

isFile


FileSystem::existDrive
existDrive

See Also	Example	FileSystem Type

Method

Reports whether a drive is attached to the system.

Syntax

existDrive ( const driveLetter String ) Logical

Description

existDrive returns True if driveLetter is attached to the system; otherwise, it returns False. You can specify driveLetter using a letter ("C") or a letter and a colon ("C:").


Example for FileSystem::existDrive
existDrive Example

The following example calls existDrive to test for the existence of drive P. If P exists, the call to setDrive makes it the default drive.

; checkDrive::pushButton
method pushButton(var eventInfo Event)
var
  fs FileSystem
  driveName String
endVar

driveName = "P"

if fs.existDrive(driveName) then
  fs.setDrive(driveName)
else
  msgStop("Stop", "Drive " + driveName + " is not attached.")
endIf

endMethod


See Also for FileSystem::existDrive
See Also

drives

setDrive

getDrive

isRemote

isRemovable


FileSystem::findFirst
findFirst

See Also	Example	FileSystem Type

Method

Searches a file system for a file name.

Syntax

findFirst ( const pattern String ) Logical

Description

findFirst returns True if a file is found whose name matches pattern; otherwise, it returns False. pattern may contain the DOS wildcard characters * and ?, as used with the DOS command DIR. Examples of pattern include:

"C:\\*.*"

"..\\myDir\\*.*"

"*.txt"

"fr*.db?"

Use findFirst to find if a file or directory exists, and to initialize a FileSystem variable before calling another FileSystem method or procedure. This method does not change the directory the FileSystem variable actually points to. Use setDir for that.

Note:	findFirst finds file and directory names in the order they're listed in the directory, which is not necessarily alphabetical. The first value returned by findFirst depends on the path and file specification.


Example for FileSystem::findFirst
findFirst Example

The following example demonstrates how findFirst behaves depending on the file specification in pattern:

; buttonOne::pushButton
method pushButton(var eventInfo Event)

var

  fs FileSystem

endVar

; Search in the root directory for a file

; or directory named PDOXWIN.

if fs.findFirst("c:\\pdoxwin") then

; this displays PDOXWIN (findFirst finds the directory)

msgInfo("Pattern: c:\\pdoxwin", "Name: " + fs.name())

else

errorShow()

endIf

; >>INVALID PATTERN CAUSES AN ERROR!! <<

if fs.findFirst("c:\\pdoxwin\\") then

message("This message never displays.")

else

errorShow("Invalid pattern: c:\\pdoxwin\\")

endIf

; Search in the PDOXWIN directory for

; any file or directory.

if fs.findFirst("c:\\pdoxwin\\*.*") then

; This displays one dot (.) because the

; first file in a directory is a single dot (.).

msgInfo("Pattern: c:\\pdoxwin\\*.*", "Name: " + fs.name())

else

errorShow()

endIf

endmethod


See Also for FileSystem::findFirst
See Also

findNext

name


FileSystem::findNext
findNext

See Also	Example1	Example2	FileSystem Type

Method

Searches a file system for multiple instances of a file name.

Syntax

findNext ( [ const fileSpec String ] ) Logical

Description

After findFirst succeeds, findNext searches for the next file whose name matches the pattern. findNext returns True if successful; otherwise, it returns False.

As a shortcut, you can use the optional argument fileSpec to specify a path and file specification. If you do, the call to findFirst is unnecessary.


Example 1 for FileSystem::findNext
findNext Example 1

The following example calls findNext to fill a list with the names of the tables in the current directory. The example assumes that a field displayed as a drop-down list has already been placed in the form. The code is attached to the built-in open method of list object contained by the field object.

; tablesFld.listObj::open

method open(var eventInfo Event)

var

fs FileSystem

endVar

doDefault

;	This while loop fills the list in the drop-down edit

; box with *.db files in the default sample directory

while fs.findNext("c:\\pdoxwin\\sample\\*.db")

self.list.selection =

self.list.selection + 1

self.list.value = fs.name()

endWhile

endMethod


Example 2 for FileSystem::findNext
findNext Example 2

The following example uses findNext with a file specification as an argument and displays a pop-up menu listing the files in the C:\PDOXWIN directory:

; editText::pushButton
method pushButton(var eventInfo Event)
var
  fs FileSystem
  p  PopUpMenu
  choice String
endVar

; search for *.txt files in the PDOXWIN directory
; then add their names to a pop-up menu
while fs.findNext("c:\\pdoxwin\\*.txt")
  p.addText(fs.name())
endWhile

choice = p.show()                   ; show the pop-up menu
if not choice.isBlank() then        ; if user selected a file
  execute("Notepad.exe " + choice)  ; edit the file in Notepad
endif

endMethod


See Also for FileSystem::findNext
See Also

findFirst


FileSystem::freeDiskSpace
freeDiskSpace

See Also	Example1	Example2	FileSystem Type

Method

Returns the amount of free space on a drive.

Syntax

freeDiskSpace ( const driveLetter String ) LongInt

Description

freeDiskSpace returns the number of bytes available on drive driveLetter. You can specify driveLetter using a letter ("C") or a letter and a colon ("C:").


Example 1 for FileSystem::freeDiskSpace
freeDiskSpace Example 1

The following example displays a dialog box listing the number of bytes available on drive C:

; showCSpace::pushButton
method pushButton(var eventInfo Event)
var
  fs FileSystem
endVar

msgInfo("Free bytes on drive C:", fs.freeDiskSpace("C"))

endMethod


Example 2 for FileSystem::freeDiskSpace
freeDiskSpace Example 2

The following example compares the size of the file MEMO14.TXT and the amount of space available on the current drive. If there's enough space, the code calls copy to copy the file.

; copyFile::pushButton
method pushButton(var eventInfo Event)

var

fs	FileSystem

stDrive	String

liFileSize,

liFreeSpace	LongInt

dyFileInfo	DynArray[] String

endVar

if fs.findFirst(":WORK:memo14.txt") then

liFileSize = fs.size()

splitFullFileName(workingDir(), dyFileInfo)

stDrive = dyFileInfo["DRIVE"]

liFreeSpace = fs.freeDiskSpace(stDrive)

else

msgStop("MEMO14.TXT", "File not found.")

return

endIf

if liFreeSpace > liFileSize then

fs.copy("memo14.txt", "memo14.bak")

message("File copied successfully.")

else

msgStop("Copy", "Not enough disk space to copy file.")

endIf

endMethod


See Also for FileSystem::freeDiskSpace
See Also

totalDiskSpace

findFirst

getDrive


FileSystem::fullName
fullName

See Also	Example	FileSystem Type

Method/Procedure

Returns the full path to a file.

Syntax

1. (Method) fullName ( ) String

2. (Procedure) fullName ( const fileName String ) String

Description

In syntax 1, after a successful findFirst or findNext, fullName returns the full path of the found file. Use this method with splitFullFileName to analyze the components of a file name.

Syntax 2 (added in version 5.0) operates on a file name, expanding or translating aliases or relative directory operators and returning the expanded string. For example, suppose :WORK: is defined as C:\PDOXWIN\FORMS. Given the string ":WORK:myForm.fsl" syntax 2 would return "C:\PDOXWIN\FORMS\myForm.fsl".


Example for FileSystem::fullName
fullName Example

The following example calls fullName to get the full name of the first form listed in the current directory. Then it calls splitFullFileName to split the name into its component parts and store them in a DynArray. Then it calls view to display the DynArray.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  fs FileSystem
  splitName DynArray[] String
  fullFileName String
endVar

; if the customer.db file is in the sample directory
if fs.findFirst("c:\\pdoxwin\\sample\\customer.db") then

  ; store the full file name to a variable
  fullFileName = fs.fullName()

  ; split file name into parts and store them in a DynArray
  splitFullFileName(fullFileName, splitName)

  ; display the component parts
  splitName.view("Split name")
endIf

endMethod


See Also for FileSystem::fullName
See Also

name

findFirst

findNext

splitFullFileName


FileSystem::getDir
getDir

See Also	Example	FileSystem Type

Method

Returns the directory path that the FileSystem variable is pointing to.

Syntax

getDir ( ) String

Description

getDir returns a string representing the path of the directory that the FileSystem variable is pointing to. (Use setDir to make a FileSystem variable point to a specified directory.) The string does not include the drive letter--use getDrive for that.


Example for FileSystem::getDir
getDir Example

The following example gets the path of the directory that the FileSystem variable is pointing to, and compares it with a path. If they don't match, the code calls setDir to change the directory.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  fs FileSystem
  st String
endVar

   st = "c:\\pdoxwin\\myforms"

   if fs.getDir() <> st then
      fs.setDir(st)
   endIf
endMethod


See Also for FileSystem::getDir
See Also

setDir

getDrive


FileSystem::getDrive
getDrive

See Also	Example	FileSystem Type

Method

Returns the drive letter or alias pointed to by the FileSystem variable.

Syntax

getDrive ( ) String

Description

getDrive returns a string representing the drive letter or alias pointed to by the FileSystem variable.


Example for FileSystem::getDrive
getDrive Example

The following example calls getDrive to return the alias of the working directory. Then the example sets the default drive to H and calls getDrive again to confirm the change.

; setH::pushButton
method pushButton(var eventInfo Event)
var
  fs FileSystem
  newDrive String
endVar

msgInfo("Default drive", fs.getDrive())       ; Displays :WORK:

newDrive = "H"

if fs.existDrive(newDrive) then
  if fs.setDrive(newDrive) then
    msgInfo("Default drive", fs.getDrive())   ; Displays H:
  else
    msgStop(newDrive, "Could not set drive.")
  endIf
else
  msgStop(newDrive, "Drive is not attached.")
endIf

endMethod


See Also for FileSystem::getDrive
See Also

existDrive

getDir

setDrive


FileSystem::getFileAccessRights
getFileAccessRights

See Also	Example	FileSystem Type

Procedure

Reports access rights (also called file attributes) of a file.

Syntax

getFileAccessRights ( const fileName String ) String

Description

getFileAccessRights returns a string describing access rights of a file. Return values can be one or more of the following: A, D, H, R, S, V (for archive, directory, hidden, read only, system, and volume, respectively). If the returned value is an empty string, the file has no attributes set. This procedure is similar to the accessRights method. However, getFileAccessRights does not require you to call the findFirst method first.


Example for FileSystem::getFileAccessRights
getFileAccessRights Example

The following example displays in a dialog box the file attributes for the C:\CONFIG.SYS file.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  fileName String
endVar

fileName = "C:\\CONFIG.SYS"

msgInfo(fileName, getFileAccessRights(fileName))

endMethod


See Also for FileSystem::getFileAccessRights
See Also

accessRights

setFileAccessRights


FileSystem::getValidFileExtensions
getValidFileExtensions

See Also	Example	FileSystem Type

Procedure

Returns the valid file extensions for a specified object.

Syntax

getValidFileExtensions ( const objectType String ) String

Description

getValidFileExtensions returns a string containing the valid file extensions for the object specified in objectType, where objectType is one of: Form, Library, Report, or Script.


Example for FileSystem::getValidFileExtensions
getValidFileExtensions Example

The following example displays a dialog box listing the valid file extensions for forms:

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  fx String
endVar

fx = getValidFileExtensions("Form")
msgInfo("Form file extensions:", fx)    ; displays fsl fdl

endMethod


See Also for FileSystem::getValidFileExtensions
See Also

getDir

getDrive

splitFullFileName


FileSystem::isDir
isDir

See Also	Example	FileSystem Type

Procedure

Reports whether a specfied string represents the name of a directory.

Syntax

isDir ( const dirName String ) Logical

Description

isDir returns True if dirName is a valid directory name; otherwise, it returns False.


Example for FileSystem::isDir
isDir Example

The following example calls isDir to make sure that the directory specified by the variable newDir is valid. If it is, the call to setDir makes newDir the default directory. In this example, the value of newDir is hard coded, but in practice, it could be supplied by the user, read from a table, and so on.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  fs FileSystem
  newDir String
endVar

newDir = "C:\\pdoxwin\\diveplan"
if isDir(newDir) then
  fs.setDir(newDir)
  msgInfo("Current directory", fs.getDir())
else
  msgStop(newDir, "Directory does not exist.")
endIf

endMethod


See Also for FileSystem::isDir
See Also

deleteDir

getDir

makeDir

setDir


FileSystem::isFile
isFile

See Also	Example1	Example2	FileSystem Type

Procedure

Reports whether a specified string is the name of a file in the current file system.

Syntax

isFile ( const fileName String ) Logical

Description

isFile returns True if fileName is a file in the current file system; otherwise, it returns False.


Example 1 for FileSystem::isFile
isFile Example 1

The following example calls isFile and displays messages reporting whether the file specifications represent actual files.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  fs FileSystem
endVar

message(isFile("c:\\dos\\chkdsk.exe")) ; displays True
sleep(1500)
message(isFile("c:\\dos\\xxxx.xxx"))   ; displays False
sleep(1500)

endMethod


Example 2 for FileSystem::isFile
isFile Example 2

The following example prompts the user to enter the full path and file name of a file to delete. A call to isFile tests if the file exists, and if it does, a call to delete deletes it:

; buttonOne::pushButton
method pushButton(var eventInfo Event)
var
  fs FileSystem
  fileName String
endVar

fileName = "Enter full path and filename here."
fileName.view("Delete a file")

if isFile(fileName) then         ; if the specified file exists
  fs.delete(fileName)            ; delete the file
  message("File deleted.")
else
  msgStop(fileName, "File not found.")
endIf

endMethod


See Also for FileSystem::isFile
See Also

findFirst

isDir


FileSystem::isFixed
isFixed

See Also	Example	FileSystem Type

Method

Reports whether a drive is fixed.

Syntax

isFixed ( const driveLetter String ) Logical

Description

isFixed returns True if driveLetter represents a fixed (not removable or network) drive; otherwise, it returns False. You can specify driveLetter using a letter ("C") or a letter and a colon ("C:").


Example for FileSystem::isFixed
isFixed Example

In the following example, drive C is the user's local hard disk, and drive H is a network drive:

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  fs FileSystem
endVar

msgInfo("Is drive C fixed?", fs.isFixed("C"))  ; displays True
msgInfo("Is drive H fixed?", fs.isFixed("H"))  ; displays False

endMethod


See Also for FileSystem::isFixed
See Also

isRemote

isRemovable


FileSystem::isRemote
isRemote

See Also	Example	FileSystem Type

Method

Reports whether a drive is remote (a network drive).

Syntax

isRemote ( const driveLetter String ) Logical

description

isRemote returns true if driveLetter represents a remote (network) drive; otherwise, it returns false. You can specify driveLetter using a letter ("C") or a letter and a colon ("C:").


Example for FileSystem::isremote
isRemote Example

In the following example, drive H is a network (remote) drive. this code calls existDrive to make sure drive H is attached, then calls isRemote to find out if drive H is a network drive.

var
   h FileSystem
endVar
if h.existDrive("h") then ; if drive H is attached
   if h.isRemote("h") then
      msgInfo("Drive H: ", "Remote Drive")
   else
      msgInfo("Drive H:", "Not a Remote Drive.")
   endIf
else
   msgStop("Drive H", "Drive is not attached.")
endIf


See Also for FileSystem::isRemote
See Also

isFixed

isRemovable


FileSystem::isRemovable
isRemovable

See Also	Example	FileSystem Type

Method

Reports whether a drive is removable.

Syntax

isRemovable ( const driveLetter String ) Logical

Description

isRemovable returns True if driveLetter represents a removable drive; otherwise, it returns False. You can specify driveLetter using a letter ("C") or a letter and a colon ("C:").


Example for FileSystem::isRemovable
isRemovable Example

In the following example, drive D is a removable drive. This code calls existDrive to make sure drive D is attached, then calls isRemovable to find out if drive D is a removable drive:

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  fs FileSystem
  s  String
endVar

if fs.existDrive("D:") then ; if drive D is attached
  if fs.isRemovable("D") then
    msgInfo("Drive D: ", "Removable Drive")
  else
    msgInfo("Drive D:", "Not a Removable Drive.")
  endIf
endIf

endMethod


See Also for FileSystem::isRemovable
See Also

isFixed

isRemote


FileSystem::makeDir
makeDir

See Also	Example	FileSystem Type

Method

Creates a new directory.

Syntax

makeDir ( const name String ) Logical

Description

makeDir creates all directories and subdirectories specified in name. This method returns True if successful in creating name; otherwise it returns False. This method also returns True if the directory already exists.


Example for FileSystem::makeDir
makeDir Example

The code in the following example tries to create a new directory on drive M. The example displays a dialog box to report whether the method succeeded or failed.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  fs FileSystem

  l Logical
endVar

; this creates \New and \New\Directory etc...
l = fs.makeDir("c:\\New\\Directory\\Tree")

msgInfo("Status", iif(l, "New directory created", "makeDir Failure"))

endMethod


See Also for FileSystem::makeDir
See Also

deleteDir

isDir


FileSystem::name
name

See Also	Example	FileSystem Type

Method

Returns the name of a file.

Syntax

name ( ) String

Description

After a successful findFirst or findNext, name returns the name of the file whose name matches the pattern.


Example for FileSystem::name
name Example

The following example calls findFirst and findNext to find the tables in the current directory, then calls name to create a pop-up menu listing the file names.

; showName::pushButton
method pushButton(var eventInfo Event)
var
  fs FileSystem
  p PopUpMenu
  tv TableView
  choice, path String
endVar

if fs.findFirst("*.db") then    ; if a *.db file exists
  p.addStaticText("Tables")     ; create a pop-up menu
  p.addSeparator()
  p.addText(fs.name())          ; use file names in pop-up
  while fs.findNext()
    p.addText(fs.name())
  endWhile
  choice = p.show()             ; show the menu
  if not choice.isBlank() then  ; if user selected a table
    tv.open(choice)             ; display the selected table
  endif
endIf

endMethod


See Also for FileSystem::name
See Also

fullName

findFirst

findNext


FileSystem::privDir
privDir

See Also	Example	FileSystem Type

Procedure

Returns the name of the user's private directory.

Syntax

privDir ( ) String

Description

privDir returns a string containing the full DOS path (including the drive ID letter) of the user's private directory.

Each user must have a private directory where temporary tables are stored. It can be on a network or a local drive. You can use setPrivDir to specify the path to the private directory.


Example for FileSystem::privDir
privDir Example

The following example calls privDir to display the path to :PRIV: in the status bar.

method pushButton(var eventInfo Event)
   message("Y our private directory is: ", privDir())
endMethod


See Also for FileSystem::privDir
See Also

getDir

setPrivDir

startUpDir

workingDir


FileSystem::rename
rename

See Also	Example	FileSystem Type

Method

Renames a file.

Syntax

rename ( const oldName, String newName String ) Logical

Description

rename changes the name of file oldName to newName. If newName is used by another file, the method fails; it does not overwrite the existing file. rename returns True if it succeeds; otherwise, it returns False. This method is independent of findFirst and findLast.


Example for FileSystem::rename
rename Example

The following example searches the current directory for the file specified in the variable oldName. If it exists, the call to rename tries to rename it. A dialog box appears to report errors, if any.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  fs FileSystem
  oldName, newName String
endVar

oldName = "memo14.txt"
newName = "memo14.bak"

if fs.findFirst(oldName) then
  if not fs.rename(oldName, newName) then
    msgStop("Could not rename file", newName + " already exists.")
  endIf
else
  msgStop(oldName, "File not found.")
endIf

endMethod


See Also for FileSystem::rename
See Also

copy

delete

findFirst

findNext


FileSystem::setDir
setDir

See Also	Example	FileSystem Type

Method

Sets the directory path for a FileSystem variable.

Syntax

setDir ( const name String ) Logical

Description

setDir sets the directory path to name for a FileSystem variable. Compare this method to setDrive, which sets the default drive.


Example for FileSystem::setDir
setDir Example

The following example calls isDir to find if the directory specified in the variable newDir is valid. If it is, the code calls setDir to make newDir the default directory.

method pushButton(var eventInfo Event)
   var
      fs FileSystem
      newDir String
   endVar

   newDir = "c:\\pdoxwin\\mine\\zap"

   if isDir(newDir) then
      fs.setDir(newDir)
   else
      msgStop(newDir, "Not a valid directory.")
   endIf

   message(fs.getDir()) ; displays \pdoxwin\mine\zap
endMethod


See Also for FileSystem::setDir
See Also

getDir

setDrive


FileSystem::setDirLock
setDirLock	5.0

See Also	Example	FileSystem Type

Procedure

Locks a specified directory.

Syntax

setDirLock ( const dirName String ) Logical

Description

setDirLock locks the directory specified in dirName. This method returns True if it succeeds; otherwise, it returns False.

A directory lock makes the directory read-only, which prevents Paradox from attempting to read from or write to a lock file in that directory. A directory lock is required for Paradox to access data from a CD-ROM drive, and can improve performance on network drives and local drives. It will not be respected on a local drive if Local Share is off.


Example for FileSystem::setDirLock
setDirLock Example

This example uses setDirLock to make a network drive read-only when the form opens, and calls clearDirLock to remove the lock when the form closes.

The following code is attached to the form's built-in open method.

method open(var eventInfo Event)

var

h FileSystem

endVar

if eventInfo.isPreFilter() then

;// This code executes for each object on the form:

else

;// This code executes only for the form:

if h.existDrive("h") then ; if drive H is attached

if h.isRemote("h") then

setDirLock("h")

message("Drive H: locked.")

else

msgStop("Drive H:", "Not a Remote Drive.")

return

endIf

else

msgStop("Drive H:", "Drive is not attached.")

return

endIf

endIf

endMethod

The following code is attached to the form's built-in close method.

method close(var eventInfo Event)

var

h FileSystem

endVar

if eventInfo.isPreFilter() then

;// This code executes for each object on the form:

else

;// This code executes only for the form:

if h.existDrive("h") then ; if drive H is attached

if h.isRemote("h") then

clearDirLock("h")

message("Drive H: unlocked.")

else

msgStop("Drive H:", "Not a Remote Drive.")

return

endIf

else

msgStop("Drive H:", "Drive is not attached.")

return

endIf

endIf

endMethod


See Also for FileSystem::setDirLock
See Also

clearDirLock


FileSystem::setDrive
setDrive

See Also	Example1	Example2	FileSystem Type

Method

Makes a specified drive the default drive.

Syntax

setDrive ( const name String ) Logical

Description

setDrive returns True if successful in setting the default drive to name; otherwise, it returns False. You can specify name using a letter ("C") or a letter and a colon ("C:"), or an alias (":MAST:").


Example 1 for FileSystem::setDrive
setDrive Example 1

The following example calls view, defined for the String type, to display a dialog box and prompt the user for input. If the user enters the ID letter of a valid drive, the call to setDrive makes the ID letter the default drive.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  fs FileSystem
  newDrive String
endVar

newDrive = "Enter drive ID or alias here."
newDrive.view("Change default drive.") ; prompt user for input

if fs.existDrive(newDrive) then
  fs.setDrive(newDrive)
else
  msgStop(newDrive, "Drive not available.")
endIf

endMethod


Example 2 for FileSystem::setDrive
setDrive Example 2

The following example shows how to use an alias with setDrive. It assumes that the alias :MAST: has already been defined.

; setDrive::pushButton
method pushButton(var eventInfo Event)
var
  fs FileSystem
endVar

fs.setDrive(":MAST:")

endMethod


See Also for FileSystem::setDrive
See Also

getDrive

setDir


FileSystem::setFileAccessRights
setFileAccessRights

See Also	Example	FileSystem Type

Procedure

Sets access rights (also called attributes) of a file.

Syntax

setFileAccessRights ( const fileName String , const rights String ) Logical

Description

setFileAccessRights sets the attributes (access rights) of fileName to the attributes specified in rights. rights is a string that evaluates to one or more or the following: A, D, H, R, S, V (for archive, directory, hidden, read only, system, and volume, respectively). If you specify an empty string ("") for rights, all attributes for fileName are removed. You don't have to declare a FileSystem variable (or use the findFirst method) before calling setFileAccessRights.


Example for FileSystem::setFileAccessRights
setFileAccessRights Example

The following example sets file attributes for C:\CONFIG.SYS to read only ("R") and hidden ("H").

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  fileName String
endVar

fileName = "C:\\CONFIG.SYS"

; set file attribute for CONFIG.SYS to read only and hidden
if setFileAccessRights(fileName, "RH") then
  ; if successful, display a message with the current attributes
  message (fileName + " attributes set to " +
           getFileAccessRights(fileName))
else
  ; otherwise, the procedure failed
  message("Can't set file attributes for " + fileName)
endif

endMethod


See Also for FileSystem::setFileAccessRights
See Also

accessRights

getFileAccessRights


FileSystem::setPrivDir
setPrivDir	5.0

See Also	Example1	Example2	FileSystem Type

Procedure

Sets or changes the private directory (:PRIV:).

Syntax

setPrivDir ( const path String ) Logical

Description

setPrivDir specifies in path the path to the current private directory (:PRIV:). This method returns True if it succeeds; otherwise, it returns False. The following table gives examples of valid values for path:

Value of path	Example

Directory name	ORDERS

Full path	C:\\PDOXWIN\\APPS\\ORDERS\\

Relative path	..\\..\\ORDERS

Alias	:ORDERS:

Paradox closes all its open windows (prompting you to save documents, as needed) and frees all locks before setting the private directory. Therefore, setPrivDir does not take effect until all ObjectPAL code has finished executing. You can keep a form open by adding code to its built-in menuAction method to trap for the MenuChangingPriv menu command (see the example for details). If you do so, save any documents that need saving before changing the working directory. This method returns True if it succeeds; otherwise, it returns False.

ObjectPAL provides the following MenuCommands constants for handling changes to the private directory:

Constant	Description

MenuFilePrivateDir	Issued when the user chooses File | Private Directory from the built-in Paradox menu. Trap for this constant to prevent the user from changing the private directory.

MenuChangingPriv	Issued just before :PRIV: changes. Trap for this constant to keep a form open when changing the private directory.

MenuChangedPriv	Issued just after :PRIV: changes. Trap for this constant to find out when the private directory has changed.

ObjectPAL also provides the constant MenuFileWorkingDir, issued when the user chooses File | Working Directory from the built-in Paradox menu.


Example 1 for FileSystem::setPrivDir
setPrivDir Example 1

The following example handles a menu choice to change the private directory, and also handles the resulting menu commands generated by Paradox. When the user chooses File | Private Directory from the default Paradox menu, this code calls disableDefault to block the default behavior, thus preventing Paradox from displaying the Set Private Dir dialog box. Next, it tests the value of a Logical variable okToChangePriv (assumed to be declared  and assigned elsewhere). If okToChangePriv is True, it calls setPrivDir to set :PRIV: behind the scenes.

This code also handles the MenuChangingPriv menu command, issued by Paradox just before it changes the private directory. The call to setErrorCode sets the error code to a nonzero value, which keeps this form open when :PRIV: changes. This code also responds to the MenuChangedPriv menu command, issued by Paradox just after it changes the private directory.

method menuAction(var eventInfo MenuEvent)

const
kKeepFormOpen = UserMenu	; UserMenu is an ObjectPAL constant.

endConst	; Any nonzero value keeps the form open.

; In a real app you'd declare and assign this variable elsewhere.

okToChangePriv = True

switch
case eventInfo.id() = MenuFilePrivateDir :
disableDefault                 ; Block the default behavior.

if okToChangePriv then
setPrivDir("c:\\pdx\\mine") ; Set :PRIV: to hard-coded path.

else

return

endIf

case eventInfo.id() = MenuChangingPriv :
eventInfo.setErrorCode(kKeepFormOpen)

case eventInfo.id() = MenuChangedPriv :
; You may want to take some action after changing :PRIV:.
; This example just displays the new path.
message(privDir())
sleep(1000)

otherwise : doDefault
endSwitch
endMethod


Example 2 for FileSystem::setPrivDir
setPrivDir Example 2

In the following example, the open and the menuAction methods of a form are used to set the private directory before the form opens. In the form's built-in open method, setPrivDir changes the current private directory to the same directory as the form. The ObjectPAL code in the menuAction prevents the form from closing during the change.

The following code is attached to the form's built-in open method. It gets the form's file name and uses it to set the private directory.

;frm1 :: open

method open(var eventInfo Event)

var

f	Form

dynPath	DynArray[] String

endVar

if eventInfo.isPreFilter() then

;// This code executes for each object on the form:

f.attach()

splitFullFileName(f.getFileName(), dynPath)

setPrivDir(dynPath["Drive"] + dynPath["Path"])

else

;// This code executes only for the form:

endIf

endMethod

The following code is attached to the form's built-in menuAction method. It keeps the form open after changing the private directory.

;frm1 :: menuAction

method menuAction(var eventInfo MenuEvent)

const

kKeepFormOpen = UserMenu 	; UserMenu is an ObjectPAL constant.

endConst	; Any nonzero value keeps the form open.

if eventInfo.isPreFilter() then

;// This code executes for each object on the form:

if eventInfo.id() = MenuChangingPriv then

eventInfo.setErrorCode(kKeepFormOpen)

endIf

else

;// This code executes only for the form:

endIf

endMethod


See Also for FileSystem::setPrivDir
See Also

privDir

setWorkingDir


FileSystem::setWorkingDir
setWorkingDir	5.0

See Also	Example1	Example2	FileSystem Type

Procedure

Sets or changes the working directory (:WORK:).

Syntax

setWorkingDir ( const path String ) Logical

Description

setWorkingDir specifies in path the path to the current working directory (:WORK:). The following table gives examples of valid values for path:

Value of path	Example

Directory name	ORDERS

Full path	C:\\PDOXWIN\\APPS\\ORDERS\\

Relative path	..\\..\\ORDERS

Alias	:ORDERS:

By default, Paradox closes all its open windows (prompting you to save documents, as needed) before setting the working directory. Therefore, setWorkingDir does not take effect until all ObjectPAL code has finished executing. You can keep a form open by adding code to its built-in menuAction method to trap for the MenuChangingWork menu command (see the example for details). If you do so, save any documents that need saving before changing the working directory. This method returns True if it succeeds; otherwise, it returns False.

ObjectPAL provides the following MenuCommands constants for handling changes to the working directory:

Constant	Description

MenuFileWorkingDir	Issued when the user chooses File | Working Directory from the built-in Paradox menu. Trap for this constant to prevent the user from changing the working directory.

MenuChangingWork	Issued just before :WORK: changes. Trap for this constant to keep a form open when changing the working directory.

MenuChangedWork	Issued just after :WORK: changes. Trap for this constant to find out when the working directory has changed.

ObjectPAL also provides the constant MenuFilePrivateDir, issued when the user chooses File | Private Directory from the built-in Paradox menu.


Example 1 for FileSystem::setWorkingDir
setWorkingDir Example 1

The following example handles a menu choice to change the working directory, and also handles the resulting menu commands generated by Paradox. When the user chooses File | Working Directory from the default Paradox menu, this code calls disableDefault to block the default behavior, thus preventing Paradox from displaying the Set Working Dir dialog box. Next, it tests the value of a Logical variable okToChangeWork (assumed to be declared  and assigned elsewhere). If okToChangeWork is True, it calls setWorkingDir to set :WORK: behind the scenes.

This code also handles the MenuChangingWork menu command, issued by Paradox just before it changes the working directory. The call to setErrorCode sets the error code to a nonzero value, which keeps this form open when :WORK: changes. This code also responds to the MenuChangedWork menu command, issued by Paradox just after it changes the working directory.

method menuAction(var eventInfo MenuEvent)
const
kKeepFormOpen = UserMenu	; UserMenu is an ObjectPAL constant.

endConst	; Any nonzero value keeps the form open.

; In a real app you'd declare and assign this variable elsewhere.

okToChangeWork = True

switch
case eventInfo.id() = MenuFileWorkingDir :
disableDefault                 ; Block the default behavior.

if okToChangeWork then
setWorkingDir("c:\\pdx\\mine") ; Set :WORK: to hard-coded path.

else

return

endIf

case eventInfo.id() = MenuChangingWork :
eventInfo.setErrorCode(kKeepFormOpen)

case eventInfo.id() = MenuChangedWork :
; You may want to take some action after changing :WORK:.
; This example just displays the new path.
message(workingDir())
sleep(1000)

otherwise : doDefault
endSwitch
endMethod


Example 2 for FileSystem::setWorkingDir
setWorkingDir Example 2

In the following example, the open and the menuAction methods of a form are used to set the working directory before the form opens. In the form's built-in open method, setWorkingDir changes the current working directory to the same directory as the form. The ObjectPAL code in the menuAction prevents the form from closing during the change.

The following code is attached to the form's built-in open method. It gets the form's file name and uses it to set the working directory.

;frm1 :: open

method open(var eventInfo Event)

var

f	Form

dynPath	DynArray[] String

endVar

if eventInfo.isPreFilter() then

;// This code executes for each object on the form:

f.attach()

splitFullFileName(f.getFileName(), dynPath)

setWorkingDir(dynPath["Drive"] + dynPath["Path"])

else

;// This code executes only for the form:

endIf

endMethod

The following code is attached to the form's built-in menuAction method. It keeps the form open after changing the working directory.

;frm1 :: menuAction

method menuAction(var eventInfo MenuEvent)

const

kKeepFormOpen = UserMenu 	; UserMenu is an ObjectPAL constant.

endConst	; Any nonzero value keeps the form open.

if eventInfo.isPreFilter() then

;// This code executes for each object on the form:

if eventInfo.id() = MenuChangingWork then

eventInfo.setErrorCode(kKeepFormOpen)

endIf

else

;// This code executes only for the form:

endIf

endMethod


See Also for FileSystem::setWorkingDir
See Also

setPrivDir

workingDir


FileSystem::size
size

See Also	Example	FileSystem Type

Method

Returns the size of a file.

Syntax

size ( ) LongInt

Description

After a successful findFirst or findNext, size returns the number of bytes in a found file.


Example for FileSystem::size
size Example

The following example creates a DynArray containing the file names and sizes of the Paradox tables in the current directory. The call to view, defined for the DynArray type, displays the information in a dialog box.

; demoButton::pushButton
method pushButton(var eventInfo Event)
var
  fs FileSystem
  da DynArray[] LongInt
endVar

if fs.findFirst("*.db") then
  da[fs.name()] = fs.size()
  while fs.findNext()
    da[fs.name()] = fs.size()
  endWhile
  da.view("Names and sizes")
else
  msgStop("*.db", "file not found.")
endIf

endMethod


See Also for FileSystem::size
See Also

freeDiskSpace

totalDiskSpace


FileSystem::splitFullFileName
splitFullFileName

See Also	Example1	Example2	Example3	FileSystem Type

Procedure

Breaks a full path name into its component parts.

Syntax

1. splitFullFileName ( const fullFileName String, var components DynArray[ ] String )

2. splitFullFileName ( const fullFileName String, var driveName String, var pathName String, var fileName String, var extensionName String )

Description

splitFullFileName divides a full file path (typically obtained using fullName) into its component parts. This method does not return the values directly; instead, it assigns them to variables you declare and pass as arguments.

Syntax 1 assigns the results to a DynArray that you must declare and pass as an argument. The DynArray has the following keys: DRIVE, PATH, NAME, and EXT.

Syntax 2 assigns the results to four String variables that youn must declare and pass as arguments.

With both syntaxes, the file path components include colons, periods, slashes, and backslashes, as appropriate. For example, given a full file name of C:\PDOXWIN\FORMS\ORDERS.FSL, splitFullFileName assigns values as follows:

DRIVE =  C:, PATH = \PDOXWIN\FORMS\ NAME = ORDERS, and EXT = .FSL.

The DRIVE variable (or key) stores everything up to and including the last colon in the file name. If the file name includes an alias, the alias is assigned to DRIVE. If the file name does not include a drive or an alias, an empty string is assigned to DRIVE.

The PATH variable (or key) stores everything following the drive, up to and including the last backslash or slash. If the file name does not include a path, an empty string is assigned to PATH. If a directory name in the path includes an extension, it is included.

The NAME variable (or key) stores everything following the path, up to but not including the last period that separates a file name from its extension. If the file name does not include a name, an empty string is assigned to NAME.

The EXT variable (or key) stores everything following the name, including the last period. If the file name does not include an extension, an empty string is assigned to EXT.


Example 1 for FileSystem::splitFullFileName
splitFullFileName Example 1

The following example calls fullName to get the full name of the first form listed in the current directory. Then it calls splitFullFileName to split the name into its component parts and store them in a DynArray, then it calls view to display the DynArray.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  fs FileSystem
  splitName DynArray[] anytype
  fullFileName String
endVar

; if the customer.db file is in the sample directory
if fs.findFirst("c:\\pdoxwin\\sample\\customer.db") then

  ; store the full file name to a variable
  fullFileName = fs.fullName()

  ; split file name into parts and store them in a DynArray
  splitFullFileName(fullFileName, splitName)

  ; display the component parts
  splitName.view("Split name")
endIf

endMethod


Example 2 for FileSystem::splitFullFileName
splitFullFileName Example 2

The following example calls splitFullFileName to split the full name of a form into its component parts, then displays the path and the file name (without an extension) in dialog boxes.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  fs FileSystem
  driveName, pathName, fileName, extName String
endVar

if fs.findFirst("*.fsl") then
  splitFullFileName(fs.fullName, driveName, pathName, fileName, extName)
  pathName.view("Path name") ; displays the path
  fileName.view("File name") ; displays the filename (no extension)
endIf

endMethod


Example 3 for FileSystem::splitFullFileName
splitFullFileName Example 3

The following example displays a dialog box and prompts you to enter a value. It calls splitFullFileName to split the value into its component parts, then displays the parts in dialog boxes. Use this example to observe how splitFullFileName deals with aliases, incomplete or complex file names, and the like.

; thisButton::pushButton
method pushButton(var eventInfo Event)

var

stTestFileName,

stPrompt,

stDrive,

stPath,

stName,

stExt	String

dyFileName	DynArray[] String

endVar

stPrompt = "Enter a file name here."

stTestFileName = stPrompt

stTestFileName.view("Enter a file name to split:")

if stTestFileName = stPrompt then

; User closed the dialog box without clicking OK,

; or clicked OK without typing a value.

return

else

; User typed a value and clicked OK.

splitFullFileName(stTestFileName, dyFileName)

dyFileName.view("DynArray")

splitFullFileName(stTestFileName, stDrive, stPath, stName, stExt)

stDrive.view("Drive")

stPath.view("Path")

stName.view("Name")

stExt.view("Ext")

endIf

endMethod


See Also for FileSystem::splitFullFileName
See Also

fullName


FileSystem::startUpDir
startUpDir

See Also	Example	FileSystem Type

Procedure

Returns a string containing the path to the user's start-up directory.

Syntax

startUpDir ( ) String

Description

startUpDir returns a string containing the full path (including the drive ID letter) to the user's start-up directory; that is the directory from which Paradox was started.


Example for FileSystem::startUpDir
startUpDir Example

The following example displays a dialog box listing the path to the directory from which the user started Paradox:

; thisButton::pushButton
method pushButton(var eventInfo Event)

msgInfo("Start-up directory", startUpDir())

endMethod


See Also for FileSystem::startUpDir
See Also

privDir

workingDir


FileSystem::time
time

See Also	Example	FileSystem Type

Method

Returns the time and date a file was last modified.

Syntax

time ( ) DateTime

Description

time returns a DateTime value representing the time and date of the last modification to a file.


Example for FileSystem::time
time Example

The following example calls time to get the time and date of the most recent changes to the Customer table. Then, statements compare the modification date with today's date and report the results.

method pushButton(var eventInfo Event)
   var
      fs FileSystem
   endVar

   if fs.findFirst("customer.db") then
      if fs.time() < DateTime(today()) then
         message("old version")
      else
         message("new version")
      endif
   endIf
endMethod


See Also for FileSystem::time
See Also

fullName

size


FileSystem::totalDiskSpace
totalDiskSpace

See Also	Example	FileSystem Type

Method

Returns the capacity of a drive.

Syntax

totalDiskSpace ( const driveLetter String ) LongInt

Description

totalDiskSpace returns the total number of bytes drive driveLetter can hold. You can specify driveLetter using a letter ("C") or a letter and a colon ("C:").


Example for FileSystem::totalDiskSpace
totalDiskSpace Example

The following example calls totalDiskSpace and freeDiskSpace to calculate the amount of space in use. It stores the information in a DynArray, then calls the view method defined for the DynArray type to display the information in a dialog box.

; spaceUsed::pushButton
method pushButton(var eventInfo Event)
var
  fs FileSystem
  da DynArray[] LongInt
endVar

da["Total space"] = fs.totalDiskSpace("C")
da["Free space"] = fs.freeDiskSpace("C")
da["Space in use"] = da["Total space"] - da["Free space"]
da.view("Drive C")

endMethod


See Also for FileSystem::totalDiskSpace
See Also

freeDiskSpace


FileSystem::windowsDir
windowsDir

See Also	Example	FileSystem Type

Procedure

Returns the path to the WINDOWS directory.

Syntax

windowsDir ( ) String

Description

windowsDir returns the path to the WINDOWS directory.


Example for FileSystem::windowsDir
windowsDir Example

The following example reads the file WIN.INI from drive B and copies it to the WINDOWS directory on the default drive:

; copyWinIni::pushButton
method pushButton(var eventInfo Event)
var
  fs FileSystem
  fileName, destName String
endVar

fileName = "\\win.ini"

fs.setDrive("B")
if fs.findFirst(fileName) then
  destName = windowsDir() + fileName
  fs.copy(fileName, destName)
endIf

endMethod


See Also for FileSystem::windowsDir
See Also

windowsSystemDir

workingDir

privDir

startUpDir


FileSystem::windowsSystemDir
windowsSystemDir

See Also	Example	FileSystem Type

Procedure

Returns the path to the Windows system directory.

Syntax

windowsSystemDir ( ) String

Description

windowsSystemDir returns the path to the Windows system directory.


Example for FileSystem::windowsSystemDir
windowsSystemDir Example

The following example reads the file SPECIAL.DRV from drive B and copies it to the Windows system directory on the default drive:

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  fs FileSystem
  fileName, destName String
endVar

fileName = "\\special.drv"

fs.setDrive("B")
if fs.findFirst(fileName) then
  destName = windowsSystemDir() + fileName
  fs.copy(fileName, destName)
endIf

endMethod


See Also for FileSystem::windowsSystemDir
See Also

windowsDir


FileSystem::workingDir
workingDir

See Also	Example	FileSystem Type

Procedure

Returns the name of the current working directory.

Syntax

workingDir ( ) String

Description

workingDir returns the name (including the path) of the current working directory (:WORK:).


Example for FileSystem::workingDir
workingDir Example

The following example displays a message containing the path to the current working directory:

; thisButton::pushButton
method pushButton(var eventInfo Event)

message("Working directory is: " + workingDir())

endMethod


See Also for FileSystem::workingDir
See Also

privDir

windowsDir

windowsSystemDir


Disk errors

See Also

When a method fails because of a disk error, the error code constant is peDiskError, and the error message is, "A disk error occurred: " plus one of the following strings:

"Invalid function number."

"The file could not be found."

"The directory path could not be found."

"No file handle available."

"Access to this file is denied. It is read only or a directory."

"Invalid handle."

"Memory control blocks have been damaged."

"Insufficient memory to allocate file structures."

"Invalid memory block address."

"Invalid environment."

"Invalid format."

"Invalid file access byte."

"Invalid data."

"Invalid drive."

"Cannot remove the current directory."

"Not the same device."

"No more files match the wildcard specification."

"Cannot write to a write-protected disk."

"Unknown unit."

"The drive is not ready."

"Command is not recognized."

"Checksum error (Bad CRC)."

"Invalid request structure length."

"File seek error."

"Unknown media type."

"Sector not found."

"Out of paper."

"An error occurred while trying to write to the disk."

"An error occurred while trying to read from the disk."

"General DOS error."

"File sharing violation."

"File lock violation."

"Invalid disk change."

"File control blocks unavailable."

"Sharing buffer overflow."

"Bad code page."

"Handle EOF."

"The disk is full."

"Device is not supported."

"Device is not listening."

"Duplicate name."

"Invalid network path."

"The network is busy."

"The device does not exist."

"Too many commands."

"Adapter error."

"Invalid network response."

"Network error."

"Adapter is incompatible."

"The print queue is full."

"Out of spool space."

"Print job was canceled."

"The network name was deleted."

"Your access to the network is denied."

"Invalid device type."

"Invalid network name."

"Too many names."

"Too many sessions."

"Sharing pause."

"Request not accepted."

"Redirection pause."

"The file already exists."

"Duplicate file control blocks."

"Cannot create the specified directory."

"DOS critical error."

"Out of structures. Cannot perform operation."

"Drive is already assigned."

"Invalid password."

"Invalid parameter."

"Network write error."

"Comp command is not loaded."

"The mode specification is invalid."

"Cannot write to the file because it was opened in read-only mode."


See Also for Disk Errors

FileSystem Type


Form Type

Changes

A Form variable provides a handle for working with a Paradox form. Form type methods let you

Load a form in a design window and save a design

Open and close a form

Attach to an open form

Work with tables in a data model

Work with table aliases

Enumerate object names, properties, and source code for methods

Determine and change the position of a form, as well as maximize or minimize the form

Send events to a form, such as a mouseUp or keyPhysical

Get and set methods for a form

The Form type is the base type from which the other Display manager types (for example, Report) are derived. Many of the methods listed in this section are used by the Application, Report, and TableView types, too.

Methods in the Form Type

Form

action

attach

bringToTop

close

create

delayScreenUpdates

deliver

design

disableBreakMessage

dmAddTable

dmAttach

dmBuildQueryString

dmEnumLinkFields

dmGet

dmGetProperty

dmHasTable

dmLinkToFields

dmLinkToIndex

dmPut

dmRemoveTable

dmResync

dmSetProperty

dmUnlink

enumDataModel

enumSource

enumSourceToFile

enumTableLinks

enumUIObjectNames

enumUIObjectProperties

formCaller

formReturn

getFileName

getPosition

getProtoProperty

getSelectedObjects

getStyleSheet

getTitle

hide

hideToolbar

isDesign

isMaximized

isMinimized

isToolbarShowing

isVisible

keyChar

keyPhysical

load

maximize

menuAction

methodDelete

methodGet

methodSet

minimize

mouseDouble

mouseDown

mouseEnter

mouseExit

mouseMove

mouseRightDouble

mouseRightDown

mouseRightUp

mouseUp

moveToPage

open

openAsDialog

postAction

run

save

saveStyleSheet

selectCurrentTool

setMenu

setPosition

setProtoProperty

setSelectedObjects

setStyleSheet

setTitle

show

showToolbar

wait

windowClientHandle

windowHandle


Changes to Form type methods

The following table lists new methods and methods that were changed for version 5.0. All methods with "SpeedBar" in their names were changed to use "Toolbar" in version 5.0. For example, hideSpeedBar was replaced by hideToolbar. ObjectPAL code that uses the old names will compile and execute as before, but you should use the new names whenever possible.

New	Changed

dmAttach	dmGet

dmBuildQueryString	dmGetProperty

dmEnumLinkFields	dmHasTable

dmResync	dmLinkToFields

enumDataModel	dmLinkToIndex

getProtoProperty	dmPut

getSelectedObjects	dmRemoveTable

getStyleSheet	dmSetProperty

hideToolbar	dmUnlink

isDesign	enumTableLinks

isToolbarShowing

load

saveStyleSheet

selectCurrentTool

setMenu

setProtoProperty

setSelectedObjects

setStyleSheet

showToolbar


Form::action
action

See Also	Example	Form Type

Method/Procedure

Performs an action command.

Syntax

action ( const actionId SmallInt ) Logical

Description

action performs the action represented by the constant actionId, where actionId is a constant in one of the following action classes:

ActionDataCommands

ActionEditCommands

ActionFieldCommands

ActionMoveCommands

ActionSelectCommands

You can also use action to send a user-defined action constant to a built-in action method. User-defined action constants are simply integers that don't interfere with any of ObjectPAL's constants. You can use them to signal other parts of an application. For instance, assume that the Const window for a form declares a constant named myAction. In the built-in action method for a page on the form, you might check the value of every incoming ActionEvent (with the id method); if the value is equal to myAction, you can respond to that action accordingly. Paradox's default response for user-defined action constants is simply to pass the action to the action method.

This action method is distinct from the built-in action method for a form or for any other UIObject. The built-in action method for an object responds to an action event; this method causes an ActionEvent.

Note:	When you call the action method as a procedure, the form dispatches it to the object represented by self. The event bubbles through the containership heirarchy until the event either reaches an object that can handle the action or the event reaches the form. If the event reaches the form, and the action is a data action, the form sends the event to the master table for the form.


Example for Form::action
action Example

In the following example, a form named Sitenote contains field objects bound to the Sites table. The current form contains a button named openEditSites; the pushButton method for openEditSites opens Sitenote, starts Edit mode, and waits for Sitenote to be closed:

; openEditSites::pushButton
method pushButton(var eventInfo Event)
var
  siteForm   Form
endVar
siteForm.open("Sitenote.fsl")  ; open Sitenote
siteForm.action(DataBeginEdit) ; start Edit mode on siteForm
message("To return, close Sitenote form.")
siteForm.wait()                ; this form will be inactive until
                               ; Sitenote returns
siteForm.close()               ; this form must close Sitenote
endMethod


See Also for Form::action
See Also

UIObject::action


Form::attach
attach

See Also	Example	Form Type

Method

Associates a Form variable with an open form.

Syntax

attach ( [ const formTitle String ] ) Logical

Description

attach associates a Form variable with an open form. You can use formTitle to specify a form's current title, or you can omit formTitle to attach to the form where attach is executing. This method returns True if it succeeds; otherwise, it returns False.

Note:	The argument formTitle specifies a form's title as displayed in the title bar (for example, Orders), not the form's file name or UIObject name. You can specify a form's title interactively by choosing Properties | Form | Window Style and entering a value in the Form Window Properties dialog box. You can specify a title in ObjectPAL by setting a form's Title property, or by calling setTitle.


Example for Form::attach
attach Example

In the following example, a form has two buttons: openSites and attachToSites. The pushButton method for openSites takes care of opening the Sitenote form. The pushButton method for attachToSites attaches the form variable sitesForm to the open form by way of the form's current title. In this case, the form title wasn't changed, so attachToSites can attach to Sitenote using the default title. Once attached, the pushButton method uses the sitesForm handle to minimize, maximize, and restore Sitenote.

The following code is attached to the pushButton method for openSites:

; openSites::pushButton
method pushButton(var eventInfo Event)
var
sitesForm Form
endVar

sitesForm.open("Sitenote")

siteForm.Title = "Notes" ; Set the form's title.

endMethod

This code is attached to the pushButton method for attachToSites:

; attachToSites::pushButton
method pushButton(var eventInfo Event)
var
  sitesForm  Form
endVar

; Attach to Sitenote by its title (Notes).
; Note that this won't work:   sitesForm.attach("Sitenote")
if not sitesForm.attach("Notes") then

errorShow()

return

endIf

; cycle through sizes
sitesForm.minimize()                ; minimize the form
sleep(2000)                         ; pause
sitesForm.maximize()                ; maximize the form
sleep(2000)                         ; pause
sitesForm.show()                    ; restore to original size
endMethod


See Also for Form::attach
See Also

getTitle

setTitle

open


Form::bringToTop
bringToTop

See Also	Example	Form Type

Beginner

Method/Procedure

Brings the window to the top of the display stack and makes it active.

Syntax

bringToTop ( )

Description

When several windows are displayed they seem to overlap, giving an appearance of layers. Use bringToTop to display a window at the top of the stack, not overlapped by any other windows. bringToTop makes a form the active window.

If a hide statement has made a form invisible, bringToTop makes it visible again.


Example for Form::bringToTop
bringToTop Example

In the following example, the pushButton method for a button named openSeveral opens the Sitenote form, then opens a table window for the Orders table. The table window, orderTV, opens over the Sitenote form, siteForm. The method pauses for a few seconds, then makes siteForm the topmost layer:

; openSeveral::pushButton
method pushButton(var eventInfo Event)
var
   siteForm  Form
   orderTV   TableView
endVar
siteForm.open("Sitenote.fsl")     ; opens Sitenote form
orderTV.open("orders")        ; opens Orders over Sitenote
message("About to make the Sitenote form the highest layer.")
beep()
sleep(5000)                   ; pause
siteForm.bringToTop()         ; make Sitenote highest layer
layer
endMethod


See Also for Form::bringToTop
See Also

isVisible

hide

show


Form::close
close

See Also	Example	Form Type

Beginner

Method/Procedure

Closes a window.

Syntax

1. ( Method ) close ( )

2. ( Procedure ) close ( [ const returnValue AnyType ] )

Description

close closes a window as if the user had chosen Close from the Control menu.


Example for Form::close
close Example

The following example demonstrates using close to return a value to a form that called it with wait. Assume a form contains a button called btn1. A second form contains two buttons called btnReturnOK and btnReturnCancel. The first form opens the second form and waits for one of three values: OK, Cancel, or False. OK and Cancel are returned from the two buttons on the second form (see code below) and False is returned if the user closes the second form without pressing a button. The first form processes the users selection in a switch statement that calls one of three custom methods (assumed to be defined elsewhere).

The following code is attached to the button btn1 in the first (calling) form.

;frm1.btn1 :: pushButton

method pushButton(var eventInfo Event)

var

f	Form	;Declare form variable.

s	String	;Declare string value.

endVar

f.open("wait2")	;Open form that will return string.

s = string(f.wait())	;Wait for value from other form.

s.view("Returned value")	;View returned value.

;Process returned value using custom methods defined elseqhere.

switch

case s = "OK"    : cmOK()	    ;User pressed the OK button.

case s = "Cancel": cmCancel();User pressed the Cancel button.

case s = "False" : cmNone()  ;User closed form, no button pressed.

endSwitch

endmethod

The following code is attached to the button btnReturnOK in the second (called) form.

;frm2.btnReturnOK :: pushButton

method pushButton(var eventInfo Event)

close("OK")	;Close & return OK.

endmethod

The following code is attached to the button btnReturnCancel in the second (called) form.

;frm2.btnReturnCancel :: pushButton

method pushButton(var eventInfo Event)

close("Cancel")	;Close & return Cancel.

endmethod


See Also for Form::close
See Also

open


Form::create
create

See Also	Example	Form Type

Method

Creates a blank form in a design window.

Syntax

create ( ) Logical

Description

create creates a blank form and leaves it in a design window. You can use the UIObject type methods create and methodSet to place objects in the new form and attach methods to them. You can attach methods to the form using the Form type method methodSet. Use the Form type method run to open the form in a Form window.


Example for Form::create
create Example

In the following example, the pushButton method for a button named createAForm creates a new form with the create method and sets the value of the new form's mouseUp method with setMethod. The pushButton method for createAForm then saves the new form to a file named NEWHELLO.FSL, runs the form, and calls the new form's mouseUp method (supplying the correct arguments). The mouseUp method for the Newhello form opens a dialog box that displays "Hello". Once the dialog box is closed (by the user), the pushButton method for createAForm closes the Newhello form.

; createAForm::pushButton
method pushButton(var eventInfo Event)
var
   newForm Form
endVar
newForm.create()              ; create a new blank form (a design window)
newForm.methodSet("mouseUp",  ; set the mouseUp method for the form
"method mouseUp(var eventInfo MouseEvent)
msgInfo(\"Greetings\", \"Hello\")
endMethod")                   ; backslashes delimit embedded quotes
newForm.save("newhello")      ; save the form
newForm.run()                 ; run the new form (View Data window)
                              ; call the mouseUp method for the form
newForm.mouseUp(100, 100, LeftButton )  ; dialog box displays "Hello"
newForm.close()               ; close the form
endMethod


See Also for Form::create
See Also

design

load

open

methodGet

methodSet

run

UIObject::create

UIObject::methodGet

UIObject::methodSet


Form::delayScreenUpdates
delayScreenUpdates

See Also	Example	Form Type

Procedure

Turns delayed screen updates on or off.

Syntax

delayScreenUpdates ( const yesNo Logical )

Description

delayScreenUpdates postpones or enables redrawing areas of the screen. You must specify Yes or No in yesNo. Specifying Yes delays screen updates (redraws) until the system yields or is idle. This can increase performance in operations that frequently refesh the display (for example, when using ObjectPAL to add items to a list). Specifying No allows screen updates to occur without delay.

For some operations, you won't notice a difference when delayScreenUpdates is set to Yes. This is especially true if the application is running on a fast machine.


Example for Form::delayScreenUpdates
delayScreenUpdates Example

The following two methods override the pushButton methods for their respective buttons. The drawOneByOne button draws a number of boxes without changing delayScreenUpdates. The drawAllAtOnce button draws the same number of boxes, to a different location, but first sets delayScreenUpdates to Yes. If you run this code, you'll see the boxes created by drawOneByOne appear one at a time, but still rapidly. The boxes created by drawAllAtOnce are created behind the scenes---which causes a short pause---then appear all at the same time.

; drawOneByOne::pushButton
method pushButton(var eventInfo Event)
var
  ui UIObject
endVar

; delayScreenUpdates(No) is the default
; Create and display a set of boxes, showing them as
; they're created.
for i from 750 to 2550 step 300
  for j from 750 to 2550 step 300
    ui.create(boxTool, i, j, 150, 150)
    ui.Color = Blue
    ui.Visible = Yes
  endfor
endfor
endMethod

The drawAllAtOnce button on the same form creates the same number of boxes, but does so with delayScreenUpdates set to Yes. On very fast machines, you still may not be able to see the difference.

; drawAllAtOnce::pushButton
method pushButton(var eventInfo Event)
var
  ui UIObject
endVar

delayScreenUpdates(Yes)
; This code will create all boxes, then display
; them all at once.
for i from 4950 to 6750 step 300
  for j from 750 to 2550 step 300
    ui.create(boxTool, i, j, 150, 150)
    ui.Color = Red
    ui.Visible = Yes
  endfor
endfor
; reset to default
delayScreenUpdates(No)

endMethod


See Also for Form::delayScreenUpdates
See Also

System::sleep


Form::deliver
deliver

See Also	Example	Form Type

Method

Delivers a form.

Syntax

deliver ( ) Logical

Description

deliver behaves like Form | Deliver. This method saves a copy of a form with an .FDL extension, which prevents users from editing the form in the Form Design window. Users can open the form only in a Form window. Switching to the Form Design window on an open, delivered form is also prohibited. For more information about saving and delivering forms, refer to the User's Guide.

Paradox opens saved forms before delivered forms with the same name. For example, suppose the working directory contains ORDERS.FSL (a saved form) and ORDERS.FDL (a delivered form). The following statement opens the saved form, ORDERS.FSL.

ordersForm.open("ORDERS") ; Opens :WORK:ORDERS.FSL.

To specify a delivered form, include the .FDL extension. For example,

ordersForm.open("ORDERS.FDL") ; Opens the delivered form.


Example for Form::deliver
deliver Example

In the following example, the createDeliver button creates a new form, saves it to the name Newhello, then delivers it (which saves a version as NEWHELLO.FDL). When the method attempts to load the form in a design window, load returns False, because a delivered form can't be loaded in a design window.

; createDeliver::pushButton
method pushButton(var eventInfo Event)
var
   newForm Form
endVar
newForm.create()              ; create a new blank form (a design window)
newForm.save("newhello")      ; save the form
newForm.deliver()             ; deliver the newly created form
newForm.close()               ; close the form
if NOT newForm.load("newhello.fdl") then  ; load will return False
   errorShow("Can't load a delivered form.")
endif
endMethod


See Also for Form::deliver
See Also

save


Form::design
design

See Also	Example	Form Type

Method

Switches a form from the Form window to the Form Design window.

Syntax

design ( ) Logical

Description

design switches a form from the Form window to the Form Design window. This method works only with saved forms (.FSL); it does not work with delivered forms (.FDL). For more information about saving and delivering forms, refer to the Guide to ObjectPAL.

Use run to switch from the Form Design window to the Form window.

Note:	Some form actions are especially processor-intensive. In some situations, you might need to follow a call to open, load, design, or run with a sleep. See the sleep method in the System type for more information.


Example for Form::design
design Example

This example uses a custom procedure to force a form (specified by its title) into design mode.

proc forceDesign(const foTemp Form) Logical

if foTemp.isDesign() then

return True

else

return foTemp.design()

endIf

endProc


See Also for Form::design
See Also

create

load

open

run


Form::disableBreakMessage
disableBreakMessage

See Also	Example	Form Type

Procedure

Prevents program interruption by Ctrl+Break.

Syntax

disableBreakMessage ( const yesNo Logical ) Logical

Description

disableBreakMessage lets you prevent or allow the user to interrupt a running program with Ctrl+Break.


Example for Form::disableBreakMessage
disableBreakMessage Example

In the following example, assume a form contains a table frame bound to the Orders table. The following code prevents the loop from being interrupted by a Ctrl+Break.

; throughTable::pushButton

method pushButton(var eventInfo Event)
; just a loop to test Ctrl-breaking out of
disableBreakMessage(Yes)     ; don't allow a Ctrl+Break
while NOT ORDERS.atLast()
  ORDERS.action(DataNextRecord)
endwhile
endMethod


See Also for Form::disableBreakMessage
See Also

System::disablePreviousError

System::debug


Form::dmAddTable
dmAddTable

See Also	Example	Form Type

Method/Procedure

Adds a table to a form's data model.

Syntax

dmAddTable ( const tableName String ) Logical

Description

dmAddTable adds the table tableName to a form's data model, where tableName is a valid table name. This method returns True if it succeeds; otherwise, it returns False.


Example for Form::dmAddTable
dmAddTable Example

In the following example, a form contains a button named toggleSites, and a list field named showSiteNames. The list data for the showSiteNames field is set with the DataSource property of its list object, ListNames. The pushButton method for toggleSites checks to see if the Sites table is in the data model for the form. If so, the reference to Sites is removed from the DataSource property of ListNames, then Sites is removed from the data model. Otherwise, the Sites table is added to the data model, and the DataSource property of ListNames is set to the Site Name field of Sites.

This is the code for the pushButton method of toggleSites:

; toggleSites::pushButton
method pushButton(var eventInfo Event)
; toggle Sites.db in and out of the data model
if dmHasTable("Sites") then    ; is Sites in data model?
  ; if so, remove dependencies, then remove table
  ; remove Sites as source from showSiteNames.ListNames
  showSiteNames.ListNames.DataSource = ""
  showSiteNames.Visible = False
  ; remove Sites from the data model
  dmRemoveTable("Sites")
  whichTable = ""
else
  ; if not already in data model, then add Sites
  dmAddTable("Sites")
  ; set the data for the list from the Sites table
  showSiteNames.ListNames.DataSource = "[Sites.Site Name]"
  showSiteNames.Visible = True
  whichTable = "Sites"
endIf

endMethod


See Also for Form::dmAddTable
See Also

dmHasTable

dmRemoveTable


Form::dmAttach
dmAttach	5.0

See Also	Example	Form Type

Method/Procedure

Associates a TCursor variable with a table in a specified data model.

Syntax

dmAttach ( tc TCursor, const tableName String ) Logical

Description

dmAttach associates the TCursor variable tc with the table tableName in a specified data model, where tableName is either a valid table name or a table alias. This method returns True if it succeeds; otherwise it returns False.


Example for Form::dmAttach
dmAttach Example

The following example demonstrates how to use dmAttach and dmResync to keep two forms synchronized. Both forms have the Customer table in their data models. When the user moves from the first form frm1 to the second form frm2, a form variable f is used to attach back to the first form and dmAttach is used to attach to the appropriate table in its data model. Finally, dmResync is used to move to the same record as the first form.

;Frm2.pge1 :: setFocus

method setFocus(var eventInfo Event)

var

f	Form	;Declare a form variable.

tc	TCursor	;Declare a TCursor variable.

endVar

if f.attach("dmAttach2") then	;Attach to other form.

f.dmAttach(tc, "Customer.db")	;Attach tc to a table in the

dmResync("Customer.db", tc)	;data model of the other form.

;Then sync the two forms.

endIf

endMethod


See Also for Form::dmAttach
See Also

dmHasTable

TCursor::dmAttach

TCursor::open

Paradox Help: Table Aliases


Form::dmBuildQueryString
dmBuildQueryString	5.0

See Also	Example1	Example2	Form Type

Method/Procedure

Builds a query string based on the data model of a form.

Syntax

dmBuildQueryString ( var queryString String ) Logical

Description

dmBuildQueryString builds a query string queryString based on the data model of a form. The query built by dmBuildQueryString creates checked example elements for all the link fields in the data model. dmBuildQueryString returns True if it is successful; otherwise, it returns False.


Example 1 for Form::dmBuildQueryString
dmBuildQueryString Example 1

For the following example, assume a data model has the Customer and Orders tables linked on the CustID field. The following code displays a query string based on that data model.

method pushButton(var eventInfo Event)

var

stQBE String

endVar

dmBuildQueryString(stQBE)

stQBE.view("Query String")

{

Displays the following string:

Query

::C:\PDOXWIN\BLDNOTES\CUSTOMER.DB | Custid       |

                                  | Check _EG01! |

::C:\PDOXWIN\BLDNOTES\ORDERS.DB | Custid      |

                                | Check _EG01 |

EndQuery

}

endMethod


Example 2 for Form::dmBuildQueryString
dmBuildQueryString Example 2

In the following example, suppose a form contains a button named btnDMQuery. The pushButton method for btnDMQuery uses dmBuildQueryString as a procedure to generate a query string in s. Then readFromString is called to assign the string to a Query variable. The method then runs the query and opens a table window for the Answer table.

;btnDMQuery :: pushButton

method pushButton(var eventInfo Event)

var

s	String

tv	TableView

qVar	Query

endVar

dmBuildQueryString(s)

qVar.readFromString(s)

if qVar.executeQBE() then

tv.open(":PRIV:ANSWER.DB")

else

errorShow()

return

endIf

endMethod


See Also for Form::dmBuildQueryString
See Also

dmHasTable

enumDataModel

Query::readfromString


Form::dmEnumLinkFields
dmEnumLinkFields	5.0

See Also	Example	Form Type

Method/Procedure

Lists the fields that link two tables.

Syntax

dmEnumLinkFields ( var masterTable String, var masterFields Array[] String, const detailTable String, var detailFields Array[] String, var detailIndex String ) Logical

Description

dmEnumLinkFields lists the fields that link the tables named in masterTable and detailTable. You must supply a table name or table alias for detailTable, and this method assigns values to the other variables (passed as arguments) as follows:

Variable	Assigned value

masterTable	The name of the master table. Blank if the table specified in detailTable has no master table.

masterFields	Names of the linking fields in the master table. Blank if the table specified in detailTable has no master table.

detailFields	Names of the linking fields in the detail table. Blank if the table specified in detailTable has no master table. If the detail table is a dBASE table and uses an expression index, the expression is returned in angled brackets. Examples: <FIRSTNAME + LASTNAME> means an expression index based on the fields named FIRSTNAME and LASTNAME; <FIRSTNAME + LASTNAME;QTY > 1> means an expression index based on the fields named FIRSTNAME and LASTNAME with QTY > 1 as a subset condition.

indexName	Name of the index used by the detail table. Blank if the table specified in detailTable is not using an index. If the detail table is a dBASE table, you can use dmGetProperty to get the associated tag name, if any.

The tables must already be in the specified data model. This method returns True if successful; otherwise, it returns False.


Example for Form::dmenumlinkfields
dmEnumLinkFields Example

In the following example, assume that a form's data model links the Customer and Orders tables on the CustID field, with the Orders table as the detail table. The tables do not use secondary indexes.

method pushButton(Var eventInfo Event)

var

mAr, dAr Array[] String

m, d, inx String

endVar

d = "orders"

dmEnumLinkFields(m, mAr, d, dAr, inx)

m.view("Master table name")    ; Displays CUSTOMER.DB

mAr.view("Master link fields") ; Displays CustID

d.view("Detail table name")    ; Displays

dAr.view("Detail link fields") ; Displays ORDERS.DB

inx.view("Index name")         ; Empty

endMethod


See Also for Form::dmEnumLinkFields
See Also

dmHasTable

Paradox Help: Table Aliases


Form::dmGet
dmGet

See Also	Example	Form Type	Changes

Method/Procedure

Retrieves a field value from a table in the data model.

Syntax

dmGet ( const tableName String, const fieldName String, var datum AnyType ) Logical

Description

dmGet provides access to table data in a specified data model. dmGet writes to datum a field value from a specified table. The table specified by tableName must be the name or table alias of a table in the form's data model (support for table aliases was added in version 5.0). fieldName must be a field in tableName.


Example for Form::dmGet
dmGet Example

In the following example, a form contains a table frame bound to the Sites table. The table frame contains only two fields: Site No and Site Name. The pushButton method for a button named getHighlight uses dmGet to find the value of the Site Highlight field for the current record. The method then displays the Site Highlight value in a dialog box and asks the user whether to change the value. If the user answers "Yes" in the dialog box, the method shows the original value for Site Highlight in a dialog box and prompts the user for a new value. The method then uses dmPut to write the changed value back to the Sites table:

; getHighlight::pushButton
method pushButton(var eventInfo Event)
var
  siteHighlight AnyType
  qAnswer       String
endVar
; get the value in the Site Highlight field for the current record
if dmGet("Sites", "Site Highlight", siteHighlight) then
 ; show the highlight and ask the user whether to change it
 qAnswer = msgQuestion("Change Highlight?",
              "At site " + SITES.Site_Name +
              " the highlight is " +
              String(siteHighlight) + ". Change highlight?")
 if qAnswer = "Yes" then
   ; check for Edit mode
   if thisForm.Editing <> True then
     action(DataBeginEdit)
   endif
   ; ask user to replace existing highlight value in View dialog box
   siteHighlight.view("Enter a new highlight:")
   ; write the changed highlight back to the Site Highlight field
   dmPut("Sites", "Site Highlight", siteHighlight)
 endif
else
  msgStop("Sorry", "Couldn't find the highlight for this site.")
endif
endMethod


See Also for Form::dmGet
See Also

dmPut

Paradox Help: Table Aliases


Changes to Form::dmGet

The table specified by tableName must be the name or table alias of a table in the form's data model (support for table aliases was added in version 5.0).


Form::dmGetProperty
dmGetProperty	4.5

See Also	Example	Form Type	Changes

Method/Procedure

Returns the value of a specified table property.

Syntax

1. dmGetProperty ( const tableName String, const propertyName String ) AnyType

2. dmGetProperty ( const tableName String, const propertyName String, var value AnyType ) Logical

Description

dmGetProperty returns the value of a property propertyName of the table tableName in the specified data model. The value of tableName must be a valid table name or a table alias (support for table aliases was added in version 5.0).

The value of propertyName must be one of the following strings:

AutoAppend	Returns True if AUTO APPEND is set to True for the table.  Otherwise, returns False.

Editing	Returns True when a form is in Edit mode, or a field object is active and being edited. Otherwise, returns False.

Flyaway	Returns True when a record has moved to its sorted position in a table. Otherwise, returns False.

FullName	Returns the full file name (as a string, including path or alias) of the table. (Added in version 5.0.)

Index	Returns the name of the index (as a string) that is currently used to view the table. For a child table, it returns the name of the index chosen in the link diagram. For a master table or unlinked table, it returns the setting of ORDER/RANGE. It returns an empty string when the primary key is used.

Inserting	Returns True when a record is being inserted anywhere in a form. Otherwise, returns False.

LinkType	Returns a string describing the way the table relates to its master: "None", "One-to-one", or "One-to-many".

Locked	Returns True when the table bound to a design object is locked. Otherwise, returns False.

Name	Returns the table's table alias (as a string) if it exists; otherwise, returns an empty string. (Added in version 5.0.)

Next	Returns the name (as a string) of the next object in the same container.

One-to-many	Returns the name (as a string) of the first detail table linked 1:M to this table.

One-to-one	Returns the name (as a string) of the first detail table linked 1:1 to this table.

Parent	Returns the table name (as a string) of this table's master in the data model.

Readonly	Returns True if READONLY is set to True for the table. Otherwise, returns False.

Refresh	Returns True when data displayed onscreen is being changed, either across a network, by an ObjectPAL statement, or user action. Otherwise, returns False.

StrictTranslation	Returns True if STRICT TRANSLATION is set to True for the table.  Otherwise, returns False.

TagName	Returns the tag name (as a string) for the current dBASE index (if any). Otherwise, it returns an empty string.

Touched	Returns True when the user has made changes to data not yet committed.

Syntax 1 returns the property value directly.

Syntax 2 (added in version 5.0) assigns the value to value, an AnyType variable that you declare and pass as an argument. Syntax 2 returns True if the method succeeds; otherwise, it returns False.

For both syntaxes, dmGetProperty returns False if tableName is not in the data model, or if the value of propertyName is not one of the strings listed above. (This feature was added in version 5.0.)


Example for Form::dmGetProperty
dmGetProperty Example

The following example sets a table's Auto Append property to False if the table isn't read-only, then checks to see if the table has a one-to-many link to another table. If it does, the read-only setting of the parent table is set to the same read-only setting as the detail (subject) table.

method UpdateProperties()

 if dmGetProperty(subject.tableName, "ReadOnly") <> True then
   dmSetProperty(subject.tableName, "AutoAppend", False)
 endif

 if dmGetProperty(subject.tableName, "LinkType") = "One-to-many"
then
  dmSetProperty(dmGetProperty(subject.tableName,"Parent"),"ReadOnly",
                 dmGetProperty(subject.tableName, "ReadOnly"))
 endif

endMethod


See Also for Form::dmHasTable
See Also

dmSetProperty

Paradox Help: Table Aliases


Changes to Form::dmGetProperty

Syntax 2 (added in version 5.0) assigns the value to value, an AnyType variable that you declare and pass as an argument. Syntax 2 returns True if the method succeeds; otherwise, it returns False.

The value of tableName must be a valid table name or a table alias (support for table aliases was added in version 5.0).

For both syntaxes, this method returns False if tableName is not in the data model, or if the value of propertyName is not one of the strings listed above. (Added in version 5.0.)

If propertyValue = "Name" this method returns the table's table alias (as a string) if it exists; otherwise, it returns an empty string. (Added in version 5.0.)

If propertyValue = "FullName" this method returns the full file name (including path or alias) of the table. (Added in version 5.0.)


Form::dmHasTable
dmHasTable

See Also	Example	Form Type	Changes

Method/Procedure

Reports whether a table is part of a specified data model.

Syntax

dmHasTable ( const tableName String ) Logical

Description

dmHasTable reports whether tableName is a table associated with a form, where tableName is a valid table name or table alias (support for table aliases was added in version 5.0).


Example for Form::dmHasTable
dmHasTable Example

See the example for dmAddTable for an illustration of how to use dmHasTable as a procedure.

The following example shows how dmHasTable is used as a method. The pushButton method for a button named isStockInDM works with the form specified by the variable thatForm. This method opens the Ordentry form, then checks to see if the Stock table is in thatForm's data model. If not, the Stock table is added to the data model for thatForm:

; isStockInDM::pushButton
method pushButton(var eventInfo Event)
var
  thatForm Form
endVar
thatForm.load("Ordentry")                   ; open ORDENTRY form
if not thatForm.dmHasTable("stock") then    ; is Stock in data model
  msgInfo("Status", "Adding Stock to data model for form.")
  thatForm.dmAddTable("stock")              ; if not, add it
it
  thatForm.save()
else
  msgInfo("Status", "Stock is already in data model for form.")
endif
thatForm.close()
endMethod


See Also for Form::dmHasTable
See Also

dmAddTable

dmRemoveTable

Paradox Help: Table Aliases


Changes to Form::dmHasTable

The value of tableName can be a valid table name or table alias (support for table aliases was added in version 5.0).


Form::dmLinkToFields
dmLinkToFields	4.5

See Also	Example1	Example2	Form Type	Changes

Method/Procedure

Links two tables in a specified data model based on lists of field names.

Syntax

dmLinkToFields ( const masterTable String, const masterFields Array[ ] String, const detailTable String, const detailFields Array[ ] String ) Logical

Description

dmLinkToFields links the tables specified in masterTable and detailTable on the field names listed in masterFields and detailFields (resizeable arrays of strings). The values of masterTable and detailTable can be table names or table aliases (support for table aliases was added in version 5.0). The tables must already be in the specified data model.

The linking fields cannot be any of the following types: Binary, Byte, Formatted Memo, Graphic, Logical, Memo, or OLE. This method returns True if successful; otherwise, it returns False. If detail tabl edoes not have an index that matches the fields in detailFields, it returns False.


Example 1 for Form::dmLinkToFields
dmLinkToFields Example 1

The following example creates a form, adds the Customer and Orders tables to the new specified data model, and calls dmLinkToFields to link the tables. Then it creates some field objects and a table frame and binds them to the tables. Finally, this code runs the new form so you can see the results.

This code specifies the names of the fields to link; you could leave this to Paradox, but Paradox default linking may not give the results you expect.

method pushButton(var eventInfo Event)
   var
      masterTC, detailTC      TCursor
      newForm                 Form
      masterFieldsAr,
      detailFieldsAr,
      keyFieldsAr               Array[] String
      badKeyTypesAr            Array[5] String
      masterName,
      detailName,
      keyFieldName,
      newFormName             String
      newField,
      newTFrame               UIObject
      x, y, w, h, offset      LongInt
      i                       SmallInt
   endVar

   ; initialize variables
   masterName = "customer.db"
   detailName = "orders.db"
   newFormName = "custOrd.fsl"

   badKeyTypesAr[1] = "MEMO"       ; types not allowed as key fields
   badKeyTypesAr[2] = "FMTMEMO"
   badKeyTypesAr[3] = "BINARYBLOB"
   badKeyTypesAr[4] = "GRAPHIC"
   badKeyTypesAr[5] = "OLEOBJ"

   masterTC.open(masterName)
   masterTC.enumFieldNames(masterFieldsAr)

   detailTC.open(detailName)
   detailTC.enumFieldNames(detailFieldsAr)

   ; specify the key field(s)
   keyFieldName = "Customer No"

   ; make sure key field type is valid
   if badKeyTypesAr.contains(masterTC.fieldType(keyFieldName)) or
      badKeyTypesAr.contains(detailTC.fieldType(keyFieldName)) then
      msgStop("Invalid key field type:",
              keyFieldName + " in\n" +

              masterName + " or\n" + detailName)
      return
   else
      keyFieldsAr.grow(1)
      keyFieldsAr[1] = keyFieldName
   endIf

   ; create the form
   newForm.create()
   newForm.dmAddTable(masterName)
   newForm.dmAddTable(detailName)

   if newForm.dmLinkToFields(masterName, keyFieldsAr,
                             detailName, keyFieldsAr) then

   ; place objects in the form

      x = 100
      y = 100
      w = 2880
      h = 360
      offset = 10

   ; create field objects bound to master table
      for i from 1 to masterFieldsAr.size()
         newField.create(FieldTool, x, y, w, h, newForm)
         y = y + h + offset
         newField.TableName = masterName
         newField.FieldName = masterFieldsAr[i]
         newField.Visible = Yes
      endFor

   ; create a table frame bound to detail table
      newTFrame.create(TableFrameTool, x, y, w, 8 * h, newForm)
      newTFrame.TableName = detailName
      newTFrame.Visible = Yes

   ; save the form and run it
      newForm.save(newFormName)
      newForm.run()

   else

      errorShow("Link failed")
   endIf

endMethod


Example 2 for Form::dmLinkToFields
dmLinkToFields Example 2

The following example shows how to use dmLinkToFields to link three tables 1:M:M. Like the previous example, this code specifies which fields to link.

method pushButton(var eventInfo Event)
   var
      firstTable,
      secondTable,
      thirdTable      String
      firstKeyAr,
      secondKeyAr,
      thirdKeyAr      Array[] String
      newForm         Form
   endVar

   ; initialize variables
   firstTable = "customer.db"
   secondTable = "orders.db"
   thirdTable = "lineitem.db"

   firstKeyAr.grow(1)
   firstKeyAr[1] = "Customer No"
   secondKeyAr.grow(1)
   secondKeyAr[1] = "Customer No"
   ; thirdKeyAr is initialized below, after 1st link

   ; create the form
   newForm.create()

   newForm.dmAddTable(firstTable)
   newForm.dmAddTable(secondTable)
   newForm.dmAddTable(thirdTable)

   ; 1st link
   if newForm.dmLinkToFields(firstTable, firstKeyAr,
                          secondTable, secondKeyAr) then

      ; initialize arrays for 2nd link
      secondKeyAr[1] = "Order No"

      thirdKeyAr.grow(1)
      thirdKeyAr[1]  = "Order No"

      ; 2nd link
      if newForm.dmLinkToFields(secondTable, secondKeyAr,
                          thirdTable, thirdKeyAr) then

         {Code to create UIObjects in new form could go here.}

         newForm.save("ordentry.fsl")

      else
         errorShow("2:3 link failed.")
      endIf

   else
      errorShow("1:2 link failed.")
   endIf

endMethod


See Also for Form::dmLinkToFields
See Also

dmLinkToIndex

dmUnlink

Paradox Help: Table Aliases


Changes to Form::dmLinkToFields

The values of masterTable and detailTable can be table names or table aliases (support for table aliases was added in version 5.0).


Form::dmLinkToIndex
dmLinkToIndex	4.5

See Also	Example	Form Type	Changes

Method/Procedure

Links two tables in a specified data model based on a list of field names and an index name.

Syntax

dmLinkToIndex ( const masterTable String, const masterFields Array[ ] String, const detailTable String, const detailIndex String ) Logical

Description

Links the tables specified in masterTable and detailTable on the field names listed in masterFields and the index specified in detailIndex. You can specify a Paradox table's primary index by assigning an empty string to detailIndex.

The values of masterTable and detailTable can be table names or table aliases (support for table aliases was added in version 5.0). The tables must already be in the specified data model. This method returns True if successful; otherwise, it returns False.

The linking fields cannot be any of the following types: Binary, Byte, Formatted Memo, Graphic, Logical, Memo, or OLE.


Example for Form::dmLinkToIndex
dmLinkToIndex Example

The following example creates a form, adds the Customer and Orders tables to the new specified data model, and calls dmLinkToIndex to link the tables. Then it creates some field objects and a table frame and binds them to the tables. Finally, this code runs the new form so you can see the results.

method pushButton(var eventInfo Event)
   var
      masterTC, detailTC      TCursor
      newForm                 Form
      masterFieldsAr,
      detailFieldsAr,
      masterKeysAr,
      detailKeysAr            Array[] String
      masterName,
      detailName,
      detailIndexName,
      newFormName             String
      newField,
      newTFrame               UIObject
      x, y, w, h, offset      LongInt
      i                       SmallInt
   endVar

   ; Initialize variables
   detailIndexName = "Customer No"
   newFormName = "idxDemo"
   masterName = "customer.db"
   detailName = "orders.db"

   masterTC.open(masterName)
   masterTC.enumFieldNames(masterFieldsAr)
   masterTC.enumFieldNamesInIndex(masterKeysAr)

   detailTC.open(detailName)
   detailTC.enumFieldNames(detailFieldsAr)

   ; create the form
   newForm.create()
   newForm.dmAddTable(masterName)
   newForm.dmAddTable(detailName)

   if newForm.dmLinkToIndex(masterName, masterKeysAr,
                            detailName, detailIndexName) then

      x = 100
      y = 100
      w = 2880
      h = 360
      offset = 10

      for i from 1 to masterFieldsAr.size()
         newField.create(FieldTool, x, y, w, h, newForm)
         y = y + h + offset
         newField.TableName = masterName
         newField.FieldName = masterFieldsAr[i]
         newField.Visible = Yes
      endFor

      newTFrame.create(TableFrameTool, x, y, w, 8 * h, newForm)
      newTFrame.TableName = detailName
      newTFrame.Visible = Yes

      newForm.save(newFormName)
      newForm.run()

   else

      errorShow("Link failed")

   endIf

endMethod


See Also for Form::dmLinkToIndex
See Also

dmLinkToFields

dmUnlink

Paradox Help: Table Aliases


Changes to Form::dmLinkToIndex

The values of masterTable and detailTable can be table names or table aliases (support for table aliases was added in version 5.0).


Form::dmPut
dmPut

See Also	Example	Form Type	Changes

Method/Procedure

Writes data to a table in a specified data model.

Syntax

dmPut ( const tableName String, const fieldName String, const datum AnyType ) Logical

Description

dmPut provides access to table data in a specified data model. dmPut writes datum to a field in a specified table. The value of tableName can be a table name or a table alias (support for table aliases was added in version 5.0). The table specified by tableName must be one of the tables in the specified data model. fieldName must be a field in tableName. This method returns True if it succeeds; otherwise, it returns False.


Example for Form::dmPut
dmPut Example

See the example for dmGet.


See Also for Form::dmPut
See Also

dmGet


Changes to Form::dmPut

The value of tableName can be a table name or a table alias (support for table aliases was added in version 5.0).


Form::dmRemoveTable
dmRemoveTable

See Also	Example	Form Type	Changes

Method/Procedure

Removes a table from a specified data model.

Syntax

dmRemoveTable ( const tableName String ) Logical

Description

dmRemoveTable removes tableName from a form's data model. The value of tableName can be a table name or a table alias (support for table aliases was added in version 5.0). Any objects on the form that depend on the table will be undefined when the table is removed. If any UIObjects in the form are bound to the table, dmRemoveTable fails. It returns True if it succeeds; otherwise, it returns False.


Example for Form::dmRemoveTable
dmRemoveTable Example

See the example for dmAddTable.


See Also for Form::dmRemoveTable
See Also

dmAddTable

dmHasTable

Paradox Help: Table Aliases


Changes to Form::dmRemoveTable

The value of tableName can be a table name or a table alias (support for table aliases was added in version 5.0).


Form::dmResync
dmResync	5.0

See Also	Example	Form Type

Method/Procedure

Resynchronizes a table in a specified data model to a TCursor.

Syntax

dmResync ( const tableName String, var tc TCursor ) Logical

Description

dmResync synchronizes a specified table in a data model with the TCursor tc. The value of tableName can be a table name or a table alias (support for table aliases was added in version 5.0).

When you resynchronize a table to a TCursor, the table's filter, index, and current record position will be changed to those of the TCursor. (For dBASE tables, the table will also take the Show Deleted setting of the TCursor.) This method works on forms in design mode or run mode.

Note:	dmResync only works when the TCursor is associated with the table in the data model. However, the table does not have to be displayed in the form.


Example for Form::dmResync
dmResync Example

This example shows how to use dmResync with the DataSource property to add items to a drop-down edit list. First, it shows how to use DataSource alone, which fills a list with values from a specified field (column) of a table. Then it shows how to use a TCursor and dmResync to fill a list with a specified subset of those values.

A field displayed as a drop-down edit list is a compound object: the field object (which displays the field value) contains a list object (which contains the items in the list). In a form, the list object is represented by the down-arrow (the arrow you click to display the list). See the Guide to ObjectPAL for more details about lists and list objects.

The usual place to attach list-building code is the list object's built-in open method, but you can attach the code to other methods, or even to other objects (as shown in the second part of this example).

Suppose a form contains a field object displayed as a drop-down edit list. The field object is bound to the ShipVia field of the Orders table. The following code is attached to the built-in open method of the list object (not the field object) named shipViaList. It fills the list with all the values in the ShippingCo field of the Shippers table in the working directory.

; shipViaList::open

; Full containership path: form.page.ShipVia.shipViaList

method open (var eventInfo Event)

doDefault

; Fills list with all values in ShippingCo field of Shippers table.

self.DataSouce = "[Shippers.ShippingCo]"

endMethod

The following code uses dmResync to filter the list depending on the value of another field. The premise here is that certain shipping methods are less expensive (and so more desirable) in certain parts of the country. So, when the user changes the value of the State field, this code updates the items in the list of shippers.

; State::changeValue

method changeValue (var eventInfo ValueEvent)

var

tcShippers	TCursor

stStateCode,

stFldName,

stDmTbName	String

dyCriteria	DynArray[] AnyType

endVar

doDefault ; Execute the built-in code to commit the field value.

if eventInfo.errorCode <> 0 then

return ; If there's an error, exit the method.

endIf

stStateCode = self.Value  ; Get the value of the State field.

stFldName   = "State"     ; Filter on the State field.

stDmTbName  = "Shippers"

dyCriteria[stFldName] = stStateCode

; Associate a TCursor with a table in the form's data model.

dmAttach(tcShippers, stDmTbName)

tcShippers.setGenFilter(dyCriteria) ; Set a filter on the TCursor.

; You could also set an index, etc.

; Synchronize the table in the data model with the TCursor.

; The table takes the filter from the TCursor.

dmResync(stDmTbName, tcShippers)

; Now the list displays only the shippers for the specified state.

ShipVia.shipViaList.DataSource = "[Shippers.ShippingCo]"

endMethod


See Also for Form::dmResync
See Also

dmAttach

dmHasTable

UIObject::resync

Paradox Help: Table Aliases


Form::dmSetProperty
dmSetProperty	4.5

See Also	Example	Form Type	Changes

Method/Procedure

Sets the value of a specified table property.

Syntax

dmSetProperty ( const tableName String, const propertyName String, Value AnyType) Logical

Description

dmSetProperty lets you change the value of a property, specified by propertyName, associated with the table specified in tableName and found in the specified data model.

The value of tableName can be a table name or a table alias (support for table aliases was added in version 5.0). The value of propertyName is one of the following properties:

AutoAppend	Set propertyValue to True to set AUTO APPEND ON for the table. Otherwise, set it to False.

Name	The value of propertyValue specifies the table's table alias as a string. The operation fails if the table alias is already in use. (Added in version 5.0.)

ReadOnly	Set propertyValue to True if READONLY should be True for the table. Otherwise, set it to False.

StrictTranslation	Set propertyValue to True if STRICT TRANSLATION should be True for the table. Otherwise, set it to False.

Touched	Set propertyValue to True when the user has made changes not yet committed.


Example for Form::dmSetProperty
dmSetProperty Example

See the example for dmGetProperty.


See Also for Form::dmSetProperty
See Also

dmGetProperty

Paradox Help: Table Aliases


Changes to Form::dmSetProperty

The value of tableName can be a table name or a table alias (support for table aliases was added in version 5.0).

If propertyName = "Name" you can specify the table's table alias as a string in propertyValue. This method fails if the table alias is already in use. (Added in version 5.0.)


Form::dmUnlink
dmUnlink	4.5

See Also	Example	Form Type	Changes

Method/Procedure

Unlinks two tables in a specified data model.

Syntax

dmUnlink ( const masterTable String, const detailTable String ) Logical

Description

dmUnlink unlinks the tables specified in masterTable and detailTable. masterTable must refer to the master table in the link, and detailTable must refer to the detail table in the link. The values of masterTable and detailTable can be table names or table aliases (support for table aliases was added in version 5.0).

This method fails if the tables are not in the specified data model; it also fails if they are in the specified data model but not linked.

This method returns True if successful; otherwise, it returns False.


Example for Form::dmUnlink
dmUnlink Example

method pushButton(var eventInfo Event)

   var
      theForm            Form
      masterTable,
      oldDetailTable,
      newDetailTable,
      oldFormName,
      newFormName         String
      newKeysAr         Array[] String
   endVar

   ; initialize variables
   oldFormName = "custOrd"
   newFormName = "newOrd"

   masterTable    = "CUSTOMER"
   oldDetailTable = "ORDERS"
   newDetailTable = "NEW_ord"

   newKeysAr.grow(1)
   newKeysAr[1] = "Customer No"

   ; load the form and change the data model
   theForm.load(oldFormName)

   if theForm.dmHasTable(masterTable) and
      theForm.dmHasTable(oldDetailTable) then

      theForm.dmAddTable(newDetailTable)
      theForm.dmUnlink(masterTable, oldDetailTable)

      theForm.dmLinkToFields(masterTable, newKeysAr,
                             newDetailTable, newKeysAr)

      theForm.ORDERS.TableName = newDetailTable

      theForm.dmRemoveTable(oldDetailTable)
      theForm.save(newFormName)

   else
      errorShow()
   endIf

endMethod


See Also for Form::dmUnlink
See Also

dmLinkToFields

dmLinkToIndex

Paradox Help: Table Aliases


Changes to Form::dmUnlink

The values of masterTable and detailTable can be table names or table aliases (support for table aliases was added in version 5.0).


Form::enumDataModel
enumDataModel	5.0

See Also	Example	Form Type

Method/Procedure

Lists the tables in a specified data model.

Syntax

enumDataModel ( const tableName String ) Logical

Description

enumDataModel creates a Paradox table listing information about the tables in a specified data model. Use the argument tableName to specify a name for the table. If tableName already exists, this method overwrites it without asking for confirmation. If tableName is already open, this method fails. You can include an alias or path in tableName; if no alias or path is specified, Paradox creates tableName in the working directory (:WORK:).

The structure of the created table is

Field Name	Type	Description

TableName	A128	Table alias, if it exists, or file name of the table (without file extension)

PropertyName	A64	A property name

PropertyValue	A255	Value of the corresponding property


Example for Form::enumDataModel
enumDataModel Example

In the following example, a form contains a button named enumerateDataModel. The pushButton method for enumerateDataModel uses enumDataModel as a procedure to enumerate the properties of all the tables in the data model for the current form to a table called DMORDERS.DB. The method then opens a table window for the DMOrders table.

;enumerateDataModel::pushButton

method pushButton(var eventInfo Event)

var

tv	TableView

endVar

enumDataModel("dmOrders.db")

tv.open("dmOrders.db")

endMethod


Property Names for Form::enumDataModel

Property	Description

AutoAppend	Returns True if AUTO APPEND is set to True for the table. Otherwise, returns False.

FullName	Returns the full file name (including path or alias) of the table.

Index	Returns the name of the index (as a string) that is currently used to view the table. For a child table, it returns the name of the index chosen in the link diagram. For a master table or unlinked table, it returns the setting of ORDER/RANGE. It returns an empty string when the primary key is used.

LinkFields	Returns a comma-separated list of fields that define the link. If the detail table is a dBASE table and uses an expression index, the expression is returned in angled brackets. Examples: <FIRSTNAME + LASTNAME> means an expression index based on the fields named FIRSTNAME and LASTNAME; <FIRSTNAME + LASTNAME;QTY > 1> means an expression index based on the fields named FIRSTNAME and LASTNAME with QTY > 1 as a subset condition.

LinkType	Returns a string describing the way the table relates to its master: "None", "One-to-one", or "One-to-many".

Name	Returns the table's table alias (as a string) if it exists; otherwise, returns an empty string.

Next	Returns the name (as a string) of the next object in the same container.

One-to-many	Returns the name (as a string) of the first detail table linked 1:M to this table.

One-to-one	Returns the name (as a string) of the first detail table linked 1:1 to this table.

Parent	Returns the table name (as a string) of this table's master in the data model. For example, in a CUSTOMER->>BOOKORD form, dmGetProperty("BOOKORD","PARENT") = "CUSTOMER.DB". If the table has no master, an empty string is returned.

Readonly	Returns True if READONLY is set to True for the table. Otherwise, returns False.

StrictTranslation	Returns True if STRICT TRANSLATION is set to True for the table.  Otherwise, returns False.

TagName	Returns the tag name (as a string) for the current dBASE index (if any). Otherwise, it returns an empty string.


See Also for Form::enumDataModel
See Also

dmEnumLinkFields

dmGetProperty

enumSource


Form::enumSource
enumSource

See Also	Example	Form Type

Method/Procedure

Creates a table listing the methods for each object in a form.

Syntax

enumSource ( const tableName String [, const recurse Logical ] ) Logical

Description

enumSource creates a Paradox table listing every object you have written a method for, along with the ObjectPAL source code for the method. Use the argument tableName to specify a name for the table. If tableName already exists, this method overwrites it without asking for confirmation. If tableName is already open, this method fails. You can include an alias or path in tableName; if no alias or path is specified, Paradox creates tableName in the working directory (:WORK:).

The structure of the created table is

Field Name	Type	Size

Object	A	128

MethodName	A	128

Source	M	64

The Object field contains the full path name of the object.

If recurse is False, this method returns the method definitions for the form only. To include the source code of methods for all objects contained by the form, recurse must be True.


Example for Form::enumSource
enumSource Example

In the following example, a form contains a button named getSource. The pushButton method for getSource uses enumSource as a procedure to enumerate the source code for the current form to a table named TEMPSORC.DB. The method then opens a table window for the Tempsorc table and waits for the user to close it. Then the method opens the Sitenote form to siteForm, uses enumSource as a method to write the source code for siteForm to a table named SITESORC.DB, and views the table:

; getSource::pushButton
method pushButton(var eventInfo Event)
var
  siteForm   Form
  tempTable  TableView
endVar

siteForm.open("Sitenote.fsl")        ; open another form

; write source for siteForm to SITESORC.DB
siteForm.enumSource("sitesorc.db", True)
siteForm.close()                 ; close the form
tempTable.open("sitesorc.db")    ; view the new table
tempTable.wait()                 ; wait for the user to close
                                 ; the table
endMethod


See Also for Form::enumSource
See Also

enumSourceToFile

enumUIObjectNames

enumUIObjectProperties


Form::enumSourceToFile
enumSourceToFile

See Also	Example	Form Type

Method/Procedure

Creates a file listing the methods for each object in a form.

Syntax

enumSourceToFile ( const fileName String [, const recurse Logical ] ) Logical

Description

enumSourceToFile creates a text file listing every object you've written a method for, along with the ObjectPAL source code for the method. Use the argument fileName to specify a name for the file. If fileName already exists, this method overwrites it without asking for confirmation. You can include an alias or path in fileName; if no alias or path is specified, Paradox creates fileName in the working directory (:WORK:).

If recurse is False, this method returns the method definitions for the form only. To include the source code of methods for all objects contained by the form, recurse must be True.


Example for Form::enumSourceToFile
enumSourceToFile Example

The following code is attached to the pushButton method for a button named getSourceToFile. This method writes all the source code for the current form to TEMPSORC.TXT. The method then opens the Sitenote form and writes all the code for that form to a file named SITESORC.TXT:

; getSourceToFile::pushButton
method pushButton(var eventInfo Event)
var
  siteForm   Form
endVar
enumSourceToFile("tempsorc.txt", True) ; writes all source for the
                                       ; current form to TEMPSORC.TXT

siteForm.open("Sitenote.fsl")              ; open another form
; write source for siteForm to SITESORC.TXT
siteForm.enumSourceToFile("sitesorc.txt", True)
siteForm.close()                       ; close the form
endMethod


See Also for Form::enumSourceToFile
See Also

enumSource

enumUIObjectNames

enumUIObjectProperties


Form::enumTableLinks
enumTableLinks

See Also	Example	Form Type	Changes

Method/Procedure

Creates a table listing the tables linked in a form.

Syntax

enumTableLinks ( const tableName String ) Logical

Description

enumTableLinks creates a Paradox table listing the names of tables linked in a form and the types of links. Use the argument tableName to specify a name for the table. If tableName already exists, this method overwrites it without asking for confirmation. If tableName is already open, this method fails. You can include an alias or path in tableName; if no alias or path is specified, Paradox creates tableName in the working directory (:WORK:).

This method creates a table containing one record for each table in the data model. The structure of the table (which changed in version 5.0) is

Field Name	Type	Description

Table	A81*	Table name, without alias, path, or extension (for example, ORDERS).

Parent	A81*	Name of parent table, or blank if table has no parent.

LinkType	A24*	Type of link between table and parent table: None, One-to-many, or One-to-one.


Example for Form::enumTableLinks
enumTableLinks Example

In the following example, the pushButton method for a button named showTableLinks writes table links for the current form to a table named TEMPLINK.DB. The method then opens the Sitenote form, and writes the table links for that form to a table named SITENOTE.DB:

; showTableLinks::pushButton
method pushButton(var eventInfo Event)
var
  siteForm  Form
  tempTable TableView
endVar
enumTableLinks("templink.db")          ; lists links to current form
tempTable.open("templink")
tempTable.wait()
siteForm.open("Sitenote.fsl")
siteForm.enumTableLinks("Sitenote.db") ; lists links to siteForm
siteForm.close()
tempTable.open("Sitenote.fsl")
tempTable.wait()
tempTable.close()
endMethod


See Also for Form::enumTableLinks
See Also

enumDataModel

enumUIObjectNames

enumUIObjectProperties

TCursor::enumRefIntStruct


Changes to Form::enumTableLinks

This method creates a table containing one record for each table in the data model. The structure of the table (which changed in version 5.0) is

Field Name	Type	Description

Table	A81*	Table name, without alias, path, or extension (for example, ORDERS).

Parent	A81*	Name of parent table, or blank if table has no parent.

LinkType	A24*	Type of link between table and parent table: None, One-to-many, or One-to-one.


Form::enumUIObjectNames
enumUIObjectNames

See Also	Example	Form Type

Method

Creates a table listing the UIObjects contained in a form.

Syntax

enumUIObjectNames ( const tableName String ) Logical

Description

enumUIObjectNames creates a Paradox table listing the name and type of each object contained in a form. Use the argument tableName to specify a name for the table. If tableName already exists, this method overwrites it without asking for confirmation. If tableName is already open, this method fails. You can include an alias or path in tableName; if no alias or path is specified, Paradox creates tableName in the working directory (:WORK:).

The structure of tableName is

Field Name	Type	Size

ObjectName	A	128

ObjectClass	A	32

Note:	ObjectName includes the entire path name of the object.


Example for Form::enumUIObjectNames
enumUIObjectNames Example

In the following example, the pushButton method for a button named getObjectNames opens the Sitenote form and enumerates all the object names on the form to a table named Siteobjs. The method then opens the Siteobjs table and waits for the user to close it:

; getObjectNames::pushButton
method pushButton(var eventInfo Event)
var
  siteForm  Form
  tempTable TableView
endVar
if siteForm.open("Sitenote.fsl") then           ; open the form
  siteForm.enumUIObjectNames("siteobjs.db") ; write object names
                                            ; SITEOBJS.DB
  siteForm.close()                          ; close the form
  tempTable.open("siteobjs")                ; open the new table
  tempTable.wait()                          ; wait for return
  tempTable.close()                         ; close after return
endIf
endMethod


See Also for Form::enumUIObjectNames
See Also

enumUIObjectProperties

enumSource

enumSourceToFile


Form::enumUIObjectProperties
enumUIObjectProperties

See Also	Example	Form Type

Method

Lists the properties of each UIObject contained in a form.

Syntax

enumUIObjectProperties ( const tableName String ) Logical

Description

enumUIObjectProperties creates a Paradox table listing the name, property name, and property value of each object contained in a form. Use the argument tableName to specify a name for the table. If tableName already exists, this method overwrites it without asking for confirmation. If tableName is already open, this method fails.

The structure of tableName is:

Field Name	Type	Size

ObjectName	A	128

PropertyName	A	64

PropertyType	A	48

PropertyValue	A	255


Example for Form::enumUIObjectProperties
enumUIObjectProperties Example

In the following example, the pushButton method for a button named getProps writes the properties for all objects contained by the current form to a table named Tempprop:

; getProperties::pushButton
method pushButton(var eventInfo Event)
var
  siteForm  Form
  tempTable TableView
endVar
if siteForm.open("Sitenote.fsl") then
  message("Enumerating properties to Siteprop table.")
  siteForm.enumUIObjectProperties("siteProp.db")
  tempTable.open("siteprop")
  message("Close the table to continue.")
  tempTable.wait()
  tempTable.close()
endIf
; to enumerate objects for current form, use the UIObject
; type method enumUIObjectProperties
; thisForm is the object ID for current form
message("Enumerating properties to Tempprop table.")
thisForm.enumUIObjectProperties("tempprop.db")
tempTable.open("tempprop")
message("Close the table to continue.")
tempTable.wait()
tempTable.close()
endMethod


See Also for Form::enumUIObjectProperties
See Also

UIObject::enumUIObjectProperties


Form::formCaller
formCaller

See Also	Example	Form Type

Procedure

Creates a handle to the calling form.

Syntax

formCaller ( var caller Form ) Logical

Description

formCaller assigns the handle of the current form's calling form to caller, if the form is in a wait. If the current form was not opened by another form, and the form that opened the current form is not waiting upon the current form, the method returns False, and caller is unassigned.


Example for Form::formCaller
formCaller Example

In the following example, the pushButton method for whoCalledMe finds out which form called the current form:

; callOtherForm::pushButton  (calling form)
method pushButton(var eventInfo Event)
var
  siteForm  Form
endVar
siteForm.open("sitenote.fsl")  ; open siteForm
siteForm.wait()                ; wait for siteForm to return
siteForm.close()               ; close siteForm
endMethod
This is the code for whoCalledMe on the current form.
; whoCalledMe::pushButton
method pushButton(var eventInfo Event)
var
  myCaller     Form
  callerTitle  AnyType
endVar
if formCaller(myCaller) then        ; try to get a handle to
                                    ; the calling form
  callerTitle = myCaller.getTitle() ; get the form's title
  msgInfo("FYI", "I was called by: \n" + callerTitle)
endif
endMethod


See Also for Form::formCaller
See Also

wait


Form::formReturn
formReturn

See Also	Example	Form Type

Procedure

Returns control to a suspended method.

Syntax

formReturn ( [ const returnValue AnyType ] )

Description

When one form opens another form and calls wait, the first form suspends ObjectPAL execution (in effect, yielding to the second form) until the second form returns control by calling formReturn. You can choose to return a value to the first form in returnValue. You can also use formReturn to return control (and a value) from a script.

formReturn posts a message to the Windows message queue, so ObjectPAL statements that follow formReturn will execute before the form returns control.

If no other form is waiting for the current form, formReturn closes the current form. If a form is waiting for the current form, formReturn does not close the current form.


Example for Form::formReturn
formReturn Example

The following example consists of three methods. The pushButton method for openDialog opens another form as a dialog box and waits for it to return a value. The other two methods are attached to buttons in the dialog box form. They use formReturn to return control and values to the calling form. Note that the calling form must call close to close the dialog box; the call to formReturn does not close it.

; openDialog::pushButton
method pushButton(var eventInfo Event)
var
  dlgForm     Form
  whichButton String
endVar
if dlgForm.openAsDialog("foforet2", WinStyleDefault,
                        1440, 1440, 7200, 5760) then
  ; waits until dlgForm calls formReturn or is closed
  ; returned value is stored to whichButton
  whichButton = String(dlgForm.wait())
  dlgForm.close()
  ; return value is cast to a String so that it will be correct
  ; type even if user closes dialog box from the system menu
  msgInfo("Button pressed", whichButton)
else
  msgStop("Stop", "Couldn't open the form.")
endIf
endMethod

This method is attached to pushButton method for OKButton in dlgForm. It returns a value of "OK" when it returns control to the method that called wait:

; OKButton::pushButton
method pushButton(var eventInfo Event)
formReturn("OK")      ; return "OK" to calling form
endMethod

This method is attached to cancelButton in dlgForm. It returns a value of "Cancel" when it returns control to the method that called wait. The message statement that follows the call to formReturn is not required; it is included here to show that statements following a call to formReturn execute before control is returned to the calling form.

; cancelButton::pushButton
method pushButton(var eventInfo Event)
formReturn("Cancel")  ; return "Cancel" to calling form

message("Cancel")     ; This statement will execute.
endMethod


See Also for Form::formReturn
See Also

formCaller

wait

Script::run


Form::getFileName
getFileName

See Also	Example	Form Type

Method/Procedure

Returns the path, file name, and extension of the associated form.

Syntax

getFileName( ) String

Description

As a method, getFileName returns the path, file name, and extension of the form associated with a Form variable. As a procedure, it returns the path, file name, and extension of the current form. Compare this method to getTitle, which returns the text in a Form window's title bar.


Example for Form::getFileName
getFileName Example

The following example displays the file name of the current form in the status bar.

method pushButton(var eventInfo Event)
   message(getFileName())
endMethod


See Also for Form::getFileName
See Also

getTitle


Form::getPosition
getPosition

See Also	Example	Form Type

Method/Procedure

Reports the position of a window onscreen.

Syntax

getPosition ( var x LongInt, var y LongInt, var w LongInt, var h LongInt )

Description

getPosition gets the position of a window relative to the Paradox Desktop. The arguments x and y contain the horizontal and vertical coordinates of the upper left corner of the form (in twips), and w and h contain the width and height (in twips).

To ObjectPAL, the screen is a two-dimensional grid, with the origin (0, 0) at the upper left corner of an object's container, positive x-values extending to the right, and positive y-values extending down.

For dialog boxes and for the Paradox Desktop application, the position is given relative to the entire screen; for forms, reports, and table windows, the position is given relative to the Paradox Desktop.


Example for Form::getPosition
getPosition Example

In the following example, the pushButton method for moveOtherForm opens a form and gets its position. The method then opens a second instance of the same form and sets its position so that no part of the second form overlaps the first:

; moveOtherForm::pushButton
method pushButton(var eventInfo Event)
var
  siteFormOne,
  siteFormTwo    Form
  x, y, w, h     LongInt
endVar
if siteFormOne.open("Sitenote") then
  siteFormOne.getPosition(x, y, w, h)
  siteFormTwo.open("Sitenote.fsl")    ; open another instance
  ; set position so that no part overlaps other instance
  siteFormTwo.setPosition(x + w, y + h, w, h)
endif
endMethod


See Also for Form::getPosition
See Also

setPosition


Form::getProtoProperty
getProtoProperty	5.0

See Also	Example	Form Type

Method/Procedure

Reports the value of a specified property of a prototype object.

Syntax

getProtoProperty ( const objectType SmallInt, propertyName String ) AnyType

Description

getProtoProperty returns the value of the property specified in propertyName of the prototype object specified in objectType. To specify objectType, use one of the UIObjectTypes constants. If called as a method, getProtoProperty operates on prototype objects in the style sheet of the specified form. If called as a procedure, it uses the style sheet of the current form.


Example for Form::getProtoProperty
getProtoProperty Example

This example uses getProptoProperty to store the current default color for the box tool. Next, it specifies a new box color and creates three new boxes. Then it restores the default box color.

const

kOneInch = 1440 ; One inch = 1,440 twips.

endConst

method mouseClick(var eventInfo MouseEvent)

var

uiRedBox 	UIObject

thisForm	Form

liDefaultBoxColor 	LongInt

endVar

thisForm.attach() ; Get a handle to this form.

; Get current default color.

liDefaultBoxColor = thisForm.getProtoProperty(BoxTool, "Color")

; Set box color and create 3 boxes using new prototype.

thisForm.setProtoProperty(BoxTool, "Color", Red)

uiRedBox.create(BoxTool, kOneInch, kOneInch, kOneInch, kOneInch)

uiRedBox.Visible = Yes

uiRedBox.create(BoxTool, 2 * kOneInch, kOneInch, kOneInch, kOneInch)

uiRedBox.Visible = Yes

uiRedBox.create(BoxTool, 3 * kOneInch, kOneInch, kOneInch, kOneInch)

uiRedBox.Visible = Yes

; Restore the default box color.

thisForm.setProtoProperty(BoxTool, "Color", liDefaultBoxColor)

endMethod


See Also for Form::getProtoProperty
See Also

setProtoProperty

getStyleSheet

saveStyleSheet


Form::getSelectedObjects
getSelectedObjects	5.0

See Also	Example	Form Type

Method/Procedure

Creates an array listing the selected objects in a form.

Syntax

getSelectedObjects ( var objects Array[] UIObject ) SmallInt

Description

getSelectedObjects creates an array objects listing the selected objects of a form, and returns the number of objects selected. This procedure is useful for creating routines that manipulate objects on forms in design mode.


Example for Form::getSelectedObjects
getSelectedObjects Example

This example creates a form that contains three boxes. Next, it selects two of the boxes, displays their names in a dialog box, and sets their color to blue.

;btnObjectsSelected :: pushButton
const
kOneInch = 1440 ; One inch = 1,440 twips.
endConst

method pushButton(var eventInfo Event)
var
foTemp	Form
arObjects	Array[] UIObject
arObjNames	Array[] String
uiVar	UIObject
si,
siSelObj	SmallInt
stBoxName	String

endVar

foTemp.create()

; Create 3 boxes.
for si from 1 to 3
uiVar.create(BoxTool, si * kOneInch, si*kOneInch,
   	             kOneInch, kOneInch, foTemp)
uiVar.Name = "Box" + String(si)
uiVar.Visible = Yes
endFor

; Select Box2 and Box3 by setting the Select property.
for si from 2 to 3
stBoxName = "Box" + String(si)
uiVar.attach(foTemp.(stBoxName))
uiVar.Select = Yes
endFor

; Get the selected objects.
siSelObj = foTemp.getSelectedObjects(arObjects)
siSelObj.view("Number of selected objects:")

; Get the names of the selected objects.
arObjNames.setSize(siSelObj)
for si from 1 to siSelObj
uiVar.attach(arObjects[si])
arObjNames[si] = uiVar.Name
endFor
arObjNames.view("Names of selected objects:")

; Change the color of the selected objects.
for si from 1 to arObjects.size()
uiVar.attach(arObjects[si])
uiVar.Color = Blue
endFor

foTemp.close()
endMethod


See Also for Form::getSelectedObjects
See Also

setSelectedObjects


Form::getStyleSheet
getStyleSheet	5.0

See Also	Example	Form Type

Method/Procedure

Returns the name of a form's style sheet.

Syntax

getStyleSheet ( ) String

Description

getStyleSheet returns the file name of a form's style sheet. If the style sheet is in :WORK:, getStyleSheet returns the file name and extension, if any (for example, BORLAND.FT). Otherwise, getStyleSheet returns the full path (for example, C:\PDOXWIN\BORLAND.FT).

If called as a method, getStyleSheet returns the file name of the style sheet of the specified form. If called as a procedure, it uses the style sheet of the current form.

It returns the name of the style sheet used by the specified form, which may be different from the Paradox system style sheet. To get the name of the default screen style sheet, call the getDefaultScreenStyleSheet procedure defined for the System type. To get the name of the default printer style sheet, call the getDefaultPrinterStyleSheet procedure defined for the System type.


Example for Form::getStyleSheet
getStyleSheet Example

See the example for setStyleSheet.


See Also for Form::getStyleSheet
See Also

setStyleSheet

saveStyleSheet

getProtoProperty

setProtoProperty

System::getDefaultPrinterStyleSheet

System::getDefaultScreenStyleSheet


Form::getTitle
getTitle

See Also	Example	Form Type

Method/Procedure

Returns the text of the window title bar.

Syntax

getTitle ( ) String

Description

getTitle returns the text in the title bar of the window containing the object.


Example for Form::getTitle
getTitle Example

In the following example, the pushButton method for showTitle opens a form, gets the new form's title and displays the title in a dialog box. This method then switches the open form to the Design window and retrieves its title again:

; showTitle::pushButton
method pushButton(var eventInfo Event)
var
   siteForm  Form
   titleText String
endVar
siteForm.open("Sitenote.fsl")
titleText = siteForm.getTitle() ; reads window title into titleText
msgInfo("Title:", titleText)    ; displays "Form : SITENOTE.FSL"
siteForm.design()               ; switch to the Design window
sleep()                         ; yield!
titleText = siteForm.getTitle() ; get the Design window title
msgInfo("Title:", titleText)    ; displays "Form Design: SITENOTE.FSL"
siteForm.close()
endMethod


See Also for Form::getTitle
See Also

setTitle

attach


Form::hide
hide

See Also	Example	Form Type

Beginner

Method/Procedure

Makes a window invisible.

Syntax

hide ( )

Description

hide makes a window invisible but doesn't close it.


Example for Form::hide
hide Example

In the following example, the pushButton method for hideForm opens a form, hides it, then shows it:

; hideForm::pushButton
method pushButton(var eventInfo Event)
var
  siteForm Form
endVar
siteForm.open("Sitenote.fsl")         ; displays Sitenote form
siteForm.hide()                   ; makes form invisible
siteForm.action(DataEnd)          ; move to the end of the table
siteForm.action(DataBeginEdit)    ; start edit mode
siteForm.action(DataInsertRecord) ; insert a new, blank record
if NOT siteForm.isVisible() then
  msgInfo("Status", "It's hidden.")
endif
message("Come out, come out, wherever you are!")
siteForm.show()                   ; make form visible again
if siteForm.isVisible() then
  msgInfo("Status", "It's visible.")
endif
endMethod


See Also for Form::hide
See Also

show

bringToTop

open

openAsDialog


Form::hideToolbar
hideToolbar	5.0

See Also	Example	Form Type

Procedure

Makes the Toolbar (SpeedBar) invisible.

Syntax

hideToolbar ( )

Description

hideToolbar removes the Toolbar (SpeedBar) from the Desktop. You must call showToolbar to restore it.


Example for Form::hideToolbar
hideToolbar Example

In the following example, the pushButton method for the toggleToolbar button checks whether the Toolbar is showing. If the Toolbar is visible, this method hides it; if the Toolbar isn't visible, this method shows it:

; toggleToolbar::pushButton
method pushButton(var eventInfo Event)
if isToolbarShowing() then   ; if Toolbar is off
   hideToolbar()             ; hide it
else                          ; otherwise
   showToolbar()             ; show it
endif
endMethod


See Also for Form::hideToolbar
See Also

isToolbarShowing

showToolbar


Form::isDesign
isDesign	5.0

See Also	Example	Form Type

Method/Procedure

Reports whether a form is displayed in a design window.

Syntax

isDesign ( ) Logical

Description

isDesign returns True if a form is displayed in a design window; otherwise, it returns False.


Example for Form::isDesign
isDesign Example

In the following example, enumFormNames is used to populate an array ar with the names of the open forms. Then a for loop steps through the array and saves the form if it is in design mode.

;btnSaveForms :: pushButton

method pushButton(var eventInfo Event)

var

ar	Array[] AnyType

siCounter	SmallInt

f	Form

endVar

enumFormNames(ar)

for siCounter from 1 to ar.size()

f.attach(ar[siCounter])

if f.getFileName() = "" then

msgStop("Warning", "At least one form is a new form.")

else

if f.isDesign() then

f.save()

endIf

endIf

endFor

endMethod


See Also for Form::isDesign
See Also

isMaximized

isMinimized


Form::isMaximized
isMaximized

See Also	Example	Form Type

Method/Procedure

Reports whether a window is displayed at its maximum size.

Syntax

isMaximized ( ) Logical

Description

isMaximized returns True if a form is displayed full screen; otherwise, it returns False.


Example for Form::isMaximized
isMaximized Example

In the following example, the pushButton method for the cycleSize button (on the current form) opens or attaches to the Sitenote form with the variable siteForm. If siteForm is maximized, this method minimizes it. If siteForm is minimized, this method restores it to its previous size with the show method. If siteForm is neither maximized nor minimized, this method maximizes it:

; cycleSize::pushButton
method pushButton(var eventInfo Event)
var
  siteForm Form
endVar
; try attaching to form, since it might be open
if NOT siteForm.attach("Form : SITENOTE.FSL") then
  ; if attaching fails, try opening the form
  if NOT siteForm.open("sitenote.fsl") then
    msgStop("Failed", "Couldn't open Sitenote.")
    return     ; if open fails, give up
  endif
endif

; if we reach this point, we have a good form handle
switch
  case isMaximized()  :                   ; if forms are maximized
    msgInfo("Status", "Siteform is maximized.")
    siteForm.show()                       ; restore size
  case siteForm.isMinimized() :           ; if form is minimized
    msgInfo("Status", "Siteform is minimized.")
    siteForm.maximize()
  case NOT (siteForm.isMaximized() OR siteForm.isMinimized()):
    msgInfo("Status", "Siteform is neither minimized or maximized.")
    siteForm.minimize()                            ; minimize
  otherwise :
    msgStop("Stop", "Unable to change size of Siteform.")
endswitch
endMethod


See Also for Form::isMaximized
See Also

maximize

minimize

isMinimized


Form::isMinimized
isMinimized

See Also	Example	Form Type

Method/Procedure

Reports whether a window is displayed as an icon.

Syntax

isMinimized ( ) Logical

Description

isMinimized returns True if a form is displayed as an icon; otherwise, it returns False.


Example for Form::isMinimized
isMinimized Example

See the example for isMaximized.


See Also for Form::isMinimized
See Also

isMaximized

minimize

maximize


Form::isToolbarShowing
isToolbarShowing	5.0

See Also	Example	Form Type

Procedure

Reports whether the Toolbar (SpeedBar) is visible.

Syntax

isToolbarShowing ( ) Logical

Description

isToolbarShowing returns True if the Toolbar (SpeedBar) is visible; otherwise, it returns False.


Example for Form::isToolbarShowing
isToolbarShowing Example

See the example for hideToolbar.


See Also for Form::isToolbarShowing
See Also

hideToolbar

showToolbar


Form::isVisible
isVisible

See Also	Example	Form Type

Method/Procedure

Reports whether any part of a window is displayed.

Syntax

isVisible ( ) Logical

Description

isVisible returns True if any part of a window is displayed (not hidden); otherwise, it returns False.


Example for Form::isVisible
isVisible Example

In the following example, the pushButton method for the siteToTop button attempts to attach to an open form. If the attach is successful, the method checks to see if the form is visible. If the form is visible, the method makes it the topmost window:

; siteToTop::pushButton
method pushButton(var eventInfo Event)
var
  siteForm Form
endVar
; if form is on desktop
if siteForm.attach("Form : SITENOTE.FSL") then
  if siteForm.isVisible() then     ; if form is visible
    siteForm.bringToTop()          ; make it the topmost layer
  else
    msgStop("Sorry", "Can't see Sitenote form.")
  endif
endif
endMethod


See Also for Form::isVisible
See Also

hide

show

bringToTop


Form::keyChar
keyChar

See Also	Example	Form Type

Method

Sends an event to a form's keyChar method.

Syntax

1. keyChar ( const aChar SmallInt, const vChar SmallInt, const state SmallInt ) Logical

2. keyChar ( const characters String [, const state SmallInt ] ) Logical

Description

keyChar sends an event to a form's keyChar method. For syntax 1, you must specify the ANSI character code in aChar, the virtual key code in vChar, and the keyboard state in state (using KeyboardStates constants). For syntax 2, you can specify a string of one or more characters and, optionally, use KeyBoardStates constants to specify a keyboard state.


Example for Form::keyChar
keyChar Example

In the following example, a form named Otherfrm is already open, and it contains one field named fieldOne. The form-level keyChar method for Otherfrm echoes characters to fieldOne. The pushButton method of a button named callOtherKeyC on the current form attaches to Otherfrm as otherForm and calls the keyChar method for otherForm, passing it a string. This is the code for the pushButton method for callOtherKeyC on the current form:

; callOtherKeyC::pushButton
method pushButton(var eventInfo Event)
var
  otherForm Form
endVar
; attach to the other form (assumes it's open)
if otherForm.attach("Form : OTHERFRM.FSL") then
  otherForm.keyChar("Hi! ")   ; send a string
else
  msgStop("Error", "The other form is not available.")
endif
endMethod

This code is attached to Otherfrm's form-level keyChar method:

; thisForm::keyChar  (OTHERFRM.FSL)
method keyChar(var eventInfo KeyEvent)
if eventInfo.isPreFilter()
  then
    ; code here executes for each object in form
  else
    ; code here executes just for form itself
    ; send the key on to fieldOne
    msgInfo("Status", "Executing Otherfrm's keychar.")
    fieldOne.keyChar(eventInfo.char())
endif
endMethod


See Also for Form::keyChar
See Also

keyPhysical


Form::keyPhysical
keyPhysical

See Also	Example	Form Type

Method

Sends an event to a form's keyPhysical method.

Syntax

keyPhysical ( const aChar SmallInt, const vChar SmallInt, const state SmallInt ) Logical

Description

keyPhysical sends an event to a form's keyPhysical method. You must specify the ANSI character code in aChar, the virtual key code in vChar, and the keyboard state in state (using KeyboardStates constants).


Example for Form::keyPhysical
keyPhysical Example

In the following example, a form named OtherFr2 is already open, and it contains one field named fieldOneThere. The form-level keyPhysical method for Otherfrm echoes characters to fieldOneThere. The keyPhysical method of a field named fieldOneHere on the current form attaches to Otherfrm as otherForm. The method then calls the keyPhysical method for otherForm, passing it the ANSI code of the character or keypress, the virtual ANSI code of the character or keypress, and the keyboard state. This is the code for the keyPhysical method for fieldOneHere on the current form:

; fieldOneHere::keyPhysical    (current form)
method keyPhysical(var eventInfo KeyEvent)
var
  otherForm Form
endVar
; attach to the other form (assumes it's open)
if otherForm.attach("Form : OTHERFR2.FSL") then
  ; switch statement sorts out keyBoardState
  switch
    case eventInfo.isShiftKeyDown() :
      otherForm.keyPhysical(eventInfo.charAnsiCode(),
                           eventInfo.vCharCode(), Shift)
    case eventInfo.isAltKeyDown() :
      otherForm.keyPhysical(eventInfo.charAnsiCode(),
                           eventInfo.vCharCode(),
                           Alt)
    case eventInfo.isControlKeyDown() :
      otherForm.keyPhysical(eventInfo.charAnsiCode(),
                           eventInfo.vCharCode(),
                           Control)
    otherwise:
      otherForm.keyPhysical(eventInfo.charAnsiCode(),
                           eventInfo.vCharCode(),
                           0)

  endSwitch
else
  msgStop("Error", "The other form is not available.")
endif
endMethod

The following code is attached to the keyPhysical method for otherForm:

; thisForm::keyPhysical   (OTHERFRM)
method keyPhysical(var eventInfo KeyEvent)
if eventInfo.isPreFilter()
  then
    ;code here executes for each object in form
  else
    ;code here executes just for form itself
    ; pass keyPhysical on to fieldOneThere
    ; switch statement sorts out keyBoardState
    switch
      case eventInfo.isShiftKeyDown() :
        fieldOneThere.keyPhysical(eventInfo.charAnsiCode(),
                                  eventInfo.vCharCode(), Shift)
      case eventInfo.isAltKeyDown() :
        fieldOneThere.keyPhysical(eventInfo.charAnsiCode(),
                                  eventInfo.vCharCode(), Alt)
      case eventInfo.isControlKeyDown() :
        fieldOneThere.keyPhysical(eventInfo.charAnsiCode(),
                                  eventInfo.vCharCode(), Control)
      otherwise :
        fieldOneThere.keyPhysical(eventInfo.charAnsiCode(),
                                  eventInfo.vCharCode(), 0)
    endSwitch
endif
endMethod


See Also for Form::keyPhysical
See Also

keyChar


Form::load
load

See Also	Example	Form Type	Changes

Method

Opens a form in the Form Design window.

Syntax

load ( const formName String, [const windowStyle LongInt [ , const x LongInt, const y LongInt, const w LongInt, const h LongInt ] ] ) Logical

Description

load opens formName in the Form Design window. You have the option to specify in windowStyle  a WindowStyles constant (or combination of constants). You also have the option to specify (in twips) the window's size and position: arguments x  and y specify the position of the upper left corner, arguments w and h specify the width and height, respectively. Both of these options were added in version 5.0. This method works only with saved forms (.FSL); it does not work with delivered forms (.FDL).

Compare this method to open, which opens a form in the Form window. To switch from the Form Design window to the Form window, use run. To switch from the Form window to the Form Design window, use design.

In either the Form Design window or the Form window, you can use UIObject type methods create and methodSet to place objects in the new form and attach methods to them. However, if you create objects while the form is in the Form window, the newly created objects will not automatically be saved when the form is closed.

Note: Some form actions are especially processor-intensive. In some situations, you might need to follow a call to open, load, design, or run with a sleep. See the sleep procedure in the System type for more information.


Example for Form::load
load Example

In the following example, the pushButton method for a button named drawABox loads the Sitenote form in a design window. The method then sets the position of the form, creates a small box, names the box newBox, and sets its color to Blue. In the Form window, the box won't be visible; by default, the Visible property of objects created in this manner is False.

; drawABox::pushButton
method pushButton(var eventInfo Event)
var
   myForm Form
   newObj UIObject
endVar
; open Sitenote in a design window
if myForm.load("Sitenote.fsl") then
   myForm.setPosition(720, 720, 1440*6, 1440*5)  ; 6" by 5"
   newObj.create(BoxTool, 1440, 1440*3, 360, 360, myForm)
   newObj.name = "newBox"
   newObj.color = Blue
else
   msgStop("Stop", "Couldn't load the form.")
endIf
endMethod


See Also for Form::load
See Also

create

open

openAsDialog

design


Changes to Form::load

You have the option to specify (in twips) the window's size and position: arguments x  and y specify the position of the upper left corner, arguments w and h specify the width and height, respectively. Both of these options were added in version 5.0.


Form::maximize
maximize

See Also	Example	Form Type

Beginner

Method/Procedure

Maximizes a window.

Syntax

maximize ( )

Description

maximize displays a window at its full size. Calling this method is equivalent to choosing Maximize from the Control menu.


Example for Form::maximize
maximize Example

In the following example, the pushButton method for the goSites button opens the Sitenote form (assumed to be in the current database), minimizes the current form, then waits for a response. If Sitenote returns "OK", this method maximizes the current form; otherwise, it restores the current form to its previous size:

; goSites::pushButton
method pushButton(var eventInfo Event)
var
  siteForm     Form
  returnString String
endVar
; open the Sitenote form, minimize self (this form), then wait
siteForm.open("Sitenote")
minimize()
returnString = String(siteForm.wait())
; if siteForm returned "OK", then maximize--otherwise, restore
if returnString = "OK" then
  maximize()
  siteForm.close()
else
  show()
  siteForm.close()
endif
endMethod

This code is attached to a button named OKButton on Sitenote:

; OKButton::pushButton
method pushButton(var eventInfo Event)
formReturn("OK")    ; return the string "OK" to the calling form
endMethod


See Also for Form::maximize
See Also

minimize

isMinimized

isMaximized

show


Form::menuAction
menuAction

See Also	Example	Form Type	Changes

Method/Procedure

Sends an event to a form's menuAction method.

Syntax

menuAction ( const action SmallInt ) Logical

Description

menuAction constructs a MenuEvent and calls a specified form's menuAction method. action is one of the MenuCommand constants, or a user-defined menu constant.

Note:	You can't use menuAction to send a menu command constant that is equivalent to a File | New menu choice (for example, File | New | Form) or a File | Open menu choice (for example, File | Open | Table). To simulate these choices, call the appropriate ObjectPAL method (for example, Form::create or TableView::open). This feature was changed in version 5.0; previous versions were more restrictive.


Example for Form::menuAction
menuAction Example

In the following example, the sendATile button on the current form opens the Sitenote form and sends it a MenuWindowTile action.

; sendATile::pushButton
method pushButton(var eventInfo Event)
var
  siteForm  Form
endVar
if siteForm.open("Sitenote.fsl") then
  siteForm.menuAction(MenuWindowTile)
endif
endMethod


See Also for Form::menuAction
See Also

action


Changes to Form::menuAction

You can't use menuAction to send a menu command constant that is equivalent to a File | New menu choice (for example, File | New | Form) or a File | Open menu choice (for example, File | Open | Table). To simulate these choices, call the appropriate ObjectPAL method (for example, Form::create or TableView::open). This feature was changed in version 5.0; previous versions were more restrictive.


Form::methodDelete
methodDelete

See Also	Example	Form Type

Method

Deletes a form-level method from a form.

Syntax

methodDelete ( const methodName String ) Logical

Description

methodDelete deletes a built-in or custom method specified in methodName from a form. You can also specify "Var", "Proc", "Uses", or "Const" in methodName to clear the Var, Proc, Uses, or Const window of a form. If methodName is a built-in method, the built-in behavior for that method is restored.

This method works only with saved forms (.FSL); it does not work with delivered forms (.FDL).


Example for Form::methodDelete
methodDelete Example

In the following example, two forms are on the desktop in a design window: Otherone and Othertwo. The pushButton method for a button named moveMethod (on the current form) moves a method from Otherone to Othertwo:

; moveMethod::pushButton
method pushButton(var eventInfo Event)
var
  tempFormSrc,
  tempFormDest    Form
  transMethod String
endVar
; try to attach to both the source and the destination form
; assume source and destination are on the desktop in a design window
if tempFormSrc.attach("Form Design : OTHERONE.FSL") AND
   tempFormDest.attach("Form Design : OTHERTWO.FSL") then
  ; get definition for source form's mouseRightUp, then delete
  transMethod = tempFormSrc.methodGet("mouseRightUp")
  tempFormSrc.methodDelete("mouseRightUp")
  ; copy the method to the destination form mouseRightUp
  tempFormDest.methodSet("mouseRightUp", transMethod)
else
  msgStop("Error", "Couldn't attach to source and destination forms.")
endif
endMethod


See Also for Form::methodDelete
See Also

methodGet

methodSet

UIObject::create

UIObject::methodGet

UIObject::methodSet


Form::methodGet
methodGet

See Also	Example	Form Type

Method

Gets a form-level method.

Syntax

methodGet (const methodName String ) String

Description

methodGet gets the text of the built-in or custom form-level method specified in methodName attached to a form. You can also specify "Var", "Const", "Uses", or "Proc" to get the contents of the Var, Const, Uses, or Proc window of a form.

This method works only with saved forms (.FSL); it does not work with delivered forms (.FDL). For more information about saving and delivering forms, refer to the User's Guide.


Example for Form::methodGet
methodGet Example

See the example for methodDelete.


See Also for Form::methodGet
See Also

methodDelete

methodSet

enumSourceToFile

UIObject::create

UIObject::methodGet

UIObject::methodSet


Form::methodSet
methodSet

See Also	Example	Form Type

Method

Sets the definition of a method attached to a form.

Syntax

methodSet (const methodName String, const methodText String ) Logical

Description

methodSet writes the text in methodText to the built-in or custom form-level method methodName, overwriting any existing method definition. You can also specify "Var", "Const", "Uses", or "Proc" to set the contents of the Var, Const, Uses, or Proc window of a form.

This method works only with saved forms (.FSL); it does not work with delivered forms (.FDL). For more information about saving and delivering forms, refer to the User's Guide.


Example for Form::methodSet
methodSet Example

See the example for methodDelete.


See Also for Form::methodSet
See Also

methodDelete

methodGet

UIObject::create

UIObject::methodGet

UIObject::methodSet


Form::minimize
minimize

See Also	Example	Form Type

Method/Procedure

Minimizes a window.

Syntax

minimize ( )

Description

minimize displays a window as an icon. Calling this method is equivalent to choosing Minimize from the Control menu.


Example for Form::minimize
minimize Example

See the example for maximize.


See Also for Form::minimize
See Also

maximize

isMaximized

isMinimized

show


Form::mouseDouble
mouseDouble

See Also	Example	Form Type

Method

Sends an event to a form's mouseDouble method.

Syntax

mouseDouble ( const x LongInt, const y LongInt, const state SmallInt ) Logical

Description

mouseDouble constructs a MouseEvent and sends it to a form's mouseDouble method. The arguments x and y specify (in twips) the location of the event, and state specifies a key state using KeyBoardStates constants.


Example for Form::mouseDouble
mouseDouble Example

In the following example, the form Othermse is open in the Form window. The pushButton method for a button named sendMouseDouble on the current form attaches to Othermse as otherForm, then calls the mouseDouble method for otherForm:

; sendMouseDouble::pushButton
method pushButton(var eventInfo Event)
var
  otherForm Form
endVar
; try to attach to target form
if otherForm.attach("Form : OTHERMSE.FSL") then
  ; send a mouseDouble to target form at coordinates 1000, 1000
  otherForm.mouseDouble(1000, 1000, LeftButton)
else
  msgStop("Quitting", "Could not find target form.")
endif
endMethod

This code is attached to the mouseDouble method for otherForm (Othermse):

; otherMouse::mouseDouble  (OTHERMSE)
method mouseDouble(var eventInfo MouseEvent)
var
  targObj  UIObject
endVar
if eventInfo.isPreFilter()
  then
    ; code here executes for each object in form
  else
    ; code here executes just for form itself
    ; write method name to the lastMethod field
    lastMethod = "mouseDouble"
    ; get the target and write name to lastTarget field
    eventInfo.getTarget(targObj)
    lastTarget = targObj.Name
endif
endMethod


See Also for Form::mouseDouble
See Also

mouseDown

mouseRightDouble


Form::mouseDown
mouseDown

See Also	Example	Form Type

Method

Sends an event to a form's mouseDown method.

Syntax

mouseDown ( const x LongInt, const y LongInt, const state SmallInt ) Logical

Description

mouseDown constructs an event and sends it to a form's mouseDown method. The arguments x and y specify (in twips) the location of the event, and state specifies a key state using KeyBoardStates constants.


Example for Form::mouseDown
mouseDown Example

In the following example, the form Othermse is open in the Form window. The pushButton method for a button named sendMouseDown on the current form attaches to Othermse as otherForm, then calls the mouseDown method for otherForm:

; sendMouseDown::pushButton
method pushButton(var eventInfo Event)
var
  otherForm Form
endVar
; try to attach to target form
if otherForm.attach("Form : OTHERMSE.FSL") then
  ; send a mouseDown to target form at coordinates 1000, 1000
  otherForm.mouseDown(1000, 1000, LeftButton)
else
  msgStop("Quitting", "Could not find target form.")
endif
endMethod

This code is attached to the mouseDown method for otherForm (Othermse):

; otherMouse::mouseDown  (OTHERMSE)
method mouseDown(var eventInfo MouseEvent)
var
  targObj  UIObject
endVar
if eventInfo.isPreFilter()
  then
    ; code here executes for each object in form
  else
    ; code here executes just for form itself
    ; write method name to the lastMethod field
    lastMethod = "mouseDown"
    ; get the target and write name to lastTarget field
    eventInfo.getTarget(targObj)
    lastTarget = targObj.Name
endif
endMethod


See Also for Form::mouseDown
See Also

mouseRightDown

mouseUp


Form::mouseEnter
mouseEnter

See Also	Example	Form Type

Method

Sends an event to a form's mouseEnter method.

Syntax

mouseEnter ( const x LongInt, const y LongInt, const state SmallInt ) Logical

Description

mouseEnter constructs a MouseEvent and sends it to a form's mouseEnter method. The arguments x and y specify (in twips) the location of the event, and state specifies a key state using KeyBoardStates constants.


Example for Form::mouseEnter
mouseEnter Example

In the following example, the form Othermse is open in the Form window. The pushButton method for a button named sendMouseEnter on the current form attaches to Othermse as otherForm, then calls the mouseEnter method for otherForm:

; sendMouseEnter::pushButton
method pushButton(var eventInfo Event)
var
  otherForm Form
endVar
; try to attach to target form
if otherForm.attach("Form : OTHERMSE.FSL") then
  ; send a mouseEnter to target form at coordinates 1000, 1000
  otherForm.mouseEnter (1000, 1000, LeftButton)
else
  msgStop("Quitting", "Could not find target form.")
endif
endMethod

This code is attached to the mouseEnter method for otherForm (Othermse):

; otherMouse::mouseEnter  (Othermse)
method mouseEnter(var eventInfo MouseEvent)
var
  targObj  UIObject
endVar
if eventInfo.isPreFilter()
  then
    ; code here executes for each object in form
  else
    ; code here executes just for form itself
    ; write method name to the lastMethod field
    lastMethod = "mouseEnter"
    ; get the target and write name to lastTarget field
    eventInfo.getTarget(targObj)
    lastTarget = targObj.Name
endif
endMethod


See Also for Form::mouseEnter
See Also

mouseExit


Form::mouseExit
mouseExit

See Also	Example	Form Type

Method

Sends an event to a form's mouseExit method.

Syntax

mouseExit ( const x LongInt, const y LongInt, const state SmallInt ) Logical

Description

mouseExit constructs a MouseEvent and sends it to a form's mouseExit method. The arguments x and y specify (in twips) the location of the event, and state specifies a key state using KeyBoardStates constants.


Example for Form::mouseExit
mouseExit Example

In the following example, the form Othermse is open in the Form window. The pushButton method for a button named sendMouseExit on the current form attaches to Othermse as otherForm, then calls the mouseExit method for otherForm:

; sendMouseExit::pushButton
method pushButton(var eventInfo Event)
var
  otherForm Form
endVar
; try to attach to target form
if otherForm.attach("Form : OTHERMSE.FSL") then
  ; send a mouseExit to target form at coordinates 1000, 1000
  otherForm.mouseExit(1000, 1000, LeftButton)
else
  msgStop("Quitting", "Could not find target form.")
endif
endMethod

This code is attached to the mouseExit method for otherForm (Othermse):

; otherMouse::mouseExit  (Othermse)
method mouseExit(var eventInfo MouseEvent)
var
  targObj  UIObject
endVar
if eventInfo.isPreFilter()
  then
    ; code here executes for each object in form
  else
    ; code here executes just for form itself
    ; write method name to the lastMethod field
    lastMethod = "mouseExit"
    ; get the target and write name to lastTarget field
    eventInfo.getTarget(targObj)
    lastTarget = targObj.Name
endif
endMethod


See Also for Form::mouseExit
See Also

mouseEnter


Form::mouseMove
mouseMove

See Also	Example	Form Type

Method

Sends an event to a form's mouseMove method.

Syntax

mouseMove ( const x LongInt, const y LongInt, const state SmallInt ) Logical

Description

mouseMove constructs an event and sends it to a form's mouseMove method. The arguments x and y specify (in twips) the location of the event, and state specifies a key state using KeyBoardStates constants.


Example for Form::mouseMove
mouseMove Example

In the following example, the form Othermse is open in the Form window. The pushButton method for a button named sendMouseMove on the current form attaches to Othermse as otherForm, then calls the mouseMove method for otherForm:

; sendMouseMove::pushButton
method pushButton(var eventInfo Event)
var
  otherForm Form
endVar
; try to attach to target form
if otherForm.attach("Form : OTHERMSE.FSL") then
  ; send a mouseMove to target form at coordinates 1000, 1000
  otherForm.mouseMove(1000, 1000, LeftButton)
else
  msgStop("Quitting", "Could not find target form.")
endif
endMethod

This code is attached to the mouseMove method for otherForm (Othermse):

; otherMouse::mouseMove  (Othermse)
method mouseMove(var eventInfo MouseEvent)
var
  targObj  UIObject
endVar
if eventInfo.isPreFilter()
  then
    ; code here executes for each object in form
  else
    ; code here executes just for form itself
    ; write method name to the lastMethod field
    lastMethod = "mouseMove"
    ; get the target and write name to lastTarget field
    eventInfo.getTarget(targObj)
    lastTarget = targObj.Name
endif
endMethod


See Also for Form::mouseMove
See Also

mouseEnter

mouseExit


Form::mouseRightDouble
mouseRightDouble

See Also	Example	Form Type

Method

Sends an event to a form's mouseRightDouble method.

Syntax

mouseRightDouble (const x LongInt, const y LongInt, const state SmallInt ) Logical

Description

mouseRightDouble constructs a MouseEvent and sends it to a form's mouseRightDouble method. The arguments x and y specify (in twips) the location of the event, and state specifies a key state using KeyBoardStates constants.


Example for Form::mouseRightDouble
mouseRightDouble Example

In the following example, the form Othermse is open in the Form window. The pushButton method for a button named sendMouseRightDouble on the current form attaches to Othermse as otherForm, then calls the mouseRightDouble method for otherForm:

; mouseRightDouble::pushButton
method pushButton(var eventInfo Event)
var
  otherForm Form
endVar
; try to attach to target form
if otherForm.attach("Form : OTHERMSE.FSL") then
  ; send a mouseRightDouble to target form at coordinates 1000, 1000
  otherForm.mouseRightDouble(1000, 1000, RightButton)
else
  msgStop("Quitting", "Could not find target form.")
endif
endMethod

This code is attached to the mouseRightDouble method for otherForm (Othermse):

; otherMouse::mouseRightDouble  (Othermse)
method mouseRightDouble(var eventInfo MouseEvent)
var
  targObj  UIObject
endVar
if eventInfo.isPreFilter()
  then
    ; code here executes for each object in form
  else
    ; code here executes just for form itself
    ; write method name to the lastMethod field
    lastMethod = "mouseRightDouble"
    ; get the target and write name to lastTarget field
    eventInfo.getTarget(targObj)
    lastTarget = targObj.Name
endif
endMethod


See Also for Form::mouseRightDouble
See Also

mouseDouble

mouseRightDown


Form::mouseRightDown
mouseRightDown

See Also	Example	Form Type

Method

Sends an event to a form's mouseRightDown method.

Syntax

mouseRightDown ( const x LongInt, const y LongInt, const state SmallInt ) Logical

Description

mouseRightDown constructs a MouseEvent and sends it to a form's mouseRightDown method. The arguments x and y specify (in twips) the location of the event, and state specifies a key state using KeyBoardStates constants.


Example for Form::mouseRightDown
mouseRightDown Example

In the following example, the form Othermse is open in the Form window. The pushButton method for a button named sendMouseRightDown on the current form attaches to Othermse as otherForm, then calls the mouseRightDown method for otherForm:

; mouseRightDown::pushButton
method pushButton(var eventInfo Event)
var
  otherForm Form
endVar
; try to attach to target form
if otherForm.attach("Form : OTHERMSE.FSL") then
  ; send a mouseRightDown to target form at coordinates 1000, 1000
  otherForm.mouseRightDown(1000, 1000, RightButton)
else
  msgStop("Quitting", "Could not find target form.")
endif
endMethod

This code is attached to the mouseRightDown method for otherForm (Othermse):

; otherMouse::mouseRightDown  (Othermse)
method mouseRightDown(var eventInfo MouseEvent)
var
  targObj  UIObject
endVar
if eventInfo.isPreFilter()
  then
    ; code here executes for each object in form
  else
    ; code here executes just for form itself
    ; write method name to the lastMethod field
    lastMethod = "mouseRightDown"
    ; get the target and write name to lastTarget field
    eventInfo.getTarget(targObj)
    lastTarget = targObj.Name
endif
endMethod


See Also for Form::mouseRightDown
See Also

mouseRightDouble

mouseDown


Form::mouseRightUp
mouseRightUp

See Also	Example	Form Type

Method

Sends an event to a form's mouseRightUp method.

Syntax

mouseRightUp ( const x LongInt, const y LongInt, const state SmallInt ) Logical

Description

mouseRightUp constructs a MouseEvent and sends it to a form's mouseRightUp method. The arguments x and y specify (in twips) the location of the event, and state specifies a key state using KeyBoardStates constants.


Example for Form::mouseRightUp
mouseRightUp Example

In the following example, assume the form Othermse is already open. The pushButton method for a button named sendMouseRightUp on the current form attaches to Othermse as otherForm, then calls the mouseRightUp method for otherForm:

; mouseRightUp::pushButton
method pushButton(var eventInfo Event)
var
  otherForm Form
endVar
; try to attach to target form
if otherForm.attach("Form : OTHERMSE.FSL") then
  ; send a mouseRightUp to target form at coordinates 1000, 1000
  otherForm.mouseRightUp(1000, 1000, RightButton)
else
  msgStop("Quitting", "Could not find target form.")
endif
endMethod

This code is attached to the mouseRightUp method for otherForm (Othermse):

; otherMouse::mouseRightUp  (Othermse)
method mouseRightUp(var eventInfo MouseEvent)
var
  targObj  UIObject
endVar
if eventInfo.isPreFilter()
  then
    ; code here executes for each object in form
  else
    ; code here executes just for form itself
    ; write method name to the lastMethod field
    lastMethod = "mouseRightUp"
    ; get the target and write name to lastTarget field
    eventInfo.getTarget(targObj)
    lastTarget = targObj.Name
endif
endMethod


See Also for Form::mouseRightUp
See Also

mouseUp

mouseRightDown


Form::mouseUp
mouseUp

See Also	Example	Form Type

Method

Sends an event to a form's mouseUp method.

Syntax

mouseUp ( const x LongInt, const y LongInt, const state SmallInt ) Logical

Description

mouseUp constructs a MouseEvent and sends it to a form's mouseUp method. The arguments x and y specify (in twips) the location of the event, and state specifies a key state using KeyBoardStates constants.


Example for Form::mouseUp
mouseUp Example

In the following example, the form Othermse is open in the Form window. The pushButton method for a button named sendMouseUp on the current form attaches to Othermse as otherForm, then calls the mouseUp method for otherForm:

; sendMouseUp::pushButton
method pushButton(var eventInfo Event)
var
  otherForm Form
endVar
; try to attach to target form
if otherForm.attach("Form : OTHERMSE.FSL") then
  ; send a mouseUp to target form at coordinates 1000, 1000
  otherForm.mouseUp(1000, 1000, LeftButton)
else
  msgStop("Quitting", "Could not find target form.")
endif
endMethod

This code is attached to the mouseUp method for otherForm (Othermse):

; otherMouse::mouseUp  (Othermse)
method mouseUp(var eventInfo MouseEvent)
var
  targObj  UIObject
endVar
if eventInfo.isPreFilter()
  then
    ; code here executes for each object in form
  else
    ; code here executes just for form itself
    ; write method name to the lastMethod field
    lastMethod = "mouseUp"
    ; get the target and write name to lastTarget field
    eventInfo.getTarget(targObj)
    lastTarget = targObj.Name
endif
endMethod


See Also for Form::mouseUp
See Also

mouseRightUp

mouseDown


Form::moveTo
moveTo

See Also	Example	Form Type

Method

Moves to a form.

Syntax

moveTo ( [const objectName String] ) Logical

Description

moveTo moves the focus to a form. Optionally, it moves to the object specified in objectName.


Example for Form::moveTo
moveTo Example

In the following example, a form named Sitenote is already open in the Form window on the desktop. the pushButton method for the goToSites button in the current form attaches the variable otherForm to Sitenote, determines if otherForm is visible, and, if so, moves to otherForm. if otherForm is not visible, the method uses show to display the form at its default size (show also moves the focus to the target form):

; goToSites::pushButton
method pushButton(var eventInfo Event)
var
  otherForm  Form
endVar
; assume that Sitenote form is already open
if otherForm.attach("Form : SITENOTE.FSL") then
  if otherForm.isVisible() then
    otherForm.moveTo()       ; if form is visible, move to it
  else
    otherForm.show()         ; otherwise, make it visible
  endif
else
  msgStop("Stop", "Couldn't find form.")
endif
endMethod


See Also for Form::moveTo
See Also

moveToPage


Form::moveToPage
moveToPage

See Also	Example	Form Type

Method/Procedure

Displays a specified page of a form.

Syntax

moveToPage ( const pageNumber SmallInt ) Logical

Description

moveToPage displays the page of a form specified in pageNumber. pageNumber can be an integer variable or an integer constant, but it can't be an object ID. To move to a page by its object ID, use the moveTo method from the UIObject type.


Example for Form::moveToPage
moveToPage Example

In the following example, the current form has two pages. The Sitenote form exists in the working directory and has four pages. The pushButton method for pageThruSites (on the current form) first moves to the second page of the current form. Then the method opens the Sitenote form to the otherForm variable, and pages through otherForm:

; pageThruSites::pushButton
method pushButton(var eventInfo Event)
const
   BillingInfo = SmallInt(4)
endConst
var
   myForm, otherForm  Form
   somePage           SmallInt
endVar
moveToPage(2)                       ; moves to page 2 on this form
if otherForm.open("Sitenote.fsl") then  ; opens to first page
  sleep(2000)                       ; pause
  otherForm.moveToPage(2)           ; moves to page 2 of SiteNote
  sleep(2000)
  somePage = 3
  otherForm.moveToPage(somePage)    ; moves to page 3
  sleep(2000)
  otherForm.moveToPage(BillingInfo) ; moves to page 4
  sleep(2000)
endIf
endMethod


See Also for Form::moveToPage
See Also

bringToTop


Form::open
open

See Also	Example1	Example2	Form Type

Beginner

Method

Opens a window.

Syntax

1. open ( const formName String [, const windowStyle LongInt ] ) Logical

2. open ( const formName String, const windowStyle LongInt, const x SmallInt, const y SmallInt, const w SmallInt, const h SmallInt ) Logical

3. open ( const openInfo FormOpenInfo ) Logical

Description

open displays the form specified in formName. The form is opened in a Form window. The optional arguments x and y specify the location of the upper left corner of the form (in twips), w and h specify the width and height (in twips), and windowStyle specifies display attributes using WindowStyles constants. You can specify more than one window style element by adding the constants together. For example, the following code opens a form and specifies both vertical and horizontal scroll bars:

theForm.open("sales", WinStyleDefault + WinStyleVScroll + WinStyleHScroll)

Compare this method with load, which opens a form in a design window.

Syntax 3 lets you specify form settings from openInfo, a record of type FormOpenInfo. The FormOpenInfo record has been predeclared and has the following structure:

x, y, w, h    LongInt ;position and size of the form
name          String  ;name of form to open
masterTable   String  ;new master table name
queryString   String  ;query to run (actual query string)
winStyle      LongInt ;window style constant(s)

You can use the masterTable member to specify a different master table for the form (this is similar to choosing a different table for a form when you open the form from the Open Form dialog box). Alternatively, you can specify a query string in the queryString member. Paradox executes the query and opens the form; the result of the query is the master table.

Paradox opens saved forms before delivered forms with the same name. For example, suppose the working directory contains ORDERS.FSL (a saved form) and ORDERS.FDL (a delivered form). The following statement opens the saved form, ORDERS.FSL.

ordersForm.open("ORDERS") ; Opens :WORK:ORDERS.FSL.

To specify a delivered form, include the .FDL extension. For example,

ordersForm.open("ORDERS.FDL") ; Opens the delivered form.

Note:	Some form actions are especially processor-intensive. In some situations, you might need to follow a call to open, load, design, or run with a sleep. See the sleep procedure in the System type for more information.


Example 1 for Form::open
open Example 1

In the following example, the keyPhysical method for a field named fieldOne tests all key events. When the user presses F1, the form HELPFORM opens. The keyPhysical method opens a form from the current directory:

; fieldOne::keyPhysical
method keyPhysical(var eventInfo KeyEvent)
var
  helpForm Form
endVar
message(eventInfo.vChar())
if eventInfo.vChar() = "VK_F1" then
  helpForm.open("helpform", WinStyleDefault,
                 720, 720, 1440 * 2, 1440 * 4)
  disableDefault
endIf

endMethod


Example 2 for Form::open
open Example 2

The following example works like the previous example, except that it uses a FormOpenInfo record to set the characteristics of the form to be opened.

; fieldOne::keyPhysical
method keyPhysical(var eventInfo KeyEvent)
var
  openHelpForm FormOpenInfo   ; a predeclared record type
  helpForm     Form
endVar
message(eventInfo.vChar())
if eventInfo.vChar() = "VK_F1" then
  openHelpForm.x = 720
  openHelpForm.y = 720
  openHelpForm.w = 2 * 1440
  openHelpForm.h = 4 * 1440
  openHelpForm.name = "helpform"
  helpForm.open(openHelpForm)
  disableDefault
endIf
endMethod


See Also for Form::open
See Also

close

create

load

openAsDialog

design


Form::openAsDialog
openAsDialog

See Also	Example	Form Type

Method

Opens a Form window as a dialog box.

Syntax

1. openAsDialog ( const formName [, const windowStyle LongInt] ) Logical

2. openAsDialog ( const formName String, const windowStyle LongInt, const x SmallInt, const y SmallInt, const w SmallInt, const h SmallInt ) Logical

3. openAsDialog ( const openInfo FormOpenInfo ) Logical

Description

openAsDialog opens the form formName and displays it on top of any other open windows. The form is in the Form window. formName is always on top, whether it's active or not. The optional arguments x and y specify the upper left corner of the window (in twips), w and h specify the width and height (in twips), and windowStyle specifies display attributes using WindowStyles constants. You can specify more than one window style element by adding the constants. For example, the following code opens a form and specifies both vertical and horizontal scroll bars:

theForm.openAsDialog("sales", WinStyleDefault + WinStyleVScroll + WinStyleHScroll)

Syntax 3 lets you specify form settings from openInfo, a record of type FormOpenInfo. The FormOpenInfo record type is predeclared and has the following structure:

x, y, w, h      LongInt  ; position and size of the form
name            String   ; name of form to open
masterTable     String   ; master table name
queryString     String   ; run this query


Example for Form::openAsDialog
openAsDialog Example

In the following example, the keyPhysical method for a field named fieldOne tests all key events. When the user presses F1, the form HELPFORM opens. The keyPhysical method opens a form as a dialog box:

; fieldOne::keyPhysical
method keyPhysical(var eventInfo KeyEvent)
var
  helpForm Form
endVar
; if user presses F1, open a help dialog box
if eventInfo.vChar() = "VK_F1" then

  helpForm.openAsDialog("helpform", WinStyleDefault,
                        720, 720, 1440 * 4, 1440 * 3)

  helpForm.setTitle("Application Help")

  helpForm.wait()
  helpForm.close()
  disableDefault                        ; don't call Help system
endIf
endMethod


See Also for Form::openAsDialog
See Also

open

wait

formCaller

formReturn


Form::postAction
postAction

See Also	Example	Form Type

Method

Posts an action to an action queue for delayed execution.

Syntax

postAction ( const actionId SmallInt )

Description

postAction works like action, except that the action is not executed immediately. Instead, the action specified by actionID is posted to an action queue at the time of the method call; Paradox waits until a yield occurs (for example, by the current method completing execution or by a call to sleep).

The value of actionID can be a user-defined action constant or a constant from one of the following Action classes:

ActionDataCommands

ActionEditCommands

ActionFieldCommands

ActionMoveCommands

ActionSelectCommands


Example for Form::postAction
postAction Example

In the following example, the pushButton method for openSitesNew opens the Sitenote form to the variable otherForm. The method then posts three actions to otherForm, and displays a message in a dialog box. The actions specified by postAction occur when Paradox yields:

; openSitesNew::pushButton
method pushButton(var eventInfo Event)
; otherForm variable is global to form--stays in scope after method ends
if otherForm.open("Sitenote.fsl") then
  ; these actions will not execute until after this method ends
  otherForm.postAction(DataEnd)          ; move to the last record
  otherForm.postAction(DataBeginEdit)    ; start Edit mode
  otherForm.postAction(DataInsertRecord) ; insert a new blank record
  msgInfo("Status", "About to perform posted actions. Watch closely.")
else
  msgStop("Stopped", "Could not open form.")
endif
endMethod


See Also for Form::postAction
See Also

action


Form::run
run

See Also	Example	Form Type

Method

Switches a form from the Form Design window to the Form window.

Syntax

run ( ) Logical

Description

run switches a form from the Form Design window to the Form window. This method works only with saved forms (.FSL); it does not work with delivered forms (.FDL). For more information about saving and delivering forms, refer to the Guide to ObjectPAL.

To switch from the Form window to the Form Design window, use design.

Note:	Some form actions are especially processor-intensive. In some situations, you might need to follow a call to open, load, design, or run with a sleep. See the sleep method in the System type for more information.


Example for Form::run
run Example

The following example opens the Sitenote form in a design window, deletes the pushButton method from the form, then runs the form. Assume that the Sitenote form is in the current directory. This code is attached to the pushButton code for delPushButton:

; delPushButton::pushButton
method pushButton(var eventInfo Event)
var
  otherForm  Form
endVar
; load the Sitenote form, delete the pushButton
; method, then run the form
if otherForm.load("Sitenote") then
  otherForm.methodDelete("pushButton")
  otherForm.run()
endif               ; won't be permanent
endMethod


See Also for Form::run
See Also

design


Form::save
save

See Also	Example	Form Type

Method

Saves a form to disk.

Syntax

save ( [ const newFormName String ] ) Logical

Description

save writes a form to disk in the user's current working directory. This method works only when the form is in a design window.

You can use newFormName to specify a name for the form, or you can omit it. If you omit newFormName and the form doesn't have a name already, Paradox displays a dialog box to prompt the user to enter a name. If the form already has a name, Paradox saves it using that name.


Example for Form::save
save Example

See the example for create.


See Also for Form::save
See Also

create

design


Form::saveStyleSheet
saveStyleSheet	5.0

See Also	Example	Form Type

Method

Saves a style sheet.

Syntax

saveStyleSheet ( const fileName String, const overWrite Logical ) Logical

Description

saveStyleSheet saves a style sheet to the file specified in fileName. If fileName does not specify a full path for the style sheet file, this method saves it to :WORK:.

The value of overWrite specifies what to do if the file already exists. If overWrite is True and the file exists, Paradox overwrites the file without asking for confirmation. If overWrite is False and the file exists, the file is not saved. This method returns True if it saves the file; otherwise, it returns False.

saveStyleSheet saves the form's current style sheet, including any changes made interactively or using ObjectPAL. If called as a method, saveStyleSheet operates on the specified form. If called as a procedure, it operates on the current form. It returns True if it succeeds; otherwise, it returns False.


Example for Form::saveStyleSheet
saveStyleSheet Example

This example sets the frame style of field objects and text objects, then saves the form's style sheet to a file named IN3DFRAM.FT. If the file exists, it is overwritten.

const

kOverWrite = Yes

endConst

method mouseClick(var eventInfo MouseEvent)

var

thisForm Form

endVar

thisForm.attach()

thisForm.setProtoProperty(FieldTool, "Frame.Style", Inside3DFrame)

thisForm.setProtoProperty(TextTool, "Frame.Style", Inside3DFrame)

thisForm.saveStyleSheet("in3dfram.ft", kOverWrite)

endmethod


See Also for Form::saveStyleSheet
See Also

getStyleSheet

setStyleSheet

getProtoProperty

setProtoProperty


Form::selectCurrentTool
selectCurrentTool	5.0

See Also	Example	Form Type

Method

Specifies a Toolbar (SpeedBar) tool to use.

Syntax

selectCurrentTool ( objType SmallInt ) Logical

Description

selectCurrentTool specifies a Toolbar (SpeedBar) tool to use, where objType is one of the UIObjectTypes constants. When used with a form in the Form Design window, this method makes the specified tool active and sets the mouse shape accordingly.


Example for Form::selectCurrentTool
selectCurrentTool Example

This example creates a form and sets the current tool to the Field tool.

method pushButton(var eventInfo Event)

var

foTest	Form

endVar

foTest.create()

foTest.selectCurrentTool(FieldTool)

msgInfo("Next step:",

          "Click and drag to draw a field object.")

endMethod


See Also for Form::selectCurrentTool
See Also

setSelectedObjects


Form::setMenu
setMenu	5.0

See Also	Example	Form Type

Method

Associates a menu with a form.

Syntax

setMenu ( const menuVar Menu )

Description

setMenu associates the menu specified in menuVar with a form. This method performs the same function as Menu::show, and adds the following features:

When the form gets focus, Paradox displays the associated menu.

Actions resulting from choices from that menu are sent to that form.


Example for Form::setMenu
setMenu Example

The following example is a script. It opens a form, builds a simple menu, then uses setMenu to assign the menu to the form.

method run(var eventInfo Event)

var

foOrders	Form

muOrderForm	Menu

puFormFile	PopUpMenu

endVar

; Build a menu for the form.

foOrders.open("orders")

; Setting the StandardMenu property to False

; (either in ObjectPAL code or interactively)

; can reduce flicker when changing menus.

foOrders.StandardMenu = False

puFormFile.addText("&New Form", MenuEnabled, MenuFormNew)

puFormFile.addText("&Open Form", MenuEnabled, MenuFormOpen)

puFormFile.addText("&Exit", MenuEnabled, MenuFileExit)

muOrderForm.addPopUp("&File", puFormFile)

foOrders.setMenu(muOrderForm)

endMethod


See Also for Form::setMenu
See Also

Menu::show

PopUpMenu::addText

Report::setMenu


Form::setPosition
setPosition

See Also	Example	Form Type

Method/Procedure

Positions a window onscreen.

Syntax

setPosition ( const x LongInt, const y LongInt, const w LongInt, const h LongInt )

Description

setPosition positions a window onscreen. The arguments x and y specify the coordinates of the upper left corner of the form (in twips), and w and h specify the width and height (in twips).

To ObjectPAL, the screen is a two-dimensional grid, with the origin (0, 0) at the upper left corner of an object's container, positive x-values extending to the right, and positive y-values extending down.

For dialog boxes and for the Paradox Desktop application, the position is given relative to the entire screen; for forms, reports, and table windows, the position is given relative to the Paradox Desktop.


Example for Form::setPosition
setPosition Example

See the example for getPosition.


See Also for Form::setPosition
See Also

open


Form::setProtoProperty
setProtoProperty	5.0

See Also	Example	Form Type

Method/Procedure

Sets the value of a specified property of a prototype object.

Syntax

setProtoProperty ( const objectType SmallInt, propertyName String, value AnyType ) Logical

Description

setProtoProperty sets the property specified in propertyName of the prototype object specified in objectType to the value specified in value. To specify objectType, use one of the UIObjectTypes constants. If called as a method, setProtoProperty operates on prototype objects in the style sheet of the specified form. If called as a procedure, it uses the style sheet of the current form.

Changes to the style sheet are not saved automatically. You must either save the style sheet interactively or call saveStyleSheet.


Example for Form::setProtoProperty
setProtoProperty Example

See the example for saveStyleSheet.


See Also for Form::setProtoProperty
See Also

getProtoProperty

getStyleSheet

saveStyleSheet


Form::setSelectedObjects
setSelectedObjects	5.0

See Also	Example	Form Type

Method

Selects specified objects in a form.

Syntax

setSelectedObjects ( objects Array[ ] UIObject, const yesNo Logical )

Description

setSelectedObjects selects specified objects in a form in a Design window as if you had selected them interactively. The array objects is an array of UIObjects (not the object names) to select. Use attach to assign a UIObject to an array.

The argument yesNo specifies whether to show selection handles: if yesNo is True, the selected objects have handles; otherwise, they do not.


Example for Form::setSelectedObjects
setSelectedObjects Example

The following example creates a form, then creates two boxes in it. Then it calls setSelectedObjects to select the boxes. Note that you must use attach assign a UIObject to an array.

method pushButton(var eventInfo Event)

var

foTemp	Form

uiTemp	UIObject

arObjects	Array[2] UIObject

endVar

const

kOneInch = 1440 ; One inch = 1,440 twips.

kShowHandles = Yes

endConst

foTemp.create()

uiTemp.create(BoxTool, 300, 300, kOneInch, kOneInch, foTemp)

uiTemp.Visible = Yes

arObjects[1].attach(uiTemp)

uiTemp.create(BoxTool, 300, 2200, kOneInch, kOneInch, foTemp)

uiTemp.Visible = Yes

arObjects[2].attach(uiTemp)

foTemp.setSelectedObjects(arObjects, kShowHandles)

endMethod


See Also for Form::setSelectedObjects
See Also

getSelectedObjects

UIObject::attach


Form::setStyleSheet
setStyleSheet	5.0

See Also	Example	Form Type

Method/Procedure

Specifies a form's style sheet.

Syntax

setStyleSheet ( const fileName String )

Description

setStyleSheet makes a form use the style sheet specified in fileName. If fileName does not specify a full path to the style sheet, this method searches for it in :WORK:. If called as a method, setStyleSheet operates on the specified form. If called as a procedure, it operates on the current form.

Any UIObjects created in the form while the style sheet is active will have the properties and methods of the corresponding prototype objects in the style sheet. setStyleSheet does not change the properties or methods of UIObjects that already exist. This method affects only the specified form; it does not affect the screen or printer style sheets. Use the System procedures setDefaultScreenStyleSheet and setDefaultPrinterStyleSheet for that.


Example for Form::setStyleSheet
setStyleSheet Example

The following example opens a form, then calls getStyleSheet to see which style sheet the form is using. If the style sheet is not BORLAND.FT, the code calls setStyleSheet to set it, then calls getStyleSheet again to make sure it was set successfully. Note that setStyleSheet requires double backslashes in the path, but getStyleSheet returns single backslashes.

method pushButon(var eventInfo Event)

   var

      f Form

   endVar

   f.open("orders")

   ; Get and set the style sheet for this form.

   if f.getStyleSheet() <> "c:\pdoxwin\borland.ft" then

      f.setStyleSheet("c:\\pdoxwin\\borland.ft")

      if f.getStyleSheet() <> "c:\pdoxwin\borland.ft" then

         msgStop("Problem", "Could not set the style sheet.")

       endIf

   endIf

endMethod


See Also for Form::setStyleSheet
See Also

getStyleSheet

saveStyleSheet

getProtoProperty

setProtoProperty

System::setDefaultPrinterStyleSheet

System::setDefaultScreenStyleSheet


Form::setTitle
setTitle

See Also	Example	Form Type

Method/Procedure

Sets the text in the window title bar.

Syntax

setTitle ( const text String )

Description

setTitle changes the text of the window title bar to the text specified in text. The maximum length of text is 78 characters. If you change a form's title, remember that you must use the new title when you want to attach to that form. (See the description of attach for more details.)


Example for Form::setTitle
setTitle Example

See the example for openAsDialog.


See Also for Form::setTitle
See Also

getTitle

attach


Form::show
show

See Also	Example	Form Type

Beginner

Method/Procedure

Displays a minimized window at its previous size; makes a hidden form visible.

Syntax

show ( )

Description

show makes a hidden form visible. show also restores a minimized window to the size before it was minimized. This method is similar to the Restore command on the Control menu.

show doesn't make a form the topmost window; use bringToTop to make a form the top layer and give it focus.


Example for Form::show
show Example

See the example for hide.


See Also for Form::show
See Also

hide

isVisible


Form::showToolbar
showToolbar	5.0

See Also	Example	Form Type

Procedure

Makes the Toolbar (SpeedBar) visible.

Syntax

showToolbar ( )

Description

showToolbar displays the Toolbar (SpeedBar).


Example for Form::showToolbar
showToolbar Example

See the example for hideToolbar.


See Also for Form::showToolbar
See Also

hideToolbar

isToolbarShowing


Form::wait
wait

See Also	Example	Form Type

Beginner

Method

Suspends execution of a method.

Syntax

wait ( ) AnyType

Description

wait suspends execution of the current method until the form you're waiting for returns (see formReturn). This method is useful when you open a second form as a dialog box. Execution resumes in the first form when the second form (the one you're waiting for) calls formReturn, or when the second form closes. Once the called form returns, the calling form should close it with close. The called form does not automatically close, even if the user closes it; it stays open so that code on the calling form can examine it (for instance, to see settings on a dialog box).


Example for Form::wait
wait Example

See the example for formReturn.


See Also for Form::wait
See Also

formReturn

formCaller

openAsDialog


Form::windowClientHandle
windowClientHandle

See Also	Example	Form Type

Method/Procedure

Returns the handle of a window.

Syntax

windowClientHandle ( ) SmallInt

Description

A window handle is a unique integer identifier assigned to a window by Windows. windowClientHandle returns an integer value representing the window handle of the client area of a form. When called as a procedure, it returns the window handle of the client area of the current form. This method should be used only by advanced programmers.

This information is useful only if you're using functions from a dynamic link library (DLL).


Example for Form::windowClientHandle
windowClientHandle Example

In the following example, assume that a DLL called MYTEST.DLL exists and that it contains a function called doSomething. The doSomething function takes one argument, a window handle.

; someButton::pushButton
method pushButton(var eventInfo Event)
Uses MYTEST
  doSomething(const wHandle CWORD)
endUses
doSomething(windowClientHandle())  ; call doSomething and supply the
                                   ; handle of the client portion
                                   ; of the current form
endMethod


See Also for Form::windowClientHandle
See Also

windowHandle


Form::windowHandle
windowHandle

See Also	Example	Form Type

Method/Procedure

Returns the handle of a window.

Syntax

windowHandle ( ) SmallInt

Description

A window handle is a unique integer identifier assigned to a window by Windows. windowHandle returns an integer value representing the window handle of a form. When called as a procedure, it returns the window handle of the current form. This method should be used only by advanced programmers.

This information is useful only if you're using functions from a Dynamic Link Library (DLL).


Example for Form::windowHandle
windowHandle Example

In the following example, assume that a DLL called MYTEST.DLL exists and that it contains a function called doSomething. The doSomething function takes one argument, a window handle.

; someButton::pushButton
method pushButton(var eventInfo Event)
Uses MYTEST
  doSomething(const wHandle CWORD)
endUses
doSomething(windowHandle())  ; call doSomething and supply the
                             ; window handle of the current form
endMethod


See Also for Form::windowHandle
See Also

windowClientHandle


Graphic Type

A Graphic variable provides a handle for manipulating a graphic object. That is, you can use Graphic variables in ObjectPAL code to manipulate graphic objects. Graphic objects contain and display graphics in bitmap format (BMP). However, Paradox can import the following graphic formats: bitmap (BMP), encapsulated Postscript (EPS), graphic interchange format (GIF), Paintbrush (PCX), and tagged information file format (TIF).

Using Graphic type methods readFromClipboard, writeToClipboard, readFromFile, and writeToFile, you can use Graphic variables to transfer bitmaps between forms (and reports), tables, the Clipboard, and disk files.

The Graphic type includes several derived methods from the AnyType type.

Methods for the Graphic Type

AnyType		Graphic
blank		readFromClipboard
dataType		readFromFile
isAssigned		writeToClipboard
isBlank		writeToFile
isFixedType


Graphic::readFromClipboard
readFromClipboard

See Also	Example	Graphic Type

Method

Reads a graphic from the Clipboard.

Syntax

readFromClipboard ( ) Logical

Description

readFromClipboard reads a graphic from the Clipboard to a variable of type Graphic. If the Clipboard contains a graphic that can be copied to the Graphic variable, readFromClipboard returns True. If the Clipboard is empty or does not contain a valid graphic, readFromClipboard returns False. readFromClipboard can read bitmap (BMP) and device independent bitmap (DIB) formats.


Example for Graphic::readFromClipboard
readFromClipboard Example

In the following example, a form contains a multi-record object named BIOLIFE bound to the Biolife table, and a button named getGraphic. The pushButton method for getGraphic locates the record with a Common Name field value of "Firefish", then writes the contents of the Clipboard to that record's Graphic field. If the Clipboard is empty or does not contain a graphic, the readFromClipboard method returns False, and the value of the Graphic field is not changed.

; getGraphic::pushButton
method pushButton(var eventInfo Event)

var
  myGraphic Graphic
endVar

if BIOLIFE.locate("Common Name", "Firefish") then

  if myGraphic.readFromClipboard() then
    ; get the current clipboard contents to myGraphic
    BIOLIFE.edit()                 ; start Edit mode on the table
    BIOLIFE.Graphic = myGraphic    ; write the bitmap to the field
    BIOLIFE.endEdit()              ; end Edit mode
  endIf
endIf
endMethod


See Also for Graphic::readFromClipboard
See Also

readFromFile

writeToClipboard


Graphic::readFromFile
readFromFile

See Also	Example	Graphic Type

Method

Reads a graphic from a file.

Syntax

readFromFile ( const fileName String ) Logical

Description

readFromFile reads a graphic from a disk file specified in fileName. readFromFile returns True if the fileName name exists and contains a graphic format that can be imported; otherwise, it returns False. Paradox can import the following graphic formats:

{bullet.bmp}	bitmap (BMP)

{bullet.bmp}	encapsulated Postscript (EPS)

{bullet.bmp}	graphic interchange format (GIF)

{bullet.bmp}	Paintbrush (PCX)

{bullet.bmp}	tagged information file format (TIF)


Example for Graphic::readFromFile
readFromFile Example

The following example assumes that a form contains a button named getChess, and an unbound graphic field named bitmapField. The pushButton method for getChess attempts to read the bitmap file CHESS.BMP from the C:\WINDOWS directory and stores CHESS.BMP in the chessBmp variable. If readFromFile is successful, chessBmp is written to the bitmapField object.

; getChess::pushButton
method pushButton(var eventInfo Event)
var
  chessBmp Graphic
endVar
; get the bitmap chess.bmp from the C:\Windows directory,
; and write it to the bitmapField graphic
if chessBmp.readFromFile("c:\\windows\\chess.bmp") then
  bitmapField = chessBmp
endIf
endMethod


See Also for Graphic::readFromFile
See Also

readFromClipboard

writeToFile


Graphic::writeToClipboard
writeToClipboard

See Also	Example	Graphic Type

Method

Writes a bitmap to the Clipboard.

Syntax

writeToClipboard ( ) Logical

Description

writeToClipboard writes a bitmap to the Clipboard. writeToClipboard returns True if successful and False if it fails. Formats copied to Clipboard can be bitmap (BMP) or device independent bitmap (DIB).


Example for Graphic::writeToClipboard
writeToClipboard Example

The following example assumes that a form contains a button named getChessToClip, and a bitmap field named bitmapField. The pushButton method for getChessToClip stores the value of bitmapField to chessBmp, then writes chessBmp to the Clipboard:

; getChessToClip::pushButton
method pushButton(var eventInfo Event)
var
   chessBmp Graphic
endVar
; get the bitmap from the bitmapField,
; and write it to the Clipboard
if NOT bitmapField.isblank() then
  chessBmp = bitmapField
  chessBmp.writeToClipboard()
endif
endMethod


See Also for Graphic::writeToClipboard
See Also

writeToFile

readFromClipboard


Graphic::writeToFile
writeToFile

See Also	Example	Graphic Type

Method

Writes a bitmap to a file.

Syntax

writeToFile ( const fileName String ) Logical

Description

writeToFile writes a bitmap to a disk file specified in fileName. If fileName does not specify a path, this method writes to :WORK:. writeToFile returns True if the file specified can be created; otherwise it returns False.


Example for Graphic::writeToFile
writeToFile Example

The following example assumes that a form contains a button named writeChessToFile, and a bitmap named bitmapField. The pushButton method for writeChessToFile stores the value of bitmapField to chessBmp, then writes chessBmp to a file in the current directory named CHESS1.BMP:

; writeChessToFile::pushButton
method pushButton(var eventInfo Event)
var
   chessBmp Graphic
endVar
; get the bitmap from the bitmapField,
; and write it to the Clipboard
if NOT bitmapField.isblank() then
  chessBmp = bitmapField
  chessBmp.writeToFile("chess1.bmp")
endif
endMethod


See Also for Graphic::writeToFile
See Also

writeToClipboard


KeyEvent Type

A KeyEvent object gets and sets information about keystroke events.

The following built-in methods are triggered by KeyEvents: keyChar, and keyPhysical.

The KeyEvent type includes several derived methods from the Event type.

Methods for the KeyEvent Type

Event		KeyEvent
errorCode		char
getTarget		charAnsiCode
isFirstTime		isAltKeyDown
isPreFilter		isControlKeyDown
isTargetSelf		isFromUI
reason		isShiftKeyDown
setErrorCode		setAltKeyDown
setReason		setChar
		setControlKeyDown
		setShiftKeyDown
		setVChar
		setVCharCode
		vChar
		vCharCode


KeyEvent::char
char

See Also	Example	KeyEvent Type

Method

Returns the character assocated with a keypress.

Syntax

char ( ) String

Description

char returns the character associated with a keypress. For example, if you type a, char returns "a". If you press Shift+A, char returns A. If a keypress results in an unprintable character, char returns an empty string ("").

char is the easiest way to check for an alphanumeric keypress when case matters. If case doesn't matter, use vChar to test against the string value of a virtual key code. For instance, if it matters whether the user presses a lowercase a or an uppercase A, use char to return the string value of the character pressed, and compare it to "a" or "A". If you want to find out if either a or A was pressed, use vChar and compare it to "A" (the virtual key code string for either a lowercase a or an uppercase A).


Example for KeyEvent::char
char Example

The following example displays the character typed into a field object as a message at the bottom of the screen. The code is attached to a field object's built-in keyChar method.

; thisField::keyChar
method keyChar(var eventInfo KeyEvent)
  doDefault                  ; put character in the field
  message(eventInfo.char())  ; then display character as a message
endMethod


See Also for KeyEvent::char
See Also

charAnsiCode

setChar

vChar

String::ansiCode

String::chrToKeyName

String::toANSI

String::toOEM


KeyEvent::charAnsiCode
charAnsiCode

See Also	Example	KeyEvent Type

Method

Returns the ANSI value associated with a keypress.

Syntax

charAnsiCode ( ) SmallInt

Description

charAnsiCode returns an integer representing the ANSI value associated with a keypress. For example, if you type a, charAnsiCode returns 97. If you press Shift + A, charAnsiCode returns 65. charAnsiCode works with unprintable characters as well. For example, if you press Enter, charAnsiCode returns 13.


Example for KeyEvent::charAnsiCode
charAnsiCode Example

The following example beeps when a user presses Backspace or Ctrl + H. This code is attached to a field object's built-in keyPhysical method.

; thisField::keyPysical
method keyPhysical(var eventInfo KeyEvent)
if eventInfo.charAnsiCode() = 8 then  ; if user presses Ctrl+H or Backspace
  beep()                             ; make a sound
endif
endMethod


See Also for KeyEvent::charAnsiCode
See Also

char

vChar

setVChar

String::ansiCode

String::chrToKeyName

String::toANSI

String::toOEM


KeyEvent::isAltKeyDown
isAltKeyDown

See Also	Example	KeyEvent Type

Method

Reports whether Alt was held down during a KeyEvent.

Syntax

isAltKeyDown ( ) Logical

Description

isAltKeyDown returns True if Alt was held down at the time a KeyEvent occurred; otherwise, it returns False.


Example for KeyEvent::isAltKeyDown
isAltKeyDown Example

The following example assumes a form has a box named boxOne. When the user presses Alt-C, the keyPhysical method for the form changes the color of boxOne. This code is attached to a form's keyPhysical method

; thisForm::keyPhysical
method keyPhysical(var eventInfo KeyEvent)
if eventInfo.isPreFilter()
  then
    ;code here  executes for each object in form

    if eventInfo.isAltKeyDown() AND    ; if user presses Alt+C
       eventInfo.vChar() = "C" then
       disableDefault                  ; block normal processing
       ; alternate a boxOne's color between red and blue
       boxOne.color = iif(boxOne.color = Red, Blue, Red)
    endif

  else
    ;code here executes just for form itself
endif
endMethod


See Also for KeyEvent::isAltKeyDown
See Also

isControlKeyDown

isShiftKeyDown

setAltKeyDown


KeyEvent::isControlKeyDown
isControlKeyDown

See Also	Example	KeyEvent Type

Method

Reports whether Ctrl was held down during a KeyEvent.

Syntax

isControlKeyDown ( ) Logical

Description

isControlKeyDown returns True if Ctrl was held down at the time a KeyEvent occurred; otherwise, it returns False.


Example for KeyEvent::isControlKeyDown
isControlKeyDown Example

See the example for setControlKeyDown.


See Also for KeyEvent::isControlKeyDown
See Also

setControlKeyDown

isAltKeyDown

isShiftKeyDown


KeyEvent::isFromUI
isFromUI

See Also	Example	KeyEvent Type

Method

Reports whether an event was generated by the user interacting with Paradox.

Syntax

isFromUI ( ) logical

Description

isFromUI reports whether a KeyEvent was generated by the user interacting with Paradox, or internally (for example, by an ObjectPAL statement). This method returns True only for the first KeyEvent generated by a keypress; for subsequent events and actions, it returns False.


Example for KeyEvent::isFromUI
isFromUI Example

The following example shows how to put one of two messages on the status bar depending on if a character is put in a field by a user or by ObjectPAL. This method returns True for user actions (including sendKeys, which mimics user input). It returns False with all other ObjectPAL methods, including keyPhysical.

The following code is attached to the pushButton method of a button named btnAutoFill. This method sends the character "a" to the field fldPassword.

; btnAutofill :: pushButton

method pushButton(var eventInfo Event)

fldPassword.keyPhysical(97, 97, Shift)   ; send an "a"

endMethod

The following code is attached to the keyPhysical method of a field named fldPassword. This method sends one of two messages depending on whether the user typed in a character or used the btnAutofill button.

;fldPassword :: keyPhysical

method keyPhysical(var eventInfo KeyEvent)

if eventInfo.isFromUI() then

message("Try using the autofill button.")

else

message("Automatically typing value.")

endIf

endMethod


See Also for KeyEvent::isFromUI
See Also

Event::isPreFilter


KeyEvent::isShiftKeyDown
isShiftKeyDown

See Also	Example	KeyEvent Type

Method

Reports whether Shift was held down during a KeyEvent.

Syntax

isShiftKeyDown ( ) Logical

Description

isShiftKeyDown returns True if Shift was held down at the time a KeyEvent occurred; otherwise, it returns False.


Example for KeyEvent::isShiftKeyDown
isShiftKeyDown Example

See the example for setShiftKeyDown.


See Also for KeyEvent::isShiftKeyDown
See Also

setShiftKeyDown

isAltKeyDown

isControlKeyDown


KeyEvent::setAltKeyDown
setAltKeyDown

See Also	Example	KeyEvent Type

Method

Simulates pressing and holding Alt during a KeyEvent.

Syntax

setAltKeyDown ( const yesNo Logical )

Description

setAltKeyDown adds information about the state of Alt to a KeyEvent. You must specify Yes or No. Yes means Alt was pressed during a KeyEvent; No means Alt was not pressed.


Example for KeyEvent::setAltKeyDown
setAltKeyDown Example

The following example assumes a form has a box named boxOne. When the user presses Alt + C, the keyPhysical method for the form changes the color of boxOne. This code is attached to a form's keyPhysical method:

; thisForm::keyPhysical
method keyPhysical(var eventInfo KeyEvent)
if eventInfo.isPreFilter()
  then
    ; code here executes for each object in form
    if eventInfo.isAltKeyDown() and    ; if user presses Alt+C
       eventInfo.vChar() = "C" then
       disableDefault                  ; block normal processing
       ; alternate a boxOne's color between red and blue
       boxOne.color = iif(boxOne.color = Red, Blue, Red)
    endif
  else
    ; code here executes just for form itself
endif
endMethod

To simulate pressing Alt+C, the code for this method creates a KeyEvent variable, then sets its virtual key character to "C" and sets the Alt key down.

; sendAltC::pushButton
method pushButton(var eventInfo Event)
var
  ke KeyEvent
endVar
ke.setVChar("C")             ; set the character to C
ke.setAltKeyDown(Yes)        ; set the Alt key state to pressed
thisForm.keyPhysical(ke)     ; send off the event
endMethod


See Also for KeyEvent::setAltKeyDown
See Also

isAltKeyDown

setControlKeyDown

setShiftKeyDown


KeyEvent::setChar
setChar

See Also	Example	KeyEvent Type

Method

Specifies an ANSI character for a KeyEvent.

Syntax

setChar ( const char String )

Description

setChar sets a KeyEvent to have an ANSI character based on the value of char, where char evaluates to single character string (example, a).


Example for KeyEvent::setChar
setChar Example

This code is attached to a field's built-in keyChar method. The keyChar method for fieldOne converts each space to an underscore as the user types characters into the field.

; thisField::keyChar
method keyChar(var eventInfo KeyEvent)
  if eventInfo.Char() = " " then  ; when user enters a space
    eventInfo.setChar("_")        ; convert it to underscore
  endif                           ; process other keystokes normally
endMethod


See Also for KeyEvent::setChar
See Also

setVChar

setVCharCode

String::toOEM

String::chr

String::chrOEM

String::keyNameToChr

String::toANSI


KeyEvent::setControlKeyDown
setControlKeyDown

See Also	Example	KeyEvent Type

Method

Simulates pressing and holding Ctrl during a KeyEvent.

Syntax

setControlKeyDown ( const yesNo Logical )

Description

setControlKeyDown adds information about the state of Ctrl to eventInfo for a KeyEvent. You must specify Yes or No. Yes means Ctrl was pressed during a KeyEvent; No means Ctrl was not pressed.


Example for KeyEvent::setControlKeyDown
setControlKeyDown Example

The following example assumes a form has a box named boxOne. When the user presses Ctrl + C, the keyPhysical method for the form changes the color of boxOne. This code is attached to a form's keyPhysical method:

; thisForm::keyPhysical
method keyPhysical(var eventInfo KeyEvent)
if eventInfo.isPreFilter() then
  ; code here executes for each object in form
  if eventInfo.isControlKeyDown() and   ; if user presses Ctrl+C
    eventInfo.vChar() = "C" then
    disableDefault                      ; block normal processing
    ; alternate color of boxOne between red and blue
    boxOne.color = iif(boxOne.color = Red, Blue, Red)
  endif
else
  ; code here executes just for form itself
endif
endMethod

To simulate Ctrl + C, the code for this method creates a KeyEvent variable, then sets its virtual key character to "C" and sets the Ctrl key down.

; sendCtrlC::pushButton
method pushButton(var eventInfo Event)
var
  ke KeyEvent
endVar
ke.setChar("C")              ; set the character to C
ke.setControlKeyDown(Yes)    ; set the Ctrl key state to pressed
thisForm.keyPhysical(ke)     ; send off the event
endMethod


See Also for KeyEvent::setControlKeyDown
See Also

isControlKeyDown

setAltKeyDown

setShiftKeyDown


KeyEvent::setShiftKeyDown
setShiftKeyDown

See Also	Example	KeyEvent Type

Method

Simulates pressing and holding Shift during a KeyEvent.

Syntax

setShiftKeyDown ( const yesNo Logical )

Description

setShiftDown adds information about the state of Shift to a KeyEvent. You must specify Yes or No. Yes means Shift was pressed and held; No means Shift wasn't pressed.


Example for KeyEvent::setShiftKeyDown
setShiftKeyDown Example

The following example assumes a form has a box named boxOne. When the user presses Shift+C, the keyPhysical method for the form changes the color of boxOne. This code is attached to a form's keyPhysical method:

; thisForm::keyPhysical
method keyPhysical(var eventInfo KeyEvent)
if eventInfo.isPreFilter() then
  ; code here executes for each object in form
  if eventInfo.isShiftKeyDown() and    ; if user presses Ctrl+C
    eventInfo.vChar() = "C" then
    disableDefault                     ; block normal processing
    ; alternate color of boxOne between red and blue
    boxOne.color = iif(boxOne.color = Red, Blue, Red)
  endif
else
  ; code here executes just for form itself
endif
endMethod

To simulate pressing pressing Shift + C, the code for this method creates a KeyEvent variable, then sets its virtual key character to "C" and sets the Shift key down.

; sendShiftC::pushButton
method pushButton(var eventInfo Event)
var
  ke KeyEvent
endVar
ke.setVChar("C")           ; set the character to C
ke.setShiftKeyDown(Yes)    ; set the Shift key state to pressed
thisForm.keyPhysical(ke)   ; send off the event
endMethod


See Also for KeyEvent::setShiftKeyDown
See Also

isShiftKeyDown

setAltKeyDown

setControlKeyDown


KeyEvent::setVChar
setVChar

See Also	Example	KeyEvent Type

Method

Specifies a Windows virtual character for a KeyEvent.

Syntax

setVChar ( const char String )

Description

setVChar specifies in char a one-character string for a KeyEvent. Use setVChar with an uppercase letter or a Keyboard constant to specify a code string for a single letter, but use the constant as a quoted string instead of an integer value. For example, the following statement specifies a tab character.

eventInfo.setVChar("VK_TAB")

The virtual character code string for any letter is the uppercase letter. For instance, the virtual character code string for the letter k is "K" (uppercase only).


Example for KeyEvent::setVChar
setVChar Example

See the example for setAltKeyDown.


See Also for KeyEvent::setVChar
See Also

setChar

setVCharCode

String::chr

String::chrOEM

String::chrToKeyName


KeyEvent::setVCharCode
setVCharCode

See Also	Example	KeyEvent Type

Method

Specifies a Windows virtual character for a KeyEvent.

Syntax

setVCharCode ( const VK_Constant SmallInt )

Description

setVCharCode uses a Keyboard constant in VK_Constant to specify a Windows virtual character for a KeyEvent.


Example for KeyEvent::setVCharCode
setVCharCode Example

This code is attached to a form's built-in keyPhysical method. When the user types ?, this code invokes the Paradox Help system.

; thisForm::keyPhysical
method keyPhysical(var eventInfo KeyEvent)
if eventInfo.isPreFilter()
  then
    ; code here executes for each object in form
    if eventInfo.char() = "?" then   ; if user types ?
      eventInfo.setVCharCode(VK_HELP)  ; invoke built-in help system
    endif
  else
    ; code here executes just for form itself
endif
endMethod


See Also for KeyEvent::setVCharCode
See Also

setChar

setVChar

String::keyNameToVKCode


KeyEvent::vChar
vChar

See Also	Example	KeyEvent Type

Method

Returns a Windows virtual character.

Syntax

vChar ( ) String

Description

vChar returns a Windows virtual key name as a string. Use Keyboard constants to find out which Windows virtual character was returned, but use the constants as quoted strings instead of integer values. For example, the following statements are equivalent (they both beep when you press Return). The first statement uses vCharCode and the constant VK_RETURN to test for an integer value, the second statement uses vChar and "VK_RETURN" to test for a string value.

if vCharCode = VK_RETURN then beep() endIf

if vChar = "VK_RETURN" then beep() endIf


Example for KeyEvent::vChar
vChar Example

In the following example, assume a form contains a box named boxOne. When the user presses a movement key, this code moves boxOne in increments of 100 twips. If Shift is held down in combination with a movement key, boxOne moves 1000 twips. Since vChar returns the virtual key name as a string, this code must compare key names against string values such as "VK_LEFT". This code is attached to a form's built-in keyPhysical method.

; thisForm::keyPhysical
method keyPhysical(var eventInfo KeyEvent)
var
  kp      String        ; key name of the keystroke
  posPt   Point         ; x and y positon of the box object
  boxStep SmallInt      ; number of Points to move the box
  x, y    LongInt       ; coordinates of the box object
endVar

if eventInfo.isPreFilter()
  then
    ;code here executes for each object in form
    disableDefault                   ; don't execute built-in code

    kp = eventInfo.vChar()           ; load kp with vChar string
    posPt = boxOne.position          ; posPt stores current postion of box
    x = posPt.x()                    ; x stores the horizontal position
    y = posPt.y()                    ; y stores the vertical postion

    ; if the Shift key was held down when the movement key was pressed,
    ; assign a large number to boxStep, else, a small number
    boxStep = iif(eventInfo.isShiftKeyDown(), 1000, 100)

    ; this block assigns x or y variables according to
    ; the key combination that the user presses
    switch
      case kp = "VK_LEFT"  : x = x - boxStep
      case kp = "VK_RIGHT" : x = x + boxStep
      case kp = "VK_UP"    : y = y - boxStep
      case kp = "VK_DOWN"  : y = y + boxStep
      otherwise            : enableDefault    ; let built-in code execute
    endswitch

    ; now move the box to location specified by x and y variables,
    ; and display the virtual key name associated with the keystoke
    boxOne.position = Point(x,y)
    message("Value of vChar() was " + kp)

  else
    ;code here executes just for form itself
endif
endMethod


See Also for KeyEvent::vChar
See Also

char

String::ansiCode

String::chrToKeyName

String::toANSI

String::toOEM


KeyEvent::vCharCode
vCharCode

See Also	Example	KeyEvent Type

Method

Returns the integer value of a Windows virtual character.

Syntax

vCharCode ( ) SmallInt

Description

vCharCode returns the integer value of a Windows virtual character. Use Keyboard constants to find out which Windows virtual character the  integer value represents.


Example for KeyEvent::vCharCode
vCharCode Example

For the following example, assume a form has a field named thisField. When the user types a value in thisField and presses Return, the code creates an executes a query based on the value of the field. This code is attached to the built-in keyPhysical method for thisField.

; thisField::keyPhysical
method keyPhysical(var eventInfo KeyEvent)
var
  cName String      ; used as tilde var
  qVar Query          ; the query statement
  tv TableView      ; tableView handle
endVar

if eventInfo.vCharCode() = VK_RETURN then  ; if user presses Enter
  cName = self.value                           ; store value of field
  qVar = Query

         c:\pdoxwin\sample\biolife.db | Common Name  | Species Name   |
                                      | check ~cName | check          |

       endQuery

  ; run query, write contents to myFish table
  qVar.executeQBE("myFish.db")

  tv.open("myFish")              ; view myFish view
endif
endMethod


See Also for KeyEvent::vCharCode
See Also

vChar


Library Type

Changes

A library is a Paradox object that stores custom methods, custom procedures, variables, constants, and user-defined data types. Libraries are useful for storing and maintaining frequently-used routines, and for sharing custom methods and variables among several forms.

In many ways, working with a library is like working with a form. For example, to create a form, choose File | New | Form; to create a library, choose File | New | Library. Like a form, a library has built-in methods. You add code to a library just as you do to a form, using the Methods dialog box and the ObjectPAL Editor. (However, you can't place design objects in the library.) As with a form, you can open Editor windows to declare custom methods, procedures, variables, constants, data types, and external routines. You can also do these things in ObjectPAL code using methods added in version 5.0.

The Library type includes several derived methods from the Form type.

Methods for the Library Type

Form		Library
deliver		close
load		create
methodDelete		enumSource
methodGet		enumSourceToFile
methodSet		execMethod
save		open


Changes to Library type methods

The following table lists new methods and methods that were changed for version 5.0. The Library type includes several methods defined for the Form type.

New	Changed

create	(None)

deliver

load

methodDelete

methodGet

methodSet

save


Library::close
close

See Also	Example	Library Type

Method

Closes a library.

Syntax

close ( )

Description

close closes a library, and ends the association between a Library variable and the underlying library file.


Example for Library::close
close Example

The following example declares a Library variable named lib, and calls open to associate lib with the library TOOLS.LSL. The example executes a method from that library, then calls close to end the association between the variable and the library. Another call to open associates lib with the library KIT.LSL, making methods in that library available.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  lib Library          ; declare a Library variable
endVar

lib.open("TOOLS.LSL")  ; associate lib with the library TOOLS.LSL
lib.doThis()           ; execute a method from the library
lib.close()            ; end the association between lib and the library

lib.open("KIT.LSL")    ; associate lib with another library
lib.doThat()           ; execute a method from the library

endMethod


See Also for Library::close
See Also

open


Library::create
create	5.0

See Also	Example	Library Type

Method

Creates a library.

Syntax

create ( ) Logical

Description

create creates a blank library and leaves it in a design window. You can use methodSet (derived from the Form type) to alter or add methods in the new library.


Example for Library::create
create Example

The following example uses create to create a new library, adds a custom method to it with methodSet, saves the library with save, then closes the library.

; btnCreateLibrary :: pushButton

method pushButton(var eventInfo Event)

var

lib	Library

endVar

;Create library.

lib.create()

lib.methodSet("cmMessage", "method cmMessage() msgInfo(\"From new library\", \"Hello World!\") endMethod")

lib.save("library")

lib.close()

endmethod


See Also for Library::create
See Also

open


Library::enumSource
enumSource

See Also	Example	Library Type

Method

Writes the code from a library to a Paradox table.

Syntax

enumSource ( const tableName String [ , const recurse Logical ] )

Description

enumSource lists, in the Paradox table specified in tableName, all the custom code (methods, procedures, variables, etc.) stored in a library. If the table does not exist, Paradox creates it in the current working directory; if the table does exist, information is appended to it.

The structure of the table is:

Field name	Type	Size

Object	A	128

MethodName	A	128

Source	M	 64

The Object field stores the UIObject name of the library, the MethodName field stores the name of the method, procedure, or window (Var, Const, Proc, Type, or Uses), and the Source field stores the corresponding source code.

This method also applies to the Form type. For forms, the optional argument recurse specifies whether to include overridden methods for all objects contained by the form. Because a Library does not contain objects, the recurse argument is not meaningful in the context of a Library.

You must call open to open the library before calling this method.


Example for Library::enumSource
enumSource Example

The following example declares a Library variable named lib, and calls open to associate lib with the library TOOLS.LSL. Then the example calls enumSource to list the code from the library to a Paradox table named LIBSRC.DB:

; srcToTable::pushButton
method pushButton(var eventInfo Event)
var
  lib Library
endVar

if lib.open("TOOLS.LSL", PrivateToForm) then

  ; write contents of TOOLS.LSL to LIBSRC.DB--
  ; goes to :WORK: by default
  lib.enumSource("LIBSRC.DB")

else
  msgStop("TOOLS.LSL", "Could not open library.")
endIf

endMethod


See Also for Library::enumSource
See Also

enumSourceToFile

open


Library::enumSourceToFile
enumSourceToFile

See Also	Example	Library Type

Method

Writes the code from a library to a text file.

Syntax

enumSourceToFile ( const fileName String [ , const recurse Logical ] )

Description

enumSourceToFile lists all the custom code (methods, procedures, variables, and so on) stored in a library to the text file specified in fileName. If the file does not exist, Paradox creates it in the working directory (:WORK:); if the file does exist, Paradox overwrites it without asking for confirmation.

In the text file, comment lines are used to identify and mark the beginning and end of each method, procedure, and so on. The following example shows the code for a library's built-in open method:

;|BeginMethod|#Library1|open|

method open(var eventInfo Event)
var

myMsgTCursor	TCursor

endVar

if not myMsgCursor.open("Msghelp.db") then
msgStop("Error", "Couldn't open MsgHelp.db")
fail()
endIf
endMethod

;|EndMethod|#Library1|open|

This method also applies to the Form type. For forms, the optional argument recurse specifies whether to include overridden methods for all objects contained by the form. Because a Library does not contain objects, the recurse argument is not meaningful in the context of a Library.

You must call open to open the library before calling this method.


Example for Library::enumSourceToFile
enumSourceToFile Example

The following example declares a Library variable named lib, and calls open to associate lib with the library TOOLS.LSL. Then the example calls enumSourceToFile to list the code from the library to a text file named LIBSRC.TXT.

; getSource::pushButton
method pushButton(var eventInfo Event)
var
  lib Library
endVar

if lib.open("TOOLS.LSL", PrivateToForm) then

  ; write contents of TOOLS.LSL to LIBSRC.TXT--
  ; goes to :PRIV: by default
  lib.enumSourceToFile("LIBSRC.TXT")

else
  msgStop("TOOLS.LSL", "Could not open library.")
endIf

endMethod


See Also for Library::enumSourceToFile
See Also

enumSource

open


Library::execMethod
execMethod

See Also	Example	Library Type

Method

Calls a custom method that takes no arguments.

Syntax

execMethod ( const methodName String )

Description

execMethod calls the custom method indicated by the string methodName. The method named in methodName takes no arguments. execMethod allows you to call a library method based on the contents of a variable, which means the compiler does not know the method to call until run time.


Example for Library::execMethod
execMethod Example

The following example creates an array of three items, where each item is the name of a custom method in a library. The code opens the library and calls execMethod for each item in the array:

var
   lib Library
   libMethods Array[3] String
   i SmallInt
endVar

libMethods[1] = "doThis"
libMethods[2] = "doThat"
libMethods[3] = "doOther"

if lib.open("tools.lsl", GlobalToDeskTop) then
   for i from 1 to libMethods.size()
      lib.execMethod(libMethods[i])
   endFor
else
   msgStop("TOOLS.LSL", "Could not open library.")
endIf


See Also for Library::execMethod
See Also

open


Library::open
open

See Also	Example	Library Type

Method

Associates a Library variable with a library, and makes the library code available.

Syntax

open ( const libraryName String [ , const libScope SmallInt ] ) Logical

Description

open associates a Library variable with a library, and makes the library code available to one or more forms, depending on the value of libScope. ObjectPAL defines LibraryScope constants for specifying the scope of a library: PrivateToForm and GlobalToDesktop:

PrivateToForm: only the form that opened the library has access to its code.

GlobalToDesktop: every form in the Desktop (Paradox session) has access to the library.

To open a library and make it available to every form in the current session of Paradox, use the constant GlobalToDesktop. For example, the following statement opens the library MYLIB.LSL:

lib.open("myLib.lsl", GlobalToDesktop)

For two or more forms to share the same library, each form must open the library global to the Desktop, and each form must have a Uses window that declares which library routines to use. This level of scope is useful in multiform applications, because it allows several forms access to the same custom methods and allows the forms to share the same global variables.

A library can be opened private to the form in one form and global to the Desktop in another form. Paradox will load a new instance of the library, if necessary.

By default, a library opens global to the Desktop. The following statements are equivalent:

lib.open("myLib.lsl") ; these statements are equivalent
lib.open("myLib.lsl", GlobalToDesktop)


Example for Library::open
open Example

The following example shows how two forms can open a library global to the Desktop and share the library. In the following code, attached to a form's built-in open method, libOne is opened private to the form. libOne cannot be shared. libTwo is opened global to the Desktop and can be shared.

; formOne::open
method open(var eventInfo Event)
var
  libOne, libTwo Library
endVar

if eventInfo.isPreFilter()
   then
   ; code here executes for each object in the form
else
   ; code here executes just for the form itself

   libOne.open("TOOLS.LSL", PrivateToForm)   ; no sharing with other forms
   libTwo.open("KIT.LSL", GlobalToDesktop)   ; can be shared with other forms

endIf

endMethod

The following code, attached to another form's built-in open method, calls open to open the library KIT.LSL global to the Desktop. This form and the previous form can now share KIT.LSL.

; formTwo::open
method open(var eventInfo Event)
var
   kitLib Library
endVar

if eventInfo.isPreFilter()
   then
   ; code here executes for each object in the form
else
   ; code here executes just for the form itself
   kitLib.open("KIT.LSL", GlobalToDesktop) ; can be shared with other forms
endIf

endMethod


See Also for Library::open
See Also

close


Logical Type

Logical variables have two possible values: True or False. You can use the ObjectPAL constants Yes or On in place of True, and use No or Off in place of False.

A Logical variable occupies 1 byte of storage. In order of precedence, the logical operators are NOT, AND, and OR.

Logical variables often answer questions about other objects and operations, for example,

Did that statement execute successfully?

Is that table empty?

Is that form displayed as an icon?

The Logical type includes several derived methods from the AnyType type.

Methods for the Logical Type

AnyType		Logical
blank		logical
dataType
isAssigned
isBlank
isFixedType
view


Logical::logical
logical

See Also	Example	Logical Type

Beginner

Procedure

Casts a value as type Logical.

Syntax

logical ( const value AnyType ) Logical

Description

logical casts (converts) the data type of value to Logical. If value is a numeric data type, non-zero values evaluate to True and zero evaluates to False. If value is a string, it must evaluate to "True" or "False". (However, you can use True or False without the quotation marks.) ObjectPAL also provides Logical constants: On and Yes for True and Off and No for False.


Example for logical::logical
logical Example

In the following example, the pushButton method of a button named showLogical creates a string, casts it to a Logical type, then displays the result:

; showLogical::pushButton
method pushButton(var eventInfo Event)
var
  myVal     String
  theResult Logical
endVar
myVal = "True"             ; set a String of True
theResult = logical(myVal) ; and cast it to a Logical type
theResult.view()           ; show the result--Title displays Logical
endMethod


See Also for logical::logical
See Also

Logical


LongInt Type

LongInt values are long integers; that is, they can be represented by a long series of digits. A LongInt variable occupies 4 bytes. ObjectPAL converts LongInt values to range from -2,147,483,648 to 2,147,483,647. An attempt to assign a value outside of this range to a LongInt variable causes an error. For example,

var

   x, y, z LongInt

endVar

x = 2147483647 ; The upper limit value for a LongInt variable.

y = 1

z = x + y      ; This statement causes an error.

When ObjectPAL performs an operation on LongInt values, it expects the result to be a LongInt, too. That's why the addition operation in the previous example causes an error: the result is too large to be a LongInt. To work with a boundary value (in either the positive or negative direction), convert it to a type that can accommodate it. In the following example, ObjectPAL converts one LongInt to a Number before doing the addition, and the statement succeeds. This example also assigns the result to a Number variable (which can handle the large value), instead of assigning it to a LongInt variable (which could not).

var

   x, y LongInt

   z    Number ; Declare z as a Number so it can hold the result.

endVar

x = 2147483647 ; The upper limit value for a LongInt variable.

y = 1

z = Number(x) + y ; This statement succeeds.

Note:	Run-time library methods defined for the Number type also work with LongInt variables. The syntax is the same, and the returned value is a number.

The LongInt type includes several derived methods from the Number and AnyType types.

Methods for the LongInt Type

AnyType		Number		LongInt
blank		abs		bitAND
dataType		acos		bitIsSet
isAssigned		asin		bitOR
isBlank		atan		bitXOR
isFixedType		atan2		LongInt
view		ceil
		cos
		cosh
		exp
		floor
		fraction
		fv
		ln
		log
		max
		min
		mod
		number
		numVal
		pmt
		pow
		pow10
		pv
		rand
		round
		sin
		sinh
		sqrt
		tan
		tanh
		truncate


LongInt::bitAND
bitAND

See Also	Example	LongInt Type

Method

Performs a bitwise AND operation on two values.

Syntax

bitAND ( const value LongInt ) LongInt

Description

bitAND returns the result of a bitwise AND operation on value. bitAND operates on the binary representations of two integers, comparing them one bit at a time. The truth table for bitAND is:

a	b	a bitAND b

0	0	0

1	0	0

0	1	0

1	1	1


Example for LongInt::bitAND
bitAND Example

In the following example, the pushButton method for a button named andTwoNums takes two integers and performs a bitwise AND calculation on them. The result of the calculation is displayed in a dialog box.

; andTwoNums::pushButton
method pushButton(var eventInfo Event)
var
  a, b LongInt
endVar
a = 33333   ; binary 00000000 00000000 10000010 00110101
b = -77777  ; binary 11111111 11111110 11010000 00101111
a.bitAND(b) ; binary 00000000 00000000 10000000 00100101
msgInfo("The result of a bitAND b is:", a.bitAND(b))
; displays 32805
endMethod


See Also for LongInt::bitAND
See Also

bitOR

bitXOR


LongInt::bitIsSet
bitIsSet

See Also	Example1	Example2	LongInt Type

Method

Reports whether a bit is 1 or 0.

Syntax

bitIsSet ( const value LongInt ) Logical

Description

bitIsSet examines the binary respresentation of an integer, reporting whether the value bit is 0 or 1. bitlsSet returns True if the bit specified is 1, and False if the bit is 0.

value is a number specified by 2n, where n is an integer between 0 and 30. The exponent n corresponds to one less than the position of the bit to test, counting from the right. For example, to specify the third bit from the right, use 4 (2(3-1), which is 22).


Example 1 for LongInt::bitIsSet
bitIsSet Example 1

In the following example, the pushButton method for a button named isABitSet, examines the values in two unbound field objects: whichBit and whatNum. whichBit contains the bit position (counting from the right) of the bit to test. whatNum contains the long integer to test.

The pushButton method uses whichBit to calculate the value of the position, then assigns the result to bitNum. The method then checks Num to see if the bitNum bit is set, and displays the Logical result with a msgInfo dialog box.

; isABitSet::pushButton
method pushButton(var eventInfo Event)
var
  bitNum,
  Num      LongInt
endVar
; get the bit position number from the whichBit
; field and convert to multiple of 2
bitNum = LongInt(pow(2, whichBit - 1))
; get the number to test from the whatNum field
Num = whatNum
; is the bit for value bitNum 1 in Num?
msgInfo("Is Bit Set?", Num.bitIsSet(bitNum))
endMethod


Example 2 for LongInt::bitIsSet
bitIsSet Example 2

The next example illustrates how you can use bitIsSet to display a long integer as a binary number. The pushButton method for showBinary constructs a string of zeros and ones by testing each bit of a four-byte long integer. For readability, a blank is added to the string every 8 digits.

; showBinary::pushButton
method pushButton(var eventInfo Event)
var
  binString  String    ; to construct the binary string
  Num        LongInt
  i          SmallInt  ; for loop index
endVar
if NOT whatNum.isBlank() then
  Num = whatNum                ; get the number test from whatNum
  binString = ""               ; initialize the string
  for i from 0 to 30
    if Num.bitIsSet(LongInt(pow(2, i))) then
      binString = "1" + binString    ; add a 1 to the front of the string
    else
      binString = "0" + binString    ; add a 0 to the front of the string
    endif
    if i = 7 OR i = 15 OR i = 23 then
      binString = " " + binString    ; add a space every 8 digits
    endif
  endfor
  if Num < 0 then
    binString = "1" + binString      ; set the sign bit
  else
    binString = "0" + binString
  endif
  ; show the number
  message("The binary equivalent is ", binString)
endif
endMethod


See Also for LongInt::bitIsSet
See Also

bitAND

bitOR

bitXOR


LongInt::bitOR
bitOR

See Also	Example	LongInt Type

Method

Performs a bitwise OR operation on two values.

Syntax

bitOR ( const value LongInt ) LongInt

Description

bitOR returns the result of a bitwise OR operation on value. bitOR operates on the binary representations of two integers, comparing them one bit at a time. Here is the truth table for bitOR:

a	b	a bitOR b

0	0	0

1	0	1

0	1	1

1	1	1


Example for LongInt::bitOR
bitOR Example

For the following example, the pushButton method for a button named orTwoNums takes two integers and performs a bitwise OR calculation on them. The result of the calculation is displayed in a dialog box.

; orTwoNums::pushButton
method pushButton(var eventInfo Event)
var
  a, b LongInt
endVar
a = 33333  ; binary 00000000 00000000 10000010 00110101
b = -77777 ; binary 11111111 11111110 11010000 00101111
a.bitOR(b) ; binary 11111111 11111110 11010010 00111111
msgInfo("33333 OR -77777", a.bitOR(b)) ; displays -77249
endMethod


See Also for LongInt::bitOR
See Also

bitAND

bitXOR


LongInt::bitXOR
bitXOR

See Also	Example	LongInt Type

Method

Performs a bitwise XOR operation on two values.

Syntax

bitXOR ( const value LongInt ) LongInt

Description

bitXOR performs a bitwise XOR (exclusive OR) operation on value. bitXOR operates on the binary respresentations of two integers, comparing them one bit at a time. Here is the truth table for bitXOR:

a	b	a bitXOR(b)

0	0	0

1	0	1

0	1	1

1	1	0


Example for LongInt::bitXOR
bitXOR Example

In the following example, the pushButton method for a button named xorTwoNums takes two integers and performs a bitwise XOR calculation on them. The result of the calculation is displayed in a dialog box.

; xorTwoNums::pushButton
method pushButton(var eventInfo Event)
var
  a, b LongInt
endVar
a = 33333   ; binary 00000000 00000000 10000010 00110101
b = -77777  ; binary 11111111 11111110 11010000 00101111
a.bitXOR(b) ; binary 11111111 11111110 01010010 00011010
msgInfo("33333 XOR -77777", a.bitXOR(b)) ; displays -110054
endMethod


See Also for LongInt::bitXOR
See Also

bitAND

bitOR


LongInt::LongInt
LongInt

See Also	Example	LongInt Type

Beginner

Procedure

Casts a value as a LongInt.

Syntax

LongInt ( const value AnyType ) LongInt

Description

LongInt casts (converts) the data type of value to a long integer. If you convert from a more precise type (for example, Number), precision may be lost.


Example for LongInt::LongInt
LongInt Example

The following example assigns a number to x, then casts x to LongInt and assigns the result to l. Notice that the decimal precision of x is lost when it is cast to a LongInt and assigned to l.

; convertToInt::pushButton
method pushButton(var eventInfo Event)
var
  x Number
  l LongInt
endVar
x = 12.34             ; give x a value
x.view()              ; view x, title of dialog will be "Number"
l = LongInt(x)        ; cast x as a LongInt and assign to l
l.view()              ; show l, note that decimal places are lost
                      ; displays 12
endMethod


See Also for LongInt::LongInt
See Also

AnyType::view


Memo Type

Memos contain text and formatting data---up to 512MB in Paradox tables. Using Memo type methods readFromFile and writeToFile, you can transfer memos between forms (and reports), tables, and disk files.

You can also use the (=) operator to assign the value of a memo field to a Memo variable or a String variable.

Note:	There are no arithmetic or comparison operators for Memo variables.

If you assign a memo field to a String variable, you get only the memo text without any formatting. If you assign a memo field to a Memo variable, you get the text and the formatting.

The Memo type includes several derived methods from the AnyType type.

Methods for the Memo Type

AnyType		Memo
blank		readFromFile
dataType		memo
isAssigned		writeToFile
isBlank
isFixedType


Memo::memo
memo

See Also	Example	Memo Type

Procedure

Casts a value as a Memo.

Syntax

memo ( const value AnyType [ , const value AnyType ] * ) Memo

Description

memo casts (converts) the expression value to a Memo. If you specify multiple arguments, this method will cast all of them to Memos and concatentate them to one Memo.


Example for Memo::memo
memo Example

The following example assumes that DOCFILES.DB exists and has an alpha field named Memo Name, a Date field named Memo Date, and a formatted memo field named Memo Data. For this example, a form has unbound fields named stringObject and memoObject, and a button named getMemoData. The code attached to getMemoData's pushButton method defines a TCursor to locate a particluar record in DocFiles. Then, the code casts and concatenates the contents of the three DocFiles fields to a String value, then to a Memo value. The value cast as a String is displayed in the stringObject object and the value cast as a Memo is displayed in the memoObject object. Note that when cast as a String, formatting information is not displayed in stringObject. When cast as a Memo, memoObject displays all formatting information.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
endVar

if tc.open("DocFiles.db") then
  if tc.locate("Memo Name", "Project Notes") then

    ; this line casts data from three DOCFILES.DB fields as a String-
    ; because this is cast as a String, the data that appears in stringObject
    ; displays WITHOUT formatting
    stringObject.value = string(tc."Memo Name", "\t",
                                tc."Memo Date", "\n", tc."Memo Data")

    ; this line casts data from three DOCFILES.DB fields as a memo-
    ; because this is cast as a MEMO, the data that appears in memoObject
    ; displays with FORMATTED text
    memoObject.value = memo(tc."Memo Name", "\t",
                            tc."Memo Date", "\n", tc."Memo Data")

  else
    msgStop("Error", "Can't find Project Notes.")
  endif
else
  msgStop("Error", "Can't open DocFiles table.")
endif

endMethod


See Also for Memo::memo
See Also

readFromFile

writeToFile


Memo::readFromFile
readFromFile

See Also	Example	Memo Type

Method

Reads a memo from a file.

Syntax

readFromFile ( const fileName String ) Logical

Description

readFromFile reads a memo from a disk file specified in fileName. This method reads text only. It does not read the formatting of formatted memos.


Example for Memo::readFromFile
readFromFile Example

The following example reads the contents of a text file to a memo field in a table. Assume that a table named PJNotes exists in the current directory and has the following fields: ProjDate, a Date field, and ProjNotes, a Memo field. The pushButton method for a button named getFile opens, edits, and inserts a new record in the PJNotes table, then fills the ProjDate field with the current date, and fills the ProjNotes field with text from a file named NOTES.TXT.

; getFile::pushButton
method pushButton(var eventInfo Event)
var
  MemoFile Memo
  pTC      TCursor
endVar

if pTC.open("pjNotes.db") then    ; open TCursor for PJNOTES.DB
  if MemoFile.readFromFile("notes.txt") then
    ; if memo file read was successful
    pTC.edit()                    ; edit project notes table
    pTC.insertRecord()            ; insert a new blank record
    pTC.ProjDate = today()        ; fill the ProjDate field
    pTC.ProjNotes = MemoFile      ; write memo to ProjNotes field
    pTC.endEdit()                 ; end Edit mode
  endif
  pTC.close()                     ; close the TCursor
endIf
endMethod


See Also for Memo::readFromFile
See Also

writeToFile


Memo::writeToFile
writeToFile

See Also	Example	Memo Type

Method

Writes a memo to a file.

Syntax

writeToFile ( const fileName String ) Logical

Description

writeToFile writes a memo to a disk file specified in fileName. This method writes text only. It does not write the formatting of formatted memos.


Example for Memo::writeToFile
writeToFile Example

The following example writes the contents of a memo to a text file. Assume that a table named PJNotes exists in the current directory and has the following fields: ProjDate, a Date field, and ProjNotes, a Memo field. The pushButton method for a button named writeFile opens the PJNotes table, locates a record with the current date, then writes the contents of the ProjNotes field for that record to a file named NOTETDAY.TXT.

; getFile::pushButton
method pushButton(var eventInfo Event)
var
  MemoFile Memo
  pTC      TCursor
endVar

if pTC.open("pjNotes.db") then             ; open project notes table
  if pTC.locate("ProjDate", today()) then
    if NOT (pTC.ProjNotes = blank()) then  ; check if memo is blank
      MemoFile = pTC.ProjNotes             ; if not, write to MemoFile var
      MemoFile.writeToFile("notetday.txt") ; write MemoFile to text file
    endif
  endif
  pTC.close()                              ; close the TCursor
endIf
endMethod


See Also for Memo::writeToFile
See Also

readFromFile


Menu Type

A Menu object is a list of items that appears in the application menu bar. When the user chooses an item from a menu, the text of that item is returned. Menus you build in ObjectPAL completely replace Paradox's built-in menus (but you can get them back using removeMenu).

By default, menus do not persist across forms; each form has its own menu system associated with it. If you create a menu for a form, the menu appears only when that form is active. If you then open a second form, the second form uses the built-in menus, not the menu you created for the first form. If you create a custom menu for each form, you can simulate context-sensitive menus in an application.

If you want two (or more) forms to display the same custom menu, set each form's StandardMenu property to Off. This instructs Paradox to retain the current menu when the user moves from one form to another. You can use the StandardMenu property to construct a single menu system for an entire application.

Note:	A typical application uses both Menu objects and PopUpMenu objects. See the PopUpMenu type for more information.

Methods for the Menu Type

Menu

addArray

addBreak

addPopUp

addStaticText

addText

contains

count

empty

getMenuChoiceAttribute

getMenuChoiceAttributeById

hasMenuChoiceAttribute

remove

removeMenu

setMenuChoiceAttribute

setMenuChoiceAttributeById

show


Menu::addArray
addArray

See Also	Example	Menu Type

Method

Appends elements of an array to a menu.

Syntax

addArray ( const items Array[ ] String )

Description

addArray appends items from an array to a menu. The array items are displayed from left to right across the menu bar. To create a drop-down menu or a cascading menu, use addPopUp.


Example for Menu::addArray
addArray Example

The following example constructs and displays an application menu bar when a form opens. This could be the application's main menu. Throughout the application, the menu displayed here can be changed by methods for other objects.

; thisForm::open
method open(var eventInfo Event)
var
  mMenu            Menu     ; main menu
  mmItems Array[3] String   ; main menu items
endVar

if eventInfo.isPreFilter()
  then
    ;code here executes for each object in form
  else
    ;code here executes just for form itself
    ;menu appears when the form first opens
    mmItems[1] = "File"        ; fill the array
    mmItems[2] = "Edit"
    mmItems[3] = "Window"
    mMenu.addArray(mmItems)    ; same as mMenu.addText(...) 3 times
    mMenu.show()               ; show the menu
endif
endMethod


See Also for Menu::addArray
See Also

addBreak

addPopUp

addStaticText

addText


Menu::addBreak
addBreak

See Also	Example	Menu Type

Method

Starts a new row in a menu.

Syntax

addBreak ( )

Description

addBreak starts a new row in a menu. addBreak lets you explicitly "wrap" large menu constructs to two or more rows.


Example for Menu::addBreak
addBreak Example

The following example constructs and displays an application menu bar when a form opens. It uses addBreak to add a second row on the menu bar.

; thisform::open
method open(var eventInfo Event)
var
  mMenu Menu
endVar
if eventInfo.isPreFilter()
  then
    ;code here executes for each object in form
  else
    ;code here executes just for form itself
    ;menu appears when the form first opens
    mMenu.addText("File")
    mMenu.addText("Edit")
    mMenu.addBreak()
    mMenu.addText("About...")  ; this appears on the second row
    mMenu.show()               ; show the menu
endif
endMethod


See Also for Menu::addBreak
See Also

addArray

addPopUp

addStaticText

addText


Menu::addPopUp
addPopUp

See Also	Example	Menu Type

Method

Adds a pop-up menu to a menu bar item.

Syntax

addPopUp ( const menuName String, const cascadedPopup PopUpMenu )

Description

addPopUp adds the heading menuName and a pop-up menu cascadedPopup to a menu. This method is useful for creating drop-down menus and cascading menus.

Note:	If you use addPopUp with a menuName of "&Window", Windows automatically appends a list of open windows to that pop-up menu.


Example for Menu::addPopUp
addPopUp Example

The code in the following example is attached to the built-in arrive method for each of two pages of a form. The arrive method for pageOne creates and displays a custom menu. The arrive method for pageTwo of the same form removes the custom menu. addPopUp is used to create a cascading pop-up menu and a drop-down menu.

Here is pageOne's arrive method:

pageOne::arrive
method arrive(var eventInfo MoveEvent)
var
  p1, p2, p3  PopUpMenu
  m1          Menu
endVar

p1.addText("Passwords...")    ; add items to p1 popup
p1.addText("Attributes...")

p2.addText("Basic...")        ; add items to p2 popup
p2.addText("Scientific...")

p1.addPopUp("Calculator", p2) ; add another item to p1 popup,
                              ; and display p2 popup when the
                              ; item is selected

p3.addText("About...")        ; add an item to 3rd popup

m1.addPopUp("Utilities", p1)  ; add item to menu bar,
                              ; and drop-down p1 when selected
m1.addPopUp("Help", p3)       ; add item to menu bar,
                              ; and drop-down p3 when selected
m1.show()                     ; show the menu bar (not PopUpMenu)

endMethod

Here is pageTwo's arrive method:

; pageTwo::arrive
method arrive(var eventInfo MoveEvent)
  removeMenu()    ; remove the custom menu---the default menu
                  ; will appear instead
endMethod


See Also for Menu::addPopUp
See Also

addArray

addBreak


Menu::addStaticText
addStaticText

See Also	Example	Menu Type

Method

Adds an unselectable text string to a menu.

Syntax

addStaticText ( const item String )

Description

addStaticText appends item to a menu as unselectable text.


Example for Menu::addStaticText
addStaticText Example

In the following example, code attached to a form's open method creates a menu bar. This example uses addStaticText to add a static menu item to the menu bar.

thisForm::open
method open(var eventInfo Event)
var
  mMenu Menu
endVar

if eventInfo.isPreFilter()
  then
    ;code here executes for each object in form
  else
    ;code here executes just for form itself
    mMenu.addStaticText("Main menu")    ; first item is static
    mMenu.addText("File")               ; add two more items
    mMenu.addText("Edit")
    mMenu.show()                        ; show the menu
endif
endMethod


See Also for Menu::addStaticText
See Also

addText


Menu::addText
addText

See Also	Example1	Example2	Menu Type

Method

Adds a selectable text string to a menu.

Syntax

1. addText ( const menuName String )

2. addText ( const menuName String, const attrib SmallInt )

3. addText ( const menuName String, const attrib SmallInt, const id SmallInt )

Description

addText adds a selectable text string to a menu.

Syntax 1 adds the item menuName to a menu. Menu items are displayed from left to right across the menu bar.

In syntax 2, you can use attrib to preset the display attribute of menuName. Use MenuChoiceAttributes constants to specify attributes.

In syntax 3, you can specify an id number (a SmallInt) to identify the menu by number instead of by menuName. Then, in the built-in menuAction method, use the id number to determine which menu the user chooses. When you specify a menu id, you should use the built-in IdRanges constant UserMenu as a base constant, then add your own number to it or create a user-defined menu constant. For example, the following line adds "File" to the myMenu menu and specifies an id number for that menu item:

myMenu.addText("File", MenuEnabled, UserMenu + 1)

You can use an ampersand in an item to designate an accelerator key. For example, the item "&File" would display as File, and the user could choose it by pressing Alt + F. If you rely on menuName to test for the user's choice, you need to include the ampersand in the comparison string. In the following example, the return value is "&File", not "File".

To right-align menu items, you can precede menuName with the string value "\008". Once you include "\008" in menuName, all subsequent menu items appear right-aligned; you don't have to use "\008" again. For example, these lines display File on the left and Help and Utilities on the right:

myMenu.addText("File")
myMenu.addText("\008Help")
myMenu.addText("Utilities")
myMenu.show()


Example 1 for Menu::addText
addText Example 1

Examples 1 and 2 demonstrate how addText syntax influences the way you test for the user's menu choice.

The following example uses the first form of addText syntax to create a simple menu. It does not use id in the addText statements. The code attached to the built-in menuAction method must evaluate the string specified in menuName to determine the user's menu choice. The code that follows is attached to the open method for pageOne.

; pageOne::open
method open(var eventInfo Event)
var
  mainMenu Menu
  utilPU PopUpMenu
endVar

 ; build a pop-up menu
utilPU.addText("&Time")
utilPU.addText("&Date")

 ; attach pop-up to the Utilities main menu item
mainMenu.addPopUp("&Utilities", utilPU)

 ; add "Help" to the menu and right-align "Help" with \008
mainMenu.addText("\008&Help")

 ; now display the menu
mainMenu.show()

endMethod

The following code is attached to the menuAction method for pageOne. This code uses the menuChoice method to obtain the string value defined by menuName.

; pageOne::menuAction
method menuAction(var eventInfo MenuEvent)
var
  choice String
endVar

choice = eventInfo.menuChoice()  ; assign string value to choice

  ; now use choice value to determine which menu was selected
switch
  case choice = "&Time"  :
    msgInfo("Current Time", time())
  case choice = "&Date"  :
    msgInfo("Today's date", today())
  case choice = "\008&Help" :
    ; open the built-in help system
    action(EditHelp)
endSwitch

endMethod


Example 2 for Menu::addText
addText Example 2

The following example demonstrates how you can use the id clause with addText to refer to menu items by number instead of by name. This code establishes user-defined constants to make it easy to remember the menu id assignments. The following code goes in the Const window for pageOne:

; pageOne::Const
Const
  ; define constants for menu id's
  ; actual values (1, 2 and 3) are arbitrary
  TimeMenu = 1
  DateMenu = 2
  HelpMenu = 3
endConst

The following code is attached to the open method for pageOne. To control the menu display attributes, this code uses built-in constants such as MenuEnabled. To identify each menu item by number, the code uses the constants defined in the Const window for pageOne (TimeMenu, DateMenu, and HelpMenu).

; pageOne::open
method open(var eventInfo Event)
var
  mainMenu Menu
  utilPU PopUpMenu
endVar

 ; build a pop-up menu and use constants (ie: TimeMenu)
 ; defined in the Const window for thisPage
utilPU.addText("&Time", MenuEnabled, TimeMenu + UserMenu)
utilPU.addText("&Date", MenuEnabled, DateMenu + UserMenu)

 ; attach pop-up to the Utilities main menu item
mainMenu.addPopUp("&Utilities", utilPU)

 ; add "Help" to the menu bar and right-align "Help" with \008
mainMenu.addText("\008&Help", MenuEnabled, HelpMenu + UserMenu)

mainMenu.show()                 ; display the menu

endMethod

The code that follows is attached to the menuAction method for pageOne. This method evaluates menu selections by id number rather than by the name specified in menuName.

; pageOne::menuAction
method menuAction(var eventInfo MenuEvent)
var
  choice SmallInt
endVar

choice = eventInfo.id()      ; assign constant value (ie: 900) to choice

  ; now use constants to determine which menu was selected
switch
  case choice = TimeMenu + UserMenu:
    msgInfo("Current Time", time())
  case choice = DateMenu + UserMenu:
    msgInfo("Today's Date", today())
  case choice = HelpMenu + UserMenu:
    ; open the built-in help system
    action(EditHelp)
endSwitch

endMethod


See Also for Menu::addText
See Also

addStaticText

addArray


Menu::contains
contains

See Also	Example	Menu Type

Method

Reports whether an item is in a menu.

Syntax

contains ( const item AnyType ) Logical

Description

contains returns True if item is in the list of items in a menu; otherwise, it returns False.


Example for Menu::contains
contains Example

The following example assumes that a multi-record object is on the form. When the user changes the value in a field contained in the multi-record object, an Undo menu item is added to the existing custom menu bar. When the user moves to another record, Undo is removed. The example uses contains to determine if Undo is present before adding or removing the item. The menu variable is defined in the form's Var window. The menu bar is created by the form's open method.

The following code goes in the form's Var window:

; thisForm::var
Var
  m1 Menu
endVar

The following code is for the form's open method:

; thisForm::open
method open(var eventInfo Event)
if eventInfo.isPreFilter()
  then
    ;code here executes for each object in form
  else
    ;code here executes just for form itself
    m1.addText("&Insert")
    m1.addText("&Delete")
    m1.show()               ; show two item menu
endif
endMethod

The following code is for the form's action method:

; thisForm::action
method action(var eventInfo ActionEvent)
if eventInfo.isPreFilter() then
  ;code here executes for each object in form

  switch
      ; when user locks a record (starts to change a field value)
    case eventInfo.id() = DataLockRecord :
if not m1.contains("&Undo") then
      ; add Undo and redisplay the menu
      m1.addText("&Undo")
      m1.show()

endIf

      ; when user posts the record (moves to another record)
    case eventInfo.id() = DataUnlockRecord :

if m1.contains("&Undo") then
      ; remove Undo redisplay the menu
      m1.remove("&Undo")
      m1.show()

endIf
  endswitch

endif
endMethod

The following code is for the form's menuAction method:

; thisForm::menuAction
method menuAction(var eventInfo MenuEvent)
var
  choice String
endVar

if eventInfo.isPreFilter() then
  ;code here executes for each object in form

  choice = eventInfo.menuChoice()

  switch
    case choice = "&Insert" :
      active.action(DataInsertRecord) ; insert new record
    case choice = "&Delete" :
      active.action(DataDeleteRecord) ; delete current record
    case choice = "&Undo"   :
      active.action(DataCancelRecord) ; restore original state
      m1.remove("&Undo")              ; remove Undo menu item
      m1.show()                       ; redisplay menu without Undo
  endswitch

endif
endMethod


See Also for Menu::contains
See Also

count


Menu::count
count

See Also	Example	Menu Type

Method

Returns the number of items in a menu.

Syntax

count ( ) SmallInt

Description

count returns the number of items in a menu, including separators, bars, and breaks.

count returns the number of items in a single menu. If you attach a pop-up menu to a menu bar item with addPopUp, count returns the number of items in the pop-up menu or the number of items in the menu bar, but not the total number of items in both menus.


Example for Menu::count
count Example

The following example constructs a menu and a pop-up menu, then displays the number of items in each menu. Note that count returns the number of items in a menu whether or not the menu is displayed.

; countMenus::pushButton
method pushButton(var eventInfo Event)
var
  m Menu
  p PopUpMenu
endVar

p.addText("&One")
p.addBar()
p.addText("T&wo")
p.addText("Th&ree")       ; 3 items + 1 bar = 4 elements

m.addText("&First")
m.addText("&Second")
m.addPopUp("&Third", p)   ; 3 items in menu bar

msgInfo("Menu bar items", m.count()) ; displays 3--- counts menu bar only
msgInfo("Pop-up items", p.count())   ; displays 4--- counts pop-up only

endMethod


See Also for Menu::count
See Also

contains


Menu::empty
empty

See Also	Example	Menu Type

Method

Removes all items from a menu.

Syntax

empty ( )

Description

empty removes all items from a custom menu. Use empty when you need to clear an existing menu before rebuilding it.


Example for Menu::empty
empty Example

The following example uses two buttons to display alternate menus. Both methods affect the same menu, declared with the variable mainMenu in the form's Var window.

The following code goes in the form's Var window:

; thisForm::Var
Var
  mainMenu Menu  ; custom menu bar
endVar

Following is the code for showMenuOne's pushButton method:

; showMenuOne::pushButton
method pushButton(var eventInfo Event)
  mainMenu.empty()          ; clear the menu
  mainMenu.addText("&One")  ; reconstruct it
  mainMenu.addText("&Two")
  mainMenu.show()           ; display the changed menu
endMethod

Following is the code for showMenuTwo's pushButton method:

; showMenuTwo::pushButton
method pushButton(var eventInfo Event)
  mainMenu.empty()              ; clear the menu
  mainMenu.addText("File")      ; reconstruct it
  mainMenu.addText("Edit")
  mainMenu.show()               ; show it again
endMethod


See Also for Menu::empty
See Also

remove


Menu::getMenuChoiceAttribute
getMenuChoiceAttribute

See Also	Example	Menu Type

Procedure

Reports the display attributes of a menu item.

Syntax

getMenuChoiceAttribute ( const menuChoice String ) SmallInt

Description

getMenuChoiceAttribute returns an integer representing the display attributes of the menu item specified in menuChoice. The integer value represents the combination of attributes that apply. Use MenuChoiceAttributes constants to test attributes. Use getMenuChoiceAttribute with hasMenuChoiceAttribute to determine whether a specific display attribute applies for a menu item.

This procedure returns the attribute of the currently displayed menu; if you have not created a custom menu, getMenuChoiceAttribute operates on the built-in menu.


Example for Menu::getMenuChoiceAttribute
getMenuChoiceAttribute Example

In the following example, the open method for pageOne constructs and displays a simple menu. The getMenuState button reports whether or not the Time menu item is enabled.

The following code is attached to the open method for pageOne:

; pageOne::open
method open(var eventInfo Event)
var
  mainMenu Menu
  utilPU PopUpMenu
  attrib SmallInt
endVar

 ; build a pop-up menu, disable Time option
utilPU.addText("&Time", MenuDisabled + MenuGrayed)
utilPU.addText("&Date")
 ; attach pop-up and show the menu bar
mainMenu.addPopUp("&Utilities", utilPU)
mainMenu.addText("&Help")
mainMenu.show()

endMethod

The following code is for getMenuState's pushButton method:

; getMenuState::pushButton
method pushButton(var eventInfo Event)
var
  attrib SmallInt
endVar

  ; store attributes of Time in attrib
attrib = getMenuChoiceAttribute("&Time")
  ; this displays False because Time is disabled
msgInfo("Time enabled?", HasMenuChoiceAttribute(attrib, MenuEnabled))
  ; this displays True because Time is grayed
msgInfo("Time grayed?", hasMenuChoiceAttribute(attrib, MenuGrayed))

endMethod


See Also for Menu::getMenuChoiceAttribute
See Also

getMenuChoiceAttributeById

hasMenuChoiceAttribute

setMenuChoiceAttribute

setMenuChoiceAttributeById


Menu::getMenuChoiceAttributeById
getMenuChoiceAttributeById

See Also	Example	Menu Type

Procedure

Reports the display attribute of a menu item specified by its menu ID.

Syntax

getMenuChoiceAttributeById ( const menuId SmallInt ) SmallInt

Description

getMenuChoiceAttributeById returns an integer representing the display attributes of the menu item specified in menuId. The integer value represents the combination of attributes that apply. Use MenuChoiceAttributes constants to test attributes. Use getMenuChoiceAttributeById with hasMenuChoiceAttribute to determine whether a specific display attribute applies for a menu item.

This procedure returns the attribute of the currently displayed menu; if you have not created a custom menu, getMenuChoiceAttributeById operates on the built-in menu.

This procedure is similar to getMenuChoiceAttribute in that both report the display attributes for a specified menu item. The difference is that you specify the actual menu ID (a SmallInt value) for getMenuChoiceAttributeById, and the menu name (a String value) for getMenuChoiceAttribute. getMenuChoiceAttributeById is especially useful when you specify a menu ID as part of addText syntax.


Example for Menu::getMenuChoiceAttributeById
getMenuChoiceAttributeById Example

The following example demonstrates how you can use getMenuChoiceAttributeById with hasMenuChoiceAttribute to determine whether a menu item is disabled. In this example, the open method for pageOne constructs a small menu. The pushButton method for the getMenuState button reports on the state of the Undo menu item.

The following code goes in the form's Var window:

; thisForm::Var
Var
  m1     Menu
  p1, p2 PopUpMenu
endVar

The following code goes in the form's Const window:

; thisForm::Const
Const
  UndoMenu  = 1
  InsMenu   = 2
  DelMenu   = 3
  IndexMenu = 4
  AboutMenu = 5
endConst

The following code is for the page's open method:

; pageOne::open
method open(var eventInfo Event)

p1.addText("Undo",   MenuDisabled + MenuGrayed, UndoMenu + UserMenu)
p1.addText("Insert", MenuEnabled, InsMenu + UserMenu)
p1.addText("Delete", MenuEnabled, DelMenu + UserMenu)
p2.addText("Index",  MenuEnabled, IndexMenu + UserMenu)
p2.addText("About",  MenuEnabled, AboutMenu + UserMenu)

m1.addPopUp("&Record", p1)
m1.addPopUp("&Help", p2)
m1.show()

endMethod

The following code is attached to the getMenuState's pushButton method:

; getMenuState::pushButton
method pushButton(var eventInfo Event)

  ; store attributes of Undo menu in attrib
attrib = getMenuChoiceAttributeById(UndoMenu + UserMenu)

  ; this displays False because Undo is disabled
msgInfo("Undo enabled?", hasMenuChoiceAttribute(attrib, MenuEnabled))
  ; this displays True because Undo is grayed
msgInfo("Undo grayed?", hasMenuChoiceAttribute(attrib, MenuGrayed))
endMethod


See Also for Menu::getMenuChoiceAttributeById
See Also

getMenuChoiceAttribute

hasMenuChoiceAttribute

setMenuChoiceAttribute


Menu::hasMenuChoiceAttribute
hasMenuChoiceAttribute

See Also	Example	Menu Type

Procedure

Reports whether a menu item contains a given display attribute.

Syntax

hasMenuChoiceAttribute ( const attrib SmallInt , const attribSet SmallInt ) Logical

Description

hasMenuChoiceAttribute returns True if attribSet contains the attribute specified in attrib; otherwise, it returns False. Use MenuChoiceAttributes constants to specify attributes.

Use hasMenuChoiceAttribute with getMenuChoiceAttribute  or getMenuChoiceAttributeById to determine whether a particular display attribute for a menu item is represented in attribSet.


Example for Menu::hasMenuChoiceAttribute
hasMenuChoiceAttribute Example

The following code demonstrates how you can use hasMenuChoiceAttribute with getMenuChoiceAttribute to determine whether a particular attribute applies to the currently displayed menu. The following code is attached to the open method for pageOne.

; pageOne::open
method open(var eventInfo Event)
var
  m1 Menu
  p1 PopUpMenu
endVar

p1.addText("&Insert")   ; create a simple menu
p1.addText("&Delete")
p1.addText("&Undo")
m1.addPopUp("&Record", p1)
m1.show()

endMethod

The following code is attached to the pushButton method for the toggleMenuState button:

; toggleMenuState::pushButton
method pushButton(var eventInfo Event)
var
  attribSet SmallInt
endVar

 ; store composite menu attributes in attribSet
attribSet = getMenuChoiceAttribute("&Undo")

 ; this is True if Undo is enabled
if hasMenuChoiceAttribute(attribSet, MenuEnabled) then
   setMenuChoiceAttribute("&Undo", MenuDisabled + MenuGrayed)
else
  setMenuChoiceAttribute("&Undo", MenuEnabled)
endif

endMethod


See Also for Menu::hasMenuChoiceAttribute
See Also

getMenuChoiceAttribute

getMenuChoiceAttributeById


Menu::remove
remove

See Also	Example	Menu Type

Method

Removes an item from a menu.

Syntax

remove ( const item AnyType )

Description

remove deletes the first occurrence of item from a menu. This method is useful for changing one item in a menu without having to rebuild the entire menu.


Example for Menu::remove
remove Example

The code shown in the following example changes a menu immediately by removing an item and adding another item in its place.

; changeMenu::pushButton
method pushButton(var eventInfo Event)
var
   mainMenu Menu
endVar

; First, assume the user is working with a form.
; You could display a menu like this:
mainMenu.addText("File")
mainMenu.addText("Edit")
mainMenu.addText("Form")
mainMenu.show()
msgInfo("Status", "About to change menus. Watch closely.")

; Then, suppose the user switches to work on a report.
; You could change the menu like this:
mainMenu.remove("Form")
mainMenu.addText("Report")
mainMenu.show()

msgInfo("Status", "About to remove the menus. Watch closely.")

; remove entire menu, reveal built-in menus
removeMenu()
endMethod


See Also for Menu::remove
See Also

contains

empty


Menu::removeMenu
removeMenu

See Also	Example	Menu Type

Procedure

Removes a custom menu and displays the default menu.

Syntax

removeMenu ( )

Description

removeMenu replaces a menu built using ObjectPAL with Paradox's default menu.


Example for Menu::removeMenu
removeMenu Example

In the following example, the form's open method constructs a menu (but does not display it). The arrive method for pageOne displays the menu with show. The arrive method for pageTwo removes the menu and reveals the built-in Paradox menu.

The following code goes in the form's Var window:

; thisForm::var
Var
  m1 Menu
endVar

The following code is attached to the form's open method:

; thisForm::open
method open(var eventInfo Event)
if eventInfo.isPreFilter()
  then
    ;code here executes for each object in form
  else
    ;code here executes just for form itself

     m1.addText("&File")   ; construct a menu
     m1.addText("&Edit")
     m1.addText("For&m")

endif

endMethod

The following code is attached to the arrive method for pageOne:

; pageOne::arrive
method arrive(var eventInfo MoveEvent)
m1.show()  ; display the application menu
endMethod

The following code is attached to the arrive method for pageTwo:

; pageTwo::arrive
method arrive(var eventInfo MoveEvent)
removeMenu()   ; remove application menu, reveal built-in menu
endMethod


See Also for Menu::removeMenu
See Also

empty

remove


Menu::setMenuChoiceAttribute
setMenuChoiceAttribute

See Also	Example	Menu Type

Procedure

Sets the display attribute of a menu item.

Syntax

setMenuChoiceAttribute ( const menuChoice String, const menuAttribute SmallInt )

Description

setMenuChoiceAttribute sets the display attribute of menuChoice to menuAttribute. Use MenuChoiceAttributes constants to specify attributes. This procedure affects the currently displayed menu; if you have not created a custom menu, setMenuChoiceAttribute affects the built-in menu.

Note:	If a menu item's definition includes an accelerator key (for example, Print which is defined as "&Print"), remember to include the ampersand in the comparison string menuChoice.


Example for Menu::setMenuChoiceAttribute
setMenuChoiceAttribute Example

In the following example, you change the attribute of the Undo option, depending on whether there is anything to undo. As the user makes changes to the record, the Undo item becomes selectable. After posting the changes, Undo is unavailable.

The following code goes in the form's Var window:

; thisForm::var
Var
  m1 Menu
  p1 PopUpMenu
endVar

The following code is for the form's open method:

; thisForm::open
method open(var eventInfo Event)
if eventInfo.isPreFilter()
  then
    ;code here executes for each object in form
  else
    ;code here executes just for form itself

    ; create a menu and show it
    p1.addText("&Undo", MenuDisabled + MenuGrayed)
    p1.addText("&Insert")
    p1.addText("&Delete")
    m1.addPopUp("&Record", p1)
    m1.show()

endif

endMethod

The following code is for the form's action method:

; thisForm::action
method action(var eventInfo ActionEvent)

if eventInfo.isPreFilter()
  then
    ;code here executes for each object in form

    switch
         ; when user locks a record (starts to change a field value)
      case eventInfo.id() = DataLockRecord :
         ; enable Undo menu item
        setMenuChoiceAttribute("&Undo", MenuEnabled)

        ; when user posts the record (moves to another record)
      case eventInfo.id() = DataUnlockRecord :
        ; disable and gray Undo menu item
        setMenuChoiceAttribute("&Undo", MenuDisabled + MenuGrayed)
    endswitch

  else
    ;code here executes just for form itself
  endif

endMethod

The following code is for the form's menuAction method:

; thisForm::menuAction
method menuAction(var eventInfo MenuEvent)
var
  choice String
endVar

if eventInfo.isPreFilter()
  then
    ;code here executes for each object in form

    choice = eventInfo.menuChoice()
    switch
      case choice = "&Insert" :
        active.action(DataInsertRecord)  ; insert new record
      case choice = "&Delete" :
        active.action(DataDeleteRecord)  ; delete current record
      case choice = "&Undo"   :
        active.action(DataCancelRecord)  ; revert record to original state
        setMenuChoiceAttribute("&Undo", MenuDisabled + MenuGrayed)
    endswitch

  else
    ;code here executes just for form itself
endif

endMethod


See Also for Menu::setMenuChoiceAttribute
See Also

getMenuChoiceAttribute

getMenuChoiceAttributeById

hasMenuChoiceAttribute

setMenuChoiceAttributeById


Menu::setMenuChoiceAttributeById
setMenuChoiceAttributeById

See Also	Example	Menu Type

Procedure

Sets the display attribute of a menu item.

Syntax

setMenuChoiceAttributeById ( const menuId String, const menuAttribute SmallInt )

Description

setMenuChoiceAttributeById sets the display attribute of menuId to menuAttribute. Use MenuChoiceAttributes constants to specify attributes. This procedure affects the currently displayed menu; if you have not created a custom menu, setMenuChoiceAttributeById affects the built-in menu.

Note:	If a menu item's definition includes an accelerator key (for example, Print which is defined as "&Print"), remember to include the ampersand in the comparison string menuChoice.


Example for Menu::setMenuChoiceAttributeById
setMenuChoiceAttributeById Example

In the following example, you change the attribute of the Undo option, depending on whether there is anything to undo. As the user makes changes to the record, the Undo item becomes selectable. After posting the changes, Undo is unavailable. This example uses the menuId clause in addText so that the code can refer to menu items by number rather than menu name.

The following code goes in the form's Var window:

; thisForm::var
Var
  m1 Menu
  p1 PopUpMenu
endVar

The following code goes in the form's Const Window:

; thisForm::const
Const
  InsMenu  = 1  ; use constants for menu id's
  DelMenu  = 2
  UndoMenu = 3
endConst

The following code is attached to the form's open method:

; thisForm::open
method open(var eventInfo Event)

if eventInfo.isPreFilter()
  then
    ;code here executes for each object in form
  else
    ;code here executes just for form itself

     ; construct a menu and display it
     p1.addText("&Undo",   MenuDisabled + MenuGrayed, UndoMenu + UserMenu)
     p1.addText("&Delete", MenuEnabled, DelMenu + UserMenu)
     p1.addText("&Insert", MenuEnabled, InsMenu + UserMenu)
     m1.addPopUp("&Record", p1)
     m1.show()

  endif

endMethod

The following code is attached to the form's action method:

; thisForm::action
method action(var eventInfo ActionEvent)

if eventInfo.isPreFilter()
  then
    ;code here executes for each object in form

    switch
         ; when user locks a record (starts to change a field value)
      case eventInfo.id() = DataLockRecord :
         ; enable Undo menu item
        setMenuChoiceAttributeById(UndoMenu + UserMenu,

                                   MenuEnabled)

         ; when user posts the record (moves to another record)
      case eventInfo.id() = DataUnlockRecord :
         ; disable and dim Undo menu item
        setMenuChoiceAttributeById(UndoMenu + UserMenu,

                                   MenuGrayed + MenuDisabled)
    endswitch

  else
    ;code here executes just for form itself
endif

endMethod

The following code is attached to the form's menuAction method:

; thisForm::menuAction
method menuAction(var eventInfo MenuEvent)
var
  menuItem SmallInt
endVar

if eventInfo.isPreFilter() then
  ;code here executes for each object in form

  menuItem = eventInfo.id()
  switch
    case menuItem = InsMenu :
      active.action(DataInsertRecord)    ; insert new record
    case menuItem = DelMenu :
      active.action(DataDeleteRecord)    ; delete current record
    case menuItem = UndoMenu :
      active.action(DataCancelRecord)    ; revert record to original state
      setMenuChoiceAttributeById(UndoMenu, MenuDisabled + MenuGrayed)
  endswitch

  endswitch

else
  ;code here executes just for form itself
endif

endMethod


See Also for Menu::setMenuChoiceAttributeById
See Also

getMenuChoiceAttribute

getMenuChoiceAttributeById

hasMenuChoiceAttribute

setMenuChoiceAttribute


Menu::show
show

See Also	Example	Menu Type

Method

Displays a menu.

Syntax

show ( )

Description

show displays a menu.

The user's choice is handled using the built-in method menuAction and menuChoice from the MenuEvent type. Refer to the Guide to ObjectPAL for more information about working with menus.


Example for Menu::show
show Example

In the following example, a form's open method constructs a simple menu, then displays it with show. The menuAction method for the form handles the user's menu choice. Following is the code attached to the open method for thisForm.

; thisForm::open
method open(var eventInfo Event)
var
  p1 PopUpMenu
  m1 Menu
endVar

if eventInfo.isPreFilter()
  then
    ;code here executes for each object in form
  else
    ;code here executes just for form itself

    p1.addText("&Time")           ; construct a pop-up
    p1.addText("&Date")
    m1.addPopUp("&Utilities", p1) ; attach pop-up to menu item
    m1.show()                     ; display the m1 menu

endif

endMethod

The following code is attached to the form's menuAction method:

; thisForm::menuAction
method menuAction(var eventInfo MenuEvent)
var
  menuName String
endVar

if eventInfo.isPreFilter() then
  ;code here executes for each object in form

  menuName = eventInfo.menuChoice()
  switch
    case menuName = "&Time" : msgInfo("Current Time", time())
    case menuName = "&Date" : msgInfo("Today's Date", date())
  endSwitch

else
  ;code here executes just for form itself
endif

endMethod


See Also for Menu::show
See Also

addText

Form::setMenu


MenuEvent Type

See Also

MenuEvent variables contain data related to menu selections in the application menu bar. When the user chooses an item from a menu, it triggers the built-in menuAction method. By modifying an object's built-in menuAction method, you can define how the object responds.

The MenuEvent type includes several derived methods from the Event type.

Methods for the MenuEvent Type

Event		MenuEvent
errorCode		data
getTarget		id
isFirstTime		isFromUI
isPreFilter		menuChoice
isTargetSelf		reason
setErrorCode		setData
		setId
		setReason


See Also for MenuEvent Type
See Also

User-defined menu constants


User-defined menu constants

MenuEvent Type

You can define your own menu constants, but you must keep them within a specific range. Because this range is subject to change in future versions of Paradox, ObjectPAL provides the IdRanges constants UserMenu and UserMenuMax to represent the minimum and maximum values allowed.

For example, suppose that you want to define two menu constants, ThisMenuItem and ThatMenuItem. In a Const window, define values for your custom constants as follows:

Const

   ThisMenuItem = 1

   ThatMenuItem = 2

EndConst

Then, to use one of these constants, add it to UserMenu. For example,

method menuAction(var eventInfo MenuEvent)

   if eventInfo.id() = UserMenu + ThisMenuItem then

      doSomething()

   endIf

endMethod

By adding UserMenu to your own constant, you guarantee yourself a value above the minimum. To keep the value under the maximum, use the value of UserMenuMax. One way to check the value is with a message statement:

message(UserMenuMax)

In this version of Paradox, the difference between UserMenu and UserMenuMax is 2047. That means the largest value you can use for a menu constant is UserMenu + 2047.


MenuEvent::data
data

See Also	MenuEvent Type

Method

Returns information about a MenuEvent.

Syntax

data ( ) LongInt

Description

data should be used by Windows programmers only. data returns the lParam argument (usually zero) of specific Windows messages, such as WM_SYSCOMMAND and WM_COMMAND. See your Windows programming documentation for more information.


See Also for MenuEvent::data
See Also

id

setData

setId


MenuEvent::id
id

See Also	Example1	Example2	MenuEvent Type

Beginner

Method

Returns the ID of a MenuEvent.

Syntax

id ( ) SmallInt

Description

id returns the ID number of a MenuEvent. ObjectPAL provides MenuComands constants (like MenuFileOpen) for many common menu choices, and you can also use user-defined menu constants to test the value returned by id.


Example 1 for MenuEvent::id
id Example 1

This is attached to a form's built-in menuAction method. When the user selects Close from the System menu, attempts to toggle to a design window, or chooses File | Exit, the method asks the user to confirm whether or not to leave the form.

; thisForm::menuAction
method menuAction(var eventInfo MenuEvent)
if eventInfo.isPreFilter()
  then
    ; code here executes for each object in form
  else
    ; code here executes just for form itself
    if eventInfo.id() = MenuControlClose OR
      eventInfo.id() = MenuFileExit OR
      eventInfo.id() = MenuFormDesign then
      disableDefault                      ; block departure
      ans = msgQuestion("Please confirm",

                        "Do you really want to leave?")
      if ans = "Yes" then
        dodefault
      endif
    endif
endif
endMethod


Example 2 for MenuEvent::id
id Example 2

The next example demonstrates how you can use the menu ID argument with addText to refer to menu items by number (ideally, user-defined constants) instead of by name. This code establishes user-defined constants to make it easy to remember the menu ID assignments. The following code defines constants global to pageOne.

; pageOne::Const
Const
  ; define constants for menu IDs
  ; actual values (1, 2 and 3) are arbitrary
  TimeMenu = 1
  DateMenu = 2
  HelpMenu = 3
endConst

The following code is attached to the open method for pageOne. To control the menu display attributes, this code uses built-in constants such as MenuEnabled. To identify each menu item by number, the code uses the constants defined in the Const window for pageOne (TimeMenu, DateMenu, and HelpMenu).

; pageOne::open
method open(var eventInfo Event)
var
  mainMenu Menu
  utilPU PopUpMenu
endVar

 ; build a pop-up menu and use constants (ie: TimeMenu)
 ; defined in the Const window for thisPage
utilPU.addText("&Time", MenuEnabled, TimeMenu + UserMenu)
utilPU.addText("&Date", MenuEnabled, DateMenu + UserMenu)
 ; UserMenu is an ObjectPAL constant
 ; attach pop-up to the Utilities main menu item
mainMenu.addPopUp("&Utilities", utilPU)

 ; add "Help" to the menu bar and right-justify "Help" with \008
mainMenu.addText("\008&Help", MenuEnabled, HelpMenu) + UserMenu

mainMenu.show()                 ; display the menu

endMethod

The following code is attached to the menuAction method for pageOne. This method evaluates menu selections by ID number rather than by the name specified in menuName.

; pageOne::menuAction
method menuAction(var eventInfo MenuEvent)
var
  choice SmallInt
endVar

choice = eventInfo.id()      ; assign constant value to choice

  ; now use constants to determine which menu was selected
switch
  case choice = TimeMenu + UserMenu:
    msgInfo("Current Time", time())
  case choice = DateMenu + UserMenu:
    msgInfo("Today's Date", today())
  case choice = HelpMenu + UserMenu:
    ; change menu ID to built-in constant (MenuHelpContents)--
    ; this effectively opens the built-in help system.
    eventInfo.setId(MenuHelpContents)
    eventInfo.setReason(MenuDesktop)
endSwitch

endMethod


See Also for MenuEvent::id
See Also

setId


MenuEvent::isFromUI
isFromUI

See Also	Example1	Example2	MenuEvent Type

Method

Reports whether an event was generated by the user interacting with Paradox.

Syntax

isFromUI ( ) logical

Description

isFromUI reports whether an event was generated by the user interacting with Paradox, or internally (for example, by an ObjectPAL statement). This method returns True if the event was generated by the user; otherwise, it returns False.


Example 1 for MenuEvent::isFromUI
isFromUI Example 1

The following example checks for a menu action to delete a record. If the action is from the UI (that is, if the user made the menu choice), a dialog box prompts for confirmation before deleting the record.

;frm :: menuAction

method menuAction(var eventInfo MenuEvent)

if eventInfo.isPreFilter() then

;// This code executes for each object on the form:

else

;// This code executes only for the form:

if eventInfo.id() = MenuRecordDelete and

      eventInfo.isFromUI() then

if msgQuestion("Delete record?",

                     "Delete this record?") <> "Yes" then

disableDefault

return

endIf

endIf

endif

endMethod


Example 2 for MenuEvent::isFromUI
isFromUI Example 2

This example shows how you can use isFromUI to indicate if the menu action was sent by menuAction or by sendKeys.

The following code is attached to the page's Const window. It declares constants to make it easy to remember the menu ID assignments.

; pageOne::Const

Const

  ; define constants for menu IDs

  ; actual values (1, 2 and 3) are arbitrary

  kTimeMenu = 1

  kDateMenu = 2

  kHelpMenu = 3

endConst

The following code is attached to the open method for pageOne. To control the menu display attributes, this code uses ObjectPAL constants such as MenuEnabled. To identify each menu item by number, the code uses the constants defined in the Const window for pageOne (kTimeMenu, kDateMenu, and kHelpMenu).

; pageOne::open

method open(var eventInfo Event)

var

  mainMenu Menu

  utilPU 	PopUpMenu

endVar

 ; build a pop-up menu and use constants (ie: kTimeMenu)

 ; defined in the Const window for thisPage

utilPU.addText("&Time", MenuEnabled, kTimeMenu + UserMenu)

utilPU.addText("&Date", MenuEnabled, kDateMenu + UserMenu)

 ; UserMenu is an ObjectPAL constant

 ; attach pop-up to the Utilities main menu item

mainMenu.addPopUp("&Utilities", utilPU)

 ; add "Help" to the menu bar and right-justify "Help" with \008

mainMenu.addText("\008&Help", MenuEnabled, kHelpMenu + UserMenu)

mainMenu.show()                 ; display the menu

endMethod

The following code is attached to the menuAction method for pageOne. This method evaluates menu selections by ID number rather than by the name specified in menuName. In addition, it uses isFromUI to report whether the menu event was generated by menuAction or by keyPhysical.

; pageOne::menuAction

method menuAction(var eventInfo MenuEvent)

var

  choice 	SmallInt

  youDoneIt	Logical

endVar

youDoneIt = eventInfo.isFromUI()

choice = eventInfo.id()      ; assign constant value to choice

  ; now use constants to determine which menu was selected

switch

  case choice = kTimeMenu + UserMenu:

    msgInfo("Did a user do this", youDoneIt)

    msgInfo("Current Time", time())

  case choice = kDateMenu + UserMenu:

    msgInfo("Did a user do this", youDoneIt)

    msgInfo("Today's Date", today())

  case choice = kHelpMenu + UserMenu:

    ; change menu ID to built-in constant (MenuHelpContents)--

    ; this effectively opens the built-in help system.

    eventInfo.setId(MenuHelpContents)

    eventInfo.setReason(MenuDesktop)

endSwitch

endMethod

You can use the following two buttons to demonstrate the code above. The following code is attached to the pushButton method of a button named btnObjectPAL. It uses menuAction to send a menu event.

;btnObjectPAL :: pushButton

method pushButton(var eventInfo Event)

menuAction(kDateMenu + UserMenu)

endMethod

The following code is attached to the pushButton method of a button named btnSendKeys. It uses sendKeys to send the keystrokes Alt + u + t . Use this button to simulate a user selecting a menu.

;btnSendKeys :: pushButton

method pushButton(var eventInfo Event)

sendKeys("%ut")

endMethod


See Also for MenuEvent::isFromUI
See Also

Event::isPreFilter


MenuEvent::menuChoice
menuChoice

See Also	Example	MenuEvent Type

Beginner

Method

Returns a string containing an item chosen from a menu.

Syntax

menuChoice ( ) String

Description

menuChoice returns a string containing an item chosen from a menu. Use menuChoice to modify an object's built-in menuAction method to specify how that object responds to menu choices.

Note:	If a menu item's definition includes an accelerator key (for example "&Print"), remember to include the ampersand in the comparison string, for instance, the following code compares the return value of menuChoice with the string "&Print":

if eventInfo.menuChoice() = "&Print" then
   : print the report
endif


Example for MenuEvent::menuChoice
menuChoice Example

The following example assumes a form contains at least one memo field, named thisMemoField. When the user arrives on thisMemoField, the built-in arrive method displays a menu that lets the user perform basic cut and paste operations. The built-in menuAction method attached to thisMemoField uses menuChoice to evaluate the user's selection, and take appropriate action. Although this example mimics the behavior of the default menus, this technique is necessary when the default menus are replaced by custom menus.

This code is attached to the built-in arrive method for thisMemoField:

; thisMemoField::arrive
method arrive(var eventInfo MoveEvent)
Var
  EditPopUp PopUpMenu
  EditMenu  Menu
endVar

EditPopUp.addText("&Cut")              ; create a pop-up menu
EditPopUp.addText("&Copy")
EditPopUp.addText("&Paste")

EditMenu.addPopUp("&Edit", EditPopUp)  ; add pop-up menu bar item
EditMenu.show()                        ; display the menu
endMethod

This code is attached to the the built-in menuAction method for thisMemoField. Note that comparisons in the switch...endSwitch statement must include the ampersand, such as "&Cut".

thisMemoField::menuAction
method menuAction(var eventInfo MenuEvent)
var
  choice String
endVar
choice = eventInfo.menuChoice()       ; store the menu selection to choice

; now respond to the selection appropriately
switch
  case choice = "&Cut"   : self.action(EditCutSelection)
  case choice = "&Copy"  : self.action(EditCopySelection)
  case choice = "&Paste" : self.action(EditPaste)
endSwitch
endMethod

This code is attached to the built-in depart method for thisMemoField. When the user leaves thisMemoField, this code removes the menu. In this example, the default menus reappear when the user moves off the field. In a similar situation, you might want to display another custom menu structure.

; thisMemoField::depart
method depart(var eventInfo MoveEvent)
removeMenu()          ; remove the Edit menu
endMethod


See Also for MenuEvent::menuChoice
See Also

id

setId


MenuEvent::reason
reason

See Also	Example	MenuEvent Type

Method

Reports the type of menu chosen.

Syntax

reason ( ) SmallInt

Description

reason returns an integer value to report why a MenuEvent occurred. MenuEvent reasons occur when a built-in menuAction method is called. ObjectPAL provides MenuReasons constants for testing the value returned by reason.


Example for MenuEvent::reason
reason Example

In the following example, the form's menuAction method examines every MenuEvent to determine the reason for the MenuEvent. The reason is then displayed in the menuReasonField field object.

; thisForm::menuAction
method menuAction(var eventInfo MenuEvent)
var
  reasonStr String
endVar
  if eventInfo.isPreFilter() then
    ; sort out the reason, and assign equivalent string to reasonStr
    reasonStr = iif(eventInfo.reason() = MenuNormal, "MenuNormal",
                iif(eventInfo.reason() = MenuControl, "MenuControl",
                 "MenuDesktop"))
    reasonId = eventInfo.reason()
    menuReasonField = String(reasonId) + " " + reasonStr
     ; Code here executes before each object
  else
     ; Code here executes afterwards (or for form)

  endif
endMethod


See Also for MenuEvent::reason
See Also

setReason


MenuEvent::setData
setData

See Also	MenuEvent Type

Method

Specifies information about a MenuEvent.

Syntax

setData ( const menuData LongInt )

Description

setData should be used by Windows programmers only. setData specifies the lParam argument (usually zero) of specific Windows messages, such as WM_SYSCOMMAND and WM_COMMAND. See your Windows programming documentation for more information.


See Also for MenuEvent::setData
See Also

data

id

setId


MenuEvent::setId
setId

See Also	Example	MenuEvent Type

Method

Specifies the ID of a MenuEvent.

Syntax

setId ( const commandId SmallInt )

Description

setId specifies in commandId an action to take as the result of a menu choice, where commandId is a MenuCommands constant.

If you change the ID for a MenuEvent with setId, you may also need to change the reason for that MenuEvent with setReason.

Note:	In many circumstances, you should use menuAction from the Form type or UIObject type to invoke a menu command. Although it is possible to change the reason and ID for an existing MenuEvent (eventInfo), and it is also possible to create a new MenuEvent and set the reason and ID for that event (only advanced users should try this), this technique is not always advisable.


Example for MenuEvent::setId
setId Example

See the example for id.


See Also for MenuEvent::setId
See Also

id

Event::errorCode

Event::setErrorCode

Form::menuAction

UIObject::menuAction


MenuEvent::setReason
setReason

See Also	Example	MenuEvent Type

Method

Specifies a reason for generating a MenuEvent.

Syntax

setReason ( const reasonId SmallInt )

Description

setReason specifies in reasonId a reason for generating a MenuEvent, where reasonId is a MenuReasons constant.

Note: In many circumstances, you should use menuAction from the Form type or UIObject type to invoke a menu command. Although it is possible to change the reason and ID for an existing MenuEvent (eventInfo), and it is also possible to create a new MenuEvent and set the reason and ID for that event (only advanced users should try this), this technique is not always advisable.


Example for MenuEvent::setReason
setReason Example

See the example for id.


See Also for MenuEvent::setReason
See Also

reason

id

Form::menuAction

UIObject::menuAction


MouseEvent Type

A MouseEvent object answers questions about the mouse, including

Where is the mouse?

Was a mouse button clicked?

Which mouse button was clicked or held down during an operation?

The following built-in object variables can be useful when working with MouseEvents: lastMouseClicked and lastMouseRightClicked.

Many methods defined for the MouseEvent type use or return Point values. Methods defined for the Point type get and set information about screen coordinates and relative positions of points. For example, the size and position properties of a design object are specified in points.

Note:	ObjectPAL calculates point values relative to the container of the design object in question. For example, if a box contains a button, ObjectPAL calculates the button's position relative to the box. If the button sits in an empty page, ObjectPAL calculates the button's position relative to the page. Methods that take or return Point values as arguments use this relative framework. The method convertPointWithRespectTo defined for the UIObject type is useful for converting values in different frameworks.

The following built-in methods are triggered by MouseEvents: mouseClick, mouseDown, mouseUp, mouseDouble, mouseRightUp, mouseRightDown, mouseRightDouble, mouseMove, mouseEnter, and mouseExit.

The MouseEvent type includes several derived methods from the Event type.

Methods for the MouseEvent Type

Event		MouseEvent
errorCode		getMousePosition
getTarget		getObjectHit
isFirstTime		isControlKeyDown
isPreFilter		isFromUI
isTargetSelf		isLeftDown
reason		isMiddleDown
setErrorCode		isRightDown
setReason		isShiftKeyDown
		setControlKeyDown
		setInside
		setLeftDown
		setMiddleDown
		setMousePosition
		setRightDown
		setShiftKeyDown
		setX
		setY
		x
		y


MouseEvent::getMousePosition
getMousePosition

See Also	Example	MouseEvent Type

Method

Returns the mouse position as a Point.

Syntax

1. getMousePosition ( var p Point )

2. getMousePosition ( var xPosition LongInt, yPosition LongInt )

Description

getMousePosition returns the mouse position. This method gets the mouse position at the time the method was called. It doesn't track subsequent mouse movements.

Syntax 1 stores the value in a Point variable, p. When you use syntax 1, you can use Point type methods (for example, isLeft and isRight) to get more information.

Syntax 2 stores the value in xPosition and yPosition, two LongInt variables representing the x- and y-coordinates of the mouse pointer.


Example for MouseEvent::getMousePosition
getMousePosition Example

The following example gets the position of the last mouseUp event and draws a small circle at that position. The method first checks if the source of the event was from the UI (in this case, from the user), and if the target of the event is the page itself (as opposed to whether it was bubbled up to the page from some other object). This method draws the circle only when the user clicks on the page.

; pageOne::mouseUp
method mouseUp(var eventInfo MouseEvent)
var
  crObj UIObject
  x, y  LongInt    ; point coordinates
endVar
if eventInfo.isFromUI() AND eventInfo.isTargetSelf() then
  ; create a small blue circle at the mouse position
  eventInfo.getMousePosition(x, y)
  crObj.create(ellipseTool, x, y, 100, 100)
  crObj.Color = DarkBlue
  crObj.Visible = True
endif
endMethod


See Also for MouseEvent::getMousePosition
See Also

setMousePosition

getObjectHit

Event::getTarget

System::getMouseScreenPosition

System::setMouseScreenPosition


MouseEvent::getObjectHit
getObjectHit

See Also	Example	MouseEvent Type

Method

Creates a handle to the UIObject that received the event.

Syntax

getObjectHit ( var target UIObject ) Logical

Description

getObjectHit returns in target a handle to the UIObject that was clicked. This method is useful for the internal MouseEvents that call the built-in methods mouseExit and mouseEnter. getObjectHit can return a different object than getTarget during a mouseExit or mouseEnter method.


Example for MouseEvent::getObjectHit
getObjectHit Example

The following method is attached to the mouseExit method of a form. When the mouse exits an object, a message appears in the status window showing the name of the target object (getTarget) vs. the name of the object hit (getObjectHit).

; thisForm::mouseExit
method mouseExit(var eventInfo MouseEvent)
var
  targObj,
  hitObj   UIObject
endVar
if eventInfo.isPreFilter()
  then
    ;code here executes for each object in form
    eventInfo.getTarget(targObj)
    eventInfo.getObjectHit(hitObj)
    message(targObj.Name + " vs. " + hitObj.Name)
  else
    ;code here executes just for form itself

endif
endMethod


See Also for MouseEvent::getObjectHit
See Also

getMousePosition

Event::getTarget


MouseEvent::isControlKeyDown
isControlKeyDown

See Also	Example	MouseEvent Type

Method

Reports whether the user has held (or is holding) down Ctrl during a MouseEvent.

Syntax

isControlKeyDown ( ) Logical

Description

isControlKeyDown returns True if Ctrl is held down during a MouseEvent; otherwise, it returns False.


Example for MouseEvent::isControlKeyDown
isControlKeyDown Example

The following example examines the keyboard state during a mouse click to determine whether to automatically insert the highest value in the range, the lowest value in a range, or the default value. The following constants are declared in the Const window for fieldOne:

; fieldOne::Const
Const
  HighRangeVal = Number(10000)
  LowRangeVal = Number(100000)
  DefaultVal = Number(50000)
endConst

This is the method for mouseUp for fieldOne:

; fieldOne::mouseUp
method mouseUp(var eventInfo MouseEvent)
; insert high, low, or default value depending on how mouse was clicked
switch
  case eventInfo.isControlKeyDown() : self.Value = LowRangeVal
                                      message("Ctrl-click")
  case eventInfo.isShiftKeyDown()   : self.Value = HighRangeVal
                                      message("Shift-click")
  otherwise                         : self.Value = LowRangeVal
                                      message("Click")
endswitch
endMethod


See Also for MouseEvent::isControlKeyDown
See Also

setControlKeyDown

isShiftKeyDown


MouseEvent::isFromUI
isFromUI

See Also	Example	MouseEvent Type

Method

Reports whether an event was generated by the user interacting with Paradox.

Syntax

isFromUI ( ) logical

Description

isFromUI reports whether an event was generated by the user interacting with Paradox, or internally (for example, by an ObjectPAL statement). This method returns True if the event was generated by the user; otherwise, it returns False.


Example for MouseEvent::isFromUI
isFromUI Example

Sometimes you need to know whether a mouseEvent was generated by the user interacting with the form or by ObjectPAL; for example, in a computer tutorial. In the following example, isFromUI is used to determine whether a button's built-in mouseEnter method was triggered by the user or by ObjectPAL.

;btnOpenCust :: mouseEnter

method mouseEnter(var eventInfo MouseEvent)

if eventInfo.isFromUI() then

message("This button opens the customer form.")

else

message("After you press this button, the customer form opens.")

endIf

endMethod


See Also for MouseEvent::isFromUI
See Also

Event::isPreFilter


MouseEvent::isInside
isInside

See Also	Example	MouseEvent Type

Method

Reports whether the mouse is inside the border of the target object.

Syntax

isInside ( ) Logical

Description

isInside reports whether the mouse is inside the border of the target object at the time of the event.


Example for MouseEvent::isInside
isInside Example

In the following example, the mouseUp method for buttonOne reports whether the last event is inside the borders of the target object. If you click buttonOne, the mouseUp MouseEvent is delivered to buttonOne and isInside returns True. If you drag from inside the button to outside the button, so that the mouseUp occurs outside of the borders of buttonOne, the MouseEvent occurs for buttonOne, and triggers the mouseUp method, but isInside returns False for that MouseEvent.

; buttonOne::mouseUp
method mouseUp(var eventInfo MouseEvent)
msgInfo("Is the last event inside ?", eventInfo.isInside())
endMethod


See Also for MouseEvent::isInside
See Also

getObjectHit

setInside


MouseEvent::isLeftDown
isLeftDown

See Also	Example	MouseEvent Type

Method

Reports whether the left (or primary) mouse button is held down during a MouseEvent.

Syntax

isLeftDown ( ) Logical

Description

isLeftDown returns True if the left mouse button is held down during a MouseEvent, for instance, while dragging the mouse; otherwise, it returns False.


Example for MouseEvent::isLeftDown
isLeftDown Example

In the following example, assume that the Site Notes field from the Sites table is placed on a form. This method, attached to the mouseMove method for Site Notes, checks whether the left or right button is down at the time of the move. If the left button is down, the field is selected from the point of the click to the beginning of the field. If the right button is down, the field is selected from the point of the click to the end of the field.

; Site Notes::mouseMove
method mouseMove(var eventInfo MouseEvent)
if eventInfo.isLeftDown() then
  self.action(SelectTop)            ; select from point to beginning
else
  if eventInfo.isRightDown() then
    self.action(SelectBottom)       ; select from point to end
  endif
endif
endMethod


See Also for MouseEvent::isLeftDown
See Also

isRightDown

isMiddleDown

setLeftDown


MouseEvent::isMiddleDown
isMiddleDown

See Also	Example	MouseEvent Type

Method

Reports whether the middle mouse button is held down during a MouseEvent.

Syntax

isMiddleDown ( ) Logical

Description

isMiddleDown returns True if the middle mouse button is held down during a MouseEvent; otherwise (even if there is no middle mouse button), it returns False.


Example for MouseEvent::isMiddleDown
isMiddleDown Example

The following example assumes that a form contains a button called sendMove, and a field from the Sites table called Site Notes. The pushButton method for sendMove constructs a MouseEvent with the middle button down, then sends the MouseEvent off to the Site Notes field.

; sendMove::pushButton
method pushButton(var eventInfo Event)
var
  mo  MouseEvent         ; declare a MouseEvent to send
  ui  UIObject
endVar
ui.attach("Site Notes")  ; attach to Site Notes
mo.setMiddleDown(Yes)    ; set middle button down on MouseEvent
ui.mouseMove(mo)         ; dispatch event to mouseMove for Site Notes
endMethod

This method is attached to the mouseMove method for Site Notes. If the middle button is down for the MouseEvent, the method moves to the beginning of the current word, then selects the entire word.

; Site_Notes::mouseMove
method mouseMove(var eventInfo MouseEvent)
if eventInfo.isMiddleDown() then
  self.action(MoveLeftWord)    ; go to the beginning of the word
  self.action(SelectRightWord) ; select the entire word
endif
endMethod


See Also for MouseEvent::isMiddleDown
See Also

setMiddleDown

isLeftDown

isRightDown


MouseEvent::isRightDown
isRightDown

See Also	Example	MouseEvent Type

Method

Reports whether the right mouse button is pressed during a MouseEvent.

Syntax

isRightDown ( ) Logical

Description

isRightDown returns True if the right (or alternate) mouse button is held down during a MouseEvent, for instance, while right-dragging; otherwise, it returns False.


Example for MouseEvent::isRightDown
isRightDown Example

In the following example, assume that the Site Notes field from the Sites table is placed on a form. The mouseMove method for Site Notes checks whether the left or right mouse button is down at the time of the move. If the left button is down, the field is selected from the point of the click to the beginning of the field; if the right button is down, the field is selected from the point of the click to the end of the field.

; Site Notes::mouseMove
method mouseMove(var eventInfo MouseEvent)
if eventInfo.isLeftDown() then
  self.action(SelectTop)            ; select from point to beginning
else
  if eventInfo.isRightDown() then
    self.action(SelectBottom)       ; select from point to end
  endif
endif
endMethod


See Also for MouseEvent::isRightDown
See Also

setRightDown

isLeftDown

isMiddleDown


MouseEvent::isShiftKeyDown
isShiftKeyDown

See Also	Example	MouseEvent Type

Method

Reports whether Shift is held down during a MouseEvent.

Syntax

isShiftKeyDown ( ) Logical

Description

isShiftKeyDown returns True if Shift is held down during a MouseEvent; otherwise, it returns False.


Example for MouseEvent::isShiftKeyDown
isShiftKeyDown Example

The following example is attached to the mouseUp method for the Site Notes field. When the user presses Shift while clicking, the word to the right of the insertion point is selected.

; Site Notes::mouseUp
method mouseUp(var eventInfo MouseEvent)
;if Shift is down, select the word to the right
if eventInfo.isShiftKeyDown() then
   self.action(SelectRightWord)
endif
endMethod


See Also for MouseEvent::isShiftKeyDown
See Also

isControlKeyDown

setShiftKeyDown


MouseEvent::setControlKeyDown
setControlKeyDown

See Also	Example	MouseEvent Type

Method

Simulates pressing and holding Ctrl during a MouseEvent.

Syntax

setControlKeyDown ( const yesNo Logical )

Description

setControlKeyDown adds information about the state of Ctrl for a MouseEvent. You must specify Yes or No. Yes means Ctrl was pressed and held during a MouseEvent; No means Ctrl was not pressed.


Example for MouseEvent::setControlKeyDown
setControlKeyDown Example

The following example creates a MouseEvent and sets Ctrl  to Yes. The event is then sent to the mouseUp built-in method for a field called lcField. This method is attached to the pushButton method for a button named sendCtrl.

; sendCtrl::pushButton
method pushButton(var eventInfo Event)
var
  ctrlMsEvent MouseEvent             ; declare the event
endVar

ctrlMsEvent.setControlKeyDown(Yes)   ; set the Control key
lcField.mouseUp(ctrlMsEvent)         ; send the event
endMethod

This code is attached to the mouseUp method for lcField. This method checks whether Ctrl  is pressed when the mouse is clicked. If so, the value in the field is changed to all lowercase.

; lcField::mouseUp
method mouseUp(var eventInfo MouseEvent)
if eventInfo.isControlKeyDown() then   ; check for Control key
  self.Value = lower(self.Value)       ; change to lowercase
endif
endMethod


See Also for MouseEvent::setControlKeyDown
See Also

isControlKeyDown

setShiftKeyDown


MouseEvent::setInside
setInside

See Also	Example	MouseEvent Type

Method

Sets the mouse to be inside the current object.

Syntax

setInside ( const TrueFalse Logical ) Logical

Description

setInside sets the MouseEvent to be inside the current object.


Example for MouseEvent::setInside
setInside Example

In the following example, the mouseUp method for sendAnEvent uses setInside to change the eventInfo variable, then sends the event to buttonOne.

; sendAnEvent::mouseUp
method mouseUp(var eventInfo MouseEvent)
eventInfo.setInside(Yes)
buttonOne.mouseUp(eventInfo)
endMethod


See Also for MouseEvent::setInside
See Also

isInside

getObjectHit


MouseEvent::setLeftDown
setLeftDown

See Also	Example	MouseEvent Type

Method

Simulates pressing the left mouse button.

Syntax

setLeftDown ( const yesNo Logical )

Description

setLeftDown adds information about the state of the left mouse button for a MouseEvent. You must specify Yes or No. Yes means the left button was clicked; No means the left button was not clicked.


Example for MouseEvent::setLeftDown
setLeftDown Example

The following example constructs a MouseEvent with the left button set down. The MouseEvent is then sent to the mouseMove method for Site_Notes. This code is attached to the pushButton method for sendLeftButton:

; sendLeftButton::pushButton
method pushButton(var eventInfo Event)
var
  leftMoveMouse MouseEvent     ; create the mouse event
  ui            UIObject
endVar
leftMoveMouse.setLeftDown(Yes) ; set Left button to Yes
ui.attach("Site_Notes")
ui.mouseMove(leftMoveMouse)    ; send the event to Site_Notes
endMethod

This code is attached to the mouseMove method for Site Notes:

; Site_Notes::mouseMove
method mouseMove(var eventInfo MouseEvent)
if eventInfo.isLeftDown() then
  self.action(SelectTop)            ; select from point to beginning
else
  if eventInfo.isRightDown() then
    self.action(SelectBottom)       ; select from point to end
  endif
endif
endMethod


See Also for MouseEvent::setLeftDown
See Also

isLeftDown

setMiddleDown

setRightDown


MouseEvent::setMiddleDown
setMiddleDown

See Also	Example	MouseEvent Type

Method

Simulates pressing the middle mouse button.

Syntax

setMiddleDown ( const yesNo Logical )

Description

setMiddleDown adds information about the state of the middle mouse button for a MouseEvent. You must specify Yes or No. Yes means the middle button was clicked; No means the middle button was not clicked.


Example for MouseEvent::setMiddleDown
setMiddleDown Example

The following example assumes that a form contains a button called sendMove and a field object from the Sites table called Site_Notes. The pushButton method for sendMove constructs a MouseEvent with the middle button down, then sends MouseEvent to the Site_Notes field object.

; sendMove::pushButton
method pushButton(var eventInfo Event)
var
  mo  MouseEvent         ; declare a MouseEvent to send
  ui  UIObject
endVar
ui.attach("Site_Notes")  ; attach to Site_Notes
mo.setMiddleDown(Yes)    ; set middle button down on MouseEvent
ui.mouseMove(mo)         ; dispatch event to mouseMove for Site Notes
endMethod

This method is attached to the mouseMove method for Site_Notes. If the middle button is down for the MouseEvent, the method moves to the beginning of the current word, then selects the entire word.

; Site_Notes::mouseMove
method mouseMove(var eventInfo MouseEvent)
if eventInfo.isMiddleDown() then
  self.action(MoveLeftWord)    ; go to the beginning of the word
  self.action(SelectRightWord) ; select the entire word
endif
endMethod


See Also for MouseEvent::setMiddleDown
See Also

isMiddleDown

setLeftDown

setRightDown


MouseEvent::setMousePosition
setMousePosition

See Also	Example	MouseEvent Type

Method

Sets the position of the mouse for an event.

Syntax

1. setMousePosition ( const xPosition LongInt, const yPosition  LongInt )

2. setMousePosition ( const p Point )

Description

setMousePosition adds information about the position of the mouse for a MouseEvent. xPosition and yPosition specify the x- and y-coordinates in twips, relative to the upper left corner of the target object's container.


Example for MouseEvent::setMousePosition
setMousePosition Example

The following example creates a new event, sets the mouse position to 500 twips to the right and below the current mouse position, and sends the event to the mouseRightUp method for the same object. This code is attached to the mouseUp method for an object called boxOne:

; boxOne::mouseUp
method mouseUp(var eventInfo MouseEvent)
var
  rightEvent MouseEvent
endVar
; set the new position to current plus 500, 500
rightEvent.setMousePosition(eventInfo.x() + 500,
                            eventInfo.y() + 500)
mouseRightUp(rightEvent)            ; send off the new event
endMethod


See Also for MouseEvent::setMousePosition
See Also

getMousePosition

System::getMouseScreenPosition

System::setMouseScreenPosition


MouseEvent::setRightDown
setRightDown

See Also	Example	MouseEvent Type

Method

Simulates pressing the right mouse button.

Syntax

setRightDown ( const yesNo Logical )

Description

setRightDown adds information about the state of the right mouse button for a MouseEvent. You must specify Yes or No. Yes means the right button was clicked; No means the right button was not clicked.


Example for MouseEvent::setRightDown
setRightDown Example

The following example constructs a MouseEvent with the right button set down. The MouseEvent is then sent to the mouseMove method for Site_Notes. This code is attached to the pushButton method for sendRightButton:

; sendRightButton::pushButton
method pushButton(var eventInfo Event)
var
  rightMoveMouse MouseEvent      ; declare the event
  ui            UIObject
endVar
rightMoveMouse.setRightDown(Yes) ; set right button down
ui.attach("Site_Notes")
ui.mouseMove(rightMoveMouse)     ; send the event to Site Notes
endMethod

This code is attached to the mouseMove method for Site_Notes:

; Site_Notes::mouseMove
method mouseMove(var eventInfo MouseEvent)
if eventInfo.isLeftDown() then
  self.action(SelectTop)            ; select from point to beginning
else
  if eventInfo.isRightDown() then
    self.action(SelectBottom)       ; select from point to end
  endif
endif
endMethod


See Also for MouseEvent::setRightDown
See Also

isRightDown

setMiddleDown

setLeftDown


MouseEvent::setShiftKeyDown
setShiftKeyDown

See Also	Example	MouseEvent Type

Method

Simulates pressing and holding Shift.

Syntax

setShiftKeyDown ( const yesNo Logical )

Description

setShiftDown adds information about the state of Shift for a MouseEvent. You must specify Yes or No. Yes means Shift was pressed and held; No means Shift wasn't pressed.


Example for MouseEvent::setShiftKeyDown
setShiftKeyDown Example

The following example creates a MouseEvent and sets Shift  to Yes. The event is then sent to the mouseUp built-in method for a field called ucField. This method is attached to the pushButton method for a button named sendShift.

; sendShift::pushButton
method pushButton(var eventInfo Event)
var
  shiftMsEvent MouseEvent             ; declare the event
endVar

shiftMsEvent.setShiftKeyDown(Yes)     ; set the Shift key
ucField.mouseUp(shiftMsEvent)         ; send the event

endMethod

This code is attached to the mouseUp method for ucField. This method checks whether Shift is pressed when the mouse is clicked. If so, the value in the field is changed to all uppercase.

; ucField::mouseUp
method mouseUp(var eventInfo MouseEvent)
if eventInfo.isShiftKeyDown() then    ; check for Shift key
  self.Value = upper(self.Value)      ; change to uppercase
endif
endMethod


See Also for MouseEvent::setShiftKeyDown
See Also

isShiftKeyDown

setControlKeyDown


MouseEvent::setX
setX

See Also	Example	MouseEvent Type

Method

Specifies the horizontal coordinate of the mouse pointer position.

Syntax

setX ( const xPosition LongInt )

Description

setX sets the horizontal coordinate (in twips) of the mouse pointer position to xPosition. Coordinates must be specified relative to the upper-left corner of the current object.


Example for MouseEvent::setX
setX Example

The following example involves two methods for the same object, boxOne. The mouseUp method creates a MouseEvent, setting the coordinates to 500 twips greater than the point of the click. The mouseUp method then sends the event to mouseRightUp. The mouseRightUp method gets the coordinates, converts them so they are placed properly on boxOne, and draws a box at the point indicated by the MouseEvent. If the MouseEvent is the result of a user interaction (isFromUI returns True), the new box is painted Red. If the MouseEvent is not the result of a user interaction, as when the event is passed from the mouseUp method, the new box is painted Green. The mouseUp method for boxOne is:

; boxOne::mouseUp
method mouseUp(var eventInfo MouseEvent)
var
  rightEvent MouseEvent
endVar
; set the new position to current plus 500, 500
rightEvent.setX(eventInfo.x() + 500)
rightEvent.setY(eventInfo.y() + 500)
mouseRightUp(rightEvent)            ; send off the new event
endMethod

This code is attached to the mouseRightUp method for boxOne:

; boxOne::mouseRightUp
method mouseRightUp(var eventInfo MouseEvent)
var
  ui     UIObject     ; to create object at point of click
  msPt   Point        ; the x, y point of click
endVar

; get the x and y coordinates of the click
msPt = Point(eventInfo.x(), eventInfo.y())

; convert the point from the page to the box
self.convertPointWithRespectTo(pageOne, msPt, msPt)

; create the box, color it, and set it to visible
ui.create(boxTool, msPt.x(), msPt.y(), 200, 200)
ui.Visible = True
if eventInfo.isFromUI() then
  ui.Color = Red         ; native event
else
  ui.Color = Green       ; mouse event passed from mouseUp
endif
endMethod


See Also for MouseEvent::setX
See Also

x

y

setY

UIObject::convertPointWithRespectTo


MouseEvent::setY
setY

See Also	Example	MouseEvent Type

Method

Specifies the vertical coordinate of the mouse pointer position.

Syntax

setY ( const yPosition LongInt )

Description

setY sets the vertical coordinate (in twips) of the mouse pointer position to yPosition. Coordinates must be specified relative to the upper-left corner of the current object.


Example for MouseEvent::setY
setY Example

See the example for setX.


See Also for MouseEvent::setY
See Also

x

y

setX

UIObject::convertPointWithRespectTo


MouseEvent::x
x

See Also	Example	MouseEvent Type

Method

Returns the horizontal coordinate of the mouse pointer position.

Syntax

x ( ) LongInt

Description

x returns (in twips) the horizontal coordinate of the mouse pointer position.


Example for MouseEvent::x
x Example

See the example for setX.


See Also for MouseEvent::x
See Also

y

setX

UIObject::convertPointWithRespectTo


MouseEvent::y
y

See Also	Example	MouseEvent Type

Method

Returns the vertical coordinate of the mouse pointer position.

Syntax

y ( ) LongInt

Description

y returns (in twips) the vertical coordinate of the mouse pointer position.


Example for MouseEvent::y
y Example

See the example for setX.


See Also for MouseEvent::y
See Also

x

setY

setX

UIObject::convertPointWithRespectTo


MoveEvent Type

Methods for the MoveEvent type enable you to get and set information about the events that occur as you navigate from one object to another in a form.

The following built-in methods are triggered by MoveEvents: arrive, canArrive, canDepart, and depart.

The MoveEvent type includes several derived methods from the Event type.

Methods for the MoveEvent Type

Event		MoveEvent
errorCode		getDestination
getTarget		reason
isFirstTime		setReason
isPreFilter
isTargetSelf
setErrorCode


MoveEvent::getDestination
getDestination

See Also	Example	MoveEvent Type

Method

Reports which object is the destination of a move.

Syntax

getDestination ( var dest UIObject )

Description

getDestination returns in dest the object that Paradox is trying to move to in a form.


Example for MoveEvent::getDestination
getDestination Example

In the following example, assume that the form contains a multi-record object bound to the Orders table. The canDepart method for the form is called whenever the user attempts to move off a field or other object in the form. The canDepart method shown in this example uses getDestination to find the intended destination of the MoveEvent. This method uses getTarget to find the source of the move and compare it with the destination.

If the containers of the two objects are the same, such as when the user is moving from one field to the next in a multi-record object, the method displays a dialog box asking for confirmation. When the user responds, the move occurs and the field the user moved from is set to yellow. If the target's container and the destination's container are different, such as when the user is attempting to leave the form altogether, the method doesn't display the dialog box. The following code is attached to the canDepart method for a form:

; thisForm::canDepart
method canDepart(var eventInfo MoveEvent)
var
  destObj UIObject
  targObj UIObject
  doMove  String
endVar
if eventInfo.isPreFilter()
  then
    ;code here executes for each object in form
    eventInfo.getTarget(targObj)
    eventInfo.getDestination(destObj)
    if targObj.ContainerName = destObj.ContainerName then
      ; handle only field-to-field moves within the MRO
      doMove = msgQuestion("Move?", "Move to " + destObj.name + " ?")
      if doMove = "No" then
        eventInfo.setErrorCode(CanNotDepart)
      else
        targObj.Color = Yellow    ; leave a trail of yellow fields
      endIf
    endif
  else
    ;code here executes just for form itself

endif
endMethod


See Also for MoveEvent::getDestination
See Also

reason

Event::getTarget


MoveEvent::reason
reason

See Also	Example	MoveEvent Type

Method

Reports why a move occurred.

Syntax

reason ( ) SmallInt

Description

reason returns an integer value to report why a MoveEvent occurred. MoveEvent reasons occur when a built-in arrive, depart, canArrive, or canDepart method is called. ObjectPAL provides MoveReasons constants for testing the value returned by reason.


Example for MoveEvent::reason
reason Example

In the following example, assume a form contains two field objects, fieldOne and fieldTwo, and a button named moveToFieldOne. A move away from fieldOne is treated as normal; however, to return to fieldOne, the user must press the moveToFieldOne button. The canArrive method for fieldOne checks the reason for the move, and blocks field arrival if the reason is not UserMove. The following code is attached to the canArrive method for fieldOne:

; fieldOne::canArrive
method canArrive(var eventInfo MoveEvent)
; don't allow user to move to field by tabbing or clicking
if eventInfo.reason() = UserMove then
  eventInfo.setErrorCode(CanNotArrive)
  beep()
  message("Press the Move to Field One button to move to Field One.")
endif
endMethod

The following code is attached to the pushButton method for moveToFieldOne:

; moveToFieldOne::pushButton
method pushButton(var eventInfo Event)
; move to fieldOne if it does not currently have focus
if fieldOne.Focus = False then
  fieldOne.moveTo()
else
  fieldTwo.moveTo()
endif
endMethod


See Also for MoveEvent::reason
See Also

setReason


MoveEvent::setReason
setReason

See Also	Example	MoveEvent Type

Method

Specifies a reason for a Move Event.

Syntax

setReason ( const reasonId SmallInt )

Description

setReason specifies a reason for generating a MoveEvent. This method takes a MoveReasons constant as an argument.


Example for MoveEvent::setReason
setReason Example

In the following example, the canArrive method for fieldOne blocks field arrival if the reason for the move is UserMove. To temporarily circumvent this restriction, the form's canArrive method changes the reason for UserMove events to PalMove events. This code is attached to the canArrive method for fieldOne:

; fieldOne::canArrive
method canArrive(var eventInfo MoveEvent)
; don't allow user to move to field by tabbing or clicking
if eventInfo.reason() = UserMove then
  eventInfo.setErrorCode(CanNotArrive)
  beep()
  message("Press the Move to Field One button to move to Field One.")
endif
endMethod

This code is attached to the canArrive method for the form:

; thisForm::canArrive
method canArrive(var eventInfo MoveEvent)
if eventInfo.isPreFilter()
  then
    ;code here executes for each object in form
    ; change events with a reason of UserMove to PalMove
    if eventInfo.reason() = UserMove then
      eventInfo.setReason(PalMove)
    endif
  else
    ;code here executes just for form itself

endif
endMethod


See Also for MoveEvent::setReason
See Also

reason


Number Type

Number variables represent floating-point values consisting of a significand (fractional portion, for example, 3.224) multiplied by a power of 10. The significand can contain up to 18 significant digits, and the power of 10 can range from ± 3.4 * 10 -4930 to ± 1.1 * 10 4930. An attempt to assign a value outside of this range to a Number variable causes an error.

Note:	ObjectPAL supports an alternate syntax:

methodName ( objVar, argument [ , argument ] )

methodName represents the name of the method, objVar is the variable representing an object, and argument represents one or more arguments. For example, the following statement uses the standard ObjectPAL syntax to return the sine of a number:

theNum.sin()

This statement uses the alternate syntax:

sin(theNum)

It's best to use standard syntax for clarity and consistency, but you can use the alternate syntax wherever it's convenient.

Note:	The display formats of numeric method may vary depending on the Windows number format of the user's system, but ObjectPAL's internal representation is always the same.

Note:	Run-time library methods and procedures defined for the Number type also work with LongInt and SmallInt variables. The syntax is the same, and the returned value is a Number. For example, the following code works, even though sin does not appear in the list of methods for the LongInt type:

var
   abc LongInt
   xyz Number
endVar
abc = 43
xyz = abc.sin()

The Number type includes several derived methods from the AnyType type.

Methods for the Number Type

AnyType		Number
blank		abs
dataType		acos
isAssigned		asin
isBlank		atan
isFixedType		atan2
view		ceil
		cos
		cosh
		exp
		floor
		fraction
		fv
		ln
		log
		max
		min
		mod
		number
		numVal
		pmt
		pow
		pow10
		pv
		rand
		round
		sin
		sinh
		sqrt
		tan
		tanh
		truncate


Number::abs
abs

See Also	Example	Number Type

Beginner

Method

Returns the absolute value of a number.

Syntax

abs ( ) Number

Description

abs removes the sign from a numeric value


Example for Number::abs
abs Example

For the following example, assume that a form contains three field objects: forecastAmt, actualAmt, and diffPercent. The newValue method for actualAmt finds the difference between forecastAmt and actualAmt, then calculates how far off the forecast was. Depending on the values in forecastAmt and actualAmt, the number by which they differ can be positive or negative. To find the percentage of error, abs is used to get the absolute value of the number, which is then multiplied by 100 to get a percentage. This code is attached to the newValue method for actualAmt:

; actualAmt::newValue
method newValue(var eventInfo Event)
var
  difference  Number
endVar
; don't execute if newValue is being called at startup, or
; if one of the fields involved is blank
if eventInfo.reason() <> StartupValue then
  if NOT self.isBlank() AND
     NOT forecastAmt.isBlank() then
    ; find out how much forecast differs from actual
    difference = (forecastAmt - Number(self.Value)) / forecastAmt
    diffPercent = difference.abs() * 100  ; get the variation as
                                          ; an absolute value
  else
    msgStop("Error", "The forecastAmt field can't be blank.")
  endif
endif
endMethod


See Also for Number::abs
See Also

number


Number::acos
acos

See Also	Example	Number Type

Beginner

Method

Returns the 2-quadrant arc cosine of a number.

Syntax

acos ( ) Number

Description

Given a number between -1 and 1, acos returns a numeric value between 0 and pi, expressed in radians. acos is called the 2-quadrant arc cosine because it returns values within quadrants 1 and 4 (that is, between -pi/2 and pi/2). acos is the inverse of cos (if acos(x) = y, then cos(y) = x).


Example for Number::acos
acos Example

The pushButton method for the findArcCos button calculates and displays the arc cosine of a value entered by the user.

; findArcCos::pushButton

method pushButton(var eventInfo Event)

var

nuUserVal,

nuArcCos	Number

stPrompt	String

endVar

stPrompt = "Enter a number from -1 to 1"

nuUserVal = 0

nuUserVal.view(stPrompt)

if (nuUserVal >= -1) and (nuUserVal <= 1) then

nuArcCos = nuUserVal.acos()

nuArcCos.view("Arc cosine of " + String(nuUserVal))

else

msgStop("You entered: " + String(nuUserVal), stPrompt)

endIf

endMethod


See Also for Number::acos
See Also

asin

atan


Number::asin
asin

See Also	Example	Number Type

Beginner

Method

Returns the 2-quadrant arc sine of a number.

Syntax

asin ( ) Number

Description

Given a number between -1 and 1, asin returns a numeric value between -pi/2 and pi/2, expressed in radians. asin is the inverse of sin (if asin(x) = y, then sin(y) = x).


Example for Number::asin
asin Example

In the following example, the pushButton method for the findASin button displays the arc sine of a number.

; findASin::pushButton
var
  x Number
endvar
x = .5
msgInfo("arc sine of .5", x.asin())   ; displays .52
endMethod


See Also for Number::asin
See Also

acos

atan

cos

sin


Number::atan
atan

See Also	Example	Number Type

Beginner

Method

Returns the 2-quadrant arctangent of a number.

Syntax

atan ( ) Number

Description

Given a tangent in radians, atan returns the angle in radians. atan is called the 2-quadrant arctangent because it returns values within quadrants 1 and 4 (that is, between -pi/2 and pi/2). atan is the inverse of tan (if atan(x) = y, then tan(y) = x).


Example for Number::atan
atan Example

In the following example, the pushButton method for getAtan calculates the 2-quadrant arctangent of x and y, then displays the result.

; getAtan::pushButton
method pushButton(var eventInfo Event)
var
  x   Number
  checkPi, fortyFiveDegrees Number
endvar
x = 1
fortyFiveDegrees = x.atan()
msgInfo("45 degrees in radians: ", fortyFiveDegrees)  ; 0.79
checkPi = fortyFiveDegrees * 4       ; pi radians = 180 degrees
msgInfo("pi: ", format("w12.10", checkPi))
endMethod


See Also for Number::atan
See Also

cos

sin

tan

tanh

atan2


Number::atan2
atan2

See Also	Example	Number Type

Beginner

Method

Returns the 4-quadrant arctangent of a number.

Syntax

atan2 ( const x Number ) Number

Description

Given a sine in radians, atan2 returns an angle in radians whose cosine is x. atan2 is called the 4-quadrant arctangent because it returns values in all four quadrants.


Example for Number::atan2
atan2 Example

For the following example, assume that a form contains a button named getAtan2. The pushButton method for getAtan2 calculates the 4-quadrant arctangent of x and y, then displays the results:

; getAtan2::pushButton
method pushButton(var eventInfo Event)
var
  x,
  y,
  checkpi,
  fortyFiveDegrees Number
endvar
x = 1                          ; The angle whose tangent is 1 / 1
y = 1                          ; is a 45 degree angle
fortyFiveDegrees = x.atan2(y)
msgInfo("45 degrees in radians: ", fortyFiveDegrees)  ; 0.79
checkpi = fortyFiveDegrees * 4.0      ; pi radians = 180 degrees
msgInfo("pi: ", format("w12.10", checkpi))
endMethod


See Also for Number::atan2
See Also

cos

sin

tan

tanh


Number::ceil
ceil

See Also	Example	Number Type

Beginner

Method

Rounds a numeric expression up to the nearest whole number.

Syntax

ceil ( ) Number

Description

ceil rounds a numeric expression up (toward positive infinity) to the nearest whole number.


Example for Number::ceil
ceil Example

In the following example, the pushButton method for a button named ceilVsRound calculates the ceiling value of a number, then shows the rounded value of the same number:

; ceilVsRound::pushButton
method pushButton(var eventInfo Event)
var
  x  Number
endVar
x = 3.1
msgInfo("The ceil of " + String(x) + " is", ceil(x))     ; displays 4.0
msgInfo("The round of " + String(x) + " is", x.round(0)) ; displays 3
endMethod


See Also for Number::ceil
See Also

floor


Number::cos
cos

See Also	Example	Number Type

Beginner

Method

Returns the cosine of an angle.

Syntax

cos ( ) Number

Description

cos returns a value between -1 and 1 for the cosine of a value or expression representing the size of the angle in radians.


Example for Number::cos
cos Example

In the following example, the pushButton method for the findCosine button calculates and displays the cosine of a 60-degree angle:

; findCosine::pushButton
method pushButton(var eventInfo Event)
var
  sixtyDegrees Number
endVar
sixtyDegrees = PI / 3.0
msgInfo("The cosine of 60 degrees", sixtyDegrees.cos()) ; displays 0.50
endMethod


See Also for Number::cos
See Also

acos

cosh

sin

tan


Number::cosh
cosh

See Also	Example	Number Type

Beginner

Method

Returns the hyperbolic cosine of an angle.

Syntax

cosh ( ) Number

Description

cosh returns the hyperbolic cosine of a value or expression representing the size of the angle in radians. The formula used is

cosh(angle) = (exp(angle) + exp(-angle)) / 2


Example for Number::cosh
cosh Example

The pushButton method for the findCosineH button calculates and displays the h cosine of 60 degrees.

; findCosineH::pushButton
method pushButton(var eventInfo Event)
var
  sixtyDegrees Number
endVar
sixtyDegrees = PI / 3.0
msgInfo("The h cosine of " + format("W8.6", sixtyDegrees) + " radians",
         format("W14.12", sixtyDegrees.cosh()))
; displays 1.600286857702
endMethod


See Also for Number::cosh
See Also

cos

sin

tan


Number::exp
exp

See Also	Example	Number Type

Beginner

Method

Returns the exponential (base e) of a number.

Syntax

exp ( ) Number

Description

exp computes ex, where e is the constant 2.7182845905. The inverse method is ln.


Example for Number::exp
exp Example

In the following example, the pushButton method for a button named getExponent button calculates and displays the base e of 1:

; getExponent::pushButton
method pushButton(var eventInfo Event)
msgInfo("The exp of 1.0", format("W14.12", exp(1.0)))
; exp(1) formatted to display full precision
endMethod


See Also for Number::exp
See Also

ln

log


Number::floor
floor

See Also	Example	Number Type

Beginner

Method

Rounds a numeric expression down to the nearest whole number.

Syntax

floor ( ) Number

Description

floor rounds a numeric expression down (toward negative infinity) to the nearest whole number.


Example for Number::floor
floor Example

In the following example, the pushButton method for a button named floorVsRound uses floor to round x down to the nearest integer. By comparison, for the same number, round results in a higher number.

; floorVsRound::pushButton
method pushButton(var eventInfo Event)
var
  x  Number
endVar
x = 3.9
msgInfo("The floor of " + String(x) + " is", floor(x))   ; displays 3.0
msgInfo("The round of " + String(x) + " is", x.round(0)) ; displays 4.0
endMethod


See Also for Number::floor
See Also

ceil


Number::fraction
fraction

See Also	Example	Number Type

Beginner

Method

Returns the fractional part of a number.

Syntax

fraction ( ) Number

Description

fraction returns the fractional part of a number, the part to the right of the decimal.


Example for Number::fraction
fraction Example

In the following example, the pushButton method for fractButton displays the fraction portion of a numeric variable:

; fractButton::pushButton
method pushButton(var eventInfo Event)
var
  myNum Number
endVar
myNum = 12.23
msgInfo("Fractional part of " + String(myNum),
         myNum.fraction())                  ; displays .23
endMethod


See Also for Number::fraction
See Also

mod


Number::fv
fv

See Also	Example	Number Type

Beginner

Method

Returns the future value of a series of equal payments.

Syntax

fv ( const interestRate Number, periods Number ) Number

Description

fv returns the future value of a series of equal payment periods, invested at interest rate interestRate. interestRate is expressed as a decimal number (like .12), not as a percentage (12%). Make sure the rate period matches the deposit period; that is, if the deposits are monthly, the interest rate should be monthly too.

The formula used is

FV = payment(pow(1 + rate, periods) - 1) / rate

fv is sometimes called the future or compound value of an annuity because you can use it to calculate the amount accumulated in an annuity fund when making regular, equal payments over time.


Example for Number::fv
fv Example

The following example calculates how much a 14.5% Individual Retirement Account would be worth if $166.67 were deposited every month for 30 years.

; findFutureVal::pushButton
method pushButton(var eventInfo Event)
var
  depositAmt,
  intRate,
  numPayments,
  iraValue       Number
endVar
intRate = .145 / 12      ; convert yearly interest to monthly interest
numPayments = 360        ; monthly payments for 30 years
depositAmt = 166.67      ; monthly deposit amount ($2000 a year)
iraValue = depositAmt.fv(intRate, numPayments)
msgInfo("IRA Value", "Depositing " + String(depositAmt) +
        " a month for " + String(numPayments/12) + " years at " +
        String(intRate * 12 * 100) + "% yields " + String(iraValue) +
        ". You'll be old but you'll be rich!")
; displays "Depositing 166.67 a month for 30 years
;           at 14.50% yields 1,027,394.23 ..."
endMethod


See Also for Number::fv
See Also

pmt

pv


Number::ln
ln

See Also	Example	Number Type

Beginner

Method

Returns the natural logarithm of a numeric expression.

Syntax

ln ( ) Number

Description

ln calculates the natural logarithm to the base e of a positive value. The constant e is approximated by the value 2.7182845905. If the value is 0 or negative, ln fails.

The inverse method is exp. Use log to compute base 10 logarithms.


Example for Number::ln
ln Example

In the following example, the pushButton method for the findNatLog button calculates and displays the natural logarithm of several numbers:

; findNatLog::pushButton
method pushButton(var eventInfo Event)
var
  x  Number
endVar
x = 2.71828
msgInfo("Natural log of " + Format("W10.6", x), ln(x)) ; displays 1.00
x = 7.3891
msgInfo("Natural log of " + Format("W10.6", x), ln(x)) ; displays 2.00
x = 20.0855
msgInfo("Natural log of " + Format("W10.6", x), ln(x)) ; displays 3.00
endMethod


See Also for Number::ln
See Also

exp

log


Number::log
log

See Also	Example	Number Type

Beginner

Method

Returns the base 10 logarithm of a numeric expression.

Syntax

log ( ) Number

Description

log returns the base 10 logarithm of a value or numeric expression. If the value is 0 or negative, log fails.

Use ln to compute natural logarithms.


Example for Number::log
log Example

; findLog::pushButton
method pushButton(var eventInfo Event)
var
  x Number
endVar
x = 10
msgInfo("The logarithm of " + String(x), log(x)) ; displays 1.00
x = 100
msgInfo("The logarithm of " + String(x), log(x)) ; displays 2.00
x = 1000
msgInfo("The logarithm of " + String(x), log(x)) ; displays 3.00
endMethod


See Also for Number::log
See Also

exp

ln


Number::max
max

See Also	Example	Number Type

Beginner

Procedure

Returns the larger of two numbers.

Syntax

max ( const x1 AnyType, const x2 AnyType ) AnyType

Description

max returns the larger of the two values x1 and x2.


Example for Number::max
max Example

In the following example, you want to find the medical deduction you're allowed for tax purposes. The pushButton method for findMedDeduct finds the maximum of 7.5% of AGI or medExpense, then deducts 7.5% of AGI from the result. Finding the maximum number first ensures that the calculation won't return a negative number.

; findMedDeduct
method pushButton(var eventInfo Event)
var
  medExpense,
  AGI        Number
endVar
AGI = 32000.45
medExpense = 4035.24
msgInfo("Allowed Medical Deduction",
        max(medExpense, AGI * .075) - (AGI * .075))  ; displays 1,635.21
; assumes that you can deduct only that part of your medical and dental
; expenses greater than 7.5% of Adjusted Gross Income
endMethod


See Also for Number::max
See Also

min


Number::min
min

See Also	Example	Number Type

Beginner

Procedure

Returns the smaller of two numbers.

Syntax

min ( const x1 AnyType, const x2 AnyType ) AnyType

Description

min returns the smaller of the two values, x1 and x2.


Example for Number::min
min Example

In the following example, you want to calculate the maximum amount of tax-deductible charitable contributions, and no more than 30% of adjusted gross income can be deducted. The pushButton method for the findCharityDeduct button finds and displays the minimum of 30% of AGI and charity.

; findCharityDeduct::pushButton
method pushButton(var eventInfo Event)
var
  charity,
  AGI       Number
endVar
AGI = 32000.45     ; Adjusted Gross Income
charity = 12000    ; charitable contributions for the year
msgInfo("Allowed Charity Deduction", min(charity, AGI * .30))
; displays 9,600.13
; assumes charitable contributions up to 30% of AGI
; are allowed as deductions
endMethod


See Also for Number::min
See Also

max


Number::mod
mod

See Also	Example	Number Type

Beginner

Method

Returns the remainder when one number is divided by another.

Syntax

mod ( const modulo Number ) Number

Description

mod returns the remainder (or modulus) when a number is divided by the value of modulo. If the number is greater than the value of modulo, mod returns the remainder of the number divided by modulo. If the number is less than modulo, mod returns the number. If the number equals modulo, mod returns 0. The following table shows examples of each case.

Fraction	ObjectPAL code	Return value
5/2	num = 5 num.mod(2)	1
2/5	num = 2 num.mod(5)	2
2/2	num = 2 num.mod(2)	0


Example for Number::mod
mod Example

In the following example, the pushButton method for the showRemainder button calculates and displays the modulus for a series of division operations:

; showRemainder::pushButton
method pushButton(var eventInfo Event)
var
  x Number
endVar
x = 8
msgInfo("The remainder of " + String(x) + "/" + "3",
          x.mod(3))                    ; displays 2
msgInfo("The remainder of " + String(x) + "/" + "12",
         x.mod(12))                    ; displays 8
x = -2
msgInfo("The remainder of " + String(x) + "/" + "10",
          x.mod(10))                   ; displays -2
x = -10
msgInfo("The remainder of " + String(x) + "/" + "-100",
        x.mod(-100))                   ; displays -10
endMethod


See Also for Number::mod
See Also

fraction


Number::number
number

See Also	Example	Number Type

Beginner

Procedure

Casts a value as a Number.

Syntax

number ( const value AnyType ) Number

Description

number casts (converts) value to a Number. value must be in the form of a valid number that can be entered in a field. number is used to cast a non-numeric type to a Number when a numeric operand is required in an expression, or a numeric argument is required in a procedure or method. number behaves the same as numVal.


Example for Number::number
number Example

In the following example, a variable x is declared as a String, then assigned a string of numbers. The pushButton method for the showDouble button casts x to a Number before doubling it, then displays the result:

; showDouble::pushButton
method pushButton(var eventInfo Event)
var
  x  String
endVar
x = "1123.54"
; cast x to a Number before multiplying by 2
msgInfo("Double " + x + " is", Number(x) * 2) ; displays 2,247.08
endMethod


See Also for Number::number
See Also

numVal


Number::numVal
numVal

See Also	Example	Number Type

Procedure

Casts a value as a Number.

Syntax

numVal ( const value AnyType ) Number

Description

numVal casts (converts) value to a Number. value must be in the form of a valid number that can be entered in a field. numVal is most often used to cast a non-numeric type to a Number when a numeric operand is required in an expression, or a numeric argument is required in a procedure or method. numVal behaves the same as number.


Example for Number::numVal
numVal Example

In the following example, a variable x is declared as a String, then assigned a string of numbers. The pushButton method for the showDouble button casts x to a Number before doubling it, then displays the result:

; showDouble::pushButton
method pushButton(var eventInfo Event)
var
  x  String
endVar
x = "1123.54"
; cast x to a Number before multiplying by 2
msgInfo("Double " + x + " is", numVal(x) * 2) ; displays 2,247.08
endMethod


See Also for Number::numVal
See Also

number


Number::pmt
pmt

See Also	Example	Number Type

Beginner

Method

Returns the periodic payment required to pay off a loan.

Syntax

pmt ( const interestRate Number, const periods Number ) Number

Description

pmt returns the constant, regular payment required to amortize (pay off) a loan. The formula used is:

PMT = p * i / ( 1 - ( 1 + i ) -t )

where p = principal amount, i = effective interest rate per period, and t = term of the loan (number of payment periods).

Payments are considered due at the end of each period.

pmt works for amortization-type loans (for example, conventional home mortgages), in which part of the payment consists of interest on the remaining principal, and the remainder pays off part of the principal of the loan. pmt does not work for consumer-type loans, such as repayments of credit accounts or automobile loans.

The interest rate used in pmt is expressed in interestRate as a decimal number (like .12), not as a percentage (12%). Make sure the rate period matches the payment periods; that is, if the payments are monthly, the interest rate should also be monthly. Since the interest rate usually quoted for amortization loans (mortgages) is annual, divide it by 12 for monthly payments, by 4 for quarterly payments, and so on.

Start with the nominal annual interest rate quoted, not the accompanying annual percentage rate (APR).


Example for Number::pmt
pmt Example

In the following example, the pushButton method for the findPayment button calculates the monthly payment for a 24-month loan of $1,000 at 12%:

; findPayment::pushButton
method pushButton(var eventInfo Event)
var
  monthlyPayment,
  loanAmt,
  intRate,
  numPayments Number
endVar
loanAmt = 1000        ; borrow $1000
intRate = .12 / 12    ; 12 percent annual interest
numPayments = 24      ; 1 payment per month for 2 years
monthlyPayment = loanAmt.pmt(intRate, numPayments)
msgInfo("Monthly payment", "The monthly payment for a loan of " +
        String(loanAmt) + " at " + String(intRate * 12 * 100) +
        "% interest for " + String(SmallInt(numPayments)) +
        " months is " + String(monthlyPayment))    ; payment is $47.07
endMethod


See Also for Number::pmt
See Also

fv

pv


Number::pow
pow

See Also	Example	Number Type

Beginner

Method

Raises a number to a power.

Syntax

pow ( const exponent Number ) Number

Description

pow returns the value of a number raised to the power specified in exponent. If the return value is larger than 10308 or smaller than 10-307, it causes an error.


Example for Number::pow
pow Example

In the following example, the pushButton method for the raiseTwo button calculates rootexpn and displays the result:

; raiseTwo::pushButton
method pushButton(var eventInfo Event)
var
  root,
  expn    Number
endVar
root = 2
expn = 8
msgInfo(String(root) + " raised to the power of " +
        String(expn), root.pow(expn)) ; displays 256
endMethod


See Also for Number::pow
See Also

pow10

ln

log


Number::pow10
pow10

See Also	Example	Number Type

Beginner

Method

Calculates 10 to a specified power.

Syntax

pow10 ( ) Number

Description

pow10 returns the value of 10 raised to a specified power.


Example for Number::pow10
pow10 Example

In the following example, the pushButton method for the raiseTen button calculates 10expn and displays the result:

; raiseTen::pushButton
method pushButton(var eventInfo Event)
var
  expn,
  result Number
endVar
expn = 9
result = expn.pow10()
msgInfo("Ten raised by a power of " + String(expn),
        format("EC", result))                  ; displays 1,000,000,000
endMethod


See Also for Number::pow10
See Also

pow

ln

log


Number::pv
pv

See Also	Example	Number Type

Beginner

Method

Returns the present value of a series of equal payments.

Syntax

pv ( const interestRate Number, const periods Number ) Number

Description

pv calculates the present value of equal, regular payments on a loan (or withdrawals from an investment) at a rate specified in interestRate for a number of periods specified in periods. The payments reduce the principal, but the remaining balance continues to generate and compound interest.

The formula used is

PV = payment * (1- (1+rate)-n / rate)

where n is the number of periods.

The interest rate used in pv is expressed as a decimal number (like .12), not as a percentage (12%). Make sure the rate period matches the payment period; that is, if the payments are monthly, the interest rate should also be monthly. You can use pv to calculate how large a mortgage you can afford. (Use pmt to work in reverse and find the monthly payment needed to amortize a given amount.) You can also use pv to calculate the amount you'll need to purchase an annuity that will make regular, equal payments to you over time. For this reason, pv is sometimes called the present value of an annuity.


Example for Number::pv
pv Example

Suppose you can afford to pay $1,200 per month and can get a 30-year mortgage at a fixed annual rate of 9% (0.75% monthly). The pushButton method for findPV calculates and displays the loan amount for which you can qualify:

; findPV::pushButton
method pushButton(var eventInfo Event)
var
  payAmt,
  intRate,
  term,
  mortgage    Number
endVar
payAmt   = 1200
intRate  = .09 / 12             ; monthly interest for 9% a year
term     = 360                  ; 30 years (expressed in months)
mortgage = payAmt.pv(intRate, term)
msgInfo("Maximum Mortgage", "If you can pay " + String(payAmt) +
        " a month for " + String(term /12) + " years at " +
        String(intRate * 12 * 100) + "% you can qualify for " +
        format("E$C", mortgage))     ; displays $149,138
endMethod

Suppose when you retire you would like to withdraw $2,500 each month for 30 years from an annuity account that accumulates 7.5% annual interest. This pushButton method for the findAnnuity button calculates how much you'll need in the account:

; findAnnuity::pushButton
method pushButton(var eventInfo Event)
var
  monthlyAmt,
  term,
  intRate,
  investment  Number
endVar

monthlyAmt = 2500.00  ; monthly amount you want annuity to pay
term = 360            ; 30 years, converted to 360 months
intRate = .075/12     ; 7.5% a year, converted to monthly rate
investment = monthlyAmt.pv(intRate, term)  ; what you need to start with
msgInfo("Annuity Required", "For an annuity to return $" +
        String(monthlyAmt) + " a month at " +
        format("W4.2", intRate * 12 * 100) + "% for " +
        String(SmallInt(term / 12)) +
        " years, the original amount must be " +
        String(investment))                ; displays 357,544.07
endMethod


See Also for Number::pv
See Also

fv

pmt


Number::rand
rand

See Also	Example	Number Type

Beginner

Procedure

Generates a random value ranging from 0 to 1.

Syntax

rand ( ) Number

Description

rand generates a random value ranging from 0 to 1.


Example for Number::rand
rand Example

In the following example, the pushButton method for the getRand button calculates and displays a random number x between 1 (minNum) and 10 (maxNum).

; getRand::pushButton
method pushButton(var eventInfo Event)
var
  x,
  minNum,
  maxNum  SmallInt
endVar
minNum = 1
maxNum = 10
; get a random integer between minNum and maxNum
x = SmallInt(rand() * (maxNum - minNum + 1) + minNum)
msgInfo("A number between " + String(minNum) + " and " +
        String(maxNum),  x)
endMethod


See Also for Number::rand
See Also

truncate


Number::round
round

See Also	Example	Number Type

Beginner

Method

Rounds a number to a specified number of decimal places.

Syntax

round ( const places SmallInt ) Number

Description

round returns a number rounded to the number of decimal places specified in places.


Example for Number::round
round Example

In the following example, the pushButton method for the showRound button rounds a number to 4 decimal places and displays the result, then rounds and displays a number to the nearest 1000.

; showRound::pushButton
method pushButton(var eventInfo Event)
var
  roundMe Number
endVar
roundMe = 1.2356838
msgInfo(format("W9.7",roundMe) + " rounded to 4 decimal places",
          format("W6.4", roundMe.round(4))) ; displays 1.2357
roundMe = 678394
msgInfo(String(roundMe) + " rounded to -3 decimal places",
          roundMe.round(-3))                ; displays 678,000
endMethod


See Also for Number::round
See Also

truncate

ceil

floor


Number::sin
sin

See Also	Example	Number Type

Beginner

Method

Returns the sine of an angle.

Syntax

sin ( ) Number

Description

sin returns a numeric value between -1 and 1 for the sine of a value representing the size of the angle in radians.


Example for Number::sin
sin Example

The pushButton method for the findSin button finds the sine of a 45-degree angle:

; findSin::pushButton
method pushButton(var eventInfo Event)
var
  fortyFiveDegrees Number
endVar
fortyFiveDegrees  = PI / 4.0
msgInfo("The sine of 45 degrees",
         format("W14.12", fortyFiveDegrees.sin()))
; displays 0.707106781187
endMethod


See Also for Number::sin
See Also

asin

cos

tan


Number::sinh
sinh

See Also	Example	Number Type

Beginner

Method

Returns the hyperbolic sine of an angle.

Syntax

sinh ( ) Number

Description

sinh returns the hyperbolic sine of a value representing the size of the angle in radians. The formula used is

sinh ( angle ) = ( exp ( angle ) - exp  ( -angle ) ) / 2


Example for Number::sinh
sinh Example

In the following example, the pushButton method for the getHSine button finds the hyperbolic sine of a 45-degree angle:

; getHSine
method pushButton(var eventInfo Event)
var
  fortyFiveDegrees Number
endVar
fortyFiveDegrees = PI / 4.0
msgInfo("The hyperbolic sine of 45 degrees",
        format("w14.12", fortyFiveDegrees.sinh()))
; displays 0.868670961486
endMethod


See Also for Number::sinh
See Also

sin

cos

tan


Number::sqrt
sqrt

See Also	Example	Number Type

Beginner

Method

Returns the square root of a number.

Syntax

sqrt ( ) Number

Description

sqrt returns the square root of a positive value or numeric expression.


Example for Number::sqrt
sqrt Example

In the following example, the pushButton method for the getSqrt button assigns the value from fieldOne (an unbound field object) to x, checks to see if x is negative, and, if not, calculates and displays the square root of x:

; getSqrt::pushButton
method pushButton(var eventInfo Event)
var
  x Number
endVar
x = fieldOne
if x < 0 then
  msgStop("Sorry",
          "Can't take the square root of a negative number.")
else
  msgInfo("The square root of " + String(x),
           format("w14.6", sqrt(x))) ; displays result
endif
endMethod


See Also for Number::sqrt
See Also

exp


Number::tan
tan

See Also	Example	Number Type

Beginner

Method

Returns the tangent of an angle.

Syntax

tan ( ) Number

Description

tan returns the tangent of a value or numeric expression representing the size of the angle in radians. tan diverges at -pi/2, pi/2, and every ± pi radians from those values.


Example for Number::tan
tan Example

In the following example, the pushButton method for the getTan button calculates the tangent of a 45-degree angle and displays the result:

; getTan::pushButton
method pushButton(var eventInfo Event)
var
  fortyFiveDegrees Number
endVar
fortyFiveDegrees = PI / 4.0
msgInfo("Tangent of 45 degrees", fortyFiveDegrees.tan())   ; displays 1.00
endMethod


See Also for Number::tan
See Also

atan

atan2

cos

sin


Number::tanh
tanh

See Also	Example	Number Type

Beginner

Method

Returns the hyperbolic tangent of an angle.

Syntax

tanh ( ) Number

Description

tanh returns the hyperbolic tangent of a value or numeric expression representing the size of the angle in radians. The formula is

tanh ( angle ) = sinh ( angle ) / cosh ( angle )


Example for Number::tanh
tanh Example

In the following example, the pushButton method for a button named getHTan calculates the hyperbolic tangent of a 60-degree angle and displays the result:

; getHTan::pushButton
method pushButton(var eventInfo Event)
var
  sixtyDegrees Number
endVar
sixtyDegrees = PI / 3.0
msgInfo("The hyperbolic tangent of 60 degrees",
        format("W14.12", sixtyDegrees.tanh()))
; displays .780714435359
endMethod


See Also for Number::tanh
See Also

atan

cos

sin


Number::truncate
truncate

See Also	Example	Number Type

Beginner

Method

Truncates a number to a specified number of decimal places.

Syntax

truncate ( const places SmallInt ) Number

Description

truncate returns a number truncated towards 0 to the number of decimal places in places. It does not round the value.


Example for Number::truncate
truncate Example

In the following example, the pushButton method for the chopAValue button assigns the value from fieldOne (an unbound field object) to x, truncates x to 3 decimal places, and displays the truncated result:

; chopAValue::pushButton
method pushButton(var eventInfo Event)
var
  x Number
endVar
x = fieldOne
msgInfo("x truncated to 3 places",
        format("W14.6", x.truncate(3))) ; displays truncated version of x
endMethod


See Also for Number::truncate
See Also

ceil

floor

round


OLE Type

Changes

OLE is an acronym for Object Linking and Embedding, a protocol that provides access to the functionality of another application without having to leave Paradox and open that application each time you want to make a change.

For example, suppose you have tables that contain bitmap graphics, and you want to create a Paradox application that enables users to edit those graphics. One approach is to create the graphics using a paint program that is an OLE server (defined below). Then, use ObjectPAL OLE type methods to make the functionality of the paint program available to your users (assuming, of course, that your users have the paint program installed on their systems).

Note:	ObjectPAL and Paradox also support DDE (for Dynamic Data Exchange), another protocol for sharing data.

The following terms are used when discussing OLE operations:

OLE server is an application that can provide access to its documents via the OLE mechanism. Paradox is an OLE server.

OLE container is an application that can use the OLE mechanism to access documents created by an OLE server. Paradox is an OLE container.

OLE object is a document created using an OLE server. It contains the data you want to use in your Paradox application.

OLE variable is an ObjectPAL variable declared to be of type OLE. An OLE variable provides a handle for manipulating an OLE object. In other words, you can use OLE variables in ObjectPAL code to manipulate OLE objects.

OLE applications execute asynchronously---that is, code in each application executes independently; one application does not wait for the other. When you write a method that launches an OLE server for user input, declare the OLE variable in a Var window (or in a method window above the method keyword). This ensures that the OLE variable will be available (and in scope) even if the method finishes before the server application is closed.

The OLE type includes several derived methods from the AnyType type.

Methods for the OLE Type

AnyType		OLE
blank		canLinkFromClipboard
dataType		canReadFromClipboard
isAssigned		edit
isBlank		enumServerClassNames
isFixedType		enumVerbs
unAssign		getServerName
		insertObject
		isLinked
		linkFromClipboard
		readFromClipboard
		updateLinkNow
		writeToClipboard


Changes to OLE type methods

The following table lists new methods and methods that were changed for version 5.0.

New	Changed

canLinkFromClipboard	(None)

enumServerClassNames

insertObject

isLinked

linkFromClipboard

updateLinkNow


OLE::canLinkFromClipboard
canLinkFromClipboard	5.0

See Also	Example	OLE Type

Method

Reports whether an OLE object can be linked from the Clipboard to an OLE variable.

Syntax

canLinkFromClipboard ( ) Logical

Description

canLinkFromClipboard returns True if an OLE object can be linked from the Clipboard to an OLE variable; otherwise, it returns False. After an OLE object is linked (as opposed to read) from the Clipboard, changes made to the OLE object while in Paradox affect the underlying file.

This method is useful in a routine that finds out whether a linkFromClipboard operation is possible. For example, you can make a menu item dimmed and inactive when this method returns False.


Example for OLE::canLinkFromClipboard
canLinkFromClipboard Example

This example tries to link an OLE object from the Clipboard to a field in a specified record in a table. If it can't, it prompts the user to embed (read) the OLE object instead.

; btnLinkOrRead::pushButton
method mouseClick(var eventInfo MouseEvent)

var

stReadOLE	String

oleObj	OLE

tcEmployee	TCursor

endVar

; Move to specified record in table.

tcEmployee.open("employee")

tcEmployee.locate("EmpName", "Frank Borland")

; Link if you can, otherwise read (embed).

switch

case oleObj.canLinkFromClipboard() :

oleObj.linkFromClipboard()

case oleObj.canReadFromClipboard() :

stReadOLE = msgQuestion("Can't link OLE object.",

                              "Do you want to embed it instead?")

if stReadOLE = "Yes" then

oleObj.readFromClipboard()

else

message("No update.")

return

endIf

otherwise :

msgInfo("Can't link or embed the OLE object.",

              "The Clipboard may be empty.")

return

endSwitch

; Update the table.

tcEmployee.edit()

tcEmployee.VoiceSample = oleObj

tcEmployee.endEdit()

message("Update complete")

endMethod


See Also for OLE::canLinkFromClipboard
See Also

linkFromClipboard

canReadFromClipboard

readFromClipboard


OLE::canReadFromClipboard
canReadFromClipboard

See Also	Example	OLE Type

Method

Reports whether an OLE object can be read (embedded) from the clipboard into an OLE variable.

Syntax

canReadFromClipboard ( ) Logical

Description

canReadFromClipboard returns True if an OLE object can be read (embedded) from the Clipboard into an OLE variable; otherwise, it returns False. After an OLE object is read (as opposed to linked) from the Clipboard, changes made to the OLE object while in Paradox do not affect the underlying file.

This method is useful in a routine that finds out whether a readFromClipboard operation is possible. For example, you can make a menu item dimmed and inactive when this method returns False.


Example for OLE::canReadFromClipboard
canReadFromClipboard Example

See the example for canLinkFromClipboard.


See Also for OLE::canReadFromClipboard
See Also

readFromClipboard

linkFromClipboard

canLinkFromClipboard


OLE::edit
edit

See Also	Example	OLE Type

Method

Launches the OLE server and lets the user edit the object or take some other action.

Syntax

edit ( const oleText String, const verb SmallInt ) Logical

Description

edit launches the OLE server application and gives control to the user. The argument oleText is a string that Paradox passes to the server application. Many server applications can display oleText in the title bar. edit passes verb to the application server to specify an action to take.

verb is an integer that corresponds to one of the OLE server's action constants. The meaning of verb varies from application to application, so a verb that is appropriate for one application may not be appropriate for another. Use enumVerbs to learn what verbs the server supports, then use one of them in the call to edit.

If you want to launch an OLE server without using enumVerbs first, use 0 (zero) for verb---this value is the primary verb, and should be supported by all OLE servers.


Example for OLE::edit
edit Example

Suppose the Pics table stores Paintbrush graphics in an OLE field. The table has two fields: PicName (A8) and PicData (O). When you click editButton, the code locates a record in the table then uses edit to invoke Paintbrush, thereby enabling the user to edit the graphic in the OLE field. When you click updateButton, the code updates the Pics table.

Code is attached to the page's Var window, editButton's pushButton method, and updateButton's pushButton method. Variables are declared in the page's Var window for two reasons: first, to make them available to both buttons; second, it makes sure the OLE variable is still available, even if this method finishes executing before the user closes Paintbrush.

The page's Var window contains the following code:

 var
   olePic  OLE
   picTC   TCursor
endVar

The editButton's pushButton method contains the following code:

 method pushButton(var eventInfo Event)
   if picTC.open ("pics.db") then
      if picTC.locate("PicName", "blueLine") then

; The PicData field stores OLE objects

; created using Paintbrush.
         olePic = picTC.PicData

; Launch Paintbrush so user can edit the bitmap.
         olePic.edit("PDOXWIN", 0)
      else
         msgStop("Stop", "Couldn't find blueLine.")
      endIf
   else
      msgStop("Stop", "Couldn't open table.")
   endIf
endMethod

The updateButton's pushButton method contains the following code:

 method pushButton(var eventInfo Event)
   picTC.edit()
   picTC.PicData = olePic
   picTC.endEdit()
   picTC.close()
endMethod


See Also for OLE::edit
See Also

enumVerbs


OLE::enumServerClassNames
enumServerClassNames	5.0

See Also	Example	OLE Type

Method

Lists registered OLE servers.

Syntax

enumServerClassNames ( var serverClasses DynArray[ ] String ) Logical

Description

enumServerClassNames lists the OLE servers registered in the user's system. The information is assigned to serverClasses, a DynArray that you must declare and pass as an argument. This method returns True if it succeeds; otherwise, it returns False.

The indexes of the DynArray are the end-user server names (for example, "Paradox Table"), and the corresponding items are the names used internally by OLE (for example, "PdoxWin5Table").

Use enumServerClassNames to get a server name to pass to insertObject.


Example for OLE::enumServerClassNames
enumServerClassNames Example

See the example for insertObject.


See Also for OLE::enumServerClassNames
See Also

enumVerbs

insertObject


OLE::enumVerbs
enumVerbs

See Also	Example	OLE Type

Method

Lists the actions supported by an OLE server.

Syntax

enumVerbs ( var verbs DynArray[ ] SmallInt ) Logical

Description

enumVerbs creates a DynArray listing the action commands (called verbs) supported by the OLE server associated with an OLE variable.

When you associate an OLE variable with an OLE object, Paradox knows which server application generated the object. Through OLE methods such as enumVerbs and getServerName, you can ask questions of the server.

enumVerbs asks the server for a list of supported action commands, then loads them into a dynamic array. Each DynArray index corresponds to the name that the server gives to a specific action; DynArray items correspond to the action constant used by the server. Because the meaning of verb varies from application to application, you need to know precisely what verb to pass to the server to instruct it to do what you want.

For example, Windows Paintbrush is an OLE server. Paintbrush has only one action command, named "Edit," with a value of 0. The following code reads from the Clipboard a graphic generated with Paintbrush, generates a dynamic array with enumVerbs, then displays the contents of the DynArray in a dialog box.

var
  oleVar OLE
  dy DynArray[] SmallInt
endVar

oleVar.readFromClipboard() ; read from the Clipboard into oleVar
oleVar.enumverbs(dy)       ; generate a DynArray of verbs
dy.view()                  ; display DynArray contents in a dialog

The preceding code assumes the Clipboard contains an OLE object (a graphic image in this case) that was generated in Paintbrush. The dynamic array contains one element whose index is "Edit" and whose value is 0. Some OLE servers use more than one verb, and would therefore generate a larger list. Other OLE servers use "Edit" but preface the name with an ampersand, such as "&Edit". The ampersand prefix is useful when you want to display action names in a menu. Paradox recognizes the ampersand as a special character and displays "&Edit" as Edit, and designates E as an accelerator key.

Refer to Menu methods for more information about menus and special characters.


Example for OLE::enumVerbs
enumVerbs Example

For the following example, assume the Sounds table has an alpha field named SoundName and an OLE field named SoundData. Data in the OLE field were copied from the Windows Sound Recorder to the Clipboard. The following example uses enumVerbs to create a pop-up menu that lists the verbs (actions) for Sound Recorder when you click a button named btnEditSounds. Because Sound Recorder supports two actions (Edit and Play), this example lets the user choose to edit or play the sound contained in the OLE field.

The following code is attached to the button's Var window. It declares the OLE variable. By declaring the OLE variable in the Var window, you ensure that the variable is available, even if the method finishes before the server application is closed.

; btnEditSounds::Var

Var

   oleVar OLE

endVar

The following code is attached to the button's built-in pushButton method. It builds and displays a pop-up menu and launches the server application.

; btnEditSounds::pushButton
method pushButton(var eventInfo Event)
var
  oleVar  OLE
  p       PopUpMenu
  verbs   DynArray[] SmallInt
  tc      TCursor
  mChoice, tagName String
endvar
soundName = "tada.wav"
tblName = "Sounds.db"

if tc.open(tblName) then
  if tc.locate(1, soundName) then ; Search in first field for tada.wav
    oleVar = tc.SoundData    ; Assign field value to OLE var
    oleVar.enumVerbs(verbs)  ; Get list of Sound Recorder actions.
    forEach tagName in verbs ; Create a pop-up menu of verbs.
      p.addText(tagName) ; Sound Recorder's verbs are &Edit and &Play
    endForEach
    mChoice = p.show()  ; display "Edit" and "Play" in the pop-up menu

    ; If the user selects from the menu,

    ; pass the selected "verb" to the
    ; edit method. verbs[mChoice] evaluates to 0 or 1.
    ; "PdoxWin" appears in Sound Recorder's title bar

    ; when Edit is selected
    if not mChoice.isBlank() then
      oleVar.edit("PdoxWin", verbs[mChoice])
    endIf

  else
    errorShow("Can't find " + soundName + ".")
  endIf
else
  errorShow("Can't open " + tblName + ".")
endIf

endMethod


See Also for OLE::enumVerbs
See Also

enumServerClassNames

getServerName

readFromClipboard


OLE::getServerName
getServerName

See Also	Example	OLE Type

Method

Reports the name of the OLE server for an OLE object.

Syntax

getServerName ( ) String

Description

getServerName returns as a string the name of the OLE server for an OLE object. This method is useful when you want to inform the user of the OLE server's name.


Example for OLE::getServerName
getServerName Example

For the following example, assume the Media table has an alpha field named MediaName, an alpha field named ServerName, and an OLE field named MediaData. The following code scans through Media's records, filling the ServerName field with the name of the OLE server that generated data in the MediaData field.

; getServerName::pushButton
method pushButton(var eventInfo Event)
var
  oleVar  OLE
  tc      TCursor
endvar

if tc.open("Media") then
  tc.edit()
  scan tc for not isBlank(tc.SoundData) :
    oleVar = tc.SoundData
    tc.ServerName = oleVar.getServerName()
  endScan
  tc.close()
else
  msgStop("Error", "Can't open Media table.")
endif

endMethod


See Also for OLE::getServerName
See Also

edit

enumServerClassNames

enumVerbs


OLE::insertObject
insertObject	5.0

See Also	Example1	Example2	Example3	OLE Type

Method

Inserts a linked or embedded OLE object into an OLE variable.

Syntax

1. insertObject ( ) Logical

2. insertObject ( const fileName String , const link Logical ) Logical

3. insertObject ( const className String ) Logical

Description

insertObject assigns a linked or embedded OLE object to an OLE variable. This method returns True if the assignment succeeds; otherwise, it returns False.

Syntax 1 invokes the Insert Object dialog box, just as if you had chosen Edit | Insert Object interactively. It is up to the user to supply any necessary information and close the dialog box. For example, the user can choose Create New (to insert a new OLE object) or Create From File (to insert an existing OLE object from a file). Choosing Create New launches the server application for user input; choosing Create From File does not.

Syntax 2 inserts an object from the file specified in fileName without launching the server application for user input. The argument link specifies whether to link to the file. If link is True, changes made to the object in Paradox are reflected in the underlying file. If link is False, changes made in Paradox do not affect the file.

Syntax 3 launches the server application for user input and inserts an object from the class specified in className, where className is the name of a registered OLE server class. Use enumServerClassNames to get a list of OLE server class names.


Example 1 for OLE::insertObject
insertObject Example 1

In the following example, a form contains buttons named btnInsertOLE and btnEditOLE and a field object named mugShot which is bound to an OLE field named MugShot in a table in the form's data model. The variables oleVar and loInserted are declared in the page's Var window for two reasons: to make them available to both buttons, and to ensure that the OLE variable is available if a method finishes before the server application is closed.

The following code is attached to the page's Var window. It declares the OLE variable oleVar and a Logical flag variable loInserted that tracks whether an OLE object was inserted into the OLE variable.

; thePage::Var

Var

oleVar	OLE

loInserted	Logical

endVar

The following code is attached to the pushButton method of btnInsertOLE. It displays the Insert Object dialog box so the user can insert an OLE object.

; btnInsertOLE :: pushButton

method pushButton(var eventInfo Event)

if not oleVar.insertObject() then ; Invoke Insert Object dialog box.

errorShow()

loInserted = No

return

else

loInserted = Yes

endIf

endMethod

The following code is attached to the pushButton method of btnEditOLE.

; btnEditOLE :: pushButton

method pushButton(var eventInfo Event)

if not loInserted.isAssigned() then

loInserted = No

endIf

if loInserted = Yes then

edit()

mugShot.Value = oleVar

loInserted = No ; Reset the flag.

endEdit()

else

msgInfo("No OLE object to insert.",

           "Click the Insert button.")

endIf

endMethod


Example 2 for OLE::insertObject
insertObject Example 2

In the following example, a form contains a button named btnInsertOLE and a field object named fldOLE which is bound to an OLE field in a table in the form's data model. The pushButton method uses an OLE variable oleVar and insertObject to read a wave file into the OLE variable oleVar and then assign it to the field fldOLE. This example does not launch the server application for user input.

;btnInsertOLEFile :: pushButton

const

; Changes made in Paradox will not

; affect the underlying file.

kNoLink = False

endConst

var

oleVar OLE

endVar

method pushButton(var eventInfo Event)

var

stFileName,

stPrompt	String

endVar

stPrompt = "Type the file name here."

stFileName = stPrompt

stFileName.view("Enter a file name.")

if stFileName = stPrompt then

return ; User didn't type a file name and click OK.

endIf

if oleVar.insertObject(stFileName, kNoLink) then

edit()

fldOLE.Value = oleVar

endEdit()

else

errorShow("Could not insert OLE object: " + stFileName)

endIf

endMethod


Example 3 for OLE::insertObject
insertObject Example 3

Suppose you were using Paradox to maintain and publish a database for a school and each record was a course syllabus. Different instructors would likely prefer different word processor applications, so you could store syllabus data in an OLE field and let people edit it using the application of their choice (the application must be an OLE server).

In this example, suppose a form contains a table frame bound to the Courses table, and each record in the table frame contains a field object named Syllabus. The following code is attached to a button named btnAddSyllabus that lets the user add a new syllabus to the table. It gets a list of the OLE server applications installed in the user's system and displays the list in a pop-up menu. When the user chooses an application name from the pop-up menu, the call to insertObject launches the specified application.

; btnAddSyllabus :: pushButton

var

oleVar	OLE

endVar

method pushButton(var eventInfo Event)

var

puServers	PopUpMenu

stOLEServer,

stUserServer	String

dyOLEServers	DynArray[] String

endVar

; Specify a title for the pop-up menu.

puServers.addStaticText("Choose one:")

puServers.addSeparator()

; enumServerClassNames returns a DynArray where the keys are

; the external names and the corresponding items are the

; names used internally by OLE.

oleVar.enumServerClassNames(dyOLEServers)

forEach stOLEServer in dyOLEServers

puServers.addText(stOLEServer)

endForEach

stUserServer = puServers.show()

if stUserServer <> "" then

  	; insertObject uses the internal name to specify an OLE server.

if oleVar.insertObject(dyOLEServers[stUserServer]) then

action(DataBeginEdit)

Courses.Syllabus.Value = oleVar

action(DataEndEdit)

else

errorShow("Could not insert " + stOLEServer)

endIf

else

return ; User didn't choose a server.

endIf

endMethod


See Also for OLE::insertObject
See Also

canReadFromClipboard

linkFromClipboard

readFromClipboard


OLE::isLinked
isLinked	5.0

See Also	Example	OLE Type

Method

Reports whether an OLE object is a linked object.

Syntax

isLinked ( ) Logical

Description

isLinked returns True if an OLE object is a linked object; it returns False if it is an embedded object. When used with updateLinkNow this method provides a convenient way to update the linked OLE fields in a table.


Example for OLE::isLinked
isLinked Example

See the example for updateLinkNow.


See Also for OLE::isLinked
See Also

canReadFromClipboard

readFromClipboard

updateLinkNow


OLE::linkFromClipboard
linkFromClipboard	5.0

See Also	Example	OLE Type

Method

Pastes a link between an OLE object from the Clipboard and an OLE variable.

Syntax

linkFromClipboard ( ) Logical

Description

linkFromClipboard returns True if an OLE object is successfully read (pasted) from the Clipboard and linked to an OLE variable; otherwise, it returns False. Calling this method is equivalent to choosing Edit | Paste Link interactively.

After an OLE object is linked from the Clipboard, changes made to the OLE object while in Paradox affect the underlying file. Compare this method to readFromClipboard, where changes made in Paradox do not affect the underlying file.


Example for OLE::linkFromClipboard
linkFromClipboard Example

See the example for canReadFromClipboard.


See Also for OLE::linkFromClipboard
See Also

canReadFromClipboard

readFromClipboard


OLE::readFromClipboard
readFromClipboard

See Also	Example	OLE Type

Method

Pastes an OLE object from the Clipboard into an OLE variable.

Syntax

readFromClipboard ( ) Logical

Description

readFromClipboard returns True if an OLE object is successfully read (pasted) from the Clipboard into an OLE variable; otherwise, it returns False.

After an OLE object is read from the Clipboard, changes made to the OLE object while in Paradox do not affect the underlying file. Compare this method to linkFromClipboard, where changes made in Paradox affect the underlying file.


Example for OLE::readFromClipboard
readFromClipboard Example

See the example for canReadFromClipboard.


See Also for OLE::readFromClipboard
See Also

canReadFromClipboard


OLE::updateLinkNow
updateLinkNow	5.0

See Also	Example	OLE Type

Method

Updates a linked OLE object.

Syntax

updateLinkNow ( ) Logical

Description

updateLinkNow updates a linked OLE object and returns True if successful. It returns False if the OLE object is an embedded object. When used with isLinked this method provides a convenient way to update the linked OLE fields in a table.


Example for OLE::updateLinkNow
updateLinkNow Example

This example scans the Employee table and updates any linked values in the OLE field named VoiceSample.

btnUpdateLinks::pushButton

method pushButton(var eventInfo Event)

var

oleObj	OLE

tcEmployee	TCursor

endVar

tcEmployee.open("employee")

tcEmployee.edit()

scan tcEmployee :

oleObj = tcEmployee.VoiceSample    ; VoiceSample is an OLE field.

if oleObj.isLinked() then

oleObj.updateLinkNow()          ; Update the OLE variable.

tcEmployee.VoiceSample = oleObj ; Assign the new value to the field in the underlying table.

endIf

endScan

tcEmployee.endEdit()

endMethod


See Also for OLE::updateLinkNow
See Also

isLinked


OLE::writeToClipboard
writeToClipboard

See Also	Example	OLE Type

Method

Copies an OLE variable to the clipboard.

Syntax

writeToClipboard ( ) Logical

Description

writeToClipboard copies the original OLE object to the Clipboard as if the server had done the copy. This method erases the Clipboard before doing the copy.

This method returns True if an OLE object is successfully written (copied) to the Clipboard; otherwise, it returns False.


Example for OLE::writeToClipboard
writeToClipboard Example

The following example reads an OLE field in a Paradox table and assigns its value to an OLE variable. Then it writes the variable to the Clipboard, where it can be used by Paradox, or by another application. The code assumes that EMPLOYEE.DB has an alpha field named Last Name and an OLE field named Picture.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  empTC TCursor
  oleImage OLE
endVar

empTC.open("Employee.db")     ; EMPLOYEE.DB has OLE images

if empTC.locate("Last Name", "Binkley") then

  oleImage = empTC.Picture    ; Picture is an OLE field
  oleImage.writeToClipboard() ; write contents of OLE field to variable

else
  msgStop("Error", "Can't find Binkley...")
endif
endMethod


See Also for OLE::writeToClipboard
See Also

readFromClipboard


Point Type

A Point variable holds information about a point on the screen. To ObjectPAL, the screen is a two-dimensional grid, with the origin at the upper left corner of the design object's container, positive x-values extending to the right, and positive y-values extending down. A Point has an x-value and a y-value, where x and y are measured in twips (a twip is 1/1440 of a logical inch; 1/20 of a printer's point.)

Methods defined for the Point type get and set information about screen coordinates and relative positions of points. For example, the size and position properties of a design object are specified in points.

Note:	ObjectPAL calculates point values relative to the container of the design object in question. For example, if a box contains a button, ObjectPAL calculates the button's position relative to the box. If the button sits in an empty page, ObjectPAL calculates the button's position relative to the page. Methods that take or return Point values as arguments use this relative framework. The method convertPointWithRespectTo defined for the UIObject type is useful for converting values in different frameworks.

You can use Point operators (+, -, =, <, >, <=, and >=) to add, subtract, and compare Point variables. These operators operate on the x-coordinates of each point, then on the y-coordinates. For example,

var
   p1, p2, p3 Point
endVar

p1 = Point(10, 30)
p2 = Point(10, 30)
p3 = Point(10, 33)

message(p1 + p2)  ; Displays (20, 60), because 10 + 10 = 20, and 30 + 30 = 60.
message(p1 = p2)  ; Displays True. Both x- and y-coordinates are equal.
message(p1 = p3)  ; Displays False. Both coordinates must be equal.
message(p3 > p1)  ; Displays False. Both coordinates must be greater.
message(p3 >= p1) ; Displays True. Both coordinates are either greater or equal.

The Point type includes several derived methods from the AnyType type.

Methods for the Point Type

AnyType		Point
blank		distance
dataType		isAbove
isAssigned		isBelow
isBlank		isLeft
isFixedType		isRight
view		point
		setX
		setXY
		setY
		x
		y


Point::distance
distance

See Also	Example	Point Type

Method

Returns the distance between two points.

Syntax

distance ( const pt Point ) Number

Description

distance returns the number of twips between a point and pt.


Example for Point::distance
distance Example

Suppose a form contains 2 boxes: redBox and brownBox. The pushButton method for a button named getDistance finds the distance between the upper left corners of the boxes:

; brownBox::pushButton
method pushButton(var eventInfo Event)
var
  p1, p2 Point
endVar
p1 = redBox.Position
p2 = brownBox.Position
msgInfo("Distance between boxes", p1.distance(p2))
; shows the distance between the top left corner of
; redBox and the top left corner of brownBox
endMethod


See Also for Point::distance
See Also

isAbove

isBelow

isLeft

isRight

x

y


Point::isAbove
isAbove

See Also	Example	Point Type

Method

Reports whether a point is above another point.

Syntax

isAbove ( const pt Point ) Logical

Description

isAbove returns True if the y-coordinate of a point is less than the y-coordinate of pt; otherwise, it returns False.


Example for Point::isAbove
isAbove Example

In the following example, the pushButton method for convergeBoxes moves boxOne closer to boxTwo, until the two boxes converge. Assume that boxOne starts to the left of and above boxTwo. Each time the button is clicked, boxOne will move down until it is on the same vertical plane, then move to the right until it is covered by boxTwo.

; convergeBoxes::pushButton
method pushButton(var eventInfo Event)
var
  p1, p2 Point
endVar
p1 = boxOne.position             ; get the position of boxOne
p2 = boxTwo.position             ; get the position of boxTwo
if p1.isAbove(p2) then           ; compare the two points
  ; if p1 is higher than p2, move boxOne down
  boxOne.position = Point(p1.x(), p1.y() + 100)
else
  if p1.isLeft(p2) then
    ; if p1 is to the left of p2, move boxOne to the right
    boxOne.position = Point(p1.x() + 100, p1.y())
  endif
endif
endMethod


See Also for Point::isAbove
See Also

isBelow

isLeft

isRight


Point::isBelow
isBelow

See Also	Example	Point Type

Method

Reports whether a point is below another point.

Syntax

isBelow ( const pt Point ) Logical

Description

isBelow returns True if the y-coordinate of a point is greater than the y-coordinate of pt; otherwise, it returns False.


Example for Point::isBelow
isBelow Example

In the following example, the pushButton method for convergeBoxes moves boxTwo closer to boxOne, until the two boxes converge. Assume that boxTwo starts to the right of and below boxOne. Each time the button is clicked, boxTwo will move up until it is on the same vertical plane, then move to the left until it is covered by boxOne.

; convergeBoxes::pushButton
method pushButton(var eventInfo Event)
var
  p1, p2 Point
endVar
p1 = boxOne.position             ; get the position of boxOne
p2 = boxTwo.position             ; get the position of boxTwo
if p2.isBelow(p1) then           ; compare the two points
  ; if p2 is lower than p1, move boxTwo up
  boxTwo.position = Point(p2.x(), p2.y() - 100)
else
  if p2.isRight(p1) then
    ; if p2 is to the left of p1, move boxTwo to the left
    boxTwo.position = Point(p2.x() - 100, p2.y())
  endif
endif
endMethod


See Also for Point::isBelow
See Also

isAbove

isLeft

isRight


Point::isLeft
isLeft

See Also	Example	Point Type

Method

Reports whether a point is to the left of another point.

Syntax

isLeft ( const pt Point ) Logical

Description

isLeft returns True if the x-coordinate of a point is less than the x-coordinate of pt; otherwise, it returns False.


Example for Point::isLeft
isLeft Example

See the example for isAbove.


See Also for Point::isLeft
See Also

isAbove

isBelow

isRight


Point::isRight
isRight

See Also	Example	Point Type

Method

Reports whether a point is to the right of another point.

Syntax

isRight ( const pt Point ) Logical

Description

isRight returns True if the x-coordinate of a point is greater than the x-coordinate of pt; otherwise, it returns False.


Example for Point::isRight
isRight Example

See the example for isBelow.


See Also for Point::isRight
See Also

isAbove

isBelow

isLeft


Point::point
point

See Also	Example	Point Type

Procedure

Casts an expression as a Point.

Syntax

1. point ( const x LongInt, const y LongInt ) Point

2. point ( const newPoint Point ) Point

Description

point casts (converts) an expression as a Point.


Example for Point::point
point Example

In the following example, you want to vary the position of a box called rateBox. The values of an unbound field object named rateField range from 0 to 10. The position of rateBox is determined by the value in rateField. The following code is attached to the changeValue method for rateField:

; rateField::changeValue
method changeValue(var eventInfo ValueEvent)
Const
  baseXPosition = LongInt(3000)
  baseYPosition = LongInt(1000)
endConst
Var
  rateX   LongInt
endVar
try
  ; this if statement will fail if the field contents can't
  ; be compared to the integers 0 and 10 - for instance, if
  ; the user enters a string
  if eventInfo.newValue() >= 0 AND eventInfo.newValue() <= 10 then
    rateX = (eventInfo.newValue() * 400) + baseXPosition
    rateBox.Position = point(rateX, baseYPosition)
  else
    fail() ; if the value is a number but is out of range,
           ; call the fail block
  endif
onFail
  disableDefault
  eventInfo.setErrorCode(CanNotDepart)
  msgStop("Stop", "Rating should be a number between 0 and 10.")
endTry

endMethod


See Also for Point::point
See Also

setX

setY


Point::setX
setX

See Also	Example	Point Type

Method

Specifies the x-coordinate of a point.

Syntax

setX ( const newXValue LongInt )

Description

setX sets the x-coordinate of a point to newXValue. If newXValue is not a LongInt, it is converted to a LongInt, and precision may be lost.


Example for Point::setX
setX Example

In the following example, a form contains an ellipse called circleOne and a button named moveRight. The pushButton method for moveRight uses setX to change the horizontal coordinate of a point, then sets the position of circleOne to the changed point:

; moveRight::pushButton
method pushButton(var eventInfo Event)
var
  p1 Point
endVar
p1 = circleOne.position    ; get the position of the circle
p1.setX(p1.x() + 100)      ; add 100 twips to the x-coordinate
circleOne.Position = p1    ; set the new position
message(p1)                ; display coordinates
endMethod


See Also for Point::setX
See Also

setY


Point::setXY
setXY

See Also	Example	Point Type

Method

Specifies the x- and y-coordinates of a point.

Syntax

setXY ( const newXValue LongInt, const newYValue LongInt )

Description

setXY sets the x- and y-coordinates of a point to newXValue and newYValue. This method combines the functions of setX and setY. If newXValue and newYValue are not LongInts, they are converted to LongInts, and precision may be lost.


Example for Point::setXY
setXY Example

In the following example, a form contains an ellipse called circleOne and a button named moveDiagonal. The pushButton method for moveDiagonal uses setXY to change the horizontal and vertical coordinates of a point, then sets the position of circleOne to the changed point:

; moveDiagonal::pushButton
method pushButton(var eventInfo Event)
var
  p1 Point
endVar
p1 = circleOne.position               ; get the position of the circle
p1.setXY(p1.x() + 100, p1.y() + 100)  ; add 100 twips to each coordinate
circleOne.Position = p1               ; set the new position
message(p1)                           ; display coordinates
endMethod


See Also for Point::setXY
See Also

setX

setY


Point::setY
setY

See Also	Example	Point Type

Method

Specifies the y-coordinate of a point.

Syntax

setY ( const newYValue LongInt )

Description

setY sets the y-coordinate of a point to newYValue. If newYValue is not a LongInt, it is converted to a LongInt, and precision may be lost.


Example for Point::setY
setY Example

In the following example, a form contains an ellipse called circleOne and a button named moveDown. The pushButton method for moveDown uses setY to change the vertical coordinate of a point, then sets the position of circleOne to the changed point:

; moveDown::pushButton
method pushButton(var eventInfo Event)
var
  p1 Point
endVar
p1 = circleOne.position  ; get the position of the circle
p1.setY(p1.y() + 100)    ; add 100 twips to y-coordinate
circleOne.Position = p1  ; set the new position
message(p1)              ; display coordinates
endMethod


See Also for Point::setY
See Also

setX

setXY


Point::x
x

See Also	Example	Point Type

Method

Returns the x-coordinate of a point.

Syntax

x ( ) LongInt

Description

x returns the x-coordinate of a point.


Example for Point::x
x Example

See the example for setX.


See Also for Point::x
See Also

setX

setY

y


Point::y
y

See Also	Example	Point Type

Method

Returns the y-coordinate of a point.

Syntax

y ( ) LongInt

Description

y returns the y-coordinate of a point.


Example for Point::y
y Example

See the example for setY.


See Also for Point::y
See Also

setY

setX

x


PopUpMenu Type

A PopUpMenu is a list of items that appears vertically in response to an Event (usually a mouse click). When the user chooses an item from a pop-up menu, the text of that item is returned to the method. A PopUpMenu is distinct from a Menu, a list of items that appears horizontally in the application menu bar.

Note:	Choosing an item from a pop-up menu does not trigger the built-in menuAction method unless the pop-up menu is attached to a custom menu.

Using PopUpMenu methods, you can

Build a pop-up menu

Display the pop-up menu and return the selected item

Inspect the items in a pop-up menu

Provide keyboard access

The PopUpMenu type includes several derived methods from the Menu type.

Methods for the PopUpMenu Type

Menu		PopUpMenu
contains		addArray
count		addBar
empty		addBreak
remove		addPopUp
removeMenu		addSeparator
		addStaticText
		addText
		show
		switchMenu


PopUpMenu::addArray
addArray

See Also	Example	PopUpMenu Type

Method

Appends elements of an array to a pop-up menu.

Syntax

addArray ( const items Array[ ] String )

Description

addArray appends items from an array to a pop-up menu.


Example for PopUpMenu::addArray
addArray Example

The following code is attached to a field object's built-in mouseRightUp method. When the user right-clicks the field, a list of available payment types appears in a pop-up menu. The following code is attached to the mouseRightUp method for paymentField.

; paymentType::mouseRightUp
method mouseRightUp(var eventInfo MouseEvent)
var
  items  Array[4] String
  p1     PopUpMenu          ;  addArray is called for this PopUpMenu
  choice String
endVar

disableDefault              ; don't show default Font menu

items[1] = "Visa"
items[2] = "MasterCharge"
items[3] = "Check"
items[4] = "Cash"

p1.addArray(items)          ; add items array to the PopUpMenu
choice = p1.show()          ; display menu, remember choice
if not choice.isBlank() then
  self.value = choice
endif

endMethod


See Also for PopUpMenu::addArray
See Also

addBar

addBreak

addSeparator

addStaticText

addText


PopUpMenu::addBar
addBar

See Also	Example	PopUpMenu Type

Method

Adds a vertical bar to a pop-up menu.

Syntax

addBar ( )

Description

addBar adds a vertical bar to a pop-up menu. The addBar method marks the beginning of a new column of choices and inserts a vertical bar immediately before the new column. addBar is the vertical equivalent of addSeparator.


Example for PopUpMenu::addBar
addBar Example

The following code displays a pop-up menu with two columns of choices. The first two choices are displayed in the left column. The remaining choices are displayed in the right column. This code is attached to a field's mouseRightUp method.

; navField::mouseRightUp
method mouseRightUp(var eventInfo MouseEvent)
var
  navPopUp   PopUpMenu    ; to show a navigate pop-up menu
  navChoice  String       ; store the menu choice
endVar

disableDefault                        ; don't show normal menu for field

navPopUp.addText("Previous record")   ; left menu
navPopUp.addText("First record")
navPopUp.addBar()                     ; add vertical bar
navPopUp.addText("Next record")       ; right menu
navPopUp.addText("Last record")

navChoice = navPopUp.show()           ; invoke menu
; ...
; process choice
; ...

endMethod


See Also for PopUpMenu::addBar
See Also

addBreak

addSeparator


PopUpMenu::addBreak
addBreak

See Also	Example	PopUpMenu Type

Method

Starts a new column in a pop-up menu.

Syntax

addBreak ( )

Description

addBreak starts a new column in a pop-up menu. The first item added after the call to addBreak appears at the top of a column to the right of the previous column, and subsequent items appear below it. The addBreak method behaves like addBar in that it marks the beginning of a new column of choices. However, addBreak doesn't create a vertical bar between columns. addBreak doesn't create a cascading menu; use addPopUp instead.


Example for PopUpMenu::addBreak
addBreak Example

The following code displays a pop-up menu with nine choices in three vertical columns. This code is attached to whereToButton's pushButton method.

; whereToButton::pushButton
method pushButton(var eventInfo Event)
var
  navPopUp      PopUpMenu       ; a pop-up of navigation choices
  navChoice     String          ; navigation chosen
endVar

navPopUp.addText("Home")        ; left menu
navPopUp.addText("Left")
navPopUp.addText("End")

navPopUp.addBreak()             ; start second column
navPopUp.addText("Up")
navPopUp.addText("Center")
navPopUp.addText("Down")

navPopUp.addBreak()             ; start third column
navPopUp.addText("PgUp")        ; right menu
navPopUp.addText("Right")
navPopUp.addText("PgDn")

navChoice = navPopUp.show()     ; invoke menu

; ... process choice

endMethod


See Also for PopUpMenu::addBreak
See Also

addBar

addSeparator


PopUpMenu::addPopUp
addPopUp

See Also	Example1	Example2	PopUpMenu Type

Method

Adds a pop-up menu to the structure.

Syntax

addPopUp ( const menuName String, const cascadedPopup PopUpMenu )

Description

addPopUp adds menuName and cascadedPopup to the current pop-up menu structure, creating a cascading menu. menuName appears as an item in the original pop-up menu, and the first item in cascadedPopup appears next to it. Subsequent items in cascadedPopUp appear in a column below the first item.


Example 1 for PopUpMenu::addPopUp
addPopUp Example 1

The following example uses addPopUp to attach a cascading menu to a menu bar item (a menu from the Menu type). In this example, the code attached to the built-in open method for thisPage creates and displays the menu structure. The code attached to thisPage's menuAction handles the user's selection because the pop-up menus are attached to a menu bar item.

The following code is attached to the open method for thisPage:

; thisPage::open
method open(var eventInfo Event)
var
  mainMenu Menu
  subMenu1, subMenu2 PopUpMenu
endVar

  ; create 2nd level submenu
subMenu2.addText("&Time")
subMenu2.addText("&Date")

  ; add 2nd level to 1st level
subMenu1.addPopUp("&Utilities", subMenu2)

  ; add 1st level to menu bar
mainMenu.addPopUp("&File", subMenu1)

  ; display the menu bar
mainMenu.show()

endMethod

The following code is attached to thisPage's menuAction method:

; thisPage::menuAction
method menuAction(var eventInfo MenuEvent)
var
  choice String
endVar

choice = eventInfo.menuChoice()
switch
  case choice = "&Time" : msgInfo("Current Time", time())
  case choice = "&Date" : msgInfo("Today's Date", date())
endSwitch

endMethod


Example 2 for PopUpMenu::addPopUp
addPopUp Example 2

The following example uses addPopUp to create a cascading pop-up menu. This menu structure is not attached to a menu bar item. The code immediately following the call to show takes action based on the user's selection; the built-in menuAction method is not used.

The following code is attached to the mouseRightUp method for pageTwo:

; pageTwo::mouseRightUp
method mouseRightUp(var eventInfo MouseEvent)
var
  p1, p2, p3 PopUpMenu
  choice String
endVar

disableDefault                ; don't show normal pop-up menu

p2.addText("&Time")           ; build p2 and p3 submenus
p2.addText("&Date")
p3.addText("&Red")
p3.addText("&Green")
p3.addText("&Blue")

p1.addPopUp("&Utilities", p2) ; create Utilities item and attach p2 to it
p1.addPopUp("&Colors", p3)    ; create Colors item and attach p3 to it

choice = p1.show()            ; display menu and store selection to choice

switch                        ; now take action based on selection
  case choice = "&Red"   : self.color = Red
  case choice = "&Green" : self.color = Green
  case choice = "&Blue"  : self.color = Blue
  case choice = "&Time"  : msgInfo("Current Time", time())
  case choice = "&Date"  : msgInfo("Today's Date", date())
endSwitch

endMethod


See Also for PopUpMenu::addPopUp
See Also

addBreak


PopUpMenu::addSeparator
addSeparator

See Also	Example	PopUpMenu Type

Method

Adds a horizontal bar to a pop-up menu.

Syntax

addSeparator ( )

Description

addSeparator appends a horizontal bar to separate item groups in a pop-up menu. addSeparator is used to group similar commands together within a menu.


Example for PopUpMenu::addSeparator
addSeparator Example

The following example uses addSeparator to group pop-up menu commands. The following code is attached to the built-in open method for thisPage:

; thisPage::open
method open(var eventInfo Event)
var
  mainMenu Menu
  subMenu1, clrMenu PopUpMenu
endVar

clrMenu.addText("&Red")
clrMenu.addText("&Blue")
clrMenu.addText("&White")

subMenu1.addText("&Time")
subMenu1.addText("&Date")
subMenu1.addSeparator()
subMenu1.addPopUp("&Page colors", clrMenu)
subMenu1.addSeparator()
subMenu1.addText("&About")

mainMenu.addPopUp("&Utilities", subMenu1)
mainMenu.show()
endMethod

The following code is attached to the built-in menuAction method for thisPage:

; thisPage::menuAction
method menuAction(var eventInfo MenuEvent)
var
  choice String
endVar
choice = eventInfo.menuChoice()
switch
  case choice = "&Red"   : self.color = Red
  case choice = "&Blue"  : self.color = Blue
  case choice = "&White" : self.color = White
  case choice = "&Time"  : msgInfo("Current Time", time())
  case choice = "&Date"  : msgInfo("Today's Date", date())
  case choice = "&About" : eventInfo.setId(MenuHelpAbout)
endSwitch
endMethod


See Also for PopUpMenu::addSeparator
See Also

addBar

addBreak


PopUpMenu::addStaticText
addStaticText

See Also	Example	PopUpMenu Type

Method

Adds an unselectable text string to a pop-up menu.

Syntax

addStaticText ( const item String )

Description

addStaticText appends an item to a pop-up menu as unselectable text. Static text is usually used as the title (first item) in a pop-up menu.


Example for PopUpMenu::addStaticText
addStaticText Example

The following code is attached to a field object's built-in mouseRightUp method. When the user right-clicks the field, a list of available payment types appears in a pop-up menu. This example displays the first item as static text. The following code is attached to the mouseRightUp method for paymentField.

; paymentType::mouseRightUp
method mouseRightUp(var eventInfo MouseEvent)
var
  items  Array[4] String
  p1     PopUpMenu          ;  addArray is called for this PopUpMenu
  choice String
endVar

disableDefault              ; don't show default Font menu

items[1] = "Visa"
items[2] = "MasterCharge"
items[3] = "Check"
items[4] = "Cash"

                            ; display first item as static text
p1.addStaticText("Payment Method")
p1.addSeparator()           ; add a horizontal separator
p1.addArray(items)          ; add items array to the PopUpMenu
choice = p1.show()          ; display menu, remember choice
if not choice.isBlank() then
  self.value = choice
endif

endMethod


See Also for PopUpMenu::addStaticText
See Also

addText


PopUpMenu::addText
addText

See Also	Example1	Example2	PopUpMenu Type

Method

Adds a selectable text string to a pop-up menu.

Syntax

1. addText ( const menuName String )

2. addText ( const menuName String, const attrib SmallInt )

3. addText ( const menuName String, const attrib SmallInt, const id SmallInt )

Description

addText appends a selectable item to a pop-up menu. The pop-up menu can be displayed alone, or as part of a menu in the menu bar.

Syntax 1 specifies the text of the item to append in menuName.

In syntax 2, you can use attrib to preset the display attribute of menuName. ObjectPAL provides MenuChoiceAttributes constants (like MenuDisabled) for display attributes, so you don't have to memorize numeric values.

Syntax 3 is used only when the pop-up menu is attached to a Menu object. You can specify an id number (of type SmallInt) to identify the menu by number instead of by menuName. Then, in the built-in menuAction method, you use the id number to determine which menu the user chooses.

You can use syntax 3 to create a menu that provides the same functions as a built-in Paradox menu. Use a MenuCommands constant to assign a value to the id argument. Then, when the user chooses that item from a menu, Paradox performs the default action. For example, the following line adds "Next" to the puRecord PopUpMenu and uses the MenuCommands constant MenuRecordNext to assign an ID value.

puRecord.addText("Next", MenuEnabled, MenuRecordNext)

It is up to you to display, enable, and disable menu items to ensure that the Paradox operation the user triggers is valid (for example, locking a record while the form is not in edit mode is not an allowed operation).

You can also specify custom menu IDs. To do this, use the IdRanges constant UserMenu as a base constant, then add a number or a user-defined menu constant to it. For example, the following line adds "File" to the myPopup PopUpMenu and specifies an id number for that menu item:

myPopup.addText("File", MenuEnabled, UserMenu + 1)

You can use an ampersand in an item so the user can select it using the keyboard. For example, the item "&File" would display as File, and the user could choose it by pressing F. When testing the user's choice, remember to include the ampersand. In this example, the returned value would be "&File", not "File".

You can also use "\t" to put a Tab between an item and its accelerator. For example, the item "&Edit Data\tF9" would display "Edit Data" left-aligned and "F9" right-aligned. The string value returned in this case would be "&Edit Data\tF9".


Example 1 for PopUpMenu::addText
addText Example 1

The following example demonstrates a variation of addText syntax.

For this example, assume a form has an unbound field named payField. When the user right-clicks the field, a list of available payment methods appears in a pop-up menu. The user can choose from the list to insert that value into the field or press Esc to cancel. The following code goes in the Var window for payField:

; payField::var
var
  payPopUp PopUpMenu
  mChoice  String
endVar

The following code is attached to the open method for payField. When the field opens for the first time, this code adds four items to the payPopUp PopUpMenu. This code does not display the pop-up menu; it just prepares the menu for later.

; payField::open
method open(var eventInfo Event)

payPopUp.addText("Visa")
payPopUp.addText("MasterCard")
payPopUp.addText("Check")
payPopUp.addText("Cash")

endMethod

The following code is attached to payField's built-in mouseRightUp method. When the user right-clicks the field, this method displays the menu with show, then inserts the user's choice in the unbound field.

; payField::mouseRightUp
method mouseRightUp(var eventInfo MouseEvent)

disableDefault               ; don't show default pop-up menu

mChoice = payPopUp.show()    ; display menu, store selection to mChoice
if not isBlank(mChoice) then ; if user does not press Esc
  self.value = mChoice       ; insert mChoice in unbound field
endif
endMethod


Example 2 for PopUpMenu::addText
addText Example 2

The following example demonstrates a variation of addText syntax.

This example shows how you can use the id clause for pop-up menus attached to a Menu object. This code establishes user-defined constants to make it easy to remember the menu id assignments. The following code goes in the Const window for thisPage.

; thisPage::const
Const
  kMenuRed   = 1  ; define constant values for menu ids
  kMenuBlue  = 2
  kMenuWhite = 3
  kMenuTime  = 4
  kMenuDate  = 5
  kMenuAbout = 6
endConst

The following code is attached to the open method for thisPage. To control the menu display attributes, this code uses built-in constants such as MenuEnabled. To identify each menu item by number, the code uses the constants defined in the Const window for thisPage (menuRed, menuBlue, and so forth).

; thisPage::open
method open(var eventInfo Event)
var
  mainMenu Menu
  subMenu1, clrMenu, puRecord PopUpMenu
endVar

  ; add text to pop-up menus and use user-defined constants
clrMenu.addText("&Red", MenuEnabled, kMenuRed + UserMenu)
clrMenu.addText("&Blue", MenuEnabled, kMenuBlue + UserMenu)
clrMenu.addText("&White", MenuEnabled, kMenuWhite + UserMenu)

subMenu1.addText("&Time", MenuEnabled, kMenuTime + UserMenu)
subMenu1.addText("&Date", MenuEnabled, kMenuDate + UserMenu)
subMenu1.addSeparator()
subMenu1.addPopUp("&Page colors", clrMenu)
subMenu1.addSeparator()
subMenu1.addText("&About", MenuEnabled, kMenuAbout + UserMenu)

; Build a pop-up menu to attach to the Record menu.

; Use ObjectPAL MenuCommands constants to assign item IDs.

puRecord.addText("&First", MenuEnabled, MenuRecordFirst)

puRecord.addText("&Prev", MenuEnabled, MenuRecordPrevious)

puRecord.addText("&Next", MenuEnabled, MenuRecordNext)
puRecord.addText("&Last", MenuEnabled, MenuRecordLast)

  ; attach pop-up menus to mainMenu and display the menu bar
mainMenu.addPopUp("&Utilities", subMenu1)

mainMenu.addPopUp("&Record", puRecord)
mainMenu.show()
endMethod

The following code is attached to the menuAction method for thisPage. This example evaluates menu selections by ID number rather than by the name specified in menuName.

; thisPage::menuAction
method menuAction(var eventInfo MenuEvent)
var
  menuId SmallInt
endVar

menuId = eventInfo.id()   ; store menu id number in menuId

switch
  case menuId = kMenuRed + UserMenu   : self.color = Red
  case menuId = kMenuBlue + UserMenu  : self.color = Blue
  case menuId = kMenuWhite + UserMenu : self.color = White
  case menuId = kMenuTime  + UserMenu : msgInfo("Time", time())
  case menuId = kMenuDate + UserMenu  : msgInfo("Date", date())
  case menuId = kMenuAbout + UserMenu : eventInfo.setId(MenuHelpAbout)

; No extra code is needed to handle choices from the Record menu,

; because item IDs were assigned using MenuCommands constants.

; Paradox handles them automatically.
endSwitch

endMethod


See Also for PopUpMenu::addText
See Also

addStaticText


PopUpMenu::show
show

See Also	Example	PopUpMenu Type

Method

Displays a pop-up menu and returns the item selected.

Syntax

show ( [ const xTwips SmallInt, const yTwips SmallInt ] ) String

Description

show displays a pop-up menu and returns the item selected. If the user presses Esc instead of making a selection, the returned value is a zero-length string. The optional arguments xTwips and yTwips specify the coordinates, in twips, of the upper left corner of the pop-up menu. If not specified, they are set to the x- and y-coordinates of the pointer.


Example for PopUpMenu::show
show Example

For the following example, assume a form has an unbound field named payField. When the user right-clicks the field, a list of payment types appears in a pop-up menu. The user can choose from the list to insert that value into the field or press Esc to cancel. The following code goes in the Var window for payField:

; payField::var
var
  payPopUp PopUpMenu
  mChoice  String
endVar

The following code is attached to the open method for payField. When the field opens for the first time, this code adds four items to the payPopUp PopUpMenu. This code does not display the pop-up menu; it just prepares the menu for later.

; payField::open
method open(var eventInfo Event)

payPopUp.addText("Visa")
payPopUp.addText("MasterCard")
payPopUp.addText("Check")
payPopUp.addText("Cash")

endMethod

The following code is attached to payField's built-in mouseRightUp method. When the user right-clicks the field, this method displays the menu with show, then inserts the user's choice into the unbound field.

; payField::mouseRightUp
method mouseRightUp(var eventInfo MouseEvent)

disableDefault               ; don't show default pop-up menu

mChoice = payPopUp.show()    ; display menu, store selection to mChoice
if not isBlank(mChoice) then ; if user does not press Esc
  self.value = mChoice       ; insert mChoice into unbound field
endif
endMethod


See Also for PopUpMenu::show
See Also

Menu::empty


PopUpMenu::switchMenu
switchMenu

See Also	Example	PopUpMenu Type

Procedure

Builds and displays a pop-up menu, and handles the menu choice.

Syntax

switchMenu

   CaseList

   [ otherwise : Statements ]

endSwitchMenu

CaseList is any number of statements in the following form:

CASE menuItem : Statements

Description

switchMenu uses the values of the menuItem argument in each CaseList to create and display a pop-up menu. The Statements following each menuItem specify how to handle each menu choice. The optional otherwise clause specifies what to do if the user closes the menu without making a choice (for example, by pressing Esc).


Example for PopUpMenu::switchMenu
switchMenu Example

The following example uses switchMenu to create, display, and process the choice from a pop-up menu. A string describing the selection is displayed in the message window of the status line.

; actionButton::pushButton
method pushButton(var eventInfo Event)
switchMenu
  case "Add"    : message("Add selected.")
  case "Edit"   : message("Edit selected.")
  case "Delete" : message("Delete selected.")
  otherwise     : message("No selection from menu.")
endSwitchMenu
endMethod


See Also for PopUpMenu::switchMenu
See Also

addText

show


Query Type

Changes

An ObjectPAL Query variable represents a QBE query. You can use ObjectPAL to create and execute queries from methods just as if you were using Paradox interactively. You can execute a query from a query file, a query statement, or a string. Some queries require Paradox to create temporary tables. Paradox creates these tables in the private directory.

Methods for the Query Type

Query

executeQBE

getQueryRestartOptions

isAssigned

isExecuteQBELocal

query

readFromFile

readFromString

setQueryRestartOptions

wantInMemoryTCursor

writeQBE


Changes to Query type methods

The following table lists new methods and methods that were changed for version 5.0.

New	Changed

readFromFile (replaces	getQueryRestartOptions (previously

Database::executeQBEFile)	in the Database type)

readFromString (replaces	isExecuteQBELocal (previously

Database::executeQBEString)	in the Database type)

wantInMemoryTCursor	setQueryRestartOptions (previously

in the Database type)


Query::executeQBE
executeQBE

See Also	Example1	Example2	Query Type	Changes

Method/Procedure

Executes a QBE query.

Syntax

1. (Method)
executeQBE ( [ { const ansTbl String | const ansTbl Table | var ansTbl TCursor } ] ) Logical

2. (Procedure)
executeQBE ( const db Database, const qVar Query
                     [ , { const ansTbl String | const ansTbl Table | var ansTbl TCursor } ] ) Logical

Description

executeQBE executes the query assigned to a Query variable and writes the results to :PRIV:ANSWER.DB or to the table specified in ansTbl. You can assign a query to a Query variable using a query statement, or by calling readfromFile or readfromString.

Syntax 1 is for calling executeQBE as a method. You have the option to write the query result to ansTbl where ansTbl is a table name, a Table variable, or a TCursor. If ansTbl is not specified, executeQBE writes to ANSWER.DB in the user's private directory.

Syntax 2 (added in version 5.0) is for calling executeQBE as a procedure. You must specify a database in db and a Query variable in qVar. You have the option to write the query result to ansTbl where ansTbl is a table name, a Table variable, or a TCursor. If ansTbl is not specified, executeQBE writes to ANSWER.DB in the user's private directory.

The following information applies to both syntaxes:

If you specify the table name as a string and don't include a file extension, ansTbl is a Paradox table by default.

If you specify ansTbl as a Table variable, ansTbl must be assigned and valid.

If you specify ansTbl as a TCursor, the results are stored in memory only; a table is not created on disk.

If executeQBE is successful---if ansTbl or ANSWER.DB is created---this method returns True (even if the resulting table is empty); otherwise it returns False.


Example 1 for Query::executeQBE
executeQBE Example 1

This example calls executeQBE as a method. The pushButton method for the getReceivables button constructs a query statement, assigns it to a Query variable, then runs it with executeQBE. The query statement in this example is an insert query: it retrieves certain records from CUSTOMER.DB and ORDERS.DB and inserts them into the existing MyCust table. The selection criteria for this example uses a tilde variable myState that designates Oregon customers to be included in the results. Since "OR" is the abbreviation for Oregon, the myState variable must evaluate to a quoted string to distinguish it from the OR query expression.

; getReceivables::pushButton
method pushButton(var eventInfo Event)
var
  qVar    Query
  myState String
  tv      TableView
endVar

; add samp alias for the PdoxWin sample directory
addAlias("samp", "Standard", "c:\\pdoxwin\\sample")

; OR is the abbreviation for Oregon, but because it's
; also an ObjectPAL keyword,it must be enclosed in quotes.
myState = "\"OR\""

; now use myState as a tilde variable in this query statement
qVar = Query

      :samp:Customer.db | Customer No | Name  | State/Prov | Phone   |
                        | _cust       | _name |   ~myState | _phone  |

       :samp:Orders.db  | Customer No | Balance Due |
                        | _cust       | 0, _balDue  |

             myCust.db  | Customer No | Name  | Balance Due | Phone  |
               insert   | _cust       | _name | _balDue     | _phone |

       EndQuery

qVar.executeQBE("myCust.db")   ; put results into myCust.db
tv.open("myCust.db")           ; view the table

endMethod


Example 2 for Query::executeQBE
executeQBE Example 2

This example calls executeQBE as a procedure. The pushButton method for the getReceivables button constructs a query statement, assigns it to a Query variable, then runs it with executeQBE. The query statement in this example is an insert query: it retrieves certain records from CUSTOMER.DB and ORDERS.DB and inserts them into the existing MyCust table. The selection criteria for this example uses a tilde variable myState that designates Oregon customers to be included in the results. Since "OR" is the abbreviation for Oregon, the myState variable must evaluate to a quoted string to distinguish it from the OR query expression.

; getReceivables::pushButton
method pushButton(var eventInfo Event)
var

  db      Database
  qVar    Query
  myState String
  tv      TableView
endVar

db.open() ; Get a handle to the default database.

; add samp alias for the PdoxWin sample directory
addAlias("samp", "Standard", "c:\\pdoxwin\\sample")

; OR is a keyword, but since it's also the abbreviation for
; Oregon, it must be enclosed in quotes
myState = "\"OR\""

; now use myState as a tilde variable in this query statement
qVar = Query

      :samp:Customer.db | Customer No | Name  | State/Prov | Phone   |
                        | _cust       | _name |   ~myState | _phone  |

       :samp:Orders.db  | Customer No | Balance Due |
                        | _cust       | 0, _balDue  |

             myCust.db  | Customer No | Name  | Balance Due | Phone  |
               insert   | _cust       | _name | _balDue     | _phone |

       EndQuery

executeQBE(db, qVar, "myCust.db")   ; put results into myCust.db
tv.open("myCust.db")                ; view the table

endMethod


See Also for Query::executeQBE
See Also

query

writeQBE

readfromFile

readfromString


Changes to Query::executeQBE

Syntax 2 (added in version 5.0) is for calling executeQBE as a procedure. You must specify a database in db and a Query variable in qVar. You have the option to write the query result to ansTbl where ansTbl is a table name, a Table variable, or a TCursor. If ansTbl is not specified, executeQBE writes to ANSWER.DB in the user's private directory.


Query::getQueryRestartOptions
getQueryRestartOptions	5.0

See Also	Example	Query Type

Method

Returns a value representing the user's query restart option setting.

Syntax

getQueryRestartOptions ( ) SmallInt

Description

getQueryRestartOptions returns an integer value representing the user's query restart option setting. Use one of the following ObjectPAL QueryRestartOptions constants to test the value:

QueryDefault	Use the options specified interactively using the Query Restart Options dialog box.

QueryLock	Lock all other users out of the tables needed while the query is running. If Paradox cannot lock a table, it does not run the query. This is the least polite to other users. And you must wait until all the locks can be secured before the query will run.

QueryNoLock	Run the query even if someone changes the data while thw query is running.

QueryRestart	Start the query over. Specify QueryRestart when you want to make sure you get a snapshot of the data as it existed at some instant. Another user might change the data after the query is completed but before the Answer table is displayed, but at least you got a snapshot. This is just the nature of multi-user work.

getQueryRestartOptions was previously in the Database type.


Example for Query::getQueryRestartOptions
getQueryRestartOptions Example

See the example for setQueryRestartOptions.


See Also for Query::getQueryRestartOptions
See Also

setQueryRestartOptions


Query::isAssigned
isAssigned

See Also	Example	Query Type

Method

Reports whether a Query variable has an assigned value.

Syntax

isAssigned ( ) Logical

Description

isAssigned returns True if a Query variable has been assigned a value; otherwise, it returns False. This method does not check the validity of the assigned query.


Example for Query::isAssigned
isAssigned Example

In the following example, the call to isAssigned returns True, because the Query variable qVar has been assigned a value, even though the value is not a valid query.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  qVar Query
endVar

qVar = Query

     This is not a query

     endQuery

msgInfo("Assigned?", qVar.isAssigned())    ; displays True

endMethod


See Also for Query::isAssigned
See Also

query


Query::isExecuteQBELocal
isExecuteQBELocal	5.0

See Also	Example	Query Type

Method

Reports whether a QBE query was executed locally or on a server.

Syntax

isExecuteQBELocal ( ) Logical

Description

isExecuteQBELocal returns True if the query represented by qbeVar was executed locally; otherwise, it returns False. This method can be useful in situations where the server uses a different character set, sort order, or other feature that could make a query executed on the server yield a different result than the same query executed locally.

isExecuteQBELocal was moved from the Database type to the Query type in version 5.0, and the functionality was changed. In previous versions, you could call isExecuteQBELocal before executing a query. As of version 5.0, you must call this method after executing the query.


Example for Query::isExecuteQBELocal
isExecuteQBELocal Example

The following code calls isExecuteQBELocal to find out where a QBE query was executed. If the query was executed on the server, the code informs the user.

method pushButton (var eventInfo Event)
   var
      qbeVar        	Query
      dlgTitleText,
      dlgBodyText	String

   endVar

   dlgTitleText = "Remote query"
   dlgBodyText  = "This query was run on the server. \n" +
                  "Check the sort order"

   qbeVar = Query

            :WestData:orders.db  | CustName | Qty         |
                                 | Check    | Check > 10  |

            endQuery

   if qbeVar.executeQBE() then
      if qbeVar.isExecuteQBELocal() then
         msgInfo(dlgTitleText, dlgBodyText)
      endIf
else

errorShow()
   endIf

endMethod


See Also for Query::isExecuteQBELocal
See Also

executeQBE


Query::query
query

See Also	Example	Query Type

Keyword

Begins a query statement.

Syntax

query

   tableName | fieldName | [ fieldName | ]*

             | criteria  | [ criteria  | ]*

 [ tableName | fieldName | [ fieldName | ]*

             | criteria  | [ criteria  | ]* ] *

endQuery

Description

query marks the beginning of a QBE statement, which assigns a query to a Query variable. A QBE statement extracts data from one or more tables according to the fields specified in fieldName and the selection criteria, where criteria can be any valid QBE expression. Because this kind of query is not a quoted string, it can contain tilde variables. (A quoted query string cannot contain tilde variables; see readFromString for more information.)

A query statement begins with a Query variable, the = sign, and the keyword query followed by a blank line. Next comes the body of the query, and another blank line. The query ends with the keyword endQuery.

Note:	You don't have to list all the fields in the table. Instead, you can list only those fields that affect the query, as in this example:

var myQBE Query endvar
myQBE = Query

           Customer | Customer No | Name   |
                    | Check       | A..    |

        endQuery

The previous query statement retrieves from the Customer table customer numbers whose name start with "A". (The Customer table has more than two fields, but only two fields are specified in the example.)

The blank lines above and below the body of the query are required. It is not neccessary to align the vertical field separators (although alignment makes it more readable). ObjectPAL interprets the following code exactly as it interprets the code in the previous example.

var myQBE Query endvar
myQBE = Query

Customer | Customer No            | Name   |
 | Check |  A..    |

   endQuery

If you construct a query statement that includes two or more tables, you must separate each table with a blank line, as follows:

var myQBE Query endvar
myQBE = Query

           Customer | Customer No | Name  | Phone  |
                    | _x          | Check | Check  |

           Orders   | Customer No | Balance Due |
                    | _x          | Check 0     |

        endQuery

You can use absolute paths or aliases to specify where to find tables in the query definition. Paradox searches for unqualified table names (that is, table names without paths or aliases) in the sepcified database, or in the default database (:WORK:) if a database is not specified.


Example for Query::query
query Example

For the following example, the pushButton method for the getReceivables button constructs a query statement, assigns it to a Query variable, then runs it with executeQBE. The query statement in this example is an insert query; it retrieves certain records from CUSTOMER.DB and ORDERS.DB and inserts them into the existing MyCust table. The selection criteria for this example uses a tilde variable myState that designates Oregon customers to be included in the results. Since "OR" is the abbreviation for Oregon, the myState variable must evaluate to a quoted string to distinguish it from the OR query expression.

; getReceivables::pushButton
method pushButton(var eventInfo Event)
var
  qVar    Query
  myState String
  tv      TableView
endVar

; add samp alias for the PdoxWin sample directory
addAlias("samp", "Standard", "c:\\pdoxwin\\sample")

; OR is the abbreviation for Oregon, but because it's
; also an ObjectPAL keyword,it must be enclosed in quotes.
myState = "\"OR\""

; now use myState as a tilde variable in this query statement
qVar = Query

     :samp:Customer.db | Customer No | Name  | State/Prov | Phone   |
                       | _cust       | _name |   ~myState | _phone  |

      :samp:Orders.db  | Customer No | Balance Due |
                       | _cust       | 0, _balDue  |

            myCust.db  | Customer No | Name  | Balance Due | Phone   |
              insert   | _cust       | _name | _balDue     | _phone  |

       EndQuery

qVar.executeQBE("myCust.db")   ; put results into myCust.db
tv.open("myCust.db")            ; view the table

endMethod


See Also for Query::query
See Also

executeQBE

readfromFile

readfromString

writeQBE


Query::readFromFile
readFromFile	5.0

See Also	Example	Query Type

Method

Assigns the contents of a QBE file to a Query variable.

Syntax

readFromFile ( const qbeFileName String ) Logical

Description

readFromFile opens qbeFileName and assigns the contents to a Query variable. There are several ways to create a query file; for example, in ObjectPAL using writeQBE, or interactively using the Query Editor. Use executeQBE to execute the query.

If the value of qbeFileName does not include a path or alias, this method looks for the file in the directory associated with the specified database (or the default database, if a database is not specified). If the value of qbeFileName does not include an extension, this method assumes an extension of .QBE. To specify a file name that does not have an extension, put a period at the end of the name. For example, the following table lists the resulting file names for various values of qbeFileName.

Value of qbeFileName	QBE file name

newcust	newcust.qbe

newcust.	newcust

newcust.q	newcust.q

readFromFile returns True if it succeeds; otherwise, it returns False.

readFromFile replaces Database::executeQBEFile, which existed in versions of ObjectPAL prior to 5.0.


Example for Query::readFromFile
readFromFile Example

This code reads a query from a file and executes the query.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
qVar	Query
endVar

; this writes results into :priv:ANSWER.DB
qVar.readFromFile("GetCust.qbe")

qVar.executeQBE()

endMethod


See Also for Query::readFromFile
See Also

readFromString


Query::readFromString
readFromString	5.0

See Also	Example	Query Type

Method

Assigns a query string to a Query variable.

Syntax

readFromString ( const QBEString String ) Logical

Description

readFromString assigns the query string specified in QBEString to a Query variable. Use executeQBE to execute the query.

readFromString is useful when you're building a QBE string from smaller strings---a QBE string can be a combination of quoted strings and string variables. Double backslashes are required when specifying a path.

You can use absolute paths or aliases to specify where to find tables in the query definition. Paradox searches for unqualified table names (that is, table names without paths or aliases) in the specified database, or in the default database (:WORK:) if a database is not specified.

Because a QBE string is a quoted string, it cannot contain tilde variables (but you can use string variables to get the same effect). If you want to use tilde variables in a query, use a query statement or use readFromFile to assign the contents of a QBE file to a Query variable.

readFromString replaces Database::executeQBEString, which existed in versions of ObjectPAL prior to 5.0.


Example for Query::readFromString
readFromString Example

For the following example, the pushButton method for btnFindName defines a query as a string value, then uses readFromString to assign the string to a Query variable.

; btnFindName::pushButton
method pushButton(var eventInfo Event)
var
  db Database
  qs String
  tv TableView
  tc TCursor
  stkNo String

qVar	Query
endVar

; Add the sampData alias then open the database.
addAlias("sampData", "Standard", "c:\\pdoxwin\\sample")
db.open("sampData")

; Open a TCursor for the Stock table.
tc.open("Stock.db", db)

; If locate finds Krypton Flashlight in the Description field.
if tc.locate("Description", "Krypton Flashlight") then

  ; Now use the Stock No field value in Stock.db in a query string.
  qs = "Query\n\n" +
      ":sampData:Lineitem | Order No | Stock No  | \n" +
                        " |  _ordNo  | " + tc."Stock No" + " | \n\n" +
        ":sampData:Orders | Order No | Customer No  | \n" +
                        " |  _ordNo | _cust  | \n\n" +
      ":sampData:Customer | Customer No | Name | Phone  | \n" +
                        " |  _cust | Check | Check  | \n\n" +
       "EndQuery"

  ; Note that the vertical lines ( | ) don't have to be aligned.

qVar.readFromString(qs)

if qVar.executeQBE() then

    tv.open(":priv:answer.db")       ; Display the answer table.
 	else
  	 msgStop("Error", "Query failed") ; Otherwise, query failed.

endIf

else
  msgStop("Error", "Can't find Krypton Flashlight")
endif

endMethod


See Also for Query::readFromString
See Also

executeQBE

readFromFile


Query::setQueryRestartOptions
setQueryRestartOptions	5.0

See Also	Example	Query Type

Method

Specifies what to do with the underlying tables while running a query.

Syntax

setQueryRestartOptions ( const qryRestartType SmallInt ) Logical

Description

setQueryRestartOptions tells Paradox what to do if data changes while you're running a query in a multiuser environment. The argument qryRestartType represents one of the following ObjectPAL QueryRestartOptions constants:

QueryDefault	Use the options specified interactively using the Query Restart Options dialog box.

QueryLock	Lock all other users out of the tables needed while the query is running. If Paradox cannot lock a table, it does not run the query. This is the least polite to other users. And you must wait until all the locks can be secured before the query will run.

QueryNoLock	Run the query even if someone changes the data while it's running.

QueryRestart	Start the query over. Specify QueryRestart when you want to make sure you get a snapshot of the data as it existed at some instant. Another user might change the data after the query is completed but before the Answer table is displayed, but at least you got a snapshot. This is just the nature of multi-user work.

setQueryRestartOptions was previously in the Database type.


Example for Query::setQueryRestartOptions
setQueryRestartOptions Example

The following example calls getQueryRestartOptions to get the user's current query restart options. If the setting is not QueryRestart, this code calls setQueryRestartOptions to set it. Then it executes a query.

method pushButton(var eventInfo Event)

var

qVar	Query

endVar

  if getQueryRestartOptions <> QueryRestart then
     setQueryRestartOptions(QueryRestart)
  endIf

if qVar.readFromFile("newcust.qbe") then

qVar.executeQBE()

else

errorShow()

endIf
endMethod


See Also for Query::setQueryRestartOptions
See Also

getQueryRestartOptions


Query::wantInMemoryTCursor
wantInMemoryTCursor	5.0

See Also	Example	Query Type

Method

Specifies how to create a TCursor resulting from a query.

Syntax

wantInMemoryTCursor ( [ const yesNo Logical ] )

Description

wantInMemoryTCursor specifies how to create a TCursor resulting from a query. When you call wantInMemoryTCursor with yesNo as Yes (or omitted), Paradox creates a "dead" TCursor in system memory, with no connection to underlying tables. When yesNo is No, Paradox creates a TCursor onto a live query view. By default, when you execute a query to a TCursor, that TCursor will point to a live query view---changes made to the TCursor will affect the underlying tables. Set wantInMemoryTCursor to Yes when you don't want a live query view.

An in-memory TCursor can be useful for performing quick "what-if" analyses. For example, suppose you want to study the effect of giving each employee a 15 percent raise. You could query the employee data to increase everyone's salary by 15 percent. Of course, you wouldn't want to do this to the actual employee data (at least, not yet), so you would execute the query to an in-memory TCursor and work with the data there, without affecting the underlying data.


Example for Query::wantInMemoryTCursor
wantInMemoryTCursor Example

This example uses an in-memory TCursor to study the effects of giving every employee a 15 percent raise. It reads a pre-defined query from a file and executes it, then uses the results in a calculation.

method pushButton(var eventInfo Event)

var

qVar	Query

tcRaise15	TCursor

nuTotalPayroll	Number

endVar

qVar.wantInMemoryTCursor(Yes)

qVar.readFromFile("raise15.qbe")

qVar.executeQBE(tcRaise15)

nuTotalPayroll = tcRaise15.cSum("Salary")

nuTotalPayroll.view("Payroll after 15%	raise:")

endMethod


See Also for Query::wantInMemoryTCursor
See Also

executeQBE

SQL::wantInMemoryTCursor

TCursor::instantiateView

TCursor::isInMemoryTCursor

TCursor::isView

Paradox Help::Live Query Views


Query::writeQBE
writeQBE

See Also	Example	Query Type	Changes

Method/Procedure

Writes a query statement to a specified file.

Syntax

1. (Method) writeQBE ( const fileName String ) Logical

2. (Procedure) writeQBE ( const str String , const fileName String ) Logical

Description

writeQBE writes a previously defined a query to the file specified in fileName. If fileName exists, it is overwritten without asking for confirmation. If fileName does not specify a path, Paradox writes to :WORK:. writeQBE returns True if the write succeeds; otherwise it returns False.

Syntax 1 is for calling writeQBE as a method. It writes the query represented by an assigned Query variable to the file specified in fileName.

Syntax 2 (added in version 5.0) is for calling writeQBE as a procedure. It writes the string represented by str to the file specified in fileName.


Example for Query::writeQBE
writeQBE Example

In the following example, assume a form has a button named getDest. When the form opens, this example determines whether the GETDEST.QBE file exists in the current directory. If the file does not exist, the built-in open method for pageOne uses writeQBE to write a query string to GETDEST.QBE. The built-in pushButton for getDest runs the query, then opens the table. This code assumes the :MAST: alias has already been defined.

Following is the code attached to the open method for pageOne:

; pageOne::open
method open(var eventInfo Event)
Var
  qVar Query
endVar

; if the GetDest.qbe query file dosn't exist
if not isFile("GetDest.qbe") then

  ; construct a query
  qVar = Query

           :mastApp:Dest | Destination Name | Avg Temp (F) |
                         | Check            | Check 70     |

         EndQuery

  ; write the query statement to the GetNames.qbe file
  qVar.writeQBE("GetDest.qbe")

endif

endMethod

The following code is attached the built-in pushButton method for the getDest button. This code does not check whether GETDEST.QBE exists because the open method for the page ensures the file is available.

; getDest::pushButton
method pushButton(var eventInfo Event)
var

qVar	Query
  tv 	TableView
endVar

qVar.readFromFile("GetDest.qbe")

qVar.executeQBE("MyDest")
tv.open("MyDest")

endMethod

Another use for this method is to use ObjectPAL to create and save a query that the user can run interactively using the Query Editor.


See Also for Query::writeQBE
See Also

executeQBE

readfromFile

readfromString


Changes to Query::writeQBE

Syntax 2 (added in version 5.0) is for calling writeQBE as a procedure. It writes the string represented by str to the file specified in fileName.


Record Type

ObjectPAL provides the Record type as a programmatic, user-defined collection of information, similar to a record in Pascal or a struct in C. Such records, defined in ObjectPAL code, are separate and distinct from records associated with a table.

Here's the syntax for declaring a Record data type:

TYPE
recordName = RECORD
                     fieldName fieldType
                   [ fieldName fieldType ]*
             ENDRECORD
ENDTYPE

One or more fieldNames identify fields (columns) of the record, and fieldType is one of the data types. Declare records in a design object's Type window.

Once you declare a Record data type, you can use the = and <> comparison operators to compare one record to another. You can also use the assignment (=) operator to copy the contents of one record to another.

The Record type includes several derived methods from the AnyType type.

Methods for the Record Type

AnyType		Record
blank		view
dataType
isAssigned
isBlank
isFixedType


Record::view
view

See Also	Example	Record Type

Method

Displays in a dialog box the value of a variable.

Syntax

view ( [ const title String ] )

Description

view displays in a modal dialog box the value or values assigned to a Record variable. ObjectPAL execution suspends until the user closes this dialog box. You can specify the dialog box's title in title, or you can omit title to display the variable's data type.

Note:	Unlike many data types, values in a Record can't be changed when displayed in a view dialog box. Refer to AnyType for more information regarding view and other data types.


Example for Record::view
view Example

The following example uses a type named MyRecord. The pushButton method for getAndViewRec declares a variable called myRec of type MyRecord. This method then opens a TCursor to the Customer table, fills myRec with the Customer No and Name field values from the first record, and uses view to display the record in a dialog box. This operation is then repeated for the second record in Customer.

The following code is attached to the Type window for getAndViewRec. This code creates a user-defined type named MyRecord.

; getAndViewRec::Type
Type
  MyRecord = RECORD         ; define a Record structure
               ID    String
               Name  String
             ENDRECORD
endType

This code is attached to the pushButton method for a button named getAndViewRec:

; getAndViewRec::pushButton
method pushButton(var eventInfo Event)
var
  recOne, recTwo MyRecord
  tc             TCursor
endVar

if tc.open("Customer.db") then
  recOne.ID = tc."Customer No"     ; put some values into the record
  recOne.Name = tc."Name"
  recOne.view("First record")      ; display the record in a dialog box

  tc.nextRecord()                  ; move to the next record

  recTwo.ID = tc."Customer No"     ; get new values
  recTwo.Name = tc."Name"
  recTwo.view("Second record")     ; display second record

  msgInfo("recOne = recTwo?", recOne = recTwo)  ; displays False

  recOne = recTwo                  ; now both records have the same values
  msgInfo("recOne = recTwo?", recOne = recTwo)  ; displays True

else
  msgStop("Stop", "Couldn't open the Customer table.")
endIf
endMethod


See Also for Record::view
See Also

Array

DynArray


Report Type

Changes

A Report variable is a handle to a report. You use Report variables in code to manipulate the report onscreen. Report methods control the window's size, position, and appearance, and to view and print the report.

Use load to load a report file in the Design window; use open to open the report in the View Data window, and use print to open a report and print it. You cannot attach methods to objects in a report, but you can attach code to calculated fields.

The Report type includes several derived methods from the Form type.

Methods for the Report Type

Form		Report
bringToTop		attach
create		close
deliver		currentPage
dmAddTable		design
dmBuildQueryString		enumUIObjectNames
dmEnumLinkFields		enumUIObjectProperties
dmGetProperty		load
dmHasTable		moveToPage
dmLinkToFields		open
dmLinkToIndex		print
dmRemoveTable		run
dmSetProperty		setMenu
dmUnlink
enumDataModel
enumSource
enumTableLinks
getFileName
getPosition
getProtoProperty
getStyleSheet
getTitle
hide
isDesign
isMaximized
isMinimized
isVisible
maximize
menuAction
minimize
moveTo
save
saveStyleSheet
selectCurrentTool
setPosition
setProtoProperty
setStyleSheet
setTitle
show
wait
windowClientHandle
windowHandle


Changes to Report type methods

The following table lists new methods and methods that were changed for version 5.0.

New	Changed

deliver	attach

dmAddTable	load

dmBuildQueryString	print

dmEnumLinkFields

dmGetProperty

dmHasTable

dmLinkToFields

dmLinkToIndex

dmRemoveTable

dmSetProperty

dmUnlink

enumDataModel

enumSource

enumTableLinks

getFileName

getProtoProperty

getStyleSheet

isDesign

menuAction

moveTo

saveStyleSheet

selectCurrentTool

setMenu

setProtoProperty

setStyleSheet

wait

windowClientHandle


Report::attach
attach

See Also	Example	Report Type

Method

Associates a Report variable with an open report.

Syntax

attach ( const reportTitle String ) Logical

Description

attach associates a Report variable with an open report, where reportTitle specifies the title of an open report.

Note:	The argument reportTitle refers to the text displayed in the title bar of the Report window, not to the file name. You can use getTitle to return this text, or you can use setTitle to specify a title yourself.


Example for Report::attach
attach Example

In the following example, assume the form's open method opened the STOCK.RSL report and retitled the window to "Stock Report". The pushButton method for printStock attaches to the open report by way of its title, then prints it.

; printStock::pushButton
method pushButton(var eventInfo Event)
var
  stockRep  Report
endVar
; the Stock report was opened and retitled by the form's open method
stockRep.attach("Stock Report")  ; attach by report's title
stockRep.print()                 ; print the report
endMethod

This code is attached to the form's open method.

; thisForm::open
method open(var eventInfo Event)
var
  stockRep  Report
endVar
if eventInfo.isPreFilter()
  then
    ;code here executes for each object in form
  else
    ;code here executes just for form itself
    stockRep.open("stock.rsl")
    stockRep.setTitle("Stock Report")
    bringToTop()          ; bring this form back to the top
endif
endMethod


See Also for Report::attach
See Also

open

Form::getTitle

Form::setTitle


Report::close
close

See Also	Example	Report Type

Method

Closes a window.

Syntax

close ( )

Description

close closes a Report window. Closing a report with close is equivalent to choosing Close from the Control menu.


Example for Report::close
close Example

In the following example, assume the form's open method opened the STOCK.RSL report and retitled the window to "Stock Report". The close method for the form attaches to the open report by way of its title, then closes it when the form closes.

; thisForm::close
method close(var eventInfo Event)
var
  stockRep  Report
endVar
if eventInfo.isPreFilter()
  then
    ; code here executes for each object in form
  else
    ; code here executes just for form itself
    ; the Stock report was opened and retitled by
    ; the form's open method
    stockRep.attach("Stock Report")
    stockRep.close()
endif
endMethod


See Also for Report::close
See Also

open


Report::currentPage
currentPage

See Also	Example	Report Type

Method

Returns the current page number of a report.

Syntax

currentPage ( ) SmallInt

Description

currentPage returns the current page number of a report.


Example for Report::currentPage
currentPage Example

In the following example, the pushButton method for plusTwoPages attempts to attach to an open report, and, if this fails, opens the report. Once the ordersRep variable points to an open report, the method moves the report forward two pages.

; plusTwoPages::pushButton
method pushButton(var eventInfo Event)
var
  ordersRep Report
endVar
; report might be open already, so attempt an attach first
if NOT ordersRep.attach("Report : ORDERS.RSL") then
  if NOT ordersRep.open("Orders.rsl") then
    msgStop("FYI", "Could not open or attach to report.")
    return
  endif
endif
; move to two pages past the current page
ordersRep.moveToPage(ordersRep.currentPage() + 2)
bringToTop()   ; make this form the top layer again
endMethod


See Also for Report::currentPage
See Also

moveToPage


Report::design
design

See Also	Example	Report Type

Method

Switches a report from a Report window to a Report Design window.

Syntax

design ( ) Logical

Description

design switches a report from the Report window to the Report Design window. This method works only with saved reports (.RSL); it does not work with delivered reports (.RDL).

Use run to switch from a Report Design window to a Report window, or load to open a report in a Report Design window.

Note:	Some report actions are especially processor-intensive. In some situations, you might need to follow a call to open, load, design, or run with a sleep. See the sleep method in the System type for more information.


Example for Report::design
design Example

In the following example, assume the form's open method opened the STOCK.RSL report and retitled the window to "Stock Report". The pushButton method for stockDesign attaches to the open report by way of its title, then switches the report to the Report Design window.

; stockDesign::pushButton
method pushButton(var eventInfo Event)
var
  stockRep  Report
endVar
; the form's open method opened and retitled the Stock report
stockRep.attach("Stock Report")
stockRep.design()            ; switch to Design mode
endMethod


See Also for Report::design
See Also

load

open

run


Report::enumUIObjectNames
enumUIObjectNames

See Also	Example	Report Type

Method

Creates a table listing the UIObjects contained in a report.

Syntax

enumUIObjectNames ( const tableName String ) Logical

Description

enumUIObjectNames creates a Paradox table listing the name and type of each object contained in a report. Use the argument tableName to specify a name for the table. If tableName already exists, this method overwrites it without asking for confirmation. If tableName is already open, this method fails. You can include an alias or path in tableName; if no alias or path is specified, Paradox creates tableName in the working directory (:WORK:).

The structure of tableName is:

Field Name	Type	Size

ObjectName	A	128

ObjectClass	A	32


Example for Report::enumUIObjectNames
enumUIObjectNames Example

In the following example, the pushButton method for describeReport uses enumUIObjectNames and enumUIObjectProperties to document a report.

; describeReport::pushButton
method pushButton(var eventInfo Event)
var
  ordersRep Report
  tempTable TableView
endVar
ordersRep.load("Orders.rsl")                     ; load report in Report Design window
ordersRep.enumUIObjectNames("ordnames.db")       ; write names to table
ordersRep.enumUIObjectProperties("ordprops.db")  ; write properties to table
ordersRep.close()
tempTable.open("ordnames")                       ; observe your handiwork
tempTable.wait()
tempTable.open("ordprops")
tempTable.wait()
tempTable.close()
endMethod


See Also for Report::enumUIObjectNames
See Also

enumUIObjectProperties


Report::enumUIObjectProperties
enumUIObjectProperties

See Also	Example	Report Type

Method

Lists the properties of each UIObject contained in a report.

Syntax

enumUIObjectProperties ( const tableName String ) Logical

Description

enumUIObjectProperties creates a Paradox table listing the name, property name, and property value of each object contained in a report. Use the argument tableName to specify a name for the table. If tableName already exists, this method overwrites it without asking for confirmation. If tableName is already open, this method fails.

The structure of tableName is:

Field Name	Type	Size

ObjectName	 A	128

PropertyName	 A	64

PropertyType	 A	48

PropertyValue	 A	255


Example for Report::enumUIObjectProperties
enumUIObjectProperties Example

See the example for enumUIObjectNames.


See Also for Report::enumUIObjectProperties
See Also

enumUIObjectNames


Report::load
load

See Also	Example	Report Type	Changes

Method

Opens a report in the Report Design window.

Syntax

load ( const reportName String, [const windowStyle LongInt [ , const x LongInt, const y LongInt, const w LongInt, const h LongInt ] ] ) Logical

Description

load opens reportName in the Report Design window. You have the option to specify in windowStyle a WindowStyles constant (or combination of constants). You also have the option to specify (in twips) the window's size and position: arguments x and y specify the position of the upper left corner, arguments w and h specify the width and height, respectively. Both of these options were added in version 5.0. This method works only with saved reports (.RSL); it does not work with delivered reports (.RDL).

Compare this method to open, which opens a report in the Report window.

Note:	Some report actions are especially processor-intensive. In some situations, you might need to follow a call to open, load, design, or run with a sleep. See the sleep method in the System type for more information.


Example for Report::load
load Example

In the following example, the pushButton method for the loadOrders button loads the ORDERS.RSL report in the Report Design window, creates a text box in the page header, and writes a string to the text box.

; loadOrders::pushButton
method pushButton(var eventInfo Event)
var
  ordersRep Report
  pageTitle UIObject
endVar
if ordersRep.load("Orders.rsl") then
  ; assume report has room in the page header for a text box
  pageTitle.create(TextTool, 1440*3, 720, 1440*2, 360, ordersRep)
  pageTitle.Name = "NewTitleText"
  pageTitle.Text = "Orders Report " + String(time())
  pageTitle.Color = LightBlue
  pageTitle.Visible = True
  ordersRep.run()
endif
endMethod


See Also for Report::load
See Also

design

run

open


Changes to Report::load

You have the option to specify (in twips) the window's size and position: arguments x  and y specify the position of the upper left corner, arguments w and h specify the width and height, respectively. Both of these options were added in version 5.0.


Report::moveToPage
moveToPage

See Also	Example	Report Type

Method

Displays a specified page of a report.

Syntax

moveToPage ( const pageNumber SmallInt ) Logical

Description

moveToPage displays the page of a report specified in pageNumber. This method doesn't make the report active. If you want to make the report active, follow moveToPage with bringToTop (see the Form type for more information on bringToTop).


Example for Report::moveToPage
moveToPage Example

See the example for currentPage.


See Also for Report::moveToPage
See Also

Form::bringToTop

currentPage


Report::open
open

See Also	Example	Report Type	Changes

Method

Opens a report and prints it.

Syntax

1. open ( const reportName String [, windowStyle LongInt ] ) Logical

2. open ( const reportName String, const windowStyle LongInt, const x SmallInt, const y SmallInt, const w SmallInt, const h SmallInt ) Logical

3. open ( const openInfo ReportOpenInfo ) Logical

Description

open displays and prints the report specified in reportName. Optional arguments specify the location of the upper left corner of the report (x and y), the width and height (w and h), and style (windowStyle).

The value of windowStyle must be one of the WindowStyles constants. You can specify more than one window style by adding the constants. For example, the following code opens a report window that has horizontal and vertical scroll bars:

salesReport.open("sales.rsl", WinStyleDefault + WinStyleHScroll + WinStyleVScroll)

Syntax 3 lets you specify form settings from openInfo, a record of type ReportOpenInfo. A ReportOpenInfo record has the following structure:

x, y, w, h         LongInt  ;size and position of report
name               String   ;name of report to open (preView)
masterTable        String   ;master table name
queryString        String   ;run this query (actual query string)
restartOptions     SmallInt ;one of the ReportPrintRestart constants

Note:	Some report actions are especially processor-intensive. In some situations, you might need to follow a call to open, load, design, or run with a sleep. See the sleep procedure in the System type for more information.


Example for Report::open
open Example

In the following example, the pushButton method for openSmall opens the ORDERS.RSL report and minimizes it by supplying a window style constant of WinStyleMinimize.

; openSmall::pushButton
method pushButton(var eventInfo Event)
var
  ordersRep Report
endVar
ordersRep.open("Orders.rsl", WinStyleMinimize)   ; open Orders Report minimized
endMethod


See Also for Report::open
See Also

close

design

load


Changes to Report::open

You have the option to specify (in twips) the window's size and position: arguments x  and y specify the position of the upper left corner, arguments w and h specify the width and height, respectively. Both of these options were added in version 5.0.


Report::print
print

See Also	Example	Report Type	Changes

Beginner

Method

Prints a report.

Syntax

1. print ( ) Logical

2. print ( const reportName String, const reportPrintRestart SmallInt ) Logical

3. print (const ri ReportPrintInfo ) Logical

Description

print prints a report. With syntax 1, Paradox opens the Print dialog box for the current report, which allows the user to specify print settings. Syntax 2 lets you specify a report name in reportName and set restart options in reportPrintRestart. The value of reportPrintRestart must be one of the ReportPrintRestart contants. Syntax 3 lets you set print settings with a ReportPrintInfo record. ReportPrintInfo records are predeclared and have the following structure:

Field name	Type	Description

endPage	LongInt	The last page of a range. Default: last page of the report.

makeCopies	Logical	Specifies how copies are made: by Paradox or the printer. True = Paradox make copies; False = printer makes copies. Default: True. The value is ignored if the printer cannot print multiple copies.

masterTable	String	Name of the master table for the report.

name	String	Name of a report to run, if it's not already running.

nCopies	SmallInt	Number of copies. Default: 1

orient	SmallInt	Page orientation. Landscape or Portrait

pageIncrement	SmallInt	Page increment for multi-pass printing. Default: 1

panelOptions	SmallInt	Specifies how to handle overflow pages. Use one of the ReportPrintPanel constants. Default: PrintClipToWidth

printBackwards	Logical	Specifies whether to print forward (from first page to last page) or backward (from last page to first page). False = forward, True = backward. Default: False

queryString	String	Specifies a QBE string to execute.

restartOptions	SmallInt	Specifies what to do when data changes while printing report. Use one of the ReportPrintRestart constants. Default: PrintReturn

startPage	LongInt	The first page of a range. Default: 1

startPageNum	LongInt	(Added in version 5.0.) The page number to print on the first page of the report. Incremented for subsequent pages. Default: 1

xOffset	LongInt	Horizontal page offset. Default: 0

yOffset	LongInt	Vertical page offset. Default: 0


Example for Report::print
print Example

For examples of printing using syntax 1, see the example for attach. The following example shows how to use syntax 3 to print using a ReportPrintInfo record.

; printWithRecord::pushButton
method pushButton(var eventInfo Event)
var
  stockRep  Report
  repInfo   ReportPrintInfo
endVar
; first, set up the repInfo record
repInfo.nCopies = 2
repInfo.makeCopies = True
repInfo.name = "Stock"
stockRep.print(repInfo)
endMethod


See Also for Report::print
See Also

open

run


Changes to Report::print

The field startPageNum was added to the ReportPrintInfo record in version 5.0. It specifies the page number to print on the first page of the report. Incremented for subsequent pages. Default: 1.


Report::run
run

See Also	Example	Report Type

Method

Switches a report from the Design window to the View Data window.

Syntax

run ( ) Logical

Description

run switches a report from the Design window to the View Data window. This method works only with saved reports (.RSL); it does not work with delivered reports (.RDL).

To switch from the View Data window to the Design window, use design.

Note: Some report actions are especially processor-intensive. In some situations, you might need to follow a call to open, load, design, or run with a sleep. See the sleep procedure in the System type for more information.


Example for Report::run
run Example

See the example for load.


See Also for Report::run
See Also

design

load


Report::setMenu
setMenu	5.0

See Also	Example	Report Type

Method

Associates a menu with a report.

Syntax

setMenu ( const menuVar Menu )

Description

setMenu associates the menu specified in menuVar with a report. This method performs the same function as Menu::show, and adds the following features:

When the report gets focus, Paradox displays the associated menu.

Actions resulting from choices from that menu are sent to that report.

Note:	When you build a custom menu for a report, use MenuCommands constants (like MenuFilePrint) to assign ID values to menu items. These are the only values a report can respond to, because (unlike a form) a report has no menuAction method you can modify to handle menu choices.


Example for Report::setMenu
setMenu Example

The following example is a script. It opens a report, builds a simple menu, then uses setMenu to assign the menu to the report.

method run(var eventInfo Event)

var

reOrders	Report

muOrderRpt	Menu

puRptFile	PopUpMenu

endVar

; Build a menu for the report.

reOrders.open("orders")

; Setting the StandardMenu property to False

; (either in ObjectPAL code or interactively)

; can reduce flicker when changing menus.

reOrders.StandardMenu = False

; IMPORTANT: When you build a custom menu for a report,

; use MenuCommands constants (like MenuFilePrint) to assign

; ID values to menu items. These are the only values a report

; can respond to, because (unlike a form) a report has no

; menuAction method you can modify to handle menu choices.

puRptFile.addText("&Print Report", MenuEnabled, MenuFilePrint)

puRptFile.addText("&Exit", MenuEnabled, MenuFileExit)

muOrderForm.addPopUp("&File", puRptFile)

foOrders.setMenu(muOrderForm)

endMethod


See Also for Report::setMenu
See Also

Form::setMenu

Menu::show

PopUpMenu::addText


Script Type

See Also	Changes

A Script type was added to ObjectPAL in version 5.0. It includes methods for manipulating scripts---and the code they contain---from within an ObjectPAL method or procedure.

The Script type includes several derived methods from the Form type.

Methods for the Script Type

Form		Script
deliver		attach
enumSource		create
formReturn		load
enumSourceToFile		run
methodDelete
methodGet
methodSet
save


Changes to Script type methods

The Script type is new for version 5.0, so all of the Script type methods are new. The Script type includes several derived methods from the Form type.


See Also

Scripts

ObjectPAL Editor menu


Script::attach
attach	5.0

See Also	Example	Script Type

Method

Associates a Script variable with the current script.

Syntax

attach ( ) Logical

Description

attach associates a Script variable with the current script. This method only works if called in code attached to the script itself; therefore, the script must be running. In other words, this method lets a running script create a handle to itself. ObjectPAL can't return Script variables or pass them as arguments, so you can only use the handle within the method that created it. attach can be used with enumSource or enumSourceToFile to create a script that enumerates its own code.

This method returns True if it succeeds; otherwise, it returns False.


Example for Script::attach
attach Example

The following example shows how to use attach to create a script that enumerates its own source to a text file. The code is attached to the script's built-in run method, which exectues when you run (play) the script.

method run(var eventInfo Event)
  var
    s Script
  endVar
  s.attach()
  s.enumSourceToFile("script.src", Yes)
endMethod


See Also for Script::attach
See Also

create

load


Script::create
create	5.0

See Also	Example	Script Type

Method

Creates a script.

Syntax

create ( ) Logical

Description

create creates an empty script, but does not display an Editor window. Use methodSet to add code to the script.


Example for Script::create
create Example

In the following example, the pushButton method for a button named editScript creates a script named MSG. Then it calls methodSet to attach code to its built-in run method, calls save to save the script and name it NewMsg (Paradox appends the .SSL extension automatically), then calls run to run it.

; editScript::pushButton
method pushButton(var eventInfo Event)
  var
    theScript 	Script
    stMsg 	String
  endVar

stMsg =
"method newMsg()
  msgInfo("New message", "New message")
endMethod"

  theScript.create()
  theScript.methodSet("run", stMsg)
  theScript.save("NewMsg") ; Saves script as NEWMSG.SSL.
  theScript.run()          ; Calls the script's built-in run method.
endMethod


See Also for Script::create
See Also

attach

load

run


Script::load
load	5.0

See Also	Example	Script Type

Method

Loads a script into system memory.

Syntax

load ( const scriptName String ) Logical

Description

load loads the script specified in scriptName into system memory. It does not display an Editor window. If you don't specify a path or an alias, Paradox looks for the script in :WORK:. This method returns True if it succeeds; otherwise, it returns False.


Example for Script::load
load Example

In the following example, the pushButton method for a button named editScript loads the script named MSG (which must have been created and saved previously). Then it calls methodSet to add a custom method, calls save to save the script, then calls run to run it.

; editScript::pushButton
method pushButton(var eventInfo Event)
  var
    theScript 	Script
    stMsg 	String
  endVar

stMsg =
"method newMsg()
  msgInfo("New message", "New message")
endMethod"

  if theScript.load("msg") then
    theScript.methodSet("newMsg", stMsg)
    theScript.save()
    theScript.run() ; Executes the script's built-in run method.
  else
    errorShow("Couldn't load the script.")
  endIf
endMethod


See Also for Script::load
See Also

attach

create


Script::run
run	5.0

See Also	Example	Script Type

Method

Runs a script.

Syntax

run ( ) AnyType

Description

run runs a script by calling its built-in run method, the same as if you had called the System procedure play. To return a value from a script, you must call formReturn from within the script.


Example for Script::run
run Example

This example shows how to run a script and how to make a script return a value. The following code is attached to a button in a form. It runs a script which returns a value, then it displays the returned value in a dialog box.

method pushButton(var eventInfo Event)

var

scTest	Script

atRetVal	AnyType

endVar

scTest.load("test")

atRetVal = scTest.run()

atRetVal.view()

endMethod

The following code is attached to a script's built-in run method. It assigns a value to a variable, then returns the value to the form.

method run(var eventInfo Event)

var

atNow	AnyType

endVar

atNow = time()

formReturn(atNow)

endMethod


See Also for Script::run
See Also

load

System::play


Session Type

Changes

A Session object represents a channel to the database engine. Opening a Paradox application opens one session by default, and you can use ObjectPAL to open other sessions from within an application; it is not necessary to open other sessions to use procedures from the Session type. The number of other sessions you can open depends on the system environment. Each session uses one user count.

Only the default session can be managed using Paradox interactively. You must manage other sessions with ObjectPAL.

Locks set by ObjectPAL interact as peers with locks set interactively in the same session.

Methods for the Session Type

Session

addAlias

addPassword

addProjectAlias

advancedWildcardsInLocate

blankAsZero

close

enumAliasLoginInfo

enumAliasNames

enumDataBaseTables

enumDriverCapabilities

enumDriverInfo

enumDriverNames

enumDriverTopics

enumEngineInfo

enumFolder

enumOpenDatabases

enumUsers

getAliasPath

getAliasProperty

getNetUserName

ignoreCaseInLocate

isAdvancedWildcardsInLocate

isAssigned

isBlankZero

isIgnoreCaseInLocate

loadProjectAliases

lock

open

removeAlias

removeAllPasswords

removePassword

removeProjectAlias

retryPeriod

saveCFG

saveProjectAliases

setAliasPassword

setAliasPath

setAliasProperty

setRetryPeriod

unLock


Changes to Session type methods

The following table lists new methods and methods that were changed for version 5.0.

New	Changed

addProjectAlias	addAlias

loadProjectAliases	enumAliasNames

removeProjectAlias	enumDatabaseTables

saveProjectAliases	enumDriverCapabilities

enumFolder

enumOpenDatabases

enumUsers


Session::addAlias
addAlias

See Also	Example1	Example2	Example3	Session Type	Changes

Method/Procedure

Adds a database alias to a session.

Syntax

1. addAlias ( const aliasName String, const type String, const path String ) Logical

2. addAlias ( const aliasName String, const type String, const params DynArray[] String ) Logical

3. addAlias ( const aliasName String, const existingAlias String ) Logical

Description

addAlias adds a public alias to a session. To add a project alias, use addProjectAlias. Although the concept of "public" and "project" aliases is new with version 5.0, the functionality of addAlias is unchanged.

In syntax 1, specify the alias name in aliasName, the alias type ("Standard") in type, and the full DOS path in path.

In syntax 2, added in version 5.0, specify the alias name in aliasName, the SQL alias type (Interbase, Oracle, Sybase, or Informix) in type, and the parameters in params.

Syntax 3, added in version 5.0, allows you to copy an alias from existingAlias to aliasName.

An alias added using addAlias is known only to the session for which it is defined, and exists only until the session is closed. Use saveCFG to save public aliases in a file. Public aliases are stored in IDAPI.CFG by default (or in the .CFG file of your choice). They are available from any working directory and visible to any application that uses IDAPI.


Example 1 for Session::addAlias
addAlias Example 1

The following example adds an alias to the current session, then supplies the new alias to the open method defined for the Database type. This code is attached to the built-in open method for the pageOne page.

; pageOne::open
method open(var eventInfo Event)
var
  custInfo Database
endVar

; add the CustomerInfo alias to the current session
addAlias("CustomerInfo", "Standard", "D:\\pdoxwin\\tables\\custdata")

; now use the alias specify the database to open
custInfo.open("CustomerInfo") ; opens the CustomerInfo database

endMethod


Example 2 for Session::addAlias
addAlias Example 2

The following example adds an Oracle type alias to the current session, then supplies the new alias to the open method defined for the Database type. This code is attached to the built-in open method for the pgeOne page.

; pgeOne::open

method open(var eventInfo Event)

var

tv	TableView

SQLdb     	Database

AliasInfo 	DynArray[]  String

endVar

AliasInfo["SERVER NAME"]    	= "Server1"

AliasInfo["USER NAME"]         	= "guest"

AliasInfo["OPEN MODE"]         	= "READ/WRITE"

AliasInfo["SCHEMA CACHE SIZE"] 	= "8"

AliasInfo["NET PROTOCOL"]      	= "SPX/IPX"

AliasInfo["LANGDRIVER"]        	= ""

AliasInfo["SQLQRYMODE"]        	= ""

AliasInfo["PASSWORD"]          	= "guest"

addAlias("Guest_Account", "Oracle", AliasInfo)

SQLdb.open("Guest_Account", AliasInfo)

tv.open(":Guest_Account:mprestwood.customer")

endMethod


Example 3 for Session::addAlias
addAlias Example 3

The following example adds an alias to the current session by copying the existing work alias to the new alias NewAlias.

; btnCopyWork::pushButton

method pushButton(var eventInfo Event)

addAlias("NewAlias", "work")

endMethod


Changes to Session::addAlias

Public and project aliases were introduced in version 5.0. The functionality of this method is unchanged, although the syntax has been enhanced.

In syntax 2, added in version 5.0, specify the alias name in aliasName, the SQL alias type (Interbase, Oracle, or Sybase) in type, and the parameters in params.

Syntax 3, added in version 5.0, allows you to copy an alias from existingAlias to aliasName.


See Also for Session::addAlias
See Also

Paradox Help: Public and Project Aliases

addProjectAlias

getAliasPath

enumAliasNames

saveCFG


Session::addPassword
addPassword

See Also	Example	Session Type

Method/Procedure

Presents a password allowing access to a protected table.

Syntax

addPassword ( const password String )

Description

addPassword presents to a Paradox session the password specified in password. (Passwords apply to Paradox tables only.) The maximum length of a password is 31 characters. Subsequent attempts to access a table protected using that password are not challenged. The argument password can represent either an owner password or an auxiliary password. Auxiliary passwords generally confer less comprehensive rights than owner passwords. password is case-sensitive; a table protected with "Sesame" won't open for "SESAME".

Passwords added using this method are valid only for the session they are presented in, and are in effect only until the session is closed. Presenting a password does not affect the state of tables: for example, an open table remains open.

Access to tables opened before the password is presented is controlled by passwords previously presented. For instance, if a table was opened using an auxiliary password, the access rights to that table do not change upon presentation of the owner password. To confer owner rights to a previously-opened table, you should first close the table, then present the owner password, then reopen the table.

Use removePassword to restore protection.


Example for Session::addPassword
addPassword Example

The following example acquires a password from the user, then presents it to the current session.

; getAddPass::pushButton
method pushButton(var eventInfo Event)
var
  newPass String
endVar
; assume that the variable ses is global, and has been
; opened by another method
if ses.isAssigned() then
  newPass.view("Enter Password (up to 31 characters) to Add.")
  ses.addPassword(newPass)
else
  msgStop("Help!","Session variable is not Assigned!")
endIf
endMethod


See Also for Session::addPassword
See Also

removePassword

removeAllPasswords


Session::addProjectAlias
addProjectAlias	5.0

See Also	Example1	Example2	Example3	Session Type

Method/Procedure

Adds a project alias to a session.

Syntax

1. addProjectAlias ( const aliasName String, const type String, const path String ) Logical

2. addProjectAlias ( const aliasName String, const type String, const params DynArray[] String ) Logical

3. addProjectAlias ( const aliasName String, const existingAlias String ) Logical

Description

addProjectAlias adds a project alias to a session. Use addAlias to add a public alias.

In syntax 1, specify the alias name in aliasName, the alias type ("Standard") in type, and the full DOS path in path.

In syntax 2, specify the alias name in aliasName, the SQL alias type (Interbase, Oracle, Sybase, or Informix) in type, and the parameters in params.

Syntax 3 allows you to copy an alias from existingAlias to aliasName.

An alias added using addProjectAlias is known only to the project in which it is defined, and exists only until the working directory is changed. Use saveProjectAliases to save project aliases in a file.

When :WORK: is set (for example, at startup) or changed (either interactively or through ObjectPAL), Paradox discards all current project aliases and loads those project aliases that are specific to the new working directory. Public aliases remain active and available; if a project alias has the same name as a public alias, Paradox does not load the project alias. By default, Paradox reads project aliases from :WORK:PDOXWORK.CFG, but you can use loadProjectAliases to specify a different file.


Example 1 for Session::addProjectAlias
addProjectAlias Example 1

The following example adds an alias to the current project, then supplies the new alias to the open method defined for the Database type. This code is attached to the built-in open method for the pageOne page.

; pageOne::open
method open(var eventInfo Event)
var
  custInfo Database
endVar

; add the CustomerInfo alias to the project
addProjectAlias("CustomerInfo", "Standard", "D:\\pdoxwin\\tables\\custdata")

; now use the alias specify the database to open
custInfo.open("CustomerInfo") ; opens the CustomerInfo database

endMethod


Example 2 for Session::addProjectAlias
addProjectAlias Example 2

The following example adds an Oracle type alias to the current project, then supplies the new alias to the open method defined for the Database type. This code is attached to the built-in open method for the pgeOne page.

; pgeOne::open

method open(var eventInfo Event)

var

tv	TableView

SQLdb     	Database

AliasInfo 	DynArray[]  String

endVar

AliasInfo["SERVER NAME"]    	= "Server1"

AliasInfo["USER NAME"]         	= "guest"

AliasInfo["OPEN MODE"]         	= "READ/WRITE"

AliasInfo["SCHEMA CACHE SIZE"] 	= "8"

AliasInfo["NET PROTOCOL"]      	= "SPX/IPX"

AliasInfo["LANGDRIVER"]        	= ""

AliasInfo["SQLQRYMODE"]        	= ""

AliasInfo["PASSWORD"]          	= "guest"

addProjectAlias("Guest_Account", "Oracle", AliasInfo)

SQLdb.open("Guest_Account", AliasInfo)

tv.open(":Guest_Account:mprestwood.customer")

endMethod


Example 3 for Session::addProjectProjectAlias
addProjectAlias Example 3

The following example adds an alias to the current session by copying the existing work alias to the new alias NewAlias.

; btnCopyWork::pushButton

method pushButton(var eventInfo Event)

addProjectAlias("NewAlias", "work")

endMethod


See Also for Session::addProjectAlias
See Also

Paradox Help: Public and Project Aliases

addAlias

loadProjectAliases

removeProjectAlias

saveProjectAliases


Session::advancedWildcardsInLocate
advancedWildcardsInLocate

See Also	Example	Session Type

Procedure

Specifies whether this session can use advanced wildcards in locate operations.

Syntax

advancedWildcardsInLocate ( [ const yesNo Logical ] )

Description

advancedWildcardsInLocate specifies whether the current session should use advanced wildcards found in pattern strings during locate operations. If yesNo is Yes, pattern strings used in locate operations can contain advanced wildcard characters; if set to No, pattern strings in locate operations cannot contain advanced wildcards. If omitted, yesNo is Yes by default.


Example for Session::advancedWildcardsInLocate
advancedWildcardsInLocate Example

The following example calls advancedWildcardsInLocate, if necessary, to specify that advanced wild cards can be used in a locate operation. Then the code continues with a call to locatePattern that uses an advanced wildcard pattern.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
  thisSession Session
endVar

if tc.open("Orders.db") then

  ; if advanced wild cards can't be used in patterns
  if NOT isAdvancedWildcardsInLocate() then
    ; specify that this session can use advanced
    ; pattern characters in subsequent locate operations
    advancedWildcardsInLocate(Yes)
  endIf

  if tc.locatePattern("Ship VIA", "[^UPS]") then
    msgInfo("Order Number", tc."Order No")
  else
    msgStop("Error", "Can't find record")
  endIf
else
  msgStop("Error", "Can't open Orders table.")
endIf

endMethod


See Also for Session::advancedWildcardsInLocate
See Also

isAdvancedWildcardsInLocate


Session::blankAsZero
blankAsZero

See Also	Example	Session Type

Method/Procedure

Specifies whether to treat blank values as zeros in calculations.

Syntax

blankAsZero ( const yesNo Logical )

Description

blankAsZero specifies whether to assign blank numeric fields a value of 0 in calculations. If yesNo is Yes, blanks are treated as zeros. If yesNo is No, they are not.

Calculations affected by blankAsZero include:

Calculated fields in forms and reports

Calculations in queries

Column calculations that involve either the number of fields or the number of non-blank fields, for example, those performed with cCount, cAverage, and others

You may want to perform these calculations differently depending on the state of blankAsZero. You can use isBlankZero to test the state, and blankAsZero to set it.


Example for Session::blankAsZero
blankAsZero Example

The following example sets blankAsZero, if necessary, to True so that a call to the cAverage method treats blank field values as zeros.

; getAvgPmt::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
endVar

if tc.open("Orders.db") then
  if not isBlankZero() then
    blankAsZero(True)
  endIf

  msgInfo("Average Amount Paid", tc.cAverage("Amount Paid"))

else
  msgStop("Error", "Can't open Orders table.")
endIf

endMethod


See Also for Session::blankAsZero
See Also

isBlankZero


Session::close
close

See Also	Example	Session Type

Method

Closes a session.

Syntax

close ( ) Logical

Description

close ends a session by closing the channel to the database engine. close frees one user count, and makes the Session variable unassigned.


Example for Session::close
close Example

For the following example, assume that the variable ses is assigned to an open session. This example closes the session ses.

; closeSession::pushButton
method pushButton(var eventInfo Event)
; assume that the variable ses is global, and has been
; opened by another method
if ses.isAssigned() then
  if ses.close() then
    msgInfo("We have TouchDown","Session close Successful.")
  else
    msgStop("Crash and Burn","Session close Unsuccessful.")
  endIf
else
  msgStop("Help!","Session variable is not Assigned! Who am I?")
endIf
endMethod


See Also for Session::close
See Also

open


Session::enumAliasLoginInfo
enumAliasLoginInfo	4.5

See Also	Example	Session Type

Method

Writes data about a specified alias to a table.

Syntax

enumAliasLoginInfo ( const tableName String, const aliasName String ) Logical

Description

enumAliasLoginInfo writes information about the alias specified in aliasName to the Paradox table specified in tableName. Returns True if successful; otherwise returns False. enumAliasLoginInfo operates on aliases stored in IDAPI.CFG and on new aliases opened and stored in system memory. This method fails if the table specified in tableName is already open.

The structure of the resulting table is:

Field name	Type	Description

DBName	A32*	Name of the database.

Property	A32*	Name of the property. Examples of properties (which vary depending on the database type) are: OPEN MODE, NET PROTOCOL, SERVER NAME, and USER NAME.

PropertyValue	A82	Value of the property.


Example for Session::enumAliasLoginInfo
enumAliasLoginInfo Example

The following example calls enumAliasLoginInfo to write data about an alias to a Paradox table. Then it searches the table to test whether the OPEN MODE property for the alias is set to READ/WRITE. If it is, the code calls a custom procedure named doSomething (which is assumed to be defined elsewhere) to continue processing. Otherwise, the code displays information about properties and property values in a modal dialog box to inform the user of the problem.

method pushButton(var eventInfo Event)

   var
      db                Database
      aliasInfoTC       TCursor
      aliasName,
      infoTableName,
      fieldName1,
      fieldName2,
      propName,
      propVal           String
      propValDA         DynArray[] AnyType
   endVar

   ; initialize variables
   aliasName = "itchy"
   infoTableName = "dbAlias.db"
   fieldName1 = "Property"
   fieldName2 = "PropertyValue"
   propName  = "OPEN MODE"
   propVal  = "READ/WRITE"

   ; open database, get alias info
   if db.open(aliasName) then
      if enumAliasLoginInfo(infoTableName, aliasName) then
         aliasInfoTC.open(infoTableName)

         ; search for info of interest
         if aliasInfoTC.locate(fieldName1, propName) then

            ; compare expected and actual values
            if aliasInfoTC.(fieldName2) <> propVal then

               ; inform user if values don't match
               propValDA["Property:"] = aliasInfoTC.(fieldName1)
               propValDA["Expected value:"] = propVal
               propValDA["Actual value:"] = aliasInfoTC.(fieldName2)
               propValDA.view("Property mismatch")
               return
            endIf

         else
            errorShow("Property not found.")
            return
         endIf
      else
         errorShow("Can't write to table: " + infoTableName)
         return
      endIf
   else
      errorShow("Couldn't open " + aliasName)
      return
   endIf

   doSomething() ; if property values are OK, continue processing

endMethod


See Also for Session::enumAliasLoginInfo
See Also

enumAliasNames


Session::enumAliasNames
enumAliasNames

See Also	Example	Session Type	Changes

Method/Procedure

Lists the names of database aliases available to a session.

Syntax

1. enumAliasNames ( const tableName String [, const LoginInfoTableName String ] ) Logical

2. enumAliasNames ( var aliasNames Array[] String ) Logical

Description

enumAliasNames lists the names of database aliases available to a session.

Syntax 1 creates a Paradox table tableName. If tableName already exists, this method overwrites it without asking for confirmation. If tableName is open, this method fails. You can include an alias or path in tableName; if no alias or path is specified, Paradox creates the table in the working directory.

The structure of tableName is

Field Name	Type	Description

DBName	A32*	The database alias name

DBType	A32	The driver type

DBPath	A82	The alias path

The optional argument LoginInfoTableName was added in version 5.0. If you include this argument, Paradox writes login data to the table, just as if you had called enumAliasLoginInfo.

The structure of the resulting table is

Field name	Type	Description

DBName	A32*	Name of the database.

Property	A32*	Name of the property. Examples of properties (which vary depending on the database type) are OPEN MODE, NET PROTOCOL, SERVER NAME, and USER NAME.

PropertyValue	A82	Value of the property.

Syntax 2 (added in version 5.0) assigns the database names to items in an array aliasNames that you declare and pass as an argument.


Example for Session::enumAliasNames
enumAliasNames Example

In the following example, the pushButton method for getAliasButton writes the alias names active for the current session to an array. If the array does not contain the name of a specified alias, a call to addAlias adds it to the session.

; getAliasButton::pushButton
method pushButton(var eventInfo Event)
var
stAliasName,

stAliasPath	String
arAliasNames	Array[] String
endVar

stAliasName = "NewCust"

stAliasPath = "g:\\netdata\\newcust"

enumAliasNames(arAliasNames)   ; List names to an array.
if arAliasNames.contains(stAliasName) then

return

else
addAlias(stAliasName, "STANDARD", stAliasPath)

endIf
endMethod


See Also for Session::enumAliasNames
See Also

addAlias

getAliasPath


Changes to Session::enumAliasNames

The optional argument LoginInfoTableName was added to syntax 1 in version 5.0.


Session::enumDataBaseTables
enumDatabaseTables

See Also	Example	Session Type	Changes

Method/Procedure

Lists the tables and other files in a database.

Syntax

1. enumDatabaseTables ( const tableName String, const databaseName String, const fileSpec String )

2. enumDatabaseTables ( var tableNames Array[] String, const databaseName String, const fileSpec String )

Description

enumDatabaseTables lists the tables and other files in the database specified by databaseName, where databaseName is an alias known to the session. fileSpec specifies a DOS file specification (it can include the wildcards * and ?).

Syntax 1 creates the Paradox table tableName. If tableName already exists, this method overwrites it without asking for confirmation. You can include an alias or path in tableName; if no alias or path is specified, Paradox creates tableName in the working directory.

The structure of the table is

Field Name	Type	Description

DBName	A32*	The database alias

TableName	A32*	The name of the table (or other file, depending on the file specification)

Syntax 2 (added in version 5.0) assigns the table names to items in an array tableNames that you pass as an argument.


Example for Session::enumDataBaseTables
enumDataBaseTables Example

The following example lists the Paradox and dBASE tables (and any other file whose extension is DB followed by 0 or 1 characters) in the user's private directory. It uses enumDataBaseTables as a procedure and works in the current session.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  dbName,
  fileSpec,
  tbName    String
  tv1       TableView
endVar

; Init variables.
dbName   = ":PRIV:"
fileSpec = "*.db?" ; Lists <filename>.db and <filename>.dbf
tbName   = "TabList"

enumDataBaseTables(tbName, dbName, fileSpec)
tv1.open(tbName)  ; Open the created table.
endMethod


See Also for Session::enumDataBaseTables
See Also

enumDriverCapabilities


Changes to Session::enumDatabaseTables

Syntax 2 (added in version 5.0) assigns the table names to items in an array tableNames that you pass as an argument.


Session::enumDriverCapabilities
enumDriverCapabilities

See Also	Example	Session Type	Changes

Procedure

Lists the capabilities of the current driver.

Syntax

enumDriverCapabilities ( const drvCapName String, const tblCapName String, const fldCapName String [ , const inxCapName String ] ) Logical

Description

enumDriverCapabilities creates three Paradox tables that list the capabilities of the current driver. Paradox overwrites the tables (if they exist) without asking for confirmation. You can include an alias or path in the specified table names; if no alias or path is specified, Paradox creates the tables in the working directory.

Driver capabilities are written to the table drvCapName (each supported table type is described by a record), which has the following structure:

Field Name	Type	Description

DriverType	A32*	Name of driver; for example, DBASE.

Description	A32	Text describing the driver; for example, dBASE driver.

Category	A32	Driver category.

DB	A4	If True or Yes, the driver supports a true database concept; otherwise, the driver uses a file system to simulate a database.

DBType	A32	Database type to be used; for example, STANDARD.

MultiUser	A4	If True or Yes, the driver supports multiuser access; otherwise, it doesn't.

ReadWrite	A4	If True or Yes, the driver is read-write; otherwise, it's read only.

Transactions	A4	If True or Yes, the driver supports transactions; otherwise, it doesn't.

PassThruSQL	A4	If True or Yes, the driver supports pass-through SQL; otherwise, it doesn't.

Login	A4	If True or Yes, the driver requires an explicit login (for example, to access a SQL server); otherwise, it doesn't.

CreateDb	A4	If True or Yes, the driver can create a database; otherwise, it can't.

DeleteDb	A4	If True or Yes, the driver can delete a database; otherwise, it can't.

CreateTable	A4	If True or Yes, the driver can create a table; otherwise, it can't.

DeleteTable	A4	If True or Yes, the driver can delete a table; otherwise, it can't.

MultiPasswords	A4	If True or Yes, the driver supports multiple passwords; otherwise, it doesn't.

Table capabilities are written to the table tblCapName (each supported table type is described by a record), which has the following structure:

Field Name	Type	Description

DriverType	A32*	Type of table; for example, dBASE.

TableType	A32*	Text describing the table type; for example, PDOX 5.0.

Format	A32*	Table format; for example, CLUSTERED.

ReadWrite	A4	If True or Yes, the user can read from and write to the table; otherwise, the user can read only.

Create	A4	If True or Yes, the user can create a table of this type; otherwise, the user cannot.

Restructure	A4	If True or Yes, the user can restructure a table of this type; otherwise, the user cannot.

ValChecks	A4	If True or Yes, the user can specify validity checks for a table of this type; otherwise, the user cannot.

Security	A4	If True or Yes, the table can be password-protected; otherwise, it cannot.

RefInt	A4	If True or Yes, the table can participate in a referential integrity relationship; otherwise, it cannot.

PrimaryKey	A4	If True or Yes, the table supports primary keys; otherwise, it does not.

Indexing	A4	If True or Yes, the table can have other (secondary) indexes; otherwise, it cannot.

NoFieldType	A6	Number of physical field types supported.

MaxRecSize	A6	Maximum record size (in bytes).

MaxFlds	A6	Maximum number of fields per record.

Field capabilities are written to the table fldCapName, which has the following structure:

Field Name	Type	Description

DriverType	A32*	Type of table; for example, dBASE.

TableType	A32*	Text describing the table type; for example, PDOX 5.0.

Format	A32*	Table format; for example, CLUSTERED.

FieldType	A32*	Field type.

Description	A32	Description of field type; for example, Long integer.

NativeType	A6	Numeric value of native field type; for example, 266.

XType	A6	Numeric value of translated field type; for example, 3.

XSubType	A6	Numeric value of translated field subtype; for example, 3.

MaxUnits1	A6	Maximum places to the left of the decimal point (or number of characters); for example, 240.

MaxUnits2	A6	Maximum places to the right of the decimal point; for example, 19.

Size	A6	Field size; for example, 8.

Required	A4	If True or Yes, the field is a required field; otherwise, it isn't.

Default	A4	If True or Yes, the field has a specified default value; otherwise, it doesn't.

Min	A4	If True or Yes, the field has a specified minimum value; otherwise, it doesn't.

Max	A4	If True or Yes, the field has a specified maximum value; otherwise, it doesn't.

RefInt	A4	If True or Yes, the field is part of a referential integrity realtionship; otherwise, it isn't.

Other	A4	Reserved.

Key	A4	If True or Yes, the field can be part of an index (keyed).

Multi	A4	If True or Yes, the driver supports more than one of these fields per record.

MinUnits1	A6	Minimum places to the left of the decimal point (or number of characters); for example, 240. Added in version 5.0.

MinUnits2	A6	Minimum places to the right of the decimal point; for example, 19. Added in version 5.0.

Createable	A4	If True or Yes, the driver can create a table using this field type. Added in version 5.0.

If the optional argument inxCapName (added in version 5.0) is included, index capabilities are written to the table specified in inxCapName, which has the following structure:

Field Name	Type	Description

DriverType	A32*	Type of table; for example, dBASE.

TableType	A32*	Text describing the table type; for example, PDOX 5.0.

Format	A32*	Table format; for example, CLUSTERED.

Name	A32*	Internal name describing the type of index; for example, SECONDARY. A corresponding description is provided in the Description field.

Format1	A32*	Index format; for example, BTREE.

Description	A32	Description of the index; for example, Nonmaintained Secondary index.

Composite	A4	Yes if the index supports composite keys; otherwise No.

Primary	A4	Yes if the index is a primary index; otherwise No.

Unique	A4	Yes if the index is a unique index; otherwise No.

keyDescending	A4	Yes if the whole key can be descending; otherwise No.

fldDescending	A4	Yes if the index is field level descending; otherwise No.

Maintained	A4	Yes if the index is a maintained index; otherwise No.

Subset	A4	Yes if the index is a subset index; otherwise No.

KeyExp	A4	Yes if the index is an expression index; otherwise No.

CaseInsensitive	A4	Yes if the index is insenstitive to case; otherwise No.


Example for Session::enumDriverCapabilities
enumDriverCapabilities Example

In the following example, the describeDriver button creates and views three tables that describe the engine driver.

; describeDriver::pushButton
method pushButton(var eventInfo Event)
var
  tv1, tv2, tv3  TableView
endVar
enumDriverCapabilities("dbcap", "tblcap", "fldcap")
tv1.open("dbcap")
tv2.open("tblcap")
tv3.open("fldcap")
endMethod


See Also for Session::enumDriverCapabilities
See Also

enumDriverInfo

enumDriverNames

enumDriverTopics


Changes to Session::enumDriverCapabilities

The following fields were added to the table of field capabilities (specified in fldCapName) in version 5.0:

Field Name	Type	Description

MinUnits1	A6	Minimum places to the left of the decimal point (or number of characters); for example, 240. Added in version 5.0.

MinUnits2	A6	Minimum places to the right of the decimal point; for example, 19. Added in version 5.0.

Createable	A4	If True or Yes, the driver can create a table using this field type. Added in version 5.0.

If the optional argument inxCapName (added in version 5.0) is included, index capabilities are written to the table specified in inxCapName.


Categories for Session::enumDriverCapabilities

Value	Description

File	File-based (Paradox, dBASE).

SQL Server	SQL-based server.

Other Server	Other kind of server (not file, not SQL).


Field types for Session::enumDriverCapabilities

The following tables (updated for version 5.0) list the field types for Paradox and dBASE tables:

Paradox field type	Return value

Alpha	ALPHA

Autoincrement	AUTOINCREMENT

BCD	BCD

Binary	BINARY

Bytes	BYTES

Date	DATE

FmtMemo	FMTMEMO

Graphic	GRAPHIC

Logical	LOGICAL

LongInt	LONG

Memo	MEMO

Money	MONEY

Number	NUMBER

OLE	OLE

Short	SHORT

Time	TIME

TimeStamp	TIMESTAMP

dBASE field type	Return value

BINARY	BINARY

CHAR	CHARACTER

DATE	DATE

FLOAT	FLOAT

LOGICAL	LOGICAL

MEMO	MEMO

NUMBER	NUMERIC

OLE	OLE


Session::enumDriverInfo
enumDriverInfo

See Also	Example	Session Type

Procedure

Lists information about available drivers.

Syntax

enumDriverInfo ( const tableName String )

Description

enumDriverInfo lists information about driver types currently available. Information is written to the table tableName. If tableName exists, it is overwritten without asking for confirmation. You can include an alias or path in tableName; if no alias or path is specified, Paradox creates tableName in the working directory.

The structure of tableName is

Field Name	Type	Description

DriverType	A32*	Type (or name) of driver; for example, PARADOX. See enumDriverNames for more information.

Topic	A32*	Driver function; for example, TABLE CREATE. See enumDriverTopics for more information.

Property	A32*	Property of corresponding driver function; for example, BLOCK SIZE.

PropertyValue	A68	Value of corresponding property; for example, 2048.


Example for Session::enumDriverInfo
enumDriverInfo Example

The following example enumerates driver information to a table named DriveInf, then views the table.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tv1 TableView
endVar
; create and view the DriveInf table
enumDriverInfo("Driveinf")
tv1.open("DriveInf")
endMethod


See Also for Session::enumDriverInfo
See Also

enumDriverCapabilities

enumDriverNames

enumDriverTopics


Session::enumDriverNames
enumDriverNames

See Also	Example	Session Type

Method/Procedure

Creates a Paradox table listing the names of the drivers available in the current session.

Syntax

enumDriverNames ( const tableName String )

Description

enumDriverNames writes the driver names currently available to the table tableName. If tableName already exists, it is overwritten without asking for confirmation. You can include an alias or path in tableName; if no alias or path is specified, Paradox creates tableName in the working directory.

The structure of the table is DriverType, A32*.


Example for Session::enumDriverNames
enumDriverNames Example

The following example enumerates available driver names to a table named DrivName, then views the table.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tv1  TableView
endVar
; create and view the DrivName table
enumDriverNames("DrivName")
tv1.open("DrivName")
endMethod


See Also for Session::enumDriverNames
See Also

enumDriverCapabilities

enumDriverInfo

enumDriverTopics


Session::enumDriverTopics
enumDriverTopics

See Also	Example	Session Type

Procedure

Lists the topics currently available for each driver type.

Syntax

enumDriverTopics ( const tableName String )

Description

enumDriverTopics writes the driver topics available for each driver type to the table tableName. If tableName already exists, it is overwritten without asking for confirmation. You can include an alias or path in tableName; if no alias or path is specified, Paradox creates tableName in the working directory.

The structure of tableName is:

Field Name	Type	Description

DriverType	A32*	Type (or name) of driver; for example, PARADOX. See enumDriverNames for more information.

Topic	A32*	Driver function. For Paradox and dBASE tables, the topics are INIT and TABLE CREATE.


Example for Session::enumDriverTopics
enumDriverTopics Example

The following example enumerates available driver topics to a table named DrivTop, then views the table.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tv1  TableView
endVar
; create and view the DrivTop table
enumDriverTopics("drivtop")
tv1.open("drivtop")
endMethod


See Also for Session::enumDriverTopics
See Also

enumDriverCapabilities

enumDriverInfo

enumDriverNames


Session::enumEngineInfo
enumEngineInfo

See Also	Example	Session Type

Procedure

Creates a Paradox table listing the current IDAPI engine properties.

Syntax

enumEngineInfo ( const tableName String )

Description

enumEngineInfo creates a Paradox table that describes the contents of the IDAPI System Information dialog box. Each setting name and value is written to a record in the table tableName. If tableName already exists, it is overwritten without asking confirmation. You can include an alias or path in tableName; if no alias or path is specified, Paradox creates tableName in the working directory.

The structure of tableName is:

Field Name	Type	Description

Property	A32*	Engine property

PropertyValue	A68	Value of corresponding property.


Example for Session::enumEngineInfo
enumEngineInfo Example

The following example enumerates engine information to a table named EngInf, then views the table.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tv1  TableView
endVar
enumEngineInfo("EngInf")
tv1.open("EngInf")
endMethod


See Also for Session::enumEngineInfo
See Also

enumDriverInfo


Properties for Session::enumEngineInfo

Engine property	Description

LANGDRIVER	Name of language driver; for example, ascii.

LANGDRVDIR	Language driver directory.

LOCAL SHARE	TRUE if Local Share is active, FALSE if it is not active.

MAXBUFSIZE	Maximum buffer size (in bytes).

MAXFILEHANDLES	Maximum number of file handles.

MINBUFSIZE	Minimum buffer size (in bytes).

NET DIR	Path to NET directory.

NET TYPE	Network type.

SYSFLAGS	Number of system flags.

VERSION	IDAPI version number.


Session::enumFolder
enumFolder

See Also	Example	Session Type	Changes

Procedure

Lists the names of files in a folder (project).

Syntax

1. enumFolder ( const tableName String [, const fileSpec String ] ) Logical

2. enumFolder ( var result Array[] String [, const fileSpec String ] ) Logical

Description

enumFolder lists the names of files in a folder (project). In version 5.0, the Project Viewer replaced the Folder. By default, a project includes all the objects in :WORK: and :PRIV:. You can also add references to objects in other directories.

Syntax 1 creates the Paradox table tableName. If tableName already exists, this method overwrites it without asking for confirmation. You can include an alias or path in tableName; if no alias or path is specified, Paradox creates tableName in the working directory.

Syntax 2 lists the files in the array result which you must declare and pass as an argument. For each file, the array lists the file name (and extension, if one exists), and includes the path if the file is not in :WORK:.

Both syntaxes include an option to specify a fileSpec to list files with a particular extension. For instance, to list all forms in a file, include a fileSpec of ".FSL".

The structure of the table created by syntax 1 is

Field Name	Type	Description

Name	A128	File name (and extension, if one exists). Includes the path if the file is not in :WORK:.

LocalName	A68	File name without extension. Includes the path if the file is not in :WORK:.

IsReference	A4	If True or Yes, the file name refers to a file in a directory other than :WORK:; if No, the file is in :WORK:.

IsPrivate	A4	If True or Yes, the file name refers to a file in :PRIV:; otherwise, the file resides elsewhere.

IsTemp	A4	Reserved.

Position	A10	Reserved.


Example for Session::enumFolder
enumFolder Example

In the following example, the method prompts the user to enter a file specification (such as "*.FSL"). The file specification entered is then used by enumFolder to create a table listing the files that match the specification.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  filespec String
  tv1      TableView
endVar
filespec.view("Enter file name specification")
enumFolder("PartCat", filespec)
message("Table lists files that match your specification.")
tv1.open("PartCat")
endMethod


See Also for Session::enumFolder
See Also

Paradox Help: Project Viewer

enumDataBaseTables

loadProjectAliases


Changes to Session::enumFolder

In version 5.0, the Project Viewer replaced the Folder. By default, a project includes all the objects in :WORK: and :PRIV:. You can also add references to objects in other directories.


Session::enumOpenDatabases
enumOpenDatabases

See Also	Example	Session Type	Changes

Method/Procedure

Lists the open databases.

Syntax

1. enumOpenDatabases ( const tableName String ) Logical

2. enumOpenDatabases ( var tableNames Array[] String ) Logical

Description

enumOpenDatabases lists the databases open in the current session.

Syntax 1 creates the Paradox table tableName. If tableName already exists, this method overwrites it without asking for confirmation. You can include an alias or path in tableName; if no alias or path is specified, Paradox creates tableName in the working directory.

The structure of the table is:

Field Name	Type	Description

DBName	A 32*	Database alias name.

DBType	A 32	Database driver type.

ShareMode	A 32	Database share mode.

OpenMode	A 32	Database open mode.

Syntax 2 (added in version 5.0) writes the data to an array tableNames that you declare and pass as an argument.


Example for Session::enumOpenDatabases
enumOpenDatabases Example

In the following example, enumOpenDatabases creates a table OPENDB.DB, and then a tableview is opened to display the table.

; btnOpenDB :: pushButton

method pushButton(var eventInfo Event)

var

tv	TableView

endVar

enumOpenDatabases("OPENDB.DB")

tv.open("OPENDB.DB")

endMethod


See Also for Session::enumOpenDatabases
See Also

enumDataBaseTables


Changes to Session::enumOpenDatabases

Syntax 2 (added in version 5.0) writes the data to an array tableNames that you declare and pass as an argument.


Session::enumUsers
enumUsers

See Also	Example	Session Type	Changes

Procedure

Creates a Paradox table listing all known users with an open channel to the IDAPI engine.

Syntax

1. enumUsers ( const tableName String ) LongInt

2. enumUsers ( var userNames Array[] String ) LongInt

Description

enumUsers creates a list of all users with an open path to the IDAPI database engine.

Syntax 1 creates the table tableName that lists all users with an open path to IDAPI. If tableName exists, it is overwritten without asking for confirmation. You can include an alias or path in tableName; if no alias or path is specified, Paradox creates tableName in the working directory.

The structure of the table is

Field Name	Type	Description

UserName	A15	Network user name

NetSession	N 	Network session number

ProductClass	N 	User's product class ID number

SerialNumber	A22	Serial number (version 1.0 only)

Syntax 2 (added in version 5.0) fills the array userNames with the network user names of users who currently have an open path to IDAPI. You must declare the array before calling this procedure.


Example for Session::enumUsers
enumUsers Example

The following example writes information about current users to the table Users, then displays the table.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tv1 TableView
endVar
  enumUsers("users")
  tv1.open("users")
endMethod


See Also for Session::enumUsers
See Also

getNetUserName


Changes to Session::enumUsers

Syntax 2 (added in version 5.0) fills the array userNames with the network user names of users currently with an open path to IDAPI. You must declare the array before calling this procedure.


Session::getAliasPath
getAliasPath

See Also	Example	Session Type

Method/Procedure

Returns the path for a specified alias.

Syntax

getAliasPath ( const aliasName String ) String

Description

getAliasPath returns the path for the alias aliasName.


Example for Session::getAliasPath
getAliasPath Example

The following example prompts the user for an alias name, then shows the path currently associated with that alias.

; getShowPath::pushButton
method pushButton(var eventInfo Event)
var

stPrompt,

stAliasName,

stCurrentPath,

stMyPath	String
endVar

stPrompt    = "Enter an Alias Name."

stAliasName = stPrompt

stMyPath    = "d:\\pdoxwin\\data"

stAliasName.view(stPrompt)    ; prompt for an alias name
if stAliasName = stPrompt then

return ; User didn't click the OK button.

else

stCurrentPath = getAliasPath(stAliasName)  ; get the path

endIf

if stCurrentPath = stMyPath then

return

else

setAliasPath(stAliasName, stMyPath)

endIf
endMethod


See Also for Session::getAliasPath
See Also

addAlias

setAliasPath


Session::getAliasProperty
getAliasProperty	4.5

See Also	Example	Session Type

Method

Returns the value of a specified property for a specified alias.

Syntax

getAliasProperty ( const aliasName String, const property String ) String

Description

getAliasProperty returns a string representing the value of the property specified in property for the alias specified in aliasName. If the property is not valid for the alias, this method returns an error. getAliasProperty operates on aliases stored in IDAPI.CFG and on new aliases opened and stored in system memory.


Example for Session::getAliasProperty
getAliasProperty Example

The following example uses getAliasProperty to get the value of the OPEN MODE property. It compares the returned (actual) value with the expected value. If they match, the code calls a custom procedure named doSomething (assumed to be defined elsewhere) to continue processing. Otherwise, the code informs the user of a property mismatch and calls setAliasProperty to set the property to the expected value.

method pushButton(var eventInfo Event)

   var
      db                Database
      aliasName,
      propName,
      expectedPropVal,
      actualPropVal     String
      propValDA         DynArray[] AnyType
   endVar

   ; initialize variables
   aliasName = "itchy"
   propName = "OPEN MODE"
   expectedPropVal = "READ/WRITE"

   if db.open(aliasName) then

      ; get property value and compare with expected value
      actualPropVal = getAliasProperty(aliasName, propName)
      if actualPropVal = expectedPropVal then
         doSomething() ; continue processing
         return
      else

         ; inform the user if there's a mismatch
         propValDA["Property name"] = propName
         propValDA["Expected value"] = expectedPropVal
         propValDA["Actual value"] = actualPropVal
         propValDA.view("Property mismatch:")

         ; let user decide what to do
         if msgQuestion("Set property value?",
            "Set "+propName+" to " + expectedPropVal + "?") = "Yes" then

            ; set property to expected value and continue processing
          if setAliasProperty(aliasName, propName, expectedPropVal) then
               doSomething() ; Continue processing
               return
          else
               errorShow("Couldn't set property value.",
                         "Operation canceled.")
               return
          endIf

         else
            msgInfo("Operation canceled.", "Property not set.")
            return
         endIf

      endIf

   else
      msgStop(aliasName, "Couldn't open database.")
      return
   endIf

endMethod


See Also for Session::getAliasProperty
See Also

setAliasProperty


Session::getNetUserName
getNetUserName

See Also	Example	Session Type

Method/Procedure

Returns the network user name for a session.

Syntax

getNetUserName ( ) String

Description

getNetUserName returns the name of the current network user.


Example for Session::getNetUserName
getNetUserName Example

The following example displays the current user's network name in a dialog box.

; thisButton::pushButton
method pushButton(var eventInfo Event)
msgInfo("Who Am I?", getNetUserName())
endMethod


See Also for Session::getNetUserName
See Also

enumUsers


Session::ignoreCaseInLocate
ignoreCaseInLocate

See Also	Example	Session Type

Procedure

Specifies whether to ignore case sensitivity in locates.

Syntax

ignoreCaseInLocate ( [ const yesNo Logical ] )

Description

ignoreCaseInLocate specifies whether the current session should ignore case-sensitivity during locate operations. If optional argument yesNo is Yes (or omitted), this subsequent locate operations will ignore case in string comparisons; if yesNo is No, locate operations will be case-sensitive.


Example for Session::ignoreCaseInLocate
ignoreCaseInLocate Example

The following example calls ignoreCaseInLocate, if necessary, to set up for a call to the locate method.

; findName::pushButton
method pushButton(var eventInfo Event)
var
  tc 	TCursor

loIgnoreCase	Logical
endVar

if tc.open("Customer.db") then

loIgnoreCase = isIgnoreCaseInLocate() ; Get user's setting.

  if loIgnoreCase then

    ; locate values based on value as entered
    ; (do not ignore case in string compares)
    ignoreCaseInLocate(No)
  endIf

  ; search for case-sensitive MacAnaly in Name field
  if tc.locate("Name", "MacAnaly") then
    tc.edit()
    tc.Name = "Macanaly"
    tc.endEdit()
  else
    message("Couldn't find MacAnaly...")
  endIf

ignoreCaseinLocate(loIgnoreCase) ; Restore user's setting.

else
  msgStop("Error", "Can't open Customer table.")
endIf

endMethod


See Also for Session::ignoreCaseInLocate
See Also

isIgnoreCaseInLocate


Session::isAdvancedWildcardsInLocate
isAdvancedWildcardsInLocate

See Also	Example	Session Type

Procedure

Reports whether this session is using advanced wildcards in locate operations.

Syntax

isAdvancedWildcardsInLocate ( ) Logical

Description

isAdvancedWildcardsInLocate reports whether the current session is using advanced wildcards during locate operations that include pattern strings.


Example for Session::isAdvancedWildcardsInLocate
isAdvancedWildcardsInLocate Example

The following example calls advancedWildcardsInLocate, if necessary, to specify that advanced wild cards can be used in a locate operation. Then the code continues with a call to locatePattern that uses an advanced wildcard pattern.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
  thisSession Session
endVar

if tc.open("Orders.db") then

  ; if advanced wild cards can't be used in patterns
  if NOT isAdvancedWildcardsInLocate() then
    ; specify that this session can use advanced
    ; pattern characters in subsequent locate operations
    advancedWildcardsInLocate(Yes)
  endIf

  if tc.locatePattern("Ship VIA", "[^UPS]") then
    msgInfo("Order Number", tc."Order No")
  else
    msgStop("Error", "Can't find record")
  endIf
else
  msgStop("Error", "Can't open Orders table.")
endIf

endMethod


See Also for Session::isAdvancedWildcardsInLocate
See Also

advancedWildcardsInLocate


Session::isAssigned
isAssigned

See Also	Example	Session Type

Method

Reports whether a session variable is assigned.

Syntax

isAssigned ( ) Logical

Description

isAssigned reports whether a Session variable is assigned.


Example for Session::isAssigned
isAssigned Example

See the example for close.


See Also for Session::isAssigned
See Also

open

close


Session::isBlankZero
isBlankZero

See Also	Example	Session Type

Method/Procedure

Reports whether blank values are being treated as zero in calculations.

Syntax

isBlankZero ( ) Logical

Description

isBlankZero returns True if blank fields are treated as fields with a value of zero in calculations, or are counted as filled fields in counting calculation (for example, cCount). If blank fields are treated as blanks or are being ignored in calculations and counts, isBlankZero returns False. Use blankAsZero to change this setting.


Example for Session::isBlankZero
isBlankZero Example

See the example for blankAsZero.


See Also for Session::isBlankZero
See Also

blankAsZero


Session::isIgnoreCaseInLocate
isIgnoreCaseInLocate

See Also	Example	Session Type

Procedure

Reports whether the current session is ignoring case sensitivity in locate operations.

Syntax

isIgnoreCaseInLocate ( ) Logical

Description

isIgnoreCaseInLocate reports whether the current session is ignoring case-sensitivity during locate operations.


Example for Session::isIgnoreCaseInLocate
isIgnoreCaseInLocate Example

See the example for ignoreCaseInLocate.


See Also for Session::isIgnoreCaseInLocate
See Also

ignoreCaseInLocate


Session::loadProjectAliases
loadProjectAliases	5.0

See Also	Example	Session Type

Procedure

Loads project alias specifications from a file.

Syntax

loadProjectAliases ( const cfgFileName String ) Logical

Description

loadProjectAliases loads project alias specifications from the file specified in cfgFileName. If cfgFileName does not specify a path, Paradox searches for it in the working directory. By default, Paradox automatically reads project aliases from :WORK:PDOXWORK.CFG when the working directory is set or changed. This method lets you specify a different file.

When :WORK: is set (for example, at startup) or changed (either interactively or through ObjectPAL), Paradox discards all current project aliases and loads those project aliases that are specific to the new working directory. Public aliases remain active and available; if a project alias has the same name as a public alias, Paradox does not load the project alias. This method returns True if it succeeds; otherwise, it returns False.


Example for Session::loadProjectAliases
loadProjectAliases Example

In this example, loadProjectAliases loads the project aliases in the open method of the first page in the form. It reads a list of custom aliases from C:\OFFICE\PDOXWIN\CUSTOM.CFG instead of from :WORK:PDOXWORK.CFG (the Paradox default configuration file).

;pge1 :: open

method open(var eventInfo Event)

loadProjectAliases("C:\\OFFICE\\PDOXWIN\\CUSTOM.CFG")

endMethod


See Also for Session::loadProjectAliases
See Also

addAlias

addProjectAlias

removeProjectAlias

saveProjectAliases

FileSystem::setWorkingDir


Session::lock
lock

See Also	Example	Session Type

Procedure

Locks one or more tables.

Syntax

lock ( const table { Table | TCursor | String},  const lockType String [, const table { Table | TCursor |  String },  const lockType String ]* ) Logical

Description

lock locks one or more tables specified in a comma-separated pairs of tables and lock types. You can use a TCursor or a Table to specify a table, and you can mix TCursor and Table variables in the list.

lockType must be a string expression that evaluates to one of the following value, listed in order of decreasing strength and increasing concurrency.

String value	Description

Exclusive	The current session has exclusive access to the table. No other session can open the table. Cannot be used with dBASE tables.

Full	The current session can restructure, write to, and read from the table. No other session can write to or restructure the table, they can only read from it. Cannot be used with dBASE tables.

Write	The current session can write to and read from the table. No other session can place a write lock or a read lock on the table.

Read	The current session can read from the table. No other session can place a write lock, full lock, or exclusive lock on the table.

If this method locks all the tables in the list, it returns True; otherwise, it returns False. If it can't lock all the tables, it doesn't lock any.


Example for Session::lock
lock Example

The following example attempts to place a write lock on the Orders table and a read lock on the Customer table. If lock is able to lock both tables, the code displays data from both of the tables in a dialog box. Then, the code calls unlock to remove the explicit locks placed on Customer and Orders.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  ordTB    Table
  custTC   TCursor
  sampDB   Database
  otherSes Session
endVar

otherSes.open("other") ; Open another session
otherSes.addAlias("samples", "Standard", "c:\\pdoxwin\\sample")
sampDB.open("samples", otherSes)

custTC.open("Customer.db", sampDB)
ordTB.attach("Orders.db", sampDB)

if lock(custTC, "Read", ordTB, "Write") then
  if custTC.locate("Name", "Unisco") then
    custNo = custTC."Customer No"

    ordTB.setIndex("Customer No")
    ordTB.setFilter(custNo, custNo)
    msgInfo(String("Total for order ", custNo),

            ordTB.cSum("Total Invoice"))
    unlock(custTC, "Read", ordTB, "Write")
  else
    msgStop("Error", "Can't find Unisco.")
  endIf
else
  errorShow()
endIf

endMethod


See Also for Session::lock
See Also

unLock


Session::open
open

See Also	Example	Session Type

Method

Opens a session (a channel to the database engine).

Syntax

1. open (  ) Logical

2. open ( const sessionName String ) Logical

Description

Calling open with no arguments (syntax 1) gives you a handle to the current session; it does not exhaust a user count. When you use sessionName to specify a session name (syntax 2), you open another channel to the database engine and exhaust one user count. The actual value of sessionName doesn't matter, as long as it is a valid string.

You can open more than one session from the same workstation, and Paradox will view each session as a separate user; for example, locks set in one session block access from the other.


Example for Session::open
open Example

The following code calls open twice: once to get a handle to the current session, and once to open a new session. Next it calls blankAsZero to specify how each session handles blank values in calculations. Then it passes the Session variables to a custom procedure named doSomething. The results of doSomething will be different for each session because of the different blankAsZero settings.

; openSession::pushButton
method pushButton(var eventInfo Event)
var
  currentSes,
  otherSes    Session
endVar

; Open sessions.
currentSes.open()
otherSes.open("other")

; Set session properties.
currentSes.blankAsZero(Yes)
otherSes.blankAsZero(No)

; Pass session handles to a custom procedure.
; Results will differ depending on settings for each session.
doSomething(currentSes)
doSomething(otherSes)

endMethod


See Also for Session::open
See Also

close


Session::removeProjectAlias
removeProjectAlias	5.0

See Also	Example	Session Type

Procedure

Removes a project alias.

Syntax

removeProjectAlias ( const alias String ) Logical

Description

removeProjectAlias removes the project alias specified in alias.

When :WORK: is set (for example, at startup) or changed (either interactively or through ObjectPAL), Paradox discards all current project aliases and loads those project aliases that are specific to the new working directory. Public aliases remain active and available; if a project alias has the same name as a public alias, Paradox does not load the project alias. By default, Paradox reads project aliases from :WORK:PDOXWORK.CFG, but you can use loadProjectAliases to specify a different file.


Example for Session::removeProjectAlias
removeProjectAlias Example

This example uses addProjectAlias in the page's built-in arrive method to add an alias to the current project, then uses removeProjectAlias in the page's built-in depart method to remove it.

The following code is attached to the page's built-in arrive method.

;pge1 :: arrive

method arrive(var eventInfo MoveEvent)

;Add the CustomerInfo alias to the project.

addProjectAlias("CustomerInfo", "Standard", "D:\\OFFICE\\PDOXWIN\\SAMPLE")

endMethod

The following code is attached to the page's built-in depart method.

;pge1 :: depart

method depart(var eventInfo MoveEvent)

;Remove the CustomerInfo alias from the project.

if not removeProjectAlias("CustomerInfo") then

errorShow("Could not remove project alias CustomerInfo.")

endIf

endMethod


See Also for Session::removeProjectAlias
See Also

addAlias

addProjectAlias

loadProjectAliases

removeAlias

saveProjectAliases

FileSystem::setWorkingDir

Paradox Help: Public and Project Aliases


Session::saveProjectAliases
saveProjectAliases	5.0

See Also	Example	Session Type

Procedure

Saves project alias specifications to a file.

Syntax

saveProjectAliases ( [ const fileName String ] ) Logical

Description

saveProjectAliases saves project alias specifications to a file. You can use the optional argument fileName to specify a file name. If you omit fileName, Paradox saves the alias to :WORK:PDOXWORK.CFG.

When :WORK: is set (for example, at startup) or changed (either interactively or through ObjectPAL), Paradox discards all current project aliases and loads those project aliases that are specific to the new working directory. Public aliases remain active and available; if a project alias has the same name as a public alias, Paradox does not load the project alias. By default, Paradox reads project aliases from :WORK:PDOXWORK.CFG, but you can use loadProjectAliases to specify a different file.


Example for Session::saveProjectAliases
saveProjectAliases Example

In the following example, saveProjectAliases is used to save the project aliases to MYPROJ.CFG after a project alias is added using addProjectAlias.

;pge1 :: open

method open(var eventInfo Event)

; Add project alias.

addProjectAlias("MYPROJ", "Standard", "D:\\OFFICE\\PDOXWIN\\MYPROJ")

; Save project aliases.

saveProjectAliases("MYPROJ.CFG")

endMethod


See Also for Session::saveProjectAliases
See Also

addAlias

addProjectAlias

loadProjectAliases

removeProjectAlias

FileSystem::setWorkingDir

Paradox Help: Public and Project Aliases


Session::setAliasPassword
setAliasPassword	4.5

See Also	Example	Session Type

Method

Sets the in-memory password for a specified alias.

Syntax

setAliasPassword ( const aliasName, const password String ) Logical

Description

setAliasPassword sets the in-memory password for the alias specified in aliasName to the value specified in password. The maximum length of a password is 31 characters. Then, the next time you open that alias, you can do so without supplying the password. In other words, calling setAliasPassword has the same effect as presenting a password interactively using the Alias Manager dialog box. It has no effect on the password stored and maintained on the server. This method returns True if successful; otherwise, it returns False.


Example for Session::setAliasPassword
setAliasPassword Example

The following example calls setAliasPassword to present the password for a specified alias. Then, when the call to open executes, it opens the database without prompting the user for a password.

method pushButton(var eventInfo Event)
   var
      aliasName,
      aliasPassword   String
   endVar

   ; initialize variables
   aliasName = "bedrock"
   aliasPassword = "fred" ; Max length: 31 characters

   ; set alias password and open database
   if setAliasPassword(aliasName, aliasPassword) then
db.open(aliasName) ; opens without prompting for password
   else
      errorShow("Couldn't set alias password.")
      return
   endIf

endMethod


See Also for Session::setAliasPassword
See Also

getAliasProperty

setAliasProperty


Session::setAliasProperty
setAliasProperty	4.5

See Also	Example	Session Type

Method

Sets the value of a specified property for a specified alias.

Syntax

setAliasProperty ( const aliasName String, const property String, const propertyValue String ) Logical

Description

setAliasProperty sets the value of the property specified in property to the value specified in propertyValue for the alias specified in aliasName. Returns True if successful; otherwise, returns False.

Properties you set using this method show up in the Alias Manager dialog box just as if you had set them interactively. However, property settings are not automatically saved to IDAPI.CFG. Use the Session procedure saveCFG to save alias properties to a file.


Example for Session::setAliasProperty
setAliasProperty Example

See the example for getAliasProperty.


See Also for Session::setAliasProperty
See Also

getAliasProperty

setAliasPassword


Session::removeAlias
removeAlias

See Also	Example	Session Type

Method/Procedure

Removes an alias from a session.

Syntax

removeAlias ( const aliasName String ) Logical

Description

removeAlias removes the alias alias from a session. You cannot remove :WORK: or :PRIV: or an alias that is open.


Example for Session::removeAlias
removeAlias Example

The following example adds an alias to the current session, then supplies the new alias to the open method defined for the Database type. When the alias is no longer needed, this code calls removeAlias to remove the alias name from the current session.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  custInfo Database
endVar

; Add the CustomerInfo alias to the current session.
addAlias("CustomerInfo", "Standard", "D:\\pdoxwin\\tables\\custdata")

; Now use the alias specify the database to open.
custInfo.open("CustomerInfo") ; Opens the CustomerInfo database.

; Do something with the opened database,
; then when the alias is no longer needed, close the
; database and remove the alias from the current session.

custInfo.close()
removeAlias("CustomerInfo")

endMethod


See Also for Session::removeAlias
See Also

addAlias


Session::removeAllPasswords
removeAllPasswords

See Also	Example	Session Type

Method/Procedure

Removes all passwords presented to a session.

Syntax

removeAllPasswords ( )

Description

removeAllPasswords reverses the effects of all addPassword statements issued for a session. It does not remove security from tables; it withdraws the passwords required to access protected tables.


Example for Session::removeAllPasswords
removeAllPasswords Example

The following example removes all the passwords from the session ses.

; removePasses::pushButton
method pushButton(var eventInfo Event)
; assume that the variable ses is global, and has been
; opened by another method
if ses.isAssigned() then
  ses.removeAllPasswords()
else
  msgStop("Help!","Session variable is not Assigned!")
endIf
endMethod


See Also for Session::removeAllPasswords
See Also

addPassword

removePassword


Session::removePassword
removePassword

See Also	Example	Session Type

Method/Procedure

Removes a password presented to a session.

Syntax

removePassword ( const password String )

Description

removePassword reverses the effect of an addPassword statement issued for a session. It does not unprotect the table; it merely withdraws the password specified in the argument password that was presented to access the table. Note that password is case-sensitive.


Example for Session::removePassword
removePassword Example

In the following example, the getRemovePass button acquires a password to remove from the user, then removes the password from the current session. Subsequent attempts to open tables protected by that password will fail.

; getRemovePass::pushButton
method pushButton(var eventInfo Event)
var
  newPass string
endVar
; assume that the variable ses is global, and has been
; opened by another method
if ses.isAssigned() then
  newPass.view("Enter Password to Remove")
  ses.removePassword(newPass)
else
  msgStop("Help!", "Session variable is not Assigned!")
endIf
endMethod


See Also for Session::removePassword
See Also

addPassword

removeAllPasswords


Session::retryPeriod
retryPeriod

See Also	Example	Session Type

Method/Procedure

Returns the number of seconds to retry an operation on a locked record or table.

Syntax

retryPeriod ( ) SmallInt

Description

retryPeriod returns the number of seconds to retry an operation on a locked record or table. The default value is 0, which means that operations are not retried.


Example for Session::retryPeriod
retryPeriod Example

The following example displays the current retry period to the user.

; getShowRetry::pushButton
method pushButton(var eventInfo Event)
var
  rp smallint
endVar
; assume that the variable ses is global, and has been
; opened by another method
if ses.isAssigned() then
  rp = ses.RetryPeriod()            ; get the current retry period
  rp.view("The Retry Period is...") ; display the value
else
  msgStop("Help!","Session variable is not assigned!")
endIf
endMethod


See Also for Session::retryPeriod
See Also

setRetryPeriod


Session::saveCFG
saveCFG

See Also	Example	Session Type

Method/Procedure

Saves the current session's alias information to a file.

Syntax

saveCFG ( const fileName String ) Logical

Description

saveCFG saves the IDAPI configuration for the current session to fileName. The configuration file specified by fileName can be loaded (with the -o command-line option) in place of IDAPI.CFG to set session information when you start Paradox for Windows.


Example for Session::saveCFG
saveCFG Example

See the example for System::dlgNetSystem.


See Also for Session::saveCFG
See Also

System::dlgNetSystem


Session::setAliasPath
setAliasPath

See Also	Example	Session Type

Method/Procedure

Sets the path for an alias.

Syntax

setAliasPath ( const aliasName String, const aliasPath String ) Logical

Description

setAliasPath sets the path aliasPath for the alias aliasName.


Example for Session::setAliasPath
setAliasPath Example

See the example for getAliasPath.


See Also for Session::setAliasPath
See Also

getAliasPath


Session::setRetryPeriod
setRetryPeriod

See Also	Example	Session Type

Method/Procedure

Sets the number of seconds to retry an action on a locked table or record.

Syntax

setRetryPeriod ( const period SmallInt ) Logical

Description

setRetryPeriod specifies in period the number of seconds to retry an action on a locked table or record. A value of 0 means that actions are not retried.


Example for Session::setRetryPeriod
setRetryPeriod Example

The following example prompts the user for a retry period, then sets the retry for the session to that value.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  rp Smallint
endVar
; assume that the variable ses is global, and has been
; opened by another method
if ses.isAssigned() then
  rp = ses.retryPeriod()
  rp.view("Enter retry period")  ; get a retry period from user
  ses.setRetryPeriod(rp)         ; set the session's retry period
else
  msgStop("Help!","Session variable is not assigned!")
endIf
endMethod


See Also for Session::setRetryPeriod
See Also

retryPeriod


Session::unLock
unlock

See Also	Example	Session Type

Procedure

Unlocks one or more tables.

Syntax

unlock ( const table { Table | TCursor |  String } ,
const lockType String  [ , const table {  Table | TCursor |  String } ,
const lockType String ] * ) Logical

Description

unlock unlocks one or more tables specified in a comma-separated list of tables and lock types.

unlock removes locks explicitly placed by a particular user or application using lock; it has no effect on locks placed automatically by Paradox. lockType must be a string expression that evaluates to one of the following values: Exclusive, Write, Read, or Full. "Read" and "Full" apply only to Paradox tables.)

If one unlock in the list fails, previous locks are not restored; the tables remain unlocked. You don't have to specify a session to use this method, because session data is set when you open a TCursor or attach to a Table.

Each time you lock a table explicitly, be sure to unlock it as soon as you no longer need the explicit lock. This ensures maximum concurrent availability of tables. Also, when you lock a table twice, you must unlock it twice. You can use the lockStatus method (defined for the TCursor and UIObject types) to determine how many explicit locks you have placed on a table. unlock returns False if you try to unlock a table that isn't locked or cannot be unlocked.


Example for Session::unLock
unLock Example

See the example for lock.


See Also for Session::unLock
See Also

lock

TCursor::lockStatus

UIObject::lockStatus


SmallInt Type

SmallInt values are small integers; that is, they can be represented by a small (short) series of digits. A SmallInt variable occupies 2 bytes of storage.

ObjectPAL converts SmallInt values to range from -32,768 to 32,767. An attempt to assign a value outside of this range to a SmallInt variable causes an error. For example,

var
   x, y, z SmallInt
endVar

x = 32767 ; The upper limit value for a SmallInt variable.
y = 1
z = x + y ; This statement causes an error.

When ObjectPAL performs an operation on SmallInt values, it expects the result to be a SmallInt, too. That's why the addition operation in the previous example causes an error: the result is too large to be a SmallInt. To work with a boundary value (in either the positive or negative direction), convert it to a type that can accommodate it. In the following example, ObjectPAL converts one SmallInt to a LongInt before doing the addition, and the statement succeeds. This example also assigns the result to a LongInt variable (which can handle the large value), instead of assigning it to a SmallInt variable (which could not).

var
   x, y SmallInt
   z    LongInt   ; Declare z as a LongInt so it can hold the result.
endVar

x = 32767 ; the upper limit value for a SmallInt variable
y = 1
z = LongInt(x) + y

Note:	The SmallInt value -32,768 cannot be stored in a Paradox table because, to Paradox, -32,768 = Blank. However, you can use this value in calculations, and you can store it in a dBASE table.

Note:	Run-time library methods and procedures defined for the Number type also work with LongInt and SmallInt variables. The syntax is the same, and the returned value is a Number. For example, the following code will work, even though sin does not appear in the list of methods for the SmallInt type:

var
   abc LongInt
   xyz Number
endVar
abc = 43
xyz = abc.sin()

Note:	ObjectPAL supports an alternate syntax:

methodName ( objVar , argument [ , argument ] )

methodName represents the name of the method, objVar is the variable representing an object, and argument represents one or more arguments. For example, the following statement uses the standard ObjectPAL syntax to return the sine of a number:

theNum.sin()

The following statement uses the alternate syntax:

sin(theNum)

We recommend using standard syntax for clarity and consistency, but you can use the alternate syntax wherever it's convenient.

The SmallInt type includes several derived methods from the Number and AnyType types.

Methods for the SmallInt Type

AnyType		Number		LongInt
blank		abs		bitAND
dataType		acos		bitIsSet
isAssigned		asin		bitOR
isBlank		atan		bitXOR
isFixedType		atan2		int
view		ceil		smallInt
		cos
		cosh
		exp
		floor
		fraction
		fv
		ln
		log
		max
		min
		mod
		number
		numVal
		pmt
		pow
		pow10
		pv
		rand
		round
		sin
		sinh
		sqrt
		tan
		tanh
		truncate


SmallInt::bitAND
bitAND

See Also	Example	SmallInt Type

Method

Performs a bitwise AND operation on two values.

Syntax

bitAND ( const value SmallInt ) SmallInt

Description

bitAND returns the result of a bitwise AND operation on value. bitAND operates on the binary representations of two integers, comparing them one bit at a time. The truth table for bitAND is:

a	b	a bitAND b

0	0	     0

1	0	     0

0	1	     0

1	1	     1


Example for SmallInt::bitAND
bitAND Example

In the following example, the pushButton method for a button named andTwoNums takes two integers and performs a bitwise AND calculation on them. The result of the calculation is displayed in a dialog box.

; andTwoNums::pushButton
method pushButton(var eventInfo Event)
var
  a, b SmallInt
endVar
a = 30233   ; binary 01110110 00011001
b = 1233    ; binary 00000100 11010001
a.bitAND(b) ; binary 00000100 00010001
msgInfo("The result of 30233 bitAND 1233 is:", a.bitAND(b))
; displays 1041
endMethod


See Also for SmallInt::bitAND
See Also

bitOR

bitXOR


SmallInt::bitIsSet
bitIsSet

See Also	Example1	Example2	SmallInt Type

Method

Reports whether a bit is 1 or 0.

Syntax

bitIsSet ( const value SmallInt ) Logical

Description

bitIsSet examines the binary representation of an integer, reporting whether the value bit is 0 or 1. It returns True if the bit specified is 1, and False if the bit is 0.

value is a number specified by 2n, where n is an integer between 0 and 14. The exponent n corresponds to one less than the position of the bit to test, counting from the right. For example, to specify the third bit from the right, use 4 (2(3-1), which is 22).


Example 1 for SmallInt::bitIsSet
bitIsSet Example 1

In the following example, the pushButton method for a button named isABitSet, examines the values in two unbound field objects: whichBit, and whatNum. whichBit contains the bit position (counting from the right) of the bit test. whatNum contains the integer to test. The pushButton method uses whichBit to calculate the value of the position, then assigns the result to bitNum. The method then checks Num to see if the bitNum bit is set, and displays the Logical result with a msgInfo dialog box.

; isABitSet::pushButton
method pushButton(var eventInfo Event)
var
  bitNum,
  Num      SmallInt
endVar
; get the bit position number from the whichBit
; field and convert to multiple of 2
bitNum = SmallInt(pow(2, whichBit - 1))
; get the number to test from the whatNum field
Num = whatNum
; is the bit for value bitNum 1 in Num?
msgInfo("Is Bit Set?", Num.bitIsSet(bitNum))
endMethod


Example 2 for SmallInt::bitIsSet
bitIsSet Example 2

The following example illustrates how you can use bitIsSet to display an integer as a binary number. The pushButton method for showBinary constructs a string of zeros and ones by testing each bit of a four-byte long integer. For readability, a blank is added to the string after 8 digits.

; showBinary::pushButton
method pushButton(var eventInfo Event)
var
  binString  String    ; to construct the binary string
  Num        SmallInt  ; number to test
  i          SmallInt  ; for loop index
endVar
if NOT whatNum.isBlank() then
  Num = whatNum                ; get the number test from whatNum
  binString = ""               ; initialize the string
  for i from 0 to 14
    if Num.bitIsSet(SmallInt(pow(2, i))) then
      binString = "1" + binString    ; add a 1 to the front of the string
    else
      binString = "0" + binString    ; add a 0 to the front of the string
    endif
    if i = 7 then
      binSTring = " " + binString    ; add a space every 8 digits
    endif
  endfor
  if Num < 0 then
    binString = "1" + binString      ; set the sign bit
  else
    binString = "0" + binString
  endif
  ; show the number
  message("The binary equivalent is ", binString)
endif
endMethod


See Also for SmallInt::bitIsSet
See Also

bitAND

bitOR

bitXOR


SmallInt::bitOR
bitOR

See Also	Example	SmallInt Type

Method

Performs a bitwise OR operation on two values.

Syntax

bitOR ( const value SmallInt ) SmallInt

Description

bitOR returns the result of a bitwise OR operation on value. bitOR operates on the binary representations of two integers, comparing them one bit at a time. The truth table for bitOR is:

a	b	a bitOR b

0	0	     0

1	0	     1

0	1	     1

1	1	     1


Example for SmallInt::bitOR
bitOR Example

In the following example, the pushButton method for a button named orTwoNums takes two integers and performs a bitwise OR calculation on them. The result of the calculation is displayed in a dialog box.

; orTwoNums::pushButton
method pushButton(var eventInfo Event)
var
  a, b SmallInt
endVar
a = 30233  ; binary 01110110 00011001
b = 1233   ; binary 00000100 11010001
a.bitOR(b) ; binary 01110110 11011001
msgInfo("30233 OR 1233", a.bitOR(b)) ; displays 30425
endMethod


See Also for SmallInt::bitOR
See Also

bitAND

bitXOR


SmallInt::bitXOR
bitXOR

See Also	Example	SmallInt Type

Method

Performs a bitwise XOR operation on two values.

Syntax

bitXOR ( const value SmallInt ) SmallInt

Description

bitXOR performs a bitwise XOR (exclusive OR) operation on value. bitXOR operates on the binary representations of two integers, comparing them one bit at a time. The truth table for bitXOR is:

a	b	a bitXOR(b)

0	0	     0

1	0	     1

0	1	     1

1	1	     0


Example for SmallInt::bitXOR
bitXOR Example

In the following example, the pushButton method for a button named xorTwoNums takes two integers and performs a bitwise XOR calculation on them. The result of the calculation is displayed in a dialog box.

; xorTwoNums::pushButton
method pushButton(var eventInfo Event)
var
  a, b SmallInt
endVar
a = 30233   ; binary 01110110 00011001
b = 1233    ; binary 00000100 11010001
a.bitXOR(b) ; binary 01110010 11001000
msgInfo("30233 XOR 1233", a.bitXOR(b)) ; displays 29384
endMethod


See Also for SmallInt::bitXOR
See Also

bitAND

bitOR


SmallInt::int
int

See Also	Example	SmallInt Type

Procedure

Casts a value as an integer.

Syntax

int ( const value AnyType ) SmallInt

Description

int casts (converts) the numeric expression value to an integer. If value is of a more precise type (for example, Number), precision is lost.


Example for SmallInt::int
int Example

The following example assigns a number to nn, views the value of nn in a dialog box, then displays nn as an integer. This code is attached to the pushButton method for the showInt button.

; showInt::pushButton
method pushButton(var eventInfo Event)
var
   nn Number
endVar
nn = 123.12
view(nn)                             ; displays 123.12
msgInfo("nn as Integer", int(nn))   ; displays 123
endMethod


See Also for SmallInt::int
See Also

smallInt


SmallInt::SmallInt
smallInt

See Also	Example	SmallInt Type

Beginner

Procedure

Casts a value as a small integer.

Syntax

smallInt ( const value AnyType ) SmallInt

Description

smallInt casts (converts) the numeric expression value to a SmallInt. If value is of a more precise type (for example, Number), precision is lost.


Example for SmallInt::SmallInt
smallInt Example

The following example assigns a number to x, then casts x to SmallInt and assigns the result to s. The decimal precision of x is lost when it is cast to a SmallInt.

; convertToInt::pushButton
method pushButton(var eventInfo Event)
var
  x Number
  s SmallInt
endVar
x = 12.34             ; give x a value
x.view()              ; view x, title of dialog will be "Number"
s = SmallInt(x)       ; cast x as a LongInt and assign to s
s.view()              ; show s, note that decimal places are lost
                      ; displays 12
endMethod


See Also for SmallInt::SmallInt
See Also

int


SQL Type

Changes

An ObjectPAL SQL variable represents an SQL statement. You can use ObjectPAL to create and execute SQL commands from methods just as if you were using Paradox interactively. You can execute SQL commands from an SQL file, an SQL statement, or a string. Some queries require Paradox to create temporary tables. Paradox creates these tables in the private directory.

Methods for the SQL Type

SQL

executeSQL

getQueryRestartOptions

isAssigned

readFromFile

readFromString

setQueryRestartOptions

wantInMemoryTCursor

writeSQL


Changes to SQL type methods

The following table lists new methods and methods that were changed for version 5.0.

New	Changed

getQueryRestartOptions	readFromFile (replaces executeSQLFile)

isAssigned	readFromString (replaces executeSQLString)

setQueryRestartOptions

wantInMemoryTCursor


SQL::executeSQL
executeSQL	4.5

See Also	Example	SQL Type

Method/Procedure

Executes an SQL statement.

Syntax

Method:

1. executeSQL ( const db Database) Logical

2. executeSQL ( const db Database, ansTbl String ) Logical

3. executeSQL ( const db Database, ansTbl Table ) Logical

4. executeSQL ( const db Database, ansTbl TCursor ) Logical

Procedure:

1. executeSQL ( const db Database, const qbeVar SQL ) Logical

2. executeSQL ( const db Database, const qbeVar SQL, ansTbl String ) Logical

3. executeSQL ( const db Database, const qbeVar SQL, ansTbl Table ) Logical

4. executeSQL ( const db Database, const qbeVar SQL, ansTbl TCursor ) Logical

Description

executeSQL executes a pass through SQL query created in an ObjectPAL method or procedure.

In syntax 1, where the answer table is not specified, executeSQL writes to ANSWER.DB in the user's private directory.

In syntax 2, specify the answer table as a string; if you do not include a file extension, the answer table is a Paradox table by default.

In syntax 3, where ansTbl is a Table variable, ansTbl must be assigned and valid.

In syntax 4, a TCursor is opened onto the answer set, which may be an in-memory table or a cursor onto the answer set.

executeSQL returns True if the query is executed on the server (even if the resulting table is empty); otherwise, it returns False.

An SQL query in ObjectPAL code begins with an SQL variable, the = sign, and the keyword SQL followed by a blank line. Next come the SQL statements that make up the body of the query, and another blank line. The query ends with the keyword endSQL. Because this kind of query is not a quoted string, it can contain tilde variables. Compare this method with readFromString.

Note:	executeSQL is a pass through function: the SQL statements are sent directly to the server as if by another user. They do not execute within the context of a database handle or active transaction.


Example for SQL::executeSQL
executeSQL Example

The following example prompts the user to enter an item name and stores the user's input in a variable. Then it uses the variable as a tilde variable in an SQL query and calls executeSQL to execute the query and store the results in a TCursor in system memory. If the query executes successfully, the results are passed to a custom procedure for more processing.

method pushButton(var eventInfo Event)
   var
      itemNameSQL      SQL
      aliasNamTC,
      itemNameTC       TCursor
      db               Database
      myAlias,
      promptString,
      aliasTableName,
      userItemName     String
   endVar

   ; initialize variables
   myAlias = "itchy"
   aliasTableName = ":PRIV:aliasNam.db"
   promptString = "Enter an item name here."
   userItemName = promptString

   enumAliasNames(aliasTableName) ; create a table of alias names

   ; use alias to open database
   aliasNamTC.open(aliasTableName)
   if aliasNamTC.locate("DBName", myAlias) then
      db.open(myAlias)   ; use alias to get database handle to server
   else
      msgStop("Stop", "The alias " + myAlias + " has not been defined.")
      return
   endIf

   userItemName.view("Item name:")
   if userItemName = promptString then
      return ; exit the method

   else
      ; set query (use a tilde variable to store user input)
      itemNameSQL = SQL

                    SELECT CustomerName, Order_no, ItemName
                    FROM   Customer, Sales
                    WHERE  Sales.ItemName = ~userItemName AND
                           Customer.CustNo = Sales.CustNo

                    endSQL

   endIf

   ; execute the query and process the results
   if itemNameSQL.executeSQL(db, itemNameTC) then
      doSomething(itemNameTC) ; call custom proc to process data
   else
      errorShow("executeSQL failed")
   endIf

endMethod


See Also for SQL::executeSQL
See Also

readFromFile

readFromString


SQL::getQueryRestartOptions
getQueryRestartOptions	5.0

See Also	Example	SQL Type

Method

Returns a value representing the user's query restart option setting.

Syntax

getQueryRestartOptions ( ) SmallInt

Description

getQueryRestartOptions returns an integer value representing the user's query restart option setting. Use one of the following ObjectPAL QueryRestartOptions constants to test the value:

QueryDefault	Use the options specified interactively using the Query Restart Options dialog box.

QueryLock	Lock all other users out of the tables needed while the query is running. If Paradox cannot lock a table, it does not run the query. This is the least polite to other users. And you must wait until all the locks can be secured before the query will run.

QueryNoLock	Run the query even if someone changes the data while it's running.

QueryRestart	Start the query over. Specify QueryRestart when you want to make sure you get a snapshot of the data as it existed at some instant. Another user might change the data after the query is completed but before the Answer table is displayed, but at least you got a snapshot. This is just the nature of multi-user work.


Example for SQL::getQueryRestartOptions
getQueryRestartOptions Example

See the example for setQueryRestartOptions.


See Also for SQL::getQueryRestartOptions
See Also

setQueryRestartOptions


SQL::isAssigned
isAssigned	5.0

See Also	Example	SQL Type

Method

Reports whether an SQL variable has an assigned value.

Syntax

isAssigned ( ) Logical

Description

isAssigned returns True if a SQL variable has been assigned a value; otherwise, it returns False. This method does not check the validity of the assigned SQL statement.


Example for SQL::isAssigned
isAssigned Example

In the following example, the call to isAssigned returns True, because the SQL variable sqlVar has been assigned a value, even though the value is not a valid SQL variable.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  sqlVar SQL
endVar

sqlVar = SQL

     This is not a valid SQL statement

     endSQL

msgInfo("Assigned?", sqlVar.isAssigned())    ; displays True

endMethod


See Also for SQL::isAssigned
See Also

query


SQL::readFromFile
readFromFile	5.0

See Also	Example	SQL Type

Method

Assigns the contents of an SQL file to an SQL variable.

Syntax

readFromFile ( const sqlFileName SQL ) Logical

Description

readFromFile opens sqlFileName (created with the writeSQL method or interactively using the SQL Editor) and assigns the contents to an SQL variable. Do not use the SQL and endSQL keywords. Use executeSQL to execute the query.

If the value of fileName does not include a path or alias, this method looks for the file in the directory associated with the specified database (or the default database, if a database is not specified). If the value of fileName does not include an extension, this method assumes an extension of .SQL. To specify a file name that does not have an extension, put a period at the end of the name. For example, the following table lists the resulting file names for various values of fileName.

Value of fileName	SQL file name

newcust	newcust.sql

newcust.	newcust

newcust.s	newcust.s

readFromFile returns True if it succeeds; otherwise, it returns False.

Note:	readFromFile is a pass through function: the SQL statements are sent directly to the server as if by another user. They do not execute within the context of a database handle or active transaction.

readFromFile replaces executeSQLFile, which existed in versions of ObjectPAL prior to 5.0.


Example for SQL::readFromFile
readFromFile Example

The following example creates a pop-up menu listing the SQL files in the user's private directory. When the user chooses a file from the menu, this code calls readFromFile to read the query, assign it to an SQL variable, execute the query, and store the results in a TCursor. Then it passes the TCursor to a custom procedure (assumed to be defined elsewhere) for more processing.

method pushButton(var eventInfo Event)
   var
      myAlias,
      aliasTableName,
      sqlFileName,
      sqlFileSpec      String
      aliasNamTC,
      answerTC         TCursor
      sqlPop           PopUpMenu
      db               Database
      sqlFS            FileSystem
      sqlFileAr        Array[] String

sqlVar	SQL
   endVar

   ; initialize variables
   myAlias = "itchy"
   aliasTableName = ":PRIV:aliasNam.db"
   sqlFileSpec = ":PRIV:*.SQL"

   enumAliasNames(aliasTableName) ; create a table of aliases

   aliasNamTC.open(aliasTableName)
   if aliasNamTC.locate("DBName", myAlias) then
      db.open(myAlias)  ; use alias to get database handle to server
   else
      msgStop("Stop",

              "The alias " + myAlias +

              " has not been defined.")
      return ; exit the method
   endIf

   ; build a pop-up menu listing SQL files in the target directory
   if sqlFS.findFirst(sqlFileSpec) then
      sqlFS.enumFileList(sqlFileSpec, sqlFileAr)
      sqlPop.addArray(sqlFileAr)
      sqlFileName = sqlPop.show() ; variable stores user's menu choice

      ; read and execute the SQL file chosen by the user
      sqlVar.readFromFile(sqlFileName)

      if sqlVar.executeSQL(answerTC) then

         doSomething(answerTC) ; call custom proc to process data
      else
         errorShow("readFromFile failed")
      endIf

   else
      msgStop("File not found:", sqlFileSpec)
   endIf

endMethod


See Also for SQL::readFromFile
See Also

executeSQL

readFromString


SQL::readFromString
readFromString	5.0

See Also	Example	SQL Type

Method

Assigns a query string to an SQL variable.

Syntax

readFromString ( const sqlString SQL ) Logical

Description

readFromString assigns the SQL query string specified in sqlString to an SQL variable. Do not enclose the string between the SQL and endSQL keywords. Use executeSQL to execute the query.

Note:	readFromString is a pass through function: the SQL statements are sent directly to the server as if by another user. They do not execute within the context of a database handle or active transaction.

readFromString replaces executeSQLString, which existed in versions of ObjectPAL prior to 5.0.


Example for SQL::readFromString
readFromString Example

The following example prompts the user to enter an SQL keyword, then uses that keyword as part of an SQL string. If the user enters a valid SQL keyword and the query executes successfully, the results are stored in a TCursor and passed to a custom procedure (assumed to be defined elsewhere) for more processing.

method pushButton(var eventInfo Event)
   var
      sqlKeyword,
      promptString,
      bigOrderString   String
      aliasNamTC,
      bigOrderTC       TCursor
      db               Database
      myAlias,
      aliasTableName   String

      sqlVar           SQL
   endVar

   ; Initialize variables.
   myAlias = "itchy"
   aliasTableName = ":PRIV:aliasNam.db"
   promptString = "Enter an SQL keyword (e.g. SELECT):"

   enumAliasNames(aliasTableName)

   ; Prompt user to enter an SQL keyword.
   sqlKeyword.view("SQL Keyword")
   if sqlKeyword = promptString then
      return ; Exit method if user doesn't enter a keyword.
   endIf

   ; Use alias to open database.
   aliasNamTC.open(aliasTableName)
   if aliasNamTC.locate("DBName", myAlias) then
      db.open(myAlias)  ; Use alias to get database handle to server
   else
      msgStop("Stop", "The alias " + myAlias +
                      " has not been defined.")
      return
   endIf

   ; Combine SQL statements and String variable sqlKeyword
   ; to create an SQL string.
   bigOrderString = sqlKeyword +

                    "CustName, Order_no, Sale_date, Qty
                    FROM     Customer
                    WHERE    Qty > 1000

   ; Read and execute the query and process the results.
   sqlVar.readFromString(bigOrderString)

   if sqlVar.executeSQL(bigOrderTC) then
      doSomething(bigOrderTC) ; call custom proc to process data
   else
      errorShow()
   endIf

endMethod


See Also for SQL::readFromString
See Also

executeSQL

readFromFile


SQL::setQueryRestartOptions
setQueryRestartOptions	5.0

See Also	Example	SQL Type

Method

Specifies what to do with the underlying tables while running a query.

Syntax

setQueryRestartOptions ( const qryRestartType SmallInt ) Logical

Description

setQueryRestartOptions tells Paradox what to do if data changes while you're running a query in a multiuser environment. The argument qryRestartType represents one of the following ObjectPAL QueryRestartOptions constants:

QueryDefault	Use the options specified interactively using the Query Restart Options dialog box.

QueryLock	Lock all other users out of the tables needed while the query is running. If Paradox cannot lock a table, it does not run the query. This is the least polite to other users. And you must wait until all the locks can be secured before the query will run.

QueryNoLock	Run the query even if someone changes the data while it's running.

QueryRestart	Start the query over. Specify QueryRestart when you want to make sure you get a snapshot of the data as it existed at some instant. Another user might change the data after the query is completed but before the Answer table is displayed, but at least you got a snapshot. This is just the nature of multi-user work.


Example for SQL::setQueryRestartOptions
setQueryRestartOptions Example

The following example calls getQueryRestartOptions to get the user's current query restart options. If the setting is not QueryRestart, this code calls setQueryRestartOptions to set it. Then it executes a query.

method pushButton(var eventInfo Event)

var

qVar	SQL

endVar

  if getQueryRestartOptions <> QueryRestart then
     setQueryRestartOptions(QueryRestart)
  endIf

if qVar.readFromFile("newcust.sql") then

qVar.executeSQL()

else

errorShow()

endIf
endMethod


See Also for SQL::setQueryRestartOptions
See Also

getQueryRestartOptions


SQL::wantInMemoryTCursor
wantInMemoryTCursor	5.0

See Also	Example	SQL Type

Method

Specifies how to create a TCursor resulting from a query.

Syntax

wantInMemoryTCursor ( [ const yesNo Logical ] )

Description

wantInMemoryTCursor specifies how to create a TCursor resulting from a query. By default, when you execute a query to a TCursor, that TCursor will point to a live query view---changes made to the TCursor will affect the underlying tables. When you call wantInMemoryTCursor with yesNo as Yes (or omitted), Paradox creates the TCursor in system memory, with no connection to underlying tables.

An in-memory TCursor can be useful for performing quick "what-if" analyses. For example, suppose you want to study the effect of giving each employee a 15 percent raise. You could query the employee data to increase everyone's salary by 15 percent. Of course, you wouldn't want to do this to the actual employee data (at least, not yet), so you would execute the query to an in-memory TCursor and work with the data there, without affecting the underlying data.


Example for SQL::wantInMemoryTCursor
wantInMemoryTCursor Example

This example uses an in-memory TCursor to study the effects of giving every employee a 15 percent raise. It reads a pre-defined query from a file and executes it, then uses the results in a calculation.

method pushButton(var eventInfo Event)

var

qVar	SQL

tcRaise15	TCursor

nuTotalPayroll	Number

endVar

qVar.wantInMemoryTCursor(Yes)

qVar.readFromFile("raise15.qbe")

qVar.executeQBE(tcRaise15)

nuTotalPayroll = tcRaise15.cSum("Salary")

nuTotalPayroll.view("Payroll after 15%	raise:")

endMethod


See Also for SQL::wantInMemoryTCursor
See Also

executeSQL

Query::wantInMemoryTCursor

TCursor::instantiateView

TCursor::isInMemoryTCursor

TCursor::isView

Paradox Help::Live Query Views


SQL::writeSQL
writeSQL	4.5

See Also	Example	SQL Type

Method/Procedure

Writes an SQL statement or an SQL string to a file.

Syntax

Method:

1. writeSQL ( const fileName String ) Logical

Procedure:

2. writeSQL ( const sqlString String, const fileName String ) Logical

Description

writeSQL writes a previously defined SQL statement or SQL string to the file specified in fileName. If fileName exists, Paradox overwrites it without asking for confirmation. writeSQL returns True if successful; otherwise, it returns False. This method does not evaluate the SQL commands.

Syntax 1 is a method; use dot notation to specify an SQL variable--for example, sqlVar.writeSQL("bigOrder.sql").

Syntax 2 is a procedure; instead of using dot notation, use a String variable as the first argument--for example, writeSQL(sqlString, "bigOrder.sql").


Example for SQL::writeSQL
writeSQL Example

The following example prompts the user to enter a table name and stores the name in a String variable. Then it uses the String variable as a tilde variable in an SQL statement. The call to writeSQL writes the SQL statement (including the expanded tilde variable) to a file. In other words, if the user enters ORDERS as a table name, the resulting SQL file would contain the following statements:

SELECT *
FROM ORDERS

This method does not verify that the file contains valid SQL statements.

method pushButton(var eventInfo Event)
   var
      sqlString,
      userTableName,
      sqlFileName,
      promptString    String
   endVar

   ; Initialize variables.
   sqlFileName = "user001.sql"
   promptString = "Enter table name here."
   userTableName = promptString

   ; Display a view() dialog box and prompt user for input.
   userTableName.view("Select * from table:")

   ; If user enters a string, use it in a tilde variable
   ; in the following SQL query.
   if userTableName <> promptString then

      sqlString = SELECT *
                  FROM ~userTableName

      writeSQL(sqlString, sqlFileName) ; Write user's query to a file.

   endIf

endMethod


See Also for SQL::writeSQL
See Also

executeSQL

readFromString

readFromFile


StatusEvent Type

StatusEvent type methods control messages that appear in the Desktop status bar. Using StatusEvent type methods, you can attach code to the built-in method to find out where and why messages will be displayed. You can block messages or display them somewhere else, in a different status area, or in another object (for example, a field object or a text file). You can also specify the text to be displayed in the message.

You can use the StatusReasons constants to refer to the areas of the status bar.

The StatusEvent type includes several derived methods from the Event type.

Methods for the StatusEvent Type

Event		StatusEvent
errorCode		reason
getTarget		setReason
isFirstTime		setStatusValue
isPreFilter		statusValue
isTargetSelf
reason
setErrorCode
setReason


StatusEvent::reason
reason

See Also	Example	StatusEvent Type

Method

Reports why a StatusEvent occurred.

Syntax

reason ( ) SmallInt

Description

reason returns an integer value to report why a StatusEvent occurred. StatusEvent reasons occur when a built-in status method is called. ObjectPAL provides StatusReasons constants for testing the value returned by reason.


Example or StatusEvent::reason
reason Example

The following example copies all the messages sent to the status bar to a field. Assume a form contains a field called fldStatus. The form's built-in status examines the event packet for the reason. If the reason is StatusWindow, then it sends the status value to the field fldStatus.

;frm1 :: status

method status(var eventInfo StatusEvent)

if eventInfo.isPreFilter()

then

; This code executes for each object on the form.

else

; This code executes only for the form.

if eventinfo.reason() = StatusWindow then

fldStatus.Value = eventinfo.statusValue()

endIf

endIf

endMethod


See Also for StatusEvent::reason
See Also

setReason


StatusEvent::setReason
setReason

See Also	Example	StatusEvent Type

Method

Specifies a reason for a StatusEvent.

Syntax

setReason ( const reasonId SmallInt )

Description

setReason specifies a reason for generating a StatusEvent. The StatusEvent reasons tell you which window on the status bar the message was sent to. ObjectPAL provides StatusReasons constants for setting the reason for a StatusEvent.


Example for StatusEvent::setReason
setReason Example

In the following example, for StatusEvent bubbled up to the form from a field, the form's status method changes the reason and the content of the message. The method changes the reason to ModeWindow1, and sets the value of the message to the name of the object that started the original event (the target).

; thisForm::status
method status(var eventInfo StatusEvent)
var
  targObj  UIObject
  nameStr  String
endVar
if eventInfo.isPreFilter()
  then
    ; code here executes for each object in form
  else
    ; code here executes just for form itself
    ; after regular message has displayed, also show
    ; field name in ModeWindow1
    eventInfo.getTarget(targObj)
    if targObj.Class = "Field" then      ; if this is a field
      nameStr = targObj.Name       ; get the field name
      eventInfo.setReason(ModeWindow1)   ; set the window
      eventInfo.setStatusValue(nameStr)  ; send the string
    endif
endif
endMethod


See Also for StatusEvent::setReason
See Also

reason

Event::errorCode

Event::setErrorCode


StatusEvent::setStatusValue
setStatusValue

See Also	Example	StatusEvent Type

Method

Specifies the text of a status message.

Syntax

setStatusValue ( const statusValue AnyType )

Description

setStatusValue specifies the text of a status message in messageText.


Example for StatusEvent::setStatusValue
setStatusValue Example

See the example for setReason.


See Also for StatusEvent::setStatusValue
See Also

setReason

statusValue


StatusEvent::statusValue
statusValue

See Also	Example	StatusEvent Type

Method

Returns the text of a status message.

Syntax

statusValue ( ) AnyType

Description

statusValue returns the text of a status message.


Example for StatusEvent::statusValue
statusValue Example

The following example makes the default status messages more prominent to the user by copying each message to a field on the form. This feature is controlled by the magnifyMessage button, also on the same form. The following code is attached to the pushButton method of the magnifyMessage button:

; magnifyMessage::pushButton
method pushButton(var eventInfo Event)
; toggle statusMessageField to visible or invisible and
; toggle label between "Magnified Messages" and "Normal Messages"
if self.LabelText = "Magnified Messages" then
  statusMessageField.Visible = True
  self.LabelText = "Normal Messages"
else
  statusMessageField.Visible = False
  self.LabelText = "Magnified Messages"
endif
endMethod

This code is attached to the form's status method:

; thisForm::status
method status(var eventInfo StatusEvent)
if eventInfo.isPreFilter()
  then
    ; code here executes for each object in form
    ; write every status event to a field on the form
    if statusMessageField.Visible = True then
      if eventInfo.reason() = StatusWindow then
        statusMessageField = eventInfo.statusValue()
      endif
    endif
  else
    ; code here executes just for form itself

endif
endMethod


See Also for StatusEvent::statusValue
See Also

reason

setStatusValue


String Type

Changes

A String variable can contain up to 32,000 characters (use Memo objects for longer text). A quoted string can contain up to 255 characters. Use double quotes ("") to represent an empty string. Strings occupy 1 byte of storage per character.

Note:	ObjectPAL supports an alternate syntax:

methodName ( objVar , argument [ , argument ] )

methodName represents the name of the method, objVar is the variable representing an object, and argument represents one or more arguments. For example, the following statement uses the standard ObjectPAL syntax to return a lowercase version of a string:

theString.lower()

The following statement uses the alternate syntax:

lower(theString)

It's best to use standard syntax for clarity and consistency, but you can use the alternate syntax wherever it's convenient.

The String type includes several derived methods from the AnyType type.

Methods for the String Type

AnyType		String
blank		advMatch
dataType		ansiCode
isAssigned		breakApart
isBlank		chr
isFixedType		chrOEM
view		chrToKeyName
		fill
		format
		ignoreCaseInStringCompares
		isIgnoreCaseInStringCompares
		isSpace
		keyNameToChar
		keyNameToVKCode
		lower
		lTrim
		match
		oemCode
		rTrim
		search
		size
		space
		string
		strVal
		substr
		toANSI
		toOEM
		upper
		vkCodeToKeyName


Changes to String methods
Changes to String type methods

The following table lists new methods and methods that were changed for version 5.0.

New	Changed

(None)	format


String::advMatch
advMatch

See Also	Example	String Type

Beginner

Method

Searches text for a specified string.

Syntax

advMatch ( const pattern String [ , var matchVar String ] * ) Logical

Description

advMatch returns True if pattern is found within the string; otherwise, it returns False. To specify pattern, use a string and the optional symbols listed in the table. This method is case sensitive by default, but you can use the String procedure ignoreCaseInStringCompares to change the case behavior.

matchVar is a variable to which the matching portion will be assigned. advMatch assigns matched patterns to one or more matchVar variables as the patterns are found. The portions of the string matching wildcard elements are assigned to the variables from left to right. Since there may be multiple matches, the first matching substring is assigned to the first variable, the second matching substring to the second variable, and so on. If no match is found, variables are not assigned values.

If you supply pattern from within a method, you need to use two backslashes when you want to tell advMatch to treat a special character as a literal; for example, \\( tells advMatch to treat the parenthesis as a literal character. Two backslashes are required in this situation because of the ambiguity between the compiler's interpretation of a backslash (used in escape sequences such as \t for a tab) and advMatch's understanding of a backslash. When the compiler sees a string with an embedded escape sequence, such as a "\tstart", it interprets the "\t" as a tab. The backslash character has a special meaning to the compiler, but it also has a special meaning to advMatch.

For example, if you're trying to search for a question mark embedded in a string, you might call advMatch like so:

s = "a string?"
advMatch(s, "\?")       ; this won't work!

You might think that you're telling advMatch to search for the literal question mark. However, the compiler sees the string first and returns a syntax error because "\?" is not a valid escape sequence. To prevent the compiler from interpreting the backslash as the beginning of an escape sequence, precede the backslash by another backslash. This will work:

s = "a string?"
advMatch(s, "\\?")       ; this does work!

If you supply pattern from a field in a table or a TextStream, special advMatch symbols are recognized without a preceding backslash, and one backslash and plus symbol (\+) yields a literal character.

Symbol	Matches

\	Use backslash to include special characters (for example, \t for Tab) as regular characters. (Remember to use two backslashes in quoted strings.)

[ ]	Match the enclosed set. For instance, [aeiou0-9] match a, e, i, o, u, and 0 through 9.

[^ ]	Do not match the enclosed set. For instance, [^aeiou0-9] match anything except a, e, i, o, u, and 0 through 9.

( )	Grouping.

^	Beginning of string (do not confuse this with [^]), where the ^ acts as a logical NOT).

$	End of string.

..	Match anything.

@	Match any single character.

*	Zero or more of the preceding character or expression.

+	One or more of the preceding character or expression.

?	None or one of the preceding character or expression.

 | 	OR operation.


Example for String::advMatch
advMatch Example

These statements demonstrate advMatch functionality:

method pushButton(var eventInfo Event)
var
  w, x, y, z      String
  l               Logical
endVar

l = advMatch("this is", "s")
l.view()
  ; returns True (different from match)

l = advMatch("this is", "^s")
l.view()
  ; returns False, because it requires s to be at the beginning of the line

l = advMatch("this is", "S")
l.view()
  ; returns False, it is case sensitive.

l = advMatch("this is", "[sS]")
l.view()
  ; returns True, because [sS] specifies any in this set

l = advMatch("this is", "[a-z]")
l.view()
  ; returns True, because [a-z] specifies any in this set of a through z

l = advMatch("this is", "[a-c]")
l.view()
  ; returns False, because [a-c] specifies any in this set of a through c
  ; and "this is" does not contain a, b, or c

l = advMatch("this is", "[a-cs]")
l.view()
  ; returns True, because [a-cc] specifies any in this set of a through c
  ; or s and "this is" does contain s
  ; note that [a-c, s] would specify any in the set of a through c,
  ; a comma, a space, or an s

l = advMatch("this is", "(@)s", x)
l.view()
x.view()
  ; returns True, x = "i" because the "()" operators specify a group,
  ; unlike match, advMatch places only those things that you group
  ; in the variables

l = advMatch("this is a test", "((t@@s) | (t@s)) | (@s)", w, x, y, z)
l.view()   ; returns True, and
w.view()   ; "this", the result of the first set of parentheses,
           ; that is, for the entire expression ((t@@s) | (t@s))
           ; also, "this" was matched before "test"
x.view()   ; also "this", for the result of the second set of
           ; parentheses, (t@@s)
y.view()   ; the result of (t@s), blank, because the t@@s
           ; satisfied the expression ((t@@s) | (t@s))
z.view()   ; also blank, because the expression ((t@@s) | (t@s)) satisfied
           ; the entire pattern ((t@@s) | (t@s)) | (@s)
; NOTE: Match variables are matched to groups in the order of occurrence,
;       not in the order of precedence: The first group--starting from
;       the left--is assigned to the first variable.

l = advMatch("this is so", "(..)is(..)", x, y)
l.view()
x.view()
y.view()
  ; returns True, x = "this", y = " so"

l = advMatch("this is so", "[a-c] | [f-l]s" )
l.view()
  ; returns True, because an s is preceded by either a through
  ; c or f through l

l = advMatch("this as so", "[a-c] | [t-z]s" )
l.view()
  ; returns True, because an s is preceded by either a through
  ; c or t through z

endMethod


See Also for String::advMatch
See Also

match

search

TextStream::advMatch

Paradox Help: Sample Search Strings with Wildcards


String::ansiCode
ansiCode

See Also	Example	String Type

Procedure

Returns the ANSI code of a one-character string.

Syntax

ansiCode ( const char String ) SmallInt

Description

ansiCode returns the ANSI code of char, where char is a one-character string. The ANSI code returned is an integer between 1 and 255.


Example for String::ansiCode
ansiCode Example

In the following example, assume a form contains four field objects: showAllChars, ANSIField, OEMField, and KeyNameField. The keyPhysical method for showAllChars examines every character, then translates it to its ANSI code, OEM code, and key-name equivalent. The various character codes are written to ANSIField, OEMField, and KeyNameField.

; showAllChars::keyPhysical
method keyPhysical(var eventInfo KeyEvent)
var
  anyChar   String
  anyANSI   SmallInt
  anyKeyN   String
  anyOEM    SmallInt
endVar
anyChar = eventInfo.char()           ; get the character typed
anyANSI = ansiCode(anyChar)          ; convert to ANSI code
ANSIField = anyANSI                  ; write ANSI code to ANSIField

anyCode = eventInfo.vCharCode()      ; get the VK_Code of character

anyKeyN = VKCodeToKeyName(anyCode)   ; convert VK_Code to key name
KeyNameField = anyKeyN               ; write key name to KeyNameField

anyOEM = oemCode(anyChar)            ; convert char to OEM code
OEMField = anyOEM                    ; write OEM code to OEMField
beep()
endMethod


See Also for String::ansiCode
See Also

chr

chrToKeyName


String::breakApart
breakApart

See Also	Example	String Type

Beginner

Method

Splits a string into substrings.

Syntax

breakApart ( var tokenArray Array[ ] String [ ,const separators String ] )

Description

breakApart splits a string into an array of substrings; each substring is written to an element of the array tokenArray. You can specify one or more delimiting characters in separators. If you omit separators, substrings are delimited by a space. In either case, delimiting characters are not included in tokenArray. This method is useful for importing data from a text file into a table.

Note:	Two delimiters with nothing between them parse as a token and result in an empty array element.


Example for String::breakApart
breakApart Example

In the following example, the pushButton method for a button named breakToArray creates three arrays from the same string. The first time, the call to the breakApart method does not specify any delimiters; by default, the method treats spaces as delimiters. The second time, the call to breakApart specifies the asterisk as a delimiter. Empty array elements are created each time an asterisk immediately follows another asterisk. The third time, the question mark, comma, and semicolon are listed as delimiters. The space is not used as a delimiter.

; breakToArray::pushButton
method pushButton(var eventInfo Event)
var
  ar Array[] String ; Must be resizable
  s String
endvar

s = "this is, a : delimited ? string"

s.breakApart(ar) ; breaks on spaces by default
ar.view()
{
ar = this
     is,
     a
     :
     delimited
     ?
     string
}

s = "this*is*a*delimited**string"
s.breakApart(ar, "*") ; breaks on specified characters
ar.view()
{
ar = this
     is
     a
     delimited

     string
}

s = "this is, a : delimited ? string"
s.breakApart(ar, ",:?") ; breaks on specified characters
                        ; this time, no space in list of delimiters
ar.view()
{
ar = this is
      a
      delimited
      string
}

endMethod


See Also for String::breakApart
See Also

substr


String::chr
chr

See Also	Example	String Type

Beginner

Procedure

Returns the one-character string represented by an ANSI code.

Syntax

chr ( const ansiCode SmallInt ) String

Description

chr returns a one-character string containing the ANSI character corresponding to ansiCode. If ansiCode is not an integer between 1 and 255, an error results.

You can use chr to generate characters that are not easily accessible through the keyboard.


Example for String::chr
chr Example

In the following example, the pushButton method for a button named showChar assigns the ANSI character 167 to the sectionChar variable, converts character 167 to its key name, and assigns it to sectionKeyName. The method then displays both versions of the character in a dialog box.

; showChar::pushButton
method pushButton(var eventInfo Event)
var
  sectionChar    String
  sectionKeyName String
endVar
sectionChar = chr(167)                           ; get the character
sectionKeyName = chrToKeyName(chr(167))          ; get the key name
msgInfo("The section character", sectionChar +   ; show the character and
        " has a key name of " + sectionKeyName)  ; the key name
endMethod


See Also for String::chr
See Also

chrOEM

chrToKeyName

string


String::chrOEM
chrOEM

See Also	Example	String Type

Procedure

Returns the one-character string of an OEM code.

Syntax

chrOEM ( const oemCode SmallInt ) String

Description

chrOEM returns a one-character string containing the OEM character corresponding to oemCode. If oemCode is not an integer between 1 and 255, an error results.

You can use chrOEM to generate characters that are not easily accessible through the keyboard. See the Guide to ObjectPAL for more information.


Example for String::chrOEM
chrOEM Example

In the following example, a form has a button named showOEM and a field named fieldOne. The pushButton method for showOEM displays the OEM character specified by the number in fieldOne.

; showOEM::pushButton
method pushButton(var eventInfo Event)
msgInfo("OEM char described by fieldOne", chrOEM(fieldOne))
endMethod


See Also for String::chrOEM
See Also

chr

string


String::chrToKeyName
chrToKeyName

See Also	Example	String Type

Procedure

Returns the virtual key-code string of a one-character string.

Syntax

chrToKeyName ( const char String ) String

Description

chrToKeyName returns the virtual key code of char as a string. A key name is one of the virtual key codes (such as VK_BACK for Backspace), but this method returns the Keyboard constant name as a string (such as "VK_BACK"). Alphanumeric characters and most symbols have a key name that consists simply of the character, for instance, "J" for the letter J.


Example for String::chrToKeyName
chrToKeyName Example

See the example for chr.


See Also for String::chrToKeyName
See Also

vkCodeToKeyName


String::fill
fill

See Also	Example	String Type

Beginner

Procedure

Returns a string containing repeated instances of a character.

Syntax

fill ( const fillCharacter String, const fillNumber SmallInt ) String

Description

fill returns a string containing the first character in fillCharacter (usually a one-character string), where fillCharacter is repeated the number of times specified in fillNumber. fillNumber must be a non-negative integer; if fillNumber is 0, fill returns an empty string.


Example for String::fill
fill Example

In the following example, the pushButton method for the fillAndView button creates two strings with the fill procedure. The method creates the first string by filling a variable with the same letter five times. The second string is created by repeating the string "Quattro Pro" four times.

; fillAndView::pushButton
method pushButton(var eventInfo Event)
var
  str String
endVar
str = fill("X", 5)
str.View()                   ; displays XXXXX
str = fill("Quattro Pro
", 4)         ; add a line break after every occurrence
str.View()
; displays:   Quattro Pro
;             Quattro Pro
;             Quattro Pro
;             Quattro Pro
endMethod


See Also for String::fill
See Also

space


String::format
format

See Also	Example	String Type	Changes

Beginner

Procedure

Returns a formatted string for display or printing.

Syntax

format ( const FormatSpec String, const value AnyType ) String

Description

format lets you control the way values are displayed or printed. formatSpec is a string expression containing one or more format specifications to be applied to String.

The following table lists the default format specification for each format category. This table also lists the valid data types for each format category. In addition to the data types listed, you can use AnyType values, as long as the value can be interpreted consistently with the format category.

Format 	Data Types 	Default
Category	Meaning	Allowed

Width	Set allowable field width 	All	Entire data value

and decimal precision

Alignment	Alignment within width	All	AR (right-aligned) for all numeric types, AL (left-aligned) for all others (including point)

Case	Uppercase or lowercase	All string types 	No default

strings

Edit	Specify characters and spacing	All numeric types	See following defaults

 	Include a specified symbol	No default

 	Decimal point character	ED. (period as decimal point)

 	Whole number separator	No separator

 	Number of leading zeros	None

 	Symbol spacing	None

 	Scientific notation	No

 	Hide trailing spaces	No (show spaces)

Use zeros as fill pattern	No

 	Scale numbers up	No

 	Precede with dollar sign	No

 	U.S. or Int'l separators	U.S.

Sign	Format of positive and 	All numeric 	See following

negative numbers

Positive	No leading positive sign 999

 	Negative	Leading minus sign -999

Date	Specify date formats	Date & DateTime	mm/dd/yy(yy) for Date or hh:mm:ss am(pm), mm/dd/yy(yy) for DateTime

Time	Specify time formats	Time & DateTime	hh:mm:ss am(pm) for Date or hh:mm:ss am(pm), mm/dd/yy(yy) for DateTime

Logical	Logical value representation	Logical	True/False

You can combine two or more format specifications in formatSpec by separating them with commas.

Type	Spec	Meaning

Width	Wn	n specifies total format width, including all special characters, leading symbols or spaces, decimal point, and whole number separators

W.n	n specifies number of decimal places, so W12.2 specifies a field of 12 characters, two of which are after the decimal character

W.W	Use decimal places from Windows numbers

W.$	Use decimal places from Windows currency

Alignment	AL	Left align in field

AR	Right align in field

AC	Center in field

Case	CU	Convert to uppercase

CL	Convert to lowercase

CC	Convert to initial capitals

Edit	E(s)	s specifies symbol to precede number

E$W	Include currency symbol from Windows

EDd	d specifies decimal point character

EDW	Use Windows decimal-point character

ENc	c specifies whole-number separator

ENW	Use Windows whole-number separator

ELn	n specifies the number of leading zeros

ELW	Use Windows leading zero setting

EP0	No symbol spacing

EP-	Make symbol spacing for negatives

EP+	Make symbol spacing for positives

EPB	Make symbol spacing for all numbers

EPW	Use Windows symbol spacing setting

ES	Use scientific notation

ET	Hide trailing spaces

EZ	Use zeros as fill pattern

EB	Use blanks as fill pattern

E*	Use '*' as fill pattern

E+n	Scale the number up

E-n	Scale the number down

E$	The same as E($)

EC	The same as EN (or EN.D)

EI	The same as ED (or ED,N. if EC is set)

Sign	S+0	Format positives as $999

S+1	Format positives as +$999

S+2	Format positives as $+999

S+3	Format positives as $999+

S+4	Format positives as 999$

S+5	Format positives as +999$

S+6	Format positives as 999+$

S+7	Format positives as 999$+

S+8	Format positives as $999DB

S+W	Format positives as Windows currency

S-0	Format negatives as ($999)

S-1	Format negatives as -$999

S-2	Format negatives as $-999

S-3	Format negatives as $999-

S-4	Format negatives as (999$)

S-5	Format negatives as -999$

S-6	Format negatives as 999-$

S-7	Format negatives as 999$-

S-8	Format negatives as $999CR

S-W	Format negatives as Windows currency

SP	(The same as S-0)

S-	(The same as S-1)

S+	(The same as S-1+1)

SC	(The same as S-8)

SD	(The same as S-8+8)

Date	DW1	Day of week as Mon

DW2	Day of week as 'Monday'

DWL	Day of week from Windows Long Date

DM1	Month as 1

DM2	Month as 01

DM3	Month as Jan

DM4	Month as January

DML	Month from Windows Long Date

DMS	Month from Windows Short Date

DD1	Day as 1

DD2	Day as 01

DDL	Day from Windows Long Date

DDS	Day from Windows Short Date

DY1	Year as 1

DY2	Year as 01

DY3	Year as 1901

DYL	Year from Windows Long Date

DYS	Year from Windows Short Date

DO(s)	s specifies order and separators, use %W for weekday,%D for numeric day, %M for month, and %Y for year, separators are literal, so 12/28/92 as DO(%W %M-%D-%Y) is Mon 12-28-92

DOL	Order and separators as Windows Long Date

DOS	Order and separators as Windows ShortDate

D1	This is the default date format

D2	As DM4Y3O(%M %D,%Y)

D3	As DO(%M/%D)

D4	As DO(%M/%Y)

D5	As DM3O(%D-%M-%Y)

D6	As DM3O(%M %Y)

D7	As DM3Y3O(%D-%M-%Y)

D8	As DY3O(%M/%D/%Y)

D9	As DO(%D.%M.%Y)

D10	As DO(%D/%M/%Y)

D11	As DO(%Y-%M-%D)

DEYEA(s)	s specifies A.D. dates (added in version 5.0)

DEYEB(s)	s specifies B.C. dates (added in version 5.0)

Time	TH1	Hours as 1T

TH2	Hours as 01

THW	Hours from Windows

TM1	Minutes as 1

TM2	Minutes as 01

TMW	Minutes from Windows

TS1	Seconds as 1

TS2	Seconds as 01

TSW	Seconds from Windows

TNA(s)	s is string to show after times before noon

TNP(s)	s is string to show after times after noon

TNW	Noon settings from Windows

TO(s)	s specifies order and separators, use %H for hours, %M for minutes, %S for seconds, %N for am/pm

TOW	Order and separators from Windows

Logical	LT(s)	s specifies representation of logical True value

LF(s)	s specifies representation of logical False value

LY	Logical values as Yes and No

LO	Logical values as On and Off


Example for String::format
format Example

In the following examples, assume a form contains a field called formatField and a button named demoFormat. The pushButton method for demoFormat demonstrates a number of different format specifications. For each example, the method fills the formatField with the formatted string, then shows a copy of the format specification in a dialog box (with view). The method won't procede to the next example until the View dialog box is closed; this gives you a way to examine both the format specification and the formatted output before moving to the next example.

; demoFormat::pushButton
method pushButton(var eventInfo Event)
var
  x  AnyType
  fs String
endVar
fs = "\"w6\",\"This is a test\""
formatField = format("w6","This is a test")
; displays This i
fs.view("Format Spec")

fs = "\"w6\",1234567"
formatField = format("w6",1234567)
; displays 1.e+6
fs.view("Format Spec")

fs = "\"w1\",( =5)"
formatField = format("w1",( =5))
; returns True, displays T
fs.View()

fs = "\"w9.2\",1234.567"
formatField = format("w9.2",1234.567)
; displays   1234.57
fs.View()

; Here are some examples of alignment specifications:
fs = "\"w20,ac\",\"This is\""
formatField = format("w20,ac","This is")
; displays              This is
fs.view()

fs = "\"w20,ac\",\"The Title\""
formatField = format("w20,ac","The Title")
; displays            The Title
fs.view()

fs = "\"w20,ac\",\"Of the Book\""
formatField = format("w20,ac","Of the Book")
; displays          Of the Book
fs.view()

fs = "\"w20,al\",123456"
formatField = format("w20,al",123456)
; displays 123456
fs.view()

fs = "\"w20,ar\",123456"
formatField = format("w20,ar",123456)
; displays               123456
fs.view()

; Here are some examples of case specifications:
fs = "\"cu\",\"the quick brown fox\""
formatField = format("cu","the quick brown fox")
; displays THE QUICK BROWN FOX
fs.view()

fs = "\"cl\",\"JUMPS OVER THE LAZY\""
formatField = format("cl","JUMPS OVER THE LAZY")
; displays jumps over the lazy
fs.view()

fs = "\"cc\",\"dOG.\""
formatField = format("cc","dOG.")
; displays Dog.
fs.view()

fs = "\"cc\",\"widgets'r us \" + \"too\""
formatField = format("cc","widgets'r us " + "too")
; displays Widgets'R Us Too
fs.view()

; Here are some examples of edit specifications:
x = 34567.89
fs = "\"w10.2, e$c\", x"
formatField = format("w10.2, e$c", x)      ; displays $34,567.89
fs.view()

fs = "\"w10.2, e$ci\", x"
formatField = format("w10.2, e$ci", x)     ; displays $34.567,89
fs.view()

fs = "\"w13.2, e$c\", x"
formatField = format("w13.2, e$c", x)      ; displays    $34,567.89
fs.view()

fs = "\"w14.2, e$cb, al\", x"
formatField = format("w14.2, e$cb, al", x) ; displays $   34,567.89
fs.view()

fs = "\"w15.2, e$cz, al\", x"
formatField = format("w15.2, e$cz, al", x) ; displays $000034,567.89
fs.view()

fs = "\"w15.2, e$c*, al\", x"
formatField = format("w15.2, e$c*, al", x) ; displays $****34,567.89
fs.view()

Here are some examples of sign specifications:
x = -3456.12
fs = "\"w8.2, s+\", x"
formatField = format("w8.2, s+", x)          ; displays <196>3456.12
fs.view()

fs = "\"w11.2, e$c, sc\", x"
formatField = format("w11.2, e$c, sc", x)    ; displays $3,456.12CR
fs.view()

fs = "\"w14.2, e$c*, sp\", x"
formatField = format("w14.2, e$c*, sp", x)   ; displays ($***3,456.12)
fs.view()

fs = "\"w13.2, e$c*, s+\", x"
formatField = format("w13.2, e$c*, s+", x)   ; displays -$***3,456.12
fs.view()

fs = "\"w14.2, e$c*, sd\", x"
formatField = format("w14.2, e$c*, sd", x)   ; displays $***3,456.12CR
fs.view()

; Here are some miscellaneous examples:
fs = "\"D2\", Date(\"3/7/1948\""
formatField = format("D2", Date("3/7/1948"))   ; displays March 7, 1948
fs.view()

fs = "\"W9.2, AL\", 1234.123"
formatField = format("W9.2, AL", 1234.123)
; displays 1234.12 in field of 9 digits with 2 decimal places
fs.view()

fs = "\"W9.2, AR\", 1234.123"
formatField = format("W9.2, AR", 1234.123)
; displays 1234.12 right aligned in same field
fs.view()

; to display date and time in 24-hour format

fs = "\"TNA(), TNP(), TO(%H:%M:%S %D), DO(%W %M/%D/%Y)\"," +

     " dateTime(\"2:30:00 pm 11/24/92\")"

formatField = format("TNA(), TNP(), TO(%H:%M:%S %D), DO(%W %M/%D/%Y)",

                     dateTime("2:30:00 pm 11/24/92"))

; displays   14:30:00 Tue 11/24/92

fs.view("Format Spec")

; To display a date including the era (B.C. or A.D.):

fs = "\"DEYEA(A.D.)EB(B.C.)O(%M/%D/%Y %E)\",

       date(\"11/15/81\")"

formatField = format("DEYEA(A.D.)EB(B.C.)O(%M/%D/%Y %E)",

                     date("11/15/81"))

; displays 11/15/81 A.D.

fs.view()

endMethod


See Also for String::format
See Also

string


Changes to String::format

Date

DEYEA(s)	s specifies A.D. dates (Added in version 5.0)

DEYEB(s)	s specifies B.C. dates (Added in version 5.0)


String::ignoreCaseInStringCompares
ignoreCaseInStringCompares

See Also	Example	String Type

Procedure

Specifies whether to consider case when comparing strings.

Syntax

ignoreCaseInStringCompares ( const yesNo Logical )

Description

ignoreCaseInStringCompares specifies whether to consider case when comparing strings. Normally, upper- and lowercase letters don't match. For example, "Q" and "q" are not the same. But when you use ignoreCaseInStringCompares(Yes), case doesn't matter, so "Q" equals "q." Once you call ignoreCaseInStringCompares(Yes), it stays in effect until you call ignoreCaseInStringCompares(No).

To find out if case is being considered, use isIgnoreCaseInStringCompares.


Example for String::ignoreCaseInStringCompares
ignoreCaseInStringCompares Example

In the following example, the pushButton method for the tryCompare button checks whether Paradox is set to ignore case in string comparisons. If isIgnoreCaseInStringCompares returns Yes, the method uses ignoreCaseInStringCompares to set it to No---which means that case is considered---then compares an uppercase and lowercase string. A message window informs the user that the strings are not equivalent. Next, the method turns on case ignore, and attempts the same comparison, which returns True.

; tryCompare::pushButton
method pushButton(var eventInfo Event)
var
  s1,
  s2  String
endVar
s1 = "cat"
s2 = "CAT"
if isIgnoreCaseInStringCompares() then
  ignoreCaseInStringCompares(No)
endif
x = (s1 = s2)              ; the first  "=" assigns, all others compare
msgInfo(s1 + " = " + s2 + "?", x)    ; displays False
ignoreCaseInStringCompares(Yes)
x = (s1 = s2)
msgInfo(s1 + " = " + s2 + "?", x)    ; displays True
endMethod


See Also for String::ignoreCaseInStringCompares
See Also

isIgnoreCaseInStringCompares


String::isIgnoreCaseInStringCompares
isIgnoreCaseInStringCompares

See Also	Example	String Type

Procedure

Reports whether case is considered when comparing strings.

Syntax

isIgnoreCaseInStringCompares ( ) Logical

Description

isIgnoreCaseInStringCompares returns True if case is considered when comparing strings; otherwise, it returns False.

To specify whether to consider case, use ignoreCaseInStringCompares.


Example for String::isIgnoreCaseInStringCompares
isIgnoreCaseInStringCompares Example

See the example for ignoreCaseInStringCompares.


See Also for String::isIgnoreCaseInStringCompares
See Also

ignoreCaseInStringCompares


String::isSpace
isSpace

See Also	Example	String Type

Beginner

Method

Reports whether a string contains only spaces (or is empty).

Syntax

isSpace ( const string String ) Logical

Description

isSpace returns True if string contains only whitespace, or if string is the empty string (""); otherwise, it returns False. Whitespace characters include spaces, tabs, carriage returns, linefeeds, and formfeeds.


Example for String::isSpace
isSpace Example

The following example creates and checks several strings to see if the strings either contain only spaces, or contain nothing at all. This is the code for the pushButton method for the valString button:

; valString::pushButton
method pushButton(var eventInfo Event)
var
  s String
endVar
s = space(3)                           ; 3 spaces
msgInfo("3 Spaces", s.isSpace())       ; True
s = ""                                 ; empty String
msgInfo("Empty String", s.isSpace())   ; True
s = "Z" + space(2)                     ; Z and 2 spaces
msgInfo("Z and 2 Spaces", s.isSpace()) ; False
endMethod


See Also for String::isSpace
See Also

space


String::keyNameToChar
keyNameToChr

See Also	Example	String Type

Procedure

Returns the one-character string represented by a virtual key-code string.

Syntax

keyNameToChr ( const keyName String ) String

Description

keyNameToChr returns the one-character string represented by the virtual key code keyName.

keyName must be one of the Keyboard constants (such as VK_BACK for Backspace), but must be supplied as a string (such as "VK_BACK"), not a constant. Alphanumeric characters and most symbols have a key name that consists simply of the character, for instance, "J" for the letter J.


Example for String::keyNameToChar
keyNameToChr Example

See the example for keyNameToVKCode.


See Also for String::keyNameToChar
See Also

chrToKeyName

keyNameToVKCode


String::keyNameToVKCode
keyNameToVKCode

See Also	Example	String Type

Procedure

Returns the VK_Code of a virtual key-code string.

Syntax

keyNameToVKCode ( const keyName String ) SmallInt

Description

keyNameToVKCode returns the virtual key code (VK_Code) of the character represented by the virtual key code keyName, given as a string.

keyName must be one of the Keyboard constants (such as VK_BACK for Backspace), but must be supplied as a string (such as "VK_BACK"), not a constant. Alphanumeric characters and most symbols have a key name that consists simply of the character, for instance, "J" for the letter J.


Example for String::keyNameToVKCode
keyNameToVKCode Example

In the following example, the pushButton method for showCode sets the string variable keyStr to an open bracket ([), then displays the ANSI code and the key name of keyStr in a dialog box.

; showCode::pushButton
method pushButton(var eventInfo Event)
var
  keyStr  String
endVar
keyStr = "["              ; set the key name for open bracket
msgInfo("VK_Code/Char", "VK_Code: " +           ; VK_Code 91
        String(keyNameToVKCode(keyStr)) +
        "\nCharacter: " + keyNameToChr(keyStr)) ; char "["
endMethod


See Also for String::keyNameToVKCode
See Also

chrToKeyName

keyNameToChr

vkCodeToKeyName


String::lower
lower

See Also	Example	String Type

Beginner

Method

Converts a string to lowercase.

Syntax

lower ( ) String

Description

lower converts a string to lowercase letters. Use upper to convert a string to uppercase letters.


Example for String::lower
lower Example

In the following example, the pushButton method for makeLower creates an uppercase string, then uses lower to display it in lowercase.

; makeLower::pushButton
method pushButton(var eventInfo Event)
var
  myText String
endVar
myText = "HEY, EVERYBODY! IT'S QUITTIN' TIME"
msgInfo("Official Notice", myText.lower())
; displays "hey everybody! it's quittin' time"
endMethod


See Also for String::lower
See Also

upper


String::lTrim
lTrim

See Also	Example	String Type

Beginner

Method

Removes leading blanks from a string.

Syntax

lTrim ( ) String

Description

lTrim removes spaces and Tab characters from the left end of a string.


Example for String::lTrim
lTrim Example

In the following example, the pushButton method for trimLeft creates a string with leading spaces and a leading tab (the escape sequence \t). The method displays the original string, uses lTrim to remove the leading nonprinting characters, then displays the trimmed version.

; trimLeft::pushButton
method pushButton(var eventInfo Event)
var
  trimMe, trimmed String
endVar
trimMe = "  \t   First word"  ; string with spaces and a tab
msgInfo("Original string", trimMe)

trimmed = trimMe.lTrim()      ; trim off spaces and tab
msgInfo("A slightly shorter version", trimmed)
; displays "First word"
endMethod


See Also for String::lTrim
See Also

rTrim


String::match
match

See Also	Example	String Type

Beginner

Method

Compares a string with a pattern.

Syntax

match ( const pattern String [ , var matchVar String ]* ) Logical

Description

match tests whether a string matches a pattern, and if so, extracts the components of the string that match the wildcard elements. The value of pattern, like patterns in queries, consists of characters interlaced with the wildcard operators .. and @. The .. matches any number of characters (including none), while the @ matches any single character. Also as in queries, match ignores or considers case depending on system settings (default: ignore case). Use isIgnoreCaseInStringCompares to find out what the system setting is, and use ignoreCaseInStringCompares to turn case-sensitivity on or off.

matchVar is a variable to which the matching portion will be assigned. match assigns matched patterns to one or more matchVar variables as the patterns are found. The portions of the string matching the wildcard elements are assigned to the variables from left to right. Since there may be multiple matches, the first matching substring is assigned to the first variable, the second matching substring to the second variable, and so on. If no match is found, variables are not assigned values.

Quotes in pattern require special handling, periods do not. To embed a quote in pattern, precede it with a backslash, as follows: \". match in ObjectPAL treats periods as alphanumeric characters, unlike earlier versions of PAL which required backslashes to delimit periods.


Example for String::match
match Example

These statements demonstrate match functionality.

var
  s, x, y, z String
endVar

s = "this and that"

msgInfo("match?", s.match("t.."))         ; displays True
msgInfo("match?", s.match("@his.."))      ; displays True
msgInfo("match?", s.match("@ and that"))  ; displays False
msgInfo("match?", s.match("..and.."))     ; displays True

msgInfo("match?", s.match("..and..", x, y))
                      ; displays True (x = this, y = that)

msgInfo("match?", s.match("T..", z))
  ; If isIgnoreCaseInString() is False, this statement displays
  ; False, and z is not assigned. Use
  ; ignoreCaseInStringCompares(Yes) to get this to display
  ; True, and set z to "his and that"


See Also for String::match
See Also

advMatch

search

Session::ignoreCaseInLocate

Session::isIgnoreCaseInLocate


String::oemCode
oemCode

See Also	Example	String Type

Procedure

Returns the OEM code of a one-character string.

Syntax

oemCode ( const char String ) SmallInt

Description

oemCode returns the OEM code of char, where char is a one-character string. The OEM code returned is an integer between 1 and 255.


Example for String::oemCode
oemCode Example

See the example for ansiCode.


See Also for String::oemCode
See Also

ansiCode

chrToKeyName


String::rTrim
rTrim

See Also	Example	String Type

Beginner

Method

Removes trailing blanks from a string.

Syntax

rTrim ( ) String

Description

rTrim removes spaces, tabs, carriage returns, and linefeed characters from the right end of a string.


Example for String::rTrim
rTrim Example

In the following example, the pushButton method for trimRight creates a string with trailing spaces. The method displays the original string, uses rTrim to remove the trailing nonprinting characters, then displays the trimmed version.

; trimRight::pushButton
method pushButton(var eventInfo Event)
var
  trimMe, trimmed String
endVar
trimMe = "Last word     "     ; string with trailing spaces
msgInfo("Original string", trimMe + "The end")
; displays "Last word     The end"

trimmed = trimMe.rTrim()      ; trim off spaces
msgInfo("A slightly shorter version", trimmed + "The end")
; displays "Last wordThe end"
endMethod


See Also for String::rTrim
See Also

lTrim


String::search
search

See Also	Example	String Type

Beginner

Method

Returns the position of one string inside another.

Syntax

search ( const str String ) SmallInt

Description

search tests for an occurrence of str within a target string. If str is found, search returns the starting character position of str within the target string; otherwise, it returns 0. The search always begins at the first character of the target string.

By default, search is case-sensitive, but you can use ignoreCaseInStringCompares to make it case-insensitive.


Example for String::search
search Example

The following example searches for parts of the string "Goliath" and "Golgolithic". The following code is attached to the pushButton method for the searchStr button:

; searchStr::pushButton
method pushButton(var eventInfo Event)
var
  s String
endVar
s = "Goliath"
msgInfo("Where is lia in Goliath?", s.search("lia")) ; displays 3
msgInfo("Where is lai in Goliath?", s.search("lai")) ; displays 0
ignoreCaseInStringCompares(No)
s = "Golgolithic"
msgInfo("Where is gol in Golgolithic?", s.search("gol"))
; displays 4
; Note: If ignoreCaseInStringCompares is on, the last
; search yields a 1 instead.
endMethod


See Also for String::search
See Also

advMatch

match


String::size
size

See Also	Example	String Type

Beginner

Method

Returns the length of a string.

Syntax

size ( ) SmallInt

Description

size returns the number of characters (including spaces) in a string.


Example for String::size
size Example

In the following example, the pushButton method for getSize assigns a string to the variable sourceText, then displays the sentence and its size in a dialog box. The method then uses size to get the first half of sourceText, and assign it back to sourceText. The size of the sourceText and the smaller sourceText are displayed in a dialog box.

; getSize::pushButton
method pushButton(var eventInfo Event)
var
  sourceText String
endVar
sourceText = "This is a short sentence."
msgInfo("Size", "Length: " + String(sourceText.size()) +
                "\n" + sourceText)
; displays   Length: 25
;            This is a short sentence.

; now chop the sentence in half
sourceText = subStr(sourceText, 1, SmallInt(sourceText.size()/2))
msgInfo("Half-Size", "Length: " + strVal(sourceText.size())
                     + "\n" + sourceText)
; displays   Length: 12
;            This is a sh
endMethod


See Also for String::size
See Also

string


String::space
space

See Also	Example	String Type

Beginner

Method

Creates a string of a specified number of spaces.

Syntax

space ( const numberOfSpaces SmallInt ) String

Description

space returns a string of numberOfSpaces spaces.


Example for String::space
space Example

See the example for isSpace.


See Also for String::space
See Also

isSpace


String::string
string

See Also	Example	String Type

Beginner

Procedure

Casts a value as a String.

Syntax

string ( const value AnyType [, const value AnyType ]* ) String

Description

string casts (converts) an expression value to a String. If you specify multiple arguments, string will cast them all to strings and concatentate them to one string.


Example for String::string
string Example

In the following example, the pushButton method for getNumToString requests a number from the user, then casts it as a string and concatenates it with another string for display in a msgInfo dialog box.

; getNumToString::pushButton
method pushButton(var eventInfo Event)
var
   nn Number
endVar
nn = 0.0                     ; initialize the number
nn.View("Enter a number")    ; display it, and ask for input

; Note: Because you can enter only one argument for the text of
; the msgInfo dialog box, if you have any non-string elements, they
; must be cast as strings, then concatenated. Here, nn is cast
; to a String type before being concatenated with "You entered "
msgInfo("Status", "You entered " + string(nn))
msgInfo("Status", string("You entered ", nn))  ; also works
endMethod


See Also for String::string
See Also

format


String::strVal
strVal

See Also	Example	String Type

Procedure

Converts a value to a string.

Syntax

strVal ( const value AnyType ) String

Description

strVal converts value to a string. The data type of value can be any of the types represented by AnyType.


Example for String::strVal
strVal Example

See the example for size.


See Also for String::strVal
See Also

string

size


String::substr
subStr

See Also	Example	String Type

Beginner

Method

Returns a portion of a string.

Syntax

substr ( const startIndex Number  [, const numberOfChars SmallInt ] ) String

Description

substr returns a portion of a string that starts at startIndex and continues for numberOfChars characters. The value of startIndex must be greater than 0 and less than or equal to the size of the string. If numberOfChars is 0, substr returns a null string. If numberOfChars is omitted, substr returns the character at position startIndex.


Example for String::substr
subStr Example

In the following example, assume a form contains a button named getPhone and four fields named wholePhone, phAreaCode, phExchange, and phNumber. The method in this example uses substr to extract the three groups of digits from a U.S. phone number. The following code is attached to the pushButton method for getPhone.

; getPhone::pushButton
method pushButton(var eventInfo Event)
var
  phoneNum  String
endVar
phoneNum = wholePhone.Value
; assume phone number has been entered as ###-###-####
; start from first position, take three characters
phAreaCode.Value = phoneNum.substr(1, 3)  ; get the area code
phExchange.Value = phoneNum.substr(5, 3)  ; get the exchange
phNumber.Value   = phoneNum.substr(9, 4)  ; get the number
beep()
endMethod


See Also for String::substr
See Also

breakApart

search

size


String::toAnsi
toANSI

See Also	Example	String Type

Method

Converts a string of OEM characters to ANSI characters.

Syntax

toANSI ( ) String

Description

toANSI converts a string of OEM characters to ANSI characters.


Example for String::toAnsi
toANSI Example

In the following example, the pushButton method for a button named showANSI displays a string in two ways: in the title of the dialog box the string is displayed as is; in the window of the dialog box, the string is first converted to ANSI. The last character in the string is the copyright symbol (©). This symbol prints in the title of the dialog box; however, in the window of the dialog box, the symbol is replaced by an underbar (_).

; showANSI::pushButton
method pushButton(var eventInfo Event)
var
  ss String
endVar
; string plus copyright symbol
ss = "A string of characters " + chr(169)
msgInfo(ss, ss.toANSI())
; displays string plus "_" in window of dialog box - system-dependent
endMethod


See Also for String::toAnsi
See Also

toOEM


String::toOEM
toOEM

See Also	Example	String Type

Method

Converts a string of ANSI characters to OEM characters.

Syntax

toOEM ( ) String

Description

toOEM converts a string of ANSI characters to OEM characters.


Example for String::toOEM
toOEM Example

In the following example, the pushButton method for a button named showOEM displays a string in two ways: in the title of the dialog box the string is displayed as is; in the window of the dialog box, the string is first converted to OEM. The last character in the string is the copyright symbol (©). This symbol prints in the title of the dialog box; however, in the window of the dialog box, the symbol is replaced by the letter c.

; showOEM::pushButton
method pushButton(var eventInfo Event)
var
  ss String
endVar
; string plus copyright symbol
ss = "A string of characters " + chr(169)
msgInfo(ss, ss.toOEM())
; displays string plus "c" in window of dialog box
endMethod


See Also for String::toOEM
See Also

toANSI


String::upper
upper

See Also	Example	String Type

Beginner

Method

Converts a string to uppercase.

Syntax

upper ( ) String

Description

upper converts a string to uppercase letters. Use lower to convert a string to lowercase letters.


Example for String::upper
upper Example

In the following example, the pushButton method for makeUpper gets a string from the user, then converts it to uppercase. The converted string is then compared to an uppercase string constant.

;makeUpper:pushButton
method pushButton(var eventInfo Event)
const
  ORDERTYPE = "BIDORDER"   ; concatenate two valid types
endConst
var
  myText String
  x      SmallInt
endVar
myText = ""                           ; initialize the string
myText.view("Enter 'Bid' or 'Order'") ; get a response
myText = myText.upper()               ; convert to uppercase
if search(ORDERTYPE, myText) > 0 then
  ; search for a matching string -- returns location
  ; of match, or zero if no match
  msgInfo("Status", "You entered a valid type.")
else
  msgStop("Stop", "You must enter either Bid or Order.")
endif
endMethod


See Also for String::upper
See Also

lower


String::vkCodeToKeyName
vkCodeToKeyName

See Also	Example	String Type

Procedure

Converts a virtual keycode constant to a virtual keycode string.

Syntax

vkCodeToKeyName ( const vkCode SmallInt ) String

Description

vkCodeToKeyName returns the virtual key-code name, as a String, of the character represented by the integer value vkCode.

This method returns the name of a Keyboard constant (such as VK_BACK for Backspace) as a string (such as "VK_BACK"), not a constant. Alphanumeric characters and most symbols have a key name that consists simply of the character, for instance, "J" for the letter J.


Example for String::vkCodeToKeyName
vkCodeToKeyName Example

See the example for ansiCode.


See Also for String::vkCodeToKeyName
See Also

ansiCode

chr

chrToKeyName

keyNameToChr


System Type

Changes

The System type contains procedures for displaying messages, finding out about the user's system, setting up a printer, manipulating the File Browser, working with the Help system, and more.

Methods for the System Type

System

beep

close

compileInformation

constantNameToValue

constantValueToName

cpuClockTime

debug

desktopMenu

disablePreviousError

dlgAdd

dlgCopy

dlgCreate

dlgDelete

dlgEmpty

dlgExport

dlgImportASCIIFix

dlgImportASCIIVar

dlgImportSpreadsheet

dlgNetDrivers

dlgNetLocks

dlgNetRefresh

dlgNetRetry

dlgNetSetLocks

dlgNetSystem

dlgNetUserName

dlgNetWho

dlgRename

dlgRestructure

dlgSort

dlgSubtract

dlgTableInfo

enableExtendedCharacters

enumDesktopWindowNames

enumEnvironmentStrings

enumFonts

enumFormats

enumFormNames

enumPrinters

enumReportNames

enumRTLClassNames

enumRTLConstants

enumRTLErrors

enumRTLMethods

enumWindowNames

errorClear

errorCode

errorHasErrorCode

errorHasNativeErrorCode

errorLog

errorMessage

errorNativeCode

errorPop

errorShow

errorTrapOnWarnings

exportParadoxDOS

execute

executeString

exit

exportASCIIFix

exportASCIIVar

exportSpreadsheet

fail

fileBrowser

formatAdd

formatDelete

formatExist

formatGetSpec

formatSetCurrencyDefault

formatSetDateDefault

formatSetDateTimeDefault

formatSetLogicalDefault

formatSetLongIntDefault

formatSetNumberDefault

formatSetSmallIntDefault

formatSetTimeDefault

formatStringToDate

formatStringToNumber

getDefaultPrinterStyleSheet

getDefaultScreenStyleSheet

getLanguageDriver

getMouseScreenPosition

getUserLevel

helpOnHelp

helpQuit

helpSetIndex

helpShowContext

helpShowIndex

helpShowTopic

helpShowTopicInKeywordTable

importASCIIFix

importASCIIVar

importSpreadsheet

isErrorTrapOnWarnings

message

msgAbortRetryIgnore

msgInfo

msgQuestion

msgRetryCancel

msgStop

msgYesNoCancel

pixelsToTwips

play

projectViewerClose

projectViewerIsOpen

projectViewerOpen

printerGetInfo

printerGetOptions

printerSetCurrent

printerSetOptions

readEnvironmentString

readProfileString

resourceInfo

sendKeys

sendKeysActionID

setDefaultPrinterStyleSheet

setDefaultScreenStyleSheet

setMouseScreenPosition

setMouseShape

setUserLevel

sleep

sound

sysInfo

tracerClear

tracerHide

tracerOff

tracerOn

tracerSave

tracerShow

tracerToTop

tracerWrite

twipsToPixels

version

winGetMessageID

winPostMessage

winSendMessage

writeEnvironmentString

writeProfileString


Changes to System type methods

The following table lists new methods and methods that were changed for version 5.0.

New	Changed

compileInformation	enumDesktopWindowNames

desktopMenu	enumWindowNames

disablePreviousError	sleep

enableExtendedCharacters

enumEnvironmentStrings

enumFormats

enumPrinters

exportParadoxDOS

formatGetSpec

formatStringToDate

formatStringToNumber

getDefaultPrinterStyleSheet

getDefaultScreenStyleSheet

getLanguageDriver

getUserLevel

isErrorTrapOnWarnings

projectViewerClose

projectViewerIsOpen

projectViewerOpen

printerGetInfo

printerGetOptions

printerSetCurrent

printerSetOptions

resourceInfo

setDefaultPrinterStyleSheet

setDefaultScreenStyleSheet

setUserLevel


System::beep
beep

See Also	Example	System Type

Beginner

Procedure

Sounds the Windows default beep.

Syntax

beep ( )

Description

beep activates the Windows default beep sound. The beep will be audible only if the Enable System Sounds option is checked in the Control Panel's Sound dialog box.

To send a sound of specified pitch and duration to the system speaker, use sound.


Example for System::beep
beep Example

The following code is attached to a button's pushButton method. It prompts the user to enter a number and beeps if the number is out of range.

; getANumber::pushButton
method pushButton(var eventInfo Event)
var
  someNumber  SmallInt
endVar
someNumber = 1
someNumber.view("Pick a number between 1 and 10")
while someNumber < 1 OR someNumber > 10
  beep()          ; beep
  sleep(100)      ; slight pause, otherwise beeps run together as one
  beep()
  msgStop("Oops", "That number is too large or too small. Try again.")
  someNumber.view("Pick a number between 1 and 10")
endwhile
endMethod


See Also for System::beep
sound


System::close
close

See Also	Example	System Type

Beginner

Procedure

Closes the current form.

Syntax

close ( [ const returnValue AnyType ] )

Description

close posts a request to close the current form. If returnValue is specified, a value will be returned to the calling form (if there is one). Specifying a returnValue when there is no calling form does not result in an error. close starts the process of closing the form, which includes removing the focus and departing.


Example for System::close
close Example

The following code closes the current form after asking the user for confirmation.

; closeButton::pushButton
method pushButton(var eventInfo Event)
var
  qAnswer String
endVar
qAnswer = msgYesNoCancel("Closing Application",
          "Do you want to close this form?")
if qAnswer = "Yes" then
  close()                 ; close the current form
else
  message("Application not closed.")
endif
endMethod


See Also for System::close
See Also

exit


System::compileInformation
compileInformation	5.0

See Also	Example	System Type

Procedure

Lists information about the form most recently compiled.

Syntax

compileInformation ( var info DynArray[] AnyType )

Description

compileInformation lists information about the form most recently compiled. This procedure is useful for analyzing large forms, libraries, scripts, and reports. It writes the data to the DynArray info that you declare and pass as an argument. The structure of the DynArray is

Index	Definition

CodeSize	The compiled size of the code segment (in bytes). The maximum allowed size is 64KB.

CompileTime	Compile time (in milliseconds).

DataSize	The compiled size of the data segment (in bytes). The maximum allowed size is 64KB.

MethodCount	The number of methods that have code and/or comments.

SourceSize	The size of the uncompiled source code (in bytes).

SymbolTableSize	The compiled size of the symbol table (in bytes). The maximum allowed size is 64KB.


Example for System::compileInformation
compileInformation Example

The following code writes compiler information to a dynamic array dynCompileInfo and then displays it in a view dialog box.

;analyzeObject::pushButton
method pushButton(var eventInfo Event)
  var
    dynCompileInfo	Dynarray[]	AnyType
  endVar

  compileInformation(dynCompileInfo)
  dynCompileInfo.view()
endmethod


See Also for System::compileInformation
See Also

Form::enumSource

Form::enumSourceToFile


System::constantNameToValue
constantNameToValue

See Also	Example	System Type

Procedure

Returns the numeric value of a constant.

Syntax

constantNameToValue ( const constantName String ) AnyType

Description

constantNameToValue returns the value represented by the ObjectPAL constant specified in constantName. constantNameToValue returns values only for predefined ObjectPAL constants; it will not return a value for a constant you have defined yourself.

Note:	For readability and portability (among other benefits), we recommend using constant names rather than numeric values.


Example for System::constantNameToValue
constantNameToValue Example

The following code returns the numeric value for the action constant DataBeginEdit.

; showValOfConst::pushButton
method pushButton(var eventInfo Event)
var
  constValue   AnyType
  constString  String
  tf           Logical
endvar
constValue = constantNameToValue("DataBeginEdit")  ; constant is passed as a
                                                   ; String
msgInfo("The value of DataBeginEdit is", constValue)
tf = constantValueToName("ActionDataCommands", constValue, constString)
if tf then   ; if the conversion worked properly, display the string
  msgInfo("The name of " + String(constValue) + " is", constString)
else
  msgInfo("Status", "Something went wrong with that conversion.")
endif
endMethod


See Also for System::constantNameToValue
See Also

constantValueToName

enumRTLConstants


System::constantValueToName
constantValueToName

See Also	Example	System Type

Procedure

Reports on the name of a constant.

Syntax

constantValueToName ( const groupName String, const value AnyType, var constName String ) Logical

Description

constantValueToName writes to constName the name of a constant with the value specified that belongs to the group groupName, where groupName is one of the Types of Constants. The constant name is written to the variable constName. This method returns True if it succeeds; otherwise, it returns False.

constantValueToName works for names of predefined ObjectPAL constants only; it will not work for a constant you have defined yourself.


Example for System::constantValueToName
constantValueToName Example

See the example for constantNameToValue.


See Also for System::constantValueToName
See Also

constantNameToValue

enumRTLConstants


System::CPUClockTime
cpuClockTime

See Also	Example	System Type

Beginner

Procedure

Returns the number of seconds since the computer was booted.

Syntax

cpuClockTime ( ) LongInt

Description

cpuClockTime returns the number of milliseconds since the computer was booted. The minimum clock increment is 55 milliseconds. This procedure is useful for measuring the interval between two events.


Example for System::CPUClockTime
cpuClockTime Example

The following example uses cpuClockTime to compare execution times for two for loops: one with an undeclared variable, one with a declared variable. Although execution times vary by system, the loop executes significantly faster when the variable is declared.

; clockVars::pushButton
method pushButton(var eventInfo Event)
var
  fastVar    SmallInt
  delta      String
  startTime,
  stopTime   LongInt
endvar
startTime = cpuClockTime()                 ; clock's time before starting
for slowVar from 1 to 10000                ; slowVar is undeclared
  slowVar = slowVar + 1
endFor
stopTime = cpuClockTime()                  ; clock's time after 10000 loops
delta = String(stopTime - startTime)       ; find the elapsed time using
delta.view("Time for undeclared variable") ; an undeclared variable --
                                           ; times vary by system
startTime = cpuClockTime()
for fastVar from 1 to 10000                ; fastVar is declared
  fastVar = fastVar + 1
endFor
stopTime = cpuClockTime()
delta = String(stopTime - startTime)       ; find the elapsed time using
delta.view("Time for declared variable")   ; a declared variable
msgInfo("And the moral is:", "For the best performance, " +
        "declare variables!")
endMethod


See Also for System::CPUClockTime
See Also

Time::time


System::debug
debug

See Also	Example	System Type

Procedure

Halts execution of a method and invokes the Debugger.

Syntax

debug ( )

Description

Placing debug in a method has the same effect as setting a breakpoint: The method stops executing, and the Debugger window opens with the pointer on the line containing debug. Unlike breakpoints, debug statements are saved with the method's source code. Also, debug statements only take effect when you choose Properties | Compile With Debug ; otherwise, they are ignored.

Note:	debug works only in methods and procedures that you write, not for methods and procedures in the ObjectPAL run-time library.

debug is handy for setting persistent breakpoints in methods while you are developing an application. You can test the application with Properties | Compile With Debug turned on, and deliver the application with it turned off.


Example for System::debug
debug Example

In the following example, assume the ObjectPAL Editor menu command Properties | Compile With Debug is selected. The following code executes a for loop. Halfway through the loop, the call to debug suspends execution and opens an Editor window containing the code. Choose Program | Run to resume execution, or use the other Debugger features.

; startDebugAt50::pushButton
method pushButton(var eventInfo Event)
var
  i SmallInt
endVar
for i from 1 to 100
  message(i)
  if i = 50 then
      debug()    ; will work only if Properties | Compile With Debug
                 ; ObjectPAL Editor menu command is checked
  endIf
endFor
endMethod


See Also for System::debug
See Also

execute


System::desktopMenu
desktopMenu	5.0

See Also	Example	System Type

Procedure

Displays the Paradox Desktop menu.

Syntax

desktopMenu ( )

Description

desktopMenu displays the Paradox Desktop menu. This can be useful when you're using a form as a dialog box and it doesn't have an associated menu.

When you call desktopMenu, the Paradox Desktop menu persists until it is replaced by one of the following actions:

The current form or report loses focus.

A call to removeMenu restores the default menu for the form or report.

A call to show displays a custom menu.


Example for System::desktopMenu
desktopMenu Example

This example calls desktopMenu in the setFocus method on the page of a dialog box to display the Paradox default menu.

;pge1 :: setFocus

method setFocus(var eventInfo Event)

desktopMenu()

endMethod


See Also for System::desktopMenu
See Also

Menu::removeMenu

Menu::show


System::disablePreviousError
disablePreviousError	5.0

See Also	Example	System Type

Procedure

Specifies whether to allow user access to the Previous Error dialog box.

Syntax

disablePreviousError ( const yesNo Logical ) Logical

Description

disablePreviousError specifies whether a user can open the Previous Error dialog box by clicking the status bar. By default, when a user moves the mouse pointer over the status bar, the pointer changes shape and the user can click the status bar to display the Previous Error dialog box (if error information is available). Calling disablePreviousError with yesNo set to Yes (or True) prevents this behavior. Calling disablePreviousError with yesNo set to No (or False) restores the default behavior.

This procedure returns True if it succeeds; otherwise, it returns False. The setting remains in effect (and affects all forms) as long as Paradox is running. The default behavior is restored the next time you start Paradox.


Example for System::disablePreviousError
disablePreviousError Example

The following example uses disablePreviousError in a script named InitApp to prevent user access to the Previous Error dialog box.

; InitApp::run
method run(var eventInfo Event)
   disablePreviousError(Yes)
   openMainForm() ; Call a custom method to open the main application form.
endMethod


See Also for System::disablePreviousError
See Also

debug

Form::disableBreakMessage


System::dlgAdd
dlgAdd

See Also	Example	System Type

Procedure

Invokes the Table Add dialog box.

Syntax

dlgAdd ( const tableName String )

Description

dlgAdd displays the Add dialog box, just as if you had chosen Tools | Utilities | Add. The variable tableName specifies the source table.

ObjectPAL code suspends execution until the user closes this dialog box. ObjectPAL has no control over this dialog box once it is displayed; it is up to the user to fill in any necessary information and close the dialog box.


Example for System::dlgAdd
dlgAdd Example

The following example invokes the Table Add dialog box and fills in the Customer table name as the source table. The user must fill in the destination table name and close the dialog box.

; showAddDlg::pushButton
method pushButton(var eventInfo Event)
; invoke the Table Add dialog box with Customer as the source
dlgAdd("customer.db") ; same as Tools | Utilities | Add
endMethod


See Also for System::dlgAdd
See Also

dlgCopy

dlgEmpty

dlgSubtract


System::dlgCopy
dlgCopy

See Also	Example	System Type

Procedure

Invokes the Copy dialog box.

Syntax

dlgCopy ( const tableName String )

Description

dlgCopy displays the Copy dialog box, just as if you had chosen Tools | Utilities | Copy. The variable tableName specifies the source table.

ObjectPAL code suspends execution until the user closes this dialog box. ObjectPAL has no control over this dialog box once it is displayed; it is up to the user to fill in any necessary information and close the dialog box.


Example for System::dlgCopy
dlgCopy Example

The following example invokes the Copy dialog box and fills in the Customer table name as the source table. The user must fill in the destination table name and close the dialog box.

; showCopyDlg::pushButton
method pushButton(var eventInfo Event)
; invoke the Table Copy dialog box with the Customer table as the source
DlgCopy("customer.db") ; same as Tools | Utilities | Copy
endMethod


See Also for System::dlgCopy
See Also

dlgAdd

dlgEmpty

dlgSubtract


System::dlgCreate
dlgCreate

See Also	Example	System Type

Procedure

Invokes dialog boxes to create a table.

Syntax

dlgCreate ( const tableName String )

Description

dlgCreate opens dialog boxes for creating a table, just as if you had chosen File | New | Table. The variable tableName specifies the name of table to create. First, it displays the Table Type dialog box. When you choose a table type and close the dialog box, it opens a Create Table dialog box for the specified table type.

ObjectPAL code suspends execution until the user closes this dialog box. ObjectPAL has no control over this dialog box once it is displayed; it's up to the user to fill in any necessary information and close the dialog box.


Example for System::dlgCreate
dlgCreate Example

The following example invokes the Create Table dialog box. The user must choose the table type, fill out the field roster, and save the created table.

; showCreateDlg::pushButton
method pushButton(var eventInfo Event)
; invoke the Create Table dialog box -- table name is not used
dlgCreate("sometbl.db") ; same as  File | New | Table
endMethod


See Also for System::dlgCreate
See Also

dlgCopy

dlgDelete


System::dlgDelete
dlgDelete

See Also	Example	System Type

Procedure

Invokes the Delete dialog box.

Syntax

dlgDelete ( const tableName String )

Description

dlgDelete displays the Delete dialog box, just as if you had chosen Tools | Utilities | Delete. The variable tableName specifies the name of table to delete.

ObjectPAL code suspends execution until the user closes this dialog box. ObjectPAL has no control over this dialog box once it is displayed; it's up to the user to fill in any necessary information and close the dialog box.


Example for System::dlgDelete
dlgDelete Example

The following example invokes the Delete dialog box and fills in the Customer table name as the table to delete. The user must close the dialog box and confirm the deletion.

; showDeleteDlg::pushButton
method pushButton(var eventInfo Event)
; invoke the Table Delete dialog box for the Customer table
DlgDelete("Customer.db")  ; same as Tools | Utilities | Delete
endMethod


See Also for System::dlgDelete
See Also

dlgCreate

dlgEmpty


System::dlgEmpty
dlgEmpty

See Also	Example	System Type

Procedure

Invokes the Empty dialog box.

Syntax

dlgEmpty ( const tableName String )

Description

dlgEmpty displays the Empty dialog box, just as if you had chosen Tools | Utilities | Empty. The variable tableName specifies the name of table to empty.

ObjectPAL code suspends execution until the user closes this dialog box. ObjectPAL has no control over this dialog box once it is displayed; it's up to the user to fill in any necessary information and close the dialog box.


Example for System::dlgEmpty
dlgEmpty Example

The following example invokes the Empty dialog box and fills in the Customer table name as the table to empty. The user must close the dialog box and confirm the data loss.

method pushButton(var eventInfo Event)
; invokes the Table Empty dialog box for Customer table
DlgEmpty("Customer.db") ; same as Tools | Utilities | Empty
endMethod


See Also for System::dlgEmpty
See Also

dlgDelete

dlgSubtract


System::dlgExport
dlgExport	4.5

See Also	Example	System Type

Method

Invokes the Table Export dialog box.

Syntax

dlgExport ( const tableName String )

Description

dlgExport invokes the Table Export dialog box, just as if you had chosen Tools | Utilities | Export. tableName specifies the name of the table to export. Refer to the User's Guide for more information about exporting data.

ObjectPAL code suspends execution until the user closes this dialog box. ObjectPAL has no control over this dialog box once it is displayed; it's up to the user to fill in any necessary information and close the dialog box.


Example for System::dlgExport
dlgExport Example

The following example invokes the Table Export dialog box for the Orders table.

method pushButton(var eventInfo Event)
   var
      tableName String
   endVar

   tableName = "orders.db"

   ; invoke the Table Export dialog box
   dlgExport(tableName)
endMethod


See Also for System::dlgExport
See Also

dlgImportASCIIFix

dlgImportASCIIVar

dlgImportSpreadsheet

exportASCIIFix

exportASCIIVar

exportSpreadsheet


System::dlgImportASCIIFix
dlgImportASCIIFix	4.5

See Also	Example	System Type

Procedure

Invokes the Fixed Length ASCII Import dialog box.

Syntax

dlgImportASCIIFix ( const fileName String )

Description

dlgImportASCIIFix invokes the Fixed Length ASCII Import dialog box, just as if you had chosen Tools | Utilities | Import, specified Fixed Length for the type, and entered a file name. fileName specifies both the name of the source file and the name of the destination table for the imported data. If you specify a file-name extension, Paradox uses it to find the source file, but the file-name extension of the destination table depends on the table type. The default type is Paradox, so the default file-name extension is .DB (for dBASE tables it's .DBF). Dates and numbers are formatted as specified in the Control Panel. Refer to the User's Guide for more information about importing data.

ObjectPAL code suspends execution until the user closes this dialog box. ObjectPAL has no control over this dialog box once it is displayed; it's up to the user to fill in any necessary information and close the dialog box.


Example for System::dlgImportASCIIFix
dlgImportASCIIFix Example

The following example invokes the Fixed Length Import dialog box to import data from the text file ORDERS.TXT to the Paradox table ORDERS.DB.

method pushButton(var eventInfo Event)
   var
      fileName String
   endVar

   fileName = "orders.txt"

   ; invoke the Fixed Length ASCII Import dialog box.
   ; by default, Paradox will use ORDERS.TXT as the source file
   ; and ORDERS.DB as the destination table
   dlgImportASCIIFix(fileName)
endMethod


See Also for System::dlgImportASCIIFix
See Also

dlgExport

dlgImportASCIIVar

dlgImportSpreadsheet

importASCIIFix


System::dlgImportASCIIVar
dlgImportASCIIVar	4.5

See Also	Example	System Type

Procedure

Invokes the Delimited ASCII Import dialog box.

Syntax

dlgImportASCIIVar ( const fileName String )

Description

dlgImportASCIIVar invokes the Delimited ASCII Import dialog box, just as if you had chosen Tools | Utilities | Import, specified Delimited for the type, and entered a file name. fileName specifies both the name of the source file and the name of the destination table for the imported data. If you specify a file-name extension, Paradox uses it to find the source file, but the file-name extension of the destination table depends on the table type. The default type is Paradox, so the default file-name extension is .DB (for dBASE tables it's .DBF). Dates and numbers are formatted as specified in the Control Panel. Refer to the User's Guide for more information about importing data.

ObjectPAL code suspends execution until the user closes this dialog box. ObjectPAL has no control over this dialog box once it is displayed; it's up to the user to fill in any necessary information and close the dialog box. Following are the default settings: fields are separated by commas, fields are delimited by quotes, only text fields are delimited, and the OEM character set is used.


Example for System::dlgImportASCIIVar
dlgImportASCIIVar Example

The following example invokes the Delimited Import dialog box to import data from the text file ORDERS.TXT to the Paradox table ORDERS.DB.

method pushButton(var eventInfo Event)
   var
      fileName String
   endVar

   fileName = "orders.txt"

   ; invoke the Fixed Length ASCII Import dialog box.
   ; by default, Paradox will use ORDERS.TXT as the source file
   ; and ORDERS.DB as the destination table.
   dlgImportASCIIVar(fileName)
endMethod


See Also for System::dlgImportASCIIVar
See Also

dlgExport

dlgImportASCIIFix

dlgImportSpreadsheet

importASCIIVar


System::dlgImportSpreadsheet
dlgImportSpreadsheet	4.5

See Also	Example	System Type

Procedure

Invokes the Spreadsheet Import dialog box.

Syntax

dlgImportSpreadsheet ( const fileName String )

Description

dlgImportSpreadsheet invokes the Spreadsheet Import dialog box, just as if you had chosen Tools | Utilities | Import, specified a spreadsheet type, and entered a file name. The fileName argument specifies the name of the source file, the spreadsheet type of the source file, and the name of the destination table for the imported data. You must specify a file-name extension; Paradox uses it to find and identify the type of the source file, but the file-name extension of the destination table depends on the table type. The default type is Paradox, so the default file-name extension is .DB (for dBASE tables it's .DBF). Refer to the User's Guide for more information about importing data.

Note:	The extension you supply as part of fileName specifies the format of the spreadsheet file. The following list shows extensions and file formats:

Extension	Format

WB1	Quattro Pro Win

WQ1	Quattro Pro DOS

WKQ	Quattro

WK1	Lotus 2.x

WKS	Lotus 1.A

XLS	Excel 3.0/4.0

ObjectPAL code suspends execution until the user closes this dialog box. ObjectPAL has no control over this dialog box once it is displayed; it's up to the user to fill in any necessary information and close the dialog box. Following are the default settings: the From cell is the first cell of the first page of the spreadsheet, the To cell is the last cell of the last page, and the Get Field Names From First Row check box is checked.


Example for System::dlgImportSpreadsheet
dlgImportSpreadsheet Example

The following example invokes the Spreadsheet Import dialog box to import the data from the Quattro Pro for Windows spreadsheet ORDERS.WB1 to the Paradox table ORDERS.DB.

method pushButton(var eventInfo Event)
   var
      fileName String
   endVar

   fileName = "orders.wb1"

   ; invoke the Spreadsheet Import dialog box
   ; y default, Paradox will use ORDERS.WB1 as the source file
   ; and ORDERS.DB as the destination table
   dlgImportSpreadsheet(fileName)
endMethod


See Also for System::dlgImportSpreadsheet
See Also

dlgExport

dlgImportASCIIFix

dlgImportASCIIVar

importSpreadsheet


System::dlgNetDrivers
dlgNetDrivers

See Also	Example	System Type

Procedure

Invokes the Drivers dialog box.

Syntax

dlgNetDrivers ( )

Description

dlgNetDrivers displays the Drivers dialog box, just as if you had chosen Tools | System Settings | Drivers.

ObjectPAL code suspends execution until the user closes this dialog box. ObjectPAL has no control over this dialog box once it is displayed; it's up to the user to fill in any necessary information and close the dialog box.


Example for System::dlgNetDrivers
dlgNetDrivers Example

The following code opens the Drivers dialog box.

; showNetDrivers::pushButton
method pushButton(var eventInfo Event)
; invoke the Drivers dialog box
DlgNetDrivers()  ; same as Tools | System Settings | Drivers
endMethod


See Also for System::dlgNetDrivers
See Also

Session::enumDriverCapabilities

Session::enumDriverInfo

Session::enumDriverNames


System::dlgNetLocks
dlgNetLocks

See Also	Example	System Type

Procedure

Creates and displays a table of lock information.

Syntax

dlgNetLocks ( )

Description

dlgNetLocks invokes the Select File dialog box and prompts you to choose a table, just as if you had chosen Tools | Multiuser | Display Locks. When you choose a table and click OK, Paradox creates a Paradox table named LOCKS.DB in your private directory. If the table exists, Paradox overwrites it without asking for confirmation. This method fails if the table is already open.

Here is the structure of LOCKS.DB:

Field Name	Type	Description

Type	S	Lock type value.

UserName	A14	User name of lock owner.

NetSession	S	Net level session number.

OurSession	S	IDAPI session number, if the lock is an IDAPI lock.

RecordNum	N	Record number of locked record (if Type = 0).

Count	S	Number of locks on the table

ObjectPAL code suspends execution until the user closes this dialog box. ObjectPAL has no control over this dialog box once it is displayed; it's up to the user to fill in any necessary information and close the dialog box.

After Paradox creates the Locks table, Paradox displays it in a Table window.


Example for System::dlgNetLocks
dlgNetLocks Example

The following example opens the Select File dialog box. Once the user chooses a file, a Locks table is created and displayed.

; showNetLocks::pushButton
method pushButton(var eventInfo Event)
; creates a table of lock info :PRIV:LOCKS.DB, then displays it
DlgNetLocks()  ; same as Tools | Multiuser | Display Locks
endMethod


See Also for System::dlgNetLocks
See Also

dlgNetSetLocks

dlgNetRetry

TCursor::enumLocks


Lock type values for System::dlgNetLocks

0 = Record lock

1 = Special record lock

2 = Group lock

3 = Image lock

4 = Table open (no lock)

5 = Table read lock

6 = Table write lock

7 = Table exclusive lock

9 = Unknown lock


System::dlgNetRefresh
dlgNetRefresh

See Also	Example	System Type

Procedure

Invokes the Network Refresh Rate dialog box.

Syntax

dlgNetRefresh ( )

Description

dlgNetRefresh displays the Network Refresh Rate dialog box, just as if you had chosen Tools | System Settings | Auto Refresh.

ObjectPAL code suspends execution until the user closes this dialog box. ObjectPAL has no control over this dialog box once it is displayed; it's up to the user to fill in any necessary information and close the dialog box.


Example for System::dlgNetRefresh
dlgNetRefresh Example

The following example opens the Network Refresh Rate dialog box.

; showNetRefresh::pushButton
method pushButton(var eventInfo Event)
; invoke the Network Refresh Rate dialog
DlgNetRefresh()  ; same as Tools | System Settings | Auto Refresh
endMethod


See Also for System::dlgNetRefresh
See Also

dlgNetRetry

dlgNetWho


System::dlgNetRetry
dlgNetRetry

See Also	Example	System Type

Procedure

Invokes the Network Retry Period dialog box.

Syntax

dlgNetRetry ( )

Description

dlgNetRetry displays the Network Retry Period dialog box, just as if you had chosen Tools | Multiuser | Set Retry.

ObjectPAL code suspends execution until the user closes this dialog box. ObjectPAL has no control over this dialog box once it is displayed; it's up to the user to fill in any necessary information and close the dialog box.


Example for System::dlgNetRetry
dlgNetRetry Example

The following example opens the Network Retry Period dialog box.

; showNetRetryDlg::pushButton
method pushButton(var eventInfo Event)
; invoke the Network Retry Period dialog box
DlgNetRetry() ; same as Tools | Multiuser | Set Retry
endMethod


See Also for System::dlgNetRetry
See Also

dlgNetLocks


System::dlgNetSetLocks
dlgNetSetLocks

See Also	Example	System Type

Procedure

Invokes the Table Locks dialog box.

Syntax

dlgNetSetLocks ( )

Description

dlgNetSetLocks displays the Table Locks dialog box, just as if you had chosen Tools | Multiuser | Set Locks.

ObjectPAL code suspends execution until the user closes this dialog box. ObjectPAL has no control over this dialog box once it is displayed; it's up to the user to fill in any necessary information and close the dialog box.


Example for System::dlgNetSetLocks
dlgNetSetLocks Example

The following example opens the Table Locks dialog box.

; showSetLocks::pushButton
method pushButton(var eventInfo Event)
DlgNetSetLocks()  ; invoke the Table Locks dialog box
                  ; same as choosing Tools | Multiuser | Set Locks
endMethod


See Also for System::dlgNetSetLocks
See Also

dlgNetLocks


System::dlgNetSystem
dlgNetSystem

See Also	Example	System Type

Procedure

Invokes the IDAPI System Information dialog box.

Syntax

dlgNetSystem ( )

Description

dlgNetSystem displays the IDAPI System Information dialog box, just as if you had chosen Tools | System Settings | IDAPI.

ObjectPAL code suspends execution until the user closes this dialog box. ObjectPAL has no control over this dialog box once it is displayed; it's up to the user to fill in any necessary information and close the dialog box.


Example for System::dlgNetSystem
dlgNetSystem Example

This code opens the IDAPI System Information dialog box.

; showNetSystem::pushButton
method pushButton(var eventInfo Event)
; invoke the IDAPI System Information dialog box
DlgNetSystem()    ; same as Tools | System Settings | IDAPI
endMethod


See Also for System::dlgNetSystem
See Also

dlgNetDrivers

Session::enumDriverCapabilities

Session::enumDriverInfo

Session::enumDriverNames


System::dlgNetUserName
dlgNetUserName

See Also	Example	System Type

Procedure

Invokes the Network User Name dialog box.

Syntax

dlgNetUserName ( )

Description

dlgNetUserName displays the Network User Name dialog box, just as if you had chosen Tools | Multiuser | User Name.

ObjectPAL code suspends execution until the user closes this dialog box. ObjectPAL has no control over this dialog box once it is displayed; it's up to the user to fill in any necessary information and close the dialog box.


Example for System::dlgNetUserName
dlgNetUserName Example

The following code opens the Network User Name dialog box, which shows the current user's network name.

; showUserName::pushButton
method pushButton(var eventInfo Event)
; invoke the Network User Name dialog box
DlgNetUserName()   ; same as Tools | Multiuser | User Name
endMethod


See Also for System::dlgNetUserName
See Also

dlgNetWho


System::dlgNetWho
dlgNetWho

See Also	Example	System Type

Procedure

Invokes the Current Users dialog box.

Syntax

dlgNetWho ( )

Description

dlgNetWho displays the Current Users dialog box, just as if you had chosen Tools | Multiuser | Who.

ObjectPAL code suspends execution until the user closes this dialog box. ObjectPAL has no control over this dialog box once it is displayed; it's up to the user to close the dialog box.


Example for System::dlgNetWho
dlgNetWho Example

The following code opens the Current Users dialog box.

; showUserList::pushButton
method pushButton(var eventInfo Event)
; invoke the Current Users dialog box
DlgNetWho()  ; same as Tools | Multiuser | Who
endMethod


See Also for System::dlgNetWho
See Also

dlgNetUserName


System::dlgRename
dlgRename

See Also	Example	System Type

Procedure

Invokes the Rename dialog box.

Syntax

dlgRename ( const tableName String )

Description

dlgRename displays the Rename dialog box, just as if you had chosen Tools | Utilities | Rename and typed the name of a table to rename. The variable tableName specifies the name of table to rename.

ObjectPAL code suspends execution until the user closes this dialog box. ObjectPAL has no control over this dialog box once it is displayed; it's up to the user to fill in any necessary information and close the dialog box.


Example for System::dlgRename
dlgRename Example

The following example invokes the Rename dialog box and fills in the Customer table name as the table to rename. The user must enter a new name and close the dialog box.

; showRenameDlg::pushButton
method pushButton(var eventInfo Event)
; invoke the Table Rename dialog box
dlgRename("customer.db") ; same as Tools | Utilities | Rename
endMethod


See Also for System::dlgRename
See Also

dlgCopy

dlgDelete

dlgSort


System::dlgRestructure
dlgRestructure

See Also	Example	System Type

Procedure

Invokes the Table Restructure dialog box.

Syntax

dlgRestructure ( const tableName String )

Description

dlgRestructure displays the Restructure Table dialog box, just as if you had chosen Tools | Utilities | Restructure and typed the name of a table to restructure. The variable tableName specifies the name of table to restructure. If tableName does not specify a path, Paradox searches for the table in the working directory. If tableName does not specify an extension, or specifies an extension of .DB, dlgRestructure displays the Restructure Paradox Table dialog box. If tableName specifies an extension of .DBF, dlgRestructure displays the Restructure dBASE Table dialog box.

ObjectPAL code suspends execution until the user closes this dialog box. ObjectPAL has no control over this dialog box once it is displayed; it's up to the user to fill in any necessary information and close the dialog box.


Example for System::dlgRestructure
dlgRestructure Example

The following example invokes the Restructure dialog box and fills in the Customer table name as the table to restructure. The user must modify the structure and close the dialog box.

; showRestructureDlg::pushButton
method pushButton(var eventInfo Event)
; invoke the Table Restructure dialog box for Customer table
DlgRestructure("customer.db")   ; same as Tools | Utilities | Restructure
endMethod


See Also for System::dlgRestructure
See Also

dlgCreate


System::dlgSort
dlgSort

See Also	Example	System Type

Procedure

Invokes the Sort Table dialog box.

Syntax

dlgSort ( const tableName String )

Description

dlgSort displays the Sort Table dialog box, just as if you had chosen Tools | Utilities | Sort and typed the name of a table to sort. The variable tableName specifies the name of table to sort.

ObjectPAL code suspends execution until the user closes this dialog box. ObjectPAL has no control over this dialog box once it is displayed; it's up to the user to fill in any necessary information and close the dialog box.


Example for System::dlgSort
dlgSort Example

The following example invokes the Sort Table dialog box and chooses the Customer table name as the table to sort. The user must create a sort specification and close the dialog box.

; showSortDlg::pushButton
method pushButton(var eventInfo Event)
; invoke the Table Sort dialog box
DlgSort("customer.db")      ; same as Tools | Utilities | Sort
endMethod


See Also for System::dlgSort
See Also

dlgRename


System::dlgSubtract
dlgSubtract

See Also	Example	System Type

Procedure

Invokes the Subtract dialog box.

Syntax

dlgSubtract ( const tableName String )

Description

dlgSubtract displays the Subtract dialog box, just as if you had chosen Tools | Utilities | Subtract and typed the name of a table. The variable tableName specifies the name of table to subtract records from.

ObjectPAL code suspends execution until the user closes this dialog box. ObjectPAL has no control over this dialog box once it is displayed; it's up to the user to fill in any necessary information and close the dialog box.


Example for System::dlgSubtract
dlgSubtract Example

The following example invokes the Subtract dialog box and fills in the Customer table name as the source table---the table with records to subtract. The user must fill in the name of the table to subtract records from and close the dialog box.

; showSubtractDlg::pushButton
method pushButton(var eventInfo Event)
; invoke the Table Subtract dialog box
DlgSubtract("customer.db")  ; Tools | Utilities | Subtract
endMethod


See Also for System::dlgSubtract
See Also

dlgAdd

dlgDelete


System::dlgTableInfo
dlgTableInfo

See Also	Example	System Type

Procedure

Invokes the Structure Information dialog box.

Syntax

dlgTableInfo ( const tableName String )

Description

dlgTableInfo invokes the Structure Information dialog box, just as if you had chosen Tools | Utilities | Info Structure and typed a table name. The variable tableName specifies the name of the table from which to subtract records.

ObjectPAL code suspends execution until the user closes this dialog box. ObjectPAL has no control over this dialog box once it is displayed; it's up to the user to fill in any necessary information and close the dialog box.


Example for System::dlgTableInfo
dlgTableInfo Example

The following example invokes the Structure Information dialog box for the Customer table.

; showTableInfo::pushButton
method pushButton(var eventInfo Event)
; invoke the Structure Information dialog box for the Customer table
dlgTableInfo("customer.db") ; same as File | Table Utilities | Info Structure
endMethod


See Also for System::dlgTableInfo
See Also

dlgCreate

dlgRestructure


System::enableExtendedCharacters
enableExtendedCharacters

See Also	Example	System Type

Procedure

Lets the user enter extended character codes from the numeric keypad without turning NumLock on.

Syntax

enableExtendedCharacters ( const yesNo Logical ) Logical

Description

enableExtendedCharacters specifies whether the can user enter extended character codes from the numeric keypad without turning NumLock on. If yesNo is True, extended characters are enabled without NumLock. If yesNo is False, NumLock must be on to enter extended character codes; if NumLock is off, keypad keys function as navigation keys. The setting affects all forms, and remains active as long as Paradox is running. It is not saved when the user exits.

This method is useful in international applications or other environments where keyboards do not have NumLock keys. enableExtendedCharacters returns True if it succeeds; otherwise it returns False.


Example for System::enableExtendedCharacters
enableExtendedCharacters Example

The following example enables extended characters when the form opens.

method open(var eventInfo Event)

if eventInfo.isPreFilter() then

;// This code executes for each object on the form:

else

;// This code executes only for the form:

doDefault

enableExtendedCharacters(Yes)

endif

endMethod


See Also for System::enableExtendedCharacters
See Also

sysInfo


System::enumDesktopWindowNames
enumDesktopWindowNames

See Also	Example	System Type	Changes

Procedure

Creates a table listing open Paradox windows.

Syntax

1. enumDesktopWindowNames ( const tableName String )

2. enumDesktopWindowNames ( const windowNames Array [ ] String )

Description

enumDesktopWindowNames lists the names of open windows owned by the Paradox Desktop.

Syntax 1 creates the Paradox table named in tableName listing the name, class, position, and size of each window owned by Paradox. If tableName does not specify a path, the table is created in the working directory. If tableName already exists, this method overwrites it without asking for confirmation. If tableName is open, this method fails.

Here is the structure of the table:

Field Name	Type	Description

WindowName	A64	Name of window, or blank if the window has no name. Field size changed in version 5.0.

ClassName	A63	Window type. Field size changed in version 5.0.

Position	A12	Coordinates of upper left corner,
for example (456, 553)

Size	A12	Coordinates of lower right corne,
for example (889, 221).

Handle	S	Window handle.

ChildId	S	ID number of child window (0 = no child window). Added in version 5.0.

ParentHandle	S	Handle of parent window. Added in version 5.0.

InstanceHandle	S	Handle of window instance. Added in version 5.0.

Syntax 2 fills the array named in winArray with the names of the windows. You must declare the array before calling this method. Applications are listed in Windows z-order; that is, the application displayed "on top" is listed first in the array, the window in the second layer is listed second, and so on.

Compare this method to enumWindowNames, which lists all Windows applications running on the user's system.


Example for System::enumDesktopWindowNames
enumDesktopWindowNames Example

The following example writes the open desktop window titles to an array and shows the array. Next, the method creates and displays a table that lists the open desktop window names.

; getDesktopWinNames::pushButton
method pushButton(var eventInfo Event)
var
  winNames Array[] String
  tempTV           TableView
endvar
tempTV.open("Customer")               ; open a table view
enumDesktopWindowNames(winNames)      ; enum desktop window names to an array
winNames.view() ; lists all windows open in the Paradox desktop, if
                ; method editor window is open, lists first 32 chars
enumDesktopWindowNames("wNameTbl.db") ; enum to a table
tempTV.open("wNameTbl")               ; show the table
endMethod


See Also for System::enumDesktopWindowNames
See Also

enumFormNames

enumReportNames

enumWindowNames


Changes to System::enumDesktopWindowNames

In version 5.0, the WindowName field was changed from A32 to A64, and the ClassName field was changed from A32 to A63.

The following fields were added in version 5.0:

Field Name	Type	Description

ChildId	S	ID number of child window (0 = no child window). Added in version 5.0.

ParentHandle	S	Handle of parent window. Added in version 5.0.

InstanceHandle	S	Handle of window instance. Added in version 5.0.


System::enumEnvironmentStrings
enumEnvironmentStrings	5.0

See Also	Example	System Type

Procedure

Lists the items from the DOS environment.

Syntax

enumEnvironmentStrings ( var values DynArray[] String ) Logical

Description

enumEnvironmentStrings lists all the items from the DOS environment. It writes the data to the DynArray values that you must declare and pass as an argument.


Example for System::enumEnvironmentStrings
enumEnvironmentStrings Example

In the following example, the method creates a dynamic array dyn that lists items from the DOS environment and shows the dynamic array.

;thisButton::pushButton
method pushButton(var eventInfo Event)
  var
    dyn	Dynarray[] String
  endVar

  enumEnvironmentStrings(dyn)
  dyn.view()
endmethod


See Also for System::enumEnvironmentStrings
See Also

resourceInfo


System::enumFonts
enumFonts

See Also	Example	System Type

Procedure

Creates a table listing fonts in the user's system.

Syntax

enumFonts ( const tableName String )

Description

enumFonts creates a Paradox table tableName listing fonts in the user's system. By default, this method creates the table in the user's working directory. If tableName already exists, this method overwrites it without asking for confirmation. If tableName is open, this method fails.

Here is the table structure:

Field Name	Type	Description

FaceName	A64	Font name. Example: Arial

FontSize	A8	Font size in printer's points. Example: 12

Attribute	A64	Display/print attribute. Example: Normal


Example for System::enumFonts
enumFonts Example

The following example calls enumFonts to list the fonts to a table named FONTS.DB. Then it searches a TCursor for a font named Modern. If Modern is in the table, it sets the Font.TypeFace property of a field object named balanceField to Modern.

; getFonts::pushButton
method pushButton(var eventInfo Event)
var
  fontsTC TCursor
  tempTV  TableView
endVar
enumFonts("fonts.db")        ; write font names to a table
tempTV.open("fonts.db")      ; show the table
dlgTableInfo("fonts.db")     ; show the table structure
fontsTC.open("fonts.db")
if fontsTC.locate("FaceName", "Modern") then
  balanceField.Font.TypeFace = "Modern"
endIf
fontsTC.close()
endMethod


See Also for System::enumFonts
See Also

enumRTLConstants


System::enumFormats
enumFormats	5.0

See Also	Example	System Type

Procedure

Lists the current formats.

Syntax

enumFormats ( const formatType String, var formats DynArray[] String ) Logical

Description

enumFormats lists the current formats for formatType, where formatType is one of the following: Date, Number, Time, or Logical. It writes the data to the DynArray formats that you must declare and pass as an argument.

enumFormats returns True if it is successful; otherwise, it returns False.


Example for System::enumFormats
enumFormats Example

In the following example, the method creates a dynamic array dyn that lists the formats for Date, then shows the dynamic array.

; btnInspectFormat :: pushButton
method pushButton(var eventInfo Event)
  var
    s	String
    dyn	DynArray[] String
  endVar

  s = "Date"
  s.view("Enter format to inspect")
  enumFormats(s, dyn)
  dyn.view()
endmethod


See Also for System::enumFormats
See Also

String::format


System::enumFormNames
enumFormNames

See Also	Example	System Type

Procedure

Creates an array listing open forms.

Syntax

enumFormNames ( var formNames Array[ ] String )

Description

enumFormNames fills the array named in formNames with the file names of the forms opened in the user's desktop. You must declare formNames as a resizeable array before calling this method. Forms are listed in Windows z-order; that is, the form displayed "on top" is listed first in the array, the form in the second layer is listed second, and so on.


Example for System::enumFormNames
enumFormNames Example

The code in the following example writes the file names of open forms to an array named openForms, then displays the openForms array.

; getFormNames::pushButton
method pushButton(var eventInfo Event)
var
  openForms Array[] String
endVar
enumFormNames(openForms)
openForms.view()         ; Lists file names of open forms.
endMethod


See Also for System::enumFormNames
See Also

enumWindowNames

enumReportNames

enumDesktopWindowNames


System::enumPrinters
enumPrinters	5.0

See Also	Example	System Type

Procedure

Lists printers installed in the user's system.

Syntax

enumPrinters ( var printers Array[ ] String ) Logical

Description

enumPrinters fills the array named in printers with the name, driver name, and port of each printer installed in the user's system. You must declare printers as a resizeable array before calling this method.

Each item in the array contains three components: the name, driver name, and port or a printer, separated by commas. For example, in the following array item, the printer name is Postscript Printer, the driver is PSCRIPT.DRV (the .DRV extension is assumed), and the port is LPT1:.

PostScript Printer,pscript,LPT1:

You can pass one of these array items to printerSetCurrent to specify the active printer. You can use the String method breakApart to separate the components (for example, to display a list of printer names).


Example for System::enumPrinters
enumPrinters Example

This example calls enumPrinters to get a list of printers installed in the user's system. If the list includes a PostScript printer, a call to printerSetCurrent makes it the current (active) printer. The example assumes that PostScript printers use the driver PSCRIPT.DRV.

method pushButton(var eventInfo Event)

var

arPrinters,

arPrnNames	Array[] String

stDrvName,

stPrnName,

stPrnInfo	String

i	SmallInt

endVar

; Assume that PostScript printers use the driver PSCRIPT.DRV.

stDrvName = "pscript"

enumPrinters(arPrinters) ; Get a list of installed printers.

; See if the list includes a PostScript printer (one that

; uses the "pscript" driver).

for i from 1 to arPrinters.size()

stPrnInfo = arPrinters[i]

; Info is separated by commas.

stPrnInfo.breakApart(arPrnNames, ",")

; After breakApart, array item 1 is the printer name,

; array item 2 is the driver name.

if arPrnNames[2] = stDrvName then

; If a PostScript printer is found, make it current.

if printerSetCurrent(stPrnInfo) then

msgInfo("Current printer:", arPrnNames[1])

else

errorShow()

endIf

return

endIf

endFor

msgStop("Printer setup", "A PostScript printer must be installed.")

endMethod


See Also for System::enumPrinters
See Also

printerGetInfo

printerGetOptions

printerSetCurrent

printerSetOptions


System::enumReportNames
enumReportNames

See Also	Example	System Type

Procedure

Creates an array listing open reports.

Syntax

enumReportNames ( var reportNames Array[ ] String )

Description

enumReportNames fills the array named in reportNames with the names of the reports open in the user's desktop. You must declare reportNames as a resizeable array before calling this method. Reports are listed in Windows z-order; that is, the report displayed "on top" is listed first in the array, the report in the second layer is listed second, and so on.


Example for System::enumReportNames
enumReportNames Example

The code in the following example writes the open reports to an array named openReports, then views the openReports array.

; getReportNames::pushButton
method pushButton(var eventInfo Event)
var
  openReports Array[] String
endVar
enumReportNames(openReports)
openReports.view()           ; lists forms, reports
endMethod


See Also for System::enumReportNames
See Also

enumFormNames

enumDesktopWindowNames

enumWindowNames


System::enumRTLClassNames
enumRTLClassNames

See Also	Example	System Type

Procedure

Creates a table listing the object types (also called classes) known to ObjectPAL.

Syntax

enumRTLClassNames ( const tableName String ) Logical

Description

enumRTLClassNames creates a Paradox table tableName listing the names of all object types (also called classes) in the ObjectPAL run-time library.  By default, this table is created in the working directory. If tableName already exists, this method overwrites it without asking for confirmation. If tableName is open, this method fails. This method returns True if it succeeds; otherwise, it returns False.

Here is the structure of the table:

Field Name	Type	Description

ClassName	A32*	ObjectPAL type name. Example: UIObject


Example for System::enumRTLClassNames
enumRTLClassNames Example

The following example writes the run-time library class names to a table named Rtlclass and views the table.

; getRTLClasses::pushButton
method pushButton(var eventInfo Event)
var
  tempTV TableView
endVar
enumRTLCLassNames("rtlclass.db")      ; write class names to table
tempTV.open("rtlclass")               ; show the table
endMethod


See Also for System::enumRTLClassNames
See Also

enumRTLConstants

enumRTLMethods


System::enumRTLConstants
enumRTLConstants

See Also	Example	System Type

Procedure

Creates a table listing the constants defined by ObjectPAL.

Syntax

enumRTLConstants ( const tableName String ) Logical

Description

enumRTLConstants creates a Paradox table tableName listing all the constants defined in the ObjectPAL run-time library. By default, this table is created in the working directory. If tableName already exists, this method overwrites it without asking for confirmation. If tableName is open, this method fails.

Here is the structure of the table:

Field Name	Type	Description

GroupName	A32*	One of the types of constants. Example: ActionDataCommands

ConstantName	A48*	Symbolic name of the constant. Example: DataArriveRecord

Type	A48	Data type of the constant. Example: SmallInt

Value	A64	Value of the constant. Example: 3111

Note:	Although Paradox provides the values of constants, you should not use the values value in code: refer to constants by name. Use the constantValueToName and constantNameToValue methods to convert values and constants, if necessary.


Example for System::enumRTLConstants
enumRTLConstants Example

The following example writes the run-time library constant descriptions to a table named Rtlconst and views the table.

; getRTLConsts::pushButton
method pushButton(var eventInfo Event)
var
  tempTV TableView
endVar
enumRTLConstants("rtlconst.db")     ; write cconstants names to table
tempTV.open("rtlconst")             ; show the table
endMethod


See Also for System::enumRTLConstants
See Also

constantValueToName

constantNameToValue

enumRTLClassNames

enumRTLMethods


System::enumRTLErrors
enumRTLErrors	5.0

See Also	Example	System Type

Procedure

Lists the error codes and messages used by ObjectPAL.

Syntax

enumRTLErrors ( const tableName String ) Logical

Description

enumRTLErrors lists the error codes and messages used by ObjectPAL. It writes the data to the table specified in tableName, creating it if necessary. If the table already exists, this method overwrites it without asking for confirmation. If you don't specify a path or alias in tableName, Paradox creates the table in the working directory.

Here is the structure of the table:

Field Name	Type	Description

ErrorNo	N*	Error number (decimal)

ErrorNoX	A8	Error number (hex)

Name	A48	Constant name, if it exists (for example, peNoMemory); otherwise, it's the string <<Unmapped Error>>

Value	M230	Error message. Example: Insufficient memory for this operation.

This method returns True if it is successful; otherwise, it returns False. If, for example, you pass enumRTLErrors an invalid table name, it fails and returns False.


Example for System::enumRTLErrors
enumRTLErrors Example

The following example writes the run-time library error codes and descriptions to a table named Rtlerror and displays the table.

;getRTLErrors::pushButton
method pushButton(var eventInfo Event)
  var
    tv	TableView
  endVar

  enumRTLErrors("RTLerror.db")
  tv.open("RTLerror.db")
endMethod


See Also for System::enumRTLErrors
See Also

enumRTLConstants

enumRTLMethods


System::enumRTLMethods
enumRTLMethods

See Also	Example	System Type

Procedure

Creates a table listing the methods in ObjectPAL.

Syntax

enumRTLMethods ( const tableName String ) Logical

Description

enumRTLMethods creates a Paradox table tableName listing all the methods defined in the ObjectPAL run-time library. By default, this table is created in the working directory. If tableName already exists, this method overwrites it without asking for confirmation. If tableName is open, this method fails.

Here is the table structure

Field Name	Type	Description

ClassName	A32*	ObjectPAL type name. Example: FileSystem

MethodType	A8*	Method (for methods) or Proc (for procedures)

MethodName	A64*	Name of method (or procedure). Example: isDir

MethodArgs	A255*	Arguments to method (or procedure). Example: (const dirName String)

ReturnType	A32*	Data type of returned value, or blank if no return value. Example: Logical


Example for System::enumRTLMethods
enumRTLMethods Example

The following example writes the run-time library method descriptions to a table named Rtlmeth and views the table.

; getRTLMethods::pushButton
method pushButton(var eventInfo Event)
var
  tempTV TableView
endVar
enumRTLMethods("rtlmeth.db")   ; write method names to table
tempTV.open("rtlmeth")         ; show the table
endMethod


See Also for System::enumRTLMethods
See Also

enumRTLClassNames

enumRTLConstants


System::enumWindowNames
enumWindowNames

See Also	Example1	Example2	System Type	Changes

Procedure

Lists open windows.

Syntax

1. enumWindowNames ( const tableName String ) Logical

2. enumWindowNames ( var windowNames Array [ ] String )

Description

enumWindowNames creates a list of the applications currently running under Windows on the user's system.

Syntax 1 creates the Paradox table named in tableName listing the name, class, position, and size of each open window in the user's system. The table lists windows opened by any application, not just Paradox. If tableName does not specify a path, it is created in the working directory. If tableName already exists, this method overwrites it without asking for confirmation. If tableName is open, this method fails.

Here is the structure of the table:

Field Name	Type	Description

WindowName	A64	Name of window, or blank if the window has no name. Field size changed in version 5.0.

ClassName	A64	Window type. Field size changed in version 5.0.

Position	A12	Coordinates of upper left corner,
for example (456, 553)

Size	A12	Coordinates of lower right corne,
for example (889, 221).

Handle	S	Window handle.

ChildId	S	ID number of child window (0 = no child window). Added in version 5.0.

ParentHandle	S	Handle of parent window. Added in version 5.0.

InstanceHandle	S	Handle of window instance. Added in version 5.0.

Syntax 2 fills the array named in winArray with the names of the applications. You must declare the array before calling this method. Applications are listed in Windows z-order; that is, the application displayed "on top" is listed first in the array, the application in the second layer is listed second, and so on.

Compare this method to enumDesktopWindowNames, which lists only open windows owned by Paradox.


Example 1 for System::enumWindowNames
enumWindowNames Example 1

In the following example, the pushButton method for a button named getWindowNames writes and displays open window information in two ways. First, the method fills an array with the titles of the open windows and displays the array. Then, the method fills a table with descriptions of the open windows and shows the table, as well as the table's structure.

; getWindowNames::pushButton
method pushButton(var eventInfo Event)
var
  winNames Array[] String
  tempTV           TableView
endvar
enumWindowNames(winNames)       ; write names to an array
winNames.view()                 ; lists all open windows
                                ; if a method editor window is open,
                                ; lists first 32 chars
enumWindowNames("wNameTbl.db")  ; write window descriptions to a table
tempTV.open("wNameTbl")         ; show the table
dlgTableInfo("wNameTbl.db")     ; show the table structure
endMethod


Example 2 for System::enumWindowNames
enumWindowNames Example 2

In this example, the pushButton method for a button named btnCalc writes the open window information to the table :PRIV:APPS.DB. Then it searches the table for Calculator. If Calculator is found, it uses the Windows API call BringToTop, registered in the Uses window of the button, to switch to it. Otherwise, the pushButton method executes CALC.EXE.

;btnCalc :: Uses

Uses USER

BringWindowToTop(WinHandle CWORD)

endUses

;btnCalc :: pushButton

method pushButton(var eventInfo Event)

var

stApps	String

tc	TCursor

siWinHandle	SmallInt

endVar

stApps = ":PRIV:APPS.DB"

enumWindowNames(stApps)

tc.open(stApps)

if tc.locate("WindowName", "Calculator") then

siWinHandle = tc.handle

BringWindowToTop(siWinHandle)

else

execute("CALC.EXE")

endIf

endmethod


See Also for System::enumWindowNames
See Also

enumDesktopWindowNames


Changes to System::enumWindowNames

In version 5.0, the WindowName field was changed from A32 to A64, and the ClassName field was changed from A32 to A64.

The following fields were added in version 5.0:

Field Name	Type	Description

ChildId	S	ID number of child window (0 = no child window). Added in version 5.0.

ParentHandle	S	Handle of parent window. Added in version 5.0.

InstanceHandle	S	Handle of window instance. Added in version 5.0.


System::errorClear
errorClear

See Also	Example	System Type

Procedure

Clears the error stack.

Syntax

errorClear ( )

Description

errorClear clears (empties) the error stack of all error codes and error messages. For more information about the error stack, refer to the Guide to ObjectPAL.


Example for System::errorClear
errorClear Example

This code clears the error stack.

; clearError::pushButton
method pushButton(var eventInfo Event)
errorClear()           ; clear the error stack
endMethod


See Also for System::errorClear
See Also

errorCode

errorMessage

errorPop


System::errorCode
errorCode

See Also	Example	System Type

Beginner

Procedure

Returns a number describing the most recent run-time error or error condition.

Syntax

errorCode ( ) SmallInt

Description

errorCode returns an integer describing the most recent run-time error or error condition. ObjectPAL provides Errors constants for these integers (for example, peObjectNotFound), so you don't have to remember numeric values. Use enumRTLErrors to create a list of error codes and error messages.

Calling errorCode is not the same as calling eventInfo.setErrorCode, which adds error information to the event packet, but not to the error stack.

For more information about the error stack and the event packet, refer to the Guide to ObjectPAL .


Example for System::errorCode
errorCode Example

The method in the following example uses a try clause to attempt to attach to an object named boxOne on the current form. If the object doesn't exist, a critical error occurs, and control moves to the onFail clause. The onFail clause uses errorCode to discover the error, then takes appropriate action.

; handleErrorcode::pushButton
method pushButton(var eventInfo Event)
var
  obj UIObject
endVar
try
  obj.attach("boxOne")
  obj.color = Red
onFail
  if errorCode() = peObjectNotFound then
     obj.create(BoxTool, 180, 180, 360, 360)
     obj.name = "boxOne"
     obj.visible = Yes
     reTry
  else
     fail()
  endIf
endTry
endMethod


See Also for System::errorCode
See Also

errorLog

errorMessage

errorPop


System::errorHasErrorCode
errorHasErrorCode	4.5

See Also	Example	System Type

Method

Checks the error stack for a specific error code.

Syntax

errorHasErrorCode ( const errCode SmallInt ) Logical

Description

errorHasErrorCode searchs the error stack for the error specified by errCode, where errorCode is an Errors constant or a user-defined error constant. If the error is found, errorHasErrorCode returns True. Otherwise, it returns False.

Use enumRTLErrors to create a list of error codes and error messages.


Example for System::errorHasErrorCode
errorHasErrorCode Example

The following code searches the error stack to see if a key violation was reported:

  if errorHasErrorCode(peKeyViol) then

       ; error handling code goes here

  endif


See also for System::errorHasErrorCode
See Also

enumRTLErrors

errorCode

errorHasNativeErrorCode


System::errorHasNativeErrorCode
errorHasNativeErrorCode	4.5

See Also	Example	System Type

Method

Checks the error stack for a specific SQL error code.

Syntax

errorHasNativeErrorCode ( const errCode LongInt ) Logical

Description

errorHasNativeErrorCode searchs the error stack for the SQL error specified by errCode. These error codes vary depending on the server and might overlap some Paradox error codes. If the error is found, errorHasNativeErrorCode returns True. Otherwise, it returns False.


Example for System::errorHasNativeErrorCode
errorHasNativeErrorCode Example

The following code searches the error stack to see if the server error associated with the constant peServerFailure, which is set to an error code listed in the server's documentation, exists in the error stack:

if errorHasNativeErrorCode(peServerFailure) then

     ; error handling code goes here

endif


See Also for System::errorHasNativeErrorCode
See Also

errorNativeCode

errorHasErrorCode


System::errorLog
errorLog

See Also	Example	System Type

Procedure

Adds information to the error stack.

Syntax

errorLog ( const errorCode SmallInt, const errorMessage String )

Description

errorLog adds (pushes) the error information specified in errorCode and errorMessage onto the error stack. Use Errors constants or user-defined error constants to specify the value of errorCode. Use enumRTLErrors to create a list of error codes and error messages.

Calling errorLog is not the same as calling eventInfo.setErrorCode, which adds error information to the event packet, but not to the error stack.

For more information about the error stack and the event packet, refer to the Guide to ObjectPAL .


Example for System::errorLog
errorLog Example

The method in the following example uses a try clause to attempt to attach to an object named boxOne on the current form. If the object doesn't exist, a critical error occurs, and control moves to the onFail clause. If the error code isn't peObjectNotFound, the method creates and logs a custom error.

; pushMessage::pushButton
method pushButton(var eventInfo Event)
var
  obj    UIObject
  eCode  LongInt
  eMsg   String
endVar
try
  obj.attach("boxOne")
  obj.color = "RedBlue"   ; invalid color constant--will cause an error
                          ; other than peObjectNotFound
onFail
  if errorCode() = peObjectNotFound then
    msgInfo("And the error was", errorMessage())
    obj.create(BoxTool, 180, 180, 360, 360)
    obj.name = "boxOne"
    obj.visible = Yes
    reTry
 else
   ; pop off the original error
   eCode = errorCode()
   eMsg = errorMessage()
   errorPop()
   ; push the original error back onto the stack, but
   ; modify the error message
   errorLog(eCode, self.Name + "::pushButton failed at " +
            String(time()) + ". " + eMsg)
   msgInfo("And the new error is", errorMessage())
   fail()
 endIf
endTry
endMethod


See Also for System::errorLog
See Also

errorCode

errorMessage

errorPop


System::errorMessage
errorMessage

See Also	Example	System Type

Beginner

Procedure

Returns the text of the most recent error message.

Syntax

errorMessage ( ) String

Description

errorMessage returns a string containing the message displayed by the most recent run-time error or error condition. If no error occurred, errorMessage returns the empty string (""). This method is useful for logging error messages during a session.


Example for System::errorMessage
errorMessage Example

See the example for errorLog.


See Also for System::errorMessage
See Also

errorLog

errorCode

errorPop


System::errorNativeCode
errorNativeCode	4.5

See Also	Example	System Type

Method

Returns the SQL server's error code.

Syntax

errorNativeCode ( ) LongInt

Description

errorNativeCode returns a value of type LongInt representing the SQL server's error code (this error code varies depending on the server and might overlap some Paradox error codes). The function usually returns zero; if errorCode returns the constant peGeneralSQL, then errorNativeCode returns the server's error code and the message is the message returned by the server.


Example for System::errorNativeCode
errorNativeCode Example

The following code checks to see if a server error occurred, then displays the server error code (if any):

if errorCode() = peGeneralSQL then
   message("SQL server error number " + string(errorNativeCode()))
endif


See Also for System::errorNativeCode
See Also

errorCode

errorHasErrorCode

errorHasNativeErrorCode

errorMessage


System::errorPop
errorPop

See Also	Example	System Type

Procedure

Removes the top layer of information from the error stack.

Syntax

errorPop ( ) Logical

Description

errorPop removes the top layer (most recently added error code and error message) from the error stack, giving access to the layer below.

For more information about the error stack, refer to the Guide to ObjectPAL.


Example for System::errorPop
errorPop Example

See the example for errorLog.


See Also for System::errorPop
See Also

errorLog

errorCode

errorMessage

errorShow


System::errorShow
errorShow

See Also	Example	System Type

Procedure

Displays the error dialog box.

Syntax

errorShow ( [const topHelp String [ , const bottomHelp String ] ] ) Logical

Description

errorShow opens the Error dialog box and displays the current error information. The string supplied in topHelp is used to label the top portion of the dialog box; bottomHelp labels the bottom portion of the dialog box.

For more information about the error stack, refer to the Guide to ObjectPAL.


Example for System::errorShow
errorShow Example

In the following example the tryAnError button logs several errors to the error stack, then displays them with errorShow.

; tryAnError::pushButton
method pushButton(var eventInfo Event)
; add two errors to the error stack
errorLog(1, "First error")
errorLog(2, "Second error")
; show the error dialog box (error 2 shows first)
errorShow("Title for top", "Title for bottom")
endMethod


See Also for System::errorShow
See Also

errorCode

errorLog

errorMessage


System::errorTrapOnWarnings
errorTrapOnWarnings

See Also	Example	System Type

Beginner

Procedure

Specifies whether to handle warning errors as critical errors.

Syntax

errorTrapOnWarnings ( const yesNo Logical )

Description

errorTrapOnWarnings specifies whether to handle warning errors as critical errors. By default, warning errors cannot be trapped in a try...onFail block. Specifying errorTrapOnWarnings(Yes) tells Paradox to trap warning errors as well as critical errors. For more information about warning errors and critical errors, refer to the Guide to ObjectPAL.


Example for System::errorTrapOnWarnings
errorTrapOnWarnings Example

The following code attempts to open a bogus form: when errorTrapOnWarnings is set to No (the default), no error results from this attempt. Once errorTrapOnWarnings is set to Yes, the same code generates an error message.

; warningToError::pushButton
method pushButton(var eventInfo Event)
var
  someForm Form
endVar
someForm.open("someFile.fsl") ; attempt to attach to a nonexistent form
                              ; normally, this doesn't cause an error
errorTrapOnWarnings(Yes)      ; set the trap
someForm.open("someFile.fsl") ; this time, you get an error message
errorTrapOnWarnings(No)       ; restore to normal
endMethod


See Also for System::errorTrapOnWarnings
See Also

errorLog

errorCode

errorMessage

errorShow


System::execute
execute

See Also	Example	System Type

Beginner

Procedure

Executes a program or DOS command.

Syntax

execute ( const programName String [ , const wait Logical [ , const displayMode SmallInt ] ] ) Logical

Description

execute runs the program or DOS command specified in programName. The optional argument wait specifies whether ObjectPAL suspends execution until the user closes the program. The optional argument displayMode specifies the video display mode to use when executing the command. Use one of the ExecuteOptions constants to specify a value for displayMode.

If the command or program is not in the user's path, you must specify the path in programName. Use double backslashes in path names.


Example for System::execute
execute Example

The following example launches the Windows Clock application with the default window style and waits the user to close it before resuming execution.

; showClock::pushButton
method pushButton(var eventInfo Event)
   execute("clock.exe", Yes, ExeShowNormal)  ; execute Windows Clock
endMethod


See Also for System::execute
See Also

play


System::executeString
executeString	4.5

See Also	Example	System Type

Method

Converts a string into an ObjectPAL script and runs it.

Syntax

executeString ( const scriptText String ) AnyType

Description

executeString works by generating a temporary script and running it. The string is inserted in the built-in run method of the script. It is not necessary to include the run method header or footer. You can declare types, constants, and variables within the string. However, you cannot use the Uses clause.

To return a value from executeString, you must use formReturn.

If the string contains syntax errors, the Script window is left on the Desktop.


Example for System::executeString
executeString Example

The following example declares and assigns a variable. The variable value is then viewed.

 method pushButton(var eventInfo Event)
 var
   s	string
 endvar

s = "var
           d	date
        endVar
        d = today()
        d.view(\"Today\")"

    executeString(s)

endMethod


See Also for System::executeString
See Also

execute

Form::formReturn


System::exit
exit

See Also	Example	System Type

Beginner

Procedure

Closes Paradox and exits to Windows.

Syntax

exit ( )

Description

exit closes Paradox and exits to Windows. If a Paradox application has changed, the user is prompted to save it.


Example for System::exit
exit Example

This example shows how to create an Exit button, that is, a button the user can click to exit Paradox. The method first asks for confirmation; if the user confirms, the method uses exit to close Paradox.

; btnExit::pushButton
method pushButton(var eventInfo Event)
var

stQuit	String

endVar

stQuit  = msgYesNoCancel("Exit", "Do you want to quit?")

if stQuit = "Yes" then

exit() ; If user chooses Yes, then exit.

endIf

endMethod


See Also for System::exit
See Also

close


System::exportASCIIFix
exportASCIIFix	4.5

See Also	Example	System Type

Procedure

Exports data from a table to a text file with fixed-length fields.

Syntax

exportASCIIFix ( const tableName String, const fileName String, const specTableName String [ , const ANSI Logical ] )

Description

exportASCIIFix exports data from a table to an ASCII (text) file in which fields of each record are the same length. Using this procedure, you can write ObjectPAL code to duplicate the functionality of the Fixed Length ASCII Export dialog box.

tableName specifies the table to export from, and fileName specifies the file to export to. TableName is the name of a table that specifies the layout of the exported data. The structure of this table is

Field Name A25, Start S, Length S.

This table serves the same purpose as EXPORT.DB, which is created automatically in your private directory when you use the Fixed Length ASCII Export Dialog box to export a table interactively. Use this table to define the length of each field in the exported file. For each field you export, enter a Start position (the column in the exported file where you want the field value to begin) and a Length (how many characters to display).

ANSI specifies whether to use the ANSI or OEM character set: set ANSI to True to use the ANSI character set, or to False to use the OEM character set. (OEM stands for Original Equipment Manufacturer and refers to the character set your computer uses; ANSI stands for American National Standards Institute and refers to the character set supported by Windows.)


Example for System::exportASCIIFix
exportASCIIFix Example

The following code exports the data in the Orders table to a text file named ORDERS.TXT. It reads the export format from the Orderexp table, and it exports the data using the ANSI character set.

method pushButton(var eventInfo Event)
   exportASCIIFix("orders.db", "orders.txt", "orderexp.db", True)
endMethod


See Also for System::exportASCIIFix
See Also

dlgExport

exportASCIIVar

exportSpreadsheet


System::exportASCIIVar
exportASCIIVar	4.5

See Also	Example	System Type

Procedure

Exports a table to a delimited (variable field length) text file.

Syntax

exportASCIIVar ( const tableName String, const fileName String [ , const separator String, const delimiter String, const allFieldsDelimited String, const ANSI Logical ] )

Description

exportASCIIVar exports data from a table to an ASCII (text) file in which the table's field values determine the length of each line. Using this procedure, you can write ObjectPAL code to duplicate the functionality of the Delimited ASCII Export dialog box.

tableName specifies the table to export from, and fileName specifies the file to export to. Use separator to specify the character that separates field values in the exported file. You can choose a comma or any other single character, including special characters such as tabs. Use delimiter to specify the characters that surround values in the exported file. You can specify the empty string if you do not want any characters to enclose the values. Use allFieldsDelimited to specify whether to surround data from all field types (True) or only from text field types (alphanumeric or character) with the specified delimiter character (False).

Note:	Paradox cannot export memo (Paradox or dBASE), formatted memo, graphic, OLE, or binary field types to delimited text.

ANSI specifies whether to use the ANSI or OEM character set: set ANSI to True to use the ANSI character set, or to False to use the OEM character set. (OEM stands for Original Equipment Manufacturer and refers to the character set your computer uses; ANSI stands for American National Standards Institute and refers to the character set supported by Windows.)

Following are the default settings for the optional arguments:

separator is "," (comma)

delimiter is "\"" (double quote)

allFieldsDelimited is False

ANSI is False


Example for System::exportASCIIVar
exportASCIIVar Example

The following code exports the data from the Orders table to a text file named ORDERS.TXT. It uses tabs to delimit field values, it uses percent signs to enclose each value, it delimits only text fields, and it uses the ANSI character set.

method pushButton(var eventInfo Event)
   exportASCIIVar("orders.db", "orders.txt", "\t", "%", False, True)
endMethod


See Also for System::exportASCIIVar
See Also

dlgExport

exportASCIIFix

exportSpreadsheet


System::exportParadoxDOS
exportParadoxDOS	5.0

See Also	Example	System Type

Procedure

Exports the data from a table to a Paradox for DOS (level 4) table.

Syntax

exportParadoxDOS ( const tableName String, const fileName String ) Logical

Description

exportParadoxDOS exports the data from a table to a level 4 Paradox for DOS table. Using this procedure, you can write ObjectPAL code to duplicate the functionality of the Table Export dialog box.

Note:	exportParadoxDOS cannot export bytes fields (typeY). They are excluded from the destination file. Also, when you export a dBASE table to Paradox DOS format, OLE and Binary fields are not exported.

tableName specifies the table to export from, and fileName specifies the file to export to. fileName can include an extension, but the extension must be .DB. For example, in the following list, the first two file names are valid, but the third is not:

File name	Remarks

ORDERS	OK to omit the extension.

ORDERS.DB	Valid.

ORDERS.DBF	Invalid. If provided, extention must be .DB.


Example for System::exportParadoxDOS
exportParadoxDOS Example

The following code exports the data from the dBASE table ORDERS.DBF to a Paradox DOS table named ORDERS.DB.

method pushButton(var eventInfo Event)
   if not exportParadoxDOS("orders.dbf", "orders") then
      errorShow("Export to Paradox DOS failed.")
   endIf
endMethod


See Also for System::exportParadoxDOS
See Also

dlgExport

exportASCIIFix

exportASCIIVar

exportSpreadsheet


System::exportSpreadsheet
exportSpreadsheet	4.5

See Also	Example	System Type

Procedure

Exports the data from a table to a spreadsheet file.

Syntax

exportSpreadsheet ( const tableName String, const fileName String [, const makeRowHeaders Logical ] )

Description

exportSpreadsheet exports the data from a table to a spreadsheet file. Using this procedure, you can write ObjectPAL code to duplicate the functionality of the Spreadsheet Export dialog box. When you export data to a spreadsheet, Paradox converts each record to a row and each field to a column. If a value is wider than the column display width, the full value is converted but partially hidden.

If a date in the original table is beyond the range of the allowable dates in the spreadsheet, the date is exported as the value ERROR.

tableName specifies the table to export from, and fileName specifies the file to export to. makeRowHeaders specifies whether to use the table's column headers to label the corresponding rows of values in the spreadsheet file: set it to True to use column headers as labels, or set it to False if you don't want labels. If you omit this argument, it is True by default.

Note:	The extension you supply as part of fileName specifies the format of the spreadsheet file. The following list shows extensions and file formats:

Extension	Format

WB1	Quattro Pro Win

WQ1	Quattro Pro DOS

WKQ	Quattro

WK1	Lotus 2.x

WKS	Lotus 1.A

XLS	Excel 3.0/4.0


Example for System::exportSpreadsheet
exportSpreadsheet Example

The following code exports the data from the Orders table to a file in Quattro Pro for Windows format. It uses field names from the table as labels in the spreadsheet file.

method pushButton(var eventInfo Event)
   exportSpreadsheet("orders.db", "orders.wb1", True)
endMethod


See Also for System::exportSpreadsheet
See Also

dlgExport

exportASCIIFix

exportASCIIVar


System::fail
fail

See Also	Example	System Type

Procedure

Causes a method to fail.

Syntax

fail ( [ const errorNumber SmallInt, const errorMessage String ] )

Description

fail causes a method to fail. Executing this method in the onFail section of a try...onFail block forces a jump to the next highest block, if it exists, or to the implicit try...onFail block ObjectPAL wraps around every method. The optional argument errorNumber specifies an error code for the failure. Use an Errors constant or a user-defined error constant to specify a value for errorNumber. The optional argument errorMessage specifes a message to display.

Use enumRTLErrors to create a list of error codes and error messages. For more information about using try...onFail blocks, refer to the Guide to ObjectPAL.


Example for System::fail
fail Example

See the example for errorCode.


See Also for System::fail
See Also

errorCode

errorMessage

errorShow


System::fileBrowser
fileBrowser

See Also	Example1	Example2	System Type

Procedure

Displays the Paradox File Browser and returns the names of one or more files selected by the user.

Syntax

1. fileBrowser ( var selectedFile String [ , var browserInfo FileBrowserInfo ] ) Logical

2. fileBrowser ( var selectedFiles Array[ ] String [ , var browserInfo FileBrowserInfo ] ) Logical

Description

fileBrowser displays the Paradox Browser and returns the names of one or more files returned by the user. ObjectPAL execution suspends until the user closes the Browser. This method returns True if the user selects at least one file; otherwise, it returns False (even if the user clicks OK to close the dialog box).

Use syntax 1 to return one file name in selectedFile, and use syntax 2 to return an array of file names in selectedFiles, where selectedFiles is declared as a resizeable array.

For either syntax, you can provide a record containing information to specify what data the Browser displays. For example, you can make the Browser display Paradox tables only, or forms only, or forms and reports, and so on. ObjectPAL provides a special data type, called FileBrowserInfo, that you can use only with the fileBrowser procedure. FileBrowserInfo is a Record with the following structure:

TYPE FileBrowserInfo =
  Record
    x, y, w, h   SmallInt      ; size of Browser window in twips
    WindowStyle  LongInt       ; window style (see WindowStyle constants)
    AllowableTypes LongInt     ; Use FileBrowserFileTypes constants
    SelectedType   LongInt     ; one of the AllowableTypes
    FileFilters    String      ; the filespec in edit box
    Alias          String      ; alias or drive name
    Path           String      ; path relative to Alias
    PathOnly       Logical     ; return path only, no file name
  endRecord
ENDTYPE

This record structure is predefined and built into ObjectPAL, so all you have to do is declare a variable of type FileBrowserInfo and assign values to its fields, as shown in the example---you don't have to declare the type yourself each time you want to use it.

After the call to fileBrowser, the Alias, Path, and FileFilter fields are filled in with the values that were in the File Browser dialog box. In other words, you can find out what the user entered in those areas of the Browser.

The AllowableTypes field specifies what appears in the drop-down edit list for the Types panel in the File Browser. The SelectedType field indicates which of the AllowableTypes is currently selected. Use FileBrowserFileTypes constants for values in the SelectedType and AllowableTypes fields.

The fileBrowser procedure looks only at the names given in the structure. You can pass a different record structure to it and it finds the fields with the appropriate names and uses them. In other words, you can define a simpler record structure with only the items you are interested in.


Example 1 for System::fileBrowser
fileBrowser Example 1

The following example calls fileBrowser twice: the first time, it returns one file name, and if it is the name of a table, opens a Table window. The second time, it returns an array of file names (selected by Shift-clicking) and displays the array in a dialog box.

; fileBrowserButton::pushButton
method pushButton(var eventInfo Event)
var
   oneFile           String
   manyFiles Array[] String
   tView             TableView
endVar
fileBrowser(oneFile)   ; display the File Browser, and wait
                       ; for the user to choose one file
                       ; variable oneFile stores the file name chosen
if isTable(oneFile) then
   tView.open(oneFile) ; open a Table window for the chosen file
endIf

fileBrowser(manyFiles) ; let the user select multiple files and store
                       ; the file names in an array
manyFiles.view()       ; displays the user's choices
endMethod


Example 2 for System::fileBrowser
fileBrowser Example 2

The second example uses a FileBrowserInfo record to pass information. Attach the following code to a button's built-in pushButton method. When it executes, it invokes the Browser and waits for you to choose a file. Then, it displays information about your choice in the status area.

method pushButton(var eventInfo Event)

var
   fbi FileBrowserInfo ; Declare a variable that uses the predefined
                       ; FileBrowserInfo record structure
   selectedFile String
endVar

The following statements assign values to fields in the record of file browser information

fbi.Alias = "WORK" ; Search the current working directory
fbi.AllowableTypes = fbTable + fbForm ; Search for tables and forms

; Display the Browser and process the user's selection
if fileBrowser(selectedFile, fbi) then
   message("You selected ", selectedFile," with the path ", fbi.path)
else
   message("You selected cancel")
endif

endMethod


See Also for System::fileBrowser
See Also

FileSystem Type

FileBrowserFileTypes constants


System::formatAdd
formatAdd

See Also	Example	System Type

Procedure

Adds a format.

Syntax

formatAdd ( const formatName String, const formatSpec String ) Logical

Description

formatAdd creates the format described by formatSpec and named formatName available to the current session. This method returns True if it succeeds; otherwise, it returns False.

Note:	Field width (Wn), alignment (AR, AL, AC), and case specifiers (CU, CL, CC) are not saved with a new format definition; but decimal precision (W.n) is saved. See format in the String type for a complete description of format specifiers.


Example for System::formatAdd
formatAdd Example

The following example adds a new format specification to the session, then sets the default Currency format to the new format.

; addAFormat::pushButton
method pushButton(var eventInfo Event)
var
  someNum Currency
endVar
; first, add a currency format with 4 decimal digits and
; a floating dollar sign (windows dollar sign)
formatAdd("FourCurrency", "W.4, E$W")
; then, set the default format for Currency to the new format
formatSetCurrencyDefault("FourCurrency")
someNum = 41324.09876
someNum.view()                   ; appears as $41,324.0988
endMethod


See Also for System::formatAdd
See Also

formatDelete

formatExist


System::formatDelete
formatDelete

See Also	Example	System Type

Procedure

Deletes a format.

Syntax

formatDelete ( const formatName String ) Logical

Description

formatDelete deletes the named format formatName from the current session.


Example for System::formatDelete
formatDelete Example

The following example deletes the custom format named FourCurrency, if it exists.

; deleteAFormat::pushButton
method pushButton(var eventInfo Event)
if formatExist("FourCurrency") then
  formatDelete("FourCurrency")
else
  msgInfo("FYI", "Format was not found.")
endif
endMethod


See Also for System::formatDelete
See Also

formatAdd

formatExist


System::formatGetSpec
formatGetSpec	5.0

See Also	Example	System Type

Procedure

Returns the format specification for a named format.

Syntax

formatGetSpec ( const formatName String ) String

Description

formatGetSpec returns the format specification for the format named in formatName. The return value (a string) can be passed to formatStringToDate and formatStringToNumber to format a string into a date or number.


Example for System::formatGetSpec
formatGetSpec Example

In the following example, formatGetSpec is used with formatStringToDate to assign a Date variable a date in the Windows Long format.

;Btn :: pushButton

method pushButton(var eventInfo Event)

var

d	Date

endVar

d = formatStringToDate("Friday, January 08, 1965", formatGetSpec("Windows Long"))

d.view()

endMethod


See Also for System::formatGetSpec
See Also

formatDelete

formatExist

formatStringToDate

formatStringToNumber


System::formatExist
formatExist

See Also	Example	System Type

Procedure

Reports whether a format exists.

Syntax

formatExist ( const formatName String ) Logical

Description

formatExist checks if the format named formatName is available for the current session. The method returns True if the format is available; otherwise, it returns False.


Example for System::formatExist
formatExist Example

In the following example, the method checks if a custom format named FourCurrency exists; if not, the method adds the new format and displays a number formatted as FourCurrency.

; addCurrFormatExist::pushButton
method pushButton(var eventInfo Event)
var
  someNum Currency
endVar
; check if custom format exists already
if NOT formatExist("FourCurrency") then
  ; if not, add a currency format with 4 decimal digits and
  ; a floating dollar sign (windows dollar sign)
  msgInfo("FYI", "Format does not exist. Adding it now.")
  formatAdd("FourCurrency", "W.4, E$W")
else
  msgInfo("FYI", "Format already exists.")
endif
; set the default format for Currency to the new format
formatSetCurrencyDefault("FourCurrency")
someNum = 41324.09876
someNum.view()        ; displays number as $41324.0988, because
                      ; someNum is a variable of Currency type
endMethod


See Also for System::formatExist
See Also

formatAdd

formatDelete


System::formatSetCurrencyDefault
formatSetCurrencyDefault

See Also	Example	System Type

Procedure

Sets the default display format for Currency values.

Syntax

formatSetCurrencyDefault ( const formatName String ) Logical

Description

formatSetCurrencyDefault sets the default format for displaying Currency values. This setting remains in effect for the duration of the session.


Example for System::formatSetCurrencyDefault
formatSetCurrencyDefault Example

See the example for formatExist.


See Also for System::formatSetCurrencyDefault
See Also

formatSetNumberDefault


System::formatSetDateDefault
formatSetDateDefault

See Also	Example	System Type

Procedure

Sets the default display format for Date values.

Syntax

formatSetDateDefault ( const formatName String ) Logical

Description

formatSetDateDefault sets the default format for displaying Date values. This setting remains in effect for the duration of the session.


Example for System::formatSetDateDefault
formatSetDateDefault Example

In the following example, the pushButton method for the setDateFormat button sets the default display format for Date values to the Windows Long format. The method then uses view to display a date; the date is shown in the new default format.

; setDateFormat::pushButton
method pushButton(var eventInfo Event)
var
  someDate Date
endVar
if formatExist("Windows Long") then
  formatSetDateDefault("Windows Long")
  someDate = date("9/15/92")
  someDate.view()              ; displays "Tuesday, September 15, 1992"
else
  msgStop("Stop", "Requested format does not exist.")
endif
endMethod


See Also for System::formatSetDateDefault
See Also

formatSetTimeDefault

formatSetDateTimeDefault


System::formatSetDateTimeDefault
formatSetDateTimeDefault

See Also	Example	System Type

Procedure

Sets the default display format for DateTime values.

Syntax

formatSetDateTimeDefault ( const formatName String ) Logical

Description

formatSetDateTimeDefault sets the default format for displaying DateTime values. This setting remains in effect for the duration of the session.


Example for System::formatSetDateTimeDefault
formatSetDateTimeDefault Example

In the following example, the pushButton method for the setDateTimeFormat button sets the default display format for DateTime values. The method then uses view to display a DateTime value; the value is shown in the new default format.

setDateTimeFormat::pushButton
method pushButton(var eventInfo Event)
var
  someDateTime DateTime
endVar
if formatExist("h:m:s am m/d/y") then
  formatSetDateTimeDefault("h:m:s am m/d/y")
  someDateTime = DateTime("11:45:25 am 11/24/61")
  someDateTime.view()                   ; displays 11:45:25 am 11/24/61
else
  msgInfo("Status", "Requested format does not exist.")
endif
endMethod


See Also for System::formatSetDateTimeDefault
See Also

formatSetDateDefault

formatSetTimeDefault


System::formatSetLogicalDefault
formatSetLogicalDefault

See Also	Example	System Type

Procedure

Sets the default display format for Logical values.

Syntax

formatSetLogicalDefault ( const formatName String ) Logical

Description

formatSetLogicalDefault sets the default format for displaying Logical values. This setting remains in effect for the duration of the session.


Example for System::formatSetLogicalDefault
formatSetLogicalDefault Example

In the following example, the pushButton method for the setLogicalFormat button sets the default display format for Logical values to the Male/Female format. The method then uses view to display a logical value; the value is shown in the new default format.

; setLogicalFormat::pushButton
method pushButton(var eventInfo Event)
var
  someLogical  Logical
endVar
if formatExist("Male/Female") then
  formatSetLogicalDefault("Male/Female")
  someLogical = True
  someLogical.view()               ; displays Male
else
  msgStop("Stop", "Requested format does not exist.")
endif
endMethod


See Also for System::formatSetLogicalDefault
See Also

formatAdd


System::formatSetLongIntDefault
formatSetLongIntDefault

See Also	Example	System Type

Procedure

Sets the default display format for LongInt values.

Syntax

formatSetLongIntDefault ( const formatName String ) Logical

Description

formatSetLongIntDefault sets the default format for displaying LongInt values. This setting remains in effect for the duration of the session.


Example for System::formatSetLongIntDefault
formatSetLongIntDefault Example

In the following example, the pushButton method for the setIntegerFormat button sets the default display format for LongInt values to the Integer format. The method then uses view to display a long integer; the value is shown in the new default format.

; setIntegerFormat::pushButton
method pushButton(var eventInfo Event)
var
  someInt  LongInt
endVar
if formatExist("Integer") then
  formatSetLongIntDefault("Integer")
  someInt = 238756
  someInt.view()                       ; displays 238756
else
  msgStop("Stop", "Requested format does not exist.")
endif
endMethod


See Also for System::formatSetLongIntDefault
See Also

formatSetSmallIntDefault


System::formatSetNumberDefault
formatSetNumberDefault

See Also	Example	System Type

Procedure

Sets the default display format for Number values.

Syntax

formatSetNumberDefault ( const formatName String ) Logical

Description

formatSetNumberDefault sets the default format for displaying Number values. This setting remains in effect for the duration of the session.


Example for System::formatSetNumberDefault
formatSetNumberDefault Example

In the following example, the pushButton method for the setNumberFormat button sets the default display format for Number values to the Scientific format. The method then uses view to display a number; the value is shown in the new default format.

; setNumberFormat::pushButton
method pushButton(var eventInfo Event)
var
  someNum Number
endVar
if formatExist("Scientific") then
  formatSetNumberDefault("Scientific")
  someNum = 3489.283
  someNum.view()             ; Displays 3.489283e+3.
else
  msgStop("Stop", "Requested format does not exist.")
endif
endMethod


See Also for System::formatSetNumberDefault
See Also

formatSetCurrencyDefault


System::formatSetSmallIntDefault
formatSetSmallIntDefault

See Also	Example	System Type

Procedure

Sets the default display format for SmallInt values.

Syntax

formatSetSmallIntDefault ( const formatName String ) Logical

Description

formatSetSmallIntDefault sets the default format for displaying SmallInt values. This setting remains in effect for the duration of the session.


Example for System::formatSetSmallIntDefault
formatSetSmallIntDefault Example

In the following example, the pushButton method for the setSmallIntFormat button sets the default display format for SmallInt values to the Integer format. The method then uses view to display a small integer; the value is shown in the new default format.

; setSmallIntFormat::pushButton
method pushButton(var eventInfo Event)
var
  someInt  SmallInt
endVar
if formatExist("Integer") then
  formatSetSmallIntDefault("Integer")
  someInt = 324
  someInt.view()                     ; displays 324
else
  msgStop("Stop", "Requested format does not exist.")
endif
endMethod


See Also for System::formatSetSmallIntDefault
See Also

formatSetLongIntDefault


System::formatSetTimeDefault
formatSetTimeDefault

See Also	Example	System Type

Procedure

Sets the default display format for Time values.

Syntax

formatSetTimeDefault ( const formatName String ) Logical

Description

formatSetTimeDefault sets the default format for displaying Time values. This setting remains in effect for the duration of the session.


Example for System::formatSetTimeDefault
formatSetTimeDefault Example

In the following example, the pushButton method for the setTimeFormat button sets the default display format for Time values to the format hh:mm:ss am. The method then uses view to display a time; the value is shown in the new default format.

; setTimeFormat::pushButton
method pushButton(var eventInfo Event)
var
  someTime Time
  someStr  String
endVar
if formatExist("hh:mm:ss am") then
  formatSetTimeDefault("hh:mm:ss am")
  someTime = time("12:22:45 pm")
  someTime.view()                    ; displays 12:22:45 pm
else
  msgInfo("Status", "Requested format does not exist.")
endif
endMethod


See Also for System::formatSetTimeDefault
See Also

formatSetDateDefault

formatSetDateTimeDefault


System::formatStringToDate
formatStringToDate	5.0

See Also	Example	System Type

Procedure

Uses a format specification to translate a String value to a Date value.

Syntax

formatStringToDate ( dateString String, formatSpec String ) Date

Description

formatStringToDate translates dateString, a string value that represents a date, to a Date value, using the format specification in formatSpec. This procedure returns the Date value and leaves the String value unchanged.

The value of formatSpec must be the format specification of a named format; it cannot be the format name. To get the format specification of a named format, use formatGetSpec.


Example for System::formatStringToDate
formatStringToDate Example

Sometimes you need to convert an invalid date stored in a string to a valid date. This example gets a String value entered by the user and formats it as a valid date, if possible. The code is attached to an Alpha field's built-in changeValue method; it executes when the user types value and then leaves the field (for example, by pressing Enter). If this field object were bound to a Date field (instead of an Alpha field), you could let Paradox validate the date without writing ObjectPAL code.

method changeValue(var eventInfo ValueEvent)

var

stUserDate	String

daValidDate	Date

endVar

doDefault

; Assume user enters "09-94-23" into this Alpha field object.

stUserDate = self.Value

try

; Format the user's value as a valid date.

daValidDate = formatStringToDate(stUserDate, "DO(%M-%Y-%D)")

; formatStringToDate does not change the String value.

; It returns a Date value. The following statement displays

;         You entered: 09-94-23

;         Valid date: 09/23/94

msgInfo("You entered: " + stUserDate,

            "Valid date: " + String(daValidDate))

onFail

; If user's value cannot be formatted as a date,

; display a message.

msgStop(stUserDate, "Cannot format that value as a Date.")

endTry

endMethod


See Also for System::formatStringToDate
See Also

formatDelete

formatExist

formatGetSpec

formatStringToNumber


System::formatStringToNumber
formatStringToNumber	5.0

See Also	Example	System Type

Procedure

Uses a format specification to translate a String value to a Number value.

Syntax

formatStringToNumber ( numberString String, formatSpec String ) Number

Description

formatStringToNumber translates numberString, a string value that represents a number, to a Number value, using the format specification in formatSpec. This procedure returns the Number value and leaves the String value unchanged.

The value of formatSpec must be the format specification of a named format; it cannot be the format name. To get the format specification of a named format, use formatGetSpec.


Example for System::formatStringToNumber
formatStringToNumber Example

In the following example, two strings are concatenated to form a number in scientific notation format. Then formatStringToNumber is used to assign the value to a Number variable. Finally, a dialog box displays the formatted and unformatted values. Note that the value of the String variable is unchanged; the formatted value is assigned to a Number variable.

;btnScientific :: pushButton

method pushButton(var eventInfo Event)

var

st1,

st2,

stSciNot	String

nuResult	Number

endVar

st1 = "1.e"

st2 = "+2"

stSciNot = st1 + st2

nuResult = formatStringToNumber(stSciNot, "S-4")

; The following statement displays

; Before format: 1.e+2

; After format: 100.00

msgInfo("Before format: " + stSciNot,

          "After format: " + String(nuResult))

endMethod


See Also for System::formatStringToNumber
See Also

formatDelete

formatExist

formatGetSpec

formatStringToDate


System::getDefaultPrinterStyleSheet
getDefaultPrinterStyleSheet	5.0

See Also	Example	System Type

Procedure

Returns the name of the default printer style sheet.

Syntax

getDefaultPrinterStyleSheet ( ) String

Description

getDefaultPrinterStyleSheet returns the file name of the default style sheet for printer documents. If the style sheet is in :WORK:, this procedure returns the file name and extension, if any (for example, BORLAND.FP). Otherwise, it returns the full path (for example, C:\PDOXWIN\BORLAND.FP).

Paradox uses the default printer style sheet whenever you create design documents that are designed for the printer. This method returns the name of the system style sheet, but individual forms and reports may use different style sheets. Use getStyleSheet and setStyleSheet to work with style sheets for specific forms and reports.

Use getDefaultScreenStyleSheet to get the name of the default screen style sheet, used whenever you create design documents that are designed for the screen.


Example for System::getDefaultPrinterStyleSheet
getDefaultPrinterStyleSheet Example

See the example for setDefaultPrinterStyleSheet.


See Also for System::getDefaultPrinterStyleSheet
See Also

getDefaultScreenStyleSheet

setDefaultPrinterStyleSheet

setDefaultScreenStyleSheet

Form::setStyleSheet

Form::saveStyleSheet

Form::getProtoProperty

Form::setProtoProperty


System::getDefaultScreenStyleSheet
getDefaultScreenStyleSheet	5.0

See Also	Example	System Type

Procedure

Returns the name of the default screen style sheet.

Syntax

getDefaultScreenStyleSheet ( ) String

Description

getDefaultScreenStyleSheet returns the file name of the default style sheet for screen documents. If the style sheet is in :WORK:, this procedure returns the file name and extension, if any (for example, BORLAND.FT). Otherwise, it returns the full path (for example, C:\PDOXWIN\BORLAND.FT).

Paradox uses the default screen style sheet whenever you create design documents that are designed for the screen. This method returns the name of the system style sheet, but individual forms and reports may use different style sheets. Use getStyleSheet and setStyleSheet to work with style sheets for specific forms and reports.

Use getDefaultPrinterStyleSheet to get the name of the default printer style sheet, used whenever you create design documents that are designed for the printer.


Example for System::getDefaultScreenStyleSheet
getDefaultScreenStyleSheet Example

See the example for setDefaultScreenStyleSheet.


See Also for System::getDefaultScreenStyleSheet
See Also

getDefaultPrinterStyleSheet

setDefaultPrinterStyleSheet

setDefaultScreenStyleSheet

Form::setStyleSheet

Form::saveStyleSheet

Form::getProtoProperty

Form::setProtoProperty


System::getLanguageDriver
getLanguageDriver	5.0

See Also	Example	System Type

Procedure

Returns the name of the default language driver for the system.

Syntax

getLanguageDriver ( ) String

Description

getLanguageDriver returns the name of the default language driver for the system.


Example for System::getLanguageDriver
getLanguageDriver Example

In the following example, the method uses the procedure getLanguageDriver to display the name of the system language driver on the status bar.

;btnDefaultDriver :: pushButton
method pushButton(var eventInfo Event)
  message(getLanguageDriver())
endmethod


See Also for System::getLanguageDriver
See Also

TCursor::getLanguageDriver


System::getMouseScreenPosition
getMouseScreenPosition

See Also	Example	System Type

Procedure

Returns the mouse position as a Point.

Syntax

getMouseScreenPosition ( ) Point

Description

getMouseScreenPosition returns the coordinates (in twips) of the pointer relative to the screen, not the Desktop. Use Point type methods (for example x and y) to get more information.

This method gets the mouse position at the time of the event; the current mouse position may be different.


Example for System::getMouseScreenPosition
getMouseScreenPosition Example

In the following example, when the user clicks the nervousMouse button, the mouse jumps one inch down and one inch to the left.

; nervousMouse::pushButton
method pushButton(var eventInfo Event)
var
  mouseP,
  newMouseP Point
endVar
mouseP = getMouseScreenPosition()
newMouseP = mouseP + Point(1440, 1440)
setMouseScreenPosition(newMouseP)   ; move mouse pointer 1 inch down and
                                    ; 1 inch to the right
endMethod


See Also for System::getMouseScreenPosition
See Also

setMouseScreenPosition

MouseEvent::getMousePosition

MouseEvent::setMousePosition


System::getUserLevel
getUserLevel	5.0

See Also	Example	System Type

Procedure

Returns the user's ObjectPAL level setting.

Type

System

Syntax

getUserLevel ( ) String

Description

getUserLevel returns the ObjectPAL level setting on the users system. It returns Advanced or Beginner. Use setUserLevel to change this setting.

Note:	The ObjectPAL level setting does not affect how code executes; it only affects what is displayed in the user interface.


Example for System::getUserLevel
getUserLevel Example

See the example for setUserLevel.


See Also for System::getUserLevel
See Also

setUserLevel


System::helpOnHelp
helpOnHelp

See Also	Example	System Type

Procedure

Displays information about how to use the Help system.

Syntax

helpOnHelp ( ) Logical

Description

helpOnHelp displays information explaining how to use the Windows Help application, opening the application if necessary.

By default, the How To Use Help command opens the WINHELP.HLP Help file that comes with Windows. You can specify your own Help file to use instead. To specify the file used by the How to Use Help command:

1.	Use a text editor to open the Help project file.

2.	Add a SetHelpOnFile macro to the [CONFIG] section, specifying the Help file you want to use for How to Use Help.

3.	Compile the Help file.

For example, this macro in the [CONFIG] section of the Help project file changes the Help file that the How To Use Help command opens from WINHELP.HLP (the default file) to HOWHELP.HLP:

[CONFIG]
SetHelpOnFile("howhelp.hlp")

Note:	Windows programmers---Calling this method is like calling the Windows 3.1 API function WinHelp with HELP_HELPONHELP as the Command parameter.


Example for System::helpOnHelp
helpOnHelp Example

The following example opens a Help file when the user chooses Help | Help On Help from a custom menu (not the built-in Paradox menu).

method menuAction(var eventInfo MenuEvent)
   var
      siMenuChoice SmallInt
   endVar

   siMenuChoice = eventInfo.id()

   switch
      case siMenuChoice = UserMenu + MenuHelpOnHelp :
           helpOnHelp()
      ; Handle other cases here
   endSwitch

endmethod


See Also for System::helpOnHelp
See Also

helpShowContext

helpShowIndex


System::helpQuit
helpQuit

See Also	Example	System Type

Procedure

Tells the Help application it is no longer needed.

Syntax

helpQuit ( const helpFileName String ) Logical

Description

helpQuit tells the Windows Help application (WINHELP.EXE) that the Help file specified in helpFileName  is no longer needed by the current Paradox application. If helpFileName is not on your path, you must specify the full path to the Help file. If no other applications have asked for Help, Windows closes the Help application.

Note:	Windows programmers---Calling this method is like calling the Windows 3.1 API function WinHelp with HELP_HELPQUIT as the Command parameter.


Example for System::helpQuit
helpQuit Example

The following example executes when the user chooses an item from a custom menu (not the built-in Paradox menu). If the user chooses File | Close Form, it calls helpQuit to tell the Help application that it's no longer needed, then calls close to close the current form.

method menuAction(var eventInfo MenuEvent)
   const
      ; Typically, menu choice constants are defined elsewhere,
      ; with the rest of the menu-building code. The following
      ; constant is defined here so the example will compile.
      kMyMenuFileCloseForm = 104
   endConst

   var
      siMenuChoice   SmallInt
      stHelpFileName String
   endVar

   siMenuChoice = eventInfo.id()
   stHelpFileName = "c:\\pdoxapps\\ordentry\\ordentry.hlp"

   switch
      case siMenuChoice = UserMenu + kMyMenuFileCloseForm :
           helpQuit(stHelpFileName) ; Tell Help we don't need it any more.
           close() ; Close the form.
   ; Handle other cases here
   endSwitch

endMethod


See Also for System::helpQuit
See Also

helpOnHelp


System::helpSetIndex
helpSetIndex

See Also	Example	System Type

Procedure

Sets the Help index (contents topic).

Syntax

helpSetIndex ( const helpFileName String, const indexId LongInt ) Logical

Description

helpSetIndex tells the Windows Help application (WINHELP.EXE) to set the current contents topic (called the index in early versions of Windows) to indexID in helpFileName.  If helpFileName is not on your path, you must specify the full path to the Help file.

When you open a Help file, WinHelp displays the Contents topic by default. When you create a Help file, you specify the Contents topic using the Contents option in the [CONFIG] section of the Help project file. For example, the following SetContents macro in the [CONFIG] section sets the Contents topic for a help file to the topic in the file CWH.HLP with the context number 100.

[CONFIG]
SetContents("cwh.hlp", 100)

If you do not use the Contents option, the Contents topic is the first topic in the first file listed in the [FILES] section.

You can use helpSetIndex to specify a Contents topic from within an application.

Note:	Windows programmers---Calling this method is like calling the Windows 3.1 API function WinHelp with HELP_SETCONTENTS as the Command parameter.


Example for System::helpSetIndex
helpSetIndex Example

The following example is a custom method that sets the Contents topic for a Help file to the topic in the file ORDENTRY.HLP with the context number 100.

method setHelpContents() Logical
   return helpSetIndex("c:\\pdoxapps\\ordentry\\ordentry.hlp", 100)
endMethod


See Also for System::helpSetIndex
See Also

helpShowIndex


System::helpShowContext
helpShowContext

See Also	Example	System Type

Procedure

Displays help for a particular context.

Syntax

helpShowContext ( const helpFileName String, const helpId LongInt ) Logical

Description

helpShowContext tells the Windows Help application to search helpFileName for helpId and display the associated help. If helpFileName is not on your path, you must specify the full path to the Help file.

In a Help source file, context IDs are strings defined using a # footnote, and they are mapped to integer values in the [MAP] section of the Help project (.HPJ) file. helpShowContext uses those integer values to locate help topics.

Note:	Windows programmers---Calling this method is like calling the Windows 3.1 API function WinHelp with HELP_CONTEXT as the Command parameter.


Example for System::helpShowContext
helpShowContext Example

The following example tells the Windows Help application to display context-sensitive help for the active object in a form. Assume the form contains three buttons and two field object. The code is attached to a button whose TabStop property is set to False (otherwise, the button would become active when clicked).

helpButton::pushButton
const
; These integer values must also be listed
; in the [MAP] section of the Help project file.
   kNewOrdBtn   = LongInt(1020)
   kEditOrdBtn  = LongInt(1021)
   kDelOrdBtn   = LongInt(1022)
   kCustNameFld = Longint(2020)
   kOrderNoFld  = LongInt (2021)
endConst

method pushButton(var eventInfo Event)

var
   stObjName,
   stHelpFileName String
   liContextId    LongInt
endVar

   stObjName = active.name ; Get the name of the active object.
   stHelpFileName = "c:\\pdoxapps\\ordentry\\ordentry.hlp"

   switch
      case stObjName = "newOrdBtn"    : liContextId = kNewOrdBtn
      case stObjName = "editOrdBtn"   : liContextId = kEditOrdBtn
      case stObjName = "delOrdBtn"    : liContextId = kDelOrdBtn
      case stObjName = "custNameFld"  : liContextId = kCustNameFld
      case stObjName = "orderNoFld"   : liContextId = kOrderNoFld
   endSwitch

   if not helpShowContext(stHelpFileName, liContextId) then
      errorShow("Could not display Help topic.")
   endIf

endMethod


See Also for System::helpShowContext
See Also

helpShowIndex

helpShowTopic


System::helpShowIndex
helpShowIndex

See Also	Example	System Type

Procedure

Displays the index (contents topic) of a specified Help file.

Syntax

helpShowIndex ( const helpFileName String ) Logical

Description

helpShowIndex  tells the Windows Help application (WINHELP.EXE) to display the Contents topic (called the index in early versions of Windows) of the Help file specified in helpFileName. If helpFileName is not on your path, you must specify the full path to the Help file.

When you open a Help file, WinHelp displays the Contents topic by default. When you create a Help file, you specify the Contents topic using the Contents option in the [CONFIG] section of the Help project file. For example, the following SetContents macro in the [CONFIG] section sets the Contents topic for a help file to the topic in the file CWH.HLP with the context number 100.

[CONFIG]
SetContents("cwh.hlp", 100)

If you do not use the Contents option, the Contents topic is the first topic in the first file listed in the [FILES] section.

Note:	Windows programmers---Calling this method is like calling the Windows 3.1 API function WinHelp with HELP_CONTENTS as the Command parameter.


Example for System::helpShowIndex
helpShowIndex Example

The following example executes when the user chooses an item from a custom menu (not the built-in Paradox menu). If the user chooses Help | Contents, it calls helpShowIndex to tell the Help application to display the Contents topic for the specified Help file.

method menuAction(var eventInfo MenuEvent)
   const
      ; Typically, menu choice constants are defined elsewhere,
      ; with the rest of the menu-building code. The following
      ; constant is defined here so the example will compile.
      kMyMenuHelpContents = 501
   endConst

   var
      siMenuChoice   SmallInt
      stHelpFileName String
   endVar

   siMenuChoice = eventInfo.id()
   stHelpFileName = "c:\\pdoxapps\\ordentry\\ordentry.hlp"

   switch
      case siMenuChoice = UserMenu + kMyMenuHelpContents :
           helpShowIndex(stHelpFileName) ; Display the Contents topic.
      ; Handle other cases here
   endSwitch

endMethod


See Also for System::helpShowIndex
See Also

helpShowContext

helpShowTopic


System::helpShowTopic
helpShowTopic

See Also	Example	System Type

Procedure

Displays help for a specified context.

Syntax

helpShowTopic ( const helpFileName String, const topicKey String ) Logical

Description

helpShowTopic tells the Windows Help application to search helpFileName for topicKey and display the associated help. If helpFileName is not on your path, you must specify the full path to the Help file. The value of topicKey must match a keyword defined using a K footnote in the Help source file; otherwise, the search fails and the Windows Help application displays an error message.

Note:	Windows programmers---Calling this method is like calling the Windows 3.1 API function WinHelp with HELP_KEY as the Command parameter.


Example for System::helpShowTopic
helpShowTopic Example

The following example prompts the user for a word or phrase, then calls helpShowTopic to search for the text in the specified Help file.

method pushButton(var eventInfo Event)
   var
      stHelpFileName,
      stTopicKey,
      stPromptText    String
   endVar

   stHelpFileName = "c:\\pdoxapps\\ordentry\\ordEntry.hlp"
   stPromptText   = "Enter a word or phrase here."
   stTopicKey     = stPromptText

   stTopicKey.view("Enter text to search for.")
   if stTopicKey <> stPromptText then
      helpShowTopic(stHelpFileName, stTopicKey)
   endIf
endMethod


See Also for System::helpShowTopic
See Also

helpShowTopicInKeywordTable

helpShowContext

helpShowIndex


System::helpShowTopicInKeywordTable
helpShowTopicInKeywordTable

See Also	Example	System Type

Procedure

Displays help for a topic identified by a keyword in an alternate keyword table.

Syntax

helpShowTopicInKeywordTable ( const helpFileName String, const keyTableLetter String, const topicKey String ) Logical

Description

helpShowTopicInKeywordTable tells the Windows Help application to search the file helpFileName for keyTableLetter and topicKey and display the associated help. If helpFileName is not on your path, you must specify the full path to the Help file. The value of keyTableLetter must match a multikey index specified in the [OPTIONS] section of the Help project file. For example, if a Help project file included the following lines, you would assign a value of "L" to keyTableLetter.

[OPTIONS]
MULTIKEY=L

Also, the value of topicKey must match a keyword defined using a multikey index footnote (the L in the previous example) in the Help source file. Otherwise, the search fails and the Windows Help application displays an error message.

Note:	Windows programmers---Calling this method is like calling the Windows 3.1 API function WinHelp with HELP_MULTIKEY as the Command parameter.


Example for System::helpShowTopicInKeywordTable
helpShowTopicInKeywordTable Example

In the following example, assume that an application is handling a user's request for help on the topic "field types." This code prompts the user to enter PARADOX or DBASE, then calls helpShowTopicInKeywordTable to search for the text "field types" in the specified keyword table of the specified Help file.

method pushButton(var eventInfo Event)
   var
      stHelpFileName,
      stPromptText,
      stUserChoice,
      stTopicKey,
      stKeyTableLetter    String
   endVar

   stHelpFileName   = "c:\\pdoxapps\\ordentry\\ordEntry.hlp"
   stPromptText     = "Enter PARADOX or DBASE here."
   stUserChoice     = stPromptText
   stTopicKey       = "field types"

   stUserChoice.view("Do you want Paradox Help or dBASE Help?")
   if stUserChoice <> stPromptText then
      switch
         case stUserChoice = "PARADOX" : stKeyTableLetter = "P"
         case stUserChoice = "DBASE"   : stKeyTableLetter = "D"
         otherwise : return
      endSwitch

      helpShowTopicInKeywordTable(stHelpFileName, stKeyTableLetter, stTopicKey)
   endIf
endMethod


See Also for System::helpShowTopicInKeywordTable
See Also

helpShowTopic

helpShowContext

helpShowIndex


System::importASCIIFix
importASCIIFix	4.5

See Also	Example	System Type

Procedure

Imports data to a table from an ASCII (text) file in which fields of each record are the same length.

Syntax

importASCIIFix (const fileName String, const tableName String, const spec String [ , const ANSI Logical ] )

Description

importASCIIFix imports data to a table from an ASCII (text) file in which fields of each record are the same length. Using this procedure, you can write ObjectPAL code to duplicate the functionality of the Fixed Length ASCII Import dialog box.

fileName specifies the file to import from, and tableName specifies the table to import to. Dates and numbers are formatted as specified in the Control Panel.

Note:	The extension you supply as part of the tableName argument specifies the table type. Use .DB to specify a Paradox table, use .DBF to specify a dBASE table. If you omit the extension, the data is imported to a Paradox table by default.

The optional argument spec is the name of a table that specifies the layout for the imported data. The structure of this table is:

Field Name	Type	Description

Field Name 	A25	Name of a field to import.

Type 	A4	Field type (must be a valid Paradox or dBASE field specification; see Table::create for details).

Start 	S	Number of the column where you want the field value to begin.

Length 	S	Field size.

This table serves the same purpose as IMPORT.DB, which is created automatically in your private directory when you use the Fixed Length ASCII Import Dialog box to import a table interactively. Use this table to define the structure of the table that will receive the imported data. For each field you import, enter a name, a type (must be a valid Paradox or dBASE field specification; see Table::create for details), a Start position (the column where you want the field value to begin) and a Length (the field size).

ANSI specifies whether to use the ANSI or OEM character set: set ANSI to True to use the ANSI character set, or to False to use the OEM character set. If you omit this argument, Paradox uses the OEM character set by default. (OEM stands for Original Equipment Manufacturer and refers to the character set your computer uses; ANSI stands for American National Standards Institute and refers to the character set supported by Windows.)


Example for System::importASCIIFix
importASCIIFix Example

The following code imports the data from a text file named ORDERS.TXT to the Orders table. It reads structure information from the Orderimp table, and it imports the data using the OEM character set.

method pushButton(var eventInfo Event)
   importASCIIFix("orders.txt", "orders.db", "orderimp.db", False)
endMethod


See Also for System::importASCIIFix
See Also

dlgImportASCIIFix

importASCIIVar

importSpreadsheet


System::importASCIIVar
importASCIIVar	4.5

See Also	Example	System Type

Procedure

Imports data from a delimited (variable field length) text file to a table.

Syntax

importASCIIVar (const fileName String, const tableName String [, const separator String, const delimiter String, const allFieldsDelimited String, const ANSI Logical ] )

Description

importASCIIVar imports data from a delimited ASCII (text) file in which the field values are delimited by a specified character. Using this procedure, you can write ObjectPAL code to duplicate the functionality of the Delimited ASCII Import dialog box.

fileName specifies the file to import from, and tableName specifies the table to import to. Dates and numbers are formatted as specified in the Control Panel.

Note:	The extension you supply as part of tableName specifies the table type. Use .DB to specify a Paradox table, use .DBF to specify a dBASE table. If you omit the extension, the data is imported to a Paradox table by default.

Use the separator argument to specify the character that separates field values in the text file. You can choose a comma or any other single character, including special characters such as tabs. Use delimiter to specify the characters that surround values in the exported file. You can specify the empty string if you do not want any characters to enclose the values. Use allFieldsDelimited to specify whether to surround data from all field types (True) or only from text field types (alphanumeric or character) with the specified delimiter character (False). These are the default settings: fields are separated by commas, fields are delimited by quotes, only text fields are delimited, and the OEM character set is used.

Note:	Paradox trims strings longer than 255 characters when it imports them.

ANSI specifies whether to use the ANSI or OEM character set: set ANSI to True to use the ANSI character set, or to False to use the OEM character set. If you omit this argument, Paradox uses the OEM character set by default. (OEM stands for Original Equipment Manufacturer and refers to the character set your computer uses; ANSI stands for American National Standards Institute and refers to the character set supported by Windows.)


Example for System::importASCIIVar
importASCIIVar Example

The following code imports the data from a text file named ORDERS.TXT to the Orders table. It uses commas to delimit field values, it does not enclose each value, it delimits all fields, and it uses the ANSI character set.

method pushButton(var eventInfo Event)
   importASCIIVar("orders.txt", "orders.db", ",", "", True, True)
endMethod


See Also for System::importASCIIVar
See Also

importASCIIFix

importSpreadsheet


System::importSpreadsheet
importSpreadsheet	4.5

See Also	Example	System Type

Procedure

Imports the data from a table to a spreadsheet file.

Syntax

importSpreadsheet (const fileName String, const tableName String, const fromCell String, const toCell String [, const getFieldNames Logical] )

Description

importSpreadsheet imports the data from a spreadsheet file to a table. Using this procedure, you can write ObjectPAL code to duplicate the functionality of the Spreadsheet Import dialog box. When you import data from a spreadsheet, Paradox converts each row to a record and each column to a  field.

fileName specifies the file to import from, and tableName specifies the table to import to. fromCell specifies the upper left cell of the block to import, and toCell specifies the lower right cell. getFieldNames specifies whether to use the top row of the spreadsheet as column headers for the table (True), or not (False). If you omit this argument, the default value is True.

Note:	The extension you supply as part of the fileName argument specifies the format of the spreadsheet file. The following list shows extensions and file formats:

Extension	Format

WB1	Quattro Pro Win

WQ1	Quattro Pro DOS

WKQ	Quattro

WK1	Lotus 2.x

WKS	Lotus 1.A

XLS	Excel 3.0/4.0

Note:	The extension you supply as part of tableName specifies the table type. Use .DB to specify a Paradox table, and use .DBF to specify a dBASE table. If you omit the extension, the data is imported to a Paradox table by default.

When you import data from a spreadsheet, Paradox automatically assigns a field type to each column of data. The following table shows how Paradox determines a field's type:

Spreadsheet value	Paradox field type	dBASE field type

Label	Alphanumeric	Character

Integer	Short number	Float number (5,0)

Number	Numeric	Float number (20,4)

Currency	Currency	Float number (20,4)

Date	Date	Date

The following rules determine which category a column falls into:

Any column that contains a label (text) is converted to an alphanumeric field (or character field if you import to a dBASE table).

A column containing both dates and numbers is converted to an alphanumeric field (or character field if you import to a dBASE table).

A column containing only values formatted as currency is converted to a currency field in a Paradox table.

A column containing both currency and number (or integer) values is converted to a number field.

As a result of these conversion rules, Paradox often imports numbers in unedited spreadsheets as alphanumeric fields. For example, spreadsheet columns often have rows of hyphens separating sections of numbers. Since only an alphanumeric field can have both numbers and hyphens, the column is converted to an alphanumeric field even though it contains mostly numbers.

To avoid conversion problems, edit the spreadsheet before importing it. This eliminates any ambiguities. Follow these steps:

1. Remove extraneous entries (such as hyphens, asterisks, and exclamation points).

2. Make sure each column contains only one kind of data and uses only one formatting option.

3. Place column titles in the top row of the selected range, because Paradox uses the first row that contains text to generate field names. (If there are no column titles on the spreadsheet, uncheck the Get field names from first row check box in the Spreadsheet Import dialog box.)

If the table does not have the format you want after you import it, you can restructure it in Paradox.


Example for System::importSpreadsheet
importSpreadsheet Example

The following code imports the data from a Quattro Pro for Windows file to the Orders table. It uses the first row of the spreadsheet file as column headers for the table.

method pushButton(var eventInfo Event)
   importSpreadsheet("orders.wb1", "orders.db","A:A1", "A:H25", True)
endMethod


See Also for System::importSpreadsheet
See Also

importASCIIFix

importASCIIVar


System::isErrorTrapOnWarnings
isErrorTrapOnWarnings	5.0

See Also	Example	System Type

Procedure

Reports whether this session is handling warning errors as critical errors.

Syntax

isErrorTrapOnWarnings ( ) Logical

Description

isErrorTrapOnWarnings reports whether this session is handling warning errors as critical errors. isErrorTrapOnWarnings returns True if this session is handling warning errors as critical errors; otherwise, it returns False.


Example for System::isErrorTrapOnWarnings
isErrorTrapOnWarnings Example

In the following example, the pushButton method for btnToggleWarning toggles whether warning errors are treated as critical.

; btnToggleWarning :: pushButton
method pushButton(var eventInfo Event)
  errorTrapOnWarnings(not isErrorTrapOnWarnings())
  msgInfo("Warning errors are critical", isErrorTrapOnWarnings())
endmethod


See Also for System::isErrorTrapOnWarnings
See Also

errorTrapOnWarnings


System::message
message

See Also	Example	System Type

Beginner

Procedure

Displays a message in the status line.

Syntax

message ( const message String [, const message String]* )

Description

message displays a message composed of up to six strings in the status line.


Example for System::message
message Example

The following method writes a message to the status line:

; showMessage::pushButton
method pushButton(var eventInfo Event)
var
  lastName, firstName String
endVar
lastName = "Borland"
firstName = "Frank"
message("Hello, my name is ", firstName, " ", lastName, ".")
endMethod


See Also for System::message
See Also

msgInfo

msgQuestion

msgStop


System::msgAbortRetryIgnore
msgAbortRetryIgnore

See Also	Example	System Type	Changes

Procedure

Displays a dialog box containing a message and three buttons: Abort, Retry, and Ignore.

Syntax

msgAbortRetryIgnore ( const caption String, const text String ) String

Description

msgAbortRetryIgnore displays a three-button dialog box where caption specifies the text in the title bar, and text specifies the message displayed to the user. The return value is a string corresponding to the button clicked: "Abort", "Retry", or "Ignore". The button labels were changed in version 5.0.


Example for System::msgAbortRetryIgnore
msgAbortRetryIgnore Example

In the following example, the showAbortRetryIgnore button warns the user that an operation may take a long time, and asks the user whether to Abort, Retry, or Ignore.

; showAbortRetryIgnore::pushButton
method pushButton(var eventInfo Event)
var
  doThis String
endVar
doThis = msgAbortRetryIgnore("Note", "This may take a long time.
Do you want to stop?")  ; This message spans 2 lines.

doThis.view() ; Display the user's choice.

; Display a message based on the user's choice.
switch
   case doThis = "Abort"  : message("Aborting operation.")
   case doThis = "Retry"  : message("Retrying operation.")
   case doThis = "Ignore" : message("Ignoring problem.")
endSwitch
endMethod


See Also for System::msgAbortRetryIgnore
See Also

msgRetryCancel

msgYesNoCancel


Changes to System::msgAbortRetryIgnore

The button labels were changed in version 5.0.


System::msgInfo
msgInfo

See Also	Example	System Type

Beginner

Procedure

Displays a dialog box containing the information icon, a message, and an OK button.

Syntax

msgInfo ( const caption String, const text String )

Description

msgInfo displays a one-button dialog box. The text in caption is displayed in the title bar, and text is displayed in the box itself. The user must click OK or press Esc to close the box. This method does not return a value.


Example for System::msgInfo
msgInfo Example

The following example uses the msgInfo method to display a fact to the user.

; showMsgInfo::pushButton
method pushButton(var eventInfo Event)
msgInfo("Trivia", "The capital of Oregon is Salem.")
endMethod


See Also for System::msgInfo
See Also

msgQuestion

msgStop


System::msgQuestion
msgQuestion

See Also	Example	System Type

Beginner

Procedure

Displays a dialog box containing a message, a question mark icon, a Yes button, and a No button.

Syntax

msgQuestion ( const caption String, const text String ) String

Description

msgQuestion displays a two-button dialog box. The text in caption is displayed in the title bar, and text is displayed in the box itself. The return value corresponds to the button the user clicks to close the dialog box: "Yes" or "No".


Example for System::msgQuestion
msgQuestion Example

The following code asks the user whether to change the desktop title. If the user presses the Yes button, the desktop title is changed, then restored.

; showMsgQuestion::pushButton
method pushButton(var eventInfo Event)
var
  userChoice String
  thisApp    Application
endVar
userChoice = msgQuestion("Confirm", "Are you sure you want to
change the title to 'Custom Application'?")
switch
   case userChoice = "Yes" :
     thisApp.setTitle("Custom Application")  ; Change desktop title.
     sleep(2000)                             ; Pause.
     thisApp.setTitle("Paradox for Windows") ; Restore it.
   case userChoice = "No"  :
     message("Application title not changed.")
endSwitch
endMethod


See Also for System::msgQuestion
See Also

msgInfo

msgStop


System::msgRetryCancel
msgRetryCancel

See Also	Example	System Type

Procedure

Displays a dialog box containing a message and two buttons: Retry and Cancel.

Syntax

msgRetryCancel ( const caption String, const text String ) String

Description

msgRetryCancel displays a two-button dialog box where caption specifies the text in the dialog box title bar, and text specifies a message to display to the user. The return value corresponds to the button the user clicks: "Retry" or "Cancel". If the user presses Esc or uses the Close box, the return value is "Cancel".


Example for System::msgRetryCancel
msgRetryCancel Example

The following example poses a question to the user in response to a problem, then displays a message on the status line depending on how the user answers.

; showMsgRetryCancel::pushButton
method pushButton(var eventInfo Event)
var
  confirm String
endVar
confirm = msgRetryCancel("Dilemma", "What will you do?")
switch
  case confirm = "Retry"  : message("Retrying.")
  case confirm = "Cancel" : message("Giving up.")
endSwitch
endMethod


See Also for System::msgRetryCancel
See Also

msgYesNoCancel

msgAbortRetryIgnore


System::msgStop
msgStop

See Also	Example	System Type

Procedure

Displays a dialog box containing a stop sign icon, a message, and an OK button.

Syntax

msgStop ( const caption String, const text String )

Description

msgStop displays a one-button dialog box. The text in caption is displayed in the title bar, and text is displayed in the box itself, along with a Stop icon. The user must click OK or press Esc to close the box. This method does not return a value.


Example for System::msgStop
msgStop Example

In the following example, the pushButton method for showMsgStop alerts the user of a potentially dangerous action.

; showMsgStop::pushButton
method pushButton(var eventInfo Event)
msgStop("Stop!", "If you do that, changes to the form will not be saved.")
endMethod


See Also for System::msgStop
See Also

msgInfo

msgQuestion


System::msgYesNoCancel
msgYesNoCancel

See Also	Example	System Type

Procedure

Displays a dialog box containing a message and three buttons: Yes, No, and Cancel.

Syntax

msgYesNoCancel ( const caption String, const text String ) String

Description

msgYesNoCancel displays a three-button dialog box where caption specifies the text in the dialog box title bar, and text specifies text to display to the user. The return value corresponds to the button the user clicks: "Yes", "No", or "Cancel". If the user presses Esc or clicks the Close box, the return value is "Cancel".


Example for System::msgYesNoCancel
msgYesNoCancel Example

In the following example, msgYesNoCancel is used to find out whether the user wants to save data before quitting, discard the data, or cancel the quit operation and stay in the application.

; showMsgYesNoCancel::pushButton
method pushButton(var eventInfo Event)
var
  theChoice String
endVar
theChoice = msgYesNoCancel("Quit", "Save data before quitting?")
switch
   case theChoice = "Yes"    : message("Saving data.")
   case theChoice = "No"     : message("Discarding data.")
   case theChoice = "Cancel" : message("Remaining in application.")
endSwitch
endMethod


See Also for System::msgYesNoCancel
See Also

msgRetryCancel

msgAbortRetryIgnore


System::pixelsToTwips
pixelsToTwips

See Also	Example	System Type

Procedure

Converts screen coordinates from pixels to twips.

Syntax

pixelsToTwips ( const pixels Point ) Point

Description

pixelsToTwips converts the screen coordinates specified in pixels from pixels to twips. A pixel (the name comes from picture element) is a dot on the screen; a twip is a device-independent unit equal to 1/1440 of an inch (1/20 of a printer's point).


Example for System::pixelsToTwips
pixelsToTwips Example

The following example shows the position of the button (self) first in twips, then in pixels. The method goes on to find the display resolution for the system (given in pixels), then uses that information to open a window in the center of the display.

; convertTwipsPixels::pushButton
method pushButton(var eventInfo Event)
var
  selfP,
  sysTwips  Point
  thisSys   DynArray[] AnyType
  x, y      SmallInt
  custForm  Form
endVar
selfP = self.Position
selfP.view("Position of this button in twips")
selfP = twipsToPixels(selfP)
selfP.view("Position of this button in pixels")
; open a 2" by 2" form exactly in the center of the screen
sysInfo(thisSys)                ; fill a dynamic array with system information
sysTwips = Point(thisSys["FullWidth"], thisSys["FullHeight"])
sysTwips = pixelsToTwips(sysTwips)
x = int(sysTwips.x()/2) - 1440  ; calculate x-coordinate 1 inch left of center
y = int(sysTwips.y()/2) - 1440  ; calculate y-coordinate 1 inch above center
custForm.open("Customer.fsl", WinStyleDefault, x, y, 2880, 2880)

endMethod


See Also for System::pixelsToTwips
See Also

twipsToPixels


System::play
play

See Also	Example	System Type

Beginner

Procedure

Plays a standalone script.

Syntax

play ( const scriptName String ) AnyType

Description

play executes the statements in the script specified in scriptName, the same as if you had called the Script method run. To return a value from a script, you must call formReturn from within the script.

A standalone script consists of one or more ObjectPAL statements attached to an object that never appears. You can think of a standalone script as a special kind of custom method. For more information, refer to the Script type.


Example for System::play
play Example

The following code plays a script named TESTSCR.SSL, which is assumed to be in the working directory.

; playAScript::pushButton
method pushButton(var eventInfo Event)
play("Testscr.ssl")
endMethod


See Also for System::play
See Also

execute

Script::run

Script Type


System::printerGetInfo
printerGetInfo	5.0

See Also	Example	System Type

Procedure

Gets information about the current printer in the user's system.

Syntax

printerGetInfo ( var printInfo PrinterInfo ) Logical

Description

printerGetInfo gets information about the current printer in the user's system. The information is assigned to printInfo, a record you must declare using a special ObjectPAL data type called PrinterInfo. The structure of a PrinterInfo record is

Field	Type	Description

DriverName	String	Name of the printer driver for the current printer. Example: PSCRIPT.DRV.

DeviceName	String	Name that identifies the printer type. Example: Apple LaserWriter Plus.

PortName	String	Name of the port used by the current printer. Example: LPT1:.

DefaultPrinter	Logical	If True, the current printer is the default printer; otherwise, it is not the default printer.

This method returns True if it succeeds; otherwise, it returns False.


Example for System::printerGetInfo
printerGetInfo Example

See the example for printerSetOptions.


See Also for System::printerGetInfo
See Also

enumPrinters

printerGetOptions

printerSetCurrent

printerSetOptions


System::printerGetOptions
printerGetOptions	5.0

See Also	Example	System Type

Procedure

Gets information about options for a specified printer attached to the user's system.

Syntax

printerGetOptions ( var printOptions PrinterOptionInfo ) Logical

Description

printerGetOptions gets information about settings and options for the current printer attached to the user's system. The information is assigned to printInfo, a record you must declare using a special ObjectPAL data type called PrinterOptionInfo.

This method returns True if it succeeds; otherwise, it returns False.


Example for System::printerGetOptions
printerGetOptions Example

This example gets the curent printer settings and checks to see if the printer is using a large format paper source.

method pushButton(var eventInfo Event)

var

recUserOptions,

recMyOptions	PrinterOptionInfo

endVar

; Get the current printer settings.

printerGetOptions(recUserOptions)

if recUserOptions.DefaultSource = LargeFmt then

return

endIf

; Specify new printer settings. LargeFmt is a PrintSources constant.

recMyOptions.DefaultSource = LargeFmt

if printerSetOptions(recMyOptions) then

message("Printer setup complete.")

else

errorShow()

endIf

endMethod


See Also for System::printerGetOptions
See Also

enumPrinters

printerGetInfo

printerSetCurrent

printerSetOptions


PrinterOptionInfo record structure

Field	Type	Description

Orientation	LongInt	Paper orientation: portrait or landscape. Use a PrinterOrientation constant to test the value.

PaperSize	LongInt	Paper size. Use a PrinterSizes constant to test the value.

PaperWidth	LongInt	Custom paper width in twips (maximum of 64K twips). This value is converted internally to the the tenths of a millimeter required by Windows.

PaperLength	LongInt	Custom paper length in twips (maximum of 64K twips). This value is converted internally to the tenths of a millimeter required by Windows.

Scale	LongInt	Scaling factor in percent. A scale value of 50 means a reduction to one-half the original size. A value of 200 means twice the original size. This only works with printers that support scaling for all functions, graphics, and fonts. Postcript printers and the Microsoft Windows Printing System are examples of such printers.

Copies	LongInt	Number of copies for the printer to make. Generally works only with page printers such as laser printers where the full page can be held in printer memory. Some printer drivers can support this feature on printers that cannot do full page printing.

This setting is equivalent to unchecking the Collate button in the Print dialog. Output will not be collated. This operation is typically much faster than repeatedly sending the full document to the printer but it does require hand sorting afterwards.

DefaultSource	LongInt	Bin, tray, or feeder to be used by default. Use a PrintSources constant to test the value.

PrintQuality	LongInt	Higher print qualities are used for final output, lower for faster or draft output. Lower quality may differ significantly from the preview appearance of the document. Use a PrintQuality constant to test the value.

Color	LongInt	Sets color printers to color or monochrome printing. Monochrome is usually faster. Use a PrintColor constant to test the value.

Duplex	LongInt	For printers which support it, sets double-sided printing. Note that some printer drivers can support double-sided printing on otherwise single-sided printers by making two passes over the document. Use a PrintDuplex constant to test the value.


System::printerSetCurrent
printerSetCurrent	5.0

See Also	Example	System Type

Procedure

Sets the current (active) printer on the user's system.

Syntax

printerSetCurrent ( printerInfo String ) Logical

Description

printerSetCurrent sets the current (active) printer on the user's system to the printer specified in printerInfo. The value of printerInfo must be the printer name, driver name, and printer port separated by commas, like items in the array returned by enumPrinters.

This method returns True if it succeeds; otherwise, it returns False.


Example for System::printerSetCurrent
printerSetCurrent Example

See the example for enumPrinters.


See Also for System::printerSetCurrent
See Also

enumPrinters

printerGetInfo

printerGetOptions

printerSetOptions


System::printerSetOptions
printerSetOptions	5.0

See Also	Example	System Type

Procedure

Specifies settings for the current printer attached to the user's system.

Syntax

printerSetOptions ( PrintOptions PrinterOptionInfo ) Logical

Description

printerSetOptions specifies settings for a printer attached to the user's system. The information is specified in printerSettings, a record you must declare using a special ObjectPAL data type called PrinterOptionInfo. You don't have to supply values for every field in a PrinterOptionInfo record; the printer uses its current setting for any value you don't supply. This method returns True if it succeeds; otherwise, it returns False. If you set a value that doesn't apply to the current printer, this method returns False.


Example for System::printerSetOptions
printerSetOptions Example

This example prompts the user to enter a number of copies to print and uses printerSetOptions to set up the printer. Then it prints a report.

method pushButton(var eventInfo Event)

var

siNCopies	SmallInt

stPrompt	String

prnOptions	PrinterOptionInfo

reOrders	Report

endVar

siNCopies = 0

stPrompt  = "Print how many copies?"

siNCopies.view(stPrompt)

if siNCopies > 0 then

prnOptions.Copies = siNCopies

else

return

endIf

; Use constant to specify lower paper tray.

prnOptions.DefaultSource = Lower

; Use constant to specify landscape (long) orientation.

prnOptions.Orientation = Landscape

; Use constant to specify high quality print.

prnOptions.PrintQuality = High

if printerSetOptions(prnOptions) then

reOrders.print("orders")

else

errorShow("Could not set printer options.")

endIf

endMethod


See Also for System::printerSetOptions
See Also

enumPrinters

printerGetInfo

printerGetOptions

printerSetCurrent


System::projectViewerClose
projectViewerClose	5.0

See Also	Example	System Type

Procedure

Closes the Project Viewer window.

Syntax

projectViewerClose ( ) Logical

Description

projectViewerClose closes the Project Viewer window. This method returns True if it succeeds; otherwise, it returns False.


Example for System::projectViewerClose
projectViewerClose Example

This example calls projectViewerIsOpen to see if the Project Viewer window is open, and if it is open, calls projectViewerClose to close it.

method open(var eventInfo Event)

if eventInfo.isPreFilter() then

;// This code executes for each object on the form:

else

;// This code executes only for the form:

if projectViewerIsOpen() then

projectViewerClose()

endIf

endIf

endMethod


See Also for System::projectViewerClose
See Also

projectViewerIsOpen

projectViewerOpen


System::projectViewerIsOpen
projectViewerIsOpen	5.0

See Also	Example	System Type

Procedure

Tells whether the Project Viewer window is open.

Syntax

projectViewerIsOpen ( ) Logical

Description

projectViewerIsOpen returns True if the Project Viewer window is open; otherwise, it returns False.


Example for System::projectViewerIsOpen
projectViewerIsOpen Example

See the example for projectViewerClose.


See Also for System::projectViewerIsOpen
See Also

projectViewerClose

projectViewerOpen


System::projectViewerOpen
projectViewerOpen	5.0

See Also	Example	System Type

Procedure

Opens the Project Viewer window.

Syntax

projectViewerOpen ( ) Logical

Description

projectViewerOpen opens the Project Viewer window. This method returns True if it succeeds; otherwise, it returns False.


Example for System::projectViewerOpen
projectViewerOpen Example

This example calls projectViewerIsOpen to see if the Project Viewer window is open, and if it is not open, calls projectViewerOpen to open it.

method open(var eventInfo Event)

if eventInfo.isPreFilter() then

;// This code executes for each object on the form:

else

;// This code executes only for the form:

if not projectViewerIsOpen() then

projectViewerOpen()

endIf

endIf

endMethod


See Also for System::projectViewerOpen
See Also

projectViewerClose

projectViewerIsOpen


System::readEnvironmentString
readEnvironmentString

See Also	Example	System Type

Procedure

Reads an item from the DOS environment.

Syntax

readEnvironmentString ( const key String ) String

Description

readEnvironmentString returns a string containing information about the DOS environment variable specified in key. Environment variables are assigned values using the DOS command SET. They control how DOS and some batch files and programs appear and work. Commonly used environment variables include PATH, PROMPT, and COMSPEC. For more information, consult your DOS manuals, especially the SET command.


Example for System::readEnvironmentString
readEnvironmentString Example

The following example uses readEnvironmentString and writeEnvironmentString to get and change the value of the PATH environment variable.

; changeEnvironmentStr::pushButton
method pushButton(var eventInfo Event)
var
   fs              FileSystem
   thePath, myDir  String
   pathArr Array[] String
endVar
; fs.getDir() currently returns some high-ANSI char--not a meaningful string
myDir = fs.getDir()                     ; get the current directory
myDir = "c:\\pdoxwin\\refwork\\pc0syall"
myDir.view("Current directory")
thePath = readEnvironmentString("PATH") ; read the path environment var
thePath.breakApart(pathArr, ";")        ; break on semicolon
pathArr.view("An array of paths")       ; view the results
if NOT pathArr.contains(myDir) then     ; if current dir not in path
   msgInfo("FYI", "Adding current directory to path.")
   writeEnvironmentString("PATH", thePath + ";" + myDir)  ; add it
endif
thePath = readEnvironmentString("PATH") ; read the changed environment var
thePath.view()
thePath.breakApart(pathArr, ";")        ; break it up
pathArr.view("An array of paths")       ; view the results
endMethod


See Also for System::readEnvironmentString
See Also

readProfileString

writeEnvironmentString


System::readProfileString
readProfileString

See Also	Example	System Type

Procedure

Reads an item from the user's WIN.INI file.

Syntax

readProfileString ( const fileName String, const section String, const key String ) String

Description

readProfileString returns a value from a specified section of a specified file on the user's system. This method searches the user's WINDOWS directory by default. Typically, you use this method to read the user's WIN.INI file, so fileName is WIN.INI. A section in WIN.INI is marked by a string bounded by square brackets on a line by itself (for example, [windows]). However, omit the brackets when you specify section; that is, to specify the [windows] section, use "windows." Within a section, a value marker is a string followed by an equal sign (for example, Beep =), but don't include the = when you specify key.


Example for System::readProfileString
readProfileString Example

The following example uses readProfileString and writeProfileString to get and change the setting for the Windows beep.

; changeProfileStr::pushButton
method pushButton(var eventInfo Event)
var
   myBeep String
   winDir String
endVar
winDir = windowsDir()
myBeep = readProfileString(winDir + "\\win.ini", "windows", "Beep")
msgInfo("Beep?", myBeep) ; displays yes or no, depending on user's settings
if myBeep <> "yes" then
  msgInfo("Alert", "Changing profile string for Beep to yes.")
  writeProfileString(winDir + "\\win.ini", "windows", "Beep", "yes")
  beep()
else
  msgInfo("Alert", "Changing profile string for Beep to no.")
  writeProfileString(winDir + "\\win.ini", "windows", "Beep", "no")
  beep()
endIf
endMethod


See Also for System::readProfileString
See Also

writeProfileString

readEnvironmentString


System::resourceInfo
resourceInfo	5.0

See Also	Example	System Type

Procedure

Lists the system resources.

Syntax

resourceInfo ( var info DynArray[] AnyType )

Description

resourceInfo lists the resources of the user's system. It writes the data to a DynArray that you declare and pass as an argument. The indexes are described in the table below.

Index	Definition

FreeGDIResources	Percentage of free Windows GDI resources.

FreeSpace	Total amount of free Windows memory.

FreeSystemResource	Percentage of free Windows system resources.

FreeUserResources	Percentage of free Windows user resources.

InternalVersion	Paradox for Windows internal IDAPI engine version.


Example for System::resourceInfo
resourceInfo Example

The following code writes resource information to a dynamic array dyn then displays dyn in a View dialog box.

; btnResourceInfo::pushButton
method pushButton(var eventInfo Event)
  var
    dynResources	Dynarray[] String
  endVar

  resourceInfo(dynResources)
  dynResources.view()
endmethod


See Also for System::resourceInfo
See Also

enumEnvironmentStrings


System::sendKeys
sendKeys	4.5

See Also	Example	System Type

Procedure

Sends one or more keystrokes to the active window as if they had been entered at the keyboard. The active window need not be Paradox for Windows.

Syntax

sendkeys ( const keyText string [, const wait logical] ) logical

Description

sendKeys sends one or more keystrokes to the active window as if they had been entered at the keyboard. The active window need not be Paradox for Windows. The argument keyText specifies one or more keys to send; the optional argument wait specifies whether to continue executing keystroke sequences in the message loop without waiting. sendKeys returns False when an error occurs and it cannot send any of the keys.  When sendKeys returns False the error code returned by the errorCode procedure is one of the following:

Error code	Error message

peskMissingCloseBrace	"Missing closing brace."

peskInvalidKey	"The key name is not correct."

peskMissingCloseParen	"Missing closing parentheses."

peskInvalidCount	"The repeat count is not correct."

peskStringTooLong	"The keys string is too long."

peskCantInstallHook	"Could not install windows journalling hook."

Note:	sendKeys can only send keystrokes to an application designed to run in Microsoft Windows. Also, sendKeys cannot send the print screen (prtsc) key to any application.

The keyText argument

Each key is represented by one or more lower case characters. For example, to represent the letter A, use "a" for keyText. To represent more than one character, string them together. For example, to send  the letters a, b, and c, use "abc" for keytext. The plus sign (+),  caret (^), percent sign (%), tilde (~), and parentheses ( ) have special meanings to sendKeys. To specify one of these characters, enclose it inside braces. For example, to specify the plus sign, use  {+}.

To send brace characters, use {{} and {}}.

To specify non-printing characters (such as enter or tab) and keys that represent actions rather than characters, use the codes listed  below:

Key	Codes

backspace	{backspace}, {bs}, {bksp}, {vk_back}

break	{break}, {vk_break}

caps lock	{capslock}, {vk_captial}

clear	{clear}, {vk_clear}

del	{delete}, {del}, {vk_delete}

down arrow	{down}, {vk_down}

end	{end}, {vk_end}

enter	{enter}, {return}, {vk_return} (the character ~)

esc	{escape}, {esc}, {vk_escape}

help	{help}, {vk_help}

home	{home}, {vk_home}

ins	{insert}, {vk_insert}

left arrow	{left}, {vk_left}

num lock	{numlock}, {vk_numlock}

page down	{pgdn}, {vk_next}

page up	{pgup}, {vk_prior}

print screen	{prtsc}, {vk_snapshot}

right arrow	{right}, {vk_right}

scroll lock	{scrolllock}, {vk_scroll}

tab	{tab}, {vk_tab}

up arrow	{up}, {vk_up}

F1	{F1}, {vk_F1}

F2	{F2}, {vk_F2}

F3	{F3}, {vk_F3}

F4	{F4}, {vk_F4}

F5	{F5}, {vk_F5}

F6	{F6}, {vk_F6}

F7	{F7}, {vk_F7}

F8	{F8}, {vk_F8}

F9	{F9}, {vk_F9}

F10	{F10}, {vk_F10}

F11	{F11}, {vk_F11}

F12	{F12}, {vk_F12}

F13	{F13}, {vk_F13}

F14	{F14}, {vk_F14}

F15	{F15}, {vk_F15}

F16	{F16}, {vk_F16}

The ~ character represents the Enter key.

For example, sendKeys("abc~") types the letters abc and the carriage return.

To specify keys combined with any combination of Shift, Ctrl, and Alt keys, precede the regular key code with one or more of the following codes:

Key	Code

Shift	+

Control	^

Alt	%

For example, to show the "File" menu list in Paradox: sendKeys("%f"). and then move down 3 menu items: sendKeys("{down 3}"). and then to pick the item: sendKeys("~"). to combine these three steps  in one sendKeys statement: sendKeys("%f{down 3}~")
To specify that Shift, Ctrl, and/or Alt are held down while one or more keys are pressed, enclose the key codes in parentheses. For example, to have the Shift key held down while a and b are pressed, use "+(ab)". To have Shift held down while a is pressed, followed by b being pressed without Shift, use "+ab".

To specify repeating keys, use a string in the form {key number};  You must put a space between key and number. For example, {left 42} means press the left arrow key 42 times; {h 9} means press h 9 times.

Special Commands

Following are special commands you can include as part of the keyText argument:

{delay value}

{action integervalue}

{cmt comment}

{beginexact} text {endexact}

{delay value}

delay sets the delay (in milliseconds) between keystrokes.  {delay 1000} delays approximately 1 second between keystrokes. This is only approximate and will vary depending whether Shift, Alt, and Ctrl are set. Also, if the time to actually execute the command is longer, then you may see additional delays.

delay is mainly used to let dialog boxes show. Without it the keys are sent at full speed, and windows will process the keys before showing the dialog box. This will result in dialog boxes not showing because windows will delay paints. delay remains in effect until another delay or another sendKeys statement executes. The delay does not affect action commands.

{action integervalue}

This sends an action to the active object in the form that issued the sendKeys statement. it allows you to gain control while sendKeys executes and inspect the state of forms or dialog boxes. The argument integervalue represents a value from 0 to 2047. Do not call any methods or procedures that wait for user input, and do not open a form or report.

{cmt comment}

cmt lets you insert comments. The comment argument represents the comment. All characters are allowed.

{beginexact} text {endexact}

The normal processing of sendKeys ignores carriage returns and line  feeds. It also assigns meaning to certain characters. To send a large block of text without this processing, enclose the  text with {beginexact} and {endexact}. Once a {beginexact} is encountered, all text is processed as is, with no special treatment, until you get to an {endexact}.

If you call sendKeys while another sendKeys statement is executing, Paradox adds the new key sequence to the end of the event queue.

The wait argument

The wait argument specifies whether to wait after keys are played or to continue ObjectPAL execution and play the keys in the next message loop. The recommended setting is False. Under certain conditions windows will stop responding to sendKeys if the wait parameter is True. For example, this happens when sending keys to nested dialogs.It is important when changing the working or private directory that you set wait to False.

Note:	sendKeys statements are not portable across language barriers.


Example for System::sendKeys
sendKeys example

The following example calls the system procedure execute to run the notepad application that comes with Microsoft Windows; then it calls sendKeys several times to send keystrokes to notepad.

method pushButton(var eventInfo event)

   execute("notepad.exe")          ; run notepad.

   ; write a short note.

   sendKeys("this is the first line of a 2-line note.~")
   sendKeys("this is the second line of a 2-line note.")

   ; send alt+f, s to choose File | Save.

   sendKeys("%fs")

   ; send a file name to the dialog box, and
   ; send enter to save the file.

 sendKeys("twolines.txt~")

   ; send Alt+f4 to close notepad.

   sendKeys("%{f4}")

endMethod


See Also for System::sendKeys
See Also

sendKeysActionID


System::sendKeysActionID
sendKeysActionID	4.5

See Also	Example	System Type

Method

Lets the sendKeys procedure notify the user that the sendKeys queue is empty.

Syntax

sendKeysActionID ( const id SmallInt )

Description

sendKeysActionID lets the sendKeys procedure notify the user that the sendKeys queue is empty. id is a user action constant and must have a value between UserAction and UserActionMax. id is sent to the active object of the form (or to the form itself if there is no active object) that issued the sendKeys method.

Typically, you'd put the code to process this at the form level. If there is an active object, it receives the ID in its action method but the default is to bubble it to the form.


Example for System::sendKeysActionID
sendKeysActionID Example

The code in this example specifies a value to send as the action ID when the queue is empty. Suppose a form contains an unbound field and a button. The following code is attached to the form's Const window.

const

kMyCustomAction = 1

endConst

The following code is attached to the form's built-in action method.

method action(var eventInfo ActionEvent)
  if eventInfo.id() = UserAction + kMyCustomAction then
     message("SendKeys has finished sending")
  endif
endMethod

The following code is attached to a button's built-in pushButton method.

method pushButton(var eventInfo Event)

   ; Send keys but do not wait.
   sendKeys("This is some text", FALSE)

   ; Set the action id to send when the queue is empty.
   sendKeysActionID(UserAction + kMyCustomAction)
endMethod


See Also for System::sendKeysActionID
See Also

sendKeys


System::setDefaultPrinterStyleSheet
setDefaultPrinterStyleSheet	5.0

See Also	Example	System Type

Procedure

Specifies a default printer style sheet.

Syntax

setDefaultPrinterStyleSheet ( const fileName String )

Description

setDefaultPrinterStyleSheet makes the Paradox system use the default style sheet for documents designed for the printer, specified in fileName. If fileName does not specify a full path to the style sheet, this method searches for it in :WORK:. Printer style sheet files have an extension of .FP, screen style sheet files have an extension of .FT. You cannot use a .FT file as a printer style sheet, and you cannot use a .FP file as a screen style sheet.

After a call to setDefaultPrinterStyleSheet, forms that use the default printer style sheet will use the style sheet specified in fileName. Any UIObjects created in such forms while the style sheet is active will have the properties and methods of the corresponding prototype objects in the style sheet. setDefaultPrinterStyleSheet does not change the properties or methods of UIObjects that already exist, and it has no effect on UIObjects in forms that use style sheets other than the default printer style sheet.

Paradox uses the default printer style sheet whenever you create a form or report. This method sets the default printer style sheet, but individual forms and reports may use different style sheets. Use getStyleSheet and setStyleSheet to work with style sheets for specific forms and reports.

Use setDefaultScreenStyleSheet to specify the name of the default screen style sheet, used whenever you create design documents that are designed for the screen.


Example for System::setDefaultPrinterStyleSheet
setDefaultPrinterStyleSheet Example

The following example calls getDefaultPrinterStyleSheet to see which style sheet the system is using. If the style sheet is not BORLAND.FT, the code calls setDefaultPrinterStyleSheet to set it, then calls getDefaultPrinterStyleSheet again to make sure it was set successfully. Note that setDefaultPrinterStyleSheet requires double backslashes in the path, but getDefaultPrinterStyleSheet returns single backslashes.

method pushButon(var eventInfo Event)
   ; Get and set the system style sheet.
   if getDefaultPrinterStyleSheet() <> "c:\pdoxwin\borland.ft" then
      setDefaultPrinterStyleSheet("c:\\pdoxwin\\borland.ft")
      if getDefaultPrinterStyleSheet() <> "c:\pdoxwin\borland.ft" then
         msgStop("Problem", "Could not set the style sheet.")
      endIf
   endIf
endMethod


See Also for System::setDefaultPrinterStyleSheet
See Also

getDefaultPrinterStyleSheet

getDefaultScreenStyleSheet

setDefaultScreenStyleSheet

Form::getStyleSheet

Form::setStyleSheet

Form::saveStyleSheet

Form::getProtoProperty

Form::setProtoProperty


System::setDefaultScreenStyleSheet
setDefaultScreenStyleSheet	5.0

See Also	Example	System Type

Procedure

Specifies a default screen style sheet.

Syntax

setDefaultScreenStyleSheet ( const fileName String )

Description

setDefaultScreenStyleSheet makes the Paradox system use the default style sheet for documents designed for the screen, specified in fileName. If fileName does not specify a full path to the style sheet, this method searches for it in :WORK:. Screen style sheet files have an extension of .FT, printer style sheet files have an extension of .FP. You cannot use a .FP file as a screen style sheet, and you cannot use a .FT file as a printer style sheet.

After a call to setDefaultScreenStyleSheet, forms that use the default screen style sheet will use the style sheet specified in fileName. Any UIObjects created in such forms while the style sheet is active will have the properties and methods of the corresponding prototype objects in the style sheet. setDefaultScreenStyleSheet does not change the properties or methods of UIObjects that already exist, and it has no effect on UIObjects in forms that use style sheets other than the default screen style sheet.

Paradox uses the default screen style sheet whenever you create a form or report. This method sets the default screen style sheet, but individual forms and reports may use different style sheets. Use getStyleSheet and setStyleSheet to work with style sheets for specific forms and reports.

Use setDefaultPrinterStyleSheet to specify the name of the default printer style sheet, used whenever you create design documents that are designed for the printer.


Example for System::setDefaultScreenStyleSheet
setDefaultScreenStyleSheet Example

The following example calls getDefaultScreenStyleSheet to see which style sheet the system is using. If the style sheet is not BORLAND.FT, the code calls setDefaultScreenStyleSheet to set it, then calls getDefaultScreenStyleSheet again to make sure it was set successfully. Note that setDefaultScreenStyleSheet requires double backslashes in the path, but getDefaultScreenStyleSheet returns single backslashes.

method pushButon(var eventInfo Event)
   ; Get and set the system style sheet.
   if getDefaultScreenStyleSheet() <> "c:\pdoxwin\borland.ft" then
      setDefaultScreenStyleSheet("c:\\pdoxwin\\borland.ft")
      if getDefaultScreenStyleSheet() <> "c:\pdoxwin\borland.ft" then
         msgStop("Problem", "Could not set the style sheet.")
      endIf
   endIf
endMethod


See Also for System::setDefaultScreenStyleSheet
See Also

getDefaultPrinterStyleSheet

getDefaultScreenStyleSheet

setDefaultPrinterStyleSheet

Form::getStyleSheet

Form::setStyleSheet

Form::saveStyleSheet

Form::getProtoProperty

Form::setProtoProperty


System::setMouseScreenPosition
setMouseScreenPosition

See Also	Example	System Type

Procedure

Displays the mouse pointer at a specified position.

Syntax

1. setMouseScreenPosition ( const mousePosition Point )

2. setMouseScreenPosition ( const x LongInt, const y LongInt )

Description

setMouseScreenPosition displays the mouse pointer at the point specified in mousePosition (syntax 1) or at the coordinates specified in x and y (syntax 2). Specify coordinates in twips.


Example for System::setMouseScreenPosition
setMouseScreenPosition Example

See the example for getMouseScreenPosition.


See Also for System::setMouseScreenPosition
See Also

getMouseScreenPosition

MouseEvent::getMousePosition

MouseEvent::setMousePosition


System::setMouseShape
setMouseShape

See Also	Example	System Type

Procedure

Specifies the shape of the mouse pointer.

Syntax

setMouseShape ( const mouseShapeId LongInt ) LongInt

Description

setMouseShape specifies in mouseShapeId the shape of the mouse pointer. ObjectPAL provides constants MouseShapes constants for mouse shapes, so you don't have to remember numeric values.


Example for System::setMouseShape
setMouseShape Example

The following example cycles through the available mouse shapes when the user clicks a field.

; changeMouseField::mouseUp
method mouseUp(var eventInfo MouseEvent)
beep()
message("Watch carefully--changing mouse shapes.")
setMouseShape(MouseIBeam)
sleep(1000)
setMouseShape(MouseCross)
sleep(1000)
setMouseShape(MouseWait)
sleep(1000)
setMouseShape(MouseUpArrow)
sleep(1000)
setMouseShape(MouseArrow)
endMethod


See Also for System::setMouseShape
See Also

setMouseScreenPosition

getMouseScreenPosition


System::setUserLevel
setUserLevel	5.0

See Also	Example	System Type

Procedure

Sets the user's ObjectPAL level.

Syntax

setUserLevel ( const level String )

Description

setUserLevel allows you to set the ObjectPAL level level on the user's system to either Beginner or Advanced. Use getUserLevel to return the current setting.

Note:	The ObjectPAL level setting does not affect how code executes; it only affects what is displayed in the user interface.


Example for System::setUserLevel
setUserLevel Example

The following example uses getUserLevel to see if the ObjectPAL level is set to Beginner. If it is, then setUserLevel is used to set the ObjectPAL level to Advanced. Then a message is sent to the status bar. If the users ObjectPAL level is already set to Advanced, a message stating this is sent to the status bar.

;setToAdvanced::pushButton
method pushButton(var eventInfo Event)
  if getUserLevel() = "Beginner" then
    setUserLevel("Advanced")
    message("ObjectPAL level is now set to Advanced")
    else
      message("ObjectPAL level was already set to Advanced")
  endIf
endmethod


See Also for System::setUserLevel
See Also

getUserLevel


System::sleep
sleep

See Also	Example	System Type	Changes

Beginner

Procedure

Produces a delay of a specified duration.

Syntax

sleep ( [ const numberOfMilliSeconds LongInt ] )

Description

sleep disables the currently executing form, rendering it incapable of receiving keystrokes, mouse events, or focus (if you move off and back on) for the number of milliseconds specified in numberofMilliseconds. It does not disable the Desktop or stop timer events.

Note:	When called with no argument, sleep does not disable the form. It causes the current process (method) to yield to Windows to let a single pending message be processed. This feature was added in version 5.0.


Example for System::sleep
sleep Example

The following code displays a message in the status line, then waits five seconds before displaying a second message.

; goToSleep::pushButton
method pushButton(var eventInfo Event)
var
   yourTurn SmallInt
endVar
yourTurn = 5000
beep()
message("Next message in 5 seconds.")
sleep(yourTurn)                     ; waits for 5 seconds
message("5 seconds have elapsed.")
endMethod


See Also for System::sleep
See Also

Form::wait


Changes to System::sleep

When called with no argument, sleep does not disable the form. It causes the current process (method) to yield to Windows to let a single pending message be processed. This feature was added in version 5.0.


System::sound
sound

See Also	Example	System Type

Beginner

Procedure

Creates a sound of specified frequency and duration.

Syntax

sound ( const freqHertz, const durationMilliSecs LongInt )

Description

sound creates a sound of frequency (in Hertz) freqHertz for a time (in milliseconds) specified in durationMilliSecs. Frequency values can range between 1 and 50,000 Hertz (the audible limit is approximately 20,000 Hertz).


Example for System::sound
sound Example

In the following example, the pushButton method for makeMusic first declares a number of constants for frequency values in a scale. These notes are used to specify the frequency argument in the calls to the sound method. After playing a few bars from a tune, the method demonstrates the calculation for notes in a chromatic scale (proceeds by half notes).

; makeMusic::pushButton
method pushButton(var eventInfo Event)
var
   quarterNote, octave, note LongInt
   power                     Number
endVar
; frequency values for notes in a scale
const
  noteA1  = 110
  noteA#1 = 116
  noteB1  = 123
  noteC1  = 130
  noteC#1 = 138
  noteD1  = 146
  noteD#1 = 155
  noteE1  = 164
  noteF1  = 174
  noteF#1 = 184
  noteG1  = 195
  noteG#1 = 207
  noteA2  = 220
  noteA#2 = 234
  noteB2  = 249
  noteC2  = 265
  noteC#2 = 282
  noteD2  = 300
endConst
; several bars from Peter and the Wolf
sound(noteA1, 200)
sound(noteD1, 150)
sound(noteF#1, 50)
sound(noteA2, 100)
sound(noteB2, 100)
sound(noteA2, 150)

sound(noteF#1, 50)
sound(noteA2, 100)
sound(noteB2, 100)
sound(noteC#2, 150)
sound(noteD2, 50)
sound(noteA2, 100)
sound(noteF#1, 100)
sound(noteD1, 100)
sleep(1000)

; play a few chromatic scales
quarterNote = 120
for octave from 0 to 1
   for note from 0 to 11
      sound(int(pow(2, octave + note / 12.0) * 110), quarterNote)
   endFor
endFor
sound(int(pow(2, 2) * 110), quarterNote) ; finish out the scale
endMethod


See Also for System::sound
See Also

beep


System::sysInfo
sysInfo

See Also	Example	System Type

Procedure

Creates a dynamic array of information about the system running Paradox.

Syntax

sysInfo ( var info DynArray[ ] AnyType )

Description

sysInfo creates a dynamic array info of information about the system running Paradox. You must declare the DynArray before calling this method. The DynArray contains indexes for system attributes and their values. The indexes are described in the table below.

Index	Definition

AreMouseButtonsSwapped	Reports whether functions of the left and right mouse buttons are reversed

ConfigFile	The path to ODAPI.CFG

CodePage	Reports which code page is currently loaded by Windows

CPU	Processor type

Edition	Paradox edition (for example, Standard)

EngineDate	Creation date of database engine

EngineVersion	Version number of database engine

FullHeight	Vertical working area (in pixels) in a maximized window

FullWidth	Horizontal working area (in pixels) in a maximized window

IconHeight	Height of icons (in pixels)

IconWidth	Width of icons (in pixels)

KeyboardFNKeys	Number of function keys

KeyboardSubType	Keyboard subtype is an OEM-dependent value

KeyboardType	Type and manufacturer of the keyboard

LanguageDriver	Default language driver

LocalShare	Reports whether Local Share is active

MathCoprocessor	Reports whether a math coprocessor is present

Memory	Available memory, including swap file (if present) in bytes

Mouse	The number of mice attached to the system

NetDir	The path to PDOXUSRS.NET

NetProtocol	Network protocol

NetShare	Reports whether Net Share is active

NetType	Network type

NumTasks	The number of active tasks (programs)

Protected	Reports whether the system is running in protected mode

ScreenHeight	Total height of screen (in pixels)

ScreenWidth	Total width of screen (in pixels)

StartupDir	The full path (including the drive ID letter) to the user's start-up directory; that is, the directory from which Paradox was started

UserName	Network user name

WindowsDir	Path to the WINDOWS directory

WindowsSystemDir	Path to the WINDOWS\SYSTEM directory

WindowsVersion	Version number of Windows


Example for System::sysInfo
sysInfo Example

The following code writes system information to a dynamic array named userSys, then displays userSys in a View dialog box. (See also pixelsToTwips.)

; showSysInfo::pushButton
method pushButton(var eventInfo Event)
var
   userSys DynArray[] AnyType
endVar
sysInfo(userSys)   ; fill the array with system information
userSys.view()     ; show the array
endMethod


See Also for System::sysInfo
See Also

readProfileString


System::tracerClear
tracerClear

See Also	Example	System Type

Procedure

Clears the Tracer window.

Syntax

tracerClear ( )

Description

tracerClear empties the Tracer window. The Tracer window can be opened by the tracerOn procedure at run time, or by selecting the ObjectPAL Editor menu's View | Tracer command.


Example for System::tracerClear
tracerClear Example

The following code clears the Tracer window. For this example, assume that the Tracer window is open and contains information.

; wipeTracer::pushButton
method pushButton(var eventInfo Event)
tracerClear()                     ; clear the Tracer window
endMethod


See Also for System::tracerClear
See Also

tracerHide

tracerOff

tracerOn

tracerSave

tracerShow

tracerToTop

tracerWrite


System::tracerHide
tracerHide

See Also	Example	System Type

Procedure

Hides the Tracer window.

Syntax

tracerHide ( )

Description

tracerHide makes the Tracer window invisible, but it does not clear or close the Tracer window. To make the Tracer window visible again, use tracerShow.


Example for System::tracerHide
tracerHide Example

The following code hides the Tracer window, pauses, then displays it again. For this example, assume that the Tracer window is already open.

; toggleTracerWin::pushButton
method pushButton(var eventInfo Event)
tracerHide()                     ; make the Tracer window invisible
message("Hiding Tracer window. Pausing...")
sleep(2000)
message("Showing Tracer window.")
tracerShow()                     ; make the Tracer window visible again
tracerToTop()                    ; bring it to the top
endMethod


See Also for System::tracerHide
See Also

tracerClear

tracerOff

tracerOn

tracerSave

tracerShow

tracerToTop

tracerWrite


System::tracerOff
tracerOff

See Also	Example	System Type

Procedure

Closes the Tracer window.

Syntax

tracerOff ( )

Description

tracerOff stops writing code traces to the Tracer window. You can resume tracing code with the tracerOn procedure. Tracing is on by default when the Tracer window is first opened.


Example for System::tracerOff
tracerOff Example

This code turns off code tracing.

; stopTracer::pushButton
method pushButton(var eventInfo Event)
tracerOff()                     ; close the Tracer window
endMethod


See Also for System::tracerOff
See Also

tracerClear

tracerHide

tracerOn

tracerSave

tracerShow

tracerToTop

tracerWrite


System::tracerOn
tracerOn

See Also	Example	System Type

Procedure

Activates code tracing.

Syntax

tracerOn ( )

Description

tracerOn resumes writing code traces to the Tracer window.


Example for System::tracerOn
tracerOn Example

The following example reactivates code tracing.

; startTracer::pushButton
method pushButton(var eventInfo Event)
tracerOn()                     ; reactivate the Tracer window
endMethod


See Also for System::tracerOn
See Also

tracerClear

tracerHide

tracerOff

tracerSave

tracerShow

tracerToTop

tracerWrite


System::tracerSave
tracerSave

See Also	Example	System Type

Procedure

Saves the contents of the Tracer window to a file.

Syntax

tracerSave ( const fileName String )

Description

tracerSave saves the contents of the Tracer window to fileName.


Example for System::tracerSave
tracerSave Example

The following example saves the contents of the Tracer window to a file named MYTRACE.TXT.

; saveTracerToFile::pushButton
method pushButton(var eventInfo Event)
tracerSave("mytrace.txt")         ; save the Tracer window to a file
endMethod


See Also for System::tracerSave
See Also

tracerClear

tracerHide

tracerOff

tracerOn

tracerShow

tracerToTop

tracerWrite


System::tracerShow
tracerShow

See Also	Example	System Type

Procedure

Makes the Tracer window visible.

Syntax

tracerShow ( )

Description

tracerShow makes the Tracer window visible. You can make the Tracer window invisible with the tracerHide procedure.


Example for System::tracerShow
tracerShow Example

See the example for tracerHide.


See Also for System::tracerShow
See Also

tracerClear

tracerHide

tracerOff

tracerOn

tracerSave

tracerToTop

tracerWrite


System::tracerToTop
tracerToTop

See Also	Example	System Type

Procedure

Makes the Tracer window the topmost window.

Syntax

tracerToTop ( )

Description

tracerToTop brings the Tracer window to the top of the desktop.


Example for System::tracerToTop
tracerToTop Example

See the example for tracerWrite.


See Also for System::tracerToTop
See Also

tracerClear

tracerHide

tracerOff

tracerOn

tracerSave

tracerShow

tracerWrite


System::tracerWrite
tracerWrite

See Also	Example	System Type

Procedure

Writes a message to the Tracer window.

Syntax

tracerWrite (const message String [ , const message String ]* )

Description

tracerWrite writes a message to the Tracer window.


Example for System::tracerWrite
tracerWrite Example

The following code logs a message to the Tracer window, then brings the Tracer window to the top layer of the desktop.

; logTracerMsg::pushButton
method pushButton(var eventInfo Event)
tracerWrite("Tracer hit by " + String(self.Name) +
            " at " + String(time()))              ; log a message
tracerToTop()            ; make the Tracer window the top-layer window
endMethod


See Also for System::tracerWrite
See Also

tracerClear

tracerHide

tracerOff

tracerOn

tracerSave

tracerShow

tracerToTop


System::twipsToPixels
twipsToPixels

See Also	Example	System Type

Procedure

Converts screen coordinates from twips to pixels.

Syntax

twipsToPixels ( const twips Point ) Point

Description

twipsToPixels converts the screen coordinates specified in twips from twips to pixels. A pixel (the name comes from picture element) is a dot on the screen; the number of pixels per inch is device-dependent. A twip is a device-independent unit equal to 1/1440 of an inch (1/20 of a printer's point).


Example for System::twipsToPixels
twipsToPixels Example

See the example for pixelsToTwips.


See Also for System::twipsToPixels
See Also

pixelsToTwips


System::version
version

See Also	Example	System Type

Procedure

Returns the Paradox version number.

Syntax

version ( ) String

Description

version returns a string containing the version number of Paradox currently being used.


Example for System::version
version Example

In the following example, the pushButton method for showVersion tells the user which Paradox version is in use.

; showVersion::pushButton

method pushButton(var eventInfo Event)

msgInfo("FYI", "You are running version " + version() + ".")

endMethod


See Also for System::version
See Also

sysInfo


System::winGetMessageID
winGetMessageID

See Also	Example	System Type

Procedure

Returns the ID of a Windows message.

Syntax

winGetMessageID ( const msgName String ) SmallInt

Description

winGetMessageID returns the integer value of the Windows message represented by the string specified in msgName. Some often-used messages are WM_CLOSE (sent as a signal that a window or application should terminate) and WM_ACTIVATE (sent when a window is activated or deactivated).

If msgName is not recognized as a Windows message, this method returns 0. Windows, not Paradox, determines which values of msgName are recognized. See your Windows programming documentation for more information. This method should only be used by Windows programmers who understand how to work with Windows messages.


Example for System::winGetMessageID
winGetMessageID Example

The following example calls winGetMessageID to display the integer value of the Windows message WM_LBUTTONDOWN.

method pushButton(var eventInfo event)
  var
    smMsgID	SmallInt
    stMsgName	String
  endVar

  stMsgName = "WM_LBUTTONDOWN"
  smMsgID = winGetMessageID(stMsgName)
  smMsgID.view(stMsgName) ; Displays 513 in Windows 3.1.
  ; The value may be different in other versions of Windows.
endMethod


See Also for System::winGetMessageID
See Also

winPostMessage

winSendMessage

MenuEvent::data

MenuEvent::id

Form::windowClientHandle

Form::windowHandle


System::winPostMessage
winPostMessage

See Also	Example	System Type

Procedure

Posts a message to Windows.

Syntax

winPostMessage ( const hWnd SmallInt, const msg SmallInt, const wParam SmallInt, const lParam LongInt ) LongInt

Description

winPostMessage posts a message to Windows. Unlike winSendMessage, which dispatches the message immediately, this method adds the message to the end of the Windows message queue, and it is dispatched after the messages (if any) ahead of it.

Valid arguments to this method are determined by Windows, not by Paradox. See your Windows programming documentation for more information. This method should only be used by Windows programmers who understand how to work with Windows messages.


Example for System::winPostMessage
winPostMessage Example

See the example for winSendMessage.


See Also for System::winPostMessage
See Also

winGetMessageID

winSendMessage

MenuEvent::data

MenuEvent::id

Form::windowClientHandle

Form::windowHandle


System::winSendMessage
winSendMessage

See Also	Example	System Type

Procedure

Sends a message to Windows.

Syntax

winSendMessage ( const hWnd SmallInt, const msg SmallInt, const  wParam SmallInt, const lParam LongInt ) LongInt

Description

winSendMessage sends a message to Windows. Valid arguments to this method are determined by Windows, not by Paradox. See your Windows programming documentation for more information. This method should only be used by Windows programmers who understand how to work with Windows messages.


Example for System::winSendMessage
winSendMessage Example

The following example uses winSendMessage to send a command to NOTEPAD.EXE, a text editor that comes with Windows. First, the code opens Notepad and calls enumWindowNames to create a table of data about windows currently open in the user's system. Then it searches that table for the record of information about Notepad and gets the handle for that window. Next, it calls winGetMessageID to get the integer value of the command represented by the string "WM_CLOSE" and calls winSendMessage with the window handle and the command value as arguments. The message is dispateched to Windows, and Notepad closes. (You could call winPostMessage instead of winSendMessage to add the message to the end of the Windows message queue.)

method pushButton(var eventInfo Event)
  var
    tcOpenWin	TCursor
    tbOpenWin	Table
    stTbName	String
    siWinHandle,
    siWinMsgID	SmallInt
  endVar

  stTbName = ":PRIV:openWin"

  execute("Notepad.exe", No, ExeShowNormal)           ; Run Notepad.
  sleep(1000)                  ;  Pause so you can see what happens.

  enumWindowNames(stTbName)                     ; List open windows.

  tcOpenWin.open(stTbName)
  ; Locate the Notepad window in the list of names.

  if tcOpenWin.locatePattern("WindowName", "Notepad..") then
    ; Get the Windows handle for the Notepad window.

    siWinHandle = tcOpenWin."Handle"
    ; Get the Windows message ID for WM_CLOSE to close the window.

    siWinMsgID = winGetMessageId("WM_CLOSE")
    ; Send the specified message to the specified window.

    winSendMessage(siWinHandle, siWinMsgID, 0, 0)
  else
    errorShow()
  endIf
endmethod


See Also for System::winSendMessage
See Also

winGetMessageID

winPostMessage

MenuEvent::data

MenuEvent::id

Form::windowClientHandle

Form::windowHandle


System::writeEnvironmentString
writeEnvironmentString

See Also	Example	System Type

Procedure

Writes information to the DOS environment.

Syntax

writeEnvironmentString ( const key String, const value String ) Logical

Description

writeEnvironmentString sets a DOS environment variable. Environment variables are assigned values using the DOS command SET. They control how DOS and some batch files and programs appear and work. Commonly used environment variables include PATH, PROMPT, and COMSPEC. For more information, consult your DOS manuals, especially the SET command.


Example for System::writeEnvironmentString
writeEnvironmentString Example

See the example for readEnvironmentString.


See Also for System::writeEnvironmentString
See Also

readEnvironmentString

writeProfileString


System::writeProfileString
writeProfileString

See Also	Example	System Type

Procedure

Writes information about the user's system to a file.

Syntax

writeProfileString ( const fileName String, const section String, const key String, const value String ) Logical

Description

writeProfileString writes a value to a specified section of a file on the user's system. If you specify a file name without a path, this method searches for the file in the WINDOWS directory (not :WORK:).

Typically, you use this method to modify the user's WIN.INI file, so fileName is typically WIN.INI. A section in WIN.INI is marked by a string bounded by square brackets on a line by itself (for example, [windows]). However, omit the brackets when you specify section; that is, to specify the [windows] section, use "windows." Within a section, a string followed by =  specifies key (for example, "Beep = "), but don't include the = when you specify key. Specify value by writing a string after the equal sign (=) in the key.


Example for System::writeProfileString
writeProfileString Example

See the example for readProfileString.


See Also for System::writeProfileString
See Also

readProfileString

writeEnvironmentString

FileSystem::windowsDir


Table Type

Changes

A Table variable represents a description of a table. It is distinct from a TCursor, which is a pointer to the data, and from a table frame and a TableView, which are objects that display the data.

Using Table objects, you can add, copy, create, and index tables, do column calculations, get information about a table's structure, and more, but you can't edit records. Use a TCursor or a table frame (UIObject) for that. Some table operations require Paradox to create temporary tables. Paradox creates these tables in the private directory.

The create, index, and sort structures are basic language elements, not methods or procedures, but they're listed here because they operate on Table variables.

Methods for the Table Type

Table

add

attach

cAverage

cCount

cMax

cMin

cNpv

compact

copy

create

createIndex

cSamStd

cSamVar

cStd

cSum

cVar

delete

dropGenFilter

dropIndex

empty

enumFieldNames

enumFieldNamesInIndex

enumFieldStruct

enumIndexStruct

enumRefIntStruct

enumSecStruct

familyRights

fieldName

fieldNo

fieldType

getGenFilter

getRange

index

isAssigned

isEmpty

isEncrypted

isShared

isTable

lock

nFields

nKeyFields

nRecords

protect

reIndex

reIndexAll

rename

setExclusive

setGenFilter

setIndex

setRange

setReadOnly

showDeleted

sort

subtract

tableRights

type

unAttach

unlock

unProtect

usesIndexes


Changes to Table type methods

The following table lists new methods and methods that were changed for version 5.0.

New	Changed

createIndex	cCount

dropGenFilter	create

getGenFilter	enumFieldStruct

getRange	enumIndexStruct

setGenFilter	enumRefIntStruct

setRange	enumSecStruct

fieldType

setFilter was replaced by setRange which offers enhanced functionality and performance. Code that calls setFilter will continue to execute as before.


Table::add
add

See Also	Example	Table Type

Beginner

Method/Procedure

Adds the data in one table to another table.

Syntax

1. add ( const destTableName String ) [ const append Logical [ const update Logical ] ] ) Logical

2. add ( const destTableVar Table ) [, const append Logical [ const update Logical ] ] ) Logical

Description

add adds the data in a table to a destination table, which you can specify using a String (destTableName in syntax 1) or a Table variable (destTableVar in syntax 2). If the destination table does not exist, this method creates it. The source table and the destination table can be the same type or different types; in any case, the tables must have compatible field structures.

Arguments append and update can be True or False. When True, append adds records at the end of a non-indexed destination table, or at the appropriate place in an indexed destination table. When True, update compares records in both tables, and where key values match, replaces the data in the destination table. When both are True, records with matching key values are updated, and others are appended. These arguments are optional, but if you specify update, you must also specify append. If omitted, both are True. For example,

myTable.add(yourTable, False, True) ; specifies update
myTable.add(yourTable)              ; specifies update
and append by default

Key violations (including validity check violations), if any, are listed in KEYVIOLS.DB in the user's private directory. This method overwrites an existing KEYVIOLS.DB or creates one, if necessary. Following are some example statements.

When tables are keyed, add uses the keyed fields to determine which records to update and which to append. When the destination table is not keyed, add fails if update is True. Also, if the destination table is not keyed, the structure of the entire record in the source table ust match the record structure in the destination table.

DOS

The following procedure is provided as a convenience to DOS PAL programmers. You can use this procedure to operate on tables by specifying the table name, rather than using a variable.

Syntax

1. add ( const sourceTableName String, const destTableName String ) [ const append Logical [, const update Logical ] ] ) Logical

2. add ( const sourceTableName String, const destTableVar Table )  [ const append Logical [, const update Logical ] ] ) Logical


Example for Table::add
add Example

For the following example, the pushButton method for updateCust runs a query from an existing file, then adds records from the Answer table to the Customer table.

; updateCust::pushButton
method pushButton(var eventInfo Event)
var
  newCust Query
  ansTbl Table
  destTbl String
endVar
destTbl = "Customer.db"

newCust.readFromFile("newCust.qbe")

if newCust.executeQBE() then         ; if the query succeeds
  ansTbl.attach(":PRIV:Answer.db")

  ; attempt to add Answer.db records to Customer.db
  if isTable(destTbl) then
    if NOT ansTbl.add(destTbl) then
      errorShow()
    endif
  else
    msgStop("Error", "Can't find " + destTbl + ".")
  endif
else
  errorShow("Query failed.")
endIf

endMethod


See Also for Table::add
See Also

copy

subtract


Table::attach
attach

See Also	Example	Table Type

Beginner

Method

Associates a Table variable with a table on disk.

Syntax

1. attach ( const tableName String ) Logical

2. attach ( const tableName String, const db Database ) Logical

3. attach ( const tableName String, const tableType String ) Logical

4. attach ( const tableName String, const tableType String, const db Database ) Logical

Description

attach associates a Table variable with the table in tableName. Optional arguments tableType and db specify a table type ("Paradox" or "dBASE") and a database, respectively. If you don't specify tableType, ObjectPAL tries to determine the table type from the table name's file extension. If you don't specify db, ObjectPAL works in the default database.

This method fails if the value of tableName is not valid (for example, because the table name is invalid, or because the table name doesn't match the table type, or because of a confilct between the table name and the database name). This method returns True if successful; otherwise, it returns False.

Note:	attach does not verify that tableName is a table, or even that the file exists. Use the isTable method to verify its existence.

To free a Table variable completely, use unAttach. To associate the Table variable with another table, just use attach again; the unAttach happens automatically.


Example for Table::attach
attach Example

In the following example, the westTable Table variable is attached to Orders so that cSum can be used with that Table variable. This example uses isTable to determine whether Orders exists in the default database before performing a calculation on the table.

; getWestTotal::pushButton
method pushButton(var eventInfo Event)
var
  westTable Table
  westTotal Number
endVar

if isTable("Orders.db")      then

   ; attach to Paradox table Orders in the default database
  westTable.attach("Orders", "Paradox")
   ; get total of Total Invoice field and store result in westTotal
  westTotal = westTable.cSum("Total Invoice")
   ; display total invoices
  msgInfo("Total Invoices", westTotal)

else
  msgInfo("Status", "Can't find Orders.db table.")
endif

endMethod


See Also for Table::attach
See Also

create

unAttach


Table::cAverage
cAverage

See Also	Example	Table Type

Beginner

Method/Procedure

Returns the average value of a field (column) in a table.

Syntax

1. cAverage ( const fieldName String ) Number

2. cAverage ( const fieldNum SmallInt ) Number

Description

cAverage returns the average of values in the column of fields specified by fieldName or fieldNum. (Fields are numbered from left to right, beginning with 1.) cAverage handles blank values as specified by the blankAsZero setting for the session. This method respects the limits of restricted views set by setRange or setGenFilter.

This method tries, for the duration of the retry period, to place a write lock on the table. If a lock cannot be placed, the method fails.

DOS

The following procedure is provided as a convenience to DOS PAL programmers. You can use this procedure to operate on tables by specifying the table name, rather than using a variable.

Syntax

1. cAverage ( const tableName String, const fieldName String ) Number

2. cAverage ( const tableName String, const fieldNum SmallInt ) Number


Example for Table::cAverage
cAverage Example

The following example uses cAverage to calculate the average order size in the Orders table. This code is attached to the pushButton method for the getAvgSales button.

; getAvgSales::pushButton
method pushButton(var eventInfo Event)
var
  ordTbl   Table
  avgSales Number
endVar

ordTbl.attach("Orders.db")
avgSales = ordTbl.cAverage("Total Invoice") ; store average invoice total
                                            ; in avgSales
msgInfo("Average Order size", avgSales)     ; display avgSales in a dialog

endMethod


See Also for Table::cAverage
See Also

cCount

cMax

cMin

cSum

cStd


Table::cCount
cCount

See Also	Example	Table Type	Changes

Beginner

Method/Procedure

Returns the number of nonblank values in a field (column) of a table.

Syntax

1. cCount ( const fieldName String ) LongInt

2. cCount ( const fieldNum SmallInt ) LongInt

Description

cCount returns the number of values in the column (field) specified by fieldName or fieldNum. (Fields are numbered from left to right, beginning with 1.) cCount works for all field types. If the field is numeric, this method handles blank values as specified in the blankAsZero setting for the session. If the field is non-numeric, cCount returns the number of nonblank values in the column of fields. In version 5.0, this method was changed to return a LongInt instead of a Number.

This method respects the limits of restricted views set by setRange or setGenFilter.

This method tries, for the duration of the retry period, to place a write lock on the table. If a lock cannot be placed, the method fails.

DOS

The following procedure is provided as a convenience to DOS PAL programmers. You can use this procedure to operate on tables by specifying the table name, rather than using a variable.

Syntax

1. cCount ( const tableName String, const fieldName String ) Number

2. cCount ( const tableName String, const fieldNum SmallInt ) Number


Example for Table::cCount
cCount Example

For the following example, the pushButton method for lineItemInfo uses cAverage and cCount to perform calculations on the Qty field in LINEITEM.DB. The example attempts to place a write lock on the table so that another user on a network can not make changes to the table between the calls to cAverage and cCount. If the lock is unsuccessful, this code aborts the operation.

; lineItemInfo::pushButton
method pushButton(var eventInfo Event)
var
  lineTbl Table
  avgQty Number

  numItems LongInt
endVar
if lineTbl.attach("Lineitem.db") then
  if lineTbl.lock("Write") then           ; if write lock succeeds
    avgQty = lineTbl.cAverage("Qty")
    numItems = lineTbl.cCount(4)          ; assumes Qty is field 4
    lineTbl.unLock("Write")               ; unlock the table
    msgInfo("Average quantity",

            String(avgQty, "\nbased on ", numItems, " items."))
  else
    errorShow("Can't lock Lineitem table.")
  endif
else
  errorShow("Can't attach to Lineitem table.")
endif

endMethod


See Also for Table::cCount
See Also

cAverage

cMax

cMin

cStd

cSum


Changes to Table::cCount

In version 5.0, this method was changed to return a LongInt instead of a Number.


Table::cMax
cMax

See Also	Example	Table Type

Beginner

Method/Procedure

Returns the maximum value of a field (column) in a table.

Syntax

1. cMax ( const fieldName String ) Number

2. cMax ( const fieldNum SmallInt ) Number

Description

cMax returns the maximum value in the column of fields specified by fieldName or fieldNum. (Fields are numbered from left to right, beginning with 1.) cMax respects the limits of restricted views set by setRange or setGenFilter. cMax handles blank values as specified in the blankAsZero setting for the session.

This method tries, for the duration of the retry period, to place a write lock on the table. If a lock cannot be placed, the method fails.

DOS

The following procedure is provided as a convenience to DOS PAL programmers. You can use this procedure to operate on tables by specifying the table name, rather than using a variable.

Syntax

1. cMax ( const tableName String, const fieldName String ) Number

2. cMax ( const tableName String, const fieldNum SmallInt ) Number


Example for Table::cMax
cMax Example

The following code displays the greatest amount in the Total Invoice field of the Orders table.

; showMaxOrder::pushButton
method pushButton(var eventInfo Event)
var
  orderTbl Table
endVar

if orderTbl.attach("Orders.db") then
  ; display maximum order in a dialog box
  msgInfo("Biggest Order in History", orderTbl.cMax("Total Invoice"))
else
  msgStop("Sorry", "Can't open Orders table.")
endif

endMethod


See Also for Table::cMax
See Also

cAverage

cMin

cStd

cSum

cCount


Table::cMin
cMin

See Also	Example	Table Type

Beginner

Method/Procedure

Returns the minimum value of a field (column) in a table.

Syntax

1. cMin ( const fieldName String ) Number

2. cMin ( const fieldNum SmallInt ) Number

Description

cMin returns the minimum value in the column of fields specified by fieldName or fieldNum. (Fields are numbered from left to right, beginning with 1.) This method respects the limits of restricted views set by setRange or setGenFilter. cMin handles blank values as specified in the blankAsZero setting for the session.

This method tries, for the duration of the retry period, to place a write lock on the table. If a lock cannot be placed, the method fails.

DOS

The following procedure is provided as a convenience to DOS PAL programmers. You can use this procedure to operate on tables by specifying the table name, rather than using a variable.

Syntax

1. cMin ( const tableName String, const fieldName String ) Number

2. cMin ( const tableName String, const fieldNum SmallInt ) Number


Example for Table::cMin
cMin Example

The following code displays the smallest amount in the Total Invoice field of the Orders table.

; showMinOrder::pushButton
method pushButton(var eventInfo Event)
var
  orderTbl Table
endVar

if orderTbl.attach("Orders.db") then
    ; display smallest order in a dialog box
    msgInfo("Smallest Order in History", orderTbl.cMin("Total Invoice"))

else
  msgStop("Sorry", "Can't open Orders table.")
endif

endMethod


See Also for Table::cMin
See Also

cAverage

cCount

cStd

cSum

cMax


Table::cNpv
cNpv

See Also	Example	Table Type

Beginner

Method/Procedure

Returns the net present value of a field (column), based on a specified discount or interest rate.

Syntax

1. cNpv ( const fieldName String, const discRate AnyType ) Number

2. cNpv ( const fieldNum SmallInt, const discRate AnyType ) Number

Description

cNpv returns the net present value of the column of fields specified by fieldName or fieldNum. (Fields are numbered from left to right, beginning with 1.) This method respects the limits of restricted views set by setRange or setGenFilter. cNpv handles blank values as specified in the blankAsZero setting for the session.

The calculation is based on discRate, expressed as a decimal (for example, 0.12 for 12 percent). This method calculates net present value using the following formula:

cNpv = sum(p = 1 to n) of Vp / (1 + r)p

where

n = number of periods, Vp = cash flow in pth period, and r = rate per period.

This method tries, for the duration of the retry period, to place a write lock on the table. If a lock cannot be placed, the method fails.

DOS

The following procedure is provided as a convenience to DOS PAL programmers. You can use this procedure to operate on tables by specifying the table name, rather than using a variable.

Syntax

1. cNpv ( const tableName String, const fieldName String, const discRate AnyType ) Number

2. cNpv ( const tableName String, const fieldNum SmallInt, 	const discRate AnyType ) Number


Example for Table::cNpv
cNpv Example

The following defines a Table variable for the GoodFund table, then calculates the net present value for the Expected Return field. For this example, the net present value is calculated based on a monthly interest rate.

; calcNPV::pushButton
method pushButton(var eventInfo Event)
var
  tbl Table
  goodFundNPV, apr Number
endVar
apr = .125                     ; annual percentage rate

tbl.attach("GoodFund.db")

; calculate net present value based on monthly interest rate
goodFundNPV = tbl.cNpv("Expected Return", (apr / 12))
msgInfo("Net present value", goodFundNPV)

endMethod


See Also for Table::cNpv
See Also

cAverage

cMax

cMin

cSum

cVar


Table::compact
compact

See Also	Example	Table Type

Beginner

Method

Removes deleted records from a table.

Syntax

compact ( [ const regIndex Logical ] ) Logical

Description

Deleted records are not immediately removed from a dBASE table. Instead, they are flagged as deleted and kept in the table. compact removes deleted records. The optional argument regIndex specifies whether to regenerate indexes associated with the table, or just to update them. When regIndex is True, this method regenerates all indexes associated with the table: indexes specified by usesIndexes, and the .MDX index whose name matches the table name. When regIndex is False, indexes are not regenerated. If omitted, regIndex is True by default.

When records are deleted from a Paradox table, they can no longer be retrieved; they are permanently deleted. However the table file (and associated index files) contain "dead" space where the record was originally stored. compact removes dead space from Paradox files. When you use compact with a Paradox table, the regIndex argument is ignored: indexes are always regenerated.

This method fails if any locks have been placed on the table, or the table is open. This method returns True if successful; otherwise, it returns False.


Example for Table::compact
compact Example

The following example demonstrates how compact affects indexes specified by usesIndexes. In this example, the ordTbl Table variable is attached to ORDERS.DBF and salesTbl is attached to SALES.DBF. Because ordTbl uses INDEX1.NDX and INDEX2.NDX (specified by usesIndexes), compact regenerates INDEX1.NDX and INDEX2.NDX if regIndex is True. For this example, regIndex is set to False, so compact affects only ORDERS.NDX.

; compactTbls::pushButton
method pushButton(var eventInfo Event)
var
  ordTbl, salesTbl Table
endVar

ordTbl.usesIndexes("index1.ndx", "index2.ndx")
ordTbl.attach("Orders.dbf")
ordTbl.compact(False)
  ; removes deleted records and fixes Orders.mdx

salesTbl.usesIndexes("index3.mdx")
salesTbl.attach("Sales.dbf")
salesTbl.compact()
  ; removes deleted records and regenerates all indexes

endMethod


See Also for Table::compact
See Also

showDeleted

usesIndexes


Table::copy
copy

See Also	Example	Table Type

Beginner

Method/Procedure

Copies a table.

Syntax

1. copy ( const destTable String ) Logical

2. copy ( const destTable Table ) Logical

Description

copy copies the records from a source table to a destination table specified in destTable. The data from the source table completely replaces the data in destination table. The source table and destination table can be different types of tables. If the destination table is open, the method fails.

This method tries, for the duration of the retry period, to place a write lock on the source table, and a full (exclusive) lock on the destination table. If either lock cannot be placed, the method fails.

DOS

The following procedure is provided as a convenience to DOS PAL programmers. You can use this procedure to operate on tables by specifying the table name, rather than using a variable.

Syntax

1. copy ( const sourceTable String, const destTable String ) Logical

2. copy ( const sourceTable String, const destTable Table ) Logical


Example for Table::copy
copy Example

For the following example, the pushButton method for backupCust copies the Customer table to CustBak. If CustBak already exists in the current directory, this method asks the user for confirmation before overwriting it.

; backupCust::pushButton
method pushButton(var eventInfo Event)
var
  srcTbl  Table
  destTbl String
endVar
destTbl = "CustBak.db"
srcTbl.attach("Customer.db")

if isTable(destTbl) then      ; if "CustBak.db" exists
                              ; ask for confirmation
  if msgQuestion("Copy table", "Overwrite " + destTbl + "?")  "Yes" then
    return
  endif
endif
srcTbl.copy(destTbl)    ; this copies Customer.db to CustBak.db
; Does not copy .VAL file if all it contains is RI information.
endMethod


See Also for Table::copy
See Also

add

subtract

rename

Paradox Help: Copying to a Different Table Type


Table::create
create

See Also	Example1	Example2	Table Type	Changes

Keyword

Creates a table.

Syntax

create tableName [ as tableType ] [ database db ]

    [ [ like likeObject ]

      [ with fieldName : type [, fieldName : type ] * ]

      [ where fieldID is newname [, fieldID is newname ] * ]

      [ without fieldID [, fieldID ] * ]

      [ struct fieldStructTable ]

      [ indexStruct indexStructTable ]

      [ refIntStruct refIntStructTable ]

      [ secStruct secStructTable ]

      [ languageDriver driverName ]

      [ versionLevel versionNumber ]

      ] *

    [ key fieldID [, fieldID ] * ]

endCreate

Description

create creates a table, where tableName is the file name of the table to create. Unless an as clause explicitly specifies a table type (see below), create infers the table type from the tableName extension, if given. (.DB is a Paradox table and .DBF is a dBASE table.) For example, given "Orders.dbf" for tableName, create creates a dBASE table. If tableName does not include an extension, create creates a Paradox table.

If tableName exists, create tries, for the duration of the retry period, to place a full (exclusive) lock on tableName. If the lock cannot be placed, create fails.

The following clauses specify table attributes. They are optional, and can appear in any order within the create structure. The clauses are executed in the order they appear in the structure.

As tableType specifies the table format. Example:

AS "Paradox"

If as is omitted, create creates a Paradox table by default (unless the table resides on a SQL server. See the discussion of the database clause, below).

database db specifies a database variable (opened before creating the new table) that determines where the table will reside. If the database is on an SQL server, the table will be of a type appropriate for the server. If omitted, the table is created in the default database. For example:

DATABASE megaData

like likeObject specifies an opened TCursor, table name, or Table variable from which to borrow field names, field types, language driver, and version level. The like clause does not borrow validity checks, primary or secondary indexes, referential integrity information, or security information. (Use struct, indexStruct, refIntStruct, and secStruct options to borrow more detailed information.)

For example:

LIKE "Sales.dbf"       ; table name as a string
LIKE ordersTC          ; a TCursor variable pointing to ORDERS.DB
LIKE ordersTB          ; a Table variable pointing to ORDERS.DB

with "fieldName" : "type" adds one or more fields to the table structure. For example:

with "Last name" : "A20", "First name" : "A15", "Quantity" : "N"

Specify in type the field type for fieldName. Valid values for type vary depending on the type of table you are creating. The following tables list valid field specifications for Paradox and dBASE tables.

Paradox tables	3.5 and earlier	4.5	5.0

Alpha	Annn	Annn	Annn

Number	N	N   	N

Money	$	$   	$

Date	D	D   	D

Short 	S	S   	S

Memo	(none)	Mnnn	Mnnn

Formatted memo	(none)	Fnnn	Fnnn

Binary	(none)	Bnnn	Bnnn

Graphic	(none)	Gnnn	Gnnn

OLE	(none)	Onnn	Onnn

Logical	(none)	(none)	L

Long Integer	(none)	(none)	I

Time	(none)	(none)	T

TimeStamp	(none)	(none)	@

BCD	(none)	(none)	#

Autoincrement	(none)	(none)	+

Bytes	(none)	(none)	Y

dBASE tables	III+	IV	V

Character	Cnnn	Cnnn	Cnnn

Number	Nnnn	Nnnn	Nnnn

Date	D	D   	D

Logical	L	L   	L

Memo	M	M   	M

Float	(none)	Fnnn.d	Fnnn.d

OLE	(none)	(none)	O

Binary 	(none)	(none)	B

where fieldID is "newName" changes the name of one or more fields fieldID (name or number) to "newName" (String). Example:

where "Last name" IS "Customer last name", 2 IS "Customer first name"

without fieldID removes one or more fields (specified by name or number) from the structure. Example:

without 4, "Country code"

struct specifies in fieldStructTable an opened TCursor, table name, or Table variable from which to borrow the field-level structure. Unlike the like clause, struct borrows all validity check and primary key information. Use enumFieldStruct to generate fieldStructTable (or create it manually) before executing create. For example:

struct "CustFlds.db"

indexStruct specifies in indexStructTable an opened TCursor, table name, or Table variable from which to borrow secondary index information. Use enumIndexStruct to generate indexStructTable (or create it manually) before executing create. For example:

indexStruct "CustIndx.db"

refIntStruct specifies an opened TCursor, table name, or Table variable from which to borrow referential integrity information. Use enumRefIntStruct to generate refIntStructTable (or create it manually) before executing create. For example:

refIntStruct "Cust_Ref.db"

secStruct specifies in secStructTable an opened TCursor, table name, or Table variable from which to borrow security information. Use enumSecStruct to generate secStructTable (or create your own) before executing create. For example:

secStruct "Cust_Sec.db"

Note:	When you use secStruct, Paradox automatically protects the table with the master password secret. Refer to the User's Guide for information about master passwords

languageDriver (added in version 5.0) specifies in driverName the internal name of a language driver to use with the table. A language driver determines the table's sort order and available character set. Choose an item below to display a list of language drivers.

Language drivers for Paradox tables

Language drivers for dBASE tables

versionLevel (added in version 5.0) specifies in versionNumber what level of table to create. Valid values for versionNumber are listed in the following table.

Table type	Version number

Paradox	 3 specifies a level 3 table corresponding to that created for Paradox 3.5 and earlier (Paradox Engine version 2).
  4 specifies a level 4 table corresponding to Paradox for Windows 4.5 and earlier and Paradox for DOS 4.0 and 4.5 (Paradox Engine version 3).
  5 specifies a level 5 table corresponding to Paradox for Windows 5.0.

dBASE	  3 specifies a dBASE III table.
  4 specifies a dBASE IV table.
  5 specifies a dBASE for Windows table.

key fieldID specifies one or more key fields. You must specify key fields in order from left to right. For example:

key "Last name", "First name"

Fields are created in the order you specify them, whether explicitly using a with clause, or as implied by one or more like clauses. where and without clauses have no meaning unless preceded by a like clause.

Note:	create is not a method, so dot notation, as in the following statement, is inappropriate:

tableVar.create() ; This is inappropriate.

Instead, use = to assign the create structure to a Table variable.


Example 1 for Table::create
create Example 1

The following example creates the Paradox table PARTS.DB. The table has three fields: Part number, Part name, and Quantity. It has one key field: Part number.

; createParts::pushButton
method pushButton(var eventInfo Event)
var
  newParts Table
  partsTV TableView
endVar
if isTable("Parts.db") then
  if msgQuestion("Confirm",

                 "Parts.db exists. Overwrite it?") <> "Yes" then
    return
  endIf
endIf

newParts = create "Parts.db"
             WITH "Part number" : "A20",

                  "Part name" : "A20",

                  "Quantity" : "S"
             KEY "Part number"
           endCreate

partsTV.open("Parts.db")      ; Open the new table.
endMethod


Example 2 for Table::create
create Example 2

The following examples show two ways to create the dBASE table NEWSALES.DBF using the same structure as the dBASE table SALES.DBF.

; version 1
var
  newSales Table
endVar
newSales = CREATE "Newsales.dbf"
             LIKE "Sales.dbf"
           ENDCREATE

; version 2
var
  newSales Table
  salesTC TCursor
endVar
salesTC.open("Sales.dbf")
newSales = CREATE
             LIKE salesTC
           ENDCREATE

The next example uses the struct option to borrow field-level information, including primary keys and validity checks, for use in a new table. (See enumFieldStruct for more information.)

; makeNewCust::pushButton
method pushButton(var eventInfo Event)
var
  custTbl, newCustTbl Table
  custTC TCursor
endVar

custTbl.attach("Customer.db")
if custTbl.isTable() then

  if custTbl.enumFieldStruct("CustFlds.db") then

    ; Open a TCursor for CustFlds table.
    custTC.open("CustFlds.db")
    custTC.edit()

    ; This loop scans through the CustFlds table and
    ; changes ValCheck definitions for every field.
    scan custTC :
      custTC."_Required Value" = 1   ; Make all fields required.
    endScan

    ; Now create NEWCUST.DB and borrow field names,
    ; ValChecks and key fields from CUSTFLDS.DB.
    newCustTbl = CREATE "NewCust.db"
                   STRUCT "CustFlds.db"
                 ENDCREATE

    ; NEWCUST.DB requires that all fields be filled

  else
    msgStop("Error", "Can't get field structure for Customer table.")
  endIf

else
  msgStop("Error", "Can't find Customer table.")
endIf

endMethod


See Also for Table::create
See Also

copy

enumFieldStruct

enumIndexStruct

enumRefIntStruct

enumSecStruct


Changes to Table::create

languageDriver (added in version 5.0) specifies in driverName the internal name of a language driver to use with the table. A language driver determines the table's sort order and available character set.

versionLevel (added in version 5.0) specifies in versionNumber what level of table to create.


Language drivers for Paradox tables

The following table shows the language drivers you can use for Paradox tables, along with the code page for each driver. Use the internal name to specify driverName.

Note:	Internal language driver names are case-sensitive.

Driver name	Internal	Language/DOS Code Page

Paradox ANSI China	ANCHINA	Chinese

Paradox ANSI Czech	ANCZECH	Czech

Paradox ANSI Greek	ANGREEK1	Greek

Paradox ANSI Korea	ANKOREA	Korean

Paradox ANSI Polish	ANPOLISH	Polish

Paradox ANSI Taiwan	ANTAIWAN	Taiwanese

Paradox ANSI 'turk'	ANTURK	Turkish

Paradox 'ascii'	ASCII	English (US)/437

Paradox China 437	CHINA	Chinese/437

Paradox Cyrr 866	CYRR	Russian/866

Paradox Czech 852	CZECH	Czech/852

Paradox Czech 867	CSKAMEN	Czech/867

Paradox ESP 437	SPANISH	Spanish/437

Paradox Greek GR437	GRCP437	Greek/437

Paradox Hun 852 DC	HUN852DC	Hungarian/852

Paradox 'intl'	INTL	International/437

Paradox 'intl850'	INTL850	International/850

Paradox ISL 861	ICELAND	Iceland/861

Paradox Korea 949	KOREA	Korean/949

Paradox NORDAN	NORDAN	Danish-Norwegian/865

Paradox NORDAN40	NORDAN40	Danish-Norwegian/865

Paradox Polish 852	POLISH	Polish/852

Paradox Slovene 852	SLOVENE	Yugoslavia/852

Paradox SWEDFIN	SWEDFIN	Swedish-Finnish/437

Paradox Taiwan	TAIWAN	Taiwanese/437

Paradox 'turk'	TURK	Turkish

Pdox ANSI Slovene	ANSISLOV	Yugoslavia

Pdox Hun ANSI DC	ANHUNDC	Hungarian

Pdx ANSI Cyrillic	ANCYRR	Russian


Language drivers for dBASE tables

The following table shows the language drivers you can use for dBASE tables. Use the internal name to specify driverName.

Note:	Internal language driver names are case-sensitive.

Driver name	Internal	Language

dBASE CHN pc437	DB437CN0	Chinese

dBASE CSY cp852	DB852CZ0	Czech

dBASE CSY cp867	DB867CZ0	Czech

dBASE DAN cp865	DB865DA0	Danish

dBASE DEU cp437	DB437DE0	German

dBASE DEU cp850	DB850DE0	German

dBASE ELL GR437	DB437GR0	Greek

dBASE ENG cp437	DB437UK0	English (U.K)

dBASE ENG cp850	DB850UK0	English (U.K)

dBASE ENU cp437	DB437US0	English (U.S.)

dBASE ENU cp850	DB850US0	English (U.S.)

dBASE ESP cp437	DB437ES1	Spanish

dBASE ESP cp850	DB850ES0	Spanish

dBASE FIN cp437	DB437FI0	Finnish

dBASE FRA cp437	DB437FR0	French

dBASE FRA cp850	DB850FR0	French

dBASE FRC cp850	DB850CF0	French (Can.)

dBASE FRC cp863	DB863CF1	French (Can.)

dBASE HUN cp852	DB852HDC	Hungarian

dBASE ITA cp437	DB437IT0	Italian

dBASE ITA cp850	DB850IT0	Italian

dBASE KOR cp949	DB949KO0	Korean

dBASE NLD cp437	DB437NL0	Dutch

dBASE NLD cp850	DB850NL0	Dutch

dBASE NOR cp437	DB437NO0	Norwegian

dBASE NOR cp865	DB865NO0	Norwegian

dBASE PLK pc852	DB852PO0	Polish

dBASE PTB cp850	DB850PT0	Portugese (Bra.)

dBASE PTG cp860	DB860PT0	Portugese

dBASE RUS cp866	DB866RU0	Russian

dBASE SLO cp852	DB852SL0	Yugoslavian

dBASE SVE cp437	DB437SV0	Swedish

dBASE SVE cp850	DB850SV0	Swedish

dBASE TRK cp857	DB857TR0	Turkish

dBASE TWN cp437	DB437TW0	Taiwanese


Table::createIndex
createIndex	5.0

See Also	Example1	Example2	Table Type

Method

Creates an index for a table.

Syntax

1. createIndex ( const attrib DynArray[] AnyType, const fieldNames Array[] String ) Logical

2. createIndex ( const attrib DynArray[] AnyType, const fieldNums Array[] SmallInt ) Logical

Description

createIndex creates an index for a table using attributes specified in the DynArray attrib and the field names (or numbers) specified in the Array fieldNames (or fieldNums). This method is provided as an alternative to the index structure, and performs the same task. It can be useful when you don't know the index structure beforehand (for example, when the information is supplied by the user).

Each key of the DynArray must be a string, and the value of each corresponding item is described in the following table. You do not have to include all the keys to use createIndex. Any key you omit is assigned the corresponding default value.

String value	Description

MAINTAINED	If True, the index is incrementally maintained. That is, after a table is changed, only that portion of the index affected by the change is updated. If False, Paradox does not maintain the index automatically. Maintained indexes typically result in better performance. Default = False (Paradox tables only).

PRIMARY	If True, the index is a primary index. If False, it's a secondary index. Default = False (Paradox tables only).

CASEINSENSITIVE	If True, the index ignores differences in case. If False, it considers case. Default = False (Paradox tables only).

DESCENDING	If True, the index is sorted in descending order, from highest values to lowest. If False, it is sorted in ascending order.
Default = False (dBASE tables only).

UNIQUE	If True, records with duplicate values in key fields are ignored. If False, duplicates are included and available. (dBASE tables only).

IndexName	A name used to identify this index. No default value, unless you're creating a secondary, case-sensitive index on a single field, in which case the default value is the field name. For dBASE tables, the index name must be a valid DOS file name. If you do not specify an extension, .NDX is added automatically.

TagName	The name of the index tag associated with the index specified in indexName (dBASE tables only).


Example 1 for Table::createIndex
createIndex Example 1

The following example builds a maintained secondary index for a Paradox table named CUSTOMER.DB. If the Customer table cannot be found, or cannot be locked, this method aborts the operation.

method pushButton(var eventInfo Event)

var

stTbName	String

tbCust	Table

arFieldNames	Array[3] String

dyAttrib	DynArray[]AnyType

endVar

stTbName = "Customer.db"

arFieldNames[1] = "Customer No"

arFieldNames[2] = "Name"

arFieldNames[3] = "Street"

dyAttrib["PRIMARY"]    = False

dyAttrib["MAINTAINED"] = True

dyAttrib["IndexName"]  = "NumberNameStreet"

if isTable(stTbName) then

  tbCust.attach(stTbName)

if not tbCust.lock("FULL") then

errorShow()

return

endIf

if not tbCust.createIndex(dyAttrib, arFieldNames) then

errorShow()

endIf

; This createIndex statement has the same effect

; as the following INDEX structure:

{

  INDEX tbCust                  ; Create index for Customer.db.

  MAINTAINED

    ON "Customer No", "Name", "Street"

  ENDINDEX

}

else

  errorShow()

endIf

endMethod


Example 2 for Table::createIndex
createIndex Example 2

The following example adds a unique index tag named StatProv to the production index for the dBASE table CUSTOMER.DBF.

method pushButton(var eventInfo Event)

var

tbCust	Table

arFieldNames	Array[1] String

dyAttrib	DynArray[]AnyType

endVar

arFieldNames[1] = "STATE_PROV"

dyAttrib["UNIQUE"]     = True

dyAttrib["MAINTAINED"] = True

; A dBASE index name must be a valid DOS file name.

; If an extension is omitted, .NDX is appended automatically.

dyAttrib["IndexName"] = "Customer.Mdx"

dyAttrib["TagName"] = "StatProv"

if isTable("Customer.dbf") then

  tbCust.attach("Customer.dbf")

  if not tbCust.createIndex(dyAttrib, arFieldNames) then

    	errorShow()

  endIf

; This createIndex statement has the same effect

; as the following INDEX structure:

{

  INDEX tbCust                        ; Create index for Customer.dbf.

 UNIQUE

    ON "STATE_PROV"                   ; Index on this field.

    TAG "StatProv" OF "Customer.dbf"  ; Name the tag "StatProv".

  ENDINDEX

}

else

  errorShow()

endIf

endMethod


See Also for Table::createIndex
See Also

Paradox Help: Indexes

dropIndex

index

setIndex

usesIndexes


Table::cSamStd
cSamStd

See Also	Example	Table Type

Beginner

Method/Procedure

Returns the sample standard deviation of a field (column) of a table.

Syntax

1. cSamStd ( const fieldName String ) Number

2. cSamStd ( const fieldNum SmallInt ) Number

Description

cSamStd returns the sample standard deviation for the column of numeric fields specified by fieldName or fieldNum. (Fields are numbered form left to right, beginning with 1). This method respects the limits of restricted views displayed in a linked table frame or multi-record object. cSamStd handles blank values as specified in the blankAsZero setting for the session.

The calculation is based on the sample variance. The sample (as opposed to population) standard deviation is calculated using the formula:

sqrt( (sampVar) * ( n/n-1) )

where

sampVar = cSamVar(tableName, fieldName)

n = cCount(tableName, fieldName).

This method tries, for the duration of the retry period, to place a write lock on the table. If a lock cannot be placed, the method fails.

DOS

The following procedure is provided as a convenience to DOS PAL programmers. You can use this procedure to operate on tables by specifying the table name, rather than using a variable.

Syntax

1. cSamStd ( const tableName String, const fieldName String ) Number

2. cSamStd ( const tableName String, const fieldNum SmallInt ) Number


Example for Table::cSamStd
cSamStd Example

The following example calculates the sample standard deviation of test scores for the Winter quarter. This code is attached to the pushButton method for showSamStd.

; showSamStd::pushButton
method pushButton(var eventInfo Event)
const

kTbName = "winter"

endConst

var
tbWinter	Table

nuSamStd 	Number

endVar

tbWinter.attach(kTbName)

nuSamStd = tbWinter.cSamStd("TestScore")

nuSamStd.view()

endMethod


See Also for Table::cSamStd
See Also

cSamVar

cAverage

cCount

cMax

cMin

cNpv

cSum

cVar

cStd


Table::cSamVar
cSamVar

See Also	Example	Table Type

Beginner

Method/Procedure

Returns the sample variance of a field (column) in a table.

Syntax

1. cSamVar ( const fieldName String ) Number

2. cSamVar ( const fieldNum SmallInt ) Number

Description

cSamVar returns the sample variance of the column of fields specified by fieldName or fieldNum. (Fields are numbered from left to right, beginning with 1.) This method respects the limits of restricted views set by setRange or setGenFilter. cSamVar handles blank values as specified in the blankAsZero setting for the session.

The sample (as opposed to population) variance is calculated using the formula:

cVar(tableName, fieldName) * (n/(n - 1)) where:

n = cCount(tableName, fieldName)

This method tries, for the duration of the retry period, to place a lock on the table. If a lock cannot be placed, the method fails.

DOS

The following procedure is provided as a convenience to DOS PAL programmers. You can use this procedure to operate on tables by specifying the table name, rather than using a variable.

Syntax

1. cSamVar ( const tableName String, const fieldName String ) Number

2. cSamVar ( const tableName String, const fieldNum SmallInt ) Number


Example for Table::cSamVar
cSamVar Example

The following example uses both forms of the syntax to calculate the sample variance of two different fields in the Answer table. This code is attached to the pushButton method for showSamVar.

; showSamVar::pushButton
method pushButton(var eventInfo Event)
var
   empTbl Table
   tblName String
   calcSalary, calcYears Number
endVar
tblName = "Answer"

empTbl.attach(tblName)
calcSalary = empTbl.cSamVar("Salary")  ; get sample variance for Salaries
calcYears  = empTbl.cSamVar(2)         ; assume "Years in service" is field 2
msgInfo("Sample Variance",             ; display info in a dialog box
        "Salaries : " + String(calcSalary,
        "\nYears in service : ", calcYears))

endMethod


See Also for Table::cSamVar
See Also

cAverage

cCount

cMax

cMin

cNpv

cSamStd

cStd

cSum

cVar


Table::cStd
cStd

See Also	Example	Table Type

Beginner

Method/Procedure

Returns the standard deviation of a field (column) in a table.

Syntax

1. cStd ( const fieldName String ) Number

2. cStd ( const fieldNum SmallInt ) Number

Description

cStd returns the population standard deviation of the column of fields specified by fieldName or fieldNum. (Fields are numbered from left to right, beginning with 1.) This method respects the limits of restricted views set by setRange or setGenFilter. The calculation is based on the variance; see cVar. This method handles blank values as specified in the blankAsZero setting for the session.

This method tries, for the duration of the retry period, to place a write lock on the table. If a lock cannot be placed, the method fails.

DOS

The following procedure is provided as a convenience to DOS PAL programmers. You can use this procedure to operate on tables by specifying the table name, rather than using a variable.

Syntax

1. cStd ( const tableName String, const fieldName String ) Number

2. cStd ( const tableName String, const fieldNum SmallInt ) 	Number


Example for Table::cStd
cStd Example

For the following example, the pushButton method for thisButton calculates the population standard deviation for two separate fields and displays the results in a dialog box.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  myTable Table
  test1, test2 Number
endVar
myTable.attach("scores.db")
test1 = myTable.cStd("Test1")
test2 = myTable.cStd(2)         ; assumes Test2 is field 2
msgInfo("Standard Deviation",
        "Test1 results : " + String(test1) + "\n" +
        "Test2 results : " + String(test2))
endMethod


See Also for Table::cStd
See Also

cSamStd

cSamVar

cSum

cAverage

cCount

cMax

cMin

cNpv

cVar


Table::cSum
cSum

See Also	Example	Table Type

Beginner

Method/Procedure

Returns the sum of the values in a field (column) of a table.

Syntax

1. cSum ( const fieldName String ) Number

2. cSum ( const fieldNum SmallInt ) Number

Description

cSum returns the sum of the values in the column of fields specified by fieldName or fieldNum. (Fields are numbered from left to right, beginning with 1.) This method respects the limits of restricted views set by setRange or setGenFilter. cSum handles blank values as specified in the blankAsZero setting for the session.

This method tries, for the duration of the retry period, to place a write lock on the table. If a lock cannot be placed, the method fails.

DOS

The following procedure is provided as a convenience to DOS PAL programmers. You can use this procedure to operate on tables by specifying the table name, rather than using a variable.

Syntax

1. cSum ( const tableName String, const fieldName String ) Number

2. cSum ( const tableName String, const fieldNum SmallInt ) Number


Example for Table::cSum
cSum Example

For the following example, the pushButton method for sumOrders uses both forms of cSum syntax to calculate totals for two fields in ORDERS.DB.

; sumOrders::pushButton
method pushButton(var eventInfo Event)
var
  orderTbl Table
  orderTotal, amtPaid Number
  tblName String
endVar
tblName = "Orders"

orderTbl.attach(tblName)
orderTotal = orderTbl.cSum("Total Invoice")
amtPaid    = orderTbl.cSum(7)    ; assumes Amount Paid is field 7
msgInfo("Order Totals",
        "Total Orders : " + String(orderTotal) + "\n" +
        "Total Receipts : " + String(amtPaid))

endMethod


See Also for Table::cSum
See Also

cAverage

cCount

cMax

cMin

cNpv

cSamStd

cSamVar

cStd

cVar


Table::cVar
cVar

See Also	Example	Table Type

Beginner

Method/Procedure

Returns the variance of a field in a table.

Syntax

1. cVar ( const fieldName String ) Number

2. cVar ( const fieldNum SmallInt ) Number

Description

cVar returns the population variance of the column of fields specified by fieldName or fieldNum. (Fields are numbered from left to right, beginning with 1.) This method respects the limits of restricted views set by setRange or setGenFilter. cVar handles blank values as specified in the blankAsZero setting for the session.

This method tries, for the duration of the retry period, to place a write lock on the table. If a lock cannot be placed, the method fails.

DOS

The following procedure is provided as a convenience to DOS PAL programmers. You can use this procedure to operate on tables by specifying the table name, rather than using a variable.

Syntax

1. cVar ( const tableName String, const fieldName String ) Number

2. cVar ( const tableName String, const fieldNum SmallInt ) Number


Example for Table::cVar
cVar Example

For the following example, the pushButton method for thisButton calculates the population variance deviation for two separate fields and displays the results in a dialog box.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  myTable Table
  test1, test2 Number
endVar
myTable.attach("scores.db")
test1 = myTable.cVar("Test1")
test2 = myTable.cVar(2)       ; assumes Test2 is field 2
msgInfo("Population Variance",
        "Test1 results : " + String(test1) + "\n" +
        "Test2 results : " + String(test2))

endMethod


See Also for Table::cVar
See Also

cAverage

cCount

cMax

cMin

cNpv

cSamVar

cSamStd

cSum


Table::delete
delete

See Also	Example	Table Type

Beginner

Method/Procedure

Deletes a table.

Syntax

delete ( ) Logical

Description

delete deletes a table without asking for confirmation. Compare this method to empty, which removes data from a table but does not delete it.

This method fails if the table is open or is locked.

DOS

The following procedure is provided as a convenience to DOS PAL programmers. You can use this procedure to operate on tables by specifying the table name, rather than using a variable.

Syntax

delete ( const tableName String ) Logical


Example for Table::delete
delete Example

The following code deletes ANSWER.DB from the private directory if it exists.

; delAnswer::pushButton
method pushButton(var eventInfo Event)
var
  tbl Table
  tblName String
endVar

tblName = privDir() + "\\Answer.db"

tbl.attach(tblName)
if tbl.isTable() then
  tbl.delete()
  message(tblName, " deleted.")
else
  message("Can't find ", tblName, ".")
endif

endMethod


See Also for Table::delete
See Also

empty


Table::dropGenFilter
dropGenFilter	5.0

See Also	Example	Table Type

Method

Drops (removes) the filter criteria associated with a Table variable.

Syntax

dropGenFilter ( ) Logical

Description

dropGenFilter drops (removes) the filter criteria associated with a Table variable, leaving it unfiltered. Indexes and ranges (if any) remain in effect.


Example for Table::dropGenFilter
dropGenFilter Example

In the following example, a form contains a button called btnCACustomers. The pushButton method for btnCACustomers attaches a Table variable to the Customer table, sets a filter criteria, and stores the value in the number variable nSubTotal. Then dropGenFilter is used to drop the filter and the total number of records is stored into the number variable nTotal. Finally, a message information box is displayed showing the number of customers in California compared to the total number of customers.

;btnCACustomers :: pushButton

method pushButton(var eventInfo Event)

var

tbl	Table

dyn	DynArray[] AnyType

nTotal,

nSubTotal	Number

endVar

tbl.attach("CUSTOMER.DB")

dyn["State/Prov"] = "CA"

tbl.setGenFilter(dyn)

nSubTotal = tbl.cCount("State/Prov")	;Get customers in CA.

tbl.dropGenFilter()

nTotal = tbl.nRecords()	;Get all customers.

msgInfo("Customer Analysis",  string(nSubtotal) + " out of " + string(nTotal) + " reside in California.")

endMethod


See Also for Table::dropGenFilter
See Also

getGenFilter

setGenFilter

TCursor::dropGenFilter

UIObject::dropGenFilter

Using Ranges and Filters


Table::dropIndex
dropIndex

See Also	Example	Table Type

Method

Deletes an index file associated with a table.

Syntax

1. (Paradox tables) dropIndex ( const indexName String ) Logical

2. (dBASE tables) dropIndex ( const indexName String
[ , const tagName String ] ) Logical

Description

dropIndex deletes a specified index file or index tag.

When working with a Paradox table, indexName specifies a secondary index; you can specify an empty string in indexName to drop the primary index.

When working with a dBASE table, you can use indexName to specify a .NDX file, or use indexName and tagName to specify a .MDX file and an index tag.

You must obtain exclusive rights to the table (by calling the Table method setExclusive) before calling dropIndex.

dropIndex fails if the index you're trying to delete is currently being used, or if the table is open.


Example for Table::dropIndex
dropIndex Example

For the following example, the pushButton method for thisButton deletes the CustName tag from a .MDX file.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  salesTbl Table
endVar

salesTbl.attach("Sales.dbf")          ; Sales.dbf is a dBASE table
if isTable(salesTbl) then             ; if salesTbl is a table

  ; Get exclusive access to the table.
  salesTbl.setExclusive(Yes)
  ; delete CustName tag from index2.mdx file
  if salesTbl.dropIndex("index2.mdx", "CustName") then
    msgInfo("Status", "CustName index deleted.")
  else
    msgInfo("Error", "Can't drop CustName from Index2.")
  endif

else
  msgStop("Stop!", "Could not find Sales.dbf table.")
endif

endMethod


See Also for Table::dropIndex
See Also

Paradox Help: Indexes

setIndex

usesIndexes


Table::empty
empty

See Also	Example	Table Type

Beginner

Method/Procedure

Removes all records from a table in a database.

Syntax

empty ( ) Logical

Description

empty removes all records from a table without asking for confirmation. This operation cannot be undone. This method returns True if it succeeds; otherwise, it returns False.

empty removes information from the table, but does not delete the table itself. Compare this method to delete, which does delete the table. This method respects the limits of restricted views set by setRange or setGenFilter.

This method first tries to gain exclusive rights to the table. If exclusive rights are not possible, empty tries to place a write lock on the table.

If exclusive rights are possible, this method deletes all records in the table at once. If only a write lock is possible, empty must delete each record one at a time. (This can be expensive for large tables.)

If empty is able to gain exclusive rights to a dBASE table, all records are deleted and the table is compacted (records are permanently removed). If only a write lock is possible, this method flags all records as deleted, but does not remove them from the table. (Records can be undeleted from a dBASE table if they have not been removed with the compact method.)

DOS

The following procedure is provided as a convenience to DOS PAL programmers. You can use this procedure to operate on tables by specifying the table name, rather than using a variable.

Syntax

empty ( const tableName String ) Logical


Example for Table::empty
empty Example

The following example prompts the user for confirmation before deleting all records from the Scratch table.

; tblEmpty::pushButton
method pushButton(var eventInfo Event)
var
  tblName String
  tblVar Table
endVar
tblName = "Scratch.db"

tblVar.attach(tblName)
if isTable(tblName) then
  if msgQuestion("Empty?", "Empty " + tblName + " ?") = "Yes" then

    if tblVar.empty() then
      message("All " + tblName + " records have been deleted.")
    else
      errorShow()
    endIf

  endIf
else
  errorShow()
endIf
endMethod


See Also for Table::empty
See Also

delete


Table::enumFieldNames
enumFieldNames

See Also	Example	Table Type

Method

Fills an array with the names of fields in a table.

Syntax

enumFieldNames ( var fieldArray Array[ ] String ) Logical

Description

enumFieldNames fills fieldArray with the names of the fields in a table. You must declare fieldArray as a resizeable array before calling this method. If fieldArray already exists, this method overwrites it without asking for confirmation.


Example for Table::enumFieldNames
enumFieldNames Example

For the following example, the pushButton method for the btnEnumFields button stores field names in a resizeable array, then uses view to display the contents of the array.

; btnEnumFields::pushButton
method pushButton(var eventInfo Event)
var
  tbl Table
  arFieldNames Array[] AnyType
endVar

tbl.attach("Sales.dbf")
if tbl.isTable() then
  tbl.enumFieldNames(arFieldNames)
  arFieldNames.view()
else
  errorShow()
endIf

endMethod


See Also for Table::enumFieldNames
See Also

enumFieldNamesInIndex

enumFieldStruct

enumIndexStruct

enumRefIntStruct

enumSecStruct


Table::enumFieldNamesInIndex
enumFieldNamesInIndex

See Also	Example	Table Type

Method

Fills an array with the names of fields in a table's index.

Syntax

1. (Paradox tables) enumFieldNamesInIndex ( [ const indexName String, ] var fieldArray Array[ ] String ) Logical

2. (dBASE tables) enumFieldNamesInIndex  ( [ const indexName String, [ const tagName String, ] ]

var fieldArray Array[ ] String ) Logical

Description

enumFieldNamesInIndex fills fieldArray with the names of the fields in a table's index, as specified in indexName. You must declare fieldArray as a resizeable array before calling this method. If fieldArray already exists, this method overwrites it without asking for confirmation.

When working with a dBASE table, the argument tagName is required to specify an index tag within a .MDX file.

If omitted, indexName corresponds to the index currently being used.


Example for Table::enumFieldNamesInIndex
enumFieldNamesInIndex Example

For the following example, the pushButton method for the showIndexFlds button stores field names in a resizeable array, then uses view to display the contents of the array.

; showIndexFlds::pushButton
method pushButton(var eventInfo Event)
var
  tbl Table
  fieldNames Array[] String
endVar

tbl.attach("Sales.dbf")
if tbl.isTable() then
  tbl.enumFieldNamesInIndex("DateIndx", "byDate", fieldNames)
  ; display the index field names for byDate in DateIndx
  fieldNames.view()
else
  msgStop("Stop", "Couldn't find Sales.dbf.")
endIf

endMethod


See Also for Table::enumFieldNamesInIndex
See Also

Paradox Help: Indexes

enumFieldNames

enumFieldStruct

enumIndexStruct

enumRefIntStruct

enumSecStruct


Table::enumFieldStruct
enumFieldStruct

See Also	Example	Table Type	Changes

Method

Lists the field structure of a table.

Syntax

1. enumFieldStruct ( const tableName String ) Logical

2. enumFieldStruct ( inMem TCursor ) Logical

Description

enumFieldStruct lists the field structure of a Table variable. Syntax 1 creates a Paradox table; syntax 2 (added in version 5.0) stores the information in a TCursor variable.

Syntax 1 creates the Paradox table specified in tableName. If tableName exists, this method overwrites it without confirmation. You can include an alias or path in tableName; if no alias or path is specified, Paradox creates tableName in the working directory. You can supply tableName to the struct option in a create statement to borrow that table's field structure (including primary keys and validity checks) for use in the new table.

In syntax 2 (added in version 5.0), the structure information is stored in the TCursor variable inMem that you pass as an argument. Using syntax 2 may result in faster performance because the information is stored in system memory without the overhead of disk access.

The structure of the table (syntax 1) or TCursor (syntax 2) is listed in the following table:

Field Name	Field Type	Description

Field Name	A31	Name of field.

Type	A31	Data type of field.

Size	S	Size of field.

Dec	S	Number of decimal places, or 0 if field type doesn't support decimal places.

Key	A1	Is it a key field?
* = key field, blank = not key field.

_Required Value	A1	Is the field required?
T = required, N (or blank) = Not required.

_Min Value	A255	Field's minimum value, if specified; otherwise blank.

_Max Value	A255	Field's maximum value, if specified; otherwise blank.

_Default Value	A255	Field's default value, if specified; otherwise blank.

_Picture Value	A175	Field's picture, if specified; otherwise blank.

_Table Lookup	A81	Name of lookup table. Includes full path if the lookup table is not in :WORK:

_Table Lookup Type	A1	Type of lookup table.
0 (or blank) = no lookup table,
1 = Current field + private
2 = All corresponding + no help
3 = Just current field + help and field
4 = All corresponding + help

_Invariant Field ID	S	Field's ordinal position in table
(first field = 1, second field = 2, etc.)

Once tableName is created, you can modify values in the table, then use it with the struct option in the create command.


Example for Table::enumFieldStruct
enumFieldStruct Example

For the following example, assume that you want a new table called NewCust that is similar to the Customer table. However, you want all of the fields in NewCust to be required fields. To accomplish this, the following code uses enumFieldStruct to load a new table (CUSTFLDS.DB) with the field-level information from Customer. The code then scans through CustFlds and modifies the field definitions so that each record describes a field that will be required. CustFlds is then supplied in the struct clause of a create statement.

; makeNewCust::pushButton
method pushButton(var eventInfo Event)
var
  custTbl, newCustTbl Table
  custTC TCursor
endVar

custTbl.attach("Customer.db")
if custTbl.isTable() then

  if custTbl.enumFieldStruct("CustFlds.db") then

    ; Open a TCursor for CustFlds table.
    custTC.open("CustFlds.db")
    custTC.edit()

    ; This loop scans through the CustFlds table and
    ; changes ValCheck definitions for every field .
    scan custTC :
      custTC."_Required Value" = 1    ; Make all fields required.
    endScan

    ; Now create NEWCUST.DB and borrow field names,
    ; ValChecks and key fields from CUSTFLDS.DB.
    newCustTbl = CREATE "NewCust.db"
                   STRUCT "CustFlds.db"
                 endCreate

    ; NEWCUST.DB requires that all fields be filled.

  else
    msgStop("Error", "Can't get field structure for Customer table.")
  endIf

else
  msgStop("Error", "Can't find Customer table.")
endIf

endMethod


See Also for Table::enumFieldStruct
See Also

enumFieldNames

enumFieldNamesInIndex

enumIndexStruct

enumRefIntStruct

enumSecStruct


Changes to Table::enumFieldStruct

Syntax 2 (added in version 5.0) stores the information in a TCursor variable.


Table::enumIndexStruct
enumIndexStruct

See Also	Example	Table Type	Changes

Method

Lists the structure of a table's secondary indexes.

Syntax

1. enumIndexStruct ( const tableName String ) Logical

2. enumIndexStruct ( inMem TCursor ) Logical

Description

enumIndexStruct lists the structure of a table's secondary indexes. Syntax 1 creates a Paradox table; syntax 2 (added in version 5.0) stores the information in a TCursor variable.

Syntax 1 creates the Paradox table specified in tableName. For dBASE tables, this method lists the structure of the indexes associated with the table by the usesIndexes method. If tableName exists, this method overwrtes it without asking for confirmation. You can include an alias or path in tableName; if no alias or path is specified, Paradox creates tableName in the working directory. You can supply tableName to the indexStruct option in a create statement to borrow secondary indexes for use in the new table.

In syntax 2, the structure information is stored in a TCursor variable inMem that you pass as an argument. Using syntax 2 may result in faster performance, because the information is stored in system memory without the overhead of disk access.

The structure of the table (syntax 1) or TCursor (syntax 2) is listed in the following table:

Field Name	Field Type	Description

infoHeader	A1	If Y, this record is a header for (and the data it contains is shared by) subsequent consecutive records that have a value of N in this field. If N, this record is not a header.

szName	A127	Index name, including path.

szTagName	A31	Tag name, no path (dBASE only).

szFormat	A31	Optional index type, e.g., BTREE, HASH

bPrimary	A1	Y if the index is primary; otherwise blank.

bUnique	A1	Y if the index is unique; otherwise blank.

bDescending	A1	Y if the index is descending; otherwise blank.

bMaintained	A1	Y if the index is maintained; otherwise blank.

bCaseInsensitive	A1	Y if the index is not case-sensitive; otherwise blank.

bSubset	A1	Y if the index is a subset index (dBASE only); otherwise blank.

bExpIdx	A1	Y if the index is an expression index (dBASE only); otherwise blank.

iKeyExpType	N	Key type of index expression (dBASE only).

szKeyExp	A220	Key expression for expression index (dBASE only).

szKeyCond	A220	Subset condition for subset index (dBASE only).

FieldNo	N	Ordinal position of key field in table.

FieldName	A31	Name of key field.

For dBASE tables, tableName includes information for indexes which would be used if the table were open. To specify which indexes to associate to a Table variable, use the usesIndexes method, then call enumIndexStruct to create a table that list those indexes.


Example for Table::enumIndexStruct
enumIndexStruct Example

For the following example, assume that you want a new table called NewCust that is similar to the Customer table. However, you don't want to borrow referential integrity or security information. To accomplish this, the following code uses enumFieldStruct and enumIndexStruct to generate two tables: CUSTFLDS.DB and CUSTINDX.DB. CustFlds and CustIndx are then supplied to the struct and indexStruct clauses of a create statement.

; makeNewCust::pushButton
method pushButton(var eventInfo Event)
var
  custTbl, newCustTbl Table
  custTC TCursor
endVar

custTbl.attach("Customer.db")
if custTbl.isTable() then

  custTbl.enumFieldStruct("CustFlds.db")
  custTbl.enumIndexStruct("CustIndx.db")

  ; Now create NEWCUST.DB.
  ; Borrow field names, ValChecks, and key fields from CUSTFLDS.DB.
  ; Borrow secondary indexes from CUSTINDX.DB.
  newCustTbl = CREATE "NewCust.db"
                 STRUCT "CustFlds.db"
                 INDEXSTRUCT "CustIndx.db"
               ENDCREATE

else
  msgStop("Error", "Can't find Customer table.")
endIf

endMethod


See Also for Table::enumIndexStruct
See Also

Paradox Help: Indexes

enumFieldNames

enumFieldNamesInIndex

enumFieldStruct

enumRefIntStruct

enumSecStruct


Changes to Table::enumIndexStruct

Syntax 2 (added in version 5.0) stores the information in a TCursor variable.


Table::enumRefIntStruct
enumRefIntStruct

See Also	Example	Table Type	Changes

Method

Lists a table's referential integrity information.

Syntax

1. enumRefIntStruct ( const tableName String ) Logical

2. enumRefIntStruct ( inMem TCursor ) Logical

Description

enumRefIntStruct lists referential integrity information for a Table variable. Syntax 1 creates a Paradox table; syntax 2 (added in version 5.0) stores the information in a TCursor variable.

Syntax 1 creates the Paradox table specified in tableName. If tableName exists, this method overwrites it without asking for confirmation. If tableName is open, this method fails. You can include an alias or path in tableName; if no alias or path is specified, Paradox creates tableName in the working directory. You can supply tableName to the refIntStruct option in a create statement to borrow referential integrity information for use in the new table.

In syntax 2, the structure information is stored in a TCursor variable inMem that you pass as an argument. Using syntax 2 may result in faster performance because the information is stored in system memory without the overhead of disk access.

The structure of the table (syntax 1) or TCursor (syntax 2) is listed in the following table:

Field Name	Type	Description

infoHeader	A1	If Y, this record is a header for (and the data it contains is shared by) subsequent consecutive records that have a value of N in this field. If N, this record is not a header.

RefName	A31	A name to identify this referential integrity constraint.

OtherTable	A81	Name (including path) of the other table in the referential integrity relationship.

Slave	A1	Y if the able is slave, not master (i.e., table is dependent); otherwise blank.

Modify	A1	Specifies update rule: Y = Cascade, blank = Prohibit.

Delete	A1	Specifies delete rule: Y = Cascade, blank = Prohibit.

FieldNo	N	Ordinal position of the field in this table involved in a referential integrity relationship.

aiThisTabField	A31	Name of the field in this table involved in a referential integrity relationship.

Other FieldNo	N	Ordinal position of the field in the other table involved in a referential integrity relationship.

aiOthTabField	A31	Name of the field in the other table involved in a referential integrity relationship.


Example for Table::enumRefIntStruct
enumRefIntStruct Example

The following example uses enumRefIntStruct to write CUSTOMER.DB referential integrity information to the CustRef table. Then, the code supplies CustRef to the refIntStruct clause in a create statement.

; thisButton::pushButton

method pushButton(var eventInfo Event)

var

tb1, tb2 Table

endVar

tb1.attach("Customer.db")

tb1.enumRefIntStruct("CustRef.db")

tb1.enumFieldStruct("CustFlds.db")

try

tb2 = CREATE "NewCust.db"

STRUCT "CustFlds.db"

REFINTSTRUCT "CustRef.db"

ENDCREATE

onFail

errorShow()

endTry

endMethod


See Also for Table::enumRefIntStruct
See Also

enumFieldNames

enumFieldNamesInIndex

enumFieldStruct

enumIndexStruct

enumSecStruct


Changes to Table::enumRefIntStruct

Syntax 2 (added in version 5.0) stores the information in a TCursor variable.


Table::enumSecStruct
enumSecStruct

See Also	Example	Table Type	Changes

Method

Lists a table's security information.

Syntax

1. enumSecStruct ( const tableName String ) Logical

2. enumSecStruct ( inMem TCursor ) Logical

Description

enumSecStruct lists the security information (access rights) of a Table variable. Syntax 1 creates a Paradox table; syntax 2 (added in version 5.0) stores the information in a TCursor variable.

Syntax 1 creates the Paradox table specified in tableName. If tableName exists, this method overwrites it without asking for confirmation. If tableName is open, this method fails. You can include an alias or path in tableName; if no alias or path is specified, Paradox creates tableName in the working directory. You can supply tableName to the secStruct option in a create statement to borrow security information for use in the new table.

In syntax 2, the structure information is stored in a TCursor variable inMem that you pass as an argument. Using syntax 2 may result in faster performance because the information is stored in system memory without the overhead of disk access.

The structure of the table (syntax 1) or TCursor (syntax 2) is listed in the following table:

Field Name	Type	Description

infoHeader	A1	If Y, this record is a header for (and the data it contains is shared by) subsequent consecutive records that have a value of N in this field. If N, this record is not a header.

iSecNum	N	Number to identify security description
(first description = 1).

eprvTable	N	Table privilege value.

eprvTableSym	A10	Table privilege name.

iFamRights	N	Family rights value.

iFamRightsSym	A10	Family rights name.

szPassword	A31	Password.

fldNum	N	Ordinal position of field in table.

aprvFld	N	Field privilege value.

aprvFldSym	A10	Field privilege name.


Example for Table::enumSecStruct
enumSecStruct Example

The following example creates a new table based on the security information associated with the Secrets table. The code uses enumSecStruct to write security information to the SecInfo table, then uses the table to create the MySecrts table.

; getSecrets::pushButton
method pushButton(var eventInfo Event)
var
  tb1, tb2 Table
endVar

tb1.attach("Secrets.db")
tb1.enumSecStruct("SecInfo.db")

tb2 = CREATE "MySecrts.db"
        LIKE "Secrets.db"
        SECSTRUCT "SecInfo.db"
      ENDCREATE

endMethod


See Also for Table::enumSecStruct
See Also

enumFieldNames

enumFieldNamesInIndex

enumFieldStruct

enumIndexStruct

enumRefIntStruct


Changes to Table::enumSecStruct

Syntax 2 (added in version 5.0) stores the information in a TCursor variable.


Privilege values and names for Table::enumSecStruct

The following table lists numeric values and symbolic names for table and field privileges.

Value	Name	Description

0	None	No privileges.

1	ReadOnly	Read-only field or table.

3	Modify	Read and modify field or table.

7	Insert	Insert + all of the above privileges (table only).

15	InsDel	Delete + all of the above privileges (table only).

31	Full	Full rights (table only).

255	Unknown	Privileges unknown.


Family rights values and names for Table::enumSecStruct

The following table lists numeric values and symbolic names for family rights.

Value	Name	Description

0	NoFamRights	No family rights.

1	FormRights	Can change forms only.

2	RptRights	Can change reports only.

4	ValRights	Can change val checks only.

8	SetRights	Can change image settings.

15	AllFamRights	All of the above.


Table::familyRights
familyRights

See Also	Example	Table Type

Method

Tests for a user's ability to create or modify objects in a table's family.

Syntax

familyRights ( const rights String) Logical

Description

familyRights returns True if you have rights to the type of object specified in rights; otherwise, it returns False. rights is a single-letter string--- either "F" (form), "R" (report), "S" (image settings), or "V" (validity checks)--- that indicates the type of object you are interested in. This method preserves functionality required by Paradox 3.5 tables, which had the concept of a table family. The concept does not apply to tables created in versions of Paradox after 3.5.

DOS

The following procedure is provided as a convenience to DOS PAL programmers. You can use this procedure to operate on tables by specifying the table name, rather than using a variable.

Syntax

familyRights( const tableName String, rights AnyType ) Logical


Example for Table::familyRights
familyRights Example

The following example indicates in a dialog box whether you have "F" rights to CUSTOMER.DB.

; showFRights::pushButton
method pushButton(var eventInfo Event)
var
  custTB Table
endVar

custTB.attach("Orders.db")
if custTB.isTable() then
  msgInfo("Rights", "Form Rights: " +
          String(custTB.familyRights("F")))
  ;displays True if you have Form rights to Orders.db
else
  msgStop("Error", "Can't find Orders.db.")
endif

endMethod


See Also for Table::familyRights
See Also

tableRights


Table::fieldName
fieldName

See Also	Example	Table Type

Method/Procedure

Returns the name of a field in a table, given a field number.

Syntax

fieldName ( const fieldNum SmallInt ) String

Description

fieldName returns the name of the field specified in fieldNum. If fieldNum is greater than the number of fields in the table, fieldName returns an empty string.

DOS

The following procedure is provided as a convenience to DOS PAL programmers. You can use this procedure to operate on tables by specifying the table name, rather than using a variable.

Syntax

fieldName ( const tableName String, const fieldNum SmallInt ) String


Example for Table::fieldName
fieldName Example

The following example uses fieldName to display the name of field number two in the Answer table. This code is attached to the built-in pushButton method of a button.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tbl Table
  fldName, tblName String
  fldNum SmallInt
endVar
tblName = "Answer.db"
fldNum = 2

tbl.attach(tblName)
if isTable(tbl) then
  fldName = tbl.fieldName(fldNum)   ; store name of field 2 in fldName
  msgInfo("The name of field " + String(fldNum) + " is:", fldName)
else
  msgStop("Sorry", "Can't find " + tblName + " table.")
endIf

endMethod


See Also for Table::fieldName
See Also

fieldNo


Table::fieldNo
fieldNo

See Also	Example	Table Type

Method/Procedure

Returns the position of a field in a table.

Syntax

fieldNo ( const fieldName String ) SmallInt

Description

fieldNo returns the position of fieldName in a table, or 0 if fieldName is not found. Fields are numbered from left to right, beginning with 1.

DOS

The following procedure is provided as a convenience to DOS PAL programmers. You can use this procedure to operate on tables by specifying the table name, rather than using a variable.

Syntax

fieldNo ( const tableName String, const fieldName String ) SmallInt


Example for Table::fieldNo
fieldNo Example

This code displays the field number of the Date field if it exists in the Orders table.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  ord Table
  fldNo SmallInt
endVar

ord.attach("Orders.db")
fldNo = ord.fieldNo("Date")

if fldNo = 0 then
  msgInfo("Orders table", "Date is not a field in this table.")
else
  msgInfo("Orders table", "Date is field number " + String(fldNo))
endif

endMethod


See Also for Table::fieldNo
See Also

fieldName


Table::fieldType
fieldType

See Also	Example	Table Type	Changes

Method/Procedure

Returns the type of a field in a table.

Syntax

1. fieldType ( const fieldName String ) String

2. fieldType ( const fieldNum SmallInt )  String

Description

fieldType returns the data type of a field. If the field is not found, this method returns "Unknown". The following tables (updated for version 5.0) list the possible return values for Paradox and dBASE tables:

Paradox field type	Return value

Alpha	ALPHA

Autoincrement	AUTOINCREMENT

BCD	BCD

Binary	BINARY

Bytes	BYTES

Date	DATE

Formatted Memo	FMTMEMO

Graphic	GRAPHIC

Logical	LOGICAL

Long Integer	LONG

Memo	MEMO

Money	MONEY

Number	NUMBER

OLE	OLE

Short	SHORT

Time	TIME

Timestamp	TIMESTAMP

dBASE field type	Return value

BINARY	BINARY

CHARACTER	CHARACTER

DATE	DATE

FLOAT	FLOAT

LOGICAL	LOGICAL

MEMO	MEMO

NUMBER	NUMERIC

OLE	OLE

DOS

The following procedure is provided as a convenience to DOS PAL programmers. You can use this procedure to operate on tables by specifying the table name, rather than using a variable.

Syntax

1. fieldType ( const tableName String, const fieldName String ) String

2. fieldType ( const tableName String, const fieldNum SmallInt ) String


Example for Table::fieldType
fieldType Example

The following example uses a dynamic array to store the type of each field in the BioLife table, then displays the contents of the dynamic array in a dialog box.

; showFldTypes::pushButton
method pushButton(var eventInfo Event)
var
  tblVar Table
  i SmallInt
  fldTypes DynArray[] AnyType
  tblName String
endVar
tblName = "BioLife.db"

if isTable(tblName) then
  tblVar.attach(tblName)
    ; This FOR loop loads the DynArray with BioLife.db field types.
  for i from 1 to tblVar.nFields()
    fldTypes[tblVar.fieldName(i)] = tblVar.fieldtype(i)
  endFor
    ; Now show the contents of the DynArray.
  fldTypes.view(tblName + " field types")
else
  msgStop("Sorry", "Can't find " + tblName + " table.")
endIf
endMethod


See Also for Table::fieldType
See Also

fieldNo


Changes to Table::fieldType

The following return values changed in version 5.0:

Before 5.0	5.0

NUMERIC	NUMBER

BINARYBLOB	BINARY

OLEOBJ	OLE

BOOLEAN	LOGICAL

The following field types were added in version 5.0:

(Paradox tables) BCD, LONG, TIME, TIMESTAMP, LOGICAL, AUTOINCREMENT, BYTES.

(dBASE tables) BINARY, OLE.


Table::getGenFilter
getGenFilter	5.0

See Also	Example1	Example2	Table Type

Method

Retrieves the filter criteria associated with a Table variable.

Syntax

1. getGenFilter ( criteria DynArray[ ] AnyType ) Logical

2. getGenFilter ( criteria Array[ ] AnyType [ , fieldName Array[ ] AnyType ] ) Logical

3. getGenFilter ( criteria String ) Logical

Description

getGenFilter retrieves the filter criteria associated with a Table variable. This method does not return values directly; instead, it assigns them to a DynArray variable (syntax 1) or to two Array variables (syntax 2) that you declare and include as arguments.

In syntax 1, the DynArray criteria lists fields and filtering conditions as follows: the index is the field name or number (depending on how it was set), and the item is the corresponding filter expression.

In syntax 2, the Array criteria lists filtering conditions, and the optional Array fieldName lists corresponding field names. If you omit fieldName, conditions apply to fields in the order they appear in the criteria array (the first condition applies to the first field in the table, the second condition applies to the second field, and so on).

If the arrays used in syntax 2 are resizeable, this method sets the array size to equal the number of fields in the underlying table. If fixed-size arrays are used, this method stores as many criteria as it can, starting with criteria field 1. If there are more array items than fields, the remaining items are left empty; if there are more fields than items, this method fills the array and then stops.

In syntax 3, the filter criteria is assigned to a String variable criteria that you must declare and pass as an argument.


Example 1 for Table::getGenFilter
getGenFilter Example 1

In this example, the pushButton method for a button named btnShowFilter uses getGenFilter to fill a DynArray dyn with a table's filter criteria. Then it checks the DynArray to see if the current criteria filters the State/Prov field with a value of "CA", and resets the filter if necessary.

;btnShowFilter :: pushButton

method pushButton(var eventInfo Event)

var

ordersTb	Table

dyn	DynArray[] AnyType

keysAr	Array[] AnyType

stFilterFld,

stCriteria	String

endVar

stFilterFld = "State/Prov"

stCriteria  = "CA"

ordersTb.attach("Orders")

ordersTb.getGenFilter(dyn)	; Get filter information.

dyn.getKeys(keysAr)

if keysAr.contains(stFilterFld) then

if dyn[stFilterFld] = stCriteria then

return               ; Filter is set correctly.

endIf

else

dyn.empty()             ; Set filter criteria correctly.

dyn[stFilterFld] = stCriteria

ordersTb.setGenFilter(dyn)

endIf

endMethod


Example 2 for Table::getGenFilter
getGenFilter Example 2

In this example, a form contains a custom method called cmGetOrders. This custom method is used by a button called btnViewOrders to set a filter and then return the number of records in the filter. Following is the code attached to the form.

;Form :: cmGetOrders

method cmGetOrders(var tbl Table) Number

var

dynCurrent	DynArray[] AnyType

dynNew	DynArray[] AnyType

endVar

dynNew["Ship Via"] = "UPS"	;Set filter criteria.

dynNew["Total Invoice"] = "> 10000"

tbl.getGenFilter(dynCurrent)	;Get the current criteria.

if dynCurrent <> dynNew then	;If current criteria is not

tbl.setGenFilter(dynNew)	;the same as new criteria,

endIf	;then set new criteria.

return(tbl.cCount("Order No"))	;Return number of orders.

endMethod

Following is the code attached to the button. It associates a Table variable with a table, then calls the custom method attached to the form to operate on the data.

;btnViewOrders :: pushButton

method pushButton(var eventInfo Event)

var

tbl	Table

endVar

tbl.attach("ORD_JUN.DB")

view(cmGetOrders(tbl), "UPS orders over $10,000 in June")

tbl.attach("ORD_JUL.DB")

view(cmGetOrders(tbl), "UPS orders over $10,000 in July")

endMethod


See Also for Table::getGenFilter
See Also

setGenFilter

dropGenFilter

setRange

UIObject::getGenFilter

Using Ranges and Filters


Table::getRange
getRange	5.0

See Also	Example	Table Type

Method

Retrieves the values that specify a range for a Table variable.

Syntax

getRange ( var rangeVals Array[ ] String ) Logical

Description

getRange retrieves the values that specify a range for a Table variable. This method does not return values directly; instead, it assigns them to an Array variable that you declare and include as an argument. The array values describe the range criteria, as listed in the following table.

Number of array items	Range specification

No items (empty array)	No range criteria associated with the Table variable.

One item	Specifies a value for an exact match on the first field of the index.

Two items	Specifies a range for the first field of the index.

Three items	The first item specifies an exact match for the first field of the index; items 2 and 3 specify a range for the second field of the index.

More than three items	For an array of size n, specify exact matches on the first n-2 fields of the index. The last two array items specify a range for the n-1 field of the index.

If the array is resizeable, this method sets the array size to equal the number of fields in the underlying table. If fixed-size arrays are used, this method stores as many criteria as it can, starting with criteria field 1. If there are more array items than fields, the remaining items are left empty; if there are more fields than items, this method fills the array and then stops.


Example for Table::getRange
getRange Example

In the following example, getRange is used on a Table variable tbl to test if the current range criteria is the same as the new range criteria. If it is not, then the new range is set using setRange.

;btnSetRange :: pushButton

method pushButton(var eventInfo Event)

var

arGet	Array[2] Anytype

arSet	Array[2] Anytype

endVar

arSet[1] = "A"

arSet[2] = "B"

;The following assumes a Table variable

;is declared and used elsewhere.

tbl.getRange(arGet)	;Get the current range.

if arGet <> arSet then	;Compare current range with new.

tbl.setRange(arSet)	;Show records starting with A.

endIf

endMethod


See Also for Table::getRange
See Also

setRange

getGenFilter

Table::getRange

TCursor::getRange

Using Ranges and Filters


Table::index
index

See Also	Example1	Example2	Table Type

Keyword

Creates an index on the specified fields of a table.

Syntax

1. index

      [ maintained ] tableDesc on fieldID

    endIndex

2. index tableDesc

      [ maintained ]                    (Paradox)

      [ primary ]                          (Paradox)

      [ caseInsensitive ]              (Paradox)

      [ descending ]                    (dBASE)

      [ unique ]                           (dBASE)

      on

        { fieldDesc [, fieldDesc ] [to indexName]

           |

        { keyExp

          to ndxFileName | tag tagName [ of mdxFileName ]

             |

          for condition } }

    endIndex

Description

index generates a primary or secondary index on the specified fields of a table. Paradox uses the index to speed up queries and searches that access those fields.

For Paradox tables, they keywords maintained, primary, and caseInsensitive are available. The primary keyword specifies a primary index (key), which is reuired before you can create any secondary indexes. If the table already has a primary index and you create another one, the new primary index replaces the old one. A primary index must be declared on one or more consecutive fields, beginning with the first field in the table. Memo fields, formatted memo fields, OLE fields, and Graphic fields cannot be indexed.

Secondary indexes can be either maintained (created using the maintained keyword) or non-maintained. Paradox updates a maintained index as records are added, deleted, or changed. A non-maintained index is only updated when it is in use. If you use the maintained keyword for Paradox tables and specify a non-keyed table to index, index fails. For dBASE tables, all opened index files are automatically maintained.

The caseInsensitive keyword makes an index ignore case. A primary index must be case-sensitive (in other words, you cannot use the caseInsensitive keyword when creating a primary index), and it must be declared on one or more consecutive fields, beginning with the first field. For Paradox tables, a case-sensitive maintained index on a single field must have the same name as that field. A case-insensitive maintained index on a single field must not have the same name as that field.

The on clause, which specifies which fields to use, has two forms: one for Paradox tables, and one for dBASE tables.

For Paradox tables, use

on fieldDesc [ , fieldDesc ] to indexName

where fieldDesc specifies one or more field names or field numbers, and indexName specifies the name of the index file. Other methods use this name to refer to the index.

For dBASE tables, use

keyExp to ndxFileName | tag tagName [ of mdxFileName ]

which lets you choose between a .NDX file or a tag in a .MDX file. If mdxFileName is omitted, the default .MDX file name is the same as the table. A dBASE table can only be indexed on one field.

In multiuser applications, index automatically places a full lock on the table while it is being indexed. If the table has been locked by another user or application, the command is continuously retried for the duration of the currently set retry period. If the lock cannot be obtained by the end of the period, a index fails. You can use the lock method to make certain that you can lock the table before you use the index command.

It can be convenient to develop your applications without worrying about indexes, then introduce them where appropriate to speed up queries and searches.

In the following situations, the index command will not successfully complete:

Too many indexes already exist (maximum of 255 for a single table).

An index being defined is already in use.

index is not a method, so dot notation, as in

tableVar.index()

is inappropriate. Instead, you create an index structure to specify how to index the table.


Example 1 for Table::index
index Example 1

The following example builds a primary index for a Paradox table named CUSTOMER.DB. If the Customer table can not be found, or cannot be locked, this method aborts the index operation. If this code successfully indexes the table, the code enumerates indexed fields to an array and displays the contents of the array in a dialog box.

; newCustKeys::pushButton
method pushButton(var eventInfo Event)
var
  tblToIndex String
  tblVar Table
  indexedFlds Array[] String
endVar
tblToIndex = "Customer.db"

if isTable(tblToIndex) then
  tblVar.attach(tblToIndex)
  if not tblVar.lock("Full") then
    msgStop("Stop!", "Can't lock " + tblToIndex + " table.")
    return
  endif
  INDEX tblVar              ; create new primary index for Customer.db
    PRIMARY
    ON "Customer No", "Name", "Street"
  ENDINDEX

    ; now display Customer's keyed fields in a dialog box
  tblVar.enumFieldNamesInIndex(indexedFlds)
  indexedFlds.view("Primary key fields for " + tblToIndex)

else
  msgStop("Stop!", "Can't find " + tblToIndex + " table.")
endif

endMethod


Example 2 for Table::index
index Example 2

The following example builds a maintained secondary index named CityState for the Paradox table, CUSTOMER.DB. If successful, this code enumerates the indexed field names to an array and displays them in a dialog box.

; cityStateIndex::pushButton
method pushButton(var eventInfo Event)
var
  tblToIndex String
  tblVar Table
  indexedFlds Array[] String
  tv TableView
endVar
tblToIndex = "Customer.db"

if isTable(tblToIndex) then
  tblVar.attach(tblToIndex)
  if not tblVar.lock("Full") then
    msgStop("Stop!", "Can't lock " + tblToIndex + " table.")
    return
  endif

  INDEX tblVar              ; create secondary index for Customer.db
    MAINTAINED              ; maintain index incrementally
    ON "City", "State/Prov" ; index on these two fields
    TO "CityState"          ; name the index "CityState"
  ENDINDEX

    ; now display Customer's keyed fields in a dialog box
  tblVar.enumFieldNamesInIndex("CityState", indexedFlds)
  indexedFlds.view("Fields in the CityState index")

else
  msgStop("Stop!", "Can't find " + tblToIndex + " table.")
endif

endMethod


See Also for Table::index
See Also

Paradox Help: Indexes

create

createIndex

enumIndexStruct

setIndex

usesIndexes


Table::isAssigned
isAssigned

See Also	Example	Table Type

Method

Reports whether a Table variable has been assigned a value.

Syntax

isAssigned ( ) Logical

Description

isAssigned returns True if a Table variable has an assigned value; otherwise, it returns False.  You can assign a value to a Table variable using create or attach.

Note:	A return value of True does not guarantee that the table exists. For example, the following code displays True in a dialog box:

var tb Table endVar
tb.attach("zxcv.qw")                  ; attach to some nonsense file name
msgInfo("Assigned?", tb.isAssigned()) ; displays True
displays True in the dialog box.


Example for Table::isAssigned
isAssigned Example

The following example tests whether the tblVar Table variable is assigned before attaching to a table. The following code goes in the Var window for the thisForm form:

; thisForm::var
var
  tblVar
endVar

The following code is attached to the pushButton method for the thisButton button. In this code, if tblVar is not already assigned, it is attached to the Orders table.

; thisButton::pushButton
method pushButton(var eventInfo Event)

if NOT tblVar.isAssigned() then
  tblVar.attach("Orders.db")
else
  msgStop("Error", "Can't attach tblVar to Orders.db")
endif

endMethod


See Also for isAssigned
See Also

attach

isTable


Table::isEmpty
isEmpty

See Also	Example	Table Type

Method/Procedure

Reports whether a table contains any records. This can be an expensive operation for dBASE tables.

Syntax

isEmpty ( ) Logical

Description

isEmpty returns True if there are no records in a table; otherwise, it returns False.

DOS

The following procedure is provided as a convenience to DOS PAL programmers. You can use this procedure to operate on tables by specifying the table name, rather than using a variable.

Syntax

isEmpty ( const tableName String ) Logical


Example for Table::isEmpty
isEmpty Example

For the following example, the pushButton method for the rptRecNo button displays the number of records in the Orders table. If Orders is empty, this code alerts the user that the table is empty.

; rptRecNo::pushButton
method pushButton(var eventInfo Event)
var
  tblVar Table
  tblName String
endVar
tblName = "Orders.db"

if isTable(tblName) then
  tblVar.attach(tblName)
  if tblVar.isEmpty() then     ; if Orders.db table is empty
    msgStop("Hey!", tblName + " table is empty!")
  else
    msgInfo(tblName + " table has", String(tblVar.nRecords()) + " records")
  endIf
else
  msgStop("Sorry", "Can't open " + tblName + " table.")
endif
endMethod


See Also for Table::isEmpty
See Also

empty

isTable


Table::isEncrypted
isEncrypted

See Also	Example	Table Type

Method/Procedure

Reports whether a table is encrypted.

Syntax

isEncrypted ( [ const tableName String ] ) Logical

Description

isEncrypted returns True if a table is password-protected; otherwise, it returns False. A TCursor can't be opened on an encrypted table until the password is presented, either interactively or using the Session type method addPassword. This method does not report whether a user has access rights to the table---use tableRights for that.

DOS

The following procedure is provided as a convenience to DOS PAL programmers. You can use this procedure to operate on tables by specifying the table name, rather than using a variable.

Syntax

isEncrypted ( const tableName String ) Logical


Example for Table::isEncrypted
isEncrypted Example

The following example uses isEncrypted to determine whether the Secrets table is protected (encrypted); if it is the code prompts the user to enter a password.

method pushButton(var eventInfo Event)

const

kTbName = "Secrets"

endConst

var

tbSecret Table

tvSecret TableView

endvar

tbSecret.attach(kTbName)

; If the table is encrypted, prompt the

; user for the password.

if tbSecret.isEncrypted() then

menuAction(MenuFileTablePasswords)

endIf

if not tvSecret.open(kTbName) then

errorShow("Could not open " + kTbName)

endIf

endMethod


See Also for isEncrypted
See Also

protect

tableRights

Session::addPassword

Session::removePassword


Table::isShared
isShared

See Also	Example	Table Type

Method/Procedure

Reports whether a table is currently shared.

Syntax

isShared ( ) Logical

Description

isShared returns True if a table is being shared by another user on a network; otherwise, it returns False. isShared does not report whether a table is being shared by another session.

DOS

The following procedure is provided as a convenience to DOS PAL programmers. You can use this procedure to operate on tables by specifying the table name, rather than using a variable.

Syntax

isShared ( const tableName String ) Logical


Example for Table::isShared
isShared Example

In the following example, a Table variable is attached to the Customer table. This code uses setExclusive to give the user exclusive rights to Customer then uses isShared to demonstrate the effect setExclusive has on tables in a multiuser environment.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tblVar Table
  tblName String
endVar
tblName = "Customer.db"

tblVar.attach(tblName)

tblVar.setExclusive(True)   ; give user exclusive rights to Customer.db
if tblVar.isShared() then   ; this is never True!
                            ; exclusive tables can't be shared
  msgStop("", "This message will never appear!")
else
  msgInfo("Multiuser Status", tblName + " is not shared.")
endif

endMethod


See Also for Table::isShared
See Also

tableRights


Table::isTable
isTable

See Also	Example	Table Type

Method/Procedure

Reports whether a table exists in a database.

Syntax

isTable ( ) Logical

Description

isTable returns True if the Table variable represents a table that can be opened; otherwise, it returns False.

DOS

The following procedure is provided as a convenience to DOS PAL programmers. You can use this procedure to operate on tables by specifying the table name, rather than using a variable.

Syntax

isTable ( const tableName String ) Logical


Example for Table::isTable
isTable Example

The following example uses isTable to verify that the Customer table exists before doing anything with the table. If Customer exists in the default database, this code stores Customer field names in an array, then displays the contents of the array in a dialog box.

; showCustFlds::pushButton
method pushButton(var eventInfo Event)
var
  tblVar Table
  tblName String
  fldNames Array[] AnyType
endVar
tblName = "Customer.db"

tblVar.attach(tblName)
if isTable(tblVar) then
  tblVar.enumFieldNames(fldNames)
  fldNames.view(tblName + " fields")
else
  msgStop("Stop!", "Can't find " + tblName + " table.")
endif

endMethod


See Also for Table::isTable
See Also

isAssigned


Table::lock
lock

See Also	Example	Table Type

Beginner

Method

Locks a specified table.

Syntax

lock ( const lockType String ) Logical

Description

lock attempts to place a lock on the table, where lockType is one of the following String values, listed in order of decreasing strength and increasing concurrency.

String value	Description

Exclusive	The current session has exclusive access to the table. No other session can open the table. Cannot be used with dBASE tables.

Full	The current session can restructure, write to, and read from the table. No other session can write to or restructure the table, they can only read from it. Cannot be used with dBASE tables.

Write	The current session can write to and read from the table. No other session can place a write lock or a read lock on the table.

Read	The current session can read from the table. No other session can place a write lock, full lock, or exclusive lock on the table.

If successful, this method returns True; otherwise, it returns False.


Example for Table::lock
lock Example

The following example attaches a Table variable to Customer, places an exclusive lock on the table, then uses reIndex to rebuild the Phone_Zip index. Once the index is rebuilt, this code unlocks Customer so other users on a network can gain access to the table.

; reindexCust::pushButton
method pushButton(var eventInfo Event)
var
  tblVar Table
  pdoxTbl String
endVar
pdoxTbl = "Customer.db"

if isTable(pdoxTbl) then
  tblVar.attach(pdoxTbl)
  if tblVar.lock("Exclusive") then    ; Try to lock the table.
    tblVar.reIndex("Phone_Zip")       ; Rebuild Phone_Zip index.
    tblVar.unLock("Exclusive")        ; Unlock the table.
  else
    msgStop("Sorry", "Can't lock " + pdoxTbl + " table.")
  endif
else
  msgStop("Sorry", "Can't find " + pdoxTbl + " table.")
endif
endMethod


See Also for Table::lock
See Also

unlock

Session::lock

Session::unlock


Table::nFields
nFields

See Also	Example	Table Type

Method/Procedure

Returns the number of fields in a table.

Syntax

nFields ( ) LongInt

Description

nFields returns the number of fields in a table.

DOS

The following procedure is provided as a convenience to DOS PAL programmers. You can use this procedure to operate on tables by specifying the table name, rather than using a variable.

Syntax

nFields ( const tableName String ) LongInt


Example for Table::nFields
nFields Example

For the following example, the pushButton method for thisButton displays the number of fields in the BioLife table.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tblVar Table
endVar

tblVar.attach("BioLife.db")
msgInfo("BioLife", "BioLife has " +
        String(tblVar.nFields(), " fields.")

endMethod


See Also for Table::nFields
See Also

nKeyFields

nRecords


Table::nKeyFields
nKeyFields

See Also	Example	Table Type

Method/Procedure

Returns the number of fields in the primary or current index for a table.

Syntax

nKeyFields ( ) LongInt

Description

nKeyFields returns the number of fields in the current index for a table. Use TCursor::getIndexName to get the name of the current index.

DOS

The following procedure is provided as a convenience to DOS PAL programmers. You can use this procedure to operate on tables by specifying the table name, rather than using a variable.

Syntax

nKeyFields ( const tableName String ) LongInt


Example for Table::nKeyFields
nKeyFields Example

The following example reports the number of primary key fields in a Paradox table (ORDERS.DB) and the number of primary key fields in the LastName tag of the SCORES.MDX index for a dBase table (SCORES.DBF).

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  pdoxTbl, dBaseTbl Table
  nkf LongInt
endVar

pdoxTbl.attach("Orders.db")
nkf = pdoxTbl.nKeyFields()        ; number of key fields in the primary index
msgInfo("Orders", "Orders.db has " + String(nkf) + " key fields.")

dBaseTbl.attach("Scores.dbf")
dBaseTbl.setIndex("Scores", "LastName")
nkf = dBaseTbl.nKeyFields() ; key fields in LastName tag
msgInfo("Scores.dbf", "LastName tag has "

                      + String(nkf) + " key fields.")

endMethod


See Also for Table::nKeyFields
See Also

Paradox Help: Indexes

TCursor::getIndexName

nFields


Table::nRecords
nRecords

See Also	Example	Table Type

Method/Procedure

Returns the number of records in a table.

Syntax

nRecords ( ) LongInt

Description

nRecords returns the number of records in the table associated with a Table variable. This operation can take a long time for dBASE tables and large Paradox tables.

Note:	When you call nRecords after setting a filter, the returned value does not represent the number of records in the filtered set. To get that information, use cCount. When you call nRecords after setting a range, the returned value represents the number of records in the set defined by the range.

When working with a dBASE table, nRecords counts deleted records if showDeleted is turned on. If showDeleted is turned off, deleted records are not counted.

DOS

The following procedure is provided as a convenience to DOS PAL programmers. You can use this procedure to operate on tables by specifying the table name, rather than using a variable.

Syntax

nRecords ( const tableName String ) LongInt


Example for Table::nRecords
nRecords Example

The following example prompts the user for confirmation before deleting all records from the Scratch table. If the user does not confirm the action, this code uses nRecords to indicate how many records exist in SCRATCH.DB.

; tblEmpty::pushButton
method pushButton(var eventInfo Event)
var
  tblName String
  tblVar Table
endVar
tblName = "Scratch.db"

if isTable(tblName) then
  tblVar.attach(tblName)
  if msgYesNoCancel("Confirm", "Empty " + tblName + " table?") = "Yes" then
    tblVar.empty()
    message("All " + tblName + " records have been deleted.")
  else
    message(tblname + " has " + String(tblVar.nRecords()) + " records.")
  endif
else
  msgInfo("Error", "Can't find " + tblName + " table.")
endif
endMethod


See Also for Table::nRecords
See Also

nFields

nKeyFields


Table::protect
protect

See Also	Example	Table Type

Method/Procedure

Encrypts and assigns an owner password to a table.

Syntax

protect ( const password String ) Logical

Description

protect assigns an owner password to a table. The maximum length of a password is 31 characters. A protected table is encrypted and cannot be accessed without presenting the password specified in password. If the table already has a password, protect fails.

Once a table is protected, you can use the addPassword method to present the password of a protected table, and the removePassword method to withdraw the password and reprotect the table. password is case-sensitive; a table protected with "Sesame" won't open for "SESAME".

Do not confuse protect with lock: protect encrypts tables, while lock controls simultaneous access to tables.

DOS

The following procedure is provided as a convenience to DOS PAL programmers. You can use this procedure to operate on tables by specifying the table name, rather than using a variable.

Syntax

protect ( const tableName String, const password String ) Logical


Example for Table::protect
protect Example

For the following example, the pushButton method for protectSecrets password-protects the Secrets table in the default database.

; protectSecrets::pushButton
method pushButton(var eventInfo Event)
var
  secretData Table
endVar

secretData.attach("Secrets.db")
if not secretData.isEncrypted() then
  secretData.protect("Get007") ; Password-protect table with "Get007"
endIf

endMethod


See Also for Table::protect
See Also

isEncrypted

Session::addPassword

Session::removePassword


Table::reIndex
reIndex

See Also	Example	Table Type

Method

Rebuilds specified index files.

Syntax

1. (Paradox tables) reIndex ( const indexName String ) Logical

2. (dBASE tables) reIndex ( const indexName String [ const tagName String ] ) Logical

Description

reIndex rebuilds an index (or index tag) that is not automatically maintained. When working with a Paradox table, use indexName to specify an index. When working with a dBASE table, use indexName to specify a .NDX file, or indexName and tagName to specify an index tag in a .MDX file. This method requires exclusive access to the table.


Example for Table::reIndex
reIndex Example

The following example attaches a Table variable to Customer (a Paradox table), places an exclusive lock on the table, then uses reIndex to rebuild the Phone_Zip index.

; reindexCust::pushButton
method pushButton(var eventInfo Event)
var
  tblVar Table
  pdoxTbl String
endVar
pdoxTbl = "Customer.db"

tblVar.attach(pdoxTbl)
if tblVar.lock("Exclusive") then  ; Try to lock the table.
  tblVar.reIndex("Phone_Zip")     ; Rebuild Phone_Zip index.
  tblVar.unLock("Exclusive")      ; Unlock the table.
else
  msgStop("Sorry", "Can't lock " + pdoxTbl + " table.")
endif

endMethod


See Also for Table::reIndex
See Also

Paradox Help: Indexes

reIndexAll


Table::reIndexAll
reIndexAll

See Also	Example	Table Type

Method

Rebuilds all index files associated with a table.

Syntax

reIndexAll ( ) Logical

Description

reIndexAll rebuilds all index files associated with a table. This method requires exclusive rights to the table to rebuild a maintained index, and it requires a write lock to rebuild a non-maintained index.


Example for Table::reIndexAll
reIndexAll Example

For the following example, the pushButton method for a button attempts to place an exclusive lock on the Customer table. If lock is successful, this code rebuilds all indexes for the Customer table then unlocks the table.

; reindexAllCust::pushButton
method pushButton(var eventInfo Event)
var
  tblVar Table
  pdoxTbl String
endVar
pdoxTbl = "Customer.db"

tblVar.attach(pdoxTbl)
if tblVar.lock("Exclusive") then    ; attempt to lock Customer.db
  tblVar.reIndexAll()               ; rebuild all Customer.db indexes
  tblVar.unLock("Exclusive")        ; unlock the table
else
  msgStop("Sorry", "Can't lock " + pdoxTbl + " table.")
endif

endMethod


See Also for Table::reIndexAll
See Also

Paradox Help: Indexes

reIndex


Table::rename
rename

See Also	Example	Table Type

Beginner

Method/Procedure

Renames a table.

Syntax

rename ( const destTableName String ) Logical

Description

rename changes the name of a table to destTableName. If the table named by destTableName exists, an error results.

This method tries, for the duration of the retry period, to place a full lock on the table. If the lock cannot be placed, an error results.

DOS

The following procedure is provided as a convenience to DOS PAL programmers. You can use this procedure to operate on tables by specifying the table name, rather than using a variable.

Syntax

rename ( const tableName String, const destTableName String ) Logical


Example for Table::rename
rename Example

The following code renames CUSTOMER.DB to OLDCUST. If OldCust exists, this example offers the user an opportunity to abort the operation.

; renameCust::pushButton
method pushButton(var eventInfo Event)
var
  tblVar Table
  oldName, newName String
endVar

oldName = "Customer.db"
newName = "OldCust.db"

tblVar.attach(oldName)
if tblVar.isTable() then
  if isTable(newName) then
    if msgQuestion("Confirm", newName + " exists. Overwrite it?") <> "Yes" then
      message("Operation canceled.")
      return
    endif
  endif
  tblVar.rename(newName)
  message(oldName + " renamed to " + newName)
else
  msgStop("Stop!", "Can't find " + oldName + " table.")
endif

endMethod


See Also for Table::rename
See Also

copy


Table::setExclusive
setExclusive

See Also	Example	Table Type

Method

Specifies whether to give the user exclusive rights to a table when it is opened.

Syntax

setExclusive ( [ const yesNo Logical ] )

Description

setExclusive specifies in yesNo whether to open a table with shared or exclusive rights. This method does not place any locks on the table--an exclusive lock (more powerful than a full lock) is placed on the table only when it is opened.

By default, tables are opened in shared mode. Optional argument yesNo specifies whether to set exclusive rights: a value of Yes requests exclusive rights so that no other user can read or write to the table, a value of No allows the table to be opened in shared mode. If omitted, yesNo defaults to Yes.


Example for Table::setExclusive
setExclusive Example

The following example demonstrates how setExclusive affects access rights to a table. The code defines a Table variable for the Customer table, then calls setExclusive so Customer is opened exclusively. Then, a TCursor is opened for Customer. If the TCursor is sucessfully opened, it has exclusive rights to the table and the code calls the TCursor method lockStatus to indicate that an exclusive lock has been placed on Customer.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tblVar Table
  tc     TCursor
endvar

tblVar.attach("Customer.db")
if tblVar.isTable() then
  ; set exclusive rights for the Table variable
  tblVar.setExclusive()

  ; attempt to open a TCursor on Customer.db--
  ; if successful, tc has exclusive rights to Customer.db
  if tc.open(tblVar) then

    ; if tc.open was successful, this message indicates
    ; that tc has 1 exclusive lock on Customer.db
    msgInfo("Lock Status", tc.lockStatus("Exclusive"))

  else
    ; else open failed
    msgInfo("Status", "Can't open Customer.db")
  endif

else
  msgInfo("Status", "Can't find Customer.db table.")
endif

if tc.isAssigned() then    ; if the TCursor was opened
  tc.close()               ; close tc--now Customer.db is not
                           ; locked and can be opened by another user
endif

endMethod


See Also for Table::setExclusive
See Also

attach

setIndex

setReadOnly


Table::setGenFilter
setGenFilter	5.0

See Also	Example1	Example2	Table Type

Method

Specifies conditions for including records in a TCursor opened on a Table variable.

Syntax

1. setGenFilter ( criteria DynArray[ ] AnyType ) Logical

2. setGenFilter ( criteria Array[ ] AnyType [ , fieldId Array[ ] AnyType ] ) Logical

Description

setGenFilter specifies conditions for including records in a TCursor opened on a Table variable. Records that meet all the specified conditions are included; records that don't are filtered out, creating a restricted view of the table.

In syntax 1, the DynArray criteria specifies fields and filtering conditions as follows: the index is the field name or field number, and the item is the filter expression.

For example, the following code specifies criteria based on the values of three fields.

criteriaDA[1]      = "Widget" ; The value of the first field in the table is Widget.
criteriaDA["Size"] = "> 4"    ; The value of the field named Size is greater than 4.
criteriaDA["Cost"] = ">= 10.95, < 22.50" ; The value of the field named Cost is greater than or equal to 10.95 and less than 22.50.

If the DynArray is empty, any existing filter criteria are removed.

In syntax 2, the Array criteria specifies filtering conditions, and the optional Array fieldId specifies field names and/or field numbers. If you omit fieldID, conditions are applied to fields in the order they appear in the criteria array (the first condition applies to the first field in the table, the second condition applies to the second field, and so on). The following example fills arrays for syntax 2 to specify the same criteria as the example for syntax 1.

criteriaAR[1] = "Widget"
criteriaAR[2] = "> 4"
criteriaAR[3] = ">= 10.95, < 22.50"
fieldAR[1] = 1
fieldAR[2] = "Size"
fieldAR[3] = "Cost"

If the Array is empty, any existing filter criteria are removed.


Example 1 for Table::setGenFilter
setGenFilter Example 1

In this example, the built-in run method for a script attaches a Table variable to the Customer table, then sets filter criteria on the State field to equal "CA".

;Script :: run

method run(var eventInfo Event)

var

tb	Table

dyn	DynArray[] AnyType

endVar

dyn["State/Prov"] = "CA"

tb.attach("CUSTOMER.DB")

tb.setGenFilter(dyn)

endMethod


Example 2 for Table::setGenFilter
setGenFilter Example 2

In the following example, a form contains a button called btnBalanceStatus. The pushButton method for btnBalanceStatus attaches a Table variable to the Orders table and sets a filter criteria to view only the records with a positive balance. Then, cCount gets the number of records, cAverage gets the average balance due, and cSum gets the total balance due. Finally, a dialog box displays the values.

;btnBalanceStatus

method pushButton(var eventInfo Event)

var

tbl	Table

dyn	DynArray[] AnyType

s1,

s2,

s3	String

endVar

tbl.attach("ORDERS")

Dyn["Balance Due"] = "> 0"

tbl.setGenFilter(Dyn)

s1 = string(tbl.cCount("Balance Due"))

s2 = string(tbl.cAverage("Balance Due"))

s3 = string(tbl.cSum("Balance Due"))

msgInfo("Outstanding balances", "There are " + s1 + " orders with an average balance due of " + s2 + ", totaling " + s3 + ".")

endMethod


See Also for Table::setGenFilter
See Also

getGenFilter

dropGenFilter

TCursor::setGenFilter

UIObject::setGenFilter

Using Ranges and Filters


Table::setIndex
setIndex

See Also	Example	Table Type

Method

Specifies an index for a table.

Syntax

1. (Paradox tables) setIndex ( const indexName String ) Logical

2. (dBASE tables) setIndex ( const indexName String  [ , const tagName  String ] ) Logical

Description

setIndex specifies an index to use when a table is opened.

When working with a Paradox table, use indexName specify an index. When working with a dBASE table, you can use indexName to specify a .NDX file, or indexName and tagName to specify an index tag in a .MDX file.


Example for Table::setIndex
setIndex Example

In the following example, assume the Paradox Customer table has a secondary index named CityState. The following code specifies CityState with setIndex to set up for a call to setRange. When the designated filter is set for Customer, this example loads a DynArray with information from the filtered table then displays the contents of the DynArray in a dialog box.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  custTbl Table
  tc TCursor
  dy DynArray[] Anytype
endVar

custTbl.attach("Customer.db")
if isTable(custTbl) then

  ; now use the secondary index named CityState
  custTbl.setIndex("CityState")

  ; filter out everything but St. Thomas
  custTbl.setRange("St. Thomas", "St. Thomas")

  ; open a TCursor for the filtered Customer table
  if tc.open(custTbl) then

    ; scan the table and load the DynArray with
    ; company names (Name) and phone numbers
    scan tc:
      dy[tc.Name] = tc.Phone
    endScan
    ; display contents of the DynArray
    dy.view("St. Thomas Phone Numbers")

  else
    msgStop("Error", "Can't open TCursor.")
  endif

else
  msgStop("Error", "Can't find Customer.db")
endif
endMethod


See Also for Table::setIndex
See Also

Paradox Help: Indexes

setRange


Table::setRange
setRange	5.0

See Also	Example1	Example2	Table Type

Method

Specifies a range of records to associate with a Table variable.

Syntax

1. setRange ( [ const exactMatchVal AnyType] * [ , const minVal AnyType, const maxVal AnyType ] ) Logical

2. setRange ( rangeVals Array[ ] AnyType ) Logical

Description

setRange specifies conditions for associating a contiguous range of records with a Table variable. Records that meet the conditions are included when the table is opened; records that don't are excluded. setRange compares the criteria you specify with values in the corresponding fields of a table's index; it fails if the table is not indexed. Calling setRange without any arguments resets the range criteria to include the entire table.

Note	This method replaces setFilter included in earlier versions: functionality is enhanced. Code that calls setFilter will continue to execute as before.

In syntax 1, to set a range based on the value of the first field of the index, specify values in minVal and maxVal. For example, the following statement checks values in the first field of the index of each record:

tableVar.setRange(14, 88)

If a value is less than 14 or greater than 88, that record is filtered out. To specify an exact match on the first field of the index, assign minVal and maxVal the same value. For example, the following statement filters out all values except 55:

tableVar.setRange(55, 55)

You can set a range based on the values of more than one field. To do so, specify exact matches except for the last one in the list. For example, the following statement looks for exact matches on "Borland" and "Paradox" (assuming they are the first fields in the index), and values ranging from 100 to 500, inclusive, for the third field:

tableVar.setRange("Borland", "Paradox", 100, 500)

In syntax 2, you can pass an array of values to specify the range criteria, as listed in the following table.

Number of array items	Range specification

No items (empty array)	Resets range criteria to include the entire table.

One item	Specifies a value for an exact match on the first field of the index.

Two items	Specifies a range for the first field of the index.

Three items	The first item specifies an exact match for the first field of the index; items 2 and 3 specify a range for the second field of the index.

More than three items	For an array of size n, specify exact matches on the first n-2 fields of the index. The last two array items specify a range for the n-1 field of the index.


Example 1 for Table::setRange
setRange Example

In the following example, assume that Lineitem's key field is Order No. and you want to know the total for order number 1005. The following code attaches a Table variable to the Lineitem table, limits the range of records to those with 1005 in the first field of the primary index, then uses cSum to calculate the total for order 1005.

; getDetailSum::pushButton
method pushButton(var eventInfo Event)
var
  tblVar Table
  tblName String
endVar
tblName = "LineItem.db"
tblVar.attach(tblName)

  ; this limits TCursor's view to records that have
  ; 1005 in the first field of the primary index
tblVar.setRange(1005, 1005)

  ; now display the total for Order No. 1005
msgInfo("Total for Order 1005", tblVar.cSum("Total"))

endMethod


Example 2 for Table::setRange
setRange Example 2

This example shows how to call setRange with a criteria array that contains more than three items. The following code sets a range to include orders from a person with a specific first name, middle initial, and last name, and an order quantity ranging from 100 to 500 items. Then it counts the number of records in this range and displays the value in a dialog box. This example assumes that the PartsOrd table is indexed on the FirstName, MiddleInitial, LastName, and Qty fields.

; setQtyRange::pushButton
method pushButton(var eventInfo Event)
var
tbPartsOrd	Table
arRangeInfo	Array[5] AnyType

nuCount	Number
endVar

arRangeInfo[1] = "Frank"      ; FirstName (exact match)

arRangeInfo[2] = "P."         ; MiddleInitial (exact match)

arRangeInfo[3] = "Borland"    ; LastName (exact match)

arRangeInfo[4] = 100          ; Minimum qty value

arRangeInfo[5] = 500          ; Maximum qty value

if tbPartsOrd.attach("PartsOrd") then
tbPartsOrd.setRange(arRangeInfo)

nuCount = tbPartsOrd.cCount(1)

nuCount.view("Number of big orders by Frank P. Borland:")
else
errorShow("Can't open the table.")
endif
endMethod


See Also for Table::setRange
See Also

setGenFilter

setIndex

TCursor::setRange

UIObject::setRange

Using Ranges and Filters


Table::setReadOnly
setReadOnly

See Also	Example	Table Type

Method

Specifies whether to give the user read-only rights to a table when it is opened.

Syntax

setReadOnly ( [ const yesNo Logical ] )

Description

setReadOnly specifies whether to give the user read-only rights to a table when it is opened. This method fails if the table has been locked by another user or if the table is open.

Optional argument yesNo specifies whether to set read-only rights: a value of Yes grants read-only rights, a value of No allows full rights to the table. If omitted, yesNo is Yes by default.


Example for Table::setReadOnly
setReadOnly Example

The following code attaches a Table variable to the Orders table, issues setReadOnly to limit user rights, then opens a TCursor for Orders.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tblVar Table
  tc TCursor
endVar

tblVar.attach("Orders.db")  ; attach Table var to Orders.db
tblVar.setReadOnly()        ; set Table to read-only
tc.open(tblVar)             ; open a TCursor for Orders.db

endMethod


See Also for Table::setReadOnly
See Also

setExclusive


Table::showDeleted
showDeleted

See Also	Example	Table Type

Method

Specifies whether to display deleted records in a dBASE table.

Syntax

showDeleted ( [ const yesNo Logical ] ) Logical

Description

Records deleted from a dBASE table aren't immediately removed. Instead, they are flagged for deletion and removed later. showDeleted specifies whether to display these records when the table is opened. showDeleted is relevant only for dBASE table.

Optional argument yesNo specifies whether to show deleted records (a value of Yes) or hide deleted records (a value of No). If omitted, yesNo is Yes by default. If you don't call this method before using the Table variable associated with the table, deleted records are not shown.


Example for Table::showDeleted
showDeleted Example

For the following example, the pushButton method attached to the showDeletedRecs button instructs a Table variable's deleted records be shown.

; showDeletedRecs::pushButton
method pushButton(var eventInfo Event)
var
  tblVar Table
endVar

tblVar.attach("Orders.dbf")
if isTable(tblVar) then

  ; show deleted records in Orders.dbf
  tblVar.showDeleted(Yes)

  ; display sum of deleted and undeleted records
  msgInfo("Total # of Records", tblVar.nRecords())
else
  msgStop("Error", "Can't find Orders table.")
endif

endMethod


See Also for Table::showDeleted
See Also

compact

delete


Table::sort
sort

See Also	Example	Table Type

Keyword

Sorts a table.

Syntax

sort sourceTable [ on fieldNameList [ D ] ] [ to destTable ] 	endSort

Description

sort fills in a sort form for the table specified in sourceTable and performs the sort.

sourceTable can be of type Table, TCursor, or String. destTable can be of type Table or String. However, you can't sort a TCursor onto itself.

If you include the optional on clause, the table is sorted on the first field specified in fieldNameList. Each subsequent field is used, in turn, to settle ties in the preceding fields. An optional D after a field name specifies a sort in descending order. If you omit the on clause, records are sorted in ascending order, moving from left to right across the fields.

If you include the optional to clause, the result of the sort is written to the table described by destTable. If that table already exists, it is overwritten without asking for confirmation. If you omit the to clause, the sorted records are placed back sourceTable (this fails if the table is open). You must specify the to clause if the source table is keyed.

sort automatically places a full lock on tables being sorted if the result will be written to the same table. Otherwise, a write lock is required for the source table and a full lock for the destination table.

sort is not a method, so dot notation, as in

tableVar.sort()

is inappropriate. Instead, you create a structure to specify how to sort the table.


Example for Table::sort
sort Example

The following example sorts Customer on the Last Name and First Name fields, and places the results in in the CustSort table.

; sortCustTable::pushButtton
method pushButton(var eventInfo Event)
var
  custTbl Table
  tv TableView
endVar

custTbl.attach("Customer.db")

sort custTbl
  on "Last Name" D, "First Name" D     ; sort in descending order
  to "CustSort.db"
endSort

tv.open("CustSort.db")                 ; open the sorted table

endMethod


See Also for Table::sort
See Also

index

TCursor::sortTo


Table::subtract
subtract

See Also	Example	Table Type

Beginner

Method/Procedure

Subtracts the records in one table from another table.

Syntax

1. subtract ( const destTableName String ) Logical

2. subtract ( const destTableName Table ) Logical

Description

subtract checks whether any records in the source table are also in destTableName. If so, subtract deletes them from destTableName without asking for confirmation.

If destTable is keyed, subtract deletes all records with keys that exactly match values in corresponding key fields in the source table. If destTable is not keyed, subtract deletes all records that exactly match any record in the source table. Whether tables are keyed or not, this method considers only fields that could be keyed (based on data type, not position). For example, numeric fields are considered, but formatted memos are not. This method requires read/write access to both tables.

Note:	If the destination table is not keyed, this operation can be time-consuming.

This method tries, for the duration of the retry period, to place a full lock on both tables. If locks cannot be placed, an error results.

DOS

The following procedure is provided as a convenience to DOS PAL programmers. You can use this procedure to operate on tables by specifying the table name, rather than using a variable.

Syntax

1. subtract ( const sourceTableName String, const destTableName String ) Logical

2. subtract ( const sourceTableName String, const destTableName Table ) Logical


Example for Table::subtract
subtract Example

The following code subtracts from Customer matching records found in the Inserted table in the private directory.

; subtractCust::pushButton
method pushButton(var eventInfo Event)
var
  insTbl, CustTbl Table
  fs FileSystem
  tblName String
endVar
tblName = privDir() + "\\Inserted.db"

insTbl.attach(tblName)
if insTbl.isTable() then
  insTbl.subtract(custTbl)    ; remove from custTbl matching records in insTbl
else
  msgInfo("Sorry", "Can't find " + tblName + " table.")
endif

endMethod


See Also for Table::subtract
See Also

add


Table::tableRights
tableRights

See Also	Example	Table Type

Method/Procedure

Specifies whether the user has rights to perform certain operations on a table.

Syntax

tableRights ( const rights String ) Logical

Description

tableRights reports about a user's rights to a table, where rights is one of the following:

Value	Description

"ReadOnly"	Read from the table, but not change it.

"Modify"	Enter or change data.

"Insert"	Add new records.

"InsDel"	Add and delete records.

"Full" or "All"	Perform all of the above operations.

This method returns True if the user has the specified rights; otherwise, it returns False.

DOS

The following procedure is provided as a convenience to DOS PAL programmers. You can use this procedure to operate on tables by specifying the table name, rather than using a variable.

Syntax

tableRights ( const tableName String, const rights String )


Example for Table::tableRights
tableRights Example

The following example reports whether the user has "All" rights to the Orders table.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  myRights Logical
  ordTbl   Table
endVar

ordTbl.attach("Orders.db")
if ordTbl.isTable() then
  myRights = ordTbl.tableRights("All")

  ; this displays True if you have All rights to Orders.db
  msgInfo("All Rights?", myRights)

else
  message("Can't find Orders table.")
endif
endMethod


See Also for Table::tableRights
See Also

familyRights


Table::type
type

See Also	Example	Table Type

Method

Returns the type of a table.

Syntax

type ( ) String

Description

type returns the string value "PARADOX" or "DBASE" to report the type of a table.


Example for Table::type
type Example

The following code compacts (removes deleted records from) the Orders table if type returns DBASE; otherwise, a message informs the user.

; compactButton::pushButton
method pushButton(var eventInfo Event)
var
  tblVar Table
endVar
tblVar.attach("orders.dbf:)
if tblVar.type() = "DBASE" then
  tblVar.compact()
else
  msgStop("Stop!", "Orders is a " + tblVar.type() + " table.")
endif

endMethod


See Also for Table::type
See Also

attach


Table::unAttach
unAttach

See Also	Example	Table Type

Method

Ends the association between a Table variable and a table description.

Syntax

unAttach ( ) Logical

Description

unAttach ends the association (created using attach or create) between a Table variable and a table description. You don't have to end the association between a Table variable and a table to attach the same variable to another table---unAttach is automatically called when a Table variable is assigned to a different table.


Example for Table::unAttach
unAttach Example

In the following example, a single Table variable is used to summarize sales information from two different tables. Once the Table variable (tableVar) is no longer needed this code calls unAttach to end the association between tableVar and the table.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tableVar Table
  q1, q2   Number
  msg      String
endVar

tableVar.attach("q1_sales.db")  ; attach to q1_sales table
q1 = tableVar.cSum("Amount")    ; get a summary

tableVar.attach("q2_sales.db")  ; no need to unattach
q2 = tableVar.cSum("Amount")    ; get summary from q2_sales

tableVar.unAttach()             ; we don't need tableVar anymore
                                ; so end the association to q2_sales

switch

case q2 < q1 : msg = "Sales are down."

case q2 = q1 : msg = "Sales are flat."

case q2 > q1 : msg = "Sales are up."

endSwitch

msgInfo("Sales", msg)

endMethod


See Also for Table::unAttach
See Also

attach


Table::unlock
unlock

See Also	Example	Table Type

Beginner

Method

Unlocks a specified table.

Syntax

unlock ( const lockType String ) Logical

Description

unlock attempts to remove locks explicitly placed on the table associated with a Table variable, where lockType is one of the following String values, listed in order of decreasing strength and increasing concurrency.

String value	Description

Exclusive	The current session has exclusive access to the table. No other session can open the table. Cannot be used with dBASE tables.

Full	The current session can restructure, write to, and read from the table. No other session can write to or restructure the table, they can only read from it. Cannot be used with dBASE tables.

Write	The current session can write to and read from the table. No other session can place a write lock or a read lock on the table.

Read	The current session can read from the table. No other session can place a write lock, full lock, or exclusive lock on the table.

unlock removes locks explicitly placed by a particular user or application using lock; it has no effect on locks placed automatically by Paradox. Each time you lock a table explicitly, be sure to unlock it as soon as you no longer need the explicit lock. This ensures maximum concurrent availability of tables. Also, when you lock a table twice, you must unlock it twice. You can use lockStatus (defined for the TCursor and UIObject types) to determine how many explicit locks you have placed on a table. unlock returns False if you try to unlock a table that isn't locked or cannot be unlocked.

If successful, this method returns True; otherwise, it returns False.


Example for Table::unlock
unlock Example

For the following example, the pushButton method for updateCust runs a query from an existing file, then adds records from the Answer table to the Customer table. This code attempts to place a write lock on the Customer table before adding records to it. If the lock succeeds, this code proceeds to add Answer records, then uses unlock to unlock Customer.

; updateCust::pushButton
method pushButton(var eventInfo Event)
var
  newCust Query
  ansTbl Table
  destTbl String
endVar
destTbl = "Customer.db"

newCust.readFromFile("getCust.qbe")

if newCust.executeQBE() then           ; If the query succeeds,
  ansTbl.attach(":PRIV:Answer.db")
  if destTbl.lock("Write") then        ; try to write lock the table.
    ansTbl.add(destTbl)                ; Add records from Answer.db.
    destTbl.unLock("Write")            ; Unlock the table.
  else
    msgStop("Stop", "Can't write lock " + destTbl + " table.")
  endif
else
  msgStop("Stop!", "Query failed.")
endIf

endMethod


See Also for Table::unlock
See Also

lock

TCursor::lockStatus

UIObject::lockStatus


Table::unProtect
unProtect

See Also	Example	Table Type

Method/Procedure

Decrypts and removes an owner password from a table.

Syntax

1. ( Procedure ) unProtect ( const tableName String [ , const Password String] )

2. ( Method ) unProtect ( [const password String] )

Description

unProtect permanently removes an owner password from a table. A protected table is encrypted and cannot be accessed without presenting the password specified in password. If you have already issued the master password for a table, password is not necessary.


Example for Table::unProtect
unProtect Example

The following example permanently removes password-protection from the Secrets table.

; decrypt::pushButton
method pushButton(var eventInfo Event)
var
  tblVar Table
  tblName String
endVar

tblName = "Secrets.db"
tblVar.attach(tblName)
if tblVar.isEncrypted() then
  tblVar.unprotect("Get007")   ; permanently remove password
                               ; this assumes Get007 is the master password
endif

endMethod


See Also for Table::unProtect
See Also

isEncrypted

protect

Session::addPassword

Session::removePassword


Table::usesIndexes
usesIndexes

See Also	Example	Table Type

Method

Specifies index files to use and maintain with a dBASE table.

Syntax

usesIndexes ( const indexFileName String [ , const indexFileName String ]* Logical

Description

usesIndexes specifies in indexFileName one or more index files (.NDX and .MDX) to maintain while you use a dBASE table. This method does not open the table, but specifies index files to open when the table is opened. Don't use this method to open production files (such as the .MDX file with the same name as the table) for a dBASE table---these files are opened automatically.

This method fails if any of the specified index files does not exist.


Example for Table::usesIndexes
usesIndexes Example

The following example calls usesIndexes to specify two different indexes in the Orders table, then opens a TCursor for the table.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tblVar Table
  tc     TCursor
endvar

tblVar.attach("Orders.dbf")
if tblVar.isTable() then

  ; specify NameStat and Ord_Name indexes
  tblVar.usesIndexes("NAMESTAT.NDX", "ORD_NAME.NDX")

  ; now attempt to open the table, using the specified indexes
  if tc.open(tblVar) then
    if tc.locate("State", "FL", "Contact", "Simons") then
      msgInfo("Order Date", tc."Order Date")
    else
      msgStop("Error", "Can't find values.")
    endif
  endif
else
  msgStop("Error", "Can't find Orders.dbf table.")
endif
endMethod


See Also for Table::usesIndexes
See Also

Paradox Help: Indexes

reIndex

reIndexAll

setIndex


Using Ranges and Filters

See Also

In broad terms, both ranges and filters enable you to select a subset of the records in a Table variable, a TCursor, or a UIObject. However, ranges and filters operate differently.

A range is based on the fields in an index, so applying a range to a table results in a subset of records that are contiguous and consecutive. Therefore, a range generally gives faster performance than a filter.

A filter offers greater flexibility in selecting fields and specifying criteria. A filter can be based on any field in a table; it is not restricted to fields in an index. Also, a filter can use expresssions to specify criteria, but a range cannot. For example, a filter could select records in which the Quantity field has values of 125, 200, and 350, but a range could only specify values ranging from 125 to 350.


See Also for Using Ranges and FIlters
See Also

Table::setGenFilter

TCursor::setGenFilter

UIObject::setGenFilter

Table::setRange

TCursor::setRange

UIObject::setRange

Paradox Help: Filters


TableView Type

A TableView object displays the data in a table in its own window. A TableView object is distinct from a table frame, which is a UIObject placed in a form, and from a TCursor, a programmatic construct that points to the data in a table.

When you declare a TableView variable, then open a TableView object to that variable, you create a handle to the TableView window, something you can refer to in your code to manipulate the TableView object.

TableView methods are a subset of the methods for the Form type. You can use them to control the Table window's size, position, and appearance. Although you can start and end Edit mode for a table view, you cannot use ObjectPAL to directly edit the data in a table view. You can use ObjectPAL to manipulate TableView properties in these main areas:

The TableView object as a whole---for example, background color, grid style, number of records, and the value of the current record

The field-level data in the table (TVData)---for example, font, color, and display format

The table view heading (TVHeading)---for example, font, color, and alignment

The TableView type includes several derived methods from the Form type.

Methods for the TableView Type

Form		TableView
bringToTop		action
getPosition		close
getTitle		moveToRecord
hide		open
isMaximized		wait
isMinimized
isVisible
maximize
minimize
setPosition
setTitle
show
windowHandle


TableView::action
action

See Also	Example	TableView Type

Method

Performs an action command.

Syntax

action ( const actionID SmallInt ) Logical

Description

action performs the action represented by the constant actionId, where actionId is a constant in one of the following action classes:

ActionDataCommands

ActionEditCommands

ActionFieldCommands

ActionMoveCommands

ActionSelectCommands

You can also use action to send a user-defined action constant to a built-in action method. User-defined action constants are simply integers that don't interfere with any of ObjectPAL's constants. You can use them to signal other parts of an application. For instance, assume that the Const window for a form declares a constant named myAction. In the built-in action method for a page on the form, you might check the value of every incoming ActionEvent (with the id method); if the value is equal to myAction, you can respond to that action accordingly. Paradox's default response for user-defined action constants is simply to pass the action to the action method. For more information on defining constants, see the Guide to ObjectPAL.

This action method is distinct from the built-in action method for a TableView or for any form or UIObject. The built-in action method for an object responds to an action event; this method causes an ActionEvent.


Example for TableView::action
action Example

The following example opens a table view for the Orders table, moves the cursor to the end of the table, starts Edit mode, and inserts a new blank record. This code is attached to the pushButton method for a button named startEditInsert.

; startEditInsert::pushButton
method pushButton(var eventInfo Event)
var
  orderTV  TableView
endVar
if orderTV.open("Orders") then
  orderTV.action(DataEnd)           ; move to the end of the table
  orderTV.action(DataBeginEdit)     ; start Edit mode
  orderTV.action(DataInsertRecord)  ; insert a new blank record
  orderTV.wait()                    ; wait until TableView object is closed
  orderTV.close()                   ; close when return
else
  msgStop("Status", "Could not find Orders table.")
endif
endMethod


See Also for TableView::action
See Also

open


TableView::close
close

See Also	Example	TableView Type

Method

Closes a table window.

Syntax

close ( )

Description

close closes a table window, equivalent to choosing Close from the Control menu.


Example for TableView::close
close Example

In the following example, the open method for a form opens a TableView object for the Customer table to the global variable custTV. When the form closes, the close method for the form closes the custTV table view. This code is attached to the close method for the form:

; thisForm::close
method close(var eventInfo Event)
if eventInfo.isPreFilter()
  then
    ; code here executes for each object in form
  else
    ; code here executes just for form itself
    custTV.close()     ; close the Customer table that was
                       ; opened by thisForm's open method
endif
endMethod

This is the code for the form's Var window.

; thisForm::Var
Var
  custTV  TableView   ; global to form, the TableView object is opened by
                      ; form's open method
endVar

This is the code for the form's open method.

; thisForm::open
method open(var eventInfo Event)
if eventInfo.isPreFilter()
  then
    ; code here executes for each object in form
  else
    ; code here executes just for form itself
    custTV.open("Customer")  ; open the Customer table view
endif
endMethod


See Also for TableView::close
See Also

open


TableView::moveToRecord
moveToRecord

See Also	Example	TableView Type

Method

Moves to a specific record in a table.

Syntax

moveToRecord ( const tc TCursor ) Logical

Description

moveToRecord sets the current record to the record pointed to by the TCursor tc. This method can be very slow for dBASE tables; use the RecNo property instead.


Example for TableView::moveToRecord
moveToRecord Example

The following example uses a TCursor to search for a customer named Jones, then calls moveToRecord to make a table view display that record. The following code is attached to a button's built-in pushButton method.

method pushButton (var eventInfo Event)
var
   custTC TCursor
   custTV TableView
endVar

custTC.open ("customer.db")
custTV.open ("customer.db")

if custTC.locate ("Last Name", "Jones") then
  custTV.moveToRecord (custTC)
else
   msgInfo("Search failed", "Couldn't find Jones.")
endIf

endMethod


See Also for TableView::moveToRecord
See Also

action


TableView::open
open

See Also	Example	TableView Type

Method

Opens a table window.

Syntax

1. open ( const tvName String [, const windowStyle LongInt] ) Logical

2. open ( const tvName String, const windowStyle LongInt, const x SmallInt, const y SmallInt, const w SmallInt, const h SmallInt ) Logical

Description

open displays the table specified in tvName in a table window. Optional arguments specify (in twips) the location of the upper left corner of the form (x and y), the width and height (w and h), and style (windowStyle). The windowStyle argument is ignored, but required for syntax 2. If you want to specify a size and position, you can use a window style constant of WinStyleDefault.


Example for TableView::open
open Example

In the following example, the pushButton method for a button named openWaitOrders opens the Orders table, then waits until the user closes the table.

; openWaitOrders::pushButton
method pushButton(var eventInfo Event)
var
  ordersTV  TableView
endVar
if ordersTV.open("Orders", WinStyleDefault, 100, 100,
                 1440*5, 1440*4) then
  ordersTV.wait()    ; wait for user to close
  ordersTV.close()   ; close Orders table
endif
endMethod


See Also for TableView::open
See Also

close


TableView::wait
wait

See Also	Example	TableView Type

Method

Suspends execution of a method.

Syntax

wait ( )

Description

wait suspends execution of a method. Execution resumes when the TableView object is closed. Note that you must follow a wait with a close. When a TableView object has been called by wait, the calling method suspends execution until the TableView object is closed by the user.


Example for TableView::wait
wait Example

See the example for open.


See Also for TableView::wait
See Also

close

open


TCursor Type

Changes

A TCursor is a pointer to the data in a table, enabling you to manipulate data without having to display the table. It is not a clone or a copy of the table---editing records in a TCursor changes the underlying table, and any locks on the table affect the TCursor. A TCursor can point to an entire table, or to a subset of the records in a table (for example, as specified by a restricted view, detail set, filter, or range).

For information about related objects, refer to the Table, TableView, and UIObject types.

Some table operations require Paradox to create temporary tables. Paradox creates these tables in the private directory.

Methods for the TCursor Type

TCursor

add

atFirst

atLast

attach

attachToKeyViol

bot

cancelEdit

cAverage

cCount

close

cMax

cMin

cNpv

compact

copy

copyFromArray

copyRecord

copyToArray

cSamStd

cSamVar

cStd

cSum

currRecord

cVar

deleteRecord

didFlyAway

dmAttach

dropGenFilter

dropIndex

edit

empty

end

endEdit

enumFieldNames

enumFieldNamesInIndex

enumFieldStruct

enumIndexStruct

enumLocks

enumRefIntStruct

enumSecStruct

enumTableProperties

eot

familyRights

fieldNo

fieldRights

fieldSize

fieldType

fieldUnits2

fieldValue

forceRefresh

getGenFilter

getIndexName

getLanguageDriver

getLanguageDriverDesc

getRange

home

initRecord

insertAfterRecord

insertBeforeRecord

insertRecord

instantiateView

isAssigned

isEdit

isEmpty

isEncrypted

isRecordDeleted

isShared

isShowDeletedOn

isValid

isView

locate

locateNext

locateNextPattern

locatePattern

locatePrior

locatePriorPattern

lock

lockRecord

lockStatus

moveToRecord

moveToRecNo

nextRecord

nFields

nKeyFields

nRecords

open

postRecord

priorRecord

qLocate

recNo

recordStatus

reIndex

reIndexAll

seqNo

setFlyAwayControl

setFieldValue

setGenFilter

setRange

showDeleted

skip

subtract

switchIndex

tableName

tableRights

type

unDeleteRecord

unlock

unlockRecord

updateRecord


Changes to TCursor type methods

The following table lists new methods and methods that were changed for version 5.0.

New	Changed

createIndex	attach

dmAttach	enumFieldStruct

getGenFilter	enumIndexStruct

getIndexName	enumRefIntStruct

getRange	enumSecStruct

instantiateView	fieldType

isView	nRecords

setGenFilter	open

setRange	recNo

seqNo

setFilter was replaced by setRange which offers enhanced functionality and performance. Code that calls setFilter will continue to execute as before.


TCursor::add
 add

See Also	Example	TCursor Type

Method

Adds the records of one table to another.

Syntax

1. add ( const destTable String [, const append Logical [, const update Logical ] ] ) Logical

2. add ( const destTable Table [, const append Logical [, const update Logical ] ] ) Logical

3. add ( const destTable TCursor [, const append Logical  [, const update Logical ] ] ) Logical

Description

add adds the records pointed to by a TCursor to the destination table specified in destTable. If the destination does not exist, this method creates it. The source table and the destination table can be the same type or different types; in any case, the tables must have compatible field structures.

Arguments append and update can be True or False. When True, append adds records at the end of a non-indexed table, or at the appropriate places in an indexed table. When True, update compares records in both tables, and where key values match, replaces the data in the destination table. When both are True, records with matching key values are updated, and others are appended. These arguments are optional, but if you specify update, you must also specify append. If omitted, both are True. Here are some example statements:

myTCursor.add(yourTable, False, True) ; specifies update
myTCursor.add(yourTable) ; specifies update and append by default

When tables are indexed, add uses the indexed fields to determine which records to update and which to append. When the destination table is not indexed, add fails if update is True. Key violations (including validity check violations), if any, are listed in KEYVIOLS.DB in the user's private directory. This method overwrites an existing KEYVIOLS.DB or creates one, if necessary. add respects the limits of restricted views set by setRange or setGenFilter.

This method tries, for the duration of the retry period, to place write locks on the source table and the destination table. If either lock cannot be placed, the method fails.


Example for TCursor::add
add Example

In the following example, assume the OldCust and NewCust tables exist in the current directory. The following code associates a TCursor with each of the tables, adds NewCust records to OldCust, then adds all records to a table named MyCust. If MyCust does not exist in the current directory, add creates it. This code is attached to a button's pushButton method.

; getMyCust::pushButton
method pushButton(var eventInfo Event)
var
  dTC, sTC TCursor
endVar

if sTC.open("oldCust.db") and
   dTC.open("newCust.db") then  ; if both TCursors can be associated
   dTC.add(sTC, True)           ; append oldCust records to newCust records
                                ; -now sTC has records from both tables

   sTC.add("myCust.db", True)   ; add sTC to myCust table

   sTC.close()                  ; close both TCursors
   dTC.close()
else
   msgStop("Stop!", "Could not open one or more tables.")
endif

endMethod


See Also for TCursor::add
See Also

copy

subtract


TCursor::atFirst
atFirst

See Also	Example	TCursor Type

Method

Reports whether the TCursor is pointing to the first record of a table.

Syntax

atFirst ( ) Logical

Description

atFirst returns True if the TCursor is pointing to the first record of a view of a table; otherwise, it returns False.


Example for TCursor::atFirst
atFirst Example

The following example assumes a form has a button named moveToFirst, and a multi-record object bound to ORDERS.DB. The code attached to the pushButton method for moveToFirst uses atFirst to determine if the TCursor is at the first record. If it isn't, this code moves to the first record.

; moveHome::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
endVar

tc.attach(orders)         ; orders is a multi-record object
if not tc.atFirst() then  ; if not at the first record
  tc.home()               ; move to it
  orders.moveToRecord(tc) ; move highlight to first record
else
  msgStop("Currently on record " + String(tc.recNo()),
          "You're already at the top of the list!")
endif
endMethod


See Also for TCursor::atFirst
See Also

atLast

bot

eot


TCursor::atLast
atLast

See Also	Example	TCursor Type

Method

Reports whether the TCursor is pointing to the last record of a table.

Syntax

atLast ( ) Logical

Description

atLast returns True if the TCursor is pointing to the the last record of a view of a table; otherwise, it returns False.


Example for TCursor::atLast
atLast Example

The following example assumes a form has a button named moveToLast, and a multi-record object bound to ORDERS.DB. The code attached to the pushButton method for moveToLast uses atLast to determine if the TCursor is on the last record. If it isn't, this code moves to the last record.

; moveToLast::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
endVar

tc.attach(ORDERS)
if not tc.atLast() then   ; if not on the last record
  tc.end()                ; move TCursor to the last record
  orders.moveToRecord(tc) ; move highlight to the last record
else
  msgStop("Currently on record " + String(tc.recNo()),
          "You're already at the last record!")
endif
endMethod


See Also for TCursor::atLast
See Also

atFirst

bot

eot


TCursor::attach
attach

See Also	Examples	TCursor Type	Changes

Method

Associates a TCursor with a table.

Syntax

1. attach ( const object UIObject ) Logical

2. attach ( const srcTCursor TCursor ) Logical

3. attach ( const tv TableView ) Logical

Description

attach associates a TCursor with a specified table. The data (including filters, indexes, and edit mode) comes from the underlying table---the TCursor gets no data from records that have not been committed (for example, because the record is being edited or has just been inserted).

Syntax 1 associates a TCursor with the table displayed in the UIObject object.

Syntax 2 associates the TCursor with the table represented by another TCursor, srcTCursor.

Syntax 3 associates the TCursor with the TableView object tv.

attach returns True if successful; otherwise, it returns False and adds the following warning to the error stack: "You have tried to access a document that is not open." (Warning added in version 5.0.)


Example for TCursor::attach
attach Examples

In the following example, assume a form contains a table frame bound to ORDERS.DB, and another table frame bound to LINEITEM.DB. The Orders table has a one-to-many link to LineItem. A button named findDetails is also on the form. Suppose you want the user to be able to search through the entire LineItem table---not just those records linked to the current order. In this case, the pushButton method for findDetails searches for orders that include the current part number.

This code is attached to the Var window for the findDetails button:

; findDetails::Var
Var
  lineTC TCursor  ; instance of LINEITEM for searching
endVar

The code that follows is attached to the open method for the findDetails button. This code associates the lineTC TCursor with LINEITEM.DB.

; findDetails::open
method open(var eventInfo Event)
lineTC.open("LineItem.db")
endMethod

The following code is attached to the pushButton method for findDetails:

; findDetails::pushButton
method pushButton(var eventInfo Event)
var
stockNum,

orderNum	Number
orderTC	TCursor
endVar

; Get Stock No from current LineItem record.

stockNum = LINEITEM.Stock_No

; LineTC was declared in Var window and opened by open method.
if NOT lineTC.locateNext("Stock No", stockNum) then
  lineTC.locate("Stock No", stockNum)
endIf

orderTC.attach(ORDERS)       ; Attach TCursor to table frame.
orderTC.locate("Order No", lineTC."Order No")
ORDERS.moveToRecord(orderTC) ; Move to CUSTOMER and
                             ; resynchronize with TCursor.
LINEITEM.moveTo()            ; Move TCursor to LINEITEM detail.

; Move TCursor to matching record.
LINEITEM.locate("Stock No", stockNum)
endMethod

This code is attached to the close method for findDetails:

; findDetails::close
method close(var eventInfo Event)
lineTC.close()   ; Close the TCursor to LineItem.
endMethod


See Also for TCursor::attach
See Also

isValid


Changes to TCursor::attach

attach returns True if successful; otherwise, it returns False and adds the following warning to the error stack: "You have tried to access a document that is not open." (Warning added in version 5.0.)


TCursor::attachToKeyViol
attachToKeyViol

See Also	Example	TCursor Type

Method

Attaches a TCursor to the existing record that has the same key as the record you attempted to post.

Syntax

attachToKeyViol ( const oldTC TCursor ) Logical

Description

After a key violation occurs, attachToKeyViol attaches a TCursor to the existing record---the record that existed before the key violation occurred. Specify in oldTC the TCursor that points to the record that caused the key violation (the new, unposted record).

This method gives you a way to compare conflicting records before replacing or discarding a change to an existing record. oldTC must already be pointing to the new (yet unposted) record.


Example for TCursor::attachToKeyViol
attachToKeyViol Example

The following example demonstrates how attachToKeyViol can be used after a key violation occurs. The code declares two TCursors: keyViolTC and originalRecTC. The code opens keyViolTC for the Orders table, then deliberately inserts a record whose key value conflicts with another record. Then, the example attempts to post the new record to the table, which forces a key violation. At this point, if the user chooses to view the existing record, the code calls attachToKeyViol, attaches the second TCursor (originalRecTC) to the original record, and displays the record in a view dialog box. If the user chooses to update the original record with data from the new record, this example calls updateRecord method to do so; otherwise, the code makes no changes.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  keyViolTC, originalRecTC TCursor
  rec DynArray[] AnyType
endvar

keyViolTC.open("Orders.db")          ; open TCursor for Orders
keyViolTC.edit()                     ; put TCursor in Edit mode
keyViolTC.insertRecord()             ; insert a new record
keyViolTC."Order No" = 1011          ; 1011 is a duplicate key

; if this attempt to post the new record fails
if NOT keyViolTC.postRecord() then

  ; attach originalRecTC to the existing record
  originalRecTC.attachToKeyViol(keyViolTC)

  ; give user the option to see the existing record
  if msgQuestion("Key Exists!",
     "Do you want to see the existing record?") = "Yes" then

    originalRecTC.copyToArray(rec)   ; copy existing record to rec
    rec.view("Original Record")      ; display rec in a dialog box

  endif

  ; give user the option to replace the existing record
  if msgQuestion("Confirm Update",
     "Do you want to replace existing record?") = "Yes" then

    ; force the new record to post
    keyViolTC.updateRecord(True)
  else
    message("Original record left intact.")
    sleep(1500)
  endif
else
  message("Posted order number 1011.")
endif

endMethod


See Also for TCursor::attachToKeyViol
See Also

postRecord

updateRecord


TCursor::bot
bot

See Also	Example	TCursor Type

Method

Tests for a move past the beginning of a table.

Syntax

bot ( ) Logical

Description

bot returns True if a command attempts to move past the first record of a table; otherwise, it returns False. bot is reset by the next move operation.


Example for TCursor::bot
bot Example

The following example moves a TCursor backwards through a table then displays a message. This code is attached to a button's pushButton method.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  myTable TCursor
endVar
myTable.open("sites.db")
myTable.end()                         ; moves to end of table
while myTable.bot() = False           ; loop until we hit the top
   myTable.priorRecord()              ; move backwards through table
endWhile
msgInfo("The Top", "You're at the beginning.")
msgInfo("At the top?", myTable.bot()) ; displays True
myTable.nextRecord()
msgInfo("At the top?", myTable.bot()) ; displays False
endMethod


See Also for TCursor::bot
See Also

atFirst

atLast

end

eot

home


TCursor::cancel
cancelEdit

See Also	Example	TCursor Type

Beginner

Method

Ends Edit mode without saving changes to the current record.

Syntax

cancelEdit ( ) Logical

Description

cancelEdit takes a TCursor out of Edit mode without saving changes to the current record. You must use cancelEdit before moving the TCursor from the current record or otherwise committing or unlocking the record. Once you move the TCursor, changes to the record are committed.


Example for TCursor::cancel
cancelEdit Example

The code for the following example is attached to the pushButton method for the changeKey button. This example associates a TCursor with the Customer table then attempts to change a value in a keyed field. If the record can not be successfully posted (for example, because of a key violation) this example displays an error message, then calls cancelEdit to restore the record to the original values and end Edit mode.

; changeKey::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
  rec Array[] AnyType
endVar

tc.open("Customer.db")
if tc.locate("Customer No", 1231) then
  tc.edit()

  tc."Customer No" = 1221   ; attempt to change key value
  if not tc.endEdit() then  ; if endEdit fails
    errorShow("Can't complete the operation.")
    tc.cancelEdit()         ; restore record and leave edit mode
    message("Record left intact.")
  else
    message("Key value changed.")
  endif
else
  errorShow("Can't find Customer 1231")
endif

endMethod


See Also for TCursor::cancel
See Also

edit

endEdit


TCursor::cAverage
cAverage

See Also	Example	TCursor Type

Method

Returns the average value of a field (column) in a table.

Syntax

1. cAverage ( const fieldName String ) Number

2. cAverage ( const fieldNum SmallInt ) Number

Description

cAverage returns the average of values in the column of fields specified by fieldName or fieldNum. This method respects the limits of restricted views set by setRange or setGenFilter.  cAverage handles blank values as specified in the blankAsZero setting for the session.

This method tries, for the duration of the retry period, to place a write lock on the table. If a lock cannot be placed, the method fails.


Example for TCursor::cAverage
cAverage Example

The following example uses cAverage to calculate the average order size in the Orders table. This code is attached to the pushButton method for the getAvgSales button.

; getAvgSales::pushButton
method pushButton(var eventInfo Event)
var
  ordTC TCursor
  avgSales Number
endVar

; open TCursor for ORDERS table
ordTC.open("Orders.db")
; store average invoice total in avgSales variable
avgSales = ordTC.cAverage("Total Invoice")
; display avgSales in a dialog
msgInfo("Average Order size", avgSales)

endMethod


See Also for TCursor::cAverage
See Also

cCount

cSum

cMax

cMin

cStd

Session::blankAsZero


TCursor::cCount
cCount

See Also	Example	TCursor Type	Changes

Method

Returns the number of values in a field (column) of a table.

Syntax

1. cCount ( const fieldName String ) LongInt

2. cCount ( const fieldNum SmallInt ) LongInt

Description

cCount returns the number of values in the column (field) specified by fieldName or fieldNum. cCount works for all field types. If the field is numeric, this method handles blank values as specified in the blankAsZero setting for the session. If the field is non-numeric, cCount returns the number of nonblank values in the column of fields. In version 5.0, this method was changed to return a LongInt instead of a Number.

This method respects the limits of restricted views set by setRange or setGenFilter.

This method tries, for the duration of the retry period, to place a write lock on the table. If a lock cannot be placed, the method fails.

cCount is useful for returning the number of entries used by another column function.


Example for TCursor::cCount
cCount Example

The following example opens a TCursor for a table, then uses cCount to display the number of records in the TCursor. This code is attached to the pushButton method for the lineItemInfo button.

; lineItemInfo::pushButton

method pushButton(var eventInfo Event)

var

  numbersTC TCursor

  avgQty Number

  numRecs LongInt

endVar

numbersTC.open("Lineitem.db")

avgQty = numbersTC.cAverage("Qty")

numRecs = numbersTC.cCount(4)        ; assumes Quantity is field 4

msgInfo("Average quantity", "Average quantity: " +

String(avgQty) + " \nbased on " + String(numRecs) + " records.")

endMethod


See Also for TCursor::cCount
See Also

cAverage

cSum

cMax

cMin

cStd

Session::blankAsZero


Changes to TCursor::cCount

In version 5.0, this method was changed to return a LongInt instead of a Number.


TCursor::close
close

See Also	Example	TCursor Type

Beginner

Method

Closes a table.

Syntax

close ( ) Logical

Description

close closes a TCursor, and makes the TCursor variable unassigned. If the current record cannot be committed, close still closes the TCursor, but discards any changes to the record.


Example for TCursor::close
close Example

The following example opens a TCursor for a table, displays information found in the last record, then closes the TCursor. In this example, the code displays a message indicating whether the TCursor variable is still assigned after the TCursor is closed. This code is attached to the built-in pushButton method for thisButton.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
endVar

tc.open("Orders.db")  ; open TCursor for the Orders table
tc.end()              ; move to the end of the table

; display information in the last record
msgInfo("Last Order", "Order number: " + String(tc."Order No") +
        " \nOrder date: " + String(tc."Sale Date"))

tc.close()                                   ; close tc TCursor
msgInfo("Is tc Assigned?", tc.isAssigned())  ; displays False

endMethod


See Also for TCursor::close
See Also

isAssigned

open


TCursor::cMax
cMax

See Also	Example	TCursor Type

Method

Returns the maximum value of a field (column) in a table.

Syntax

1. cMax ( const fieldName String ) Number

2. cMax ( const fieldNum SmallInt ) Number

Description

cMax returns the maximum value in the column of fields specified by fieldName or fieldNum. If the field is numeric, this method handles blank values as specified in the blankAsZero setting for the session. This method respects the limits of restricted views set by setRange or setGenFilter.

This method tries, for the duration of the retry period, to place a write lock on the table. If a lock cannot be placed, the method fails.


Example for TCursor::cMax
cMax Example

In the following example, assume a form has a button, getMaxBalance, and a table frame bound to the Orders table. In this code, the pushButton method for getMaxBalance associates the table frame with a TCursor then locates the highest balance due in the Orders table:

; getMaxBalance::pushButton
method pushButton(var eventInfo Event)
var
  ordTC TCursor
endVar

ordTC.attach(ORDERS)   ; ORDERS is a table frame on the form

; now locate the maximum value in the "Balance Due" field
ordTC.locate("Balance Due", ordTC.cMax("Balance Due"))
; syncronize the table frame to the TCursor
ORDERS.moveToRecord(ordTC)

endMethod


See Also for TCursor::cMax
See Also

cAverage

cMin

cSum

cCount

cStd

Session::blankAsZero


TCursor::cMin
cMin

See Also	Example	TCursor Type

Method

Returns the minimum value of a field (column) in a table.

Syntax

1. cMin ( const fieldName String ) Number

2. cMin ( const fieldNum SmallInt ) Number

Description

cMin returns the minimum value in the column of fields specified by fieldName or fieldNum. If the field is numeric, this method handles blank values as specified in the blankAsZero setting for the session. This method respects the limits of restricted views set by setRange or setGenFilter.

This method tries, for the duration of the retry period, to place a write lock on the table. If a lock cannot be placed, the method fails.


Example for TCursor::cMin
cMin Example

The following example uses both forms of the syntax to calculate minimum values in the ORDERS.DB table:

; showMinimums::pushButton
method pushButton(var eventInfo Event)
var
  OrdTC TCursor
  minBalDue, minOrder Number
endVar
OrdTC.open("Orders.db")
minBalDue = ordTC.cMin("Balance Due")  ; get minimum balance due
minOrder  = ordTC.cMin(6) ; assumes "Total Invoice" is field 6

; display results in a dialog box
msgInfo("Minimums", "Minimum balance due: " +

                     String(minBalDue) + "\n" +

                    "Minimum order : " + String(minOrder))
endMethod


See Also for TCursor::cMin
See Also

cMax

cAverage

cCount

cStd

cSum

Session::blankAsZero


TCursor::cNpv
cNpv

See Also	Example	TCursor Type

Method

Returns the net present value of a field (column), based on a specified discount or interest rate.

Syntax

1. cNpv ( const fieldName String, const discRate Number ) Number

2. cNpv ( const fieldNum SmallInt, const discRate Number ) Number

Description

cNpv returns the net present value of the entries in a column of fields. The calculation is based on the interest or discount rate discRate, where discRate is a decimal number (for example, 12 percent is expressed as .12). This method handles blank values as specified in the blankAsZero setting for the session.

This method tries, for the duration of the retry period, to place a lock on the table. If a lock cannot be placed, the method fails. This method respects the limits of restricted views set by setRange or setGenFilter.

This method calculates net present value using the following formula:

cNpv = sum(p=1 to n) of Vp/(1+i)p

where n = number of periods, Vp = cash flow in pth period, and

i = interest rate per period.


Example for TCursor::cNpv
cNpv Example

The following example associates a TCursor with the GoodFund table, then calculates the net present value for the Expected Return field. In this example, the net present value is calculated based on a monthly interest rate. This code is attached to the pushButton method for the calcNPV button.

; calcNPV::pushButton
method pushButton(var eventInfo Event)
var
  SavingsTC TCursor
  goodFundNPV, apr Number
endVar
SavingsTC.open("GoodFund.db")  ; associate TCursor with Savings table
apr = .125                     ; annual percentage rate

; now calculate net present value based on monthly interest rate
goodFundNPV = SavingsTC.cNpv("Expected Return", (apr / 12))
msgInfo("Net present value", goodFundNPV)

endMethod


See Also for TCursor::cNpv
See Also

cAverage

cSum


TCursor::compact
compact

See Also	Example	TCursor Type

Method

Removes deleted records from a dBASE table.

Syntax

compact ( [ const regIndex Logical ] ) Logical

Description

compact removes deleted records from a dBASE table. Deleted records are not immediately removed from a dBASE table. Instead, they are flagged as deleted and kept in the table. This method returns True if successful; otherwise, it returns False. The optional argument regIndex is used to specify whether to regenerate indexes associated with the table, or simply to update them. When regIndex is True, this method regenerates all indexes associated with the TCursor and frees any unused space in the indexes. When regIndex is False, indexes are not regenerated. If omitted, regIndex is True by default.

This method fails if any locks have been placed on the table, or if the table is open. If the table has maintained indexes, this method requires exclusive access; otherwise it requires a write lock.

The compact method defined for the TCursor type does not work with Paradox tables. To pack a Paradox table, use the compact method defined for the Table type.


Example for TCursor::compact
compact Example

The following example removes deleted records from the dBASE table named OLDDATA.DBF. This code is attached the pushButton method for the purgeTable button.

; purgeTable::pushButton
method pushButton(var eventInfo Event)

var

  tb Table

  tc TCursor

endVar

tb.attach("OldData.dbf")

tb.setExclusive()            ; Get exclusive rights to the table.

tc.open(tb)                  ; Associate TCursor with OldData table.

if tc.compact() then         ; Remove all deleted records.

tc.close()

message("Old records purged.")

else

errorShow()

endIf

endMethod


See Also for TCursor::compact
See Also

deleteRecord

showDeleted

Table::compact


TCursor::copy
copy

See Also	Example	TCursor Type

Method

Copies a table.

Syntax

1. copy ( const tableName String ) Logical

2. copy ( const tableName Table ) Logical

Description

copy copies a table to the destination table tableName. If tableName does not exist, copy creates it. If tableName already exists, copy overwrites it without asking for confirmation.

This method tries, for the duration of the retry period, to place a write lock on the source table and a full (exclusive) lock on the destination table. This method fails if either lock cannot be placed, or if the destination table is open.

This method does not respect the limits of restricted views.


Example for TCursor::copy
copy Example

The following example copies the Customer table to the NewCust table.

This code uses the isTable method (from the DataBase type) to test whether NewCust exists; if it does, the user is prompted to confirm the action before NewCust is overwritten:

; copyCust::pushButton
method pushButton(var eventInfo Event)
var
  sourceTC TCursor
  destTb Table
endVar
destTb.attach("NewCust.db")
sourceTC.open("Customer.db")

; if NewCust.db exists, ask for confirmation
if isTable(destTb) then
  if msgYesNoCancel("Copy table", "Overwrite Newcust.db?") = "Yes" then

    ; copy Customer.db records to NewCust.db
; If .VAL file contains only RI info, it is not copied.
    sourceTC.copy(destTb)
  endIf
endIf

endMethod


See Also for TCursor::copy
See Also

add

copyRecord

Paradox Help: Copying to a Different Table Type


TCursor::copyFromArray
copyFromArray

See Also	Example	TCursor Type

Method

Copies data from an array to the fields of the current record.

Syntax

1. copyFromArray ( const ar Array[ ] AnyTpe ) Logical

2. copyFromArray ( const ar DynArray[ ] AnyType ) Logical

Description

copyFromArray copies the elements of an array or a DynArray to the record pointed to by a TCursor, which must be in Edit mode.

Syntax 1 uses an array ar. The first element of the array is copied to the first field, the second element to the second field, and so on until the array is exhausted or the record is full.

Syntax 2 uses a DynArray ar, where each index is a field name or a field number, and the corresponding item is the field value.

The method fails if an attempt is made to copy an unassigned array element or if the structures do not match. (This can never happen if the array was created by copyToArray, because copyToArray assigns a blank value if a field is blank.) If there are more elements in the array than fields in the record, the extra elements are ignored. To copy a new record into an empty table, use insertRecord to insert a blank record before using copyFromArray.


Example for TCursor::copyFromArray
copyFromArray Example

In the following example, suppose CUSTNAME.DB has three fields: Last Name, A20; First name, A20; and Telephone, A12. This method associates a TCursor with the CustName table, creates an array with three elements, inserts a new record in the table, then uses copyFromArray to copy data from the array to the new record.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
  aa Array[3] AnyType
endVar
aa[1] = "Borland"
aa[2] = "Frank"
aa[3] = "555-1212"
if tc.open("CustName.db") then  ; open table
  tc.edit()                     ; copyFromArray works only in Edit mode
  tc.insertRecord()             ; insert new record
  tc.copyFromArray(aa)          ; copy from array to table
  tc.endEdit()
else
  msgStop("Stop", "Couldn't open CustName.db.")
endIf
endMethod


See Also for TCursor::copyFromArray
See Also

copyRecord

copyToArray

insertRecord

insertAfterRecord

insertBeforeRecord


TCursor::copyRecord
copyRecord

See Also	Example	TCursor Type

Method

Copies a record from one TCursor into another TCursor.

Syntax

copyRecord ( const sourceTC TCursor ) Logical

Description

copyRecord copies the record pointed to by one TCursor into the record pointed to by another TCursor. For example, the following code copies a record from the sourceTC TCursor into the destinationTC TCursor:

destinationTC.copyRecord(sourceTC)

The TCursor specified in sourceTC does not have to be in Edit mode; the TCursor you're copying to (the destination TCursor) does. This method fails if any field in the source record cannot be converted to the data type of the corresponding field in the destination record. This method returns True if it succeeds; otherwise, it returns False.

Note: 	You cannot use copyRecord to copy a record into an empty table. To copy a new record into an empty table, use insertRecord.


Example for TCursor::copyRecord
copyRecord Example

The following example uses a TCursor to scan the Orders table for sales posted in the last 10 days and copies them to the NewOrdrs table in the current directory. This code is attached to the pushButton method for the getNewOrders button.

; getNewOrders::pushButton
method pushButton(var eventInfo Event)
var
  ordTC,

newOrdTC 	TCursor
  tvNewOrds	TableView
endVar

ordTC.open("Orders.db")
newOrdTC.open("NewOrdrs.db")
newOrdTC.edit()                ; copyRecord only works in Edit mode.

; Scan Orders.db table for records posted in the last ten days.
scan ordTC for ordTC."Sale Date" >= (today() - 10) and

               ordTC."Sale Date" <= today() :
  newOrdTC.insertRecord()      ; Insert a new record in NewOrdrs.db.
  newOrdTC.copyRecord(ordTC)   ; Copy from Orders.db into NewOrdrs.db.
endScan
newOrdTC.endEdit()             ; End Edit mode for TCursor.

tvNewOrds.open("NewOrdrs.db")  ; Display the table.
endMethod


See Also for TCursor::copyRecord
See Also

copyToArray

insertAfterRecord

insertBeforeRecord

insertRecord


TCursor::copyToArray
copyToArray

See Also	Example	TCursor Type

Method

Copies the fields of the current record to an array.

Syntax

1. copyToArray ( var ar Array[ ] AnyType ) Logical

2. copyToArray ( var ar DynArray[ ] AnyType ) Logical

Description

copyToArray copies the fields of the current record to the elements of an array specified in ar. You must declare the array to be of type AnyType, or of a type that matches every field in the table.

In syntax 1, where ar is a fixed or resizable array, the value of the first field is copied to the first element of the array, the value of the second field to the second element, and so on. If the array is resizeable, it grows automatically to hold the number of fields in the record. If the array is not resizeable, it holds as many fields as it can, and the rest are discarded.

If syntax 2, where ar is a DynArray, index values correspond to the field names and DynArray values correspond to field values:

ar [ fieldName ] = fieldValue

The size of the array is equal to the number of fields in the record (unless ar is a fixed array). The record number field and any display-only or calculated fields that appear in a form window of the table are not copied to the array.


Example for TCursor::copyToArray
copyToArray Example

In the following example, assume a form has a table frame, CUSTOMER, bound to CUSTOMER.DB. When the user attempts to delete a CUSTOMER record, this code (attached to the built-in action method) uses copyToArray and copyFromArray to copy the record to an archive table, CUSTARC.DB. If CUSTARC.DB cannot be opened, this method informs the user and does not delete the record.

; CUSTOMER::action
method action(var eventInfo ActionEvent)
var
  tcOrig, tcArc TCursor
  arcRec Array[] AnyType
endVar

if eventInfo.id() = DataDeleteRecord then ; when user deletes a record
  if thisForm.Editing = True then         ; if form is in Edit mode
    disableDefault                        ; don't delete the record

                                          ; ask for confirmation
    if msgQuestion("Confirm", "Delete record?") = "Yes" then

      tcOrig.attach(CUSTOMER)             ; sync TCursor to UIObject
      tcOrig.copyToArray(arcRec)          ; store the record in arcRec
      if tcArc.open("CustArc.db") then    ; True if tcArc can open CustArc
        tcArc.edit()                      ; copyFromArray requires Edit
        tcArc.insertAfterRecord()         ; create a new record
        tcArc.copyFromArray(arcRec)       ; copy arcRec to new record
        enableDefault                     ; delete the record in Customer
      else                                ; can't open Customer TCursor
        msgStop("Stop!", "Sorry, Can't archive record.")
      endif
    else                                  ; user didn't confirm dialog box
      message("Record not deleted.")
    endif

  else                                    ; not in Edit mode
    msgStop("Stop!", "Press F9 to edit data.")
  endif
endif
endMethod


See Also for TCursor::copyToArray
See Also

copyFromArray


TCursor::createIndex
createIndex	5.0

See Also	Example1	Example2	TCursor Type

Method

Creates an index for a table.

Syntax

1. createIndex ( const attrib DynArray[] AnyType, const fieldNames Array[] String ) Logical

2. createIndex ( const attrib DynArray[] AnyType, const fieldNums Array[] SmallInt ) Logical

Description

createIndex creates an index for a table using attributes specified in the DynArray attrib and the field names (or numbers) specified in the Array fieldNames (or fieldNums). This method is provided as an alternative to the index structure, and performs the same task. It can be useful when you don't know the index structure beforehand (for example, when the information is supplied by the user).

Each key of the DynArray must be a string, and the value of each corresponding item is described in the following table. You do not have to include all the keys to use createIndex. Any key you omit is assigned the corresponding default value.

String value	Description

MAINTAINED	If True, the index is incrementally maintained. That is, after a table is changed, only that portion of the index affected by the change is updated. If False, Paradox does not maintain the index automatically. Maintained indexes typically result in better performance. Default = False (Paradox tables only).

PRIMARY	If True, the index is a primary index. If False, it's a secondary index. Default = False (Paradox tables only).

CASEINSENSITIVE	If True, the index ignores differences in case. If False, it considers case. Default = False (Paradox tables only).

DESCENDING	If True, the index is sorted in descending order, from highest values to lowest. If False, it is sorted in ascending order.
Default = False (dBASE tables only).

UNIQUE	If True, records with duplicate values in key fields are not allowed. If False, duplicates are allowed (dBASE tables only).

IndexName	A name used to identify this index. No default value, unless you're creating a secondary, case-sensitive index on a single field, in which case the default value is the field name. For dBASE tables, the index name must be a valid DOS file name. If you do not specify an extension, .NDX is added automatically.

TagName	The name of the index tag associated with the index specified in indexName (dBASE tables only).


Example 1 for TCursor::createIndex
createIndex Example 1

The following example builds a maintained secondary index for a Paradox table named CUSTOMER.DB. If the Customer table cannot be found, or cannot be locked, this method aborts the operation.

; newCustKeys::pushButton
method pushButton(var eventInfo Event)
var
  stTbName	String
  tcCust	TCursor
arFieldNames	Array[3] String

dyAttrib	DynArray[]AnyType

endVar

stTbName        = "Customer.db"

arFieldNames[1] = "Customer No"

arFieldNames[2] = "Name"

arFieldNames[3] = "Street"

dyAttrib["PRIMARY"]    = False

dyAttrib["MAINTAINED"] = True

dyAttrib["IndexName"]  = "NumberNameStreet"

if isTable(stTbName) then
  tcCust.open(stTbName)
  if not tcCust.lock("Full") then
    msgStop("Stop!", "Can't lock " + stTbName + " table.")
    return
  endIf

tcCust.createIndex(dyAttrib, arFieldNames)

; This createIndex statement has the same effect

; as the following INDEX structure:

{

  INDEX "Customer.db"
    MAINTAINED
    ON "Customer No", "Name", "Street"
  ENDINDEX

}

else
  msgStop("Stop!", "Can't find " + stTbName + " table.")
endIf

endMethod


Example 2 for TCursor::createIndex
createIndex Example 2

The following example builds a unique index named CITYSTAT.NDX for the dBASE table CUSTOMER.DBF.

; cityStateIndex::pushButton

method pushButton(var eventInfo Event)

var

  stTbName	String

  tcCust	TCursor

arFieldNames	Array[2] String

dyAttrib	DynArray[]AnyType

endVar

stTbName        = "Cust.dbf"

arFieldNames[1] = "CITY"

arFieldNames[2] = "STATE_PROV"

dyAttrib["UNIQUE"]     = True

dyAttrib["MAINTAINED"] = True

; A dBASE index name must be a valid DOS file name.

; If an extension is omitted, .NDX is appended automatically.

dyAttrib["IndexName"] = "CityStat"

if isTable(stTbName) then

  tcCust.open(stTbName)

  if not tcCust.lock("Full") then

    msgStop("Stop!", "Can't lock " + stTbName + " table.")

    return

  endif

  tcCust.createIndex(dyAttrib, arFieldNames)

; This createIndex statement has the same effect

; as the following INDEX structure:

{

  INDEX "Cust.dbf"

 UNIQUE

    ON "CITY", "STATE_PROV"

    TO "CityStat"

  ENDINDEX

}

else

  msgStop("Stop!", "Can't find " + stTbName + " table.")

endif

endMethod


See Also for TCursor::createIndex
See Also

Paradox Help: Indexes

dropIndex

Table::index

Table::setIndex

Table::usesIndexes


TCursor::cSamStd
cSamStd

See Also	Example	TCursor Type

Method

Returns the sample standard deviation of a field (column) of a table.

Syntax

1. cSamStd ( const fieldName String ) Number

2. cSamStd ( const fieldNum SmallInt ) Number

Description

cSamStd returns the sample standard deviation of values in a column of numeric fields. This method respects the limits of restricted views set by setRange or setGenFilter. The returned value is based on the sample variance. This method handles blank values as specified in the blankAsZero setting for the session.

This method tries, for the duration of the retry period, to place a lock on the table. If a lock cannot be placed, the method fails.

The sample standard deviation (as opposed to population) is calculated using this formula:

sqrt(TCursor.cVar(FieldName) * (n/(n - 1)))

where

variance = TCursor.cVar(fieldName)

n = TCursor.cCount(fieldName)


Example for TCursor::cSamStd
cSamStd Example

The following example uses both forms of the syntax to calculate the sample standard deviation of two different fields in the Answer table. This code is attached to the pushButton method for showSamStd:

; showSamStd::pushButton
method pushButton(var eventInfo Event)
var
  empTC TCursor
  tblName String
  CalcSalary, CalcYears Number
endVar
tblName = "Answer"
if empTC.open(tblName) then
  CalcSalary = empTC.cSamStd("Salary")  ; get sample std deviation for salaries
  CalcYears  = empTC.cSamStd(2)         ; assume "Years in service" is field 2
  msgInfo("Sample Std Deviation",       ; display info in a dialog box
          "Salaries : " + String(CalcSalary) + "\n" +
          "Years in service : " + String(CalcYears))
else
  msgInfo("Sorry", "Can't open " + tblName + " table.")
endif
endMethod


See Also for TCursor::cSamStd
See Also

cAverage

cCount

cMax

cMin

cNpv

cSamVar

cStd

cSum

cVar


TCursor::cSamVar
cSamVar

See Also	Example	TCursor Type

Method

Returns the sample variance of a field (column) in a table.

Syntax

1. cSamVar ( const fieldName String ) Number

2. cSamVar ( const fieldNum SmallInt ) Number

Description

cSamVar returns the sample variance of the values in a column of fields. This method respects the limits of restricted views set by setRange or setGenFilter. This method handles blank values as specified in the blankAsZero setting for the session.

This method tries, for the duration of the retry period, to place a write lock on the table. If a lock cannot be placed, the method fails.

The sample variance (as opposed to population) is calculated using this formula:

TCursor.cVar(fieldName) * (n/(n-1))

where

n = TCursor.cCount(fieldName)


Example for TCursor::cSamVar
cSamVar Example

The following example uses both forms of the syntax to calculate the sample variance of two different fields in the Answer table. This code is attached to the pushButton method for showSamVar.

; showSamVar::pushButton
method pushButton(var eventInfo Event)
var
  empTC TCursor
  tblName String
  CalcSalary, CalcYears Number
endVar
tblName = "Answer"
if empTC.open(tblName) then
  CalcSalary = empTC.cSamVar("Salary") ; get sample variance for salaries
  CalcYears  = empTC.cSamVar(2)        ; assume "Years in service" is field 2
  msgInfo("Sample Variance",           ; display info in a dialog box
          "Salaries : " + String(CalcSalary) + "\n" +
          "Years in service : " + String(CalcYears))
else
  msgInfo("Sorry", "Can't open " + tblName + " table.")
endif
endMethod


See Also for TCursor::cSamVar
See Also

cAverage

cCount

cMax

cMin

cNpv

cSamStd

cStd

cSum

cVar


TCursor::cStd
cStd

See Also	Example	TCursor Type

Method

Returns the standard deviation of a field (column) in a table.

Syntax

1. cStd ( const fieldName String ) Number

2. cStd ( const fieldNum SmallInt ) Number

Description

cStd returns the population standard deviation of the values in a column of fields. The calculation is based on the variance. This method respects the limits of restricted views set by setRange or setGenFilter. This method handles blank values as specified in the blankAsZero setting for the session.

This method tries, for the duration of the retry period, to place a write lock on the table. If a lock cannot be placed, the method fails.


Example for TCursor::cStd
cStd Example

In the following example, the pushButton method for thisButton calculates the population standard deviation for two separate fields and displays the results in a dialog box:

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
  test1, test2 Number
endVar
tc.open("scores.dbf")
test1 = tc.cStd("Test1")
test2 = tc.cStd(2)             ; assumes Test2 is field 2

; show results in a dialog
msgInfo("Standard Deviation",
        "Test1 results : " + String(test1) + "\n" +
        "Test2 results : " + String(test2))

endMethod


See Also for TCursor::cStd
See Also

cAverage

cCount

cMax

cMin

cNpv

cSamStd

cSamVar

cSum

cVar


TCursor::cSum
cSum

See Also	Example	TCursor Type

Method

Returns the sum of the values in a field (column) of a table.

Syntax

1. cSum ( const fieldName String ) Number

2. cSum ( const fieldNum SmallInt ) Number

Description

cSum returns the sum of the values in a column of fields. This method respects the limits of restricted views set by setRange or setGenFilter. This method handles blank values as specified in the blankAsZero setting for the session.

This method tries, for the duration of the retry period, to place a write lock on the table. If a lock cannot be placed, the method fails.


Example for TCursor::cSum
cSum Example

In the following example, the pushButton method for sumOrders uses both forms of cSum syntax to calculate totals for two fields in ORDERS.DB:

; sumOrders::pushButton
method pushButton(var eventInfo Event)
var
  orderTC TCursor
  orderTotal, amtPaid Number
  tblName String
endVar
tblName = "Orders"
if orderTC.open(tblName) then
  orderTotal = orderTC.cSum("Total Invoice")  ; get sum for Total Invoice field
  amtPaid    = orderTC.cSum(7)                ; assumes Amount Paid is field 7
  msgInfo("Order Totals",
          "Total Orders : " + String(orderTotal) + "\n" +
          "Total Receipts : " + String(amtPaid))
else
  msgInfo("Sorry", "Can't open " + tblName + " table.")
endif
endMethod


See Also for TCursor::cSum
See Also

cAverage

cCount

cMax

cMin

cNpv

cSamStd

cSamVar

cStd

cVar


TCursor::currRecord
currRecord

See Also	Example	TCursor Type

Method

Reads the current record into the record buffer.

Syntax

currRecord ( ) Logical

Description

currRecord reads values of the current record from the underlying table into the record buffer. Any unposted changes to the TCursor are cancelled. This method ensures you're working with the most recently updated version of the record, particularly on a network.


Example for TCursor::currRecord
currRecord Example

The following example is part of a system that processes ticket orders for concerts. It finds out which artist the customer wants to see, then finds out how many seats the customer needs.

; updateSeats::pushButton
method pushButton(var eventInfo Event)
var
tcConcert	TCursor
siSeatsNeeded,
siCustSeats	SmallInt
stArtist	String
endVar

; Call a custom method to find out which artist
; the customer wants to see.
stArtist = getArtistName()
tcConcert.open("concerts")
tcConcert.locate("Artist", stArtist)

if tcConcert.SoldOut = True then
msgStop("Sorry", "Sold out")
return
else

; Call a custom method to find out how many seats
; the customer needs (this may take awhile).
siCustSeats = getCustSeats()

; Meanwhile, other customers may have ordered seats for this 	; concert, so read current values into the record buffer.
tcConcert.currRecord()

if tcConcert.Seats >= siCustSeats then
processOrder() ; Call a custom method to process the order.
else
notEnoughSeats() ; Call a custom method.
endIf

endMethod


See Also for TCursor::currRecord
See Also

home

end

nextRecord

priorRecord

skip

moveToRecord


TCursor::cVar
cVar

See Also	Example	TCursor Type

Method

Returns the variance of a field (column) in a table.

Syntax

1. cVar ( const fieldName String ) Number

2. cVar ( const fieldNum SmallInt ) Number

Description

cVar returns the population variance of values in a column of numeric fields. This method respects the limits of restricted views set by setRange or setGenFilter. cVar handles blank values as specified in the blankAsZero setting for the session.

This method tries, for the duration of the retry period, to place a write lock on the table. If a lock cannot be placed, the method fails.


Example for TCursor::cVar
cVar Example

In the following example, the pushButton method for thisButton calculates the population variance deviation for two separate fields and displays the results in a dialog box:

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  myTable TCursor
  test1, test2 Number
endVar
myTable.open("scores.dbf")
test1 = myTable.cVar("Test1")     ; get Test1 cVar
test2 = myTable.cVar(2)           ; assumes Test2 is field 2
msgInfo("Population Variance",
        "Test1 results : " + String(test1) + "\n" +
        "Test2 results : " + String(test2))
endMethod


See Also for TCursor::cVar
See Also

cAverage

cCount

cMax

cMin

cNpv

cSamVar

cSamStd

cStd

cSum


TCursor::deleteRecord
deleteRecord

See Also	Example	TCursor Type

Beginner

Method

Deletes the record pointed to by a TCursor.

Syntax

deleteRecord ( ) Logical

Description

deleteRecord deletes the record pointed to by a TCursor without prompting for confirmation. The operation cannot be undone for Paradox tables; but it can be undone for dBASE tables. The table must be in Edit mode.

If the record is locked or has already been deleted by another user (in a dBASE table), this method fails.


Example for TCursor::deleteRecord
deleteRecord Example

In the following example, the pushButton method for the checkIOU button determines whether a particular debt has been marked as paid; if it has, this code uses deleteRecord to delete the record:

; checkIOU::pushButton
method pushButton(var eventInfo Event)
var
  iou TCursor
  searchName String
endVar
searchName = "Hall"
iou.open("iou.db")
iou.edit()
if iou.locate("Name", searchName) then
  if iou."paid" = "Yes" then
    iou.deleteRecord()           ; delete the current record
    message(searchName + " deleted")
  else
    sendBill()                   ; run custom procedure
  endIf
else
   msgStop("Stop", "Couldn't find " + searchName)
endIf
endMethod


See Also for TCursor::deleteRecord
See Also

cancelEdit

empty

unDeleteRecord


TCursor::didFlyAway
didFlyAway

See Also	Example	TCursor Type

Method

Reports whether the current record moved to a different position as the result of a key value change.

Syntax

didFlyAway ( ) Logical

Description

didFlyAway returns True if the most recent call to unlockRecord caused the record to move to a different position in the table; otherwise, it returns False. This method is relevant only if the setFlyAwayControl method has been set to True; otherwise, didFlyAway returns False (even if the record moved to its sorted position).


Example for TCursor::didFlyAway
didFlyAway Example

The following example demonstrates how setFlyAwayControl affects the position of a TCursor after a call to unlockRecord and under what circumstances didFlyAway returns True.

; demoButton::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
endvar

tc.open("MyTable.db")

; Assume that MyTable.db has the following
; values in its only key field, "Customer No" :
;  Record#  Customer No
;     1        110
;     2        120   ; the code below changes this value to 145
;     3        130
;     4        140
                     ; which moves the record to this position
;     5        150

tc.setFlyAwayControl(Yes) ; Enable flyaway tracking.

if tc.locate("Customer No", 120) then
  tc.edit()

  ; Change the key value so that the record
  ; changes relative position.
  tc."Customer No" = 145

  tc.unlockRecord()       ; Unlock the record.

  ; The dialog box displays True because the new key value
  ; changes the record's relative position in the table.
  msgInfo("Did 145 fly away?", tc.didFlyAway())

else
  message("120 not found.")
endif

endMethod


See Also for TCursor::didFlyAway
See Also

setFlyAwayControl

unLockRecord


TCursor::dmAttach
dmAttach	5.0

See Also	Example	TCursor Type

Method

Associates a TCursor with a table in the data model.

Syntax

dmAttach ( const dmTableName String ) Logical

Description

dmAttach associates a TCursor with the table specified in dmTableName. The table must be in the data model. This method returns True if it succeeds; otherwise, it returns False.


Example for TCursor::dmAttach
dmAttach Example

The following example demonstrates using dmAttach to open a TCursor to a table in the data model. The TCursor respects the restricted view of the data model. cSum is used to gather information stored in the string variables s1, s2, and s3. Finally, a dialog box displays the information to the user.

;btnCustomerSummary :: pushButton

method pushButton(var eventInfo Event)

var

tc	TCursor

s1	String

s2	String

s3	String

endVar

tc.dmAttach("Orders.db")

s1 = string(tc.cSum("Total Invoice"))

s2 = string(tc.cSum("Amount Paid"))

s3 = string(tc.cSum("Balance Due"))

msgInfo("Customer Summary",

          "Total Orders = " + s1 +

          "\nTotal Paid = " + s2 +

          "\nTotal Due = " + s3)

endMethod


See Also for TCursor::dmAttach
See Also

attach

open

Form::dmAttach


TCursor::dropGenFilter
dropGenFilter	5.0

See Also	Example1	Example2	TCursor Type

Method

Drops (removes) the filter criteria associated with a TCursor.

Syntax

dropGenFilter ( ) Logical

Description

dropGenFilter drops (removes) the filter criteria associated with a TCursor, leaving it unfiltered. Indexes and tags (if any) remain in effect.


Example 1 for TCursor::dropGenFilter
dropGenFilter Example 1

The following example attaches a TCursor to a table frame bound to the Orders table. This method calculates the average total invoice amount for the entire table. To do so, it first calls dropGenFilter to remove any filter criteria that may have been set by the user (or by code executing elsewhere in the application). The call to dropGenFilter operates on the TCursor only; it does not affect the table frame.

; btnCalAvgInvoice::pushButton

method pushButton(var eventInfo Event)

var

ordersTC	TCursor

nuAvgInvoice	Number

endVar

ordersTC.attach(Orders)    ; Attach to the Orders table frame.

ordersTC.dropGenFilter()   ; Remove any filters on the TCursor.

nuAvgInvoice = ordersTC.cAverage("Total Invoice")

nuAvgInvoice.view("Average Total Invoice:")

endMethod


Example 2 for TCursor::dropGenFilter
dropGenFilter Example 2

In the following example, a form contains a button called btnCascadeDelete. The pushButton method for btnCascadeDelete attaches a TCursor to a child table, uses dropGenFilter to make sure the TCursor can see all the child records, moves the TCursor to the first record, and puts it in edit mode. Then a while loop is used to delete all the child records. Finally, the form is put into edit mode and the parent record is deleted.

;btnCascadeDelete::pushButton

method pushButton(var eventInfo Event)

var

tc	TCursor

siCounter	SmallInt

endVar

tc.attach(LINEITEM)	;Attach to detail table.

tc.dropGenFilter()	;Drop any user set filters.

tc.home()	;Make sure TCursor is on first record.

tc.edit()

while not tc.eot()	;If there are any child

tc.deleteRecord()	;records, delete all of them.

endWhile

edit()	;Make sure form is in edit mode.

Order_No.deleteRecord()	;Delete the parent record.

endMethod


See Also for TCursor::dropGenFilter
See Also

getGenFilter

setGenFilter

setRange

UIObject::dropGenFilter


TCursor::dropIndex
dropIndex

See Also	Example	TCursor Type

Method

Deletes an index file associated with a table.

Syntax

1. (Paradox tables) dropIndex ( const indexName String ) Logical

2. (dBASE tables) dropIndex ( const indexName String  [ , const tagName String ] ) Logical

Description

dropIndex deletes a specified index file or index tag. You can't delete an index that's in use.

When working with a Paradox table, indexName is required. It specifies a secondary index; you can't use a TCursor to drop the primary index of a Paradox table.

When working with a dBASE table, you can use indexName to specify a .NDX file, or use indexName and tagName to specify a .MDX file and an index tag.

Note:	You must obtain exclusive rights to the table (by opening the TCursor on a Table variable that has called the Table method setExclusive before opening the table) before calling dropIndex.


Example for TCursor::dropIndex
dropIndex Example

In the following example, the pushButton method for a button deletes the CustName tag from the .MDX file for a dBASE table.

method pushButton(var eventInfo Event)
var
  tc1 TCursor
  tb1 Table
endVar

if isTable("Sales.dbf") then
  tb1.attach("Sales.dbf") ; Sales.dbf is a dBASE table
  tb1.setExclusive (Yes)
  tc1.open(tb1)

; delete CustName tag from index2 file
  if tc1.dropIndex("index2.mdx", "CustName") then
  msgInfo("", "custname dropped")

else

errorShow("Could not drop index."))
else
  msgStop("Stop!", "Could not find Sales.dbf table.")
endif

endMethod


See Also for TCursor::dropIndex
See Also

Paradox Help: Indexes

switchIndex


TCursor::edit
edit

See Also	Example	TCursor Type

Beginner

Method

Puts a TCursor into Edit mode.

Syntax

edit ( ) Logical

Description

edit puts a TCursor into Edit mode so changes can be made to the current record. After editing, if you want to stay in Edit mode, move off the record or use postRecord or unlockRecord to accept changes to the record. If you want to leave Edit mode, use cancelEdit to cancel changes to the record or use endEdit to accept changes.


Example for TCursor::edit
edit Example

The following example creates an array and uses copyFromArray to copy the contents of the array to a new record in the CustName table. Because the TCursor must be in Edit mode before the new record is inserted, this code uses edit to start editing the table. After the new record is inserted, this code uses endEdit to end Edit mode and accept changes.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
  aa Array[3] AnyType
endVar
aa[1] = "Borland"
aa[2] = "Frank"
aa[3] = "555-1212"
if tc.open("custname.db") then  ; open table
  tc.edit()                     ; put TCursor in Edit mode
  tc.insertRecord()             ; insert new record
  tc.copyFromArray(aa)          ; copy from array to table
  tc.endEdit()                  ; end Edit mode
else
  msgStop("Stop", "Couldn't open Custname.db.")
endIf
endMethod


See Also for TCursor::edit
See Also

cancelEdit

endEdit

postRecord


TCursor::empty
empty

See Also	Example	TCursor Type

Method

Deletes all records from a table.

Syntax

empty ( ) Logical

Description

empty deletes all records from a table without prompting for confirmation. If the TCursor is associated with a dBASE table, the records are flagged as deleted, and then the table is compacted (packed), if possible. In any case, the TCursor does not have to be in Edit mode, but a write lock (at least) is required. This operation cannot be undone.

empty removes information from the table, but does not delete the table itself. Compare this method to Table::delete, which does delete the table.

This method first tries to gain exclusive rights to the table. If exclusive rights are not possible, empty tries to place a write lock on the table.

If exclusive rights are possible, this method deletes all records in the table at once. If only a write lock is possible, empty must delete each record one at a time. (This can be expensive for large tables.)

If empty is able to gain exclusive rights to a dBASE table, all records are deleted and the table is compacted (records are permanently removed). If only a write lock is possible, this method flags all records as deleted, but does not remove them from the table. (Records can be undeleted from a dBASE table if they have not been removed with the compact method.)


Example for TCursor::empty
empty Example

The following example prompts the user for confirmation before deleting all records from the Scratch table. If the user does not confirm the action, this code uses nRecords to indicate how many records exist in SCRATCH.DB.

; tblEmpty::pushButton
method pushButton(var eventInfo Event)
var
  tblName String
  tc TCursor
endVar

tblName = "Scratch.db"
if isTable(tblName) then
  tc.open(tblName)
  if msgQuestion("Confirm", "Empty " + tblName + " table?") = "Yes" then
    tc.empty()
    message("All " + tblName + " records have been deleted.")
  else
    message(tblname + " has " + String(tc.nRecords()) + " records.")
  endif
else
  msgInfo("Error", "Can't find " + tblName + " table.")
endif
endMethod


See Also for TCursor::empty
See Also

deleteRecord

nRecords

Table::delete

Table::empty


TCursor::end
end

See Also	Example	TCursor Type

Beginner

Method

Moves a TCursor to the last record in a table.

Syntax

end ( ) Logical

Description

end sets the current record (and the record buffer) to the last record in a table.


Example for TCursor::end
end Example

The following example uses end to move a TCursor to the last record in the Orders table, then displays in a dialog box information in the last record.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
endVar
tc.open("Orders.db")        ; open tc for Orders table
tc.end()                    ; move to the last record in the table
                            ; display info in last record
msgInfo("Customer No " + tc."Customer No",
        "Oustanding balance: " + tc."Balance Due")

endMethod


See Also for TCursor::end
See Also

home

nextRecord

priorRecord

currRecord

skip

moveToRecord


TCursor::endEdit
endEdit

See Also	Example	TCursor Type

Beginner

Method

Exits Edit mode and accepts changes to the current record.

Syntax

endEdit ( ) Logical

Description

endEdit accepts changes to the current record and exits Edit mode. It does not close the TCursor. (Changes to previous records are committed or canceled as the user navigates through the table.)


Example for TCursor::endEdit
endEdit Example

The following example creates an array and uses copyFromArray to copy the contents of the array to a new record in the CustName table. Because CustName must be in Edit mode before the new record is inserted, this code uses edit to start editing the table. After the new record is inserted, this code uses endEdit to exit Edit mode.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
  aa Array[3] AnyType
endVar
aa[1] = "Borland"
aa[2] = "Frank"
aa[3] = "555-1212"
if tc.open("custname.db") then  ; open table
  tc.edit()                     ; put TCursor in Edit mode
  tc.insertRecord()             ; insert new record
  tc.copyFromArray(aa)          ; copy from array to table
  tc.endEdit()                  ; end Edit mode
else
  msgStop("Stop", "Couldn't open Custname.db.")
endIf
endMethod


See Also for TCursor::endEdit
See Also

cancelEdit

edit


TCursor::enumFieldNames
enumFieldNames

See Also	Example	TCursor Type

Method

Fills an array with the names of fields in a table.

Syntax

enumFieldNames ( const fieldArray Array[ ] String ) Logical

Description

enumFieldNames fills fieldArray with the names of the fields in a table.  If fieldArray is resizeable, it grows automatically to hold the field names; if it is not resizeable, it holds as many as it can, and discards the rest. If fieldArray already exists, this method overwrites it without asking for confirmation.


Example for TCursor::enumFieldNames
enumFieldNames Example

For the following example, the pushButton method for the enumFields button stores field names in a resizeable array, then uses view to display the contents of the array.

; enumFields::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
  fieldNames Array[] String     ; field names for tables are always strings
endVar
if tc.open("orders.db") then
  tc.enumFieldNames(fieldNames) ; load fieldNames with names of Orders.db fields
  fieldNames.view()             ; display field names in a dialog box
else
  msgStop("Stop", "Couldn't open Orders.db.")
endIf

endMethod


See Also for TCursor::enumFieldNames
See Also

enumFieldNamesInIndex


TCursor::enumFieldNamesInIndex
enumFieldNamesInIndex

See Also	Example	TCursor Type

Method

Fills an array with the names of fields in a table's index.

Syntax

1. (Paradox tables) enumFieldNamesInIndex  ( [ const indexName String, ] var fieldArray Array[ ] String ) Logical

2. (dBASE tables) enumFieldNamesInIndex  ( [ const indexName String [, const tagName String , ] var fieldArray Array[ ] String ) Logical

Description

enumFieldNamesInIndex fills fieldArray with the names of the fields in a table's index, as specified in indexName. If indexName is omitted, this method uses the current index. If fieldArray is resizeable, it grows automatically to hold the field names; if it is not resizeable, it holds as many as it can, and discards the rest. If fieldArray already exists, this method overwrites it without asking for confirmation.

When working with a dBASE table, you can use the optional argument tagName to specify an index tag within a .MDX file.


Example for TCursor::enumFieldNamesInIndex
enumFieldNamesInIndex Example

In the following example, the pushButton method for the enumIndex button stores field names in a resizeable array, then uses view to display the contents of the array:

; enumIndex::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
  fieldNames Array[] String
endVar
if tc.open("Sales.dbf") then
  ; load fieldNames array with field names in the byDate index
  tc.enumFieldNamesInIndex("DateIndx.MDX", "byDate", fieldNames)
  ; display the index field names for byDate in DateIndx
  fieldNames.view()
else
  msgStop("Stop", "Couldn't open Sales.dbf.")
endIf
endMethod


See Also for TCursor::enumFieldNamesInIndex
See Also

Paradox Help: Indexes

enumIndexStruct


TCursor::enumFieldStruct
enumFieldStruct

See Also	Example	TCursor Type	Changes

Method

Lists the field structure of a TCursor.

Syntax

1. enumFieldStruct ( const tableName String ) Logical

2. enumFieldStruct ( inMem TCursor ) Logical

Description

enumFieldStruct lists the field structure of a TCursor. Syntax 1 creates a Paradox table; syntax 2 (added in version 5.0) stores the information in a TCursor variable.

Syntax 1 creates the Paradox table specified in tableName. If tableName exists, this method overwrites it without confirmation. You can include an alias or path in tableName; if no alias or path is specified, Paradox creates tableName in the working directory. You can supply tableName to the struct option in a create statement to borrow that table's field structure (including primary keys and validity checks) for use in the new table.

In syntax 2 (added in version 5.0), the structure information is stored in the TCursor variable inMem that you pass as an argument. Using syntax 2 may result in faster performance because the information is stored in system memory without the overhead of disk access.

The structure of the table (syntax 1) or TCursor (syntax 2) is listed in the following table:

Field Name	Field Type	Description

Field Name	A31	Name of field.

Type	A31	Data type of field.

Size	S	Size of field.

Dec	S	Number of decimal places, or 0 if field type doesn't support decimal places.

Key	A1	Is it a key field?
* = key field, blank = not key field.

_Required Value	A1	Is the field required?
T = required, N (or blank) = Not required.

_Min Value	A255	Field's minimum value, if specified; otherwise blank.

_Max Value	A255	Field's maximum value, if specified; otherwise blank.

_Default Value	A255	Field's default value, if specified; otherwise blank.

_Picture Value	A175	Field's picture, if specified; otherwise blank.

_Table Lookup	A81	Name of lookup table. Includes full path if the lookup table is not in :WORK:

_Table Lookup Type	A1	Type of lookup table.
0 (or blank) = no lookup table,
1 = Paradox

_Invariant Field ID	S	Field's ordinal position in table
(first field = 1, second field = 2, etc.)


Example for TCursor::enumFieldStruct
enumFieldStruct Example

For the following example, assume that you want a new table called NewCust that is similar to the Customer table. However, you want all of the fields in NewCust to be required fields. To accomplish this, the following code uses enumFieldStruct to load a new table (CUSTFLDS.DB) with the field-level information from Customer. The code then scans through CustFlds and modifies the field definitions so that each record describes a field that will be required. CustFlds is then supplied in the struct clause of a create statement.

; makeNewCust::pushButton
method pushButton(var eventInfo Event)
var
  newCustTbl Table
  tc   TCursor
  structName, sourceName String
endVar

structName = "CustFlds.db"
sourceName = "Customer.db"

if tc.open(sourceName) then

  tc.enumFieldStruct(structName)

  ; Point the TCursor to the CustFlds table.
  tc.open(structName)
  tc.edit()

  ; This loop scans through the CustFlds table and
  ; changes ValCheck definitions for every field.
  scan tc :
    tc."_Required Value" = 1    ; Make all fields required.
  endScan

  ; Now create NEWCUST.DB and borrow field names,
  ; ValChecks and key fields from CUSTFLDS.DB.
  newCustTbl = CREATE "NewCust.db"
                 STRUCT structName
               ENDCREATE

  ; NEWCUST.DB requires that all fields be filled.

else
  msgStop("Error", "Can't get field structure for Customer table.")
endIf

endMethod


See Also for TCursor::enumFieldStruct
See Also

enumFieldNames

enumFieldNamesInIndex

enumIndexStruct

enumRefIntStruct

enumSecStruct


Changes to TCursor::enumFieldStruct

Syntax 2 (added in version 5.0) stores the information in a TCursor variable.


TCursor::enumIndexStruct
enumIndexStruct

See Also	Example	TCursor Type	Changes

Method

Lists the structure of a TCursor's secondary indexes.

Syntax

1. enumIndexStruct ( const tableName String ) Logical

2. enumIndexStruct ( inMem TCursor ) Logical

Description

enumIndexStruct lists the structure of a table's secondary indexes. Syntax 1 creates a Paradox table; syntax 2 (added in version 5.0) stores the information in a TCursor variable.

Syntax 1 creates the Paradox table specified in tableName. For dBASE tables, this method lists the structure of the indexes associated with the table by the usesIndexes method. If tableName exists, this method prompts the user for confirmation before overwriting the table. You can include an alias or path in tableName; if no alias or path is specified, Paradox creates tableName in the working directory. You can supply tableName to the indexStruct option in a create statement to borrow secondary indexes for use in the new table.

In syntax 2, the structure information is stored in a TCursor variable inMem that you pass as an argument. Using syntax 2 may result in faster performance, because the information is stored in system memory without the overhead of disk access.

The structure of the table (syntax 1) or TCursor (syntax 2) is listed in the following table:

Field Name	Field Type	Description

infoHeader	A1	If Y, this record is a header for (and the data it contains is shared by) subsequent consecutive records that have a value of N in this field. If N, this record is not a header.

szName	A127	Index name, including path.

szTagName	A31	Tag name, no path (dBASE only).

szFormat	A31	Optional index type, e.g., BTREE, HASH

bPrimary	A1	Y if the index is primary; otherwise blank.

bUnique	A1	Y if the index is unique; otherwise blank.

bDescending	A1	Y if the index is descending; otherwise blank.

bMaintained	A1	Y if the index is maintained; otherwise blank.

bCaseInsensitive	A1	Y if the index is not case-sensitive; otherwise blank.

bSubset	A1	Y if the index is a subset index (dBASE only); otherwise blank.

bExpIdx	A1	Y if the index is an expression index (dBASE only); otherwise blank.

iKeyExpType	N	Key type of index expression (dBASE only).

szKeyExp	A220	Key expression for expression index (dBASE only).

szKeyCond	A220	Subset condition for subset index (dBASE only).

FieldNo	N	Ordinal position of key field in table.

FieldName	A31	Name of key field.


Example for TCursor::enumIndexStruct
enumIndexStruct Example

For the following example, assume that you want a new table called NewCust that is similar to the Customer table. However, you don't want to borrow referential integrity or security information. To accomplish this, the following code uses enumFieldStruct and enumIndexStruct to generate two tables: CUSTFLDS.DB and CUSTINDX.DB. CustFlds and CustIndx are then supplied to the struct and indexStruct clauses of a create statement.

; makeNewCust::pushButton
method pushButton(var eventInfo Event)
var
  newcustTC Table
  custTC    TCursor
endVar

if custTC.open("Customer.db") then

  ; write field level information to CUSTFLDS.DB
  custTC.enumFieldStruct("CustFlds.db")

  ; write secondary index information to CUSTINDX.DB
  custTC.enumIndexStruct("CustIndx.db")

  ; now create NEWCUST.DB--
  ; borrow field names, ValChecks, and key fields from CUSTFLDS.DB
  ; borrow secondary indexes from CUSTINDX.DB
  newcustTC = CREATE "NewCust.db"
                STRUCT "CustFlds.db"
                INDEXSTRUCT "CustIndx.db"
              ENDCREATE

else
  msgStop("Error", "Can't find Customer table.")
endif

endMethod


See Also for TCursor::enumIndexStruct
See Also

Paradox Help: Indexes

enumFieldNames

enumFieldNamesInIndex

enumFieldStruct

enumRefIntStruct

enumSecStruct


Changes to TCursor::enumIndexStruct

Syntax 2 (added in version 5.0) stores the information in a TCursor variable.


TCursor::enumLocks
enumLocks

See Also	Example	TCursor Type	Changes

Method

Creates a Paradox table listing the locks currently applied to a table.

Syntax

enumLocks ( const fileName String ) LongInt

Description

enumLocks creates the Paradox table specified in tableName, and the return value indicates the number of locks on the specified table. tableName lists the locks currently applied to the table pointed to by a TCursor. If tableName exists, this method overwrites it without asking for confirmation. If tableName is open, this method fails. For dBASE tables, this method lists only the lock you've placed (not all locks currently on the table). You can include an alias or path in tableName; if no alias or path is specified, Paradox creates tableName in the working directory.

The structure of tableName, which changed in version 5.0, is listed below:

Field Name	Field Type	Description

UserName	A15	User name.

LockType	A32	String describing type of lock, for example, Table Write Lock.

NetSession	N	Net level session number.

Session	N	IDAPI session number, if the lock was placed by IDAPI.

RecordNumber	N	Record number, if the lock is a record lock; otherwise 0.


Example for TCursor::enumLocks
enumLocks Example

In the following example, the built-in pushButton method for the showOrdersLcks button creates a table listing the locks currently applied to ORDERS.DB and opens the newly created table.

; showOrdersLcks::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
  tv TableView
endVar
if tc.open("Orders.db") then
  tc.enumLocks("OrderLck.db")  ; store Orders.db locks in OrderLck.db
  tv.open("OrderLck.db")       ; open OrderLck.db
else
  msgStop("Stop!", "Can't open Orders.db table")
endif

endMethod


See Also for TCursor::enumLocks
See Also

lock

lockStatus


Changes to TCursor::enumIndexStruct
Changes to TCursor::enumLocks

The structure of tableName, which changed in version 5.0, is listed below:

Field Name	Field Type	Description

UserName	A15	User name.

LockType	A32	String describing type of lock, for example, Table Write Lock.

NetSession	N	Net level session number.

Session	N	IDAPI session number, if the lock was placed by IDAPI.

RecordNumber	N	Record number, if the lock is a record lock; otherwise 0.


TCursor::enumRefIntStruct
enumRefIntStruct

See Also	Example	TCursor Type	Changes

Method

Lists referential integrity information for a TCursor.

Syntax

1. enumRefIntStruct ( const tableName String ) Logical

2. enumRefIntStruct ( inMem TCursor ) Logical

Description

enumRefIntStruct lists referential integrity information for a TCursor. Syntax 1 creates a Paradox table; syntax 2 (added in version 5.0) stores the information in a TCursor variable.

Syntax 1 creates the Paradox table specified in tableName. If tableName exists, this method overwrites it without asking for confirmation. If tableName is open, this method fails. You can include an alias or path in tableName; if no alias or path is specified, Paradox creates tableName in the working directory. You can supply tableName to the refIntStruct option in a create statement to borrow referential integrity information for use in the new table.

In syntax 2, the structure information is stored in a TCursor variable inMem that you pass as an argument. Using syntax 2 may result in faster performance because the information is stored in system memory without the overhead of disk access.

The structure of the table (syntax 1) or TCursor (syntax 2) is listed in the following table:

Field Name	Type	Description

infoHeader	A1	If Y, this record is a header for (and the data it contains is shared by) subsequent consecutive records that have a value of N in this field. If N, this record is not a header.

RefName	A31	A name to identify this referential integrity constraint.

OtherTable	A81	Name (including path) of the other table in the referential integrity relationship.

Slave	A1	Y if the able is slave, not master (i.e., table is dependent); otherwise blank.

Modify	A1	Specifies update rule: Y = Cascade, blank = Prohibit.

Delete	A1	Specifies delete rule: Y = Cascade, blank = Prohibit.

FieldNo	N	Ordinal position of the field in this table involved in a referential integrity relationship.

aiThisTabField	A31	Name of the field in this table involved in a referential integrity relationship.

Other FieldNo	N	Ordinal position of the field in the other table involved in a referential integrity relationship.

aiOthTabField	A31	Name of the field in the other table involved in a referential integrity relationship.


Example for TCursor::enumRefIntStruct
enumRefIntStruct Example

The following example uses enumRefIntStruct to write CUSTOMER.DB referential integrity information to the CustRef table. Then, the code supplies CustRef to the refIntStruct clause in a create statement.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tc  TCursor
  tbl Table
endVar

tc.open("Customer.db")

; Write referential integrity information to CustRef.
tc.enumRefIntStruct("CustRef.db")

; Write field level information to CustFlds.
tc.enumFieldStruct("CustFlds.db")

; Now create NEWCUST.DB.
; Borrow field level information from CUSTFLDS.DB.
; Borrow referential integrity information from CUSTREF.DB.
tbl = CREATE "NewCust.db"
        STRUCT "CustFlds.db"
        REFINTSTRUCT "CustRef.db"
      ENDCREATE

endMethod


See Also for TCursor::enumRefIntStruct
See Also

enumFieldNames

enumFieldNamesInIndex

enumFieldStruct

enumIndexStruct

enumSecStruct

Form::enumTableLinks


Changes to TCursor::enumRefIntStruct

Syntax 2 (added in version 5.0) stores the information in a TCursor variable.


TCursor::enumSecStruct
enumSecStruct

See Also	Example	TCursor Type	Changes

Method

Lists security information of a TCursor.

Syntax

1. enumSecStruct ( const tableName String ) Logical

2. enumSecStruct ( inMem TCursor ) Logical

Description

enumSecStruct lists the security information (access rights) of a TCursor. Syntax 1 creates a Paradox table; syntax 2 (added in version 5.0) stores the information in a TCursor variable.

Syntax 1 creates the Paradox table specified in tableName. If tableName exists, this method overwrites it without asking for confirmation. If tableName is open, this method fails. You can include an alias or path in tableName; if no alias or path is specified, Paradox creates tableName in the working directory. You can supply tableName to the secStruct option in a create statement to borrow security information for use in the new table.

In syntax 2, the structure information is stored in a TCursor variable inMem that you pass as an argument. Using syntax 2 may result in faster performance because the information is stored in system memory without the overhead of disk access.

The structure of the table (syntax 1) or TCursor (syntax 2) is listed in the following table:

Field Name	Type	Description

infoHeader	A1	If Y, this record is a header for (and the data it contains is shared by) subsequent consecutive records that have a value of N in this field. If N, this record is not a header.

iSecNum	N	Number to identify security description
(first description = 1).

eprvTable	N	Table privilege value.

eprvTableSym	A10	Table privilege name.

iFamRights	N	Family rights value.

iFamRightsSym	A10	Family rights name.

szPassword	A31	Password.

fldNum	N	Ordinal position of field in table.

aprvFld	N	Field privilege value.

aprvFldSym	A10	Field privilege name.


Example for TCursor::enumSecStruct
enumSecStruct Example

The following example creates a new table based on the security information associated with the Secrets table. The code uses enumSecStruct to write security information to the SecInfo table, then uses the table to create the MySecrts table.

method pushButton(var eventInfo Event)
var
  tc  TCursor
  tbl Table
endVar

; Associate tc with SECRETS.DB.
tc.open("Secrets.db")
; Write security information to SECINFO.DB.

tc.enumSecStruct("SecInfo.db")

; Now create MYSECRTS.DB.
; Borrow field names and types from SECRETS.DB.
; Borrow security information from SECINFO.DB.
tbl = CREATE "MySecrts.db"
        LIKE "Secrets.db"
        SECSTRUCT "SecInfo.db"
      ENDCREATE
endMethod


See Also for TCursor::enumSecStruct
See Also

enumFieldNames

enumFieldNamesInIndex

enumFieldStruct

enumIndexStruct

enumRefIntStruct


Changes to TCursor::enumSecStruct

Syntax 2 (added in version 5.0) stores the information in a TCursor variable.


Privilege values and names for TCursor::enumSecStruct

The following table lists numeric values and symbolic names for table and field privileges.

Value	Name	Description

0	None	No privileges.

1	ReadOnly	Read-only field or table.

3	Modify	Read and modify field or table.

7	Insert	Insert + all of the above privileges (table only).

15	InsDel	Delete + all of the above privileges (table only).

31	Full	Full rights (table only).

255	Unknown	Privileges unknown.


Family rights values and names for TCursor::enumSecStruct

The following table lists numeric values and symbolic names for family rights.

Value	Name	Description

0	NoFamRights	No family rights.

1	FormRights	Can change forms only.

2	RptRights	Can change reports only.

4	ValRights	Can change val checks only.

8	SetRights	Can change image settings.

15	AllFamRights	All of the above.


TCursor::enumTableProperties
enumTableProperties

See Also	Example	TCursor Type

Method

Writes the properties of a TCursor to a Paradox table.

Syntax

enumTableProperties ( const tableName String ) Logical

Description

enumTableProperties writes the properties of a table associated with a TCursor to the table specified in tableName. If tableName exists, this method prompts the user for confirmation before overwriting the table. If tableName is open, this method fails. You can include an alias or path in tableName; if no alias or path is specified, Paradox creates tableName in the working directory.

The structure of tableName is listed in the following table.

Field Name	Field Type	Description

TableName	A32	Name of table (name only: no path, no extension).

PropertyName	A64	Name of property. The following properties are valid for Paradox and dBASE tables: Name, Type, FieldCount, LogicalRecordSize, PhysicalRecordSize, KeySize, IndexCount, ValCheckCount, ReferentialCount, BookMarkSize, StableBookMarks, OpenMode, ShareMode.

PropertyValue	A255	Value of corresponding property.


Example for TCursor::enumTableProperties
enumTableProperties Example

The following example uses enumTableProperties to write ORDERS.DB properties to ORDPROPS.DB. If ORDPROPS.DB exists, this code prompts the user for confirmation before overwriting the table.

; showTblProps::pushButton
method pushButton(var eventInfo Event)
var
  tblName, propTbl String
  tc TCursor
  tv TableView
endVar
tblName = "Orders.db"
propTbl = "OrdProps.db"

if tc.open(tblName) then
  if isTable(propTbl) then
    if msgYesNoCancel("Confirm",
       propTbl + " exists. Overwrite it?") <> "Yes" then
      return
    endif
  endif
  ; Write Orders.db properties to OrdProps.db.
  tc.enumTableProperties(propTbl)
  ; Open newly created OrdProps.db table.
  tv.open(propTbl)
else
  msgStop("Stop!", "Can't open " + tblName + " table.")
endif

endMethod


See Also for TCursor::enumTableProperties
See Also

enumFieldNames


TCursor::eot
eot

See Also	Example	TCursor Type

Method

Tests for a move past the end of a table.

Syntax

eot ( ) Logical

Description

eot returns True if a command attempts to move past the last record of a table; otherwise, it returns False. eot is reset by the next move operation.

eot (and bot) also return True if a command forces the TCursor to point to a nonexistent record. For example, suppose the Customer table has values in the first key field that range from 1,000 to 10,000. If you call setRange such that the TCursor points to key values from 1 to 10 (outside the possible range of Customer values), the TCursor points to a nonexistent record. The following code fragment demonstrates how setRange can affect eot and bot:

var tc TCursor endvar
tc.open("Customer.db")
; Suppose values in field 1 range from 1,000 to 10,000.
tc.setRange(1, 10)           ; filter ranges from 1 to 10
  ; tc.eot() and tc.bot() are True at this point

Similarly, if a call to setGenFilter forces the TCursor to point to a nonexistent record, eot and bot methods return True.


Example for TCursor::eot
eot Example

In the following example, a while loop controls a TCursor's movement through the Orders table. When code within the loop attempts to move beyond the end of the table, eot returns True and the loop terminates.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
  tblName String
  fldVal AnyType
endVar
tblName = "Customer.db"
if tc.open(tblName) then
  while tc.eot() = False      ; While subsequent commands do not
                              ; move past end of the table,
    message(tc."Customer No") ; display value in Customer No field,
    sleep(250)                ; pause for the message,
    tc.nextRecord()           ; move to the next record.
  endWhile
  msgInfo("End", "That's all, folks!")
else
  msgStop("Stop!", "Can't open " + tblName + " table.")
endif
endMethod


See Also for TCursor::eot
See Also

bot

end

home


TCursor::familyRights
familyRights

See Also	Example	TCursor Type

Method

Tests for a user's ability to create or modify objects in a table's family.

Syntax

familyRights ( const rights String ) Logical

Description

familyRights returns True if you have rights to the type of object specified in rights; otherwise, it returns False. rights is a single-letter string--either "F" (form), "R" (report), "S" (image settings), or "V" (validity checks)--that indicates the type of object you are interested in. This method preserves functionality required by Paradox 3.5 tables, which had the concept of a table family. The concept does not apply to tables created in versions of Paradox after 3.5.


Example for TCursor::familyRights
familyRights Example

The following example indicates in a dialog box whether you have "F" rights to CUSTOMER.DB.

; showFRights::pushButton
method pushButton(var eventInfo Event)
var
  custTC TCursor
endVar

custTC.open("Customer.db")
msgInfo("Rights", "Form Rights: " + String(custTC.familyRights("F")))
; Displays True if you have Form rights to CUSTOMER.DB.

endMethod


See Also for TCursor::familyRights
See Also

tableRights


TCursor::fieldName
fieldName

See Also	Example	TCursor Type

Method

Returns the name of a field.

Syntax

fieldName ( const fieldNum SmallInt ) String

Description

fieldName returns the name of field fieldNum. Fields are numbered from left to right, beginning with 1.


Example for TCursor::fieldName
fieldName Example

The following example uses fieldName to display the name of field number two in the Answer table. This code is attached to the built-in pushButton method of a button.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
  fldName, tblName String
  fldNum SmallInt
endVar
tblName = "Answer.db"

if tc.open(tblName) then
  fldName = tc.fieldName(2)       ; store name of field 2 in fldName
  msgInfo("Field Name",           ; display field 2 field name
          "Field name for field 2 is\n" + fldName)
else
  msgStop("Sorry", "Can't open " + tblName + " table.")
endIf

endMethod


See Also for TCursor::fieldName
See Also

fieldNo

fieldType

fieldValue


TCursor::fieldNo
fieldNo

See Also	Example	TCursor Type

Method

Returns the position of a field in a table.

Syntax

fieldNo ( const fieldName String ) SmallInt

Description

fieldNo returns the position of the field fieldName in a table. Fields are numbered from left to right, beginning with 1.


Example for TCursor::fieldNo
fieldNo Example

The following code is attached to the pushButton method for thisButton. When you press thisButton, this example uses fieldNo to display Common Name's field position in the BioLife table.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
  fldNum SmallInt
endVar

if tc.open("biolife.db") then
  fldNum = tc.fieldNo("Common Name")   ; store field number in fldNum
  msgInfo("Field Number",
          "Common Name field is\n field number " + String(fldNum))
else
  msgInfo("Sorry", "Can't open BioLife.db table.")
endif

endMethod


See Also for TCursor::fieldNo
See Also

fieldValue


TCursor::fieldRights
fieldRights

See Also	Example	TCursor Type

Method

Reports whether a user has rights to read or modify a field in a table.

Syntax

1. fieldRights ( const fieldName String, const rights String ) Logical

2. fieldRights ( const fieldNum SmallInt, const rights String ) Logical

Description

fieldRights returns True if the user has rights to the field specified in fieldName or fieldNum; otherwise, it returns False. The value of rights must be an expression that evaluates to one of the following strings: ReadOnly, ReadWrite, or All. Rights are obtained using the Session type method addPassword; rights cannot be acquired after the table is opened.


Example for TCursor::fieldRights
fieldRights Example

The following example uses fieldRights to determine whether a TCursor has adequate field rights before attempting to modify the field's value.

; updateCust::pushButton
method pushButton(var eventInfo Event)
var
  custTC TCursor
endVar
custTC.open("Customer.db")
if custTC.locate("Name", "Unisco") then
  ; if we don't have sufficient rights to change the Name field
  if NOT custTC.fieldRights("Name", "ReadWrite") then
    ; display error message and abort operation
    msgStop("Error!", "Insufficient rights to change Name field")
  else
    ; otherwise, we have rights to make changes to the field
    custTC.edit()
    custTC.Name = "Unisco Worldwide, Inc."
    message("Changed Unisco to Unisco Worldwide, Inc.")
    custTC.endEdit()
  endif
else
  msgStop("Error", "Can't find Unisco")
endif

endMethod


See Also for TCursor::fieldRights
See Also

tableRights


TCursor::fieldSize
fieldSize

See Also	Example	TCursor Type

Method

Returns the size of a field.

Syntax

1. fieldSize ( const fieldName String ) SmallInt

2. fieldSize ( const fieldNum SmallInt ) SmallInt

Description

fieldSize returns the size of a field as defined when the table was created. The return value can represent the maximum number of characters a field can contain; for example, given a field defined as Alpha20, fieldSize returns 20. Or, the return value can represent the maximum amount of data to display. For example, when you create a table and define a Memo field, you can specify a number of characters to display. fieldSize would return that number.

Numeric fields in dBASE tables can specify the number of digits to display on either side of the decimal point; for example, a field defined as Number 8.2 could display up to 8 digits total, with 6 digits to the left of the decimal and 2 digits to the right. fieldSize returns the first part of the definition; that is, the number of digits to the left of the decimal. To get the second part, use fieldUnits2.

For field types that do not display characters or numbers (such as OLE, binary, graphic, and so on), this method returns 0.


Example for TCursor::fieldSize
fieldSize Example

The following example uses a dynamic array to store the size of each field in the BioLife table, then displays the contents of the dynamic array in a dialog box.

; showFldSizes::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
  i SmallInt
  fldSizes DynArray[] AnyType
  tblName String
endVar
tblName = "BioLife.db"

if tc.open(tblName) then
   ; this FOR loop loads the DynArray with BioLife.db field sizes
  for i from 1 to tc.nFields()
    fldSizes[tc.fieldName(i)] = tc.fieldSize(i)
  endFor
   ; now show the contents of the DynArray
  fldSizes.view(tblName + " field sizes.")
else
  msgStop("Sorry", "Can't open " + tblName + " table.")
endif
endMethod


See Also for TCursor::fieldSize
See Also

fieldName

fieldType

fieldUnits2


TCursor::fieldType
fieldType

See Also	Example	TCursor Type	Changes

Method

Returns the data type of a field.

Syntax

1. fieldType ( const fieldName String ) String

2. fieldType ( const fieldNum SmallInt ) String

Description

fieldType returns the data type of a field. It returns "Unknown" if the field is not found. The following tables (updated for version 5.0) list the possible return values for Paradox and dBASE tables:

Paradox field type	Return value

Alpha	ALPHA

Autoincrement	AUTOINCREMENT

BCD	BCD

Binary	BINARY

Bytes	BYTES

Date	DATE

Formatted Memo	FMTMEMO

Graphic	GRAPHIC

Logical	LOGICAL

Long Integer	LONG

Memo	MEMO

Money	MONEY

Number	NUMBER

OLE	OLE

Short	SHORT

Time	TIME

Timestamp	TIMESTAMP

dBASE field type	Return value

BINARY	BINARY

CHARACTER	CHARACTER

DATE	DATE

FLOAT	FLOAT

LOGICAL	LOGICAL

MEMO	MEMO

NUMBER	NUMERIC

OLE	OLE


Example for TCursor::fieldType
fieldType Example

The following example uses a dynamic array to store the type of each field in the BioLife table, then displays the contents of the dynamic array in a dialog box.

; showFldTypes::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
  i SmallInt
  fldTypes DynArray[] AnyType
  tblName String
endVar
tblName = "BioLife.db"

if tc.open(tblName) then
   ; this FOR loop loads the DynArray with BioLife.db field types
  for i from 1 to tc.nFields()
    fldTypes[tc.fieldName(i)] = tc.fieldtype(i)
  endFor
   ; now show the contents of the DynArray
  fldTypes.view(tblName + " field types.")
else
  msgStop("Sorry", "Can't open " + tblName + " table.")
endif
endMethod


See Also for TCursor::fieldType
See Also

fieldNo


Changes to TCursor::fieldType

The following return values changed in version 5.0:

Before 5.0	5.0

NUMERIC	NUMBER

BINARYBLOB	BINARY

OLEOBJ	OLE

BOOLEAN	LOGICAL

The following field types were added in version 5.0:

(Paradox tables) BCD, LONG, TIME, TIMESTAMP, LOGICAL, AUTOINCREMENT, BYTES.

(dBASE tables) BINARY, OLE.


TCursor::fieldUnits2
fieldUnits2

See Also	Example	TCursor Type

Method

Returns the number of decimal places defined for a numeric field in a dBASE table.

Syntax

1. fieldUnits2 ( const fieldName String ) SmallInt

2. fieldUnits2 ( const fieldNum SmallInt ) SmallInt

Description

fieldUnits2 returns the number of decimal places defined for a numeric field in a dBASE table. For a Paradox table (or any other driver or field type that does not require field units to be specified), this method returns 0. Numeric fields in dBASE tables can specify the number of digits to display on either side of the decimal point; for example, a field defined as Number 8.2 could display up to 8 digits total with 6 characters to the left of the decimal and 2 digits to the right. fieldUnits2 returns the second part of the definition; that is, the number of digits to the right of the decimal. To get the first part, use fieldSize. This method returns 0 for non-numeric field types such as alphanumeric, boolean, date, and so on.


Example for TCursor::fieldUnits2
fieldUnits2 Example

For the following example, the pushButton method for thisButton concatenates values returned from fieldSize and fieldUnits2 such that both sides of the decimal point are expressed in a single number. For example, if a field's size is 11 and is defined with 2 decimal places, this method concatenates the values to 11.2. This code uses a DynArray to store concatenated values for each field in SCORES.DBF then displays the contents of the array in a dialog box.

; showFldSizes::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
  i SmallInt
  fldSizes DynArray[] AnyType
  tblName String
  totalSize Number
endVar
tblName = "Scores.dbf"

if tc.open(tblName) then
   ; This FOR loop loads the DynArray with the full field spec.
   ; For example if fieldSize(1) = 11 and fieldUnits2(1) = 2,
   ; one value in the DynArray would be 11.2
  for i from 1 to tc.nFields()
    totalSize = numVal(String(tc.fieldsize(i)) + "." +
                       String(tc.fieldUnits2(i)))
    fldSizes[tc.fieldName(i)] = totalSize
  endFor
   ; now show the contents of the DynArray
  fldSizes.view(tblName + " total field sizes.")
else
  msgStop("Sorry", "Can't open " + tblName + " table.")
endif
endMethod


See Also for TCursor::fieldUnits2
See Also

fieldName

fieldNo

fieldSize

fieldType


TCursor::fieldValue
fieldValue

See Also	Example	TCursor Type

Method

Reads the value of a specified field.

Syntax

1. fieldValue ( const fieldName String, var result AnyType ) Logical

2. fieldValue ( const fieldNum SmallInt, var result AnyType ) Logical

Description

fieldValue gets the value of a specified field (fieldName or fieldNum) in the current record and assigns it to the variable result. This method returns True if successful; otherwise, it returns False.

You can get the same information using dot notation. For example, this statement uses dot notation to assign the myPrice variable with data from the Last Bid field:

myCost = tcVar."Last Bid"

The following statement uses fieldValue to achieve the same results:

tcVar.fieldValue("Last Bid", myCost)


Example for TCursor::fieldValue
fieldValue Example

For the following example, assume a form has at least one field, one of which is named paymentField. When you right-click on the paymentField, the code in this example presents a PopUpMenu listing possible values for the field. When you choose a menu item from the list, that value is inserted into the field.

The following code is attached to the field's Var window:

; paymentField::Var
Var
  lkupTbl String
  menuArray Array[] String
  fldVal AnyType
  p1 PopUpMenu
  tc TCursor
endVar

The following code is attached to the field's open method. When the field opens, this code scans through the PayMethd table and loads the menuArray array with values from the Pay Method field.

; paymentField::open
method open(var eventInfo Event)

lkupTbl = "PayMethd.db"
tc.open(lkupTbl)
scan tc :                             ; scan through table
  tc.fieldValue("Pay Method", fldVal) ; store field value in fldVal
  menuArray.addLast(fldVal)           ; add new element to menuArray
endScan
p1.addStaticText("Possible Values")   ; put static text at top of menu
p1.addSeparator()                     ; add a horizontal bar below static text
p1.addArray(menuArray)                ; add array to the menu

endMethod

The following code is attached to the field's mouseRightUp method. When you right-click the field, this code presents a PopUpMenu and the field takes the value of your menu choice.

; paymentField::mouseRightUp
method mouseRightUp(var eventInfo MouseEvent)

disableDefault              ; don't show the default menu
choice = p1.show()          ; show the pop-up menu
if NOT isBlank(choice) then ; if user did not press Esc
  self.value = choice       ; enter choice into the field
endif

endMethod


See Also for TCursor::fieldValue
See Also

setFieldValue


TCursor::forceRefresh
forceRefresh	4.5

See Also	Example	TCursor Type

Method

Makes TCursor point to the current data in the underlying table.

Syntax

forceRefresh( ) Logical

Description

forceRefresh empties a TCursor's record buffer and refreshes it with the current data from the underlying table. The record position is maintained, provided the record still exists in the table. On an SQL server, a call to forceRefresh forces a read from the server. This is the only way to get a refresh from the server; it may be a time-consuming operation.


Example for TCursor::forceRefresh
forceRefresh Example

The following example opens a TCursor onto the Orders table and executes two scan loops to perform two calculations. The first calculation returns the total quantity of orders from California. Then, the code calls forceRefresh to get the latest data from the table before executing the second scan loop to calculate the total quantity of orders from Florida.

method pushButton(var eventInfo Event)
   var
      tc       TCursor
      tName,
      fName,
      fVal_1,
      fVal_2   String
      caQty,
      flQty,   LongInt
   endVar

   ; initialize variables
   tName  = "orders" ; assign table name
   fName  = "State"  ; assign field name
   caQty  = 0        ; assign CA quantity
   flQty  = 0        ; assign FL quantity
   fVal_1 = "CA"     ; assign 1st field value
   fVal_2 = "FL"     ; assign 2nd field value

   tc.open(tName)

   scan tc for tc.fName = fVal_1:
      caQty = caQty + tc.Qty
   endScan

; during the first scan, other users may
; change data in the underlying table

   tc.forceRefresh() ; Get latest data from table

   scan tc for tc.fName = fVal_2:
      flQty = flQty + tc.Qty
   endScan

   msgInfo("CA Qty and FL Qty:",
           "CA = " + caQty + "\n" + FL = " + flQty)

endMethod


See Also for TCursor::forceRefresh
See Also

currRecord


TCursor::getGenFilter
getGenFilter	5.0

See Also	Example	TCursor Type

Method

Retrieves the filter criteria associated with a TCursor.

Syntax

1. getGenFilter ( criteria DynArray[ ] AnyType ) Logical

2. getGenFilter ( criteria Array[ ] AnyType [ , fieldName Array[ ] AnyType ] ) Logical

3. getGenFilter ( criteria String ) Logical

Description

getGenFilter retrieves the filter criteria associated with a TCursor. This method does not return values directly; instead, it assigns them to a DynArray variable (syntax 1) or to two Array variables (syntax 2) that you declare and include as arguments.

In syntax 1, the DynArray criteria lists fields and filtering conditions as follows: the index is the field name, and the item is the corresponding filter expression.

In syntax 2, the Array criteria lists filtering conditions, and the optional Array fieldName lists corresponding field names. If you omit fieldName, conditions apply to fields in the order they appear in the criteria array (the first condition applies to the first field in the table, the second condition applies to the second field, and so on).

If the arrays used in syntax 2 are resizeable, this method sets the array size to equal the number of fields in the underlying table. If fixed-size arrays are used, this method stores as many criteria as it can, starting with criteria field 1. If there are more array items than fields, the remaining items are left empty; if there are more fields than items, this method fills the array and then stops.

In syntax 3, the filter criteria is assigned to a String variable criteria that you must declare and pass as an argument.


Example for TCursor::getGenFilter
getGenFilter Example

In this example, the pushButton method for a button named btnShowFilter uses getGenFilter to fill a DynArray dyn with a TCursor's filter criteria. Then it checks the DynArray to see if the current criteria filters the State/Prov field with a value of "CA", and resets the filter if necessary.

;btnShowFilter :: pushButton

method pushButton(var eventInfo Event)

var

ordersTC	TCursor

dyn	DynArray[] AnyType

keysAr	Array[] AnyType

stFilterFld,

stCriteria	String

endVar

stFilterFld = "State/Prov"

stCriteria  = "CA"

ordersTC.open("Orders")

ordersTC.getGenFilter(dyn)	; Get filter info.

dyn.getKeys(keysAr)

if keysAr.contains(stFilterFld) then

if dyn[stFilterFld] = stCriteria then

return               ; Filter is set correctly.

endIf

else

dyn.empty()             ; Set filter criteria correctly.

dyn[stFilterFld] = stCriteria

ordersTC.setGenFilter(dyn)

endIf

endMethod


See Also for TCursor::getGenFilter
See Also

setGenFilter

dropGenFilter

setRange

UIObject::getGenFilter

Using Ranges and Filters


TCursor::getIndexName
getIndexName	5.0

See Also	Example	TCursor Type

Method

Retrieves the name of the current index for a table.

Syntax

1. (Paradox tables) getIndexName ( indexName String ) Logical

2. (dBASE tables) getIndexName ( indexName String [ , tagName String ] ) Logical

Description

getIndexName retrieves the name of the current index (and, optionally, the current tag for dBASE tables). This method does not return values directly; instead, it assigns them to String variables you declare and provide as arguments.


Example for TCursor::getIndexName
getIndexName Example

The following code gets and displays the name of the index associated with the Orders table.

method pushButton(var eventInfo Event)
   var
      ordersTC TCursor
      indexName String
   endVar

   ordersTC.open("orders")

   ; Get the index name and assign the value to the String variable indexName.
   ordersTC.getIndexName(indexName)

   if indexName.isAssigned() then
      indexName.view("Current index")
   else
      msgInfo("indexName", "No value for indexName.")
   endIf
endMethod


See Also for TCursor::getIndexName
See Also

Paradox Help: Indexes

getGenFilter

setGenFilter


TCursor::getLanguageDriver
getLanguageDriver

See Also	Example	TCursor Type

Method

Returns the name of the current language driver for a table.

Syntax

getLanguageDriver ( ) String

Description

getLanguageDriver returns a String value indicating the language driver for a table.


Example for TCursor::getLanguageDriver
getLanguageDriver Example

The following example displays in a dialog box the language driver for the Customer table:

; getDriver::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
endVar
tc.open("Customer.db")
msgInfo("", tc.getLanguageDriver())  ; displays "ascii"
endMethod


See Also for TCursor::getLanguageDriver
See Also

getLanguageDriverDesc


TCursor::getLanguageDriverDesc
getLanguageDriverDesc

See Also	Example	TCursor Type

Method

Returns the name of the current language driver description for a table.

Syntax

getLanguageDriverDesc ( ) String

Description

getLanguageDriverDesc returns a String value indicating the language driver description for a table.


Example for TCursor::getLanguageDriverDesc
getLanguageDriverDesc Example

The following example displays in a dialog box the language driver description for the Customer table.

; getDriverDesc::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
endVar
tc.open("Customer.db")
msgInfo("", tc.getLanguageDriverDesc())  ; displays "Paradox ascii"
endMethod


See Also for TCursor::getLanguageDriverDesc
See Also

getLanguageDriver


TCursor::getRange
getRange	5.0

See Also	Example	TCursor Type

Method

Retrieves the values that specify a range for a TCursor.

Syntax

getRange ( var rangeVals Array[ ] String ) Logical

Description

getRange retrieves the values that specify a range for a TCursor. This method does not return values directly; instead, it assigns them to an Array variable that you declare and include as an argument. The array values describe the range criteria, as listed in the following table.

Number of array items	Range specification

No items (empty array)	No range criteria associated with the TCursor.

One item	Specifies a value for an exact match on the first field of the index.

Two items	Specifies a range for the first field of the index.

Three items	The first item specifies an exact match for the first field of the index; items 2 and 3 specify a range for the second field of the index.

More than three items	For an array of size n, specify exact matches on the first n-2 fields of the index. The last two array items specify a range for the n-1 field of the index.

If the array is resizeable, this method sets the array size to equal the number of fields in the underlying table. If fixed-size arrays are used, this method stores as many criteria as it can, starting with criteria field 1. If there are more array items than fields, the remaining items are left empty; if there are more fields than items, this method fills the array and then stops.


Example for TCursor::getRange
getRange Example

In the following example, a button on a form is used to display the number of orders for any  customer number per any month. Assume a form with the Orders table in its data model contains at least a Customer_No field, a Month field, and a button called btnCustOrdersByMonth. You could use setGenFilter to accomplish the same task. However, in this example a secondary index called secCustomerMonth, getRange, getIndexName, switchIndex and setRange is used to speed up the task.

;btnCustOrdersByMonth :: pushButton

method pushButton(var eventInfo Event)

var

tc	TCursor

nuCustomer	Number

arGet,

arSet	Array[2] AnyType

stMonth,

stActiveInd,

stDisplay	String

endVar

nuCustomer = Customer_No.value	;Customer field on form.

nuCustomer.view("Customer #:")	;Allow user to alter cust #.

stMonth = Month.value	;Month field on form.

stMonth.view("Month:")	;Allow user to alter month.

arSet[1] = nuCustomer	;Set array to range criteria.

arSet[2] = stMonth

tc.attach(Customer_No)	;Attach tc to Customer field.

tc.getIndexName(stActiveInd) 	;Get the active index name.

if stActiveInd = "secCustomerMonth" then

tc.getRange(arGet)	;Get the current range.

if arGet <> arSet then	;Compare current range.

tc.setRange(nuCustomer, stMonth, stMonth)

endIf

else

;You must create a secondary index called secCustomerMonth

;for this example to work.

tc.switchIndex("secCustomerMonth")

tc.setRange(nuCustomer, stMonth, stMonth)

endIf

stDisplay = String(nuCustomer) + " had "

              + String(tc.nRecords()) +

              " orders in " + stMonth

msgInfo("Orders in a month", stDisplay)

endMethod


See Also for TCursor::getRange
See Also

setRange

getGenFilter

Table::getRange

UIObject::getRange

Using Ranges and Filters


TCursor::home
home

See Also	Example	TCursor Type

Beginner

Method

Moves to the first record of a table.

Syntax

home ( ) Logical

Description

home sets the current record (and the record buffer) to the first record in a table.


Example for TCursor::home
home Example

For the following example, the pushButton method associates a TCursor with the Orders table, then loads an array with field values in a scan loop. After the loop terminates, the TCursor is positioned at the last record in the table. This method uses home to move the TCursor back to the first record of the table.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
  fldArray Array[] AnyType
  fldVal AnyType
endVar
tc.open("Orders.db")
fldArray.grow(tc.nRecords())
; scan table and store order numbers in fldArray
scan tc:
  tc.fieldValue(1, fldVal)
  fldArray[tc.recNo()] = tc."Order No"
endScan
; TCursor is on the last record after the scan loop

fldArray.view()            ; display contents of array

tc.home()                  ; move TCursor to the first record
endMethod


See Also for TCursor::home
See Also

end

moveToRecord

moveToRecNo

nextRecord

priorRecord

skip


TCursor::initRecord
initRecord

See Also	Example	TCursor Type

Method

Empties the record buffer.

Syntax

initRecord ( ) Logical

Description

initRecord initializes the record buffer by filling it with blanks (not spaces). If default values have been set for fields in the table, initRecord initializes those fields with the default.


Example for TCursor::initRecord
initRecord Example

This example uses initRecord to undo changes made while editing a record in a table frame. Assume that a form contains a table frame custTF bound to the Customer table.

method menuAction(var eventInfo MenuEvent)

var

tc TCursor

endVar

if eventInfo.id() = UserMenu + kMenuUndoRecordEdit then

tc.attach(custTF)

tc.initRecord()

custTF.resync(tc)

endIf

endMethod


See Also for TCursor::initRecord
See Also

copyRecord

currRecord


TCursor::insertAfterRecord
insertAfterRecord

See Also	Example	TCursor Type

Method

Inserts a record into a table after the current record.

Syntax

insertAfterRecord ( [ const pointer TCursor ] ) Logical

Description

insertAfterRecord inserts a record after the current record. This method is useful for inserting a new record after the last record of a table. You can use the optional argument pointer to insert the record pointed to by a different TCursor, or omit the argument to insert a blank record.

If the table is indexed, the record is placed in its sorted position when the record is committed; otherwise it is inserted after the current record.

This method fails if the table is not in Edit mode. Also, this method fails if the current record cannot be committed (for example, because of a key violation).


Example for TCursor::insertAfterRecord
insertAfterRecord Example

For the following example, assume a form has a table frame, CUSTOMER, bound to CUSTOMER.DB. When the user attempts to delete a record, the built-in action method for CUSTOMER moves the record to CUSTARC.DB before deleting the record from CUSTOMER. You could use copyFromArray and copyToArray to accomplish the same thing, but if you use insertAfterRecord you don't have to store the record in an array in order to copy it. As this code demonstrates, you can use the optional argument pointer to insert the record pointed to by a TCursor.

; CUSTOMER::action
method action(var eventInfo ActionEvent)
var
  tcCust, tcArc TCursor
endVar
if eventInfo.id() = DataDeleteRecord then ; if user attempts to delete a record
  if thisForm.Editing = True then         ; if form is in Edit mode
    disableDefault                        ; don't process DataDeleteRecord yet

    if msgYesNoCancel("Confirm",          ; if user confirms delete
       "Delete the current record?") = "Yes" then
      tcCust.attach(CUSTOMER)             ; sync TCursor to CUSTOMER pointer
      if tcArc.open("CustArc.db") then
        tcArc.edit()
        tcArc.end()                       ; move to end of table
        tcArc.insertAfterRecord(tcCust)   ; insert current CUSTOMER record
                                          ; after last record in CustArc.db
        doDefault                         ; process DataDeleteRecord now
      else
        msgStop("Stop!", "Sorry, Can't archive record.")
      endif
    else                                  ; else user didn't confirm delete
      message("Record not deleted.")
    endif
  else                                    ; else form is not in Edit mode
    msgStop("Stop!", "Press F9 to edit data.")
  endif
endif
endMethod


See Also for TCursor::insertAfterRecord
See Also

insertRecord

insertBeforeRecord


TCursor::insertBeforeRecord
insertBeforeRecord

See Also	Example	TCursor Type

Method

Inserts a record into a table before the current record.

Syntax

insertBeforeRecord ( [ const pointer TCursor ] ) Logical

Description

insertBeforeRecord inserts a record before the current record (the same as insertRecord). You can use the optional argument pointer to insert the record pointed to by another TCursor, or omit the argument to insert a blank record.

If the table is indexed, the record is placed in its sorted position when the record is committed; otherwise, it is inserted before the current record.

This method fails if the table is not in Edit mode. Also, this method fails if the current record cannot be committed (for example, because of a key violation).


Example for TCursor::insertBeforeRecord
insertBeforeRecord Example

For the following example, assume a form has a table frame, CUSTOMER, bound to CUSTOMER.DB. When the user attempts to delete a record, the built-in action method for CUSTOMER moves the record to CUSTARC.DB before deleting the record from CUSTOMER. You could use copyFromArray and copyToArray to accomplish the same thing, but if you use insertBeforeRecord you don't have to store the record in an array in order to copy it. As this code demonstrates, you can use the optional argument pointer to insert the record pointed to by a second TCursor.

; CUSTOMER::action
method action(var eventInfo ActionEvent)
var
  tcCust, tcArc TCursor
endVar
if eventInfo.id() = DataDeleteRecord then ; if user attempts to delete a record
  if thisForm.Editing = True then         ; if form is in Edit mode
    disableDefault                        ; don't process DataDeleteRecord yet

    if msgYesNoCancel("Confirm",          ; if user confirms delete
       "Delete the current record?") = "Yes" then
      tcCust.attach(CUSTOMER)             ; sync TCursor to CUSTOMER pointer
      if tcArc.open("CustArc.db") then
        tcArc.edit()
        tcArc.insertBeforeRecord(tcCust)  ; insert current CUSTOMER record
                                          ; before current record in CustArc.db
        doDefault                         ; process DataDeleteRecord now
      else
        msgStop("Stop!", "Sorry, Can't archive record.")
      endif
    else                                  ; else user didn't confirm delete
      message("Record not deleted.")
    endif
  else                                    ; else form is not in Edit mode
    msgStop("Stop!", "Press F9 to edit data.")
  endif
endif
endMethod


See Also for TCursor::insertBeforeRecord
See Also

insertRecord

insertAfterRecord


TCursor::insertRecord
insertRecord

See Also	Example	TCursor Type

Beginner

Method

Inserts a record into a table.

Syntax

insertRecord ( [ const pointer TCursor ] ) Logical

Description

insertRecord inserts a record into a table before the current record (the same as insertBeforeRecord). You can use the optional argument pointer to insert the record pointed to by another TCursor, or omit the argument to insert a blank record.

If the table is indexed, the record is placed in its sorted position when the record is committed; otherwise, it is inserted before the current record.

This method fails if the table is not in Edit mode. Also, this method fails if the current record cannot be committed (for example, because of a key violation).


Example for TCursor::insertRecord
insertRecord Example

For the following example, assume a form has a table frame, CUSTOMER, bound to CUSTOMER.DB. When the user attempts to delete a record, the built-in action method for CUSTOMER moves the record to CUSTARC.DB before deleting the record from CUSTOMER. You could use copyFromArray and copyToArray to accomplish the same thing, but if you use insertRecord you don't have to store the record in an array in order to copy it. As this code demonstrates, you can use the optional argument pointer to insert the record pointed to by another TCursor.

; CUSTOMER::action
method action(var eventInfo ActionEvent)
var
  tcCust, tcArc TCursor
endVar
if eventInfo.id() = DataDeleteRecord then ; if user attempts to delete a record
  if thisForm.Editing = True then         ; if form is in Edit mode
    disableDefault                        ; don't process DataDeleteRecord yet

    if msgYesNoCancel("Confirm",          ; if user confirms delete
       "Delete the current record?") = "Yes" then
      tcCust.attach(CUSTOMER)             ; sync TCursor to CUSTOMER pointer
      if tcArc.open("CustArc.db") then
        tcArc.edit()
        tcArc.insertRecord(tcCust)        ; insert current CUSTOMER record
                                          ; before current record in CustArc.db
        doDefault                         ; process DataDeleteRecord now
      else
        msgStop("Stop!", "Sorry, Can't archive record.")
      endif
    else                                  ; else user didn't confirm delete
      message("Record not deleted.")
    endif
  else                                    ; else form is not in Edit mode
    msgStop("Stop!", "Press F9 to edit data.")
  endif
endif
endMethod


See Also for TCursor::insertRecord
See Also

insertAfterRecord

insertBeforeRecord


TCursor::instantiateView
instantiateView	5.0

See Also	Example	TCursor Type

Method

Copies an in-memory TCursor to a physical table and makes the TCursor point to it.

Syntax

1. instantiateView ( const tableName String ) Logical

2. instantiateView ( const tableVar Table ) Logical

Description

instantiateView copies an in-memory TCursor to a physical table and makes the TCursor point to it. This method returns True if it succeeds; otherwise, it returns False.

Syntax 1 creates the table using the name specified in tableName.

Syntax 2 associates the table with the Table variable specified in tableVar.

Use this method after executing a query that generates a TCursor onto a live query view. instantiateView copies the data from the live query view to a table on disk and makes the TCursor point to it---then you can use that TCursor to manipulate the data. The resulting table has no relationship to the underlying tables in the query.

You can also use instantiateView with TCursors created by ObjectPAL methods.


Example for TCursor::instantiateView
instantiateView Example

This example exectues a query to a TCursor and determines if the result is a live query view. If so, it calls instantitateView to write the view to a physical table, then displays the table in a Tabe window.

method pushButton(var eventInfo Event)

const

kName = "salary"

endConst

var

qbeVar	Query

tcAnswer	TCursor

tvAnswer	TableView

endVar

qbeVar.readFromFile(kName)

qbeVar.executeQBE(tcAnswer)

if tcAnswer.isView() then

tcAnswer.instantiateView(kName)

tvAnswer.open(kName)

else

return

endIf

endIf

endMethod


See Also for TCursor::instantiateView
See Also

isInMemoryTCursor

isView

Query::wantInMemoryTCursor

Paradox Help::Live Query Views


TCursor::isAssigned
isAssigned

See Also	Example	TCursor Type

Method

Reports whether a TCursor variable has been assigned a value.

Syntax

isAssigned ( ) Logical

Description

isAssigned returns True if a TCursor variable has a value assigned using open or attach; otherwise, it returns False.


Example for TCursor::isAssigned
isAssigned Example

The following example associates a TCursor with a table, displays information found in the last record, then closes the TCursor. In this example, the code displays a message indicating whether the TCursor variable is still assigned after the TCursor is closed. This code is attached to the built-in pushButton method for thisButton.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
endVar
tc.open("Orders.db")         ; open a TCursor for Orders.db
tc.end()                     ; move to end of the table

; display information in last record
msgInfo("Last Order", "Order number: " +
String(tc."Order No") + " \nOrder date: " + String(tc."Sale Date"))

tc.close()                   ; attempt to close TCursor

; if close is successful, this displays False (tc is no longer assigned)
; otherwise, it displays True (tc is still assigned if close fails)
msgInfo("Is tc Assigned?", tc.isAssigned())

endMethod


See Also for TCursor::isAssigned
See Also

open

close


TCursor::isEdit
isEdit

See Also	Example	TCursor Type

Method

Reports whether a TCursor is in Edit mode.

Syntax

isEdit ( ) Logical

Description

isEdit returns True if the TCursor is in Edit mode; otherwise, it returns False. If you attach a TCursor to a display manager (such as a UIObject or a TableView), and that object is in Edit mode, the TCursor will be in Edit mode as well.


Example for TCursor::isEdit
isEdit Example

For the following example, assume a form has a table frame bound to the Customer table and a button. The code attached to the pushButton method for thisButton attaches a TCursor to the table frame, then uses isEdit to determine whether the TCursor is in Edit mode. If the table frame was in Edit mode when the TCursor was attached, the TCursor will also be in Edit mode.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
endvar

; attach to the table frame
tc.attach(CUSTOMER)

; if CUSTOMER was in Edit mode, tc will be in Edit mode too

if NOT tc.isEdit() then    ; test whether tc is in Edit mode
  tc.edit()
endif

if tc.locate("Name", "Action Club") then
  tc.phone = "808-555-1234"
else
  msgStop("Sorry", "Can't find Action club")
endif

endMethod


See Also for TCursor::isEdit
See Also

edit

endEdit


TCursor::isEmpty
isEmpty

See Also	Example	TCursor Type

Method

Determines whether a table contains any records.

Syntax

isEmpty ( ) Logical

Description

isEmpty returns True if there are no records in the table associated with the TCursor; otherwise, it returns False.


Example for TCursor::isEmpty
isEmpty Example

For the following example, the pushButton method for the rptRecNo button displays the number of records in the Orders table. If the table is empty, this code alerts the user that the table is empty.

; rptRecNo::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
  tblName String
endVar
tblName = "Orders.db"

if tc.open(tblName) then
  if tc.isEmpty() then                          ; if Orders.db is empty
    msgStop("Hey!",
             tblName + " table is empty!")
  else
    msgInfo(tblName + " table has",             ; report number of records
            String(tc.nRecords()) + " records")
  endIf
else
  msgStop("Sorry", "Can't open " + tblName + " table.")
endif
endMethod


See Also for TCursor::isEmpty
See Also

empty

nRecords

insertRecord


TCursor::isEncrypted
isEncrypted

See Also	Example	TCursor Type

Method

Reports whether a table is password-protected.

Syntax

isEncrypted ( ) Logical

Description

isEncrypted returns True if a table is password-protected; otherwise, it returns False. A TCursor can't be opened on an encrypted table until you use the Session type method addPassword to present the required password. This method does not report whether a user has access rights to the table---use tableRights for that.


Example for TCursor::isEncrypted
isEncrypted Example

The following example tests whether the Customer table is encrypted.

; thisButton::pushButton
method open(var eventInfo Event)
var
  tc TCursor
endvar

if tc.open("Customer.db") then
  if tc.isEncrypted() then
    msgInfo("Table is protected", "An acceptable password has been presented.")
else
  msgStop("Error", "Can't open the Customer table.")
endif

endMethod


See Also for TCursor::isEncrypted
See Also

tableRights

Session::addPassword

Table::protect


TCursor::isInMemoryTCursor
isInMemoryTCursor	5.0

See Also	Example	TCursor Type

Method

Reports whether a TCursor points to a table in system memory or a physical table.

Syntax

isInMemoryTCursor ( ) Logical

Description

isInMemoryTCursor returns True if the TCursor is associated with a table in system memory (for example, a table generated by anObjectPAL method that enumerates information to a TCursor); otherwise, it returns False.

By default, when you execute a query, Paradox tries to create a live query view. In some cases, however, a live query view is not possible. Use isInMemoryTCursor to find out whether the query resulted in a live query view (in which case changes made to the TCursor affect the underlying tables) or an in-memory answer table (in which case the underlying tables are not affected). By default, if the query results in a live query view, isInMemoryTCursor returns False (and isView returns True). However, you can use wantInMemoryTCursor to specify how to create a TCursor resulting from a query.


Example for TCursor::isInMemoryTCursor
isInMemoryTCursor Example

This example reads a query from a file and executes it, then uses a scan loop to increase the salary of each employee by 12 percent. There's no way to know before running the query if it will result in a live query view, so the call to isInMemoryTCursor is required to prevent changes to the actual employee salary data.

method pushButton(var eventInfo Event)

var

qbeVar	Query

tcAnswer	TCursor

endVar

; Read the query from a file.

qbeVar.readFromFile("Salary.qbe")

; We don't know if this query will generate a live

; query view, so use isInMemoryTCursor to find out.

if qbeVar.executeQBE(tcAnswer) then

; If it is in memory (i.e., not live), then

; see the effects of a 12% raise for all employees.

if tcAnswer.isInMemoryTCursor() then

nuOldTotalPayroll = tcAnswer.cSum("Salary")

tcAnswer.edit()

scan tcAnswer :

tcAnswer.Salary = tcAnswer.Salary * .15

endScan

tcAnswer.endEdit()

nuNewTotalPayroll = tcAnswer.cSum("Salary")

msgInfo("Before raise: " + String(nuOldTotalPayroll),

                 "After raise: " + String(nuNewTotalPayroll))

else

; If it is live, inform user and quit the method.

msgStop("Live query view",

             "Edits would affect the underlying table.")

return

endIf

else

errorShow()

endIf

endmethod


See Also for TCursor::isInMemoryTCursor
See Also

Query::executeQBE

Query::wantInMemoryTCursor

instantiateView

isInMemoryTCursor

isView

Paradox Help::Live Query Views


TCursor::isOnSQLServer
isOnSQLServer	4.5

See Also	Example	TCursor Type

Method

Reports whether a TCursor is associated with a table on a SQL server.

Syntax

isOnSQLServer ( ) Logical

Description

isOnSQLServer returns True if the TCursor is associated with a table on a SQL server; otherwise, returns False.


Example for TCursor::isOnSQLServer
isOnSQLServer Example

The following example is a custom method that uses isOnSQLServer to find out whether a TCursor is associated with a remote table. If isOnSQLServer returns True, the code displays a msgQuestion dialog box and prompts the user to confirm the decision to lock the remote table.

method confirmRemoteLock(const tc TCursor) Logical

   if tc.isOnSQLServer() then

      ; you might not want to lock remote tables
      if msgQuestion("Lock table?",
                     "Lock a remote table?") = "Yes" then
         return True
      else
         return False
      endIf

   endIf

endMethod


See Also for TCursor::isOnSQLServer
See Also

isOpenOnUniqueIndex


TCursor::isOpenOnUniqueIndex
isOpenOnUniqueIndex	4.5

See Also	Example	TCursor Type

Method

Reports whether a TCursor is open on a unique index.

Syntax

isOpenOnUniqueIndex ( ) Logical

Description

isOpenOnUniqueIndex returns True if a TCursor is open on a unique index (that is, an index that does not allow duplicate key values); otherwise, returns False. This method is useful for working with remote tables, because operations that update the table (for example, editing data or deleting records) may fail unless the TCursor is opened on a unique index.


Example for TCursor::isOpenOnUniqueIndex
isOpenOnUniqueIndex Example

The following example is a custom method that calls isOpenOnUniqueIndex before putting the TCursor into Edit mode.

method editIfUniqueIndex(const tc TCursor) Logical
   if tc.isOpenOnUniqueIndex() then
      return tc.edit()
   else
      return False
   endIf
endMethod


See Also for TCursor::isOpenOnUniqueIndex
See Also

isInMemoryTCursor

isOnSQLServer

isView


TCursor::isRecordDeleted
isRecordDeleted

See Also	Example	TCursor Type

Method

Reports whether the current record has been deleted (dBASE tables only).

Syntax

isRecordDeleted ( ) Logical

Description

isRecordDeleted reports whether the current record has been deleted. isRecordDeleted works only for dBASE tables because deleted Paradox records can't be displayed. This method returns True if the current record has been deleted; otherwise, it returns False.

Deleted records in a dBASE table are not shown by default. For isRecordDeleted to work correctly, you must call showDeleted to show deleted records in the table; otherwise, deleted records are not visible to isRecordDeleted.


Example for TCursor::isRecordDeleted
isRecordDeleted Example

The following example opens a TCursor for the SCORES.DBF dBASE table, then uses showDeleted to display all deleted records. Then, the code attempts to locate a specific record in the table. This example uses isRecordDeleted to determine whether the record has been deleted; if it has, it is undeleted with undeleteRecord. The following code is attached to the pushButton method for thisButton:

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
endVar
tc.open("Scores.dbf")                 ; open TCursor on a dBASE table
tc.showDeleted()                      ; show deleted records
if tc.locate("Name", "Jones") then    ; if locate finds Jones in Name field
  if tc.isRecordDeleted() then        ; if the record has been deleted
    tc.edit()                         ; begin Edit mode
    tc.undeleteRecord()               ; undelete the record
    message("Jones record undeleted")
  endif
else
  msgStop("Error", "Can't find Jones.")
endif
endMethod


See Also for TCursor::isRecordDeleted
See Also

isShowDeletedOn

showDeleted


TCursor::isShared
isShared

See Also	Example	TCursor Type

Method

Reports whether a table is currently shared.

Syntax

isShared ( ) Logical

Description

isShared returns True if another user has opened the table pointed to by a TCursor; otherwise, it returns False.


Example for TCursor::isShared
isShared Example

For the following example, a form's built-in open method determines whether CUSTOMER.DB is currently being shared by another user; if it is, the user is warned and given the option to continue or abort.

; thisPage::open
method open(var eventInfo Event)
var
  tc TCursor
endVar
tc.open("Customer.db")              ; open a TCursor for Customer
if tc.isShared() then               ; if table is currently shared
  if msgYesNoCancel("Continue?",    ; ask for confirmation
     "Customer table is currently being shared.\n" +
     "Continue anyway?") <> "Yes" then

    close()                         ; close this form
  endif
endif
endMethod


See Also for TCursor::isShared
See Also

isAssigned

isValid


TCursor::isShowDeletedOn
isShowDeletedOn

See Also	Example	TCursor Type

Method

Reports whether deleted records in a dBASE table are shown.

Syntax

isShowDeletedOn ( ) Logical

Description

isShowDeletedOn reports whether the table pointed to by a TCursor currently shows deleted records. You can use the showDeleted method to specify whether or not to show deleted records, then use isShowDeletedOn to determine states. isShowDeletedOn is valid only for dBASE tables.


Example for TCursor::isShowDeletedOn
isShowDeletedOn Example

In the following example, if isShowDeletedOn returns False, the code calls showDeleted to show deleted records in ORDERS.DBF.

; showDeletedRecs::pushButton
method pushButton(var eventInfo Event)
var
  dbfTC TCursor
endVar
if dbfTC.open("Orders.dbf") then
  if NOT dbfTC.isShowDeletedOn() then   ; if deleted records are not shown
    dbfTC.showDeleted(Yes)              ; show deleted records
  endif
else
  msgStop("Sorry", "Can't open Orders.dbf table.")
endIf
endMethod


See Also for TCursor::isShowDeletedOn
See Also

compact

isRecordDeleted

setShowDeleted

showDeleted


TCursor::isValid
isValid

See Also	Example	TCursor Type

Method

Reports whether the contents of a field are legitimate and complete.

Syntax

1. isValid ( const fieldName String, const value AnyType ) Logical

2. isValid ( const fieldNum SmallInt, const value AnyType ) Logical

Description

isValid reports whether the value specified in value conforms with field type and validity checks for the field specified in fieldNum or fieldName. This method gives you an opportunity to check whether a new value is valid for a field before you attempt to post the record.

isValid returns True if value conforms to field type and validity checks; otherwise, it returns False.


Example for TCursor::isValid
isValid Example

The following example uses isValid to test whether a given value is valid for a Date field. If the value is not valid, this code warns the user of the error; otherwise the value is entered into the field. The following code is attached to the pushButton method for thisButton.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
  tryValue String
endVar
tryValue = "100/5/1994" ; Invalid date.
tc.open("Orders.db")
if NOT tc.isValid("Sale Date", tryValue) then
  msgStop("Error",
  String(tryValue) + " is not valid for this field.")
else                  ; this condition is never met
  tc."Sale Date" = tryValue
  tc.postRecord()
endif

endMethod


See Also for TCursor::isValid
See Also

postRecord

setFieldValue


TCursor::isView
isView	5.0

See Also	Example	TCursor Type

Method

Reports whether a TCursor is associated with a live query view.

Syntax

isView (  ) Logical

Description

isView returns True if the TCursor is associated with a live query view; otherwise, it returns False.

When isView is True, isInMemoryTCursor returns False.


Example for TCursor::isView
isView Example

See the example for instantiateView.


See Also for TCursor::isView
See Also

instantiateView

isInMemoryTCursor

Query::wantMemoryTCursor

Paradox Help::Live Query Views


TCursor::locate
locate

See Also	Example	TCursor Type

Beginner

Method

Searches for a specified field value.

Syntax

1. locate ( const fieldName String, const exactMatch AnyType [ , const fieldName String, const exactMatch AnyType ] * ) Logical

2. locate ( const fieldNum SmallInt,  const exactMatch AnyType [ , const fieldNum SmallInt, const exactMatch AnyType ] * ) Logical

Description

locate searches a table for records whose values exactly match the criteria specified in one or more field/value pairs. Specify the value to search for in exactMatch and the field to search in fieldName or fieldNum (use fieldNum for faster performance). This method guarantees that the first value matching exactMatch is found, given the current view of the records. If the TCursor is using a secondary index, locate finds the first record in secondary index order---regardless of that record's primary index order.

The search always starts from the beginning of the table, but if no match is found, the TCursor returns to the original record. If a match is found, the TCursor moves to that record. This operation fails if the current record cannot be posted (for example, because of a key violation).

Note:	The search is case-sensitive unless Session::ignoreCaseInLocate is set to True.


Example for TCursor::locate
locate Example

In the following example, the pushButton method for the fixSpelling button searches for a value in the Name field of the Customer table. If locate is successful, this method replaces the name with a new value and informs the user of the change.

; fixSpelling::pushButton
method pushButton(var eventInfo Event)
var
  ordTC TCursor
endVar

ordTC.open("Customer.db")
; if locate finds "Profesional Divers, Ltd." in the Name field
if ordTC.locate("Name", "Profesional Divers, Ltd.") then
  ; begin Edit mode
  ordTC.edit()
  ; correct spelling (Professional)
  ordTC.Name = "Professional Divers, Ltd."
  msgInfo("Success", "Corrected spelling error.")
else
  msgInfo("Search Failed",
          "Couldn't find \nProfesional Divers, Ltd.")
endIf
ordTC.endEdit()
endMethod


See Also for TCursor::locate
See Also

locateNext

locatePattern

locateNextPattern


TCursor::locateNext
locateNext

See Also	Example	TCursor Type

Beginner

Method

Searches for a specified field value.

Syntax

1. locateNext ( const fieldName String, const exactMatch AnyType [ , const fieldName String, const exactMatch AnyType ]* ) Logical

2. locateNext ( const fieldNum SmallInt, const exactMatch AnyType [ , const fieldNum SmallInt, const exactMatch AnyType ]* ) Logical

Description

locateNext searches a table for records whose values exactly match the criteria specified in one or more field/value pairs. Specify the value to search for in exactMatch and the field to search in fieldName or fieldNum (use fieldNum for faster performance). This method guarantees that the next value matching exactMatch is found, given the current view of the records. If the TCursor is using a secondary index, locateNext finds the next record in secondary index order---regardless of that record's primary index order.

The search begins with the record after the current record. If a match is found, the TCursor moves to that record. If no match is found, the TCursor returns to the original record. To start a search from the beginning of a table, use locate.

This operation fails if the current record cannot be posted (for example, because of a key violation).

Note:	The search is case-sensitive unless Session::ignoreCaseInLocate is set to True.


Example for TCursor::locateNext
locateNext Example

The following example uses locate and locateNext to count the number of records that have "FL" in the State/Prov field of the Customer table. The following code is attached to the findFL pushButton method.

; findFL::pushButton
method pushButton(var eventInfo Event)
var
  CustTC TCursor
  numFound LongInt
endVar
custTC.open("Customer.db")

if custTC.locate("State/Prov", "FL") then
  numFound = 1
  while custTC.locateNext("State/Prov", "FL")
    numFound = numFound + 1
  endWhile
  msgInfo("Records Found", String("Found ", numFound, " companies in FL"))
else
  msgInfo("Sorry", "Can't find FL in State/Prov field.")
endIf

endMethod


See Also for TCursor::locateNext
See Also

locate

locateNextPattern

locatePattern


TCursor::locateNextPattern
locateNextPattern

See Also	Example	TCursor Type

Method

Locates the next record containing a field that has a specified pattern of characters.

Syntax

1. locateNextPattern ( [ const fieldName String, const exactMatch AnyType ] * const fieldName String, const pattern AnyType ) Logical

2. locateNextPattern ( [ const fieldNum SmallInt, const exactMatch AnyType ] * const fieldNum SmallInt, const pattern AnyType ) Logical

Description

locateNextPattern finds sub-strings (for example, "comp" in "computer"). The search begins with the record after the current record. If a match is found, the TCursor moves to that record. If no match is found, the TCursor returns to the original record. If the TCursor is using a secondary index, locateNextPattern finds the next record in secondary index order---regardless of that record's primary index order.

This operation fails if the current record cannot be committed (for example, because of a key violation). To start a search at the beginning of a table, use locatePattern.

To search for records based on the value of a single field, specify the field in fieldName or fieldNum (use fieldNum for faster performance), and specify a pattern of characters in pattern.

You can include the standard pattern operators @ and .. in the pattern argument. The .. operator stands for any string of characters (including none at all); @ stands for any single character. Any combination of literal characters and wildcards can be used in constructing a search. If advancedWildCardsInLocate (in the Session type) is on, you can use advanced match pattern operators, not the standard pattern operators. See the description of advMatch for more information about advanced match pattern operators.

For example, the following statement checks values the in the first field of each record. If a value is anything except "Borland", locateNextPattern returns True.

tc.locateNextPattern(1, [^Borland])

To search records based on the values of more than one field, specify exact matches on all fields except the last one in the list. For example, the following statement searches the Name field for exact matches on "Borland", the Product field for "Paradox", and the Keywords field for words beginning with "data" (for example, "database"):

tc.locateNextPattern("Name", "Borland", "Product", "Paradox", "Keywords", "data*")

Note:	The search is case-sensitive unless Session::ignoreCaseInLocate is set to True.


Example for TCursor::locateNextPattern
locateNextPattern Example

In the following example, assume the SOFTWARE.DB table exists in the current directory. Assume further that two of the fields are named Product and Name. This code (attached to the pushButton method) searches for records whose Name field contains "Borland" and whose Product field begins with "Par". This code keeps track of the matches found and stores field values in a resizeable array. When the method can't locate any more records that match the criteria, the results are displayed in a dialog box.

; findGoodProducts::pushButton
method pushButton(var eventInfo Event)
var
  myNames TCursor
  searchFor String
  numFound SmallInt
  productNames Array[] String
endVar
myNames.open("software.db")
searchFor = "Borland"

; this searches for records with "Borland" in the Name field
; and values starting with "Par" in the Product field
if myNames.locatePattern("Name", searchFor, "Product", "Par..") then
  numFound = 1
  productNames.grow(1)
  productNames[numFound] = myNames.Product

  ; now continue searching through fields with same criteria and
  ; store Product values in myNames array
  while myNames.locateNextPattern("Name", searchFor, "Product", "Par..")
    numFound = numFound + 1
    productNames.addLast(myNames.product)
  endWhile
endIf
if productNames.size() > 0 then
  productNames.view()
endIf
endMethod


See Also for TCursor::locateNextPattern
See Also

locatePattern

locateNext

String::advMatch

Session::advancedWildCardsInLocate

Session::isAdvancedWildCardsInLocate

Paradox Help: Sample Search Strings with Wildcards


TCursor::locatePattern
locatePattern

See Also	Example	TCursor Type

Method

Locates a record containing a field that has a specified pattern of characters.

Syntax

1. locatePattern ( [ const fieldName String, const exactMatch AnyType ] * const fieldName String, const pattern String ) Logical

2. locatePattern ( [ const fieldNum SmallInt, const exactMatch AnyType ] * const fieldNum SmallInt, const pattern String ) Logical

Description

locatePattern finds sub-strings (for example, "comp" in "computer"). The search always starts at the beginning of the table, but if no match is found, the TCursor returns original record. If a match is found, the TCursor moves to that record. If the TCursor is using a secondary index, locate finds the first record in secondary index order---regardless of that record's primary index order.

This operation fails if the current record cannot be committed (for example, because of a key violation). To start a search after the current record, use locateNextPattern. To start a search before the current record, use locatePriorPattern.

To search for records based on the value of a single field, specify the field in fieldName or fieldNum (use fieldNum for faster performance), and specify a pattern of characters in pattern.

You can include the standard pattern operators @ and .. in the pattern argument. The .. operator stands for any string of characters (including none at all); @ stands for any single character. Any combination of literal characters and wildcards can be used in constructing a search. If advancedWildCardsInLocate (in the Session type) is on, you can use advanced match pattern operators, not the standard pattern operators. See the description of advMatch for more information about advanced match pattern operators.

For example, the following statement checks values in the first field of each record. If a value is anything except "Borland", locatePattern returns True.

tc.locatePattern(1, [^Borland])

To search records based on the values of more than one field, specify exact matches on all fields except the last one in the list. For example, the following statement searches the Name field for exact matches on "Borland", the Product field for "Paradox", and the Keywords field for words beginning with "data" (for example, database).

tc.locatePattern("Name", "Borland", "Product", "Paradox", "Keywords", "data*")

Note:	The search is case-sensitive unless Session::ignoreCaseInLocate is set to True.


Example for TCursor::locatePattern
locatePattern Example

In the following example, assume the SOFTWARE.DB table exists in the current directory. Assume further that two of the fields are named Product and Name. This code (attached to the pushButton method) searches for records whose Name field contains "Borland" and whose Product field begins with "Par". This code keeps track of the matches found and stores field values in a resizeable array. When the method can't locate any more records that match the criteria, the results are displayed in a dialog box.

; findGoodProducts::pushButton
method pushButton(var eventInfo Event)
var
  myNames TCursor
  searchFor String
  numFound SmallInt
  productNames Array[] String
endVar
myNames.open("software.db")
searchFor = "Borland"

; this searches for records with "Borland" in the Name field
; and values starting with "Par" in the Product field
if myNames.locatePattern("Name", searchFor, "Product", "Par..") then
  numFound = 1
  productNames.grow(1)
  productNames[numFound] = myNames.Product

  ; now continue searching through fields with same criteria and
  ; store Product values in myNames array
  while myNames.locateNextPattern("Name", searchFor, "Product", "Par..")
    numFound = numFound + 1
    productNames.addLast(myNames.product)
  endWhile
endIf
if productNames.size() > 0 then
  productNames.view()
endIf
endMethod


See Also for TCursor::locatePattern
See Also

locateNextPattern

locate

String::advMatch

Session::advancedWildCardsInLocate

Session::isAdvancedWildCardsInLocate

Paradox Help: Sample Search Strings with Wildcards


TCursor::locatePrior
locatePrior

See Also	Example	TCursor Type

Method

Searches for a specified field value.

Syntax

1. locatePrior ( const fieldName String , const exactMatch AnyType
                 [ , const fieldName String , const exactMatch AnyType ] * ) Logical

2. locatePrior ( const fieldNum SmallInt , const exactMatch AnyType
                 [ , const fieldNum SmallInt , const exactMatch AnyType ] * ) Logical

Description

locatePrior searches a table for records whose values exactly match the criteria specified in one or more field/value pairs. Specify the value to search in searchValue and the field to search in fieldName or fieldNum (use fieldNum for faster performance). This method guarantees that the previous value matching exactMatch is found, given the current view of the records. If the TCursor is using a secondary index, locatePrior finds the previous record in secondary index order---regardless of that record's primary index order.

The search starts from the record before the current record, and searches backwards in the table for the previous match. If a match is found, the TCursor moves to that record; otherwise, it returns to the original record. This operation fails if the current record cannot be committed (for example, because of a key violation). This method returns True if a successful match was made; otherwise, it returns False.

Note:	The search is case-sensitive unless Session::ignoreCaseInLocate is set to True.


Example for TCursor::locatePrior
locatePrior Example

In the following example, the pushButton method for showPrior searches backwards through the Lineitem table for records with a certain order number. The lineTC variable is declared in the page's Var window, and opened to the Lineitem table in the open method for the page.

The following code goes in the Var window for thisPage:

; thisPage::var
Var
  lineTC TCursor
endVar

The following code is attached to the open method for thisPage:

; thisPage::open
method open(var eventInfo Event)
  lineTC.open("Lineitem")        ; open a TCursor for LineItem.db
endMethod

The following code is attached to the pushButton method for the showPrior button:

; showPrior::pushButton
method pushButton(var eventInfo Event)
var
  rec Array[] AnyType
endVar

if lineTC.locatePrior("Order No", 1005) then
  lineTC.copyToArray(rec)
  rec.view("Record #" + String(lineTC.recNo()))
else
  msgStop("Sorry", "No more records.")
endif
endMethod


See Also for TCursor::locatePrior
See Also

locateNext

locateNextPattern

locatePattern


TCursor::locatePriorPattern
locatePriorPattern

See Also	Example	TCursor Type

Method

Locates the previous record containing a field that has a specified pattern of characters.

Syntax

1. locatePriorPattern ( [ const fieldName String, const exactMatch AnyType ] * const fieldName String, 	const pattern String ) Logical

2. locatePriorPattern ( [ const fieldNum SmallInt, const exactMatch AnyType ] * const fieldNum SmallInt, const pattern String ) Logical

Description

locatePriorPattern finds sub-strings (for example, "comp" in "computer"). The search begins with the record before the current record. If a match is found, the TCursor moves to that record. If no match is found, the TCursor returns to the original record. If the TCursor is using a secondary index, locatePriorPattern finds the previous record in secondary index order---regardless of that record's primary index order.

This operation fails if the current record cannot be committed (for example, because of a key violation). To start a search at the beginning of a table, use locatePattern.

To search for records based on the value of a single field, specify the field in fieldName or fieldNum (use fieldNum for faster performance), and specify a pattern of characters in pattern.

You can include the standard pattern operators @ and .. in the pattern argument. The .. operator stands for any string of characters (including none at all); @ stands for any single character. Any combination of literal characters and wildcards can be used in constructing a search. If advancedWildCardsInLocate (in the Session type) is on, you can use advanced match pattern operators, not the standard pattern operators. See the description of advMatch for more information about advanced match pattern operators.

For example, the following statement checks values in first field of each record. If a value is anything except "Borland," locatePriorPattern returns True.

tc.locatePriorPattern(1, [^Borland])

To search records based on the values of more than one field, specify exact matches on all fields except the last one in the list. For example, the following statement searches the Name field for exact matches on "Borland", the Product field for "Paradox", and the Keywords field for words beginning with "data" (for example, "database"):

tc.locatePriorPattern("Name", "Borland", "Product", "Paradox", "Keywords", "data*")

Note:	The search is case-sensitive unless Session::ignoreCaseInLocate is set to True.


Example for TCursor::locatePriorPattern
locatePriorPattern Example

In the following example, the pushButton method for showPriorPtrn searches backwards through the Software table for records with a certain company and product name. The tc variable is declared in the page's Var window, and opened to the Software table in the open method for the page.

The following code goes in the Var window for thisPage:

; thisPage::var
Var
  tc        TCursor
  searchFor String
endVar

The following code is attached to the open method for thisPage:

; thisPage::open
method open(var eventInfo Event)
  tc.open("Software.db")  ; open TCursor for Software.db
  tc.end()                ; move TCursor to the last record
  searchFor = "Borland"
endMethod

The following code is attached to the pushButton method for the showPriorPtrn button:

; showPrior::pushButton
method pushButton(var eventInfo Event)
var
  rec Array[] AnyType
endVar

; search for the previous pattern
if tc.locatePriorPattern("Name", searchFor, "Product", "Par..") then
  tc.copyToArray(rec)
  rec.view("Record #" + String(tc.recNo()))
else
  msgStop("Sorry", "No more records.")
endif
endMethod


See Also for TCursor::locatePriorPattern
See Also

locatePattern

locateNextPattern

String::advMatch

Session::advancedWildCardsInLocate

Session::isAdvancedWildCardsInLocate

Paradox Help: Sample Search Strings with Wildcards


TCursor::lock
lock

See Also	Example	TCursor Type

Beginner

Method

Places specified locks on a specified table.

Syntax

lock ( const lockType String ) Logical

Description

lock attempts to place a lock on the TCursor, where lockType is one of the following String values, listed in order of decreasing strength and increasing concurrency.

String value	Description

Exclusive	The current session has exclusive access to the table. No other session can open the table. Cannot be used with dBASE tables.

Full	The current session can restructure, write to, and read from the table. No other session can write to or restructure the table, they can only read from it. Cannot be used with dBASE tables.

Write	The current session can write to and read from the table. No other session can place a write lock or a read lock on the table.

Read	The current session can read from the table. No other session can place a write lock, full lock, or exclusive lock on the table.

If successful, this method returns True; otherwise, it returns False.


Example for TCursor::lock
lock Example

The following example opens a TCursor for Customer, places a full lock on the table, then uses reIndex to rebuild the Phone_Zip index. Once the index is rebuilt, this code unlocks Customer so other users on a network can gain access to the table.

; reindexCust::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
  pdoxTbl String
endVar
pdoxTbl = "Customer.db"

if tc.open(pdoxTbl) then
  if tc.lock("Full") then     ; attempt to place Full lock
    tc.reIndex("Phone_Zip")   ; rebuild Phone_Zip index
    tc.unLock("Full")         ; unlock the table
    message("Phone_Zip rebuilt.")
  else
    msgStop("Sorry", "Can't lock " + pdoxTbl + " table.")
  endif
endif
endMethod


See Also for TCursor::lock
See Also

lockStatus

unlock


TCursor::lockRecord
lockRecord

See Also	Example	TCursor Type

Method

Puts a write lock on the current record.

Syntax

lockRecord ( ) Logical

Description

Paradox places a write lock on a record when you begin to make changes (an implicit record lock). lockRecord attempts to place a write lock on the record pointed to by a TCursor (an explicit record lock) and if successful, returns True; otherwise, it returns False.


Example for TCursor::lockRecord
lockRecord Example

In the following example, the pushButton method for thisButton searches for a record in the Customer table. If the search is successful, this example attempts to lock the record with lockRecord. When the record has been locked, a custom procedure is called to get new customer information from the user. If lockRecord is not successful, the user is asked to try again later.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  custTC, myCustTC TCursor
endVar
custTC.open("Customer.db")

; attempt to locate record in Customer.db
if custTC.locatePattern("Name", "Jamaica..") then
  custTC.edit()
  if custTC.lockRecord() then        ; attempt to lock the record
    custTC.initRecord()              ; initialize record to the defaults
    getCustInfo()                    ; call a custom procedure
  else                               ; otherwise record couldn't be locked
    msgStop("Sorry", "Can't lock record. \n Try again later.")
  endif
else
  msgStop("Sorry", "Can't find record.")
endif

endMethod


See Also for TCursor::lockRecord
See Also

unLockRecord


TCursor::lockStatus
lockStatus

See Also	Example	TCursor Type

Method

Returns the number of times you have placed a lock on a TCursor.

Syntax

lockStatus ( lockType String ) SmallInt

Description

lockStatus returns the number of times you have placed a lock of type lockType on a TCursor, where lockType is one of the following String values: Write, Read, Full, or Any.

If you haven't placed any locks of a given type, lockStatus returns 0.

If you specify "Any" for lockType, lockStatus returns the total number of locks you've placed on the table. lockStatus reports only on locks you've placed explicitly on the TCursor, not on locks placed by Paradox or by other users or applications.


Example for TCursor::lockStatus
lockStatus Example

This example shows how lockStatus reports only on locks you've placed explicitly on a TCursor, not on locks placed by Paradox or by other users or applications. Assume a form contains a button named thisButton and a field object named Balance_Due bound to the Balance Due field of the Orders table.

; thisButton::pushButton
const

kTbName = "locks"

kStatus = "Any"

endConst

var

tcOrders	TCursor

tvLocks	TableView

endVar

proc displayLockInfo()

tcOrders.enumLocks(kTbName)

tvLocks.open(kTbName)

tvLocks.setTitle("Locks on Orders table:")

siNumLocks = tcOrders.lockStatus(kStatus)

siNumLocks.view("Locks on TCursor:")

tvLocks.close()

endProc

method pushButton(var eventInfo Event)

; Associate TCursor with a field object bound

; to the Balance Due field in the Orders table.

; TCursor gets locks from the UIObject.

tcOrders.attach(Balance_Due)

displayLockInfo() ; Table is locked, but not TCursor.

tcOrders.lock("Write") ; Lock TCursor.

displayLockInfo() ; Table and TCursor are locked,

                    ; but locks are different.

endmethod


See Also for TCursor::lockStatus
See Also

lock

unLockRecord


TCursor::moveToRecNo
moveToRecNo

See Also	Example	TCursor Type

Method

Moves a TCursor to a specific record in a table.

Syntax

moveToRecNo ( const recordNum LongInt ) Logical

Description

moveToRecNo sets the current record to the record specified in recordNum. It returns an error if recordNum is not in the table. Use the nRecords method or examine the NRecords property to find out how many records a table contains. This method is recommended only for dBASE tables. When used for a Paradox table, moveToRecNo behaves exactly like the moveToRecord method.


Example for TCursor::moveToRecNo
moveToRecNo Example

This example uses moveToRecNo to move to a specified record in the dBASE table ORDERS.DBF. Then it displays the value of the SALE_DATE field for that record.

method pushButton(var eventInfo Event)

var

tcOrders	TCursor

siRecNo	SmallInt

daSaleDate	Date

endVar

tcOrders.open("orders.dbf")

siRecNo = 0

siRecNo.view("Enter a record number:")

if siRecNo > 0 then

if	tcOrders.moveToRecNo(siRecNo) then

daSaleDate = tcOrders."SALE_DATE"

daSaleDate.view("Sale date: ")

else

errorShow("Invalid record number.")

endIf

else

return

endIf

endMethod


See Also for TCursor::moveToRecNo
See Also

currRecord

end

home

moveToRecord

nextRecord

nRecords

priorRecord

skip


TCursor::moveToRecord
moveToRecord

See Also	Example	TCursor Type

Method

Moves a TCursor to a specific record in a table.

Syntax

moveToRecord ( const recordNum LongInt ) Logical

Description

moveToRecord sets the current record (and the record buffer) to the record specified in recordNum. It returns an error if recordNum is greater than the number of records in the table. Use nRecords to find out how many records a table contains. This method can be very slow for dBASE tables; use moveToRecNo instead.

This operation fails if the current record cannot be committed (for example, because of a key violation).


Example for TCursor::moveToRecord
moveToRecord Example

This example uses moveToRecord to move to a specified record in the Orders table. Then it displays the value of the Sale Date field for that record.

method pushButton(var eventInfo Event)

var

tcOrders	TCursor

siRecNo	SmallInt

daSaleDate	Date

endVar

tcOrders.open("orders.db")

siRecNo = 0

siRecNo.view("Enter a record number:")

if siRecNo > 0 then

if	tcOrders.moveToRecord(siRecNo) then

daSaleDate = tcOrders."Sale Date"

daSaleDate.view("Sale date: ")

else

errorShow("Invalid record number.")

endIf

else

return

endIf

endMethod


See Also for TCursor::moveToRecord
See Also

nRecords

home

end

nextRecord

priorRecord

currRecord

skip


TCursor::nextRecord
nextRecord

See Also	Example	TCursor Type

Beginner

Method

Moves to the next record in a table.

Syntax

nextRecord ( ) Logical

Description

nextRecord sets the current record to the next record in the table. If the table is in Edit mode, nextRecord commits changes to the current record before moving. This operation fails if the current record cannot be committed (for example, because of a key violation).

nextRecord returns False if you try to move past the end of the table. Also, the last record of the table becomes the current record, and eot returns True.


Example for TCursor::nextRecord
nextRecord Example

In the following example, the pushButton method for showNextCust uses nextRecord to move a TCursor through the Customer table. Each time the TCursor lands on a new record, the code uses copyToArray to copy the contents of the record to a DynArray, then displays field values in a dialog box. When nextRecord attempts to move beyond the last record in the table, eot returns True and the pushButton method terminates.

; showNextCust::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
  scratch DynArray[] AnyType
  tblName String
endVar
tblName = "Customer.db"

if tc.open(tblName) then

  while NOT tc.eot()           ; True until nextRecord attempts to move
                               ; beyond the end the table
    tc.copyToArray(scratch)    ; copy the record to scratch DynArray
    scratch.view("Record " + String(tc.recNo()))
    if msgQuestion("",
       "Do you want to see the next record?") = "Yes" then
      tc.nextRecord()          ; move down one record
    else
      return
    endif
  endWhile

  msgStop("That's it!", "No more records.")

else
  msgStop("Sorry", "Can't open " + tblName + " table.")
endif
endMethod


See Also for TCursor::nextRecord
See Also

home

end

priorRecord

skip

moveToRecord


TCursor::nFields
nFields

See Also	Example	TCursor Type

Method

Returns the number of fields in a table.

Syntax

nFields ( ) LongInt

Description

nFields returns the number of fields in the table associated with a TCursor.


Example for TCursor::nFields
nFields Example

In the following example, the pushButton method for thisButton displays the number of fields in the BioLife table.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
endVar
if tc.open("BioLife.db") then
  msgInfo("Number of BioLife fields", tc.nFields())
else
  msgStop("Sorry", "Can't open BioLife.db table")
endif

endMethod


See Also for TCursor::nFields
See Also

nKeyFields

nRecords


TCursor::nKeyFields
nKeyFields

See Also	Example	TCursor Type

Method

Returns the number of fields in the current index of a table.

Syntax

nKeyFields ( ) LongInt

Description

nKeyFields returns the number of fields in the current index of the table associated with a TCursor. Use getIndexName to get the name of the current index.


Example for TCursor::nKeyFields
nKeyFields Example

The following example reports the number of key fields in a Paradox table.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  pdoxTC   TCursor
  nkf      LongInt
  pdoxTbl  String
endVar
pdoxTbl = "Orders.db"

if pdoxTC.open(pdoxTbl) then
  nkf = pdoxTC.nKeyFields() ; Key fields in the primary index
  msgInfo(pdoxTbl,

          pdoxTbl + " has " + String(nkf) + " key fields.")
else
  msgInfo("Sorry", "Can't open " + pdoxTbl + " table.")
endif

endMethod


See Also for TCursor::nKeyFields
See Also

getIndexName

nFields

nRecords


TCursor::nRecords
nRecords

See Also	Example	TCursor Type	Changes

Beginner

Method

Returns the number of records in a table.

Syntax

nRecords ( ) LongInt

Description

nRecords returns the number of records in the table associated with a TCursor. This operation can take a long time for dBASE tables and large Paradox tables.

Note:	When you call nRecords after setting a filter, the returned value does not represent the number of records in the filtered set. To get that information, use cCount.
When you call nRecords after setting a range, the returned value represents the number of records in the set defined by the range. This functionality was added in version 5.0.

When working with a dBASE table, nRecords counts deleted records if showDeleted is turned on. Otherwise, deleted records are not counted.


Example for TCursor::nRecords
nRecords Example

In the following example, the pushButton method for thisButton runs a custom method if there are more than 10,000 records in ORDERS.DB; otherwise, the code displays the current number of records in Orders.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  ordTC TCursor
  nOrders LongInt
endVar
if ordTC.open("Orders.db") then
  nOrders = ordTC.nRecords()
  if nOrders > 10000 then   ; If Orders has more than 10,000 records
    archiveOldOrders()      ; run a custom method.
  else
    msgInfo("Status",

            "Orders table has " + String(nOrders) + " records.")
  endif
else
  msgStop("Sorry", "Can't open Orders table.")
endif
endMethod


See Also for TCursor::nRecords
See Also

nFields

nKeyFields


Changes to TCursor::nRecords

When you call nRecords after setting a filter, the returned value does not represent the number of records in the filtered set. To get that information, use cCount. When you call nRecords after setting a range, the returned value represents the number of records in the set defined by the range. This functionality was added in version 5.0.


TCursor::open
open

See Also	Example1	Example2	TCursor Type	Changes

Beginner

Method

Opens a table.

Syntax

1. open ( const tableName String [, const db DataBase ] [, const indexName String ] ) Logical

2. open ( const tableVar Table ) Logical

Description

open associates a TCursor with the table named in tableName.

In syntax 1, where tableName is a String, you can use arguments db and indexName to specify a database and an index. If tableName does not specify a file name extension, Paradox assumes the extension is .DB.

Note:	In version 5.0, the indexName option is valid for Paradox tables only. To specify an index for a dBASE table, use Table methods usesIndexes and setIndex.

In syntax 2, where tableVar is the name of a Table variable, you can use the Table method setIndex to specify an index, and you can specify the database using the Table method attach.


Example 1 for TCursor::open
open Example 1

The following example uses the first syntax to open a TCursor on the Customer table in the "SampleTables" database. This code uses the optional indexName clause, so the TCursor uses the "NameAndState" index. The following code is attached to the pushButton method for firstButton:

; firstButton::pushButton
method pushButton(var eventInfo Event)
var
  tc1  TCursor
  samp Database
endVar

; Create the SampleTables alias for the default sample directory.
addAlias("SampleTables", "Standard", "c:\\pdoxwin\\sample")

; Associate the samp Database var with SampleTables database.
samp.open("SampleTables")

; Associate tc1 to the Customer table in samp database,
; and use the NameAndState index.
if not tc1.open("Customer.db", samp, "NameAndState") then

   errorShow()

endIf

endMethod


Example 2 for TCursor::open
open Example 2

The following example achieves the same as Example 1, but uses the second form of the syntax where a tableVar is used. The following code is attached to the pushButton method for secondButton:

; secondButton::pushButton
method pushButton(var eventInfo Event)
var
  tc1  TCursor
  samp DataBase
  tbl  Table
endVar

; Create the SampleTables alias for the default sample directory.
addAlias("SampleTables", "Standard", "c:\\pdoxwin\\sample")

; Associate the samp DataBase var with SampleTables database.
samp.open("SampleTables")

; Attach the tbl Table handle to Customer in the samp database.
tbl.attach("Customer.db", samp)
; Set the tbl index to the NameAndState index.
tbl.setIndex("NameAndState")

; Now associate tc1 TCursor to Customer table in samp database.
if not tc1.open(tbl) then

   errorShow()

endIf

endMethod


See Also for TCursor::open
See Also

close


Changes to TCursor::open

In version 5.0, the indexName option is valid for Paradox tables only. To specify an index for a dBASE table, use Table methods usesIndexes and setIndex.


TCursor::postRecord
postRecord

See Also	Example	TCursor Type

Beginner

Method

Posts changes to a record.

Syntax

postRecord ( ) Logical

Description

postRecord posts changes to a record immediately. The record remains locked. If a key value is changed in an indexed table and the record flies away, the TCursor flies with it and continues to point to the same record. This method returns True if successful; otherwise, it returns False.


Example for TCursor::postRecord
postRecord Example

For the following example, the pushButton method for the fixName button attempts to find a misspelled name in the Customer table. If the erroneous name is found, the code corrects it, then posts changes with postRecord.

; fixName::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
  badName String
endVar
badName = "Usco"
goodName = "Unisco"

tc.open("Customer.db")
if tc.locate("Name", badName) then ; if the erroneous name is found
  tc.edit()                        ; put TCursor in Edit mode
  tc.Name = goodName               ; correct misspelled name
  if tc.postRecord() then          ; True if record is posted
    message("Changes posted.")
  else                             ; record is not posted (Key violation?)
    msgStop("PostRecord", "Can't post these changes.")
  endIf
  tc.endEdit()                     ; end Edit mode
  ; If the record was committed, endEdit simply ends Edit mode--the Name
  ; field now stores "Unisco". If the record was not committed, the field
  ; retains its original value ("Usco").

else                               ; can't find "Usco" in Name field
   message("Can't find " + badName)
endif
endMethod


See Also for TCursor::postRecord
See Also

unLockRecord


TCursor::priorRecord
priorRecord

See Also	Example	TCursor Type

Beginner

Method

Moves to the previous record in a table.

Syntax

priorRecord ( ) Logical

Description

priorRecord sets the current record to the previous record in a table. If the table is in Edit mode, priorRecord commits changes to the current record before moving. It returns False if the TCursor is already at the first record. Also, the first record of the table becomes the current record, and bot returns True.

priorRecord may not be appropriate in all databases, because some may not be bi-directional. This operation fails if the current record cannot be committed (for example, because of a key violation).


Example for TCursor::priorRecord
priorRecord Example

In the following example, the pushButton method for showPrevCust uses priorRecord to move a TCursor backwards through the Customer table. Each time the TCursor lands on a new record, this code uses copyToArray to copy the contents of the record to a DynArray and display field values in a dialog box. When priorRecord attempts to move beyond the beginning of the table, bot returns True and the pushButton method terminates.

; showPrevCust::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
  scratch DynArray[] AnyType
  tblName String
endVar
tblName = "Customer.db"

if tc.open(tblName) then

  tc.end()                     ; move to end of table
  while NOT tc.bot()           ; True until priorRecord attempts to move
                               ; beyond the beginning of the table
    tc.copyToArray(scratch)    ; copy the record to scratch DynArray
    scratch.view("Record " + String(tc.recNo()))
    if msgQuestion("",
       "Do you want to see the next record?") = "Yes" then
      tc.priorRecord()         ; move up one record
    else
      return
    endif
  endWhile

  msgStop("That's it!", "No more records.")

else
  msgStop("Sorry", "Can't open " + tblName + " table.")
endif
endMethod


See Also for TCursor::priorRecord
See Also

home

end

nextRecord

skip

moveToRecord


TCursor::qLocate
qLocate

See Also	Example	TCursor Type

Method

Searches an indexed table for a specified field value.

Syntax

qLocate ( const searchValue AnyType [, const searchValue AnyType ] * ) Logical

Description

qLocate searches an indexed table for records where values in key fields exactly match the criteria specified in searchValue. qLocate searches for values in the active index; the first value corresponds to the first field in the index, the second value corresponds to the second field in the index, and so on.

The search always starts from the beginning of the table, but if no match is found, the TCursor returns to the original record. If a match is found, the TCursor moves to that record. This method does not attempt to post the current record. The operation fails if the number of search values exceeds the number of fields in the current index.


Example for TCursor::qLocate
qLocate Example

This code uses qLocate to find a key value in the Lineitem table:

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
endvar

if tc.open("Lineitem.db") then

  ; if qLocate can find 1002 in the first field of the
  ; index and 1316 in the second field of the index
  if tc.qLocate(1002, 1316) then

    ; make some changes to the record
    tc.edit()
    tc.Qty = 10
    tc.Total = tc."Selling Price" * tc.Qty
    tc.close()
  else
    msgStop("Sorry", "Can't find specified record.")
  endif
else
  msgStop("Error", "Can't open Lineitem.db")
endif

endMethod


See Also for TCursor::qLocate
See Also

locate

locateNext

locateNextPattern

locatePattern

locatePrior

locatePriorPattern


TCursor::recNo
recNo

See Also	Example	TCursor Type	Changes

Method

Returns the record number of the current record.

Syntax

recNo ( ) LongInt

Description

recNo returns an integer representing the current record's position in the table. For a dBASE table, recNo returns the physical position of the record in the table; for an indexed Paradox table, it returns the record's sorted position according to the current index.

Note:	When you call recNo after setting a filter, the returned value is represented by the ObjectPAL constant peInvalidRecordNumber. This functionality was added in version 5.0.


Example for TCursor::recNo
recNo Example

In the following example, the pushButton method for thisButton searches the Customer table for customers residing in Oregon. If any are found, this code stores record numbers in an array, then displays the contents of the array in a dialog box.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
  ar Array[] SmallInt
  tblName String
endVar
tblName = "Customer.db"

tc.open(tblName)
if tc.locate("State/Prov", "OR") then
  ar.addLast(tc.recNo())                   ; add record number to array
  while tc.locateNext("State/Prov", "OR")  ; find the next "OR"
    ar.addLast(tc.recNo())                 ; add more array elements
  endWhile
  ar.view("Record Numbers")                ; display ar array
else
  msgInfo("Nothing to do!", "Can't find \"OR\" in \"State/Prov\" field")
endif
endMethod


See Also for TCursor::recNo
See Also

nRecords


Changes to TCursor::recNo

When you call recNo after setting a filter, the returned value is represented by the ObjectPAL constant peInvalidRecordNumber. This functionality was added in version 5.0.


TCursor::recordStatus
recordStatus

See Also	Example	TCursor Type

Method

Reports about the status of a record.

Syntax

recordStatus ( const statusType String ) Logical

Description

recordStatus returns True or False to a question to report about the status of a record. Use the argument statusType to specify the status to ask about, where statusType is one of the following String values: New, Locked, or Modified.

"New" means the record has just been inserted into the table and is not yet posted to the table. "Locked" means a lock (implicit or explicit) has been placed on the record. "Modified" means at least one of the field values has been changed and is not yet posted to the table.


Example for TCursor::recordStatus
recordStatus Example

The following example tests whether the current record is locked. If the record is not locked, this method uses lockRecord to lock the record; otherwise this example informs the user that the record has previously been locked.

; lockThisRecord::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
endVar
tc.open("orders.db")
tc.edit()

; if the current record is NOT locked
if tc.recordStatus("Locked") = False then
  ; lock the current record
  tc.lockRecord()

  ; if record is locked, this statement will display True
  msgInfo("Record Status", "recordStatus(\"Locked\") = " +
                        String(tc.recordStatus("Locked")))
else
  message("Current record is already locked.")
endIf

endMethod


See Also for TCursor::recordStatus
See Also

lockRecord

unlockRecord


TCursor::reIndex
reIndex

See Also	Example	TCursor Type

Method

Rebuilds specified index files.

Syntax

reIndex ( const IndexName String [, const TagName String ] ) Logical

Description

reIndex rebuilds an index (or index tag) that is not automatically maintained. When working with a Paradox table, use indexName to specify an index (the field name, for a single-field index, or the full name of a composite index). When working with a dBASE table, use indexName to specify a .NDX file, or indexName and tagName to specify an index tag in a .MDX file. This method requires exclusive access to the table.


Example for TCursor::reIndex
reIndex Example

The following example opens a TCursor for Customer (a Paradox table), gains exclusive access to the table, then uses reIndex to rebuild the Phone_Zip index.

; reindexCust::pushButton
method pushButton(var eventInfo Event)
var
  tc      TCursor
  pdoxTbl String
  tb      Table
endVar
pdoxTbl = "Customer.db"

tb.attach(pdoxTbl)
tb.setExclusive(Yes)

if tc.open(tb) then
  tc.reIndex("Phone_Zip")          ; rebuild Phone_Zip index
  message("Phone_Zip reindexed.")
else
  msgStop("Sorry", "Can't open " + pdoxTbl + " table.")
endif

endMethod


See Also for TCursor::reIndex
See Also

reIndexAll


TCursor::reIndexAll
reIndexAll

See Also	Example	TCursor Type

Method

Rebuilds all index files for a table.

Syntax

reIndexAll ( ) Logical

Description

reIndexAll rebuilds all indexes for the table associated with a TCursor. This method requires exclusive rights to the table to rebuild a maintained index, and it requires a write lock to rebuild a non-maintained index. reIndexAll works only with Paradox tables, because any index opened for a dBASE table is maintained automatically.


Example for TCursor::reIndexAll
reIndexAll Example

For the following example, the pushButton method for a button rebuilds all indexes for the Customer table.

; reindexAllCust::pushButton
method pushButton(var eventInfo Event)
var
  tc      TCursor
  pdoxTbl String
  tb      Table
endVar
pdoxTbl = "Customer.db"

tb.attach(pdoxTbl)
tb.setExclusive(Yes) ; Need exclusive rights for a  maintained index.

if tc.open(tb) then
  tc.reIndexAll()               ; Rebuild all Customer indexes.
  message("Indexes rebuilt.")
else
  msgStop("Sorry", "Can't open " + pdoxTbl + " table.")
endif
endMethod


See Also for TCursor::reIndexAll
See Also

reIndex


TCursor::seqNo
seqNo

See Also	Example	TCursor Type	Changes

Method

Returns the record number of the current record.

Syntax

seqNo ( ) LongInt

Description

seqNo returns an integer representing the current record's position in a table. For dBASE tables, seqNo returns the sequential position of a record as viewed by the current index. For Paradox tables, seqNo and recNo always return the same value.

Note:	When you call seqNo after setting a filter, the returned value is represented by the ObjectPAL constant peInvalidRecordNumber. This functionality was added in version 5.0.


Example for TCursor::seqNo
seqNo Example

In the following example, assume SCORES.DBF has three records and the second record has been deleted. The code attached to the pushButton method for testSeqNo demonstrates the difference between seqNo and recNo methods.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
endVar

  ; Scores.dbf has 3 records and the second record is deleted
tc.open("Scores.dbf")

  ; do not show deleted records
tc.showDeleted(No)

  ; this displays recNo() = 1
  ;               seqNo() = 1
msgInfo("tc Status", "recNo() = " + String(tc.recNo()) + "\n" +
                     "seqNo() = " + String(tc.seqNo()))

  ; move to the last record in the table
tc.end()

  ; this displays   recNo() = 3
  ;                 seqNo() = 2   (record number 2 is deleted)
msgInfo("tc Status", "recNo() = " + String(tc.recNo()) + "\n" +
                     "seqNo() = " + String(tc.seqNo()))

endMethod


See Also for TCursor::seqNo
See Also

moveToRecNo

moveToRecord

recNo


Changes to TCursor::seqNo

When you call seqNo after setting a filter, the returned value is represented by the ObjectPAL constant peInvalidRecordNumber. This functionality was added in version 5.0.


TCursor::setBatchOff
setBatchOff	4.5

See Also	Example	TCursor Type

Method

Ends the batch processing mode invoked by a call to setBatchOn.

Syntax

setBatchOff ( ) Logical

Description

setBatchOff ends batch processing mode by removing the restrictions imposed by setBatchOn.


Example for TCursor::setBatchOff
setBatchOff Example

See the example for setBatchOn.


See Also for TCursor::setBarchOff
See Also

setBatchOn


TCursor::setBatchOn
setBatchOn	4.5

See Also	Example1	Example2	TCursor Type

Method

Groups multiple operations to improve performance of table updates in a multiuser environment.

Syntax

setBatchOn ( ) Logical

Description

When update operations are performed after executing a setBatchOn statement, file I/O and concurrency control are minimized, resulting in improved performance. setBatchOn gives you exclusive access to a table for a short period of time. After setBatchOn executes, no other user or session can access, open, modify, lock, or read from the table until setBatchOff executes. (Other TCursors in the same session can still access the table.) If setBatchOff does not execute, the lock remains in effect for the life of the TCursor. setBatchOn is useful when several short operations should occur sequentially. setBatchOn should be used by advanced developers for serializing operations and improving performance. Most developers will not need this command.

Note:	setBatchOn is intended to operate for less than two seconds. If another user attempts to update or access the current table, that user's system will freeze. If setBatchOn is not followed by a setBatchOff statement, the other user's system will be frozen for up to two minutes. After two minutes, the operation that caused the user's system to freeze will fail due to a timeout error, and the user's system will resume operation.

Other users have no way of determining whether setBatchOn has been called. Always call setBatchOff as soon as possible after calling setBatchOn to minimize the chances of interfering with other users.


Example 1 for TCursor::setBatchOn
setBatchOn Example 1

Suppose a form's data model contains the Orders table and the Lineitem table linked 1:M, with Orders as the master table. The following code deletes all the records in the current detail set; that is, it deletes all the line items for the current order.

  method pushButton(var eventInfo Event)
     var
        ordersTC TCursor
     endVar

     ordersTC.attach(Lineitem) ; attach to the detail set
     ordersTC.edit()

     ordersTC.setBatchOn()
     while not ordersTC.eot()
        ordersTC.deleteRecord()
     endWhile
     ordersTC.setBatchOff()

  endMethod


Example 2 for TCursor::setBatchOn
setBatchOn Example 2

Many applications require an autosequence number that must be incremented by each user who attempts to add a record to a table. This example shows how setBatchOn and setBatchOff could be used to serialize access to such an autosequence number. The following example assumes that the NumTable table contains a single numeric field called Sequence Number.

In this example, every user who attempts an operation would call the custom method GetAutoSequence. The first user to call the method gets the lowest sequence number. The call to setBatchOn holds every other user out without locking the table. Every other user who has issued a GetAutoSequence call gains access to the table sequentially.

  method GetAutoSequence() LongInt
     var
        numTableTC	TCursor
        SequenceVar	LongInt
     endVar

     numTableTC.open("numtable.db")
     numTableTC.edit()

     numTableTC.setBatchOn()
     numTableTC."Sequence Number" = numTableTC."Sequence Number" + 1
     numTableTC.postRecord()
     SequenceVar = numTableTC."Sequence Number"
     numTableTC.setBatchOff()

     return SequenceVar
  endMethod


See Also for TCursor::setBatchOn
See Also

setBatchOff


TCursor::setFieldValue
setFieldValue

See Also	Example	TCursor Type

Method

Assigns a value to a specified field.

Syntax

1. setFieldValue ( const fieldName String, const value AnyType ) Logical

2. setFieldValue ( const fieldNum SmallInt, const value AnyType ) Logical

Description

setFieldValue sets the value of a field (fieldName or fieldNum) to value. This method returns True if successful; otherwise, it returns False.

You can achieve the same results using dot notation. For example, this statement uses dot notation to change the value in the Last Bid field:

tcVar."Last Bid" = 32.25

The following statement uses setFieldValue to achieve the same results:

tcVar.setFieldValue("Last Bid", 32.25)


Example for TCursor::setFieldValue
setFieldValue Example

In the following example, the pushButton method for correctName locates a misspelled name in the Name field, then uses setFieldValue to replace the original name.

; correctName::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
  badName, goodName String
endVar

badName = "Usco"
goodName = "Unisco"
tc.open("Customer.db")
if tc.locate("Name", badName) then
  tc.edit()
  tc.setFieldValue("Name", goodName)    ; correct misspelled name
  tc.postRecord()                       ; post record to the table
  tc.endEdit()                          ; end Edit mode
  message("Usco replaced with Unisco.")
else                                    ; can't find "Usco" in Name field
  message("Can't find " + badName)
endif
endMethod


See Also for TCursor::setFieldValue
See Also

fieldValue


TCursor::setFlyAwayControl
setFlyAwayControl

See Also	Example	TCursor Type

Method

Specifies whether flyaway information is made available to the didFlyAway method.

Syntax

setFlyAwayControl ( [ const yesNo Logical ] ) Logical

Description

setFlyAwayControl specifies in yesNo whether flyaway information is made available to the didFlyAway method.

When you're working with indexed tables, the didFlyAway, setFlyAwayControl, and unlockRecord methods are closely related. When you call unlockRecord, the record is posted (if no key violation exists) to the table and moved to its sorted position. Depending on whether the record moved to a new position, the TCursor may not continue to point to the posted record. This behavior is referred to as record flyaway.

You can use didFlyAway to test whether the record did, in fact, fly away.

When setFlyAwayControl is set to Yes, Paradox performs extra record-level checking for many operations. This extra work can slow an application down, so you should set setFlyAwayControl to Yes only when the application needs flyaway information, and set it to No (the default) otherwise.


Example for TCursor::setFlyAwayControl
setFlyAwayControl Example

See the example for didFlyAway.


See Also for TCursor::setFlyAwayControl
See Also

didFlyAway

postRecord

unLockRecord


TCursor::setGenFilter
setGenFilter	5.0

See Also	Example	TCursor Type

Method

Specifies conditions for including records in a TCursor.

Syntax

1. setGenFilter ( [ idxName String, [ tagName String, ] ] criteria DynArray[] AnyType ) Logical

2. setGenFilter ( [ idxName String, [ tagName String, ] ] criteria Array[] AnyType [ , fieldId Array[] AnyType ] ) Logical

Description

setGenFilter specifies conditions for including records in a TCursor. Records that meet all the specified conditions are included, records that don't are filtered out. Unlike setRange, this method does not required an indexed table.

In syntax 1, the DynArray criteria specifies fields and filtering conditions as follows: the tag is the field name or field number, and the item is the filter expression. For example, the following code specifies criteria based on the values of three fields.

criteriaDA[1]      = "Widget" ; The value of the first field in the table is Widget.
criteriaDA["Size"] = "> 4"    ; The value of the field named Size is greater than 4.
criteriaDA["Cost"] = ">= 10.95, < 22.50" ; The value of the field named Cost is greater than or equal to 10.95 and less than 22.50.

If the DynArray is empty, any existing filter criteria are removed.

In syntax 2, the Array criteria specifies filtering conditions, and the optional Array fieldId specifies field names and/or field numbers. If you omit fieldID, conditions are applied to fields in the order they appear in the criteria array (the first condition applies to the first field in the table, the second condition applies to the second field, and so on). The following example fills arrays for syntax 2 to specify the same criteria as the example for syntax 1.

criteriaAR[1] = "Widget"
criteriaAR[2] = "> 4"
criteriaAR[3] = ">= 10.95, < 22.50"
fieldAR[1] = 1
fieldAR[2] = "Size"
fieldAR[3] = "Cost"

If the Array is empty, any existing filter criteria are removed.

For both syntaxes, idxName specifies an index name (Paradox and dBASE tables) and tagName specifies a tag name (dBASE tables only). If you use these optional items, the index (and tag) are applied to the TCursor before the filtering criteria.

This method fails if the current record cannot be committed.


Example for TCursor::setGenFilter
setGenFilter Example

In this example, the built-in run method for a script opens a TCursor onto the Customer table, then sets filter criteria on the State field to equal "CA". Then a scan loop is used to fill the DynArray dynView with the customer name and phone number. Finally, a view dialog box displays the data.

;Script :: run

method run(var eventInfo Event)

var

tc	TCursor

dyn,

dynView	DynArray[] AnyType

endVar

dyn["State/Prov"] = "CA"

tc.open("CUSTOMER.DB")

tc.setGenFilter(dyn)

scan tc:

dynView[tc."Name"] = tc."Phone"

endScan

dynView.view()

endMethod


See Also for TCursor::setGenFilter
See Also

getGenFilter

dropGenFilter

setRange

UIObject::setGenFilter

Using Ranges and Filters


TCursor::setRange
setRange	5.0

See Also	Example1	Example2	TCursor Type

Method

Specifies a range of records to include.

Syntax

1. setRange ( [ const exactMatchVal AnyType ] * [ , const minVal AnyType, const maxVal AnyType ] ) Logical

2. setRange ( rangeVals Array[] AnyType ) Logical

Description

setRange specifies conditions for including a range of records. Records that meet the conditions are included; records that don't are excluded. setRange compares the criteria you specify with values in the corresponding fields of a table's index; it fails if the current record cannot be committed or if the table is not indexed. Calling setRange without any arguments resets the range criteria to include the entire table.

Note:	This method replaces setFilter included in earlier versions: both functionality and performance are enhanced. Code that calls setFilter will continue to execute as before.

In syntax 1, to set a range based on the value of the first field of the index, specify values in minVal and maxVal. For example, the following statement checks values in the first field of the index of each record;

tcVar.setRange(14, 88)

If a value is less than 14 or greater than 88, that record is excluded. To specify an exact match on the first field of the index, assign minVal and maxVal the same value. For example, the following statement excludes all values except 55:

tcVar.setRange(55, 55)

You can set a range based on the values of more than one field. To do so, specify exact matches except for the last one in the list. For example, the following statement looks for exact matches on "Borland" and "Paradox" (assuming they are the first fields in the index), and values ranging from 100 to 500, inclusive, for the third field:

tcVar.setRange("Borland", "Paradox", 100, 500)

In syntax 2, you can pass an array of values to specify the range criteria, as listed in the following table.

Number of array items	Range specification

No items (empty array)	Resets range criteria to include the entire table.

One item	Specifies a value for an exact match on the first field of the index.

Two items	Specifies a range for the first field of the index.

Three items	The first item specifies an exact match for the first field of the index; items 2 and 3 specify a range for the second field of the index.

More than three items	For an array of size n, specify exact matches on the first n-2 fields of the index. The last two array items specify a range for the n-1 field of the index.


Example 1 for TCursor::setRange
setRange Example 1

For the following example, assume that the first field in Lineitem's key is "Order No." and you want to know the total for order number 1005. When you press the getDetailSum button, the pushButton method opens a TCursor for Lineitem, then limits the number of records included in the TCursor to those with 1005 in the first key field. After the call to setRange, this example uses cSum to display the sum of the Total field. Because the TCursor is pointing only to order number 1005, cSum reports summary information only for that order.

; getDetailSum::pushButton
method pushButton(var eventInfo Event)
var
  lineTC TCursor
  tblName String
endVar
tblName = "LineItem.db"
if lineTC.open(tblName) then

  ; this limits TCursor's view to records that have
  ; 1005 as their key value (Order No. 1005).
  lineTC.setRange(1005, 1005)

  ; now display the total for Order No. 1005
  msgInfo("Total for Order 1005", lineTC.cSum("Total"))
else
  msgStop("Sorry", "Can't open " + tblName + " table.")
endif
endMethod


Example 2 for TCursor::setRange
setRange Example 2

This example shows how to call setRange with a criteria array that contains more than three items. The following code sets a range to include orders from a person with a specific first name, middle initial, and last name, and an order quantity ranging from 100 to 500 items. Then it counts the number of records in this range and displays the value in a dialog box. This example assumes that the PartsOrd table is indexed on the FirstName, MiddleInitial, LastName, and Qty fields.

; setQtyRange::pushButton
method pushButton(var eventInfo Event)
var
tcPartsOrd	TCursor
arRangeInfo	Array[5] AnyType

nuCount	Number
endVar

arRangeInfo[1] = "Frank"      ; FirstName (exact match)

arRangeInfo[2] = "P."         ; MiddleInitial (exact match)

arRangeInfo[3] = "Borland"    ; LastName (exact match)

arRangeInfo[4] = 100          ; Minimum qty value

arRangeInfo[5] = 500          ; Maximum qty value

if tcPartsOrd.open("PartsOrd") then
tcPartsOrd.setRange(arRangeInfo)

nuCount = tcPartsOrd.cCount(1)

nuCount.view("Number of big orders by Frank P. Borland:")
else
errorShow("Can't open the table.")
endif
endMethod


See Also for TCursor::setRange
See Also

getRange

reIndex

reIndexAll

setGenFilter

switchIndex

Table::setRange

UIObject::setRange

Using Ranges and Filters


TCursor::setShowDeleted
setShowDeleted

See Also	Example	TCursor Type

Method

Specifies whether to show deleted records (dBASE tables only).

Syntax

setShowDeleted ( [ yesNo ] ) Logical

Description

setShowDeleted specifies whether to show deleted records. You can use yesNo to specify Yes, to show deleted records, or No, if you don't want to show them. If you omit the argument, the value is True by default.

Note:	setShowDeleted is valid only for dBASE tables.


Example for TCursor::setShowDeleted
setShowDeleted Example

var
   dbfTable TCursor
endVar
if dbfTable.open("orders.dbf") then
   dbfTable.setShowDeleted(Yes)
endIf


See Also for TCursor::setShowDeleted
See Also

open

isShowDeletedOn

showDeleted


TCursor::showDeleted
showDeleted

See Also	Example	TCursor Type

Method

Specifies whether to show deleted records in a dBASE table.

Syntax

showDeleted ( [ yesNo ] ) Logical

Description

showDeleted specifies whether to show deleted records in a dBASE table. You can use yesNo to specify Yes to show deleted records, or No if you don't want to show them. If omitted, yesNo is Yes by default. showDeleted is valid only for dBASE tables because deleted records in a Paradox table cannot be shown.


Example for TCursor::showDeleted
showDeleted Example

In the following example, the pushButton method attached to showDeletedRecs calls showDeleted to show deleted records in ORDERS.DBF.

; showDeletedRecs::pushButton
method pushButton(var eventInfo Event)
var
  dbfTC TCursor
endVar
if dbfTC.open("Orders.dbf") then
  dbfTC.showDeleted(Yes)
else
  msgStop("Sorry", "Can't open Orders.dbf table.")
endIf
endMethod


See Also for TCursor::showDeleted
See Also

compact

isRecordDeleted

isShowDeletedOn

showDeleted


TCursor::skip
skip

See Also	Example	TCursor Type

Method

Moves forward or backward a specified number of records in a table.

Syntax

skip ( [ const nRecords LongInt ] ) Logical

Description

skip sets the current record (and the record buffer) to the record nRecords from the current record. If skip tries to move beyond the limits of the table, you'll get an error, and the current record will be the first or last record of the table, as appropriate. This operation fails if the current record cannot be committed (for example, because of a key violation).

Positive values for nRecords move forward through the table (skip(1) is the same as nextRecord), negative values move backward (skip(-1) is the same as priorRecord), and a value of 0 doesn't move (skip(0) is the same as currRecord). If omitted, nRecords is 1 by default.


Example for TCursor::skip
skip Example

The following example demonstrates how skip affects a TCursor's record position in a table.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
endVar
tc.open("Orders.db")

tc.skip(5)     ; ahead 5 records. tc.recNo() = 6
tc.skip(-3)    ; back 3 records. tc.recNo() = 3
tc.skip(-5)    ; fails--attempted to move beyond the
               ; beginning of the table.
               ; tc.recNo() = 1
               ; tc.bot() = True

endMethod


See Also for TCursor::skip
See Also

home

end

nextRecord

priorRecord

currRecord

moveToRecord


TCursor::sortTo
sortTo

See Also	Example	TCursor Type

Method

Sorts a table.

Syntax

1. sortTo ( const destTable String, const numFields SmallInt, const sortFields Array[ ] String, const sortOrder Array[ ] SmallInt ) Logical

2. sortTo ( const destTable Table, const numFields SmallInt, const sortFields Array[ ] String, const sortOrder Array ) Logical

Description

sortTo sorts a table based on values of fields, and puts the results into destTable.

sortFields is an array of strings or integers specifying the fields on which to sort. The size of the sortFields array is specified in numFields. sortOrder is an array of integers, where a value of 0 specifies a sort in ascending order, and a value of 1 specifies descending order. The two arrays must be the same size, specified in numFields. Element 1 of sortOrder specifies how to sort the field named in element 1 of sortFields, and so on.

This method requires at least a read only lock on the source table, and a full lock on the destination table. If destTable exists, it will be overwritten without asking for confirmation. If destTable is open, this method fails. You cannot use sortTo to sort a table onto itself; use a sort structure for that.


Example for TCursor::sortTo
sortTo Example

The following example sorts the Customer table to the CUSTSORT.DB table, then opens the sorted table. If the Customer table cannot be write-locked, this example informs the user of the error and aborts the operation. If the CustSort destination table exists, the user is given an opportunity to continue or abort.

The following code goes in the Const window for the sortCustButton button:

; sortCustButton::Const

const

kAscending = 0

kDescending = 1

endConst

The following code goes in the Var window for the sortCustButton button:

; sortCustButton::var
var
  sortFlds Array[2]  String
  sortOrder Array[2] SmallInt
  tc                 TCursor
  srcTbl, destTbl    String
  noSort             Logical
  sortTbl            TableView
endVar

The following code is attached to the button's open method. This code assigns open a TCursor for the Customer table and initializes the array elements. These assignments determine the sort criteria for sortTo.

; sortCustButton::pushButton
method open(var eventInfo Event)
srcTbl = "Customer.db"
destTbl = "CustSort.db"
if tc.open(srcTbl) then
  noSort = False                 ; flag for pushButton method
  sortFlds[1] = "First Contact"  ; sort by First Contact
  sortOrder[1] = kAscending      ; in ascending order

  sortFlds[2] = "Country"        ; then by Country
  sortOrder[2] = kDescending     ; in descending order
else
  noSort = True
endif

endMethod

The following code is attached to the pushButton method for the sortCustButton button. When the button is pressed, the code attempts to place a write lock on the source table (CUSTOMER.DB), prompts the user if the destination table exists (CUSTSORT.DB), then sorts Customer to CustSort based on the values in the sortFlds and sortOrder arrays. After CUSTSORT.DB is created (or overwritten), this example opens it as a TableView.

; sortCustButton::pushButton
method pushButton(var eventInfo Event)
if noSort = False then
  if tc.lock("Write") then
    if isTable(destTbl) then
      if msgQuestion("Overwrite?",
           "Replace " + destTbl + " ?") <> "Yes" then
           msgInfo("Canceled", "Operation canceled.")
           return
      endif
    endif
    tc.sortTo(destTbl, 2, sortFlds, sortOrder)
    sortTbl.open(destTbl)
  else
    msgStop("Stop!", "Can't write-lock " + srcTbl + " table.")
  endif
else
  msgStop("Sorry", "Can't open " + srcTbl + " table.")
endif
endMethod


See Also for TCursor::sortTo
See Also

add

copy

subtract


TCursor::subtract
subtract

See Also	Example	TCursor Type

Method

Subtracts the records in one table from another table.

Syntax

1. subtract ( const destTable String ) Logical

2. subtract ( const destTable Table ) Logical

3. subtract ( const destTable TCursor ) Logical

Description

subtract checks whether any records in the source table are also in destTable. If so, subtract deletes them from destTable without asking for confirmation.

If destTable is indexed, subtract deletes all records with indexes that exactly match values in corresponding index fields in the source table. If destTable is not indexed, subtract deletes all records that exactly match any record in the source table. Whether tables are indexed or not, this method considers only fields that could be keyed (based on data type, not position). For example, numeric fields are considered, but formatted memos are not. This method requires read/write access to both tables.

Note:	If the destination table is not indexed, this operation can be time-consuming.

This method tries, for the duration of the retry period, to place a full lock on both tables. If locks cannot be placed, an error results.


Example for TCursor::subtract
subtract Example

In the following example, the pushButton method for subtractCust deletes records from the Customer table that exactly match those in the Answer table.

; subtractCust::pushButton
method pushButton(var eventInfo Event)
var
  ansTC, custTC TCursor
endVar

if ansTC.open(":PRIV:Answer.db") and
   custTC.open("Customer.db") then

  ansTC.subtract(custTC)              ; subtract Answer records from Customer

else
  msgStop("Stop!", "Can't open tables.")
endif

endMethod


See Also for TCursor::subtract
See Also

add

copy


TCursor::switchIndex
switchIndex

See Also	Example	TCursor Type

Beginner

Method

Specifies another index to use to view the records in a table.

Syntax

1. switchIndex ( [ const indexName String ]   [, const stayOnRecord Logical ] ) Logical

2. switchIndex ( [ const indexFileName String  [, const tagName String ] ] [, const stayOnRecord Logical ] ) Logical

Description

switchIndex specifies in indexName an index file to use with a table. In syntax 1, indexName specifies an index to use with a Paradox table. If you omit indexName, the table's primary index is used.

Syntax 2 is for dBASE tables, where indexFileName can specify a .NDX file or a .MDX file, and optional argument tagName specifies an index tag in a production index (.MDX) file.

In both syntaxes, if optional argument stayOnRecord is Yes, this method maintains the current record after the index switch; if it is No, the first record in the table becomes the current record. If omitted, stayOnRecord is No by default.


Example for TCursor::switchIndex
switchIndex Example

In the following example, assume that Customer is a keyed Paradox table that has a secondary index named "NameAndState". This example opens a TCursor for Customer, calls switchIndex to switch from the primary index to the "NameAndState" index, then displays the first value in the Name field. Since the TCursor is sorted on Name and State fields in ascending order, the field value displayed is the first name in ascending sort order.

; thisButton::pushButton
method pushButton(var eventInfo Event)
   var
      tc TCursor
   endvar

   tc.open("Customer.db")            ; open TCursor for Customer
   tc.switchIndex("NameAndState")    ; switch to index NameAndState
   tc.home()                         ; move to the first record
   msgInfo("First Record", tc.Name)  ; display value in Name field

   tc.switchIndex( )                 ; to restore primary index
   { tc.switchIndex (" ", True) to stay on the same record. }
   msgInfo("First Record", tc.Name)  ; display value in Name field
endMethod


See Also for TCursor::switchIndex
See Also

reIndex

reIndexAll

Table::setIndex


TCursor::tableName
tableName

See Also	Example	TCursor Type

Method

Returns the name of the table associated with a TCursor.

Syntax

tableName ( ) String

Description

tableName returns the name of the table associated with a TCursor. This method is useful when you're passing variables to the TCursor open method.


Example for TCursor::tableName
tableName Example

In the following example, the pushButton method for thisButton uses findFirst and findNext methods from the FileSystem type to locate Paradox tables in the current working directory. This example searches each table for a value in the Name field of the current table. This example opens all of the tables in the current directory that have "Unisco" in the "Name" field.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  fs FileSystem
  tc TCursor
  tb TableView
endVar
if fs.findFirst("*.db") then
  while fs.findNext()
    tc.open(fs.Name())                  ; open TCursor for a .db file
    if tc.locate("Name", "Unisco") then ; if we find Unisco in Name field
      tb.open(tc.tableName())           ; open table associated with TCursor
    endIf
    tc.close()
  endWhile
endIf

endMethod


See Also for TCursor::tableName
See Also

tableRights


TCursor::tableRights
tableRights

See Also	Example	TCursor Type

Method

Reports about the operations you can perform on a table.

Syntax

tableRights ( const rights String ) Logical

Description

tableRights reports about a user's rights to a table, where rights is one of the following:

Value	Description

"ReadOnly"	Read from the table, but not change it.

"Modify"	Enter or change data.

"Insert"	Add new records.

"InsDel"	Add and delete records.

"Full" or "All"	Perform all of the above operations.

This method returns True if the user has the specified rights; otherwise, it returns False.


Example for TCursor::tableRights
tableRights Example

The following example reports whether the user has "InsDel" rights to the Orders table.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
   myRights Logical
   ordersTC TCursor
endVar
ordersTC.open("orders.db")
ordersTC.edit()
myRights = ordersTC.tableRights("InsDel")

  ; this displays True if you have InsDel rights to Orders.db
msgInfo("Rights to Enter?", myRights)

endMethod


See Also for TCursor::tableRights
See Also

fieldRights


TCursor::type
type

See Also	Example	TCursor Type

Method

Returns the type of a table.

Syntax

type ( ) String

Description

type returns a string describing the type of a table, either Paradox or dBASE.


Example for TCursor::type
type Example

The following example compacts (removes deleted records) from the Orders table if type returns dBASE; otherwise a message indicates that Orders is a Paradox table.

; compact::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
endVar

tc.open("Orders.db")

; if Orders.db is a dBASE table
if tc.type() = "dBASE" then
  ; remove deleted records
  tc.compact()
else
  ; otherwise, display the type of table
  msgStop("Stop!", "Orders.db is a " + tc.type() + " table.")
endif

endMethod


See Also for TCursor::type
See Also

isAssigned

tableName


TCursor::unDeleteRecord
unDeleteRecord

See Also	Example	TCursor Type

Beginner

Method

Undeletes the current record from a dBASE table.

Syntax

unDeleteRecord ( ) Logical

Description

unDeleteRecord undeletes the current record of a dBASE table. This operation can be successful only if showDeleted has been set to True, the current record is a deleted record, and the TCursor is in Edit mode.


Example for TCursor::unDeleteRecord
unDeleteRecord Example

The following example opens a TCursor for SCORES.DBF (a dBASE table), then uses showDeleted to display all deleted records. Then, the code attempts to locate a specific record in the table. This example uses isRecordDeleted to determine whether the record has been deleted; if it has, it is undeleted with unDeleteRecord. The following code is attached to the pushButton method for thisButton:

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
endVar
tc.open("Scores.dbf")                 ; open TCursor on a dBASE table
tc.showDeleted()                      ; show deleted records
if tc.locate("Name", "Jones") then    ; if locate finds Jones in Name field
  if tc.isRecordDeleted() then        ; if the record has been deleted
    tc.edit()                         ; begin Edit mode
    tc.undeleteRecord()               ; undelete the record
    message("Jones record undeleted")
  endif
else
  msgStop("Error", "Can't find Jones.")
endif
endMethod


See Also for TCursor::unDeleteRecord
See Also

deleteRecord

isRecordDeleted

isShowDeletedOn

showDeleted


TCursor::unlock
unlock

See Also	Example	TCursor Type

Beginner

Method

Removes specified locks from a TCursor.

Syntax

unlock ( const lockType String ) Logical

Description

unlock attempts to remove locks explicitly placed on the table pointed to by a TCursor, where lockType is one of the following String values, listed in order of decreasing strength and increasing concurrency.

String value	Description

Exclusive	The current session has exclusive access to the table. No other session can open the table. Cannot be used with dBASE tables.

Full	The current session can restructure, write to, and read from the table. No other session can write to or restructure the table, they can only read from it. Cannot be used with dBASE tables.

Write	The current session can write to and read from the table. No other session can place a write lock or a read lock on the table.

Read	The current session can read from the table. No other session can place a write lock, full lock, or exclusive lock on the table.

unlock removes locks explicitly placed by a particular user or application using lock; it has no effect on locks placed automatically by Paradox. Each time you lock a table explicitly, be sure to unlock it as soon as you no longer need the explicit lock. This ensures maximum concurrent availability of tables. Also, when you lock a table twice, you must unlock it twice. You can use lockStatus (defined for the TCursor and UIObject types) to determine how many explicit locks you have placed on a table. unlock returns False if you try to unlock a table that isn't locked or cannot be unlocked.

If successful, this method returns True; otherwise, it returns False.


Example for TCursor::unlock
unlock Example

The following example opens a TCursor for Customer (a Paradox table), places a full lock on the table, then uses reIndex to rebuild the Phone_Zip index. Once the index is rebuilt, this code unlocks Customer so other users on a network can gain access to the table.

; reindexCust::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
  pdoxTbl String
endVar
pdoxTbl = "Customer.db"

if tc.open(pdoxTbl) then
  if tc.lock("Full") then    ; attempt to gain exclusive access
    tc.reIndex("Phone_Zip")  ; rebuild Phone_Zip index
    tc.unLock("Full")        ; unlock the table
  else
    msgStop("Sorry", "Can't lock " + pdoxTbl + " table.")
  endif
else
  msgStop("Sorry", "Can't open " + pdoxTbl + " table.")
endif
endMethod


See Also for TCursor::unlock
See Also

lock

lockStatus

UIObject::lockStatus


TCursor::unLockRecord
unLockRecord

See Also	Example	TCursor Type

Beginner

Method

Unlocks the current record.

Syntax

unLockRecord ( ) Logical

Description

unLockRecord unlocks the current record if it is locked. If you try to unlock a record that isn't locked, you'll get an error. This operation fails if the current record cannot be committed (for example, because of a key violation).

If the table is indexed, the record is posted to the table and moved to its sorted position. Depending on whether the record moved to a new position, the TCursor may not continue to point to the posted record. This behavior is referred to as record flyaway.

If a key value changes when the record is unlocked, the record may fly away to a new position in the table; however, the TCursor will not fly with it. You can also use didFlyAway to test whether the record, did, in fact, fly away.


Example for TCursor::unLockRecord
unLockRecord Example

In the following example, the pushButton method for thisButton attempts to locate a misspelled value in the Name field of the Customer table. If the value is found, this code locks the record, corrects the value in the field, then unlocks the record with unLockRecord.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tc TCursor
endVar
if tc.open("Customer.db") then
  if tc.locate("Name", "Usco") then
    tc.edit()
    tc.lockRecord()           ; lock current record
    tc.Name = "Unisco"        ; change field value
    tc.unlockRecord()         ; unlock current record
    message("Name changed to \"Unisco\"")
  else
    msgStop("Sorry", "Can't find \"Usco\" in \"Name\" field.")
  endif
else
  msgStop("Sorry", "Can't open Customer.db table.")
endif

endMethod


See Also for TCursor::unLockRecord
See Also

didFlyAway

lockRecord

postRecord

setFlyAwayControl


TCursor::update
update	4.5

See Also	Example	TCursor Type

Method

Assigns values to fields in the current record of a TCursor.

Syntax

1. update ( const fieldName String, const fieldValue AnyType

    [, const fieldName String, const fieldValue AnyType ] * ) Logical

2. update ( const fieldNum SmallInt, const fieldValue AnyType

    [, const fieldNum SmallInt, const fieldValue AnyType ] * ) Logical

Description

update assigns values to one or more fields in the current record of a TCursor. update improves performance by enabling you to update an entire record with a single statement instead of assigning field values one at a time. Use fieldName (syntax 1) or fieldNum (syntax 2) to specify fields, and use fieldValue to specify the new field value.

You can combine field names and field numbers in the same update statement. Performance improves when you use field numbers instead of field names.


Example for TCursor::update
Example

The following example shows how to use update to set the values of three fields with one statement. First, the following code shows how to assign values to the PartNum, PartName, and Cost fields of the Parts table without using update:

  var
     partsTC	TCursor
     partNumID	SmallInt
  endVar

  partsTC.open("parts")
  partNumID = partsTC.fieldNo("PartNum")

  if partsTC.locate("PartName", "Widget") then
     partsTC.edit()

     partsTC.(partNumID) = "G01"
     partsTC.PartName    = "Gadget"
     partsTC.Cost        = 2.50

     partsTC.endEdit()
  endIf

The following code calls update to accomplish the same thing:

  var
     partsTC	TCursor
     partNumID	SmallInt
  endVar

  partsTC.open("parts")
  partNumID = partsTC.fieldNo("PartNum")

  if partsTC.locate("PartName", "Widget") then
     partsTC.edit()

     partsTC.update(partNumID, "G01", "PartName", "Gadget", "Cost", 2.50)

     partsTC.endEdit()
  endIf


See Also for TCursor::update
See Also

setFieldValue


TCursor::updateRecord
updateRecord

See Also	Example	TCursor Type

Beginner

Method

Updates the existing record with data from the new record when a key violation exists.

Syntax

updateRecord ( [ const moveTo Logical ] ) Logical

Description

updateRecord overwrites the existing record with values from the unposted new record when a key violation exists. The record is posted to the table and does not remain locked. If optional argument moveTo is True, the TCursor will point to the record after it is posted to the table; if False, the TCursor points to the record following the position of the original record.

If no key violation exists, this method behaves like unlockRecord.


Example for TCursor::updateRecord
updateRecord Example

See the example for attachToKeyViol.


See Also for TCursor::updateRecord
See Also

attachToKeyViol

lockRecord

postRecord

unlockRecord


TextStream Type

A TextStream is a sequence of characters read from (or written to) a text file. TextStreams contain only ANSI characters; formatting information such as font, alignment, and margins is not included. However, nonprinting characters, such as carriage returns and line feeds (CR/LF) are included.

Paradox maintains a file position pointer that behaves like an insertion point cursor in a word processor. The pointer tells you how far (how many characters) you are from the beginning of the file. Counting begins with 1 (not with 0, as in some other languages).

Methods for the TextStream Type

TextStream

advMatch

close

commit

create

end

eof

home

open

position

readChars

readLine

setPosition

size

writeLine

writeString


TextStream::advMatch
advMatch

See Also	Example	TextStream Type

Method

Searches for a pattern of characters in a text file.

Syntax

advMatch ( var startIndex LongInt, var endIndex LongInt, const pattern String ) Logical

Description

advMatch searches a text file for a pattern of characters represented by the variable pattern. If startIndex is assigned a value, the search starts at the startIndex position; otherwise, the search starts at the beginning of the file. The position in endIndex does not indicate the end of the range to search. If the pattern is found, the position of the first matching character is stored in startIndex, and the position of the last matching character is stored in endIndex.

advMatch returns True if pattern is found in the file; otherwise, it returns False. This method is case sensitive by default, but you can use the String procedure ignoreCaseInStringCompares to change the case behavior.

If you supply pattern from within a method, you need to use two backslashes when you want to tell advMatch to treat a special character as a literal; for example, \\( tells advMatch to treat the parenthesis as a literal character. Two backslashes are required in this situation because of the ambiguity between the compiler's interpretation of a backslash (used in escape sequences such as \t for a tab) and advMatch's understanding of a backslash. When the compiler sees a string with an embedded escape sequence, such as a "\tstart", it interprets the "\t" as a tab, followed by the word "start." The backslash character has a special meaning to the compiler, but it also has a special meaning to advMatch. (See the entry for advMatch in the String type.)

If you supply pattern from a field in a table or a TextStream, special advMatch symbols are recognized without a preceding backslash, and one backslash and plus symbol (\+) yields a literal character.

To specify pattern, use a string with the optional symbols listed in the table below.

Symbol	Matches

\	Use backslash to include special characters (for example, \t for Tab) as regular characters. (Remember to use two backslashes in quoted strings.)

[ ]	Match the enclosed set. For instance, [aeiou0-9] match a, e, i, o, u, and 0 through 9.

[^ ]	Do not match the enclosed set. For instance, [^aeiou0-9] matches anything except a, e, i, o, u, and 0 through 9.

()	Grouping.

^	Beginning of string (do not confuse this with [^], where the ^ acts as a logical NOT).

$	End of string.

..	Match anything.

@	Match any single character.

*	Zero or more of the preceding character or expression.

+	One or more of the preceding character or expression.

?	None or one of the preceding character or expression.

 | 	OR operation.


Example for TextStream::advMatch
advMatch Example

The following example assumes that a file named PDXQUOTE.TXT exists in the current working directory. The file contains the following text:

How wonderful that we have met with paradox.
Now we have some hope of making progress.
Niels Bohr

The call to advMatch specifies "@o@e" as the pattern to search. This pattern matches any character followed by an o followed by any character followed by an e. When this pattern is found, the variables firstChar and lastChar store the positions of the first and last matching characters. The calls to setPosition and readChars read the matching characters and store them in the variable theMatch.

; findSome::pushButton
method pushButton(var eventInfo Event)
var
  pdq                 TextStream
  firstChar, lastChar LongInt
  theMatch            String
endvar
if pdq.open("pdxquote.txt", "R") then
  if pdq.advMatch(firstChar, lastChar, "@o@e") then
    msgInfo("The position found", firstChar)
    pdq.setPosition(firstChar)
    pdq.readChars(theMatch, lastChar - firstChar)
    message(theMatch)               ; displays "some"
  else
    msgInfo("Sorry", "Match not found.")
  endIf
  pdq.close()
else
  msgInfo("Sorry", "Couldn't open the requested text file.")
endif
endMethod


See Also for TextStream::advMatch
See Also

home

end

setPosition

position

String::advMatch

String::ignoreCaseInStringCompares

Paradox Help: Sample Search Strings with Wildcards


TextStream::close
close

See Also	Example	TextStream Type

Method

Closes a text file.

Syntax

close ( ) Logical

Description

close closes a text file and writes the contents of all text buffers to disk. It also ends the association between a TextStream variable and the underlying text file.


Example for TextStream::close
close Example

The following example declares one TextStream variable, ts, and calls open to associate ts with the text file PDXQUOTE.TXT, then calls close to end the association.

; quoteALine::pushButton
method pushButton(var eventInfo Event)
var
  ts        TextStream
  firstLine String
endvar
ts.open("pdxQuote.txt", "R")
ts.readLine(firstLine)
firstLine.view("Line 1 of PDXQUOTE.TXT")
ts.close()
endMethod


See Also for TextStream::close
See Also

open

commit


TextStream::commit
commit

See Also	Example	TextStream Type

Method

Writes the contents of the text buffer to disk.

Syntax

commit ( )

Description

commit empties the text buffer and writes the contents to disk. The file stays open and the position of the file pointer does not change.


Example for TextStream::commit
commit Example

In the following example, the createText button creates a new file called MYTEXT.TXT, writes a line to it, commits the current version of the TextStream, then closes the file.

; createText::pushButton
method pushButton(var eventInfo Event)
var
  ts TextStream
endVar

ts.create("myText.txt")
msgInfo("TextStream position is now", ts.position()) ; displays 1

ts.writeLine("This is some text.")
msgInfo("TextStream position is now", ts.position()) ; displays 21

ts.commit()
msgInfo("TextStream position is now", ts.position()) ; still 21

ts.close()

endMethod


See Also for TextStream::commit
See Also

writeString


TextStream::create
create

See Also	Example	TextStream Type

Method

Creates a text file for reading and writing.

Syntax

create ( const fileName String ) Logical

Description

create creates the text file fileName and opens it for reading and writing. If fileName exists, create overwrites it without prompting for confirmation. You can specify a directory in which to create the file using a full DOS path or an alias. If you don't specify a path or an alias, Paradox creates the file in the working directory (:WORK:).

This method returns True if successful; otherwise, it returns False. If the file is successfully created, it is opened for reading and writing.

Note:	The following statements are equivalent:

ts.create("newText.txt")
ts.open("newText.txt, "NW")


Example for TextStream::create
create Example

The following code is attached to a button's pushButton method. It consists of a variable declaration block, a procedure declaration, and the body of the method. In the body of the method, the call to the FileSystem method findFirst checks for the existence of a file named RICK.TXT. If it doesn't exist, the custom procedure addLine creates it and adds a line to it. If the file does exist, a dialog box confirms the decision to overwrite the file.

; createFile::pushButton
var
  ts               TextStream
  firstLine        String
  allLines Array[] String
  fs               FileSystem
endvar

proc addLine()
; Create a file, open for writing and reading

  ts.create(":PRIV:rick.txt")
  ts.writeLine("Here's looking at you, kid.")
  ts.home()
  ts.readLine(allLines)
  allLines.view("Rick says:")
endProc

method pushButton(var eventInfo Event)
if not fs.findFirst(":PRIV:rick.txt") then
  addLine()
else
  if msgYesNoCancel(":PRIV:RICK.TXT",

                    "Overwrite this file?") = "Yes" then
    addLine()
  endif
endif
endMethod


See Also for TextStream::create
See Also

open

close


TextStream::end
end

See Also	Example	TextStream Type

Method

Sets the pointer to the end of a text file.

Syntax

end ( )

Description

end sets the pointer to the last character of a text file.


Example for TextStream::end
end Example

The following example assumes that a file named PDXQUOTE.TXT exists in the user's private directory. The file contains the following text:

How wonderful that we have met with paradox.
Now we have some hope of making progress.
Niels Bohr

The code in this example is attached to the built-in newValue method of a field object displayed as two radio buttons. The values of the radio buttons are "Overwrite" and "Append." Choose one to specify whether to insert text at the beginning of the file (which overwrites existing text) or append it to the end of the file. If you choose "Overwrite," the call to home moves the pointer to position 1. If you choose "Append," the call to end moves the pointer to position 103 (the end of this particular file).

; insertAppendField::changeValue
method newValue(var eventInfo Event)
var
  ts TextStream
  allLines Array[] String
endVar
if eventInfo.reason() = EditValue then
  ts.open(":PRIV:pdxquote.txt", "W")
  switch
    case self.value = "Overwrite" :
      ts.home()
      ts.writeLine(DateTime())   ; time stamp the file at beginning
      ; file will read:
      ; DateTimeStamp (depends on date/time)
      ; have met with Paradox.
      ; Now we have some hope of making progress.
      ; Niels Bohr
    case self.value = "Append" :
      ts.end()
      ts.writeLine(DateTime())   ; time stamp the file at end
      ; file will read:
      ; How wonderful that we have met with Paradox.
      ; Now we have some hope of making progress.
      ; Niels Bohr
      ; DateTimeStamp (depends on date/time)
  endSwitch
  ts.home()
  ts.readLine(allLines)
  allLines.view()
  ts.close()
endif
endMethod


See Also for TextStream::end
See Also

home

setPosition

eof


TextStream::eof
eof

See Also	Example	TextStream Type

Method

Tests for a move past the end of a text file.

Syntax

eof ( ) Logical

Description

eof returns True if an operation tries to move the file pointer past the end of a text file; otherwise, it returns False.


Example for TextStream::eof
eof Example

The following example assumes that a file named PDXQUOTE.TXT exists in the user's private directory. The file contains the following text:

How wonderful that we have met with paradox.
Now we have some hope of making progress.
Niels Bohr

The while loop reads each of the three lines from the file and displays it in a dialog box. Then eof returns True, and a dialog box tells the user that there's no more text in the file.

; lineAtATime::pushButton
method pushButton(var eventInfo Event)
var
  pdq      TextStream
  textLine String
endVar

pdq.open(":PRIV:pdxquote.txt", "r")
while not pdq.eof()        ; quit loop when you hit the end of the file
  pdq.readLine(textLine)   ; read the next line
  msgInfo("Position " + String(pdq.position()), textLine)
endWhile
msgInfo("Finished", "No more text")
endMethod


See Also for TextStream::eof
See Also

end

position

setPosition


TextStream::home
home

See Also	Example	TextStream Type

Method

Sets the pointer to the beginning of a text file.

Syntax

home ( )

Description

home sets the file pointer to the first character of a text file.


Example for TextStream::home
home Example

See the example for end.


See Also for TextStream::home
See Also

end

eof

setPosition


TextStream::open
open

See Also	Example1	Example2	TextStream Type

Method

Opens a text file in a specified mode.

Syntax

open ( const fileName String, const mode String ) Logical

Description

open opens fileName in the mode specified in mode, and associates a FileSystem variable with the underlying file. The modes are listed in the following table (the case of a mode specification doesn't matter).

Mode specification	Description

"a"	Append and read.

"r"	Read only.

"w"	Write and read.

"nw"	New file, write and read.

If the file exists, the "nw" mode overwrites the file without asking for confirmation.

Note:	The following statements are equivalent:

ts.open("new.txt", "NW")
ts.create("new.txt")

Opening a file in any mode except "a" (append) sets the pointer to the beginning of the file.

You can specify a directory from which to open the file using a full DOS path or an alias. If you don't specify a path or an alias, Paradox looks for the file in the working directory.

This method returns True if successful; otherwise, it returns False.


Example 1 for TextStream::open
open Example 1

The following example uses an alias with open to create a text file in the private directory and write a line of text to it:

var
   ts TextStream
endVar
if ts.open(":PRIV:memo14.txt", "NW") then
   ts.writeLine("This is private!")
endIf


Example 2 for TextStream::open
open Example 2

You can associate more than one TextStream variable with the same file. Both variables have equal rights to the file, and Paradox maintains separate pointers for each variable. The following example declares two TextStream variables, ts1 and ts2, and calls open to associate each of them with the text file NEWTEXT.TXT. As statements are written to the file, messages display the pointer position for each variable.

; openStreams::pushButton
method pushButton(var eventInfo Event)
var
  ts1, ts2  TextStream
  firstLine String
  allLines  Array[] String
endvar
ts1.open("newText.txt", "nw")      ; open a new file read/write
ts1.writeLine("Written by ts1.")
ts1.writeLine("This is line 2.")
msgInfo("Text stream one", ts1.position()) ; displays 35
ts1.commit()                       ; write it out to disk, so that
                                   ; ts2 will get most current version

ts2.open("newText.txt", "w")       ; open existing file read/write
msgInfo("Text stream one", ts1.position()) ; displays 35
msgInfo("Text stream two", ts2.position()) ; displays 1

ts2.writeLine("Written by ts2.")
msgInfo("Text stream one", ts1.position()) ; displays 35
msgInfo("Text stream two", ts2.position()) ; displays 18

ts1.home()
ts1.readLine(allLines)     ; reads all lines into an array
allLines.view("ts1")       ; displays:
                           ; Written by ts1.
                           ; This is line 2.
; ts1 does not reflect changes made by ts2

; unless ts1 is closed and reopened.
endMethod


See Also for TextStream::open
See Also

create

close


TextStream::position
position

See Also	Example	TextStream Type

Method

Returns the pointer's position in a text file.

Syntax

position ( ) LongInt

Description

position returns an integer representing the pointer's position in a text file. position counts both printing and nonprinting characters. Counting begins with 1 (not with 0).


Example for TextStream::position
position Example

It may be helpful to think of position as returning the number of the next character in the file. As the following example shows, when you create a new text file and call position, it returns 1. The call to writeLine adds 14 characters to the file: 12 printing characters and the carriage return and line feed (CR/LF) pair. The next character will be 15, so position returns 15.

var newFile TextStream endVar
newFile.open("newmemo.txt", "nw")
message(newFile.position()) ; displays 1
sleep(1000)
newFile.writeLine("Don't panic.")
message(newFile.position()) ; displays 15
                            ; 12 printing characters + CR/LF = 14
                            ; next character will be 15
sleep(1000)


See Also for TextStream::position
See Also

setPosition

size


TextStream::readChars
readChars

See Also	Example	TextStream Type

Method

Reads a specified number of characters from a text file.

Syntax

readChars ( var string String, const nChars SmallInt ) Logical

Description

readChars reads the number of characters specified in nChars and stores them in string. readChars starts reading from the current pointer position. This method returns True if successful; otherwise, it returns False.


Example for TextStream::readChars
readChars Example

The following example assumes that a file named PDXQUOTE.TXT exists in the current working directory. The file contains the following text:

How wonderful that we have met with paradox.
Now we have some hope of making progress.
Niels Bohr

The call to readChars reads the first 100 characters from the file:

; getLetters::pushButton
method pushButton(var eventInfo Event)
var
  letter  TextStream
  myChars String
endVar
letter.open("pdxquote.txt", "r")
if letter.readChars(myChars, 100) then

  msgInfo("The first 100 characters are:", myChars)
endIf
endMethod


See Also for TextStream::readChars
See Also

readLine

setPosition

The example for advMatch.


TextStream::readLine
readLine

See Also	Example1	Example2	TextStream Type

Method

Reads a line from a text file.

Syntax

1. readLine ( var value String ) Logical

2. readLine ( var stringArray Array[ ] String ) Logical

Description

readLine reads characters from a line of text from a file until a CR/LF pair is encountered (or 1,023 characters have been read), and moves the file pointer to the first position after the CR/LF pair (or after the 1,023rd character). readLine begins reading from the current pointer position. This method returns True if successful; otherwise, it returns False.

Syntax 1 stores a single line in value. The CR/LF pair is not stored.

Syntax 2 stores the entire file in stringArray, where stringArray is a resizable array of strings and each array item stores one line from the file. The CR/LF pair is not stored.


Example 1 for TextStream::readLine
readLine Example 1

The following example creates a 2-line text file, then calls readLine to read the first line into a String variable. readLine reads the four characters before the CR/LF in the first line, then skips over the CR/LF characters, and sets the pointer.

method pushButton(var eventInfo Event)
var
   ts TextStream
   oneLine String
endvar

ts.create("newtext.txt")
ts.writeLine("1234")
ts.writeLine("5678")
ts.home()

ts.readLine(oneLine)
message(oneLine.size()) ; displays 4 (doesn't include CR/LF)
sleep(1000)
message(ts.position()) ; displays 7 (skips over CR/LF)
sleep(1000)
endMethod


Example 2 for TextStream::readLine
readLine Example 2

The following example creates a 3-line text file, then calls readLine to read the entire file into an array, then displays the array in a dialog box.

method pushButton(var eventInfo Event)

var
   letter TextStream
   allLines Array[] String
endVar

letter.open("letter.txt", "nw")
letter.writeLine("Dear Customer,")
letter.writeLine("Thank you for your interest in our new product.")
letter.writeLine("A representative will call you next week.")

letter.home() ; move the pointer to the beginning of the file

letter.readLine(allLines)
allLines.view("Entire letter")     ; displays the entire letter
letter.close()

endMethod


See Also for TextStream::readLine
See Also

readChars

writeLine


TextStream::setPosition
 setPosition

See Also	Example1	Example2	TextStream Type

Method

Positions the pointer in a text file.

Syntax

setPosition ( const offset LongInt )

Description

setPosition positions the file pointer offset characters from the beginning of a text file. (CR/LF) characters are considered part of the file, and can be overwritten. Specifying a position before the beginning or after the end of file moves the pointer to the corresponding position.


Example 1 for TextStream::setPosition
setPosition Example 1

In the following example, the showPositions button first writes a line to a new text file, MEMO.TXT. The method then moves back to the fourth character, overwrites that character with "4", then rereads and displays the line.

; showPositions::pushButton
method pushButton(var eventInfo Event)
var
  myFile  TextStream
  lineOne String
endVar
myFile.open(":PRIV:memo.txt", "nw")        ; open new file as read/write
myFile.writeLine("1235")                   ; 4 characters plus CR/LF
msgInfo("Where am I?", myFile.position())  ; displays 7

myFile.setPosition(4)                ; move to character 4
myFile.writeString("4")              ; now, line is "1234"
myFile.home()                        ; same as setPosition(1)
myFile.readLine(lineOne)
msgInfo("This is line one", lineOne) ; displays  "1234"
endMethod


Example 2 for TextStream::setPosition
setPosition Example 2

The following example shows what happens when you attempt to move the pointer beyond the end of a file or before the beginning of a file.

; showPositions::pushButton
method pushButton(var eventInfo Event)
var
  myFile  TextStream
endVar

myFile.open(":PRIV:memo.txt", "r")  ; open existing file for read
myFile.setPosition(100)             ; beyond end of file
msgInfo("End", myFile.position())   ; displays 7 -- the real end
myFile.setPosition(-100)            ; before beginning of file
msgInfo("Home", myFile.position())  ; displays 1 -- the beginning
endMethod


See Also for TextStream::setPosition
See Also

position

size

eof


TextStream::size
size

See Also	Example	TextStream Type

Method

Returns the number of characters in a text file.

Syntax

size ( ) LongInt

Description

size returns the number of characters in a text file, including nonprinting characters such as carriage returns and line feeds (CR/LF).


Example for TextStream::size
size Example

The following example creates a TextStream, writes a line to it, then shows the size of the file.

; showSize::pushButton
method pushButton(var eventInfo Event)
var
  myText TextStream
endVar
myText.create("short.txt")
myText.writeLine("1234")
msgInfo("What size am I?", myText.size()) ; displays 6
; 4 printing characters "1234", and 2 nonprinting characters CR/LF
myText.close()
endMethod


See Also for TextStream::size
See Also

position

setPosition

eof


TextStream::writeLine
writeLine

See Also	Example	TextStream Type

Method

Writes a string to a text file.

Syntax

writeLine ( const value AnyType [, const value AnyType ] * ) Logical

Description

writeLine writes a comma-separated list of values to a text file, and appends a CR/LF character pair. Compare this method to writeString, which doesn't append a CR/LF pair.


Example for TextStream::writeLine
writeLine Example

See the example for create.


See Also for TextStream::writeLine
See Also

readLine

writeString


TextStream::writeString
writeString

See Also	Example	TextStream Type

Method

Writes a character string to a text file.

Syntax

writeString ( const value AnyType, [, const value AnyType ] * ) Logical

Description

writeString writes a comma-separated list of values to a text file, but does not append a CR/LF pair. Compare this method to writeLine, which does append a CR/LF pair.


Example for TextStream::writeString
writeString Example

The following example assigns strings to the variables lo and hi, then uses writeString to write them to an open TextStream.

; goodAdvice::pushButton
method pushButton(var eventInfo Event)
var
   myText TextStream
   lo, hi String
endVar
lo = "Buy low. "
hi = "Sell high."
myText.open(":PRIV:advice.txt", "nw")         ; open a new file
myText.writeString(lo, hi)
msgInfo("File size:", string(myText.size()))  ; displays 19
; Buy low.  = 9 characters, Sell High. = 10 characters. 10 + 9 = 19.
myText.close()
endMethod


See Also for TextStream::writeString
See Also

writeLine


Time Type

Time variables store times in the form hour-minute-second-millisecond. You can use the following characters as separators: blank, tab, space, comma (,), hyphen (-), slash (/), period (.), colon (:), and semicolon (;).

Time values must be cast (explicitly declared). For example, the following statements assign to the Time variable ti a time of 10 minutes and 40 seconds past eleven o'clock in the morning:

var ti Time endVar
ti = Time("11:10:40 am")

The quotes around the value are required. Whether a time is valid depends on the current Paradox time format. For example, if the current time format is set to 12-hour format (such as hh:mm:ss), methods in the Time type consider hh:mm:ss a valid time format. Use formatSetTimeDefault procedure defined for the System type to set Paradox time formats with ObjectPAL.

The Time type includes several derived methods from the DateTime and AnyType types.

Methods for the Time Type

AnyType		DateTime		Time
blank		hour		time
dataType		milliSec
isAssigned		minute
isBlank		second
isFixedType
view


Time::time
time

See Also	Example1	Example2	Time Type

Beginner

Procedure

Casts a value as a time, or returns the current time.

Syntax

time ( [ const value AnyType ] ) Time

Description

time casts (converts) value as a time, or returns the current time according to the system clock. value, if given, must match the current Paradox time format. For more information, refer to the System type procedure formatSetTimeDefault.


Example 1 for Time::time
time Example 1

The following example calls time to convert a string value to a time value:

var
   st String
   ti Time
endVar

st = "12:21:33 am"
ti = time(st)


Example 2 for Time::time
time Example 2

The following example displays the current time in a dialog box. The display format varies according to the user's current time format. This code is attached to a button's pushButton method.

; timeButton::pushButton
method pushButton(var eventInfo Event)

  ; displays the current time in a dialog box
   msgInfo("Current Time", time())

endMethod


See Also for Time::time
See Also

DateTime::hour

DateTime::milliSec

DateTime::minute

DateTime::second


UIObject Type

Changes

UIObjects (the UI stands for user interface) create the user interface for an application: anything you can place in a form or report is a UIObject. Only UIObjects in forms have built-in methods. The different UIObjects are band, bitmap, box, button, cell, crosstab, ellipse, field object, form, graph, group, line, list, multi-record object, OLE object, page, record object, table frame, and text box.

Note:	The form behaves like a UIObject: a form has built-in methods, you can attach code to those built-in methods, and a form responds to events. There is also a separate type, Form, for methods and procedures that work only with forms.

You can also use built-in object variables to refer to UIObjects. This technique can be useful for creating generalized code.

Many UIObject methods duplicate TCursor methods. The UIObject methods that work with tables work on the underlying table through the visible object. Actions directed to the UIObject that affect the table are immediately visible in the object the table is bound to. TCursor methods, by contrast, work with a table behind the scenes; actions that affect the table are not necessarily visible in any object, even if the TCursor is acting on the same table to which a visible object is bound.

Note:	Some table operations require Paradox to create temporary tables. Paradox creates these tables in the private directory.

Some table operations are considerably faster with TCursors than with UIObjects. For instance, if you need to perform a table-oriented operation that will cause a high volume of screen refreshes---which are time-consuming---you can use this technique: declare a TCursor, attach it to the object the table is already bound to (such as a table frame), do the operation with the TCursor, then resynchronize the display object to the TCursor. When you attach a TCursor to an object bound to a table, the TCursor's record pointer is set to the current record for the object. After you perform a TCursor operation, such as a locate, the TCursor might point to a different record than the object. To make the object point to the same record as the TCursor, use the resync method; to make the TCursor point to the same record as the object, use the attach method. See the example for insertRecord.

Methods for the UIObject Type

UIObject

action

atFirst

atLast

attach

bringToFront

broadcastAction

cancelEdit

convertPointWithRespectTo

copyFromArray

copyToArray

copyToToolbar

create

currRecord

delete

deleteRecord

dropGenFilter

edit

empty

end

endEdit

enumFieldNames

enumLocks

enumObjectNames

enumSource

enumSourceToFile

enumUIClasses

enumUIObjectNames

enumUIObjectProperties

execMethod

getBoundingBox

getGenFilter

getPosition

getProperty

getPropertyAsString

getRange

getRGB

hasMouse

home

insertAfterRecord

insertBeforeRecord

insertRecord

isContainerValid

isEdit

isEmpty

isLastMouseClickedValid

isLastMouseRightClickedValid

isRecordDeleted

keyChar

keyPhysical

killTimer

locate

locateNext

locateNextPattern

locatePattern

locatePrior

locatePriorPattern

lockRecord

lockStatus

menuAction

mouseClick

mouseDouble

mouseDown

mouseEnter

mouseExit

mouseMove

mouseRightDouble

mouseRightDown

mouseRightUp

mouseUp

moveTo

moveToRecNo

moveToRecord

nextRecord

nFields

nKeyFields

nRecords

pixelsToTwips

postAction

postRecord

priorRecord

pushButton

recordStatus

resync

rgb

sendToBack

setGenFilter

setPosition

setProperty

setRange

setTimer

skip

switchIndex

twipsToPixels

unDeleteRecord

unlockRecord

view

wasLastClicked

wasLastRightClicked


Changes to UIObject type methods

The following table lists new methods and methods that were changed for version 5.0.

New	Changed

bringToFront	enumUIObjectProperties

copyToToolbar	setFilter was replaced by setRange which offers enhanced functionality and performance. Code that calls setFilter will continue to execute as before.

dropGenFilter

getGenFilter

getRange

sendToBack

setGenFilter

setRange


UIObject::action
action

See Also	Example	UIObject Type

Beginner

Method

Performs a specified action.

Syntax

action ( const actionId SmallInt ) Logical

Description

action specifies an actionId to perform in response to an event, where actionId is a constant in one of the following action classes:

ActionDataCommands

ActionEditCommands

ActionFieldCommands

ActionMoveCommands

ActionSelectCommands

You can also use action to send a user-defined action constant to a built-in action method. User-defined action constants are simply integers that don't interfere with any of ObjectPAL's constants. You can use them to signal other parts of an application.

This action method is distinct from the built-in action method for a form or for any other UIObject. The built-in action method for an object responds to an action event; this method causes an ActionEvent.


Example for UIObject::action
action Example

The code in the following example is attached to a button's mouseUp method and does the following: if you press and hold Shift and click the button, the pointer moves to the next set of records. If you click the button without pressing Shift, the pointer moves to the next record.

The action constants DataFastForward and DataNextRecord behave like the Fast Forward and Next Record Toolbar buttons. Assume that CUSTOMER refers to a table frame on the form and that nextRecordOrFast is a button on the same form. The nextRecordOrFast button is not in the same containership hierarchy as CUSTOMER, so the action won't bubble up to CUSTOMER automatically. Thus, the action must be sent to the CUSTOMER object explicitly.

; nextRecordOrFast::mouseUp
method mouseUp(var eventInfo MouseEvent)
; if the tableFrame isn't active, then move to it
if NOT CUSTOMER.focus then
  CUSTOMER.Name.moveTo()
endif
; if Shift key is down, go to next set of records,
;  otherwise go to next record
if eventInfo.isShiftKeyDown() then
   CUSTOMER.action(DataFastForward)
else
   CUSTOMER.action(DataNextRecord)
endif
endMethod


See Also for UIObject::action
See Also

menuAction

ActionEvent::id

ActionEvent::setId


UIObject::atFirst
atFirst

See Also	Example	UIObject Type

Method

Reports if the pointer is at the first record of a table.

Syntax

atFirst ( ) Logical

Description

atFirst returns True if the pointer is at the first record of a table; otherwise, it returns False. atFirst respects the limits of restricted views displayed in a linked table frame or multi-record object.


Example for UIObject::atFirst
atFirst Example

In the following example, assume that CUSTOMER refers to a table frame on the form and goToFirstButton is a button on the same form. The method checks the pointer position. If the pointer is not on the first record of CUSTOMER, the method moves it to that record.

; goToFirstButton::pushButton
method pushButton(var eventInfo Event)
if NOT CUSTOMER.atFirst() then
  CUSTOMER.home()
  ; this has the same effect as:  CUSTOMER.action(DataBegin)
endif
endMethod


See Also for UIObject::atFirst
See Also

atLast


UIObject::atLast
atLast

See Also	Example	UIObject Type

Method

Reports if the pointer is at the last record in a table.

Syntax

atLast ( ) Logical

Description

atLast returns True if the pointer is at the last record of a table; otherwise, it returns False. atLast respects the limits of restricted views displayed in a linked table frame or multi-record object.


Example for UIObject::atLast
atLast Example

In the following example, assume that CUSTOMER refers to a table frame on the form and goToLastButton is a button on the same form. The method checks the pointer position. If the pointer is not on the last record of CUSTOMER, the method moves it to that record.

; goToLastButton::pushButton
method pushButton(var eventInfo Event)
if NOT CUSTOMER.atLast() then
  CUSTOMER.end()
  ;this has the same effect as:  CUSTOMER.action(DataEnd)
endif
endMethod


See Also for UIObject::atLast
See Also

atFirst


UIObject::attach
attach

See Also	Example1	Example2	UIObject Type

Method

Binds a UIObject variable to a specified design object.

Syntax

1. attach ( ) Logical

2. attach ( const objectVar UIObject ) Logical

3. attach ( const objectName String ) Logical

4. attach ( const form Form [, objectName String ] ) Logical

5. attach ( const report Report [, objectName String ] ) Logical

Description

attach binds a UIObject variable to a specified design object. You can also use attach to assign a UIObject to an item in an Array.

Syntax 1 binds the variable to the object that called attach. In other words, it binds the variable to self.

Syntax 2 binds the variable to another UIObject specified by a UIObject variable objectVar in one of the following ways:

Specification	Example

UIObject variable	var
u1, u2 UIObject
endVar
u1.attach()   ; Attach to self.
u2.attach(u1) ; Attach to a UIObject variable.

UIObject name	var
u1 UIObject
endVar
; Attach to an object named nameFld.
u1.attach(nameFld)

Containership path	var
u1       UIObject
aForm Form
endVar
aForm.open("aform.fsl")
; Attach to an object named aField.
u1.attach(aForm.aPage.aField)

Syntax 3 binds the variable to another UIObject specified by name in objectName. For example, if a form contains a box named theFrame, the following statement binds the UIObject variable ui to the box:

ui.attach("theFrame")

Syntax 4 binds the variable to the form specified by the Form variable form, or to a UIObject in that form specified by objectName.

Syntax 5 binds the variable to the report specified by the Report variable report, or to a UIObject specified by objectName.

Note:	Some of the methods in the UIObject class can be used for forms, but only if you attach a UIObject variable to the form. Syntax 4 of the attach method lets you attach a UIObject variable to a form so that you can access those methods. For instance, to send a mouseUp event to another form's form-level mouseUp built-in method, you need to attach a UIObject variable (a Form variable won't work) to an open form.


Example 1 for UIObject::attach
attach Example 1

The following example shows various forms of the syntax. First, the method attaches the variable objBox to the current object (self), then changes its color. Next, the method attaches objBox to another object, then changes that object's color via objBox. A second example for of the same syntax opens another form, attaches objBox to a box on the second form, and changes the color of the other form's object via objBox.

Notice that you can attach to an object name on another form by including the form handle (previously obtained) in the object name. You can supply the handle to the form in the first argument; the second argument supplies the object name on the specified form as a string.

In this example, assume the current form contains two boxes, thisBox and thatBox. The method is attached to thisBox. The secondary form contains one box, called otherBox.

; thisBox::mouseUp
method mouseUp(var eventInfo MouseEvent)
var
  objBox,
  objForm    UIObject
  otherForm  Form
endVar

objBox.attach()           ; binds objBox to thisBox
objBox.color = DarkMagenta

objBox.attach(thatBox)    ; binds objBox to thatBox
objBox.color = Magenta

; assume the form uiattch2.fsl exists and it has
; one object called otherBox
if otherForm.open("uiattch2.fsl") then
  objBox.attach(otherForm.otherBox)
  objBox.color = DarkBlue
  sleep(2000)
  otherForm.close()
endif

if otherForm.open("uiattch2.fsl") then
  ; notice that the object name is given as a string
  objBox.attach(otherForm, "otherBox")
  objBox.color = LightBlue
  sleep(2000)
  otherForm.close()
endif

endMethod


Example 2 for UIObject::attach
attach Example 2

The following example shows how to use attach to assign a UIObject to an item in an array.

method pushButton(var eventInfo Event)
const

kOneInch = 1440 ; One inch = 1,440 twips.

kShowHandles = Yes

endConst

var
foForm	Form

uiTempObj	UIObject

arObjects	Array[2] UIObject

endVar

foForm.create()

uiTempObj.create(BoxTool, 700, 700, kOneInch, kOneInch, foForm)

arObjects[1].attach(uiTempObj)

uiTempObj.create(BoxTool, 700, 2500, kOneInch, kOneInch, foForm)

arObjects[2].attach(uiTempObj)

foForm.setSelectedObjects(arObjects, kShowHandles)

endMethod


See Also for UIObject::attach
See Also

moveTo


UIObject::bringToFront
bringToFront	5.0

See Also	Example	UIObject Type

Method

Displays an object in front of other objects.

Syntax

bringToFront ( )

Description

bringToFront moves a UIObject to the front drawing layer of a window, displaying it on top of other objects. (If you're using a form as a UIObject, this method displays the form window in front of other windows.)

This method works in design mode and run mode; you do not have to select the object. Paradox moves the object in front, so it appears to be on top of other objects. This might not be noticeable unless the objects partially overlap each other. You might want to bring an object to the front of the stack of objects if

You have objects that overlap each other

You want to rearrange the tab order

Note:	When you change the front-to-back positions of objects, you change their tab order, because objects always tab from back to front.


Example for UIObject::bringToFront
bringToFront Example

In the following example, the pushButton method for a button displays a sequence of twelve bitmaps to create animation. It uses two for loops along with bringToFront to first cycle through the bitmaps; then to cycle through the bitmaps again in reverse order.

;btn1 :: pushButoon

method pushButton(var eventInfo Event)

var

siCounter SmallInt

endVar

;Cycle through bitmaps.

for siCounter from 1 to 12

; Assume the bitmap objects have names like bmp1, bmp2, etc.

pge1.("bmp" + string(siCounter)).bringToFront()

sleep(100)

endFor

;Cycle through bitmaps in reverse order.

for siCounter from 11 to 1 step -1

pge1.("bmp" + string(siCounter)).bringToFront()

sleep(100)

endFor

endMethod


See Also for UIObject::bringToFront
See Also

sendToBack


UIObject::broadcastAction
broadcastAction

See Also	Example	UIObject Type

Method

Broadcasts an action to an object and the objects it contains.

Syntax

broadcastAction (const actionID SmallInt)

Description

broadcastAction sends the ActionEvent specified in actionID to an object, and then sequentially to each object it contains, with each contained object in turn as the target. The action is sent depth-first through the containership hierarchy, not breadth-first. By default, contained objects bubble the action up through the hierarchy.

For example, suppose a page named thePage contains two boxes, boxOne and boxTwo, and boxOne contains a button btnOne. A call to thePage.broadcastAction(actionID) would send the action represented by actionID to the objects in the following order:

1.	thePage (specified by dot notation)

2.	boxOne (contained by thePage)

3.	btnOne (contained by boxOne, at a lower level in the hierarchy)

4.	boxTwo (also contained by thePage, at the same level as boxOne in the hierarchy)

The value of actionID can be a user-defined action constant or a constant from one of the following Action classes:

ActionDataCommands

ActionEditCommands

ActionFieldCommands

ActionMoveCommands

ActionSelectCommands


Example for UIObject::broadcastAction
broadcastAction Example

In the following example, the form's built-in action method uses broadcastAction to send all the objects in the page pge1 a user-defined action. When the form goes into edit mode, it sends UserAction + 1. When the form ends edit mode, it sends UserAction + 2. Every field's label then uses the user-defined action to turn every label Red or Black.

The following code is attached to the form's built-in action method.

;frm1 :: action

method action(var eventInfo ActionEvent)

if eventInfo.isPreFilter() then

;// This code executes for each object on the form:

else

;// This code executes only for the form:

switch

case eventInfo.id() = DataBeginEdit :

pge1.broadCastAction(UserAction + 1)

case eventInfo.id() = DataEndEdit :

pge1.broadCastAction(UserAction + 2)

endSwitch

endif

endmethod

The following code is attached to each label's built-in action method.

;label :: action

method action(var eventInfo ActionEvent)

;Duplicate this code on every object (or create a prototype object)

;you wish toggle the font color from black to red when

;the form goes in and out of edit mode.

switch

case eventInfo.id() = UserAction + 1 : self.font.color = Red

case eventInfo.id() = UserAction + 2 : self.font.color = Black

endSwitch

endmethod


See Also for UIObject::broadcastAction
See Also

action

menuAction

postAction

ActionEvent Type

User-Defined Action Constants


UIObject::cancelEdit
cancelEdit

See Also	Example	UIObject Type

Beginner

Method

Cancels record changes without ending Edit mode.

Syntax

cancelEdit ( ) Logical

Description

cancelEdit leaves a table in Edit mode but cancels changes to the current record. It returns True if successful; otherwise, it returns False. To abort changes to the current record, you must use cancelEdit before moving the pointer from the current record; once you move the pointer, changes to the record are committed.

cancelEdit has the same effect as the action constant DataCancelEdit, so the following statements are equivalent:

obj.cancelEdit()
obj.action(DataCancelEdit)


Example for UIObject::cancelEdit
cancelEdit Example

The following method attaches a UIObject variable, noChange, to a table frame, CUSTOMER. (From then on noChange is used as a handle to the table frame.) The method searches for a value in the Customer table, and, if found, changes the value. Before leaving the record, the change is cancelled with the cancelEdit method. In this example, assume that you have one page on the form, called pageOne; a table frame attached to the Customer table; and a button named CancelEditButton.

; CancelEditButton::pushButton
method pushButton(var eventInfo Event)
var
  noChange UIObject
endVar

noChange.attach()
noChange.attach(pageOne.CUSTOMER)
noChange.edit()
if noChange.locate("Name", "Unisco") then
  noChange."Name" = "Jones"   ; prepare to change the record
  msgInfo("noChange.'Name'", noChange."Name".value)
  noChange.cancelEdit()        ; belay that order!
                           ; record not changed,
endif
noChange.endEdit()         ; exit Edit mode

endMethod


See Also for UIObject::cancelEdit
See Also

currRecord

edit

endEdit


UIObject::convertPointWithRespectTo
convertPointWithRespectTo

See Also	Example	UIObject Type

Method

Changes the frame of reference for calculating the coordinates of a point.

Syntax

convertPointWithRespectTo ( const otherUIObject UIObject, const oldPoint Point, var convertedPoint Point )

Description

convertPointWithRespectTo changes the frame of reference for calculating the position of a point. Normally, coordinates are calculated relative to the upper left corner of the object's container (or the container's frame, in the case of an ellipse). This method instead calculates a point's position relative to the upper left corner of the object specified in otherUIObject.


Example for UIObject::convertPointWithRespectTo
convertPointWithRespectTo Example

The following example gets and shows the position of an object called innerBox. innerBox is contained by outerBox, and is on a page called pageOne. First, the position of outerBox relative to the upper left corner of the page is obtained and displayed. Next, the position of innerBox is taken, relative to the upper left corner of outerBox. Finally, the position of innerBox is converted with respect to the page, so you can see how far innerBox is from the top and left edges of the page.

; alignInnerBox::pushButton
method pushButton(var eventInfo Event)
var
  innerPos,
  outerPos,
  convertedPos  Point
  x, y, w, h    LongInt
endVar

outerBox.getPosition(x, y, w, h)
outerPos = point(x, y) ; convert x and y from
outerPos.view("Outer box position") ; outerBox to a point
innerBox.getPosition(x, y, w, h)
innerPos = point(x, y)
innerPos.view("Inner box position unconverted")
; how far is innerPos from the upper left corner of the page?
outerBox.convertPointWithRespectTo(pageOne, innerPos, convertedPos)
convertedPos.view("Inner box position converted")
endMethod


See Also for UIObject::convertPointWithRespectTo
See Also

Point


UIObject::copyFromArray
copyFromArray

See Also	Example	UIObject Type

Method

Copies data from an array to a record of a table.

Syntax

copyFromArray ( const ar Array[ ] AnyType) Logical

Description

copyFromArray copies data from an array ar to a UIObject (typically a table frame or multi-record object). The first element of the array is copied to the first field of the table, the second element to the second field, and so on until the array is exhausted or the record is full.

The method fails if an attempt is made to copy an unassigned array element or if the structures do not match. (This can never happen if the array was created by copyToArray, which assigns a blank value if a field is blank.) In addition, the method fails if the form is not in Edit mode. If there are more elements in the array than fields in the record, the extra elements are ignored.


Example for UIObject::copyFromArray
copyFromArray Example

In the following example, suppose a form contains a table frame named CUSTNAME. The CUSTNAME table has three fields: Last name, A20; First name, A20; and Middle Initial, A1. This method starts editing CUSTNAME, creates an array with three elements, creates a new record in CUSTNAME, then copies data from the array to the record.

; createRecord::pushButton
method pushButton(var eventInfo Event)
var
  nameArray Array[3] String
endvar
CUSTNAME.edit()            ; start Edit mode
nameArray[1] = "Hall"      ; fill the array with the record to insert
nameArray[2] = "Robert"
nameArray[3] = "A"
CUSTNAME.action(DataInsertRecord) ; insert a blank record first
CUSTNAME.copyFromArray(nameArray) ; copy the array to the new record
CUSTNAME.endEdit()
endMethod


See Also for UIObject::copyFromArray
See Also

copyToArray


UIObject::copyToArray
copyToArray

See Also	Example	UIObject Type

Method

Copies data from a record to an array.

Syntax

copyToArray ( var ar Array [ ] AnyType ) Logical

Description

copyToArray copies the fields of the current record of a UIObject (typically a table frame or a multi-record object) to the elements of an array specified in ar. You must declare the array to be of type AnyType, or of a type that matches every field in the table. If the array is resizeable, it grows automatically to hold the number of fields in the record. If the array is not resizeable, it holds as many fields as it can, and the rest are discarded.

The value of the first field is copied to the first element of the array, the value of the second field to the second element, and so on. The size of the array is equal to the number of fields in the record. The record number field and any display-only or calculated fields are not copied to the array.


Example for UIObject::copyToArray
copyToArray Example

The following example assumes that there are two table frames on a form, CUSTOMER and CUSTARC, and one button, named archiveButton. The form itself is renamed thisForm. When archiveButton is pushed, the current record in CUSTOMER is moved to CUSTARC.

First, the method looks at the Editing property of the form; if it's False, the method starts Edit mode. The method then copies the current record in CUSTOMER to the arcRecord array and attempts to delete the current record. If the current record can't be locked and deleted, the record is not copied to the target table CUSTARC. If the record delete is successful, the method adds a new blank record to the target table, and writes the contents of the array to the record.

; archiveButton::pushButton
method pushButton(var eventInfo Event)
var
  arcRecord Array[] String
endVar

; check to see if form is in edit mode
if thisForm.Editing = False then ; if not, then start
  CUSTOMER.action(DataBeginEdit)
endif

; move the current record from CUSTOMER to archive in CUSTARC
CUSTOMER.copyToArray(arcRecord)
arcRecord.view()           ; take a look at the array
; if the record can't be locked, it won't be deleted
if CUSTOMER.deleteRecord() = True then
  ; if it is deleted, then copy it to the archive table
  CUSTARC.insertRecord()            ; insert blank record
  CUSTARC.copyFromArray(arcRecord)  ; copy array to blank record
endif

endMethod


See Also for UIObject::copyToArray
See Also

copyFromArray


UIObject::copyToToolBar
copyToToolbar	5.0

See Also	Example	UIObject Type

Method

Copies an object to the Toolbar where it can be used as a prototype object.

Syntax

copyToToolbar ( ) Logical

Description

copyToToolbar copies an object (including all its properties and methods) to the Toolbar. Objects subsequently created with the corresponding Toolbar tool will have the new properties. Objects that existed in the form previously do not change.

For example, suppose you create a box (interactively or using ObjectPAL), then set its color to red and add code to its built-in mouseClick method. When you copy this box to the Toolbar, all subsequent boxes you create will be red and have the same code attached to the mouseClick method.

copyToToolbar copies all component objects in a compound object. For example, when you copy a labeled field object, you copy the field object, the label, and the edit region. Tables come with headers, labels, records, and fields. Multirecord objects come with records (but not fields). Crosstabs come with cells and fields, and can distinguish the three different cell types, so you can have three different types of fields in them, different colors in them, and so on.

You can also copy the component objects separately. For example, if you only want to copy an edit region, you can do that. If an object contains objects, but is not a compound object, the contained objects are not copied.

Changes you make using copyToToolbar last only for the current Paradox session. To save the tool's new properties to the next session, call saveStyleSheet.

If an object does not have a corresponding tool on the Toolbar, Paradox copies its properties and methods to a "hidden" tool, and subsequent objects of that type will have those properties and methods. For example, the Toolbar has no tool for creating a page. However, you can set a page's properties and methods, and then call copyToToolbar. Pages created subsequently will have those same properties and methods.


Example for UIObject::copyToToolBar
copyToToolbar Example

In this example, a button named btnCreateStyleSheet uses enumObjectNames to fill an array arObjNames. A for loop cycles through the array and copies the object to the Toolbar using copyToToolbar. Finally, a call to saveStyleSheet creates (or overwrites) a style sheet with the name in the String variable stSheet. Paste the following code into the pushButton method for a button on any form you want to use as a style sheet.

;btnCreateStyleSheet :: pushButton

method pushButton(var eventInfo Event)

var

f	Form

stSheet	String

arObjNames	Array[] Anytype

siCounter	SmallInt

endVar

f.attach()	      ; Attach to this form.

f.enumObjectNames(arObjNames)	; Fill array with object names.

; Prompt user for name of new style sheet.

stSheet = "Style sheet name"

stSheet.view("Enter name of style sheet")

if stSheet = "Style sheet name" then	; If variable was not changed,

return	; quit the operation.

endIf

for siCounter from 1 to arObjNames.size()	; Cycle through array

copyToToolbar(f.(arObjNames[siCounter]))	; and copy objects to

endFor	; the Toolbar.

if not f.saveStyleSheet(stSheet, True) then

errorShow("Error saving style sheet", "Check path & filename")

endIf

endMethod


See Also for UIObject::copyToToolBar
See Also

Form::getProtoProperty

Form::saveStyleSheet

Form::selectCurrentTool

Form::setProtoProperty

System::getDefaultPrinterStyleSheet

System::getDefaultScreenStyleSheet

System::setDefaultPrinterStyleSheet

System::setDefaultScreenStyleSheet


UIObject::create
create

See Also	Example	UIObject Type

Method

Creates an object.

Syntax

create ( const objectType SmallInt, const x LongInt, const y LongInt, const w LongInt, const h LongInt [, const container UIObject ] )

Description

create creates the object specified in objectType (use one of the UIObjectTypes constants) at a position specified in x and y, with a width specified in w and a height specified in h. (x, y, w, and h are assumed to be twips.) The optional argument container specifes a container object for the object you're creating.

Note:	When you use create to create an object, the object is invisible. To make it visible, set its Visible property to True. Objects can also be deleted at run time with the delete method.


Example for UIObject::create
create Example

The following code is attached to the mouseUp method for pageOne on a form. This example creates a box, names it Fred, colors it blue, and sets it visible. An ellipse is then created with a size position in Fred, and its container is set to Fred.

; pageOne::mouseUp

const

kOneInch = 1440 ; One inch = 1,440 twips.

endConst

method mouseUp(var eventInfo MouseEvent)

var

  ui UIObject

endvar

; create a Blue box, called Fred, and make it visible

ui.create(BoxTool, 144, 144, 2 * kOneInch, 2 * kOneInch)

ui.Name = "Fred"

ui.Color = Blue

ui.Visible = True

; create a Green ellipse inside Fred, called Bill

ui.create (EllipseTool, 288, 288, kOneInch, kOneInch, self.Fred)

ui.Name = "Bill"

ui.Color = Green

ui.Visible = True

endMethod


See Also for UIObject::create
See Also

delete

methodSet


UIObject::currRecord
currRecord

See Also	Example	UIObject Type

Method

Reads the current record into the record buffer.

Syntax

currRecord ( ) Logical

Description

currRecord cancels changes to the current record, refreshing the current record from saved data. Any changes to the record are not committed. currRecord leaves a locked record locked. It returns True if successful; otherwise, it returns False.

currRecord has the same effect as the action constant DataRefresh, so the following statements are equivalent:

obj.currRecord()
obj.action(DataRefresh)


Example for UIObject::currRecord
currRecord Example

In the following example, assume that a form contains a table frame bound to Orders.

refreshRecord::pushButton
method pushButton(var eventInfo Event)
ORDERS.edit()            ; start edit
ORDERS.Amount_Paid = 321.45   ; make a change
message("Watch closely now.")
sleep(2000)
ORDERS.currRecord()      ; refreshes record from disk,
                         ; any changes are lost, record
                         ; is not locked
if ORDERS.recordStatus("Locked") then
  msgInfo("FYI", "The record is still locked.")
endif
endMethod


See Also for UIObject::currRecord
See Also

cancelEdit


UIObject::delete
delete

See Also	Example	UIObject Type

Method

Deletes an object from a form.

Syntax

delete ( )

Description

delete deletes an object from a form at run time.


Example for UIObject::delete
delete Example

In the following example, assume that a form contains a method that creates a box named Fred and a ellipse inside Fred called Bill. These objects are created at run time and thus can't be referenced directly by this method, because they don't exist yet. The technique used here attaches to the object using a string evaluated at run time. See the example for create for details about the mouseUp method (on the same form) that creates the objects to be deleted.

; pageOne::mouseRightUp
method mouseRightUp(var eventInfo MouseEvent)
var
  ui   UIObject
endVar

;  Fred and Bill are objects created by the mouseUp method
;  for pageOne of this form. Because they are created at
;  run time, you can't directly refer to them as objects in
;  code. Consequently, attach is used to attach the ui var
;  to the string "Fred.Bill", which is evaluated at run time.
;  As long as mouseUp is called before mouseRightUp, those
;  objects will exist.
if ui.attach("Fred.Bill") then
  ui.delete()
  ui.attach("Fred")
  ui.delete()
  {This would do the same thing as previous four lines,
    because Fred contains Bill at run time:
    ui.attach("Fred")
    ui.delete()
  }
endif
endMethod


See Also for UIObject::delete
See Also

create

methodSet


UIObject::deleteRecord
deleteRecord

See Also	Example	UIObject Type

Beginner

Method

Deletes the current record from the table.

Syntax

deleteRecord ( ) Logical

Description

deleteRecord deletes the current record of a table without prompting for confirmation. It returns True if successful; otherwise, it returns False. This operation cannot be undone, for Paradox tables, but it can be undone for dBASE tables.

deleteRecord has the same effect as the action constant DataDeleteRecord, so the following statements are equivalent:

obj.deleteRecord()
obj.action(DataDeleteRecord)


Example for UIObject::deleteRecord
deleteRecord Example

The following example assumes that there are two table frames on a form, CUSTOMER and CUSTARC, and one button, named archiveButton. The form is renamed thisForm. When archiveButton is pushed, the current record in CUSTOMER is moved to CUSTARC.

First, the method looks at the Editing property of the form; if Editing is False, the method starts Edit mode. The method then copies the current record in CUSTOMER to the arcRecord array and attempts to delete the current record. If the current record can't be locked and deleted, the record is not copied to the target table CUSTARC. If the record delete is successful, the method adds a new blank record to the target table, and writes the contents of the array to the record.

; archiveButton::pushButton
method pushButton(var eventInfo Event)
var
  arcRecord Array[] String
endVar

; check to see if form is in edit mode
if thisForm.editing = False then ; if not, then start
  CUSTOMER.action(DataBeginEdit)
endif

; move the current record from CUSTOMER to archive in CUSTARC
CUSTOMER.copyToArray(arcRecord)
arcRecord.view()           ; take a look at the array
; if the record can't be locked, it won't be deleted
if CUSTOMER.deleteRecord() = True then
  ; if it is deleted, then copy it to the archive table
  CUSTARC.insertRecord()
  CUSTARC.copyFromArray(arcRecord)
endif

endMethod


See Also for UIObject::deleteRecord
See Also

empty

insertRecord

insertAfterRecord

insertBeforeRecord


UIObject::dropGenFilter
dropGenFilter	5.0

See Also	Example	UIObject Type

Method

Drops (removes) the filter criteria associated with a field, multirecord object, or table frame.

Syntax

dropGenFilter ( ) Logical

Description

dropGenFilter drops (removes) the filter criteria associated with a UIObject, leaving it unfiltered. Indexes and ranges (if any) remain in effect.


Example for UIObject::dropGenFilter
dropGenFilter Example

In a complex form, it is sometimes convenient to include a button that removes all the filter criteria from the form. In the following example, a form's data model contains the Orders and Linteitem tables linked 1:M. The form also contains a button called btnDropFilters. The pushButton method for btnDropFilters uses dropGenFilter on one UIObject connected to each table in the data model.

;btnDropFilters :: pushButton

method pushButton(var eventInfo Event)

; Order_No is a field object bound to

; the Order No field in the Orders table.

Order_No.dropGenFilter()

; LINEITEM is a table frame bound to the Lineitem table.

LINEITEM.dropGenFilter()

endMethod


See Also for UIObject::dropGenFilter
See Also

getGenFilter

setGenFilter

setRange

TCursor::dropGenFilter


UIObject::edit
edit

See Also	Example	UIObject Type

Beginner

Method

Puts a table into Edit mode.

Syntax

edit ( ) Logical

Description

edit puts all tables on a form into Edit mode so changes can be made. If a form is already in Edit mode, an unnecessary edit does not cause an error, and does not toggle out of Edit mode.

In Edit mode, record changes are posted when the focus moves off the record, when the table receives a DataPostRecord or DataUnlockRecord action, or when endEdit is executed. Use cancelEdit to cancel changes to the record before departing from the record.

edit has the same effect as the action constant DataBeginEdit, so the following statements are equivalent:

obj.edit()
obj.action(DataBeginEdit)


Example for UIObject::edit
edit Example

In the following example, assume that a form contains a table frame bound to the Orders table, and one button, named changeDate. The pushButton method for changeDate checks the Sale Date and Ship Date fields of the current record, and updates Sale Date if Ship Date is less than Sale Date. Once the transaction is complete, endEdit posts the record and ends Edit mode.

; changeDate::pushButton
method pushButton(var eventInfo Event)

; first, see if you want to change Ship Date
if ORDERS."Sale Date".value > ORDERS."Ship Date".value then
  ; start Edit mode for the form
  ORDERS.edit()
  ; if Sale Date is later than Ship Date, change Ship Date
  ORDERS."Ship Date".value = ORDERS."Sale Date".value + 5
  ORDERS.endEdit()      ; end editing---changes to the record
                        ; can't be cancelled
endif

endMethod


See Also for UIObject::edit
See Also

cancelEdit

endEdit


UIObject::empty
empty

See Also	Example	UIObject Type

Method

Deletes all records from a table.

Syntax

empty ( ) Logical

Description

empty deletes all records from a table without prompting for confirmation. If the UIObject is bound to a dBASE table, the records are flagged as deleted. In any case, the table does not have to be in Edit mode, but a write lock (at least) is required. This operation cannot be undone.

empty removes information from the table, but does not delete the table itself. Compare this method to Table::delete, which does delete the table.

empty tries to place a write lock on the table. empty must delete each record one at a time. This can take a long time for large tables. For dBASE tables, this method flags all records as deleted, but does not remove them from the table. Records can be undeleted from a dBASE table if they have not been removed with the TCursor::compact method.


Example for UIObject::empty
empty Example

The following example assumes a form with three buttons: createTable, emptyTable, and deleteTable. createTable creates a copy of the Orders table called TmpOrder, then places a table frame on the form and binds TmpOrder to it. emptyTable deletes all the records from TmpOrder. deleteTable removes the table frame, removes the table from the data model of the form, and deletes the temporary table.

Following is the code for the createTable button:

; createTable::pushButton
method pushButton(var eventInfo Event)
var
  tbl Table
  ui  UIObject
endVar

tbl.attach("Orders.db")
tbl.copy("TmpOrder.db")  ; Copy Orders to TmpOrder.

ui.create(TableFrameTool, 720, 720, 4320, 1440) ; Create a TableFrame.
ui.TableName = "TmpOrder.db" ; This also adds table to data model.
ui.Visible = True

endMethod

Following is the code for the emptyTable button:

; emptyTable::pushButton
method pushButton(var eventInfo Event)
var
  ui  UIObject
endVar

if ui.attach("TMPORDER") then
  if msgYesNoCancel("Empty",
    "Delete all records from this table?") = "Yes" then
    ui.empty()  ; Deletes all records from the TMPORDERS table.

  endIf
endIf

endMethod

Following is the code for the deleteTable button:

; deleteTable::pushButton
method pushButton(var eventInfo Event)
var
  tbl Table
  ui  UIObject
endVar

; Clean up.
if ui.attach("TMPORDER") then
  ui.delete()                   ; Delete table frame.
  DMRemoveTable("TmpOrder.db")  ; Remove table from data model.
  tbl.attach("TmpOrder.db")
  tbl.delete()                  ; Delete table.
endIf
endMethod


See Also for UIObject::empty
See Also

deleteRecord

Table::delete

Table::empty

TCursor::empty


UIObject::end
end

See Also	Example	UIObject Type

Beginner

Method

Moves to the last record in a table.

Syntax

end ( ) Logical

Description

end sets the current record to the last record in a table.

end has the same effect as the action constant DataEnd, so the following statements are equivalent:

obj.end()
obj.action(DataEnd)


Example for UIObject::end
end Example

The following example moves to the last record in the Customer table. Assume that Customer is bound to a table frame on the form; moveToEnd is a button on the same form.

; moveToEnd::pushButton
method pushButton(var eventInfo Event)
CUSTOMER.end()  ; move to the last record
                ; same as:  CUSTOMER.action(DataEnd)
msgInfo("At the last record?", CUSTOMER.atLast())
endMethod


See Also for UIObject::end
See Also

home

nextRecord

priorRecord

currRecord

skip

moveTo


UIObject::endEdit
endEdit

See Also	Example	UIObject Type

Beginner

Method

Leaves Edit mode, and accepts changes to the current record.

Syntax

endEdit ( ) Logical

Description

endEdit takes a table out of Edit mode and posts changes to the current record.

endEdit has the same effect as the action constant DataEndEdit, so the following statements are equivalent:

obj.endEdit()
obj.action(DataEndEdit)


Example for UIObject::endEdit
endEdit Example

See the example for edit.


See Also for UIObject::endEdit
See Also

cancelEdit

edit


UIObject::enumFieldNames
enumFieldNames

See Also	Example	UIObject Type

Method

Fills an array with the names of fields in a table.

Syntax

enumFieldNames ( var fieldArray Array[ ] String ) Logical

Description

enumFieldNames fills fieldArray with the names of the fields in a table, where fieldArray is a resizeable array that you must declare and pass as an argument. If fieldArray already exists, this method overwrites it without asking for confirmation. This method returns True if it succeeds; otherwise, it returns False.


Example for UIObject::enumFieldNames
enumFieldNames Example

The following example uses enumFieldNames to write the field names from the Orders table to an array named fieldNames. Assume that a form has a table frame bound to Orders and a button called getFieldNames.

; getFieldNames::pushButton
method pushButton(var eventInfo Event)
var
  fieldNames Array[] String
endVar
ORDERS.enumFieldNames(fieldNames)
fieldNames.view()
endMethod


See Also for UIObject::enumFieldNames
See Also

enumObjectNames


UIObject::enumLocks
enumLocks

See Also	Example	UIObject Type

Method

Creates a Paradox table listing the locks currently applied to a UIObject; returns number of locks.

Syntax

enumLocks ( const tableName String ) LongInt

Description

enumLocks creates the Paradox table specified in tableName. tableName lists the locks currently applied to the table object. If tableName exists, this method overwrites it without asking for confirmation. If tableName is open, this method fails. For dBASE tables, this method lists only the lock you've placed (not all locks currently on the table).

You can include an alias or path in tableName; if no alias or path is specified, Paradox creates tableName in the working directory (:WORK:).

The structure of tableName is listed below:

Field Name	Field Type	Description

UserName	A15	User name.

LockType	A32	String describing type of lock, for example, Table Write Lock.

NetSession	N	Net level session number.

Session	N	IDAPI session number, if the lock was placed by IDAPI.

RecordNumber	N	Record number, if the lock is a record lock or an image lock; otherwise 0.


Example for UIObject::enumLocks
enumLocks Example

In the following example, the built-in pushButton method for the showLocks button creates a table listing the locks currently applied to the Customer table.

; showLocks::pushButton
method pushButton(var eventInfo Event)
var
  obj       UIObject
  howMany   LongInt
  enumTable TableView
endVar
obj.attach(CUSTOMER)            ; table frame on form
lock("Customer", "Write")       ; put a write lock on Customer
howMany = obj.enumLocks("lockenum.db")  ; enumerate locks
message("There are ", howMany, " locks on Customer table.")
enumTable.open("lockenum.db")   ; show the resulting table
enumTable.wait()
enumTable.close()
endMethod


See Also for UIObject::enumLocks
See Also

lockStatus

TCursor::lock

TCursor::lockStatus


UIObject::enumObjectNames
enumObjectNames

See Also	Example	UIObject Type

Method/Procedure

Fills an array with the names of the objects in a form.

Syntax

enumObjectNames ( var objectNames Array[ ] String )

Description

enumObjectNames fills an array with object names, where arrayName is a resizeable array that you declare and pass as an argument. If arrayName already exists, this method overwrites it without asking for confirmation.

This method returns the names of bound objects and unbound objects, beginning with the object that called this method, and including paths to objects that object contains. So, to enumerate all objects in a form, make enumObjectNames start with the form. To enumerate all objects in a page, make it start with the page. To enumerate all objects in a box, make it start with the box.

To list object names to a table (instead of an array) use enumUIObjectNames.


Example for UIObject::enumObjectNames
enumObjectNames Example

This example demonstrates the difference between enumObjectNames (which lists object names to an array) and enumUIObjectNames (which lists object names to a table). In this example, the pushButton method for getObjectNames writes all object names on the form to an array, then to a table.

; getObjectNames::pushButton
method pushButton(var eventInfo Event)

var

foThisForm	Form

arObjNames	Array[] String

stTbName	String

tvObjNames	TableView

endVar

stTbName = "objTable.db"

foThisForm.attach() ; Get a handle to the current form.

foThisForm.enumObjectNames(arObjNames)

arObjNames.view("Objects in this form:")

foThisForm.enumUIObjectNames(stTbName)
tvObjNames.open(stTbName)

endMethod


See Also for UIObject::enumObjectNames
See Also

enumUIObjectNames

enumUIObjectProperties

enumUIClasses


UIObject::enumSource
enumSource

See Also	Example	UIObject Type

Method

Fills a table with the source code of the methods on a form.

Syntax

enumSource ( const tableName String, [const recurse Logical ] ) Logical

Description

enumSource fills a table with the source code of the methods on a form. If tableName already exists, this method overwrites it without asking for confirmation. You can include an alias or path in tableName; if no alias or path is specified, Paradox creates tableName in the working directory (:WORK:).

The structure of the table is

Field Name	Type	Description

Object	A128	Object name.

MethodName	A128	Method name.

Source	M64	ObjectPAL code.

If recurse is False, this method returns the method definitions for overridden methods on the current object only. To include the source code for overridden methods on objects contained by the current object, recurse should be True.

When recurse is True, enumSource returns the method definitions for overridden methods, beginning with the object that called this method, and including paths to objects that object contains. So, to enumerate the source for all objects in a form, make enumSource start with the form. To enumerate the source for all objects in a page, make it start with the page. To enumerate the source for all objects in a box, make it start with the box.


Example for UIObject::enumSource
enumSource Example

This example uses enumSource twice: first to get the source code for the entire form, then to get only the source code for a button named btnCancel.

; getObjectNames::pushButton
const

kRecurse   = Yes

kNoRecurse = No

endConst

method pushButton(var eventInfo Event)

var

foThisForm	Form

stTbName	String

tvSource	TableView

endVar

stTbName = "objSrc.db"

foThisForm.attach() ; Get a handle to the current form.

foThisForm.enumSource(stTbName, kRecurse)

tvSource.open(stTbName)

; Suspend execution until you close the table view.

tvSource.wait()

btnCancel.enumSource(stTbName, kNoRecurse)
tvSource.open(stTbName)

endMethod


See Also for UIObject::enumSource
See Also

enumSourceToFile

enumUIObjectProperties

enumUIClasses

Form::enumSource


UIObject::enumSourceToFile
enumSourceToFile

See Also	Example	UIObject Type

Method

Writes the source code for a form or an object to a text file.

Syntax

enumSourceToFile ( const fileName String [, const recurse Logical ] ) Logical

Description

enumSourceToFile writes the source code of the methods on a form to a text file. If fileName already exists, this method overwrites it without asking for confirmation. You can include an alias or path in fileName; if no alias or path is specified, Paradox creates fileName in the working directory (:WORK:).

If recurse is False, this method writes the method definitions for overridden methods on the current object only. To include the source code for overridden methods on objects contained by the current object, recurse should be True.

When recurse is True, enumSourceToFile writes the method definitions for overridden methods, beginning with the object that called this method, and including paths to objects that object contains. So, to enumerate the source for all objects in a form, make enumSourceToFile start with the form. To enumerate the source for all objects in a page, make it start with the page. To enumerate the source for all objects in a box, make it start with the box.


Example for UIObject::enumSourceToFile
enumSourceToFile Example

This example uses enumSourceToFile twice: first to get the source code for the entire form, then to get only the source code for a button named btnCancel.

; getObjectNames::pushButton
const

kRecurse   = Yes

kNoRecurse = No

endConst

method pushButton(var eventInfo Event)

var

foThisForm	Form

endVar

foThisForm.attach() ; Get a handle to the current form.

foThisForm.enumSource("formSrc.txt", kRecurse)

btnCancel.enumSource("btnSrc.txt", kNoRecurse)
endMethod


See Also for UIObject::enumSourceToFile
See Also

enumSource

enumUIObjectProperties

enumUIClasses

Form::enumSourceToFile


UIObject::enumUIClasses
enumUIClasses

See Also	Example	UIObject Type

Procedure

Writes a list of UIObject classes to a table.

Syntax

enumUIClasses ( const tableName String ) Logical

Description

enumUIClasses creates a table tableName containing a list of all UIObject classes (such as bitmap, box, and field) and the names of associated properties. You can include an alias or path in tableName; if no alias or path is specified, Paradox creates tableName in the working directory (:WORK:).

The table structure is

Field Name	Type	Description

ClassName	A32	Name of object class.

PropertyName	A64	Name of property.


Example for UIObject::enumUIClasses
enumUIClasses Example

The following example writes the types and properties to a table named Tmpclass.

; writeClasses::pushButton
method pushButton(var eventInfo Event)
enumUIClasses("TmpClass.db")
endMethod


See Also for UIObject::enumUIClasses
See Also

enumUIObjectNames

enumUIObjectProperties


UIObject::enumUIObjectNames
enumUIObjectNames

See Also	Example	UIObject Type

Method/Procedure

Gets the names of each object in a form and writes them to a table.

Syntax

enumUIObjectNames ( const tableName String ) Logical

Description

enumUIObjectNames fills a table with object names. You can include an alias or path in tableName; if no alias or path is specified, Paradox creates tableName in the working directory (:WORK:).

The structure of the table is

Field Name	Type	Description

ObjectName	A128	Name of object.

ObjectClass	A32	Type of object (for example, button).

This method returns the names of bound objects and unbound objects, beginning with the object that called this method, and including paths to any objects that object contains. So, to enumerate all objects in a form, make enumUIObjectNames start with the form. To enumerate all objects in a page, make it start with the page. To enumerate all objects in a box, make it start with the box.

To list object names to an array (instead of a table), use enumObjectNames.


Example for UIObject::enumUIObjectNames
enumUIObjectNames Example

See the example for enumObjectNames.


See Also for UIObject::enumUIObjectNames
See Also

enumObjectNames

enumUIObjectProperties

enumUIClasses

Form::enumUIObjectNames


UIObject::enumUIObjectProperties
enumUIObjectProperties

See Also	Example1	Example2	UIObject Type	Changes

Method/Procedure

Lists the properties of an object.

Syntax

1. enumUIObjectProperties ( const tableName String ) Logical

2. enumUIObjectProperties ( const properties DynArray[] String ) Logical

Description

enumUIObjectProperties lists the properties of an object to a table or a DynArray.

Syntax 1 writes the data to the Paradox table specified in tableName. You can include an alias or path in tableName; if no alias or path is specified, Paradox creates tableName in the working directory (:WORK:). If the table already exists, Paradox overwrites it without asking for confirmation.

The table lists the properties of the specified object, and the properties of the objects it contains. The structure of the table is

Field Name	Type	Description

ObjectName	A128	Name of the object

PropertyName	A64	Name of the property

PropertyType	A48	Data type of the corresponding property

PropertyValue	A255	Value of the corresponding property

In syntax 2 (added in version 5.0), the properties of the object (but not the properties of objects it contains) are written to a DynArray properties. The DynArray keys are the property names, and the items are the corresponding property values. You must declare the DynArray before calling this method.


Example 1 for UIObject::enumUIObjectProperties
enumUIObjectProperties Example 1

For the following example, assume that getProperties is a button on a form designed to show fields from the Customer table. The pushButton method for getProperties uses enumUIObjectProperties to write all of the property values for each object on the form to the table CstProps.

; getProperties::pushButton
method pushButton(var eventInfo Event)
enumUIObjectProperties("CstProps.db")
endMethod


Example 2 for UIObject::enumUIObjectProperties
enumUIObjectProperties Example 2

For the following example, assume that getProperties is a button on a form. The pushButton method for btnProperties uses enumUIObjectProperties to write all of its property values to the dynamic array dyn and then display it.

; btnProperties::pushButton

method pushButton(var eventInfo Event)

var

dyn	DynArray[] String

endVar

self.enumUIObjectProperties(dyn)

dyn.view("Properties of this button:")

endMethod


See Also for UIObject::enumUIObjectProperties
See Also

enumUIObjectNames

enumUIClasses


Changes to UIObject::enumUIObjectProperties

In syntax 2 (added in version 5.0), the properties of the object (but not the properties of objects it contains) are written to a DynArray properties. The DynArray keys are the property names, and the items are the corresponding property values. You must declare the DynArray before calling this method.


UIObject::execMethod
execMethod

See Also	Example	UIObject Type

Method/Procedure

Calls a custom method that takes no arguments.

Syntax

execMethod ( const methodName String )

Description

execMethod calls the custom method indicated by the string methodName. The method named in methodName can take no arguments. execMethod allows you to call a method based on the contents of a variable, which means the compiler does not know the method to call until run time.


Example for UIObject::execMethod
execMethod Example

In the following example, assume that a form contains several fields, fieldOne, fieldTwo, and fieldThree. The form's Var window declares a dynamic array called objPreProc. The form's one custom method is called fieldOnePreProc. The form's open method (in the isPreFilter=False clause) creates elements in the objPreProc array: an element is created for each object on the form for which there is a preprocessing custom method.

In this example, fieldOne is assumed to require some preprocessing. An array element is created with an index of the object name "pageOne.fieldOne"; the value of the custom method name is "fieldOnePreProc". The isPreFilter=True clause of the form's open method---called for each object on the form---sorts out if an array element in objPreProc corresponds to the current object; if so, the custom method for that object is called.

Following is the code for the custom method fieldOnePreProc:

; form design::fieldOnePreProc  (custom method)
; This method is called during the form's preFilter clause,
; when the current object is fieldOne.
method fieldOnePreProc()
fieldOne.color = "Red"    ; change the color of the field
fieldOne.Value = "Initialized by the form's open method"
endMethod

The following code goes in the form's Var window:

; Var window for the form
Var
  ObjPreProc DynArray[] String  ; indexed by object name, will
                                ; hold names of methods to execute
                                ; when isPreFilter is true
endVar

Following is the code for the form's open method:

method open(var eventInfo Event)
var
  targObj   UIObject   ; holds the target object
  targName  String     ; target object's name
  element   AnyType    ; index to dynamic array objPreProcs
endVar
if eventInfo.isPreFilter()
  then
    ; code here executes for each object in form
    eventInfo.getTarget(targObj)  ; identify the current target
    targName = targObj.name       ; get the name of the target
    forEach element in objPreProc ; iterate through array
      if element = targName then  ; is the target name there?
                                  ; if so, execute the corresponding

                                  ; custom method
        execMethod(objPreProc[targName])
      endIf
    endForEach
  else
    ; code here executes just for form itself

    ; assign elements to the objPreProc array to indicate
    ; objects for which there is a preprocess custom method
    objPreProc["fieldOne"] = "fieldOnePreProc"
endif
endMethod


See Also for UIObject::execMethod
See Also

methodDelete

methodGet

methodSet


UIObject::forceRefresh
forceRefresh	4.5

See Also	Example	UIObject Type

Method

Makes an object display the current data in the underlying table, and makes a calculated field recalculate.

Syntax

forceRefresh( ) Logical

Description

forceRefresh initiates an action that says, in effect, "Throw out any buffers and regenerate your data from the table information. And do this recursively for all objects you contain." forceRefresh will also make a calculated field recalculate its value, and make a crosstab or graph re-evaluate its components.

Calling active.forceRefresh( ) is exactly the same as calling active.action(DataRecalc) or pressing Shift + F9. It is a UIObject counterpart to the forceRefresh method defined for the TCursor type.

A call to forceRefresh affects the target object, objects contained by the target object, and objects bound to the same table as the target object. It does not affect objects in other windows. For example, calling forceRefresh in a form would not refresh data displayed in a table window. You refresh every object in a form by declaring a UIObject variable and calling attach to assign it a value; you can't use a variable declared as a Form variable.

forceRefresh behaves as follows:

If a table frame or MRO is active when you call forceRefresh, only the underlying table refreshes. Child tables repaint, but they will not necessarily discard cached data.

If a field object is active when you call forceRefresh, the table associated with that field refreshes, thereby repainting all fields dependent on it.

You will not lose your current record position, provided the record still exists in the table.

On a SQL server, a call to forceRefresh forces a read from the server. This is the only way to get a refresh from the server.


Example for UIObject::forceRefresh
forceRefresh Example

The following example uses forceRefresh in code attached to a button's built-in pushButton method to let the user control when data is refreshed. This example assumes you have interactively chosen File | System Settings | AutoRefresh and entered a large value (at least 3,600 seconds) in the Network Refresh Rate dialog box. The code uses forceRefresh to refresh the Parts table each time the user clicks the button. Other tables bound to this form are refreshed only once in 3,600 seconds (one hour).

method pushButton(var eventInfo Event)
   Parts.forceRefresh()
endMethod


See Also for UIObject::forceRefresh
See Also

currRecord


UIObject::getBoundingBox
getBoundingBox

See Also	Example	UIObject Type

Method

Returns the coordinates of the frame that bounds an object.

Syntax

getBoundingBox ( var topLeft Point, var bottomRight Point )

Description

getBoundingBox returns the coordinates of the top left corner (topLeft) and the bottom right corner (bottomRight) of the invisible box (frame) that bounds an object, relative to the form. The bounding box is only visible in a design window. When you select an object in a design window, you can see its bounding box.


Example for UIObject::getBoundingBox
getBoundingBox Example

The following example draws a box around an ellipse based on the ellipse's bounding box. Assume that a form contains an ellipse called redCircle.

; redCircle::mouseUp
method mouseUp(var eventInfo MouseEvent)
var
  TopLeft,
  BotRight Point      ; to hold the points returned by getBoundingBox
  ui       UIObject   ; to create a new object
endVar

self.getBoundingBox(TopLeft, BotRight)
ui.create(BoxTool, TopLeft.x(),
                   TopLeft.y(),
                   BotRight.x() - TopLeft.x(),
                   BotRight.y() - TopLeft.y())
ui.Color = Green
ui.Translucent = Yes
ui.Visible = Yes

endMethod


See Also for UIObject::getBoundingBox
See Also

convertPointWithRespectTo


UIObject::getGenFilter
getGenFilter	5.0

See Also	Example1	Example2	UIObject Type

Method

Retrieves the filter criteria associated with a field, table frame, or multirecord object.

Syntax

1.getGenFilter  ( criteria DynArray[] AnyType ) Logical

2. getGenFilter ( criteria Array[] AnyType [ , fieldName Array[] AnyType ] ) Logical

3. getGenFilter ( criteria String ) Logical

Description

getGenFilter retrieves the filter criteria associated with a field, table frame, or multirecord object. This method does not return values directly; instead, it assigns them to a DynArray variable (syntax 1) or to two Array variables (syntax 2) that you declare and include as arguments.

In syntax 1, the DynArray criteria lists fields and filtering conditions as follows: the index is the field name, and the item is the corresponding filter expression.

In syntax 2, the Array criteria lists filtering conditions, and the optional Array fieldName lists corresponding field names. If you omit fieldName, conditions apply to fields in the order they appear in the criteria array (the first condition applies to the first field in the table, the second condition applies to the second field, and so on).

If the arrays used in syntax 2 are resizeable, this method sets the array size to equal the number of fields in the underlying table. If fixed-size arrays are used, this method stores as many criteria as it can, starting with criteria field 1. If there are more array items than fields, the remaining items are left empty; if there are more fields than items, this method fills the array and then stops.

In syntax 3, the filter criteria is assigned to a String variable criteria that you must declare and pass as an argument.


Example 1 for UIObject::getGenFilter
getGenFilter Example 1

In this example, the pushButton method for a button named btnSetFilter uses getGenFilter to populate a DynArray dyn with a table frame's filter criteria. Then it checks the DynArray to see if the current criteria filters the Balance Due field for values greater than 10,000 and the Total Invoice field for values less that 65,000 and resets the filter if necessary.

;btnSetFilter :: pushButton

method pushButton(var eventInfo Event)

var

currentDyn,

filterDyn	DynArray[] AnyType

keysAr	Array[] AnyType

endVar

filterDyn["Balance Due"]   = "> 10000"

filterDyn["Total Invoice"] = "< 65000"

ORDERS.getGenFilter(currentDyn)   ; ORDERS is a table frame on a form.

if currentDyn = filterDyn then

return                         ; Filter is OK.

else

ORDERS.setGenFilter(filterDyn) ; Reset filter.

endIf

endMethod


Example 2 for UIObject::getGenFilter
getGenFilter Example 2

In this example, the pushButton method for a button named btnShowFilter uses getGenFilter to populate a DynArray dyn with the current filter criteria. Finally, the DynArray is displayed in a view dialog box. This technique is an alternative to setting flags to track the current filter criteria.

;btnShowFilter :: pushButton

method pushButton(var eventInfo Event)

var

dyn	DynArray[] AnyType

endVar

ORDERS.getGenFilter(dyn)	; ORDERS is a table frame on a form.

dyn.view("Current filter criteria")

endMethod


See Also for UIObject::getGenFilter
See Also

setGenFilter

dropGenFilter

setRange

TCursor::getGenFilter

Using Ranges and Filters


UIObject::getPosition
getPosition

See Also	Example	UIObject Type

Method

Reports the position of an object.

Syntax

getPosition ( const x LongInt, const y LongInt, const w LongInt, const h LongInt)

Description

getPosition gets the position of an object on the screen, relative to its container. Variables x and y specify the coordinates (in twips) of the upper left corner of the object. Variables w and h specify the width and height (in twips) of the object. If the object is not specified, self is implied.

To ObjectPAL, the screen is a two-dimensional grid, with the origin (0, 0) at the upper left corner of an object's container, positive x-values extending to the right, and positive y-values extending down.

For dialog boxes and for the Paradox Desktop application, the position is given relative to the entire screen; for forms, reports, and table windows, the position is given relative to the Paradox Desktop.


Example for UIObject::getPosition
getPosition Example

The following example moves a circle across the screen in response to timer events. The pushButton method for toggleButton uses setTimer and killTimer to start or stop a timer, depending on the condition of the button. When the timer starts, it issues a timer event every 100 milliseconds. Each timer event causes toggleButton's timer method to execute. The timer method locates the current position of the ellipse with getPosition, then moves it 100 twips to the right with setPosition.

Following is the code for toggleButton's pushButton method:

; toggleButton::pushButton
method pushButton(var eventInfo Event)
if buttonLabel = "Start Timer" then  ; if stopped, then start
  buttonLabel = "Stop Timer"         ; change label
  self.setTimer(100)          ; tell timer to issue a timer
                              ; event every 100 milliseconds
else
  buttonLabel = "Start Timer"         ; change label
  self.killTimer()                    ; stop the timer
endif

endMethod

Following is the code for toggleButton's timer method:

; toggleButton::timer
;   this method is called once for every timer event
method timer(var eventInfo TimerEvent)
var
  ui          UIObject
  x, y, w, h  SmallInt
endVar

ui.attach(floatCircle)          ; attach to the circle
ui.getPosition(x, y, w, h)      ; assign coordinates to vars
if x < 4320 then                ; if not at right edge of area
  ui.setPosition(x + 100, y, w, h)  ; move to the right
else
  ui.setPosition(1440, y, w, h)     ; return to the left
endif

endMethod


See Also for UIObject::getPosition
See Also

setPosition


UIObject::getProperty
getProperty

See Also	Example	UIObject Type

Method

Returns the value of a specified property.

Syntax

getProperty ( const propertyName String ) AnyType

Description

getProperty returns the value of the property specified in propertyName. Not all properties take strings as values. For example, if a property value is a number, this method returns a number. To return a string in every case, use getPropertyAsString.

getProperty is an alternative to getting a property directly; it's useful when propertyName is a variable. Otherwise, access the property directly, as in

thisColor = myBox.Color


Example for UIObject::getProperty
getProperty Example

The following example creates a dynamic array, indexed by property names, to contain property values. The array is filled by using the array's index as the argument to the getProperty command.

; boxOne::mouseUp
method mouseUp(var eventInfo MouseEvent)
var
  propNames DynArray[] AnyType    ; to hold property names & values
  arrayIndex           String     ; index to dynamic array
endVar

propNames["Color"] = ""
propNames["Visible"] = ""
propNames["Name"] = ""

foreach arrayIndex in propNames   ; assign the properties to the array
  propNames[arrayIndex] = self.getProperty(arrayIndex)
endforeach

propNames["Color"] = "DarkBlue"

foreach arrayIndex in propNames   ; set properties from the array
  self.setProperty(arrayIndex, propNames[arrayIndex])
endforeach

endMethod


See Also for UIObject::getProperty
See Also

getPropertyAsString

setProperty


UIObject::getPropertyAsString
getPropertyAsString

See Also	Example	UIObject Type

Method

Returns the value of a specified property as a string.

Syntax

getPropertyAsString ( const propertyName String ) String

Description

getPropertyAsString returns a string containing the value of the property specified in propertyName.


Example for UIObject::getPropertyAsString
getPropertyAsString Example

The following example assigns the value of the Color property to an AnyType variable using the getProperty method. The value returned is a LongInt, because colors are long integer constants. Next, the Color property is obtained using getPropertyAsString. The value returned is a String type, such as "Blue".

; boxOne::mouseRightUp
method mouseRightUp(var eventInfo MouseEvent)
var
  myColor  AnyType
endVar

myColor = self.getProperty("Color")
myColor.view()                             ; shows as LongInt
myColor = self.getPropertyAsString("Color")
myColor.view()                             ; shows as String
endMethod


See Also for UIObject::getPropertyAsString
See Also

getProperty

setProperty


UIObject::getRange
getRange	5.0

See Also	Example	UIObject Type

Method

Retrieves the values that specify a range for a field, table frame, or multirecord object.

Syntax

getRange ( var rangeVals Array[ ] String ) Logical

Description

getRange retrieves the values that specify a range for a field, table frame, or multirecord object. This method does not return values directly; instead, it assigns them to an Array variable that you declare and include as an argument. The array values describe the range criteria, as listed in the following table.

Number of array items	Range specification

No items (empty array)	No range criteria associated with the UIObject.

One item	Specifies a value for an exact match on the first field of the index.

Two items	Specifies a range for the first field of the index.

Three items	The first item specifies an exact match for the first field of the index; items 2 and 3 specify a range for the second field of the index.

More than three items	For an array of size n, specify exact matches on the first n-2 fields of the index. The last two array items specify a range for the n-1 field of the index.

If the array is resizeable, this method sets the array size to equal the number of fields in the underlying table. If fixed-size arrays are used, this method stores as many criteria as it can, starting with criteria field 1. If there are more array items than fields, the remaining items are left empty; if there are more fields than items, this method fills the array and then stops.


Example for UIObject::getRange
getRange Example

The following example demonstrates using two unlinked tables in the data model and using ObjectPAL to link them. Assume a form has the Orders and Lineitem tables in its data model and they are not linked. getRange is used on a table frame bound to the Lineitem table to retrieve the values that specify the current range (if any).

The following code is attached to the arrive method of the record object of a table frame bound to the Orders table.

;Record :: arrive

method arrive(var eventInfo MoveEvent)

var

arSet	Array[] AnyType

arGet	Array[] AnyType

endVar

LINEITEM.getRange(arGet)	;Retrieve values of range.

arSet.setSize(2)	;Specify size of array.

arSet[1] = string(Order_No.value)

arSet[2] = string(Order_No.value)

if (arSet.size() = arGet.size()) and (arSet <> arGet) then

LINEITEM.setRange(arSet)	;Specify range of records.

endIf

endMethod


See Also for UIObject::getRange
See Also

setRange

getGenFilter

Table::getRange

TCursor::getRange

Using Ranges and Filters


UIObject::getRGB
getRGB

See Also	Example	UIObject Type

Procedure

Finds the red, green, and blue components of a color.

Syntax

getRGB ( const rgb LongInt, var red SmallInt, var green SmallInt, var blue SmallInt )

Description

getRGB returns the component red, green and blue values of the color specified in rgb, where rgb is one of the Colors constants. getRGB assigns the component values to the variables red, green, and blue, which you must declare and pass as arguments.


Example for UIObject::getRGB
getRGB Example

The following example determines the red, green, and blue components of the constant Brown.

; decompBrown::pushButton
method pushButton(var eventInfo Event)
var
  thisRed, thisBlue, thisGreen SmallInt
endVar
getRGB(Brown, thisRed, thisGreen, thisBlue)
msgInfo("Brown is really",
        String("Red ", thisRed, "  Green ", thisGreen,
               "  Blue ", thisBlue))
endMethod


See Also for UIObject::getRGB
See Also

rgb


UIObject::hasMouse
hasMouse

See Also	Example	UIObject Type

Method

Tells if the mouse is positioned over an object.

Syntax

hasMouse ( ) Logical

Description

hasMouse returns True if the pointer is positioned inside the boundaries of an object; otherwise, it returns False.


Example for UIObject::hasMouse
hasMouse Example

The following example assumes that a form has a bitmap object called cat. The open method for cat sets the timer interval to 250 milliseconds. The timer method uses hasMouse to determine if cat has the mouse; if not, it moves cat to the mouse's position.

Following is the code for cat's open method:

; cat::open
method open(var eventInfo Event)
; set the timer interval to 250 milliseconds
self.setTimer(250)
endMethod

Following is the code for cat's timer method:

; cat::timer
method timer(var eventInfo TimerEvent)
var
  mousePt  Point                     ; to get mouse position
endVar
if NOT cat.hasMouse() then           ; am I on the mouse?
  mousePt = getMouseScreenPosition() ; find the mouse
  cat.setPosition(mousePt.x() - 350,
                  mousePt.y() - 2880,
                  4320, 1750)        ; chase the mouse
  ; moves cat above and slightly to the left of mouse
  ; assumes cat is a bitmap with width 4320, height 1750
  ; since getMouseScreenPosition returns position of mouse
  ; on desktop, these numbers assume form is maximized
  ; offset (2880-1750) allows for height of menu and Toolbar
endif
endMethod


See Also for UIObject::hasMouse
See Also

MouseEvent


UIObject::home
home

See Also	Example	UIObject Type

Beginner

Method

Moves to the first record in a table.

Syntax

home ( ) Logical

Description

home sets the current record to the first record of a table. home respects the limits of restricted views displayed in a linked table frame or multi-record object; home moves to the first record in a restricted view.

home has the same effect as the action constant DataBegin, so the following statements are equivalent:

obj.home()
obj.action(DataBegin)


Example for UIObject::home
home Example

The following example moves to the first record in the Customer table. Assume that Customer is bound to a table frame on the form; moveToHome is a button on the same form.

; moveToHome::pushButton
method pushButton(var eventInfo Event)
CUSTOMER.home()  ; move to the first record
                 ; same as:  CUSTOMER.action(DataBegin)
msgInfo("At the first record?", CUSTOMER.atFirst())
endMethod


See Also for UIObject::home
See Also

end

nextRecord

priorRecord


UIObject::insertAfterRecord
insertAfterRecord

See Also	Example	UIObject Type

Method

Inserts a record into a table after the current record.

Syntax

insertAfterRecord ( ) Logical

Description

insertAfterRecord inserts a record into a table after the current record. The table must be in Edit mode.


Example for UIObject::insertAfterRecord
insertAfterRecord Example

In the following example, suppose that CustSort is a copy of the Customer table, sorted by the Name field. The form contains a table frame named CUSTSORT bound to the CustSort table, an undefined field called newField, and a button called insRecButton. To add a new name to the table, type the name in newField and press insRecButton.

The following code is attached to the pushButton method for insRecButton. This method checks for a value in newField, then checks if the form is in Edit mode. If so, the method attaches the TCursor custTC to CUSTSORT, and scans custTC for a value greater than the string given in newField. If it finds a name greater than the new name, the method uses insertRecord to insert a new blank record before the name found; otherwise, it uses insertAfterRecord to insert a new blank record at the end of the table.

; insRecButton::pushButton
method pushButton(var eventInfo Event)
var
  custTC  TCursor
  nameStr String
endvar

if newField.Value = "" then       ; Quit if the field is blank.
  RETURN
endif

nameStr = newField.Value          ; Get the name to add.
CUSTSORT."Name".moveTo()

if thisForm.Editing then          ; Check for edit mode first.
  custTC.attach(CUSTSORT)

  scan custTC for custTC."Name"  nameStr:
    quitloop                      ; Stop when you find the name.
  endscan

  msgInfo("Current record no", custTC.recno())
  CUSTSORT.resync(custTC)         ; Resync CUSTSORT to custTC.

  if NOT CUSTSORT.atLast() then
    CUSTSORT.insertBeforeRecord()
  else
    CUSTSORT.insertAfterRecord()  ; Add blank record.
  endif

  ; ... fill the record with the rest of the customer information

else
  msgInfo("Sorry", "Form must be in Edit mode.")
endif
endMethod


See Also for UIObject::insertAfterRecord
See Also

insertRecord

insertBeforeRecord


UIObject::insertBeforeRecord
insertBeforeRecord

See Also	Example	UIObject Type

Method

Inserts a record into a table before the current record.

Syntax

insertBeforeRecord ( ) Logical

Description

insertBeforeRecord inserts a record into a table before the current record. The table must be in Edit mode.

insertBeforeRecord has the same effect as the action constant DataInsertRecord, so the following statements are equivalent:

obj.insertBeforeRecord()
obj.action(DataInsertRecord)


Example for UIObject::insertBeforeRecord
insertBeforeRecord Example

In the following example, suppose that CustSort is a copy of the Customer table, sorted by the Name field. The form contains a table frame named CUSTSORT bound to CustSort, an undefined field called newField, and a button called insRecButton. To add a new name to the table, type the name in newField and press insRecButton.

The following method overrides the pushButton method for insRecButton. This method checks for a value in newField, then checks if the form is in Edit mode. If so, the method attaches a TCursor named custTC to CUSTSORT, and scans custTC for a value greater than the string given in newField. If it finds a name greater than the new name, the method uses insertBeforeRecord to insert a new blank record before the name found; otherwise, it uses insertAfterRecord to insert a new blank record at the end of the table.

; insRecButton::pushButton
method pushButton(var eventInfo Event)
var
  custTC  TCursor
  nameStr String
endvar

if newField.Value = "" then       ; Quit if the field is blank.
  RETURN
endif

nameStr = newField.Value          ; Get the name to add.
CUSTSORT."Name".moveTo()

if thisForm.Editing then          ; Check for edit mode first.
  custTC.attach(CUSTSORT)

  scan custTC for custTC."Name"  nameStr:
    quitloop                      ; Stop when you find the name.
  endscan

  msgInfo("Current record no", custTC.recno())
  CUSTSORT.resync(custTC)         ; Resync CUSTSORT to custTC.

  if NOT CUSTSORT.atLast() then
    CUSTSORT.insertBeforeRecord()

  else
    CUSTSORT.insertAfterRecord()
  endif

  ; ... fill the record with the rest of the customer information
else
  msgInfo("Sorry", "Form must be in Edit mode.")
endif
endMethod


See Also for UIObject::insertBeforeRecord
See Also

insertRecord

insertAfterRecord


UIObject::insertRecord
insertRecord

See Also	Example	UIObject Type

Beginner

Method

Inserts a record into a table.

Syntax

insertRecord ( ) Logical

Description

insertRecord inserts a record before the current record into a table.

insertRecord has the same effect as insertBeforeRecord and the action constant DataInsertRecord, so the following three statements are equivalent:

obj.insertRecord()
obj.insertBeforeRecord()
obj.action(DataInsertRecord)


Example for UIObject::insertRecord
insertRecord Example

See the example for insertBeforeRecord.


See Also for UIObject::insertRecord
See Also

insertAfterRecord

insertBeforeRecord


UIObject::isContainerValid
isContainerValid

See Also	Example	UIObject Type

Method

Reports whether an object's container is valid.

Syntax

isContainerValid ( ) Logical

Description

isContainerValid reports if the current object's container is valid. For instance, a form has no container, so the ContainerName property for a form is not valid.


Example for UIObject::isContainerValid
isContainerValid Example

In the following example, the arrive built-in method for a form uses isContainerValid to check for a container:

; thisForm::arrive
method arrive(var eventInfo MoveEvent)
  if eventInfo.isPreFilter() then

     ;Code here executes before each object
  else
     ;Code here executes afterwards (or for form)
     if NOT isContainerValid() then
       msgInfo("Form",
               "This object does not have a valid container.")
     endif
  endif
endMethod


See Also for UIObject::isContainerValid
See Also

isLastMouseClickedValid


UIObject::isEdit
isEdit

See Also	Example	UIObject Type

Beginner

Method

Reports whether an object is in Edit mode.

Syntax

isEdit ( ) Logical

Description

isEdit reports whether an object is in Edit mode.


Example for UIObject::isEdit
isEdit Example

See the example for lockRecord.


See Also for UIObject::isEdit
See Also

edit

endEdit

lockRecord


UIObject::isEmpty
isEmpty

See Also	Example	UIObject Type

Method

Reports whether a table contains any records.

Syntax

isEmpty ( ) Logical

Description

isEmpty returns True if no records in the table are associated with the table frame. isEmpty respects the limits of restricted views displayed in a linked table frame or multi-record object.

You can also find out if a table is empty by checking the value returned by the nRecords method, or by checking the value of the NRecords property of the object.


Example for UIObject::isEmpty
isEmpty Example

The cascadeDelete button in the following example deletes an order and all the linked detail records for that order. Assume that a form contains a single-record object bound to the Orders tables and a linked table frame bound to the Lineitem table. Orders has a one-to-many link to Lineitem.

; cascadeDelete::pushButton
method pushButton(var eventInfo Event)
var
  ui        UIObject
endVar

if thisForm.Editing then
  if msgQuestion("Confirm", "Delete this order?") = "Yes" then
    ui.attach(LINEITEM)
    while NOT ui.isEmpty()      ; check to see if linked table is
                                ; empty---respects restricted view
      ui.deleteRecord()         ; delete the detail records
    endwhile
    ORDERS.action(DataDeleteRecord)   ; delete the master record
  endif
else
  msgInfo("Status", "You must be editing to delete a record.")
endif
endMethod


See Also for UIObject::isEmpty
See Also

empty

nRecords


UIObject::isLastMouseClickedValid
isLastMouseClickedValid

See Also	Example	UIObject Type

Method

Reports if the last object to receive a mouse click is valid.

Syntax

isLastMouseClickedValid ( ) Logical

Description

isLastMouseClickedValid reports if the current form has received a mouse click since it opened.


Example for UIObject::isLastMouseClickedValid
isLastMouseClickedValid Example

This method checks to see if a form has been clicked yet.

; thisForm::arrive
method arrive(var eventInfo MoveEvent)
   if eventInfo.isPreFilter() then
     ;Code here executes before each object
  else
     ;Code here executes afterwards (or for form)
     if NOT isLastMouseClickedValid() then
       msgInfo("FYI", "This form has not been clicked yet.")
     endif
  endif
endMethod


See Also for UIObject::isLastMouseClickedValid
See Also

islastMouseRightClickedValid


UIObject::islastMouseRightClickedValid
isLastMouseRightClickedValid

See Also	Example	UIObject Type

Method

Reports if the last object to receive a right mouse click is valid.

Syntax

isLastMouseRightClickedValid ( ) Logical

Description

isLastMouseRightClickedValid reports if the current form has received a right mouse click since it opened.


Example for UIObject::islastMouseRightClickedValid
isLastMouseRightClickedValid Example

This method checks to see if a form has been right-clicked yet.

; thisForm::arrive
method arrive(var eventInfo MoveEvent)
  if eventInfo.isPreFilter() then

     ;Code here executes before each object
  else
     ;Code here executes afterwards (or for form)
     if NOT isLastMouseRightClickedValid() then
       msgInfo("FYI", "This form has not been right-clicked yet.")
     endif
  endif
endMethod


See Also for UIObject::islastMouseRightClickedValid
See Also

isLastMouseClickedValid


UIObject::isRecordDeleted
isRecordDeleted

See Also	Example	UIObject Type

Method

Reports whether the current record has been deleted (dBASE tables only).

Syntax

isRecordDeleted ( ) Logical

Description

isRecordDeleted reports whether the current record has been deleted. isRecordDeleted works only for dBASE tables because deleted Paradox records can't be displayed. This method returns True if the current record has been deleted; otherwise, it returns False.

Deleted records in a dBASE table are not shown by default. For isRecordDeleted to work correctly, you must call TCursor::showDeleted to show deleted records in the table; otherwise, deleted records are not visible to isRecordDeleted.


Example for UIObject::isRecordDeleted
isRecordDeleted Example

See the example for TCursor::isRecordDeleted.


See Also for UIObject::isRecordDeleted
See Also

unDeleteRecord

TCursor::isShowDeletedOn

TCursor::showDeleted


UIObject::keyChar
keyChar

See Also	Example	UIObject Type

Beginner

Method

Sends an event to an object's keyChar method.

Syntax

1. keyChar ( const characters String [, const state SmallInt ] ) Logical

2. keyChar ( const ansiKeyValue SmallInt ) Logical

3. keyChar ( const ansiKeyValue SmallInt, const vChar SmallInt, const state SmallInt ) Logical

Description

keyChar constructs an event and calls the built-in keyChar method of an object with that event. Specify one or more characters in characters (syntax 1), ansiKeyValue (syntax 2), or ansiKeyValue and vChar (syntax 3). Specify the keyboard state in state using KeyboardStates constants. These constants can be added together to create combined key states, such as Alt + Control.


Example for UIObject::keyChar
keyChar Example

The following example overrides the pushButton method of a button named sendKeyChar. This method sends keystrokes to a field, called fieldOne, on the same form.

; sendKeyChar::pushButton
method pushButton(var eventInfo Event)
var
  x  SmallInt
endVar
fieldOne.keyChar("Send me an ")    ; send a string
fieldOne.keyChar(65, 65, Shift)    ; send ANSI char, decimal
                                   ; equivalent of VK_Char,
                                   ; and keyboardstate
fieldOne.keyChar(" and a ", Shift) ; send a string with the keyboardstate
x = 98                             ; set the code
fieldOne.keyChar(x)                ; send ANSI char code
endMethod


See Also for UIObject::keyChar
See Also

keyPhysical

KeyEvent


UIObject::keyPhysical
keyPhysical

See Also	Example	UIObject Type

Method

Sends an event to an object's keyPhysical method.

Syntax

keyPhysical ( const aChar SmallInt, const vChar SmallInt, const state SmallInt )

Description

keyPhysical sends an event to an object's built-in keyPhysical method. You must specify the ANSI character code in aChar, the virtual key code in vChar, and the keyboard state in state (using KeyboardStates constants).


Example for UIObject::keyPhysical
keyPhysical Example

The following code is attached to the pushButton method of a button named sendKeyPhys. This method sends the character "a" to the field fieldOne.

; sendKeyPhys::pushButton
method pushButton(var eventInfo Event)
fieldOne.keyPhysical(97, 97, Shift)   ; send an "a"
endMethod


See Also for UIObject::keyPhysical
See Also

keyChar

KeyEvent


UIObject::killTimer
killTimer

See Also	Example	UIObject Type

Method

Stops the timer associated with an object.

Syntax

killTimer ( )

Description

killTimer stops a timer associated with an object.


Example for UIObject::killTimer
killTimer Example

The following example moves a circle across the screen in response to TimerEvents. The pushButton method for toggleButton uses setTimer and killTimer to start or stop a timer, depending on the condition of the button. When the timer starts, it issues a TimerEvent every 100 milliseconds. Each TimerEvent causes toggleButton's timer method to execute. The timer method gets the current position of the ellipse with getPosition, then moves it 100 twips to the right with setPosition.

Following is the code for toggleButton's pushButton method:

; toggleButton::pushButton
method pushButton(var eventInfo Event)
if buttonLabel = "Start Timer" then  ; if stopped, then start
  buttonLabel = "Stop Timer"         ; change label
  self.setTimer(100)          ; tell timer to issue a timer
                              ; event every 100 milliseconds
else
  buttonLabel = "Start Timer"         ; change label
  self.killTimer()                    ; stop the timer
endif

endMethod

Following is the code for toggleButton's timer method:

; toggleButton::timer
;   this method is called once for every timer event
method timer(var eventInfo TimerEvent)
var
  ui          UIObject
  x, y, w, h  SmallInt
endVar

ui.attach(floatCircle)          ; attach to the circle
ui.getPosition(x, y, w, h)      ; assign coordinates to vars
if x < 4320 then                ; if not at right edge of area
  ui.setPosition(x + 100, y, w, h)  ; move to the right
else
  ui.setPosition(1440, y, w, h)     ; return to the left
endif

endMethod


See Also for UIObject::killTimer
See Also

setTimer


UIObject::locate
locate

See Also	Example	UIObject Type

Beginner

Method

Searches for a specified field value.

Syntax

1. locate ( const fieldName String, const exactMatch AnyType [ ,const fieldName String, const exactMatch AnyType ] * ) Logical

2. locate ( const fieldNum SmallInt, const exactMatch AnyType [ ,const fieldNum SmallInt, const exactMatch AnyType ] * ) Logical

Description

locate searches a table frame, multi-record object, record object, or field object for records whose values exactly match the criteria specified in one or more field/value pairs. Specify the value to search for in exactMatch and the field to search in fieldName or fieldNum (use fieldNum for faster performance). This method uses active indexes when it can to speed the search. It respects the limits of restricted views in linked detail tables.

The search always starts from the beginning of the table, but if no match is found, the cursor returns to the current record. If a match is found, the cursor moves to that record. This operation fails if the current record cannot be posted and unlocked (for example, because of a key violation).

Note:	The search is case-sensitive unless Session::ignoreCaseInLocate is on.


Example for UIObject::locate
locate Example

In the following example, assume that a form contains a table frame bound to the Customer table, and a button named locateButton. The pushButton method for locateButton attempts to find the customer named "Sight Diver" in the city "Kato Paphos". If found, the customer's name is changed to "Right Diver".

; locateButton::pushButton
method pushButton(var eventInfo Event)
var
  Cust UIObject
endVar
Cust.attach(CUSTOMER)
; find customer named "Sight Diver" in Kato Paphos
if Cust.locate("Name", "Sight Diver", "City", "Kato Paphos") then
   Cust.edit()
   Cust."Name" = "Right Diver"
   Cust.endEdit()
endIf
endMethod


See Also for UIObject::locate
See Also

locateNext

locatePattern

locateNextPattern


UIObject::locateNext
locateNext

See Also	Example	UIObject Type

Beginner

Method

Searches forward from the current record for a specified field value.

Syntax

1. locateNext ( const fieldName String, const exactMatch AnyType [ ,const fieldName String, const exactMatch AnyType ]* ) Logical

2. locateNext ( const fieldNum SmallInt, const exactMatch AnyType [ ,const fieldNum SmallInt, const exactMatch AnyType ]* ) Logical

Description

locateNext searches a table for records whose values exactly match the criteria specified in one or more field/value pairs. Specify the value to search for in exactMatch and the field to search in fieldName or fieldNum (use fieldNum for faster performance). This method uses active indexes when it can to speed the search. It respects the limits of restricted views in linked detail tables.

The search begins with the record after the current record. If a match is found, the cursor moves to that record. If no match is found, the cursor returns to the current record. To start a search from the beginning of a table, use locate.

This operation fails if the current record cannot be committed (for example, because of a key violation).

Note:	The search is case-sensitive unless Session::ignoreCaseInLocate is on.


Example for UIObject::locateNext
locateNext Example

For the following example, suppose a form contains a table frame bound to the Customer table, and one button named locateButton. The pushButton method for locateButton searches for customers in the city of Freeport. If the first locate is successful, the method uses locateNext to find successive records.

; locateButton::pushButton
method pushButton(var eventInfo Event)
var
   Cust      UIObject
   searchFor String
   numFound  SmallInt
endVar
Cust.attach(CUSTOMER)
searchFor = "Freeport"
if Cust.locate("City", searchFor) then
   numFound = 1
   message("")
   while Cust.locateNext("City", searchFor)
      numFound = numFound + 1
   endWhile
   msgInfo("Found " + searchFor, strval(numFound) + " times.")
endIf


See Also for UIObject::locateNext
See Also

locate

locateNextPattern


UIObject::locateNextPattern
locateNextPattern

See Also	Example1	Example2	UIObject Type

Method

Locates the next record containing a field that has a specified pattern of characters.

Syntax

1. locateNextPattern ( [ const fieldName String,const exactMatch AnyType, ] * const fieldName String, const pattern String ) Logical

2. locateNextPattern ( [ const fieldNum SmallInt, const exactMatch AnyType, ] * const fieldNum SmallInt, const pattern String ) Logical

Description

locateNextPattern finds substrings (for example, "comp" in "computer"). The search begins with the record after the current record. If a match is found, the cursor moves to that record. If no match is found, the cursor returns to the current record. This method uses active indexes when it can to speed the search. It respects the limits of restricted views in linked detail tables.

This operation fails if the current record cannot be committed (for example, because of a key violation). To start a search at the beginning of a table, use locatePattern.

To search for records based on the value of a single field, specify the field in fieldName or fieldNum (use fieldNum for faster performance), and specify a pattern of characters in pattern.

You can include the standard pattern operators @ and .. in the pattern argument. The .. operator stands for any string of characters (including none at all); @ stands for any single character. Any combination of literal characters and wildcards can be used in constructing a search. If advancedWildCardsInLocate (in the Session type) is on, you can use advanced match pattern operators, not the standard pattern operators. See the description of advMatch for more information about advanced match pattern operators.

To search records based on the values of more than one field, specify exact matches on all fields except the last one in the list. For example, the next statement searches the Name field for exact matches on "Borland", the Product field for "Paradox", and the Keywords field for words beginning with "data" (for example, "database").

tc.locateNextPattern("Name", "Borland"  "Product", "Paradox" "Keywords", "data..")

Note:	The search is case-sensitive unless Session::ignoreCaseInLocate is on.


Example 1 for UIObject::locateNextPattern
locateNextPattern Example 1

The following example searches for multiple occurrences of the letter "C" in the Name field of the Customer table, and writes the matching names to an array. Suppose that the CUSTOMER table frame is bound to Customer, and locateButton is a button on the same form.

; locateButton::pushButton
method pushButton(var eventInfo Event)
var
   Cust      UIObject           ; to attach to CUSTOMER table frame
   searchFor String             ; the pattern string to search for
   numFound  SmallInt           ; the number of matches located
   custNames Array[] String     ; the matches found
endVar

cust.attach(CUSTOMER)
searchFor = "C.."               ; find customers whose name
                                ; begins with C
if cust.locatePattern("Name", searchFor) then  ; if you can find one
  numFound = 1                                 ; post it to the array
  custNames.grow(1)                            ; then keep looking
  custNames[numFound] = cust."Name"
  while cust.locateNextPattern("Name", searchFor)
    numFound = numFound + 1
    custNames.grow(1)
    custNames[numFound] = cust."Name"
  endWhile
endIf
if custNames.size() > 0 then     ; if there's anything in the array
  custNames.view()               ; show the array
endIf
endMethod


Example 2 for UIObject::locateNextPattern
locateNextPattern Example 2

The following example is similar to Example 1, except that it searches for records based on the value of the City field and a pattern in the Name field:

; locateButtonTwo::pushButton
method pushButton(var eventInfo Event)
var
   Cust      UIObject           ; to attach to CUSTOMER TableFrame
   searchFor String             ; the pattern string to search for
   numFound  SmallInt           ; the number of matches located
   custNames Array[] String     ; the matches found
endVar

cust.attach(CUSTOMER)
searchFor = "..C.."             ; find customers whose name
                                ; includes a C
if cust.locatePattern("City", "Marathon", "Name", searchFor) then  ; if you can find one
  numFound = 1                                 ; post it to the array
  custNames.grow(1)                            ; then keep looking
  custNames[numFound] = cust."Name"
  while cust.locateNextPattern("City", "Marathon", "Name", searchFor)
    numFound = numFound + 1
    custNames.grow(1)
    custNames[numFound] = cust."Name"
  endWhile
endIf
if custNames.size()  0 then     ; if there's anything in the array
  custNames.view()               ; show the array
endIf
endMethod


See Also for UIObject::locateNextPattern
See Also

locate

locatePattern

locateNext

String::advMatch

String::match

Paradox Help: Sample Search Strings with Wildcards


UIObject::locatePattern
locatePattern

See Also	Example	UIObject Type

Method

Searches for a record containing a field that has a specified pattern of characters.

Syntax

1. locatePattern ( [ const fieldName String, const exactMatch AnyType, ] * const fieldName String, const pattern String ) Logical

2. locatePattern ( [ const fieldNum SmallInt, const exactMatch AnyType, ] * const fieldName SmallInt, const pattern String ) Logical

Description

locatePattern finds substrings (for example, "comp" in "computer"). This method uses active indexes when it can to speed the search. This method respects the limits of restricted views in linked detail tables.

The search always starts at the beginning of the table, but if no match is found, the cursor returns to the current record. If a match is found, the cursor moves to that record. This operation fails if the current record cannot be committed (for example, because of a key violation).

To search for records based on the value of a single field, specify the field in fieldName or fieldNum (use fieldNum for faster performance), and specify a pattern of characters in pattern.

You can include the standard pattern operators @ and .. in the pattern argument. The .. operator stands for any string of characters (including none at all); @ stands for any single character. Any combination of literal characters and wildcards can be used in constructing a search. If advancedWildCardsInLocate (in the Session type) is on, you can use advanced match pattern operators, not the standard pattern operators. See the description of advMatch for more information about advanced match pattern operators.

To search records based on the values of more than one field, specify exact matches on all fields except the last one in the list. For example, the next statement searches the Name field for exact matches on "Borland", the Product field for "Paradox," and the Keywords field for words beginning with "data" (for example, database).

To start a search after the current record, use locateNextPattern.

tc.locatePattern("Name", "Borland"  "Product", "Paradox" "Keywords", "data..")

Note:	The search is case-sensitive unless Session::ignoreCaseInLocate is on.


Example for UIObject::locatePattern
locatePattern Example

See the example for locateNextPattern.


See Also for UIObject::locatePattern
See Also

locateNextPattern

locate

String::advMatch

String::match

Paradox Help: Sample Search Strings with Wildcards


UIObject::locatePrior
locatePrior

See Also	Example	UIObject Type

Method

Searches backward for a specified field value.

Syntax

1. locatePrior ( const fieldName String, const exactMatch AnyType [ ,const fieldName String, const exactMatch AnyType ]* ) Logical

2. locatePrior ( const fieldNum SmallInt, const exactMatch AnyType [ ,const fieldNum SmallInt, const exactMatch AnyType ]* ) Logical

Description

locatePrior searches backwards from the current record in a table for records whose values exactly match the criteria specified in one or more field/value pairs. Specify the value to search for in exactMatch and the field to search in fieldName or fieldNum (use fieldNum for faster performance). This method uses active indexes when it can to speed the search. It respects the limits of restricted views in linked detail tables.

The search begins with the record before the current record and moves up through the table. If a match is found, the cursor moves to that record. If no match is found, the cursor returns to the current record. To start a search from the beginning of a table, use locate.

This operation fails if the current record cannot be committed (for example, because of a key violation).

Note:	The search is case-sensitive unless Session::ignoreCaseInLocate is on.


Example for UIObject::locatePrior
locatePrior Example

The method shown in the following example locates the last occurrence of a value in a table by moving to the end of the table and using locatePrior to search up for a match. Assume that the form contains a table frame bound to the Customer table, and one button named locateButton.

; locateButton::pushButton
method pushButton(var eventInfo Event)
var
   Cust      UIObject      ; to attach to CUSTOMER table frame
   searchFor String        ; the string to search for
endVar
Cust.attach(CUSTOMER)      ; attach to table frame
Cust.end()                 ; move to the end of the table
searchFor = "Freeport"
if Cust.locatePrior("City", searchFor) then   ; find record
   msgInfo("Status", "The last record with a City of " +
           searchFor + " is record " + Cust.recno + ".")
endIf

endMethod


See Also for UIObject::locatePrior
See Also

locate

locatePriorPattern


UIObject::locatePriorPattern
locatePriorPattern

See Also	Example	UIObject Type

Method

Locates the prior record containing a field that has a specified pattern of characters.

Syntax

1. locatePriorPattern ( [ const fieldName String,const exactMatch AnyType, ] * const fieldName String, const pattern String ) Logical

2. locatePriorPattern ( [ const fieldNum SmallInt, const exactMatch AnyType, ] * const fieldNum SmallInt, const pattern String ) Logical

Description

locatePriorPattern finds substrings (for example, "comp" in "computer"). This method uses active indexes when it can to speed the search. This method respects the limits of restricted views in linked detail tables.

The search begins with the record before the current record and moves up through the table. If a match is found, the cursor moves to that record. If no match is found, the cursor returns to the current record. This method uses active indexes when it can to speed the search.

This operation fails if the current record cannot be committed (for example, because of a key violation). To start a search at the beginning of a table, use locatePattern.

To search for records based on the value of a single field, specify the field in fieldName or fieldNum (use fieldNum for faster performance), and specify a pattern of characters in pattern.

You can include the standard pattern operators @ and .. in the pattern argument. The .. operator stands for any string of characters (including none at all); @ stands for any single character. Any combination of literal characters and wildcards can be used in constructing a search. If advancedWildCardsInLocate (in the Session type) is on, you can use advanced match pattern operators, not the standard pattern operators. See the description of advMatch for more information about advanced match pattern operators.

To search records based on the values of more than one field, specify exact matches on all fields except the last one in the list. For example, the next statement searches the Name field for exact matches on "Borland", the Product field for "Paradox", and the Keywords field for words beginning with "data" (for example, "database").

obj.locatePriorPattern("Name", "Borland"  "Product", "Paradox" "Keywords", "data*")

Note:	The search is case-sensitive unless Session::ignoreCaseInLocate is on.


Example for UIObject::locatePriorPattern
locatePriorPattern Example

The method shown in the following example locates the last occurrence of a value in a table by moving to the end of the table and using locatePriorPattern. Assume that the form contains a table frame bound to the Customer table, and one button named locateButton.

; locateButton::pushButton
method pushButton(var eventInfo Event)
var
   Cust      UIObject      ; to attach to CUSTOMER table frame
   searchFor String        ; the string to search for
endVar
Cust.attach(CUSTOMER)      ; attach to table frame
Cust.end()                 ; move to the end of the table
searchFor = "Freeport"
if Cust.locatePrior("City", searchFor, "Name", "..C..") then   ; find record
   msgInfo("Status", "The last record with a City of " + searchFor +
           "and a name with C is record " + Cust.recno + ".")
endIf

endMethod


See Also for UIObject::locatePriorPattern
See Also

locatePattern

locatePrior

String::advMatch

String::match

Paradox Help: Sample Search Strings with Wildcards


UIObject::lockRecord
lockRecord

See Also	Example1	Example2	UIObject Type

Beginner

Method

Puts a write lock on the current record.

Syntax

lockRecord ( ) Logical

Description

lockRecord returns True if it successfully places an explicit write lock on the current record; otherwise, it returns False. If the record already exists, it is locked and becomes the current record.

Note:	The Locked property is a read-only property. You can examine the property to find out whether an object is locked, but you can't change the property to lock or unlock an object.


Example 1 for UIObject::lockRecord
lockRecord Example 1

The following example first checks to see if the Customer table is in Edit mode. If so, the method locates a record, attempts to lock it with lockRecord, then checks the status of the lock with recordStatus. Assume that a form contains a table frame bound to the Customer table, and a button named lockButton. Assume also that the record inside the CUSTOMER table frame is named custRec.

; lockButton::pushButton
method pushButton(var eventInfo Event)
var
  obj  UIObject
endVar
obj.attach(CUSTOMER)
obj.locate("Name", "Sight Diver")
if thisForm.editing then
if CUSTOMER.isEdit() then
  if NOT obj.lockRecord() then
     msgStop("Lock failed", "recordStatus(\"Locked\") is " +
             String(obj.recordStatus("Locked")))
  else
     msgStop("Lock succeeded", "recordStatus(\"Locked\") is " +
             String(obj.recordStatus("Locked")))
     obj.custRec."Name" = "Right Diver"  ; quotes on Name indicate
                                         ; field name instead of property
     obj.unlockRecord()
  endif
else
  msgInfo("Status", "You must be in edit mode to lock and change records.")
endif
endMethod


Example 2 for UIObject::lockRecord
lockRecord Example 2

The following example shows how you can examine the Locked property for a record object to determine if the record is locked. This example behaves roughly the same as Example 1.

; lockButtonTwo::pushButton
method pushButton(var eventInfo Event)
var
  obj,
  recObj  UIObject
endVar

obj.attach(CUSTOMER)
obj.locate("Name", "Sight Diver")

if thisForm.editing then
  obj.lockRecord()                 ; no write access to Locked property
                                   ; so use method to lock record
  recObj.attach(CUSTOMER.custRec)
  if NOT recObj.Locked then        ; check the property to see
                                   ; if the record is locked
     msgStop("Lock failed", "recObj.Locked is " +
             String(recObj.Locked))
  else
     msgStop("Lock succeeded", "recObj.Locked is " +
             String(recObj.Locked))
     recObj."Name" = "Right Diver" ; name is in quotes to indicate Name
                                   ; field instead of obj's Name property
     obj.unlockRecord()
  endif
else
  msgInfo("Status", "You must be in edit mode to lock and change records.")
endIf
endMethod


See Also for UIObject::lockRecord
See Also

postRecord

recordStatus

unlockRecord


UIObject::lockStatus
lockStatus

See Also	Example	UIObject Type

Method

Returns the number of locks on a table.

Syntax

lockStatus (const lockType String ) SmallInt

Description

lockStatus returns the number of times you've placed a lock of type lockType on a table, where lockType is one of "Write", "Read", or "Any".

If you haven't placed any locks of a given type, lockStatus returns 0.

If you specify "Any" for lockType, lockStatus returns the total number of locks you've placed on the table. lockStatus only reports on locks you've placed explicitly, not on locks placed by Paradox or by other users or applications.


Example for UIObject::lockStatus
lockStatus Example

The following example assumes that a form has a table frame named CUSTOMER bound to the Customer table, and a button named lockButton. The pushButton method for lockButton removes all locks from CUSTOMER, checks for locks with lockStatus, places a lock, then reports on the locks with lockStatus again.

; lockButton::pushButton
method pushButton(var eventInfo Event)
var
  CustTC TCursor     ; to place a lock on the table
  Cust UIObject
  l    Logical
endVar
CustTC.attach(CUSTOMER)     ; attach the TCursor to CUSTOMER
l = unlock(CustTC, "ALL")   ; remove any locks
l.view("Unlock successful:")
Cust.attach(CUSTOMER)       ; attach the UIObject to CUSTOMER
if Cust.lockStatus("ANY") = 0 then   ; check for locks
   l = lock(CustTC, "WL")            ; place a write lock
   l.view("Lock successful:")        ; check up on it
endif
msgInfo("Status", "Table " + Cust.Name + " has " +
         String(Cust.lockStatus("WL")) + " write lock(s).")
unlock(CustTC, "ALL")                ; remove any locks
endMethod


See Also for UIObject::lockStatus
See Also

enumLocks

lockRecord


UIObject::menuAction
menuAction

See Also	Example	UIObject Type

Method/Procedure

Sends an event to an object's menuAction method.

Syntax

menuAction ( const action SmallInt )

Description

menuAction constructs a MenuEvent and sends it to a specified UIObject's menuAction method. action is one of the MenuCommands constants, or a user-defined menu constant.

Note:	You can't use menuAction to send a menu command constant that is equivalent to a command on the File menu. To simulate a File menu command, use one of the regular Action constants, manipulate a property, or use one of the many System type methods that emulate File menu commands.


Example for UIObject::menuAction
menuAction Example

In the following example, the sendATile button on the current form opens sends the form (thisForm) a MenuWindowTile action.

; sendATile::pushButton
method pushButton(var eventInfo Event)
thisForm.menuAction(MenuWindowTile)
endMethod


See Also for UIObject::menuAction
See Also

action


UIObject::methodDelete
methodDelete

See Also	Example	UIObject Type

Method

Deletes a specified method.

Syntax

methodDelete ( const methodName String ) Logical

Description

methodDelete deletes the method specified by methodName. The form that contains the object must be in Form Design window.


Example for UIObject::methodDelete
methodDelete Example

The following example uses methodGet, methodSet, and methodDelete to copy methods from one object to another. The method shown here overrides the pushButton method for a button named copyMethods. Four other objects are on the same form: the targetForm field lets you specify the name of the form containing the objects to copy; the sourceObject field holds the name of the object containing the methods to copy; the destinationObject field contains the name of the object to copy the methods to; and a radio button field, named copyOrMove, lets you specify whether methods in the source should be copied, or copied then deleted.

; copyMethods::pushButton
method pushButton(var eventInfo Event)
var
  otherForm            Form       ; a handle to a form
  sourceObj,                      ; object to copy from
  destObj              UIObject   ; object to copy to
  methodStr            String     ; stores the method definition
  methodArray Array[]  String     ; holds method names to copy
  i                    SmallInt   ; array index
endvar

; open the form and attach to the objects
if targetForm = "" OR sourceObject = "" OR destinationObject = "" then
  msgStop("Error", "Please fill in form, source, and destination.")
  return
endif
if NOT otherForm.load(targetForm.value) then
  msgStop("Error", "Couldn't open named form.")
  return
endif
if NOT sourceObj.attach(otherForm, sourceObject.value) then
  otherForm.close()
  msgStop("Error", "Couldn't find source object. Please specify entire path.")
  return
endif
if NOT destObj.attach(otherForm, destinationObject.value) then
  otherForm.close()
  msgStop("Error", "Couldn't find destination object. Specify entire path.")
  return
endif

; set up the array of method names to copy
methodArray.addLast("mouseUp")
methodArray.addLast("mouseDown")
methodArray.addLast("mouseDouble")
methodArray.addLast("mouseEnter")
methodArray.addLast("mouseExit")
methodArray.addLast("mouseRightUp")
methodArray.addLast("mouseRightDown")
methodArray.addLast("mouseRightDouble")
methodArray.addLast("mouseMove")
methodArray.addLast("open")
methodArray.addLast("close")
methodArray.addLast("canArrive")
methodArray.addLast("arrive")
methodArray.addLast("setFocus")
methodArray.addLast("canDepart")
methodArray.addLast("depart")
methodArray.addLast("removeFocus")
methodArray.addLast("depart")
methodArray.addLast("timer")
methodArray.addLast("keyPhysical")
methodArray.addLast("keyChar")
methodArray.addLast("action")
methodArray.addLast("menuAction")
methodArray.addLast("error")
methodArray.addLast("status")

; add the method names specific to fields and buttons
if sourceObj.class = "Field" AND destObj.class = "Field" then
  methodArray.addLast("changeValue")
  methodArray.addLast("newValue")
else
if sourceObj.class = "Button" AND destObj.class = "Button" then
  methodArray.addLast("pushButton")
endif
if sourceObj.class <> "Button" AND destObj.class <> "Button" then
  methodArray.addLast("mouseClick")
endif

; copy methods from sourceObj to destObj on form otherForm
for i from 1 to methodArray.size()
  ; write the method named in methodArray to the string
;  msgInfo("methodArray is", methodArray[i])
  try
    methodStr = sourceObj.methodGet(methodArray[i])
    msgInfo("FYI", "Retrieved " + methodArray[i] + " method.")
    ; write the string to the method named in methodArray
    destObj.methodSet(methodArray[i], methodStr)
    if copyOrMove.Value = "Move" then
      sourceObj.methodDelete(methodArray[i])
    endif
  onfail
  ;  loop
  endTry
endfor

endMethod


See Also for UIObject::methodDelete
See Also

create

methodGet

methodSet


UIObject::methodGet
methodGet

See Also	Example	UIObject Type

Method

Returns the text of a specified method.

Syntax

methodGet ( const methodName String ) String

Description

methodGet returns a string containing the text of the method specified in methodName.


Example for UIObject::methodGet
methodGet Example

See the example for methodDelete.


See Also for UIObject::methodGet
See Also

create

methodDelete

methodSet


UIObject::methodSet
methodSet

See Also	Example	UIObject Type

Method

Sets the text of a specified method.

Syntax

methodSet ( const methodName String, const methodText String ) Logical

Description

methodSet specifies in methodText the source code for the method named in methodName. The form that contains the object should be in Design mode.


Example for UIObject::methodSet
methodSet Example

See the example for methodDelete.


See Also for UIObject::methodSet
See Also

create

methodDelete

methodGet


UIObject::mouseClick
mouseClick

See Also	Example	UIObject Type

Method

Sends an event to an object's mouseClick method.

Syntax

mouseClick ( ) Logical

Description

mouseClick constructs a mouseClick MouseEvent and calls the built-in mouseClick method of an object with that event.


Example for UIObject::mouseClick
mouseClick Example

The following example sends a mouseClick MouseEvent to fieldTwo on the same form:

; sendMouseClick::pushButton
method pushButton(var eventInfo Event)
; send a mouseClick to fieldTwo
fieldTwo.mouseClick()
endMethod


See Also for UIObject::mouseClick
See Also

mouseUp


UIObject::mouseDouble
mouseDouble

See Also	Example	UIObject Type

Method

Sends an event to an object's mouseDouble method.

Syntax

mouseDouble ( const x LongInt, const y LongInt, const state SmallInt ) Logical

Description

mouseDouble constructs a double-click event and calls the built-in mouseDouble method of an object with that event. The event will have the coordinates specified in x and y (in twips). Specify the mouse and keyboard state in state using KeyboardStates constants. These constants can be added together to create combined key states, such as Control + LeftButton.


Example for UIObject::mouseDouble
mouseDouble Example

The following example sends a double-click to fieldTwo on the same form:

; sendMouseDouble::pushButton
method pushButton(var eventInfo Event)
; send a mouseDouble to fieldTwo
fieldTwo.mouseDouble(100, 100, LeftButton)
endMethod


See Also for UIObject::mouseDouble
See Also

mouseRightDouble

mouseDown

mouseUp


UIObject::mouseDown
mouseDown

See Also	Example	UIObject Type

Method

Sends an event to an object's mouseDown method.

Syntax

mouseDown ( const x LongInt, const y LongInt, const state SmallInt ) Logical

Description

mouseDown constructs an event and calls the built-in mouseDown method of an object with that event. The event will have the coordinates specified in x and y (in twips). Specify the mouse and keyboard state in state using KeyboardStates constants. These constants can be added together to create combined key states, such as LeftButton + Control.


Example for UIObject::mouseDown
mouseDown Example

The following example sends a mouseDown and a mouseUp MouseEvent to the object fieldOne on the same form:

method pushButton(var eventInfo Event)
var
  fPt  Point
endVar
fPt = fieldOne.Position
fieldOne.mouseDown(fPt.x(), fPt.y(), LeftButton)
sleep(500)
fieldOne.mouseUp(fPt.x(), fPt.y(), LeftButton)
endMethod


See Also for UIObject::mouseDown
See Also

mouseUp

mouseDouble

mouseRightDown

mouseRightUp


UIObject::mouseEnter
mouseEnter

See Also	Example	UIObject Type

Method

Sends an event to an object's mouseEnter method.

Syntax

mouseEnter ( const x LongInt, const y LongInt, const state SmallInt ) Logical

Description

mouseEnter constructs an event and calls the built-in mouseEnter method of an object with that event. The event will have the coordinates specified in x and y (in twips). Specify the mouse and keyboard state in state using KeyboardStates constants. These constants can be added together to create combined key states, such as LeftButton + Control.


Example for UIObject::mouseEnter
mouseEnter Example

The following example sends a mouseEnter MouseEvent to a field named fieldSix on the same form:

; sendMouseEnter::pushButton
method pushButton(var eventInfo Event)
; send a mouseEnter to fieldSix
fieldSix.mouseEnter(100,100,LeftButton)
endMethod


See Also for UIObject::mouseEnter
See Also

mouseExit

mouseMove


UIObject::mouseExit
mouseExit

See Also	Example	UIObject Type

Method

Sends an event to an object's mouseExit method.

Syntax

mouseExit ( const x LongInt, const y LongInt, const state SmallInt ) Logical

Description

mouseExit constructs an event and calls the built-in mouseExit method of an object with that event. The event will have the coordinates specified in x and y (in twips). Specify the mouse and keyboard state in state using KeyboardStates constants. These constants can be added together to create combined key states, such as LeftButton + Control.


Example for UIObject::mouseExit
mouseExit Example

The following example sends a mouseExit MouseEvent to fieldSeven on the same form:

; sendMouseExit::pushButton
method pushButton(var eventInfo Event)
; send a mouseExit to fieldSeven
fieldSeven.mouseExit(100, 100, LeftButton)
endMethod


See Also for UIObject::mouseExit
See Also

mouseEnter

mouseMove


UIObject::mouseMove
mouseMove

See Also	Example	UIObject Type

Method

Sends an event to an object's mouseMove method.

Syntax

mouseMove ( const x LongInt, const y LongInt, const state SmallInt ) Logical

Description

mouseMove constructs an event and calls the built-in mouseMove method of an object with that event. The event will have the coordinates specified in x and y (in twips). Specify the mouse and keyboard state in state using KeyboardStates constants. These constants can be added together to create combined key states, such as LeftButton + Control.


Example for UIObject::mouseMove
mouseMove Example

The following example sends a mouseDown, a mouseUp, and a mouseMove MouseEvent to a field named fieldFive on the same form:

; sendMouseMove::pushButton
method pushButton(var eventInfo Event)
fieldFive.mouseDown(100, 100, LeftButton)
fieldFive.mouseUp(100, 100, LeftButton)
; send a mouseMove to fieldFive
fieldFive.mouseMove(100, 100, LeftButton)
endMethod


See Also for UIObject::mouseMove
See Also

mouseEnter

mouseExit


UIObject::mouseRightDouble
mouseRightDouble

See Also	Example	UIObject Type

Method

Sends an event to an object's mouseRightDouble method.

Syntax

mouseRightDouble ( const x LongInt, const y LongInt, const state SmallInt ) Logical

Description

mouseRightDouble constructs an event and calls the built-in mouseRightDouble method of an object with that event. The event will have the coordinates specified in x and y (in twips). Specify the mouse and keyboard state in state using KeyboardStates constants. These constants can be added together to create combined key states, such as LeftButton + Control.


Example for UIObject::mouseRightDouble
mouseRightDouble Example

The following example sends a mouseRightDouble MouseEvent to a field named fieldTwo on the same form:

; sendMouseDouble::pushButton
method pushButton(var eventInfo Event)
; send a mouseDouble to fieldTwo
fieldTwo.mouseDouble(100, 100, LeftButton)
endMethod


See Also for UIObject::mouseRightDouble
See Also

mouseDouble

mouseRightUp

mouseRightDown


UIObject::mouseRightDown
mouseRightDown

See Also	Example	UIObject Type

Method

Sends an event to an object's mouseRightDown method.

Syntax

mouseRightDown ( const x LongInt, const y LongInt, const state SmallInt ) Logical

Description

mouseRightDown constructs an event and calls the built-in mouseRightDown method of an object with that event. The event will have the coordinates specified in x and y (in twips).  Specify the mouse and keyboard state in state using KeyboardStates constants. These constants can be added together to create combined key states, such as LeftButton + Control.


Example for UIObject::mouseRightDown
mouseRightDown Example

The following example sends a mouseRightDown and a mouseRightUp MouseEvent to a field named fieldThree on the same form:

; sendMouseRightUp::pushButton
method pushButton(var eventInfo Event)
var
  fPt Point
endVar
fP = fieldThree.position    ; get the position, send a mouseRightDown
fieldThree.mouseRightDown(fPt.x(), fPt.y(), LeftButton)
sleep(500)                  ; pause, then send a mouseRightUp
fieldThree.mouseRightUp(fPt.x(), fPt.y(), LeftButton)
endMethod


See Also for UIObject::mouseRightDown
See Also

mouseRightUp

mouseRightDouble

mouseUp

mouseDown


UIObject::mouseRightUp
mouseRightUp

See Also	Example	UIObject Type

Method

Sends an event to an object's mouseRightUp method.

Syntax

mouseRightUp ( const x LongInt, const y LongInt, const state SmallInt ) Logical

Description

mouseRightUp constructs an event and calls the built-in mouseRightUp method of an object with that event. The event will have the coordinates specified in x and y (in twips).  Specify the mouse and keyboard state in state using KeyboardStates constants. These constants can be added together to create combined key states, such as LeftButton + Control.


Example for UIObject::mouseRightUp
mouseRightUp Example

The following example sends a mouseRightDown and a mouseRightUp MouseEvent to a field named fieldThree on the same form:

; sendMouseRightUp::pushButton
method pushButton(var eventInfo Event)
var
  fPt Point
endVar
fP = fieldThree.position    ; get the position, send a mouseRightDown
fieldThree.mouseRightDown(fPt.x(), fPt.y(), LeftButton)
sleep(500)                  ; pause, then send a mouseRightUp
fieldThree.mouseRightUp(fPt.x(), fPt.y(), LeftButton)
endMethod


See Also for UIObject::mouseRightUp
See Also

mouseRightDown

mouseRightDouble

mouseDown

mouseUp


UIObject::mouseUp
mouseUp

See Also	Example	UIObject Type

Method

Sends an event to an object's mouseUp method.

Syntax

mouseUp ( const x LongInt, const y LongInt, const state SmallInt ) Logical

Description

mouseUp constructs an event and calls the built-in mouseUp method of an object with that event. The event will have the coordinates specified in x and y (in twips). Specify the mouse and keyboard state in state using KeyboardStates constants. These constants can be added together to create combined key states, such as LeftButton + Control.


Example for UIObject::mouseUp
mouseUp Example

The following example sends a mouseDown and a mouseUp MouseEvent o the object fieldOne on the same form:

method pushButton(var eventInfo Event)
var
  fPt  Point
endVar
fPt = fieldOne.Position
fieldOne.mouseDown(fPt.x(), fPt.y(), LeftButton)
sleep(500)
fieldOne.mouseUp(fPt.x(), fPt.y(), LeftButton)
endMethod


See Also for UIObject::mouseUp
See Also

mouseDown

mouseDouble

mouseRightDown

mouseRightUp

mouseRightDouble


UIObject::moveTo
moveTo

See Also	Example	UIObject Type

Beginner

Method

Sets the focus to a specified object.

Syntax

1. (Method) moveTo ( ) Logical

2. (Procedure) moveTo ( const objectName String ) Logical

Description

moveTo moves the focus to a specified object. When you call moveTo as a procedure (syntax 2), objectName specifies the name of the object to move to (the destination object).


Example for UIObject::moveTo
moveTo Example

In the following example, assume a form contains a table frame bound to Orders, and another table frame bound to LineItem. Orders has a one-to-many link to LineItem. A button named findDetails is also on the form. Suppose you want to be able to search through the entire LineItem table---not just through those records linked to the current order. In this case, the pushButton method for findDetails searches for orders that include the current part number.

This code is attached to the Var window for findDetails:

; findDetails::Var
Var
  lineTC TCursor  ; instance of LINEITEM for searching
endVar

; findDetails::open
method open(var eventInfo Event)
lineTC.open("LineItem.db")
endMethod

Following is the code for findDetails' pushButton method:

; findDetails::pushButton
method pushButton(var eventInfo Event)
var
  stockNum  Number
  orderTC    TCursor
  OrderNum    Number
endVar

; get Stock No from current LineItem
stockNum = LINEITEM.lineRecord."Stock No"
; lineTC was declared in Var window and opened by open method
if NOT lineTC.locateNext("Stock No", stockNum) then
  lineTC.locate("Stock No", stockNum)
endif
orderTC.attach(ORDERS)
orderTC.locate("Order No", lineTC."Order No")
ORDERS.moveToRecord(orderTC)       ; move to CUSTOMER and
                             ; resynchronize with TCursor
LINEITEM.lineRecord."Stock No".moveTo()   ; move cursor to LINEITEM detail
; move cursor to matching record
LINEITEM.locate("Stock No", stockNum)
endMethod

Following is the code for findDetails' close method:

; findDetails::close
method close(var eventInfo Event)
lineTC.close()   ; close the TCursor to LineItem
endMethod


See Also for UIObject::moveTo
See Also

attach


UIObject::moveToRecNo
moveToRecNo

See Also	Example	UIObject Type

Method

Moves to a specific record in a dBASE table.

Syntax

moveToRecNo ( const recordNum LongInt ) Logical

Description

moveToRecNo sets the current record to the record recordNum. It returns an error if recordNum is not in the table. Use the method nRecords or examine the NRecords property to find out how many records a table contains. This method is recommended only for dBASE tables; moveToRecord is recommended for Paradox tables.


Example for UIObject::moveToRecNo
moveToRecNo Example

The following example moves to the midpoint of a table. Assume that a form contains a table frame bound to the LineItem table, and a button called MidWay.

; MidWay::pushButton
method pushButton(var eventInfo Event)
var
  halfWay  LongInt
endVar

halfWay = LongInt(LINEITEM.nRecords()/2)
LINEITEM.moveToRecNo(halfWay)

endMethod


See Also for UIObject::moveToRecNo
See Also

nRecords

moveToRecord

resync


UIObject::moveToRecord
moveToRecord

See Also	Example	UIObject Type

Method

Moves to a specific record in a table.

Syntax

1. moveToRecord ( const recordNum LongInt ) Logical

2. moveToRecord ( const tc TCursor ) Logical

Description

moveToRecord sets the current record.

Syntax 1 moves to the record number specified in recordNum. It returns an error if recordNum is greater than the number of records in the table. Use the method nRecords or examine the NRecords property to find out how many records a table contains.

Syntax 2 moves to the record pointed to by the TCursor tc. This method can be very slow for dBASE tables; use moveToRecNo instead.


Example for UIObject::moveToRecord
moveToRecord Example

For an example of how to use moveToRecord with a TCursor, see the example for moveTo.

The following example moves to the midpoint of a table. Assume that a form contains a table frame bound to the LineItem table, and a button called MidWay.

; MidWay::pushButton
method pushButton(var eventInfo Event)
var
  halfWay  LongInt
endVar

halfWay = LongInt(LINEITEM.nRecords()/2)
LINEITEM.moveToRecord(halfWay)

endMethod


See Also for UIObject::moveToRecord
See Also

nRecords

moveTo

moveToRecNo

resync


UIObject::nextRecord
nextRecord

See Also	Example	UIObject Type

Beginner

Method

Moves to the next record in a table.

Syntax

nextRecord ( ) Logical

Description

nextRecord sets the current record to the next record in a table. It returns an error if the cursor is already at the last record.

nextRecord has the same effect as the action constant DataNextRecord, so the following statements are equivalent:

obj.nextRecord()
obj.action(DataNextRecord)


Example for UIObject::nextRecord
nextRecord Example

The following example moves to the next record in the Customer table. Assume that Customer is bound to a table frame on the form; moveToNext is a button on the same form.

; moveToNext::pushButton
method pushButton(var eventInfo Event)
if NOT CUSTOMER.atLast() then
  CUSTOMER.nextRecord()  ; move to the next record
  ; same as:  CUSTOMER.action(DataNextRecord)
  msgInfo("What record?", CUSTOMER.recno)
else
  msgInfo("Status", "Already at the last record.")
endif
endMethod


See Also for UIObject::nextRecord
See Also

home

end

priorRecord

moveToRecord


UIObject:: nFields
nFields

See Also	Example	UIObject Type

Method

Returns the number of fields in a table.

Syntax

nFields ( ) LongInt

Description

nFields returns the number of fields in a table.

Note:	To find the number of columns displayed in an object bound to a table, examine the value of the NCols property for that object.


Example for UIObject:: nFields
nFields Example

The following example reports on the number of fields and key fields in the LineItem table. Assume that a form has a table frame named LINEITEM bound to the LineItem table, and a button named tableStats.

; tableStats::pushButton
method pushButton(var eventInfo Event)
msgInfo("Status", "The LineItem table has " +
        String(LINEITEM.nFields()) + " fields and " +
        String(LINEITEM.nKeyFields()) + " key fields." +
        "\nThere are " + String(LINEITEM.NCols) +
        " columns in the table frame.")
endMethod


See Also for UIObject:: nFields
See Also

nKeyFields

nRecords


UIObject::nKeyFields
nKeyFields

See Also	Example	UIObject Type

Method

Returns the fields in the current index.

Syntax

nKeyFields ( ) LongInt

Description

nKeyFields returns the number of fields in the current index associated with a UIObject.


Example for UIObject::nKeyFields
nKeyFields Example

See the example for nFields.


See Also for UIObject::nKeyFields
See Also

nFields

nRecords


UIObject::nRecords
nRecords

See Also	Example	UIObject Type

Beginner

Method

Returns the number of records in a table.

Syntax

nRecords ( ) LongInt

Description

nRecords returns the number of records in the table bound to a table frame, multirecord object, or field object. You can also examine the NRecords property for an object to find the number of records in the table bound to that object. Either operation can take a long time for dBASE tables and large Paradox tables.

The nRecords method and the NRecords property respect the limits of restricted views. If a table-based object is the detail table in a one-to-many relationship, nRecords reports the number of linked detail records, not the total number of records in the entire table.

Note:	When you call nRecords after setting a filter, the returned value does not represent the number of records in the filtered set. To get that information, attach a TCursor to the UIObject and call cCount. When you call nRecords after setting a range, the returned value represents the number of records in the set defined by the range.

When working with a Paradox table, nRecords returns the number of records in the underlying table, not the number of records displayed in the object. For example, suppose the Customer table contains 100 records, but a table frame bound to the Customer table displays 5 records. This method would return 100, not 5.

When working with a dBASE table, nRecords counts deleted records if the form displays them. If the form does not display them, deleted records are not counted. To make a form display deleted records, choose Form | Show Deleted, or call action(DataShowDeleted) or action(DataToggleDeleted).


Example for UIObject::nRecords
nRecords Example

The following example moves to the midpoint of a table. Assume that a form contains a table frame named LINEITEM bound to the LineItem table, and a button called MidWay.

; MidWay::pushButton
method pushButton(var eventInfo Event)
var
  halfWay  LongInt
endVar

halfWay = LongInt(LINEITEM.nRecords()/2)
LINEITEM.moveToRecord(halfWay)

endMethod


See Also for UIObject::nRecords
See Also

moveToRecord

nKeyFields

nFields


UIObject::pixelsToTwips
pixelsToTwips

See Also	Example	UIObject Type

Method

Converts screen coordinates from pixels to twips.

Syntax

pixelsToTwips ( const pixels Point ) Point

Description

pixelsToTwips converts the screen coordinates specified in pixels from pixels to twips. A pixel (the name comes from picture element) is a dot on the screen, and a twip is a device-independent unit equal to 1/1440 of a logical inch (1/20 of a printer's point).


Example for UIObject::pixelsToTwips
pixelsToTwips Example

The next example assumes that a form contains a two-inch square box named twoSquare. The twoSquare box contains two text boxes: pixNum to display the width of the box in pixels and twipNum to display the width in twips.

; twoSquare::mouseUp
method mouseUp(var eventInfo MouseEvent)
var
  twTopLeft,             ; top left point in twips
  twBottomRight,         ; bottom right point in twips
  pxTopLeft,             ; top left in pixels
  pxBottomRight,         ; bottom right in pixels
  selfPos      Point     ; current position property
endvar
self.getBoundingBox(twTopLeft, twBottomRight)    ; returns points in twips
twipNum.Text = twBottomRight.x() - twTopLeft.x() ; get the width in twips
pxTopLeft = TwipsToPixels(twTopLeft)             ; convert to pixels
pxBottomRight = TwipsToPixels(twBottomRight)
pixNum.Text = pxBottomRight.x() - pxTopLeft.x()  ; get the width in pixels
; cross check
twTopLeft = PixelsToTwips(pxTopLeft)      ; convert from pixels back to twips
twTopLeft.view("Top left in twips")       ; twTopLeft should match selfPos
selfPos = self.Position                   ; get selfPos, twips by default
selfPos.view("Position of box in twips")  ; show the result
endMethod


See Also for UIObject::pixelsToTwips
See Also

twipsToPixels


UIObject::postAction
postAction

See Also	Example	UIObject Type

Method

Posts an action to an action queue for delayed execution.

Syntax

postAction ( const actionId SmallInt )

Description

postAction works like action, except that the action is not executed immediately. Instead, the action specified by actionID is posted to an action queue at the time of the method call; Paradox waits until a yield occurs (for example, by the current method completing execution or by a call to sleep).

The value of actionID can be a user-defined action constant or a constant from one of the following Action classes:

ActionDataCommands

ActionEditCommands

ActionFieldCommands

ActionMoveCommands

ActionSelectCommands


Example for UIObject::postAction
postAction Example

The following example demonstrates how to store a value from a calculated field into a table. In this example, an unbound calculated field object named fldLineTotal calculates the line total. Whenever the calculation occurs, postAction is used to send a custom user action that posts the value to a table frame bound to the Lineitem table.

The following code defines the calculation for the calculated field.

;fldLineTotal :: Calculation

[LINEITEM.SELLING PRICE]*[LINEITEM.QTY]	;Calculated field.

The following code is attached to the field object's built-in newValue method.

;fldLineTotal :: newValue

method newValue(var eventInfo Event)

if Qty.isEdit() then	;If edit mode,

Qty.postAction(UserAction + 1)	;send a custom user

endIf	;action to QTY.

endmethod

The following code is attached to the table frame's built-in action method.

;recTFrame :: action

method action(var eventInfo ActionEvent)

if eventInfo.id() = UserAction + 1 then	;If ID is user

dmPut("LINEITEM", "Total", Total.value)	;action, then

Qty.postRecord()	;post changes.

endIf

endmethod


See Also for UIObject::postAction
See Also

action

Form::postAction

action

broadcastAction

menuAction

ActionEvent Type

User-Defined Action Constants


UIObject::postRecord
postRecord

See Also	Example	UIObject Type

Beginner

Method

Posts a pending record to a table.

Syntax

postRecord ( ) Logical

Description

postRecord returns True if the current record is successfully posted to the underlying table; otherwise, it returns False. postRecord does not unlock a locked record.

postRecord has the same effect as the action constant DataPostRecord, so the following statements are equivalent:

obj.postRecord()
obj.action(DataPostRecord)


Example for UIObject::postRecord
postRecord Example

The following example locates a record, attempts to lock it with lockRecord, then checks the status of the lock with recordStatus. The method changes the record and posts it with postRecord. Assume that a form contains a table frame bound to the Customer table, and a button named lockButton.

; lockButton::pushButton
method pushButton(var eventInfo Event)
var
  obj  UIObject
endVar
obj.attach(CUSTOMER)
obj.locate("Name", "Sight Diver")
if thisForm.Editing then
  if NOT obj.lockRecord() then
     msgStop("Lock failed", "recordStatus(\"Locked\") is " +
             String(obj.recordStatus("Locked")))
  else
     msgStop("Lock succeeded", "recordStatus(\"Locked\") is " +
             String(obj.recordStatus("Locked")))
     obj.custRec."Name" = "Right Diver"  ; quotes on Name indicates
                                         ; field name instead of property
     obj.postRecord()
     message("Record is locked: ", obj.custRec.locked)
  endif
else
  msgInfo("Status", "You must be in edit mode to lock and change records.")
endif
endMethod


See Also for UIObject::postRecord
See Also

recordStatus

lockRecord

TCursor::attachToKeyViol


UIObject::priorRecord
priorRecord

See Also	Example	UIObject Type

Beginner

Method

Moves to the previous record in a table.

Syntax

priorRecord ( ) Logical

Description

priorRecord sets the current record to the previous record in a table. It returns an error if the cursor is already at the first record.

priorRecord has the same effect as the action constant DataPriorRecord, so the following statements are equivalent:

obj.priorRecord()
obj.action(DataPriorRecord)


Example for UIObject::priorRecord
priorRecord Example

The following example moves to the prior record in the Customer table. Assume that Customer is bound to a table frame on the form; moveToPrior is a button on the same form.

; moveToPrior::pushButton
method pushButton(var eventInfo Event)
if NOT CUSTOMER.atFirst() then
  CUSTOMER.priorRecord()  ; move to the previous record
  ; same as CUSTOMER.action(DataPriorRecord)
  msgInfo("What record?", CUSTOMER.recno)
else
  msgInfo("Status", "Already at the first record.")
endif
endMethod


See Also for UIObject::priorRecord
See Also

home

end

nextRecord

currRecord

skip

moveToRecord


UIObject::pushButton
pushButton

See Also	Example	UIObject Type

Method

Generates a pushButton Event and sends it to an object.

Syntax

pushButton ( ) Logical

Description

pushButton constructs a pushButton Event and calls the built-in pushButton method of an object with that event.


Example for UIObject::pushButton
pushButton Example

The following example sends a pushButton event to buttonTwo on the same form:

; sendPushButton::pushButton
method pushButton(var eventInfo Event)
; send a pushButton to buttonTwo
buttonTwo.pushButton()
endMethod


See Also for UIObject::pushButton
See Also

mouseClick

mouseUp


UIObject::recordStatus
recordStatus

See Also	Example	UIObject Type

Method

Reports about the status of a record.

Syntax

recordStatus ( const statusType String ) Logical

Description

recordStatus returns True or False to a question about the status of a record. Use the argument statusType to specify the status in question, where statusType is "New", "Locked", or "Modified".

"New" means the record has just been inserted into the table. "Locked" means a lock (implicit or explicit) has been placed on the record. "Modified" means at least one of the field values has been changed. You can obtain similar information about the current record by examing the Inserting, Locked, Focus, and Touched properties for the record.


Example for UIObject::recordStatus
recordStatus Example

The following example locates a record, attempts to lock it with lockRecord, then checks the status of the lock with recordStatus. The method changes the record and unlocks it with unlockRecord. Assume that a form contains a table frame bound to the Customer table, and a button named lockButton.

; lockButton::pushButton
method pushButton(var eventInfo Event)
var
  Cust   UIObject                   ; to attach to table frame
  newKey Number
endVar

Cust.attach(CUSTOMER)               ; attach to CUSTOMER table frame
Cust.locate("Name", "Sight Diver")  ; find the record
if NOT thisForm.editing then        ; check if form is in Edit mode
  msgInfo("Status", "You must be in Edit mode for this operation.")
else
  if NOT Cust.lockRecord() then     ; try to lock the record
     msgStop("Status", "Lock Failed. recordStatus(\"Locked\") is " +
             String(Cust.recordStatus("Locked")))
  else
     msgInfo("Record locked?", Cust.recordStatus("Locked"))
     newKey = 1384
     Cust.custRec."Customer No" = newKey   ; change the key value
     msgInfo("Record modified?", Cust.recordStatus("Modified"))
     Cust.unlockRecord()            ; try to unlock the record-if it
                                    ; causes a keyviol, Paradox
                                    ; leaves record locked
     if Cust.recordStatus("Locked") then

       msgInfo("Status", "Record was a key violation. Changing key.")
       newKey = 1451
       Cust.custRec."Customer No" = newKey ; change to a new key
       Cust.postRecord()                   ; post it
       ; record will "fly away" to a new position based on key
     endif
     Cust.locate("Customer No", newKey)   ; find the "fly away"
  endif
endif
endMethod


See Also for UIObject::recordStatus
See Also

lockRecord

unlockRecord


UIObject::resync
resync

See Also	Example	UIObject Type

Method

Resynchronizes an object to a TCursor.

Syntax

resync ( const tc TCursor ) Logical

Description

resync changes the current record pointer of a UIObject to the current record of the TCursor tc. When you resynchronize a table object to a TCursor, the table's filters and indexes will be changed to those of the TCursor. (For dBASE tables, the table will also take the Show Deleted setting of the TCursor.)

Note:	resync only works when the UIObject and the TCursor are associated with the same table.


Example for UIObject::resync
resync Example

See the example for insertBeforeRecord.


See Also for UIObject::resync
See Also

attach

moveToRecord

insertRecord


UIObject::rgb
rgb

See Also	Example	UIObject Type

Method

Defines a color.

Syntax

rgb ( const red SmallInt, const green SmallInt, const blue SmallInt ) LongInt

Description

rgb defines a color based on the values of red, green, and blue, which can be integers ranging from 0 to 255, or Colors constants.


Example for UIObject::rgb
rgb Example

The following example uses rgb to set the color of boxes as they're created. The method creates a color palette. Assume that the titles exist on the form in the appropriate locations. The form has one button, named showPalette.

; drawPalette::pushButton
method pushButton(var eventInfo Event)
var
  palAr Array[5] SmallInt   ; array to hold rgb values
  setBaseX       LongInt    ; base position
  setBaseY       LongInt    ; base position
  ui             UIObject   ; handle to create boxes
endVar
const
  horizInc = 1440           ; amount to move horizontally (twips)
  vertInc =  1080           ; amount to move vertically
endConst

palAr[1] = 0
palAr[2] = 64
palAr[3] = 128
palAr[4] = 192
palAr[5] = 255

for i from 1 to palAR.size()        ; reds(diagonal position)
  setBaseX = 720 + ((i - 1) * 150)  ; change base as i increases
  setBaseY = 720 + ((i - 1) * 150)
  for j from 1 to palAR.size()      ; greens (vertical positioning)
    for k from 1 to palAR.size()    ; blue   (horizontal positioning)
      ui.create(boxTool, setBaseX + (horizInc * (k - 1)),
                setBaseY + (vertInc * (j - 1)), 250, 250)
      ; set the color using rgb and values from array
      ui.Color = rgb(palAr[i], palAr[j], palAr[k])
      ui.Visible = Yes
    endfor                          ; k (blue, horizontal)
  endfor                            ; j (green, vertical)
endfor                              ; i (red, diagonal)

endMethod


See Also for UIObject::rgb
See Also

getProperty

getRGB

setProperty


UIObject::sendToBack
sendToBack	5.0

See Also	Example	UIObject Type

Method

Displays an object behind other objects.

Syntax

sendToBack ( )

Description

sendToBack moves a UIObject to the back drawing layer of a window, displaying it behind other objects. (If you're using a form as a UIObject, this method displays the form window behind other windows.)

This method works in design mode and run mode; you do not have to select the object. Paradox moves the object to the back, so it appears to be behind (below) other objects. This might not be noticeable unless the objects partially overlap each other. You might want to bring an object to the back of the stack of objects if

You have objects that overlap each other

You want to rearrange the tab order

Note:	When you change the front-to-back positions of objects, you change their tab order, because objects always tab from back to front.


Example for UIObject::sendToBack
sendToBack Example

In the following example, assume a form contains two multirecord objects that occupy the same location and size on a form. Two buttons toggle between each multirecord object: btnShowVendors uses sendToBack to send the STOCK multirecord object to the background; the VENDORS multirecord object is in front. btnShowStock uses sendToBack to send the VENDORS multirecord object to the background; the STOCK multirecord object is in front.

The following code is attached to btnShowVendors.

;btnShowVendors :: pushButton

method pushButton(var eventInfo Event)

STOCK.sendToBack()	; Send the VENDORS MRO to the back

Vendor_No.moveTo()	; so the STOCK MRO may be seen.

endmethod

The following code is attached to btnShowStock.

;btnShowStock :: pushButton

method pushButton(var eventInfo Event)

VENDORS.sendToBack()	; Send the STOCK MRO to the back

Stock_No.moveTo()	; so the VENDORS MRO may be seen.

endmethod


See Also for UIObject::sendToBack
See Also

bringToFront


UIObject::setGenFilter
setGenFilter	5.0

See Also	Example	UIObject Type

Method

Specifies conditions for including records in a field, table frame, or multirecord object.

Syntax

1. setGenFilter ( [ idxName String, [ tagName String, ] ] criteria DynArray [ ] AnyType ) Logical

2. setGenFilter ( [ idxName String, [ tagName String, ] ] criteria Array[ ] AnyType [ , fieldId Array[ ] AnyType ] ) Logical

Description

setGenFilter specifies conditions for including records in a table frame or multirecord object. Records that meet all the specified conditions are included; records that don't are filtered out. Unlike setRange, this method does not require an indexed table.

In syntax 1, the DynArray criteria specifies fields and conditions as follows: the index is the field name or field number, and the item is the criteria expression. For example, the following code specifies criteria based on the values of three fields.

criteriaDA[1]      = "Widget" ; The value of the first field in the table is Widget.
criteriaDA["Size"] = "> 4"    ; The value of the field named Size is greater than 4.
criteriaDA["Cost"] = ">= 10.95, < 22.50" ; The value of the field named Cost is greater than or equal to 10.95 and less than 22.50.

If the DynArray is empty or contains at least one empty item, any existing filter criteria are removed.

In syntax 2, the Array criteria specifies conditions, and the optional Array fieldId specifies field names and/or field numbers. If you omit fieldID, conditions are applied to fields in the order they appear in the criteria array (the first condition applies to the first field in the table, the second condition applies to the second field, and so on). The following example fills arrays for syntax 2 to specify the same criteria as the example for syntax 1.

criteriaAR[1] = "Widget"
criteriaAR[2] = "> 4"
criteriaAR[3] = ">= 10.95, < 22.50"
fieldAR[1] = 1
fieldAR[2] = "Size"
fieldAR[3] = "Cost"

If the Array is empty or contains at least one empty item, any existing filter criteria are removed.

For both syntaxes, idxName specifies an index name (Paradox and dBASE tables) and tagName specifies a tag name (dBASE tables only). If you use these optional items, the index (and tag) are applied to the underlying table before the filtering criteria.

This method fails if the current record cannot be committed.

Note:	If you use setGenFilter on a UIObject in a running report, the filter does not take effect until the next time you run the report. For example, the following code runs a report, then sets a filter, but the filter has no effect until the code switches the report into design mode, then switches it back into run mode.

method pushButton(var eventInfo Event)

var

reOrders	Report

daCriteria	DynArray[] AnyType

endVar

reOrders.open("orders")

daCriteria["OrderNo"] = "> 1234"

; Assume the report contains a table frame bound to the Orders table.

; This statement has no effect because the report is in run mode.

reOrders.ORDERS.setGenFilter(daCriteria)

reOrders.design()

reOrders.run() ; Now the filter takes effect.

endMethod


Example for UIObject::setGenFilter
setGenFilter Example

In this example, the pushButton method for a button named balanceDueBtn uses setGenFilter to filter a table frame on a form. It filters the ORDERS table frame to show only those orders with a positive balance due.

;balanceDueBtn :: pushButton

method pushButton(var eventInfo Event)

var

dyn	DynArray[] String

stField, stData	String

endVar

stField = "Balance Due"

stData = "> 0"

dyn[stField] = sData

ORDERS.setGenFilter(dyn)	; ORDERS is a detail table frame.

endmethod


See Also for UIObject::setGenFilter
See Also

getGenFilter

dropGenFilter

setRange

TCursor::setGenFilter

Using Ranges and Filters


UIObject::setPosition
setPosition

See Also	Example	UIObject Type

Method

Sets the position of an object.

Syntax

setPosition ( const x LongInt, const y LongInt, const w LongInt, const h LongInt)

Description

setPosition sets the position of an object on the screen. Variables x and y specify the coordinates (in twips) of the upper left corner of the object. Variables w and h specify the width and height (in twips) of the object. If the object is not specified, self is implied.

Note:	This method does not work with forms as UIObjects. To set the position of a form, use Form::setPosition.

You can also set and examine an object's position and size with the Position and Size properties. For instance,

self.Position = Point(100, 150)
self.Size = Point(2000, 2500)

is the same as

self.setPosition(100, 150, 2000, 2500)

To ObjectPAL, the screen is a two-dimensional grid, with the origin (0, 0) at the upper left corner of an object's container, positive x-values extending to the right, and positive y-values extending down.

For dialog boxes and for the Paradox Desktop application, the position is given relative to the entire screen; for forms, reports, and table windows, the position is given relative to the Paradox Desktop.


Example for UIObject::setPosition
setPosition Example

The following example moves a circle across the screen in response to timer events. The pushButton method for toggleButton uses setTimer and killTimer to start or stop a timer, depending on the condition of the button. When the timer starts, it issues a timer event every 100 milliseconds. Each timer event causes toggleButton's timer method to execute. The timer method gets the current position of the ellipse with getPosition, then moves it 100 twips to the right with setPosition.

Following is the code for toggleButton's pushButton method:

; toggleButton::pushButton
method pushButton(var eventInfo Event)
; label for button was renamed to buttonLabel
if buttonLabel = "Start Timer" then   ; if stopped, then start
  buttonLabel = "Stop Timer"          ; change label
  self.setTimer(10)                   ; start the timer
else                                  ; if started, then stop
  buttonLabel = "Start Timer"         ; change label
  self.killTimer()                    ; stop the timer
endif

endMethod

Following is the code for toggleButton's timer method:

; toggleButton::timer
method timer(var eventInfo TimerEvent)
var
  ui          UIObject
  x, y, w, h  SmallInt
endVar
ui.attach(floatCircle)         ; attach to the circle
ui.getPosition(x, y, w, h)     ; assign coordinates to vars
if x  4320 then                ; if not at left edge of area
  ui.setPosition(x + 100, y, w, h)  ; move to the left
else
  ui.setPosition(1440, y, w, h)     ; return to the right
endif
endMethod


See Also for UIObject::setPosition
See Also

getPosition

Form::setPosition


UIObject::setProperty
setProperty

See Also	Example	UIObject Type

Method

Sets a property to a specified value.

Syntax

setProperty ( const propertyName String, const propertyValue AnyType )

Description

setProperty sets the propertyName property of an object to propertyValue. If the object does not have a property propertyName, or if propertyValue is invalid, an error results.

setProperty is an alternative to setting a property directly; it's useful when propertyName is a variable. Otherwise, access the property directly, for example,

aBox.Color = Red

instead of

aBox.setProperty("Color", Red)


Example for UIObject::setProperty
setProperty Example

The following example creates a dynamic array, indexed by property names, to contain property values. The array is filled by using the array's index as the argument to the getProperty command. The method changes one of the values of the properties and resets the object's properties from the dynamic array with the setProperty method.

; boxOne::mouseUp
method mouseUp(var eventInfo MouseEvent)
var
  propNames DynArray[] AnyType    ; to hold property names & values
  arrayIndex           String     ; index to dynamic array
endVar

propNames["Color"] = ""
propNames["Visible"] = ""
propNames["Name"] = ""

foreach arrayIndex in propNames
  propNames[arrayIndex] = self.getProperty(arrayIndex)
endforeach

propNames["Color"] = "DarkBlue"

foreach arrayIndex in propNames
  self.setProperty(arrayIndex, propNames[arrayIndex])
endforeach

endMethod


See Also for UIObject::setProperty
See Also

getProperty

getPropertyAsString


UIObject::setRange
setRange	5.0

See Also	Example1	Example2	UIObject Type

Method

Specifies a range of records to include in a field, table frame, or multirecord object.

Syntax

1. setRange ( [ const exactMatchVal AnyType] * [ , const minVal AnyType, const maxVal AnyType ] ) Logical

2. setRange ( rangeVals Array[] AnyType ) Logical

Description

setRange specifies conditions for including a range of records. Records that meet the conditions are included; records that don't are excluded. setRange compares the criteria you specify with values in the corresponding fields of a table's index; it fails if the current record cannot be committed or if the table is not indexed. Calling setRange without any arguments resets the range criteria to include the entire table.

Note	This method replaces setFilter included in earlier versions: both functionality and performance are enhanced. Code that calls setFilter will continue to execute as before.

In syntax 1, to set a range based on the value of the first field of the index, specify values in minVal and maxVal. For example, the following statement checks values in the first field of the index of each record:

tblObj.setRange(14, 88)

If a value is less than 14 or greater than 88, that record is excluded. To specify an exact match on the first field of the index, assign minVal and maxVal the same value. For example, the following statement excludes all values except 55:

tblObj.setRange(55, 55)

You can set a range based on the values of more than one field. To do so, specify exact matches except for the last one in the list. For example, the following statement looks for exact matches on "Borland" and "Paradox" (assuming they are the first fields in the index), and values ranging from 100 to 500, inclusive, for the third field:

tblObj.setRange("Borland", "Paradox", 100, 500)

In syntax 2, you can pass an array of values to specify the range criteria, as listed in the following table.

Number of array items	Range specification

No items (empty array)	Resets range criteria to include the entire table.

One item	Specifies a value for an exact match on the first field of the index.

Two items	Specifies a range for the first field of the index.

Three items	The first item specifies an exact match for the first field of the index; items 2 and 3 specify a range for the second field of the index.

More than three items	For an array of size n, specify exact matches on the first n-2 fields of the index. The last two array items specify a range for the n-1 field of the index.


Example 1 for UIObject::setRange
setRange Example 1

For the following example, assume that the first field in Lineitem's key is "Order No." and you want to know the total for order number 1005. When you press the getDetailSum button, the pushButton method limits the number of records included in the LINEITEM object to those with 1005 in the first key field.

; getDetails::pushButton
method pushButton(var eventInfo Event)
var
  tblObj  UIObject
endVar
if tblObj.attach(LINEITEM) then

  ; this limits tblObj's view to records that have
  ; 1005 as their key value (Order No. 1005).
  tblObj.setRange(1005, 1005)
  ; now display the number of records for Order No. 1005
  msgInfo("Total records for order 1005", tblObj.nRecords())
else
  msgStop("Sorry", "Can't attach to table.")
endif
endMethod


Example 2 for UIObject::setRange
setRange Example 2

This example shows how to call setRange with a criteria array that contains more than three items. The following code makes a table frame display orders from a person with a specific first name, middle initial, and last name, and an order quantity ranging from 100 to 500 items. This example assumes that the PartsOrd table is indexed on the FirstName, MiddleInitial, LastName, and Qty fields.

; setQtyRange::pushButton
method pushButton(var eventInfo Event)
var
arRangeInfo	Array[5] AnyType

endVar

arRangeInfo[1] = "Frank"       ; FirstName (exact match)

arRangeInfo[2] = "P."          ; MiddleInitial (exact match)

arRangeInfo[3] = "Borland"     ; LastName (exact match)

arRangeInfo[4] = 100           ; Minimum qty value

arRangeInfo[5] = 500           ; Maximum qty value

PartsOrd.setRange(arRangeInfo) ; PartsOrd is a table frame

endMethod


See Also for UIObject::setRange
See Also

switchIndex

Table::setRange

TCursor::setRange

Using Ranges and Filters


UIObject::setTimer
setTimer

See Also	Example	UIObject Type

Method

Starts the timer for an object.

Syntax

setTimer ( const milliSeconds LongInt [, const repeat Logical ] )

Description

setTimer starts a timer for an object. The timer interval (in milliseconds) is specified using milliSeconds. The optional argument repeat specifies if the timer automatically repeats. If repeat is True or omitted, the timer repeats; otherwise, the timer event is sent once. Usually, setTimer is attached to an object's open method, and the object's response is defined in its timer method.

Note:	Windows allows a maximum of 16 timers for all applications. However, Paradox has no limit. System resources may limit the number of timers you can set, and you may run out of Windows timers, but Paradox is not restricted by the 16-timer limit.


Example for UIObject::setTimer
setTimer Example

The following example moves a circle across the screen in response to timer events. The pushButton method for toggleButton uses setTimer and killTimer to start or stop a timer, depending on the condition of the button. When the timer starts, it issues a timer event every 100 milliseconds. Each timer event causes toggleButton's timer method to execute. The timer method gets the current position of the ellipse with getPosition, then moves it 100 twips to the right with setPosition.

The following code is for toggleButton's pushButton method:

; toggleButton::pushButton
method pushButton(var eventInfo Event)
if buttonLabel = "Start Timer" then   ; if stopped, then start
  buttonLabel = "Stop Timer"          ; change label
  self.setTimer(10)                   ; start the timer
else
  buttonLabel = "Start Timer"         ; change label
  self.killTimer()                    ; stop the timer
endif

endMethod

The following code is for toggleButton's timer method:

; toggleButton::timer
method timer(var eventInfo TimerEvent)
var
  ui          UIObject
  x, y, w, h  SmallInt
endVar
ui.attach(floatCircle)         ; attach to the circle
ui.getPosition(x, y, w, h)     ; assign coordinates to vars
if x  4320 then                ; if not at left edge of area
  ui.setPosition(x + 100, y, w, h)  ; move to the left
else
  ui.setPosition(1440, y, w, h)     ; return to the right
endif
endMethod


See Also for UIObject::setTimer
See Also

killTimer


UIObject::skip
skip

See Also	Example	UIObject Type

Method

Moves forward or backward a specified number of records in a table.

Syntax

skip ( const nRecords LongInt ) Logical

Description

skip sets the current record to the record nRecords from the current record. You'll get an error if skip tries to move beyond the limits of the table.

Positive values for nRecords move forward through the table (nRecords = 1 is the same as nextRecord), negative values move backward (nRecords = -1 is the same as priorRecord), and setting nRecords to 0 doesn't move (nRecords = 0 is the same as currRecord).


Example for UIObject::skip
skip Example

The following example fills a table with a sampling of records from the Orders table. Assume that the table SampOrd already exists with the same structure as Orders. The createSampling button, whose pushButton method is shown below, exists on a form along with a table frame bound to Orders. The method moves the cursor through the Orders table, skips a random number of records, and copies the record it lands on to the sampling table.

; createSampling::pushButton
method pushButton(var eventInfo Event)
var
  ordSampleTC         TCursor       ; handle to sampling table
  copyRec Array[]     String        ; holds record copied from Orders
  randInt             SmallInt      ; random number to skip
  OrdObj              UIObject      ; handle to Orders
endVar

ordObj.attach(ORDERS)               ; attach to ORDERS table frame
ordObj.home()                       ; move to the first record
if ordSampleTC.open("OrdSamp.db")  then
  ordSampleTC.empty()               ; clear out sampling table
  ordSampleTC.edit()                ; start editing
  while NOT OrdObj.atLast()
    randInt = int(rand() * 20) + 1  ; create an integer between 1 and 20
    randInt.view()                  ; show the number
    OrdObj.skip(randInt)            ; skip a random number of records
    OrdObj.copyToArray(copyRec)     ; get the record
    ordSampleTC.insertRecord()      ; make a space for it
    ordSampleTC.copyFromArray(copyRec)  ; insert the record
  endwhile
  ordSampleTC.endEdit()             ; end editing
  msgInfo("Status", "OrdSamp table now has " +
           String(ordSampleTC.nRecords()) + " records.")
  ordSampleTC.close()               ; close it out
else
  msgStop("Oops", "Sorry. Couldn't find OrdSamp table.")
endif
endMethod


See Also for UIObject::skip
See Also

home

end

nextRecord

priorRecord

currRecord

moveToRecord


UIObject::switchIndex
switchIndex

See Also	Example	UIObject Type

Method

Specifies another index to use to view the records in a table.

Syntax

1. switchIndex ( [ const indexName String ] [, const stayOnRecord Logical ] ) Logical

2. switchIndex ( [const indexFileName String ] [, const tagName String [, const stayOnRecord Logical ] ] ) Logical

Description

switchIndex specifies in indexName an index file to use with a table. In syntax 1, indexName specifies an index to use with a Paradox table. If you omit indexName, the table's primary index is used.

Syntax 2 is for dBASE tables, where indexFileName can specify a .NDX file or a .MDX file, and optional argument tagName specifies an index tag in a production index (.MDX) file.

In both syntaxes, if optional argument stayOnRecord is Yes, this method maintains the current record after the index switch; if it is No, the first record in the table becomes the current record. If omitted, stayOnRecord is No by default.


Example for UIObject::switchIndex
switchIndex Example

For the following example, assume that Customer is a keyed Paradox table that has a secondary index named "NameAndState". This example attaches to a table frame bound to Customer,  and calls switchIndex to switch from the primary index to the "NameAndState" index.

; thisButton::pushButton
method pushButton(var eventInfo Event)
var
  tblObj UIObject
endvar

tblObj.attach(CUSTOMER)               ; attach to Customer
tblObj.switchindex("NameAndState")    ; switch to index NameAndState
tblObj.home()                         ; make sure we're on the first record
msgInfo("First Record", tblObj."Name")  ; display value in Name field
; quotes around "Name" distinguish field name from property name
endMethod


See Also for UIObject::switchIndex
See Also

Paradox Help: Indexes

setGenFilter

setRange

TCursor::reIndex

TCursor::reIndexAll

Table::setIndex


UIObject::twipsToPixels
twipsToPixels

See Also	Example	UIObject Type

Method

Converts screen coordinates from twips to pixels.

Syntax

twipsToPixels ( const twips Point ) Point

Description

twipsToPixels converts the screen coordinates specified in twips from twips to pixels. A pixel (the name comes from picture element) is a dot on the screen, and a twip is a device-independent unit equal to 1/1440 of a logical inch (1/20 of a printer's point).


Example for UIObject::twipsToPixels
twipsToPixels Example

See the example for pixelsToTwips.


See Also for UIObject::twipsToPixels
See Also

pixelsToTwips


UIObject::unDeleteRecord
unDeleteRecord

See Also	Example	UIObject Type

Method

Undeletes the current record from a dBASE table.

Syntax

unDeleteRecord ( ) Logical

Description

unDeleteRecord undeletes the current record of a dBASE table. This operation can only be successful if showDeleted has been set True, the current record is a deleted record, and the table object is in Edit mode.


Example for UIObject::unDeleteRecord
unDeleteRecord Example

See the example for TCursor::unDeleteRecord.


See Also for UIObject::unDeleteRecord
See Also

deleteRecord

isRecordDeleted

TCursor::isShowDeletedOn

TCursor::showDeleted


UIObject::unlockRecord
unlockRecord

See Also	Example	UIObject Type

Beginner

Method

Removes a write lock from the current record.

Syntax

unlockRecord ( ) Logical

Description

unlockRecord returns True if it successfully removes an explicit write lock on the current record; otherwise, it returns False.

Note:	The Locked property is a read-only property. You can examine the property to find out whether an object is locked, but you can't change the property to lock or unlock an object.


Example for UIObject::unlockRecord
unlockRecord Example

See the example for recordStatus.


See Also for UIObject::unlockRecord
See Also

recordStatus

lockRecord

TCursor::attachToKeyViol

TCursor::didFlyAway

TCursor::setFlyAwayControl


UIObject::view
view

See Also	Example	UIObject Type

Beginner

Method

Displays the value of an object in a dialog box.

Syntax

view ( [ const title String ] )

Description

view displays the value of an object in a dialog box. Paradox suspends method execution until you close the dialog box. You have the option to specify, in title, a title for the dialog box. If you omit title, the title is the data type of the value.

This method works only with the following UIObjects:

Buttons as checkboxes or radio buttons.

Unbound fields only as lists or radio buttons.

Fields bound to a table; the field's data type can be any data type except Memo and Graphic.

Calling view with any other UIObject causes a run-time error.


Example for UIObject::view
view Example

For the following example, assume that a form contains a table frame, named CUSTOMER bound to the Customer table, and a button. The following code is attached to the button's pushButton method. It creates an array of seven UIObjects, then tries to view each item in the array.

;  page::mouseUp
method mouseUp(var eventInfo MouseEvent)
var
   obj          UIObject
   arr Array[7] UIObject
   i            SmallInt
endVar
arr[1].attach(CUSTOMER.Phone) ; the Phone field (A15) in the table frame
                              ; shows the phone number
arr[2].attach(aGraphic)       ; a bitmap (invalid)
arr[3].attach(someText)       ; a text object (invalid)
arr[4].attach(someList)       ; an unbound list field
                              ; shows the list item selected
arr[5].attach(someUnField)    ; an unbound field (invalid)
arr[6].attach(someRadio)      ; an unbound field as a radio button
                              ; shows the value of the active radio button
arr[7].attach(someButton)     ; an unbound field as a checkbox
                              ; True if checked, otherwise False
for i from 1 to arr.size()
  arr[i].view(arr[1].Class + ": Item " + String(i))
endFor
endMethod


See Also for UIObject::view
See Also

attach


UIObject::wasLastClicked
wasLastClicked

See Also	Example	UIObject Type

Method

Tells if an object was the last object to receive a mouse click.

Syntax

wasLastClicked ( ) Logical

Description

wasLastClicked returns True if an object was the last object to receive a mouse click; otherwise, it returns False. This method can be used only with objects in the current form.


Example for UIObject::wasLastClicked
wasLastClicked Example

The following code is attached to the mouseUp method for an object called boxOne. If boxOne received the click, the message appears; if boxOne was sent a mouseUp event from another object, the method beeps instead.

Following is the code for boxOne's mouseUp method:

; boxOne::mouseUp
method mouseUp(var eventInfo MouseEvent)
if self.wasLastClicked() then
  msgInfo("Hey!", "Quit clicking me.")  ; method invoked by clicking
else
  beep()                                ; method invoked indirectly
endif
endMethod

Following is the code for sendAClick's mouseUp method:

; sendAClick::mouseUp
method mouseUp(var eventInfo MouseEvent)
boxOne.mouseUp(eventInfo)  ; when boxOne's mouseUp gets this,
                           ; it will beep
endMethod


See Also for UIObject::wasLastClicked
See Also

wasLastRightClicked

hasMouse


UIObject::wasLastRightClicked
wasLastRightClicked

See Also	Example	UIObject Type

Method

Tells if an object was the last object to receive a right mouse click.

Syntax

wasLastRightClicked ( ) Logical

Description

wasLastRightClicked returns True if an object was the last object to receive a right mouse click; otherwise, it returns False. This method can be used only with objects in the current form.


Example for UIObject::wasLastRightClicked
wasLastRightClicked Example

The following is attached to the mouseRightUp method for an object called circleOne. If the ellipse received the right click, the message displays; if the ellipse was sent a mouseRightUp event from another object, the method beeps instead.

Following is the code for circleOne's mouseUp method:

; circleOne::mouseRightUp
method mouseRightUp(var eventInfo MouseEvent)
if self.wasLastRightClicked() then
  ; method invoked by right-click
  msgInfo("Right-click", "Go click on someone your own size.")
else
  beep()       ; method invoked indirectly
endif
endMethod

Following is the code for sendARightClick's mouseUp method:

; sendARightClick::mouseRightUp
method mouseRightUp(var eventInfo MouseEvent)
circleOne.mouseRightUp(eventInfo)  ; when circleOne gets this,
                                   ; it will beep
endMethod


See Also for UIObject::wasLastRightClicked
See Also

wasLastClicked

hasMouse


ValueEvent Type

ValueEvent methods control field value changes. The changeValue built-in method is the only method triggered by a ValueEvent. The built-in newValue method is not called with a ValueEvent; newValue takes an Event instead.

Do not confuse changeValue with newValue. The built-in changeValue method is called when the value of a field is about to change. changeValue gives you a chance to check the value and decide whether you want to post it. The built-in newValue method reports when a field has received a new value; newValue is usually called after the fact (fields defined as buttons and lists behave differently). Also note that the built-in newValue method is not the same as the newValue method for the ValueEvent type.

The ValueEvent type includes several derived methods from the Event type.

Methods for the ValueEvent Type

Event		ValueEvent
errorCode		newValue
getTarget		setNewValue
isFirstTime
isPreFilter
isTargetSelf
reason
setErrorCode
setReason


ValueEvent::newValue
newValue

See Also	Example	ValueEvent Type

Beginner

Method

Returns the unposted new value of a ValueEvent.

Syntax

newValue ( ) AnyType

Description

newValue returns the new value to be assigned to a field for a ValueEvent. The new value is not yet assigned to the field so the following two statements may return different values:

field.Value
eventInfo.newValue()

Note:	This method is not the same as the built-in newValue method.


Example for ValueEvent::newValue
newValue Example

In the following example, the changeValue method for the creditLimit field checks the old value and the new value to see if there is more than a 25% change. If the difference between the old and new values is too large, the method blocks the change. Assume that creditLimit is an unbound field on a form, and that there is at least one other field to move to.

; creditLimit::changeValue
method changeValue(var eventInfo ValueEvent)
var
  oldVal,
  newVal   Number
endVar
oldVal = self.Value              ; the property may be different
newVal = eventInfo.newValue()    ; than the new value
if (newVal > oldVal) AND (oldVal <> 0) then
  if (newVal - oldVal)/oldVal > 0.25 then
    msgStop("Stop", "You are not allowed to increase the " +
                    "credit limit more than 25%.")
    self.action(EditUndoField)  ; --use this to restore old value
    eventInfo.setErrorCode(CanNotDepart)   ; block departure
  endif
endif
endMethod


See Also for ValueEvent::newValue
See Also

setNewValue


ValueEvent::setNewValue
setNewValue

See Also	Example	ValueEvent Type

Method

Specifies a value to set for a ValueEvent.

Syntax

setNewValue ( const newValue AnyType )

Description

setNewValue specifies in newValue a value to set for a ValueEvent. The data type of the value supplied in newValue should be consistent with the field's type.


Example for ValueEvent::setNewValue
setNewValue Example

In the following example, assume a form contains the field authorAbbrToName, as well as at least one other field. When the user enters an author abbreviation, then moves off the field, the changeValue method fills in the full author name.

; authorAbbrToName::changeValue
method changeValue(var eventInfo ValueEvent)
var
  abbrValue,
  fullValue String
endVar

abbrValue = upper(eventInfo.newValue())  ; get the value and convert
                                         ; to uppercase
; user enters an abbreviation--change to full name
switch
  case abbrValue = "AC" : fullValue = "Agatha Christie"
  case abbrValue = "SP" : fullValue = "Sara Paretsky"
  case abbrValue = "MHC": fullValue = "Mary Higgins Clark"
  case abbrValue = "FK" : fullValue = "Faye Kellerman"
  case abbrValue = "SG" : fullValue = "Susan Grafton"
  case abbrValue = "AF" : fullValue = "Antonia Fraser"
  otherwise : fullValue = "Author Unknown"
endswitch

eventInfo.setNewValue(fullValue)
endMethod


See Also for ValueEvent::setNewValue
See Also

newValue


Alphabetic List of ObjectPAL Methods

A

abs

accessRights

acos

action (Form Type)

action (TableView Type)

action (UIObject Type)

actionClass

add (Table Type)

add (TCursor Type)

addAlias

addArray (Menu Type)

addArray (PopUpMenu Type)

addBar

addBreak (Menu Type)

addBreak (PopUpMenu Type)

addLast

addPassword

addPopUp (Menu Type)

addPopUp (PopUpMenu Type)

addProjectAlias

addSeparator

addStaticText (Menu Type)

addStaticText (PopUpMenu Type)

addText (Menu Type)

addText (PopUpMenu Type)

advancedWildcardsInLocate

advMatch (String Type)

advMatch (TextStream Type)

ansiCode

append

asin

atan

atan2

atFirst (TCursor Type)

atFirst (UIObject Type)

atLast (TCursor Type)

atLast (UIObject Type)

attach (Form Type)

attach (Report Type)

attach (Script Type)

attach (Table Type)

attach (TCursor Type)

attach (UIObject Type)

attachToKeyViol

B

beep

beginTransaction

bitAND (LongInt Type)

bitAND (SmallInt Type)

bitIsSet (LongInt Type)

bitIsSet (SmallInt Type)

bitOR (LongInt Type)

bitOR (SmallInt Type)

bitXOR (LongInt Type)

bitXOR (SmallInt Type)

blank

blankAsZero

bot

breakApart

bringToFront

bringToTop

broadcastAction

C

cancelEdit (TCursor Type)

cancelEdit (UIObject Type)

canLinkFromClipboard

canReadFromClipboard

cAverage (Table Type)

cAverage (TCursor Type)

cCount (Table Type)

cCount (TCursor Type)

ceil

char

charAnsiCode

chr

chrOEM

chrToKeyName

clipboardErase

clipboardHasFormat

close (Database Type)

close (DDE Type)

close (Form Type)

close (Library Type)

close (Report Type)

close (Session Type)

close (System Type)

close (TCursor Type)

close (TextStream Type)

close (TableView Type)

cMax (Table Type)

cMax (TCursor Type)

cMin (Table Type)

cMin (TCursor Type)

cNpv (Table Type)

cNpv (TCursor Type)

commit

commitTransaction

compact (Table Type)

compact (TCursor Type)

compileInformation

constantNameToValue

constantValueToName

contains (Array Type)

contains (DynArray Type)

contains (Menu Type)

convertPointWithRespectTo

copy (FileSystem Type)

copy (Table Type)

copy (TCursor Type)

copyFromArray (TCursor Type)

copyFromArray (UIObject Type)

copyRecord

copyToArray (TCursor Type)

copyToArray (UIObject Type)

copyToToolbar

cos

cosh

count

countOf

cpuClockTime

create (Form Type)

create (Library Type)

create (Script Type)

create (Table Type)

create (TextStream Type)

create (UIObject Type)

createIndex

cSamStd (Table Type)

cSamStd (TCursor Type)

cSamVar (Table Type)

cSamVar (TCursor Type)

cStd (Table Type)

cStd (TCursor Type)

cSum (Table Type)

cSum (TCursor Type)

currency

currentPage

currRecord (TCursor Type)

currRecord (UIObject Type)

cVar (Table Type)

cVar (TCursor Type)

D

data

dataType

date

dateTime

dateVal

day

daysInMonth

debug

delayScreenUpdates

delete (Database Type)

delete (FileSystem Type)

delete (Table Type)

delete (UIObject Type)

deleteDir

deleteRecord (TCursor Type)

deleteRecord (UIObject Type)

deliver (Form Type)

design (Form Type)

design (Report Type)

desktopMenu

didFlyAway

disableBreakMessage

disablePreviousError

distance

dlgAdd

dlgCopy

dlgCreate

dlgDelete

dlgEmpty

dlgExport

dlgImportASCIIFix

dlgImportASCIIVar

dlgImportSpreadsheet

dlgNetDrivers

dlgNetLocks

dlgNetRefresh

dlgNetRetry

dlgNetSetLocks

dlgNetSystem

dlgNetUserName

dlgNetWho

dlgRename

dlgRestructure

dlgSort

dlgSubtract

dlgTableInfo

dmAddTable

dmAttach (Form Type)

dmAttach (TCursor Type)

dmBuildQueryString

dmEnumLinkFields

dmGet

dmGetProperty

dmHasTable

dmLinkToFields

dmLinkToIndex

dmPut

dmRemoveTable

dmResync

dmSetProperty

dmUnlink

dow

dowOrd

doy

drives

dropGenFilter (Table Type)

dropGenFilter (TCursor Type)

dropGenFilter (UIObject Type)

dropIndex (Table Type)

dropIndex (TCursor Type)

E

edit (OLE Type)

edit (TCursor Type)

edit (UIObject Type)

empty (Array Type)

empty (DynArray Type)

empty (Menu Type)

empty (Table Type)

empty (TCursor Type)

empty (UIObject Type)

enableExtendedCharacters

end (TCursor Type)

end (TextStream Type)

end (UIObject Type)

endEdit (TCursor Type)

endEdit (UIObject Type)

enumAliasLoginInfo

enumAliasNames

enumClipboardFormats

enumDataBaseTables

enumDataModel

enumDesktopWindowNames

enumDriverCapabilities

enumDriverInfo

enumDriverNames

enumDriverTopics

enumEngineInfo

enumEnvironmentStrings

enumFamily

enumFieldNames (Table Type)

enumFieldNames (TCursor Type)

enumFieldNames (UIObject Type)

enumFieldNamesInIndex (Table Type)

enumFieldNamesInIndex (TCursor Type)

enumFieldStruct (Table Type)

enumFieldStruct (TCursor Type)

enumFileList

enumFolder

enumFonts

enumFormats

enumFormNames

enumIndexStruct (Table Type)

enumIndexStruct (TCursor Type)

enumLocks (TCursor Type)

enumLocks (UIObject Type)

enumObjectNames

enumOpenDatabases

enumPrinters

enumRefIntStruct (Table Type)

enumRefIntStruct (TCursor Type)

enumReportNames

enumRTLClassNames

enumRTLConstants

enumRTLErrors

enumRTLMethods

enumSecStruct (Table Type)

enumSecStruct (TCursor Type)

enumServerClassNames

enumSource (Form Type)

enumSource (Library Type)

enumSource (UIObject Type)

enumSourceToFile (Form Type)

enumSourceToFile (Library Type)

enumSourceToFile (UIObject Type)

enumTableLinks

enumTableProperties

enumUIClasses

enumUIObjectNames (Form Type)

enumUIObjectNames (Report Type)

enumUIObjectNames (UIObject Type)

enumUIObjectProperties (Form Type)

enumUIObjectProperties (Report Type)

enumUIObjectProperties (UIObject Type)

enumUsers

enumVerbs

enumWindowNames

eof

eot

errorClear

errorCode (Event Type)

errorCode (System Type)

errorHasErrorCode

errorHasNativeErrorCode

errorLog

errorMessage

errorNativeCode

errorPop

errorShow

errorTrapOnWarnings

exchange

execMethod (Library Type)

execMethod (UIObject Type)

execute (DDE Type)

execute (System Type)

executeQBE

executeSQL

executeString

existDrive

exit

exp

exportASCIIFix

exportASCIIVar

exportParadoxDOS

exportSpreadsheet

F

fail

familyRights (Table Type)

familyRights (TCursor Type)

fieldName

fieldNo (Table Type)

fieldNo (TCursor Type)

fieldRights

fieldSize

fieldType (Table Type)

fieldType (TCursor Type)

fieldUnits2

fieldValue

fileBrowser

fill (Array Type)

fill (String Type)

findFirst

findNext

floor

forceRefresh

format

formatAdd

formatDelete

formatExist

formatGetSpec

formatSetCurrencyDefault

formatSetDateDefault

formatSetDateTimeDefault

formatSetLogicalDefault

formatSetLongIntDefault

formatSetNumberDefault

formatSetSmallIntDefault

formatSetTimeDefault

formatStringToDate

formatStringToNumber

formCaller

formReturn

fraction

freeDiskSpace

fromHex

fullName

fv

G

getAliasPath

getAliasProperty

getBoundingBox

getDefaultPrinterStyleSheet

getDefaultScreenStyleSheet

getDestination

getDir

getDrive

getFileAccessRights

getFileName

getGenFilter (Table Type)

getGenFilter (TCursor Type)

getGenFilter (UIObject Type)

getIndexName

getKeys

getLanguageDriver (System Type)

getLanguageDriver (TCursor Type)

getLanguageDriverDesc

getMenuChoiceAttribute

getMenuChoiceAttributeById

getMousePosition

getMouseScreenPosition

getNetUserName

getObjectHit

getPosition (Form Type)

getPosition (UIObject Type)

getProperty

getPropertyAsString

getProtoProperty

getQueryRestartOptions

getRange (Table Type)

getRange (TCursor Type)

getRange (UIObject Type)

getRGB

getSelectedObjects

getServerName

getStyleSheet

getTarget

getTitle

getUserLevel

getValidFileExtensions

grow

H

hasMenuChoiceAttribute

hasMouse

helpOnHelp

helpQuit

helpSetIndex

helpShowContext

helpShowIndex

helpShowTopic

helpShowTopicInKeywordTable

hide

hideToolbar

home (TCursor Type)

home (TextStream Type)

home (UIObject Type)

hour

I

id (ActionEvent Type)

id (MenuEvent Type)

ignoreCaseInLocate

ignoreCaseInStringCompares

importASCIIFix

importASCIIVar

importSpreadsheet

index

indexOf

initRecord

insert

insertAfter

insertAfterRecord (TCursor Type)

insertAfterRecord (UIObject Type)

insertBefore

insertBeforeRecord (TCursor Type)

insertBeforeRecord (UIObject Type)

insertFirst

insertObject

insertRecord (TCursor Type)

insertRecord (UIObject Type)

instantiateView

int

isAbove

isAdvancedWildcardsInLocate

isAltKeyDown

isAssigned (AnyType Type)

isAssigned (Database Type)

isAssigned (Query Type)

isAssigned (SQL Type)

isAssigned (Session Type)

isAssigned (Table Type)

isAssigned (TCursor Type)

isBelow

isBlank

isBlankZero

isContainerValid

isControlKeyDown (KeyEvent Type)

isControlKeyDown (MouseEvent Type)

isDesign

isDir

isEdit (TCursor Type)

isEdit (UIObject Type)

isEmpty (Table Type)

isEmpty (TCursor Type)

isEmpty (UIObject Type)

isEncrypted (Table Type)

isEncrypted (TCursor Type)

isErrorTrapOnWarnings

isExecuteQBELocal

isFile

isFirstTime

isFixed

isFixedType

isFromUI (KeyEvent Type)

isFromUI (MouseEvent Type)

isFromUI (MenuEvent Type)

isIgnoreCaseInLocate

isIgnoreCaseInStringCompares

isLastMouseClickedValid

isLastMouseRightClickedValid

isLeapYear

isLeft

isLeftDown

isLinked

isMaximized

isMiddleDown

isMinimized

isPreFilter

isRecordDeleted (TCursor Type)

isRecordDeleted (UIObject Type)

isRemote

isRemovable

isResizeable

isRight

isRightDown

isShared (Table Type)

isShared (TCursor Type)

isShiftKeyDown (KeyEvent Type)

isShiftKeyDown (MouseEvent Type)

isShowDeletedOn

isSpace

isSQLServer

isTable (Database Type)

isTable (Table Type)

isTargetSelf

isToolbarShowing

isValid

isView

isVisible

J-K

keyChar (Form Type)

keyChar (UIObject Type)

keyNameToChar

keyNameToVKCode

keyPhysical (Form Type)

keyPhysical (UIObject Type)

killTimer

L

linkFromClipboard

ln

load (Form Type)

load (Report Type)

load (Script Type)

loadProjectAliases

locate (TCursor Type)

locate (UIObject Type)

locateNext (TCursor Type)

locateNext (UIObject Type)

locateNextPattern (TCursor Type)

locateNextPattern (UIObject Type)

locatePattern (TCursor Type)

locatePattern (UIObject Type)

locatePrior (TCursor Type)

locatePrior (UIObject Type)

locatePriorPattern (TCursor Type)

locatePriorPattern (UIObject Type)

lock (Session Type)

lock (Table Type)

lock (TCursor Type)

lockRecord (TCursor Type)

lockRecord (UIObject Type)

lockStatus (TCursor Type)

lockStatus (UIObject Type)

log

logical

LongInt

lower

lTrim

M

makeDir

match

max

maximize

memo

menuAction (Form Type)

menuAction (UIObject Type)

menuChoice

message

methodDelete

methodGet

methodSet

milliSec

min

minimize

minute

mod

month

mouseClick

mouseDouble (Form Type)

mouseDouble (UIObject Type)

mouseDown (Form Type)

mouseDown (UIObject Type)

mouseEnter (Form Type)

mouseEnter (UIObject Type)

mouseExit (Form Type)

mouseExit (UIObject Type)

mouseMove (Form Type)

mouseMove (UIObject Type)

mouseRightDouble (Form Type)

mouseRightDouble (UIObject Type)

mouseRightDown (Form Type)

mouseRightDown (UIObject Type)

mouseRightUp (Form Type)

mouseRightUp (UIObject Type)

mouseUp (Form Type)

mouseUp (UIObject Type)

moveTo

moveToPage (Form Type)

moveToPage (Report Type)

moveToRecNo (TCursor Type)

moveToRecNo (UIObject Type)

moveToRecord (TCursor Type)

moveToRecord (TableView Type)

moveToRecord (UIObject Type)

moy

msgAbortRetryIgnore

msgInfo

msgQuestion

msgRetryCancel

msgStop

msgYesNoCancel

N

name

newValue

nextRecord (TCursor Type)

nextRecord (UIObject Type)

nFields (Table Type)

nFields (TCursor Type)

nFields (UIObject Type)

nKeyFields (Table Type)

nKeyFields (TCursor Type)

nKeyFields (UIObject Type)

nRecords (Table Type)

nRecords (TCursor Type)

nRecords (UIObject Type)

number

numVal

O

oemCode

open (Database Type)

open (DDE Type)

open (Form Type)

open (Library Type)

open (Report Type)

open (Session Type)

open (TCursor Type)

open (TextStream Type)

open (TableView Type)

openAsDialog

P

pixelsToTwips (System Type)

pixelsToTwips (UIObject Type)

play

pmt

point

position

postAction (Form Type)

postAction (UIObject Type)

postRecord (TCursor Type)

postRecord (UIObject Type)

pow

pow10

print

printerGetInfo

printerGetOptions

printerSetCurrent

printerSetOptions

priorRecord (TCursor Type)

priorRecord (UIObject Type)

privDir

projectViewerClose

projectViewerIsOpen

projectViewerOpen

protect

pushButton

pv

Q

qLocate

query

R

rand

readChars

readEnvironmentString

readFromClipboard (Binary Type)

readFromClipboard (Graphic Type)

readFromClipboard (OLE Type)

readFromFile (Binary Type)

readFromFile (Graphic Type)

readFromFile (Memo Type)

readFromFile (Query Type)

readFromFile (SQL Type)

readFromString (Query Type)

readFromString (SQL Type)

readLine

readProfileString

reason (ErrorEvent Type)

reason (Event Type)

reason (MenuEvent Type)

reason (MoveEvent Type)

reason (StatusEvent Type)

recNo

recordStatus (TCursor Type)

recordStatus (UIObject Type)

reIndex (Table Type)

reIndex (TCursor Type)

reIndexAll (Table Type)

reIndexAll (TCursor Type)

remove (Array Type)

remove (Menu Type)

removeAlias

removeAllItems

removeAllPasswords

removeItem (Array Type)

removeItem (DynArray Type)

removeMenu

removePassword

removeProjectAlias

rename (FileSystem Type)

rename (Table Type)

replaceItem

resourceInfo

resync

retryPeriod

rgb

rollBackTransaction

round

rTrim

run (Form Type)

run (Report Type)

run (Script Type)

S

save

saveCFG

saveProjectAliases

saveStyleSheet

search

second

selectCurrentTool

sendKeys

sendKeysActionID

sendToBack

seqNo

setAliasPassword

setAliasPath

setAliasProperty

setAltKeyDown

setChar

setControlKeyDown (KeyEvent Type)

setControlKeyDown (MouseEvent Type)

setData

setDefaultPrinterStyleSheet

setDefaultScreenStyleSheet

setDir

setDrive

setErrorCode

setExclusive

setFieldValue

setFileAccessRights

setFlyAwayControl

setGenFilter (Table Type)

setGenFilter (TCursor Type)

setGenFilter (UIObject Type)

setId (ActionEvent Type)

setId (MenuEvent Type)

setIndex (Table Type)

setInside

setItem

setLeftDown

setMenu (Form Type)

setMenu (Report Type)

setMenuChoiceAttributeById

setMiddleDown

setMousePosition

setMouseScreenPosition

setMouseShape

setNewValue

setPosition (Form Type)

setPosition (TextStream Type)

setPosition (UIObject Type)

setPrivDir

setProperty

setProtoProperty

setQueryRestartOptions

setRange (Table Type)

setRange (TCursor Type)

setRange (UIObject Type)

setReadOnly

setReason (ErrorEvent Type)

setReason (Event Type)

setReason (MenuEvent Type)

setReason (MoveEvent Type)

setReason (StatusEvent Type)

setRetryPeriod

setRightDown

setSelectedObjects

setShiftKeyDown (KeyEvent Type)

setShiftKeyDown (MouseEvent Type)

setSize

setStatusValue

setStyleSheet

setTimer

setTitle

setUserLevel

setVChar

setVCharCode

setWorkingDir

setX (MouseEvent Type)

setX (Point Type)

setXY

setY (MouseEvent Type)

setY (Point Type)

show (Form Type)

show (Menu Type)

show (PopUpMenu Type)

showDeleted (Table Type)

showDeleted (TCursor Type)

showToolbar

sin

sinh

size (Array Type)

size (Binary Type)

size (DynArray Type)

size (FileSystem Type)

size (String Type)

size (TextStream Type)

skip (TCursor Type)

skip (UIObject Type)

sleep

smallInt

sort

sound

space

splitFullFileName

sqrt

startUpDir

statusValue

string

strVal

substr

subtract (Table Type)

subtract (TCursor Type)

switchIndex (TCursor Type)

switchIndex (UIObject Type)

switchMenu

sysInfo

T

tableName

tableRights (Table Type)

tableRights (TCursor Type)

tan

tanh

time (FileSystem Type)

time (Time Type)

toANSI

today

toHex

toOEM

totalDiskSpace

tracerClear

tracerHide

tracerOff

tracerOn

tracerSave

tracerShow

tracerToTop

tracerWrite

transactionActive

truncate

twipsToPixels (System Type)

twipsToPixels (UIObject Type)

type (Table Type)

type (TCursor Type)

U

unAssign

unAttach

unDeleteRecord (TCursor Type)

unDeleteRecord (UIObject Type)

unLock (Session Type)

unlock (Table Type)

unlock (TCursor Type)

unlockRecord (TCursor Type)

unlockRecord (UIObject Type)

unProtect

updateLinkNow

updateRecord

upper

usesIndexes

V

vChar

vCharCode

version

view (Array Type)

view (AnyType Type)

view (DynArray Type)

view (Record Type)

view (UIObject Type)

vkCodeToKeyName

W

wait (Form Type)

wait (TableView Type)

wantInMemoryTCursor (Query Type)

wantInMemoryTCursor (SQL Type)

wasLastClicked

wasLastRightClicked

windowClientHandle

windowHandle

windowsDir

windowsSystemDir

winGetMessageID

winPostMessage

winSendMessage

workingDir

writeEnvironmentString

writeLine

writeProfileString

writeQBE

writeSQL

writeString

writeToClipboard (Binary Type)

writeToClipboard (Graphic Type)

writeToClipboard (OLE Type)

writeToFile (Binary Type)

writeToFile (Graphic Type)

writeToFile (Memo Type)

X

x (MouseEvent Type)

x (Point Type)

Y-Z

y (MouseEvent Type)

y (Point Type)

year


Introduction to ObjectPAL

See Also

ObjectPAL is the object-based Paradox application language. It is an event-driven programming language, different from a traditional procedural language in many ways. Using ObjectPAL, you place objects (for example, buttons and fields) in a form or report and attach code modules, called methods, that execute when something happens to the object.

ObjectPAL has two aspects:

The language itself (its object types, methods, procedures, and constructs)

The Integrated Development Environment (IDE), including

The Editor

The Debugger

A mechanism for creating and playing scripts

The application-delivery facilities

ObjectPAL methods and procedures fall into six language categories. Each category is in turn divided into several types. In addition to these six categories, there are basic language elements that are common to all methods and procedures.

The level of ObjectPAL that you are working in determines the number of methods available for each type. You can change the ObjectPAL level in the ObjectPAL Preferences dialog box by choosing Properties | ObjectPAL.

You can copy and paste the examples into your own code through the Clipboard.

From the Help window menu choose Edit | Copy, then select the block of code you want and click Copy.

Place the insertion point in your code where you want to insert the example, then choose Edit | Paste from the Paradox menu.

Choose from the following topics for more information:

Programming Tasks

ObjectPAL Language Categories

Objects

Events

Properties

ObjectPAL Language Components

Basic Language Elements

Procedures

RTL Procedures

Custom Procedures

Procedures Declared in Methods

Procedures Declared in an Object's Proc Window

Methods

Editing a Method

Built-In Methods (Overview)

Methods in the Run-Time Library

Custom Methods

Methods in Other Objects

Method Language Structure and Syntax

Containership

Variables

The Scope of a Variable

Constants


See Also

ObjectPAL IDE

Working with Tables


Programming Tasks

See Also

Here is a road map if you're looking for a shortcut into the ObjectPAL language. Before you jump to any of these topics, make sure you read about objects and events.

Messages and dialog boxes	Messages and built-in dialog boxes give you a way to interact with a user.

Handling keyboard events	You can trap for any keypress in ObjectPAL, which means you can easily develop hotkeys for your application.

Working with menus	Using ObjectPAL, you can define menus and pop-up menus to display choices to users.

Working with lists	You can use List boxes and Dropdown Edit boxes to let a user choose from a group of items.

Multiform applications	To design applications that use more than one form, you'll need to know how to open a form and control it from another form. Forms can also be opened as dialog boxes.

Working with text files	You can use ObjectPAL to work with text files. Text files are called TextStreams in ObjectPAL.

Using DLLs	With the Uses clause, you can declare and subsequently use functions called from DLLs (dynamic link libraries).

Working with the file system	Using methods in the FileSystem type, you can access and get information about disk files, drives, and directories. ObjectPAL also includes a built-in file browser dialog.


See Also

Objects

Events


Language Categories
ObjectPAL Language Categories

See Also

Paradox and ObjectPAL let you create compiled applications from these major components:

Category	Description	Object types
Data model objects	Let you work with data stored in tables	Database, Query, Table, TCursor, SQL
System data objects	Let you store data, but not in tables	DDE, FileSystem,Library, Session, System, TextStream
Data types	The basic ObjectPAL data types	AnyType, Array, Binary, Currency, Date, DateTime, DynArray, Graphic, Logical, LongInt, Memo, Number, OLE, Point, Record, SmallInt, String, Time
Design objects	Let you create the user interface to your application	Menu, PopUpMenu, UIObject
Display managers	Let you control how data is presented to the user	Application, Form, Report, Script, TableView
Events	Contain information about actions in Paradox	ActionEvent, ErrorEvent, Event, KeyEvent, MenuEvent, MouseEvent, MoveEvent, StatusEvent, TimerEvent, ValueEvent
Using Paradox and ObjectPAL, you can build applications incrementally. That is, you can build some of the tables, create some of the objects, and write some of the methods, test and refine these, then add more tables, objects, and methods, and so on, until the application is complete.


See Also

Basic Language Elements (Overview)


Objects
Objects (Overview)

See Also

In Paradox, everything is an object---from the buttons and fields you create using tools in the Toolbar, to tables and text files stored on disk, to menus and pop-up menus created in code. Paradox recognizes two kinds of objects: design objects and data objects. Design objects are objects you place in a form (for example, a button) are design objects, and data objects are files, data types, and programming structures.

All Paradox objects have

Properties	color, font, line width, and so on

Methods	code that defines how the object responds to an event

You can modify these properties and methods. Any object you can create or modify  using Paradox interactively, you can create or modify using ObjectPAL

Objects and Methods

Creating Paradox applications is largely a process of placing objects in forms and writing ObjectPAL methods to define how those objects respond to events. Such applications are sometimes called "Hey you, do this" applications. The "Hey you" part (called an event) happens when the user does something to an object---for example, points to a button in a form and clicks the mouse. The "do this" part is defined by methods---code that runs when the object handles an event. Some objects can display other objects (such as a lookup list), or chain to another stage in the application (for example, another form, query, or report).

Object Types

ObjectPAL objects are grouped by type. ObjectPAL Language Categories contains groups of  types and gives you access to help on the methods in each type.

For each method, you'll find syntax, description, and sample code you can copy and paste into your own code through the Clipboard.


See Also

Properties and Property Values

Properties Unique to Graph Objects

UIObject Properties


Events
Events (Overview)

See Also

Examples of events are:

Pressing the mouse button

Releasing the mouse button

Moving the mouse pointer over an object

Pressing a key

Moving the cursor into a field

Moving the cursor out of a field

Selecting an item from a menu

Events can happen for other reasons, too. For example, the timer event happens after a certain amount of time passes. You can also generate events from within your own methods.

Using ObjectPAL, you can create methods that define how objects respond to events. All objects have default methods for ObjectPAL events. You don't have to write methods for all the events an object can handle, and an event never goes unrecognized.


See Also

List of Events


Properties
Properties (Overview)

See Also

Objects have properties such as color, pattern, font, and line width.

You can use Paradox to set and change these properties or you can do it with ObjectPAL. Everything you can do in Paradox, you can do in ObjectPAL.

For example, the following statements set the color of rectangle box1 to red, set the font of field field1 to Times, and make myCircle invisible.

box1.color = "Red"    ; sets color of box1 to red
field1.font = "Times" ; sets font of field1 to times
myCircle.visible = No


See Also

Properties and Property Values

Properties Unique to Graph Objects

UIObject Properties


ObjectPAL Language Components

There are three components of the ObjectPAL language:

Basic Language Elements	The fundamental structural elements of ObjectPAL

Procedures	Methods bracketed by the commands PROC and ENDPROC

Methods	Code attached to an object which defines that object's behavior


Basic Language Elements
Basic Language Elements (Overview)

See Also

Basic language elements are the fundamental structural elements of ObjectPAL. Most of these elements are not bound to specific object types; they work for all object types. You can use these elements to assign values, call functions from DLLs, build control structures like if...then...else...endIf loops, while...endWhile loops, and switch...case...endSwitch structures. You can also declare methods, procedures, constants, variables, and data types.


See Also

Basic Language Elements


Procedures

See Also

There are two kinds of procedures in ObjectPAL: procedures in the ObjectPAL runtime library (RTL), and custom procedures you create. Procedures in the RTL are just like methods except they never explicitly specify an object. A custom procedure resembles procedures in many other programming languages; it is a routine you write yourself and use like a subroutine.


See Also

RTL Procedures

Custom Procedures


RTL Procedures

See Also

The procedures in the ObjectPAL run-time library are just like ObjectPAL methods, with one exception: Procedures never specify an object. Any method in any object can call any ObjectPAL procedure, and the procedure will know what to do. For example, the statement

close()

calls the Form type procedure quit, which closes the current form. The System type includes a number of procedures for interacting with users, for example message, msgInfo, and msgStop.

msgStop("Alert!", "This file already exists.")

The System type also includes the procedures beep and sleep, and several enumeration procedures for getting and setting the mouse position and shape.

method pushButton(var eventInfo Event)
beep()             ; plays the system beep sound
sleep(2000)        ; waits for 2 seconds
beep()
message("Did you hear two beeps?")
                   ; displays a message in the status line
sleep(2000)
enumAllObjectSource("mySource.db")
                   ; creates a table of all methods in this form
endMethod

Like ObjectPAL methods, ObjectPAL procedures are associated with object types, and they execute in response to events. It may be helpful to think of ObjectPAL procedures as methods with the object implied.


See Also

Custom Procedures


Custom Procedures

See Also

Custom procedures in ObjectPAL resemble procedures in many other programming languages. A custom procedure is a routine you write and use like a subroutine.

Custom procedures can be attached to the object itself, or to any object in the containership hierarchy, or to the form itself.

Custom procedures can be included in libraries, but can only be invoked from within the library.

Note:	ObjectPAL can call a custom procedure faster than it can a call custom method. The code executes at the same, speed, but ObjectPAL can "find" a procedure faster than it can find a method.

Use a proc block to declare a custom procedure. The structure is

PROC name (parameterDescription) [return type]
   [CONST section]
   [TYPE section]
   [VAR section]
   [ObjectPAL statements]
ENDPROC

You can declare procedures in two places:

Within a method

In an object's Proc window


See Also

Basic Language Elements (Overview)

Containership

Controlling the Scope of a Library

Libraries

RTL Procedures

proc


Procedures Declared in Methods

See Also

A procedure declared in a method is private: Its scope is limited to the method in which it is defined.

Here's an example of a custom procedure:

proc inc (x SmallInt) SmallInt
   return x+1 ; increments a number
endProc

The following example shows how to call that procedure (and another one) from within a method. (In this example, it's the pushButton method, but it could be any method.)

proc inc (x SmallInt) SmallInt
   return x+1
endProc

proc showMe (x SmallInt)
   msgInfo("myNum = ", x)
endProc

method pushButton (var eventInfo Event)
var
   myNum SmallInt
endVar
   myNum = 3
   showMe(myNum)
   myNum = inc(myNum)
   showMe(myNum)
endMethod


See Also

Custom Procedures

Procedures Declared in an Object's Proc Window

The Scope of a Variable


Procedures Declared in an Object's Proc Window

See Also

A procedure declared in an object's Proc window has the same syntax as a procedure declared in a method, but it has a different scope.

A procedure declared in an object's Proc window is visible to all methods attached to that object, and to all methods in objects contained by that object. So, to make a procedure available to every object in a form, declare it in the form's Proc window.


See Also

Attaching Methods to a Form

Containership

Custom Procedures

Tools | Object Tree

Procedures Declared in Methods


Methods
Methods (Overview)

See Also

A method is code that defines the behavior of an object. Methods define how an object responds to events. ObjectPAL methods fall into one of three categories:

Built-in methods included with every Paradox object

Methods in the ObjectPAL run-time library

Custom methods you create


See Also

Alphabetical List of Methods

Built-in Methods (Overview)

Custom Methods

Editing a Method

Methods in Other Objects

Methods in the Run-Time Library

The Method Inspector

Types and Methods Dialog Box

The Scope of a Variable


Editing a Method

See Also

To edit a method for an object, right-click the object and select Methods from the Properties menu. Select a method from the Method Inspector by double clicking it. The code for the method appears in the Editor window.

To edit the method for a form, right-click the form's title bar and then choose Methods. The Methods Inspector appears.

You can type the text for a method directly in the Editor, or use the Clipboard to copy, cut, and paste methods and parts of methods from other objects. However, there is no linkage or relationship between the original method and the copied method. Changes made to one are not reflected in the other.

You can also copy a method by copying an object from a design document. When you copy an object, all methods attached to the object are copied as well. However, there is still no linkage after the copy.


See Also

The Method Inspector

Types and Methods Dialog Box


Built-In Methods
Built-In Methods (Overview)

See Also

Every Paradox object comes with built-in methods (for example, open, close, and mouseUp) for each event it can respond to. The built-in code for these methods specify an object's default behavior in response to a given event. You can add your own code to built-in methods using the ObjectPAL Editor. To edit a built-in method for an object, inspect the object and select Methods from its menu. Select one or more methods from the Method Inspector, then choose OK to open one or more ObjectPAL Editor windows. You can type the text for a method directly in the ObjectPAL Editor, or use the Clipboard to copy, cut, and paste methods and parts of methods from other objects.


See Also

List of Built-in Methods

The Method Inspector

Types and Methods Dialog Box


Methods in the Run-Time Library

See Also

The ObjectPAL run-time library (RTL) is a collection of predefined routines. It includes methods you can use to perform a wide range of tasks, from reading and editing data in tables to creating and displaying menus. Each of these methods is associated with an object type; all the methods for working on forms are in the Form type, all the methods for working with text files are in the TextStream type, and so on.

ObjectPAL methods are symmetrical and consistent. Within a type, methods often come in pairs. For example, if a type has an open method, you can expect it to have a close method, too. If you can read information from an object, you can write to it; if you can get a value, you can set it.

ObjectPAL methods are consistent across types because methods with similar names do similar things. For example, open makes an object available for manipulation, whether the object is a table or a text file, and close puts it away. The underlying code may differ, but conceptually, the results are the same.

Methods in the run-time library require you to use dot notation to specify an object to operate on.


See Also

Containership

ObjectPAL Language Categories

The Method Inspector

Types and Methods Dialog Box


Custom Methods

See Also

Custom methods are auxiliary methods you create. They are convenient for making frequently used routines available to several objects.

Custom methods attached to a form are available to all objects in the form. That way, you only have to maintain the code in one place.

To create a custom method, inspect an object, choose Methods, then choose the New Custom Method text box. In the edit box, type a name for the custom method, then choose OK to open an ObjectPAL Editor window. You can type or paste text into custom methods just as you can for built-in methods.

After you save a custom method, its name is listed in the Method Inspector. To make changes, choose the name and open an ObjectPAL Editor window, just as you would to edit a built-in method.

You can copy, cut, and paste an entire object. When you do, all methods attached to the object are copied as well. However, there is no link or relationship between the original method and the copied method. Changes made to one are not reflected in the other.


See Also

Containership

The Method Inspector

Types and Methods Dialog Box


Methods in Other Objects

See Also

Methods are public: that is, methods attached to an object can be called by other objects. For example, suppose a form contains two boxes: box1 and box2. If box1 has a method fred, box2 could use dot notation to call it:

box1.fred()

If you attach a custom method to a form, which is the top level of the containership hierarchy, all objects contained in the form have direct access to that method. For example, if you attach the custom goNextPage method to a form, a button on that form could call goNextPage like this:

method pushButton (var eventInfo Event)
goNextPage() ; this is a custom method attached to the form
endMethod

In this example, we didn't have to use dot notation because the pushButton method is attached to the button, and the button is contained by the form, so it has direct access to the form's methods.

When you compile this method, ObjectPAL searches other objects for goNextPage, so it executes without delay at run time.


See Also

The Scope of a Variable


Method Language Structure and Syntax

See Also

In terms of structure and syntax, ObjectPAL methods resemble traditional programs. Some aspects of this structure are:

Methods can have parameters (also called arguments).

Methods are delineated by the method...endMethod keywords. You can define an ordered structure of execution because ObjectPAL supports control structures and loops like while...endWhile, if...then...else...endIf, and switch...case...endSwitch.

As in Pascal and C, you can define procedures to perform one or more tasks. Procedures can receive arguments from and return results to the method that calls them.

Also as in C, you can freely use whitespace (tabs, spaces, and blank lines). You can choose to indent subordinate method lines, put one or more statements on a line, and append a comment to any method line---whitespace has no effect on how statements are executed.


See Also

Alphabetical List of Methods


Containership

See Also

Paradox objects coexist in a hierarchy of containers: When you place a table object, for example, on a page of a form, that page contains the table. Forms contain tables, tables contain records, records contain fields, fields can contain buttons, and so on.

An object is contained only if it is completely within the boundaries of the container.

Position in this hierarchy is important because it defines what an object can see of other objects---their properties and their variables.

An object cannot see variables in the objects it contains.

An object can see its own variables, as well as the variables in objects that contain it.

To put it another way, if you think of objects as boxes containing smaller boxes, the smallest box has the best view.


See Also

Variables


Variables

See Also

A variable is like a slot where you can temporarily store one item of information.

The value of a variable can be of any ObjectPAL type (also called a data type). It is not necessary to explicitly indicate a data type for variables.

Specifying a variable's data type before using it is called declaring a variable.

The simplest way to give a variable a value is to use the assignment operator (=).


See Also

The Scope of a Variable


The Scope of a Variable

The term "scope" means "accessiblity." The scope of a variable, that is, the range of objects that have access to it is defined by the objects in which it is declared, and by the containership hierarchy. Objects can access only their own variables and the variables defined in the objects that contain them. Also, the scope of a variable depends on where it is declared:

Within a Method

Variables declared within a method are visible only to that method, and are accessible only while that method executes. They are initialized (reset) each time the method executes.

Outside a Method

Variables declared in a method window before the keyword method are visible only to that method, but are not initialized each time the method executes.

In the Var Window

Variables declared in an object's Var window are visible to all methods attached to that object, and to any objects that object contains. A variable declared in an object's Var window is attached to the object, and is accessible as long as the object exists in the form and the form is open.

Within the Containership Hierarchy (Compile-time Binding)

In programming terms, "binding" a variable is the process of connecting a variable to a data type. The ObjectPAL compiler binds variables when it compiles the source code; there is no run-time binding in ObjectPAL. When the compiler encounters a variable in a statement, it searches the rest of the source code to find out where the variable is declared so it can bind the variable to the declared data type.


Constants
Constants (Overview)

See Also

The ObjectPAL language includes many predefined constants. Constants are like variables except they are protected from change when the program runs, enabling the compiler to generate more efficient code.

You can define constants for a single method, or open a Const window to define constants for all the object's methods.

Constants are automatically put into resources, where they can be modified without affecting the source code.


See Also

Types of Constants


ObjectPAL Glossary

ObjectPAL terms

A

active

ANSI

application

argument

array

array element

ASCII

B

blank

braces

branching commands

breakpoint

bubbling

built-in method

C

column

compound object

constant

container

containership

control structure

Ctrl+Break

D

data

Database

data type

DDE

deadlock

Debugger

Desktop

Display manager

DLL

dynamic array

E

Editor

encrypt

event

event-driven application

event model

example element

expression

F

field

field assignment

field object

field type

field value

field view

file

FileSystem

focus

format specification

form

function keys

G

global variable

H

handle

Help

hierarchy

I

IBM extended codes

incremental development

index

insertion point

inspect

J-K

key

keycode

key field

keyword

L

lastMouseClicked

lastMouseRightClicked

library

lifetime

link key

local variable

logical operator

logical value

loops

M

menu

menu choice

message

method

N

normalized data structure

O

object

Object Tree

P

parameter

picture

pixel

point

pointer

post

primary index

procedure

prompt

properties

Q

QBE

query

query by example (QBE)

quoted string

R

raster operation

record

record number

relational database

reserved words

restricted view

row

run-time error

run-time library

S

scope

script

secondary index

Self

session

slash sequence

string

structure

subject

substring

syntax error

T

Tableview

target

TCursor

tilde variable

transaction

twip

type

U-Z

validity check

variable


active, defined
active

Active is a built-in object variable that represents the currently active objectthe last object to receive a moveTo. Typically, the active object is highlighted.

When an active object is set to respond to keyboard events, it is said to have focus. Even when focus is removed from an object (for example, to activate another form), Active still refers to that object. Only when someone moves off that object is Active reset to the new object. Dont underestimate the importance of Active, since general routines can be written to operate on the active object without really knowing which one it is. For example, suppose a form contains two table frames, each bound to a different table. The following statement automatically operates on the active table frame:

active.action(DataNextRecord)


ANSI, defined
ANSI

An acronym for American National Standards Institute; a sequence of eight-bit codes that defines 256 standard characters, letters, numbers, and symbols. The ASCII character set (see below) is the same as the first 128 ANSI characters.


application, defined
application

An ObjectPAL type you can use to get a handle to the a Paradox application. Also a group of forms, methods, queries, and procedures forming a single unit, where users can enter, view, maintain, and report their data.


argument, defined
argument

Information passed to a method or procedure (also called a parameter).


array, defined
array

A special kind of object that consists of several elements. Items in an array are designated by subscripts enclosed in square brackets, so that ar[1] and ar[2] are the first two items of an array named ar.


array element, defined
array element

One component of an array. For example, the array created with the following declaration has seven string elements, ar[1] through ar[7].

ar Array [7] String

Elements are also called items.


ASCII, defined
ASCII

An acronym for American Standard Code for Information Interchange; a sequence of seven-bit codes that define 128 standard characters, letters, numbers, and symbols. The IBM PC extends this code to 8 bits to include some special graphic characters. Windows products use the ANSI character set.


blank, defined
blank

A field or variable that has no value.


braces, defined
braces

The symbols { and } .  Braces mark comments in code.


branching commands, defined
branching commands

Control structures that perform specific commands depending on whether certain conditions are met. Examples: if, while.


breakpoint, defined
breakpoint

A flag set in source code that causes execution to suspend.  Used in debugging.


bubbling, defined
bubbling

A process by which events pass from the target object up through the containership hierarchy.


built-in method, defined
built-in method

Pre-defined code that comes with every object you can place in a form. Built-in methods define an object's default response to events.


column, defined
column

A vertical component of a Paradox table that contains one field.  In a Paradox report, a vertical area containing one or more fields.


compound object, defined
compound object

An object made up of two or more other objects. For example, a table frame is a compound object made of field objects and record objects.


constant, defined
constant

A constant represents a value that cannot be changed. For example, DataNextRecord is an ObjectPAL constant that specifies a move to the next record in a table.


container, defined
container

Container is a built-in object variable that represents the object that contains Self. For example, suppose a box contains a button, and the buttons pushButton method is as follows:

container.color = Red

When this code executes, the box turns red, because the box contains the button, and the button is executing the code.


containership, defined
containership

One object contains another object if the other object is completely within the borders of the first object. Containership affects the availability of variables, methods, and procedures.


control structure, defined
control structure

A sequence of branching statements, such as if...then...endIf or while ...endWhile, that affects the order in which statements execute.


Ctrl+Break, defined
Ctrl+Break

A key sequence that halts program execution. You can configure Paradox to respond to Ctrl+Break by choosing Properties | ObjectPAL and checking Enable Crtl + Break.


data, defined
data

The information Paradox stores in a table.


Database, defined
Database

An object type that contains information about relationships between tables or access to the tables.


data type, defined
data type

The type of data that a field, variable,ar array element contains.


DDE, defined
DDE

Stands for Dynamic Data Exchange. A way for Windows applications to share data.


deadlock, defined
deadlock

A situation created in a multiuser environment when two incompatible lock commands are issued concurrently.


Debugger, defined
Debugger

Part of the ObjectPAL Integrated Development Environment (IDE), the Debugger lets you interactively test and trace execution of commands in your methods.


Desktop, defined
Desktop

The main window in Paradox.


Display manager, defined
Display manager

A category of object types that includes Application, Form, Report, and Table View.


DLL, defined
DLL

Stands for Dynamic Link Library. A DLL is a program that allows Windows programs to share code that performs common tasks.


dynamic array, defined
dynamic array

A special kind of array where each item has a string for an index. For example, ["Product"], [" Paradox for Windows"], [" Type"] [" Relational database"], ["]Version"] [1.0].


Editor, defined
Editor

The component of the ObjectPAL Integrated Development Environment (IDE) used to create and edit ObjectPAL methods.


encrypt, defined
encrypt

To translate a table or script into code that cannot be read without the proper password.


event, defined
event

The action that triggers a method (that is, causes code to execute). Also an object type (Event).


event-driven application, defined
event-driven application

An application where code executes in response to events, as opposed to a procedural application, where code executes in a linear sequence.


event model, defined
event model

The rules that specify how events are processed by objects in a form.


example element, defined
example element

In a query statement, an arbitrary sequence of characters that represents any value in a field. In Paradox you indicate an example element by pressing Example and typing the characters in the query image. In methods, you indicate example elements by preceding the characters with an underscore.


expression, defined
expression

A group of characters that can include data values, variables, arrays, operators, or functions that represent a quantity or value.  An expression can evaluate to a specific data type or, in certain cases, first be converted to string values before it is evaluated.


field, defined
field

One item of information in a table. A collection of related fields makes up one record.


field assignment, defined
field assignment

Use of dot notation to assign the value of an expression to a field.


field object, defined
field object

A UIObject that can be bound to a field in a table or unbound.


field type, defined
field type

The kind of information that can be entered into a field of a table. See also Data type.


field value, defined
field value

The data contained in one field of a record. If no data is present, the field is considered blank. Field objects have a Value property.


field view, defined
field view

Lets you move the insertion point through a field, character by character. It is used to view field values that are too large to be displayed in the current field width, or to edit a field value.


file, defined
file

A collection of information stored under one name on a disk. For example, Paradox tables are stored in files.


FileSystem, defined
FileSystem

An ObjectPAL type. FileSystem variables contain information about disk files.


focus, defined
focus

An attribute of an object. An object that has focus (also called the active object) is ready to handle keyboard input. Typically the active object is highlighted.


format specification, defined
format specification

The way in which a field value is displayed onscreen or output to a printer.


form, defined
form

A window for displaying data and objects. Also an ObjectPAL type (Form). The form is the highest-level container object.


function keys, defined
function keys

The 12 keys across the top of the keyboard. (Some keyboards have 10 keys at the far left of the keyboard labeled F1 through F10).


global variable, defined
global variable

A variable available to all objects in a form. See also local variable.


handle, defined
handle

A variable you can use in code to manipulate objects.


Help, defined
Help

The Paradox online Help system. You can press F1 at any point in Paradox to display information about the current operation.


hierarchy, defined
hierarchy

The relationship of objects in a form, derived from their visual, spatial relationship. See also containership.


IBM extended codes, defined
IBM extended codes

Keys or combinations of keys on the keyboard that do not correspond to any of the standard ASCII character codes and are given special extended code numbers between  -1 and -132.


incremental development, defined
incremental development

A process of application development in which small parts or the general structure of the application are designed and tested interactively.


index, defined
index

A file that determines the order in which Paradox can access the records in a table. The key field of a Paradox table establishes its primary index. See also key, secondary index.


insertion point, defined
insertion point

The place where text is inserted when you type. The insertion point is usually represented by a flashing vertical bar.


inspect, defined
inspect

To view or change an object's properties. To inspect an object, either right-click it or select it with the keyboard and press F6.  The object's menu appears. Choose from the menu the property you want to change.


key, defined
key

A field or group of fields used to order records. See also key field.


keycode, defined
keycode

A code that represents a keyboard character in ObjectPAL methods.  May be an ANSI number or a string representing a key name known to Paradox.


key field, defined
key field

A field designated as all or part of an identifier of the records in a Paradox table. Establishing a key has three effects: the table is prevented from containing duplicate records, the records are maintained in sorted order based on the key fields, and a primary index is created for the table.  See also index.


keyword, defined
keyword

A word reserved by ObjectPAL. A keyword must not be used as the name of a variable, array, method, or procedure.


lastMouseClicked, defined
lastMouseClicked

LastMouseClicked is a built-in object variable that represents the last object to receive a mouseDown. It is reset when the mouse button is released, but only after the object has been given a chance to do its mouseUp.


lastMouseRightClicked, defined
lastMouseRightClicked

LastMouseRightClicked is a built-in object variable that represents the last object to receive a mouseRightDown. It is reset when the mouse button is released, but only after the object has been given a chance to do its mouseRightUp.


library, defined
library

A collection of ObjectPAL code that can be used by objects in one or more forms.


lifetime, defined
lifetime

The length of time an item is active or available.


link key, defined
link key

In a linked multi-table form, the part of the subordinate table's key that is linked or matched to fields in the master table.


local variable, defined
local variable

A variable that is available only to the method or procedure in which it is declared. See also global variable.


logical operator, defined
logical operator

One of three operators (AND, OR, or NOT) that can be used on logical data. For example, an AND between two logical values results in a logical value of True if both the original values are also True. Also known as Boolean operators.


logical value, defined
logical value

A value (True or False) assigned to an expression when it is evaluated. Also known as Boolean value.


loops, defined
loops

Control structures that repeat a series of commands until a certain condition is met. See also control structures.


menu, defined
menu

A display of the choices or options available. Using ObjectPAL, you can create and edit both application menus and pop-up menus.


menu choice, defined
menu choice

A command chosen from a menu.


message, defined
message

A string expression displayed in the status line.


method, defined
method

ObjectPAL code attached to an object that defines the object's response to an event.


normalized data structure, defined
normalized data structure

An arrangement of data in tables where each record includes the fewest number of fields necessary to establish unique categories. Rather than using a few records to provide all possible information, a normalized table spreads out information over many records using fewer fields. A normalized table provides more flexibility in terms of analysis.


object, defined
object

An encapsulation of data and code: the data defines the object's properties, the code defines the object's response to an event.


Object Tree, defined
Object Tree

A diagram that shows how objects in a form are related in terms of containership.


parameter, defined
parameter

The variable into which an argument is passed. Used in defining procedures.


picture, defined
picture

A pattern of characters that defines what a user can type into a field during editing or data entry, or in response to a prompt.


pixel, defined
pixel

A single point on the screen. The name comes from picture element.


point, defined
point

An ordered pair of numbers that represents a location on screen.


pointer, defined
pointer

A visual marker that indicates the mouse location on screen.


post, defined
post

Accept changes to a record and put the data into the table. Also called commit.


primary index, defined
primary index

An index on the key fields of a Paradox table. A primary index determines the location of records, lets you use the table as the detail in a link, keeps records in sorted order, and speeds up operations. See also key, secondary index.


procedure, defined
procedure

Code bracketed by the keywords proc and endProc. Unlike a method, it has no object to give it context.


prompt, defined
prompt

Instructions displayed on the screen, usually in the status bar. Prompts ask for information or guide the user through an operation.


properties, defined
properties

The attributes of an object. You right-click an object to view or change properties. See also inspect.


QBE, defined
QBE

See query by example.


query, defined
query

A question you ask about information in a table, formulated in a query form. Also an ObjectPAL type (Query).


query by example (QBE), defined
query by example (QBE)

The method of asking questions about data by providing examples of the answers you want.


quoted string, defined
quoted string

Text enclosed in double quotation marks.


raster operation, defined
raster operation

An operation that specifies how colors are blended on the screen.


record, defined
record

A horizontal row in a Paradox table that contains a group of related fields of data. Also an ObjectPAL type (Record).


record number, defined
record number

A unique number that identifies each record in a table.


relational database, defined
relational database

A database design in accordance with a set of principles called the relational mode1. Data in a relational database must be organized into tables.


reserved words, defined
reserved words

The names of commands, keywords, functions, system variables, and operators. These words may not be used as ObjectPAL variables or array names. See also keywords.


restricted view, defined
restricted view

A detail table on a multi-table form, linked to the master table on a one-to-one or one-to many basis, limited to showing only those records that match the current master record.


row, defined
row

A horizontal component of a table, called a record, in Paradox.


run-time error, defined
run-time error

An error that occurs when a syntactically valid statement cannot be carried out in the current context.


run-time library, defined
run-time library

A collection of pre-defined methods and procedures that operate on objects in specific types.


scope, defined
scope

The accessibility or availability of a variable, method, or procedure to other objects.


script, defined
script

A collection of ObjectPAL code that executes without opening a window.


secondary index, defined
secondary index

An index used for linking, querying, and changing the view order of tables.


Self, defined
Self

Self is a built-in object varaible that represents the object to which the currently executing code is attached. For example, when the following statement executes in the mouseEnter method attached to theBox, Self refers to theBox.

self.color = Red

But, suppose a method attached to theBox calls a custom method named changeColor attached to the page. Suppose the code for changeColor is

method changeColor()
self.color = Blue
endMethod

When the method attached to theBox calls changeColor, the page turns blue, not theBox. Why? Because Self refers to the object to which the code is attachedregardless of which object actually called the codeand in this case, the code is attached to the page. The single exception to this rule is when Self appears in a statement in a library. In this case, Self refers to the object that called the library routine.

When an event occurs, Self and eventInfo.getTarget may refer to the same object, but as events bubble up the containership chain, the target remains fixed while Self changes to refer to the object executing the method.

Self always refers to a UIObject, not to the objects value or the objects name.


session, defined
session

A channel to the database engine. Also an ObjectPAL type (Session).


slash sequence, defined
slash sequence

A backslash followed by one or more characters, to represent an ASCII character. Examples are \" or \018. Slash sequences are used for placing quotation marks within strings and including other characters that have special meaning to Paradox.


string, defined
string

An alphanumeric value, or an expression consisting of alphanumeric characters. Also an ObjectPAL type (String).


structure, defined
structure

The arrangement of fields in a table.


subject, defined
subject

Subject is a built-in object variable that specifies which object a custom method should operate on. For example, suppose a page in a form has a custom method setColor, and this is the code for setColor:

method setColor()
   subject.color = red
endMethod

Any object on that page can make the following call, and the object named someObject will turn red. When setColor executes, it replaces Subject with someObject.

someObject.setColor()


substring, defined
substring

Any part of a string.


syntax error, defined
syntax error

An error that occurs due to an incorrectly expressed statement.


table, defined
table

A strcuture made up of rows (records) and columns (fields) that contains information.


table alias, defined
table alias

Alternate name for a table in a data model.


TableView, defined
TableView

An ObjectPAL type. Use it to get a handle to a table view, the representation of a table in rows and columns.


target, defined
target

The object for which an event is intended. For example, when you click a button, the button is the target.


TCursor, defined
TCursor

An ObjectPAL type. A pointer to the data in a table. Using TCursors, you can manipulate data without having to display the actual table.


tilde variable, defined
tilde variable

A variable used in a query form, which must be preceded by a tilde(~).


transaction, defined
transaction

A group of related changes to a database.


twip, defined
twip

A unit of measurement equal to 1/1440 of a logical inch (1/20 of a printer's point).


type, defined
type

A way of classifying objects that have similar attributes. For example, all tables have attributes in common, and all forms have attributes in common, but the attributes of tables and forms are different. Therefore, tables and forms belong to different types.


validity check, defined
validity check

A constraint on the values you can enter in a field. Sometimes called a val check.


variable, defined
variable

A place in memory to store data temporarily.