Delphi - Visual Component Library PDF
Delphi - Visual Component Library PDF
Reference
Delphi for Windows
I n t r o d u c t i o n
Copyright
Agreement
This manual is a reference for the Delphi Visual Component Library (VCL) and the
Delphi run-time library. Use it when you want to look up the details of a particular VCL
object, component, variable, property, method, event, routine, or type and find out how
to use it.
Note See online Help for documentation of the Object Pascal Language Definition and
Reference.
Manual conventions
The printed manuals for Delphi use the typefaces and symbols described in
Table Intro.1 to indicate special text.
Table Intro.1 Typefaces and symbols in these manuals
Typeface or symbol Meaning
Monospace type Monospaced text represents text as it appears onscreen or in Object Pascal code.
It also represents anything you must type.
Boldface Boldfaced words in text or code listings represent Object Pascal reserved words
or compiler directives.
Italics Italicized words in text represent Object Pascal identifiers, such as variable or
type names. Italics are also used to emphasize certain words, such as new terms.
Keycaps This typeface indicates a key on your keyboard. For example, “Press Esc to exit a
menu.”
This symbol indicates a key, or important property, method, or event.
This symbol indicates a run-time only property, method or event.
Contacting Borland
The Borland Assist program offers a range of technical support plans to fit the different
needs of individuals, consultants, large corporations, and developers. To receive help
with this product send in the registration card and select the Borland Assist plan that
best suits your needs. North American customers can register by phone 24 hours a day
by calling 1-800-845-0147. For additional details on these and other Borland services, see
the Borland Assist Support and Services Guide included with this product.
Introduction 1
Delphi Visual Component Library
The VCL is made up of objects, most of which are also components. Using the objects
and components of VCL, you are unlimited in the range of Windows programs you can
develop rapidly. Delphi itself was built using VCL.
Delphi objects contain both code and data. The data is stored in the fields and properties
of the objects, and the code is made up of methods that act upon the field and property
values. All objects descend from the ancestor object TObject.
Components are visual objects that you can manipulate at design time. All components
descend from the TComponent object. To program with a component, this is the model
you will use most frequently:
1 Select a component from Delphi’s Component palette and add it to a form.
2 Set property values of the component using the Object Inspector.
3 Respond to events that might occur to the component at run time. To respond to an
event, you write code within an event handler. Your code modifies property values
and calls methods.
For detailed information on how to perform these three steps, see the Delphi User’s
Guide.
You can create your own objects and components by deriving them from the existing
Delphi objects and components. For information about writing your own components,
see the Delphi Component Writer’s Guide.
Note In addition to these objects, all VCL components also descend from TObject, although
not directly.
The TObject object introduces the following methods that all objects and components
inherit:
Table Intro.3 Object methods
ClassName ClassType Destroy
ClassParent Create Free
Introduction 3
Table Intro.4 VCL components (continued)
TButton TField TRadioButton
TBytesField TFileListBox TRadioGroup
TCheckBox TFilterComboBox TReplaceDialog
TColorDialog TFindDialog TReport
TComboBox TFloatField TSaveDialog
TCurrencyField TFontDialog TScreen
TDatabase TForm TScrollBar
TDataSource TGraphicField TScrollBox
TDateField TGroupBox TSession
TDateTimeField THeader TShape
TDBCheckBox TImage TSmallIntField
TDBComboBox TIntegerField TSpeedButton
TDBEdit TLabel TStoredProc
TDBGrid TListBox TStringField
TDBImage TMainMenu TStringGrid
TDBListBox TMaskEdit TTabbedNotebook
TDBLookupCombo TMediaPlayer TTable
TDBLookupList TMemo TTabSet
TDBMemo TMemoField TTimeField
TDBNavigator TMenuItem TTimer
TDBRadioGroup TNotebook TVarBytesField
TDBText TOLEContainer TWordField
TDDEClientConv TOpenDialog
Most components are available from the Component palette. You will not find the
following components on the Component palette, however:
Table Intro.5 Components not on the Component palette
TApplication TDateTimeField TScreen
TBCDField TField TSession
TBlobField TFloatField TSmallIntField
TBooleanField TGraphicField TStringField
TBytesField TIntegerField TTimeField
TCurrencyField TMemoField TVarBytesField
TDateField TMenuItem TWordField
The TComponent component introduces the following properties that all components
inherit:
Table Intro.6 Component properties
ComponentCount Components Owner
ComponentIndex Name Tag
In addition to the properties controls inherit from the TComponent component, the
TControl component introduces the following:
Table Intro.9 Control properties
Align Cursor ShowHint
BoundsRect Enabled Top
ClientHeight Height Visible
ClientOrigin Hint Width
ClientRect Left
ClientWidth Parent
Introduction 5
In addition to the methods controls inherit from the TComponent component, the
TControl component introduces the following methods:
Table Intro.10 Control methods
BeginDrag GetTextBuf Repaint
BringToFront GetTextLen ScreenToClient
ClientToScreen Hide SetBounds
ControlAtPos Invalidate SetTextBuf
Dragging Refresh Show
EndDrag SendToBack Update
In addition to the methods windowed controls inherit from the TControl component, the
TWinControl component introduces the following methods:
Table Intro.13 Windowed control methods
CanFocus Focused RemoveControl
ClientOrigin HandleAllocated ScaleBy
Create HandleNeeded ScrollBy
Destroy InsertControl SetFocus
Introduction 7
The following routines are used to display messages in dialog boxes:
Table Intro.16 Message dialog box routines
InputBox MessageDlg
InputQuery MessageDlgPos
The following routines are used to define menu command short cuts.
Table Intro.17 Menu shortcut routines
ShortCut ShortCutToText
ShortCutToKey TextToShortCut
The following routines are used to determine the parent form of components:
Table Intro.18 Parent form routines
GetParentForm ValidParentForm
The following routines are used to create graphical points and rectangles:
Table Intro.19 Point and rectangle routines
Bounds Point Rect
The following routines are used to control Object Linking and Embedding (OLE)
container applications:
Table Intro.20 OLE routines
BOLEMediumCalc LinksDlgEnabled ReleaseOLEInitInfo
ClearFormOLEDropFormats PasteSpecialDlg SetFormOLEDropFormats
InsertOLEObjectDlg PasteSpecialEnabled
LinksDlg RegisterFormAsOLEDropTarget
Library reference
The alphabetical reference following the sample entry in the next section contains a
detailed description of the Delphi VCL objects, components, variables, properties,
methods, events, routines, and types you use to develop Windows applications. The
reference also contains the procedures, functions, types, variables, and constants that
make up the Delphi run-time library and are declared in the System and SysUtils units.
These procedures and functions are useful routines that exist outside of the objects of
VCL. They are presented here so that you only need to search one reference source for
the information you need about programming Delphi applications.
Each alphabetically listed entry contains the declaration format and a description of the
entry. If the entry is an object, component, routine, or type, the unit that contains the
entry is listed at the beginning of the entry. (The unit that corresponds to a variable,
property, method, or event is the unit that contains the object or component to which the
entry belongs.) If the entry applies to specific objects or components, they are listed. The
Declaration
{ The declaration of the entry from the unit it occupies }
A description containing specific information about the entry.
Note Any special notes that apply to the entry
Example
A description of the example code that follows.
{ Example code which illustrates the use of the entry }
See also
Related entries that are also listed in the VCL Reference.
Introduction 9
10 Delphi Visual Component Library
Delphi Library Reference
Chapter 0
Abort method
Applies to
TPrinter object
Declaration
procedure Abort;
The Abort procedure terminates the printing of a print job, dropping all unprinted data.
The device is then set for the next print job. Use Abort to terminate the print job before it
completes; otherwise, use the EndDoc method.
To use the Abort method, you must add the Printers unit to the uses clause of your unit.
Example
The following code aborts a print job if the user presses Esc. Note that you should set
KeyPreview to True to ensure that the OnKeyDown event handler of Form1 is called.
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (Key=VK_ESCAPE) and Printer.Printing then
begin
Printer.Abort;
MessageDlg('Printing aborted', mtInformation, [mbOK],0);
end;
end;
See also
BeginDoc method, EndDoc method, Printer variable, Printing property
Aborted property
Applies to
TPrinter object
Declaration
property Aborted: Boolean;
Run-time and read-only. The Aborted property determines if the user aborted the print
job, thereby calling the Abort method. If Aborted is True, the print job was aborted. If it is
False, the user did not abort the print job.
Example
The following code displays a dialog box if the print job was aborted:
if Printer.Aborted then
MessageDlg(‘The print job did not finish printing’), mtInformation, [mbOK], 0);
See also
Abort method, Printer variable, Printing property
AbortOnKeyViol property
Applies to
TBatchMove component
Declaration
property AbortOnKeyViol: Boolean;
If AbortOnKeyViol is True (the default) and an integrity (key) violation occurs during the
batch move operation, the Execute method will immediately terminate the operation. If
you prefer to have the operation continue, with all key violations posted to the key
violations table, set AbortOnKeyViol to False.
Note If you set AbortOnKeyViol to False, you should provide a KeyViolTableName to hold the
records with errors.
Example
BatchMove1.AbortOnKeyViol := False;
See also
KeyViolCount property, KeyViolTableName property
Declaration
property AbortOnProblem: Boolean;
If AbortOnProblem is True (the default) and it would be necessary to discard data from a
source record to place it into the Destination, the Execute method will immediately
terminate the batch move operation. If you prefer to have the operation continue, with
all problems posted to the problems table, set AbortOnProblem to False.
Note If you set AbortOnProblem to False, you should provide a ProblemTableName to hold the
records with problems.
Example
BatchMove1.AbortOnProblem := False;
See also
ProblemCount property, ProblemTableName property
Example
var
r: Real;
i: Integer;
begin
r := Abs(-2.3); { 2.3 }
i := Abs(-157); { 157 }
end;
Active property
Applies to
TOLEContainer, TQuery, TStoredProc, TTable components
Example
{ Close the dataset }
Table1.Active := False;
{ Open the dataset }
Table1.Active := True;
See also
AutoActivate property, InPlaceActive property, OnActivate event
ActiveControl property
Applies to
TForm, TScreen components
Declaration
property ActiveControl: TWinControl;
For forms, the ActiveControl property indicates which control has focus, or has focus
initially when the form becomes active. Your application can use the ActiveControl
property to access methods of the active control. Only one control, the active control, can
have focus at a given time in an application.
For the screen, ActiveControl is a read-only property. The value of ActiveControl is the
control that currently has focus on the screen.
Note When focus shifts to another control, the ActiveControl property is updated before the
OnExit event of the original control with focus occurs.
Example
The following event handler responds to timer events by moving the active control one
pixel to the right:
procedure TForm1.Timer1Timer(Sender: TObject);
begin
ActiveControl.Left := ActiveControl.Left + 1;
end;
See also
ActiveForm property, OnActiveControlChange event, OnEnter event, OnExit event
ActiveForm property
Applies to
TScreen component
Declaration
property ActiveForm: TForm;
Run-time and read only. The ActiveForm property indicates which form currently has
focus, or will have focus when the application becomes active again after another
Windows application has been active.
Example
This example changes the color of the current form.
procedure TForm1.Button1Click(Sender: TObject);
begin
Screen.ActiveForm := clBlue;
end;
See also
ActiveControl property, ActiveMDIChild property, OnActivate event,
OnActiveFormChange event, Screen variable
ActiveMDIChild property
Applies to
TForm component
Declaration
property ActiveMDIChild: TForm;
Run-time and read only. The value of the ActiveMDIChild property is the form that
currently has focus in an MDI application.
Example
This code uses a button on an MDI application. When the user clicks the button, the
active MDI child form turns blue.
procedure TForm1.Button1Click(Sender: TObject);
var
BlueForm: TForm;
begin
BlueForm := Form1.ActiveMDIChild;
BlueForm.Color := clBlue;
end;
See also
ActiveForm property, FormStyle property, MDIChildCount property, MDIChildren
property
Declaration
property ActivePage: string;
The ActivePage property determines which page displays in the notebook or tabbed
notebook control. The value of ActivePage must be one of the strings contained in the
Pages property.
Example
This example uses a notebook control and a button on the form. The notebook has
multiple pages, including one called Graphics options. When the user clicks the button,
the Graphics options page displays in the notebook control.
procedure TForm1.Button1Click(Sender: TObject);
begin
Notebook1.ActivePage := 'Graphics options’;
end;
See also
PageIndex property, TTabSet component
Add method
Applies to
TFieldDefs, TIndexDefs, TList, TStringList, TStrings objects; TMenuItem, TOutline
components
Example
This example adds a new object to a list in a list object:
type
TMyClass = class
MyString: string;
constructor Create(S: string);
end;
constructor TMyClass.Create(S: string);
begin
MyString := S;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
MyList: TList;
MyObject, SameObject: TMyClass;
begin
MyList := TList.Create; { create the list }
try
MyObject := TMyClass.Create('Semper Fidelis!'); { create a class instance }
try
MyList.Add(MyObject); { add instance to list }
SameObject := TMyClass(MyList.Items[0]); { get first element in list }
MessageDlg(SameObject.MyString, mtInformation, [mbOk], 0); { show it }
finally
MyObject.Free;
end; { don't forget to clean up! }
finally
MyList.Free;
See also
Capacity property, Clear method, Delete method, Expand method, First method, IndexOf
method, Insert method, Last method, Remove method
Example
This code uses a button and a list box on a form. When the user clicks the button, the
code adds a new string to a list box.
procedure TForm1.Button1Click(Sender: TObject);
begin
ListBox1.Items.Add('New string');
end;
This code uses a list box, a button, and a label on a form. When the user clicks the
button, the code adds a new string to the list box and reports its position in the list box as
the caption of the label.
procedure TForm1.Button1Click(Sender: TObject);
var
Position: Integer;
begin
Position:= ListBox1.Items.Add('New item');
Label1.Caption := IntToStr(Position);
end;
See also
AddObject method, AddStrings method, Clear method, Delete method, Duplicates
property, Exchange method, Insert method, Items property, Lines property, Move method,
Sorted property
Example
This code adds a menu item to a File menu:
procedure Form1.Button1Click(Sender: TSender);
var
NewItem: TMenuItem;
begin
NewItem := TMenuItem.Create(Self);
NewItem.Caption := ‘New item’;
File.Add(NewItem);
end;
See also
Delete method, Insert method
For outlines
Declaration
function Add(Index: LongInt; const Text: string): LongInt;
The Add method adds an outline item (TOutlineNode object) to an outline. The value of
the Index parameter specifies where to add the new item. The Text parameter specifies
the Text property value of the new item. Add returns the Index property value of the
A
added item.
The added item is positioned in the outline as the last sibling of the outline item
specified by the Index parameter. The new item shares the same parent as the item
specified by the Index parameter. Outline items that appear after the added item are
moved down one row and reindexed with valid Index values. This is done automatically
unless BeginUpdate was called.
Note To add items to an empty outline, specify zero (0) as the Index parameter.
Example
The following code adds a new item at the top level of the outline. The new item is
identified by the text ‘New item’:
Outline1.Add(0, 'New item');
See also
AddChild method, AddChildObject method, AddObject method, Insert method, MoveTo
method
AddChild method
Applies to
TOutline component
Declaration
function AddChild(Index: LongInt; const Text: string): LongInt;
The AddChild method adds an outline item (TOutlineNode object) to an outline as a child
of an existing item. The value of the Index parameter specifies where to add the new
item. The Text parameter specifies the Text property value of the new item. AddChild
returns the Index property value of the added item.
The added item is positioned in the outline as the last child of the outline item specified
by the Index parameter. Outline items that appear after the added item are moved down
one row and reindexed with valid Index values. This is done automatically unless
BeginUpdate was called.
Note To add items to an empty outline, specify zero (0) as the Index parameter.
Example
The following code adds a new child to the selected item of the outline. The new item is
identified by the text ‘New child’:
Outline1.AddChild(Outline1.SelectedItem, 'New child');
See also
Add method, AddChildObject method, AddObject method, Insert method, MoveTo method
AddChildObject method
Applies to
TOutline component
Declaration
function AddChildObject(Index: LongInt; const Text: string; const Data: Pointer): LongInt;
The AddChildObject method adds an outline item (TOutlineNode object) containing data
to an outline as a child of an existing item. The value of the Index parameter specifies
where to add the new item. The Text parameter specifies the Text property value of the
new item. The Data parameter specifies the Data property value of the new item.
AddChild returns the Index property value of the added item.
The added item is positioned in the outline as the last child of the outline item specified
by the Index parameter. Outline items that appear after the added item are moved down
one row and reindexed with valid Index values. This is done automatically unless
BeginUpdate was called.
Note To add items to an empty outline, specify zero (0) as the Index parameter.
Example
The following code adds a new child to the selected item of the outline. The new item is
identified by the text ‘New child’. The TBitmap object named Bitmap1 is attached to the
new item:
Outline1.AddChildObject(Outline1.SelectedItem, 'New child', Bitmap1);
See also
Add method, AddChild method, AddObject method, Insert method, MoveTo method
AddFieldDesc method
Applies to
TFieldDefs object
AddIndex method
Applies to
TTable component
Declaration
procedure AddIndex(const Name, Fields: string; Options: TIndexOptions);
The AddIndex method creates a new index for the TTable. Name is the name of the new
index. Fields is a list of the fields to include in the index. Separate the field names by a
semicolon. Options is a set of values from the TIndexOptions type.
Example
Table1.AddIndex(‘NewIndex’, ‘CustNo;CustName’, [ixUnique, ixCaseInsensitive]);
See also
DeleteIndex method, IndexDefs property, IndexName property
AddObject method
Applies to
TStringList, TStrings objects; TOutline component
Example
This code adds the string ‘Orange’ and a bitmap of an orange to an owner-draw list box:
See also
Add method, AddStrings method, IndexOf method, IndexOfObject method, InsertObject
method, Objects property, Strings property
For outlines
Declaration
function AddObject(Index: LongInt; const Text: string; const Data: Pointer): LongInt;
The AddObject method adds an outline item (TOutlineNode object) containing data to an
outline. The value of the Index parameter specifies where to add the new item. The Text
parameter specifies the Text property value of the new item. The Data parameter
specifies the Data property value of the new item. Add returns the Index property value
of the added item.
The added item is positioned in the outline as the last sibling of the outline item
specified by the Index parameter. The new item shares the same parent as the item
specified by the Index parameter. Outline items that appear after the added item are
moved down one row and reindexed with valid Index values. This is done automatically
unless BeginUpdate was called.
Note To add items to an empty outline, specify zero (0) as the Index parameter.
Example
The following code defines a record type of TMyRec and a record pointer type of
PMyRec.
type
PMyRec = ^TMyRec;
TMyRec = record
FName: string;
LName: string;
end;
Assuming these types are used, the following code adds an outline node to Outline1. A
TMyRec record is associated with the added item. The FName and LName fields are
obtained from edit boxes Edit1 and Edit2. The Index parameter is obtained from edit box
Edit3. The item is added only if the Index is a valid value.
var
MyRecPtr: PMyRec;
OutlineIndex: LongInt;
See also
Add method, AddChild method, AddChildObject method, Insert method, MoveTo method
AddParam method
Applies to
TParams object
Declaration
procedure AddParam(Value: TParam);
AddParam adds Value as a new parameter to the Items property.
Example
{ Move all parameter info from Params2 to Params1 }
while Params2.Count <> 0 do
begin
{ Grab the first parameter from Params2 }
TempParam := Params2[0];
{ Remove it from Params2 }
Params2.RemoveParam(TempParam);
{ And add it to Params1 }
Params1.AddParam(TempParam);
end;
See also
RemoveParam method
AddPassword method
Applies to
TSession component
Declaration
procedure AddPassword(const Password: string);
The AddPassword method is used to add a new password to the current TSession
component for use with Paradox tables. When an application opens a Paradox table that
requires a password, the user will be prompted to enter a password unless the Session
has a valid password for the table.
Example
Session.AddPassword(‘ASecret’);
See also
Session variable
Example
var
P: Pointer;
begin
P := Addr(P); { Now points to itself }
end;
See also
Ofs function, Ptr function, Seg function
AddStrings method
Applies to
TStringList, TStrings objects
Declaration
procedure AddStrings(Strings: TStrings);
The AddStrings method adds a group of strings to the list of strings in a string or string
A
list object. The new strings are appended to the existing strings. Specify a string object
containing the list of strings you want added as the value of the Strings parameter.
Example
This code appends the contents of a file to the end of a memo control:
procedure TForm1.Button1Click(Sender: TSender);
var
Contents: TStringList;
begin
Contents.LoadFromFile(‘NEWSTUFF.TXT’);
Memo1.Lines.AddStrings(Contents);
finally
Contents.Free;
end;
This code adds the list of strings contained in ListBox1.Items to the end of the
ListBox2.Items list of strings:
procedure TForm1.Button1Click(Sender: TObject);
begin
ListBox2.Items.AddStrings(ListBox1.Items);
end;
See also
Add method, AddObject method, Strings property
AfterCancel event
Applies to
TTable, TQuery, TStoredProc components
Declaration
property AfterCancel: TDataSetNotifyEvent;
The AfterCancel event is activated when the dataset finishes a call to the Cancel method.
This event is the last action before Cancel returns to the caller. If the dataset is not in Edit
state or there are no changes pending, then Cancel will not activate the AfterCancel event.
By assigning a method to this property, you can take any special actions required by the
event.
See also
BeforeCancel event
AfterClose event
Applies to
TTable, TQuery, TStoredProc components
Declaration
property AfterClose: TDataSetNotifyEvent;
The AfterClose event is activated after a dataset is closed, either by calling the Close
method or by setting the Active property to False. This event is the last action before Close
returns to the caller. Typically, the AfterClose event handler closes any private lookup
tables opened by the BeforeOpen event.
By assigning a method to this property, you can take any special actions required by the
event.
See also
BeforeClose event
AfterDelete event
Applies to
TTable, TQuery, TStoredProc components
Declaration
property AfterDelete: TDataSetNotifyEvent;
The AfterDelete event is activated when the dataset finishes a call to the Delete method.
This event is the last action before Delete returns to the caller. When AfterDelete is called,
the deleted record has already been removed from the dataset, and the dataset cursor
will be positioned on the following record.
By assigning a method to this property, you can take any special actions required by the
event.
See also
BeforeDelete event
AfterEdit event
Applies to
TTable, TQuery, TStoredProc components
See also
BeforeEdit event
AfterInsert event
Applies to
TTable, TQuery, TStoredProc components
Declaration
property AfterInsert: TDataSetNotifyEvent;
The AfterInsert event is activated when a dataset finishes a call to the Insert or Append
methods. This event is the last action before Insert or Append returns to the caller.
Note This event occurs before a new record has been added to the component.
By assigning a method to this property, you can take any special actions required by the
event.
See also
BeforeInsert event
AfterOpen event
Applies to
TTable, TQuery, TStoredProc components
Declaration
property AfterOpen: TDataSetNotifyEvent;
The AfterOpen event is activated after a dataset is opened, either by calling the Open
method or by setting the Active property to True. This event is the last action before Open
returns to the caller.
By assigning a method to this property, you can take any special actions required by the
event.
See also
BeforeOpen event
AfterPost event
Applies to
TTable, TQuery, TStoredProc components
Declaration
property AfterPost: TDataSetNotifyEvent;
The AfterPost event is activated after a call to the Post method. This event is the last
action before Post returns to the caller.
If a TTable has a range filter (set with ApplyRange) in effect, and if the key value of the
newly posted record falls outside the range, then in the AfterPost event, the cursor will
not be positioned on the newly posted record.
By assigning a method to this property, you can take any special actions required by the
event.
See also
BeforePost event
AliasName property
Applies to
TDataBase component
Declaration
property AliasName: TSymbolStr;
AliasName is the name of an existing BDE alias defined with the BDE Configuration
Utility. This is where the TDatabase component gets its default parameter settings. This
property will be cleared if DriverName is set. If you try to set AliasName of a TDatabase for
which Connected is True, Delphi will raise an exception.
Example
Database1.AliasName := ‘DBDEMOS’;
Declaration
property Align: TAlign;
The Align property determines how the controls align within their container (or parent
control). These are the possible values:
Value Meaning
alNone The component remains where you place it in the form. This is the default value.
alTop The component moves to the top of the form and resizes to fill the width of the form. The
height of the component is not affected.
alBottom The component moves to the bottom of the form and resizes to fill the width of the form.
The height of the component is not affected.
alLeft The component moves to the left side of the form and resizes to fill the height of the form.
The width of the component is not affected.
alRight The component moves to the right side of the form and resizes to fill the height of the
form. The width of the component is not affected.
alClient The component resizes to fill the client area of a form. If a component already occupies
part of the client area, the component resizes to fit within the remaining client area.
Example
This example moves a panel control named Panel1 to the bottom of the form and resizes
it to fill the width of the form:
procedure TForm1.Button1Click(Sender: TObject);
begin
Panel1.Align := alBottom;
end;
See also
Alignment property
Alignment property
Applies to
TBCDField, TBooleanField, TCheckBox, TCurrencyField, TDateField, TDateTimeField,
TDBCheckBox, TDBMemo, TDBText, TFloatField, TIntegerField, TLabel, TMemo, TPanel,
TPopupMenu, TRadioButton, TSmallintField, TStringField, TTimeField, TWordField
components
Value Meaning
taLeftJustify Align text to the left side of the control
taCenter Center text horizontally in the control
taRightJustify Align text to the right side of the control
Example
This code aligns text to the right side of a label named Label1 in response to a click on a
button named RightAlign:
procedure TForm1.RightAlignClick(Sender: TObject);
begin
Label1.Alignment := taRightJustify;
end;
See also
Caption property, Text property
Example
This code makes the check box two-dimensional and puts the check box on the left side
of the text:
procedure TForm1.Button1Click(Sender: TObject);
begin
CheckBox1.Ctl3D := False;
CheckBox1.Alignment := taLeftJustify;
end;
See also
Caption property
Value Meaning
paLeft The pop-up menu appears with its top left corner under the mouse pointer.
paCenter The pop-up menu appears with the top center of the menu under the mouse pointer.
paRight The pop-up menu appears with its top right corner under the mouse pointer.
Example
This example uses a pop-up menu component and a button on a form. The code places
the top right corner of a pop-up menu under the mouse pointer when the menu
appears:
procedure TForm1.AlignPopupMenuClick(Sender: TObject);
begin
PopupMenu1.Alignment := paRight;
end;
See also
AutoPopup property, OnPopup event
See also
ReAllocMem function
AllowAllUp property
Applies to
TSpeedButton component
Declaration
property AllowAllUp: Boolean;
The AllowAllUp property determines if all speed buttons in a group this speed button
belongs to can be unselected (in their up state) at the same time. AllowAllUp should be
used only with speed buttons in a group (that is, the value of the button’s GroupIndex
property is not zero). See the GroupIndex property for information on how to create a
group of speed buttons. If GroupIndex is zero, AllowAllUp has no effect.
If AllowAllUp is True, all of the speed buttons in a group can be unselected. All buttons
can appear in their up state.
If AllowAllUp is False, one of the speed buttons belonging to a group must be selected (in
its down state) at all times. Clicking a down button won’t return the button to its up
state. The button only becomes unselected when the user clicks one of the other buttons
in the group. In such a group, one button must always be selected. Determine which
speed button will be initially down by setting its Down property to True.
The default value is False.
Changing the value of the AllowAllUp property for one speed button in a group changes
the AllowAllUp value for all buttons in the group.
You can use AllowAllUp with a single bitmap button in its own group (with a
A
GroupIndex value greater than 0) so that the button can be selected and remain selected
until the user clicks the button again—at which time it becomes unselected. In other
words, the button can work much like a check box. To make a single speed button
behave this way, set its GroupIndex property to a value greater than 0 (but different from
any other GroupIndex value of any other speed buttons you have), and set AllowAllUp to
True.
Example
In this example, there are three speed buttons on a form. All three belong to the same
group as all three have a GroupIndex value of 1. This line of code changes the AllowAllUp
property to True for all three speed buttons, so it’s possible that all the speed buttons in
the group can be unselected at the same time:
SpeedButton3.AllowAllUp := True;
See also
Down property, Glyph property, GroupIndex property
AllowGrayed property
Applies to
TCheckBox, TDBCheckBox components
Declaration
property AllowGrayed: Boolean;
The value of the AllowGrayed property determines if a check box can have two or three
possible states. If AllowGrayed is False, the default value, clicking a check box alternately
checks and unchecks it. If AllowGrayed is True, clicking a check box either checks, grays,
or unchecks it.
Example
This example uses a check box on a form. When the application runs, the check box is
initially checked. When the user clicks it, the check box is unchecked. Clicking it again
grays the check box.
procedure TForm1.FormCreate(Sender: TObject);
begin
CheckBox1.AllowGrayed := True;
CheckBox1.State := cbChecked;
end;
See also
Checked property, State property
AllowInPlace property
Applies to
TOLEContainer component
Declaration
property AllowInPlace: Boolean;
The AllowInPlace property specifies whether an OLE object can be activated in place. If
AllowInPlace is True, in-place activation is allowed. If AllowInPlace is False, in-place
activation is not allowed and the OLE object is activated in its own window (OLE 1.0-
style).
Note To support in-place activation, the OLE container application must include a
TMainMenu component.
Example
The following code sets AllowInPlace to False.
OLEContainer1.AllowInPlace := False;
See also
AutoActivate property
AllowResize property
Applies to
THeader component
Declaration
property AllowResize: Boolean;
The value of the AllowResize property determines if the user can modify the size of the
header at run time with the mouse. If AllowResize is False, the sections within a header
can’t be resized. If AllowResize is True, clicking a border of a header section and dragging
it left or right changes the width of the section. The default value is True.
Example
The following code allows the resizing of the sections of Header1.
Header1.AllowResize := True;
See also
OnSized event, Sections property, SectionWidth property, Sizing event
See also
AnsiCompareText function
See also
AnsiCompareStr function
See also
AnsiUpperCase function, LowerCase function
AnsiToNative function DB
Declaration
function AnsiToNative(Locale: TLocale; const AnsiStr: string; NativeStr: PChar;
MaxLen: Word): PChar;
The AnsiToNative function translates the ANSI characters in AnsiStr (or the first MaxLen
characters) to the native character set according to Locale by calling DBIAnsiToNative.
The translated characters are returned in NativeStr with a null terminator. AnsiToNative
returns NativeStr.
See also
AnsiLowerCase function, UpperCase function
Append method
Applies to
TTable, TQuery, TStoredProc components
Declaration
procedure Append;
The Append method moves the cursor to the end of the dataset, puts the dataset into
Insert state , and opens a new, empty record. When an application calls Post, the new
record will be inserted in the dataset in a position based on its index, if defined. To
discard the new record, use Cancel.
This method is valid only for datasets that return a live result set.
Note For indexed tables, the Append and Insert methods will both put the new record in the
correct location in the table, based on the table’s index. If no index is defined on the
underlying table, then the record will maintain its position—Append will add the record
to the end of the table, and Insert will insert it at the current cursor position. In either
case, posting a new record may cause rows displayed in a data grid to change as the
dataset follows the new row to its indexed position and then fetches data to fill the data
grid around it.
Example
with Table1 do
begin
Append;
FieldByName(‘CustNo’).AsString := ‘9999’;
{ Fill in other fields here }
if { you are sure you want to do this} then Post
else { if you changed your mind } Cancel;
end.
Example
var F: TextFile;
begin
if OpenDialog1.Execute then { Bring up open file dialog }
begin
AssignFile(F, OpenDialog1.FileName);
{ Open file selected in dialog }
Append(F); { Add more text onto end }
Writeln(F, 'appended text');
CloseFile(F); { Close file, save changes }
end;
end;
See also
AssignFile procedure, FileClose procedure, Reset procedure, Rewrite procedure
AppendRecord method
Applies to
TTable, TQuery, TStoredProc components
Declaration
procedure AppendRecord(const Values: array of const);
The AppendRecord method appends a new record to the dataset using the field values
passed in the Values parameter. The assignment of the elements of Values to fields in the
record is sequential; the first element is assigned to the first field, the second to the
second, etc. The number of field values passed in Values may be fewer than the number
of actual fields in the record; any remaining fields are left unassigned and are NULL.
The type of each element of Values must be compatible with the type of the field in that
the field must be able to perform the assignment using AsString, AsInteger, and so on,
according the type of the Values element.
This method is valid only for datasets that return a live result set.
Note For indexed tables, the AppendRecord and InsertRecord methods will both put the new
record in the correct location in the table, based on the table’s index. If no index is
defined on the underlying table, then the record will maintain its position—
AppendRecord will add the record to the end of the table, and InsertRecord will insert it at
the current cursor position. In either case, posting a new record in a data grid may cause
all the rows before and after the new record to change as the dataset follows the new
row to its indexed position and then fetches data to fill the grid around it.
Example
Table1.AppendRecord([9999, ‘Doe‘, ‘John‘]);
See also
TField component.
Example
This code displays the name of your project in an edit box:
procedure TForm1.Button1Click(Sender: TObject);
begin
Edit1.Text := Application.Title;
end;
See also
Icon property, Run method, Title property
ApplyFilePath method
Applies to
TFileListBox component
Declaration
procedure ApplyFilePath(const EditText: string);
ApplyFileEditText is intended to be used in a dialog box that approximates the utility and
behavior of an Open dialog box. Such a dialog box would contain a file list box
(TFileListBox), a directory list box (TDirectoryListBox), a drive combo box
(TDriveComboBox), a filter combo box TFilterComboBox, a label, and an edit box where
the user can type a file name including a full directory path. When the user then chooses
the OK button, you would like all the controls to update with the information the user
entered in the edit box. For example, you would want the directory list box to change to
the directory specified in the path the user typed, and you want the drive combo box to
change to the correct drive if the path included a different drive letter.
If the file list box, directory list box, drive combo box, filter combo box, label, and edit
box are connected using the FileEdit, FileList, DirLabel, and DirList properties, your
application can call ApplyFilePath to update the controls with the text the user entered in
the edit box.
The user can enter any of these strings in the edit box: a file name, with or without a
path, a drive only, a drive and directory only, relative paths, or a file mask using
wildcard characters. In all cases, the ApplyFilePath method updates the controls as you
would expect. For example, if the user includes a directory name, the directory list box
makes that directory the current one.
The EditText parameter is the text within the edit box.
Example
This example uses a file list box, a directory list box, a filter combo box, a drive combo
box, a label, an edit box, and a button on a form. When the user runs the application and
enters a path or file name in the edit box, all the controls update:
procedure TForm1.FormCreate(Sender: TObject);
begin
FileListBox1.FileEdit := Edit1;
FilterComboBox1.FileList := FileListBox1;
DirectoryListBox1.FileList := FileListBox1;
DirectoryListBox1.DirLabel := Label1;
DriveComboBox1.DirList := DirectoryListBox1;
Button1.Default := True;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
FileListBox1.ApplyFilePath(Edit1.Text);
end;
See also
Directory property, Drive property
ApplyRange method
Applies to
TTable component
Declaration
procedure ApplyRange;
The ApplyRange method is used to apply the start and end ranges established with the
SetRangeStart and SetRangeEnd methods or the EditRangeStart and EditRangeEnd
methods. This will filter the set of records from the database table accessible to the
application.
Note When comparing fields for range purposes, a NULL field is always less than any other
possible value.
Example
{ Limit the range from ‘Goleta’ to ‘Santa Barbara’}
with Table1 do
begin
EditRangeStart; { Set the beginning key }
See also
CancelRange method, KeyExclusive property, KeyFieldCount property, SetRange method
Arc method
Applies to
TCanvas object
Declaration
procedure Arc(X1, Y1, X2, Y2, X3, Y3, X4, Y4: Integer);
The Arc method draws an arc on the canvas along the perimeter of the ellipse bounded
by the specified rectangle. Coordinates (X1, Y1 and X2, Y2) define the enclosing
rectangle for the arc. The arc starts at the intersection of the ellipse edge and the line
from the center of the ellipse to the specified starting point (X3, Y3). The arc is drawn
counterclockwise until it reaches the position where the ellipse edge intersects the line
from the center of the ellipse to the specified ending point (X4, Y4).
Example
The following lines of code draw the top quarter of an arc bounded by the current
window:
TForm1.FormPaint(Sender: TObject);
var
R: TRect;
begin
R := GetClientRect; {Gets the rectangular coordinates of the current window}
Canvas.Arc(R.Left, R.Top, R.Right, R.Bottom, R.Right, R.Top, R.Left, R.Top);
end;
See also
Chord method, Draw method, DrawFocusRect method, Ellipse method, Pie method
You can calculate other trigonometric functions using Sin, Cos, and ArcTan in the
following expressions:
Tan(x) = Sin(x) / Cos(x)
ArcSin(x) = ArcTan (x/sqrt (1–sqr (x)))
ArcCos(x) = ArcTan (sqrt (1–sqr (x)) /x)
Example
var
R: Real;
begin
R := ArcTan(Pi);
end;
See also
Cos function, Sin function
ArrangeIcons method
Applies to
TForm component
Declaration
procedure ArrangeIcons;
The ArrangeIcons method arranges the icons of minimized forms so that they are evenly
spaced and don’t overlap. The ArrangeIcons method applies only to forms that are MDI
parent forms (have a FormStyle property value of fsMDIForm).
Example
This code runs when the user chooses a menu item called Window|Arrange Icons:
procedure TForm1.WindowArrangeIconsClick(Sender: TObject);
begin
Form1.ArrangeIcons;
end;
See also
Cascade method, Next method, Previous method, Tile method
AsBCD property
Applies to
TParam object
See also
TFieldType type
AsBoolean property
Applies to
TParam object; TBooleanField, TStringField components
Example
if Table1.FieldByName('BackOrdered').AsBoolean then ...
AsCurrency property
Applies to
TParam object
Declaration
property AsCurrency: Double;
Assigning a value to the AsCurrency property sets the DataType property to ftCurrency
and saves the value as the current data for the parameter. Accessing the AsCurrency
property attempts to convert the current data to a Double value and returns that value.
See also
TFieldType type
AsDate property
Applies to
TParam object
Declaration
property AsDate: TDateTime;
Assigning a value to the AsDate property sets the DataType property to ftDate and saves
the value as the current data for the parameter. Accessing the AsDate property attempts
to convert the current data to a TDateTime value and returns that value.
See also
StrToDateTime function, TFieldType type
AsDateTime property
Applies to
TParam object; TDateField, TDateTimeField, TStringField, TTimeField components
See also
StrToDateTime function, TFieldType type
Example
The following statement converts a string to a date for insertion into a date field:
Table1.FieldByName(TimeStamp).AsDateTime := StrToDateTime(Now);
See also
DateToStr function, StrToDate function, StrToDateTime function, DateTimeToStr function,
TimeToStr function, StrToTime function, Value property
AsFloat property
Applies to
TParam object; TBCDField, TCurrencyField, TFloatField, TStringField components
See also
TFieldType type
See also
FloatToStr function, StrToFloat function
AsInteger property
Applies to
TParam object; TIntegerField, TSmallintField, TStringField, TWordField components
See also
TFieldType type
See also
Data Access Components Hierarchy, IntToStr function, StrToInt function, Value
property
Example
The following code copies the bitmap of a speed button named SpeedButton1 to the
Clipboard:
Clipboard.Assign(SpeedButton1.Glyph);
See also
AsText property, Clipboard variable, HasFormat property
Declaration
procedure Assign(FieldDefs: TFieldDefs);
Assign creates a new set of TFieldDef objects in Items from the FieldDefs parameter. Any
previously entries in Items are freed.
Examples
{ Copy one date-time field to another }
DateTimeField1.Assign(DateTimeField2);
{ Copy a graphic field to a blob field }
BlobField1.Assign(GraphicField1);
{Copy strings in a TMemo to a TMemoField}
MemoField1.Assign(Memo1.Lines);
See also
DataType property, Size property
Example
{ Copy the CustNo parameter from Query1 to Query2 }
Example
var SavedParams: TParams;
...
{ Initialize SavedParams }
SavedParams := TParams.Create;
{ Save the parameters for Query1 }
SavedParams.Assign(Query1.Parameters);
{ Do something with Query1 }
...
{ Restore the parameters to Query1 }
Query1.Parameters.Assign(SavedParams);
SavedParams.Free;
See also
AssignValues method
If Destination is a property of some object, however, and that property is not a reference
to another object (such as the ActiveControl property of a form, or the DataSource
property of a data-aware control), then the statement "Destination := Source" is the same
as "Destination.Assign(Source)". Consider these statements:
Button1.Font := Button2.Font;
ListBox1.Items := Memo1.Lines;
Table1.Fields[0] := Query1.Fields[2];
They correspond to these statements:
Button1.Font.Assign(Button2.Font);
ListBox1.Items.Assign(Memo1.Lines);
Table1.Fields[0].Assign(Query1.Fields[2]);
The actions performed by Assign depend on the actual types of Destination and Source.
For example, if Destination and Source are string objects (TStrings), the strings contained
in Source are copied into Destination. Likewise, if Destination and Source are bitmaps
(TBitmap), the bitmap contained in Source is copied into Destination.
Although the compiler allows any two TPersistent objects to be used in a call to Assign,
the call succeeds at run time only if the objects involved "know" how to perform an
assignment. For example, if Destination is a button (TButton) and Source is an edit box
(TEdit), the call to Assign raises an EConvertError exception at run time.
An object of one type can always be assigned to another object of the same type. In
addition, Assign supports the following special cases:
• If Destination is of type TPicture then Source can be of type TBitmap, TIcon, or TMetafile.
• If Destination is of type TBitmap, TIcon, or TMetafile then Source can be of type TPicture
if the Graphic property of the picture is of the same type as Destination.
• If Destination is of type TBlobField then Source can be of type TBitmap, TPicture, or
TStrings.
Example
The following code changes the properties of a label’s font so that they match the
properties of the button’s font when the user clicks the button:
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Font.Assign(Button1.Font);
end;
AssignCrt works exactly like the Assign standard procedure except that no file name is
A
specified. Instead, the text file associates with the CRT window, which emulates a text-
based CRT in the Windows environment. Subsequent Write and Writeln operations on
the file write to the CRT window, and Read and Readln operations read from the CRT
window.
This allows faster output (and input) than would normally be possible using standard
output (or input).
See also
AssignFile procedure, Read procedure, Readln procedure, Write procedure, Writeln
procedure
Example
var P: Pointer;
begin
P := nil;
if Assigned (P) then Writeln ('You won''t see this');
P := @P;
if Assigned (P) then Writeln ('You''ll see this');
end;
AssignField method
Applies to
TParam object
Declaration
procedure AssignField(Field: TField);
The AssignField method transfers the DataType value and Name from Field. Use
AssignField to set a parameter from a TField component.
Example
{ Copy the CustNo field value from Query1 to the CustNo parameter of Query2 }
Query2.ParamByName(‘CustNo’).AssignField(Query1.FieldNyName(‘CustNo’));
Example
var
F: TextFile;
S: string;
begin
if OpenDialog1.Execute then { Display Open dialog box }
See also
Append procedure, FileClose procedure, Reset procedure, Rewrite procedure
Example
This code prints a line of text on the printer when the user clicks the button on the form:
procedure TForm1.Button1Click(Sender: TObject);
var
MyFile: TextFile;
begin
AssignPrn(MyFile);
Rewrite(MyFile);
Writeln(MyFile, ‘Print this text’);
System.CloseFile(MyFile);
end;
Example
var
P: PString;
begin
P := NewStr('First string'); { Allocate and point to 'First string' }
AssignStr(P, 'Second string'); { Dispose of 'First string', allocate and point to }
{ 'Second string' }
DisposeStr(P); { Dispose of 'Second string' }
end;
See also
DisposeStr procedure
AssignValue method
Applies to
TBCDField, TBlobField, TBooleanField, TBytesField, TCurrencyField, TDateField,
TDateTimeField, TFloatField, TGraphicField, TIntegerField, TMemoField, TSmallintField,
TStringField, TTimeField, TVarBytesField, TWordField components
Declaration
procedure AssignValue(const Value: TVarRec);
The AssignValue method sets the field to Value using one of the AsInteger, AsBoolean,
AsString or AsFloat properties, depending on the type of Value. If Value is of type TObject
or a TObject descendant, AssignValue uses the Assign method to transfer the information.
Example
Field1.AssignValue(‘new string’);
AssignValues method
Applies to
TParams object
Declaration
procedure AssignValues(Value: TParams);
For each entry in Items, the AssignValues method attempts to find a parameter with the
same Name property in Value. If successful, the parameter information (type and current
data) from the Value parameter is assigned to the Items entry. Entries in Items for which
no match is found are left unchanged.
AsSmallInt property
Applies to
TParam object
Declaration
procedure SetAsSmallInt(Value: Longint);
Assigning a value to the AsSmallInt property sets the DataType property to fsSmallInt
and save the value as the current data for the parameter. Accessing the AsSmallInt
property attempts to convert the current data to a SmallInt value and returns that value.
AsString property
Applies to
TParam object; TBCDField, TBlobField, TBooleanField, TBytesField, TCurrencyField,
TDateField, TDateTimeField, TFloatField, TGraphicField, TIntegerField, TMemoField,
TSmallintField, TStringField, TTimeField, TVarBytesField, TWordField components
See also
DateToStr function, DateTimeToStr function, FloatToStr function, IntToStr function,
TFieldType type, TimeToStr function
AsText property
Applies to
TClipboard object
Declaration
property AsText: String;
Run-time only. The AsText property returns the current contents of the Clipboard as a
string. The Clipboard must contain a string or an exception occurs.
You can also use the AsText property to place a copy of a string on the Clipboard. Assign
a string as the value of AsText.
The string value of the AsText property is limited to 255 characters. If you need to set
A
and retrieve more than 255 characters, use the SetTextBuf and GetTextBuf Clipboard
methods.
If the Clipboard contains a string, this expression is True:
Clipboard.HasFormat(CF_TEXT)
Example
The following code retrieves the contents of the Clipboard as a string and displays the
value in a label:
begin
Label1.Caption := Clipboard.AsText;
end;
See also
Clipboard variable, HasFormat method
AsTime property
Applies to
TParam object
Declaration
property AsTime: TDateTime;
Assigning a value to the AsTime property sets the DataType property to ftTime and saves
the value as the current data for the parameter. Accessing the AsTime property attempts
to convert the current data to a TDateTime value and returns that value.
See also
StrToDateTime function, TDateTime type, TFieldType type
AsWord property
Applies to
TParam object
Declaration
property AsWord: Longint;
Assigning a value to the AsWord property sets the DataType property to ftWord and
saves the value as the current data for the parameter. Accessing the AsWord property
attempts to convert the current data to a Longint value and returns that value.
See also
TFieldType type
AutoActivate property
Applies to
TOLEContainer component
Declaration
property AutoActivate: TAutoActivate;
AutoActivate determines how an object in an OLE container can be activated. These are
the possible values:
Value Meaning
aaManual The OLE object must be manually activated. To activate the OLE object manually,
set the Active property to True.
aaGetFocus The user activates the OLE object by clicking the OLE container or pressing Tab
until focus shifts to the OLE container. If the OLE container has a TabOrder of 0,
the OLE container initially receives focus but the OLE object won’t be activated.
aaDoubleClick The user activates the OLE object by double-clicking the OLE container, or
pressing Enter when the container has focus. An OnDblClick event is generated
immediately after the OLE server application is activated.
Example
The following code sets the activation method of OLEContainer1 to aaManual, then
activates OLEContainer1:
OLEContainer1.AutoActivate := aaManual;
OLEContainer1.Active := True;
See also
OnActivate event
AutoCalcFields property
Applies to
TTable, TQuery, TStoredProc components
Declaration
property AutoCalcFields: Boolean;
The AutoCalcFields property determines when OnCalcFields is called. OnCalcFields is
always called whenever an application retrieves a record from the database. If
AutoCalcFields is True, then OnCalcFields is called also whenever a field in a dataset is
edited.
If AutoCalcFields is True, OnCalcFields should not perform any actions that modify the
A
dataset (or the linked dataset if it is part of a master-detail relationship), because this can
lead to recursion. For example, if OnCalcFields performs a Post, and AutoCalcFields is
True, then OnCalcFields will be called again, leading to another Post, and so on.
AutoDisplay property
Applies to
TDBImage, TDBMemo component
Declaration
property AutoDisplay: Boolean;
The value of the AutoDisplay property determines whether to automatically display the
contents of a memo or graphic BLOB in a database memo (TDBMemo) or database
image (TDBImage) control.
If AutoDisplay is True (the default value), the control automatically displays new data
when the underlying BLOB field changes (such as when moving to a new record).
If AutoDisplay is False, the control clears whenever the underlying BLOB field changes.
To display the data, the user can double-click on the control or select it and press Enter.
In addition, by calling the LoadMemo method of a database memo or the LoadPicture
method of a database image you can ensure that the control is showing data.
You might want to change the value of AutoDisplay to False if the automatic loading of
BLOB fields seems to take too long.
Example
The following code displays the text BLOB in DBMemo1.
DBMemo1.AutoDisplay := True;
See also
LoadMemo method, LoadPicture method
AutoEdit property
Applies to
TDataSource component
Declaration
property AutoEdit: Boolean;
AutoEdit determines if data-aware controls connected to TDataSource automatically
place the current record into edit mode by calling the table’s Edit method when the user
begins typing within one of them. AutoEdit is True by default; set it to False to protect the
data from being unintentionally modified. When AutoEdit is False, you can still call the
Edit method to modify a field.
AutoEnable property
Applies to
TMediaPlayer component
Declaration
property AutoEnable: Boolean;
The AutoEnable property determines whether the media player automatically enables
and disables individual buttons in the component.
If AutoEnable is True, the media player automatically enables or disables its control
buttons. The media player determines which buttons to enable or disable by the current
mode specified in the Mode property, and the current multimedia device type specified
in the DeviceType property.
AutoEnable overrides the EnabledButtons property. The buttons enabled or disabled
automatically by the media player supersede any buttons enabled or disabled with
EnabledButtons.
If AutoEnable is False, the media player does not enable or disable buttons. You must
enable or disable buttons with the EnabledButtons property.
The following table shows whether buttons are automatically enabled or disabled for
each device mode:
Example
The following code causes all of the buttons of MediaPlayer1 to become disabled when a
bitmap button is clicked:
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
with MediaPlayer1 do begin
AutoEnable := False;
See also
AutoOpen property
AutoMerge property
Applies to
TMainMenu component
Declaration
property AutoMerge: Boolean;
The AutoMerge property determines if the main menus (TMainMenu) of forms other
than the main form merge with the main menu of the main form in non-MDI
applications at run time. The default value is False. To merge the form’s menus with the
main menu in the main form, set the AutoMerge property of each main menu you want
merged to True. Make sure that the AutoMerge property of the main menu you are
merging with other menus remains False. How menus merge depends on the value of
the GroupIndex property for each menu item.
If the application is an MDI application (the FormStyle properties are set so the main
form is a parent form and subsequent forms are child forms), menu merging occurs
automatically and you don’t need to use the AutoMerge property. In an MDI application,
you should be sure that the AutoMerge value for the main menu of the parent form is
False, or else the menu bar of the parent form disappears when a child form appears.
Example
This example uses two forms with a main menu and a button on each form. Using the
Object Inspector, set the GroupIndex value for each menu item on the menu bar in the
second form to a number greater than 0. When the application runs and the user clicks
the button on the first form, the main menu on the second form merges with the main
menu of the first form. When the user clicks the button on the second form, the form
closes.
procedure TForm1.Button1Click(Sender: TObject);
begin
Form2.MainMenu1.AutoMerge := True;
Form2.Show;
end;
This is the code for the button-click event handler on the second form:
procedure TForm2.Button1Click(Sender: TObject);
begin
Close;
end;
To run this example, you must add Unit2 to the uses clause of Unit1.
See also
GroupIndex property, Merge method, Unmerge method
AutoOpen property
Applies to
TMediaPlayer component
Declaration
property AutoOpen: Boolean;
The AutoOpen property determines if the media player is opened automatically when
the application is run. If AutoOpen is True, the media player attempts to open the
multimedia device specified by the DeviceType property (or FileName if DeviceType is
dtAutoSelect) when the form containing the media player component is created at run
time. If AutoOpen is False, the device must be opened with a call to the Open method.
AutoOpen defaults to True.
If an error occurs when opening the device, an exception of type EMCIDeviceError is
raised which contains the error message. Upon completion, a numerical error code is
stored in the Error property, and the corresponding error message is stored in the
ErrorMessage property.
The Wait property determines whether control is returned to the application before
opening the multimedia device. The Notify property determines whether opening the
device generates an OnNotify event.
Example
The following code opens MediaPlayer1 if AutoOpen was not set to True. This code
assumes that an appropriate value was specified for FileName at design time.
with MediaPlayer1 do
if not AutoOpen then
Open;
See also
Close method
AutoPopup property
Applies to
TPopupMenu component
Example
The following prevents the pop-up menu from appearing when the user clicks the right
mouse button:
PopupMenu1.AutoPopup := False;
See also
OnPopup event, Popup method
AutoRewind property
Applies to
TMediaPlayer component
Declaration
property AutoRewind: Boolean;
The AutoRewind property determines if the media player control rewinds before playing
or recording.
If AutoRewind is True and the current position is at the end of the medium, Play or
StartRecording moves the current position to the beginning of the medium before
playing or recording. If AutoRewind is False, the user must click the Prev button or your
code must call Previous to move to the beginning.
Note If values have been assigned to StartPos or EndPos or if the multimedia device uses
tracks, AutoRewind has no effect on playing or recording. When you call Play or
StartRecording, the current position remains at the end of the medium.
Example
The following code plays MediaPlayer. If AutoRewind is False, Previous is called to rewind
after Play is finished.
MediaPlayer.Wait := True;
MediaPlayer.Play;
if not MediaPlayer.AutoRewind then MediaPlayer.Previous;
See also
Rewind method
AutoScroll property
Applies to
TForm, TScrollBox, TTabSet components
Example
This code displays scroll buttons in the tab set control if all the tabs aren’t visible:
TabSet11.AutoScroll := True;
See also
FirstIndex property, TabIndex property
Example
This example uses a label on a form. When the form becomes active, the label displays a
message informing the user whether scroll bars will be available if the form is resized so
that not all controls are fully visible.
procedure TForm1.FormActivate(Sender: TObject);
begin
See also
HorzScrollBar property, ScrollInView method, VertScrollBar property
AutoSelect property
Applies to
TDBEdit, TDBLookupCombo, TEdit, TMaskEdit components
Declaration
property AutoSelect: Boolean;
The value of the AutoSelect property determines if the text in the edit box or combo box
is automatically selected when the user tabs to the control. If AutoSelect is True, the text is
selected. If AutoSelect is False, the text is not selected.
The default value is True.
Example
This example uses an edit box and a check box on a form. Set the caption of the check
box to ‘AutoSelect text’. When the user checks the check box, text is automatically
selected each time the user tabs to the edit box. If the user unchecks the check box, text is
no longer selected automatically when the user tabs to the edit box.
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
if CheckBox1.Checked then
Edit1.AutoSelect := True
else
Edit1.AutoSelect := False;
end;
end;
See also
AutoSize property, SelLength property, SelStart property, SelText property, Text property
AutoSize property
Applies to
TDBEdit, TDBText, TEdit, TImage, TLabel, TMaskEdit, TOLEContainer components
The AutoSize property determines if the component automatically resizes to match the
size of its contents.
For images
Declaration
property AutoSize: Boolean;
When the AutoSize property is True, the image control resizes to accommodate the
image it contains (specified by the Picture property). When AutoSize is False, the image
control remains the same size, regardless of the size of the image. If the image control is
smaller than the image, only the portion of the picture that fits inside the image
component will be visible.
The default value is False.
Note You must remember to set the AutoSize property to True before loading the picture, or
AutoSize has no effect.
To resize the image to fill an image control completely when the control is larger than
the native size of the image, use the Stretch property.
Example
This example uses an image control and a button. Resize the image control so that it is
too small to display the entire bitmap. When the user clicks the button, the bitmap is
loaded into the image control, and the image control resizes to display the bitmap in its
entirety.
procedure TForm1.Button1Click(Sender: TObject);
begin
Image1.AutoSize := True;
Image1.Picture.LoadFromFile('c:\windows\arches.bmp');
end;
See also
LoadFromFile method, Stretch property
See also
Font property
Example
The following code keeps the size of the label control constant, even though the length
of the label’s caption changes. As a result, the caption of the label is probably too long to
display in the label when the user clicks the button:
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.AutoSize := False;
Label1.Caption := 'This string is too long as the caption of this label';
end;
See also
WordWrap property
Declaration
property AutoSize: Boolean;
Autosize determines whether the OLE container automatically resizes to the size of the
OLE object it contains.
If Autosize is True, the OLE container adopts the shape of the OLE object at run time. If
the user activates the object and changes its size, the OLE container resizes to the new
size. Setting Autosize to True may unintentionally cause the OLE container to resize to a
shape that exists outside the client area of the form or over other controls.
If Autosize is False, the shape of the OLE container remains constant. The picture of the
OLE object is clipped to fit in the shape of the OLE container when deactivated. This
clipping does not affect the OLE object itself, however. The user can still access the entire
OLE object when it is activated.
Example
The following code resizes OLEContainer1 automatically when activated:
OLEContainer1.AutoSize := True;
AutoUnload property
Applies to
TReport component
Declaration
property AutoUnload: Boolean;
The AutoUnload property determines whether ReportSmith Runtime unloads from
memory when you have finished running a report.
If AutoUnload is True, ReportSmith Runtime unloads as soon as the report is finished
running.
If AutoUnload is False, ReportSmith Runtime remains in memory. For example, you can
create an application that includes a menu item that runs a report. After the report runs,
you want ReportSmith Runtime to stay in memory so the report can be quickly rerun
again. To remove ReportSmith Runtime from memory when AutoUnload is False, you
+
must then call the CloseApplication method. B
Example
The following code sets AutoUnload to False, so that Report1 can be run twice using two
different variables. After the second run, ReportSmith is unloaded by a call to
CloseApplication.
Report1.AutoUnload := False;
if Report1.SetVariable(‘FName’, ‘Linda’) then
Report1.Run;
if Report1.SetVariable(‘LName’, ‘King’) then
Report1.Run;
Report1.CloseApplication(False);
Back method
Applies to
TMediaPlayer component
Declaration
procedure Back;
The Back method steps backward a number of frames (determined by the value of the
Frames property) in the currently loaded medium. Back is called when the Back button
on the media player control is clicked at run time.
Upon completion, Back stores a numerical error code in the Error property and the
corresponding error message in the ErrorMessage property.
The Wait property determines whether control is returned to the application before the
Back method has been completed. The Notify property determines whether Back
generates an OnNotify event.
Example
The following example lets the user pick an .AVI video file using OpenDialog1 and
opens that file in MediaPlayer1. Then, the Back button can be used to step backward
through the .AVI clip. You could use this to hide MediaPlayer1 and design your own
user interface for the media player.
procedure TForm1.OpenClick(Sender: TObject);
begin
OpenDialog1.Filename := '*.*';
if OpenDialog1.Execute then
begin
MediaPlayer1.Filename := OpenDialog1.Filename;
MediaPlayer1.Open;
end;
end;
See also
Capabilities property, OnClick event, Rewind method, Step method
BackgroundColor property
Applies to
TTabSet component
Declaration
property BackgroundColor: TColor;
The BackgroundColor property determines the background color of the tab set control.
The background area of the tab set control is the area between the tabs and the border of
the control. For a list of possible color values, see the Color property.
Example
This code changes the background color of the tab set control:
TabSet1.BackgroundColor := clBackground;
See also
DitherBackground property
BatchMove method
Applies to
TTable component
Declaration
function BatchMove(ASource: TDataSet; AMode: TBatchMode): Longint;
The BatchMove method copies, appends, updates, or deletes records in the TTable.
ASource is a TTable linked to a database table containing the source records. AMode is the
copy mode; it can be any of the elements of TBatchMode: batAppend, batUpdate,
batAppendUpdate, batDelete, or batCopy.
BatchMove returns the number of records operated on.
Example
Table1.BatchMove(Table2, batAppend);
Declaration
property BeforeCancel: TDataSetNotifyEvent;
The BeforeCancel event is activated at the beginning of a call to the Cancel method. This
event is the first action taken by Cancel. If the dataset is not in Edit state or there are no
changes pending, then Cancel will not activate the BeforeCancel event.
By assigning a method to this property, you can take any special actions required by the
event. By raising an exception in this event handler, you can prevent the Cancel
operation from occurring.
See also
AfterCancel event
BeforeClose event
Applies to
TTable, TQuery, TStoredProc components
Declaration
property BeforeClose: TDataSetNotifyEvent;
The BeforeClose event is activated before the dataset is closed, either by calling the Close
method or by setting the Active property to False. This event is the first action taken by
Close.
By assigning a method to this property, you can take any special actions required by the
event. By raising an exception in this event handler, you can prevent the Close operation
from occurring.
See also
AfterClose event
BeforeDelete event
Applies to
TTable, TQuery, TStoredProc components
Declaration
property BeforeDelete: TDataSetNotifyEvent;
The BeforeDelete event is activated when the dataset begins a call to Delete. This event is
the first action taken by the Delete method.
By assigning a method to this property, you can take any special actions required by the
event. By raising an exception in this event handler, you can prevent the Delete
operation from occurring.
See also
AfterDelete event
BeforeEdit event
Applies to
TTable, TQuery, TStoredProc components
Declaration
property BeforeEdit: TDataSetNotifyEvent;
The BeforeEdit event is activated when the dataset begins a call to the Edit method. This
event is the first action taken by Edit.
By assigning a method to this property, you can take any special actions required by the
event. By raising an exception in this event handler, you can prevent the Edit operation
from occurring.
See also
AfterEdit event
BeforeInsert event
Applies to
TTable, TQuery, TStoredProc components
Declaration
property BeforeInsert: TDataSetNotifyEvent;
The BeforeInsert event is activated when the dataset begins a call to the Insert or Append
+
methods. This event is the first action taken by Insert or Append. B
By assigning a method to this property, you can take any special actions required by the
event. By raising an exception in this event handler, you can prevent the Insert operation
from occurring.
See also
AfterInsert event
BeforeOpen event
Applies to
TTable, TQuery, TStoredProc components
Declaration
property BeforeOpen: TDataSetNotifyEvent;
The BeforeOpen event is activated before the dataset is opened, either by calling the Open
method or by setting the Active property to True. This event is the first action taken by
the Open method. Typically, the BeforeOpen event handler opens any private lookup
tables used by other event handlers in the dataset.
By assigning a method to this property, you can take any special actions required by the
event. By raising an exception in this event handler, you can prevent the Open operation
from occurring.
See also
AfterOpen event
BeforePost event
Applies to
TTable, TQuery, TStoredProc components
Declaration
property BeforePost: TDataSetNotifyEvent;
The BeforePost event is activated at the beginning of a call to the Post method. This event
is the first action taken by the Post method, after it calls the UpdateRecord method to
reflect any changes made to the record by data controls. The BeforePost event can be
used to validate a record before it is posted. By raising an exception, a BeforePost event
handler can prevent the posting of an invalid record.
By assigning a method to this property, you can take any special actions required by the
event. By raising an exception in this event handler, you can prevent the Post operation
from occurring.
See also
AfterPost event
BeginDoc method
Applies to
TPrinter object
Declaration
procedure BeginDoc;
The BeginDoc method sends a print job to the printer. If the print job is sent successfully,
the application should call EndDoc to end the print job. The print job won’t actually start
printing until EndDoc is called.
To use the BeginDoc method, you must add the Printers unit to the uses clause of your
unit.
Example
This code prints a rectangle on the default printer:
begin
Printer.BeginDoc; { begin to send print job to printer }
Printer.Canvas.Rectangle(20,20,1000,1000); { draw rectangle on printer's canvas }
Printer.EndDoc; { EndDoc ends and starts printing print job }
end;
To use the BeginDoc method, you must add the Printers unit to the uses clause of your
unit.
See also
Abort method, Printer variable
BeginDrag method
Applies to
All controls
Declaration
procedure BeginDrag(Immediate: Boolean);
The BeginDrag method starts the dragging of a control. If the Immediate parameter is
+
True, the mouse pointer changes to the value of the DragCursor property and dragging
begins immediately. If Immediate is False, the mouse pointer doesn’t change to the value
B
of the DragCursor property and dragging doesn’t begin until the user moves the mouse
pointer a short distance (5 pixels). This allows the control to accept mouse clicks without
beginning a drag operation.
Your application needs to call the BeginDrag method to begin dragging only when the
DragMode property value for the control is dmManual.
Example
procedure TForm1.Button1Click(Sender: TObject);
begin
if Button1.DragMode = dmManual then
Button1.BeginDrag(True);
end;
See also
DragMode property, EndDrag method, OnDragDrop event, OnDragOver event,
OnEndDrag event
BeginUpdate method
Applies to
TStringList, TStrings objects; TOutline component
Declaration
procedure BeginUpdate;
The BeginUpdate method prevents the updating of the outline or string object until the
EndUpdate method is called. For string objects, BeginUpdate prevents the screen from
being repainted when new strings are added. For outlines, BeginUpdate prevents the
screen from being repainted and prevents outline items from being reindexed when
new items are added, deleted, or inserted. Outline items affected by the changes will
have invalid Index values until EndUpdate is called.
For example, the Lines property of a memo component is of type TStrings. If your
application calls the AddStrings method to add several strings at once to the Lines
property, AddStrings calls BeginUpdate before the strings are added. After the strings are
added, AddStrings calls EndUpdate and the screen repaints, displaying the new list of
strings.
Use BeginUpdate to prevent screen repaints and to speed processing time while you are
rebuilding your list.
Example
BeginUpdate and EndUpdate should always be used in conjunction with a try...finally
statement to ensure that EndUpdate is called if an exception occurs. A block that uses
BeginUpdate and EndUpdate typically looks like this:
ListBox1.Items.BeginUpdate;
try
ListBox1.Items.Clear;
ListBox1.Items.Add(...);
...
ListBox1.Items.Add(...);
finally
ListBox1.Items.EndUpdate; { Executed even in case of an exception }
end;
See also
EndUpdate method
BevelInner property
Applies to
TPanel component
Declaration
property BevelInner: TPanelBevel;
A panel component has two bevels, an outer bevel drawn next to the border of the
control, and an inner bevel drawn inside the outer bevel the number of pixels specified
in the BorderWidth property.
The BevelInner property determines the style of the inner bevel of a panel component.
These are the possible values:
Value Meaning
bvNone No inner bevel exists.
bvLowered The inner bevel is lowered.
bvRaised The inner bevel is raised.
Example
This example uses a panel component and a button named CreateStatusLine on a form.
The code moves the panel to the bottom of the form when the user clicks the button and
gives the panel the appearance of a status line by changing the value of the BevelInner,
BevelOuter, BevelWidth, and BorderWidth properties.
procedure TForm1.CreateStatusLineClick(Sender: TObject);
begin
with Panel1 do
begin
See also
BevelOuter property, BevelWidth property, BorderWidth property, TPanelBevel type
BevelOuter property
Applies to
TPanel component
Declaration
property BevelOuter: TPanelBevel;
A panel component has two bevels, an outer bevel drawn next to the border of the
control, and an inner bevel drawn inside the outer bevel. The width of the inner bevel is
specified in the BorderWidth property in pixels.
The BevelOuter property determines the style of the outer bevel of a panel component.
These are the possible values:
Value Meaning
bvNone No outer bevel exists.
bvLowered The outer bevel is lowered.
bvRaised The outer bevel is raised.
Example
This code creates a lowered frame 10 pixels wide around a panel component named
Panel1:
Panel1.BorderWidth := 10;
Panel1.BevelInner := bvRaised;
Panel1.BevelOuter := bvLowered;
See also
BevelInner property, BevelWidth property, BorderWidth property
BevelWidth property
Applies to
TPanel component
Declaration
property BevelWidth: TBevelWidth;
The BevelWidth property determines the width in pixels between the inner and the outer
bevels of a panel. The BevelInner property determines how the inner bevel appears, and
the BevelOuter property determines how the outer bevel appears. By changing these
properties, you change the appearance of the panel.
Example
This code alternately displays and hides the bevels of a panel when the user clicks the
Button1 button:
procedure TForm1.Button1Click(Sender: TObject);
begin
with Panel1 do
begin
BevelInner := bvLowered;
BevelOuter := bvRaised;
if BevelWidth = 0 then
BevelWidth := 2
else
BevelWidth := 0;
end;
end;
See also
BorderWidth property
Bitmap property
Applies to
TBrush, TPicture objects
For brushes
Declaration
property Bitmap: TBitmap;
Run-time only. The Bitmap property enables a brush to use a bitmap image for painting
with the ability to produce special painting effects such as patterns. The bitmap must be
8 pixels high and 8 pixels wide.
Example
The following code loads a bitmap from a file and assigns it to the Brush of the Canvas of
Form1:
Example
The following code copies the bitmap in Picture1 to the Glyph of BitBtn1.
BitBtn1.Glyph := Picture1.Bitmap;
See also
Graphic property
{$I+} lets you handle run-time errors using exceptions. For more information on
handling run-time library exceptions, see Handling RTL Exceptions in the Help system.
If you are using {$I–}, you must use IOResult to check for I/O errors.
Example
var
FromF, ToF: file;
NumRead, NumWritten: Word;
Buf: array[1..2048] of Char;
begin
if OpenDialog1.Execute then { Display Open dialog box }
begin
AssignFile(FromF, OpenDialog1.FileName);
Reset(FromF, 1); { Record size = 1 }
if SaveDialog1.Execute then { Display Save dialog box}
begin
AssignFile(ToF, SaveDialog1.FileName); { Open output file }
Rewrite(ToF, 1); { Record size = 1 }
Canvas.TextOut(10, 10, 'Copying ' + IntToStr(FileSize(FromF))
+ ' bytes...');
repeat
BlockRead(FromF, Buf, SizeOf(Buf), NumRead);
BlockWrite(ToF, Buf, NumRead, NumWritten);
until (NumRead = 0) or (NumWritten <> NumRead);
CloseFile(FromF);
CloseFile(ToF);
end;
end;
end;
See also
BlockWrite procedure
error occurs if Count * RecSize is greater than 65,535 (64K). You can use the exception
+
handler EInOutError to deal with this error. B
If the entire block is transferred, Result is equal to Count on return.
If Result is less than Count, the disk became full before the transfer was complete. In this
case, if the file’s record size is greater than 1, Result returns the number of complete
records written.
The current file position is advanced by Result records as an effect of the BlockWrite.
If Result isn’t specified, an I/O error occurs if the number written isn’t equal to Count.
You can use exception handler EInOutError to deal this error.
{$I+} lets you handle run-time errors using exceptions. For more information on
handling run-time library exceptions, see Handling RTL Exceptions in the Help system.
If you are using {$I–}, you must use IOResult to check for I/O errors.
Example
var
FromF, ToF: file;
NumRead, NumWritten: Word;
Buf: array[1..2048] of Char;
begin
if OpenDialog1.Execute then { Display Open dialog box }
begin
AssignFile(FromF, OpenDialog1.FileName);
Reset(FromF, 1); { Record size = 1 }
if SaveDialog1.Execute then { Display Save dialog box }
begin
AssignFile(ToF, SaveDialog1.FileName); { Open output file }
Rewrite(ToF, 1); { Record size = 1 }
Canvas.TextOut(10, 10, 'Copying ' + IntToStr(FileSize(FromF))
+ ' bytes...');
repeat
BlockRead(FromF, Buf, SizeOf(Buf), NumRead);
BlockWrite(ToF, Buf, NumRead, NumWritten);
until (NumRead = 0) or (NumWritten <> NumRead);
CloseFile(FromF);
CloseFile(ToF);
end;
end;
end;
See also
BlockRead procedure
BOF property
Applies to
TTable, TQuery, TStoredProc components
Declaration
property BOF: Boolean;
Run-time and read only. BOF is a Boolean property that indicates whether a dataset is
known to be at its first row. The BOF property returns a value of True only after:
• An application first opens a table
• A call to a table’s First method
• A call to a table’s Prior method fails
Example
Table1.Last;
while not Table1.BOF do
begin
{DoSomething}
Table1.Prior;
end;
See also
MoveBy method
Example
The following code calculates the BOLEMedium associated with CF_BITMAP and stores
it in the fmtMedium field of the first element of a BOLEFormat record array.
var
Fmts: array[0..2] of BOLEFormat;
begin
Fmts[0].fmtId := CF_BITMAP;
Fmts[0].fmtMedium := BOLEMediumCalc(CF_BITMAP);
Fmts[0].fmtIsLinkable := False;
StrPCopy (Fmts[0].fmtName, '%s');
StrPCopy (Fmts[0].fmtResultName, '%s');
end;
BorderColor property
Applies to
TShape component
Declaration
property BorderColor: TColor;
The BorderColor property is used to color the border of a shape component. For a
complete list of the values the BorderColor property can have, see the Color property.
Example
This example changes the border color of a shape component at run time:
Shape1.BorderColor := clBlack;
BorderIcons property
Applies to
TForm component
Declaration
property BorderIcons: TBorderIcons;
The BorderIcons property is a set whose values determine which icons appear on the title
bar of a form. These are the possible values that the BorderIcons set can contain:
Value Meaning
biSystemMenu The form has a Control menu (also known as a System menu)
biMinimize The form has a Minimize button
biMaximize The form has a Maximize button
Example
The following code removes a form’s Maximize button when the user clicks a button:
procedure TForm1.Button1Click(Sender: TObject);
BorderStyle property
Applies to
TDBEdit, TDBGrid, TDBImage, TDBListBox, TDBLookupCombo, TDBLookupList,
TDBMemo, TDrawGrid, TEdit, TForm, THeader, TListBox, TMaskEdit, TMemo,
TOLEContainer, TOutline, TPanel, TScrollBox, TStringGrid components
For forms
Declaration
property BorderStyle: TFormBorderStyle;
The BorderStyle property for forms specifies both the appearance and the behavior of the
form border. You normally set BorderStyle at design time, but you can also change it at
run time.
BorderStyle can have any of the following values:
Value Meaning
bsDialog Not resizeable; standard dialog box border
bsSingle Not resizeable; single-line border
bsNone Not resizeable; no visible border line, Minimize or Maximize
buttons, or Control menu
bsSizeable Standard resizeable border
Changing the border style of an MDI child form to bsDialog or bsNone has no effect.
Example
This example creates a form with a single-line border that the user can’t resize:
Form1.BorderStyle := bsSingle;
See also
BorderIcons property
For controls
Declaration
property BorderStyle: TBorderStyle;
The BorderStyle property of edit boxes, list boxes, memo controls, grid controls, outlines,
and scroll boxes determines whether these components have a border. These are the
possible values:
Value Meaning
bsNone No visible border
bsSingle Single-line border
If you set the AutoSize property of an edit box to True, the edit box resizes automatically
when the font size of the text changes. You must set the value of the BorderStyle property
to fsSingle, or else AutoSize has no effect.
Example
The following example puts a single-line border around the edit box, Edit1.
Edit1.BorderStyle := bsSingle;
See also
Ctl3D property
BorderWidth property
Applies to
TPanel component
Declaration
property BorderWidth: TBorderWidth;
The BorderWidth property determines the width in pixels of the border around a panel.
The default value is 0, which means no border.
Example
This example uses a panel component and a button named CreateStatusLine on a form.
The code moves the panel to the bottom of the form when the user clicks the button, and
gives the panel the appearance of a status line by changing the value of the BevelInner,
BevelOuter, BevelWidth, and BorderWidth properties:
procedure TForm1.CreateStatusLineClick(Sender: TObject);
begin
with Panel1 do
Align := alBottom;
See also
BevelInner property, BevelOuter property, BevelWidth property
Example
This example returns a TRect record that defines a rectangle that is 100 pixels long on
each side with the top left corner at coordinate 10, 10.
var
R: TRect;
begin
R := Bounds(10, 10, 100, 100);
end;
See also
BoundsRect property
BoundsRect property
Applies to
All controls
Declaration
property BoundsRect: TRect;
The BoundsRect property returns the bounding rectangle of the control, expressed in the
coordinate system of the parent control. The statement
R := Control.BoundsRect;
corresponds to
R.Left := Control.Left;
R.Top := Control.Top;
R.Right := Control.Left + Control.Width;
R.Bottom := Control.Top + Control.Height;
Example
This code resizes a button control to twice as wide and half as high:
procedure TForm1.Button1Click(Sender: TObject);
var
MyRect: TRect;
begin
MyRect := Button2.BoundsRect;
MyRect.Right := MyRect.Left + 2 * (MyRect.Right - MyRect.Left);
MyRect.Bottom := MyRect.Top + (MyRect.Bottom - MyRect.Top) div 2;
Button2.BoundsRect := MyRect;
end;
See also
Bounds function
Example
uses WinCRT;
var
S: string;
begin
while True do
begin
ReadLn(S);
if S = '' then Break;
WriteLn(S);
end;
end;
See also
Continue procedure, Exit procedure, Halt procedure
Declaration
property Break: TMenuBreak;
The Break property lets you break a long menu into columns. These are the possible
values:
Value Meaning
mbNone No menu breaking occurs.
mbBarBreak The menu breaks into another column with the menu item appearing at the top of the
new column. A bar separates the new and the old columns.
mbBreak The menu breaks into another column with the menu item appearing at the top of the
new column. Only space separates the new and the old columns.
Example
This example uses a button and a main menu component with several subitems on it,
including one labeled Save As, so that Delphi automatically names that menu item
SaveAs1. When the user clicks the button on the form, the menu breaks so Save As
appears in a second column with a bar between the two columns. The change to the
menu is visible when the menu displays.
procedure TForm1.Button1Click(Sender: TObject);
begin
SaveAs1.Break := mbBarBreak;
end;
See also
Checked property, Enabled property
BringToFront method
Applies to
All controls; TForm component
Declaration
procedure BringToFront;
The BringToFront method puts the component or form in front of all other components
or forms within its parent component or form. BringToFront is especially useful for
making certain that a form is visible. You can also use it to reorder overlapping
components within a form.
The order in which controls stack on top of each order (also called the Z order) depends
on whether the controls are windowed or non-windowed controls. For example, if you
put a label and an image on a form so that one is on top of the other, the one you placed
first on the form is the one on the bottom. Because both the label and the image are non-
windowed controls, they “stack” as you would expect them to. Suppose that the label is
on the bottom. If you call the BringToFront method for the label, the label then appears
on top of the image.
The stacking order of windowed controls is the same. For example, if you put a memo
on a form, then put a check box on top of it, the check box remains on top. If you call
BringToFront for the memo, the memo appears on top.
The stacking order of windowed and non-windowed controls cannot be mingled. For
example, if you put a memo, a windowed control, on a form, and then put a label, a non-
windowed control, on top of it, the label disappears behind the memo. Windowed
controls always stack on top of non-windowed controls. In this example, if you call the
BringToFront method of the label, it remains behind the memo.
Example
The following code uses two forms. Form1 has a button on it. The second form is used as
a tool palette. This code makes the palette form visible, and ensures it is the top form by
bringing it to the front.
To run this example, you must put Unit2 in the uses clause of your unit.
procedure TForm1.ShowPaletteButtonClick(Sender: TObject);
begin
if Form2.Visible = False then Form2.Visible := True;
Form2.BringToFront;
end;
See also
SendToBack method
Brush property
Applies to
All controls; TCanvas object; TForm, TShape components
Declaration
property Brush: TBrush;
A canvas or shape object’s Brush property determines what kind of color and pattern the
canvas uses for filling graphical shapes and backgrounds. Controls also specify an
additional brush in their Brush properties, which they use for painting their
backgrounds.
See also
BrushCopy method, Canvas property, Font property, Pen property, TCanvas object
BrushCopy method
Applies to
TCanvas object
Declaration
procedure BrushCopy(const Dest: TRect; Bitmap: TBitmap; const Source: TRect; Color: TColor);
The BrushCopy method copies a portion of a bitmap onto a portion of a canvas, replacing
one of the colors of the bitmap with the brush of the destination canvas. Dest specifies
the rectangular portion of the destination canvas to copy to. Bitmap specifies the graphic
to copy from. Source specifies the rectangular area of the bitmap to copy. Color specifies
the color in Bitmap to replace with the brush of the canvas (specified in the Brush
property).
You could use BrushCopy to make the copied image partially transparent, for example.
To do this, you would specify the color of the surface being copied to (clBackground for
example) as the Color of the Brush property of the destination canvas, then call
BrushCopy.
Example
The following code illustrates the differences between CopyRect and BrushCopy. The
bitmap graphic ‘TARTAN.BMP’ is loaded into Bitmap and displayed on the Canvas of
Form1. BrushCopy replaces the color black in the graphic with the brush of the canvas,
while CopyRect leaves the colors intact.
var
Bitmap: TBitmap;
MyRect, MyOther: TRect;
begin
MyRect.Top := 10;
MyRect.Left := 10;
MyRect.Bottom := 100;
MyRect.Right := 100;
MyOther.Top := 111; {110}
MyOther.Left := 10;
MyOther.Bottom := 201; {210}
MyOther.Right := 100;
Bitmap := TBitmap.Create;
Bitmap.LoadFromFile('c:\windows\tartan.bmp');
Form1.Canvas.BrushCopy(MyRect,Bitmap, MyRect, clBlack);
Form1.Canvas.CopyRect(MyOther,Bitmap.Canvas,MyRect);
Bitmap.Free;
end;
See also
Brush property, CopyRect method
BtnClick method
Applies to
TDBNavigator component
Declaration
procedure BtnClick(Index: TNavigateBtn);
The BtnClick method simulates a button click on the database navigator, invoking the
action of the button. Specify which button BtnClick should operate on as the value of the
Index parameter.
Example
This line of code simulates the clicking of the Next button on a database navigator
control, which makes the next record in the dataset the current record:
DBNavigator1.BtnClick(nbNext);
Buttons property
Applies to
TDBRadioGroup, TRadioGroup components
Example
The following code disables the first button in DBRadioGroup1.
TRadioButton(DBRadioGroup1.Buttons.First).Enabled := False;
Calculated property
Applies to
TBCDField, TBlobField, TBooleanField, TBytesField, TCurrencyField, TDateField,
TDateTimeField, TFloatField, TGraphicField, TIntegerField, TMemoField, TSmallintField,
TStringField, TTimeField, TVarBytesField, TWordField components
Declaration
property Calculated: Boolean;
Calculated is True if the value of the field is calculated by the OnCalcFields event handler.
Calculated fields can be created with the Fields Editor, but are not stored in or retrieved
from the physical tables underlying a dataset. Instead they are calculated for each record
in the table by the dataset’s OnCalcFields event handler, which typically uses expressions
involving values from other fields in the record to generate a value for each calculated
field. For example, a table might have non-calculated fields for Quantity and UnitPrice,
and a calculated field for ExtendedPrice, which would be calculated by multiplying the
values of the Quantity and UnitPrice fields. Calculated fields are also useful for
performing lookups in other tables. For example, a part number can be used to retrieve a
part description for display in an invoice line item.
Cancel method
Applies to
TTable, TQuery, TStoredProc components
Declaration
procedure Cancel;
The Cancel method returns the dataset to Browse state and discards any changes to the
current record.
See also
Append method, Insert method, Post method
Cancel property
Applies to
TBitBtn, TButton components
Declaration
property Cancel: Boolean;
The Cancel property indicates whether a button or a bitmap button is a Cancel button. If
Cancel is True, any time the user presses Esc, the OnClick event handler for the button
executes. Although your application can have more than one button designated as a
Cancel button, the form calls the OnClick event handler only for the first button in the
tab order that is visible.
Example
The following code designates a button called Button1 as a Cancel button:
Button1.Cancel := True;
See also
Default property, OnClick event
CancelRange method
Applies to
TTable component
Declaration
procedure CancelRange;
The CancelRange method removes any range limitations for the TTable which were
previously established by calling the ApplyRange or SetRange methods.
Example
Table1.CancelRange;
CanFocus method
Applies to
All controls
Example
This example uses a group box, a label, and a button on a form. The group box contains
a check box. When the application runs, the group box is disabled (Enabled is set to
False). Because the group box is the parent of the check box, the user can never tab to the
check box. When the user clicks the button, the caption of the label reports that the check
box can not receive the input focus:
procedure TForm1.FormCreate(Sender: TObject);
begin
GroupBox1.Enabled := True;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if CheckBox1.CanFocus then
Label1.Caption := 'The check box can focus'
else
Label1.Caption := 'The check box cannot focus';
end;
See also
Parent property
CanModify property
Applies to
TBCDField, TBlobField, TBooleanField, TBytesField, TCurrencyField, TDateField,
TDateTimeField, TFloatField, TGraphicField, TIntegerField, TMemoField, TSmallintField,
TStoredProc, TStringField, TQuery, TTable, TTimeField, TVarBytesField, TWordField
components
put into Edit or Insert state. When CanModify is True, the dataset can enter Edit or Insert
state.
Even if CanModify is True, it is not a guarantee that a user will be able to insert or update
records in a table. Other factors may come in to play, for example, SQL access privileges.
TTable has a ReadOnly property that requests write privileges when set to False. When
ReadOnly is True, CanModify will automatically be set to False. When ReadOnly is False,
CanModify will be True if the database allows read and write privileges for the dataset
and the underlying table.
Example
if Table1.CanModify then
{ Do this only if the dataset can be modified }
Table1.CustNo := 1234;
See also
Active property
See also
DataSet property
Canvas property
Applies to
TBitmap, TComboBox, TDBComboBox, TDBGrid, TDBListBox, TDirectoryListBox,
TDrawGrid, TFileListBox, TForm, TImage, TListBox, TOutline, TPaintBox, TPrinter,
TStringGrid components
Run-time only. The Canvas property gives you access to a drawing surface that you can
+
use when implementing a handler for the OnPaint event of a form, an image, or a paint
box.
+
The Canvas property of an image or a form is read only. C
Example
The following code sets the Color of the Pen of the Canvas of Bitmap1 to clBlue.
Bitmap1.Canvas.Pen.Color := clBlue;
See also
Search for Graphics in online Help and choose the topic Drawing Graphics at Run Time
Example
The following code draws a graphic stored in the Objects property of the Items list of
ListBox1. This code should be attached to the OnDrawItem event handler of ListBox1, and
the Style property of ListBox1 should be lbOwnerDrawFixed.
procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
var
SourceRect: TRect;
begin
SourceRect.Top := 0;
SourceRect.Left := 0;
SourceRect.Bottom := TBitmap(ListBox1.Items.Objects[Index]).Height;
SourceRect.Right := TBitmap(ListBox1.Items.Objects[Index]).Width;
ListBox1.Canvas.CopyRect(Rect, TBitmap(ListBox1.Items.Objects[Index]).Canvas,
SourceRect);
end;
The following code draws a graphic stored in the Data property of the Items list of
Outline1. This code should be attached to the OnDrawItem event handler of Outline1,
and the Style property of Outline1 should be otOwnerDraw.
procedure TForm1.Outline1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
var
SourceRect: TRect;
begin
SourceRect.Top := 0;
SourceRect.Left := 0;
SourceRect.Bottom := TBitmap(Outline1.Items[Index].Data).Height;
SourceRect.Right := TBitmap(Outline1.Items[Index].Data).Width;
Outline1.Canvas.CopyRect(Rect, TBitmap(Outline1.Items[Index].Data).Canvas,
SourceRect);
end;
See also
ItemHeight property, OnDrawCell event, OnDrawDataCell event, OnDrawItem event,
OnPaint event
For grids
Declaration
property Canvas: TCanvas;
Run-time and read only. The Canvas property gives you access to a drawing surface that
you can use when implementing a handler for the OnDrawCell or OnDrawDataCell event
of a grid control.
Example
The following code prints the text ‘Hello, world!’:
Printer.BeginDoc;
Printer.Canvas.TextOut(0, 0, 'Hello, world');
Pritner.EndDoc;
See also
Brush property, Font property, Pen property, TextOut method
See also
Draw method
Capabilities property
Applies to
TMediaPlayer component
Declaration
property Capabilities: TMPDevCapsSet;
Run-time and read only. The Capabilities property determines the capabilities of the
open multimedia device.
The various capabilities specified in Capabilities are determined when the device is
opened with the Open method. The following table lists the capabilities a device can
have:
Value Capability
mpCanEject Can eject media
mpCanPlay Can play media
mpCanRecord Can record media
mpCanStep Can step forward or backward within media
mpUsesWindows Uses a window for displaying output
Note Currently, there is no way to check whether a device can step forward or backward.
Capabilities includes mpCanStep only if the device type (specified in the DeviceType
property) is Animation, AVI Video, Digital Video, Overlay, or VCR.
Example
The following code determines whether the device opened by the media player control
MediaPlayer1 uses a window to display output. If so, the output displays in a form
named Form2:
if mpUsesWindows in MediaPlayer1.Capabilities then
MediaPlayer1.Display := Form2;
See also
Back method, Display property, Eject method, Play method, StartRecording method, Step
method
Capacity property
Applies to
TList object
Declaration
property Capacity: Integer;
Run time only. The Capacity property contains the allocated size of the array of pointers
maintained by a TList object. This is different from the Count property, which contains
the number of entries that are actually in use. The value of the Capacity property is
always greater than or equal to the value of the Count property.
When setting the Capacity property, an EListError exception occurs if the specified value
is less than the Count property or greater than 16380 (the maximum number of elements
a list object can contain). Also, an EOutOfMemory exception occurs if there is not enough
memory to expand the list to its new size.
When an element is added to a list whose Capacity and Count are equal (indicating that
all allocated entries are in use), the Capacity is automatically increased by 16 elements. In
situations where you are going to be adding a known number of elements to a list, you
can reduce memory reallocations by first increasing the list's capacity. For example,
List.Clear;
List.Capacity := Count;
for I := 1 to Count do List.Add(...);
The assignment to Capacity before the for loop ensures that each of the following Add
operations doesn’t cause the list to be reallocated, which in turn means that the Add
operations are guaranteed to never raise an exception.
Example
The following code sets the Capacity of List1 to 5.
List1.Capacity := 5;
See also
Count property, Expand method, Items property, Pack method
Caption property
Applies to
TBitBtn, TButton, TCheckBox, TDBCheckBox, TDBRadioGroup, TForm, TGroupBox, TLabel,
TMenuItem, TPanel, TRadioButton, TSpeedButton components
Example
The following code creates a caption that says “Hello, World!” on a form called MyForm:
MyForm.Caption := ‘Hello, World!’;
See also
BorderStyle property
Example
This code changes the caption of a group box:
procedure TForm1.Button1Click(Sender: TObject);
begin
GroupBox1.Caption := ’Fancy options’;
end;
See also
FocusControl property, ShowAccelChar property, Text property
Cascade method
Applies to
TForm component
Declaration
procedure Cascade;
The Cascade method rearranges the child forms in your application so they overlap. The
top of each form remains visible so that you can easily select one of the forms. The
Cascade method applies only to MDI parent forms (with a FormStyle property value of
fsMDIForm).
Example
This code arranges all MDI children of the current MDI parent form in a cascade pattern
when the user chooses the Cascade menu command:
procedure TForm1.Cascade1Click(Sender: TObject);
begin
Cascade;
end;
See also
ArrangeIcons method, Next method, Previous method, Tile method
CellRect method
Applies to
TDrawGrid, TStringGrid components
Declaration
function CellRect(ACol, ARow: Longint): TRect;
The CellRect method creates a rectangle of type TRect for the cell defined by the column
ACol and the row ARow. If the cell indicated by ACol and ARow is not visible, CellRect
returns an empty rectangle.
Example
This example uses a string grid, four labels, and a button on a form. When the user clicks
the button, the coordinates of the cell in the second column and first row appear in the
label captions:
procedure TForm1.Button1Click(Sender: TObject);
var
Rectangle: TRect;
begin
Rectangle := StringGrid1.CellRect(3, 2);
Cells property
Applies to
TStringGrid component
Declaration
property Cells[ACol, ARow: Integer]: string;
Run-time only. The Cells property is an array of strings, one string for each cell in the
grid. Use the Cells property to access a string within a particular cell. ACol is the column
coordinate of the cell, and ARow is the row coordinate of the cell. The first row is row
zero, and the first column is column zero.
The ColCount and RowCount property values define the size of the array of strings.
Example
This code fills each cell of a grid with the same string.
procedure TForm1.Button1Click(Sender: TObject);
var
I, J: Integer;
begin
with StringGrid1 do
for I := 0 to ColCount - 1 do
for J:= 0 to RowCount - 1 do
Cells[I,J] := 'Delphi';
end;
See also
Cols property, Objects property, Rows property
Center property
Applies to
TDBImage, TImage components
Declaration
property Center: Boolean;
The Center property determines whether an image is centered in the image control. If
Center is True, the image is centered. If Center is False, the image aligns with the top left
corner of the control. The default value is True.
Example
The following code centers the image in Image1 when the user checks CheckBox1:
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
Image1.Center := CheckBox1.Checked;
end;
See also
AutoSize property, Stretch property
ChangedCount property
Applies to
TBatchMove component
Declaration
property ChangedCount: Longint;
Run-time and read only. ChangedCount is the number of records added to the table
specified by ChangedTableName. If ChangedTableName is not specified, the count is still
valid.
Example
with BatchMove1 do
begin
Execute;
if ChangedCount <> Source.RecordCount then { something went wrong };
end;
See also
ChangedTableName property
ChangedTableName property
Applies to
TBatchMove component
Example
BatchMove1.ChangedTableName := ‘oldrecs.db’;
Example
The following code generates the name of an .INI file based on the name of the program:
function INIFileName: string;
begin
Result := ChangeFileExt(ParamStr(0), '.INI');
end;
ChangeLevelBy method
Applies to
TOutlineNode object
Declaration
procedure ChangeLevelBy(Value: TChangeRange);
The ChangeLevelBy method changes the level of an outline item. Specify a Value
parameter value of -1 to move up (toward the root) one level. Specify a Value parameter
value of 1 to move down (away from the root) one level.
When moving up one level, an item becomes the next sibling of its former parent. When
moving down one level, an item becomes the last child of its former prior sibling.
Therefore, you can not change the level of the first item in the outline, as it has no parent
or prior sibling. Also, you can not move items that are already on the first level up one
level.
ChangeLevelBy modifies the value of the Level property to reflect the new level. You can
only move an item up or down one level at a time.
Example
Attach the following code to the OnClick event handlers of two buttons to allow the user
to move the selected outline item up or down. The code for UpBtn checks to see if the
selected item is not already on the first level before moving it up. The code for DownBtn
checks to see if the selected item has a prior sibling before moving it down.
procedure TForm1.UpBtnClick(Sender: TObject);
begin
with Outline1[Outline1.SelectedItem] do
if Level > 1 then ChangeLevelBy(-1);
end;
See also
Level property, MoveTo method
CharCase property
Applies to
TDBEdit, TEdit, TMaskEdit components
Declaration
property CharCase: TEditCharCase;
The CharCase property determines the case of the Text property of the edit box. These are
the possible values:
Value Meaning
ecLowerCase The text of the edit box displays in lowercase
ecNormal The text of the edit box displays in mixed case
ecUpperCase The text of the edit box displays in uppercase
If the user tries to enter a different case than the current value of CharCase, the characters
the user enters appear in the case specified by CharCase. For example, if the value of
CharCase is ecLowerCase, only lowercase characters appear in the edit box, even if the
user tries to enter uppercase characters.
Example
This example uses an edit box and group box containing three radio buttons. When the
user selects the first radio button, the text in the edit box becomes lowercase, and any
text the user types in the edit box also appears in lowercase. When the user selects the
second radio button, the text in the edit box becomes uppercase, and any text the user
+
types in the edit box also appears in uppercase. When the user selects the third radio
button, the text in the edit box remains unchanged, but the user can type using either
+
upper- or lowercase characters:
procedure TForm1.RadioButton1Click(Sender: TObject);
C
begin
Edit1.CharCase := ecLowerCase;
end;
procedure TForm1.RadioButton2Click(Sender: TObject);
begin
Edit1.CharCase := ecUpperCase;
end;
procedure TForm1.RadioButton3Click(Sender: TObject);
begin
Edit1.CharCase := ecNormal;
end;
Example
begin
{$I–}
{ Change to directory specified in Edit1 }
ChDir(Edit1.Text);
if IOResult <> 0 then
MessageDlg('Cannot find directory', mtWarning, [mbOk], 0);
end;
See also
GetDir procedure, MkDir procedure, RmDir procedure
Check procedure DB
Declaration
procedure Check(Status: Integer);
The Check procedure tests Status for a nonzero value and calls DbiError passing Status.
CheckBrowseMode method
Applies to
TTable, TQuery, TStoredProc components
Declaration
procedure CheckBrowseMode;
The CheckBrowseMode method verifies that the dataset is open and has no pending
changes. If the dataset’s State property is dsEdit, dsInsert or dsSetKey, the Post method is
called to post any pending changes. If the dataset is closed, an EDataBaseError exception
will be raised.
Example
This example fills in a radio button at run time:
RadioButton1.Checked := True;
This example uses a main menu component that contains a menu item named
SnapToGrid1 on a form. When the user chooses the Snap To Grid command, a check
mark appears next to the command. When the user chooses the Snap To Grid command
again, the check marks disappears:
procedure TForm1.SnapToGrid1Click(Sender: TObject);
begin
SnapToGrid1.Checked := not SnapToGrid1.Checked;
end;
See also
AllowGrayed property, State property
The CheckEOF typed constant controls the end-of-file character checking in the CRT
window.
When CheckEOF is True, an end-of-file marker is generated when the user presses Ctrl+Z
while reading from a file assigned to the CRT window.
When CheckEOF is False, pressing Ctrl+Z has no effect.
CheckEOF is False by default.
Chord method
Applies to
TCanvas object
Declaration
procedure Chord(X1, Y1, X2, Y2, X3, Y3, X4, Y4: Integer);
The Chord method draws a line on the canvas connecting two points on the ellipse
bounded by the specified rectangle. The screen pixel coordinates (X1, Y1) and (X2, Y2)
define the enclosing rectangle for the chord. (X3,Y3) is the starting point for the line, and
(X4, Y4) is the ending point.
Example
This code draws a chord on the top of an ellipse bounded by the current window:
var
R: TRect;
begin
R := GetClientRect; {Gets the rectangular coordinates of the current window}
Canvas.Chord(R.Left, R.Top, R.Right, R.Bottom, R.Right, R.Top, R.Left, R.Top);
end;
See also
Arc method, Draw method, Ellipse method, Pie method
Example
begin
Canvas.TextOut(10, 10, Chr(65)); { The letter ‘A’}
Declaration
class function ClassName: string;
The ClassName function returns the name of an object or a class. For example,
TButton.ClassName returns the string ‘TButton’.
The name returned by ClassName is the name of the actual class of the object, as opposed
to the object’s declared class. For example, the following code assigns ’TButton’ to S, not
’TObject’:
var
MyObject: TObject;
S: string;
begin
MyObject := TButton.Create(Application);
S := MyObject.ClassName;
...
MyObject.Free;
end;
Example
This example uses a button, a label, a list box, a check box, and an edit box on a form.
When the user clicks one of the controls, the name of the control’s class appears in the
edit box.
procedure FindClassName(AControl:TObject);
begin
Form1.Edit1.Text := AControl.ClassName;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
FindClassName(Button1);
end;
procedure TForm1.Label1Click(Sender: TObject);
begin
FindClassName(Label1);
end;
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
FindClassName(CheckBox1);
end;
procedure TForm1.ListBox1Click(Sender: TObject);
begin
FindClassName(ListBox1);
end;
See also
ClassParent method, ClassType method
ClassParent method
Applies to
All objects and components
Declaration
class function ClassParent: TClass;
The ClassParent method returns the parent class of an object or a class. The returned
value is the immediate ancestor of the object or class. For example, TScrollBar.
ClassParent returns TWinControl as TScrollBar is derived from TWinControl.
Note that TObject.ClassParent returns nil because TObject has no parent.
Example
This code example uses a button and a list box on a form. When the user clicks the
button, the name of the button’s class and the names of its parent classes are added to
the list box.
procedure TForm1.Button1Click(Sender: TObject);
var
ClassRef: TClass;
begin
ListBox1.Clear;
ClassRef := Sender.ClassType;
while ClassRef <> nil do
begin
ListBox1.Items.Add(ClassRef.ClassName);
ClassRef := ClassRef.ClassParent;
end;
end;
The list box contains the following strings after clicking the button:
TButton
TButtonControl
TWinControl
TControl
ClassType method
Applies to
All objects and components
Declaration
function ClassType: TClass;
The ClassType function returns the class of an object.
Example
This example uses a button and a label on a form. When the user clicks the button, the
type of the button component (TButton) appears in the caption of the label.
procedure TForm1.Button1Click(Sender: TObject);
var
ButtonClassType: TClass;
begin
ButtonClassType := Button1.ClassType;
Label1.Caption := ButtonClassType.ClassName;
end;
See also
ClassName method, ClassParent method
Clear method
Applies to
TClipboard, TFieldDefs, TIndexDefs, TList, TParam, TParams, TStringList, TStrings objects;
TBCDField, TBlobField, TBooleanField, TBytesField, TComboBox, TDBComboBox,
TCurrencyField, TDateField, TDateTimeField, TDBEdit, TDBListBox, TDBMemo,
TDirectoryListBox, TDriveComboBox, TEdit, TFileListBox, TFilterComboBox, TFloatField,
TGraphicField, TIndexDefs, TIntegerField, TListBox, TMaskEdit, TMemo, TMemoField,
TOutline, TSmallintField, TStringField, TTimeField, TVarBytesField, TWordField
components
Example
Params1.Clear;
Example
{ Clear the CustNo parameter for Query 1 }
Query1.ParamByName(‘CustNo’).Clear;
For fields
Declaration
procedure Clear;
Clear sets the value of the field to NULL.
Example
The following code removes the text from an edit box control called NameField:
NameField.Clear;
This example uses a list box and a button on a form. When the form is created, strings
are added to the list box. When the user clicks the button, all the strings contained in the
Items property, a TStrings object, are cleared.
procedure TForm1.FormCreate(Sender: TObject);
begin
ListBox1.Items.Add('One');
ListBox1.Items.Add('Two');
ListBox1.Items.Add('Three');
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ListBox1.Items.Clear;
end;
See also
CopyToClipboard method, CutToClipboard method, Items property, Pack method,
PasteFromClipboard method, Text property, Strings property
ClearFields method
Applies to
TTable, TQuery, TStoredProc components
Declaration
procedure ClearFields;
The ClearFields method clears all fields of the current record to their default values
(normally NULL.) The dataset must be in Edit state or an EDatabaseError exception will
be raised.
See also
Edit method, State property, TField component
Example
The following code clears Form1 of object formats:
ClearFormOLEDropFormats(Form1);
See also
SetFormOLEDropFormats procedure, TOLEDropNotify object
ClearSelection method
Applies to
TDBEdit, TDBMemo, TEdit, TMaskEdit, TMemo components
Declaration
procedure ClearSelection;
The ClearSelection method deletes text selected in an edit box or memo control. If no text
is selected in the control when ClearSelection is called, nothing happens.
Example
This code uses a memo control named MyMemo and a button on a form. When the user
clicks the button, the text the user selected in the memo control is deleted.
procedure TForm1.Button1Click(Sender: TObject);
begin
MyMemo.ClearSelection;
end;
See also
Clear method, CopyToClipboard method, CutToClipboard method, PasteFromClipboard
method
Example
This example uses a main menu component and a button named Print. The main menu
component has a Print1 menu item on it. When the user clicks the button, the code
attached to the OnClick event of the Print1 menu item runs.
procedure TForm1.PrintClick(Sender: TObject);
begin
Print1.Click;
end;
See also
OnClick event
Example
The following code simulates a click on the Next button of DBNavigator1.
DBNavigator1.Click(nbNext);
ClientHandle property
Applies to
TForm component
Declaration
property ClientHandle: HWND;
Read only. The ClientHandle property value is the handle to the internal MDI (Multiple
Document Interface) client window. The property value is meaningful only if the form
is an MDI parent form with its FormStyle property set to fsMDIForm.
ClientHeight property
Applies to
All controls; TForm component
Declaration
property ClientHeight: Integer;
The ClientHeight property is the height of the control’s client area in pixels. For most
controls, ClientHeight is exactly the same as Height. For forms, however, ClientHeight
represents the height of the usable area inside the form’s frame.
ClientHeight is a run-time only property for all controls except forms.
Example
This example reduces the height of the form’s client area by half when the user clicks the
button on the form:
procedure TForm1.Button1Click(Sender: TObject);
begin
Form1.ClientHeight := Form1.ClientHeight div 2;
end;
Note that only the client area is halved, not the entire form.
See also
ClientWidth property, Height property
ClientOrigin property
Applies to
All controls; TForm component
Declaration
property ClientOrigin: TPoint;
Run-time and read only. The ClientOrigin property is used to determine the screen
coordinates (in pixels) of the top left corner of a control or form client area. ClientOrigin
returns X and Y coordinates in a record of type Point.
See also
ClientRect property
ClientRect property
Applies to
All controls; TForm component
Declaration
property ClientRect: TRect;
Run-time and read only. The ClientRect property is used to determine the size (in pixels)
of a control or form client area. ClientRect returns the Top, Bottom, Left, and Right
coordinates in one record of type TRect.
Example
The following code uses ClientRect to find and draw a line from the top left to the bottom
right of the current form:
with ClientRect do
begin
Canvas.MoveTo(Left,Top);
Canvas.LineTo(Right, Bottom);
end;
See also
ClientOrigin property
ClientToScreen method
Applies to
All controls
Declaration
function ClientToScreen(Point: TPoint): TPoint;
The ClientToScreen method translates the given point from client area coordinates to
global screen coordinates. In client area coordinates (0, 0) corresponds to the upper left
corner of the control’s client area. In screen coordinates (0, 0) corresponds to the upper
left corner of the screen.
Using the ClientToScreen and ScreenToClient methods you can convert from one control’s
coordinate system to another control’s coordinate system. For example,
P := TargetControl.ScreenToClient(SourceControl.ClientToScreen(P));
which converts P from coordinates in SourceControl to coordinates in TargetControl.
Example
This example uses two edit boxes on a form. When the user clicks a point on the form,
the X screen coordinate appears in Edit1, and the Y screen coordinate appears in Edit2.
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
P, Q : TPoint;
begin
P.X := X; { P is the TPoint record for the form}
P.Y := Y;
Q := ClientToScreen(P); { Q is the TPoint for the screen }
Edit1.Text := IntToStr(Q.X) + ' is the X screen coordinate';
Edit2.Text := IntToStr(Q.Y) + ' is the Y screen coordinate';
end;
See also
ScreenToClient method
ClientWidth property
Applies to
All controls
Declaration
property ClientWidth: Integer;
The ClientWidth property is the horizontal size of the control’s client area in pixels. For
most controls, ClientWidth is exactly the same as Width. For forms, however, ClientWidth
represents the width of the usable area inside the form’s frame.
ClientWidth is a run-time only property for all components except forms.
Example
This example uses a button on a form. Each time the user clicks the button, the button
grows 10 pixels wider.
ClipRect property
Applies to
TCanvas object
Declaration
property ClipRect: TRect;
Read only. The ClipRect property specifies a bounding clipping rectangle. The rectangle
specified by ClipRect defines the outer boundaries of the drawing area of the canvas.
Any drawing that occurs at coordinates outside the ClipRect are clipped and don’t
appear onscreen. For example, the ClipRect of the canvas of a form is the same size as the
client area of the form.
See also
ClientRect property
Close method
Applies to
TClipboard object; TDataBase, TForm, TMediaPlayer, TQuery, TStoredProc, TTable
components
For forms
Declaration
procedure Close;
The Close method closes a form. Calling the Close method on a form corresponds to the
user selecting the Close menu item on the form’s System menu. The Close method first
calls the CloseQuery method to determine if the form can close. If CloseQuery returns
False, the close operation is aborted. Otherwise, if CloseQuery returns True, the code
attached to the OnClose event is executed. The CloseAction parameter of the OnClose
event controls how the form is actually closed.
Example
The following method closes a form when a button called Done is clicked:
procedure TForm1.DoneButtonClick(Sender: TObject);
begin
Close;
end;
See also
Hide method, Open method
Example
The following code closes the Clipboard:
Clipboard.Close;
See also
Clipboard variable
See also
Open method
For databases
Declaration
procedure Close;
The Close method closes the TDatabase component and all the dataset components
linked to it. This is the same as setting the Connected property to False.
Example
Database1.Close;
See also
CloseDatasets method
The Close procedure terminates the association between the file variable and an external
disk file.
F is a file variable of any file type opened using Reset, Rewrite, or Append. The external
file associated with F is completely updated and then closed, freeing the file handle for
reuse.
{$I+} lets you handle run-time errors using exceptions. For more information on
handling run-time library exceptions, see Handling RTL Exceptions in the Help system.
If you are using {$I–}, you must use IOResult to check for I/O errors.
Example
var
F: TextFile;
begin
if OpenDialog1.Execute then { Bring up open file dialog }
begin
AssignFile(F, OpenDialog1.FileName);
{ File selected in dialog }
Reset(F);
Edit1.Text := IntToStr(FileSize(F);
{ Put file size string in a TEdit control }
CloseFile(F); { Close file }
end;
end;
See also
Append procedure, AssignFile procedure, Reset procedure, Rewrite procedure
CloseApplication method
Applies to
TReport component
Declaration
function CloseApplication(ShowDialogs: Boolean): Boolean;
The CloseApplication method stops ReportSmith Runtime, if it is running.
CloseApplication sends a DDE message to terminate ReportSmith Runtime and looks for
a DDE message from ReportSmith in return. If CloseApplication returns True, the
ReportSmith Runtime received the message to terminate successfully; if it returns False,
ReportSmith Runtime was not able to receive the message at the current time.
The value of the ShowDialogs parameter determines whether ReportSmith displays
dialog boxes prompting users to save the existing report before closing, and so on. If
ShowDialogs is True, the dialog boxes appear before ReportSmith closes. If the parameter
is False, no dialog boxes appear.
Declaration
procedure CloseDatabase(Database: TDatabase);
The CloseDatabase method closes a TDatabase component. The parameter Database
specifies the TDatabase component to close. Normally, this is handled automatically
when an application closes the last table in the database associated with a TDatabase
component. CloseDatabase decrements the Session’s reference count of the number of
open database connections.
You should always use CloseDatabase with OpenDatabase, typically in a try...finally block
to ensure that database connections are handled properly.
Example
Database := Session.OpenDatabase(‘DBDEMOS’);
try
begin
{Do Something}
finally
Session.CloseDatabase(‘DBDEMOS’);
end;
See also
Session variable
CloseDatasets method
Applies to
TDataBase component
Declaration
procedure CloseDatasets;
The CloseDatasets method closes all of the dataset components linked to the TDatabase
component, but does not close the database connection itself.
Example
Database1.CloseDatasets;
See also
Close method
CloseDialog method
Applies to
TFindDialog, TReplaceDialog components
Declaration
procedure CloseDialog;
The CloseDialog method closes the Find and Replace dialog boxes.
See also
Execute method
CloseLink method
Applies to
TDDEClientConv component
Declaration
function CloseLink;
The CloseLink method terminates an ongoing DDE conversation. After a link is closed,
+
no DDE communication can take place between the DDE client and server until another
link is opened.
+
Example
C
The following code terminates the DDE conversation.
DDEClientConv1.CloseLink;
See also
OnClose event, OpenLink method
CloseQuery method
Applies to
TForm component
Declaration
function CloseQuery: Boolean;
The CloseQuery method is called as part of a form’s Close method processing to
determine if the form can actually close. CloseQuery executes the code attached to the
OnCloseQuery event. If the OnCloseQuery event handler assigns False to its CanClose
parameter, CloseQuery will return False indicating that the form cannot close. Otherwise
CloseQuery returns True, indicating that the form is ready to close.
The CloseQuery method of the main form of an MDI application automatically calls the
CloseQuery method of each MDI child form before executing its own OnCloseQuery
event. If any of the child forms return False, the main form’s CloseQuery stops and also
returns False. Your application can use the OnCloseQuery event to ask users if they want
special processing to occur, such as saving information on the form, before the form is
closed.
Example
When the user attempts to close the form in this example, a message dialog appears that
asks if it is OK to close the form. If the user chooses No, the form doesn’t close. If the
user chooses OK, the form closes.
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
var
ButtonSelected: Word;
begin
ButtonSelected := MessageDlg('Is it OK to close the form?', mtInformation,
[mbOk, mbNo], 0);
if ButtonSelected = mrOk then
CanClose := True
else
CanClose := False;
end;
See also
Close method, OnCloseQuery event
CloseReport method
Applies to
TReport component
Declaration
function CloseReport(ShowDialogs: Boolean): Boolean;
The CloseReport method determines whether the running of a ReportSmith report
terminates. CloseReport sends a DDE message to ReportSmith Runtime and looks for a
DDE message from ReportSmith Runtime in return. If CloseReport returns True,
ReportSmith Runtime received the message to terminate the report. If CloseReport
returns False, ReportSmith Runtime could not receive the DDE message at the current
time.
The ShowDialogs parameter determines whether dialog boxes that prompt the user
about saving the report appear before the report closes, and so on. If ShowDialogs is True,
the dialog boxes appear. If it is False, the dialog boxes are not shown.
Example
The following code terminates the running report if the user chooses Yes from a dialog
box:
if MessageDlg('Do you want to stop running ' + Report1.ReportName + ' ?',
mtConfirmation, [mbYes, mbNo], 0) = mrYes then
if Report1.CloseReport(False) then MessageDlg(Report1.ReportName + ' canceled.',
mtInformation, [mbOK], 0);
See also
CloseApplication method
CloseUp method
Applies to
TDBLookupCombo component
Declaration
procedure CloseUp;
The CloseUp method closes an opened or “dropped-down” database lookup combo box.
See also
DropDown method
Example
uses WinCrt;
begin
ClrScr;
Writeln('Hello there, how are you today?');
Writeln('Press <enter> key...');
Readln;
GotoXY(1,2);
ClrEol;
Writeln ('Glad to hear it!');
end;
See also
ClrScr procedure
Example
uses WinCrt;
begin
Writeln('Hello. Please the <enter> key...');
Readln;
ClrScr;
end;
See also
ClrEol procedure
Col property
Applies to
TDrawGrid, TStringGrid components
Declaration
property Col: Longint;
Run-time only. The value of the Col property indicates the current column of the cell that
has input focus. You can use the Col property along with the Row property to determine
which cell is selected at run time.
Example
This example uses a string grid with a label above it on a form. When the user clicks a
cell in the grid, the location of the cursor is displayed in the label caption.
procedure TForm1.StringGrid1Click(Sender: TObject);
begin
Label1.Caption := 'The cursor is in column ' + IntToStr(StringGrid1.Col + 1)
+ ', row ' + IntToStr(StringGrid1.Row + 1);
end;
See also
ColCount property, ColWidths property, DefaultColWidth property
Example
The following line of code adds one column to a string grid named MyStrngGrd:
MyStrngGrd.ColCount := MyStrngGrd.ColCount + 1;
See also
Col property, ColWidths property, RowCount property
Collapse method
Applies to
TOutlineNode object
Declaration
procedure Collapse;
The Collapse method collapses an outline item by assigning False to its Expanded
property. When an outline item is collapsed, its sub-items are hidden and the plus
picture or closed picture might be displayed, depending on the outline style specified in
the OutlineStyle property of the TOutline component.
Example
The following code collapses the first outline item.
Outline1.Items[1].Collapse;
See also
Expand method, FullCollapse method, FullExpand method, PictureClosed property,
PicturePlus property
Collate property
Applies to
TPrintDialog component
Declaration
property Collate: Boolean;
The Collate property determines if the Collate check box is checked and, therefore, if
collating is selected. Regardless of the initial setting of the Collate property, the user can
always check or uncheck the Collate check box (and change the Collate property) to
choose or not choose to collate the print job. The default setting is False.
Color property
Applies to
TBrush, TFont, TPen objects; TBitBtn, TCheckBox, TColorDialog, TComboBox,
TDBCheckBox, TDBComboBox, TDBEdit, TDBGrid, TDBImage, TDBListBox,
TDBLookupCombo, TDBLookupList, TDBMemo, TDBRadioGroup, TDBText,
TDirectoryListBox, TDrawGrid, TDriveComboBox, TEdit, TFileListBox, TForm, TGroupBox,
TLabel, TListBox, TMaskEdit, TMemo, TNotebook, TOutline, TPaintBox, TPanel,
TRadioButton, TScrollBox, TStringGrid components
Declaration
property Color: TColor;
For all components or objects except the Color dialog box, the Color property determines
the background color of a form or the color of a control or graphics object.
If a control’s ParentColor property is True, then changing the Color property of the
control’s parent automatically changes the Color property of the control. When you
assign a value to a control’s Color property, the control’s ParentColor property is
automatically set to False. These are the possible values of Color:
Value Meaning
clBlack Black
clMaroon Maroon
clGreen Green
clOlive Olive green
clNavy Navy blue
clPurple Purple
clTeal Teal
clGray Gray
clSilver Silver
clRed Red
clLime Lime green
clBlue Blue
clFuchsia Fuchsia
clAqua Aqua
clWhite White
clBackground Current color of your Windows background
The second half of the colors listed here are Windows system colors. The color that
appears depends on the color scheme users are using for Windows. Users can change
these colors using the Control Panel in Program Manager. The actual color that appears
will vary from system to system. For example, the color fuchsia may appear more blue
on one system than another.
Example
This code colors a form red:
Form1.Color := clRed;
The following code changes the color of an edit box control using the Color dialog box.
The example displays the Color dialog box when the Button1 button is clicked, allowing
the user to select a color with the dialog box. The example then assigns the color value
selected with the dialog box to the Color property of the edit box control:
procedure TForm1.Button1Click(Sender: TObject);
begin
if ColorDialog1.Execute then
Edit1.Color := ColorDialog1.Color;
end;
See also
ColorToRGB function, ParentColor property, TColorDialog component
ColoredButtons property
Applies to
TMediaPlayer component
Declaration
property ColoredButtons: TButtonSet;
The ColoredButtons property determines which of the buttons on the media player
control has color. If a button is not colored with ColoredButtons, it appears in black-and-
white when visible. All media player control buttons are colored by default.
Example
The following example displays all of the media player component’s buttons in color:
TMediaPlayer1.ColoredButtons := [btPlay, btPause, btStop, btNext, btPrev, btStep, btBack,
btRecord, btEject]
See also
EnabledButtons property, VisibleButtons property
The ColorToRGB function returns the RGB value that Windows uses from a TColor type
+
used by Delphi. If the color represents a system color, the current RGB value for that
system color is returned.
+
Example
C
The following code converts the color of the current form, Form1, to a Windows RGB
value:
var
L : Longint;
begin
L := ColorToRGB(Form1.Color);
end;
See also
Color property
Cols property
Applies to
TStringGrid component
Declaration
property Cols[Index: Integer]: TStrings;
The Cols property is an array of the strings and their associated objects in a column. The
number of strings and associated objects is always equal to the value of the ColCount
property, the number of columns in the grid. Use the Cols property to access the strings
and their associated objects within a particular column in the grid. The Index parameter
is the number of the column you want to access; the Index value of the first column in the
grid is zero.
Example
The following line of code adds the string ’Hello’ to the end of the list of strings in
column four of the string grid named StringGrid1:
StringGrid1.Cols[3].Add('Hello');
See also
Cells property, Objects property, Rows property
Columns property
Applies to
TDBRadioGroup, TDirectoryListBox, TListBox, TRadioGroup components
Declaration
property Columns: Longint;
The Columns property denotes the number of columns in the list box or radio group box.
Specify the number of columns you want for the list box or radio group box as the value
of Columns.
Example
This example uses a list box and a button on a form. Each time the user clicks the button,
the string ‘Hello’ is added to the list box. When the list box is filled, a new column is
created and subsequent new strings are added to the new column:
procedure TForm1.Button1Click(Sender: TObject);
begin
if ListBox1.Columns < 1 then
ListBox1.Columns := 1;
Listbox1.Items.Add('Hello');
if Listbox1.Height <= ((Listbox1.ItemHeight * Listbox1.Items.Count)
/ ListBox1.Columns) then
Listbox1.Columns := Listbox1.Columns + 1;
end;
ColWidths property
Applies to
TDrawGrid, TStringGrid components
Declaration
property ColWidths[Index: Longint]: Integer;
Run-time only. The ColWidths property determines the width in pixels of all the cells
within the column referenced by the Index parameter.
By default, all the columns are the same width, the value of the DefaultColWidth
property. To change the width of all columns within a grid, change the DefaultColWidth
property value.
To change the width of one column without affecting others, change the ColWidths
property. Specify the column you want to change as the value of the Index parameter.
Remember the first column always has an Index value of 0.
Example
The following code changes the width of column 0 in the string grid called StringGrid1
to twice the default value.
StringGrid1.ColWidths[0] := StringGrid1.DefaultColWidth * 2;
See also
RowHeights property
Example
The following procedure is a WM_COMMAND message handler. It checks the ItemID
field of Msg to see if the message was generated by a menu item called MenuThink. If so,
it displays a message dialog box. When writing message handlers, remember to call
Inherited afterward, if necessary, so Windows can perform default message processing.
procedure TForm1.WMCommand(var Msg: TWMCommand);
begin
if Msg.ItemID = MenuThink.Command then
MessageDlg(‘This is the Think command’, mtInformation, [mbOk], 0);
Inherited;
end;
Commit method
Applies to
TDataBase component
Declaration
procedure Commit;
The Commit method commits the current transactions and thus all modifications made
to the database since the last call to StartTransaction. If no transaction is active, Delphi
will raise an exception. Use this method only when connected to a server database.
Example
with Database1 do
begin
StartTransaction;
{ Update one or more records in tables linked to Database1 }
...
Commit;
end;
See also
Rollback method
Example
The following code compares String1, 'STEVE', to String2, 'STEVe'. Note that CompareStr
returns a number less than 0 because the value of 'e' is greater than the value of 'E'.
var
String1, String2 : string;
I : integer;
begin
String1 := 'STEVE';
String2 := 'STEVe';
I := CompareStr(String1, String2); { the value of I is < 0 }
if I < 0 then
MessageDlg('The strings are not equal', mtWarning, [mbOK], 0)
end;
See also
CompareText function
Example
The following code compares String1, 'ABC, to String2, 'aaa'. Because CompareText is
case insensitive, String2 is larger.
var
String1, String2 : string;
See also
CompareStr function
ComponentCount property
Applies to
All components
Declaration
property ComponentCount: Integer;
Run-time and read only. The ComponentCount property indicates the number of
components owned by the component as listed in the Components array property. For
example, ComponentCount of a form contains the same number of items as in the
Components list of a form.
Note ComponentCount is always 1 more than the highest Components index, because the first
Components index is always 0.
Example
This code uses several controls on a form, including a button and an edit box. When the
user clicks the button, the code counts all the components on the form and displays the
number in the Edit1 edit box. While the components are being counted, each is
evaluated to see if it is a button component. If the component is a button, the code
changes the font on the button face.
procedure TForm1.Button1Click(Sender: TObject);
var
I: Integer;
begin
for I := 0 to ComponentCount -1 do
if Components[I] is TButton then
TButton(Components[I]).Font.Name := 'Courier';
Edit1.Text := IntToStr(ComponentCount) + ' components';
end;
See also
ComponentIndex property, Components property
ComponentIndex property
Applies to
All components
Declaration
property ComponentIndex: Integer;
Run-time and read only. The ComponentIndex property indicates the position of the
component in its owner’s Components property list. The first component in the list has a
ComponentIndex value of 0, the second has a value of 1, and so on.
Example
The following code uses a button and a wide edit box on a form. When the user clicks
the button, the edit box displays the index value of the button component:
procedure TForm1.Button1Click(Sender: TObject);
begin
Edit1.Text := 'The index of the button is ' + IntToStr(Button1.ComponentIndex);
end;
See also
ComponentCount property, Components property
Components property
Applies to
All components
Declaration
property Components[Index: Integer]: TComponent;
Run-time and read only. The Components array property is a list of all components
owned by the component. You can use the Components property to access any of these
owned components, such as the controls owned by a form. The Components property is
most useful if you need to refer to owned components by number rather than name.
Don’t confuse the Components property with the Controls property. The Components
property lists all components that are owned by the component, whereas the Controls
property lists all the controls that are child windows of this control. All components on a
form are owned by the form, and therefore, they appear in the form’s Components
property list.
Consider this example. If you put a control in a group box, the form still owns the
control, but the control’s window parent is the group box control, and therefore, is listed
in the group box’s Controls property array.
See also
ComponentCount property, ComponentIndex property, Owner property, Parent property,
TabOrder property
Example
var
S: string;
begin
S := Concat('ABC', 'DEF'); { 'ABCDE' }
end;
See also
Copy function, Delete procedure, Insert procedure, Length function, Pos function
ConfirmDelete property
Applies to
TDBNavigator component
Declaration
property ConfirmDelete: Boolean;
The ConfirmDelete property determines whether a message box asking you to confirm
the deletion when the user uses the database navigator to delete the current record in
the dataset. If ConfirmDelete is True, a prompting message box appears and the record
isn’t deleted unless the user chooses the OK button. If ConfirmDelete is False, no message
box appears and the record is deleted.
The default value is True.
See also
VisibleButtons property
Connect method
Applies to
TReport component
Declaration
function Connect(ServerType: Word; const ServerName, UserName, Password,
DatabaseName: string): Boolean;
The Connect method connects the report to a database, bypassing the ReportSmith log in
dialog box. Specify the server type and name with the ServerType and ServerName
parameters. Specify the user name, the log-in password, and the name of the database
using the UserName, Password, and DatabaseName parameters.
Connected property
Applies to
TDataBase component
Declaration
property Connected: Boolean;
The Connected property indicates whether the TDatabase component has established a
connection to a database. Connected will be set to True when an application opens a table
in a database (logging in to a server, if required). It will be set back to False when the
table is closed (unless KeepConnection is True). Set Connected to True to establish a
Example
Database1.Connected := True;
ConnectMode property
Applies to
TDDEClientConv component
Declaration
property ConnectMode: TDataMode;
The ConnectMode property determines the type of connection to establish when
initiating a link with a DDE server application. These are the possible values:
Value Meaning
ddeAutomatic The link is automatically established when the form containing the TDDEClient
component is created at run time. This is the default value.
ddeManual The link is established only when the OpenLink method is called.
Example
The following code sets the connect mode of DDEClientConv1 to manual.
DDEClientConv1.ConnectMode := ddeManual;
ContainsControl method
Applies to
All windowed controls
Declaration
function ContainsControl(Control: TControl): Boolean;
The ContainsControl method indicates whether a specified control exists within a control.
If the method returns True, the control specified as the value of the Control parameter
exists within the control. If the method returns False, the specified control is not within
the control.
Example
This example uses a label, a list box, and a button on a form. When the user clicks the
button, the caption of the label reports that the form contains the list box:
procedure TForm1.Button1Click(Sender: TObject);
begin
if ContainsControl(ListBox1) then
Label1.Caption := 'The form contains ListBox1';
end;
Example
var
F: File;
i: integer;
begin
for i := 0 to (FileListBox1.Items.Count – 1) do begin
if FileListBox1.Selected[i] then begin
if not FileExists(FileListBox1.Items.Strings[i]) then begin
MessageDlg('File: ' + FileListBox1.Items.Strings[i] +
' not found', mtError, [mbOk], 0);
Continue;
end;
AssignFile(F, FileListBox1.Items.Strings[i]);
Reset(F, 1);
ListBox1.Items.Add(IntToStr(FileSize(F)));
CloseFile(F);
end;
end;
end;
See also
Break procedure, Exit procedure, Halt procedure
ControlCount property
Applies to
All controls
Declaration
property ControlCount: Integer;
Run-time and read only. The ControlCount property indicates the number of controls
that are children of the control. The children are listed in the Controls property array.
Note The value of ControlCount is always 1 greater than the highest Controls index, because
the first Controls index is 0.
Example
This example uses a group box on a form, with several controls contained within the
group box. The form also has an edit box and a button outside of the group box. The
code counts each control’s child controls turning each of them invisible as they are
counted. The total number of controls counted appears in the edit box.
procedure TForm1.Button1Click(Sender: TObject);
var
I: Integer;
begin
for I:= 0 to GroupBox1.ControlCount -1 do
GroupBox1.Controls[I].Visible := False;
Edit1.Text := IntToStr(GroupBox1.ControlCount) + ' controls';
end;
See also
Controls property
Controls property
Applies to
All controls
Declaration
property Controls[Index: Integer]: TControl;
Run-time and read only. The Controls property is an array of all controls that are
children of the control. The Controls property is most useful if you have a need to refer to
the children of a control by number rather than name.
Don’t confuse the Controls property with the Components property. The Components
property lists all components that are owned by the component, while the Controls
property lists all the controls that are child windows of the control. All components put
on a form are owned by the form, and therefore, they appear in the form’s Components
property list.
For example, if you put a control in a group box, the form still owns the control, but the
control’s window parent is the group box control, and therefore, is listed in the group
box’s Controls property array.
Example
This example uses a group box on a form, with several controls contained within the
group box. The form also has an edit box and a button outside of the group box. The
code counts each control’s child controls turning each of them invisible as they are
counted. The total number of controls counted displays in the edit box.
procedure TForm1.Button1Click(Sender: TObject);
var
I: Integer;
begin
for I:= 0 to GroupBox1.ControlCount -1 do
GroupBox1.Controls[I].Visible := False;
Edit1.Text := IntToStr(GroupBox1.ControlCount) + ' controls';
end;
See also
ControlCount property, Owner property, Parent property
ConvertDlgHelp property
Applies to
TOLEContainer component
Declaration
property ConvertDlgHelp: THelpContext;
Example
The following code assigns 531 to the context-sensitive Help identification number of
the OLE Convert dialog box.
OLEContainer1.ConvertDlgHelp := 531;
Copies property
Applies to
TPrintDialog component
Declaration
property Copies: Integer;
The value of the Copies property determines the number of copies of the print job to
print. If you change the value of Copies at design time, the value you specify is the
default value in the edit box control when the Print dialog box appears. The default
value is 0.
Example
The following code sets the default number of copies for the print dialog box,
PrintDialog1, to 3 before displaying the dialog box:
PrintDialog1.Copies := 3;
PrintDialog1.Execute;
Example
var S: string;
begin
S := 'ABCDEF';
S := Copy(S, 2, 3); { 'BCD' }
end;
See also
Concat function, Delete procedure, Insert procedure, Length function, Pos function
CopyMode property
Applies to
TCanvas object
Declaration
property CopyMode: TCopyMode;
The CopyMode property determines how a canvas treats an image copied from another
canvas. By default, CopyMode is cmSrcCopy, meaning that pixels from the other canvas
are copied to the canvas, overwriting any image already there. By changing CopyMode,
you can create many different effects. The following table shows possible values of
CopyMode and describes each:
Value Meaning
cmBlackness Turns all output black.
cmDstInvert Inverts the destination bitmap.
cmMergeCopy Combines the pattern and the source bitmap by using the Boolean AND operator.
cmMergePaint Combines the inverted source bitmap with the destination bitmap by using the
Boolean OR operator.
cmNotSrcCopy Copies the inverted source bitmap to the destination.
Example
The following code copies the the inverted source bitmap to the Canvas of Form2:
Form2.Canvas.CopyMode := cmNotSrcCopy;
Form2.Canvas.CopyRect(ClientRect, Canvas, ClientRect);
See also
CopyRect method
CopyParams method
Applies to
TStoredProc component
Declaration
procedure CopyParams(Value: TParams);
The CopyParams method copies all of the parameter information from the stored
procedure component to Value. Use this method to copy parameters from one stored
procedure component to another.
Example
{ Copy all parameters from StoredProc1 to StoredProc2 }
StoredProc1.CopyParams(StoredProc2.Params);
CopyRect method
Applies to
TCanvas object
Declaration
procedure CopyRect(Dest: TRect; Canvas: TCanvas; Source: TRect);
The CopyRect method copies part of an image from another canvas into the canvas
object. The Dest property specifies the destination rectangle on the destination canvas
where the image will be copied. The Canvas property specifies the source canvas. The
Source property specifies the source rectangle from the source canvas that will be copied.
Example
The following code copies the the inverted source bitmap to the Canvas of Form2:
Form2.Canvas.CopyMode := cmNotSrcCopy;
Form2.Canvas.CopyRect(ClientRect, Canvas, ClientRect);
See also
CopyMode property
CopyToClipboard method
Applies to
TDBEdit, TDBImage, TDBMemo, TDDEServerItem, TEdit, TMemo, TOLEContainer
components
Example
The following method copies the selected text from the memo control named Memo1 to
the Clipboard and pastes it into an edit box named Edit1 when the user clicks the button
named Button1:
procedure TForm1.Button1Click(Sender: TObject);
begin
Memo1.CopyToClipboard;
Edit1.PasteFromClipboard;
end;
Example
The following code copies the OLE object in OLEContainer1 to the Clipboard without
clearing the contents first.
OLEContainer1.CopyToClipboard(False);
See also
Clear method
rules of the DDE server application. See the documentation for the DDE server
application for specific information about pasting the link.
If the Clear parameter is True, the prior contents of the Clipboard are deleted before
CopyToClipboard places its data on the Clipboard. If Clear is False, the Clipboard won’t be
cleared before the copy.
Example
The following code copies the DDE link information of DDEServerItem1 to the
Clipboard, clearing the contents of the Clipboard before the copy.
DDEServerItem1.CopyToClipboard;
See also
Clear method
Example
The following code copies the contents of DBImage1 to the Clipboard without clearing
the contents of the Clipboard first.
DBImage1.CopyToClipboard(False);
See also
CutToClipboard method, PasteFromClipboard method
Example
var R: Real;
begin
R := Cos(Pi);
end;
Example
The following code displays the number of items in a list box in the caption of a label
when the user clicks the CountItems button:
procedure TForm1.CountItemsClick(Sender: TObject);
begin
Label1.Caption := 'There are ' + IntToStr(ListBox1.Items.Count) +
' items in the listbox.';
end;
The following example assumes the form contains a main menu component, which
includes a File menu and a label. This code displays the number of menu items that
make up the File menu.
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption := IntToStr(FileMenu.Count):
end;
See also
Items property, List property, Strings property
Example
{ Assign 99999 to any integer parameter which does not have a value }
for I := 0 to Params.Count - 1 do
if (Params.Items[I].IsNull) and (Params.Items[I].DataType = ftInteger) then
{ Items is the default property, so you can omit its name }
Params[I].AsInteger := 99999;
See also
Items property
Create method
Applies to
All objects and components
Example
This code creates an .INI file object and passes it the name of the .INI file,
SUPERAPP.INI:
var
IniFile: TIniFile;
begin
IniFile := TIniFile.Create(‘SUPERAPP.INI’);
IniFile.Free;
end;
Example
{ Link BlobStream1 to MyBlobField for data access only }
BlobStream1 := TBlobStream.Create(MyBlobField, bmRead);
Example
The following code creates a TButton and makes Form1 the owner.
var
Button1: TButton;
begin
Button1 := TButton.Create(Form1);
end;
Example
The following code creates a TBitmap and loads the bitmap graphic file C:\WINDOWS\
256COLOR.BMP into it. Then, the bitmap is drawn in a paint box by the OnPaint event
handler of PaintBox1.
procedure TForm1.PaintBox1Paint(Sender: TObject);
var
Bitmap1: TBitmap;
begin
Bitmap1 := TBitmap.Create;
Bitmap1.LoadFromFile('c:\windows\256color.bmp');
PaintBox1.Canvas.Draw(0, 0, Bitmap1);
Bitmap1.Free;
end;
See also
Free method
CreateField method
Applies to
TFieldDef object
Declaration
function CreateField(Owner: TComponent): TField;
CreateField creates a TField component of the appropriate type that corresponds to the
TFieldDef object itself. Owner is the dataset component containing the field.
CreateForm method
Applies to
TApplication component
Declaration
procedure CreateForm(FormClass: TFormClass; var Reference);
The CreateForm method creates a new form of the type specified by the FormClass
parameter and assigns it to the variable given by the Reference parameter. The owner of
the new form is the Application object. The form created by the first call to CreateForm in a
project becomes the project's main form.
A Delphi project typically contains one or more calls to CreateForm in the project's main
statement part, but there is seldom any need for you to call CreateForm yourself.
Example
The following code creates Form1 of type TForm1.
Application.CreateForm(TForm1, Form1);
CreateNew method
Applies to
TForm component
Declaration
constructor CreateNew(AOwner: TComponent);
The CreateNew method creates a new instance of the current form type.
CreateParam method
Applies to
TParams object
Declaration
function CreateParam(FldType: TFieldType; const ParamName: string;
ParamType: TParamType): TParam;
The CreateParam method attempts to create a new entry in Items, using the FieldType,
ParamName, and ParamType parameters.
Example
{ Create a new parameter for CustNo and assign a value of 999 to it }
with Params.CreateParam(ftInteger, ‘CustNo’, ptInput) do
AsInteger := 999;
Example
with Table1 do
begin
Active := False;
DatabaseName := ‘Delphi_Demos’;
TableName := ‘CustInfo’;
TableType := ttParadox;
with FieldDefs do
begin
Clear;
Add(‘Field1’, ftInteger, 0);
Add(‘Field2’, ftInteger, 0);
end;
with IndexDefs do
begin
Clear;
Add(‘Field1Index’, ‘Field1’, [ixPrimary, ixUnique]);
end;
CreateTable;
end;
Example
function MakeHexWord(w: Word): string;
const
hexChars: array [0..$F] of Char = '0123456789ABCDEF';
var
HexStr : string;
begin
HexStr := '';
HexStr := HexStr + hexChars[Hi(w) shr 4];
HexStr := HexStr + hexChars[Hi(w) and $F];
HexStr := HexStr + hexChars[Lo(w) shr 4];
HexStr := HexStr + hexChars[Lo(w) and $F];
MakeHexWord := HexStr;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
i: Integer;
Y: Integer;
S: string;
begin
Y := 10;
S := 'The current code segment is $' + MakeHexWord(CSeg);
Canvas.TextOut(5, Y, S);
Y := Y + Canvas.TextHeight(S) + 5;
S := 'The global data segment is $' + MakeHexWord(DSeg);
Canvas.TextOut(5, Y, S);
Y := Y + Canvas.TextHeight(S) + 5;
S := 'The stack segment is $' + MakeHexWord(SSeg);
Canvas.TextOut(5, Y, S);
Y := Y + Canvas.TextHeight(S) + 5;
S := 'The stack pointer is at $' + MakeHexWord(SPtr);
Canvas.TextOut(5, Y, S);
Y := Y + Canvas.TextHeight(S) + 5;
S := 'i is at offset $' + MakeHexWord(Ofs(i));
Canvas.TextOut(5, Y, S);
Y := Y + Canvas.TextHeight(S) + 5;
S := 'in segment $' + MakeHexWord(Seg(i));
Canvas.TextOut(5, Y, S);
end;
See also
DSeg function, SSeg function
Ctl3D property
Applies to
TBitBtn, TButton, TCheckBox, TColorDialog, TComboBox, TDBCheckBox, TDBComboBox,
TDBEdit, TDBGrid, TDBImage, TDBListBox, TDBLookupCombo, TDBLookupList,
TDBMemo, TDBNavigator, TDBRadioGroup, TDirectoryListBox, TDrawGrid,
TDriveComboBox, TEdit, TFileListBox, TFindDialog, TFilterComboBox, TFontDialog, TForm,
TGroupBox, TListBox, TMaskEdit, TMemo, TNotebook, TOLEContainer, TOpenDialog,
TOutline, TPanel, TRadioButton, TReplaceDialog, TSaveDialog, TScrollBar, TScrollBox,
TStringGrid components
Example
The following code toggles the 3-D look of a memo control when the user clicks a button
named Toggle:
procedure TForm1.ToggleClick(Sender: TObject);
begin
Memo1.Ctl3D := not Memo1.Ctl3D; {Toggles the Ctl3D property of Memo1}
end;
See also
ParentCtl3D property
TimePMString: string[7];
ShortTimeFormat: string[15];
LongTimeFormat: string[31];
ShortMonthNames: array[1..12] of string[3];
LongMonthNames: array[1..12] of string[15];
ShortDayNames: array[1..7] of string[3];
LongDayNames: array[1..7] of string[15];
The SysUtils unit includes a number of variables that are used by the date and time
routines. You can assign new values to these variables to change the formats of date and
time strings.
The initial value is fetched from the iCurrency variable in the [intl] section of
WIN.INI.
NegCurrFormat The currency format for used in floating-point to decimal conversions of
negative numbers. Possible values are:
0 = ($1) 4 = (1$)
1 = -$1 5 = -1$
2 = $-1 6 = 1-$
3 = $1- 7 = 1$-
The initial value is fetched from the iNegCurr variable in the [intl] section of
WIN.INI.
ThousandSeparator The character used to separate thousands in numbers with more than three digits
to the left of the decimal separator. The initial value is fetched from the
sThousand variable in the [intl] section of WIN.INI.
DecimalSeparator The character used to separate the integer part from the fractional part of a
number. The initial value is fetched from the sDecimal variable in the [intl]
section of WIN.INI.
CurrencyDecimals The number of digits to the right of the decimal point in a currency amount. The
initial value is fetched from the sCurrDigits variable in the [intl] section of
WIN.INI.
DateSeparator The character used to separate the year, month, and day parts of a date value.
The initial value is fetched from the sDate variable in the [intl] section of
WIN.INI.
Example
This example uses a label and a button on a form. When the user clicks the button, the
current date displays in the caption of the label. Because some of the date variables are
assigned new values, the format of the date in the label changes. For example, if the date
is 9/15/94, the date displays as 15-09-1994.
procedure TForm1.Button1Click(Sender: TObject);
begin
DateOrder := doDMY;
DateSeparator := '-';
DateFullYear := True;
DateLeadZero := True;
Label1.Caption := DateToStr(Date);
end;
Currency property
Applies to
TBCDField, TCurrencyField, TFloatField components
Declaration
property Currency: Boolean;
Run-time only. The Currency property is used to control the format of the value of a
TBCDField, TCurrencyField, and TFloatField when both DisplayFormat and EditFormat
properties are not assigned.
Currency is True by default for TCurrencyField and False for TFloatField and TBCDField.
When Currency is True formatting is performed by FloatToText using ffCurrency for
display text or ffFixed for editable text. When Currency is False, the formatting is
performed by FloatToTextFmt.
See also
DisplayFormat property, EditFormat property, FloatToText function, FloatToTextFmt
function
Cursor property
Applies to
All controls, TScreen component
Example
This line of code changes the display of the image to the cross cursor when the user
moves the mouse pointer over Button1:
Button1.Cursor := crCross;
See also
Cursors property, DragCursor property
Declaration
property Cursor: TCursor;
The Screen object's Cursor property controls the mouse cursor shape at a global level.
Assigning any value but crDefault to the Screen object's Cursor property sets the mouse
cursor shape for all windows belonging to the application. The global mouse cursor
shape remains in effect until you assign crDefault to the Screen object's Cursor property,
at which point normal cursor behavior is restored.
To see a list of possible cursor shapes, see the Cursor property for all controls.
Example
Assignments to the Screen object's cursor property are typically guarded by a
try...finally statement to ensure that normal cursor behavior is restored, for example:
Screen.Cursor := crHourglass; { Show hourglass cursor }
try
{ Do some lengthy operation }
finally
Screen.Cursor := crDefault; { Always restore to normal }
end;
CursorPosChanged method
Applies to
TTable, TQuery, TStoredProc components
Declaration
procedure CursorPosChanged;
The CursorPosChanged method is needed only if you use the Handle property to make
direct calls to the Borland Database Engine (BDE) API which cause the cursor position
to change. To notify the dataset that the underlying BDE cursor’s position has changed,
call CursorPosChanged after the direct calls to the BDE.
See also
UpdateCursorPos method
Cursors property
Applies to
TScreen component
Declaration
property Cursors[Index: Integer]: HCursor;
Run-time only. The Cursors property gives you access to the list of cursors available for
your application. To access a particular cursor, specify its position in the list of cursors as
the value of the Index parameter with the first position in the list having an index of 0,
the second having an index of 1, and so on.
Using the Cursors property, you can make custom cursors available to your application.
These are the cursor constants and their position in the Cursors property array:
+
Cursor Value Cursor Value
+
crDefault
crNone
0
–1
crSizeWE
crUpArrow
–9
–10
C
crArrow –2 crHourglass –11
crCross –3 crDrag –12
crIBeam –4 crNoDrop –13
crSize –5 crHSplit –14
crSizeNESW –6 crVSplit –15
crSizeNS –7 crMultiDrag –16
crSizeNWSE –8 crSQLWait –17
Example
This example assumes you have created a cursor resource with the name NewCursor.
The code loads the new cursor into the Cursors property array and makes the newly
loaded cursor the cursor of the form:
const
crMyCursor = 5;
procedure TForm1.FormCreate(Sender: TObject);
begin
Screen.Cursors[crMyCursor] := LoadCursor(HInstance, 'NewCursor');
Cursor := crMyCursor;
end;
See also
Cursor property, DragCursor property
The CursorTo procedure moves the cursor to the given coordinates (X, Y) within the
virtual screen.
The coordinates of the upper left corner of the CRT window are (0, 0). CursorTo sets the
Cursor variable to (X, Y).
See also
GoToXY procedure
CustomColors property
Applies to
TColorDialog component
Declaration
property CustomColors: TStrings;
The value of the CustomColors property determines the custom colors that are available
in the Color dialog box. Each custom color is represented as a string that follows this
format:
ColorX=HexValue
For example, this string could indicate that the first custom color box in the Color dialog
box:
ColorA=808022
This is the same format that your CONTROL.INI file uses to specify the custom colors
that are available in the Windows Color dialog box.
You can have up to 16 custom colors, ColorA through ColorP.
Use the string list of custom colors to save the custom colors specified in the dialog box
so you can use them elsewhere. For example, you might save them to an .INI file for
your application so your application can use the custom colors.
Example
This example displays the Color dialog box, allowing the user to create custom colors,
then displays the custom color strings in a list box:
procedure TForm1.Button1Click(Sender: TObject);
begin
if ColorDialog1.Execute then
ListBox1.Items.AddStrings(ColorDialog1.CustomColors);
end;
Example
The following method cuts the text the user selects in Memo1 to the Clipboard and
pastes it from the Clipboard in an edit box control when the user clicks the button:
procedure TForm1.Button1Click(Sender: TObject);
begin
Memo1.CutToClipboard;
Edit1.PasteFromClipboard;
end;
See also
Clear method, ClearSelection method, CopyToClipboard method, PasteFromClipboard
method
Data property
Applies to
TOutlineNode component
Declaration
property Data: Pointer;
Run-time only. The Data property specifies any data you want associated with an
outline item.
Example
The following code creates a TBitmap and adds it to the Data of the selected outline item.
var
Bitmap: TBitmap;
begin
Bitmap := TBitmap.Create;
Outline1.Items[Outline1.SelectedItem].Data := Bitmap;
end;
See also
GetDataItem method, Text property
Database property
Applies to
TTable, TQuery component
Declaration
property Database: TDatabase;
Run-time and read only. Database specifies the database (TDatabase) component
associated with the dataset component. If you did not create a TDatabase at design time,
then Delphi will create one at run time. Use the Database property to reference the
properties and methods of the database.
Example
{ Do a transaction }
with Table1.Database do
begin
StartTransAction;
{ Post some records with Table1 }
Commit;
end;
DatabaseCount property
Applies to
TSession component
Declaration
property DatabaseCount: Integer;
Run-time and read only. DatabaseCount is the number of TDataBase components
currently attached to Session.
Example
{ Close all databases }
with Session do
while DatabaseCount <> 0 do
Databases[0].Close;
Example
{ Test for an error and raise an exception if so }
if { some error has occured } then DatabaseError(‘Some error has occured’);
DatabaseName property
Applies to
TDataBase, TQuery, TStoredProc, TTable components
Example
Database1.DatabaseName := ‘Delphi_Demos’;
Set the DatabaseName property to specify the database to access. This property can
specify:
• A defined BDE alias,
• A directory path for desktop database files,
• A directory path and file name for a Local InterBase Server database,
• An application-specific alias defined by a TDatabase component
Note Use the Close method to put a dataset in Inactive state before changing DatabaseName.
Example
{ Close the DBDataSet }
Table1.Active := False;
try
{ First try to use an alias }
Table1.DatabaseName := ‘Delphi_Demos’;
Table1.Active := True;
except
on EDatabaseError do
{ If that fails, try to use the drive and directory }
Table1.DatabaseName := ‘c:\delphi\demos\database’;
Table1.Active := True;
See also
Active property
Databases property
Applies to
TSession component
Declaration
property Databases[Index: Integer]: TDatabase;
Run-time and read only. The Databases property holds a list of all of the currently active
TDatabase components.
Example
{ Close all databases }
with Session do
while DatabaseCount <> 0 do
Databases[0].Close;
See also
DatabaseCount property
Example
The following code specifies that the DataField of DBEdit1 is ‘FNAME’.
DBEdit1.DataField := ‘FNAME’;
DataFormat property
Applies to
TOLEDropNotify object
Declaration
property DataFormat: Word;
The DataFormat property specifies the Clipboard format of data dropped on a form. The
form must be registered with the RegisterFormAsOLEDropTarget function for a
TOLEDropNotify object to be the Source in an OnDragDrop event handler. If DataFormat
specifies an OLE object format, the PInitInfo property points to initialization information
for the dropped OLE object. If the dropped data is not an OLE object, DataFormat
specifies some other format (such as CF_BITMAP for bitmap graphic data) and PInitInfo
won’t point to valid OLE initialization information and can’t be used to initialize a
TOLEContainer component.
Example
The following code is the OnDragDrop event handler for a form that is registered as an
OLE drop target with RegisterFormAsOLEDropTarget. If a text object is dropped, a label is
created to display the data. If a metafile object is dropped, an image is created to display
the data. Otherwise, it is assumed that an OLE object was dropped and an OLE
container is created to contain the object.
See also
DataHandle property
DataHandle property
Applies to
TOLEDropNotify object
Declaration
property DataHandle: THandle;
The DataHandle property specifies a handle to the data dropped on a form. The form
must have been registered with the RegisterFormAsOLEDropTarget function for a
TOLEDropNotify object to be the Source in an OnDragDrop event handler. If the data is
any type other than an OLE object, you can use DataHandle to access the data.
Example
The following code locks the data handle of a TOLEDropNotify object named Dropper.
Ptr := GlobalLock (Dropper.DataHandle);
See also
DataFormat property
DataSet property
Applies to
TBCDField, TBlobField, TBooleanField, TBytesField, TCurrencyField, TDataSource,
TDateField, TDateTimeField, TFloatField, TGraphicField, TIntegerField, TMemoField,
TSmallintField, TStringField, TTimeField, TVarBytesField, TWordField components
DataSet specifies the dataset component (TTable, TQuery, and TStoredProc) that is
providing data to the data source. Usually you set DataSet at design time with the Object
Inspector, but you can also set it programmatically. The advantage of this interface
approach to connecting data components is that the dataset, data source, and data-
aware controls can be connected and disconnected from each other through the
TDataSource component. In addition, these components can belong to different forms.
Example
DataSource1.DataSet := Table1; {get data from this form’s Table1}
DataSource1.DataSet := Form2.Table1; {get data from Form2’s Table1}
DatasetCount property
Applies to
TDataBase component
Declaration
property DatasetCount: Integer;
DatasetCount is the number of dataset components (TTable, TQuery, and TStoredProc)
that are currently using the TDatabase component. Read-only and run time only.
Example
{ Check to see if any record associated with this database has pending updates }
Changed := False;
with Database1 do
for I := 0 to DatasetCount - 1 do
Changed := Changed or DataSets[I].Modified;
See also
Datasets property
Example
{ Check to see if any record associated with this database has pending updates }
Changed := False;
with Database1 do
for I := 0 to DatasetCount - 1 do
Changed := Changed or DataSets[I].Modified;
See also
DatasetCount property
DataSize property
Applies to
TBCDField, TBlobField, TBooleanField, TBytesField, TCurrencyField, TDateField,
TDateTimeField, TFloatField, TGraphicField, TIntegerField, TMemoField, TSmallintField,
TStringField, TTimeField, TVarBytesField, TWordField components
Declaration
property DataSize: Word;
Run-time and read only. The value of DataSize is the number of bytes required to store
the field in memory.
For TBoolean, TSmallint, and TWordField, the value is two bytes. For TDateField,
TIntegerField, and TTimeField, the value is four bytes. For TCurrencyField, TDateTimeField,
and TFloatField, the value is eight bytes. For TBCDField, the value is eighteen bytes. For
TStringField, the value is the maximum size of the text plus one (not more than 255
characters). For TBlobField, TBytesField, TGraphicField, TMemoField, and TVarBytesField,
the value is the size of the field as stored in the record buffer.
DataSource property
Applies to
TDBCheckBox, TDBComboBox, TDBEdit, TDBGrid, TDBImage, TDBListBox,
TDBLookupCombo, TDBLookupList, TDBMemo, TDBNavigator, TQuery, TDBRadioGroup,
TDBText components
Declaration
property DataSource: TDataSource;
The DataSource property determines where the component obtains the data to display.
Specify the data source component that identifies the dataset the data is found in.
Example
The following code specifies DataSource1 to be the DataSource of DBGrid1.
DBGrid1.DataSource := DataSource1;
See also
DataField property, SQL property
For queries
Declaration
property DataSource: TDataSource;
Set the DataSource property to the name of a TDataSource component in the application
to assign values to parameters not bound to values programmatically with Params or
ParamByName. If the unbound parameter names match any column names in the
specified data source, Delphi binds the current values of those fields to the
corresponding parameters. This capability enables applications to have linked queries.
Example
The LINKQRY sample application illustrates the use of the DataSource property to link a
query in a master-detail form. The form contains a TQuery component (named Orders)
with the following in its SQL property:
SELECT Orders.CustNo, Orders.OrderNo, Orders.SaleDate
FROM Orders
WHERE Orders.CustNo = :CustNo
The form also contains:
• A TDataSource named OrdersSource, linked to Orders by its DataSet property.
• A TTable component (named Cust).
See also
SQL property
DataType property
Applies to
TFieldDef, TParam objects; TBCDField, TBlobField, TBooleanField, TBytesField,
TCurrencyField, TDateField, TDateTimeField, TFloatField, TGraphicField, TIntegerField,
TMemoField, TSmallintField, TStringField, TTimeField, TVarBytesField, TWordField
components
Example
with Query1.Parameters do
for I := 0 to Count - 1 do
if Params[I].DataType = ftUnknown then
MessageDlg(‘Parameter ‘ + IntToStr(I) + ‘ is undefined’, mtWarning, [mbOK], 0);
Example
This example uses a label and a button on a form. When the user clicks the button, the
current date is displayed in the caption of the label:
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption := 'Today is ' + DateToStr(Date);
end;
See also
DateToStr function, DayOfWeek function, DecodeDate procedure, Now function, Time
function
See also
TDateTime type
Example
This example uses a label and a button on a form. When the user clicks the button, the
current date is converted to a string and displayed as the caption of the label:
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption := DateToStr(Date);
end;
See also
Date function, DateTimeToStr function, StrToDate function, TimeToStr function
change how the string is formatted by changing some of the date and time typed
constants.
Example
This example uses a label and a button on a form. When the user clicks the button, the
current date and time is converted to a string and displayed as the caption of the label:
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption := DateTimeToStr(Now);
end;
See also
Date function, DateToStr function, Now function, StrToDate function, Time function,
TimeToStr function
Example
This example uses a button, an edit box, and a label on a form. When the user enters a
date in the edit box using the Month/Day/Year format, the caption of the label reports
the day of the week for the specified date.
procedure TForm1.Button1Click(Sender: TObject);
var
ADate: TDateTime;
begin
ADate := StrToDate(Edit1.Text);
Label1.Caption := 'Day ' + IntToStr(DayOfWeek(ADate)) + ' of the week';
end;
See also
Date function, EncodeDate function, Now function, StrToDate function, StrToDateTime
function
DBHandle property
Applies to
TTable, TQuery, TStoredProc components
DbiError procedure DB
Declaration
procedure DbiError(ErrorCode: Integer);
The DbiError procedure creates an error message by querying the Borland Database
Engine for the last error number and text and calls DatabaseError passing the result.
ErrorCode is used to obtain a text message from the engine if the error has already been
cleared.
DBLocale property
Applies to
TTable, TQuery, TStoredProc components
Declaration
property DBLocale: TLocale;
Run-time and read only. The DBLocale property allows you to make direct calls to the
Borland Database Engine using this specification of the language driver. Under most
circumstances you should not need to use this property, unless your application
requires some functionality not encapsulated in the VCL.
DDEConv property
Applies to
TDDEClientItem component
Declaration
property DdeConv: TDdeClientConv;
The DDEConv property specifies the DDE client conversation component to associate
with the DDE client item component. The value of DDEConv is the name of the DDE
client conversation component that defines the DDE conversation.
Example
The following code specifies DDEClientConv1 as the conversation of DDEClientItem1.
DDEClientItem1.DDEConv := DDEClientConv1.
See also
Name property
DDEItem property
Applies to
TDDEClientItem component
Declaration
property DDEItem: String;
The DDEItem property specifies the item of a DDE conversation. The value of DDEItem
depends on the linked DDE server application. DDEItem is typically a selectable portion
of text, such as a spreadsheet cell or a database field in an edit box. If the DDE server is a
Delphi application, DDEItem is the name of the linked DDE server component. For
example, to link to a DDE server component named DDEServer1, set DDEItem to
‘DDEServer1’.
See the documentation for the DDE server application for the specific information about
specifying DDEItem.
At design time, you can specify DDEItem either by typing the item string in the object
inspector or by pasting a link using the DDE Info dialog box, which appears if you click
the ellipsis (...) button for DDEService or DDETopic in the Object Inspector. After you
choose Paste Link in the DDE Info dialog box, you can choose the item from a list of
possible items for DDEItem in the object inspector if link information is still on the
Clipboard.
Example
The following code specifies a DDE item of ‘DDEServer1’.
DDEClientItem1.DDEItem := 'DDEServer1';
See also
DDEService property, DDETopic property
DDEService property
Applies to
TDDEClientConv component
Example
The following code specifies a DDE service of ‘Project1’.
DDEClientConv1.DDEService := 'Project1';
See also
DDEItem property, DDETopic property
DDETopic property
Applies to
TDDEClientConv component
Declaration
property DDETopic: string;
The DDETopic property specifies the topic of a DDE conversation. Typically, DDETopic
is a file name (and path, if necessary) used by the application specified in DDEService. If
the DDE server is an Delphi application, by default DDETopic is the caption of the form
containing the linked component. For example, to link to a component on a form named
Form1, set DDETopic to ‘Form1’. However, if the DDE client is linked to a
TDDEServerConv component, DDETopic is the name of the server conversation
component instead of the form caption. For example, to link to DDEServerConv1, set
DDETopic to ‘DDEServerConv1’.
See the documentation for the DDE server application for the specific information about
specifying DDETopic.
At design time, you can specify DDETopic either by typing the DDE server application
name in the object inspector or by choosing Paste Link in the DDE Info dialog box.
Example
The following code spGecifies a DDE topic of ‘Form1’.
DDEClientConv1.DDETopic := 'Form1';
See also
DDEItem property
Example
var
IntVar: Integer;
LongintVar: Longint;
begin
Intvar := 10;
LongintVar := 10;
Dec(IntVar); { IntVar := IntVar – 1 }
Dec(LongintVar, 5); { LongintVar := LongintVar – 5 }
end;
See also
Inc procedure, Pred function, Succ function
Example
This example uses a button and two labels on a form. When the user clicks the button,
the current date and time are reported in the captions of the two labels.
procedure TForm1.Button1Click(Sender: TObject);
See also
DecodeTime procedure
Example
This example uses a button and two labels on a form. When the user clicks the button,
the current date and time are reported in the captions of the two labels.
procedure TForm1.Button1Click(Sender: TObject);
var
Present: TDateTime;
Year, Month, Day, Hour, Min, Sec, MSec: Word;
begin
Present:= Now;
DecodeDate(Present, Year, Month, Day);
Label1.Caption := 'Today is Day ' + IntToStr(Day) + ' of Month '
+ IntToStr(Month) + ' of Year ' + IntToStr(Year);
DecodeTime(Present, Hour, Min, Sec, MSec);
Label2.Caption := 'The time is Minute ' + IntToStr(Min) + ' of Hour '
+ IntToStr(Hour);
end;
See also
DecodeDate procedure, EncodeTime function, Time function
Default property
Applies to
TBitBtn, TButton components
Declaration
property Default: Boolean;
The Default property indicates whether a push or bitmap button is the default button. If
Default is True, any time the user presses Enter, the OnClick event handler for that button
runs. The only exception to this is if the user selects another button before pressing Enter,
in which case the OnClick event handler for that button runs. Although your application
can have more than one button designated as a default button, the form calls the OnClick
event handler for the first button in the tab order.
Whenever any button has focus, it becomes the default button temporarily. When the
focus moves to a control that isn’t a button, the button with its Default property set to
True becomes the default button once again.
Example
This example makes the button named OK the default button:
procedure TForm1.FormCreate(Sender: TObject);
begin
OK.Default := True;
end;
See also
Cancel property
DefaultColWidth property
Applies to
TDrawGrid, TStringGrid components
Declaration
property DefaultColWidth: Integer;
The DefaultColWidth property determines the width of all the columns within the grid.
If you want to change the width of a single column within a grid without changing
other columns, use the ColWidths property during run time. If you change the
DefaultColWidth property value after changing the width of specified columns, all the
columns become the height specified in the DefaultColWidth property once again.
The default value is 64 pixels.
DefaultDrawing property
Applies to
TDBGrid, TDrawGrid, TStringGrid components
Declaration
property DefaultDrawing: Boolean;
The DefaultDrawing property determines if the cell is painted and the item it contains is
drawn automatically. If True, the default drawing occurs. If False, your application must
handle all the drawing details in the OnDrawCell event handler, or in the
OnDrawDataCell event handler for the data grid.
When DefaultDrawing is True, the Paint method initializes the Canvas’ font and brush to
the control font and the cell color. The cell is prepainted in the cell color and a focused
TRect object is drawn in the cell. The state of the cell is returned. The possible states are a
fixed cell, a focused cell, or a cell within the area the user has selected.
Example
The following code sets DefaultDrawing to False for DrawGrid1.
DrawGrid1.DefaultDrawing := False;
See also
OnDrawCell event, OnDrawDataCell event
DefaultExt property
Applies to
TOpenDialog, TSaveDialog components
Declaration
property DefaultExt: TFileExt;
The DefaultExt property specifies the extension that is added to the file name the user
types in the File Name edit box if the user doesn’t include a file-name extension in the
file name. If the user specifies an extension for the file name, the value of the DefaultExt
property is ignored. If the DefaultExt value remains blank, no extension is added to the
file name entered in the File Name edit box.
Legal property values include strings up to 3 characters in length. Don’t include the
period (.) that divides the file name and its extension.
Example
This example sets the default file extension to TXT, displays the Open dialog box, then
assigns the file name the user selects with the dialog box to a variable the application can
use to open a file:
procedure TForm1.Button1Click(Sender: TObject);
var
NameOfFile : TFileName;
begin
OpenDialog1.DefaultExt := ’TXT’;
if OpenDialog1.Execute then
NameOfFile := OpenDialog1.FileName;
end;
When this code runs, if the user types a file name in the File Name edit box in the Open
dialog box, but doesn’t specify an extension, the TXT extension is added to the file name,
and the entire file name is saved in the NameOfFile variable. For example, if the user
types MYNOTES as the file name, the string saved in the NameOfFile variable is
MYNOTES.TXT.
See also
FileName property, TOpenDialog component, TSaveDialog component
DefaultRowHeight property
Applies to
TDrawGrid, TStringGrid components
Declaration
property DefaultRowHeight: Integer;
The DefaultRowHeight property determines the height of all the rows within the grid.
The default value is 24 pixels.
If you want to change the height of a single row within a grid without changing other
rows, use the RowHeights property during run time. If you change the DefaultRowHeight
property value after changing the height of specified rows, all the rows become the
height specified in the DefaultRowHeight property once again.
Example
The following line of code changes the default height of the rows in a string grid control
to 10 pixels more than the original value:
Example
FileMenu in the following code is a menu that contains four menu items (menu
commands). They are New, Open, Save, and Save As, in that order. This event handler
deletes the Save command from the menu:
procedure TForm1.Button1Click(Sender: TObject);
begin
FileMenu.Delete(2);
end;
This example uses a list box and a button on a form. When the form appears, five items
are in the list box. When the user clicks the button, the second item in the list box is
deleted:
procedure TForm1.FormCreate(Sender: TObject);
var
I: Integer;
begin
for I := 1 to 5 do
ListBox1.Items.Add('Item ' + IntToStr(I));
end;
See also
Add method, Clear method, Insert method, Remove method
For outlines
Declaration
procedure Delete(Index: LongInt);
The Delete method removes the outline item with an Index property value equal to the
Index parameter from the list outline. If that item is has subitems, the subitems are also
deleted.
Outline items that appear after the deleted item are moved up and reindexed with valid
Index values. This is done automatically unless BeginUpdate has been called.
Example
The following code deletes the selected item from Outline1.
Outline1.Delete(Outline1.SelectedItem);
See also
Add method, AddChild method, Insert method
Example
var
s: string;
begin
s := 'Honest Abe Lincoln';
Delete(s,8,4);
Canvas.TextOut(10, 10, s); { 'Honest Lincoln' }
end;
See also
Concat function, Copy function, Insert procedure, Length function, Pos function
Example
The following code erases the file DELETE.ME in the current directory:
DeleteFile('DELETE.ME');
DeleteIndex method
Applies to
TTable component
Declaration
procedure DeleteIndex(const Name: string);
The DeleteIndex method deletes a secondary index for a TTable. Name is the name of the
index. You must have opened the table with exclusive access (Exclusive = True).
Example
Table1.DeleteIndex(‘NewIndex’);
See also
AddIndex method
DeleteTable method
Applies to
TTable component
Declaration
procedure DeleteTable;
The DeleteTable method deletes an existing database table. Before calling this method,
the DatabaseName, TableName and TableType properties must be assigned values. The
table must be closed.
Example
with Table1 do
begin
Active := False;
DatabaseName := ‘DBDEMOS’;
TableName := ‘Customer’;
TableType := ttParadox;
DeleteTable;
end;
DescriptionsAvailable method
Applies to
TStoredProc component
Declaration
function DescriptionsAvailable: Boolean;
The DescriptionsAvailable method indicates whether stored procedure parameter
information is available from the server. If the information is available, it returns True.
See also
Overload property, StoredProcName property
Destination property
Applies to
TBatchMove component
Declaration
property Destination: TTable;
Destination specifies a TTable component corresponding to the database table that will be
the destination of the batch move operation. The destination table may or may not
already exist.
Example
BatchMove1.Destination := Table1;
Destroy method
Applies to
All objects and components
Declaration
destructor Destroy;
The Destroy method destroys the object, component, or control and releases the memory
allocated to it.
You seldom need to call Destroy. Objects designed with Delphi create and destroy
themselves as needed, so you don’t have to worry about it. If you construct an object by
calling the Create method, you should call Free to release memory and dispose of the
object.
See also
Free method, Release method
Device property
Applies to
TFontDialog component
Declaration
property Device: TFontDialogDevice;
The Device property determines which device the returned font affects. These are the
possible values:
Value Meaning
fdScreen Affects the screen
fdPrinter Affects the printer
fdBoth Affects both the screen and the printer
Example
This example lets the user select a font to use for printing a file:
procedure TForm1.Button1Click(Sender: TObject);
var
FontName: TFont;
begin
FontDialog1.Device := fdPrinter;
FontDialog1.Execute;
FontName := FontDialog1.Font;
end;
See also
TFont object
DeviceID property
Applies to
TMediaPlayer component
Declaration
property DeviceID: Word;
Run-time and read only. The DeviceID property specifies the device ID for the currently
open multimedia device.
The value of DeviceID is determined when an device is opened with the Open method. If
+
no device is open, DeviceID is 0. +
Example
The following code opens MediaPlayer1 and displays the DeviceID in Edit1. If an
+
exception occurs, a message window displays the error number and string. D
procedure TForm1.BitBtn1Click(Sender: TObject);
var
MyErrorString: string;
begin
try
MediaPlayer1.Open;
Edit1.Text := IntToStr(MediaPlayer1.DeviceID);
except
MyErrorString := 'ErrorCode: ' + IntToStr(Error) + #13#10;
MessageDlg(MyErrorString + MediaPlayer1.ErrorMessage, mtError, [mbOk], 0);
end;
end;
DeviceType property
Applies to
TMediaPlayer component
Declaration
property DeviceType: TMPDeviceTypes;
The DeviceType property specifies a multimedia device type to open with the Open
method. The default is dtAutoSelect. The valid values for DeviceType are dtAutoSelect,
dtAVIVideo, dtCDAudio, dtDAT, dtDigitalVideo, dtMMMovie, dtOther, dtOverlay,
dtScanner, dtSequencer, dtVCR, dtVideodisc, or dtWaveAudio.
If DeviceType is dtAutoSelect, the device type is determined by the file extension specified
in the FileName property. If no device type is associated with the extension, you must
explicitly specify the correct device type by setting DeviceType to a value other than
dtAutoSelect.
A multimedia device is typically associated with an appropriate file-name extension
when you install the device. Associations are specified in the [mci extensions] section of
the Windows WIN.INI file. See the documentation for your specific device for
instructions about how to associate file-name extensions with the device.
Example
The following code checks to make sure that a filename is specified for MediaPlayer1 if
the DeviceType is set to dtAutoSelect before opening the device.
procedure TForm1.FormCreate(Sender: TObject);
begin
with MediaPlayer1 do
if (DeviceType = dtAutoSelect) and (FileName = '') then
MessageDlg('You must specify a filename for the MediaPlayer', mtError, [mbOk], 0)
else
Open;
end;
Directory property
Applies to
TDirectoryListBox, TFileListBox components
Declaration
property Directory: string;
The value of the Directory property determines the current directory for the file list box
and directory list box components. The file list box displays the files in the directory
specified in the Directory property. The directory list box displays the value of the
Directory property as the current directory in the list box.
Examine the example to see how a directory list box and a file list box can work together
through their Directory properties.
Example
If you have a file list box and a directory list box on a form, this code changes the current
directory in the directory list box and displays the files in that directory in the file list
box when the user changes directories using the directory list box:
procedure TForm1.DirectoryListBox1Change(Sender: TObject);
begin
FileListBox1.Directory := DirectoryListBox1.Directory;
end;
See also
DirLabel property, Drive property, FileList property
If only a directory name is entered as the value of Name, DirectoryExists searches for the
+
directory within the current directory. If a full path name is entered, DirectoryExists
searches for the directory along the designated path.
+
Example
+
This example uses an edit box, a label, and a button on a form. When the user enters a
directory name in the edit box and clicks the button, whether or not the directory exists
D
is reported in the caption of the label:
procedure TForm1.Button1Click(Sender: TObject);
begin
if DirectoryExists(Edit1.Text) then
Label1.Caption := Edit1.Text + ' exists'
else
Label1.Caption := Edit1.Text + ' does not exist';
end;
See also
ForceDirectories procedure, SelectDirectory function
DirLabel property
Applies to
TDirectoryListBox component
Declaration
property DirLabel: TLabel;
The DirLabel property provides a simple way to display the current directory as the
caption of a label control. When the current directory changes in the directory list box,
the change is reflected in the caption of the label.
Specify the label you want updated with the current directory as the value of the
DirLabel property.
Example
This example uses a button, an edit box, a label, a drive combo box, a directory list box, a
file list box, and a filter combo box on a form. When the user clicks the button, the rest of
the controls of the form begin working together like the controls in an Open or Save
dialog box.
procedure TForm1.Button1Click(Sender: TObject);
begin
DriveComboBox1.DirList := DirectoryListBox1;
DirectoryListBox1.FileList := FileListBox1;
DirectoryListBox1.DirLabel := Label1;
FileListBox1.FileEdit := Edit1;
FilterComboBox1.FileList := FileListBox1;
end;
See also
Caption property, Directory property, DirList property, FileEdit property, FileList
property
DirList property
Applies to
TDriveComboBox component
Declaration
property DirList: TDirectoryListBox;
The DirList property provides a simple way to connect a drive combo box with a
directory list box. When a new drive is selected in the drive combo box, the specified
directory list box updates to display the directory structure and the current directory on
the new drive.
Specify the directory list box you want updated as the value of DirList.
Example
This example uses a button, an edit box, a label, a drive combo box, a directory list box, a
file list box, and a filter combo box on a form. When the user clicks the button, the rest of
the controls of the form begin working together as the controls in an open or save dialog
box do.
procedure TForm1.Button1Click(Sender: TObject);
begin
DriveComboBox1.DirList := DirectoryListBox1;
DirectoryListBox1.FileList := FileListBox1;
DirectoryListBox1.DirLabel := Label1;
FileListBox1.FileEdit := Edit1;
FilterComboBox1.FileList := FileListBox1;
end;
See also
Directory property, DirLabel property, Drive property, FileEdit property, FileList property
DisableControls method
Applies to
TTable, TQuery, TStoredProc components
Declaration
procedure DisableControls;
The DisableControls method temporarily disconnects the dataset from all TDataSource
+
components. While the data sources are disconnected, associated data-aware controls
will not reflect changes to datasets. When iterating over a dataset with Next or Prior
+
methods, calling DisableControls first will speed the process, eliminating the need to
update the screen each time.
+
Use EnableControls to restore the connection. The dataset maintains a count of the
number of calls to DisableControls and EnableControls, so only the last call to
D
EnableControls will actually update the data sources.
Example
with Table1 do
begin
DisableControls;
{ Move forward five records }
try
for I := 1 to 5 do Next;
finally
{ Update the controls to the current record }
EnableControls;
end;
Example
var
S: string;
begin
S := IntToStr(DiskFree(0) div 1024) + ' Kbytes free.';
Canvas.TextOut(10, 10, S);
end;
See also
DiskSize function
Example
var
S: string;
begin
S := IntToStr(DiskSize(0) div 1024) + ' Kbytes capacity.';
Canvas.TextOut(10, 10, S);
end;
See also
DiskFree function
Display property
Applies to
TMediaPlayer component
Declaration
property Display: TWinControl;
The Display property specifies the display window for an multimedia device that uses a
window for output. Assign the name of a windowed control such as a form or panel to
Display to display output in that control.
The default value of Display is nil. If the value of Display is nil, the device creates its own
window to display output. Also, if you Free the control assigned to Display after the
device has been opened, video output will be in its own default window.
Examples of multimedia devices that use a window to display output are Animation,
AVI Video, Digital Video, Overlay, and VCR.
Example
The following example displays the .AVI video file 'FOOTBALL.AVI' in the client area
of Form2.
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
with MediaPlayer1 do begin
try
FileName := 'football.avi';
See also
Capabilities property, DeviceType property, DisplayRect property, Open method
DisplayFormat property
Applies to
TDateField, TDateTimeField, TIntegerField, TSmallintField, TTimeField, TWordField
components
Declaration
property DisplayFormat: string
The DisplayFormat property is used to format the value of the field for display purposes.
For TIntegerField, TSmallintField, and TWordField, formatting is performed by
FloatToTextFmt. If DisplayFormat is not assigned a string, the value is formatted by Str.
For TDateField, TDateTimeField, and TTimeField, formatting is performed by
DateTimeToStr. If DisplayFormat is not assigned a string, the value is formatted according
to the default Windows specifications in the [International] section of the WIN.INI file.
For TBCDField, TCurrencyField, and TFloatField, formatting is performed by
FloatToTextFmt. If DisplayFormat is not assigned a string, the value is formatted
according to the value of the Currency property.
See also
FmtStr procedure, Format function, FormatBuf function, FormatDateTime function,
FormatFloat function, StrFmt function, StrLFmt function
DisplayLabel property
Applies to
TBCDField, TBlobField, TBooleanField, TBytesField, TCurrencyField, TDateField,
TDateTimeField, TFloatField, TGraphicField, TIntegerField, TMemoField, TSmallintField,
TStringField, TTimeField, TVarBytesField, TWordField components
Declaration
property DisplayLabel: string;
DisplayLabel contains the column heading for a field displayed by a TDBGrid
component. If DisplayLabel is null, the FieldName property is used to supply the column
heading.
DisplayName property
Applies to
TBCDField, TBlobField, TBooleanField, TBytesField, TCurrencyField, TDateField,
TDateTimeField, TFloatField, TGraphicField, TIntegerField, TMemoField, TSmallintField,
TStringField, TTimeField, TVarBytesField, TWordField components
Declaration
property DisplayName: Pstring;
Run-time and read only. DisplayName returns the name of the field for display purposes.
Use DisplayName in your code to use the same algorithm that other Delphi components
use when they need the DisplayLabel or FieldName of a field.
DisplayRect property
Applies to
TMediaPlayer component
Declaration
property DisplayRect: TRect;
Run-time only. The DisplayRect property specifies the rectangle area within the form
specified in the Display property used to display output from a multimedia device.
DisplayRect is ignored if Display is nil.
Assign a TRect record to DisplayRect to display output in a specific rectangle area on a
form. The Rect function can be used to create a TRect record.
Examples of multimedia devices that use a window to display output are Animation,
AVI Video, Digital Video, Overlay, and VCR.
Media that use a rectangle to display output usually perform best if the default
DisplayRect size is used. To set DisplayRect to the default size, use 0, 0 for the lower right
corner. Position the rectangle with the upper left corner.
Note You must set DisplayRect after the media device is opened.
DisplayText property
Applies to
TBCDField, TBlobField, TBooleanField, TBytesField, TCurrencyField, TDateField,
TDateTimeField, TFloatField, TGraphicField, TIntegerField, TMemoField, TSmallintField,
TStringField, TTimeField, TVarBytesField, TWordField components
Declaration
property DisplayText: string;
Run-time and read only. The string value for the field when it is displayed in a data-
aware control that is not in Edit mode. Data-aware controls such as TDBEdit rely on
DisplayText to provide the formatting for each field.
The default string depends on a field’s data type. You can control the strings returned
by DisplayText by specifying a DisplayFormat string or by providing an OnGetText event
handler.
For a TStringField, the contents of the field is formatted using the EditMask property.
For a TIntegerField, TSmallintField, or TWordField, if DisplayFormat has been assigned a
value, FloatToTextFmt is called with it; otherwise Str is called.
For a TFloatField or TBCDField, FloatToTextFmt is called with the DisplayFormat property.
For a TCurrencyField, if DisplayFormat has been assigned a value, FloatToTextFmt is called
with it; otherwise, FloatToTextFmt is called with the ffCurrency flag and CurrencyDecimals
variable.
For a TDateTimeField, DateTimeToStr is called with the DisplayFormat property. For a
TDateField, DateTimeToStr is called with the DisplayFormat property, except that the
ShortDateFormat variable will be substituted if DisplayFormat is unassigned. For a
TTimeField, DateTimeToStr is called with the DisplayFormat property, except that the
LongTimeFormat variable will be substituted if DisplayFormat is unassigned.
Example
{ Display a message that the current value is invalid }
MessageDlg(Field1.DisplayText + ‘ is invalid’, mtWarning, [mbOK], 0);
DisplayValue property
Applies to
TDBLookupCombo, TDBLookupList components
Declaration
property DisplayValue : string;
Run-time only. The DisplayValue is the string that appears in the database lookup combo
box or database lookup list box. Its value is contained in the field specified as the
LookupDisplay field. The current value of the Value property, which determines the
current record in the lookup table, also determines which string is the DisplayValue
string.
Example
The following code makes the caption of a button equal to the DisplayValue of
DBLookupCombo1.
Button1.Caption := DBLookupCombo1.DisplayValue;
See also
LookupField property
DisplayValues property
Applies to
TBooleanField component
Declaration
property DisplayValues: string;
DisplayValues controls the manner in which the TBooleanField is translated to and from
display format. Set DisplayValues to ‘T;F’ to use ‘T’ and ‘F’ for values of True and False.
You can use any pair of phrases you want, separated by a semicolon. If one phrase is
omitted, no text is displayed and a data-aware control with no text assigns the
corresponding value to the field. The default value is ‘True;False’.
Example
Field1.DisplayValues := 'Yes;No';
Field2.DisplayValues := 'Oui;Non';
See also
DisplayLabel property, DisplayText property
Example
type
Str18 = string[18];
var
P: ^Str18;
begin
New(P);
P^ := 'Now you see it...';
Dispose(P); { Now you don't... }
end;
See also
FreeMem procedure, GetMem procedure, New procedure
Example
The following code allocates and frees heap space for a copy of string S pointed to by P,
then deallocates the heap space pointed to by P:
var
P: PString;
S: string;
begin
S := 'Ask me about Blaise';
P := NewStr(S);
DisposeStr(P):
end;
See also
NewStr function
DitherBackground property
Applies to
TTabSet component
Declaration
property DitherBackground: Boolean;
The DitherBackground property determines whether the selected background color set
with the BackgroundColor property is dithered. Dithering means the background is
lightened by 50%, which is intended to make the tabs easier to see. If DitherBackground is
True, the tab set control background is dithered. If it is False, there is no dithering.
The default value is True.
Example
This event handler toggles the dithering of the tab set control’s background each time
the user clicks the form:
procedure TForm1.FormClick(Sender: TObject);
begin
if TabSet1.DitherBackground = True then
TabSet1.DitherBackground := False
Down property
Applies to
TSpeedButton component
Declaration
property Down: Boolean;
The Down property of a speed button determines if the button appears in an up
(unselected) or down (selected) state. Speed buttons are initially in their up (unselected)
state. This occurs because the default setting of the Down property is False.
To initially display a speed button in its down state, set the Down property to True. For
example, if you use a panel component with several speed buttons to create a tools
palette, you might want one of the speed buttons selected when the palette first appears.
Although you can use a group of speed buttons with the AllowAllUp property set to
False to make the tool palette buttons work as a group, you must set the Down property
for the button you want to be selected initially. You can also use the Down property at
run time any time you want to put a button in a down state without the user clicking it
first.
Example
This code displays the speed button in a down state:
SpeedButton1.Down := True;
See also
AllowAllUp property, GroupIndex property
DragCursor property
Applies to
TBitBtn, TButton, TCheckBox, TComboBox, TDBCheckBox, TDBEdit, TDBGrid, TDBImage,
TDBListBox, TDBLookupCombo, TDBLookupList, TDBMemo, TDBNavigator,
TDBRadioGroup, TDBText, TDirectoryListBox, TDriveComboBox, TEdit, TFileListBox,
TFilterComboBox, TGroupBox, TImage, TLabel, TListBox, TMaskEdit, TMemo, TOutline,
TPaintBox, TPanel, TRadioButton, TScrollBar, TScrollBox, TShape, TNotebook controls
Declaration
property DragCursor: TCursor;
The DragCursor property determines the shape of the mouse pointer when the pointer is
over a component that will accept an object being dragged. These are the possible
images:
Example
The following code changes the DragCursor of Memo1 to crIBeam.
Memo1.DragCursor := crIBeam;
See also
BeginDrag method, Cursor property, Cursors property, Dragging method, EndDrag
method, OnDragDrop event, OnDragOver event, OnEndDrag event
Dragging method
Applies to
All controls
See also
BeginDrag method, DragMode property, EndDrag method, OnDragDrop event,
OnDragOver event, TDragState type
DragMode property
Applies to
TBitBtn, TButton, TCheckBox, TComboBox, TDBCheckBox, TDBComboBox, TDBEdit,
TDBGrid, TDBImage, TDBText, TDBListBox, TDBLookupCombo, TDBLookupList,
TDBMemo, TDBNavigator, TDBRadioGroup, TDirectoryListBox, TDrawGrid,
TDriveComboBox, TEdit, TFileListBox, TFilterComboBox, TGroupBox, TImage, TLabel,
TListBox, TMaskEdit, TMemo, TOLEContainer, TOutline, TPaintBox, TRadioButton,
TScrollBar, TScrollBox, TShape, TStringGrid, TNotebook controls
Declaration
property DragMode: TDragMode;
The DragMode property determines the drag and drop behavior of a control. These are
the possible values:
Value Meaning
dmAutomatic If dmAutomatic is selected, the control is ready to be dragged; the user just
clicks and drags it.
dmManual If dmManual is selected, the control can’t be dragged until the application calls
the BeginDrag method.
If a control’s DragMode property value is dmAutomatic, the application can disable the
drag and drop capability at run time by changing the DragMode property value to
dmManual.
Example
This example determines whether the drag mode of the button on the form is manual. If
it is, the dragging the button becomes possible.
procedure TForm1.Button1Click(Sender: TObject);
begin
if Button1.DragMode = dmManual then
Button1.BeginDrag(True);
end;
See also
BeginDrag method, EndDrag method
Draw method
Applies to
TCanvas object
Declaration
procedure Draw(X, Y: Integer; Graphic: TGraphic);
The Draw method draws the graphic specified by the Graphic parameter on the canvas at
the location given in the screen pixel coordinates (X, Y). Graphics can be bitmaps, icons,
or metafiles.
Example
The following code draws the graphic in C:\WINDOWS\TARTAN.BMP centered in
Form1 when the user clicks Button1. Attach this code to the OnClick event handler of
Button1.
procedure TForm1.Button1Click(Sender: TObject);
var
Bitmap1: TBitmap;
begin
Bitmap1 := TBitmap.Create;
Declaration
procedure DrawFocusRect(const Rect: TRect);
The DrawFocusRect method draws a rectangle in the style used to indicate that the
rectangle has the focus. Because this is an XOR function, calling it a second time and
specifying the same rectangle removes the rectangle from the screen.
The rectangle this function draws cannot be scrolled. To scroll an area containing a
rectangle drawn by this function, call DrawFocusRect to remove the rectangle from the
screen, scroll the area, and then call DrawFocusRect to draw the rectangle in the new
position.
Example
This examples uses a radio button and a button on a form. When the user clicks the
button, the code draws a rectangle around the radio button.
procedure TForm1.Button1Click(Sender: TObject);
var
NewRect: TRect;
begin
NewRect := RadioButton1.BoundsRect;
with NewRect do
begin
Left := Left - 10;
Top := Top - 10;
Right := Right + 10;
Bottom := Bottom + 10;
end;
Form1.Canvas.DrawFocusRect(NewRect);
end;
See also
Arc method, Chord method, Ellipse method, FrameRect method, Pie method, Rectangle
method
Drive property
Applies to
TDirectoryListBox, TDriveComboBox, TFileListBox components
Declaration
property Drive: Char;
Run-time only. For the drive combo box, the Drive property determines which drive is
displayed in the edit control of the combo box. When the user uses the drive combo box
to select a new drive, the selected drive becomes the value of the Drive property. The
value of the Text property also changes to the new volume name when the Drive
property value changes.
For the directory list box, the Drive property determines which drive the list box
displays the directory structure on. When the value of Drive changes, the Directory value
changes also to the current directory on the specified drive.
For the file list box, the Drive property determines which drive the list box displayed the
files on. When the value of Drive changes, the Directory value also changes to the current
directory on the specified drive.
Example
The following example assumes that a drive combo box, a file list box, and a directory
list box are on a form. This code changes the drive displayed in the drive combo box,
displays the current directory of the selected drive in the directory list box, and displays
the files in the current directory of the selected drive in the file list box when the user
selects a drive in the drive combo box:
procedure TForm1.DriveComboBox1Change(Sender: TObject);
begin
DirectoryListBox1.Drive := DriveComboBox1.Drive;
FileListBox1.Directory := DirectoryListBox1.Directory;
end;
See also
Directory property, DirList property, Text property
DriverName property
Applies to
TDataBase component
Declaration
property DriverName: TSymbolStr;
DriverName is the name of a BDE driver, such as STANDARD (for dBASE and Paradox),
+
ORACLE, SYBASE, INFORMIX or INTERBASE. This property will be cleared if
AliasName is set, because an AliasName specifies a driver type. Conversely, setting this
+
property will clear AliasName. +
If you try to set DriverName of a TDatabase for which Connected is True, Delphi will raise
an exception. D
Example
Database1.DriverName := ‘STANDARD’;
DropConnections method
Applies to
TSession component
Declaration
procedure DropConnections;
The DropConnections method drops all inactive database connections. By default,
temporary database components keep their connections to the server open even when
not in use so that they do not have to log in to the server each time a dataset component
is opened.
Example
Session.DropConnections;
See also
Session variable, Temporary property
DropDown method
Applies to
TDBLookupCombo component
Declaration
procedure DropDown;
The DropDown method opens or “drops down” the database lookup combo box so that
the user has a list of values to choose from.
See also
CloseUp method
DropDownCount property
Applies to
TComboBox, TDBComboBox, TDBLookupCombo components
Declaration
property DropDownCount: Integer;
The DropDownCount property determines how long the drop-down list of a combo box
is. By default, the drop-down list is long enough to contain eight items without
requiring the user to scroll to see them all. If you would like the drop-down list to be
smaller or larger, specify a number larger or smaller than eight as the DropDownCount
value.
If the DropDownCount value is larger than the number of items in the drop-down list, the
drop-down list is just large enough to hold all the items and no larger. For example, if
the list contains three items, the drop-down list is only long enough to display the three
items, even if the DropDownCount is eight.
Example
The following code assigns three to the DropDownCount property of ComboBox1. To see
more than three items in the drop-down list, the user must scroll.
ComboBox1.DropDownCount := 3;
See also
DropDownWidth property
DropDownWidth property
Applies to
TDBLookupCombo component
Declaration
property DropDownWidth: Integer;
The DropDownWidth property determines how wide the drop-down list of the combo
box is in pixels. The default value is 0, which means the drop-down list is the same
width as the combo box.
The DropDownWidth property is useful when you are displaying multiple fields, and
therefore, multiple columns in the database lookup combo box.
Example
This code displays three fields in the drop-down list of the database lookup combo box.
Each column has a title and is separated from the other columns by a line. The combo
box displays ten items at a time; therefore, the user must scroll to view the rest of the
+
items. The drop-down list is 600 pixels wide so all the fields fit in the drop-down list. +
procedure TForm1.FormCreate(Sender: TObject);
begin
DBLookupCombo1.LookupDisplay := 'Company;City;Country';
+
DBLookupCombo1.Options := [loColLines,loTitles];
DBLookupCombo1.DropDownCount := 10;
D
DBLookupCombo1.DropDownWidth := 600;
end;
See also
DropDownCount property, LookupDisplay property, Options property
DroppedDown property
Applies to
TComboBox, TDBComboBox components
Declaration
property DroppedDown: Boolean;
Run-time only. The DroppedDown property determines whether the drop-down list of
the combo box is open or closed. If DroppedDown is True, the drop-down list is visible. If
DroppedDown is False, the drop-down list is closed. The default value is False.
See also
DropDownCount property
dsEditModes const
Declaration
dsEditModes = [dsEdit, dsInsert, dsSetKey];
dsEditModes is the subset of TDataSetState elements which the State property of a dataset
component will have if the current record of the dataset is being modified. It is also uses
by the UpdateRecord of a dataset component.
Example
function MakeHexWord(w: Word): string;
const
hexChars: array [0..$F] of Char = '0123456789ABCDEF';
var
HexStr : string;
begin
HexStr := '';
HexStr := HexStr + hexChars[Hi(w) shr 4];
HexStr := HexStr + hexChars[Hi(w) and $F];
HexStr := HexStr + hexChars[Lo(w) shr 4];
HexStr := HexStr + hexChars[Lo(w) and $F];
MakeHexWord := HexStr;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
i: Integer;
Y: Integer;
S: string;
begin
Y := 10;
S := 'The current code segment is $' + MakeHexWord(CSeg);
Canvas.TextOut(5, Y, S);
Y := Y + Canvas.TextHeight(S) + 5;
S := 'The global data segment is $' + MakeHexWord(DSeg);
Canvas.TextOut(5, Y, S);
Y := Y + Canvas.TextHeight(S) + 5;
S := 'The stack segment is $' + MakeHexWord(SSeg);
Canvas.TextOut(5, Y, S);
Y := Y + Canvas.TextHeight(S) + 5;
S := 'The stack pointer is at $' + MakeHexWord(SPtr);
Canvas.TextOut(5, Y, S);
Y := Y + Canvas.TextHeight(S) + 5;
S := 'i is at offset $' + MakeHexWord(Ofs(i));
Canvas.TextOut(5, Y, S);
Y := Y + Canvas.TextHeight(S) + 5;
S := 'in segment $' + MakeHexWord(Seg(i));
Canvas.TextOut(5, Y, S);
end;
See also
CSeg function, SSeg function
Value Meaning
dupIgnore Attempts to add a duplicate string to a sorted string list are ignored
dupAccept Duplicate strings can be added to a sorted string list
dupError Adding a duplicate string results in an EListError exception
Example
The following code makes StringList1 ignore duplicate entries.
StringList1.Duplicates := dupIgnore;
See also
Sort method, Sorted property
EDBEngineError object DB
EDBEngineError = class(EDatabaseError)
private
FErrors: TList;
function GetError(Index: Integer): TDBError;
function GetErrorCount: Integer;
public
constructor Create(ErrorCode: DBIResult);
destructor Destroy;
property ErrorCount: Integer;
property Errors[Index: Integer]: TDBError;
end;
Description
The EDBEngineError exception is raised whenever a BDE error occurs. The exception
contains two public properties of significance:
The objects contained in the Errors property are of type TDBError, which is declared like
this:
TDBError = class
private
FErrorCode: DBIResult;
FNativeError: Longint;
FMessage: TMessageStr;
function GetCategory: Byte;
function GetSubCode: Byte;
public
constructor Create(Owner: EDBEngineError; ErrorCode: DBIResult;
NativeError: Longint; Message: PChar);
property Category: Byte;
property ErrorCode: DBIResult;
property SubCode: Byte;
property Message: TMessageStr;
property NativeError: Longint;
end;
These are the public properties of the TDBError object:
Example
Table1.Edit;
See also
AutoEdit property
See also
DataSet property, Insert method
EditFormat property
Applies to
TIntegerField, TSmallintField, TWordField components
Declaration
property EditFormat: string;
EditFormat is used to format the value of the field for editing purposes.
For TIntegerField, TSmallintField, and TWordField, formatting is performed by
FloatToTextFmt. If EditFormat is not assigned a string, but DisplayFormat does have a
value, the DisplayFormat string is used. Otherwise, the value is formatted by to the
shortest possible string.
For TBCDField, TCurrencyField, and TFloatField, formatting is performed by
FloatToTextFmt. If EditFormat is not assigned a string but DisplayFormat does have a
value, the DisplayFormat string will be used. Otherwise, the value is formatted according
to the value of the Currency property.
EditKey method
Applies to
TTable component
Declaration
procedure EditKey;
Use the EditKey method to modify the contents of the search key buffer. This method is
useful only when searching on multiple fields after calling SetKey. Call GotoKey to move
the cursor to the record with the corresponding key.
EditKey differs from SetKey in that the latter clears all the elements of the search key
buffer to the default values (or NULL). EditKey leaves the elements of the search key
buffer with their current values.
Example
with Table1 do
begin
EditKey;
FieldByName(‘State’).AsString := ‘CA‘;
FieldByName(‘City’).AsString := ‘Santa Barbara‘;
GotoKey;
end;
See also
IndexFields property
These characters (already mentioned in previous table) are typed constants declared in
the Mask unit whose value you can change at run time, although the need for this should
be limited:
Example
This example assigns an edit mask to the masked edit box on the form. The edit mask
makes it easy to enter American telephone numbers in the edit box.
procedure TForm1.FormCreate(Sender: TObject);
begin
MaskEdit1.EditMask := '!\(999\)000-0000;1;
MaskEdit1.Text := '';
MaskEdit1.AutoSelect := False;
end;
See also
OnGetEditMask event, EditText property, Text property
Example
Field1.EditMask := Field2.EditMaskPtr^;
EditorMode property
Applies to
TDBGrid, TDrawGrid, TStringGrid components
Declaration
property EditorMode: Boolean;
Run-time only. The EditorMode property determines whether the grid is in automatic
Edit mode. When the grid is in automatic edit mode, the user can type in a cell without
having to press Enter or F2 first. If the Options property set includes the value
goAlwaysShowEditor (goAlwaysShowEditor is True), the grid is in automatic edit mode,
just as if EditorMode is True. While you are most likely to set the Options property values
at design time, the EditorMode property makes it easy to control when editing is
permitted at run time.
If EditorMode is True, the grid is in automatic edit mode as long as the Options property
set includes the value goEditing (or dgEditing for the data grid). If goEditing or dgEditing is
not in the Options set (goEditing or dgEditing is False), setting EditorMode to True has no
effect, and the user cannot edit the contents of a cell.
If EditorMode is False and the Options property set includes the value goEditing or
dgEditing, but not the value goAlwaysShowEditor (or dgAlwaysShowEditor for the data
grid), the user can enter edit mode by pressing either Enter or F2 before editing the
contents of each cell.
Example
The following code sets EditorMode to True for StringGrid1.
StringGrid1.EditorMode := True;
See also
Options property
EditRangeEnd method
Applies to
TTable component
Declaration
procedure EditRangeEnd;
EditRangeEnd enables you to modify the beginning range of the dataset filter established
with SetRangeEnd. Subsequent assignments to field values will modify the values of the
ending field range previously set with SetRangeEnd. Call ApplyRange to apply the new
range and filter the dataset.
EditRangeEnd differs from SetRangeEnd in that the latter clears all the elements of the
search key buffer to the default values (NULL). EditRangeEnd leaves the elements of
search key buffer with their current values.
Note With Paradox or dBASE tables, these methods work only with indexed fields. With SQL
databases, they can work with any columns specified in the IndexFieldNames property.
Example
{ Limit the range from ‘Goleta’ to ‘Santa Barbara’}
with Table1 do
begin
EditRangeStart; { Set the beginning key }
FieldByName(‘City’).AsString := ‘Goleta‘;
EditRangeEnd; { Set the ending key }
FieldByName(‘City’).AsString := ‘Santa Barbara‘;
ApplyRange; { Tell the dataset to establish the range }
end;
See also
KeyExclusive property, KeyFieldCount property
EditRangeStart method
Applies to
TTable component
Declaration
procedure EditRangeStart;
EditRangeStart enables you to modify the lower key limit established with SetRangeStart.
+
Call ApplyRange to apply the new range and filter the dataset. +
EditRangeStart differs from SetRangeStart in that the latter clears all the elements of the
search key buffer to the default values (NULL). EditRangeStart leaves the elements of the +
search key buffer with their current values.
Note With Paradox or dBASE tables, these methods work only with indexed fields. With SQL +
databases, they can work with any columns specified in the IndexFieldNames property.
E
Example
{ Limit the range from ‘Goleta’ to ‘Santa Barbara’}
with Table1 do
begin
EditRangeStart; { Set the beginning key }
FieldByName(‘City’).AsString := ‘Goleta‘;
EditRangeEnd; { Set the ending key }
FieldByName(‘City’).AsString := ‘Santa Barbara‘;
ApplyRange; { Tell the dataset to establish the range }
end;
See also
KeyExclusive property, EditRangeEnd method, SetRange method, SetRangeEnd method
EditText property
Applies to
TDBEdit, TMaskEdit components
Declaration
property EditText: string;
Run-time only. The EditText property is the value of the Text property as it appears in
the edit box at run time with the mask specified in the EditMask property applied. If
literal mask characters are not saved and no character is substituted for blanks, the
values of EditText and Text are the same.
EditText is what the user actually sees in the edit box at run time.
See also
EditMask property, Text property
The EDivByZero exception is an integer math exception. The exception occurs when
your application attempts to divide an integer type by zero. For example, this code
raises an EDivByZero exception:
var
X, Y: Integer;
begin
X := 0;
Y := 10;
Y := Y div X;
end;
Exception Meaning
EGPFault A general protect fault, which is usually caused by an uninitialized pointer or object.
EStackFault Illegal access to the processor’s stack segment.
EPageFault The Windows memory manager was unable to correctly use the Windows swap file.
EInvalidOpCode The processor encountered an undefined instruction. Usually this means the
processor was trying to execute data or uninitialized memory.
The EFilerError is raised when an attempt is made to register the same class twice. It is
+
also the parent of these exceptions that occur when reading or writing streams: +
Exception
EReadError
Description
The ReadBuf method cannot read the specified number of bytes
+
EWriteError
EClassNotFound
The WriteBuf method cannot write the specified number of bytes
A component on the form has been deleted from the form type declaration
+
E
EFOpenError object Classes
Declaration
EFOpenError = class(EStreamError);
The EFOpenError exception is raised when an attempt is made to create a file stream
object and the specified file cannot be opened.
The $I+ directive must be in effect or input/output errors will not raise an exception. If
an I/O error occurs when your application is in the $I- state, your application must call
the IOResult function to clear the error.
Description
The EIntError exception is a generic integer math exception. Although it is never raised
in the run-time library, it is the base from which other integer math exceptions descend.
These are the integer math exceptions:
Exception Meaning
EDivByZero An attempt was made to divide by zero
ERangeError Number or expression out of range
EIntOverflow Integer operation overflowed
Description
The EIntOverFlow exception is an integer math exception. It occurs when a calculated
result is too large to fit within the register allocated for it and therefore, data is lost. For
example, this code results in an overflow condition as the calculation result overflows a
register:
var
SmallNumber: Shortint;
X, Y: Integer;
begin
X := 127;
Y := 127;
SmallNumber := X * Y * 100;
end;
The EIntOverFlow occurs only if range checking is turned on (your code includes the
$O+ directive or you set the Overflow-checking option using the Options|Project dialog
box).
See also the ERangeError exception.
Description
An EInvalidGraphicOperation is raised when an illegal operation is attempted on a
graphic. For example, if your application attempts to resize an icon, the invalid graphic
operation is raised:
var
AnIcon: TIcon;
begin
AnIcon := TIcon.Create;
AnIcon.LoadFromFile('C:\WINDOWS\DIRECTRY.ICO');
AnIcon.Width := 100; { an invalid graphic operation exception is raised }
...
Eject method
Applies to
TMediaPlayer component
Declaration
procedure Eject;
The Eject method ejects the loaded medium from the open multimedia device. Eject is
called when the Eject button on the media player control is clicked at run time.
Upon completion, Eject stores a numerical error code in the Error property, and the
corresponding error message in the ErrorMessage property.
The Wait property determines whether control is returned to the application before the
Eject method has been completed. The Notify property determines whether Eject
generates an OnNotify event.
Example
This code ejects the CD from the CD-ROM player after 10 seconds. For the code to run
correctly, you must have your CD audio device installed correctly, and the device must
have software ejecting capabilities.
var
TimerOver: Word;
See also
Capabilities property
A list error exception is raised when you insert a string into a sorted string list, as the
+
string you insert at the specified position may put the string list out of sorted order. For
example, this code raises the list error exception:
+
procedure TForm1.FormCreate(Sender: TObject);
var
+
I: Integer;
begin
+
for I := 1 to 5 do
ListBox1.Items.Add('Item ' + IntToStr(I)); E
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
try
ListBox1.Items.Insert(0, 'Try to insert here');
except
on EListError do
MessageDlg(‘Attempt to insert into a sorted list’, mtWarning, [mbOK], 0);
end;
end;
Ellipse method
Applies to
TCanvas object
Declaration
procedure Ellipse(X1, Y1, X2, Y2: Integer);
The Ellipse method draws an ellipse defined by a bounding rectangle on the canvas. The
top left point of the bounding rectangle is at pixel coordinates (X1, Y1) and the bottom
right point is at (X2, Y2). If the points of the rectangle form a square, a circle is drawn.
Example
The following code draws an ellipse filling the background of a form:
procedure TForm1.FormPaint(Sender: TObject);
begin
Canvas.Ellipse(0, 0, ClientWidth, ClientHeight);
end;
See also
Arc method, Chord method, Draw method, DrawFocusRect method, Pie method,
StretchDraw method
Exception Meaning
EInvalidOp Processor encountered an undefined instruction
EZeroDivide Attempt to divide by zero
EOverflow Floating-point operation overflowed
EUnderflow Floating-point operation underflowed
Description
The EMCIDeviceError exception is raised if an error occurs when accessing a multimedia
device. The most common cause for the exception is trying to access a multimedia
device before it has been opened with the Open method.
The Button argument can be one of the following values: btBack, btEject, btNext, btPause,
+
btPlay, btPrev, btRecord, btStep, or btStop. +
The default value of the DoDefault argument is True. If DoDefault is True, the media
player control calls the method that corresponds to the clicked button. For example, if +
the user clicks the Play button (btPlay), the Play method is called.
If DoDefault is False, you must supply the code that executes when a media player +
control button is clicked in the OnClick event handler. The following table lists the
default methods corresponding to the media player control buttons: E
Control button Button value Method called
Play btPlay Play
Record btRecord StartRecording
Stop btStop Stop
Next btNext Next
Prev btPrev Previous
Step btStep Step
Back btBack Back
Pause btPause Pause
Eject btEject Eject
Empty property
Applies to
TBitmap, TGraphic, TIcon, TMetafile objects
Declaration
property Empty: Boolean;
Read-only. The Empty property specifies whether the graphics object contains a graphic.
If Empty is True, no graphic has been loaded into the graphics object. If Empty is False, a
graphic is contained by the graphics object.
Example
The following loads a file into Graphic1 if it does not already contain a graphic.
if Graphic1.Empty then Graphic1.LoadFromFile('myfile.bmp');
See also
LoadFromFile method
EmptyTable method
Applies to
TTable component
Declaration
procedure EmptyTable;
The EmptyTable method deletes all records from the database table specified by
TableName. Before calling this method, the DatabaseName, TableName and TableType
properties must be assigned values.
Note If the table is open, it must have been opened with the Exclusive property set to True.
Example
with Table1 do
begin
Active := False;
DatabaseName := ‘Delphi_Demos’;
TableName := ‘CustInfo’;
TableType := ttParadox;
EmptyTable;
end;
EnableControls method
Applies to
TTable, TQuery, TStoredProc components
See also
Enabled property
Enabled property
Applies to
All controls; TDataSource, TForm, TMenuItem, TTimer components
The Enabled property determines if the control responds to mouse, keyboard, or timer
events, or if the data-aware controls update each time the dataset they are connected to
changes.
Example
To disable a button called FormatDiskButton,
FormatDiskButton.Enabled := False;
This code alternately dims or enables a menu command when a user clicks the button:
procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenCommand.Enabled then
OpenCommand.Enabled := False
else
OpenCommand.Enabled := True;
end;
Description
Enabled specifies if the display in data-aware controls connected to TDataSource is
updated when the current record in the dataset changes. For example, when Enabled is
True and the Next method of a dataset component is called many times, each call
updates all controls. Setting Enabled to False allows the Next calls to be made without
performing updates to the controls. Once you reach the desired record, set Enabled to
True to update the controls to that record.
Note Setting Enabled to False clears the display in data-aware controls until you set it to True
again. If you want to leave the controls with their current contents while moving
through the table or query, call the DisableControls and EnableControls.
Example
DataSource1.Enabled := False;
while not DataSource1.DataSet.EOF do DataSource1.DataSet.Next;
DataSource1.Enabled := True;
EnabledButtons property
Declaration
property EnabledButtons: TButtonSet;
The EnabledButtons property determines which buttons on the media player are enabled.
An enabled button is colored and usable. A disabled button is dimmed and not usable.
If a button is not enabled with EnabledButtons, it is disabled. By default, all buttons are
enabled.
Example
The following example enables all of the media player component’s buttons:
TMediaPlayer1.EnabledButtons := [btPlay, btPause, btStop, btNext, btPrev, btStep, btBack,
btRecord, btEject]
See also
ColoredButtons property, VisibleButtons property
Example
This example uses a button and a label on a form. When the user clicks the button, a
specified date is encoded as a MyDate variable of type TDateTime. MyDate is then
displayed as a string in the caption of the label.
procedure TForm1.Button1Click(Sender: TObject);
var
MyDate: TDateTime;
begin
MyDate := EncodeDate(83, 12, 31);
Label1.Caption := DateToStr(MyDate);
end;
See also
DateToStr function, DecodeDate procedure, EncodeTime function
fractional part of a day given by the specified time. The value 0 corresponds to
+
midnight, 0.5 corresponds to noon, 0.75 corresponds to 6:00 pm, etc. +
Example +
procedure TForm1.Button1Click(Sender: TObject);
var
MyTime: TDateTime;
+
Hour, Min, Sec, MSec: Word;
begin
E
MyTime := EncodeTime(0, 45, 45, 7);
Label1.Caption := TimeToStr(MyTime);
Time24Hour := True;
Label2.Caption := TimeToStr(MyTime);
end;
See also
DecodeTime procedure, EncodeDate function
EndDoc method
Applies to
TPrinter object
Declaration
procedure EndDoc;
The EndDoc method ends the current print job and closes the text file variable. After the
application calls EndDoc, the printer begins printing. Use EndDoc after successfully
sending a print job to the printer. If the print job isn’t successful, use the Abort method.
The Close procedure calls the EndDoc method.
Example
This example uses a button on a form. When the user clicks it, the event handler prints a
rectangle on the printer and displays a message on the form.
procedure TForm1.Button1Click(Sender: TObject);
begin
with Printer do
begin
BeginDoc;
Canvas.Rectangle(20, 20, 400, 300);
EndDoc;
end;
Canvas.TextOut(10, 10, 'Printed');
end;
To use the EndDoc method, you must add the Printers unit to the uses clause of your
unit.
See also
BeginDoc method
EndDrag method
Applies to
All controls
Declaration
procedure EndDrag(Drop: Boolean);
The EndDrag method stops an object from being dragged any further. If the Drop
parameter is True, the object being dragged is dropped. If the Drop parameter is False,
the object is not dropped and dragging is canceled.
Example
The following code cancels the dragging of Label1 without dropping the object.
Label1.EndDrag(False);
See also
BeginDrag method, DragMode property, OnEndDrag event
EndMargin property
Applies to
TTabSet component
Declaration
property EndMargin: Integer;
The EndMargin property determines how far in pixels the rightmost tab appears from
the right edge of the tab set control. The default value is 5. Together with the StartMargin
property, EndMargin can play a role in determining how many tabs can fit within the tab
set control.
If AutoScroll is True and scroll buttons appear in the tab set control, EndMargin
determines how far in pixels the rightmost tab appears from the left edge of the scroll
buttons, rather than the edge of the tab set control.
See also
StartMargin property
EndPage property
Applies to
TReport component
Declaration
property EndPage: Word;
The value of the EndPage property specifies the last page of the report that is printed.
The default value is 9999. If the report is fewer than 9999 pages and you don’t change
the value of EndPage, your entire report is printed.
Example
The following code prints only the first page of Report1.
Report1.EndPage := 1;
Report1.Run;
See also
PrintCopies property, StartPage property
EndPos property
Applies to
TMediaPlayer component
Declaration
property EndPos: Longint;
Run-time only. The EndPos property specifies the position within the currently loaded
medium at which to stop playing or recording. EndPos is specified using the current
time format, which is specified in the TimeFormat property.
The EndPos property affects only the next Play or StartRecording method called after
setting EndPos. You must reset EndPos to affect any subsequent calls to Play or
StartRecording.
Example
The following procedure begins playing the .WAV audio file from the beginning of the
file to middle only.
procedure TForm1.Button1Click(Sender: TObject);
begin
with MediaPlayer1 do
begin
FileName := 'D:\WINAPPS\SOUNDS\CARTOON.WAV';
Open;
EndPos := TrackLength[1] div 2;
Play;
end;
end;
See also
StartPos property
EndUpdate method
Applies to
TStringList, TStrings objects; TOutline component
Declaration
procedure EndUpdate;
The EndUpdate method re-enables screen repainting and outline item reindexing that
was turned off with the BeginUpdate method.
Example
BeginUpdate and EndUpdate should always be used in conjunction with a try...finally
statement to ensure that EndUpdate is called if an exception occurs. A block that uses
BeginUpdate and EndUpdate typically looks like this:
ListBox1.Items.BeginUpdate;
try
ListBox1.Items.Clear;
ListBox1.Items.Add(...);
...
ListBox1.Items.Add(...);
finally
Example
var
F1, F2: TextFile;
Ch: Char;
begin
if OpenDialog1.Execute then begin
AssignFile(F1, OpenDialog1.Filename);
Reset(F1);
if SaveDialog1.Execute then begin
AssignFile(F2, OpenDialog1.Filename);
Rewrite(F2);
while not Eof(F1) do
begin
Read(F1, Ch);
Write(F2, Ch);
end;
CloseFile(F2);
end;
CloseFile(F1);
end;
end;
See also
Eoln function, SeekEof function
EOF property
Applies to
TTable, TQuery, TStoredProc components
Declaration
property EOF: Boolean;
Run-time and read only. EOF is a Boolean property that indicates whether a dataset is
known to be at its last row. The EOF property returns a value of True after:
• An application opens an empty dataset
• A call to a table’s Last method
• A call to a table’s Next fails because the cursor is on the last row
Example
Table1.First;
while not Table1.EOF do
begin
{Do Something}
Table1.Next;
end;
See also
MoveBy method
Description
The EOverflow exception is a floating-point math exception. It occurs when a calculated
result is too large to fit within the register allocated for it and therefore, data is lost. For
example, this code results in an overflow condition:
var
X, Y: Single;
begin
X := 3.3e37;
Y := 2.4e36;
X := X * Y;
end;
Exception Meaning
EFault The base exception object from which all fault objects descend.
EGPFault A general protect fault, which is usually caused by an uninitialized pointer or object.
EStackFault Illegal access to the processor’s stack segment.
EPageFault The Windows memory manager was unable to correctly use the Windows swap file.
EInvalidOpCode The processor encountered an undefined instruction. Usually this means the
processor was trying to execute data or uninitialized memory.
EBreakpoint Your application generated a breakpoint interrupt.
ESingleStep Your application generated a single-step interrupt.
You should rarely encounter the fault exceptions, other than the general protection fault,
because they represent serious failures in the operating environment. The breakpoint
and single-step exceptions are usually handled by Delphi’s integrated debugger.
Description
The ERangeError exception is an integer math exception. It occurs when an integer
expression evaluates to a value that exceeds the bounds of the specified integer type to
which it is assigned. For example, this code raises an ERangeError exception:
var
SmallNumber: Shortint;
X, Y: Integer;
begin
X := 100;
Y := 75;
SmallNumber := X * Y;
end;
Attempting to access an item in an array with an index value that is not within the
defined array results in a range error exception. For example, this code attempts to
assign a value to Values[11] when the highest index of the Values array is 10:
var
Values: array{1..10] of Integer;
I: Integer;
begin
for I := 1 to 11 do
Values[I] := I; { on the last loop a range error exception is raised }
end;
The ERangeError exception is raised only if range checking is turned on (your code
includes the $R+ directive or you set the Range-checking option using the Options|
Project dialog box).
Example
procedure TForm1.Button1Click(Sender: TObject);
var
F: Textfile;
begin
OpenDialog1.Title := 'Delete File';
if OpenDialog1.Execute then begin
AssignFile(F, OpenDialog1.FileName);
try
Reset(F);
if MessageDlg('Erase ' + OpenDialog1.FileName + '?',
mtConfirmation, [mbYes, mbNo], 0) = mrYes then
end;
MessageDlg('File I/O error.', mtError, [mbOk], 0); +
end;
end;
E
See also
Rename procedure
EraseSection method
Applies to
TIniFile object
Declaration
procedure EraseSection(const Section: string);
The EraseSection method erases an entire section of an .INI file.
The Section constant identifies the section of the .INI file to erase. For example, the
WIN.INI for Windows contains a [Desktop] section.
Example
This examples erases the SaveSettings section in the MYAPP.INI file when the user
clicks the button on the form:
procedure TForm1.Button1Click(Sender: TObject);
var
MyAppIni: TIniFile;
begin
MyAppIni := TIniFile.Create('MYAPPINI.INI');
MyAppIni.EraseSection('SaveSettings');
MyAppIni.Free;
end;
See also
ReadSection method
Error property
Applies to
TMediaPlayer component
Declaration
property Error: Longint;
Run-time and read only. The Error property specifies the MCI error code returned by
the most recent media control method (Back, Close, Eject, Next, Open, Pause, PauseOnly,
Play, Previous, StartRecording, Resume, Rewind, Step, or Stop).
The error codes returned by media control methods are the same error codes returned
by the mciSendCommand function, which is documented in MMSYSTEM.HLP. The
message describing the error code is stored in the ErrorMessage property.
The value of Error is zero if the most recent media control method didn’t cause an error.
+
If a method results in an error, a value other than zero is stored in Error. If the error
occurs during the opening of the device, an EMCIDeviceError exception occurs.
+
Example
+
The following code opens, closes, then plays MediaPlayer1. If an error occurs, a message
window displays the error number.
+
procedure TForm1.BitBtn1Click(Sender: TObject);
var
E
MyErrorString: String;
begin
MediaPlayer1.Open;
MediaPlayer1.Close;
MediaPlayer1.Play;
MyErrorString := 'ErrorCode: ' + IntToStr(Error);
MessageDlg(MyErrorString, mtError, [mbOk], 0);
end;
See also
ExitCode variable, ExitProc variable
ErrorMessage property
Applies to
TMediaPlayer component
Declaration
property ErrorMessage: String;
Run-time and read only. The ErrorMessage property specifies the error message that
describes the error code returned from the most recent media control method (Back,
Close, Eject, Next, Open, Pause, PauseOnly, Play, Previous, StartRecording, Resume, Rewind,
Step, or Stop). The error code described by the message is stored in the Error property.
Example
The following code opens MediaPlayer1. If an exception occurs, a message window
displays the error number and string.
procedure TForm1.BitBtn1Click(Sender: TObject);
var
MyErrorString: String;
begin
try
MediaPlayer1.Open;
except
MyErrorString := 'ErrorCode: ' + IntToStr(Error) + #13#10;
MessageDlg(MyErrorString + MediaPlayer1.ErrorMessage, mtError, [mbOk], 0);
end;
end;
Description
The EStackFault exception is a hardware fault exception. It occurs when an illegal
attempt to access the processor’s stack is made. Usually a stack fault represents a serious
failure in the operating environment.
If you have stack checking turned on {$S+}, you are not likely to reach a point where a
+
stack fault occurs because each procedure or function call checks to be sure there is
enough stack space for local variables before it runs. If stack checking is off {$S-}, this
+
checking does not occur, and the stack fault exception could be raised. +
EStreamError object Classes
+
Declaration
E
EStreamError = class(Exception);
The EStreamError exception is raised when an error occurs when a stream is read with
the LoadFromStream method. It also is the parent of these two stream exceptions:
Exception Description
EFCreateError An error occurred while creating a file
EFOpenError An error occurred while opening a file
The EWriteError exception is raised when the WriteBuffer method of a stream object is
unable to write the number of bytes specified in its Count parameter.
The CreateResHelp method obtains the string that becomes the value of the Message
+
property from a resource file. Specify the string as the value of the Ident parameter. The
AHelpContext parameter is for a context-sensitive ID number.
+
The CreateResFmtHelp method obtains the string that becomes the value of the Message +
property and formats it using the Format function. The AHelpContext parameter is for a
context-sensitive ID number. +
Exchange method
E
Applies to
TList, TStringList, TStrings objects
Declaration
procedure Exchange(Index1, Index2: Integer);
The Exchange method exchanges the position of two items in the list of a list object, or in
the list of strings of a string or string list object. The items are specified with their index
values in the Index1 and Index2 parameters. Because the indexes are zero-based, the first
item in the list has an index value of 0,the second item has an index value of 1, and so on.
If a string in a string or string list object has an associated object, Exchange changes the
position of both the string and the object.
Example
This example uses a list box that contains several strings as the value of the Items
property, and a button. When the user clicks the button, the second and third items in
the list box switch places in the list box.
procedure TForm1.Button1Click(Sender: TObject);
begin
ListBox1.Items.Exchange(1, 2);
end;
See also
Add method, AddStrings method, Delete method, IndexOf method, Insert method, Move
method
The construct Exclude (S, I) corresponds to S := S – (I) but the Exclude procedure
generates more efficient code.
See also
Include procedure
Exclusive property
Applies to
TTable component
Declaration
property Exclusive: Boolean;
Set the Exclusive property to True to prevent any other user from accessing the table. If
other users are accessing the table when you try to open it, your exception handler will
have to wait for those users to release it. If you do not provide an exception handler and
another user already has the table open, your application will be terminated.
Note Set the Active property to False before changing Exclusive to prevent an exception.
Do not set Active and Exclusive to True in the Object Inspector Window. Since the Object
Inspector will have the table open, that will prevent your program from opening it.
Set Exclusive to True only when you must have complete control over the table.
Example
{ Try to open Table1 with Exclusive True }
{ First, close Table1 }
Table1.Active := False;
repeat { until successful or Cancel button is pressed }
try
Table1.Exclusive := True; { See if it will open }
Table1.Active := True;
Break; { If no error, exit the loop }
except
on EDatabaseError do
{ Ask if it is OK to retry }
if MessageDlg(‘Could not open Table1 exclusively - OK to retry?’, mtError,
[mbOK, mbCancel], 0) <> mrOK then raise; { If not, reraise to abort }
{ Otherwise resume the repeat loop }
end;
until False;
Example
{ Execute the stored procedure }
StoredProc1.ExecProc;
ExecSQL method
Applies to
TQuery component
Declaration
procedure ExecSQL;
Use the ExecSQL method to execute an SQL statement assigned to the SQL property of a
TQuery if the statement does not return a result set. If the SQL statement is an INSERT,
UPDATE, DELETE, or any DDL statement, then use this method.
If the SQL statement is a SELECT statement, use Open instead.
Example
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add(‘Delete from Country where Name = ‘Argentina’);
Query1.ExecSQL;
Execute method
Applies to
TBatchMove, TColorDialog, TFindDialog, TFontDialog, TOpenDialog, TPrintDialog,
TPrinterSetupDialog, TReplaceDialog, TSaveDialog components
For Color, Font, Open, Save, Print, Find, and Replace dialog boxes
Declaration
function Execute: Boolean;
The Execute method displays the dialog box in the application and returns True when it
is displayed. This allows your code to determine whether the user has displayed and
used the dialog box by choosing its OK button.
Example
This example uses a main menu component, a memo, an Open dialog box, and a Save
dialog box on a form. To use it, you need to create a File menu that includes an Open
command. This code is an event handler for the OnClick event of the Open command on
the File menu. If the user has selected a file name by choosing the Open dialog box’s OK
button, the code sets the Save dialog box Filename property to the same file name, and
displays the selected file name as the caption of the form.
procedure TForm1.Open1Click(Sender: TObject);
begin
if OpenDialog1.Execute then
begin
Memo1.Lines.LoadfromFile(OpenDialog1.FileName);
SaveDialog1.Filename := OpenDialog1.FileName;
Caption := OpenDialog1.FileName;
end;
end;
Example
This code displays the Printer Setup dialog box when the user clicks the button:
procedure TForm1.Button1Click(Sender: TObject);
begin
PrinterSetupDialog1.Execute;
end;
The Execute method performs the batch move operation specified by Mode from the
+
Source table to the Destination table. +
Example +
BatchMove1.Execute;
+
ExecuteMacro method E
Applies to
TDDEClientConv component
Declaration
function ExecuteMacro(Cmd: PChar; WaitFlg: Boolean): Boolean;
The ExecuteMacro method attempts to send a macro command string to a DDE server
application. ExecuteMacro returns True if the macro was successfully passed to the DDE
server application. If ExecuteMacro was unable to send a command string, ExecuteMacro
returns False.
Cmd is a null-terminated string that contains the macro to be executed by the DDE
server application. The actual value of Cmd depends on the DDE server application. See
the documentation of the DDE server application for the command strings it will accept.
WaitFlg determines if your application should wait until the DDE server application
finishes executing the macro before allowing another successful call to ExecuteMacro or
the ExecuteMacroLines, PokeData, or PokeDataLines methods. If WaitFlg is set to True,
subsequent calls to these methods before the DDE server application completes the first
macro do not send data to the DDE server and return False. If WaitFlg is set to False,
subsequent calls to these methods before the DDE server application completes the first
macro do attempt to send data to the DDE server.
If you need to send a macro command string list rather than a single string, use the
ExecuteMacroLines method.
Note Depending on the DDE server, attempting to execute a macro or poke data before the
DDE server application completes the first macro might cause the first macro to execute
unsuccessfully or produce unpredictable results. See the documentation of the DDE
server application for the results of sending command strings or poking data before
macro execution has completed.
Example
The following code executes the macro that is specified by the Text of Edit1. The macro
sets WaitFlg to True to wait until the server has completed macro execution.
var
TheMacro: PChar;
begin
StrPCopy(TheMacro, Edit1.Text);
DDEClientConv1.ExecuteMacro(TheMacro, True);
end;
See also
StrPCopy function
ExecuteMacroLines method
Applies to
TDDEClientConv component
Declaration
function ExecuteMacroLines(Cmd: TStrings; WaitFlg: Boolean): Boolean;
The ExecuteMacroLines method attempts to send a macro command string list to a DDE
server application. ExecuteMacroLines returns True if the macro was successfully passed
to the DDE server application. If ExecuteMacroLines was unable to send a command
string list, ExecuteMacroLines returns False.
Cmd contains the macro to be executed by the DDE server application. WaitFlg
determines if your application should wait until the DDE server application finishes
executing the macro before allowing another successful call to ExecuteMacroLines or the
ExecuteMacro, PokeData, or PokeDataLines methods.
Use ExecuteMacroLines to execute a macro command string list rather than a single
macro command string (which is what the ExecuteMacro method passes for its Cmd
parameter).
Example
The following code executes the macro that exists in the Lines of Memo1. Wait is a
boolean variable that specifies whether to wait for the server to complete macro
processing before sending more data to the server.
DDEClientConv1.ExecuteMacroLines(Memo1.Lines, Wait);
ExeName property
Applies to
TApplication component
Declaration
property ExeName: string;
Run-time and read only. The ExeName property contains the name of the executable
application including path information. The name of the application is the name you
gave the project file with an .EXE extension. If you haven’t specified a name, the default
name is PROJECT1.EXE.
If the current block is a procedure or function, Exit causes the calling block to continue
with the statement after the point which the block was called.
Example
uses WinCrt;
procedure TForm1.Button1Click(Sender: TObject);
begin
repeat
if Keypressed then Exit;
Write('Xx');
until False;
end;
See also
Halt procedure
See also
ErrorAddr variable, ExitProc variable
When implemented properly, an exit procedure actually becomes part of a chain of exit
+
procedures. The procedures on the exit chain get executed in reverse order of
installation.
+
To keep the exit chain intact, you need to save the current contents of ExitProc before +
changing it to the address of your own exit procedure.
The first statement in your exit procedure must reinstall the saved value of ExitProc. +
See also E
ErrorAddr variable, ExitCode variable
Return Value
The Exp function returns the exponential of X.
The return value is e raised to the power of X, where e is the base of the natural
logarithms.
Example
var
S: string;
begin
S := ‘e = ‘ + IntToStr(Exp(1.0));
TextOut(10, 10, S);
end;
See also
Ln function
Expand method
Applies to
TList, TOutlineNode objects
For lists
Declaration
function Expand: TList;
The Expand method increases the maximum size of the list maintained by a list object,
creating more space to add new list items and incrementing the value of the Capacity
property. If the value of the Capacity property is greater than 8, the Expand method
increases the capacity of the list by 16. If the value of Capacity is greater than 4, but less
than 9, then the capacity of the list increases by 8. Finally if the value of Capacity is less
than 4, then the capacity of the list grows by 4.
The returned value is the expanded list.
Example
The following code expands List1.
List1.Expand;
See also
Capacity property
Example
The following code expands the first child of the first outline item, if it has children.
with Outline1.Items[1] do
if HasItems then
Outline1.Items[GetFirstChild].Expand;
See also
Collapse method, FullCollapse method, FullExpand method, PictureMinus property,
PictureOpen property
Expanded property
Applies to
TOutlineNode object
Declaration
property Expanded: Boolean;
Run-time only. The Expanded property specifies whether the outline item is expanded or
+
not. When an outline item is expanded, its subitems are displayed and the minus picture
or open picture might be displayed, depending on the outline style specified in the
+
OutlineStyle property of the TOutline component. +
Expanded is True if the item is expanded, False if it isn’t expanded.
+
Example
The following code toggles the state of the selected outline item. E
with Outline1 do
Items[SelectedItem].Expanded := not Items[SelectedItem].Expanded;
See also
Collapse method, Expand method, FullCollapse method, FullExpand method, PictureMinus
property, PictureOpen property
Example
The following code converts a file name into a fully-expanded file name:
MyFileName := ExpandFileName(MyFileName);
See also
ExtractFileName function
Expression property
Applies to
TIndexDef object
Declaration
property Expression: string;
Run-time and read only. Read expressions in dBASE indexes.
ExtendedSelect property
Applies to
TListBox component
Declaration
property ExtendedSelect: Boolean;
The ExtendedSelect property determines if the user can select an range of items in the list
box. ExtendedSelect works in conjunction with the MultiSelect property. If MultiSelect is
False, the setting of ExtendedSelect has no effect as the user will not be able to select more
than one item at a time in the list box.
If MultiSelect is True and ExtendedSelect is True, the user can select an item then hold
down the Shift key and select another and all the items in between the two selected items
also become selected. If the user doesn’t hold down the Shift or Ctrl key while selecting a
second item, the first selected item becomes unselected—in other words, the user must
use the Ctrl key to select multiple noncontiguous items, or the Shift key to select a range of
items. If ExtendedSelect is False, the user can select multiple items without using the Shift
or Ctrl key, but they can’t select a range of items in one operation.
See also
MultiSelect property
Example
The following code returns the extension from a file name:
MyFilesExtension := ExtractFileExt(MyFileName);
See also
ExtractFileName function
The ExtractFileName function takes a fully or partially qualified path name in FileName
+
and returns a string containing only the file name part, including the name and
extension.
+
Example
+
The following code changes the caption of Form1 to read "Editing <FileName>". +
E
Form1.Caption := 'Editing '+ ExtractFileName(FileName);
See also
ExpandFileName function, ExtractFilePath function
Example
The following code changes the current directory to the location of FileName.
ChDir(ExtractFilePath(FileName));
See also
ExtractFileName function
Description
The EZeroDivide exception is a floating-point math exception. It occurs when your
application attempts to divide a floating-point value by zero. For example, this code
raises a EZeroDivide exception:
var
X, Y: Double;
begin
X := 0.0;
Y := 10.11111;
Y := Y / X;
end;
See also
New procedure
FieldByName method
Applies to
TTable, TQuery, TStoredProc components
Declaration
function FieldByName(const FieldName: string): TField;
The FieldByName method returns the TField with the name passed as the argument in
FieldName. Using FieldByName protects your application from a change in the order of
the fields in the dataset. If the field can not be found, FieldByName raises an exception. If
you are not certain whether a field with the requested name exists, use the FindField
method.
Example
with Table1 do
begin
{ This is the safe way to change ‘CustNo’ field }
FieldByName(‘CustNo’).AsString := ‘1234’;
{ This is *not* the safe way to change ‘CustNo’ field }
Fields[0].AsString := ‘1234’;
end;
FieldClass property
Applies to
TFieldDef object
Declaration
property FieldClass: TFieldClass;
Run-time and read only. Read FieldClass to determine the type of the TField component
that corresponds to this TFieldDef object.
FieldCount property
Applies to
TDBGrid, TDBLookupList, TQuery, TStoredProc, TTable components
Declaration
property FieldCount: Integer;
Run-time and read only. The FieldCount property specifies the number of fields
(columns) in a dataset. It may not be the same as the number of fields in the underlying
database table, since you can add calculated fields and remove fields with the Fields
Designer.
For the data grid and database lookup list box, the value of the FieldCount property is the
number of fields in the dataset displayed in the control.
Example
The following code displays the number of fields in DBGrid1 in a label.
Label1.Caption := IntToStr(DBGrid1.FieldCount);
See also
Fields property, SelectedField property
FieldDefs property
Applies to
TTable, TQuery, TStoredProc components
Declaration
property FieldDefs: TFieldDefs;
Run-time only. The FieldDefs property holds information about each TFieldDef in the
dataset. You can use this property to determine which fields are in the dataset, their
name, type, and size.
See also
Fields property, TField component
See also
DisplayName property
FieldNo property
Applies to
TFieldDef object; TBCDField, TBlobField, TBooleanField, TBytesField, TCurrencyField,
TDateField, TDateTimeField, TFloatField, TGraphicField, TIntegerField, TMemoField,
TSmallintField, TStringField, TTimeField, TVarBytesField, TWordField components
Example
{ Display the field name and number }
with FieldDef1 do
MessageDlg(Name + ' is field ’ + IntToStr(FieldNo), mtInformation, [mbOK], 0);
See also
TField component
For fields
Declaration
property FieldNo: Integer;
Run-time and read only. FieldNo is the ordinal of the TField component in its dataset.
This property is available for programs that make direct calls to the Borland Database
Engine.
Fields property
Applies to
TIndexDef object; TDBGrid, TDBLookupList, TQuery, TStoredProc, TTable components
Example
The following code left justifies the first field in DBGrid1.
DBGrid1.Fields[0].Alignment := taLeftJustify;
See also
FieldCount property, FieldDefs property, SelectedField property, SelectedIndex property
Constant Definition
fmOpenRead Open for read access only.
fmOpenWrite Open for write access only.
fmOpenReadWrite Open for read and write access.
fmShareCompat Compatible with the way FCBs are opened.
fmShareExclusive Read and write access is denied.
fmShareDenyWrite Write access is denied.
fmShareDenyRead Read access is denied.
fmShareDenyNone Allows full access for others.
Example
The following code closes a file opened with FileOpen:
FileClose(MyFileHandle);
See also
FileCreate function, FileOpen procedure
Example
The following example creates a new file and assigns it to the identifier MyFileHandle.
MyFileHandle := FileCreate('NEWFILE.TXT');
See also
FileClose procedure, FileOpen procedure
FileEdit property
Applies to
TFileListBox component
Declaration
property FileEdit: TEdit;
The FileEdit property provides a simple way to display a file selected in a file list box as
the text of an edit box, as is commonly done in Open and Save dialog boxes. If no file is
selected in the file list box, the text of the edit box is the current value of the file list box’s
+
Mask property. +
Specify the edit box you want the mask or selected file to appear in as the value of the
FileEdit property. +
Example +
This example uses a button, an edit box, a label, a drive combo box, a directory list box, a
file list box, and a filter combo box on a form. When the user clicks the button, the rest of
the controls of the form begin working together like the controls in an Open or Save
+
dialog box. F
procedure TForm1.Button1Click(Sender: TObject);
begin
DriveComboBox1.DirList := DirectoryListBox1;
DirectoryListBox1.FileList := FileListBox1;
DirectoryListBox1.DirLabel := Label1;
FileListBox1.FileEdit := Edit1;
FilterComboBox1.FileList := FileListBox1;
end;
See also
DirLabel property, DirList property, FileList property, Mask property, Text property
FileEditStyle property
Applies to
TOpenDialog, TSaveDialog components
Declaration
property FileEditStyle: TFileEditStyle;
The FileEditStyle property determines if the Open or Save dialog box contains an edit
box or combo box control for the user to enter a file name. These are the possible values:
Value Meaning
fsEdit Edit box to enter a file name.
fsComboBox Drop-down combo box to enter a file name. The combo box can be used to display a
list of file names.
1 Add a TStringList object to your application to keep the list of file names the user
enters.
2 Before your application calls the Execute method to display the Open or Save dialog
box, assign the TStringList object to the HistoryList property. For example,
var
MyHistoryList: TStringList;
begin
OpenDialog1.HistoryList := MyHistoryList;
if OpenDialog1.Execute then
...
3 Use the returned FileName property value to update your history list. For example:
MyHistoryList.Insert(0, OpenDialog1.FileName);
Example
This examples uses a Save dialog box, an edit box, and a button on a form. When the
user clicks the button, the Save dialog box appears with a combo box control to allow
the user to type a file name, select a file name from the list box, or drop down a list to
choose a file name from a history list. For this example, no history list exists. Once the
user selects a file name, the selected name appears in the edit box on the form.
procedure TForm1.Button1Click(Sender: TObject);
begin
SaveDialog1.FileEditStyle := fsComboBox;
SaveDialog1.Filter := 'Text Files(*.TXT) | *.TXT';
if SaveDialog1.Execute then
Edit1.Text := SaveDialog1.FileName;
end;
See also
HistoryList property, TFilterComboBox component
Example
The following code prompts you for confirmation before deleting a file:
if FileExists(FileName) then
MsgBox('Do you really want to delete ' + ExtractFileName(FileName)
+ '?'), []) = IDYes then FileDelete(FileName);
See also
DateTimeToFileDate function
See also
FileSetAttr function
See also
FileSetDate procedure
FileList property
Applies to
TDirectoryListBox, TFilterComboBox components
Declaration
property FileList: TFileListBox;
The FileList property is used for two different purposes, depending on the type of
control it is a property of.
For directory list boxes, FileList provides a simple way to connect a directory list box
with a file list box. Once the two controls are connected and new directory is selected as
the current directory using a directory list box, the file list box displays the files in the
current directory. Specify the file list box in which you want to display the files in the
directory selected in the directory list box as the value of the FileList property.
For filter combo boxes, FileList provides a simple way to connect a filter combo box with
a file list box. Once the two controls are connected and a new filter is selected using a
filter combo box, the file list box displays the files that match the selected filter. Specify
the file list box you want to display the files matching the selected filter as the value of
the FileList property.
Example
This example uses a button, an edit box, a label, a drive combo box, a directory list box, a
file list box, and a filter combo box on a form. When the user clicks the button, the rest of
the controls on the form begin working together like the controls in an open or save
dialog box.
procedure TForm1.Button1Click(Sender: TObject);
begin
DriveComboBox1.DirList := DirectoryListBox1;
DirectoryListBox1.FileList := FileListBox1;
DirectoryListBox1.DirLabel := Label1;
FileListBox1.FileEdit := Edit1;
FilterComboBox1.FileList := FileListBox1;
end;
See also
DirLabel property, Directory property, DirList property, FileEdit property, FileList
property, Filter property, Mask property
The FileMode variable determines the access code to pass to DOS when typed and
+
untyped files (not text files) are opened using the Reset procedure. +
The default FileMode is 2. Assigning another value to FileMode causes all subsequent
Resets to use that mode. +
The range of valid FileMode values depends on the version of DOS in use. For all
versions, these modes are defined: +
0 Read only +
1
2
Write only
Read/Write F
DOS version 3.x and later defines additional modes, which are primarily concerned
with file sharing on networks.
See also
Rewrite procedure
FileName property
Applies to
TFileListBox, TMediaPlayer, TOpenDialog, TSaveDialog components; TIniFile object
Example
This example displays an Open dialog box and suggests the file name LIST.PAS to the
user. Once the user selects a file name, the code displays that name in a label on the
form:
procedure TForm1.Button1Click(Sender: TObject);
begin
OpenDialog1.FileName := ’LIST.PAS’;
if OpenDialog1.Execute then
Label1.Caption := OpenDialog1.FileName;
end;
See also
Files property
Example
The following code determines what type of media device to open from the results of an
Open dialog box, then opens the file.
if OpenDialog1.Execute then
begin
MediaPlayer1.DeviceType := dtAutoSelect;
MediaPlayer1.FileName := OpenDialog1.FileName;
MediaPlayer1.Open;
end;
Example
This example uses a file list box and a label on a form. When the user selects a file in the
file list box, the name of the file appears as the caption of the label.
procedure TForm1.FileListBox1Click(Sender: TObject);
begin
Label1.Caption := FileListBox1.FileName;
end;
See also
FileList property
Position Result
Beginning of file FilePos(F) = 0
Middle of file FilePos(F) = current file position
End of file Eof(F) = True
{$I+} lets you handle run-time errors using exceptions. For more information on
handling run-time library exceptions, see Handling RTL Exceptions in the Help system.
If you are using {$I–}, you must use IOResult to check for I/O errors.
Example
var
f: file of Byte;
size : Longint;
S: string;
y: integer;
begin
if OpenDialog1.Execute then begin
AssignFile(f, OpenDialog1.FileName);
Reset(f);
size := FileSize(f);
S := 'File size in bytes: ' + IntToStr(size);
y := 10;
Canvas.TextOut(5, y, S);
y := y + Canvas.TextHeight(S) + 5;
S := 'Seeking halfway into file...';
Canvas.TextOut(5, y, S);
y := y + Canvas.TextHeight(S) + 5;
See also
FileSize function, Seek procedure
Example
The following code fills a buffer from a file.
ActualRead := FileRead(MyFileHandle, Buffer, SizeOf(Buffer));
See also
FileSeek function, FileWrite function
Files property
Applies to
TOpenDialog, TSaveDialog components
Declaration
property Files: TStrings;
Run-time and read only. The Files property value contains a list of all the file names
selected in the Open or Save dialog box including the path names.
To let users select multiple file names in the dialog box, include ofAllowMultiSelect in the
Options property set (set ofAllowMultiSelect to True).
The entire list of names is returned as the value of the FileName property. If the list of
names is long, FileName contains only the first 127 characters.
Example
The following code searches for FINDME.DLL in a series of directories:
FoundIt := FileSearch('FINDME.DLL', MyAppDir+’\';'+WinDir+';'+WinDir+'\SYSTEM');
See also
FileExists function
denoting the beginning of the file, the end of the file, and the current position of the file
pointer.
Origin Action
0 The file pointer is positioned Offset bytes from the beginning of the file.
1 The file pointer is positioned Offset bytes from its current position.
2 The file pointer is positioned Offset bytes from the end of the file.
If FileSeek is successful, it returns the new position of the file pointer; otherwise, it
returns the Windows constant HFILE_ERROR.
Example
The following code positions the file pointer at the end of a file:
if FileSeek(MyFileHandle,0,2) = HFILE_ERROR then
HandleFileError
else
AppendStuff;
See also
FileRead function, FileWrite function
See also
FileGetAttr function
Example
var
f: file of Byte;
size : Longint;
S: string;
y: integer;
begin
if OpenDialog1.Execute then begin
AssignFile(f, OpenDialog1.FileName);
Reset(f);
size := FileSize(f);
S := 'File size in bytes: ' + IntToStr(size);
y := 10;
Canvas.TextOut(5, y, S);
y := y + Canvas.TextHeight(S) + 5;
S := 'Seeking halfway into file...';
Canvas.TextOut(5, y, S);
y := y + Canvas.TextHeight(S) + 5;
Seek(f,size div 2);
S := 'Position is now ' + IntToStr(FilePos(f));
Canvas.TextOut(5, y, S);
CloseFile(f);
end;
end;
See also
FilePos function
FileType property
Applies to
TFileListBox component
Declaration
property FileType: TFileType;
The FileType property determines which files are displayed in the file list box based on
the attributes of the files. Because FileType is of type TFileType, which is a set of file
attributes, FileType can contain multiple values. For example, if the value of FileType is a
set containing the values ftReadOnly and ftHidden, only files that have the read-only and
hidden attributes are displayed in the list box. These are the values that can occur in the
FileType property:
Value Meaning
ftReadOnly When ftReadOnly is True, the list box can display files with the read-only attribute.
ftHidden When ftHidden is True, the list box can display files with the hidden attribute.
ftSystem When ftSystem is True, the list box can display files with the system attribute.
ftVolumeID When ftVolumeID is True, the list box can display the volume name.
ftDirectory When ftDirectory is True, the list box can display directories.
ftArchive When ftArchive is True, the list box can display files with archive attribute.
ftNormal When ftNormal is True, the list box can display files with no attributes.
If you use the Object Inspector to change the value of FileType, click the FileType
property to see the attribute values. Then you can set each value to True or False, which
builds the FileType set.
Example
This example uses a file list box on a form. When the application runs, only read-only
files, directories, volume IDs, and files with no attributes appear in the list box.
procedure TForm1.FormCreate(Sender: TObject);
begin
FileListBox1.FileType := [ftReadOnly, ftDirectory, ftVolumeID, ftNormal];
end;
See also
Mask property, TFileType type
Example
var
S: string[80];
begin
{ Set a string to all spaces }
FillChar(S, SizeOf(S), ' ');
S[0] := #80; { Set length byte }
end;
See also
Move procedure
FillRect method
Applies to
TCanvas object
Declaration
procedure FillRect(const Rect: TRect);
The FillRect method fills the specified rectangle on the canvas using the current brush.
Example
This code creates a rectangle on the form’s canvas and colors it red by changing the
canvas Brush property to clRed.
procedure TForm1.ColorRectangleClick(Sender: TObject);
var
NewRect: TRect;
begin
NewRect := Rect(20, 30, 50, 90);
Form1.Canvas.Brush.Color := clRed;
Form1.Canvas.FillRect(NewRect);
end;
See also
Brush property, Rect function
Filter property
Applies to
TFilterComboBox, TOpenDialog, TSaveDialog components
This allows the user to select from a number of file filters and determine which files are
+
displayed in the list box. +
To specify multiple file filters,
1 Create a file filter string as previously shown.
+
2 Type another file filter in the same way, but separate the second file filter from the
first with the | character.
+
3 Continue adding as many file filters as you like, separating them with the | character. +
The string can be up to 255 characters.
Here’s an example of three file filters specified as the value of the Filter property:
F
’Text files (*.TXT)|*.TXT|Pascal files (*.PAS)|*.PAS|Quattro Pro files (*.WB1)|*.WB1’
Now when the dialog box appears, the user can choose from three file filters that appear
in the List Files of Type drop-down list box.
Note that the previous example includes the file filters in parentheses in the text parts.
This isn’t required, but it’s a common convention that helps users understand what to
expect when they select a file filter.
You can string multiple wildcard file filters together if you separate them with
semicolons:
OpenDialog1.Filter := ’All files|*.TXT;*.PAS;*.WB1’;
Example
This code sets the value of the Filter property, displays the dialog box, and assigns the
file name the user selects to a variable:
procedure TForm1.Button1Click(Sender: TObject);
var
NameOfFile : TFileName;
begin
OpenDialog1.Filter := 'Text files (*.TXT)|*.TXT|Pascal files (*.PAS)' +
‘|*.PAS|Quattro Pro files (*.WB1)|*.WB1';
if OpenDialog1.Execute then
NameOfFile := OpenDialog1.FileName;
...
end;
See also
FileName property, FilterIndex property
A file mask or file filter is a file name that usually includes wildcard characters (*.PAS,
for example). When your application runs, the file filter the user selects in the filter
combo box becomes the value of the Mask property. To specify a file filter, assign a filter
string as the value of Filter. To create the string, follow these steps:
1 Type some meaningful text to indicate the type of file.
2 Type a | character (this is the “pipe” or “or” character).
3 Type the file filter.
Don’t put in any spaces around the | character in the string.
Here’s an example:
FilterComboBox1.Filter := ’Text files|*.TXT’;
If you entered this string, the string “Text files” appears in the filter combo box.
You can specify multiple file filters so that a list of filters appears in the filter combo box
from which the user can select. To specify multiple file filters,
1 Type a file filter as shown previously.
2 Type another file filter in the same way, but separate the second file filter from the
first with the | character.
3 Continue adding as many file filters as you like, separating them with the | character.
The string can be up to 255 characters.
Here’s an example of three file filters specified as the value of the Filter property:
’Text files (*.TXT)|*.TXT|Pascal files (*.PAS)|*.PAS|Quattro Pro files (*.WB1)|*.WB1’
Note that the previous example includes the file filters in parentheses in the text parts.
This isn’t required, but it’s a common convention that helps users understand what to
expect when they select a file filter.
You can string multiple wildcard file filters together if you separate them with
semicolons:
FilterComboBox1.Filter := ’All files|*.TXT;*.PAS;*.WB1’;
Examples
This example uses a filter combo box on a form. When the application runs, three filters
appear in the filter combo box:
procedure TForm1.FormCreate(Sender: TObject);
begin
FilterComboBox1.Filter := 'Text files (*.TXT)|*.TXT|Pascal files (*.PAS)' +
'|*.PAS|Quattro Pro files (*.WB1)|*.WB1';
end;
This example uses a filter combo box, a file list box, and an edit box on a form. The code
connects the three controls through the FileList and FileEdit properties. When the user
selects a filter in the filter combo box, the filter is applied to the files in the list box so the
list box displays only the files that match the filter. The filter in effect on the file list box
appears in the edit box. When the user selects a file in the file list box, the selected file
appears in the edit box.
Declaration
property FilterIndex: Integer;
The FilterIndex property determines which file filter specified in the Filter property
appears as the default file filter in the List Files of Type drop-down list box. For
example, if you set the FilterIndex value to 2, the second file filter listed in the Filter
property becomes the default filter when the dialog box appears. The default FilterIndex
value is 1. If you specify a value greater than the number of file filters in the Filter
property, the first filter is chosen.
The default value is 1.
Example
This code specifies three file filters as the value of the Filter property, sets the FilterIndex
to 2 so that the second file filter is the default file filter, and displays the Open dialog
box. Once the user selects a file with the dialog box and chooses OK, the file name the
user selected appears in a label on the form.
procedure TForm1.Button1Click(Sender: TObject);
begin
OpenDialog1.Filter := 'Text files (*.TXT)|*.TXT|Pascal files (*.PAS)' +
‘|*.PAS|dBASE program files (*.PRG)|*.PRG';
OpenDialog1.FilterIndex := 2;
if OpenDialog1.Execute then
Label1.Caption := OpenDialog1.FileName;
end;
See also
Filter property
Find method
Applies to
TFieldDefs, TStringList objects
Example
This example uses a list box and a label on a form. When the application runs, a string
list object is created and three strings are added to it. The Find method searches the
strings to look for a match with the string ’Flowers’. If the string is found, all the strings
in the string list are added to the list box, and the index value of the ’Flowers’ string
appears in the caption of the label control.
procedure TForm1.FormCreate(Sender: TObject);
var
MyList: TStringList;
Index: Integer;
begin
MyList := TStringList.Create;
MyList.Add('Animals');
MyList.Add('Flowers');
MyList.Add('Cars');
if MyList.Find('Flowers', Index) then
begin
ListBox1.Items.AddStrings(MyList);
Label1.Caption := 'Flowers has an index value of ' + IntToStr(Index);
end;
MyList.Free;
end;
See also
Add method, Clear method, IndexOf method, Strings property
See also
Name property
See also
FindFirst function, FindNext function
FindComponent method
Applies to
All components
Declaration
function FindComponent(const AName: string): TComponent;
The FindComponent method returns the component in the Components array property
with the name that matches the string in the AName parameter. FindComponent is not
case sensitive.
Example
To set up this example, place several components on a form, including an edit box and a
button. When the user clicks the button, the code displays the value of the
ComponentIndex of the edit box in the edit box.
procedure TForm1.Button1Click(Sender: TObject);
var
TheComponent: TComponent;
begin
TheComponent := FindComponent('Edit1');
Edit1.Text := IntToStr(TheComponent.ComponentIndex);
end;
See also
ComponentCount property, ComponentIndex property, Components property
FindDatabase method
Applies to
TSession component
Declaration
function FindDatabase(const DatabaseName: string): TDatabase;
The FindDatabase method attempts to find a TDatabase component in the Databases
collection with a DatabaseName property which matches the DatabaseName parameter. If
there is no such database, FindDatabase returns nil.
Example
MyDatabase := Session.FindDatabase(‘MYDB’);
See also
Session variable
FindField method
Applies to
TTable, TQuery, TStoredProc components
Declaration
function FindField(const FieldName: string): TField;
The FindField method returns the field with the name passed in FieldName. While calling
FindField is slightly slower than a direct reference to the Fields property, using FindField
protects your application from a change in the order of the fields in the component. If
+
the field can not be found, FindField returns nil. +
Example +
with Table1 do
begin
{ This is the safe way to change ‘CustNo’ field }
+
FindField(‘CustNo’).AsString := ‘1234’;
{ This is *not* the safe way to change ‘CustNo’ field }
+
Fields[0].AsString := ‘1234’;
end; F
See also
FieldByName method
You can combine attributes by adding their constants or values. For example, to search
for read-only and hidden files in addition to normal files, pass (faReadOnly + faHidden)
the Attr parameter.
FindFirst returns the results of the directory search in the search record you specify in
the F parameter. You can then use the fields of the search record to extract the
information you want.
The return value is zero if the function was successful. Otherwise the return value is a
negative DOS error code; a value of -18 indicates that there are no more files matching
the search criteria.
Example
This example uses a label and a button named Search on a form. When the user clicks
the button, the first file in the specified path is found and the name and number of bytes
in the file appear in the label's caption:
var
SearchRec: TSearchRec;
procedure TForm1.SearchClick(Sender: TObject);
begin
FindFirst('c:\delphi\bin\*.*', faAnyFile, SearchRec);
Label1.Caption := SearchRec.Name + ' is ' + IntToStr(SearchRec.Size) +
' bytes in size';
end;
See also
FindNext function
FindIndexForFields method
Applies to
TIndexDefs object
Declaration
function FindIndexForFields(const Fields: string): TIndexDef;
Run-time and read only. Returns the TIndexDef object that is present in Items
corresponding to a semicolon-separated list of fields.
FindItem method
Applies to
TMainMenu component
Declaration
function FindItem(Value: Word; Kind: TFindItemKind): TMenuItem;
The FindItem method returns the menu item owned by the menu that has either a menu
+
handle, menu command, or menu shortcut matching the value of the Value parameter.
The Kind parameter can be any of these values:
+
Value Meaning
+
fkCommand
fkHandle
Menu command number used by Windows WM_COMMAND message
Menu handle
+
fkShortCut Menu shortcut +
Example
This example uses a label, a button, and a main menu component. The menu is a File
F
menu that contains Open, Save, and Close commands. Delphi automatically names the
menu items that are the commands, Open1, Save1, and Close1. The Open1 menu item has
a ShortCut value of F3. The code locates the menu item that has the specified shortcut
and reports the name of the menu item in the caption of the label. Note that the shortcut
is specified as a virtual key code. You can find a list of virtual key codes in the Help
system. Search for the Virtual Key Codes topic.
procedure TForm1.Button1Click(Sender: TObject);
var
ItemName: TMenuItem;
begin
ItemName := MainMenu1.FindItem(VK_F3, fkShortCut);
Label1.Caption := ItemName.Name;
end;
See also
Command property, ShortCut property, TMenuItem component
FindKey method
Applies to
TTable component
Declaration
function FindKey(const KeyValues: array of const): Boolean;
The FindKey method searches the database table to find a record whose index fields match
those passed in KeyValues. FindKey takes a comma-delimited array of values as its
argument, where each value corresponds to a index column in the underlying table. The
values can be literals, variables, null, or nil. If the number of values supplied is less than
the number of columns in the database table, then the remaining values are assumed to
be null. FindKey will search for values specified in the array in the current index.
FindKey does the following:
• Puts the TTable in SetKey state.
• Finds the record in the table that matches the specified values. If a matching record is
found, it moves the cursor there, and returns True.
• If a matching record is not found, it does not move the cursor, and returns False.
Example
{ Search for CustNo = ‘1234’ }
if Table1.FindKey([‘1234’]) then
ShowMessage(‘Customer Found’);
See also
FindNearest method, GotoKey method
FindNearest method
Applies to
TTable component
Declaration
procedure FindNearest(const KeyValues: array of const);
The FindNearest method moves the cursor to the first record whose index fields’ values
are greater than or equal to those passed in KeyValues. The search begins at the first
record, not at the current cursor position. This method can be used to match columns of
string data type only. If you do not supply values for each field in the index key, any
unassigned fields will use a null value.
FindNearest works by default on the primary index column. To search the table for
values in other indexes, you must specify the field name in the table’s IndexFieldNames
property or the name of the index in the IndexName property.
The KeyExclusive property indicates whether a search will position the cursor on or after
the specified record being searched for.
Note With Paradox or dBASE tables, FindNearest works only with indexed fields. With SQL
databases, it can work with any columns specified in the IndexFieldNames property.
Example
{ Search for CustNo >= ‘1234’ }
Table1.FindNearest([‘1234’]);
See also
FindKey method, GotoKey method, GotoNearest method, TField component
Example
This example uses a label, a button named Search, and a button named Again on a form.
When the user clicks the Search button, the first file in the specified path is found, and
the name and the number of bytes in the file appear in the label's caption. Each time the
user clicks the Again button, the next matching file name and size is displayed in the
label:
var
SearchRec: TSearchRec;
procedure TForm1.SearchClick(Sender: TObject);
begin
FindFirst('c:\delphi\bin\*.*', faAnyFile, SearchRec);
Label1.Caption := SearchRec.Name + ' is ' + IntToStr(SearchRec.Size) +
' bytes in size';
end;
procedure TForm1.AgainClick(Sender: TObject);
begin
FindNext(SearchRec);
Label1.Caption := SearchRec.Name + ' is ' + IntToStr(SearchRec.Size) +
' bytes in size';
end;
See also
FindFirst function
FindText property
Applies to
TFindDialog, TReplaceDialog components
Declaration
property FindText: string;
The FindText property contains the string your application can search for if it uses the
Find dialog box.
You can specify a FindText value before the user displays the Find dialog box so that
when it appears, the FindText value appears in the Find What edit box. The user can
then either accept or change the FindText value before choosing the Find Next button in
the dialog box.
Example
The following OnFind event handler searches a memo component for the text specified
in the FindText property of a find dialog component. If found, the first occurrence of the
text in Memo1 is selected. The code uses the Pos function to compare strings, and stores
the number of characters to skip when determining the selection position in the
SkipChars variable. Because there is no handling of case, whole word, or search direction
in this algorithm, it is assumed that the Options property of FindDialog1 was set to
[frHideMatchCase, frHideWholeWord, frHideUpDown].
procedure TForm1.FindDialog1Find(Sender: TObject);
var
I, J, PosReturn, SkipChars: Integer;
begin
For I := 0 to Memo1.Lines.Count do
begin
PosReturn := Pos(FindDialog1.FindText,Memo1.Lines[I]);
if PosReturn <> 0 then {found!}
begin
Skipchars := 0;
for J := 0 to I - 1 do
Skipchars := Skipchars + Length(Memo1.Lines[J]);
SkipChars := SkipChars + (I*2);
SkipChars := SkipChars + PosReturn - 1;
Memo1.SetFocus;
Memo1.SelStart := SkipChars;
Memo1.SelLength := Length(FindDialog1.FindText);
end;
end;
end;
See also
ReplaceText property
First method
Applies to
TList object; TQuery, TStoredProc, TTable components
See also
IndexOf method, Last method
See also
Last method, MoveBy method, Next method, Prior method, SetRange method,
SetRangeStart method
FirstIndex property
Applies to
TTabSet component
Declaration
property FirstIndex: Integer;
Run-time only. The value of the FirstIndex property is the tab that appears in the leftmost
visible position in the tab set control. Any tabs with a lower value in the FirstIndex
property scroll to the left in the tab set control and don’t appear until the user scrolls the
tabs.
The default value of FirstIndex is 0 indicating that the tab with an index of 0 is in the
leftmost position. For example, if you have three tabs labeled First, Second, and Third
with TabIndex values of 0, 1, and 2, respectively, First appears first, by default, because it
has an index value of 0. If you want to shift the tabs so the Second or Third tab appears
leftmost in the tab set control, change the FirstIndex value to 1 or 2.
Example
This example uses a tab set control, a label, and a button on a form.
This code in an event handler creates 20 tabs labeled Tab 1 through Tab 20 when Form1
is created:
procedure TForm1.FormCreate(Sender: TObject);
var
I: Integer;
begin
for I := 0 to 19 do
TabSet11.Tabs.Add('Tab ' + IntToStr(I));
end;
Users can scroll through the tabs. When they click the button, the caption of the first tab
visible in the tab set control is displayed in the label control.
procedure TForm1.Button1Click(Sender: TObject);
var
I: Integer;
begin
Label1.Caption := IntToStr(TabSet11.FirstIndex);
end;
See also
TabIndex property, Tabs property
FixedColor property
Applies to
TDBGrid, TDrawGrid, TStringGrid components
Declaration
property FixedColor: TColor;
The value of the FixedColor property determines the color of nonscrolling or fixed
columns and rows within the grid. Refer to the Color property for a list of the possible
values for FixedColor.
The default color is clBtnFace, the color of the face of a button.
Example
This example uses a draw grid and a button on a form. When the user clicks the button,
the color of the nonscrolling (fixed) rows and columns of the draw grid changes color.
Declaration
property FixedCols: Integer;
The FixedCols property determines the number of nonscrolling columns within a grid.
The default value is 1. Nonscrolling columns remain fixed at the far left of the grid, even
when the user scrolls the other columns. Nonscrolling columns are useful for displaying
row titles that need to remain visible in the grid at all times.
Each grid must have a least one column that isn’t fixed. In other words, the value of the
FixedCols property must always be at least one less than the value of the ColCount
property, which contains the number of columns in the grid.
Example
This example uses a string grid and a button. When the user clicks the button, a message
dialog box appears informing the user that a fixed column number of 2 is
recommended. The dialog box also offers the user an opportunity to accept the
recommended number if the number of fixed columns isn’t already 2. If the user
chooses Yes, the number of fixed columns changes to 2.
procedure TForm1.Button1Click(Sender: TObject);
var
Check: Integer;
begin
if StringGrid1.FixedCols <> 2 then
begin
Check := MessageDlg('2 fixed columns are recommended! Change?',
mtWarning, mbYesNoCancel, 0);
if Check = IdYes then
StringGrid1.FixedCols := 2;
end;
end;
See also
FixedColor property, FixedRows property, LeftCol property
FixedRows property
Applies to
TDrawGrid, TStringGrid components
Declaration
property FixedRows: Integer;
The FixedRows property determines the number of nonscrolling rows within a grid. The
default value is 1. Nonscrolling rows remain fixed at top of the grid, even when the user
scrolls the other rows. Nonscrolling rows are useful for displaying column titles that
need to remain visible in the grid at all times.
Each grid must have a least one row that isn’t fixed. In other words, the value of the
FixedRows property must always be at least one less than the value of the RowCount
property, which contains the number of rows in the grid.
Example
This example uses a string grid and three radio buttons on a form. With the Object
Inspector, specify the following event handler for all OnClick events of the three radio
buttons. As the user selects different radio buttons, the number of fixed rows in the
string grid changes.
procedure TForm1.RadioButton1Click(Sender: TObject);
begin
if RadioButton1.Checked then
StringGrid1.FixedRows := 1
else if RadioButton2.Checked then
StringGrid1.FixedRows := 2
else if RadioButton3.Checked then
StringGrid1.FixedRows := 3;
end;
See also
FixedColor property, FixedCols property, TopRow property
The Precision parameter specifies the requested number of significant digits in the
+
result—the allowed range is 1..18. +
The Decimals parameter specifies the requested maximum number of digits to the left of
the decimal point in the result. +
Precision and Decimals together control how the result is rounded. To produce a result
that always has a given number of significant digits regardless of the magnitude of the +
number, specify 9999 for the Decimals parameter.
The result of the conversion is stored in the specified TFloatRec record as follows:
+
Field Value
F
Exponent Contains the magnitude of the number, i.e. the number of significant digits to the right of
the decimal point. The Exponent field is negative if the absolute value of the number is
less than one. If the number is a NAN (not-a-number), Exponent is set to -32768. If the
number is INF or -INF (positive or negative infinity), Exponent is set to 32767.
Negative True if the number is negative, False if the number is zero or positive.
Digits Contains up to 18 significant digits followed by a null terminator. The implied decimal
point (if any) is not stored in Digits. Trailing zeros are removed, and if the resulting
number is zero, NAN, or INF, Digits contains nothing but the null terminator.
The possible values of the Format parameter, and the meaning of each, are described
below.
Value Meaning
ffGeneral General number format. The value is converted to the shortest possible decimal string
using fixed or scientific format. Trailing zeros are removed from the resulting string, and a
decimal point appears only if necessary. The resulting string uses fixed point format if the
number of digits to the left of the decimal point in the value is less than or equal to the
specified precision, and if the value is greater than or equal to 0.00001. Otherwise the
resulting string uses scientific format, and the Digits parameter specifies the minimum
number of digits in the exponent (between 0 and 4).
ffExponent Scientific format. The value is converted to a string of the form "-d.ddd...E+dddd". The
resulting string starts with a minus sign if the number is negative, and one digit always
precedes the decimal point. The total number of digits in the resulting string (including
the one before the decimal point) is given by the Precision parameter. The "E" exponent
character in the resulting string is always followed by a plus or minus sign and up to four
digits. The Digits parameter specifies the minimum number of digits in the exponent
(between 0 and 4).
ffFixed Fixed point format. The value is converted to a string of the form "-ddd.ddd...". The
resulting string starts with a minus sign if the number is negative, and at least one digit
always precedes the decimal point. The number of digits after the decimal point is given
by the Digits parameter—it must be between 0 and 18. If the number of digits to the left of
the decimal point is greater than the specified precision, the resulting value will use
scientific format.
ffNumber Number format. The value is converted to a string of the form "-d,ddd,ddd.ddd...". The
ffNumber format corresponds to the ffFixed format, except that the resulting string contains
thousand separators taken from WIN.INI.
ffCurrency Currency format. The value is converted to a string that represents a currency amount.
The conversion is controlled by the CurrencyString, CurrencyFormat, NegCurrFormat,
ThousandSeparator, and DecimalSeparator global variables, all of which are initialized from
the Currency Format in the International section of the Windows Control Panel and
WIN.INI. The number of digits after the decimal point is given by the Digits parameter—it
must be between 0 and 18.
For all formats, the actual characters used as decimal and thousand separators are
obtained from the DecimalSeparator and ThousandSeparator global variables.
If the given value is a NAN (not-a-number), the resulting string is 'NAN'. If the given
value is positive infinity, the resulting string is 'INF'. If the given value is negative
infinity, the resulting string is '-INF'.
Declaration
procedure FloodFill(X, Y: Integer; Color: TColor; FillStyle: TFillStyle);
The FloodFill method fills an area of the screen surface using the current brush specified
by the Brush property. The FloodFill method begins at the point at coordinates (X, Y) and
continues in all directions to the color boundary.
The way in which the area is filled is determined by the FillStyle parameter. If FillStyle is
fsBorder, the area fills until a border of the color specified by the Color parameter is
encountered. If FillStyle is fsSurface, the area fills as long as the color specified by the
Color parameter is encountered. fsSurface fills are useful to fill an area with a
multicolored border.
Example
The following code floodfills from the center point of Form1’s client area until the color
black is encountered.
Form1.Canvas.FloodFill(ClientWidth/2, ClientHeight/2, clBlack, fsBorder);
See also
Ellipse method, FillRect method, Polygon method, Rectangle method
Example
var
f: TextFile;
begin
if OpenDialog1.Execute then
begin { open a text file }
AssignFile(f, OpenDialog1.FileName);
Append(f);
Writeln(f, 'I am appending some stuff to the end of the file.');
Flush(f); { ensures that the text was actually written to file }
CloseFile(f);
end;
end;
See also
Format function
Example
{ Set focus to first data-aware component associated with Field1 }
Field1.FocusControl;
FocusControl property
Applies to
TLabel component
Declaration
property FocusControl: TWinControl;
The FocusControl links the label control with another control on the form. If the Caption
of a label includes an accelerator key, the control specified as the value of the
FocusControl property becomes the focused control when the user uses the accelerator
key.
The caption of a label often identifies the purpose of another control on the form, or
directs the user to interact with it. For example, a label placed right above an edit box
might have the caption ’File Name’, indicating the user should type a file name in the
edit box. In this case, making that edit box the value of the label’s FocusControl property
gives the edit box the focus when the user presses Alt+F.
Example
This code displays a line of text in a label on the form and associates the label with an
edit box control. Note that the label caption includes an accelerator key. When the user
presses Alt+N, the edit box control receives the focus:
Label1.Caption := ‘&Name';
Label1.FocusControl := Edit1;
For this example, you need to place the label and edit box control close together to make
sure that users understand that they should enter text in the edit box.
See also
ShowAccelChar property, TabStop property
Focused method
Applies to
All windowed controls
Declaration
function Focused: Boolean;
The Focused method is used to determine whether a windowed control has the focus and
is therefore is the ActiveControl.
Example
This example uses an edit box and a memo on a form. When the user switches the focus
between the two controls, the control that currently has the focus becomes red:
type
TForm1 = class(TForm)
Edit1: TEdit;
Memo1: TMemo;
Button1: TButton;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
procedure ColorControl(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.ColorControl(Sender: TObject);
begin
if Edit1.Focused then
Edit1.Color := clRed
else
Edit1.Color := clWindow;
if Memo1.Focused then
Memo1.Color := clRed
Declaration
property Font: TFont;
The Font property is a font object that controls the attributes of text written on or in the
component or object or sent to the printer. To modify a font, you change the value of the
Color, Name, Size, or Style properties of the font object.
Example
This code changes color of text in a memo control to dark blue:
Memo1.Font.Color := clNavy;
See also
ParentFont property
Declaration
property Font: TFont;
The Font property is the font the Font dialog box returns when the user uses the Font
dialog box. Your application can then use this returned Font value for further
processing.
You can also specify a default font before displaying the Font dialog box; the font name
then appears selected in the Font combo box. Use the Object Inspector to specify a Font
property, or assign a value to Font before using the Execute method to display the dialog
box.
Example
This example uses a button, a Font dialog box, and a label on a form. When the user
clicks the button, the Font dialog box appears. If the user uses the dialog box to change
the font and chooses OK, the caption of the label changes to reflect the user’s font
selection.
procedure TForm1.Button1Click(Sender: TObject);
begin
FontDialog1.Font.Name := 'System';
FontDialog1.Font.Size := 10;
if FontDialog1.Execute then
Label1.Font := FontDialog1.Font;
end;
See also
Color property, Name property, Size property
Fonts property
Applies to
TPrinter object; TScreen component
Declaration
property Fonts: TStrings;
Run-time and read only. The Fonts property for the screen component returns a list of
fonts supported by the screen.
The Fonts property for a printer object holds a list of fonts supported by the printer. The
list contains TrueType fonts even if the printer doesn’t support them natively because
the Windows Graphics Device Interface (GDI) can draw TrueType fonts accurately
when a print job uses them.
Example
This code displays the fonts supported by the screen in a FontList list box when the user
clicks the ListFonts button:
procedure TForm1.ListFontsClick(Sender: TObject);
var
FontIndex: Integer;
begin
FontList.Clear;
FontList.Sorted := True;
FontList.Items := Screen.Fonts;
end;
Example
This example uses a label and a button on a form. When the user clicks the button, all the
directories along the specified path that don’t exist are created. The results are reported
in the caption of the label:
procedure TForm1.Button1Click(Sender: TObject);
var
Dir: string;
begin
Dir := 'C:\APPS\SALES\LOCAL';
ForceDirectories(Dir);
if DirectoryExists(Dir) then
Label1.Caption := Dir + ' was created'
end;
See also
DirectoryExists function, SelectDirectory function
Format strings
Format strings passed to the string formatting routines contain two types of objects—
plain characters and format specifiers. Plain characters are copied verbatim to the
resulting string. Format specifiers fetch arguments from the argument list and apply
formatting to them.
Format specifiers have the following form:
"%" [index ":"] ["-"] [width] ["." prec] type
A format specifier begins with a % character. After the % come the following, in this
order:
• An optional argument index specifier, [index ":"]
• An optional left justification indicator, ["-"]
• An optional width specifier, [width]
• An optional precision specifier, ["." prec]
• The conversion type character, type
The following table summarizes the possible values for type:
StrLFmt function
FormatChars property
Applies to
TDDEClientConv component
Declaration
property FormatChars: Boolean;
The FormatChars property determines if certain characters are filtered out of text data
transferred from a DDE server application. Some DDE server applications transfer
backspaces, linefeeds, carriage returns, and tabs with the text data. Sometimes, this can
cause incorrect spacing, line breaks, or characters in the DDE client data. If this is the
case, the characters should be filtered. The default value of FormatChars is False.
If False, all text characters of the linked data from the DDE server appear in the linked
data in the DDE client. If True, ASCII characters 8 (backspace), 9 (tab), 10 (linefeed), and
13 (carriage return) are filtered out and won’t appear in the DDE client data.
Example
The following code formats characters if the DDE service name is “SuperWrd”.
if DDEClientConv.DDEService = ’SuperWrd’ then
DDEClientConv.FormatChars := True;
FormatCount property
Applies to
TClipboard object
See also
Assign method, AsText property, Clipboard variable, GetComponent method, HasFormat
method, SetComponent method
Specifier Displays
c Displays the date using the format given by the ShortDateFormat global variable, followed
by the time using the format given by the LongTimeFormat global variable. The time is not
displayed if the fractional part of the DateTime value is zero.
d Displays the day as a number without a leading zero (1-31).
dd Displays the day as a number with a leading zero (01-31).
ddd Displays the day as an abbreviation (Sun-Sat) using the strings given by the
ShortDayNames global variable.
dddd Displays the day as a full name (Sunday-Saturday) using the strings given by the
LongDayNames global variable.
ddddd Displays the date using the format given by the ShortDateFormat global variable.
dddddd Displays the date using the format given by the LongDateFormat global variable.
m Displays the month as a number without a leading zero (1-12). If the m specifier
immediately follows an h or hh specifier, the minute rather than the month is displayed.
mm Displays the month as a number with a leading zero (01-12). If the mm specifier
immediately follows an h or hh specifier, the minute rather than the month is displayed.
mmm Displays the month as an abbreviation (Jan-Dec) using the strings given by the
ShortMonthNames global variable.
Specifier Displays
mmmm Displays the month as a full name (January-December) using the strings given by the
LongMonthNames global variable.
yy Displays the year as a two-digit number (00-99).
yyyy Displays the year as a four-digit number (0000-9999).
h Displays the hour without a leading zero (0-23).
hh Displays the hour with a leading zero (00-23).
n Displays the minute without a leading zero (0-59).
nn Displays the minute with a leading zero (00-59).
s Displays the second without a leading zero (0-59).
ss Displays the second with a leading zero (00-59).
t Displays the time using the format given by the ShortTimeFormat global variable.
tt Displays the time using the format given by the LongTimeFormat global variable.
am/pm Uses the 12-hour clock for the preceding h or hh specifier, and displays 'am' for any hour
before noon, and 'pm' for any hour after noon. The am/pm specifier can use lower, upper,
or mixed case, and the result is displayed accordingly.
a/p Uses the 12-hour clock for the preceding h or hh specifier, and displays 'a' for any hour
before noon, and 'p' for any hour after noon. The a/p specifier can use lower, upper, or
mixed case, and the result is displayed accordingly.
ampm Uses the 12-hour clock for the preceding h or hh specifier, and displays the contents of the
TimeAMString global variable for any hour before noon, and the contents of the
TimePMString global variable for any hour after noon.
/ Displays the date separator character given by the DateSeparator global variable.
: Displays the time separator character given by the TimeSeparator global variable.
'xx'/"xx" Characters enclosed in single or double quotes are displayed as-is, and do not affect
formatting.
Format specifiers may be written in upper case as well as in lower case letters—both
produce the same result.
If the string given by the Format parameter is empty, the date and time value is
formatted as if a 'c' format specifier had been given.
Example
The following example assigns 'The meeting is on Wednesday, February 15, 1995 at
10:30 AM' to the string variable S.
S := FormatDateTime('"The meeting is on" dddd, mmmm d, yyyy, ' +
'"at" hh:mm AM/PM', StrToDateTime('2/15/95 10:30am'));
FormatFloat formats the floating-point value given by Value using the format string
+
given by Format. The following format specifiers are supported in the format string: +
Specifier
0
Represents
Digit placeholder. If the value being formatted has a digit in the position where the '0'
+
appears in the format string, then that digit is copied to the output string. Otherwise, a '0'
is stored in that position in the output string. +
# Digit placeholder. If the value being formatted has a digit in the position where the '#'
appears in the format string, then that digit is copied to the output string. Otherwise,
nothing is stored in that position in the output string.
+
. Decimal point. The first '.' character in the format string determines the location of the
decimal separator in the formatted value; any additional '.' characters are ignored. The F
actual character used as a the decimal separator in the output string is determined by the
DecimalSeparator global variable. The default value of DecimalSeparator is specified in the
Number Format of the International section in the Windows Control Panel.
, Thousand separator. If the format string contains one or more ',' characters, the output
will have thousand separators inserted between each group of three digits to the left of the
decimal point. The placement and number of ',' characters in the format string does not
affect the output, except to indicate that thousand separators are wanted. The actual
character used as a the thousand separator in the output is determined by the
ThousandSeparator global variable. The default value of ThousandSeparator is specified in
the Number Format of the International section in the Windows Control Panel.
E+ Scientific notation. If any of the strings 'E+', 'E-', 'e+', or 'e-' are contained in the format
string, the number is formatted using scientific notation. A group of up to four '0'
characters can immediately follow the 'E+', 'E-', 'e+', or 'e-' to determine the minimum
number of digits in the exponent. The 'E+' and 'e+' formats cause a plus sign to be output
for positive exponents and a minus sign to be output for negative exponents. The 'E-' and
'e-' formats output a sign character only for negative exponents.
'xx'/"xx" Characters enclosed in single or double quotes are output as-is, and do not affect
formatting.
; Separates sections for positive, negative, and zero numbers in the format string.
The locations of the leftmost '0' before the decimal point in the format string and the
rightmost '0' after the decimal point in the format string determine the range of digits
that are always present in the output string.
The number being formatted is always rounded to as many decimal places as there are
digit placeholders ('0' or '#') to the right of the decimal point. If the format string contains
no decimal point, the value being formatted is rounded to the nearest whole number.
If the number being formatted has more digits to the left of the decimal separator than
there are digit placeholders to the left of the '.' character in the format string, the extra
digits are output before the first digit placeholder.
To allow different formats for positive, negative, and zero values, the format string can
contain between one and three sections separated by semicolons.
• One section: The format string applies to all values.
• Two sections: The first section applies to positive values and zeros, and the second
section applies to negative values.
• Three sections: The first section applies to positive values, the second applies to
negative values, and the third applies to zeros.
If the section for negative values or the section for zero values is empty, that is if there is
nothing between the semicolons that delimit the section, the section for positive values
is used instead.
If the section for positive values is empty, or if the entire format string is empty, the
value is formatted using general floating-point formatting with 15 significant digits,
corresponding to a call to FloatToStrF with the ffGeneral format. General floating-point
formatting is also used if the value has more than 18 digits to the left of the decimal
point and the format string does not specify scientific notation.
Example
The following table shows some sample formats and the results produced when the
formats are applied to different values:
Formats property
Applies to
TClipboard object
Declaration
property Formats[Index: Integer]: Word;
Run-time and read only. The Formats property array contains a list of all the formats the
Clipboard contains. Usually when an application copies or cuts something to the
Clipboard, it places it there in multiple formats.
Your application can place items of a particular format on the Clipboard and retrieve
items with a particular format from the Clipboard if the format is in the Formats array.
You can find out if a particular format is available on the Clipboard with the HasFormat
method.
The Index parameter of the Formats property lets you access a format by its position in
the array.
FormCount property
Applies to
TScreen component
Declaration
property FormCount: Integer;
Run-time and read only. The FormCount property value contains the number of forms
displayed on the screen.
Example
The following code adds the name of all forms on the screen to ListBox1 when Button1 is
clicked.
procedure TForm1.Button1Click(Sender: TObject);
var
I: Integer;
begin
For I := 0 to Screen.FormCount-1 do
ListBox1.Items.Add(Screen.Forms[I].Name);
end;
See also
Forms property, Screen variable
Forms property
Applies to
TScreen component
Declaration
property Forms[Index: Integer]: TForm;
Description
Run-time and read only. The Forms property lets you access a form on the screen by
specifying its position in the list of forms kept by the TScreen component using its Index
value. The first form has an index value of 0, the second has an index value of 1, and so
on.
Example
The following code adds the name of all forms on the screen to ListBox1 when Button1 is
clicked.
procedure TForm1.Button1Click(Sender: TObject);
var
I: Integer;
begin
For I := 0 to Screen.FormCount-1 do
ListBox1.Items.Add(Screen.Forms[I].Name);
end;
See also
FormCount property, Screen variable
FormStyle property
Applies to
TForm component
Declaration
property FormStyle: TFormStyle;
The FormStyle property determines the style of the form. These are the possible values
and their meanings:
Value Meaning
fsNormal The form is neither an MDI parent window nor an MDI child window.
fsMDIChild The form is an MDI child window.
fsMDIForm The form is an MDI parent window.
fsStayOnTop This form remains on top of other forms in the project, except any others that also have
FormStyle set to fsStayOnTop.
forms contained within the MDI parent form. You must use the Object Inspector to set
+
the child form’s Visible property to True or your child form won’t appear. You can have
as many child forms as you like.
+
Example
+
This example ensures the main form of the application is an MDI parent form: +
+
procedure TForm1.FormCreate(Sender: TObject);
begin
if FormStyle <> fsMDIForm then
FormStyle := fsMDIForm;
if FormStyle = fsMDIForm then F
Edit1.Text := 'MDI form'
else
Edit1.Text := 'Not an MDI form'; {This line never runs}
end;
See also
CreateForm method, MainForm property, Visible property
Example
var
R: Real;
begin
R := Frac(123.456); { 0.456 }
R := Frac(–123.456); { –0.456 }
end;
See also
Int function
FrameRect method
Applies to
TCanvas object
Declaration
procedure FrameRect(const Rect: TRect);
The FrameRect method draws a rectangle using the Brush of the canvas to draw the
border. FrameRect does not fill the interior of the rectangle with the Brush pattern.
Example
The following code displays the text “Hello, world!” in a rectangle defined by the
coordinates (10, 10) and (100, 100). After displaying the text with the TextRect method,
the code draws a black, vertical line frame around the rectangle.
var
TheRect: TRect;
begin
Form1.Canvas.Brush.Color := clBlack;
Form1.Canvas.Brush.Style := bsVertical;
TheRect.Top := 10;
TheRect.Left := 10;
TheRect.Bottom := 100;
TheRect.Right := 100;
Form1.Canvas.TextRect(TheRect,10,10,'Hello, world!');
Form1.Canvas.FrameRect(TheRect);
end;
See also
Brush property, Rect function, TextRect method
Frames property
Applies to
TMediaPlayer component
Declaration
property Frames: Longint;
Run-time-only. The Frames property specifies the number of frames the Step method
steps forward or the Back method steps backward.
Frames defaults to ten percent of the length of the currently loaded medium, which is
specified by the Length property.
Note The definition of frame varies by multimedia device. For display media, a frame is one
still image.
Example
The following code frees an object called MyObject:
MyObject.Free;
See also
Destroy method, Release method
FreeBookmark method
Applies to
TTable, TQuery, TStoredProc components
Declaration
procedure FreeBookmark(Bookmark: TBookmark);
Use the FreeBookmark method in combination with the GetBookmark and GotoBookmark
methods. FreeBookmark releases the system resources reserved during a call to
GetBookmark.
Example
var MyBookmark: TBookmark;
...
with Table1 do
begin
{ Save the current record position in MyBookmark }
MyBookmark := GetBookmark;
... { Other code here }
{ Return to the record associated with MyBookmark }
GotoBookmark(MyBookmark);
{ Release the resources for MyBookmark }
FreeBookmark(MyBookmark);
end;
See also
Dispose procedure, GetMem procedure, New procedure
FromPage property
Applies to
TPrintDialog component
Declaration
property FromPage: Integer;
The value of the FromPage property determines on which page the print job begins. The
default value is 0.
Example
This example uses a Print dialog box on a form. These lines set up the Print dialog box so
that when it appears, the default values of 1 and 1 are the default starting and ending
values for the Pages From and To edit boxes.
PrintDialog1.Options := [poPageNums];
PrintDialog1.FromPage := 1;
PrintDialog1.ToPage := 1;
See also
ToPage property
FullCollapse method
Applies to
TOutline component
Declaration
procedure FullCollapse;
FullCollapse collapses all the items within an outline. When an item is collapsed, its
Expanded property is set to False, its subitems are hidden, and the closed or plus pictures
might be displayed, depending on the outline style specified in the OutlineStyle
property.
Example
The following code collapses the outline if the selected item is visible.
if Outline[Outline1.SelectedItem].IsVisible then
Outline1.FullCollapse;
See also
Collapse method, Expand method, FullExpand method, OnCollapse event, PictureClosed
property, PicturePlus property
FullExpand method
Applies to
TOutlineNode object; TOutline component
Declaration
procedure FullExpand;
FullExpand expands the items within an outline. If the FullExpand method belongs to a
TOutline component, all items in the outline are expanded. If the FullExpand method
belongs to a TOutlineNode object, only the items on the same branch as the outline node
are expanded. This means that all subitems are expanded, and all parents up to the top
item on level 1 (specified by the TopItem property) are expanded. No items on other
branches (with different level 1 parents) are expanded.
When an item is expanded, its Expanded property is set to True, its subitems are
displayed, and the open or minus pictures might be displayed, depending on the
outline style specified in the OutlineStyle property.
Declaration
property FullPath: string;
Run-time and read only. The FullPath property specifies the path of outline items from
the top item on level 1 to the item contained by the TOutlineNode. The path consists of
the values of the Text properties of the outline items separated by the string specified in
the ItemSeparator property of the TOutline component.
Example
The following code displays the full path of the selected outline item in Label1:
Label1.Caption := Outline1.Items[Outline1.SelectedItem].FullPath;
See also
Items property, SelectedItem property
GetAliasNames method
Applies to
TSession component
Declaration
procedure GetAliasNames(List: TStrings);
The GetAliasNames method clears the parameter List and adds to it the names of all
defined BDE aliases. Application-specific aliases are not included.
Example
Session.GetAliasNames(MyStringList);
See also
GetDataBaseNames method, Session variable
GetAliasParams method
Applies to
TSession component
Declaration
procedure GetAliasParams(const AliasName: string; List: TStrings);
The GetAliasParams method clears List and adds to it the parameters associated with the
BDE alias passed in AliasName.
Example
Session.GetAliasParams(MyStringList);
See also
Session variable
GetAsHandle method
Applies to
TClipboard object
Declaration
function GetAsHandle (Format: Word): THandle;
The GetAsHandle method returns the data from the Clipboard in a Windows handle for
the format specified in the Format parameter. See the Windows API Help file for
information about the available formats.
Your application doesn’t own the handle, so it should copy the data before using it.
Example
The following code locks the memory for text on the Clipboard, then converts the text to
a Pascal-style string.
var
TheClipboard: TClipboard;
MyHandle: THandle;
TextPtr: PChar;
MyString: string;
begin
MyHandle := TheClipboard.GetAsHandle(CF_TEXT);
Example
var MyBookmark: TBookmark;
...
with Table1 do
begin
{ Save the current record position in MyBookmark }
MyBookmark := GetBookmark;
... { Other code here }
{ Return to the record associated with MyBookmark }
GotoBookmark(MyBookmark);
{ Release the resources for MyBookmark }
FreeBookmark(MyBookmark);
end;
GetComponent method
Applies to
TClipboard object
Declaration
function GetComponent(Owner, Parent: TComponent): TComponent;
The GetComponent method retrieves a component from the Clipboard and places it
according to the value of the Owner and Parent parameters. With Owner, specify the
component that becomes the owner of the retrieved component—usually this is a form.
With Parent, specify the component that becomes the parent of the component. Both
Owner and Parent can be nil.
Example
This example uses a button and a group box on a form. When the user clicks the button,
the button is copied to the Clipboard and then retrieved from the Clipboard and placed
in the new parent of the button, the group box. The name of the original button is
changed to an empty string to avoid having two components with the same name at the
same time.
implementation
uses Clipbrd;
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
Clipboard.SetComponent(Button1); { copies button to the Clipboard }
Button1.Name := ''; { prevents having two components with the same name }
Clipboard.GetComponent(Self, GroupBox1); { retrieves button from Clipboard and }
end; { places it in the group box }
initialization
RegisterClasses([TButton]); { registers the TButton class }
end.
See also
AsText property, Owner property, Parent property, SetComponent method
GetData method
Applies to
TParam object; TBCDField, TBlobField, TBooleanField, TBytesField, TCurrencyField,
TDateField, TDateTimeField, TFloatField, TGraphicField, TIntegerField, TMemoField,
TSmallintField, TStringField, TTimeField, TVarBytesField, TWordField components
For fields
Declaration
function GetData(Buffer: Pointer): Boolean;
GetData is the method used to obtain “raw” data from the field. Unlike the AsString,
+
DisplayText, and Text properties, GetData performs no translation or interpretation of the
data. Buffer must have sufficient space allocated for the data. Use the DataSize property
+
to determine the space required. If the data is NULL, GetData returns False and no data
is transferred to Buffer. Otherwise, it returns True.
+
Example
+
{ Retrieve the “raw” data from Field1 }
with Field1 do
+
begin
{ Allocate space } +
GetMem(Buffer, DataSize);
if not Field1.GetData(Buffer) then
MessageDlg(FieldName + ' is NULL’, mtInformation, [mbOK], 0)
G
else { Do something with the data };
{ Free the space }
FreeMem(Buffer, DataSize);
end;
Example
var Buffer: Pointer;
{ Allocate enough space to hold the CustNo data }
GetMem(Buffer, Query1.ParamByName(‘CustNo’).GetDataSize);
{ Retrieve the data }
Query1.ParamByName(‘CustNo’).GetData(Buffer);
See also
SetData method
GetDatabaseNames method
Applies to
TSession component
Declaration
procedure GetDatabaseNames(List: TStrings);
The GetDatabaseNames method clears List and adds to it the names of all BDE aliases and
application-specific aliases.
Example
Session.GetDatabaseNames(MyStringList);
See also
GetAliasNames method, Session variable
GetDataItem method
Applies to
TOutline component
Declaration
function GetDataItem(Value: Pointer): Longint;
The GetDataItem method returns the Index value of the first outline item that contains the
data specified in the Value parameter in its Data property. Use GetDataItem when you
have a pointer to data and you want to know which outline item contains the data.
Example
The following code displays the Text of the outline item that points to the variable P3 in
its Data property. The text is displayed in a label.
Label1.Caption := Outline1.Items[GetDataItem(p3)].Text;
See also
GetItem method, GetTextItem method
GetDataSize method
Applies to
TParam object
Declaration
function GetDataSize: Word;
The GetDataSize method returns the number of bytes required to hold the parameter’s
value. Use GetDataSize in conjunction with the GetData method to allocate memory for
the parameter’s data.
Example
var Buffer: Pointer;
Example
var
s : string;
begin
GetDir(0,s); { 0 = Current drive }
MessageDlg('Current drive and directory: ' + s, mtInformation, [mbOk] , 0);
end;
See also
ChDir function, MkDir procedure, RmDir procedure
GetDriverNames method
Applies to
TSession component
Declaration
procedure GetDriverNames(List: TStrings);
The GetDriverNames method clears List and adds to it the names of all BDE drivers
currently installed. This will not include ‘PARADOX’ or ‘DBASE’, since these databases
are handled by the driver named ‘STANDARD’.
Example
Session.GetDriverNames(MyStringList);
See also
Session variable
GetDriverParams method
Applies to
TSession component
Declaration
procedure GetDriverParams(const DriverName: string; List: TStrings);
The GetDriverParams method clears List and adds to it the default parameters for the
driver named in DriverName parameter. The driver named ‘STANDARD’ (used for
Paradox and dBASE tables) has only one parameter, ‘PATH=’. SQL drivers will have
varying parameters.
Example
Session.GetDriverParams(MyStringList);
See also
Session variable
GetFieldNames method
Applies to
TTable, TQuery, TStoredProc components
Declaration
procedure GetFieldNames(List: TStrings);
The GetFieldNames method clears the TStrings argument, List, and then adds the name of
each field in the dataset to it.
Example
var FieldNames: TStringList;
...
{ Initialize FieldNames to hold the names }
FieldNames := TStringList.Create;
{ Get the names }
Table1.GetFieldNames(FieldNames);
Example
The following code expands the selected outline item if it has children and then selects
the first child.
with Outline1 do
if Items[SelectedItem].HasItems then
begin
Items[SelectedItem].Expanded := True;
SelectedItem := Items[Items[SelectedItem].GetFirstChild];
end;
See also
GetLastChild method, GetNextChild method, GetPrevChild method
GetFormImage method
Applies to
TForm component
Declaration
function GetFormImage: TBitmap;
The GetFormImage returns a bitmap of the form as it appears when printed.
Example
This example uses an image, a button, and a shape component on a form. When the user
clicks the button, an image of the form is stored in the FormImage variable and copied to
the Clipboard. Then image of the form in then copied back to the image component,
producing an interesting result, especially if the button is clicked multiple times.
procedure TForm1.Button1Click(Sender: TObject);
var
FormImage: TBitmap;
begin
FormImage := GetFormImage;
Clipboard.Assign(FormImage);
Image1.Picture.Assign(Clipboard);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Shape1.Shape := stEllipse;
Shape1.Brush.Color := clLime;
Image1.Stretch := True;
end;
See also
PrintScale property
GetHelpContext method
Applies to
TMainMenu component
Declaration
function GetHelpContext(Value: Word; ByCommand: Boolean): THelpContext;
The GetHelpContext method returns a help context number.
See also
HelpContext property, HelpContext method, HelpJump method, OnHelp event
GetIndexForPage method
Applies to
TTabbedNotebook component
See also
SetTabFocus method
GetIndexNames method
Applies to
TTable component
Declaration
procedure GetIndexNames(List: TStrings);
The GetIndexNames method adds the names of all available indexes for the TTable to the
List parameter.
Example
var
MyList: TStringList;
...
MyList := TStringList.Create;
Table1.GetIndexNames(MyList);
{ Do something with the names }
MyList.Free;
See also
IndexName property
GetItem method
Applies to
TOutline component
Declaration
function GetItem(X, Y: Integer): Longint;
The GetItem method returns the Index value of the outline item that resides at the pixel
coordinates (X, Y). Use GetItem when you want to know which outline item is in a
specific screen location.
Example
The following code makes the item at screen coordinates (34,100) the selected item.
Outline1.SelectedItem := Outline1.GetItem(34,100);
See also
GetDataItem method, GetTextItem method
GetItemPath method
Applies to
TDirectoryListBox component
Declaration
function GetItemPath(Index : Integer): string;
The GetItemPath method returns as a string the path of a directory in a directory list box.
Specify the directory with the Index value using the first directory in the list that has an
index value of 0.
Example
This example uses a directory list box, a button, and a label on a form. When the user
selects a directory in the directory list box and clicks the button, the selected directory
opens, and the path of the second directory displayed in the list box appears as the
caption of the label.
procedure TForm1.Button1Click(Sender: TObject);
begin
DirectoryListBox1.OpenCurrent;
Example
The following code expands the selected outline item if it has children and then selects
the last child.
with Outline1 do
if Items[SelectedItem].HasItems then
begin
Items[SelectedItem].Expanded := True;
SelectedItem := Items[Items[SelectedItem].GetLastChild];
end;
See also
GetFirstChild method, GetNextChild method, GetPrevChild method
Example
This code assigns a two-part string as to the Hint property of an edit box and then
displays the “long” or second part of the string as the text of the edit box:
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
Edit1.Hint := 'Name|Enter full name';
Edit1.Text := GetLongHint(Edit1.Hint);
end;
See also
GetShortHint function, OnHint event, ShowHint property
Example
type
TFriendRec = record
Name: string[30];
Age : Byte;
end;
var
p: pointer;
begin
if MaxAvail < SizeOf(TFriendRec) then
MessageDlg('Not enough memory', mtWarning, [mbOk], 0);
else
begin
{ Allocate memory on heap }
GetMem(p, SizeOf(TFriendRec));
{ ...}
{ ...Use the memory... }
{ ...}
{ then free it when done }
FreeMem(p, SizeOf(TFriendRec));
end;
end;
Example
The following code selects the next sibling of the selected item.
with Outline1 do
SelectedItem := Items[SelectedItem].GetNextChild(SelectedItem);
See also
GetFirstChild method, GetLastChild method, GetPrevChild method
Example
The following code shows the form that contains Button2:
GetParentForm(Button2).Show;
See also
ValidParentForm function
GetPassword method
Applies to
TSession component
Declaration
function GetPassword: Boolean;
The GetPassword method invokes the OnPassword event (if any) or displays the default
password dialog box. It then returns True if the user chose the OK button and False if the
user chose the Cancel button.
Example
Session.GetPassword;
See also
Session variable
GetPrevChild method
Applies to
TOutlineNode object
Declaration
function GetPrevChild(Value: Longint): Longint;
The GetPrevChild method returns the Index value of the previous outline item that shares
the same parent item as the item that has an Index value equal to the Value parameter.
This is useful when the previous sibling has subitems, thus its index is not simply one
less than Value. If the item indexed by Value has no previous sibling, GetPrevChild
returns -1.
Example
The following code tests to determine if the selected item has a previous sibling. The
results are displayed in a label.
with Outline1 do
if (Items[SelectedItem].GetPrevChild > -1) then
Label1.Caption := ’Has a prior sibling’
else
Label1.Caption := ’Has no prior sibling’;
See also
GetFirstChild method, GetLastChild method, GetNextChild method
GetResults method
Applies to
TParam object
Declaration
procedure GetResults;
You only need to call this method with a Sybase stored procedure that returns a result
set. GetResults returns the output parameter values from the stored procedure. Usually,
TStoredProc does this automatically, but Sybase stored procedures do not return the
values until the cursor reaches the end of the result set, so you must call GetResults
explicitly.
Example
StoredProc1.Open
while not EOF do
begin
StoredProc1.Next;
{Do Something}
end;
StoredProc1.GetResults;
Edit1.Text := StoredProc1.ParamByName(‘Output’);
GetSelTextBuf method
Applies to
TDBEdit, TDBMemo, TEdit, TMaskEdit, TMemo components
Declaration
function GetSelTextBuf(Buffer: PChar; BufSize: Integer): Integer;
The GetSelTextBuf method copies the selected text from the edit box or memo control
into the buffer pointed to by Buffer, up to a maximum of BufSize characters, and returns
the number of characters copied.
You should need to use the GetSelTextBuf method only if you are working with strings
longer than 255 characters. Because an Object Pascal style string has a limit of 255
characters, such properties as Text for an edit box, Items for a list box, and Lines for a
memo control do not allow you to work with strings longer than 255 characters.
GetSelTextBuf and the corresponding SetSelTextBuf methods use null-terminated strings
that can be up to 64K in length.
Example
procedure TForm1.Button1Click(Sender: TObject);
var
Buffer: PChar;
Size: Integer;
begin
Size := Edit1.SelLength; {Get length of selected text in Edit1}
Inc(Size); {Add room for null character}
GetMem(Buffer, Size); {Creates Buffer dynamic variable}
Edit1.GetSelTextBuf(Buffer,Size); {Puts Edit1.Text into Buffer}
Edit2.Text := StrPas(Buffer); {Converts string in Buffer into Pascal-style string}
FreeMem(Buffer, Size); {Frees memory allocated to Buffer}
end;
See also
GetLongHint function, OnHint event, ShowHint property
GetStoredProcNames method
Applies to
TSession component
Declaration
procedure GetStoredProcNames(const DatabaseName: string; List: TStrings);
GetStoredProcNames returns a list of all stored procedures defined for the specified SQL
database. This method is not valid for Paradox or dBASE databases.
Example
Session.GetStoredProcNames(‘IB_EMPLOYEE’, MyStringList);
See also
Session variable
GetTableNames method
Applies to
TSession component
Declaration
procedure GetTableNames(const DatabaseName, Pattern: string;
Extensions, SystemTables: Boolean; List: TStrings);
The GetTableNames method clears List and then adds to it the names of all the tables in
the database referenced by DatabaseName. The Pattern parameter will limit the table
names to those matching Pattern.
For SQL servers, set SystemTables to True to obtain system tables in addition to user
tables. For desktop (non-SQL) databases, set Extensions to True to include file-name
extensions in the table names.
Example
Session.GetTableNames(‘DBDEMOS‘, False, False, MyStringList);
See also
Session variable
GetText method
Applies to
TStrings, TStringList objects
Declaration
function GetText: PChar;
The GetText method returns a string list as a null-terminated string. GetText is useful
when working with components that contain blocks of text made up of more than one
string. For example, a memo component (TMemo) can contain multiple strings. When
you want to return the entire list of strings in a memo component all at once, use the
GetText method.
Example
The following code returns the text in the items of an outline to one variable called
MyVar.
MyVar := Outline1.Lines.GetText;
See also
SetText method
Example
This example copies the text in an edit box into a null-terminated string, and puts this
string in another edit box when the user clicks the button on the form.
procedure TForm1.Button1Click(Sender: TObject);
var
Buffer: PChar;
Size: Byte;
begin
Size := Edit1.GetTextLen; {Get length of string in Edit1}
Inc(Size); {Add room for null character}
GetMem(Buffer, Size); {Creates Buffer dynamic variable}
Edit1.GetTextBuf(Buffer,Size); {Puts Edit1.Text into Buffer}
Edit2.Text := StrPas(Buffer); {Converts Buffer to a Pascal-style string]
FreeMem(Buffer, Size); {Frees memory allocated to Buffer}
end;
See also
GetSelTextBuf method, SetTextBuf method
GetTextItem method
Applies to
TOutline component
Declaration
function GetTextItem(Value: string): Longint;
The GetTextItem method returns the Index value of the first outline item that contains the
string specified in the Value parameter in its Text property. Use GetTextItem when you
want to know which outline item is identified by a string.
Example
The following code returns the index of the outline item that contains the text ’Perry’ to
a variable called PerryIndex.
PerryIndex := Outline1.GetTextItem(’Perry’);
See also
GetDataItem method, GetItem method
GetTextLen method
Applies to
All controls
Declaration
function GetTextLen: Integer;
The GetTextLen method returns the length of the control’s text. The most common use of
GetTextLen is to find the size needed for a text buffer in the GetTextBuf method.
Example
This example uses two edit boxes and a button on a form. When the user clicks the
button, the length of the text in the Edit1 is displayed in Edit2.
procedure TForm1.Button1Click(Sender: TObject);
var
Size: Integer;
begin
Size := Edit1.GetTextLen;
Edit2.Text := ('Edit1 has ' + IntToStr(Size) + 'characters in it');
end;
See also
GetTextBuf method
Glyph property
Applies to
TBitBtn, TSpeedButton controls
If only one image is present, Delphi attempts to represent the other states by altering the
image slightly for the different states, although the stay down state is always the same as
the up state. If you aren’t satisfied with the results, you can provide one or more
additional images in the bitmap.
If you have multiple images in a bitmap, you must specify the number of images that
are in the bitmap with the NumGlyphs property. All images must be the same size and
next to each other in a horizontal row.
Example
This example uses a bitmap button on a form. When the application runs and the form is
created, a bitmap is placed on the bitmap button.
procedure TForm1.FormCreate(Sender: TObject);
begin
BitBtn1.Glyph.LoadFromFile('TARTAN.BMP');
end;
These lines of code load a four-image bitmap into the Glyph property of a speed button,
and specify the appropriate value for the NumGlyphs property:
SpeedButton1.Glyph.LoadFromFile(‘MYBITMAP.BMP’);
SpeedButton1.NumGlyphs := 4;
See also
Kind property, Layout property, Margin property, ModalResult property, NumGlyphs
property, Spacing property, TBitmap object
GotoBookmark method
Applies to
TTable, TQuery, TStoredProc components
Declaration
procedure GotoBookmark(Bookmark: TBookmark);
The GotoBookmark method moves the cursor to the record corresponding to the
bookmark obtained through a call to GetBookmark. While you must eventually call the
FreeBookmark method to release the resources reserved during the call to GetBookmark,
you are free to make as many calls to GotoBookmark as you wish before calling
FreeBookmark. If the Bookmark parameter is nil, GotoBookmark does nothing.
Example
var MyBookmark: TBookmark;
...
with Table1 do
begin
{ Save the current record position in MyBookmark }
MyBookmark := GetBookMark;
... { Other code here }
{ Return to the record associated with MyBookmark }
GotoBookMark(MyBookMark);
{ Release the resources for MyBookmark }
FreeBookmark(MyBookmark);
end;
GotoCurrent method
Applies to
TTable component
Declaration
procedure GotoCurrent(Table: TTable);
Use the GotoCurrent method to synchronize the positions of two TTable components that
use the same database table. GotoCurrent changes the position of the table to match that
of the Table parameter.
Note Both tables must have the same DatabaseName and TableName or a “table mismatch”
exception will be raised.
Example
Table1.GotoCurrent(Table2);
Example
with Table1 do
begin
EditKey;
FieldByName(‘CustNo’).AsFloat := 610;
GotoKey;
end;
See also
FindKey method
GotoNearest method
Applies to
TTable component
Declaration
procedure GotoNearest;
The GotoNearest method is used with the EditKey or SetKey method to move to a record
in the dataset whose index fields are greater than or equal to the IndexFields property.
Call SetKey first to put the TTable in SetKey state, modify the fields of the key, and finally
call GotoNearest to perform the move.
The KeyExclusive property indicates whether a search will position the cursor on or after
the specified record being searched for.
Note You do not have to assign a value for each field in the index key. Any unassigned field
will use a NULL value.
The search begins at the first record in the table, not at the current cursor position.
Example
with Table1 do
begin
SetKey;
FieldByName(‘State’).AsString := ‘CA‘;
FieldByName(‘City’).AsString := ‘Santa‘;
GotoNearest;
end;
See also
GotoKey method, KeyFieldCount property, SetKey method
Example
uses WinCrt;
var
C: PChar;
begin
GotoXY(10,10);
Writeln('Hello');
end;
See also
CursorTo procedure, WhereX function, WhereY function
Graphic property
Applies to
TPicture object
Example
The following code tests to determine if the graphic in Picture1 is an icon. If so, the
minimized icon of Form1 is set to the graphic.
if GraphicExtension(Picture1.Graphic)=’.ICO’ then
Form1.Icon := Picture1.Graphic;
See also
GraphicFilter function
The GraphicFilter function returns a filter string compatible with the Filter property value
of an Open or Save dialog box. The GraphicClass parameter can be one of these values:
TBitmap, TGraphic, TIcon, or TMetafile. These are the strings that are returned for each
class:
Example
This code displays an Open dialog box with the TBitmap filter string in the List Files of
Type combo box:
OpenDialog1.DefaultExt := GraphicExtension(TBitmap);
OpenDialog1.Filter := GraphicFilter(TBitmap);
if OpenDialog1.Execute then
...
See also
GraphicExtension function, TOpenDialog component, TSaveDialog component
GridHeight property
Applies to
TDrawGrid, TStringGrid components
Declaration
property GridHeight: Integer;
Run-time and read only. The GridHeight property is the height of the grid in pixels. If the
grid is too tall to be fully displayed causing the user to scroll to see its entire contents, the
value of GridHeight is the same as the ClientHeight property value for the grid.
Example
This example uses a string grid and a label on a form. The height of the grid appears in
the caption of the label.
procedure TForm1.FormCreate(Sender: TObject);
var
ARow, ACol: Integer;
begin
with StringGrid1 do
begin
for ARow := 1 to RowCount - 1 do
Declaration
property GridLineWidth: Integer;
The GridLineWidth property determines the width of the lines between the cells in the
grid. The default value is 1 pixel. Larger values create heavier lines.
Example
This example includes a draw grid on a form. When the application runs and the form is
created, the width of the lines on the draw grid changes if the default column width of
the grid is over 90 pixels wide:
procedure TForm1.FormCreate(Sender: TObject);
begin
with DrawGrid1 do
begin
if DefaultColWidth > 90 then
GridLineWidth := 2
else
GridLineWidth := 1;
end;
end;
See also
ColWidths property, DefaultColWidth property, GridHeight property, GridWidth property,
RowHeights property
GridWidth property
Applies to
TDrawGrid, TStringGrid components
Declaration
property GridWidth: Integer;
Run-time and read only. The GridWidth property is the width of the grid in pixels. If the
grid is too wide to be fully displayed causing the user to scroll it to see its entire
contents, the value of GridWidth is the same as the ClientWidth property value for the
grid.
Example
This example uses a string grid and a label on a form. The label reports the width of the
grid.
procedure TForm1.FormCreate(Sender: TObject);
var
ARow, ACol: Integer;
begin
with StringGrid1 do
begin
for ARow := 1 to RowCount - 1 do
for ACol := 1 to ColCount - 1 do
Cells[ARow, ACol] := 'Pascal';
end;
Label1.Caption := IntToStr(StringGrid1.GridWidth) + ' pixels';
end;
See also
GridHeight property
GroupIndex property
Applies to
TMenuItem, TSpeedButton components
down state, until the user clicks another speed button belonging to the same group.
+
Speed buttons used in this way can present mutually exclusive choices to the user. +
Example
This code assures that the three speed buttons work together as a group:
+
SpeedButton1.GroupIndex := 1; +
+
SpeedButton2.GroupIndex := 1;
SpeedButton3.GroupIndex := 1;
See also
AllowAllUp property, Down property
+
G
For menu items
Declaration
property GroupIndex: Byte;
If your application has multiple forms, you’ll probably want your application’s main
menu to change as different forms become active. The alternative is for each form to
display its own menu within itself. MDI applications always merge the menus of child
windows with the main menu of the parent window. By using the GroupIndex property
for menu items, you can determine how menus are merged. You can choose to replace
or insert menu items in a menu bar.
Each menu item has a GroupIndex property value. By default, all menu items in a menu
bar have the same GroupIndex value, unless you explicitly change them. Each successive
menu item in a menu bar must have a GroupIndex value equal to or greater than the
previous menu item.
the item’s GroupIndex value is greater than all other GroupIndex values in the main
form’s menu bar, the item appears at the end of the menu. If the GroupIndex value is
between other GroupIndex values in the menu bar on the main form, the menu item
appears between other menu items, depending on the value.
For example, an item with a GroupIndex value of 2 would be inserted between items
with GroupIndex values of 1 and 3. An item with a GroupIndex value of 4 would appear
after all the other items.
Note The GroupIndex value must be different from all others in the menu bar on the main
form, or else the new menu item will replace one or more menu items with the same
GroupIndex value, which you may or may not want to do.
Any menu items in your container application with values of 1, 3, or 5 for their
GroupIndex properties are replaced by menu items with corresponding index values
from the OLE server application. The menu items from your OLE container with a
GroupIndex value other than 1, 3, or 5 won’t be replaced by menus from the server.
See also
AutoMerge property, FormStyle property
The Halt procedure stops the program and returns to the operating system. Exitcode is
+
an optional expression that specifies the exit code of your program. +
Example +
begin
if 1 = 1 then
begin
+
if 2 = 2 then
begin
+
if 3 = 3 then
begin +
end;
Halt(1); { Halt right here! }
end; +
end;
Canvas.TextOut(10, 10, 'This will not be executed');
H
end;
See also
Exit procedure, RunError procedure
Handle property
Applies to
All windowed controls; TApplication, TBitmap, TBrush, TCanvas, TFont, TIcon, TMetafile,
TPen, TPrinter objects; TDatabase, TFindDialog, TMainMenu, TMenuItem, TPopupMenu,
TQuery, TSession, TStoredProc, TTable components
Declaration
property Handle: HBitmap; {for TBitmap objects}
property Handle: HBrush; {for TBrush objects}
property Handle: HDC; {for TCanvas objects}
property Handle: HFont; {for TFont objects}
property Handle: HIcon; {for TIcon objects}
property Handle: HMetafile; {for TMetafile objects}
property Handle: HPen; {for TPen objects}
The Handle property lets you access the Windows GDI object handle, so you can access
the GDI object. If you need to use a Windows API function that requires the handle of a
pen object, you could pass the handle from the Handle property of a TPen object.
Example
The following code uses the Windows API function ShowWindow to display Form2 as an
icon, but does not activate it.
ShowWindow(Form2.Handle, SW_SHOWWINMINNOACTIVE);
See also
HandleAllocated method, HandleNeeded method
Example
The following code uses the Windows API function HiliteMenuItem to highlight the first
menu item in MainMenu1 on Form1.
HiliteMenuItem(Form1.Handle, MainMenu1.Handle, 0, MF_BYPOSITION+MF_HILITE);
For sessions
Declaration
property Handle: HDBISES;
Run-time and read only. The Handle property allows you to make direct calls to the
+
Borland Database Engine using this handle to the session (TSession). Under most
circumstances you should not need to use this property, unless your application
+
requires some functionality not encapsulated in the VCL. +
For tables, queries, and stored procedures +
Declaration +
property Handle: HDBICur;
Run-time and read only. The Handle property enables an application to make direct calls
+
to the Borland Database Engine API using this handle of a dataset component. +
Under most circumstances you should not need to use this property, unless your
application requires some functionality not encapsulated in the VCL. H
For databases
Declaration
property Handle: HDBIDB;
Run-time and read only. Use the Handle property to make direct calls to the Borland
Database Engine (BDE) API that require a database handle. Under most circumstances
you should not need to use this property, unless your application requires some
functionality not encapsulated in the VCL.
HandleAllocated method
Applies to
All controls
Declaration
function HandleAllocated: Boolean;
The HandleAllocated method returns True if a window handle for the control exists. If no
window handle exists, HandleAllocated returns False. If you query the Handle property of
a control directly, a handle is automatically created if it didn’t previously exist.
Therefore, you should call the HandleAllocated method if you don’t want a handle
created automatically for the control, but simply want to know if one exists.
Example
The following code displays the value of the handle of GroupBox1 if it exists. If not, it
displays a message.
var
TheValue: string;
begin
if GroupBox1.HandleAllocated then
TheValue := IntToStr(GroupBox1.Handle)
else TheValue := ’Handle not allocated.’;
Label1.Caption := TheValue;
end;
See also
HandleNeeded method
HandleException method
Applies to
TApplication component
Declaration
procedure HandleException(Sender: TObject);
The HandleException method handles the exceptions for the application. If an exception
passes through all the try blocks in your application code, your application
automatically calls the HandleException method, which displays a dialog box indicating
an error occurred. To assign other exception handling code for the application, use the
OnException event handler.
Example
The following code uses the default error handling:
try
{ Some code that may produce an exception goes here }
except
Application.HandleException(Self);
end;
See also
Application variable, OnException event
HandleNeeded method
Applies to
All controls
Declaration
procedure HandleNeeded;
The HandleNeeded method creates a window handle for the control if one doesn’t
+
already exist. +
Example
The following code creates a window handle for Button1:
+
Button1.HandleNeeded; +
See also +
Handle property, HandleAllocated method
+
HasFormat method +
Applies to
TClipboard object
H
Declaration
procedure HasFormat(Format: Word): Boolean;
The HasFormat method determines if the Clipboard object contains a particular format.
If HasFormat is True, the format is present; if False, the format is absent. The Clipboard
object keeps a list of available formats in the Formats array property.
These are the possible values of the Format parameter:
Value Meaning
CF_TEXT Text with each line ending with a CR-LF combination. A null character identifies
the end of the text.
CF_BITMAP A Windows bitmap graphic.
CF_METAFILE A Windows metafile graphic.
CF_PICTURE An object of type TPicture.
CF_OBJECT Any persistent object.
Example
This example uses a button on a form. When the user clicks the button, a message box
appears if there is no text on the Clipboard; otherwise, you don’t see anything happen.
procedure TForm1.Button1Click(Sender: TObject);
begin
if not Clipboard.HasFormat(CF_TEXT) then
MessageDlg('There is no text on the Clipboard', mtInformation,
[mbOK],0);
end;
See also
Assign method, FormatCount property, Formats property, GetComponent method,
SetComponent method
HasItems property
Applies to
TOutlineNode object
Declaration
property HasItems: Boolean;
Run-time and read only. The HasItems property determines if an outline item has any
subitems. Subitems appear below and indented from their parent item when the parent
is expanded. The Index value of the parent item is one less than the Index value of its first
subitem. HasItems is True if the item has subitems, or False if the item has no subitems.
Example
The following code expands the selected item of Outline1 if it has subitems:
with Outline1[Outline1.SelectedItem] do
if HasItems then Expand;
See also
GetFirstChild method, GetLastChild method, GetNextChild method, GetPrevChild method
See also
GlobalAlloc function, GlobalLock function
Height property
Applies to
All controls; TBitmap, TFont, TGraphic, TIcon, TMetafile, TPicture objects; TForm, TScreen
components
Declaration
property Height: Integer;
Example
The following code doubles the height of a list box control:
ListBox1.Height := ListBox1.Height * 2;
See also
ClientHeight property, SetBounds method, Width property
Example
To following code sets a form’s height to half the height of the screen:
Form1.Height := Screen.Height div 2;
See also
Screen variable, Width property
For fonts
The Height property is the height of the font in pixels. It is the size of the font plus the
font’s internal leading. If you are concerned with the size of the font on the screen—the
number of pixels the font needs—use the Height property. If you want to specify a font‘s
size using points, use the Size property instead.
Delphi calculates Height using this formula:
Font.Height = -Font.Size * Font.PixelsPerInch / 72
Therefore, whenever you enter a point size in the Height property, you’ll notice the Size
property changes to a negative value. Conversely, if you enter a positive Size value, the
Height property value changes to a negative value.
Example
This example uses button and a label on a form. When the user clicks the button, the
height of the font changes to 36 pixels on the screen:
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Font.Height := 36;
end;
Example
This example uses a bitmap button on a form. When the user clicks the button, the Help
contents screen of the specified Help file appears.
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
Application.HelpFile := 'MYHELP.HLP';
Application.HelpCommand(HELP_CONTENTS, 0);
end;
See also
Application variable, HelpContext method, HelpContext property, HelpFile property,
HelpJump method
HelpContext method
Applies to
TApplication component
Declaration
function HelpContext(Context: THelpContext): Boolean;
The HelpContext method calls WinHelp, the Windows Help system program, if the
HelpFile property is assigned a file to use for Help. HelpContext passes the file name
contained in HelpFile and the context number passed in Context parameter. For example,
if you specify the Context value as 714, the HelpContext method displays the screen with
the context help ID of 714 in the Help file.
HelpContext returns False if HelpFile is an empty string, meaning the application has no
Help file assigned. In all other cases, HelpContext returns True.
Example
This example uses a bitmap button on a form. When the user clicks the button, the
screen with the context number of 714 in the DATA.HLP Help file appears:
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
Application.HelpFile := 'DATA.HLP';
Application.HelpContext(714);
end;
See also
Application variable, HelpFile property, OnHelp event
HelpContext property
Applies to
All controls; Exception, TColorDialog, TFindDialog, TFontDialog, TMenuItem, TPopupMenu,
TOpenDialog, TPrintDialog, TPrinterSetupDialog, TReplaceDialog, TSaveDialog
components
Declaration
property HelpContext: THelpContext;
The HelpContext property provides a context number for use in calling context-sensitive
online Help. Each screen in the Help system should have a unique context number.
When a component is selected in the application, pressing F1 displays a Help screen.
Which Help screen appears depends on the value of the HelpContext property.
Example
The following code associates a Help file with the application, and makes the screen
with a context number of 7 the context-sensitive Help screen for the Edit1 edit box:
procedure TForm1.FormActivate(Sender: TObject);
begin
Application.HelpFile := ’MYHELP.HLP’;
Edit1.HelpContext := 7;
end;
See also
HelpContext method, HelpFile property, HelpJump method, OnHelp event
HelpFile property
Applies to
TApplication component
Declaration
function HelpJump(const JumpID: string): Boolean;
The HelpJump method calls WinHelp, the Windows Help system program, if the HelpFile
property is assigned a file to use for Help. HelpJump passes the file name contained in
HelpFile and the context string specified in the JumpID parameter. For example, if you
specify the JumpID value as ‘vclDefaultProperty', the HelpJump method displays the
screen in the Help file that has the context string ‘vclDefaultProperty'.
HelpJump returns False if HelpFile is an empty string, meaning the application has no
Help file assigned. In all other cases, HelpJump returns True.
Example
This example uses a bitmap button on a form. When the user clicks the button, the Help
screen describing the Default property in the DELPHI.HLP file appears, because the
Default property screen has the a JumpID string of ‘vclDefaultProperty'.
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
Application.HelpFile := 'DELPHI.HLP';
Application.HelpJump('vclDefaultProperty');
end;
See also
Application variable, HelpCommand method, HelpContext method, HelpContext property,
HelpFile property, OnHelp event
Hi function System
Declaration
function Hi(X): Byte;
The Hi function returns the high-order byte of X as an unsigned value. X is an
expression of type Integer or Word.
Example
var B: Byte;
begin
B := Hi($1234); { $12 }
end;
See also
Lo function, Swap function
Hide method
Applies to
TForm component, All controls
Declaration
procedure Hide;
The Hide method makes a form or control invisible by setting the Visible property of the
form or control to False. Although a form or control that is hidden is not visible, you can
still set the properties of the form or control, or call its methods.
Example
This code uses a button and a timer on a form. When the user clicks the button, the form
disappears for the period of time specified in the Interval property of the timer control,
then the form reappears:
procedure TForm1.Button1Click(Sender: TObject);
begin
Timer1.Enabled := True;
Hide;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Visible := True;
Timer1.Enabled := False;
end;
Example
This example uses an edit box and a memo on a form. When the user jumps from one
control to the other, selected text remains selected in the memo, but not in the edit box.
procedure TForm1.FormCreate(Sender: TObject);
begin
Edit1.HideSelection := True;
Memo1.HideSelection := False;
end;
See also
AutoSelect property
Example
function Sum( var X: array of Double): Double;
var
I: Word;
S: Double;
begin
S := 0; { Note that open array index range is always zero-based. }
for I := 0 to High(X) do S := S + X[I];
Sum := S;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
List1: array[0..3] of Double;
List2: array[5..17] of Double;
X: Word;
S, TempStr: string;
begin
for X := Low(List1) to High(List1) do
List1[X] := X * 3.4;
for X := Low(List2) to High(List2) do
List2[X] := X * 0.0123;
Str(Sum(List1):4:2, S);
S := 'Sum of List1: ' + S + #13#10;
S := S + 'Sum of List2: ';
Str(Sum(List2):4:2, TempStr);
S := S + TempStr;
MessageDlg(S, mtInformation, [mbOk], 0);
end;
See also
Low function
Example
This example uses an edit box and a list box on a form. Items are added to the list box
and a Help Hint is assigned to both controls. The last statement enables the Help Hints
for the entire application.
procedure TForm1.FormCreate(Sender: TObject);
var
I: Integer;
begin
Edit1.Hint := 'Enter your name';
Edit1.ShowHint := True;
with ListBox1 do
begin
for I := 1 to 10 do
Items.Add('Item ' + IntToStr(I));
Hint := 'Select an item';
ShowHint := True;
end;
Application.ShowHint := True;
end;
To see a example that displays the hints of controls in some place other than in a Help
Hint box, see the OnHint example.
See also
GetLongHint function, GetShortHint function, HintColor property, HintPause property,
ShowHint property for controls, ShowHint property for the application
HintColor property
Applies to
TApplication component
Declaration
property HintColor: TColor
Description
Run time only. The HintColor property determines the color of the hint boxes for the
Help Hints of the controls in the application. For a table of possible color values, see the
Color property.
Example
This example includes an control that has a Hint property value and has its ShowHint
property value set to True. When the application runs and the user places the mouse
cursor over the control, a Help Hint appears for the control in an aqua hint box after a
delay of 1000 milliseconds:
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.ShowHint := True;
Application.HintColor := clAqua;
Application.HintPause := 1000;
end;
See also
Application variable, Hint property, HintPause property, ShowHint property, TColor type
See also
Application variable, Hint property, HintColor property, ShowHint property
Hints property
Applies to
TDBNavigator component
Declaration
property Hints: TStrings;
The Hints property allows you to customize the Help Hints for the buttons on the
database navigator. Each hint is a string. The first string in the string object becomes the
Help Hint for the first button on the navigator. The seventh hint becomes the Help Hint
for the seventh button (the Edit button).
If you don’t want to change the Help Hint for every button, enter an empty string (‘’) for
the Help Hint you want to stay the same, or simply leave the line blank if you are using
the string list property editor of the Object Inspector for the Hints property.
Example
This example uses a database navigator and a button on a form. When the user clicks the
button, the Help Hints for the navigator are modified.
procedure TForm1.Button1Click(Sender: TObject);
var
NewStrings: TStringList;
begin
NewStrings := TStringList.Create;
with NewStrings do
begin
Add('Beginning of dataset');
Add('Previous record');
Add('');
Add('End of dataset');
end;
DBNavigator1.Hints := NewStrings;
DBNavigator1.ShowHint := True;
end;
See also
Hint property, HintColor property, HintPause property
HistoryList property
Applies to
TOpenDialog, TSaveDialog components
Declaration
property HistoryList: TStrings ;
The HistoryList property contains strings that appear in the File Name drop-down
combo box of an Open or Save dialog box when the user opens it. Because only a File
Name combo box can have a value for the HistoryList property, the FileEditStyle
property value of the dialog box must be fsComboBox. If the FileEditStyle property value
is fsEdit, the strings in the HistoryList property aren’t used by the dialog box.
Your application can use the HistoryList property to create a list of previous files names
opened or saved with the dialog box. Use a TStringList object to keep a list of file names,
and assign this object to the HistoryList property.
Note When an Open or Save dialog box is open, your application won’t be able to access the
HistoryList property. Therefore, your application must work with HistoryList before the
dialog box opens or after it closes.
Example
This example uses an Open dialog box and a button. The code creates a string list object
and stores each file the user selects in the Open dialog box in it. Each time the clicks the
button to open the dialog box, the string list is assigned to the HistoryList property.
HorzScrollBar property
Applies to
TForm, TScrollBox components
Declaration
property HorzScrollBar: TControlScrollBar;
The HorzScrollBar property is the form’s or scroll box’s horizontal scroll bar. The values
of HorzScrollBar’s nested properties determines how the horizontal scroll bar behaves.
To make a horizontal scroll bar appear on a form or scroll box, the nested properties of
HorzScrollBar must be set like this:
• Visible must be True.
• The value of the Range property must be greater than the value of the ClientWidth
property of the form or the Width property of the scroll box.
Example
This example implements a horizontal scroll bar on the form. The scroll bar scrolls the
form 100 pixels more than the form width:
procedure TForm1.FormCreate(Sender: TObject);
begin
ClientWidth := 300;
with HorzScrollBar do
begin
Increment := 4;
Position := 0;
Range := ClientWidth + 100; {Range must be greater than the form’s client width}
Visible := True;
end;
end;
See also
AutoScroll property, Increment property, Position property, Range property, ScrollPos
property, VertScrollBar property, Visible property
Icon property
Applies to
TPicture object; TApplication, TForm components
For forms
Declaration
property Icon: TIcon
The Icon property determines the icon that is displayed when the window or form is
minimized. If you don’t assign a specific icon to Icon, the form uses the application’s
icon.
Example
This code assigns an icon to a form when the form is created:
procedure TForm1.FormCreate(Sender: TObject);
begin
Icon.LoadFromFile('MYICON.ICO');
end;
See also
Graphic property
For an application
Declaration
property Icon: TIcon;
The value of the Icon property determines which icon represents the application when it
is minimized or displayed in the Program Manager.
Example
This line of code uses the icon in the MYAPP.ICO files for the application’s icon:
Application.Icon.LoadFromFile('MYAPP.ICO');
See also
Application variable, LoadFromFile method, Minimize method, SaveToFile method
Example
var
IntVar: Integer;
LongintVar: Longint;
begin
Inc(IntVar); { IntVar := IntVar + 1 }
Inc(LongintVar, 5); { LongintVar := LongintVar + 5 }
end;
See also
Dec procedure, Pred function, Succ function
Inch property
Applies to
TMetafile object
See also
Exclude procedure
Increment property
Applies to
TControlScrollBar component
Declaration
property Increment: Integer;
The Increment property determines how many positions the scroll box in a form scroll
bar moves when the user clicks one of the small end arrows. The default value is 8.
Example
This example implements a horizontal scroll bar on the form. The scroll bar scrolls the
form 100 pixels more than the form width. Each time the user clicks a scroll arrow on the
scroll bar, the form scrolls 7 pixels:
procedure TForm1.FormCreate(Sender: TObject);
begin
ClientWidth := 300;
with HorzScrollBar do
begin
Position := 0;
Increment := 7;
Range := ClientWidth + 100; {Range must be greater than the form’s client width}
Visible := True;
end;
end;
See also
HorzScrollBar property, Position property, Range property, ScrollPos property,
VertScrollBar property
Index property
Applies to
TOutlineNode object; TBCDField, TBlobField, TBooleanField, TBytesField, TCurrencyField,
TDateField, TDateTimeField, TFloatField, TGraphicField, TIntegerField, TMemoField,
TSmallintField, TStringField, TTimeField, TVarBytesField, TWordField components
Example
The following code tests to determine if the selected item is the top item in the outline.
with Outline1 do
if Items[SelectedItem].Index = 1 then
{ The selected item is the top item }
else
{ The selected item is not the top item };
See also
Add method, Delete method, EndUpdate method, Insert method
Example
{ Get the current available indicies }
Table1.IndexDefs.Update;
{ Find one which combines Customer Number (‘CustNo’) and Order Number (‘OrderNo’) }
for I := 0 to Table1.IndexDefs.Count - 1 do
if Table1.IndexDefs.Items[I].Fields = ‘CustNo;OrderNo’ then
IndexFieldCount property
Applies to
TTable component
Declaration
property IndexFieldCount: Integer;
Run-time only. The IndexFieldCount property is the number of actual fields for the
current index. If you are using the primary index for the component, this value will be
one. If the component is not Active, the value of IndexFieldCount will be zero.
Example
TotalLen := 0;
with Table1 do
{ Calculate the total length of the index }
for I := 0 to IndexFieldCount - 1 do
Inc(TotalLen, IndexFields[I].FieldDef.DataSize);
IndexFieldNames property
Applies to
TTable component
Declaration
property IndexFieldNames: string;
The IndexFieldNames property is used with an SQL server to identify the columns to be
used as an index for the TTable. Separate the column names with semicolon characters
(“;”). If you have too many column names or the names are too long to fit within the 255
character limit, use column numbers instead of names.
Note IndexFieldNames and IndexName are mutually exclusive. Setting one will clear the other.
Example
Query1.IndexFieldNames := ‘CustNo;OrderNo’;
IndexFields property
Applies to
TTable component
Declaration
property IndexFields[Index: Integer]: TField;
Run-time only. The IndexFields property gives you access to information about each field
of the current index for the dataset. The Active property must be True or the information
will not be valid.
Example
S := '';
with Table1 do
{ Create a composite string with the index’s names separated by “@” }
for I := 0 to IndexFieldCount - 1 do
S := S + '@' + IndexFields[I].FieldName;
Example
Table1.IndexName := ‘CustNoIndex’;
See also
MasterFields property, MasterSource property
IndexOf method
Applies to
TList, TStringList, TStrings objects; TFieldDefs, TIndexDefs, TMenuItem components
Example
This example uses a main menu named File1, a button, and a label on a form. The File1
menu contains three menu commands, Open, Save, and Close. Delphi automatically
names these menu items Open1, Save1, and Close1. This code returns the position of the
Close command in the File menu and reports it as the caption of the label.
See also
FindItem method
Example
The following code adds an object to MyList if it isn’t already in the list.
if MyList.IndexOf(MyObject)=-1 then MyList.Add(MyObject);
See also
Add method, Count property
Example
This example uses a combo box that contains five strings (enter them as the value of the
Items property with the Object Inspector) and a label. When the user selects a string in
the combo box, the index of the selected string appears as the caption of the label.
procedure TForm1.ComboBox1Click(Sender: TObject);
begin
Label1.Caption := IntToStr(ComboBox1.Items.IndexOf(ComboBox1.SelText));
end;
This example uses a file list box, a directory list box, and a label on a form. When the
user uses the directory list box to change directories, a message appears and the color of
the form changes if the file AUTOEXEC.BAT is in the new directory. The code is written
+
in the OnChange event of the directory list box: +
procedure TForm1.DirectoryListBox1Change(Sender: TObject);
begin
FileListBox1.Directory := DirectoryListBox1.Directory;
+
if FileListBox1.Items.IndexOf('AUTOEXEC.BAT') > -1 then
begin
+
Color := clYellow;
Label1.Caption := 'You are in the root directory!'; +
end;
end; +
See also
IndexOfObject method, Strings property
+
+
For TIndexDefs objects
I
Declaration
function IndexOf(const Name: string): Integer;
The IndexOf method returns the index of the entry in Items whose Name property
matches the Name parameter.
IndexOfObject method
Applies to
TStringList, TStrings objects
Declaration
function IndexOfObject(AObject: TObject): Integer;
The IndexOfObject method returns the position of an object stored in the Objects property
of a string object. Specify the object you want to locate as the value of the AObject
parameter. The first position in the list of objects is 0. If the object is not in the list of
objects, IndexOfObject returns -1.
Example
The following code determines if MyObject is the first object in MyStringList.
if MyStringList.IndexOfObject(MyObject)=0 then
{ MyObject is the first object in the list };
See also
AddObject method, IndexOf method, InsertObject method
InitialDir property
Applies to
TOpenDialog, TSaveDialog components
Declaration
property InitialDir: string;
The InitialDir property determines the current directory when the dialog box first
appears and value of the InitialDir property is shown as the current directory in the
directory tree. Only files in the current directory appear in the dialog box’s list box of file
names. After the dialog box appears, users can then use the directory tree to change to
another directory if they want.
When specifying the initial directory, include the full path name. For example,
C:\WINDOWS\SYSTEM
If no initial directory is specified, the directory that is current when the dialog box
appears remains the current directory. The same is true if you specify a directory that
does not exist.
Example
This code specifies C:\WINDOWS as the initial directory when the dialog box appears,
displays the dialog box, and displays the name of the file the user selects with the dialog
box in a label on the form:
procedure TForm1.Button1Click(Sender: TObject);
begin
OpenDialog1.InitialDir := 'C:\WINDOWS';
if OpenDialog1.Execute then
Label1.Caption := OpenDialog1.FileName;
end;
See also
Filter property
See also
ScreenSize typed constant, WindowOrg typed constant, WindowSize typed constant,
WindowTitle variable
InPlaceActive property
Applies to
TOLEContainer component
Declaration
property InPlaceActive: Boolean;
Run-time and read only. The InPlaceActive property specifies whether the OLE object in
an OLE container is active in-place. If so, the value of InPlaceActive is True. If the object is
deactivated, or activated in its own window (not in place), the value of InPlaceActive is
False.
When an OLE object is active in-place, the OLE server application controls the editing of
the OLE object from within the OLE container application. The OLE server might
replace menu items and the status bar of the OLE container.
Example
The following code waits until an OLE object is activated in place before unlocking
Panel1. Attach this code to the OnActivate event handler of OLEContainer1.
procedure TForm1.OleContainer1Activate(Sender: TObject, Activating:Boolean);
begin
if OLEContainer1.InPlaceActive then
Panel1.Locked := False;
end;
See also
Active property, GroupIndex property
Example
This example displays an input dialog box when the user clicks the button on the form.
The input dialog box includes a prompt string and a default string. The string the user
enters in the dialog box is stored in the InputString variable.
uses Dialogs;
procedure TForm1.Button1Click(Sender: TObject);
var
InputString: string;
begin
InputString:= InputBox('Input Box', 'Prompt', 'Default string');
end;
See also
MessageDlg function, MessageDlgPos function
Example
This example uses a button and a label on the form. When the user clicks the button, a
the input box displays. If the user chooses OK, the string that appears in the edit box of
the dialog box displays as the caption of the label on the form. If the user chooses
Cancel, the dialog box closes and the caption of the label remains unchanged.
procedure TForm1.Button1Click(Sender: TObject);
var
NewString: string;
ClickedOK: Boolean;
begin
NewString := 'Default String';
Label1.Caption := NewString;
ClickedOK := InputQuery('Input Box', 'Prompt', NewString);
if ClickedOK then { NewString contains new input string }
Label1.Caption := 'The new string is ''' + NewString + '''';
end;
See also
MessageDlg function, MessageDlgPos function
Insert method
Applies to
TList, TMenuItem, TStringList, TStrings objects; TOutline, TTable, TQuery components
Declaration
procedure Insert(Index: Integer; const S: string);
The Insert method inserts a string into the list of strings in a string or string list object.
The string S is inserted into the position in the list indicated by the value of Index. The
index is zero-based, so the first position in the list has an index value of 0.
Example
This example uses a list box and a button on a form. When the form appears, it contains
five items. When the user clicks the button, another string is inserted at the top of the list
of items:
procedure TForm1.FormCreate(Sender: TObject);
var
I: Integer;
begin
for I := 1 to 5 do
ListBox1.Items.Add('Item ' + IntToStr(I));
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
See also
Add method, AddStrings method, Clear method, Delete method, IndexOf method,
InsertObject method
Example
This example inserts a new menu item after the first item in a menu named FileMenu:
procedure TForm1.Button1Click(Sender: TObject);
var
NewItem: TMenuItem;
begin
NewItem := TMenuItem.Create(FileMenu);
NewItem.Caption := 'Do this';
FileMenu.Insert(1, NewItem);
end;
See also
Add method, Count property, Delete method
For outlines
Applies to
TOutline component
Declaration
function Insert(Index: Longint; const Text: string): Longint;
Description
The Insert method inserts an outline item (TOutlineNode object) into an outline. The
value of the Index and Text parameters are stored in the Index and Text properties of the
inserted item. Insert returns the Index property value of the inserted item.
The inserted item appears in the outline position determined by the Index parameter. It
is inserted at the same level as the item that previously resided at this position.
Therefore, the inserted item and the original item are siblings and share the same parent.
The original item and all other outline items that appear after the inserted item are
+
moved down one row and are reindexed with valid Index values. This happens
automatically unless the BeginUpdate method was called.
+
Note To insert an item as the last top-level item in an outline, pass zero (0) in the Index
parameter.
+
Example
+
The following code inserts an item as a sibling of the selected item. +
begin
Outline1.Insert(Outline1.SelectedItem, 'New item');
end;
+
See also
+
Add method, AddChild method, AddChildObject method, InsertObject method, MoveTo
method
+
I
For tables and queries
Declaration
procedure Insert;
The Insert method puts the dataset into Insert state and opens a new, empty record at the
current cursor location. When an application calls Post, the new record will be inserted
in the dataset in a position based on its index, if defined. To discard the new record, use
Cancel.
This method is valid only for datasets that return a live result set.
Note For indexed tables, the Append and Insert methods will both put the new record in the
correct location in the table, based on the table’s index. If no index is defined on the
underlying table, then the record will maintain its position—Append will add the record
to the end of the table, and Insert will insert it at the current cursor position. In either
case, posting a new record may cause rows displayed in a data grid to change as the
dataset follows the new row to its indexed position and then fetches data to fill the data
grid around it.
Example
with Table1 do
begin
{ Move to the end ot the component }
Last;
Insert;
FieldByName(‘CustNo’).AsString := ‘9999’;
{ Fill in other fields here }
if { you are sure you want to do this} then Post
else { if you changed your mind } Cancel;
end.
Example
var
S: string;
begin
S := 'Honest Lincoln';
Insert('Abe ', S, 8); { 'Honest Abe Lincoln' }
end;
See also
Concat function, Copy function, Delete procedure, Length function, Pos function
InsertComponent method
Applies to
All components
Declaration
procedure InsertComponent(AComponent: TComponent);
The InsertComponent method makes the component own the component passed in the
AComponent parameter. The component is added to the end of the Components array
property. The inserted component must have no name (no specified Name property
value), or the name must be unique among all others in the Components list.
When the owning component is destroyed, AComponent is destroyed also.
Example
The following code inserts NewButton into the Components array of Form1.
Form1.InsertComponent(NewButton);
See also
RemoveComponent method
See also
Parent property, RemoveControl method
InsertObject method
Applies to
TStringList, TStrings objects, TOutline component
The InsertObject method inserts a string into the list of strings and an object into the list
of objects in a string or string list object. Specify the string you want to insert as the value
of the S parameter, and the object you want to insert as the value of the AObject
parameter. The Index parameter identifies the position of the string and object in their
respective string and object lists. Because the index is zero-based, the first position in
each list has an Index value of 0.
If your application calls InsertObject when the list of items is sorted, an EListError
exception is raised.
Example
The following code inserts the components of Form1 into the first position of the Lines
list of Memo1.
var
I: Integer;
begin
for I := 0 to Form1.ComponentCount-1 do
begin
with Form1.Components[i] as TComponent do
Memo1.lines.InsertObject(0, Name, Self);
end;
end;
See also
AddObject method, IndexOfObject method, Insert method, Objects property, Strings
property
For outlines
Applies to
TOutline component
Declaration
function InsertObject(Index: Longint; const Text: string; const Data: Pointer): Longint;
Description
The InsertObject method inserts an outline item (TOutlineNode object) containing data
into an outline. The value of the Index and Text parameters are stored in the Index and
Text properties of the inserted item. The Data parameter specifies the Data property
value of the new item. Insert returns the Index property value of the inserted item.
The inserted item appears in the outline position determined by the Index parameter. It
will be inserted at the same level as the item that previously resided at this position.
Therefore, the inserted item and the original item will be siblings and share the same
parent. The original item and all other outline items that appear after the inserted item
are moved down one row and are reindexed with valid Index values. This is done
automatically unless the BeginUpdate method was called.
To insert an item as the last top-level item in an outline, pass zero (0) in the Index
+
parameter. +
Example
The following code creates a bitmap object named Bitmap1 and inserts an outline item
+
containing Bitmap1 into the first level of Outline1. +
+
var
Bitmap1: TBitmap;
begin
Bitmap1 := TBitmap.Create;
Outline1.InsertObject(1, 'New item', Bitmap1); +
end;
+
See Also
Add method, AddChild method, AddChildObject method, Insert method, MoveTo method +
InsertOLEObjectDlg function
I
Toctrl
Declaration
function InsertOleObjectDlg(Form: TForm; HelpContext: THelpContext;
var PInitInfo: Pointer): Boolean;
InsertOLEObjectDlg displays the Insert Object dialog box. Use this function to allow the
user to specify the OLE object initialization information by using the Insert Object dialog
box.
InsertOLEObjectDlg returns True if the user specifies an OLE object and chooses OK from
the Insert Object dialog box. InsertOLEObjectDlg returns False if the user doesn’t specify
an OLE object or chooses Cancel in the dialog box.
These are the parameters of InsertOLEObjectDlg:
Field Description
Form The form that owns the Insert Object dialog box.
HelpContext A Help context identification number that is used if the user chooses Help from within
the Insert Object dialog box. If you pass 0 for HelpContext, no Help button appears in
the Insert Object dialog box. Pass a number other than 0 if you want to provide
context-sensitive online Help.
PInitInfo If InsertOLEObject returns True, InsertOLEObjectDlg modifies the PInitInfo pointer
parameter to point to OLE initialization information. Initialize the OLE object by
assigning this pointer to the PInitInfo property. When your application is finished with
the PInitInfo pointer, it should be released with ReleaseOLEInitInfo.
Example
The following code displays the Insert Object dialog box. If the user specifies an object
and chooses OK, OLEContainer1 is initialized. After initialization, the OLE information is
released.
var
Info: Pointer;
begin
if InsertOLEObjectDlg(Form1, 0, Info) then
begin
OLEContainer1.PInitInfo := Info;
ReleaseOLEInitInfo(Info);
end;
end;
See also
LinksDlg function, PasteSpecialDlg function
InsertRecord method
Applies to
TTable, TQuery components
Declaration
procedure InsertRecord(const Values: array of const);
The InsertRecord method inserts a new record into the dataset using the field values
passed in the Values parameter. The assignment of the elements of Values to fields in the
record is sequential; the first element is assigned to the first field, the second to the
second, etc. The number of field values passed in Values may be fewer than the number
of actual fields in the record; any remaining fields are left unassigned and are NULL.
The type of each element of Values must be compatible with the type of the field in that
the field must be able to perform the assignment using AsString, AsInteger, etc.,
according the type of the Values element.
This method is valid only for datasets that return a live result set.
Note For indexed tables, the AppendRecord and InsertRecord methods will both put the new
record in the correct location in the table, based on the table’s index. If no index is
defined on the underlying table, then the record will maintain its position—
AppendRecord will add the record to the end of the table, and InsertRecord will insert it at
the current cursor position. In either case, posting a new record in a data grid may cause
all the rows before and after the new record to change as the dataset follows the new
row to its indexed position and then fetches data to fill the grid around it.
Example
Table1.InsertRecord([9998, ‘Lesh’, ‘Phil’]);
See also
TField component
IntegralHeight property
Applies to
TDBListBox, TDirectoryListBox, TFileListBox, TListBox component
Declaration
property IntegralHeight: Boolean;
The IntegralHeight property controls the way the list box represents itself on the form. If
IntegralHeight is True, the list box shows only entries that fit completely in the vertical
space, and the bottom of the list box moves up to the bottom of the last completely
drawn item in the list. If IntegralHeight is False, the bottom of the list box is at the location
determined by its ItemHeight property, and the bottom item visible in the list might not
be complete.
If the list box has a Style property value of lbOwerDrawVariable, setting the IntegralHeight
property to True has no effect.
If the Style property value of the list box is lsOwnerDrawFixed, the height of the list box at
design time is always an increment of the ItemHeight value.
Example
This example uses a list box on a form. To try it, enter as many strings in the Items
property as you like using the Object Inspector. When the application runs, the list box
displays only entries that fit completely in the vertical space, and the bottom of the list
box moves up to the bottom of the last string in the list box if the form is less than 300
pixels in height:
procedure TForm1.FormCreate(Sender: TObject);
begin
if Height < 300 then
ListBox1.IntegralHeight := True
else
ListBox1.IntegralHeight := False;
end;
See also
ItemHeight property, Items property
Interval property
Applies to
TTimer component
Declaration
property Interval: Word;
The Interval property determines in milliseconds the amount of time that passes before
the timer component initiates another OnTimer event.
You can specify any value between 0 and 65,535 as the interval value, but the timer
component won’t call an OnTimer event if the value is 0. The default value is 1000 (one
second).
Example
The code in this OnTimer event handler moves a ball, the shape component (TShape)
slowly across a form.
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Timer1.Interval := 100;
Shape1.Shape := stCircle;
Shape1.Left := Shape1.Left + 1;
end;
See also
+
IntToStr function
+
IntToStr function SysUtils +
Declaration
+
function IntToStr(Value: Longint): string; I
The IntToStr function converts an integer into a string containing the decimal
representation of that number.
Example
This example uses a button and an edit box on a form. The code assigns a value to the
Value variable and displays the string representation of the Value variable in the edit
box.
procedure TForm1.Button1Click(Sender: TObject);
var
Value: Integer;
begin
Value := 1234;
Edit1.Text := IntToStr(Value);
end;
See also
IntToHex function, StrToInt function
Invalidate method
Applies to
All controls; TForm component
Declaration
procedure Invalidate;
The Invalidate method forces a control to repaint as soon as possible.
Example
The following code invalidates Form1.
Form1.Invalidate;
See also
Refresh method, Update method
Example
var
F: file of Byte;
begin
if OpenDialog1.Execute then begin
AssignFile(F, OpenDialog1.FileName);
{$I–}
Reset(F);
{$I+}
if IOResult = 0 then
MessageDlg('File size in bytes: ' + IntToStr(FileSize(F)),
mtInformation, [mbOk], 0);
else
MessageDlg('File access error', mtWarning, [mbOk], 0);
end;
end;
IsIndexField property
Applies to
TBCDField, TBlobField, TBooleanField, TBytesField, TCurrencyField, TDateField,
TDateTimeField, TFloatField, TGraphicField, TIntegerField, TMemoField, TSmallintField,
TStringField, TTimeField, TVarBytesField, TWordField components
See also
EditMask property
IsNull property
Applies to
TParam object; TBCDField, TBlobField, TBooleanField, TBytesField, TCurrencyField,
TDateField, TDateTimeField, TFloatField, TGraphicField, TIntegerField, TMemoField,
TSmallintField, TStringField, TTimeField, TVarBytesField, TWordField components
Example
{ Set the CustNo parameter to 999 if it is null }
with Params.ParamByName(‘CustNo’) do
if IsNull then AsInteger := 999;
For fields
Declaration
property IsNull: Boolean;
Run-time and read only. IsNull returns True if the value of the field is NULL.
See also
Required property
IsSQLBased property
Applies to
TDataBase component
Declaration
property IsSQLBased: Boolean;
Run-time and read only. IsSQLBased is True if the TDatabase component uses any driver
other than ‘STANDARD’. If you are accessing a dBASE or Paradox database or ASCII
file, IsSQLBased will be False.
IsValidChar method
Applies to
TBCDField, TBlobField, TBooleanField, TBytesField, TCurrencyField, TDateField,
TDateTimeField, TFloatField, TGraphicField, TIntegerField, TMemoField, TSmallintField,
TStringField, TTimeField, TVarBytesField, TWordField components
Declaration
function IsValidChar(InputChar: Char): Boolean; virtual;
IsValidChar is used by data-aware controls to determine if a particular character entered
in the field is valid for the field. TIntegerField, TSmallintField and TWordField allow ‘+’, ‘-’
and ‘0’ to ‘9’. TBCDField and TFloatField also allow ‘E’, ‘e’, and the DecimalSeparator
+
character. All other fields accept all characters. +
See also
DecimalSeparator variable
+
+
IsValidIdent function SysUtils +
Declaration +
function IsValidIdent(const Ident: string): Boolean;
IsValidIdent returns True if the given string is a valid identifier. An identifier is defined as +
a character from the set ['A'..'Z', 'a'..'z', '_'] followed by zero or more characters from the
set ['A'..'Z', 'a'..'z', '0..'9', '_']. +
Note All component names must be valid Object Pascal identifiers.
I
IsVisible property
Applies to
TOutlineNode object
Declaration
property IsVisible: Boolean;
Run-time and read only. The IsVisible property indicates whether the outline item is
visible within the TOutline component. An item is visible if it is on level 1 or if all its
parents are expanded.
Example
The following code expands the branch of the selected outline item if it isn’t visible.
with Outline1.Items[Outline1.SelectedItem] do
if not IsVisible then FullExpand;
See also
Expanded property, Level property
ItemAtPos method
Applies to
TDBListBox, TDirectoryListBox, TFileListBox, TListBox, TTabSet components
Applies to
TDBListBox, TDirectoryListBox, TFileListBox, TListBox components
Declaration
function ItemAtPos(Pos: TPoint; Existing: Boolean): Integer;
The ItemAtPos method returns the index of the list box indicated by the coordinates of a
point on the control. The Pos parameter is the point in the control in window
coordinates.
If Pos is beyond the last item in the list box, the value of the Existing variable determines
the returned value. If you set Existing to True, ItemAtPos returns -1, indicating that no
item exists at that point. If you set Existing to False, ItemAtPos returns the position of the
last item in the list box.
ItemAtPos is useful for detecting if an item exists at a particular point in the control.
Example
This example uses a list box, and edit box, and a button on a form. When the user clicks
the button, the index value of the item in the list box which contains the point specified
in the code appears in the edit box:
procedure TForm1.Button1Click(Sender: TObject);
var
Value: Integer;
APoint: TPoint;
begin
APoint.X := 30;
APoint.Y := 50;
Value := ListBox1.ItemAtPos(APoint, False);
Edit1.Text := IntToStr(Value);
end;
See also
ItemIndex property, Items property
Declaration
function ItemAtPos(Pos: TPoint): Integer;
The ItemAtPos method returns the index of the tab indicated by the coordinates of a
point on the control. The Pos parameter is the point in the control in window
coordinates. If the returned index is 0, the tab is the first tab in the tab set, if the index is
+
1, the tab is the second tab, and so on. +
ItemAtPos is useful for determining which tab is located at a particular position in the tab
set control. +
Example +
The following code selects the tab that is at client coordinates (100, 10) in TabSet1.
TabSet1.TabIndex := TabSet1.ItemAtPos(Point(100, 10);
+
See also +
TabIndex property, Tabs property
+
ItemCount property +
Applies to I
TOutline component
Declaration
property ItemCount: Longint;
Run-time and read only. The ItemCount property specifies the total number of items in
an outline.
Example
The following code turns off automatic reindexing before inserting a new item into the
index if the index includes more than 100 items. Otherwise, automatic reindexing
remains active.
Outline1.SetUpdateState(Outline1.ItemCount > 100)
Outline1.Insert(1, ’NewItem’, MyData);
Outline1.EndUpdate
See also
Items property
ItemHeight property
Applies to
TComboBox, TDBComboBox, TDBListBox, TDirectoryListBox, TFileListBox, TListBox,
TOutline components
Declaration
property ItemHeight: Integer;
For list boxes, the ItemHeight property is the height of an item in the list box in pixels
when the list box’s Style property is lsOwnerDrawFixed. If the Style property is lsStandard
or lsOwnerDrawVariable, the value of ItemHeight is ignored. You can control the height of
an item in a fixed owner-draw list box by changing the height of ItemHeight.
For combo boxes, the ItemHeight property is the height of an item in the combo box list
in pixels when the combo box’s Style property is csOwnerDrawFixed. If the Style property
is any other setting, the value of ItemHeight is ignored. You can control the height of an
item in a fixed owner-draw combo box by changing the height of ItemHeight.
For outlines, the ItemHeight property is the height of an item in the outline in pixels
when the outline’s Style property is osOwnerDraw. If the Style property is osStandard, the
value of ItemHeight is ignored. You can control the height of an item in an owner-draw
outline by changing the height of ItemHeight.
Example
This example uses a list box and a button on a form. Enter as many strings in the list box
as you like using the property editor of the Items property in the Object Inspector. When
the user clicks the button on the form, the amount of vertical space allotted to each item
in the list box changes.
procedure TForm1.Button1Click(Sender: TObject);
begin
ListBox1.Style := lbOwnerDrawFixed;
ListBox1.ItemHeight := 30;
end;
See also
Items property, IntegralHeight property, OnDrawItem event
ItemIndex property
Applies to
TComboBox, TDBComboBox, TDBRadioGroup, TDirectoryListBox, TDriveComboBox,
TFileListBox, TFilterComboBox, TListBox, TRadioGroup components
Declaration
property ItemIndex: Integer;
Run-time only. The value of the ItemIndex property is the ordinal number of the selected
item in the control’s item list. If no item is selected, the value is -1, which is the default
value unless MultiSelect is True. To select an item at run time, set the value of ItemIndex
to the index of the item in the list you want selected, with 0 being the first item in the list.
For list boxes and combo boxes, if the value of the MultiSelect property is True and the
user selects more than one item in the list box or combo box, the ItemIndex value is the
index of the selected item that has focus. If MultiSelect is True, ItemIndex defaults to 0.
See also
+
Items property
+
ItemRect method +
Applies to
+
TDBListBox, TDirectoryListBox, TDrawGrid, TFileListBox, TListBox, TStringGrid, TTabSet
components I
Declaration
function ItemRect(Item: Integer): TRect;
The ItemRect method returns the rectangle that surrounds the item specified in the Item
parameter.
Example
This example uses a list box and four labels on a form. When the application runs, three
strings are added to the list box. When the user selects one of the strings in the list box,
the coordinates of the rectangle taken up by the selected string appear in the four labels:
procedure TForm1.FormCreate(Sender: TObject);
begin
with ListBox1 do
begin
Items.Add('Hello');
Items.Add('New');
Items.Add('World');
end;
end;
procedure TForm1.ListBox1Click(Sender: TObject);
var
ListBoxItem: TRect;
begin
ListBoxItem := ListBox1.ItemRect(ListBox1.ItemIndex);
Label1.Caption := ’Left ’ + IntToStr(ListBoxItem.Left);
Label2.Caption := 'Top ' + IntToStr(ListBoxItem.Top);
Label3.Caption := 'Right ' + IntToStr(ListBoxItem.Right);
Label4.Caption := 'Bottom ' + IntToStr(ListBoxItem.Bottom);
end;
See also
TRect type
Items property
Applies to
TFieldDefs, TIndexDefs, TList, TParams objects; TComboBox, TDBComboBox, TDBListBox,
TDBRadioGroup, TDirectoryListBox, TDriveComboBox, TFileListBox, TFilterComboBox,
TListBox, TMainMenu, TMenuItem, TOutline, TPopupMenu, TRadioGroup components
Example
This example uses an edit box, a list box, and a button on a form. When the user clicks
the button, the text in the edit box is added to the list box:
procedure TForm1.Button1Click(Sender: TObject);
begin
ListBox1.Items.Add(Edit1.Text);
end;
See also
Add method, Delete, method, Exchange method, Insert method, ItemIndex property, Move
method, Selected property
the subitem within the Items array. For example, if an application has a File drop-down
+
menu that contains the menu items New, Open, and Save, in that order,
FileMenu.Items[2] refers to the Save command. For menu items, Items is run-time only
+
property. +
For main menus, the Items property provides access to a menu item on the main menu
bar, and is available at both design time and run time. +
For pop-up menus, the Items property provides access to a menu item on the pop-up
menu, and is available at both design time and run time. +
Example +
The following code disables all the subitems of MenuItem1.
var
+
I: Integer;
begin +
I
for I := 0 to MenuItem1.ItemCount-1 do
MenuItem1.Items[I].Enabled := False;
end;
See also
Count property
For outlines
Declaration
property Items[Index: Longint]: TOutlineNode;
Run-time and read only. For outlines, the Items array property provides access to a
outline node by its row position. The value of the Index parameter corresponds to the
Index property and represents the position of the item within the Items array. For
example, if an outline has three items with Index property values of 1, 2, and 3 and Text
property values of ’Orange’, ’Apple’, and ’Banana’, respectively, Items[2] refers to the
’Apple’ item.
Example
The following code collapses the selected item of Outline1.
Outline1.Items[Outline1.SelectedItem].Expanded := False;
See also
SelectedItem property
Run-time only. The Items array property lets you access a specific pointer kept in the List
property of a list object. Using the Index parameter of Items you can access a list item by
its position in the list.
Example
This example creates a list object and inserts two records into it. The value of the record
fields are written on the form:
procedure TForm1.FormActivate(Sender: TObject);
type
PMyList = ^AList;
AList = record
I: Integer;
C: Char;
end;
var
MyList: TList;
ARecord: PMyList;
B: Byte;
Y: Word;
begin
MyList := TList.Create;
New(ARecord);
ARecord^.I := 100;
ARecord^.C := 'Z';
MyList.Add(ARecord); {Add integer 100 and character Z to list}
New(ARecord);
ARecord^.I := 200;
ARecord^.C := 'X';
MyList.Add(ARecord); {Add integer 200 and character X to list}
Y := 10; {Variable used in TextOut function}
{Go through the list until the end is reached}
for B := 0 to (MyList.Count - 1) do
begin
Y := Y + 30; {Increment Y Value}
ARecord := MyList.Items[B];
Canvas.TextOut(10, Y, IntToStr(ARecord^.I)); {Display I}
Y := Y + 30; {Increment Y Value again}
Canvas.TextOut(10, Y, ARecord^.C); {Display C}
end;
MyList.Free;
end;
See also
Add method, Expand method, First method, IndexOf method, Last method, Remove
method
Example
{ Assign 99999 to any integer parameter which does not have a value }
for I := 0 to Params.Count - 1 do
if (Params.Items[I].IsNull) and (Params.Items[I].DataType = ftInteger) then
{ Items is the default property, so you can omit its name }
Params[I].AsInteger := 99999;
See also
Count property
ItemSeparator property
Applies to
TOutline component
Declaration
property ItemSeparator: string;
The ItemSeparator property determines the separator string used between the outline
item Text values in the FullPath property of the TOutlineNode object. The default value of
ItemSeparator is ’\’.
For example, if the top-level outline item has a Text value of ’Animals’ and a child item
with the Text value of ’Dogs’, the FullPath property of the ’Dogs’ item would have the
value ’Animals\Dogs’ by default. If the string ’->’ were assigned to the ItemSeparator
property, the FullPath property of the ’Dogs’ item would be ’Animals->Dogs’.
Example
The following code changes the item separator to ’:’.
Outline1.ItemSeparator := ’:’;
See also
FullPath property, Text property, TOutlineNode object
KeepConnection property
Applies to
TDataBase component
Declaration
property KeepConnection: Boolean;
The KeepConnection property specifies whether an application remains connected to a
database server even when no tables are open. If an application needs to open and close
several tables in a single database, it will be more efficient to set KeepConnection to True.
That way, the application will remain connected to the database even when it does not
have any tables open. It can then open and close tables repeatedly without incurring the
overhead of connecting to the database each time. If KeepConnection is False, the database
must repeat the login process to the server each time the Connected property is set to
True.
The TSession component has an application-wide KeepConnections property that
determines the initial state of the KeepConnection property for temporary (automatically-
created) TDatabase components.
Example
Database1.KeepConnection := False;
See also
Session variable
KeyExclusive property
Applies to
TTable component
Declaration
property KeyExclusive: Boolean;
The KeyExclusive property indicates whether range and search functions will exclude
the matching records specified by the functions. KeyExclusive is False by default.
For the SetRangeStart and SetRangeEnd methods, KeyExclusive determines whether the
filtered range excludes the range boundaries. The default is False, which means rows
will be in the filtered range if they are greater than or equal to the start range specified
and less than or equal to the end range specified. If KeyExclusive is True, the methods
will filter strictly greater than and less than the specified values.
For the GotoNearest and FindNearest methods, KeyExclusive indicates whether a search
will position the cursor on or after the record being searched for. If KeyExclusive is False,
then GoToNearest and FindNearest will move the cursor to the record that matches the
specified values, if found. If True, then the methods will go the record immediately
following the matching record, if found.
Example
{ Limit the range from 1351 to 1356, excluding both 1351 and 1356 }
with Table1 do
begin
{ Set the beginning key }
EditRangeStart;
IndexFields[0].AsString := '1351';
{ Exclude 1351 itself }
KeyExclusive := True;
{ Set the ending key }
EditRangeEnd;
IndexFields[0].AsString := '1356';
{ Exclude 1356 itself }
KeyExclusive := True;
{ Tell the dataset to establish the range }
ApplyRange;
end;
See also
ApplyRange method, EditRangeStart method, EditRangeEnd method, KeyFieldCount
property
KeyFieldCount property
Applies to
TTable component
Declaration
property KeyFieldCount: Integer;
KeyFieldCount specifies the number of key fields to use with search functions (GotoKey,
FindKey, EditKey, and so on) if you don’t want to search on all the fields in the key.
See also
GotoKey method, GotoNearest method, EditKey method, FindKey method, FindNearest
method, SetKey method
The KeyPressed function returns True if a key has been pressed on the keyboard
+
The key can be read using the ReadKey function. +
Example +
uses WinCrt; +
+
begin
repeat
Write('Xx');
until KeyPressed;
end; +
See also +
ReadKey function
+
KeyPreview property +
Applies to K
TForm component
Declaration
property KeyPreview: Boolean;
When the KeyPreview property is True, most key events (OnKeyDown event, OnKeyUp
event, and OnKeyPress event) go to the form first, regardless of which control is selected
on the form. This allows your application to determine how to process key events. After
going to the form, key events are then passed to the control selected on the form. When
KeyPreview is False, the key events go directly to the controls. The default value is False.
The exceptions are the navigation keys, such as Tab, BackTab, the arrow keys, and so on.
If the selected control processes such keys, you can use KeyPreview to intercept them;
otherwise, you can’t.
If KeyPreview is False, all key events go to the selected control.
Example
This example changes a form’s color to aqua when the user presses a key, even when a
control on the form has the focus. When the user releases the key, the form returns to its
original color.
var
FormColor: TColor;
procedure TForm1.FormCreate(Sender: TObject);
begin
KeyPreview := True;
end;
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
FormColor := Form1.Color;
Form1.Color := clAqua;
end;
procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
Form1.Color := FormColor;
end;
KeyViolCount property
Applies to
TBatchMove component
Declaration
property KeyViolCount: Longint;
Run-time and read only. KeyViolCount reports the number of records which could not be
replaced, added, or deleted from Destination because of an integrity (key) violations. If
AbortOnKeyViol is True, KeyViolCount will never be greater than one, since the first
violation will cause the move to terminate.
Example
with BatchMove1 do
begin
Execute;
if KeyViolCount <> 0 then { something went wrong };
end;
KeyViolTableName property
Applies to
TBatchMove component
Declaration
property KeyViolTableName: TFileName;
KeyViolTableName, if specified, creates a local (Paradox) table containing all records from
the source table that caused an integrity violation (such as a key violation) as a result of
the batch operation.
If AbortOnKeyViol is True, then there will be at most one record in this table since the
operation will be aborted with that first record. KeyViolCount will have the number of
records placed in the new table.
Value Meaning
bkCustom You indicate which bitmap you want the bitmap button to have by setting the value of
the Glyph property to the bitmap of your choice. Like push buttons, you can either
select a ModalResult for the button, or you can supply the code to respond to an
OnClick event.
bkOK A green check mark and the text “OK” appears on the button face. The button
becomes the default button (the Default property is automatically set to True). When
the user chooses the button, the dialog box closes. The resulting ModalResult value of
the bitmap button is mrOK.
bkCancel A red X and the text “Cancel” appears on the button face. The button becomes the
Cancel button (the Cancel property is automatically set to True). When the user
chooses the button, the dialog box closes. The resulting ModalResult value of the
bitmap button is mrCancel.
bkYes A green check mark and the text “Yes” appears on the button face. The button
becomes the default button (the Default property is automatically set to True). When
the user chooses the button, any changes the user made in the dialog box are accepted
and the dialog box closes. The resulting ModalResult value of the bitmap button is
mrYes.
bkNo A red no symbol and the text “No” appears on the button face. The button becomes
the Cancel button (the Cancel property is automatically set to True). When the user
chooses the button, any changes the user made in the dialog box are canceled and the
dialog box closes. The resulting ModalResult value of the bitmap button is mrNo.
bkHelp A cyan question mark and the text “Help” appears on the button face. When the user
chooses the button, a Help screen in the application’s Help file appears. The Help file
that appears is the file specified as the value of the application’s HelpFile property. The
value of the HelpContext property of the button specifies which Help screen in the
Help file appears.
Value Meaning
bkClose A door with a green exit sign over it (use your imagination) and the text “Close”
appear on the button face. When the user chooses the button, the form closes. The
Default property of the button is True.
bkAbort A red X and the text “Abort” appears on the button face. The Cancel property of the
button is automatically set to True.
bkRetry A green circular arrow and the text “Retry” appear on the button face.
bkIgnore A green man walking away and the text “Ignore” appears on the button face. Use it to
allow the user to continue after an error has occurred.
bkAll A double green check mark and the text “Yes to All” appears on the button face. The
Default property of the button is automatically set to True.
Example
This example uses three bitmap buttons on a form. When the application runs, the Kind
property for each bitmap button is set, and the BitBtn1 button (the OK button) becomes
the default button.
procedure TForm1.FormCreate(Sender: TObject);
begin
BitBtn1.Kind := bkOK;
BitBtn2.Kind := bkCancel;
BitBtn3.Kind := bkHelp;
end;
See also
Cancel property, Default property, ModalResult property
Value Meaning
sbHorizontal Scroll bar is horizontal
sbVertical Scroll bar is vertical
For scroll bars of type TControlScrollBar (form and scroll box scroll bars accessed
through the HorzScrollBar and VertScrollBar properties), Kind is a read- and run-time-
only property.
Example
This example uses a radio group box and a scroll bar on a form. When the user selects
one of the radio buttons, the scroll bar changes orientation accordingly.
procedure TForm1.FormCreate(Sender: TObject);
Example
This code determines that when the user clicks the scroll bar on either side of the scroll
box, the scroll box moves 100 positions on the scroll bar:
ScrollBar1.LargeChange := 100;
See also
Max property, Min property, Position property, SmallChange property
Last method
Applies to
TList object; TQuery, TStoredProc, TTable components
Example
This example inserts two records into a list object and displays the contents of the last
record in the list on the form:
procedure TForm1.FormActivate(Sender: TObject);
type
PMyList = ^AList;
AList = record
I: Integer;
C: Char;
end;
var
MyList: TList;
ARecord: PMyList;
begin
MyList := TList.Create;
New(ARecord);
ARecord^.I := 100;
ARecord^.C := 'Z';
MyList.Add(ARecord); {Add integer 100 and character Z to list}
New(ARecord);
ARecord^.I := 200;
ARecord^.C := 'X';
MyList.Add(ARecord); {Add integer 200 and character X to list}
ARecord := MyList.Last;
Canvas.TextOut(10, 10, IntToStr(ARecord^.I)); {Display I}
Canvas.TextOut(10, 40, ARecord^.C); {Display C}
MyList.Free;
end;
See also
Capacity property, First method, IndexOf method, Items property
If the dataset is in Insert or Edit state, Last will perform an implicit Post of any pending
+
data. +
Example +
Table1.Last;
+
See also
First method, MoveBy method, Next method, Prior method, SetRangeEnd method +
Layout property
+
+
Applies to
TBitBtn, TSpeedButton components +
Declaration +
property Layout: TButtonLayout;
The Layout property determines where the image appears on the bitmap button or a
+
speed button. These are the possible values:
L
Value Meaning
blGlyphLeft The image appears near the left side of the button.
blGlyphRight The image appears near the right side of the button.
blGlyphTop The image appears near the top of the button.
blGlyphBottom The image appears near the bottom of the button.
Example
This example uses a bitmap button on a form that has a bitmap specified as the value of
its Glyph property. When the user clicks the bitmap button, the bitmap randomly
changes its position on the button:
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
Randomize;
case Random(4) of
0: BitBtn1.Layout := blGlyphLeft;
1: BitBtn1.Layout := blGlyphRight;
2: BitBtn1.Layout := blGlyphTop;
3: BitBtn1.Layout := blGlyphBottom;
end;
end;
See also
Margin property, Spacing property
Left property
Applies to
All controls; TFindDialog, TReplaceDialog components
Declaration
property Left: Integer;
The Left property determines the horizontal coordinate of the left edge of a component
relative to the form in pixels. For forms, the value of the Left property is relative to the
screen in pixels. The default value is -1.
The Left property for the Find and Replace dialog boxes is available at run-time only.
Example
The following example moves the button 10 pixels to the right each time a user clicks it:
procedure TForm1.Button1Click(Sender: TObject);
begin
Button1.Left := Button1.Left + 10;
end;
See also
SetBounds method, Top property
LeftCol property
Applies to
TDrawGrid, TStringGrid components
Declaration
property LeftCol: Longint;
Run-time only. The LeftCol property determines which column in the grid appears at the
far left side of the grid.
If you have one or more nonscrolling columns in the grid, they remain at the far left,
regardless of the value of the LeftCol property. In this case, the column you specify as the
far left column is the first column to the immediate right of the nonscrolling columns.
Example
This line of code positions the fourth column of a string grid at the left edge of the grid:
StringGrid1.LeftCol := 3;
See also
FixedCols property, TopRow property
Declaration
property Length: Longint;
Run-time and read only. The Length property specifies the length of the medium in the
open multimedia device. Length is specified using the current time format, which is
specified by the TimeFormat property.
Example
The following code sets Wait to False if the Length of the media is over 10,000. If
TimeFormat is tfMilliseconds, Wait is set to False if the media is over 10 seconds long.
MediaPlayer1.Wait := (MediaPlayer1.Lenth > 10000);
See also
Position property, Start property, TrackLength property
Level property
Applies to
TOutlineNode object
Declaration
property Level: Word;
Run-time and read only. The Level property indicates the level of indentation of an item
within the TOutline component. The value of Level is 1 for items on the top level. The
value of Level is 2 for their children, and so on.
Example
The following code tests to determine if the fifth outline item is on the same level as the
selected outline item.
if Outline1.Items[5].Level = Outline1.Items[Outline1.SelectedItem].Level then
{ The selected item is on the same level as the fifth item };
See also
ChangeLevelBy method, TopItem property
Lines property
Applies to
TDBMemo, TDDEClientItem, TDDEServerItem, TMemo, TOutline components
Declaration
property Lines: TStrings;
The Lines property contains the text lines in a memo component.
For a database memo control, the Lines property is a run-time property only.
Example
This example uses a button and a memo control on a form. When the user clicks the
button, the contents of the system’s AUTOEXEC.BAT file is loaded into the memo, and
the sixth line of the file is written across the top of the form.
procedure TForm1.Button1Click(Sender: TObject);
begin
Memo1.Lines.LoadFromFile('C:\AUTOEXEC.BAT');
Writeln('The 6th line of AUTOEXEC.BAT is: ', Memo1.Lines[5]);
end;
See also
GetTextBuf method, SetTextBuf method, Text property
Declaration
property Lines: TStrings;
The Lines property contains the text data to exchange in a DDE conversation. For
TDDEClientItem components, Lines specifies the text that is updated by the DDE server
application. For TDDEServerItem components, Lines specifies the text that is sent to any
DDE clients when the value of Lines changes or when a client requests to be updated.
When Lines is changed, an OnChange event occurs.
Lines corresponds to the Text property. Whenever the value of Lines or Text is changed,
the other is updated so that the first line of Lines is always equal to Text. Use Lines to
contain text values longer than 255 characters (which is the limit of the Text property).
For shorter strings, use the Text property.
If the Lines property is of a TDDEClientItem component, you can also send the text in
Lines directly to the DDE server by poking data with the PokeDataLines method.
If the Lines property is of a TDDEServerItem component, the DDE client can change Lines
by poking data. The poked data replaces the contents of Lines and an OnChange event
occurs.
Example
The following code assigns the value to the Lines property of DDEClientItem1 to the
Lines of Memo1. This code is executed in the OnChange event handler of
DDEClientItem1, so whenever the client is updated, the new data from the server is
displayed.
procedure TForm1.DdeClientItem1Change(Sender: TObject);
begin
Memo1.Lines := DDEClientItem1.Lines
end;
LineTo method
Applies to
TCanvas object
Declaration
procedure LineTo(X, Y: Integer);
The LineTo method draws a line on the canvas from the current drawing position
(specified by the PenPos property) to the point specified by X and Y and sets the pen
position to (X, Y).
Example
The following code draws a line from the upper left corner of a form to the point clicked
with the mouse.
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Canvas.MoveTo(0, 0);
Canvas.LineTo(X, Y);
end;
See also
MoveTo method
LinksDlg displays the Links dialog box. Use the Links dialog box to view and edit the
+
current OLE links in your application. These are the parameters of LinksDlg: +
Field
Form
Description
The form that owns the Links dialog box.
+
HelpContext A Help context ID number to be used if the user chooses Help from within the Links
dialog box. If you pass 0 for HelpContext, no Help button appears in the Links dialog
+
box. Pass a number other than 0 if you want to provide context-sensitive online Help.
+
Example
The following code activates the Links dialog with a context-sensitive Help ID number +
of 1000.
LinksDlg(Form1, 1000);
+
See also +
InsertOLEObjectDlg function, LinksDlgEnabled function, PasteSpecialDlg function
+
LinksDlgEnabled function Toctrl +
Declaration L
function LinksDlgEnabled(Form: TForm): Boolean;
LinksDlgEnabled determines if the Links dialog box is enabled. If so, LinksDlgEnabled
returns True and LinksDlg can be successfully called. If not, LinksDlgEnabled returns False
and nothing happens if you call LinksDlg.
The Form parameter specifies the form that owns the Links dialog box.
Example
The following code activates the Links dialog box if it is enabled.
if LinksDlgEnabled(Form1) then LinksDlg(Form1, 0);
List property
Applies to
TList object
Declaration
property List: PPointerList;
Run-time and read only. The List property stores a list of pointers that reference objects
of any type. The declaration of PPointerList is
PPointerList = ^TPointerList;
Example
The following code creates List1 and Object1, then adds Object1 to List1. If the first item
in the List property List1 differs from the first item of the Items property of List1 (which
shouldn’t happen), a message is displayed.
var
List1: TList;
Object1: TObject;
begin
List1 := TList.Create;
Object1 := TObject.Create;
List1.Add(Object1);
if List1.List^[0]<>List1.Items[0] then
MessageDlg('Something is wrong here', mtInformation, [mbOK], 0);
List1.Free;
Object1.Free;
end;
See also
FileEditStyle property, TStrings object
Ln function System
Declaration
function Ln(X: Real): Real;
The Ln function returns the natural logarithm (Ln(e) = n) of the real-type expression X.
Example
var
e : real;
S : string;
begin
e := Exp(1.0);
Str(ln(e):3:2, S);
S := 'ln(e) = ' + S;
Canvas.TextOut(10, 10, S);
end;
See also
Exp function
Example
This example uses a bitmap button on a form. When the application runs and the form is
created, a bitmap is placed on the bitmap button:
procedure TForm1.FormCreate(Sender: TObject);
begin
BitBtn1.Glyph.LoadFromFile('TARTAN.BMP');
end;
See also
SaveToFile method, Strings property
Example
{ Load a blob field with the contents of autoexec.bat }
BlobField1.LoadFromFile(‘c:\autoexec.bat’);
LoadFromStream method
Applies to
TBlobField, TGraphicField, TMemoField components
Declaration
procedure LoadFromStream(Stream: TStream);
The LoadFromStream method reads Stream and stores the contents in TBlobField,
TMemoField or TGraphicField.
Note For a TMemoField or TGraphicField, the file should have been created by the SaveToFile or
SaveToStream method.
Example
{ Load a blob field from an existing STream1 }
BlobField1.LoadFromStream(Stream1);
See also
LoadFromFile method, SaveToStream method
LoadMemo method
Applies to
TDBMemo component
Declaration
procedure LoadMemo;
The LoadMemo method loads a text BLOB into the database memo control. If the value of
+
the AutoDisplay property is False, the text of a memo is not automatically loaded. If
AutoDisplay is False, you can control when the text is loaded at run time by calling
+
LoadMemo when you want the text to appear in the control. +
Example
This example uses a database memo that is connected to a BLOB text field in the dataset.
+
It also contains a button. When the user clicks the button, the BLOB loads into the
memo. +
procedure TForm1.FormCreate(Sender: TObject);
begin
+
DBMemo1.AutoDisplay := False;
end; +
procedure TForm1.Button1Click(Sender: TObject);
begin +
DBMemo1.LoadMemo;
end; +
See also
LoadPicture method
+
L
LoadPicture method
Applies to
TDBImage component
Declaration
procedure LoadPicture;
The LoadPicture method loads the image specified as the value of the Picture property
into the database image control.
If the value of the AutoDisplay property is False, the image of a database image control is
not automatically loaded. If AutoDisplay is False, you can control when the image is
loaded at run time by calling LoadPicture when you want the image to appear in the
control.
Example
The following code loads the picture into DBImage1.
DBImage1.LoadPicture;
See also
LoadMemo method
Local property
Applies to
TQuery component
Declaration
property Local: Boolean;
Run-time and read only. The Local property specifies if the table referenced by the
TQuery is a local dBASE or Paradox table or an SQL server table. If Local is True, then the
table is a dBASE or Paradox table. If Local is False, the table is a SQL table.
For remote SQL tables, some operations (such as record counts) may take longer than
for local tables, owing to network constraints.
Example
{ If the table is local, allow the data-aware controls to display the changes }
DataSource1.Enabled := Query1.Local;
Locale property
Applies to
TDataBase, TTable, TQuery, TSession, TStoredProc components
Locked property
Applies to
TPanel component
Declaration
property Locked: Boolean;
The Locked property determines whether a panel is replaced by an in-place active OLE
object. If Locked is False, the OLE server can replace the panel. If Locked is True and the
panel is aligned to one of the edges of the form (its Align property is alTop, alBottom,
alLeft, or alRight), then the panel remains when an OLE object in a TOLEContainer
component is activated in place.
Use Locked to prevent status bars and the like from being replaced.
Example
The following code sets Locked to True for a panel named StatusBar.
StatusBar.Locked := True;
See also
InPlaceActive property
LoginPrompt property
Applies to
TDataBase component
Declaration
property LoginPrompt: Boolean;
The LoginPrompt property is used to control how security is handled for SQL databases.
If True, (the default), the standard Delphi Login dialog box will be opened when the
application attempts to establish a database connection. The user must then enter a
proper user name and password to connect to a database on the server.
If False, then an application will look for login parameters in the Params property of the
TDatabase component. These are the USERNAME and PASSWORD parameters. For
example,
USERNAME = SYSDBA
PASSWORD = masterkey
This is generally not recommended since it compromises server security.
Example
{ Do not display the login prompt }
Database1.LoginPrompt := False;
See also
OnLogin event
LongRec SysUtils
Declaration
LongRec = record
Lo, Hi: Word;
end;
LongRec declares a utility record that stores the high and low order bytes of the specified
variable as type Word.
LongRec is useful in handling double-word length variables.
See also
Hi function, Lo function
See also
LookupField property, Options property
LookupField property
Applies to
TDBLookupCombo, TDBLookupList components
Declaration
property LookupField: string;
The LookupField property links the dataset the database lookup combo box or database
lookup list box uses to “look up” data to the primary dataset you are working with.
Although the name of the field specified as the LookupField does not have to be the same
as the name of the field specified as the DataField, the two fields must contain the same
values. For example, the LookupField value can be CustomerNumber and the DataField
value can be CustNo, as along as both fields use the same number to identify a particular
customer. When you specify a LookupField, the current value of that field appears in the
control, if the Active property of both datasets is True.
After you specify a LookupField field, you can choose which field you prefer to display in
the control with the LookupDisplay property.
Example
The following code designates that DBLookupCombo1 looks up data in the
’CustomerNumber’ field.
DBLookupCombo1.LookupField := ’CustomerNumber’;
See also
DataSource property, LookupSource property
LookupSource property
Applies to
TDBLookupCombo, TDBLookupList components
Declaration
property LookupSource: TDataSource;
The LookupSource of a database lookup combo box or lookup list box is the data source
component (TDataSource) that identifies the dataset you want the control to use to “look
up” the information you want displayed in the control.
Example
The following code specifies that DataSource1 is the lookup source for DBLookupCombo1.
DBLookupCombo1.LookupSource := DataSource1;
See also
LookupDisplay property, LookupField property
See also
High function
Example
This example uses two edit boxes and a button on a form. When the user clicks the
button, the text in the Edit1 edit box displays in the Edit2 edit box in lowercase letters.
procedure TForm1.Button1Click(Sender: TObject);
begin
Edit2.Text := LowerCase(Edit1.Text);
end;
See also
AnsiLowerCase function, UpperCase function
MainForm property
Applies to
TApplication component
Declaration
property MainForm: TForm;
Run-time and read only. The MainForm property identifies which form in the
application is the main form, which is the form that is always created first. When the
main form closes, the application terminates.
When you create a new project, Form1 automatically becomes the value of the MainForm
property. If you want to make another form become the main form, use the Forms page
of the Options|Project Options dialog box.
See also
Application variable, CreateForm method, Run method
Mappings property
Applies to
TBatchMove component
Declaration
property Mappings: TStrings;
By default TBatchMove matches columns based on their position in the source and
destination tables. That is, the first column in the source is matched with the first column
in the destination, and so on.
To override the default column mappings, use the Mappings property. This is a list of
column mappings (one per line) in one of two forms. To map the column ColName in
the source table to the column of the same name in the destination table use:
See also
Source property
Margin property
Applies to
TBitBtn, TControlScrollBar, TSpeedButton components
Declaration
property Margin: Integer;
The Margin property determines the number of pixels between the edge of the image
(specified in the Glyph property) and the edge of the button. The edges that the margin
separates depends on the layout of the image and text (specified in the Layout property).
For example, if Layout is blGlyphLeft, the margin appears between the left edge of the
image and the left edge of the button. If Margin is 3, three pixels separates the image and
the button edges. If Margin is 0, no distance in pixels separates the image and the button
edges.
If Margin is -1 (which it is by default), then the image and text (specified in the Caption
property) are centered. The number of pixels between the image and button edge is
equal to the number of pixels between the opposite edge of the button and the text.
Example
This example uses a moderately large bitmap button on a form. When the application
runs, a bitmap (or glyph) is loaded on to the button, the bitmap appears on the right side
of the button, and bitmap is placed 30 pixels from the right edge of the bitmap button.
procedure TForm1.FormCreate(Sender: TObject);
begin
with BitBtn1 do
begin
Glyph.LoadFromFile('C:WINDOWS\CARS.BMP');
Layout := blGlyphRight;
Margin := 30;
end;
end;
See also
Caption property, Glyph property, Layout property
Declaration
procedure Margin: Word;
The Margin property value is the minimum number of pixels you want controls on a
form or in a scroll box to be from the edge of the form or scroll box. This number is
automatically added to the Range value to ensure that the user has a scroll bar whenever
the distance from a control and the edge of the form or scroll box becomes less than the
Margin value.
The default value is 0.
Example
This example uses a button and a label on a form. Place the label near the left side of the
form, and place the button somewhere near the middle of the form. When the user runs
the application, a horizontal scroll bar does not appear, because no control on the form is
close enough to the right edge. Each time the user clicks the button, the button moves 25
pixels to the right, and the calculated Range value is reported in the caption of the label.
Repeatedly clicking the button eventually moves the button close enough to the edge of
the form (within the Margin amount) so that a horizontal scroll bar appears:
Example
This example uses a filter combo box and a label on a form. When the user selects a filter
in the filter combo box, the selected mask appears in the caption of the label:
procedure TForm1.FilterComboBox1Change(Sender: TObject);
begin
Label1.Caption := 'The selected mask is ' + FilterComboBox1.Mask;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
FilterComboBox1.Filter := 'All files (*.*)|*.*| Pascal files (*.pas)|*.pas';
end;
See also
Filter property
Example
This example uses a file list box on a form. When the application runs, the list box
displays only files with a .PAS file extension:
procedure TForm1.FormCreate(Sender: TObject);
begin
FileListBox1.Mask := '*.PAS';
end;
See also
Filter property
MasterFields property
Applies to
TTable component
Declaration
property MasterFields: string;
Use the MasterFields property to specify the column(s) to link a detail table with a master
table that is specified by the MasterSource property. MasterFields is a string consisting of
one or more column names that join the two tables. Separate multiple column names
with semicolons. Each time the current record in the master table changes, the new
values in those fields are used to select corresponding records from the detail table for
display. At design time, use the Field Link Designer to set this property.
Example
Suppose you have a master table named Customer that contains a CustNo field, and you
also have a detail table named Orders that also has a CustNo field. To display only those
records in Orders that have the same CustNo value as the current record in Customer,
write this code:
Max property
Applies to
TScrollBar component
Declaration
property Max: Integer;
The Max property along with the Min property determines the number of possible
positions the scroll box can have on the scroll bar. The LargeChange and SmallChange
properties use the number of positions to determine how far to move the scroll box
when the user uses the scroll bar.
For example, if Max is 30000 and Min is 0, the scroll box can assume 30,000 positions on
a horizontal scroll bar. If the LargeChange property setting is 10000 and the scroll box
position is at the far left of the scroll bar (Position is 0), the user can click the scroll bar
three times to the right of the scroll box before the scroll box is moved all the way to the
right of the scroll bar (30000/10000 = 3).
If you want to change the Min, Max, and Position values all at once at run time, call the
SetParams method.
Example
This code changes the maximum position of the scroll bar from 100, the default value, to
30000:
ScrollBar1.Max := 30000;
See also
LargeChange property, Min property, Position property, SetParams method, SmallChange
property
Example
uses Dialogs;
type
FriendRec = record
Name: string[30];
Age: Byte;
end;
var
P: Pointer;
begin
if MaxAvail < SizeOf(FriendRec) then
MessageDlg('Not enough memory', mtWarning, [mtOk], 0)
else
begin
{ Allocate memory on heap }
GetMem(P, SizeOf(FriendRec));
{ ... }
end;
end;
See also
MinFontSize property
MaxLength property
Applies to
TComboBox, TDBEdit, TDBLookupCombo, TDBMemo, TEdit, TMaskEdit, TMemo
components
Declaration
property MaxLength: Integer;
The MaxLength property specifies the maximum number of characters the user can enter
in an edit box, memo, or combo box. The default setting for MaxLength is 0, which
means that there is no limit on the number of characters the control can contain. Any
other number limits the number of characters the control accepts.
Example
The following example sets the maximum number of characters for an edit box to 80:
Edit1.MaxLength := 80;
MaxPage property
Applies to
TPrintDialog component
Declaration
property MaxPage: Integer;
The MaxPage property determines the greatest page number the user can use when
specifying pages to print. If the user specifies a number greater than the value in
MaxPage, a warning message appears and the user must enter a valid number or close
the dialog box. The default value is 0.
Note The user can specify pages numbers only if the Options property set includes the value
poPageNums.
Example
This example uses a button and a Print dialog box on a form. When the user clicks the
button, the code makes page four the highest page number the user can select in the
Print dialog box and displays the dialog box:
procedure TForm1.Button1Click(Sender:TObject);
begin
PrintDialog1.Options := [poPageNums];
PrintDialog1.ToPage := 4;
PrintDialog1.MaxPage := 4;
if PrintDialog1.Execute then
...;
end;
See also
MinPage property
MaxRecords property
Applies to
TReport component
Declaration
property MaxValue: Longint;
The MaxValue property limits the maximum value in the field. Assigning a value greater
than MaxValue raises an exception.
Example
{ Limit a field to 1 to 10}
Field1.MaxValue := 10;
Field1.MinValue := 1;
See also
MinValue property
MDIChildCount property
Applies to
TForm component
Declaration
property MDIChildCount: Integer;
Run-time and read only. The value of the MDIChildCount property is the number of
child windows open in an MDI application.
Example
The following code closes Form1 if it has no MDI children open.
if Form1.MDIChildCount = 0 then Form1.Close;
See also
ActiveMDIChild property, FormStyle property, MDIChildren property
MDIChildren property
Applies to
TForm component
Declaration
property MDIChildren[I: Integer]: TForm;
Run-time and read only. The MDIChildren property array provides access to a child
window or form in an MDI application through an index value, I. The value of I is
determined by the order in which the window was created. For example, the first MDI
child window has an I value of 0.
Example
The following code closes all the MDI children of Form1.
var
I: Integer;
begin
with Form1 do
for I := 0 to MDIChildCount-1 do
MDIChildren[I].Close;
end;
See also
FormStyle property, MDIChildCount property
Example
This code displays a new menu named NewMenu when the user clicks the button
ChangeMenu button.
procedure TForm1.ChangeMenuClick(Sender: TObject);
begin
Menu := NewMenu;
end;
Merge method
Applies to
TMainMenu component
Declaration
procedure Merge(Menu: TMainMenu);
The Merge method merges a main menu of one form with a main menu of another for
non-MDI applications. For example, when your application uses the main menu of the
first form as the main menu for the application, and your application displays a second
form, you can call Merge to merge the main menu on the second form with the main
menu of the application.
Specify the menu you want merged with this menu as the Menu parameter.
Depending on the value of the GroupIndex property of menu items on the main menu,
the merged menu items can replace menu items on the menu bar, or add or insert menu
items into the menu bar. See GroupIndex for information on how to do these things.
It you want merging and unmerging to occur automatically when another form is
displayed, change the value of the AutoMerge property to True.
Example
This example uses two forms, each containing a main menu created with the Menu
Designer. It also uses a button on Form1. When the user clicks the button, Form2 appears
and the main menu of Form2 merges with that of Form1.
Before running this example, add Unit2 to the uses clause of Unit1.
procedure TForm1.Button1Click(Sender: TObject);
begin
Form2.Show;
MainMenu1.Merge(Form2.MainMenu1);
end;
See also
AutoMerge property, Unmerge method
MessageBox method
Applies to
TApplication component
Declaration
function MessageBox(Text, Caption: PChar; Flags: Word): Integer;
The MessageBox method is an encapsulation of the Windows API MessageBox function
except that you don’t need to supply a window handle.
The MessageBox method displays a generic dialog box that displays a message and one
or more buttons. The value of the Text parameter is the message, which can be longer
than 255 characters if necessary. Long messages are automatically wrapped in the
message box. The value of the Caption property is the caption that appears in the title bar
of the dialog box. Captions can be longer than 255 characters, but they don’t wrap. A
long caption results in a wide message box.
To see the possible values of the Flags parameter, see the MessageBox function in the
Windows API Help file (WinAPI.HLP). The corresponding parameter on that Help
screen is called TextType. The values determine the buttons that appear in the message
box and the behavior of the message box. The values can be combined to obtain the
+
effect your want. +
The return value of the MessageBox method is 0, if there wasn’t enough memory to
create the message box, or one of these values:. +
Value Numeric value Meaning +
IDABORT
IDCANCEL
3
2
The user chose the Abort button
The user chose the Cancel button +
IDIGNORE
IDNO
5
7
The user chose the Ignore button
The user chose the No button +
IDOK
IDRETRY
1
4
The user chose the OK button
The user chose the Retry button +
IDYES 6 The user chose the Yes button
+
Example
This example uses a button and a label on a form. When the user clicks the button, a +
message box appears. When the user responds to the message box, the button selected is
reported in the caption of the label: +
procedure TForm1.Button1Click(Sender: TObject);
var
Button: Integer;
+
begin
Button := Application.MessageBox('Welcome to Delphi!', 'Message Box', mb_OKCancel +
M
mb_DefButton1);
if Button = IDOK then
Label1.Caption := 'You chose OK';
if Button = IDCANCEL then
Label1.Caption := 'You chose Cancel';
end;
See also
MessageDlg function, MessageDlgPos function, ShowMessage procedure, ShowMessagePos
procedure
The AType parameter determines the type of message box that appears. These are the
possible values:
Value Meaning
mtWarning A message box containing a yellow exclamation point symbol.
mtError A message box containing a red stop sign.
mtInformation A message box containing a blue “i”.
mtConfirmation A message box containing a green question mark.
mtCustom A message box containing no bitmap. The caption of the message box is the name of
the application’s executable file.
The AButtons parameter determines which buttons appear in the message box. AButtons
is of type TMsgDlgBtns, which is a set, so you can include multiple buttons within the
set. These are the values you can include in the set:
Value Meaning
mbYes A button with a green check mark and the text ‘Yes’ on its face
mbNo A button with a red circle and slash mark through the circle and the text ‘No’ on its face
mbOK A button with a green check mark and the text ‘OK’ on its face
mbCancel A button with a red X and the text ‘Cancel’ on its face
mbHelp A button with a cyan question mark and the text ‘Help’ on its face
mbAbort A button with a red check mark and the text ‘Abort’ on its face
mbRetry A button with two green circular arrows and the text ‘Retry’ on its face
mbIgnore A button with a green man walking away and the text ‘Ignore’ on its face
mbAll A button with a green double check marks and the text ‘All’ on its face
In addition to the individual set values, VCL defines three constants that are predefined
sets that include common button combinations:
Value Meaning
mbYesNoCancel A set that puts the Yes, No, and Cancel buttons in the message box
mbOkCancel A set that puts the OK and Cancel buttons in the message box
mbAbortRetryIgnore A set that puts an Abort, Retry, and Ignore buttons in the message box
When using these constants, remember not to add the brackets [ ] to define the set. These
constants are already predefined sets.
The HelpCtx parameter determines which Help screen is available for the message box.
For more information about Help context values, see the HelpContext property.
The function returns the value of the button the user selected. These are the possible
return values:
See also
Kind property, MessageDlgPos function, ModalResult property, MessageBox method,
ModalResult property, ShowMessage procedure, ShowMessagePos procedure
Value Meaning
mtWarning A message box containing yellow exclamation point symbol.
mtError A message box containing a red stop sign.
mtInformation A message box containing a blue “i”.
mtConfirmation A message box containing a green question mark.
mtCustom A message box containing no bitmap. The caption of the message box is the
name of the application’s executable file.
The AButtons parameter determines which buttons appear in the message box. AButtons
is of type TMsgDlgBtns, which is a set, so you can include multiple buttons within the
set. These are the values you can include in the set:
Value Meaning
mbYes A button with a green check mark and the text ‘Yes’ on its button face
mbNo A button with a red circle and slash mark through the circle and the text ‘No’ on its button
face
mbOK A button with a green check mark and the text ‘OK’ on its button face
mbCancel A button with a red X and the text ‘Cancel’ on its button face
mbHelp A button with a cyan question mark and the text ‘Help’ on its button face
mbAbort A button with a red check mark and the text ‘Abort’ on its face
mbRetry A button with two green circular arrows and the text ‘Retry’ on its face
mbIgnore A button with a green man walking away and the text ‘Ignore’ on its face
mbAll A button with a green double check marks and the text ‘All’ on its face
In addition to the individual set values, VCL defines three constants that are predefined
sets which include common button combinations:
Value Meaning
mbYesNoCancel A set that puts the Yes, No, and Cancel buttons in the message box
mbOkCancel A set that puts the OK and Cancel buttons in the message box
mbAbortRetryIgnore A set that puts an Abort, Retry, and Ignore buttons in the message box
When using these constants, remember not to add the brackets [ ] to define the set. These
constants are already predefined sets.
The HelpCtx parameter determines which Help screen is available for the message box.
+
For more information about Help context values, see the HelpContext property. +
The X and Y integer parameters are the screen coordinates in pixels where the top left
corner of the message box appears. +
The function returns the value of the button the user selected. These are the possible
return values: +
Return values +
mrNone
mrOk
mrAbort
mrRetry
mrYes
mrNo
+
mrCancel mrIgnore mrAll
+
The MsgDlgButtonStyle constant in the Dialogs unit is declared like this:
MsgDlgButtonStyle: TButtonStyle = bsAutoDetect;
+
This ensures that the style of the buttons matches the style used by the operating
environment your application is running under. If you prefer to always use a particular
+
style, change the value of the MsgDlgButtonStyle. See the Style property for bitmap
buttons for the possible values and their meanings.
+
The MsgDlgGlyphs typed constant in the Dialogs unit is declared like this: +
MsgDlgGlyphs: Boolean = True;
This declaration ensures that bitmaps (or glyphs) appear on the message dialog box
M
buttons. If you prefer that the bitmaps are not present, change the value of
MsgDlgButtonStyle to False.
Example
This example displays a confirmation style message box at screen coordinates 125, 25
that asks users if they want to color the form green. If the user chooses Yes, the form
turns bright green:
procedure TForm1.Button1Click(Sender: TObject);
var
ButtonSelected: Word;
begin
if MessageDlgPos(‘Color the form green?', mtConfirmation,
[mbYes, mbNo], 0, 125, 25) := mrYes then
Color := clLime;
end;
This example uses a button on a form. When the user clicks the button, a message box
appears with a Yes, No, and Cancel button on it:
procedure TForm1.Button1Click(Sender: TObject);
begin
MessageDlgPos('Are you there?', mtConfirmation, mbYesNoCancel, 0, 200, 200);
end;
See also
Kind property, MessageBox method, MessageDlg function, ModalResult property,
ShowMessage procedure, ShowMessagePos procedure
Metafile property
Applies to
TPicture object
Declaration
property Metafile: TMetafile
The Metafile property specifies the contents of the TPicture object as a Windows metafile
graphic (.WMF file format). If Metafile is referenced when the TPicture contains a Bitmap
or Icon graphic, the graphic won’t be converted. Instead, the original contents of the
TPicture are discarded and Metafile returns a new, blank metafile.
Example
The following line of code displays the pixels-per-inch of the coordinate mapping of a
metafile. The Inch property of the metafile stored in the MyGraphic is converted to text
and assigned to the Caption of Label1.
Label1.Caption := IntToStr(MyGraphic.Metafile.Inch);
See also
Graphic property
Min property
Applies to
TScrollBar component
Declaration
property Min: Integer;
The Min property along with the Max property determines the number of possible
positions the scroll box can have on the scroll bar. The LargeChange and SmallChange
properties use the number of positions to determine how far to move the scroll box
when the user uses the scroll bar.
For example, if Max is 3000 and Min is 0, the scroll box can assume 3000 positions on a
horizontal scroll bar. If the LargeChange property setting is 1000 and the scroll box
position is at the far left of the scroll bar (Position is 0), the user can click the scroll bar
three times to the right of the scroll box before the scroll box is moved all the way to the
right of the scroll bar (3000/1000 = 3).
If you want to change the Min, Max, and Position values all at run time, call the
+
SetParams method. +
Example
The following code sets the minimum position to the value specified in an edit box, and
+
sets the maximum position to 1000 more than the minimum position. +
+
ScrollBar1.Min := StrToInt(Edit1.Text);
ScrollBar1.Max := ScrollBar1.Min + 1000;
See also
LargeChange property, Max property, Position property, SetParams method, SmallChange
+
property +
MinFontSize property +
Applies to
+
TFontDialog component
+
Declaration
property MinFontSize: Integer;
+
The MinFontSize property determines the smallest font size available in the Font dialog M
box. Use the MinFontSize property when you want to limit the font sizes available to the
user. To limit the font sizes available, the Options set property of the Font dialog box
must also contain the value fdLimitSize. If fdLimitSize is False, setting the MinFontSize
property has no affect on number of fonts available in the Font dialog box.
The default value is 0, which means there is no minimum font size specified.
Example
This example uses a Font dialog box, a button, and a label on a form. When the user
clicks the button, the Font dialog box appears. The font sizes available are within the
range of 10 to 14. When the user chooses OK, the selected font is applied to the caption
of the label.
procedure TForm1.Button1Click(Sender: TObject);
begin
FontDialog1.Options := [fdLimitSize];
FontDialog1.MaxFontSize := 14;
FontDialog1.MinFontSize := 10;
if FontDialog1.Execute then
Label1.Font := FontDialog1.Font;
end;
See also
MinFontSize property
Minimize method
Applies to
TApplication component
Declaration
procedure Minimize;
The Minimize method shrinks your application into an icon on your Windows desktop.
Example
This example uses a button named Shrink on a form. When the user clicks the button, the
application minimizes to an icon:
procedure TForm1.ShrinkClick(Sender: TObject);
begin
Application.Minimize;
end;
See also
Application variable, Icon property
MinPage property
Applies to
TPrintDialog component
Declaration
property MinPage: Integer;
The MinPage property determines the smallest page number the user can use when
specifying pages to print. If the user specifies a number less than the value of MinPage, a
warning message appears and the user must enter a valid number or close the dialog
box. The default value is 0.
Note The user can specify pages numbers only if the Options property set includes the value
poPageNums.
Example
This example uses a button and a Print dialog on a form. When the user clicks the
button, the code sets the lowest and the highest possible page numbers the user can
select and displays the dialog box:
procedure TForm1.Button1Click(Sender: TObject);
begin
with PrintDialog1 do
begin
See also
MaxValue property
Example
uses Dialogs;
begin
{$I–}
{ Get directory name from TEdit control }
MkDir(Edit1.Text);
if IOResult <> 0 then
MessageDlg('Cannot create directory', mtWarning, [mbOk], 0)
else
MessageDlg('New directory created', mtInformation, [mbOk], 0);
end;
See also
ChDir procedure, GetDir procedure, RmDir procedure
ModalResult property
Applies to
TBitBtn, TButton, TForm components
Declaration
property ModalResult: TModalResult;
Run-time only. The ModalResult property for forms is used to terminate a modal form.
By default, ModalResult is 0. Setting ModalResult to any nonzero value ends the form’s
modal state. When the user chooses to close a modal form, the button click sets
ModalResult to close the form. The value assigned to ModalResult becomes the return
value of the ShowModal function call which displayed the modal form.
Button controls have a ModalResult property also that is read only. Use a button’s
ModalResult property when you want a click of the button to close a modal form. For
example, if you create a dialog box with two buttons, OK and Cancel, set the
ModalResult property to mrOK for the OK button and mrCancel for the Cancel button.
When the user chooses either of these two buttons, the dialog box’s modal state ends
because ModalResult is greater than mrNone and the dialog box disappears. Using
ModalResult, you don’t have to write an event handler just to close the dialog box.
These constants are possible ModalResult values:
Constant Value
mrNone 0
mrOk idOK
mrCancel idCancel
mrAbort idAbort
mrRetry idRetry
mrIgnore idIgnore
Mode property
Applies to
TPen object; TMediaPlayer component
Example
The following code sets the mode of the pen of the Canvas of Form1 to the inverse of the
pen Color.
Form1.Canvas.Pen.Mode := pmNotCopy;
See also
Pen property, TPen object
Value Mode
mpNotReady Not ready
mpStopped Stopped
mpPlaying Playing
mpRecording Recording
mpSeeking Seeking
mpPaused Paused
mpOpen Open
Example
The following code declares an array of strings named ModeStr, indexed by the
TMPModes type. The Caption of a form is then set to the string describing the current
mode of the device:
const
Example
BatchMove1.Mode := batAppendUpdate;
Modified property
Applies to
TBitmap, TGraphic, TIcon, TMetafile objects, TDBEdit, TDBMemo, TEdit, TMaskEdit,
TMemo, TOLEContainer, TQuery, TStoredProc, TTable components
If the graphics object was modified, you can save the changes to a file with the
SaveToFile method. The next time the application is run, the object can be loaded from
the file with the LoadFromFile method.
Example
The following code saves the bitmap object in Graphic1 to a file if it was modified.
if Graphic1.Modified then Graphic1.SaveToFile('myfile.bmp');
Example
The following code saves the object in OLEContainer1 to the file OBJ.OLE if it was
modified.
if OLEContainer1.Modified then OLEContainer1.SaveToFile('OBL.OLE');
Example
procedure TForm1.Button1Click(Sender: TObject);
begin
if Edit1.Modified = True then
begin
MessageDlg('Edit box text was modified',
mtInformation, [mbOK], 0);
Declaration
property Monochrome: Boolean;
The Monochrome property determines if the bitmap displays in monochrome. If True, the
bitmap is monochrome. If False, the bitmap displays in color.
Example
The following code create Bitmap1 and sets its Monochrome property to True.
var
Bitmap1: TBitmap;
begin
Bitmap1 := TBitmap.Create;
Bitmap1.Monochrome := True;
end;
MouseToCell method
Applies to
TDrawGrid, TStringGrid components
Declaration
procedure MouseToCell(X, Y: Integer; var ACol, ARow: Longint);
The MouseToCell method returns the column and row of the cell the mouse pointer is
positioned on. The X and Y parameters are the screen coordinates of the mouse pointer.
The ACol parameter is the number of the column where the mouse pointer is positioned,
and the ARow parameter is the number of the row.
Usually the MouseToCell method is used in a mouse event handler, which supplies the
mouse coordinates to the method call.
Example
This example uses a string grid on a form. When the user selects a cell in the grid and
releases the mouse button, the column and row coordinates for the cell appear in the
cell. The code for displaying the coordinates is written in the OnMouseUp event handler:
procedure TForm1.FormCreate(Sender: TObject);
begin
StringGrid1.DefaultColWidth := 100;
end;
procedure TForm1.StringGrid1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
Column, Row: Longint;
begin
StringGrid1.MouseToCell(X, Y, Column, Row);
StringGrid1.Cells[Column, Row] := 'Col ' + IntToStr(Column) +
',Row ' + IntToStr(Row);
end;
See also
CellRect method, OnMouseDown event, OnMouseMove event, OnMouseUp event
Move method
Applies to
TList, TStringList, TStrings objects
Declaration
procedure Move(CurIndex, NewIndex: Integer);
The Move method changes the position of an item in the list of a list object or in a list of
+
strings in a string object by giving the item a new index value. The CurIndex parameter is
the item’s current index, and the NewIndex parameter is the item’s new index value.
+
If a string in a string object has an associated object in the Objects property, Move moves +
both the string and the object.
+
Example
This example uses a list box and a button on a form. The list box contains items when
the form appears. When the user clicks the button, the fifth item in the list box is moved
+
to the top of the list box: +
procedure TForm1.FormCreate(Sender: TObject);
var
I: Integer;
+
begin
for I := 1 to 5 do
+
end;
ListBox1.Items.Add('Item ' + IntToStr(I));
+
procedure TForm1.Button1Click(Sender: TObject);
begin +
ListBox1.Items.Move(4, 0);
end; +
See also
Add method, Delete method, Exchange method, Objects property, Strings property
M
Move procedure System
Declaration
procedure Move(var Source, Dest; Count: Word);
The Move procedure copies Count bytes from a Source to Dest. No range-checking is
performed.
When the segment parts of Source and Dest are equal, Move compensates for overlaps
between the source and destination blocks. If the source and destination overlap but
their segment parts are not equal, Move will not compensate for overlaps and there is a
50% chance that Move will not work correctly. Borland Pascal’s static and dynamic
(heap) memory allocation schemes never create overlapping variables whose addresses
have different segment parts, so this problem can only occur if the addresses of Source
and Dest are modified or normalized by your program, or if they are provided by an
external source.
Whenever possible, use SizeOf to determine the count.
Example
var
A: array[1..4] of Char;
B: Longint;
begin
Move(A, B, SizeOf(A)); { SizeOf = safety! }
end;
See also
FillChar procedure, SizeOf function
MoveBy method
Applies to
TTable, TQuery, TStoredProc components
Declaration
procedure MoveBy(Distance: Integer);
The MoveBy method moves the dataset cursor by Distance records. If Distance is
negative, the move is backward. If Distance is positive, the movement is forward. If
Distance is zero, no move is done.
If the dataset is in Insert or Edit state, MoveBy will perform an implicit Post of any
pending data.
Example
{ Skip three records forward }
Table1.MoveBy(3);
See also
First method, Last method, Next method, Prior method
MovedCount property
Applies to
TBatchMove component
Declaration
property MovedCount: Longint;
Run-time and read only. MovedCount is the number of records which were actually
processed by the Execute method. This includes any records which had integrity or data
size problems.
Example
The following code draws a line from the upper-eft corner of a form to the point clicked
with the mouse:
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Canvas.MoveTo(0, 0);
Canvas.LineTo(X, Y);
end;
See also
LineTo method
Declaration
procedure MoveTo(Destination: Longint; AttachMode: TAttachMode);
Description
The MoveTo method moves an outline item from one location to another within an
outline (TOutline component). The Destination parameter determines where to move the
item. Pass the Index value of another outline item in the Destination parameter. The
AttachMode parameter specifies how you want to attach the item to the destination
position. These are the possible values of AttachMode:
Value Meaning
oaAdd The item is attached as if added with the Add method. The moved item becomes the last
sibling of the item specified by the Destination parameter. The moved item will share the
same parent as the Destination item.
oaAddChild The item is attached as if added with the AddChild method. The moved item becomes the
last child of the item specified by the Destination parameter. The Destination item will
become the parent of the moved item.
oaInsert The item is attached as if inserted with the Insert method. The moved item replaces the
Destination item in the outline, while the Destination item and all other following items are
moved down one row.
Example
The following code moves the selected item to become the first item in the outline.
with Outline1.Items[Outline1.SelectedItem] do
MoveTo(0, oaInsert);
See also
ChangeLevelBy method
Name property
Applies to
All components; TFieldDef, TFieldDefs, TIndexDef, TIndexDefs, TFont, TParam, TParams
objects
For components
Declaration
property Name: TComponentName;
The Name property contains the name of the component as referenced by other
components. By default, Delphi assigns sequential names based on the type of the
component, such as ‘Button1’, ‘Button2’, and so on. You may change these to suit your
needs.
Example
The following code lists the names of all the components of Form1 in a list box.
var
I: Integer;
begin
for I := 0 to Form1.ComponentCount-1 do
ListBox1.Items.Add(Form1.Components[I].Name);
end;
Example
This code sets the font for all text that appears on the form to Times New Roman. If the
controls on the form have their ParentFont property set to True, text on these controls
will also be in Times New Roman.
procedure TForm1.FormCreate(Sender: TObject);
begin
Font.Name := 'Times New Roman';
end;
See also
ParentFont property
NetFileDir property
Applies to
TSession component
Declaration
property NetFileDir: string;
Run-time only. The NetFileDir property specifies the directory that contains the BDE
network control file, PDOXUSRS.NET. This property enables multiple users to share
Paradox tables on network drives. NetFileDir overrides the specification defined for the
Paradox driver in the BDE Configuration Utility.
All applications that need to share the same Paradox database must specify the same
directory, and all must have read/write/create rights for the directory.
See also
Session variable
Example
type
Str18 = string[18];
var
P: ^Str18;
begin
New(P);
P^ := 'Now you see it...';
Dispose(P); { Now you don't... }
end;
See also
Dispose procedure, FreeMem procedure, GetMem procedure
NewPage method
Applies to
TPrinter object
Declaration
procedure NewPage;
The NewPage method forces the current print job to begin printing on a new page in the
+
printer. It also increments the value of the PageNumber property and resets the value of
the Pen property of the Canvas back to (0, 0).
+
Example
+
This example uses a button on a form. When the user clicks the button, a rectangle is
printed twice, one per page.
+
To run this example successfully, you must add the Printers unit to the uses clause of
your unit.
+
procedure TForm1.Button1Click(Sender: TObject); +
+
begin
with Printer do
begin
BeginDoc;
Canvas.Rectangle(10, 10, 200, 200); +
NewPage;
Canvas.Rectangle(10, 10, 200, 200);
EndDoc;
+
end;
end;
+
See also
+
BeginDoc method, EndDoc method, Printer variable
+
NewStr function SysUtils N
Declaration
function NewStr(const S: string): PString;
The NewStr function allocates a copy of the string S on the heap and returns a pointer to
the newly allocated string. When your application finishes using the allocated string,
you should use DisposeStr to dispose of the string on the heap.
Do not change the length of strings allocated with NewStr. Increasing the length of the
string overwrites other variables on the heap. Decreasing the length of the string
prevents some of the memory from being deallocated.
Example
The following code allocates space for and places the string ‘New String’ in memory.
The pointer S points to the new string:
var
S: PString;
begin
S := NewStr('New String');
.
.
DisposeStr(S);
See also
DisposeStr procedure
Next method
Applies to
TForm, TMediaPlayer, TQuery, TStoredProc, TTable components
The Next method either activates the next form, media track, or record.
For forms
Declaration
procedure Next;
The Next method makes the next child form in the form sequence the active form.
For example, if you have three child forms within a parent form in your MDI
application and Form2 is the active form, the Next method makes Form3 the active form.
Calling Next again makes Form4 active. The next time your application calls Next, the
sequence starts over again and Form2 becomes the active form once again.
The Next method applies only to forms that are MDI parent forms (have a FormStyle
property value of fsMDIForm).
Example
The following code activates the next child of Form1.
Form1.Next;
See also
ArrangeIcons method, Cascade method, Previous method, Tile method
The Wait property determines whether control is returned to the application before the
+
Next method has completed. The Notify property determines whether Next generates an
OnNotify event.
+
Example
+
The following code opens a WAV audio file and fast-forwards to the end of the
medium.
+
MediaPlayer1.DeviceType := dtWAVAudio;
MediaPlayer1.FileName := ’c:\chimes.wav’;
+
MediaPlayer1.Open;
MediaPlayer1.Next;
+
See also +
Position property, Previous method, Tracks property
+
For tables, queries, and stored procedures +
Declaration +
procedure Next;
The Next method moves the cursor forward by one record. If the cursor is already on the
+
last record, it does not move. If the dataset is in Insert or Edit state, Next will perform an
implicit Post of any pending data. +
Example N
{ Move to the next record }
Table1.Next;
if Table1.Eof then { No more records };
See also
First method, Last method, MoveBy method, Prior method
NormalizeTopMosts method
Applies to
TApplication component
Declaration
procedure NormalizeTopMosts;
The NormalizeTopMosts method makes forms that have been designated as topmost
forms (their FormStyle is fsStayOnTop) behave as if they were not topmost forms. You’ll
find this method convenient to use if you want a message box or dialog box to appear
on top of a topmost form.
For example, while you do not have to call NormalizeTopMosts to use the Delphi
methods and functions that display message boxes (such as MessageBox and
MessageDlg), you should call it if you want to call Windows API functions directly to
display a message box. If you neglect to call NormalizeTopMosts, the message box won’t
display on top of the form, but the form remains on top. Any time you call Windows
API functions to display a window on top of a form, call NormalizeTopMosts first.
To return the forms designated as fsStayOnTop to be topmost again, call
RestoreTopMosts.
Example
The following code normalizes topmost forms before calling the MessageBox function in
the WinProcs unit. After the message box is closed, the topmost forms are restored.
begin
Application.NormalizeTopMosts;
MessageBox(Form1.Handle, 'This should be on top.', 'Message Box', MB_OK);
Application.RestoreTopMosts;
end;
See also
FormStyle property, RestoreTopMosts method
Notify property
Applies to
TMediaPlayer component
Declaration
property Notify: Boolean;
Run-time only. The Notify property determines whether the next call to a media control
method (Back, Close, Eject, Next, Open, Pause, PauseOnly, Play, Previous, StartRecording,
Resume, Rewind, Step, or Stop) generates an OnNotify event when the method has
completed.
If Notify is True, the next media control method generates OnNotify event upon
completion and stores the notification message in the NotifyValue property. If Notify is
False, the method does not generate an OnNotify event and NotifyValue remains
unchanged.
Notify affects only the next call to a media control method. After an OnNotify event,
Notify must be reset to affect any subsequent media control methods.
By default, Play and StartRecording function as if Notify is True. You must set Notify to
False before calling Play or StartRecording to prevent an OnNotify event from being
generated when playing or recording has finished. By default, all other media control
methods function as if Notify is False.
Set Notify to True if the next media control is expected to take a long time, so your
+
application is notified when the media control method has completed. If you set Notify
to True, you might want to set Wait to False so that control returns to the application
+
Note
before the media control method is finished.
If you try to resume a device that doesn’t support Resume, the device is resumed as if
+
you called the Play method. If you have assigned True to Notify before calling Resume (or
any other media control method), Notify doesn’t affect the call to Resume. Resume does
+
not generate an OnNotify event upon completion, and NotifyValue remains unchanged.
+
Example
The following code sets Notify to True after opening and playing the Microsoft Video for
+
the Windows file named DUCK.AVI. When the Play method is completed, an OnNotify
event occurs, which displays a message. +
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
+
with MediaPlayer1 do begin
FileName := 'duck.avi'; +
+
Open;
Play;
Notify := True;
end;
end; +
procedure TForm1.MediaPlayer1Notify(Sender: TObject);
begin
if MediaPlayer1.NotifyValue=nvSuccessful then
+
end;
MessageDlg('Done playing video.', mtInformation, [mbOK], 0); N
NotifyValue property
Applies to
TMediaPlayer component
Declaration
property NotifyValue: TMPNotifyValues;
Run-time and read only. The NotifyValue property reports the result of the last media
control method (Back, Close, Eject, Next, Open, Pause, PauseOnly, Play, Previous,
StartRecording, Resume, Rewind, Step, or Stop) that requested a notification. Set Notify to
True before calling a media control method to request notification.
The following table lists the possible values for NotifyValue.
Value Result
nvSuccessful Command completed successfully
nvSuperseded Command was superseded by another command
Value Result
nvAborted Command was aborted by the user
nvFailure Command failed
Example
This example uses a media player component named MediaPlayer1. When the
application runs, the code attempts to play a CD in the CD audio device, and displays a
message dialog box indicating whether the attempt to play the CD was successful.
Before you can run this example, you must have a CD audio device installed correctly.
procedure TForm1.FormCreate(Sender: TObject);
begin
with MediaPlayer1 do
begin
DeviceType := dtCDAudio;
Open;
Play;
if NotifyValue <> nvSuccessful then
MessageDlg('Error playing CD audio', mtError, [mbOk], 0)
else
MessageDlg('Playing CD audio', mtInformation, [mbOk], 0);
Visible := False;
end;
end;
See also
OnNotify event
Example
This example uses a label and a button on a form. When the user clicks the button, the
current date and time appear as the caption of the label.
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption := 'The date and time is ' + DateTimeToStr(Now);
end;
See also
Date function, DateTimeToStr function, Time function
If only one image is present, Delphi attempts to represent the other states by altering the
image slightly for the different states, although the stay down state is always the same as
the up state. If you aren’t satisfied with the results, you can provide additional images in
the bitmap.
Example
This example uses a speed button and a label on a form. When the example runs, the
number of images in the specified bitmap appears as the caption of the label.
See also
Glyph property
ObjClass property
Applies to
TOLEContainer component
Declaration
property ObjClass: string;
Specify the OLE class of an object in the ObjClass property. The class of an object is
typically the application name of the OLE server application without the .EXE
extension. See the documentation for the OLE server for specific information about its
OLE class.
At design time, specifying the ObjClass property displays the Insert Object dialog box
and initializes the OLE object. At run time, the ObjClass property is specified
automatically when you initialize the OLE object with the PInitInfo property.
Example
The following code tests to determine if “Paintbrush Picture” is the object class. If so, a
message is displayed in Label1 when Button1 is clicked.
procedure TForm1.Button1Click(Sender: TObject);
begin
if OLEContainer1.ObjClass = 'Paintbrush Picture' then
Label1.Caption := 'The object is a Paintbrush Picture';
end;
See also
ObjDoc property, ObjItem property
ObjDoc property
Applies to
TOLEContainer component
Declaration
property ObjDoc: string;
Specify the OLE document of an object in the ObjDoc property. The document of an
+
object is typically the name of the file containing the OLE information. See the OLE
server documentation for specific information about its OLE documents.
+
At design time, specifying the ObjDoc property displays the Insert Object dialog box and +
initializes the OLE object. At run time, the ObjDoc property is specified automatically
when you initialize the OLE object with the PInitInfo property, if the object is linked to
data in a file.
+
Example
+
The following code tests to determine if ‘c:\windows\256color.bmp’ is the object
document. If so, a message is displayed in Label1 when Button1 is clicked.
+
procedure TForm1.Button1Click(Sender: TObject);
begin
+
if OLEContainer1.ObjDoc = 'c:\windows\256color.bmp' then
Label1.Caption := 'The object document is c:\windows\256color.bmp';
+
end;
+
See also
ObjClass property, ObjItem property +
+
ObjectMenuItem property
+
Applies to
TForm component +
Declaration O
property ObjectMenuItem: TMenuItem;
ObjectMenuItem is used to specify the OLE object menu item. If you create a menu item
and specify it as the OLE object menu item with the ObjectMenuItem property, the item is
automatically enabled when an OLE object in an OLE container is selected.
The OLE object menu item can be used to activate or convert the selected object. All you
need to do is specify the menu item in the ObjectMenuItem component. The processing
of activating or converting the object is handled by the OLE server application.
Example
The following code assigns MyObject1 to the ObjectMenuItem property of Form1. When
an OLE container that contains an object is selected, the caption of the MyObject1 menu
item can be modified by the OLE server and the functionality of MyObject1 will be
handled by the server.
Form1.ObjectMenuItem := MyObject1;
Objects property
Applies to
TStringList, TStrings objects; TStringGrid component
Example
The following code allows the user to specify a bitmap file with the OpenDialog1 open
dialog box component when Form1 is created. Then, the bitmap file specified is added to
the Items list of ListBox1.
If ListBox1 is an owner-draw control (specified by a Style property of lbOwnerDrawFixed
or lbOwnerDrawVariable), the second procedure is the OnDrawItem event handler for
ListBox1. The bitmap in the Object property and the text of an item are retrieved and
displayed in Listbox1.
procedure TForm1.FormCreate(Sender: TObject);
var
TheBitmap: TBitmap;
begin
if OpenDialog1.Execute then
begin
TheBitmap := TBitmap.Create;
TheBitmap.LoadFromFile(OpenDialog1.FileName);
Example
The following code stores a TBitmap object called MyBitmap in row 3, column 10 of
StringGrid1.
StringGrid1.Objects[10, 3] := MyBitmap;
See also
Cells property, Cols property, Free method, Rows property
ObjItem property
Applies to
TOLEContainer component
Declaration
property ObjItem: string;
Specify the OLE item of an object in the ObjItem property. The item of an object is a
discrete unit of data within the OLE document containing the OLE information. See the
OLE server documentation for specific information about its OLE documents.
At design time, specifying the ObjItem property displays the Paste Special dialog box
and initializes the OLE object. At run time, the ObjItem property is specified
automatically when you initialize the OLE object with the PInitInfo property, if the
object linked is a more specific piece of data than is specified by the ObjDoc property.
Example
The following code tests to determine if “29 8 337 96” is the object item (this could be the
item if you copied a portion of a Paintbrush picture to the Clipboard and wanted to link
to the bitmap defined by the coordinates (29, 8) and (337, 96)). If so, a message is
displayed in Label1 when Button1 is clicked.
procedure TForm1.Button1Click(Sender: TObject);
begin
if OLEContainer1.ObjDoc = '29 8 337 96' then
Label1.Caption := 'The object item is 29 8 337 96';
end;
See also
ObjClass property
Example
begin
if Odd(5) then
Canvas.TextOut(10, 10, '5 is odd.')
else
Canvas.TextOut(10, 10, 'Something is odd!');
end;
Canvas.TextOut(5, Y, S);
Y := Y + Canvas.TextHeight(S) + 5;
S := 'The global data segment is $' + MakeHexWord(DSeg);
Canvas.TextOut(5, Y, S);
Y := Y + Canvas.TextHeight(S) + 5;
S := 'The stack segment is $' + MakeHexWord(SSeg);
Canvas.TextOut(5, Y, S);
Y := Y + Canvas.TextHeight(S) + 5;
S := 'The stack pointer is at $' + MakeHexWord(SPtr);
Canvas.TextOut(5, Y, S);
Y := Y + Canvas.TextHeight(S) + 5;
S := 'i is at offset $' + MakeHexWord(Ofs(i));
Canvas.TextOut(5, Y, S);
Y := Y + Canvas.TextHeight(S) + 5;
S := 'in segment $' + MakeHexWord(Seg(i));
Canvas.TextOut(5, Y, S);
end;
See also
Addr function, Seg function
OLEObjAllocated method
Applies to
TOLEContainer component
Declaration
function OleObjAllocated: Boolean;
The OLEObjAllocated method specifies whether an OLE container has been initialized
and therefore contains an OLE object. OLEObjAllocated returns True if an OLE object has
been allocated, or False if the OLE container is empty.
Example
The following code only initializes OLEContainer1 if it does not already contain an OLE
object, assuming TheInitInfo points to valid initialization information.
if not OLEContainer1.OLEObjAllocated then
OLEContainer1.PInitInfo := TheInitInfo;
See also
PInitInfo property
OnActivate event
Applies to
TApplication, TForm, TOLEContainer components
Declaration
property OnActivate: TNotifyEvent;
The OnActivate event for an OLE container occurs when the OLE object is activated as
specified by the AutoActivate property.
Example
The following code displays the number of times an OLE container has been activated in
Label1. The code assumes that TimesActivated is an Integer field of Form1 that is initialized
to 0 in the OnCreate event of Form1.
procedure TForm1.OleContainer1Activate(Sender: TObject);
begin
TimesActivated := TimesActivated + 1;
Form1.Label1.Caption := 'Times activated: '+IntToStr(TimesActivated);
end;
For an application
Declaration
property OnActivate: TNotifyEvent;
The OnActivate event for an application occurs when the application becomes active.
Your application becomes active when it is initially run or when focus is shifted from
another Windows application to your application.
Note Search Help for “Handling Application Events” for more information about creating
event handlers for application events.
Example
The following code is the entire unit which assigns the ApplicationActivate procedure to
the OnActivate event of the application. Note that ApplicationActivate is declared as a
method of Form1. The code that you add is notes with comments. The rest of the code is
generated by Delphi.
unit Unit1;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs;
type
TForm1 = class(TForm)
procedure ApplicationActivate(Sender: TObject); {Add this declaration line}
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Example
This example uses an edit box and a memo on a form. When the user switches the focus
between the two controls, the control that currently has the focus becomes red:
type
TForm1 = class(TForm)
Edit1: TEdit;
Memo1: TMemo;
Button1: TButton;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
procedure ColorControl(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.ColorControl(Sender: TObject);
begin
if Edit1.Focused then
Edit1.Color := clRed
else
Edit1.Color := clWindow;
if Memo1.Focused then
Memo1.Color := clRed
else
Memo1.Color := clWindow;
procedure TForm1.FormCreate(Sender: TObject);
begin
Screen.OnActiveControlChange := ColorControl;
end;
See also
ActiveControl property, ActiveForm property, OnActiveFormChange event
OnActiveFormChange event
Applies to
TScreen component
Declaration
property OnActiveFormChange: TNotifyEvent;
The OnActiveFormChange event occurs when a new form becomes the active form on the
screen (the form becomes the value of the ActiveForm property). Use the
OnActiveFormChange event to specify any special processing to occur just before a new
form becomes the active form.
Example
This example uses a two forms with a button on the first form. When the user clicks the
button, the second form appears. As the user switches between forms, the form that is
active is colored aqua:
type
TForm1 = class(TForm)
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
procedure ColorForm(Sender: TObject);
Declaration
property OnApply: TFDApplyEvent
The OnApply event occurs when the user clicks the Apply button in the Font dialog box.
The Apply button won’t appear in the Font dialog box unless the form has an OnApply
event handler. The user can use the Apply button to apply the font selected in the dialog
box to a component immediately before the dialog box is closed.
Example
This code displays the Font dialog box and puts an Apply button in it. When the user
clicks the Apply button, the font selected in the dialog box is applied to the Button1
button while the dialog box is still open.
procedure TForm1.Button1Click(Sender: TObject);
begin
FontDialog1.Execute;
end;
procedure TForm1.FontDialog1Apply(Sender: TObject; Wnd: Word);
begin
Button1.Font := FontDialog1.Font;
end;
See also
Execute method, Font property
OnCalcFields event
Applies to
TTable, TQuery, TStoredProc components
Declaration
property OnCalcFields: TDataSetNotifyEvent;
The OnCalcFields event is used to set the values of calculated fields. OnCalcFields is called
when a dataset reads a record from the database. In addition, if the dataset’s
AutoCalcFields property is True, OnCalcFields is called when a non-calculated field is
modified while the dataset is in Edit or Insert state.
Typically, the OnCalcFields event will be called often, so it should be kept short.
OnCalcFields should not perform any actions that modify the dataset (or the linked
dataset if it is part of a master-detail relationship), because this can lead to recursion.
While the OnCalcFields event is executed, a dataset will be put in CalcFields state. When a
dataset is in CalcFields state, you cannot set the values of any fields other than calculated
fields. After OnCalcFields is completed, the dataset will return to its previous state.
The first call to the OnCalcFields event handler may occur before all components in your
application have been initialized. If your handler requires access to another component,
use the Edit|Creation Order command to ensure that the components are created in the
correct order.
OnChange event
Applies to
TBitmap, TBrush, TCanvas, TFont, TGraphic, TGraphicsObject, TMetafile, TPen, TPicture,
TStringList objects; TComboBox, TDBComboBox, TDBEdit, TDBLookupCombo, TDBMemo,
TDBRadioGroup, TDDEClientItem, TDDEServerItem, TDirectoryListBox, TDriveComboBox,
TEdit, TFileListBox, TFilterComboBox, TMaskEdit, TMemo, TQuery, TScrollBar, TTable,
TTabSet, TBCDField, TBlobField, TBooleanField, TBytesField, TCurrencyField, TDateField,
TDateTimeField, TFloatField, TGraphicField, TIntegerField, TMemoField, TSmallintField,
TStringField, TTimeField, TVarBytesField, TWordField components
Example
The following code updates the contents of an edit box with the linked text from a DDE
server when the data is updated.
procedure TForm1.DdeClientItem1Change(Sender: TObject);
begin
Edit1.Text := DDEClientItem1.Text;
end;
Example
The following code displays a message if the data accessed by DBMemo1 changes.
procedure TForm1.DBMemo1Change(Sender: TObject);
begin
MessageDlg('Data has changed',mtInformation,[mbOK],0);
end;
For fields
Declaration
property OnChange: TFieldNotifyEvent;
OnChange is activated when the contents of the field are modified. If a data-aware
control is linked to the field, OnChange is not activated until the control attempts to store
the changes into the current record.
You can take any special actions required by the event by assigning a method to this
property.
Example
Field1.OnChange := CapitalizeFirstLetter;
For combo boxes, the OnChange event also occurs when an item is selected in the drop
+
down list. +
For string list objects, the OnChange event occurs when a change to a string stored in the
list of strings changes. +
Example +
This example uses a color grid on a form. The color grid is a component on the Samples
page of the Component palette. When the user clicks a color rectangle or drags the
mouse cursor across the color grid, the color of the form changes.
+
procedure TForm1.ColorGrid1Change(Sender: TObject); +
+
begin
Color := ColorGrid1.ForegroundColor;
end;
See also
+
OnChanging event
+
OnChanging event +
Applies to
+
TCanvas object
+
Declaration
property OnChanging: TNotifyEvent;
+
An OnChanging event occurs immediately before the graphic contained in the canvas is
modified.
O
OnClick event
Applies to
TBitBtn, TButton, TCheckBox, TComboBox, TDBCheckBox, TDBComboBox, TDBEdit,
TDBImage, TDBListBox, TDBLookupCombo, TDBLookupList, TDBMemo, TDBNavigator,
TDBRadioGroup, TDBText, TDirectoryListBox, TDrawGrid, TDriveComboBox, TFileListBox,
TFilterComboBox, TForm, TGroupBox, TImage, TLabel, TListBox, TMaskEdit, TMediaPlayer,
TMemo, TMenuItem, TNotebook, TOutline, TPaintBox, TPanel, TRadioButton, TScrollBar,
TScrollBox, TSpeedButton, TStringGrid, TTabSet components
An OnClick event occurs when the user presses and releases the mouse button when the
mouse pointer is over one of the control buttons of the media player control, or when
the user presses Spacebar when the media player control has focus. When the media
player control has focus, the user can select which control button to click when the
Spacebar is pressed with the Left Arrow or Right Arrow keys.
Example
This example uses a label and a media player on a form. When the user clicks one of the
media player buttons, the caption of the label indicates which button was clicked. For
this example to run successfully, you must have a CD audio device installed correctly.
procedure TForm1.FormCreate(Sender: TObject);
begin
MediaPlayer1.DeviceType := dtCDAudio;
MediaPlayer1.Open;
MediaPlayer1.Left := 20;
MediaPlayer1.Top := 12;
Label1.Top := 44;
Label1.Left := 20;
Label1.Color := clYellow;
Label1.Font.Name := 'Arial';
Label1.Caption := 'Click Me';
end;
procedure TForm1.MediaPlayer1Click(Sender: TObject; Button: TMPBtnType;
var DoDefault: Boolean);
begin
case Button of
btPlay :
begin
Label1.Caption := 'Playing';
Label1.Left := 20;
end;
btPause:
begin
Label1.Caption := 'Paused';
Label1.Left := 48;
end;
btStop:
begin
Label1.Caption := 'Stopped';
Label1.Left := 76;
end;
btNext:
begin
Label1.Caption := 'Next';
Label1.Left := 104;
end;
btPrev:
begin
Label1.Caption := 'Previous';
Label1.Left := 132;
Example
The form in this example changes color each time the user clicks it:
procedure TForm1.FormClick(Sender: TObject);
begin
Randomize;
Color := Random(65535);
end;
See also
Click method, OnDblClick event
OnClose event
Applies to
TDDEClientConv, TForm components
See also
OnCloseQuery event, OnOpen event
Example
The following code displays a message when a conversation is closed.
OnCloseQuery event
Applies to
TForm component
Declaration
property OnCloseQuery: TCloseQueryEvent;
The OnCloseQuery event occurs when an action to close the form takes place (when the
Close method is called or when the user chooses Close from the form’s System menu).
An OnCloseQuery event handler contains a Boolean CanClose variable that determines
whether a form is allowed to close. It’s default value is True. See the TCloseQueryEvent
type for more information about CanClose.
You can use an OnCloseQuery event handler to ask users if they are sure they really want
the form closed immediately. For example, you can use the handler to display a message
box that prompts the user to save a file before closing the form.
Example
When the user attempts to close the form in this example, a message dialog appears that
asks the user if it is OK to close the form. If the user chooses the OK button, the form
closes. If the user chooses Cancel, the form doesn’t close.
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
if MessageDlg('Close the form?', mtConfirmation,
[mbOk, mbCancel], 0) = mrCancel then
CanClose := False;
end;
See also
Close method, OnClose event
OnColEnter event
Applies to
TDBGrid component
Declaration
property OnColEnter: TNotifyEvent;
The OnColEnter event occurs when the user clicks a cell in a column or moves to a
+
column with the Tab key within the data grid. Use the OnColEnter event to specify any
processing you want to occur as soon as a column is entered.
+
Example
+
The following code concatenates an asterisk to the display label of a field when the
column is entered.
+
procedure TForm1.DBGrid1ColEnter(Sender: TObject);
begin
+
with DBGrid1.SelectedField do
DisplayLabel := '* ' + DisplayLabel;
+
end;
+
See also
OnColExit event +
OnColExit event
+
+
Applies to
TDBGrid component +
Declaration +
property OnColExit: TNotifyEvent;
The OnColExit event occurs when the user uses the Tab key to move out of a column or
+
clicks a cell in another column. Use the OnColExit event to specify any special processing
you want to occur when exiting the column. O
Example
The following code deletes the first two characters from the display label of the selected
field when exiting a column. Note that FirstTime is a Boolean field that prevents
characters from being deleted the first time a column is exited. Use this code in
conjunction with code in the example of OnColEnter to modify the appearance of the
display label of columns while they are entered.
procedure TForm1.DBGrid1ColExit(Sender: TObject);
var
TheLabel: string;
begin
if FirstTime then
FirstTime := False
else
begin
with DBGrid1.SelectedField do
begin
TheLabel := DisplayLabel;
Delete(TheLabel, 1, 2);
DisplayLabel := TheLabel;
end;
end;
end;
See also
OnColExit event
OnCollapse event
Applies to
TOutline component
Declaration
property OnCollapse: EOutlineChange;
An OnCollapse event occurs when an expanded outline item that has subitems is
collapsed. An expanded outline item is collapsed when the user double-clicks it at run
time, when the FullCollapse method is called, or when its Expanded property is set to
False. When collapsed, the subitems no longer appear in the outline and the plus picture
or closed picture for the parent item is displayed if the appropriate OutlineStyle has been
selected.
Example
The following code displays the text from a collapsed outline item in a message dialog
box.
procedure TForm1.Outline1Collapse(Sender: TObject; Index: Longint);
var
TheStr: string;
begin
TheStr := Outline1.Items[Index].Text;
MessageDlg(TheStr+' has collapsed.', mtInformation, [mbOK],0);
end;
See also
OnExpand event, PictureClosed property, PicturePlus property
OnColumnMoved event
Applies to
TDrawGrid, TStringGrid components
Declaration
property OnColumnMoved: TMovedEvent;
The OnColumnMoved event occurs when the user moves a column using the mouse. The
+
user can move a column only if the Options property set includes the value goColMoving. +
Example
The following code permits one column to be moved (assuming [goColMoving] is
+
specified for the Options property at design time), then locks the columns by preventing
any more moves.
+
procedure TForm1.StringGrid1ColumnMoved(Sender: TObject; FromIndex, ToIndex: Longint);
begin
+
StringGrid1.Options := StringGrid1.Options - [goColMoving];
end;
+
See also +
OnRowMoved event
+
OnCreate event +
Applies to +
TForm component
+
Declaration
property OnCreate: TNotifyEvent;
+
The OnCreate event specifies which event handler to call when the form is first created.
You can write code in the event handler that sets initial values for properties and does
+
any processing you want to occur before the user begins interacting with the form.
Delphi creates a form when the application is run by calling the Create method.
O
Note When writing code in an OnCreate event handler, don’t fully qualify a component
reference by including the name of the form in the reference. For example, if the form is
named Form1 and contains an Edit1 edit box control, don’t refer to the edit box control
with the Form1.Edit1 name. Because Form1 doesn’t yet exist when this code executes,
your application would crash if you used the fully qualified name. Instead, simply use
the name Edit1.
When a form is being created and its Visible property is True, the following events occur
in the order listed:
• OnActivate
• OnShow
• OnCreate
• OnPaint
Example
This very simple OnCreate event handler assures that the form is the same color as the
Windows system color of your application workspace:
See also
OnActivate event, OnDestroy event, OnPaint event
OnDataChange event
Applies to
TDataSource component
Declaration
property OnDataChange: TDataChangeEvent;
The OnDataChange occurs when the State property changes from dsInactive, or when a
data-aware control notifies the TDataSource that something has changed.
Notification occurs when the following items change because of field modification or
scrolling to a new record: field component, record, dataset component, content, and
layout. The Field parameter to the method may be nil if more than one of the fields
changed simultaneously (as in a move to a different record). Otherwise, Field is the field
which changed.
See also
OnStateChange event, State property
OnDblClick event
Applies to
TComboBox, TDBComboBox, TDBEdit, TDBGrid, TDBImage, TDBListBox,
TDBLookupCombo, TDBLookupList, TDBMemo, TDBNavigator, TDBText,
TDirectoryListBox, TDrawGrid, TDriveComboBox, TEdit, TFileListBox, TFilterComboBox,
TForm, TGroupBox, TImage, TLabel, TListBox, TMaskEdit, TMemo, TNotebook,
TOLEContainer, TOutline, TPaintBox, TPanel, TRadioButton, TScrollBox, TSpeedButton,
TStringGrid components
Example
The following code minimizes an application when it’s deactivated. Note that
AppDeactivate should be declared a method of TForm1.
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnDeactivate := AppDeactivate;
end;
procedure TForm1.AppDeactivate(Sender: TObject);
begin
Application.Minimize;
end;
See also
OnActivate event
OnDestroy event
Applies to
TForm component
Declaration
property OnDestroy: TNotifyEvent;
The OnDestroy event occurs when a form is about to be destroyed. A form is destroyed
by the Destroy, Free, or Release methods, or when the main form of the application is
closed.
Example
The following code explicitly allocates memory for a a pointer in the OnCreate event of
Form1, then releases the memory in the OnDestroy event. Assume that MyPtr is a Pointer
type field of TForm1.
procedure TForm1.FormCreate(Sender: TObject);
begin
New(MyPtr);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
Dispose(MyPtr);
end;
See also
OnCreate event
OnDragDrop event
Applies to
TBitBtn, TButton, TCheckBox, TComboBox, TDBCheckBox, TDBComboBox, TDBEdit,
TDBGrid, TDBImage, TDBListBox, TDBLookupCombo, TDBLookupList, TDBMemo,
TDBNavigator, TDBText, TDBRadioGroup, TDirectoryListBox, TDrawGrid,
TDriveComboBox, TEdit, TFileListBox, TFilterComboBox, TForm, TGroupBox, TImage,
TListBox, TMaskEdit, TMemo, TNotebook, TOLEContainer, TOutline, TPaintBox, TPanel,
TRadioButton, TScrollBar, TScrollBox, TShape, TStringGrid, TTabSet components
Declaration
property OnDragDrop: TDragDropEvent;
The OnDragDrop event occurs when the user drops an object being dragged. Use the
OnDragDrop event handler to specify what you want to happen when the user drops an
object. The Source parameter of the OnDragDrop event is the object being dropped, and
the Sender is the control the object is being dropped on. The X and Y parameters are the
coordinates of the mouse positioned over the control.
See also +
DragCursor property, DragMode property, OnDragOver event, OnEndDrag event
+
OnDragOver event +
Applies to +
TBitBtn, TButton, TCheckBox, TComboBox, TDBCheckBox, TDBComboBox, TDBEdit,
TDBGrid, TDBImage, TDBListBox, TDBLookupCombo, TDBLookupList, TDBMemo,
TDBNavigator, TDBText, TDBRadioGroup, TDirectoryListBox, TDrawGrid,
+
TDriveComboBox, TEdit, TFileListBox, TFilterComboBox, TForm, TGroupBox, TImage,
TListBox, TMaskEdit, TMemo, TNotebook, TOLEContainer, TOutline, TPaintBox, TPanel,
+
TRadioButton, TScrollBar, TScrollBox, TShape, TStringGrid, TTabSet components
O
Declaration
property OnDragOver: TDragOverEvent;
The OnDragOver event occurs when the user drags an object over a component. Usually
you’ll use an OnDragOver event to accept an object so the user can drop it.
The OnDragOver event accepts an object when its Accept parameter is True.
Usually, you will want the cursor to change shape, indicating that the control can accept
the dragged object if the user drops it. You can change the shape of the cursor by
changing the value of the DragCursor property for the control at either design or run
time before an OnDragOver event occurs.
Example
This OnDragOver event handler permits the list box to accept a dropped label:
procedure TForm1.ListBox1DragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
begin
Accept := Source is TLabel;
end;
The Source parameter identifies what is being dragged. The Sender is the control being
dragged over.
This code permits the list box to accept any dropped control:
procedure TForm1.ListBox1DragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
begin
Accept := True;
end;
See also
DragMode property, OnDragDrop event, OnEndDrag event, TDragState type
OnDrawCell event
Applies to
TDrawGrid, TStringGrid components
Declaration
property OnDrawCell: TDrawCellEvent;
The OnDrawCell event occurs whenever the contents of a grid cell need to be
redisplayed. For example, it occurs when the user selects a cell or scrolls the grid. How a
cell is redrawn depends on the value of the DefaultDrawing property.
If DefaultDrawing is False, you must write the code that handles all drawing within the
cell in the OnDrawCell event handler.
Example
The following code draws a focus rectangle around each of the cells of StringGrid1.
procedure TForm1.StringGrid1DrawCell(Sender: TObject; Col, Row: Longint;
Rect: TRect; State: TGridDrawState);
begin
StringGrid1.Canvas.DrawFocusRect(Rect);
end;
OnDrawDataCell event
Applies to
TDBGrid component
Declaration
property OnDrawDataCell: TDrawDataCellEvent;
The OnDrawDataCell event occurs whenever the contents of a data grid cell need to be
+
redisplayed. For example, it occurs when the user selects a cell or scrolls the grid. How a
cell is redrawn depends on the value of the DefaultDrawing property.
+
If DefaultDrawing is False, you must write the code that handles all the drawing within +
the cell in the OnDrawDataCell event handler.
+
Example
The following code fills the cells of DBGrid1 with the pattern defined by the Brush of the
Canvas of DBGrid1.
+
procedure TForm1.DBGrid1.DrawDataCell(Sender: TObject; Rect: TRect; Field: TField; +
+
State: TGridDrawState)
begin
DBGrid1.Canvas.FillRect(Rect);
end;
+
OnDrawItem event +
Applies to +
TComboBox, TDBComboBox, TDBListBox, TListBox, TOutline components
+
Declaration
property OnDrawItem: TDrawItemEvent;
+
The OnDrawItem event occurs whenever an item in an owner-draw outline, list box, or
combo box needs to be redisplayed. For example, it occurs when the user selects an item
+
or scrolls the outline, list box, or combo box. OnDrawItem events occur only for outlines
with the Style value osOwnerDraw, list boxes with the Style values lbOwnerDrawFixed or
O
lbOwnerDrawVariable, and for combo boxes with the Style values csOwnerDrawFixed or
csOwnerDrawVariable.
OnDrawItem passes four parameters to its handler describing the item to be drawn:
• a reference to the control containing the item
• the index of the item in that control
• a rectangle in which to draw
• the state of the item (selected, focused, and so on)
The size of the rectangle that contains the item is determined either by the ItemHeight
property for fixed owner-draw controls or by the response to the OnMeasureItem event
for variable owner-draw controls.
Example
Here is a typical handler for an OnDrawItem event. In the example, a list box with the
lbOwnerDrawFixed style draws a bitmap to the left of each string.
procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect;
State: TOwnerDrawState);
var
Bitmap: TBitmap; { temporary variable for the item’s bitmap }
Offset: Integer; { text offset width }
begin
with (Control as TListBox).Canvas do { draw on the control canvas, not on the form }
begin
FillRect(Rect); { clear the rectangle }
Offset := 2; { provide default offset }
Bitmap := TBitmap(Items.Objects[Index]); { get the bitmap for this item }
if Bitmap <> nil then
begin
BrushCopy(Bounds(Rect.Left + 2, Rect.Top, Bitmap.Width, Bitmap.Height), Bitmap,
Bounds(0, 0, Bitmap.Width, Bitmap.Height), clRed); { render the bitmap }
Offset := Bitmap.width + 6; { add four pixels between bitmap and text }
end;
TextOut(Rect.Left + Offset, Rect.Top, Items[Index]) { display the text }
end;
end;
Note that the Rect parameter automatically provides the proper location of the item
within the control’s canvas.
See also
ItemHeight property, OnMeasureItem event
OnDrawTab event
Applies to
TTabSet component
Declaration
property OnDrawTab: TDrawTabEvent;
The OnDrawTab event occurs when a tab needs to redisplay only for tab set controls that
have the Style property value of tsOwnerDraw. For example, it happens when the user
selects a tab or scrolls the tabs using an owner-draw tab set control.
You must write the code in the OnDrawTab event handler to draw the tab.
OnDrawTab occurs just after the OnMeasureTab event, which contains the code to
calculate the width of the tab needed. The height of the tab is determined by the value of
the TabHeight property of the tab set control. The code you write in the OnDrawTab
event handler, therefore, must use the width determined with the OnMeasureTab event
to draw the tab.
Example
The following code loads a bitmap from the Objects property of the Tabs list of the
DriveTabSet tab set component. This bitmap is then drawn on the tab, along with the text
from the Tabs list.
OnEndDrag event
Applies to
TBitBtn, TButton, TCheckBox, TComboBox, TDBCheckBox, TDBComboBox, TDBEdit,
TDBGrid, TDBImage, TDBListBox, TDBLookupCombo, TDBMemo, TDBNavigator,
TDBText, TDBRadioGroup, TDirectoryListBox, TDrawGrid, TDriveComboBox, TEdit,
TFileListBox, TFilterComboBox, TGroupBox, TImage, TListBox, TMaskEdit, TMemo,
TNotebook, TOLEContainer, TOutline, TPanel, TRadioButton, TScrollBar, TScrollBox,
TShape, TStringGrid, TTabSet components
Declaration
property OnEndDrag: TEndDragEvent;
The OnEndDrag event occurs whenever the dragging of an object ends, either by
dropping the object or by canceling the dragging. Use the OnEndDrag event handler to
specify any special processing you want to occur when dragging stops. If the dragged
object was dropped and accepted by the control, the Target parameter of the OnEndDrag
event is True. If the object was not dropped successfully, the value of Target is nil.
Example
This code displays a message in a label named Status. The message displayed depends
on whether or not the dragged label control was dropped into and accepted by a list box
control successfully:
procedure TForm1.LabelEndDrag(Sender, Target: TObject; X, Y: Integer);
var
S: string;
begin
S := (Sender as TLabel).Name + ' was dropped... and ';
if Target <> nil then S := S + 'accepted!'
else S := S + 'rejected!';
Status.Caption := S;
end;
The Target parameter is the list box and Sender is the label.
See also
EndDrag method, OnDragDrop event
OnEnter event
Applies to
All windowed controls
Declaration
property OnEnter: TNotifyEvent;
The OnEnter event occurs when a component becomes active. Use the OnEnter event
handler to specify any special processing you want to occur when a component
becomes active.
Note The OnEnter event does not occur when switching between forms or between another
Windows application and your application.
Note The OnEnter event for a TPanel or THeader component never occurs as panels and
headers never receive focus.
See also
ActiveControl property, OnActivate event, OnExit event +
OnException event
+
Applies to
O
TApplication component
Declaration
property OnException: TExceptionEvent;
The OnException event occurs when an unhandled exception occurs in your application.
By default, the HandleException method calls the OnException event handler, which calls
ShowException to display a message dialog box appears indicating an error occurred.
You can change this behavior by specifying what processing you want to occur in the
OnException event handler.
Note Search Help for “Handling Application Events” for more information about creating
event handlers for application events.
Example
The following code defines the default exception handling of the application, assuming
AppException is declared a method of TForm1.
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnException := AppException;
end;
procedure TForm1.AppException(Sender: TObject; E: Exception);
begin
Application.ShowException
end;
OnExecuteMacro event
Applies to
TDDEServerConv component
Declaration
property OnExecuteMacro : TMacroEvent;
The OnExecuteMacro event occurs when a DDE client application sends a macro to a
DDE server conversation component. Write code to process the macro in the
OnExecuteMacro event handler. See the DDE client application documentation for
information about how it sends macros. If the DDE client is a Delphi application, a
macro is sent with the ExecuteMacro method of the TDDEClientConv component.
Example
The following code clears the contents of a memo in the server application if the
appropriate message is sent from the client application.
procedure TForm1.DdeServerConv1ExecuteMacro(Sender: TObject; Msg: TStrings);
begin
if Msg.Strings[0] = 'Edit|Clear' then
Memo1.Clear;
end;
OnExit event
Applies to
All windowed controls
Declaration
property OnExit: TNotifyEvent;
The OnExit event occurs when the input focus shifts away from one control to another.
Use the OnExit event handler when you want special processing to occur when this
control ceases to be active.
Note The OnExit event does not occur when switching between forms or between another
Windows application and your application.
Note The OnExit event for a TPanel or THeader component never occurs as panels and headers
never receive focus.
Declaration
property OnExpand: EOutlineChange;
An OnExpand event occurs when a collapsed outline item having subitems is expanded.
A collapsed outline item is expanded when the user double-clicks on it at run time,
when its Expanded property is set to True, or when the FullExpand method of the
TOutlineNode object is called. When expanded, the subitems appear in the outline and
the minus picture or open picture for the parent item is displayed if the appropriate
OutlineStyle has been selected.
Example
The following code displays the text from a collapsed outline item in a message dialog
box.
procedure TForm1.Outline1Expand(Sender: TObject; Index: Longint);
var
TheStr: string;
begin
TheStr := Outline1.Items[Index].Text;
MessageDlg(TheStr+' has expanded.', mtInformation, [mbOK],0);
end;
See also
OnCollapse event, PictureMinus property, PictureOpen property
OnFind event
Applies to
TFindDialog, TReplaceDialog components
Declaration
property OnFind: TNotifyEvent;
The OnFind event occurs whenever the user chooses the Find Next button in the Find or
Replace dialog box. Use the OnFind event to specify what you want to happen when the
user chooses the Find Next button.
Example
The following text compares the FindText to the Text of the Items of Outline1. If the string
is found, a message is displayed and I-1 specifies the index of the matching item.
procedure TForm1.FindDialog1Find(Sender: TObject);
var
I: Integer;
Found: Boolean;
begin
I := 1;
Found := False;
repeat
if Outline1.Items[I].Text = FindDialog1.FindText then
begin
MessageDlg('Found!', mtInformation, [mbOK], 0);
Found := True;
end;
I := I+1;
until (I > Outline1.ItemCount) or (Found);
end;
See also
OnReplace event
OnGetEditText event
Applies to
TDrawGrid, TStringGrid components
Declaration
property OnGetEditText: TGetEditEvent;
The OnGetEditText event occurs when the Options property set contains the value
goEditing and the grid needs to redisplay the text of a cell in the grid. For example, the
grid needs to redisplay the text when the user scrolls the grid or the user changes the
data.
You write the code to retrieve the text of the cell in the OnGetEditText event handler.
When the user edits data in a grid, the OnSetEditText event occurs to change the actual
data, then the OnGetEditText event occurs to display the changed data in the grid.
Example
The following code appends ‘My ‘ to any text entered in StringGrid1.
procedure TForm1.StringGrid1GetEditText(Sender: TObject; ACol,
ARow: Longint; var Value: OpenString);
begin
Value := 'My ' + Value;
end;
See also
OnGetEditMask event, OnSetEditText event
OnGetText event
Applies to
TBCDField, TBlobField, TBooleanField, TBytesField, TCurrencyField, TDateField,
TDateTimeField, TFloatField, TGraphicField, TIntegerField, TMemoField, TSmallintField,
TStringField, TTimeField, TVarBytesField, TWordField components
Declaration
property OnGetText: TFieldGetTextEvent;
The OnGetText event is activated when the DisplayText or Text properties are referenced.
The DisplayText parameter indicates if the event should supply the text in display
format or in edit format for the Text property. If OnGetText has been assigned a method,
the default processing for DisplayText or Text does not occur; the event handler is
expected to perform any conversion required to display the value.
By assigning a method to this property, you can take any special actions required by the
event.
Example
Field1.OnGetText := MyFormatMethod;
OnHide event
Applies to
TForm component
Declaration
property OnHide: TNotifyEvent;
The OnHide event occurs just before the form is hidden on the screen. Use the OnHide
event to specify any special processing you want to happen just before the form
disappears.
A form that is an MDI child form (FormStyle is fsMDIChild) loses its window handle
+
when it is hidden. If your application performs some operation that causes the window
handle to come back, such as adding items to a list box on the form, an exception is
+
raised. +
Example
This example uses two forms, each with a label and a button. When the user clicks a
+
button, the other form appears and the current form disappears. Also, a message
appears in the label of the form that is showing, indicating that the other form is hidden. +
This is the implementation section of Unit1:
implementation
+
{$R *.DFM} +
uses Unit2;
procedure TForm1.Button1Click(Sender: TObject);
+
begin
Form2.Show; +
+
Hide;
end;
procedure TForm1.FormHide(Sender: TObject);
begin
Form2.Label1.Caption := 'Form1 is hiding';
+
end;
end.
+
This is the implementation section of Unit2: +
implementation
{$R *.DFM}
O
uses Unit1;
procedure TForm2.Button1Click(Sender: TObject);
begin
Form1.Show;
Hide;
end;
procedure TForm2.FormHide(Sender: TObject);
begin
Form1.Label1.Caption := 'Form2 is hiding';
end;
end.
See also
OnShow event
OnHelp event
Applies to
TApplication component
Declaration
property OnHelp: THelpEvent;
The OnHelp event occurs when your application receives a request for help. Use the
OnHelp event handler to specify any special processing you want to occur when help is
requested.
The HelpContext and the HelpJump methods automatically trigger the OnHelp event.
Note Search Help for “Handling Application Events” for more information about creating
event handlers for application events.
Example
The following code changes the Help file for the application to the results of the Open
dialog component. AppHelp should be assigned to the OnHelp event handler of
Application in the OnCreate event of Form1.
function TForm1.AppHelp(Command: Word; Data: Longint): Boolean;
begin
if OpenDialog1.Execute then
Application.HelpFile := OpenDialog1.FileName;
end;
See also
HelpCommand method, HelpContext property, HelpFile property, THelpEvent type
OnHint event
Applies to
TApplication component
Declaration
property OnHint: TNotifyEvent;
The OnHint event occurs when the user positions the mouse pointer over a control with
a Hint property value other than an empty string (‘’). Use the OnHint event handler to
perform any special processing you want to happen when the OnHint event occurs.
A common use of the OnHint event is to display the value of a control or menu item’s
Hint property as the caption of a panel control (TPanel), thereby using the panel as a
status bar. Using the Hint property, you can specify a Help Hint and a usually longer
hint that appears elsewhere when the OnHint event occurs.
Search Help for “Handling Application Events” for more information about creating
+
event handlers for application events. +
Example
This example uses a panel component, a menu, and an edit box on a form. You can
+
design the menu as you want, but remember to include a value for the Hint property for
each menu item in the menu. Also, specify a value for the Hint property of the edit box.
+
Align the panel at the bottom of the form (choose alBottom as the value of the Align
property), and left justify the caption of the panel (choose taLeftJustify as the value of the +
Alignment property).
The OnHint event is an event of the TApplication component. You can’t use the Object
+
Inspector to generate an empty event handler for TApplication, so you will need to write
your own OnHint event handler. To accomplish this, you create a method of the TForm1 +
object and give it an appropriate name, such as DisplayHint. You write the method in the
implementation part of the unit, but you must also remember to declare the method in +
the TForm1 type declaration in the public section.
In the DisplayHint method, you assign the Hint property of the application to the Caption +
property of the panel component.
One task remains. The OnHint event is an event of TApplication, so you must assign the
+
new method you created as the method used by the OnHint event. You can do this in
the form’s OnCreate event handler.
+
This code shows the complete type declaration, the new method, and the OnCreate event
handler. When the user runs the application and positions the cursor over the edit box
+
or a menu item on the menu, the specified hint appears as the caption of the panel at the
bottom of the form:
+
type
TForm1 = class(TForm)
O
Button1: TButton;
Panel1: TPanel;
Edit1: TEdit;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
procedure DisplayHint(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.FRM}
procedure TForm1.DisplayHint(Sender: TObject);
begin
Panel1.Caption := Application.Hint;
end;
See also
OnCreate event
OnIdle event
Applies to
TApplication component
Declaration
property OnIdle: TIdleEvent
The OnIdle event occurs whenever the application is idle. Use the OnIdle event handler
to specify any special processing to occur when your application is idle. Your
application is idle when it is processing code, for example, or when it is waiting for
input from the user.
The TIdleEvent type has a Boolean parameter Done that is True by default. When Done is
True, the Windows API WaitMessage function is called when OnIdle returns. WaitMessage
yields control to other applications until a new message appears in the message queue
of your application. If Done is False, WaitMessage is not called.
Note Search Help for “Handling Application Events” for more information about creating
event handlers for application events.
Example
The following code allows other applications to be processed while Application is idle.
AppIdle should be declared as a method of TForm1.
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnIdle := AppIdle;
end;
end;
MessageDlg('Alt+F10 pressed down', mtInformation, [mbOK], 0);
O
See also
KeyPreview property, OnKeyPress event, OnKeyUp event
OnKeyPress event
Applies to
TBitBtn, TButton, TCheckBox, TComboBox, TDBCheckBox, TDBComboBox, TDBEdit,
TDBGrid, TDBImage, TDBListBox, TDBLookupCombo, TDBMemo, TDirectoryListBox,
TDrawGrid, TDriveComboBox, TEdit, TFileListBox, TFilterComboBox, TForm, TListBox,
TMaskEdit, TMemo, TOLEContainer, TOutline, TRadioButton, TScrollBar, TStringGrid
components
Declaration
property OnKeyPress: TKeyPressEvent;
The OnKeyPress event occurs when a user presses a single character key. Use the
OnKeyPress event handler when you want something to happen as a result of pressing a
single key.
The Key parameter in the OnKeyPress event handler is of type Char; therefore, the
OnKeyPress event registers the ASCII character of the key pressed. Keys that don’t
correspond to an ASCII Char value (Shift or F1, for example) don’t generate an
OnKeyPress event. Key combinations (such as Shift+A), generate only one OnKeyPress
event (for this example, Shift+A results in a Key value of “A” if Caps Lock is off). If you
want to respond to non-ASCII keys or key combinations, use the OnKeyDown or
OnKeyUp event handlers.
Example
This event handler displays a message dialog box specifying which key was pressed:
procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
MessageDlg(Key + ' has been pressed', mtInformation, [mbOK], 0)
end;
See also
KeyPreview property
OnKeyUp event
Applies to
TBitBtn, TButton, TCheckBox, TComboBox, TDBCheckBox, TDBComboBox, TDBEdit,
TDBGrid, TDBImage, TDBListBox, TDBLookupCombo, TDBMemo, TDirectoryListBox,
TDrawGrid, TDriveComboBox, TEdit, TFileListBox, TFilterComboBox, TForm, TListBox,
TMaskEdit, TMemo, TOLEContainer, TOutline, TRadioButton, TScrollBar, TStringGrid
components
Declaration
property OnKeyUp: TKeyEvent;
The OnKeyUp event occurs when the user releases a key that has been pressed. Use the
OnKeyUp event handler when you want special processing to occur when a key is
released. The OnKeyUp handler can respond to all keyboard keys including function
keys and keys combined with the Shift, Alt, and Ctrl keys and pressed mouse buttons. The
Key parameter of the OnKeyUp event handler is of type Word; therefore, you must use
virtual key codes to determine the key pressed. You can find a table of virtual key codes
in the Help system; search for the topic Virtual Key Codes.
Example
The following code changes a form’s color to aqua when a key is pressed. When the key
is released, the form’s color reverts to the original color. Note that the KeyPreview
property of the form must be set to True to capture all key presses, even if a control has
focus:
OnMeasureItem event
Applies to
TComboBox, TDBComboBox, TDBListBox, TListBox components
Declaration
property OnMeasureItem: TMeasureItemEvent;
The OnMeasureItem event occurs whenever an application needs to redisplay an item in
an owner-draw list box or combo box with a variable style. That is, for a list box, the
Style property is lbOwnerDrawVariable, or for a combo box, the Style property is
csOwnerDrawVariable.
The OnMeasureItem event passes three parameters to its handler describing the item to
measure:
• The control containing the item
• The index of the item in the control
• The height of the item
The OnMeasureItem event handler should specify the height in pixels that the given item
will occupy in the control. The Height parameter is a var parameter, which initially
contains the default height of the item or the height of the item text in the control’s font.
The handler can set Height to a value appropriate to the contents of the item, such as the
height of a graphical image to be displayed within the item.
After the OnMeasureItem event occurs, the OnDrawItem event occurs, rendering the item
with the measured size.
Example
Here is a typical handler for an OnMeasureItem event. The example assumes that a
variable owner-draw list box already has bitmaps associated with each of its strings. It
sets the height of the item to the height of the associated bitmap if that height is greater
than the default height.
procedure TForm1.ListBox1MeasureItem(Control: TWinControl; Index: Integer;
var Height: Integer);
var
Bitmap: TBitmap;
begin
with Control as TListBox do
begin
Bitmap := TBitmap(Items.Objects[Index]);
if Bitmap <> nil then
if Bitmap.Height > Height then Height := Bitmap.Height;
end;
end;
OnMeasureTab event
Applies to
TTabSet component
Declaration
property OnMeasureTab: TMeasureTabEvent;
The OnMeasureTab event occurs when the Style property of the tab set control is
+
tsOwnerDraw and an application needs to redisplay a tab in a tab set control. In the
OnMeasureTab event handler, you write the code to calculate the width needed to draw
+
the tab. After the OnMeasureTab event occurs, the OnDrawTab event occurs. You write
the code to draw the tab using the width calculated in OnMeasureTab in the OnDrawTab
+
event handler.
The Index parameter of the TMeasureTabEvent method pointer is the position of the tab in
+
the tab set control. The TabWidth parameter is the width of the tab. +
Example
The following code measures the width of a bitmap stored in the Objects property of the
+
Tabs list of the DriveTabSet tab set component. It then makes the width of the tab two
pixels wider than the bitmap width. +
procedure TFMForm.DriveTabSetMeasureTab(Sender: TObject; Index: Integer;
var TabWidth: Integer);
+
var
BitmapWidth: Integer; +
begin
BitmapWidth := TBitmap(DriveTabSet.Tabs.Objects[Index]).Width;
Inc(TabWidth, 2 + BitmapWidth);
+
end;
+
OnMessage event +
Applies to
+
TApplication component
O
Declaration
property OnMessage: TMessageEvent;
The OnMessage event occurs when your application receives a Windows message. By
creating an OnMessage event handler in your application, you can call other handlers
that respond to the message. If your application doesn’t have a specific handler for an
incoming message, the message is dispatched and Windows handles the message. An
OnMessage event handler lets your application trap a Windows message before
Windows itself processes it.
Note Search Help for “Handling Application Events” for more information about creating
event handlers for application events.
Example
The following code displays the time of the most recently received Windows message in
the Caption of Label1. AppMessage should be declared a method of TForm1.
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnMessage := AppMessage;
end;
See also
ProcessMessages method
OnMinimize event
Applies to
TApplication component
Declaration
property OnMinimize: TNotifyEvent;
The OnMinimize event occurs when the application is minimized, either because the
user minimizes the main window, or because of a call to the Minimize method. Use the
OnMinimize event handler to put code that performs any special processing you want to
happen when the application is minimized.
See also
OnRestore event, Restore method
OnMouseDown event
Applies to
TBitBtn, TButton, TCheckBox, TDBCheckBox, TDBEdit, TDBImage, TDBListBox,
TDBLookupCombo, TDBMemo, TDBNavigator, TDBText, TDirectoryListBox, TDrawGrid,
TEdit, TFileListBox, TForm, TGroupBox, TImage, TLabel, TListBox, TMaskEdit, TMemo,
TNotebook, TOLEContainer, TOutline, TPaintBox, TPanel, TRadioButton, TScrollBox,
TShape, TSpeedButton, TStringGrid, TTabSet components
Declaration
property OnMouseDown: TMouseEvent;
The OnMouseDown event occurs when the user presses a mouse button with the mouse
pointer over a control. Use the OnMouseDown event handler when you want some
processing to occur as a result of pressing a mouse button.
The Button parameter of the OnMouseDown event identifies which mouse button was
pressed. By using the Shift parameter of the OnMouseDown event handler, you can
respond to the state of the mouse buttons and shift keys. Shift keys are the Shift, Ctrl, and
Alt keys.
Declaration
property OnMouseMove: TMouseMoveEvent;
The OnMouseMove occurs when the user moves the mouse pointer when the mouse
pointer is over a control. Use the OnMouseMove event handler when you want
something to happen when the mouse pointer moves within the control.
By using the Shift parameter of the OnMouseDown event handler, you can respond to the
state of the mouse buttons and shift keys. Shift keys are the Shift, Ctrl, and Alt keys.
Example
The following code updates two labels when the mouse pointer is moved. The code
assumes you have two labels on the form, lblHorz and lblVert. If you attach this code to
the OnMouseMove event of a form, lblHorz continually displays the horizontal position
of the mouse pointer, and lblVert continually displays the vertical position of the mouse
pointer while the pointer is over the form.
See also
OnMouseDown event, OnMouseUp event
OnMouseUp event
Applies to
TBitBtn, TButton, TCheckBox, TDBCheckBox, TDBEdit, TDBImage, TDBListBox,
TDBLookupCombo, TDBMemo, TDBNavigator, TDBText, TDirectoryListBox, TDrawGrid,
TEdit, TFileListBox, TForm, TGroupBox, TImage, TLabel, TListBox, TMaskEdit, TMemo,
TNotebook, TOLEContainer, TOutline, TPaintBox, TPanel, TRadioButton, TScrollBox,
TShape, TSpeedButton, TStringGrid, TTabSet components
Declaration
property OnMouseUp: TMouseEvent;
The OnMouseUp event occurs when the user releases a mouse button that was pressed
with the mouse pointer over a component. Use the OnMouseUp event handler when you
want processing to occur when the user releases a mouse button.
The OnMouseUp event handler can respond to left, right, or center mouse button presses
and shift key plus mouse button combinations. Shift keys are the Shift, Ctrl, and Alt keys.
Example
The following code draws a rectangle when the user presses a mouse button, moves the
mouse, and releases the mouse button. When the mouse button is released, the rectangle
appears on the form’s canvas. Its top-left and bottom-right corners are defined by the
location of the mouse pointer when the user pressed and released the mouse button.
var
StartX, StartY: Integer; {Declare in interface section of form’s unit}
{Use this code as the OnMouseDown event handler of the form:}
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
StartX := X;
StartY := Y;
end;
{Use this code as the OnMouseUp event handler of the form:}
procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Form1.Canvas.Rectangle(StartX, StartY, X, Y);
Example
Attach the following code to the OnNotify event handler of a media player named
MediaPlayer1. If the Notify property of MediaPlayer1 is set to True, this code displays the
value of the NotifyValue property in a message dialog box.
procedure TForm1.MediaPlayer1Notify(Sender: TObject);
var
MyString: string;
begin
case MediaPlayer1.NotifyValue of
nvSuccessful : MyString := 'Success!';
See also
NotifyValue property, Wait property
OnOpen event
Applies to
TDDEClientConv, TDDEServerConv components
Declaration
property OnOpen: TNotifyEvent;
An OnOpen event occurs when a DDE conversation is opened. A DDE conversation can
be initiated automatically or manually. Automatically open a conversation by setting
the value of the ConnectMode property to ddeAutomatic. When the form containing the
DDE client conversation component is created at run time, the DDE conversation opens.
Manually open a conversation by setting the value of ConnectMode to ddeManual and
calling the OpenLink method.
Example
The following code sends a macro to the server and closes the link immediately after
opening it.
procedure TForm1.DdeClientConv1Open(Sender: TObject);
begin
with DDEClientConv1 do
begin
ExecuteMacro('File|New', False);
CloseLink;
end;
end;
See also
OnClose event
OnPageChanged event
Applies to
TNotebook component
OnPaint event
Applies to
TForm, TPaintBox component
Declaration
property OnPaint: TNotifyEvent;
The OnPaint event occurs when Windows requires the form or paint box to paint, such
as when the form or paint box receives focus or becomes visible when it wasn’t
previously. Your application can use this event to draw on the canvas of the form or
paint box.
Example
The following code is an entire unit that loads a background bitmap onto the Canvas of
the main form in the OnPaint event handler.
unit Unit1;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls, Forms, Dialogs;
type
TForm1 = class(TForm)
procedure FormPaint(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
TheGraphic: TBitmap; { Add this declaration for the graphic}
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormPaint(Sender: TObject); { OnPaint event handler}
begin
Form1.Canvas.Draw(0, 0, TheGraphic); { Draw the graphic on the Canvas }
end;
procedure TForm1.FormCreate(Sender: TObject); { OnCreate event handler }
begin
TheGraphic := TBitmap.Create; { Create the bitmap object }
TheGraphic.LoadFromFile('C:\APP\BKGRND.BMP'); { Load the bitmap from a file}
end;
end.
See also
Canvas property
OnPassword event
Applies to
TSession component
Declaration
property OnPassword: TPasswordEvent;
Run-time only. The OnPassword event is activated whenever a Paradox table is opened
+
and the Borland Database Engine reports that the application does not have sufficient
access rights. The value of Sender is the Session component. Continue determines whether
+
the caller will make another attempt to access the database. The procedure should add
any available additional passwords and set Continue to True. If there are no additional
+
passwords available, set Continue to False.
If no OnPassword event is defined, Session will create a default dialog box for the user to
+
enter a new password. +
OnPokeData event +
Applies to
+
TDDEServerItem component
+
Declaration
property OnPokeData: TNotifyEvent
+
The OnPokeData event occurs when the DDE client application pokes data to your DDE +
server application. When a client pokes data, it sends text to the linked DDE server. The
Text and Lines properties will be updated to contain the poked data, then the
OnPokeData event occurs.
+
If the DDE client is a Delphi application that uses a TDDEClientConv component, data is +
poked when the PokeData or PokeDataLines method is called.
+
Example
The following code uses a Boolean variable FInPoke to protect poked data from being
lost by a DDE server application. DoOnPoke is the OnPokeData event handler for the
O
DDE server item component named DDETestItem. When data is poked, FInPoke is set to
True, the poked data is stored in the Lines property of Memo2, and FInPoke is set back to
False.
The data should be protected because the server data is updated when the Lines of
Memo1 are updated by the user. DoOnChange, the OnChange event handler for Memo1,
tests FInPoke before updating the server data in DDETestItem. Otherwise, data poked
from the client could be lost when Memo1.Lines is changed.
var
FInPoke: Boolean;
.
.
.
procedure TDdeSrvrForm.doOnPoke(Sender: TObject);
begin
FInPoke := True;
Memo2.Lines := DdeTestItem.Lines;
FInPoke := False;
end;
See also
OnExecuteMacro event
OnPopup event
Applies to
TPopupMenu component
Declaration
property OnPopup: TNotifyEvent;
The OnPopup event occurs whenever a pop-up menu appears either because the user
right-clicks the component when the pop-up menu’s AutoPopup is True or because the
Popup method executed. Use the OnPopup event handler when you want some special
processing to occur when the component’s pop-up menu appears.
Example
The following code enables the Paste item from the pop-up menu if the Clipboard has
text data.
procedure TForm1.PopupMenu1Popup(Sender: TObject);
begin
Paste1.Enabled := Clipboard.HasFormat(CF_TEXT);
end;
See also
PopupMenu property
OnPostClick event
Applies to
TMediaPlayer component
Declaration
property OnPostClick: EMPPostNotify;
An OnPostClick event is generated after the code of the OnClick event handler has been
called. If Wait is True when the media player was clicked, OnPostClick won’t be called
until the completion of the OnClick code. If Wait is False, control can return to the
application before completion of the OnClick code; therefore, the OnPostClick event may
+
occur before the actions initiated by the OnClick event have completed. +
For example, if the user clicks the Play button and the DoDefault parameter of the
OnClick event handler for the media player is True, the media is played. If the media is +
long enough, it will still be playing when the OnPostClick event is generated if Wait is
True. If Wait is False, however, OnPostClick won’t occur until the media has finished
playing.
+
See also
+
OnClick event +
OnReplace event +
Applies to
+
TReplaceDialog components
+
Declaration +
+
property OnReplace: TNotifyEvent;
The OnReplace event occurs whenever the user chooses either the Replace or the Replace
All button in the Replace dialog box. Use the OnReplace event to specify the processing
that replaces text. +
Because the OnReplace event occurs when the user chooses either the Replace or Replace
All button, the code you write in the OnReplace event handler should determine which +
button was chosen and supply the appropriate logic. Use the frReplace and frReplaceAll
values in the Options set to determine which button was chosen. O
Example
The following code calls the user-defined routine DoReplace if the Replace button was
clicked, or calls the user-defined routine DoReplaceAll if the ReplaceAll button was
clicked.
procedure TForm1.ReplaceDialog1Replace(Sender: TObject);
begin
if (ReplaceDialog1.Options*[frReplace])=[frReplace] then DoReplace
else if (ReplaceDialog1.Options*[frReplaceAll])=[frReplaceAll] then DoReplaceAll;
end;
See also
OnFind event
OnResize event
Applies to
TDBNavigator, TForm, TPanel, TScrollBox components
Declaration
property OnResize: TNotifyEvent;
The OnResize event occurs whenever the form is resized while an application is running.
Use the OnResize event handler when you want something to happen in your
application when the form is resized.
Example
The following code keeps the right edge on Button1 against the right edge of Form1
when Form1 is resized.
procedure TForm1.FormResize(Sender: TObject);
begin
Button1.Left := (Form1.Width)-Button1.Width;
end;
OnRestore event
Applies to
TApplication component
Declaration
property OnRestore: TNotifyEvent;
The OnRestore event occurs when the previously minimized application is restored to its
normal size, either because the user restores the application, or because the application
calls the Restore method. Use the OnRestore event handler to put code that performs any
special processing you want to happen as the application is restored.
See also
Minimize method, OnMinimize event
OnRowMoved event
Applies to
TDrawGrid, TStringGrid components
Declaration
property OnRowMoved: TMovedEvent;
The OnRowMoved event occurs when the user moves a row using the mouse. The user
can move a row only if the Options property set includes the value goRowMoving.
Example
The following code displays the number of rows a row was moved in a label.
10. This shows how you can use the OnScroll event handler to move the thumb tab by
different increments than specified by the LargeChange and SmallChange properties. +
procedure TForm1.ScrollBar1Scroll(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer); O
begin
if ScrollCode = scPageUp then ScrollPos := ScrollPos - 1
else if ScrollCode = scPageDown then ScrollPos := ScrollPos + 10;
Label1.Caption := IntToStr(ScrollPos);
end;
OnSelectCell event
Applies to
TDrawGrid, TStringGrid component
Declaration
property OnSelectCell: TSelectCellEvent;
The OnSelectCell event occurs when the user selects a cell in a draw grid or string grid.
Use the OnSelectCell event handler to write the code that handles the selecting of a cell.
Using the CanSelect parameter of the event handler type, your code can determine
whether the user can select a cell or not.
Example
The following code determines that the user cannot select a cell containing the text ‘No’.
procedure TForm1.StringGrid1SelectCell(Sender: TObject; Col, Row: Longint;
var CanSelect: Boolean);
begin
CanSelect := not (StringGrid1.Cells[Col,Row]='No')
end;
OnSetEditText event
Applies to
TDrawGrid, TStringGrid component
Declaration
property OnSetEditText: TSetEditTextEvent;
The OnSetEditText event occurs when the user edits the text in the grid. The user can edit
the text only if the Options property set contains the value goEditing. The OnSetEditText
event makes the actual changes to the data. Use the OnSetEditText event handler to write
the code to handle the changes to the text within a cell of the grid.
When the user edits data in a grid, the OnSetEditText event occurs to change the actual
data, then the OnGetEditText event occurs to display the changed data in the grid.
See also
OnGetEditText event
OnSetText event
Applies to
TBCDField, TBlobField, TBooleanField, TBytesField, TCurrencyField, TDateField,
TDateTimeField, TFloatField, TGraphicField, TIntegerField, TMemoField, TSmallintField,
TStringField, TTimeField, TVarBytesField, TWordField components
Declaration
property OnSetText: TFieldSetTextEvent;
The OnSetText event is activated when the Text property is assigned a value. If
OnSetText has been assigned a method, the default processing for Text does not occur.
The event handler must store the text provided by Text.
By assigning a method to this property, you can take any special actions required by the
event.
Example
This example uses three speed buttons on a panel. The code changes the color, width,
and position of the text in the Help Hint for the third speed button.
You must declare the DoShow method in the type declaration of the form. Once it is
declared, write the code for the DoShow method in the implementation part of the unit.
Finally, in the OnCreate event handler for the form, assign the method to the
OnShowHint event of the application.
type
TForm1 = class(TForm)
Panel1: TPanel;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
procedure DoShowHint(var HintStr: string; var CanShow: Boolean;
var HintInfo: THintInfo;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.DoShowHint(var HintStr: string; var CanShow: Boolean;
var HintInfo: THintInfo);
begin
if HintInfo.HintControl = SpeedButton3 then
begin
with HintInfo do
begin
HintColor := clAqua; { Changes only for this hint }
MaxHintWidth := 120; {Hint text word wraps if width is greater than 120 }
Inc(HintPos.X, SpeedButton3.Width); { Move hint to right edge }
end;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnShowHint := DoShowHint;
end;
end.
See also
Hint property, OnHint event, ParentShowHint property, ShowHint property
OnSized event
Applies to
THeader component
Declaration
property OnSized: TSectionEvent;
See also
AllowResize property, OnSized event
OnStateChange event
Applies to
TDataSource component
Declaration
property OnStateChange: TNotifyEvent;
OnStateChange is activated when the State property changes.
By assigning a method to this property, you can react programmatically to state
changes. For example, this event is useful for enabling or disabling buttons (for
example, enabling an edit button only when a table is in edit mode), or displaying
processing messages.
Note OnChangeState can occur even for nil datasets, so it is important to protect any reference
to the DataSet property with a nil test:
if DataSource1.Dataset <> nil then
ƒ
See also
OnDataChange event
OnStatusLineEvent event
Applies to
TOLEContainer component
Declaration
property OnStatusLineEvent: TStatusLineEvent;
An OnStatusLineEvent event occurs if an OLE server application has a message to
display in the status line of the OLE container application when an OLE object is
activated in place. Typically, your OLE container application handles an
OnStatusLineEvent event by displaying the message string in its own status bar.
Example
The following code displays the status line message from the OLE server in Panel1.
procedure TForm1.OleContainer1StatusLineEvent(Sender: TObject; Msg: string);
begin
Panel1.Caption := Msg;
end;
OnTimer event
Applies to
TTimer component
Declaration
property OnTimer: TNotifyEvent;
The OnTimer event is used to execute code at regular intervals. Place the code you want
+
to execute within the OnTimer event handler. +
The Interval property of a timer component determines how frequently the OnTimer
event occurs. Each time the specified interval passes, the OnTimer event occurs. +
Example +
Here is an example of an OnTimer event handler that moves a ball slowly across the
screen: +
procedure TForm1.Timer1Timer(Sender: TObject);
begin +
+
Timer1.Interval := 100;
Shape1.Left := Shape1.Left + 1;
end;
See also
+
Interval property
+
OnTopLeftChanged event +
Applies to
+
TDrawGrid, TStringGrid components
+
Declaration
property OnTopLeftChanged: TNotifyEvent;
+
The OnTopLeftChanged event occurs whenever the value of either the TopRow property
or LeftCol property changes.
O
Example
The following code displays the latest top row and left column of StringGrid1.
procedure TForm1.StringGrid1TopLeftChanged(Sender: TObject);
begin
with StringGrid1 do
MessageDlg('The top row is now '+IntToStr(TopRow)+
' and the left col is now '+IntToStr(LeftCol), mtInformation, [mbOK],0);
end;
OnUpdateData event
Applies to
TDataSource component
Declaration
property OnUpdateData: TNotifyEvent;
OnUpdateData is activated by the Post or UpdateRecord method of a dataset component
when the current record is about to be updated in the database. It causes all data-aware
controls connected to the data source to be notified of the pending update, allowing
them to change their associated fields to the current values in the controls. By assigning
a method to this property, you can react programmatically to updates.
See also
BeforePost event
OnValidate event
Applies to
TBCDField, TBlobField, TBooleanField, TBytesField, TCurrencyField, TDateField,
TDateTimeField, TFloatField, TGraphicField, TIntegerField, TMemoField, TSmallintField,
TStringField, TTimeField, TVarBytesField, TWordField components
Declaration
property OnValidate: TFieldNotifyEvent;
The OnValidate event is activated when a field is modified. If a data-aware control is
linked to the field, changes in the control do not activate OnValidate until the control
attempts to store the results of those changes into the current record.
By assigning a method to this property, you can perform any special validation required
for the field.
Example
Field1.OnValidate := ValidateFieldRange;
Open method
Applies to
TClipboard object; TDatabase, TMediaPlayer, TQuery, TStoredProc, TTable components
Clipboard, your application doesn’t have to call Open. If you want to add a series of
+
items to the Clipboard, however, Open prevents the contents from being overwritten
with each addition.
+
When your application has added all items to the Clipboard, it should call the Close +
method.
+
Example
The following code opens a Clipboard object before two items (text from an edit box and
an OLE object from an OLE container) are copied to the Clipboard. Then the Clipboard
+
is closed. +
Clipboard.Open;
Edit1.CopyToClipboard;
OLEContainer1.CopyToClipboard;
+
Clipboard.Close;
+
See also
Clear method, Clipboard variable, Close method
+
For media player controls
+
+
Declaration
procedure Open; +
The Open method opens a multimedia device. The multimedia device type must be
specified in the DeviceType property before you can open a device.
+
Upon completion, Open stores a numerical error code in the Error property, and the
corresponding error message in the ErrorMessage property.
O
The Wait property determines whether control is returned to the application before the
Open method is completed. The Notify property determines whether Open generates an
OnNotify event.
Example
This example begins playing an audio CD when the application begins running. When
the application is closed, the CD automatically stops playing. For this example to run
successfully, you must have an audio CD device installed correctly.
procedure TForm1.FormCreate(Sender: TObject);
begin
with MediaPlayer1 do
begin
DeviceType := dtCDAudio;
Visible := False;
Open;
Play;
end;
end;
See also
AutoOpen property, Close method
Example
try
Table1.Open;
except
on EDataBaseError do { The dataset could not be opened };
end;
See also
Close method
For databases
Declaration
procedure Open;
The Open method connects the TDatabase component to the server (or BDE for Paradox
and dBASE databases). This is the same as setting Connected to True.
Example
Database1.Open;
OpenCurrent method
Applies to
TDirectoryListBox component
Example
Database := Session.OpenDatabase(‘DBDEMOS’);
try
begin
{Do Something}
finally
Session.CloseDatabase(‘DBDEMOS’);
end;
See also
Session variable
OpenLink method
Applies to
TDDEClientConv component
Declaration
function OpenLink: Boolean;
The OpenLink method initiates a new DDE conversation. If the conversation was
successfully opened, an OnOpen event occurs and OpenLink returns True. If the
conversation wasn’t successfully opened, OpenLink returns False.
Example
The following code requests data if a link is open.
if OpenLink then DDEClientConv1.RequestData(DDEClientItem1.DDEItem);
See also
CloseLink method
Options property
Applies to
TIndexDef object; TColorDialog, TDBGrid, TDBLookupCombo, TDBLookupList, TDrawGrid,
TFindDialog, TFontDialog, TOpenDialog, TOutline, TPrintDialog, TReplaceDialog,
TSaveDialog, TStringGrid components
The Options property is a set of options that affects how dialog boxes, outlines, and grids
appear and behave. The possible values contained within the set vary depending on the
type of dialog box or if the component is an outline or grid control.
Value Meaning
cdFullOpen Displays the custom coloring options when the Color dialog opens
cdPreventFullOpen Disables the Create Custom Colors button in the Color dialog box so the user cannot
create their own custom colors.
cdShowHelp Adds a Help button to the Color dialog box.
The default value is [ ], the empty set, meaning all of these values are False and none of
+
the options are in effect. +
Example
This example displays the Color dialog box with a Help button and the Create Custom
+
Colors button dimmed. The form is colored whatever color the user chooses. +
+
procedure TForm1.Button1Click(Sender: TObject);
begin
ColorDialog1.Options := [cdPreventFullOpen, cdShowHelp];
if ColorDialog1.Execute then
Color := ColorDialog1.Color; +
end;
+
See also
Color property, CustomColors property +
For Font dialog boxes +
Declaration
+
property Options: TFontDialogOptions; +
These are the possible values that can be included in the Options set for the Fonts dialog
box: +
Value Meaning +
fdAnsiOnly If True, the user can select fonts that use the Windows character set only; that is, the
user can’t choose a font that contains only symbols because they aren’t displayed in
the Font combo box.
O
fdEffects If True, the Effects check boxes and the Color list box appear in the Font dialog box.
The user uses the Effects check boxes to specify strikeout or underlined text and the
Color list box to select a color for the selected font. If fdEffects is False, the Effects check
boxes and Color list box don’t appear in the Font dialog box.
fdFixedPitchOnly If True, only monospaced fonts are displayed in the Font combo box.
fdForceFontExist If True and the user enters a font name in the Font combo box and chooses OK, a
message dialog box appears informing the user the font name is invalid.
fdLimitSize If True, the MinFontSize and MaxFontSize properties can limit the number of fonts
available in the dialog box.
fdNoFaceSel If True, when the dialog box appears, no font name is selected in the Font combo box.
fdNoOEMFonts If True, only fonts that aren’t vector fonts are displayed in the Font combo box.
fdScalableOnly If True, only fonts that can be scaled are displayed in the Font combo box.
fdNoSimulations If True, only fonts that aren’t GDI font simulations are displayed in the Font combo
box.
fdNoSizeSel If True, when the dialog box appears, no size is selected in the Size combo box.
fdNoStyleSel If True, when the dialog box appears, no style is selected in the Style combo box.
fdNoVectorFonts Same as fdNoOEMFonts.
fdShowHelp If True, a Help button appears in the dialog box.
Value Meaning
fdTrueTypeOnly If True, only TrueType fonts are displayed in the Font list box.
fdWysiwyg If True, only fonts that are available to both the printer and the screen appear in the
Font combo box.
The default value is [fdEffects], meaning that only the fdEffects option is in effect.
Example
This example sets the options of the Font dialog box so that when the dialog box
displays, only TrueType fonts show in the list of fonts and no font size is selected:
procedure TForm1.Button1Click(Sender: TObject);
begin
FontDialog1.Options := [fdTrueTypeOnly, fdNoSizeSel];
if FontDialog1.Execute then
Memo1.Font := FontDialog1.Font;
end;
See also
Font property
Declaration
property Options: TPrintDialogOptions;
These are the possible values that can be included in the Options set for the Print dialog
box:
Value Meaning
poHelp If True, a Help button appears in the dialog box.
poPageNums If True, the Pages radio button is enabled and the user can specify a range of pages
to print.
poPrintToFile If True, a Print to File check box appears in the dialog box, giving the user the option
to print to a file rather than to a printer.
poSelection If True, the Selection radio button is enabled and the user can choose to print
selected text.
poWarning If True and if no printer is installed, a warning message appears when the user
chooses OK.
poDisablePrintToFile If True and poPrintToFile is True, the Print to File check box is dimmed when the
dialog box appears. If poPrintToFile is False, setting poDisablePrintToFile to True has
no effect because the dialog box won’t have a Print to File check box.
The default value is [ ], the empty set, meaning that none of the possible options are in
effect.
end;
...
+
See also +
PrintRange property, PrintToFile property
+
For Open and Save dialog boxes +
Declaration +
+
property Options: TOpenOptions;
These are the possible values that can be included in the Options set for the Open and
Save dialog boxes:
+
Value
ofAllowMultiSelect
Meaning
When True, this option allows users to select more than one file in the File Name
list box.
+
ofCreatePrompt When True, this option displays a dialog box with a message if the user enters a
file name that doesn’t exist in the File Name edit box and chooses OK. The
+
ofExtensionDifferent
message tells the user the file doesn’t exist and asks if the user wants to create a
new file with that name.
This option is set when the file name returned from the dialog box has an
O
extension that differs from the default file extension, the value in the DefaultExt
property. Your application can then use this information. Setting an
ofExtensionDifferent value with the Object Inspector has no meaning.
ofFileMustExist If True, this option displays a dialog box with a message if the user enters a file
that doesn’t exist in the File Name edit box and chooses OK. The message informs
the user the file can’t be found and asks the user to make sure they entered the
correct path and file name.
ofHideReadOnly If True, this option hides the Read Only check box in the dialog box.
ofNoChangeDir If True, this option sets the current directory to whatever the current directory
was when the dialog box first appeared and ignores any directory changes the
user made while using the dialog box.
ofNoReadOnlyReturn If True, a message box appears informing the user if the selected file is read-only.
ofNoTestFileCreate This option applies only when the user wants to save a file on a create-no-modify
network share point, which can’t be opened again once it has been opened. If
ofNoTestFileCreate is True, your application won’t check for write protection, a full
disk, an open drive door, or network protection when saving the file because
doing so creates a test file. Your application will then have to handle file
operations carefully so that a file isn’t closed until you really want it to be.
ofNoValidate If True, this option doesn’t prevent the user from entering invalid characters in a
file name. If ofNoValidate is False and the user enters invalid characters for a file
name in the File Name edit box, a message dialog box appears informing the user
the file name contains invalid characters.
Value Meaning
ofOverwritePrompt If True, this option displays a message dialog box if the user attempts to save a file
that already exists. The message informs the user the file exists and lets the user
choose to overwrite the existing file or not.
ofReadOnly If True, the Read Only check box is checked when the dialog box is displayed.
ofPathMustExist If this option is True, the user can type only existing path names as part of the file
name in the File Name edit box. If the user enters a path name that doesn’t exist, a
message box appears informing the user that the path name is invalid.
ofShareAware If True, the dialog box ignores all sharing errors and returns the name of the
selected file even though a sharing violation occurred. If ofShareAware is False, a
sharing violation results in a message box informing the user of the problem.
ofShowHelp If True, this option displays a Help button in the dialog box.
The default value is [ ], the empty set, meaning that none of the options are in effect.
Example
This example uses an Open dialog box and a button on a form. The code forces the user
to enter valid file name characters, prevents the read-only check box from appearing in
the dialog box, and let’s the user choose to overwrite a file if the user selects a file that
doesn’t exist; the selected file name appears in a label on the form:
procedure TForm1.Button1Click(Sender: TObject);
begin
OpenDialog1.Options := [ofNoValidate, ofHideReadOnly, ofCreatePrompt];
if OpenDialog1.Execute then
Label1.Caption := OpenDialog1.FileName;
end;
Value Meaning
frDisableMatchCase When True, the Match Case check box is dimmed and users cannot check it. When
it is False, users can check the Match Case check box.
frDisableUpDown When True, the Direction Up and Down buttons are dimmed and the user cannot
select either of them. When it is False, users can select one of the Direction Up and
Down buttons.
frDisableWholeWord When True, the Match Whole Word check box is dimmed and user cannot select it.
When it is False, users can check the check box.
frDown When True, the Down button is selected in the dialog box and the search direction
is down. When frDown is False, the Up button is selected, and the search direction
is up. frDown can be set a design time, or users can change its value at run time
when they use the dialog box.
For outlines
Declaration
property Options: TOutlineOptions;
The Options property determines how the items in an outline are drawn. These are the
possible values that can be contained in the Options set:
Value Meaning
ooDrawTreeRoot The first item (Index value of 1) is connected to the root item by the outline tree.
This means that the tree will extend from the top of the outline to all the first level
items. Without ooDrawTreeRoot, all first level items appear leftmost in the outline,
not connected by the tree.
Value Meaning
ooDrawFocusRect The outline draws a focus rectangle around the selected item.
ooStretchBitmaps The outline stretches the standard bitmaps (PictureLeaf, PictureOpen, PictureClosed,
PicturePlus, PictureMinus) to fit in the size of the item, determined by the size of the
Font of the Text. Without ooStretchBitmap, the bitmaps won’t be stretched. They will
be cropped if larger than the height of the item text, or won’t fill up the entire item
space if smaller than the text.
Example
The following code draws the tree of the outline to the root (extending from the first
level items to the top of the outline).
Outline1.Options := [ooDrawTreeRoot];
See also
OutlineStyle property, Style property
Value Meaning
goFixedHorzLine When True, horizontal lines appear between the rows within nonscrolling regions.
goFixedVertLine When True, vertical lines appear between the columns within nonscrolling
regions.
goHorzLine When True, horizontal lines appear between the rows.
goVertLine When True, vertical lines appear between the columns.
goRangeSelect When True, the user can select a range of cells at one time. When goEditing is True,
the user can no longer select a range of cells.
goDrawFocusSelected When True, the cell with the focus is colored the same as other cells in a selected
block are colored. When False, the cell with the focus remains the color of all
unselected cells, the color specified with the grid Color property.
goRowSizing When True, rows can be resized individually except for fixed or nonscrolling rows.
goColSizing When True, columns can be resized individually except for fixed or nonscrolling
columns.
goRowMoving When True, the user can move a row to a new location in the grid using the mouse.
goColMoving When True, the user can move a column to a new location in the grid using the
mouse.
goEditing When True, the user can edit the text in the grid. When goEditing is True, the user
cannot select a range of cells at one time.
goAlwaysShowEditor When True, the grid is in automatic edit mode if goEditing is also True. When the
grid is in automatic edit mode, the user does not have to press Enter or F2 before
editing the contents of a cell. When goAlwaysShowEditor is False and goEditing is
True, the user must press Enter or F2 before editing the contents of a cell. If
goEditing is False, setting goAlwaysShowEditor to True has no effect.
Value
goTabs
Meaning
+
When True, the user can use the Tab and Shift-Tab keys to move from column to
goRowSelect
column in the grid.
+
When True, the user can select only whole rows at a time instead of individual
cells.
goThumbTracking +
When True, the contents of the grid scrolls while the user is moving the thumb tab
of the grid scroll bar. When False, the contents of the grid doesn’t scroll until the
user releases the thumb tab in its new position.
+
This code changes the look of the grid; only horizontal lines appear in both the body of +
Example
the grid and in the nonscrolling regions when the user clicks the ChangeGridStyle button:
procedure TForm1.ChangeGridStyleClick(Sender: TObject); +
begin
DrawGrid1.Options := [goFixedHorzLine, goHorzLine];
end;
+
+
For data grids
+
Declaration
property Options: TDBGridOptions;
+
These are the possible values that can be included in the Options set for the data grid
control:
+
Value Meaning
+
dgEditing O
When True, allows the user to edit data in the data grid. When the ReadOnly
property is True and dgEditing is True, users can still use the Insert key to insert a
blank row, or press the Down Arrow key when positioned at the bottom of the grid
to append a blank row, although they won’t be able to enter text in the new row.
dgAlwaysShowEditor When True, the grid is in automatic edit mode as long as gdEditing is also True.
When the grid is in automatic edit mode, the user does not have to press Enter or
F2 before editing the contents of a cell. When gdAlwaysShowEditor is False and
gdEditing is True, the user must press Enter or F2 before editing the contents of a
cell. If gdEditing is False, setting gdAlwaysShowEditor to True has no effect.
dgTitles When True, the column titles are visible.
dgIndicator When True, a small pointer is visible that indicates which column is the current
one.
dgColumnResize When True, the columns can be resized. A column can’t be resized, however, until
its field has been added to the grid. To add a field to the grid, choose Add from
the Fields editor.
dgColLines When True, lines between the columns appear.
dgRowLines When True, lines between the rows appear.
dgTabs When True, users press the Tab key and the Shift-Tab keys to move among the
columns of the data grid.
dgRowSelect When True, the user can select whole rows only instead of individual cells.
dgAlwaysShowSelection When True, the cell selected in the grid continues to display as selected even if the
data grid doesn’t have the focus.
Value Meaning
dgConfirmDelete When True, a message box appears if the user uses Ctrl+Delete to delete a row in
the grid. The message box asks for confirmation that the row should really be
deleted.
dgCancelOnExit When True, if an insert is pending and no modifications were made by the user,
the insert will be cancelled when the user exits the grid. This prevents the
inadvertent posting of partial or blank records.
Example
This line of code displays column titles, makes the column indicator visible, and permits
the user to edit the data displayed in the data grid:
procedure TForm1.FormClick(Sender: TObject);
begin
DBGrid1.Options := [dgIndicator, dgEditing, dgTitles];
end;
See also
ReadOnly property
Declaration
property Options: TDBLookupListOptions;
The Options property determines how multiple columns in database lookup combo
boxes and database lookup list boxes appear. These are the possible values that can be
part of the Options set:
Value Meaning
loColLines When True, lines separate the columns displayed in the control. When False, no lines appear
between the columns.
loRowLines When True, lines separate the rows displayed in the control. When False, no lines appear
between the rows.
loTitles When True, the field names appear as titles above the columns in the control. When False,
no titles appear.
Example
This code displays three fields in a database lookup list box, displays the field names as
titles for the columns, and separates the columns with lines:
procedure TForm1.FormCreate(Sender: TObject);
begin
DBLookupList1.LookupDisplay := 'Company;City;Country';
See also
Chr function
Orientation property
Applies to
TPrinter object
Declaration
property Orientation: TPrinterOrientation;
Run-time only. The value of the Orientation property determines if the print job prints
vertically or horizontally on a page. These are the possible values:
Value Meaning
poPortrait The print job prints vertically on the page.
poLandscape The print job prints horizontally on the page.
Example
This example uses two radio buttons on a form named Landscape and Portrait. The form
also includes a button. When the user selects an orientation by clicking one of the radio
buttons and then clicks the button to print one line of text, the print job prints using the
selected orientation:
procedure TForm1.Button1Click(Sender: TObject);
begin
Printer.BeginDoc;
Printer.Canvas.TextOut(100,100,'Hi there');
Printer.EndDoc;
end;
procedure TForm1.PortraitClick(Sender: TObject);
begin
Printer.Orientation := poPortrait;
end;
procedure TForm1.LandscapeClick(Sender: TObject);
begin
Printer.Orientation := poLandscape;
end;
See also
Printer variable
+
osTreePictureText Displays outline tree, open picture, closed picture, leaf picture, and item text.
osTreeText Displays outline tree and item text.
Example
The following code displays pictures only if they are monochrome. The first choice is
+
Open and Closed pictures. If they aren’t monochrome, the code tests Plus and Minus
pictures. The final resort is to simply display text.
+
with Outline1 do
if (PictureOpen.Monochrome and PictureClosed.Monochrome) then
O
OutlineStyle := osPictureText
else if (PicturePlus.Monochrome and PictureMinus.Monochrome) then
OutlineStyle := osPlusMinusText
else OutlineStyle := osText;
The Output variable is a write-only file associated with the operating system’s standard
output file, which is usually the display.
In many of Delphi's standard file-handling routines, the file variable parameter can be
omitted. Instead the routine operates on the Input or Output file variable. The following
standard file-handling routines operate on the Output file when no file parameter is
specified:
• Write
• Writeln
Since Windows does not support text-oriented input and output, Input and Output files
are unassigned by default in a Windows application. Any attempt to read or write to
them will produce an I/O error.
If the application uses the WinCrt unit, Input and Output will refer to a scrollable text
window.
See also
Input variable, TextFile type
Overload property
Applies to
TStoredProc component
Declaration
property Overload: Word;
Oracle servers allow overloading of stored procedures in an Oracle package; that is,
different procedures with the same name.
Set the Overload property to specify the procedure to execute on an Oracle server. If
Overload is zero (the default), there is assumed to be no overloading. If Overload is one
(1), then Delphi will execute the first stored procedure with the overloaded name; if it is
two (2), it will execute the second, and so on.
See also
StoredProcName property
Owner property
Applies to
All components
Declaration
property Owner: TComponent;
Pack method
Applies to
TList object
Declaration
procedure Pack;
The Pack method deletes all nil items from the list of pointers kept by the List property of
a list object. Items become nil when the Delete or Remove’ method has been called to
delete them from the list.
Example
This example assumes there are two edit box controls on the form. The code creates a list
object and adds two strings to it. The second string in the list is a nil string. The code
counts the number of strings in the list and displays the number in the Edit1 control. The
code then packs the list, removing the nil string, and counts the strings in the list again.
The second count displays in the Edit2 control:
procedure TForm1.FormCreate(Sender: TObject);
var
MyList: TList;
I: Integer;
Buffer: string;
begin
MyList := TList.Create; {Create a list of TList}
MyList.Add(PChar('Another string')); {Add a string}
MyList.Add(PChar(NIL)); {Add a Nil string}
Str(MyList.Count, Buffer);
Edit1.Text := Buffer; {Put count into Edit1}
Mylist.Pack; {Pack the list.}
Str(MyList.Count, Buffer);
Edit2.Text := Buffer; {Put count into Edit2}
MyList.Free; {Free memory for list}
end;
See also
Expand method, Remove method, Capacity property
PageHeight property
Applies to
TPrinter object
Declaration
property PageHeight: Integer;
Run-time and read only. The PageHeight property contains the height of the currently
printing page in pixels.
Example
This code displays the page height of the currently printing page in an edit box.
To run this code successfully, you must add Printers to the uses clause of your unit.
Edit1.Text := IntToStr(Printer.PageHeight);
See also
PageNumber property, PageWidth property, Printer variable
See also
ActivePage property, TTabSet component
PageNumber property
Applies to
TPrinter object
Declaration
property PageNumber: Integer;
Run-time and read only. The PageNumber property contains the number of the current
page. Each time an application calls the NewPage method, NewPage increments the value
of PageNumber.
Example
This example uses a button on a form. When the user clicks the button, one line of text is
printed on six separate pages. As each page is printed, a message indicating the number
of the page being printed appears on the form.
To run this example successfully, you must add Printers to the uses clause of your unit.
procedure TForm1.Button1Click(Sender: TObject);
var
I, X, Y: Integer;
begin
Printer.BeginDoc;
X := 10;
Y := 10;
for I := 1 to 6 do
begin
Printer.Canvas.TextOut(100, 100, 'Object Pascal is great');
Canvas.TextOut(X, Y, 'Printing page ' + IntToStr(Printer.PageNumber));
Printer.NewPage;
Y := Y + 20;
end;
Printer.EndDoc;
end;
See also
NewPage method, Printer variable
Pages property
Applies to
TNotebook, TTabbedNotebook components
Declaration
property Pages: TStrings;
The Pages property contains the strings that identify the individual pages of the
+
notebook or tabbed notebook control. Both these controls create a separate page for each
string in the Pages property. For example, if Pages contains three strings, First, Second,
+
and Third, the control has three separate pages. +
You can access the various pages in a notebook or tabbed notebook control with either
the ActivePage or PageIndex property. +
Example
The following code ensures that the Pages of Notebook1 correspond with the value of the
+
Tabs property of TabSet1. +
Notebook1.Pages := TabSet1.Tabs;
+
See also
TTabSet component +
PageWidth property
+
Applies to
+
TPrinter object +
Declaration +
property PageWidth: Integer;
Run-time and read only. The PageWidth property contains the value of width of the
+
currently printing page in pixels.
+
Example
The code uses an edit box on a form. The code creates a printer object and displays the P
current width of a page in pixels in the edit box when the form first appears.
To run this example, you must add the Printers unit to the uses clause of your unit.
procedure TForm1.FormCreate(Sender: TObject);
begin
Edit1.Text := IntToStr(Printer.PageWidth) + ' pixels';
end;
See also
PageHeight property, PageNumber property, Printer variable
Palette property
Applies to
TBitmap object
Declaration
property Palette: HPalette;
The Palette property controls a bitmap’s color mapping. The Palette of a bitmap contains
up to 256 colors that can be used to display the bitmap onscreen.
If the bitmap is drawn by an application running in the foreground, as many colors of
Palette as will be added to the Windows system palette. Any additional colors will be
mapped to the existing colors of the system palette. If the bitmap is drawn by an
application running in the background and another application has loaded the system
palette with its own colors, the bitmap’s colors will be mapped to the system palette.
Example
The following code selects the Palette from Form1 for Form2.
SelectPalette(Form2.Canvas.Handle, Form1.Canvas.Palette, True);
ParamBindMode property
Applies to
TStoredProc component
Declaration
property ParamBindMode; TParamBindMode;
ParamBindMode determines how the elements of the Params array will be matched with
stored procedure parameters. If ParamBindMode is set to pbByName (the default),
parameters will be bound based on their names in the stored procedure. If
ParamBindMode is set to pbByNumber, parameters will be bound based on the order in
which they are defined in the stored procedure. Use this setting if you are building your
parameters list, and you don’t want to use the parameter names defined in the stored
procedure.
Example
ParamBindMode := pbByName;
ParamByName method
Applies to
TParams object; TQuery, TStoredProc component
Example
begin
if ParamCount = 0 then
See also
ParamStr function
ParamCount property
Applies to
TQuery, TStoredProc component
Example
for I := 0 to Query1.ParamCount - 1 do
Query1.Params[I].AsInteger := I;
See also
Params property
Example
{ Set all parameters to an empty string }
with StoredProc1 do
for I := 0 to ParamCount - 1 do
Param[I].AsString := ‘’;
Example
For example, suppose a TQuery component named Query2 has the following statement
for its SQL property:
INSERT
INTO COUNTRY (NAME, CAPITAL, POPULATION)
VALUES (:Name, :Capital, :Population)
An application could use Params to specify the values of the parameters as follows:
Query2.Params[0].AsString := 'Lichtenstein';
Query2.Params[1].AsString := 'Vaduz';
Query2.Params[2].AsInteger := 420000;
These statements would bind the value “Lichtenstein” to the :Name parameter,
“Vaduz” to the :Capital parameter, and 420000 to the :Population parameter.
Example
var
I: Word;
Y: Integer;
begin
Y := 10;
for I := 1 to ParamCount do begin
Canvas.TextOut(5, Y, ParamStr(I));
Y := Y + Canvas.TextHeight(ParamStr(I)) + 5;
end;
end;
See also
ParamCount function
Example
To set up the form for this example, put a group box on the form and add a radio button
to the group box. Put two labels and a button on the form. This code displays the name
of the parent of the radio button and the class name of the owner of the radio button in
the captions of the two labels when the user clicks the button:
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption := RadioButton1.Parent.Name + ' is the parent';
Label2.Caption := RadioButton1.Owner.ClassName +
' is the class name of the owner';
end;
This example uses a button and a group box on a form. When the user clicks the button,
the button moves inside the group box, because the group box is now the parent of the
button.
procedure TForm1.Button1Click(Sender: TObject);
begin
Button1.Parent := GroupBox1;
end;
See also
Controls property, Owner property
Declaration
property Parent: TMenuItem;
Run-time and read only. The Parent property of a menu item identifies the parent menu
item of this menu item.
Example
This example assumes there are two edit boxes on a form as well as a main menu that
contains menu items. One of the menu items has Save as the value of its Caption
property, so the value of its Name property is Save1. The code displays the name of the
parent of the Save1 menu item in the Edit1 control, and it displays the class name of the
parent in the Edit2 control when the form first appears.
procedure TForm1.FormCreate(Sender: TObject);
begin
Edit1.Text := Save1.Parent.Name;
Edit2.Text := Save1.Parent.ClassName;
end;
Declaration
property ParentColor: Boolean;
The ParentColor property determines where a control looks for its color information. If
ParentColor is True, the control uses the color in its parent component’s Color property. If
ParentColor is False, the control uses its own Color property. Except for the radio group,
database radio group, label and database text controls, the default value is False.
By using ParentColor, you can ensure that all the controls on a form have a uniform
appearance. For example, if you change the background color of your form to gray, by
default, the controls on the form will also have a gray background.
To specify a different color for a particular control, specify the desired color as the value
of that control’s Color property, and ParentColor becomes False automatically.
Example
This code uses a label control and a timer component on the form. When the OnTimer
event occurs, the label turns red if the label’s ParentColor property is True. If the
ParentColor property is False, ParentColor is set to True. The result is the label flashes red
on and off. Every other time an OnTimer event occurs, the label turns red. The other
times, the label assumes the color of its parent, Form1.
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if Label1.ParentColor then
Label1.Color := clRed
else
Label1.ParentColor := True;
end;
See also
Color property, Parent property, ParentFont property
ParentCtl3D property
Applies to
TCheckBox, TComboBox, TDBCheckBox, TDBComboBox, TDBEdit, TDBGrid, TDBImage,
TDBLookupCombo, TDBLookupList, TDBListBox, TDBNavigator, TDBMemo,
TDBRadioGroup, TDirectoryListBox, TDrawGrid, TDriveComboBox, TEdit, TFileListBox,
TFilterComboBox, TGroupBox, TListBox, TMaskEdit, TMemo, TNotebook, TOLEContainer,
TOutline, TPanel, TRadioButton, TScrollBox, TStringGrid components
Declaration
property ParentCtl3D: Boolean;
The ParentCtl3D property determines where a component looks to determine if it
should appear three dimensional. If ParentCtl3D is True, the component uses the
dimensionality of its parent component’s Ctl3D property. If ParentCtl3D is False, the
control uses its own Ctl3D property. The default value is True.
By using ParentCtl3D, you can ensure that all the components on a form have a uniform
appearance. For example, if you want all components on a form to appear three
dimensional, set the form’s Ctl3D property to True and each component’s ParentCtl3D
property to True. Not only will all components have a three-dimensional appearance,
but if you decide you prefer a two-dimensional appearance, you only have to change
the Ctl3D property of the form and all the components will become two dimensional.
To specify a different dimensionality for a particular component, specify the
dimensionality (True for 3D or False for 2D) as the value of that control’s Ctl3D property,
and ParentCtl3D becomes False automatically.
Example
This example uses a timer component and a label control. When an OnTimer event
occurs and the label uses its parent’s font, the code changes the label’s ParentFont
property to False and changes the label’s font size to 30 points. When an OnTimer event
occurs and the label doesn’t use its parent’s font, the code sets its ParentFont to True. The
result is that the label’s font grows and shrinks alternately, each time an OnTimer event
occurs.
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if Label1.ParentFont = True then
Label1.Font.Size := 30
else
Label1.ParentFont := True;
end;
This example uses a button on a form. When the user clicks the button, the font type and
color change for all components on all forms in the application.
procedure TForm1.Button1Click(Sender: TObject);
begin
ParentFont := True;
if Application.Font.Name = 'System' then
begin
Application.Font.Color := clNavy;
Application.Font.Name := 'New Times Roman';
end
else
begin
Application.Font.Color := clBlack;
Application.Font.Name := 'System'
end;
end;
See also
Application variable, Font property, Parent property, ParentColor property, ParentCtl3D
property, TApplication component
ParentShowHint property
Applies to
All controls
Declaration
property ParentShowHint: Boolean;
The ParentShowHint property determines where a control looks to find out if Help Hint,
specified as the value of the Hint property for the control, should be shown. If
ParentShowHint is True, the control uses the ShowHint property value of its parent. If
ParentShowHint is False, the control uses its own ShowHint property.
By using ParentShowHint, you can ensure that all the controls on a form either show
their Help Hints or don’t show them. By default, ParentShowHint is True.
If don’t want all the controls to have Help Hints, set the ShowHint property for those
+
controls you do want to have Help Hints to True, and ParentShowHint becomes False
automatically.
+
You can enable or disable all Help Hints for the entire application using the ShowHint +
property of the application.
+
Example
This example uses an edit box, a memo, and a check box on a form. For each of these
controls, the ParentShowHint property is True, the default value. When the code runs, the
+
ShowHint property of the form is set to True and hints are assigned to each control.
Because each control looks to its parent, the form, to find out whether to display a Help
+
Hint, and because the form’s ShowHint property is True, the Help Hints are available.
procedure TForm1.FormCreate(Sender: TObject);
+
begin
ShowHint := True;
+
Edit1.Hint := 'Enter text';
Memo1.Hint := 'Enter lots of text'; +
CheckBox1.Hint := 'Check or uncheck me';
end; +
See also
Hint property, ParentColor property, ParentCtl3D property, ParentFont property
+
+
PasswordChar property +
Applies to
TDBEdit, TEdit, TMaskEdit components
+
Declaration
P
property PasswordChar: Char;
The PasswordChar property lets you create an edit box that displays special characters in
place of the entered text. By default, PasswordChar is the null character (ANSI character
zero), meaning that the control displays its text normally. If you set PasswordChar to any
other character, the control displays that character in place of each character in the
control’s text.
Example
The following code displays asterisks for each character in an edit box called
PasswordField:
PasswordField.PasswordChar := ’*’;
PasteFromClipboard method
Applies to
TDBEdit, TDBImage, TDBMemo, TEdit, TMaskEdit, TMemo components
Declaration
procedure PasteFromClipboard;
The PasteFromClipboard method copies the contents of the Clipboard to the control,
inserting the contents where the cursor is positioned.
Example
This example uses two edit boxes and a button on a form. When the user clicks the
button, text is cut from the Edit1 edit box and pasted into the Edit2 edit box:
procedure TForm1.Button1Click(Sender: TObject);
begin
Edit1.SelectAll;
Edit1.CutToClipboard;
Edit2.Clear;
Edit2.PasteFromClipboard;
Edit1.SetFocus;
end;
See also
Clear method, ClearSelection method, CopyToClipboard method, CutToClipboard method
Format
sensitive online Help.
Format is modified by PasteSpecialDlg to specify the Clipboard format of the data
selected by the user in the Paste Special dialog box. If the object is an OLE object,Format
+
specifies the Clipboard format registered with RegisterClipboardFormat, prior to the call
to PasteSpecialDlg. If the object is a type other than an OLE object, Format specifies its
Clipboard format (for example, if the data is text, format specifies CF_TEXT).
+
Handle Handle is modified by PasteSpecialDlg to provide a handle to the data on the Clipboard.
If the data is a type other than an OLE object, use the THandle returned in the Handle
+
PInitInfo
parameter to access the data.
If InsertOLEObject returns True, InsertOLEObjectDlg modifies the PInitInfo pointer
parameter to point to OLE initialization information. Initialize the OLE object by
+
assigning this pointer to the PInitInfo property. When your application is finished with
the PInitInfo pointer, it should be released with ReleaseOLEInitInfo. +
Example +
The following code registers a new Clipboard format for embedded OLE objects and
creates a object formats array for FEmbedClipFmt. If an embedded OLE object is on the +
Clipboard, the Paste Special Dialog box is displayed. If the user selects the object and
chooses OK, then OLEContainer1 is initialized. P
var
FEmbedClipFmt: Word;
Fmts: array[0..0] of BOLEFormat;
TheFormat: Word;
TheHandle: THandle;
TheInfo: Pointer;
begin
FEmbedClipFmt := RegisterClipboardFormat('Embedded Object');
Fmts[0].fmtId := FEmbedClipFmt;
Fmts[0].fmtMedium := BOLEMediumCalc(FEmbedClipFmt);
Fmts[0].fmtIsLinkable := False;
StrPCopy (Fmts[0].fmtName, '%s');
StrPCopy (Fmts[0].fmtResultName, '%s');
if PasteSpecialEnabled(Self, Fmts) then
if PasteSpecialDlg(Form1, Fmts, 0, TheFormat, TheHandle, TheInfo) then
OLEContainer1.PInitInfo := TheInfo;
end;
See also
InsertOLEObjectDlg function, LinksDlg procedure, PasteSpecialEnabled function
Example
The following code calls PasteSpecialDlg if the Paste Special dialog box is enabled or
displays a message if it is not enabled.
var
Pasted: Boolean;
begin
if PasteSpecialEnabled(Self, Fmts) then
Pasted := PasteSpecialDlg(Form1, Fmts, 0, TheFormat, TheHandle, TheInfo)
else
MessageDlg(‘There are no OLE objects on the Clipboard’, mtInformation, [mbOK], 0);
end;
See also
HasFormat method
Pause method
Applies to
TMediaPlayer component
Declaration
procedure Pause;
The Pause method pauses the open multimedia device. If the device is already paused
when Pause is called, the device resumes playing or recording by calling the Resume
method. Pause is called when the Pause button on the media player control is clicked at
run time.
Upon completion, Pause stores a numerical error code in the Error property and the
corresponding error message in the ErrorMessage property.
The Wait property determines whether control is returned to the application before the
+
Pause method has completed. The Notify property determines whether Pause generates
an OnNotify event.
+
Example
+
This example uses a media player, a timer, and a button on a form. Only the button is
visible when the application runs. When the user clicks the button, the .WAV file plays.
+
When the user clicks the button again, the .WAV file pauses. The caption of the button
changes, depending on whether the .WAV file is playing, paused, or stopped. +
To run this example, you must have the CHIMES.WAV file in your Windows directory
and have a device that plays WAV audio files:
+
procedure TForm1.FormActivate(Sender: TObject);
var
+
WinDir: PChar;
begin
+
MediaPlayer1.Visible := False;
GetMem(WinDir, 144); +
+
GetWindowsDirectory(WinDir, 144);
StrCat(WinDir, '\chimes.wav');
MediaPlayer1.FileName := StrPas(WinDir);
MediaPlayer1.Open;
FreeMem(WinDir, 144); +
Button1.Caption := 'Play';
end; +
procedure TForm1.Button1Click(Sender: TObject);
begin +
+
if Button1.Caption = 'Play' then
begin
Button1.Caption := 'Pause';
end
MediaPlayer1.Play;
P
else
begin
Button1.Caption := 'Play';
MediaPlayer1.Pause;
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if MediaPlayer1.Mode = mpStopped then
Button1.Caption := ‘Play’;
end;
See also
PauseOnly method, Play method, StartRecording method, Stop method
PauseOnly method
Applies to
TMediaPlayer component
Declaration
procedure PauseOnly;
The PauseOnly method only pauses the open multimedia device. If the device is already
paused when PauseOnly is called, the device will remain paused.
Upon completion, PauseOnly stores a numerical error code in the Error property and the
corresponding error message in the ErrorMessage property.
The Wait property determines whether control is returned to the application before the
PauseOnly method has completed. The Notify property determines whether PauseOnly
generates an OnNotify event.
Example
The following code illustrates the difference between Pause and PauseOnly. After the
second call to Pause, MediaPlayer1 resumes playing. After the second call to PauseOnly,
MediaPlayer1 is still paused.
with MediaPlayer1 do begin
MediaPlayer1.Play;
MediaPlayer1.Pause;
{ Now its paused }
MediaPlayer1.Pause;
{ Now its playing }
MediaPlayer1.PauseOnly;
{ Now its paused }
MediaPlayer1.PauseOnly;
{ Now its still paused }
end;
See also
Pause method, Play method, Resume method, StartRecording method, Stop method
Pen property
Applies to
TCanvas object; TShape component
Declaration
property Pen: TPen;
A canvas object’s Pen property determines what kind of pen the canvas uses for
drawing lines and shape outlines.
Example
var
S: string;
begin
Str(Pi:10:11, S);
Canvas.TextOut(10, 10, 'Pi = ' + S);
end;
Picture property
Applies to
TDBImage, TImage components
Declaration
property Picture: TPicture;
The Picture property determines the image that appears on the image control. The
property value is a TPicture object which can contain an icon, metafile, or bitmap
graphic.
Example
This example uses two picture components. When the form first appears, two bitmaps
are loaded into the picture components and stretched to fit the size of the components.
To try this code, substitute names of bitmaps you have available.
procedure TForm1.FormCreate(Sender: TObject);
begin
Image1.Stretch := True;
Image2.Stretch := True;
Image1.Picture.LoadFromFile('BITMAP1.BMP');
Image2.Picture.LoadFromFile('BITMAP2.BMP');
end;
See also
Bitmap property, Icon property, Metafile property, LoadFromFile method, SaveToFile
method
PictureClosed property
Applies to
TOutline component
Declaration
property PictureClosed: TBitmap;
The PictureClosed property determines the picture displayed in the TOutline component
that represents an item, which contains subitems but is not expanded. By default, the
PictureClosed property contains a picture of a closed file folder. The OutlineStyle property
must be set to osPictureText, osPlusMinusPictureText, or osTreePictureText to display the
PictureClosed picture.
Example
The following code loads a new bitmap for the PictureClosed property of Outline1.
Outline1.PictureClosed.LoadFromFile('C:\closed.bmp');
Declaration
property PictureMinus: TBitmap;
The PictureMinus property determines the picture displayed in the TOutline component
that represents an item, which contains subitems and is expanded. By default, the
PictureMinus property contains a bitmap of a minus sign. The OutlineStyle property
must be set to osPlusMinusPictureText or osPlusMinusText to display the PictureMinus
picture.
Example
The following code displays the same picture for the plus and minus states of Outline1.
The same graphic appears whether an item is expanded or collapsed.
Outline1.PictureMinus := Outline1.PicturePlus;
See also
PictureClosed property, PictureLeaf property, PictureOpen property, PicturePlus property
PictureOpen property
Applies to
TOutline component
Declaration
property PictureOpen: TBitmap;
The PictureOpen property determines the picture displayed in the TOutline component
that represents an item, which contains subitems and is expanded. By default, the
PictureOpen property contains a bitmap of an open file folder. The OutlineStyle property
must be set to osPictureText, osPlusMinusPictureText, or osTreePictureText to display the
PictureOpen picture.
Example
The following code copies text (‘Hello world’) into the PictureOpen bitmap.
Outline1.PictureOpen.Canvas.TextOut(0, 0, ‘Hello world’);
See also
PictureClosed property, PictureLeaf property, PictureMinus property, PicturePlus property
PicturePlus property
Applies to
TOutline component
Declaration
property PicturePlus: TBitmap;
The PicturePlus property determines the bitmap displayed in the TOutline component
that represents an item, which contains subitems but is not expanded. By default, the
PicturePlus property contains a bitmap of a plus sign. The OutlineStyle property must be
set to osPlusMinusPictureText or osPlusMinusText to display the PicturePlus picture.
Example
The following code allows the user to specify the graphic for the PicturePlus property of
Outline1 by using the Open dialog box .
if OpenDialog1.Execute then
Outline1.PicturePlus.LoadFromFile(OpenDialog1.FileName);
Declaration
property PInitInfo: Pointer;
PInitInfo specifies a pointer to the OLE object initialization information. Assigning a
pointer, which points to valid OLE initialization information, to the PInitInfo property
initializes the OLE object in the OLE container.
Typically, a valid PInitInfo pointer can be obtained by using the InsertOLEObjectDlg or
PasteSpecialDlg functions, or as a property of the TOLEDropNotify object passed in the
Source parameter of the OnDragDrop event when an OLE object is dropped on a form.
Example
The following code initializes OLEContainer1 when an OLE object is dropped on the
Form1 at run time. Attach this code to the OnDragDrop event handler of Form1.
procedure TForm1.FormDragDrop(Sender, Source: TObject; X, Y: Integer);
begin
if Source is TOLEDropNotify then
with Source as TOLEDropNotify do
OLEContainer1.PInitInfo := Source.PInitInfo;
end;
Pitch property
Applies to
TFont object
Declaration
property Pitch: TFontPitch;
The Pitch property specifies the pitch or width of the characters of a font. Characters
with variable pitch can have varying widths. For example, the following characters are
in a variable pitch font. Note that the width of ten ‘i’ characters is less than the width of
ten ‘M’ characters.
iiiiiiiiii
MMMMMMMMMM
The following characters are in a fixed-pitch font. Note that ten ‘i’ characters are the
same width as ten ‘M’ characters:
iiiiiiiiii
MMMMMMMMMM
Here are the possible values for Pitch:
Value Meaning
fpDefault The font pitch is set to the default value, which depends on the font specified in the Name
property.
fpFixed The font pitch is set to fixed. All characters in the font have the same width.
fpVariable The font pitch is set to variable. The characters in the font have different widths.
Note Setting the Pitch of a fixed-width font to fpVariable or a variable-width font to fpFixed
might have no effect on the appearance of a font, or might cause another font to be
substituted. For example, setting the pitch of MS Serif (a variable-pitch font, by default)
to fpFixed causes Courier to be displayed.
Example
The following code toggles the pitch of the Font of Label1 from variable to fixed or from
fixed to variable.
PixelsPerInch property
Applies to
TFont object; TForm, TScreen components
Declaration
property PixelsPerInch: Integer;
There are three different properties called PixelsPerInch: one for forms, one for the
screen, and one for fonts.
For forms
Declaration
property PixelsPerInch: Integer;
The PixelsPerInch property for a form determines how many pixels per inch are used to
display a form. A higher value displays a smaller form at run time, and a lower value
displays a larger form. This property is useful when your application runs on a
computer system that uses a screen resolution different than the one you used to create
the application. By specifying the pixels per inch used by the other computer system,
you can be assured that the form appears as you designed it when your application
runs.
Note Although you can change the PixelsPerInch value with the Object Inspector, you won’t
see the results until you run your application. Also, you must set the Scaled property to
be True, or a change in the PixelsPerInch value has no effect.
Example
This example adds 30 to the form’s PixelsPerInch property if the screen’s PixelsPerInch
property is greater than 100:
procedure TForm1.FormActivate(Sender: TObject);
begin
Form1.Scaled := True;
if Screen.PixelsPerInch > 100 then
Form1.PixelsPerInch := Form1.PixelsPerInch + 30;
end;
See also
Scaled property
Declaration
property PixelsPerInch: Integer;
Read and run-time only. The PixelsPerInch property determines how many pixels are in
an inch using the current video driver. The value in PixelsPerInch is retrieved from
Windows when Delphi loads.
Example
This example adds 30 to the form’s PixelsPerInch property if the screen’s PixelsPerInch
property is greater than 100:
procedure TForm1.FormActivate(Sender: TObject);
begin
Form1.Scaled := True;
if PixelsPerInch > 100 then
Example
This example uses a media player and a button on a form. When the application runs,
only the button is visible. When the user clicks the button, the .WAV file plays.
To run this example, the file CHIMES.WAV must be in your Windows directory.
procedure TForm1.FormActivate(Sender: TObject);
var
WinDir: PChar;
begin
MediaPlayer1.Visible := False;
GetMem(WinDir, 144);
GetWindowsDirectory(WinDir, 144);
StrCat(WinDir, '\CHIMES.WAV');
MediaPlayer1.FileName := StrPas(WinDir);
MediaPlayer1.Open;
FreeMem(WinDir, 144);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
MediaPlayer1.Play;
end;
See also
Capabilities property, Pause method, PauseOnly method, StartRecording method, Stop
method
Point function
Declaration
function Point(AX, AY: Integer): TPoint;
The Point function takes the x- and y-coordinates passed in AX and AY and returns a
TPoint record. You’ll most often use Point to construct a parameter for a function that
requires one or more TPoint.
Example
The following code uses the Polygon method to draw a right triangle on a form called
Form1:
Polygon([Point(10, 10), Point(10, 20), Point(20, 20)]);
See also
Rect function
PokeDataLines method
Applies to
TDDEClientConv component
Declaration
function PokeDataLines(Item: string; Data: TStrings): Boolean;
The PokeDataLines method sends data to a DDE server application. Text data from a
linked control in the DDE client application is transferred to the linked section of the
DDE server application. Item specifies the linked item in the DDE server. Data is a
TStrings object that specifies the text data to transfer to the DDE server.
The usual direction of data flow is from the DDE server to the DDE client application.
Some DDE server applications won’t accept poked data. PokeDataLines returns True if
the data was successfully transferred, or False if the data was not successfully
transferred.
If you need to poke a single string rather than a string list, use the PokeData method.
Note If either the ExecuteMacro or ExecuteMacroLines method was called with its WaitFlg
parameter set to True prior to calling PokeDataLines, you must wait until the server
application has completed executing the macro before calling PokeDataLines. Depending
on the DDE server application, calling PokeDataLines before the DDE server application
has completed executing the macro might cause the macro to execute unsuccessfully or
produce unpredictable results.
Example
The following code pokes the data that is in Memo1 to the DDE server. The DDE item of
the conversation is specified in the DDEItem property of DDEClientItem1. TheData is a
PChar variable.
DDEClientConv1.PokeData(DDEClientItem1.DDEItem, Memo1.Lines));
See also
PokeData method
Polygon method
Applies to
TCanvas object
Declaration
procedure Polygon(Points: array of TPoint);
The Polygon method draws a series of lines on the canvas, connecting the points passed
to it in Points (much as the PolyLine method would), then closes the shape by drawing a
line from the last point to the first point. After drawing the complete shape, Polygon fills
the shape using the current brush.
Example
This example draws a polygon in the specified shape, and fills it with the color teal:
procedure TForm1.FormActivate(Sender: TObject);
begin
Canvas.Brush.Color := clTeal;
Canvas.Polygon([Point(10, 10), Point(30, 10),
Point(130, 30), Point(240, 120)]);
end;
See also
PolyLine method
end;
Point(140, 200), Point(80, 100), Point(5, 5)]);
+
See also +
Pen property, Polygon method
+
Popup method +
Applies to +
TPopupMenu component
P
Declaration
procedure Popup(X, Y: Integer);
The Popup method displays a pop-up menu onscreen at the coordinates indicated by the
values (in pixels) of X and Y.
Example
This example uses a pop-up menu. When the user presses the mouse button, the pop-up
menu appears near the upper left corner of the form:
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
PopupMenu1.AutoPopup := False;
PopupMenu1.Popup(Form1.Left + 10, Form1.Top + 40);
end;
See also
AutoPopup property, OnPopup event, PopupMenu property
PopupComponent property
Applies to
TPopupMenu component
Declaration
property PopupComponent: TComponent;
Run-time only. The PopupComponent property contains the name of the component the
user last clicked that displayed the pop-up menu. If your application has multiple
controls that share the same pop-up menu, you can use PopupComponent to determine
which of them last displayed the menu.
If you activate a pop-up menu by explicitly calling the Popup method, you should
specify the name of the component you want to associate with the pop-up menu in the
PopupComponent property
Example
This example uses two edit boxes, two memos, and one pop-up menu on a form. The
pop-up menu contains Cut, Copy, and Paste commands. This code makes the pop-up
menu available to both edit boxes and both memos:
procedure TForm1.FormCreate(Sender: TObject);
begin
PopupMenu1.AutoPopup := True;
Edit1.PopupMenu := PopupMenu1;
Edit2.PopupMenu := PopupMenu1;
Memo1.PopupMenu := PopupMenu1;
Memo2.PopupMenu := PopupMenu1;
end;
These are the cut, copy, and paste OnClick events for the commands on the pop-up
menu. The code only allows the user to cut and copy text from the edit boxes, and to
paste text into the memo boxes.
procedure TForm1.Copy1Click(Sender: TObject);
begin
if PopupMenu1.PopupComponent = Edit1 then
Edit1.CopyToClipboard
else
if PopupMenu1.PopupComponent = Edit2 then
Edit2.CopyToClipboard;
end;
procedure TForm1.Cut1Click(Sender: TObject);
begin
if PopupMenu1.PopupComponent = Edit1 then
Example
This example assigns the pop-up menu named MyPopupMenu to the form:
procedure TForm1.FormActivate(Sender: TObject);
begin
PopupMenu := MyPopupMenu;
end;
See also
OnPopup event
Example
var S: string;
begin
S := ' 123.5';
{ Convert spaces to zeroes }
while Pos(' ', S) > 0 do
S[Pos(' ', S)] := '0';
end;
See also
Concat function, Copy function, Delete procedure, Insert procedure, Length function
Position property
Applies to
TControlScrollBar, TForm, TMediaPlayer, TScrollBar components
The Position property determines the visual position of a component or the current
position within media loaded in a media player.
For forms
Declaration
property Position: TPosition;
The Position property determines the size and placement of the form when it appears in
+
your application. These are the possible values: +
Value
poDesigned
Meaning
The form appears positioned on the screen and with the same height and width as
+
poDefault
it had at design time.
The form appears in a position on the screen and with a height and width
+
determined by Delphi. Each time you run the application, the form moves slightly
down and to the right. The right side of the form is always near the far right side
of the screen, and the bottom of the form is always near the bottom of the screen,
+
poDefaultPosOnly
regardless of the screen’s resolution.
The form displays with the size you created it at design time, but Delphi chooses +
+
its position on the screen. Each time you run the application, the form moves
slightly down and to the right. When the form can no longer move down and to
the right and keep the same size while remaining entirely visible on the screen, the
poDefaultSizeOnly
form displays at the top-left corner of the screen.
The form appears in the position you left it at design time, but Delphi chooses its
size. The right side of the form is always near the far right side of the screen, and
+
the bottom of the form is always near the bottom of the screen, regardless of the
screen’s resolution. +
poScreenCenter The form remains the size you left it at design time, but is positioned in the center
of the screen. +
The default value is poDesigned. +
Example
This code assures that the first form will appear centered on the screen:
+
procedure TForm1.FormCreate(Sender: TObject);
begin
+
Position := poScreenCenter;
end;
+
For scroll bars
P
Declaration
property Position: Integer;
The Position property determines the position of the thumb tab on a scroll bar. When the
user scrolls the scroll bar, the value of Position changes. You can also change where the
thumb tab appears on the scroll bar by changing the value of Position.
For TControlScrollBar components, the value of the Range property determines the
number of possible positions on a scroll bar that a thumb tab can assume. The default
value is 0, which positions the thumb tab at the far left.
For TScrollBar components, the number of possible positions on the scroll bar is
determined by the difference between the Max property and the Min property. If the
Min and Position values are both 0, the thumb tab is positioned to the far left on a
horizontal scroll bar and to the top of a vertical scroll bar. If Min is 10, Position can be no
less than 10.
Example
This code places the thumb tab in the middle of the scroll bar:
ScrollBar1.Max := 1000;
ScrollBar1.Min := 500;
ScrollBar1.Position := 750;
See also
HorzScrollBar property, Increment property, LargeChange property, SmallChange
property, VertScrollBar property
Declaration
property Position: Longint;
Run-time only. The Position property specifies the current position within the currently
loaded medium. The value of Position is specified according to the current time format,
which is specified in the TimeFormat property.
Position defaults to the beginning of the medium. If the medium supports multiple
tracks, Position defaults to the beginning of the first track.
Example
The following code shows the position of the currently playing .WAV audio file
(CARTOON.WAV in this example) in the Caption of a label. The current position is
updated by Timer1.
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
with MediaPlayer1 do begin
DeviceType := dtWaveAudio;
FileName := 'CARTOON.WAV';
Open;
TimeFormat := tfMilliseconds;
Label1.Caption := IntToStr(Position);
Play;
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Label1.Caption := IntToStr(MediaPlayer1.Position);
end;
See also
Length property, Start property, TrackPosition property, Tracks property
See also
CloseDialog method +
Post method +
Applies to
+
TTable, TQuery, TStoredProc components P
Declaration
procedure Post;
The Post method writes the current record to the database. Post should be called after
calling Append or Insert and making any desired changes to the fields of the current
record.
Post behaves differently depending on a dataset’s state.
• In Edit state, Post modifies the current record.
• In Insert state, Post inserts or appends a new record.
• In SetKey state, Post commits the changes to the search key buffer, and returns the
dataset to Browse state.
Posting can be done explicitly, or implicitly as part of another procedure. When an
application moves off the current record, Delphi calls Post implicitly. Calls to the Next,
MoveBy, Prior, First, and Last methods perform a Post if the table is in Edit or Insert state.
The Append, AppendRecord, Insert, and InsertRecord methods also implicitly perform a
Post of any pending data.
Note If the record can not be written to the database for some reason, the dataset will remain
in Edit state.
Example
with Table1 do
begin
Append;
FieldByName(‘CustNo’).AsString := ‘9999’;
{ Fill in other fields here }
if { you are sure you want to do this} then Post
else { if you changed your mind } Cancel;
end.
See also
Cancel method
Precision property
Applies to
TBCDField, TCurrencyField, TFloatField components
Declaration
property Precision: Integer;
The Precision property is used in formatting numeric fields. The value of Precision is the
number of decimal places to the right of the decimal point the numeric value should be
formatted to before rounding begins. The default value is 15 decimal places.
Example
uses Dialogs;
type
Colors = (RED,BLUE,GREEN);
Example
StoredProc1.Prepare;
See also
Prepared property, UnPrepare method
For queries
Declaration
procedure Prepare;
The Prepare method sends a parameterized query to the database engine for parsing and
optimization. A call to Prepare is not required to use a parameterized query. However, it
is strongly recommended, because it will improve performance for dynamic queries
that will be executed more than once. If a query is not explicitly prepared, each time it is
executed, Delphi automatically prepares it.
Prepared is a Boolean property of TQuery that indicates if a query has been prepared.
If a query has been executed, an application must call Close before calling Prepare again.
Generally, an application should call Prepare once—for example, in the OnCreate event
of the form—then set parameters using the Params property, and finally call Open or
ExecSQL to execute the query. Each time the query is to be executed with different
parameter values, an application must call Close, set the parameter values, and then
execute the query with Open or ExecSQL.
See also
Text property
Prepared property
Applies to
TQuery, TStoredProc components
Example
{ Make sure that the server is aware that we will be executing the procedure }
with StoredProc1 do
if not Prepared then Prepared := True;
See also
Prepare method, UnPrepare method
See also
Params property, UnPrepare method
+
+
Preview property +
Applies to
TReport component
+
Declaration
+
property Preview: Boolean; P
The Preview property determines whether a report should be viewed onscreen or
printed. If Preview is True, the report appears onscreen when the report is run. If Preview
is False, the report is printed.
Example
This example uses a report component and a button on a form. When the user clicks the
button, a message appears if the Preview property is True. If Preview is True, the MyReport
report is sent to the screen; if Preview is False, the report prints on the printer.
procedure TForm1.Button1Click(Sender: TObject);
begin
Report1.ReportName := ‘MyReport’;
if Report1.Preview then
Application.MessageBox('Sending the report to the screen', 'Message box', MB_OK);
Report1.Run;
end;
See also
ReportName property, Run method
Previous method
Applies to
TForm, TMediaPlayer components
The Previous method activates the previous form or media player track.
For forms
Declaration
procedure Previous;
The Previous method makes the previous child form in the form sequence the active
form.
For example, if you have three child forms within a parent form in your MDI
application and Form4 is the active form, the Previous method makes Form3 the active
form. Calling Previous again makes Form2 active. The next time your application calls
Previous, the sequence starts over again and Form4 becomes the active form once again.
The Previous method applies only to forms that are MDI parent forms (have a FormStyle
property value of fsMDIForm).
Example
This code sample activates the previous child window of the parent (Form1) when the
user selects a menu item named Previous on a menu.
procedure TForm1.Previous1Click(Sender: TObject);
begin
Previous;
end;
See also
ArrangeIcons method, Cascade method, Next method, Tile method
Declaration
procedure Previous;
The Previous method sets the current position to the beginning of the previous track if
the position was at the beginning of a track when Previous was called. If the position is at
the first track or somewhere other than the beginning of a track when Previous was
called, Previous sets the current position to the beginning of the current track. If the
+
device doesn’t use tracks, Previous sets the current position to the beginning of the
medium, which is specified in the Start property. Previous is called when the Previous
+
button on the media player control is clicked at run time. +
Upon completion, Previous stores a numerical error code in the Error property and the
corresponding error message in the ErrorMessage property. +
The Wait property determines whether control is returned to the application before the
Previous method has completed. The Notify property determines whether Previous +
generates an OnNotify event.
+
Example
The following code rewinds the media after playing has completed. Normally, setting
AutoRewind to True would accomplish the same result, but if EndPos is set, AutoRewind
+
has no effect. This code is essentially an AutoRewind for media with EndPos set. +
with MediaPlayer1 do
begin
EndPos := 3000;
+
Play;
Previous;
+
end;
+
See also
AutoRewind property, Next method, Position property, Tracks property +
+
Print method
+
Applies to
TForm, TReport components P
For forms
Declaration
procedure Print;
The Print method prints the form.
Example
This example uses a button named PrintButton on a form. When the user chooses the
button, the form prints.
procedure TForm1.PrintButtonClick(Sender: TObject);
begin
Print;
end;
See also
PrintScale property
For reports
Declaration
function Print: Boolean;
The Print method determines whether a ReportSmith report prints. Print sends a DDE
message to ReportSmith Runtime and looks for a DDE message from ReportSmith
Runtime in return. If Print returns True, ReportSmith Runtime received the message to
print the report. If Print returns False, ReportSmith Runtime could not receive the DDE
message at the current time.
Example
This example notifies the user if the report is being printed:
procedure TForm1.Button1Click(Sender: TObject);
begin
if Report1.Print = True then
MessageDlg('Printing the report', mtInformation, [mbOK], 0) ;
end;
See also
Preview property, PrintCopies property, Run method
PrintCopies property
Applies to
TReport component
Declaration
property PrintCopies: Word;
The value of the PrintCopies property determines how many copies of the report are
printed when you run a report. Specify the number of copies you want printed when
your report runs. The default value is 1.
Example
The following code reads the number of copies to print from an edit box.
Report1.PrintCopies := StrToInt(Edit1.Text);
See also
EndPage property, StartPage property
Example
The following code asks the user if they want to use the default printer. If they choose
yes, PrinterIndex specifies the default printer. The code assumes that Printer is a TPrinter
object.
if (MessageDlg('Do you want to use the default printer',
mtInformation, mbYesNoCancel,0)=idYes) then
Printer.PrinterIndex := -1;
See also
Printers property
Printers property
Applies to
TPrinter object
Declaration
property Printers: TStrings;
Run-time and read only. The Printers property is a list of all printers installed in
Windows.
Example
The following code displays the names of all printers in ListBox1.
begin
ListBox1.Items := Printer1.Printers;
end;
See also
Printer variable
Printing property
Applies to
TPrinter object
Declaration
property Printing: Boolean;
Run-time and read only. The Printing property determines whether a print job is
printing. Printing is True when your application has called the BeginDoc method, but the
EndDoc method (or the Abort method) hasn’t been called yet.
Example
This code terminates the print job if the job is currently printing:
if Printer.Printing then
Abort;
See also
Aborted property
See also
Options property, PrintToFile property
PrintScale property
Applies to
TForm component
Declaration
property PrintScale: TPrintScale;
The PrintScale property determines the proportions of a printed form. These are the
possible values:
Value Meaning
poNone No special scaling occurs; therefore, the printed form and how the form appears
onscreen may have somewhat different proportions.
poProportional The form is printed so that it maintains the same size that is has on the screen (the
same number of pixels per inch is used).
poPrintToFit The form is printed using the same screen proportions, but in a size that just fits the
printed page.
Example
The following code maintains the proportions of the form when it is printed.
Form1.PrintScale := poProportional;
Form1.Print;
See also
Print method
PrintToFile property
Applies to
TPrintDialog component
Declaration
property PrintToFile: Boolean;
The PrintToFile property determines if the user has chosen to print the print job to a file
rather than to a printer. If True, the user has checked the Print to File check box. If False,
the user has unchecked the Print to File check box. If PrintToFile is set to True at design
time, the Print to File check box is checked when the Print dialog box appears in your
application. The default value is False.
Note The Print to File check box appears in the Print dialog box, only if theOptions property set
includes poPrintToFile. Otherwise, your users won’t have the option of choosing to print
to a file.
Example
This example displays a print dialog box with its Print to File check box checked:
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
Declaration
property PrivateDir: string;
Run-time only. PrivateDir specifies the path of the directory in which to store temporary
files (for example, files used to process local SQL statements). You should set this
property if there will be only one instance of the application running at a time.
Otherwise, the temporary files from multiple application instances will interfere with
each other.
See also
Session variable
ProblemCount property
Applies to
TBatchMove component
Declaration
property ProblemCount: Longint;
Run-time and read only. ProblemCount is the number of records which could not be
added to Destination without loss of data due to field width constraints. If
AbortOnProblem is True, then this number will be one, since the operation will be aborted
when the problem occurs.
Example
MessageDlg(IntToStr(BatchMove1.ProblemCount) + ‘ records had problems’,
mtInformation, [mbOK], 0);
See also
ProblemTableName property
ProblemTableName property
Applies to
TBatchMove component
Declaration
property ProblemTableName: TFileName;
If the Execute method is unable to move a record to Destination without data loss (caused
by a field width conflict), the record will be placed in a new table with the name
supplied in ProblemTableName. If AbortOnProblem is True, then there will be at most one
record in this table since the operation will be aborted with that first record.
ProblemCount will have the number of records placed in the new table. If
ProblemTableName is not specified, the data in the record will still be trimmed and placed
in the destination table.
Example
BatchMove1.ProblemTableName := ‘PROB.DB’;
ProcessMessages method
Applies to
TApplication component
I, J, X, Y: Word;
begin
I := 0;
J := 0;
while I < 64000 do
begin
Randomize;
while J < 64000 do
begin
Y := Random(J);
Inc(J);
Application.ProcessMessages;
end;
X := Random(I);
Inc(I);
end;
Canvas.TextOut(10, 10, 'The Button2Click handler is finished');
end;
Example
var P: ^Byte;
begin
P := Ptr($40, $49);
Canvas.TextOut(10, 10, 'Current video mode is ' + IntToStr(P^));
end;
See also
Addr function
See also
Randomize procedure, RandSeed variable
The Randomize procedure initializes the built-in random number generator with a
random value (obtained from the system clock).
The random number generator should be initialized by making a call to Randomize, or
by assigning a value to RandSeed.
Example
var
I: Integer;
begin
Randomize;
for I := 1 to 50 do begin
{ Write to window at random locations }
Canvas.TextOut(Random(Width), Random(Height), 'Boo!');
end;
end;
See also
Random function, RandSeed variable
See also
Random function, Randomize procedure
Range property
Applies to
TControlScrollBar component
Declaration
property Range: Integer;
The value of the Range property determines how far a horizontal or vertical form scroll
bar can be scrolled. It also represents the virtual size of the form. For example, if the
Range value of a horizontal scroll bar is 500, and the client width of the form is 200, the
scroll bar position can range from 0 to 300. While the client width of the form is 200, the
+
virtual client width of the form is 500, because the user can scroll the form that far. +
If the value of Range for a horizontal scroll bar is less than the client width of the form or
scroll box, no horizontal scroll bar appears on the form. Likewise, if the value of Range +
for a vertical scroll bar is less than the client height of the form or scroll box, no vertical
scroll bar appears. +
For a horizontal scroll bar, the Range is calculated to be the distance of the right edge of
the control that is the farthest to the right in the scroll bar or form from the left edge of +
the scroll box or form plus an amount specified as the value of the Margin property. If
the form or scroll box contains one or more controls that are right-aligned (their Align
value is alRight), the width of these controls is also added to the Range calculation.
+
For a vertical scroll bar, the Range is calculated to be the distance of the bottom edge of +
the control farthest away from the top edge of the scroll box or form from the top of the
scroll box or form plus an amount specified as the value of the Margin property. If the
form or scroll box contains one or more controls that are bottom-aligned (their Align
+
value is alBottom), the height of these controls is also added to the Range calculation. +
Example
This example uses a button on a form. When the user clicks the button, a vertical scroll
+
bar alternately appears and disappears on the form, because the value of the Range
property changes with each click.
+
procedure TForm1.Button1Click(Sender: TObject);
begin
+
ClientHeight := 300;
VertScrollBar.Visible := True; +
if VertScrollBar.Range = 290 then
VertScrollBar.Range := 500
else
+
end;
VertScrollBar.Range := 290; +
See also
R
ClientHeight property, ClientWidth property, HorzScrollBar property, VertScrollBar
property, Visible property
Read method
Applies to
TBlobStream object
Declaration
function Read(var Buffer; Count: Longint): Longint;
The Read method copies up to Count bytes from the current position in the field to Buffer.
Buffer must have at least Count bytes allocated for it. Read returns the number of bytes
transferred (which may be less than the number requested in Count.) Transfers which
require crossing a selector boundary in the destination will be handled correctly.
Example
BlobStream1.Read(MyBuf, 4096);
See also
TBlobField component, TBytesField component, TVarBytesField component
See also
Eof function, ReadKey function, Readln procedure, Write procedure, Writeln procedure
See also
ReadInteger method, ReadSection method, ReadString method, WriteBool method
Example
uses WinCrt;
var
C: PChar;
begin
GetMem(C, 20);
C := #0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0;
Writeln('Type a phrase up to 20 characters long:');
ReadBuf(C, 20);
Writeln(' You typed: ');
Writeln(C);
end;
See also
ReadKey function
ReadFrom method
Applies to
TBitmap, TGraphic, TIcon, TMetafile, TPicture objects
Declaration
procedure ReadFrom(const Filename: string); virtual;
The ReadFrom method reads an image from the file named in FileName.
Example
To read an image into a bitmap object called MyBitmap from the file MYBITMAP.BMP,
MyBitmap.ReadFrom(‘MYBITMAP.BMP’);
See also
SaveToFile method
Declaration
function ReadInteger(const Section, Ident: string; Default: Longint): Longint;
The ReadInteger method retrieves an integer value in an .INI file.
The Section constant identifies the section of the .INI file in which to search for the value.
For example, the WIN.INI for Windows contains a [Desktop] section.
The Ident parameter is the name of the identifier of which you want the value.
The Default parameter is the default value.
Example
This example reads settings in the WIN.INI file and displays on the form the value of a
few settings.
Before you run this example, you must add the IniFiles unit to the uses clause of your
unit.
procedure TForm1.FormActivate(Sender: TObject);
var
WinIni: TIniFile;
begin
Canvas.TextOut(20, 10, 'VARIOUS WINDOWS SETTINGS');
WinIni := TIniFile.Create('Win.Ini');
with WinIni do
begin
Canvas.TextOut(10, 45, 'Border Width = ' +
IntToStr(ReadInteger('Windows', 'BorderWidth', -1)));
Canvas.TextOut(10, 65, 'Icon Spacing = ' +
IntToStr(ReadInteger('Desktop', 'IconSpacing', -1)));
Canvas.TextOut(10, 85, 'Grid Granularity = ' +
IntToStr(ReadInteger('Desktop', 'GridGranularity', -1)));
Canvas.TextOut(10, 105, 'Cursor Blink Rate = ' +
IntToStr(ReadInteger('Windows', 'CursorBlinkRate', -1)));
Canvas.TextOut(10, 125, 'Double Click Speed = ' +
IntToStr(ReadInteger('Windows', 'DoubleClickSpeed', -1)));
end;
WinIni.Free;
end;
See also
ReadBool method, ReadSection method, ReadString method, WriteBool method
Example
uses WinCrt;
var
C: Char;
begin
Writeln('Please press a key');
See also
Alignment property, EditMask property, Options property, Title property, Visible property
For tables
Declaration
property ReadOnly: Boolean;
Use the ReadOnly property to prevent users from changing data in the table.
Note Set the Active property to False before changing ReadOnly.
Example
Table1.Active := False;
Table1.ReadOnly := True;
Table1.Active := True;
See also
Exclusive property
ReadSection method
Applies to
TIniFile object
Declaration
procedure ReadSection (const Section: string; Strings: TStrings);
The ReadSection method reads all the variables of a section of an .INI file into a string
object. The Strings parameter specifies the string list object. If you want to use a string
list that is maintained by a component such as a list box, Strings should specify the
property of the component that contains the string list. If you want to maintain the
string list independent of any components, use a TStringList object.
The Section constant identifies the section of the .INI file that is read. For example, the
+
WIN.INI for Windows contains a [Desktop] section. +
Example
This example uses a list box on a form. When the application runs, all the entries in the
+
Windows section of the WINI.INI file appear as items in the list box. +
Before you run this example, you must put the IniFiles unit in the uses clause of your
unit. +
procedure TForm1.FormActivate(Sender: TObject);
var +
+
WinIni: TIniFile;
begin
WinIni := TIniFile.Create('WIN.INI');
WinIni.ReadSection('Windows', ListBox1.Items);
WinIni.Free; +
end;
+
See also
EraseSection method, ReadBool method, ReadInteger method, ReadSectionValues method,
ReadString method, WriteBool method, WriteInteger method, WriteString method
+
+
ReadSectionValues method +
Applies to
TIniFile object
+
Declaration
+
procedure ReadSectionValues(const Section: string; Strings: TStrings); +
The ReadSectionValues method reads all the variables and their values of an entire
section of an .INI file into a string object. You can then use the Values property of string R
and string list objects to access a specific string in the list of strings.
Example
This example reads the Transfer section of the DELPHI.INI file into a memo and
changes one of the strings:
procedure TForm1.Button1Click(Sender: TObject);
var
DelphiIni: TIniFile;
begin
DelphiIni := TIniFile.Create('c:\windows\delphi.ini');
Memo1.Clear;
DelphiIni.ReadSectionValues('Transfer', Memo1.Lines);
Memo1.Lines.Values['Title1'] := 'Picture Painter';
DelphiIni.Free;
end;
Although this example doesn’t do so, your code could then write the new value to the
DELPHI.INI file.
See also
EraseSection method, ReadBool method, ReadInteger method, ReadSection method,
ReadString method, Values property, WriteBool method, WriteInteger method, WriteString
method
ReadString method
Applies to
TIniFile object
Declaration
function ReadString(const Section, Ident, Default: string): string;
The ReadString method retrieves a string in an .INI file.
The Section constant identifies the section of the .INI file in which to search for the value.
For example, the WIN.INI for Windows contains a [Desktop] section.
The Ident constant is the name of the identifier of which you want the value.
The Default constant is the default string value.
Example
This example reads strings in the DELPHI.INI file and displays them on the form.
Before you run this application, you must add the IniFiles unit to the uses clause of your
unit.
procedure TForm1.FormActivate(Sender: TObject);
var
DelphiIni: TIniFile;
begin
Canvas.TextOut(20, 10, 'VARIOUS DELPHI SETTINGS');
DelphiIni := TIniFile.Create('Delphi.Ini');
with DelphiIni do
begin
with Canvas do
begin
TextOut(10, 50, 'Editor Font = ' +
ReadString('Editor', 'FontName', 'ERROR'));
TextOut(10, 70, 'Search Path = ' +
ReadString('Library', 'SearchPath', 'ERROR'));
TextOut(10, 90, 'Component Library = ' +
ReadString('Library', 'ComponentLibrary', 'ERROR'));
TextOut(10, 110, 'VBX Directory = ' +
ReadString('VBX', 'VBXDir', 'ERROR'));
TextOut(10, 130, 'VBX Unit Directory = ' +
Example
The following code sets the ‘FirstName’ report variable to ‘Marty’, then recalculates the
report.
Report1.SetVariable(‘FirstName’, ‘Marty’);
if not (Report1.RecalcReport) then
MessageDlg(‘Unable to recalculate’, mtInformation, [mbOK] 0);
See also
Preview property, Print method, Run method, SetVariable method, SetVariableLines
method
Rect function
Declaration
function Rect(ALeft, ATop, ARight, ABottom: Integer): TRect;
The Rect function returns a TRect record built from the individual coordinates passed in
ALeft, ATop, ARight, and ABottom. You’ll usually use Rect to construct parameters for
functions that require TRect, rather than setting up local variables for each one.
Example
The following code defines the display rectangle for a media player component to be
100 pixels wide, 200 pixels tall, with a top-left corner at coordinates (10, 10);
MediaPlayer1.DisplayRect := Rect(10, 10, 110, 210);
See also
Point function
RecordCount property
Applies to
TBatchMove, TQuery, TStoredProc, TTable components
Example
{ Limit the move to the first 1000 records }
See also
RoundRect method
Refresh method
Applies to
All controls; TTable, TQuery, TStoredProc components
Declaration
procedure Refresh;
The Refresh method erases whatever image is on the screen and then repaints the entire
control. Within the implementation of Refresh, the Invalidate and then the Update
methods are called.
Example
The following code refreshes all windowed controls of Form1, then refreshes Form1.
var
I: Integer;
begin
for I := 0 to Form1.ComponentCount-1 do
if Form1.Components[i] is TWinControl then
with Form1.Components[i] as TWinControl do
Refresh;
Form1.Refresh;
end;
See also
Repaint method
See also
TOLEDropNotify object
Release method
Applies to
TForm component
Declaration
procedure Release;
The Release method destroys the form and releases its associated memory. It is much like
the Free method except that it does not destroy the form until all event handlers of the
form or event handlers of components on the form have finished executing.
Example
This example displays a message box about the form going away, calls Release, and
terminates the application.
procedure TForm1.Button1Click(Sender: TObject);
begin
MessageDlg('This form is going away forever', mtInformation, [mbOK], 0);
Release;
Application.Terminate;
end;
See also
Free method, Destroy method
Example
uses Crt;
var
p : pointer;
p1,p2,p3 : ^Integer;
begin
ClrScr;
New(p1); { Allocate an Integer }
Mark(p); { Save heap state }
New(p2); { Allocate two more Integers }
Example
The following code uses PasteSpecialDlg to specify OLE initialization information. After
OLEContainer1 is initialized, the information is released. Fmts is assumed to be a valid
array of BOLEFormat records.
var
ClipFmt: Word;
DataHand: THandle;
Info: Pointer;
begin
if PasteSpecialDlg(Form1, Fmts, 0, ClipFmt, DataHand, Info) then
begin
OLEContainer.PInitInfo := Info;
ReleaseOLEInitInfo(Info);
end;
end;
See also
PInitInfo property
ReleasePalette method
Applies to
TBitmap object
Declaration
function ReleasePalette: HPalette;
The ReleasePalette method returns the handle to the bitmap’s palette so that the TBitmap
object no longer knows about the palette.
Example
The following code release the palette of the bitmap in MyBitmap.
MyBitmap.ReleasePalette;
See also
ReleaseHandle method
Remove method
Applies to
TList object
Declaration
function Remove(Item: Pointer): Integer;
The Remove method deletes the item referenced in the Item parameter from the list of
pointers stored in the List property of a list object. The value returned is the position of
the item in the list of pointers before it was removed. After an item is removed, its
position in the list is nil.
Example
The following code adds a new object to a list in a list object and then removes it:
Declaration
procedure RemoveAllPasswords;
The RemoveAllPasswords method causes all previously entered password information to
be discarded. Any future access will require that new password information be
supplied before the table can be opened. This method affects Paradox databases only.
Example
Session.RemoveAllPasswords;
See also
RemovePassword method, Session variable
RemoveComponent method
Applies to
All components
Declaration
procedure RemoveComponent(AComponent: TComponent);
The RemoveComponent method removes the component specified in the AComponent
parameter from the component’s Components list. That position in the list becomes nil.
Example
The following code removes Button2 from the Components list of Form1.
Form1.RemoveComponent(Button2);
See also
InsertComponent method
RemoveControl method
Applies to
All controls
Declaration
procedure RemoveControl(AControl: TControl);
The RemoveControl method removes the control specified with the AControl parameter
from the Controls array of this control. The result is that this control is no longer the
parent of the removed control.
Example
This example uses a button placed alongside a group box. When the user clicks the
button, the group box becomes the parent of the button, so the button moves inside the
group box:
procedure TForm1.Button1Click(Sender: TObject);
begin
RemoveControl(Button1);
See also
AddParam method
RemovePassword method
Applies to
TSession component
Declaration
procedure RemovePassword(const Password: string);
The RemovePassword method removes Password from the known set of authorizations.
Any future access will require that new password information be supplied before the
table can be opened. This method affects Paradox databases only.
Example
Session.RemovePassword(’MySecret’);
See also
RemoveAllPasswords method, Session variable
Example
uses Dialogs;
var
f : file;
begin
OpenDialog1.Title := 'Choose a file... ';
if OpenDialog1.Execute then begin
SaveDialog1.Title := 'Rename to...';
if SaveDialog1.Execute then begin
AssignFile(f, OpenDialog1.FileName);
Canvas.TextOut(5, 10, 'Renaming ' + OpenDialog1.FileName + ' to ' +
SaveDialog1.FileName);
Rename(f, SaveDialog1.FileName);
end;
end;
end;
Example
The following code repaints all windowed controls of Form1, then repaints Form1.
var
I: Integer;
begin
for I := 0 to Form1.ComponentCount-1 do
if Form1.Components[I] is TWinControl then
with Form1.Components[I] as TWinControl do
Repaint;
Form1.Repaint;
end;
See also
Refresh method
ReplaceText property
Applies to
TReplaceDialog component
Declaration
property ReplaceText: string;
The ReplaceText property contains the string your application can use to replace the
string specified in the FindText property when the FindText value is found during a
search.
Example
The following code replaces the selected text in Memo1 with the value of ReplaceText.
Memo1.SelText := ReplaceDialog1.ReplaceText;
See also
FindText property
ReportDir property
Applies to
TReport component
Declaration
property ReportDir: string;
The value of the ReportDir is the directory where ReportSmith stores its reports and
expects to find saved reports. By specifying a report directory, you won’t have to
include a path when specifying a report name.
Example
The following text lets the user use the Save dialog box component to specify where
ReportSmith saves its reports.
if SaveDialog1.Execute then
Report1.ReportDir := SaveDialog1.FileName;
See also
ReportName property
Example
The following code lets users use the Open dialog box component to specify the report
they want to run.
if OpenDialog1.Execute then
Report1.ReportName := OpenDialog1.FileName;
See also
ReportDir property
RequestData method
Applies to
TDDEClientConv component
Declaration
function RequestData(const Item: string): PChar;
The RequestData method requests data from a DDE server. Call RequestData when you
want your DDE client application to receive data from the server once, instead of being
updated continually. Another reason to use RequestData is that some DDE servers
contain DDE items that can’t be continually updated; the only way for your client to
access these items is to explicitly request the data.
Item specifies the DDE server item you want data from. The value of the DDE item
depends on the linked DDE server application. Item is typically a selectable portion of
text, such as a spreadsheet cell or a database field in an edit box. If the DDE server is an
Delphi application, Item is the name of the linked DDE server component.
Note See the documentation for the DDE server application for the specific information about
specifying DDEItem.
RequestData returns a null-terminated PChar string which contains the value of the item
requested of the DDE server. RequestData automatically allocates memory to store this
data, but you must dispose of the PChar string returned by RequestData after you have
finished processing it. This is done with the StrDispose function.
Example
The following code requests data from the DDE server and displays it in Label1. The
DDE item of the conversation is specified in the DDEItem property of DDEClientItem1.
var
TheData: PChar;
begin
TheData := DDEClientConv1.RequestData(DDEClientItem1.DDEItem);
Label1.Caption := StrPas(TheData);
end;
See also
StrPas function
RequestLive property
Applies to
TQuery component
Example
{ Is field required? }
if FieldDef1.Required) then
MessageDlg(Name 'is a required field’ , mtInformation, [mbOK], 0);
See also
TField component
Example
function FileExists(FileName: string): Boolean;
{ Boolean function that returns True if the file exists; otherwise,
it returns False. Closes the file if it exists. }
var
F: file;
begin
{$I–}
AssignFile(F, FileName);
FileMode := 0; ( Set file access to read only }
Reset(F);
CloseFile(F);
{$I+}
FileExists := (IOResult = 0) and (FileName <> '');
end;
Canvas.TextOut(10, 10, 'File not found');
+
See also +
Append procedure, AssignFile procedure, FileClose procedure, Rewrite procedure, Truncate
procedure +
+
Restore method
+
Applies to
TApplication component +
Declaration +
procedure Restore;
The Restore method returns your application to its previous size before it was
+
maximized or minimized.
Don’t confuse the Restore method with restoring a form or window to its original size.
+
To minimize, maximize, and restore a window or form, you change the value of the
WindowState property.
+
Example
+
This example uses a timer on a form. When the application runs and the user minimizes +
the application, the application returns to its normal size when an OnTimer event occurs:
procedure TForm1.Timer1Timer(Sender: TObject);
begin
R
Application.Restore;
end;
See also
BorderIcons property, BorderStyle property, Minimize method
RestoreTopMosts method
Applies to
TApplication component
Declaration
procedure RestoreTopMosts;
The RestoreTopMosts method restores forms that were originally designated as topmost
forms (FormStyle is fsStayOnTop) and then temporarily changed to be non-topmost
forms with the NormalizeTopMosts method call. After a call to RestoreTopMosts, the
topmost forms move on top of other forms again.
Example
The following code normalizes topmost forms before calling the MessageBox function in
the WinProcs unit. After the message box is closed, the topmost forms are restored.
begin
Application.NormalizeTopMosts;
MessageBox(Form1.Handle, 'This should be on top.', 'Message Box', MB_OK);
Application.RestoreTopMosts;
end;
Resume method
Applies to
TMediaPlayer component
Declaration
procedure Resume;
The Resume method resumes playing or recording the currently paused multimedia
device. Resume is called when the Pause button on the media player control is clicked at
run time, when the device is paused.
Upon completion, Resume stores a numerical error code in the Error property, and the
corresponding error message in the ErrorMessage property.
The Wait property determines whether control is returned to the application before the
Resume method has completed. The Notify property determines whether Resume
generates an OnNotify event.
Example
The following code resumes the playing or recording of MediaPlayer1.
MediaPlayer1.Resume;
See also
Pause method, PauseOnly method
See also
AutoRewind property, Back method
untyped file, RecSize specifies the record size to be used in data transfers. If RecSize is
omitted, a default record size of 128 bytes is assumed.
Rewrite creates a new external file with the name assigned to F.
If an external file with the same name already exists, it is deleted and a new empty file is
created in its place.
If F is already open, it is first closed and then re-created. The current file position is set to
the beginning of the empty file.
If F was assigned an empty name, such as AssignFile(F,''), then after the call to Rewrite, F
refers to the standard output file (standard handle number 1).
If F is a text file, F becomes write-only.
After calling Rewrite, Eof(F) is always True.
{$I+} lets you handle run-time errors using exceptions. For more information on
handling run-time library exceptions, see Handling RTL Exceptions in the Help system.
If you are using {$I–}, you must use IOResult to check for I/O errors.
Example
var F: TextFile;
begin
AssignFile(F, 'NEWFILE.$$$');
Rewrite(F);
Writeln(F, 'Just created file with this text in it...');
CloseFile(F);
end;
See also
Append procedure, AssignFile procedure, Reset procedure, Truncate procedure
end;
MessageDlg('Directory removed', mtInformation, [mbOk], 0);
+
See also +
ChDir procedure, GetDir procedure, MkDir procedure
+
Rollback method +
Applies to +
TDataBase component
+
Declaration
procedure Rollback;
+
The Rollback method rolls back the current transaction and thus cancels all modifications
made to the database since the last call to StartTransaction. Use this method only when
+
connected to a server database.
+
Example
with Database1 do
+
begin
StartTransaction;
R
{ Update one or more records in tables linked to Database1 }
...
Rollback;
end;
See also
Commit method
Example
var
S, T: string;
begin
Str(1.4:2:1, T);
S := T + ' rounds to ' + IntToStr(Round(1.4)) + #13#10;
Str(1.5:2:1, T);
S := S + T + ' rounds to ' + IntToStr(Round(1.5)) + #13#10;
Str(-1.4:2:1, T);
S := S + T + ' rounds to ' + IntToStr(Round(-1.4)) + #13#10;
Str(-1.5:2:1, T);
S := S + T + ' rounds to ' + IntToStr(Round(-1.5));
MessageDlg(S, mtInformation, [mbOk], 0);
end;
See also
Int function, Trunc function
RoundRect method
Applies to
TCanvas object
Declaration
procedure RoundRect(X1, Y1, X2, Y2, X3, Y3: Integer);
The RoundRect method draws a rectangle on a canvas with the upper left corner at (X1,
Y1) and the lower right corner at (X2, Y2), much as the Rectangle method does. However,
RoundRect draws the corners as quarters of an ellipse with the width of X3 and a height
of Y3.
Example
This example draws many rectangles of various sizes and colors on a form maximized
to fill the entire screen:
var
X, Y: Integer;
procedure TForm1.FormActivate(Sender: TObject);
See also
DefaultRowHeight property, RowCount property, RowHeights property
RowCount property
Applies to
TDrawGrid, TStringGrid components
Declaration
property RowCount: Longint;
The value of the RowCount property determines the number of rows that appear in the
grid.
Example
This example uses a string grid and a button. When the user clicks the button, the
number of columns and rows change:
procedure TForm1.Button1Click(Sender: TObject);
begin
StringGrid1.ColCount := 7;
StringGrid1.RowCount := 11;
end;
See also
ColCount property, Row property, RowHeights property
RowHeights property
Applies to
TDrawGrid, TStringGrid components
Declaration
property RowHeights[Index: Longint]: Integer;
Run-time only. The RowHeights property determines the height in pixels of all the cells
within the row referenced by the Index parameter.
By default, all the rows are the same height, the value found in the DefaultRowHeight
property. To change the height of all rows within a grid, change the DefaultRowHeight
property value.
To change the height of one row without affecting any others, change the RowHeights
property. Specify the row you want to change as the value of the Index parameter.
Remember, the first row always has an Index value of 0.
Example
This example uses a string grid and a button. When the user clicks the button, the
number of columns and rows change, and the first column and row in the grid are sized
differently from the rest of the columns and rows:
end;
Note that the first position of the list box is empty, because there is no string in the cell
referenced by Cells[0, 1].
See also
Cells property, Cols property, Objects property, TStrings object
Run method
Applies to
TApplication, TReport components
For an application
Declaration
procedure Run;
The Run method executes the application.
When you create a new project, Delphi automatically creates a main program block in
the project file that calls the Run method.
Example
The main program block of a Delphi project always looks like this, by default:
begin
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
See also
CreateForm method, MainForm property
For reports
Declaration
procedure Run;
The Run method loads ReportSmith Runtime, runs the report specified as the value of
the ReportName property, and prints the report.
Example
The following code allows the user to specify the report with the Open dialog box and
then runs the report.
Declaration
function RunMacro(Macro: string): Boolean;
The RunMacro method runs the ReportBasic macro specified as the value of the Macro
parameter.
The RunMacro method sends a DDE message to ReportSmith Runtime to run the
specified macro and looks for a DDE message from ReportSmith Runtime in return. If
RunMacro returns True, the message to run the macro was sent successfully to
ReportSmith Runtime. If it returns False, ReportSmith Runtime could not receive the
DDE message at the current time.
For information about ReportBasic macros, refer to your ReportSmith documentation.
Example
The following code runs the macro “SELALL.MAC”.
Report1.RunMacro(‘SELALL.MAC’);
See also
Run method
Save method
Applies to
TMediaPlayer component
Declaration
procedure Save;
The Save method saves the currently loaded medium to the file specified in the FileName
property. Save is ignored for devices that don’t use media stored in files (videodiscs, for
example).
Upon completion, Save stores a numerical error code in the Error property, and the
corresponding error message in the ErrorMessage property.
The Wait property determines whether control is returned to the application before the
Save method has completed. The Notify property determines whether Save generates an
OnNotify event.
Example
The following code saves to a file when the SaveButton is clicked, assuming that
FileName has been specified.
procedure TForm1.SaveButtonClick(Sender: TObject);
begin
MediaPlayer1.Save;
end;
See also
Close method, Open method
Example
+
runs, the code attempts to load text in a text file named SOMETEXT.TXT into the memo +
This example uses a memo control and two buttons on a form. When the application
control. If the attempt fails, a message box appear, prompting the user to enter text in the
memo. +
The user must choose one of the two buttons, as there is no System menu (also called a
Control menu) on the form to close the form. If the user chooses the button labeled Save,
+
form closes. If the user chooses the button labeled Discard, the lines in the memo control +
the contents of the memo control is saved in a file named SOMETEXT.TXT, and the
See also
LoadFromFile method, LoadFromStream method, SaveToStream method
SaveToStream method
Applies to
TBlobField, TGraphicField, TMemoField components
Declaration
procedure SaveToStream(Stream: TStream);
The SaveToStream method writes a stream with the name passed in Stream with the
contents of TBlobField, TMemoField, or TGraphicField.
Example
{ Store a blob field into a stream }
BlobField1.SaveToStream(Stream1);
See also
LoadFromFile method, LoadFromStream method, SaveToFile method
ScaleBy method
Applies to
All controls
Declaration
procedure ScaleBy(M, D: Integer);
Description
The ScaleBy method scales a control to a percentage of its former size. The M parameter
is the multiplier and the D parameter is the divisor. For example, if you want a control to
be 75% of its original size, specify the value of M as 75, and the value of D as 100 (75/
100). You could also obtain the same results by specifying the value of M as 3, and the
value of D as 4 (3/4). Both fractions are equal and result in the control being scaled by
the same amount, 75%.
If you want the control to be 33% larger than its previous size, specify the value of M as
133, and the value of D as 100 (133/100). You can also obtain the same results by
specifying the value of M as 4, and the value of D as 3 (4/3), as the fraction 133/100 is
+
approximately equal to 4/3. +
Example
This example makes your form 50% larger:
+
procedure TForm1.Button1Click(Sender: TObject); +
+
begin
ScaleBy(150, 100);
end;
See also
+
Scaled property
+
Scaled property +
Applies to
+
TForm component
+
Declaration
property Scaled: Boolean;
+
The Scaled property determines if the form is scaled to the value in the PixelsPerInch
property. If Scaled is True and the value of PixelsPerInch differs from its default value, the
+
form is scaled to a new size. If Scaled is False, no scaling occurs, regardless of the
PixelsPerInch value. The default value is True.
+
Example
+
This code ensures that the form is always scaled to whatever value is in the PixelsPerInch
property:
+
procedure TForm1.FormCreate(Sender: TObject);
begin
+
Scaled := True;
end; S
See also
PixelsPerInch property, ScaleBy method
The Screen variable is a TScreen component that normally represents your screen device.
By default, your application creates a screen component based on information from
Windows about the current screen device and assigns it to Screen.
Example
The following code sets the width of a form called Form1 to half the width of the screen:
Form1.Width := Screen.Width div 2;
ScreenToClient method
Applies to
All controls
Declaration
function ScreenToClient(Point: TPoint): TPoint;
The ScreenToClient method is used to determine the control coordinates in pixels of a
point on the screen. ScreenToClient returns X and Y coordinates in a record of type
TPoint.
Example
The following code converts the origin of the screen (0, 0) to the client coordinates of
Button2.
var
ScreenOrgin, ClientPoint: TPoint;
begin
ScreenOrgin.X := 0;
ScreenOrgin.Y := 0;
ClientPoint := Button2.ScreenToClient(ScreenOrgin);
end;
Declaration
procedure ScrollBy(DeltaX, DeltaY: Integer);
The ScrollBy method scrolls the contents of a form or windowed control. You will
seldom need to call the ScrollBy method unless you want to write your own scrolling
logic rather than use a scroll bar.
The DeltaX parameter is the change in pixels along the X axis. A positive DeltaX value
scrolls the contents to the right; a negative value scrolls the contents to the left. The
DeltaY parameter is the change in pixels along the Y axis. A positive DeltaY value scrolls
the contents down; a negative value scrolls the contents up.
Example
This example uses a timer and several controls of your choosing on a form. When the
application runs, the controls on the form appear to slide down and off to the right. This
is because the contents of the form are scrolling both down and to the right by one pixel
each time a timer event occurs:
procedure TForm1.FormActivate(Sender: TObject);
begin
Timer1.Interval := 1;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
ScrollBy(1,1);
end;
See also
HorzScrollBar property, ScrollBars property, ScrollInView method, TScrollBox component,
VertScrollBar property
ScrollInView method
Applies to
TForm, TScrollBox components
Declaration
procedure ScrollInView(AControl: TControl);
The ScrollInView method scrolls the form or scroll box so that at least part of the control
specified as the AControl parameter is in view.
Example
This example uses two buttons on a form. Place each button on opposite sides of the
form. When the user runs the application and resizes the form so that it is smaller,
clicking either of the buttons scrolls the form so that at least part of the other button is
visible:
procedure TForm1.Button1Click(Sender: TObject);
begin
ScrollInView(Button2);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
ScrollInView(Button1);
end;
Example
uses WinCrt;
begin
GotoXY(1,10);
Writeln('Hello');
Writeln('Type in a line and press Enter.');
Readln;
ScrollTo(0,10);
end;
See also
GoToXY procedure
Sections property
Applies to
THeader component
Declaration
property Sections: TStrings
The Sections property is a list of strings that contain the text for the sections of a header.
The number of lines of the string list determines the number of sections of the header. If
the string list is empty, the header will have one blank section. If this string list contains
one or more lines, the text of each line will be in its own section. The first line will be in
the leftmost section, the second line will be in the next section to the right, and so on.
Example
The following code adds ‘Schaeferle’ to the header sections list.
Header1.Sections.Add(‘Schaeferle’);
See also
SectionWidth property
SectionWidth property
Applies to
THeader component
Declaration
property SectionWidth[X: Integer]: Integer;
Run-time only. The SectionWidth array property determines the width in pixels of the
sections of a header. X is an index into the sections, from 0 to the number of sections - 1.
For example, the index of the first section is 0, the second section is 1, and so on.
Example
The following code doubles the width of all the sections of a header.
var
I: Integer;
begin
with Header1 do
for I := Sections.Count-1 do
If you are using {$I–}, you must use IOResult to check for I/O errors.
Example
uses Dialogs;
var
f: file of Byte;
size : Longint;
S: string;
y: integer;
begin
if OpenDialog1.Execute then begin
AssignFile(f, OpenDialog1.FileName);
Reset(f);
size := FileSize(f);
S := 'File size in bytes: ' + IntToStr(size);
y := 10;
Canvas.TextOut(5, y, S);
y := y + Canvas.TextHeight(S) + 5;
S := 'Seeking halfway into file...';
Canvas.TextOut(5, y, S);
y := y + Canvas.TextHeight(S) + 5;
Seek(f,size div 2);
S := 'Position is now ' + IntToStr(FilePos(f));
Canvas.TextOut(5, y, S);
CloseFile(f);
end;
end;
See also
FilePos function
Example
var
f : System.TextFile;
begin
AssignFile(f,'TEST.TXT');
+
Rewrite(f);
{ Create a file with 8 numbers and some +
whitespace at the ends of the lines }
Writeln(f,'1 2 3 4 ');
Writeln(f,'5 6 7 8 ');
+
Reset(f); +
{ Read the numbers back. SeekEoln returns TRUE if there are no more numbers on the
+
current line; SeekEof returns TRUE if there is no more text (other than whitespace)
in the file. }
+
Y := 5;
while not SeekEof(f) do
begin
if SeekEoln(f) then
Readln; { Go to next line }
+
Read(f,j);
Canvas.TextOut(5, Y, IntToStr(j));
Y := Y + Canvas.TextHeight(IntToStr(j)) + 5;
+
end;
end;
+
See also
+
Eof function, SeekEoln function
+
SeekEoln function System +
Declaration +
function SeekEoln [ (var F: Text) ]: Boolean; +
The SeekEoln function returns the end-of-line status of a file.
SeekEoln can be used only on open text files.
+
{$I+} lets you handle run-time errors using exceptions. For more information on
handling run-time library exceptions, see Handling RTL Exceptions in the Help system.
S
If you are using {$I–}, you must use IOResult to check for I/O errors.
Example
var
f : System.TextFile;
i, j, Y : Integer;
begin
AssignFile(f,'TEST.TXT');
Rewrite(f);
{ Create a file with 8 numbers and some
whitespace at the ends of the lines }
Writeln(f,'1 2 3 4 ');
Writeln(f,'5 6 7 8 ');
Reset(f);
{ Read the numbers back. SeekEoln returns TRUE if there are no more numbers on the
current line; SeekEof returns TRUE if there is no more text (other than whitespace)
in the file. }
Y := 5;
while not SeekEof(f) do
begin
if SeekEoln(f) then
Readln; { Go to next line }
Read(f,j);
Canvas.TextOut(5, Y, IntToStr(j));
Y := Y + Canvas.TextHeight(IntToStr(j)) + 5;
end;
end;
See also
Eoln function, SeekEof function
Example
function MakeHexWord(w: Word): string;
const
hexChars: array [0..$F] of Char =
'0123456789ABCDEF';
var
HexStr : string;
begin
HexStr := '';
HexStr := HexStr + hexChars[Hi(w) shr 4];
HexStr := HexStr + hexChars[Hi(w) and $F];
HexStr := HexStr + hexChars[Lo(w) shr 4];
HexStr := HexStr + hexChars[Lo(w) and $F];
MakeHexWord := HexStr;
end;
var
i: Integer;
Y: Integer;
S: string;
Example
This example uses a list box, a label, and a button on a form. Enter several strings in the
list box as the value of the Items property. When the user selects items in the list box and
clicks the button, the number of items selected in the list box is displayed in the caption
of the label:
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption := IntToStr(ListBox1.SelCount) + ' items are selected';
end;
See also
ExtendedSelect property, MultiSelect property, Selected property
SelectAll method
Applies to
TComboBox, TDBComboBox, TDBEdit, TDBMemo, TDriveComboBox, TEdit,
TFilterComboBox, TMaskEdit, TMemo components
Declaration
procedure SelectAll;
The SelectAll method selects the entire block of text in the control. If you want to select
only part of the text, use the SelStart and SelLength properties.
Example
The following code selects all the text in Memo1.
Memo1.SelectAll;
See also
SelLength property, SelStart property, SelText property, Text property
Value Meaning
[ ], the empty set The user can select a directory that currently exists only. The user cannot specify a
directory that does not exist as there is no edit box to type in a new directory name.
sdAllowCreate An edit box appears in the dialog box so that the user can type in the name of a
directory that does not exist. This option does not create a directory, but the
application can access the Directory parameter to create the directory selected if
desired.
See also
+
DirectoryExists function, ForceDirectories procedure
S
Selected property
Applies to
TDBListBox, TDirectoryListBox, TFileListBox, TListBox components
Declaration
property Selected[X: Integer]: Boolean;
The Selected property determines whether a particular item is selected in the list box. The
X parameter is the item referenced by its position in the list box, with the first item
having an X value of 0. If the specified item is selected in the list box, the value of the
Selected property is True. If the specified item is not selected, Selected is False.
If you want the user to be able to select more than one item in the list box, use the
MultiSelect property
Example
This example uses a list box on a form. When the form is first created, 3 items are added
to the list box. When the user selects an item in the list box, the list box color changes to
reflect the item selected:
procedure TForm1.FormCreate(Sender: TObject);
var
I: Integer;
begin
ListBox1.Items.Add('Blue');
ListBox1.Items.Add('Yellow');
ListBox1.Items.Add('Red');
end;
procedure TForm1.ListBox1Click(Sender: TObject);
begin
if ListBox1.Selected[0] then
ListBox1.Color := clBlue;
if ListBox1.Selected[1] then
ListBox1.Color := clYellow;
if ListBox1.Selected[2] then
ListBox1.Color := clRed;
end;
See also
ExtendedSelect property, MultiSelect property, SelCount property
SelectedColor property
Applies to
TTabSet component
Declaration
property SelectedColor: TColor;
The SelectedColor property determines the color of the selected tab in the tab set control.
To view a list of available color values, see the Color property.
Example
This code changes the color of selected tabs:
TabSet11.SelectedColor := clPurple;
Example
The following code makes all the fields up to the selected field of the dataset of DBGrid1
read-only. I is an integer variable.
for I := 0 to DBGrid1.SelectedIndex do
DBGrid1.Fields[I].ReadOnly := True;
See also
SelectedField property
SelectedItem property
Applies to
TOutline component
Declaration
property SelectedItem: Longint;
Run-time only. The SelectedItem property determines which item of the outline currently
has focus. SelectedItem contains the Index value of the selected item. If no item is selected,
SelectedItem contains 0.
Example
The following code expands the selected item of Outline1.
Outline1.Items[Outline1.SelectedItem].FullExpand;
See also
Items property
Selection property
Applies to
TDrawGrid, TStringGrid components
Declaration
property Selection: TGridRect;
The Selection property contains the column and row coordinates of the cell or cells
selected in the grid.
Example
The following code selects the rectangle containing rows 1 and 2, and columns 3 and 4.
var
SRect: TGridRect;
begin
SRect.Top := 1;
SRect.Left := 3;
SRect.Bottom := 2;
SRect.Right := 4;
StringGrid1.Selection := SRect;
end;
SelLength property
Applies to
TComboBox, TDBComboBox, TDBEdit, TDBMemo, TDriveComboBox, TEdit,
TFilterComboBox, TMaskEdit, TMemo components
Declaration
property SelLength: Integer;
The SelLength property returns the length (in characters) of the control’s selected text. By
using SelLength along with the SelStart property, you specify which part of the text in the
control is selected. You can change the number of selected characters by changing the
value of SelLength. When the SelStart value changes, the SelLength value changes
accordingly.
The edit box or memo must be the active control when you change the value of
SelLength, or nothing appears to happen.
Example
This example uses an edit box and a label on a form. When the user selects text in the
edit box, the number of selected characters is reported in the caption of the label:
procedure TForm1.Edit1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Label1.Caption := 'Selected length = ' +
IntToStr(Edit1.SelLength);
end;
See also
SelStart property, SelText property, Text property
SelStart property
Applies to
TComboBox, TDBComboBox, TDBEdit, TDBMemo, TDriveComboBox, TEdit,
TFilterComboBox, TMaskEdit, TMemo components
Declaration
property SelStart: Integer;
The SelStart property returns the starting position of the selected part of the control’s
text, with the first character in the text having a value of 0. You can use SelStart along
with the SelLength property to select a portion of the text. Specify the character you want
the selected text to start with by its position in the text as the value of SelStart.
When the SelStart value changes, the SelLength value changes accordingly.
The edit box or memo must be the active control when you change the value of SelStart,
or nothing appears to happen.
Example
This example uses an edit box and a label on a form. When the user selects text in the
edit box, the starting position of the selected text is reported in the caption of the label:
See also +
SelectAll method, SelLength property, SelText property, Text property
+
SelText property +
Applies to +
TComboBox, TDBComboBox, TDBEdit, TDriveComboBox, TEdit, TFilterComboBox,
TMaskEdit components +
Declaration +
property SelText: string;
The SelText property contains the selected part of the control’s text. You can use it to
+
by specifying a new string. If no text is currently selected, the SelText string is inserted in +
determine what the selected text is, or you can change the contents of the selected text
See also
SelLength property, SelStart property, Text property
SendToBack method
Applies to
All controls; TForm component
Declaration
procedure SendToBack;
The SendToBack method puts a windowed component behind all other windowed
components within its parent component or form, or it puts a non-windowed
component behind all other non-windowed components within its parent component
or form. If the component has the input focus when the SendToBack method executes, it
loses the input focus.
SendToBack is useful for changing the order of overlapping controls or forms.
The order in which controls stack on top of each order (also called the Z order) depends
on whether the controls are windowed or non-windowed. For example, if you put a
label and an image on a form so that one is on top of the other, the first one you placed
on the form is the one on the bottom. Because both the label and the image are non-
windowed controls, they “stack” as you would expect them to. Suppose that the image
is on the top. If you call the SendToBack method for the image, the label then appears on
top of the image.
The stacking order of windowed controls is the same. For example, if you put a memo
on a form, then put a check box on top of it, the memo remains on the bottom. If you call
SendToBack for the check box, the memo appears on top.
The stacking order of windowed and non-windowed controls cannot be mingled. For
example, if you put a memo, a windowed control, on a form, and then put a label, a non-
windowed control, on top of it, the label disappears behind the memo. Windowed
controls always “stack” on top of non-windowed controls. In this example, if you call
the SendToBack method of the memo, it remains on top of the label.
Example
This example uses two forms. When the user clicks the button on Form2, it moves Form2
behind the other form and is no longer the active form:
procedure TForm2.Button1Click(Sender: TObject);
begin
SendToBack;
end;
In this example, the parent of the two forms is the application itself.
See also
BringToFront method
ServerConv property
Applies to
TDDEServerItem component
SetAsHandle method
Applies to
TClipboard object
Declaration
function SetAsHandle (Format: Word): THandle;
The SetAsHandle method places the data in the given format as a Windows handle. Once
your application gives the handle to the Clipboard, it should not delete the handle.
Instead, the Clipboard will delete the handle.
See the Windows API Help file for information about the available formats for Format
parameter.
Example
The following code gives the handle of bitmap graphic data to the Clipboard.
Clipboard.SetAsHandle(CF_BITMAP);
See also
FormatCount property, Formats property, GetAsHandle method, HasFormat method
SetBounds method
Applies to
All controls
Declaration
procedure Setbounds(ALeft, ATop, AWidth, AHeight: Integer);
The SetBounds method sets the component’s boundary properties, Left, Top, Width, and
Height, to the values passed in ALeft, ATop, AWidth, and AHeight, respectively.
SetBounds enables you to set more than one of the component’s boundary properties at a
time. Although you can always set the individual boundaries, using SetBounds enables
you to make several changes at once without repainting the control for each change.
Example
The following code doubles the size of a button control when the user clicks it:
procedure TForm1.Button1Click(Sender: TObject);
begin
Button1.SetBounds(Left, Top, Height * 2, Width * 2);
end;
Note that you could use the following code instead, but each click would result in the
button being redrawn twice: once to change the height, and once to change the width:
See also
AsText property, GetComponent method, Owner property, Parent property
SetData method
Applies to
TParam object; TBCDField, TBlobField, TBooleanField, TBytesField, TCurrencyField,
TDateField, TDateTimeField, TFloatField, TGraphicField, TIntegerField, TMemoField,
TSmallintField, TStringField, TTimeField, TVarBytesField, TWordField components
Example
var I: Longint;
I := 1221;
{ Set the data }
Query1.ParamByName(‘CustNo’).SetData(@I);
Example
{ Assign “raw” data to Field1 }
with Field1 do
begin
{ Allocate space }
GetMem(Buffer, DataSize);
{ Fill Buffer with the desired data }
...
{ Do the assignment }
Field1.SetData(Buffer)
{ Free the space }
FreeMem(Buffer, DataSize);
end;
See also
Fields property +
SetFocus method
+
Applies to
+
All controls; TForm component S
Declaration
procedure SetFocus;
The SetFocus method gives the input focus to the control. If the control is a form, the
form calls the SetFocus method of its active control.
Example
When the user clicks the button on this form, the list box becomes the active control and
receives the input focus:
procedure TForm1.Button1Click(Sender: TObject);
begin
ListBox1.SetFocus;
end;
See also
ActiveControl property, OnEnter event
Example
The following code resets the OLE object drop format for Form1, assuming Fmts is an
array of BOLEFormat records.
SetFormOLEDropFormats(Form1, Fmts);
See also
TOLEDropNotify object
SetKey method
Applies to
TTable component
Declaration
procedure SetKey;
The SetKey method puts the TTable in SetKey state (the State property is set to dsSetKey).
This enables an application to search for values in database tables. In SetKey state, you
can set the values of the search key buffer. The search key buffer is a set of fields
corresponding to the table’s key fields. After setting the values of the search key buffer
fields, call GotoKey, GotoNearest, FindKey, or FindNearest to move the cursor to the
matching record.
SetKey differs from EditKey in that the former clears all the elements of the search key
buffer. EditKey leaves the elements of the search key buffer with their current values, but
enables you to edit them.
See also
CloseLink method, OpenLink method
SetParams method
Applies to
TScrollBar component
Declaration
procedure SetParams(APosition, AMin, AMax: Integer);
The SetParams method sets the Position, Min, and Max property values of a scroll bar all
at once.
Example
This example uses a scroll bar and a button on a form. When the user clicks the button,
the minimum and maximum values of scroll bar are set, and the thumb tab moves to
one-fifth of the distance to the right:
procedure TForm1.Button1Click(Sender: TObject);
begin
ScrollBar1.SetParams(100, 0, 500)
end;
SetPrinter method
Applies to
TPrinter object
Declaration
procedure SetPrinter(ADevvice, ADriver, APort: PChar; ADeviceMode: THandle);
The SetPrinter method specifies a printer as the current printer. You should seldom, if
ever, need to call this method, but instead should access the printer you want in the
Printers property array. For more information, see the Windows API CreateDC function.
SetRange method
Applies to
TTable component
Declaration
procedure SetRange(const StartValues, EndValues: array of const);
The SetRange method combines the functionality of the SetRangeStart, SetRangeEnd, and
ApplyRange methods. SetRange assigns the elements of StartValues to the beginning
index key, the elements of EndValues to the ending index key, and then calls ApplyRange.
This enables an application to filter the data visible to the dataset.
If either StartValues or EndValues has fewer elements than the number of fields in the
current index, then the remaining entries are set to NULL.
Note With Paradox or dBASE tables, these methods work only with indexed fields. With SQL
databases, they can work with any columns specified in the IndexFieldNames property.
See also
CancelRange method, KeyExclusive property, EditRangeStart method, SetRange method,
SetRangeStart method
SetRangeStart method
Applies to
TTable component
Declaration
procedure SetRangeStart;
SetRangeStart indicates that subsequent assignments to field values will specify the start
of the range of rows to include in the dataset. This enables an application to filter the
data that is visible to it. Any column values not specified are not considered. The
corresponding method EditRangeStart indicates to keep existing range values and
update with the succeeding assignments.
Call ApplyRange to apply the range filter defined with SetRangeEnd and SetRangeStart.
SetRangeStart differs from EditRangeStart in that it clears all the elements of range filter
to the default values (or NULL). EditRangeStart leaves the elements of range filter with
their current values.
Note With Paradox or dBASE tables, these methods work only with indexed fields. With SQL
databases, they can work with any columns specified in the IndexFieldNames property.
Example
with Table1 do
begin
SetRangeStart; { Set the beginning key }
FieldByName(‘City’).AsString := ‘Ben Lomond‘;
SetRangeEnd; { Set the ending key }
FieldByName(‘City’).AsString := ‘Scotts Valley‘;
ApplyRange; { Tell the dataset to establish the range }
end;
See also
EditRangeEnd method, KeyExclusive property, SetRangeEnd method
SetSelTextBuf method
Applies to
TComboBox, TDBComboBox, TDBEdit, TDBMemo, TEdit, TMaskEdit, TMemo components
Declaration
procedure SetSelTextBuf(Buffer: PChar);
The SetSelTextBuf method sets the selected text in the edit box or memo control to the
text in the null-terminated string pointed to by Buffer.
You should have no need to use the SetSelTextBuf method unless you are working with
+
strings longer than 255 characters. Because an Object Pascal string has a limit of 255
characters, such properties as Text for an edit box, Items for a list box, and Lines for a
+
memo control do not allow you to work with strings longer than 255 characters.
SetSelTextBuf and the corresponding GetSelTextBuf methods use null-terminated strings
+
that are up to 64K in length.
+
Example
This example uses a button and an edit box on a form. When the user selects text in the +
edit box and clicks the button, new text replaces the selected text. The string specified as
the parameter of the SetSelTextBuf is a null-terminated string of type PChar. +
procedure TForm1.FormCreate(Sender: TObject);
begin +
Button1.Caption := 'Click me';
end; +
procedure TForm1.Button1Click(Sender: TObject);
begin +
+
Edit1.SetSelTextBuf('You clicked the button');
end;
See also
GetSelTextBuf method, SetTextBuf method
+
+
SetTabFocus method +
Applies to
TTabbedNotebook component
+
Declaration
+
procedure SetTabFocus(Index: Integer); +
The SetTabFocus changes the active page in the tabbed notebook control. The Index
parameter is the PageIndex value of the page, which indicates the page’s position in the
Pages property array. For example, the first page in the control has an index value of 0,
S
the second page has an index value of 1, and so on.
Example
The following code sets focus to the first page in TabbedNotebook1.
TabbedNoteBook1.SetTabFocus(0);
See also
ActivePage property, GetIndexForPage method
SetText method
Applies to
TStringList, TStrings objects
Declaration
procedure SetText(Text: PChar);
The SetText method writes an entire list of strings at one time. It is meant to be used with
components that contain multiple strings where you would find it convenient to treat all
the strings as one block. For example, SetText would be useful with a memo component,
which can hold multiple strings.
Specify the text you want write as the value of the Text parameter, making sure the
block of text to which you are referring is a null-terminated string.
Example
The following code uses SetText to write the contents of an edit box to Memo1.
var
TheText: array[0..255] of Char;
begin
StrPCopy(TheText, Edit1,Text);
Memo1.SetText(TheText);
end;
See also
GetText method
SetTextBuf method
Applies to
All controls; TClipboard object
Declaration
procedure SetTextBuf(Buffer: PChar);
The SetTextBuf method sets the control’s text to the text in the buffer pointed to by Buffer.
Buffer must point to a null-terminated string.
Usually, you use SetTextBuf and the corresponding GetTextBuf only when you need to
work with strings that are longer than 255 characters. Because an Object Pascal style
string has a limit of 255 characters, such properties as Text for an edit box, Items for a list
box, and Lines for a memo control do not allow you to work with strings longer than 255
characters. GetTextBuf and SetTextBuf use null-terminated strings that are up to 64K in
length.
Example
uses Dialogs;
var
F, FTwo: System.TextFile;
Ch: Char;
Buf: array[1..4095] of Char; { 4K buffer }
begin
if OpenDialog1.Execute then begin
AssignFile(F, ParamStr(1));
{ Bigger buffer for faster reads }
SetTextBuf(F, Buf);
Reset(F);
{ Dump text file into another file }
AssignFile(FTwo, 'WOOF.DOG');
Rewrite(FTwo);
while not Eof(f) do
begin
Read(F, Ch);
Write(FTwoCh);
end;
System.CloseFile(F);
System.CloseFile(FTwo);
end;
end;
See also
Append procedure, AssignFile procedure, Read procedure, Reset procedure, Rewrite
procedure, SizeOf function, Write procedure
SetUpdateState method
Applies to
TOutline component
Declaration
procedure SetUpdateState(Value: Boolean);
The SetUpdateState method sets the update state of the outline component. If you add or
delete an item from the outline, by default the outline component reindexes the
subsequent items that have indexes changed by the addition or deletion. For a large
outline, this can slow processing and consume a large amount of processing time. If you
have a large outline, or plan to add many items, you can turn off automatic reindexing
to speed up processing. You can quickly add items, but the indexes of all subsequent
items will no longer be valid. When you finish adding items, you should turn on
reindexing so the index values of the subsequent items are made valid again.
By passing True in the Value property of SetUpdateState, you turn off automatic
reindexing. This is functionally the same as calling the BeginUpdate method. By passing
False in the Value property of SetUpdateState, you turn on automatic indexing. This is
+
functionally the same as calling the EndUpdate method. +
Example
The following code turns off automatic reindexing on Outline1.
+
Outline1.SetUpdateState(True); +
SetVariable method
+
+
Applies to
TReport component +
Declaration +
function SetVariable(Name, Value: string): Boolean;
The SetVariable method changes the value of a report variable. The Name parameter
+
specifies which report variable changes, and the Value parameter specifies the new
value. Once the SetVariable method has been called, your application can call the +
RecalcReport method, which recalculates the report using the new value for the specified
report variable. +
The SetVariable method sends a DDE message to ReportSmith Runtime to change the
specified report variable with the new value, and looks for a DDE message from +
ReportSmith Runtime in return. If SetVariable returns True, the message was sent to
ReportSmith Runtime successfully. If it returns False, ReportSmith Runtime could not +
receive the message at the current time.
To learn more about report variables, see your ReportSmith documentation. +
Note Before calling SetVariable, you must load a report by specifying the ReportName
property.
+
Example
+
The following code attempts to set the ‘LastName’ report variable to ‘Schaeferle’. If
successful, it then recalculates the report.
S
if Report1.SetVariable(‘LastName’, ‘Schaeferle’) then
Report1.RecalcReport;
See also
RecalcReport method, SetVariableLines method
SetVariableLines method
Applies to
TReport component
Declaration
function SetVariableLines(Name, Value: TStrings): Boolean;
The SetVariableLines method changes the value of a report variable. The Name parameter
specifies which report variable changes, and the Value parameter specifies the new
value, which is a list of strings. Once the SetVariableLines method has been called, your
application can call the RecalcReport method, which recalculates the report using the
new value for the specified report variable.
The SetVariableLines method sends a DDE message to ReportSmith Runtime to change
the specified report variable with the new value, and looks for a DDE message from
ReportSmith Runtime in return. If SetVariableLines returns True, the message was sent to
ReportSmith Runtime successfully. If it returns False, ReportSmith Runtime could not
receive the message at the current time.
To learn more about report variables, see your ReportSmith documentation.
Note Before calling SetVariable, you must load a report by specifying the ReportName
property.
See also
RecalcReport method, SetVariable method
Shape property
Applies to
TBevel, TShape components
The Shape property determines the visual shape of the component.
For bevels
Declaration
property Shape: TBevelShape;
The Shape property determines the shape the bevel control assumes. These are the
possible values:
Value Meaning
bsBox The bevel assumes a box shape.
bsFrame The bevel assumes a frame shape.
bsTopLine The bevel becomes a line at the top of the bevel control.
bsBottomLine The bevel becomes a line at the bottom of the bevel control.
bsLeftLine The bevel becomes a line at the left side of the bevel control.
bsRightLine The bevel becomes a line at the right side of the bevel control.
+
stRoundRect The shape is a rectangle with rounded corners.
stRoundSquare The shape is a square with rounded corners.
+
stSquare The shape is a square.
stCircle The shape is a circle.
Example +
This example uses a shape component on a form. When the user clicks the shape, it
becomes a ball with red stripes: +
procedure TForm1.Shape1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
+
with Shape1 do
begin
S
Shape := stCircle;
Brush.Color := clRed;
Brush.Style := bsVertical;
end;
end;
Shareable property
Applies to
TMediaPlayer component
Declaration
property Shareable: Boolean;
The Shareable property determines whether more than one application can share a
multimedia device. If Shareable is False, no other components or applications can access
the device. If True, more than one component or application can access the device.
Shareable defaults to False.
You should set Shareable before opening a device. Some devices aren’t shareable. If you
set Shareable to True and try to open a device that isn’t shareable by more than one
application, the Open method fails and the error code is returned to the Error property.
Example
The following code sets the Shareable property of a media player named MediaPlayer1 to
True before attempting to open the Microsoft Video for Windows device. Attach this
code to the OnClick event handler of a bitmap button named BitBtn1. If an exception
occurs when the Open method is called, a message dialog box displays the error. Note
that this example assumes that C:\KA-BAR.AVI is a valid video file name.
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
with MediaPlayer1 do
begin
try
FileName := 'c:\Ka-Bar.AVI';
Shareable := True;
Open;
except
MessageDlg(MediaPlayer1.ErrorMessage, mtError, [mbOk], 0);
end;
end;
end;
Once you create a shortcut, you can assign it to the ShortCut property of a menu item.
+
The TextToShortCut function can also create a shortcut. This function converts a string to +
a shortcut; therefore, it’s useful when you want to let the user specify the shortcut.
TextToShortCut executes much more slowly, however, so you should use the ShortCut +
function whenever possible.
+
Example
This code creates a shortcut, Ctrl+O, at run time and assigns it to the Open command on a
File menu.
+
begin +
+
OpenCommand.ShortCut := ShortCut(Word('O'), [ssCtrl]);
end;
See also
ShortCut property, ShortCutToKey procedure, ShortCutToText function, TextToShortCut
+
function +
ShortCut property +
Applies to
+
TMenuItem component
+
Declaration
property ShortCut: TShortCut;
+
The ShortCut property determines the key strokes users can use to access a menu item. +
The key combination the user can use appears to the right of the menu item in the menu.
To see an example of menu shortcuts, pull down the Delphi Edit menu and note the
menu shortcuts on the right side of some of the editing commands.
+
Usually you set menu shortcuts for menu items in the Object Inspector, which gives you +
S
a long list to choose from. If you create menu items at run time, however, you can create
shortcuts for them too. Choose from these functions and procedures for more
information about working with shortcuts at run time:
Routine Purpose
ShortCut function Creates a shortcut for a menu item programmatically.
ShortCutToKey procedure Obtains the virtual key code and shift state of an existing shortcut.
ShortCutToText function Returns the text string of an existing shortcut. Use this function to display a
shortcut you created at run time on a menu item.
TextToShortCut function Converts a text string to a shortcut. Use this function to allow users to specify
the shortcut characters.
Example
This code creates a shortcut, Ctrl+C, at run time and assigns it to the Close command on a
File menu.
begin
CloseCommand.ShortCut := ShortCut(Word('C'), [ssCtrl]);
end;
Example
The following code redefines the ShortCut of CloseCommand if the original short cut
used the [ssCtrl] shift state.
var
TheKey: Word;
TheShiftState: TShiftState;
begin
ShortCutToKey(CloseCommand.ShortCut, TheKey, TheShiftState);
if TheShiftState = [ssCtrl] then
CloseCommand.ShortCut := ShortCut(Word('C'), [ssShift]);
end;
See also
ShortCut function, ShortCut property, ShortCutToText function, TextToShortCut function
Example
This code converts the menu shortcut assigned to the OpenCommand ShortCut
property to a string and displays it in an edit box:
Edit1.Text := ShortCutToText(OpenCommand.ShortCut);
Example
This example uses two labels on a form. The first label has a caption with an accelerator
character in it. The second label also includes an ampersand, but it does not appear as an
accelerator character.
See also
Caption property, FocusControl property
ShowException method
Applies to
TApplication component
Declaration
procedure ShowException(E: Exception);
The ShowException method displays an exception that occurred in your application in a
message box.
ShowGlyphs property
Applies to
TFileListBox component
Declaration
property ShowGlyphs: Boolean;
The value of the ShowGlyphs property determines whether glyphs (bitmaps) appear next
to the file names listed in the file list box. If ShowGlyphs is True, the glyphs appear; if
ShowGlyphs is False, the glyphs don’t appear. The default value is False.
Example
This example uses an edit box on a form. When the application runs and the user places
the mouse pointer over the edit box, a Help Hint in an aqua box appears:
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.ShowHint := True;
Application.HintColor := clAqua;
Application.HintPause := 1000;
Edit1.ShowHint := True;
See also
HintColor property, HintPause property, ParentShowHint property, ShowHint for the
application
For applications
Applies to
TApplication component
Declaration
property ShowHint: Boolean;
Run-time only. The ShowHint property determines whether Help Hints are enabled or
disabled for the entire application. If ShowHint is True, Help Hints are enabled; if
ShowHint is False, Help Hints are disabled. The default value is True.
Even if ShowHint is True, a Help Hint won’t appear for a particular control unless its
own ShowHint property is True, or its ParentShowHint property is True and its parent’s
ShowHint property is True.
Setting ShowHint for the application to False disables all Help Hints, regardless of the
value of the ShowHint properties for individual controls.
Example
This example includes an control that has a Hint property value and has its ShowHint
property value set to True. When the application runs and the user places the mouse
cursor over the control, a Help Hint appears for the control in a red hint box after a delay
of 1000 milliseconds:
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.ShowHint := True;
Application.HintColor := clAqua;
Application.HintPause := 1000;
end;
See also
Hint property, HintColor property, HintPause property
Showing property
Applies to
All controls
See also
MessageBox method, MessageDlg function, MessageDlgPos function, ShowMessagePos
procedure
Example
This example uses a button on a form. When the user clicks the button, a message dialog
box appears with a comment about Delphi programmers. The upper left corner of the
message box appears at screen location 100, 100.
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessagePos('Delphi programmers are more productive', 100, 100);
end;
See also
MessageBox method, MessageDlg function, MessageDlgPos function, ShowMessage
procedure
ShowModal method
Applies to
TForm component
Declaration
function ShowModal: Integer;
The ShowModal method makes a form the active form, just like Show, but also makes the
form modal; therefore the user must put the form away before the application can
continue to run.
When the user chooses to close the form in some manner, the value of the form’s
ModalResult property changes to a nonzero value. When ModalResult has a nonzero
value, the form terminates, and the ModalResult value is passed as the result of the
ShowModal method.
Example
The following code displays a message box after BtnBottomDlg is shown modally and is
closed by an OK button.
BtnBottomDlg.ShowModal;
if BtnBottomDlg.ModalResult=mrOK then
For fonts
Declaration
property Size: Integer;
The Size property value is the size of the font, which is the height of the font minus the
internal leading that appears at the top of the font. Whenever you specify a font size in
points, use the Size property. If you are concerned with the height of the font on the
screen—the number of pixels the font needs—use the Height property instead of Size.
Users usually specify font sizes in points within an application, while programmers are
usually concerned with the actual height of the font—which includes the internal
leading—when displaying a font on the screen.
Delphi determines the value of the Size property using this formula:
Font.Size = -Font.Height * 72 / Font.PixelsPerInch
Therefore, whenever you enter a positive value for the Size property, the font’s Height
property value changes to a negative number. Conversely, if you enter a positive value
for the Height property, the font’s Size property changes to a negative number.
Example
This examples uses a button on a form. When the user clicks the button, the size of the
font used by the button changes to 24 points.
procedure TForm1.Button1Click(Sender: TObject);
begin
Button1.Font.Size := 24;
end;
See also
Font property, Height property, PixelsPerInch property
Example
{ Allocate enough memory to make a copy of the BLOB }
GetMem(PBlob, BlobFieldDef.Size);
See also
FillChar procedure, GetMem procedure, Move procedure
SmallChange property
Applies to
TScrollBar component
Declaration
property SmallChange: TScrollBarInc;
The SmallChange property determines how far the thumb tab moves when the user
clicks the arrows at the end of the scroll bar to scroll or uses the arrow keys on the
keyboard. The default value is 1.
For example, if SmallChange is 1000, each time the user clicks an arrow on the scroll bar,
the thumb tab moves 1000 positions. The number of positions is determined by the
difference between the Max property value and the Min property value. If the Max
property is 30000 and the Min property is 0, the user would need to click an arrow on
the scroll bar 30 times to move the thumb tab from one end of the scroll bar to the other.
Example
This code determines that when the user clicks an arrow on the scroll bar, the thumb tab
moves 10 positions on the scroll bar:
ScrollBar1.SmallChange := 10;
See also
LargeChange property, Max property, Position property
Sort method
Applies to
TStringList object
Declaration
procedure Sort;
The Sort method sorts the strings in a string list object in alphabetical order.
Example
The following code sorts MyStringList.
MyStringList.Sort;
See also
Sorted property
See also
Add method, Insert method, Items property
Example
This example uses a list box on a form. When the application runs, a string list object is
created and three strings are added to it. The strings are sorted and added to the list box,
where they appear in their sorted order:
procedure TForm1.FormCreate(Sender: TObject);
var
MyList: TStringList;
begin
MyList := TStringList.Create;
MyList.Add('Plants');
MyList.Add('Animals');
MyList.Add('Minerals');
MyList.Sorted := True;
ListBox1.Items.AddStrings(MyList);
MyList.Free;
end;
See also
Add method, IndexOf method, Sort method, Strings property
Source property
Applies to
TBatchMove component
Declaration
property Source: TDataSet;
Source specifies a dataset (a TQuery or TTable component) corresponding to an existing
source table.
Example
BatchMove1.Source := Table1;
Example
function MakeHexWord(w: Word): string;
const
hexChars: array [0..$F] of Char =
'0123456789ABCDEF';
var
HexStr : string;
begin
HexStr := '';
HexStr := HexStr + hexChars[Hi(w) shr 4];
HexStr := HexStr + hexChars[Hi(w) and $F];
HexStr := HexStr + hexChars[Lo(w) shr 4];
HexStr := HexStr + hexChars[Lo(w) and $F];
MakeHexWord := HexStr;
end;
var
i: Integer;
Y: Integer;
S: string;
begin
Y := 10;
S := 'The current code segment is $' + MakeHexWord(CSeg);
Canvas.TextOut(5, Y, S);
Y := Y + Canvas.TextHeight(S) + 5;
S := 'The global data segment is $' + MakeHexWord(DSeg);
Canvas.TextOut(5, Y, S);
Y := Y + Canvas.TextHeight(S) + 5;
S := 'The stack segment is $' + MakeHexWord(SSeg);
Canvas.TextOut(5, Y, S);
Y := Y + Canvas.TextHeight(S) + 5;
S := 'The stack pointer is at $' + MakeHexWord(SPtr);
Canvas.TextOut(5, Y, S);
Y := Y + Canvas.TextHeight(S) + 5;
S := 'i is at offset $' + MakeHexWord(Ofs(i));
Canvas.TextOut(5, Y, S);
Y := Y + Canvas.TextHeight(S) + 5;
S := 'in segment $' + MakeHexWord(Seg(i));
Canvas.TextOut(5, Y, S);
end;
See also
SSeg function
SQL property
Applies to
TQuery component
Declaration
property SQL: TStrings;
The SQL property holds the text of the SQL statement that will be executed when Open
+
or ExecSQL is called. Once a query has been executed by Open, you must call the Close
method before you can change the SQL text.
+
You can create the text for the SQL property: +
Delphi also supports heterogeneous queries against more than one server or table type (for
example, data from an Oracle table and a Paradox table). +
Note The SQL property may contain only one complete SQL statement at a time. In general,
multiple statements are not allowed. Some servers support multiple statement “batch”
+
syntax; if the server supports this, then such statements are allowed.
+
See also
Text property
+
+
Sqr function System
+
Declaration
function Sqr(X: Real): (Real);
+
The Sqr function returns the square of the argument. +
X is a real-type expression. The result, of the same type as X, is the square of X, or X*X.
+
Example
var
+
S, Temp: string;
begin
+
Str(Sqr(5.0):3:1, Temp);
S := '5 squared is ' + Temp + #13#10; +
+
Str(Sqrt(2.0):5:4, Temp);
S := S + 'The square root of 2 is ' + Temp;
MessageDlg(S, mtInformation, [mbOk], 0);
end;
S
See also
Sqrt function
Example
var
S, Temp: string;
begin
Str(Sqr(5.0):3:1, Temp);
S := '5 squared is ' + Temp + #13#10;
Str(Sqrt(2.0):5:4, Temp);
S := S + 'The square root of 2 is ' + Temp;
MessageDlg(S, mtInformation, [mbOk], 0);
end;
See also
Sqr function
Example
function MakeHexWord(w: Word): string;
const
hexChars: array [0..$F] of Char =
'0123456789ABCDEF';
var
HexStr : string;
begin
HexStr := '';
HexStr := HexStr + hexChars[Hi(w) shr 4];
HexStr := HexStr + hexChars[Hi(w) and $F];
HexStr := HexStr + hexChars[Lo(w) shr 4];
HexStr := HexStr + hexChars[Lo(w) and $F];
MakeHexWord := HexStr;
end;
var
i: Integer;
Y: Integer;
S: string;
begin
Y := 10;
S := 'The current code segment is $' + MakeHexWord(CSeg);
Canvas.TextOut(5, Y, S);
Y := Y + Canvas.TextHeight(S) + 5;
Edit1.Text := IntToStr(MediaPlayer1.Start);
except
MessageDlg(MediaPlayer1.ErrorMessage, mtError, [mbOk], 0);
end;
end;
end;
See also
Length property
StartMargin property
Applies to
TTabSet component
Declaration
property StartMargin: Integer;
The StartMargin property determines how far in pixels the first tab appears from the left
edge of the tab set control. The default value is 5. Together with the EndMargin property,
StartMargin can play a role in determining how many tabs can fit within the tab set
control.
Example
This example displays the tab set control so that the tabs are no closer than 20 pixels
from the edge of the tab control on the left and from the scroll buttons on the right:
procedure TForm1.FormCreate(Sender: TObject);
begin
with TabSet1 do
begin
AutoScroll := True;
StartMargin := 20;
EndMargin := 20;
end;
end;
See also
AutoScroll property, EndMargin property
StartPage property
Applies to
TReport component
See also
EndPos property
StartRecording method
Applies to
TMediaPlayer component
Declaration
procedure StartRecording;
The StartRecording method begins recording from the current Position or from the
position specified in StartPos. StartRecording is called when the Record button on the
media player control is clicked at run time.
Upon completion, StartRecording stores a numerical error code in the Error property and
the corresponding error message in the ErrorMessage property.
The Wait property determines whether control is returned to the application before the
StartRecording method has completed. The Notify property determines whether
StartRecording generates an OnNotify event.
By default, the Notify property becomes True, and the Wait property becomes False upon
completion of the StartRecording method. However, if you’ve set these properties to
specific values prior to calling StartRecording, they remain unchanged.
Example
The following code tells MediaPlayer1 to start recording.
MediaPlayer1.StartRecording;
See also
Capabilities property, Pause method, PauseOnly method, Play method, Stop method
StartTransaction method
Applies to
TDataBase component
Declaration
procedure StartTransaction;
The StartTransaction method begins a transaction at the isolation level specified by the
TransIsolation property. If a transaction is currently active, Delphi will raise an exception.
Modifications made to the database will be held by the server until the Commit method
is called to commit the changes or the Rollback method is called to cancel the changes.
See also
AllowGrayed property, Checked property
Description
State reads the current status of the dataset component. Possible values are those of the
TDataSetState type: dsInactive, dsBrowse, dsEdit, dsInsert, dsSetKey, or dsCalcFields. The
value of State is the same as that of the State property of DataSet, except that when
Enabled is False or DataSet has not been assigned a value, State will be dsInactive.
Example
if DataSource1.Dataset <> nil then
PostButton.Enabled := DataSource1.State in [dsEdit, dsInsert];
Example
{ Open the dataset if it is not already }
if Table1.State = dsInactive then Table1.Active := True;
Step method
Applies to
TMediaPlayer component
Declaration
procedure Step;
The Step method steps forward a number of frames (determined by the Frames property)
+
in the currently loaded medium. Step is called when the Step button on the media player
control is clicked at run time.
+
Upon completion, Step stores a numerical error code in the Error property and the +
corresponding error message in the ErrorMessage property.
The Wait property determines whether control is returned to the application before the +
Step method has completed. The Notify property determines whether Step generates an
OnNotify event. +
Example +
The following example lets the user pick an .AVI video file using OpenDialog1 and
opens that file in MediaPlayer1. The 'Step' button can then be used to step forward
through the .AVI clip. This could be used to hide MediaPlayer1 if you wanted to design
+
your own user interface for the media player. +
procedure TForm1.FormClick(Sender: TObject);
begin
OpenDialog1.Filename := '*.*';
+
if OpenDialog1.Execute then begin
MediaPlayer1.Filename := OpenDialog1.Filename;
+
MediaPlayer1.Open;
end; +
+
end;
procedure TForm1.BackClick(Sender: TObject);
begin
MediaPlayer1.Step;
end;
+
See also
+
Back method, Capabilities property +
StmtHandle property +
Applies to
S
TQuery, TStoredProc component
Declaration
property StmtHandle: HDBIStmt;
Run-time and read only. The StmtHandle property enables an application to make direct
calls to the Borland Database Engine (BDE) API using the result of the last query. Under
most circumstances you should not need to use this property, unless your application
requires some functionality not encapsulated in the VCL.
Stop method
Applies to
TMediaPlayer component
Declaration
procedure Stop;
The Stop method stops playing or recording. Stop is called when the Stop button on the
media player control is clicked at run time.
Upon completion, Stop stores a numerical error code in the Error property, and the
corresponding error message in the ErrorMessage property.
The Wait property determines whether control is returned to the application before the
Stop method has completed. The Notify property determines whether Stop generates an
OnNotify event.
Example
The following procedure stops the currently playing multimedia device when Button2 is
clicked.
procedure TForm1.Button2Click(Sender: TObject);
begin
MediaPlayer1.Stop;
end;
See also
Pause method, PauseOnly method, Play method, StartRecording method
Storage property
Applies to
TOLEContainer component
Declaration
property Storage: IStorage;
Read-only. The Storage property allows access to the OLE IStorage interface of an OLE
container component.
Note The concept of IStorage is described in detail in OLE 2.0 documentation such as the
Microsoft OLE 2.0 SDK.
See also
LoadFromFile method, SaveToFile method
See also
Val procedure, Write procedure
Example
uses SysUtils;
const
Obj: PChar = 'Object';
Pascal: PChar = 'Pascal';
var
S: array[0..15] of Char;
begin
StrCopy(S, Obj);
+
>0 if Str1 > Str2
Example
uses SysUtils; +
const
S1: PChar = 'Wacky';
+
S2: PChar = 'Code';
var
+
C: Integer;
Result: string; +
begin
C := StrComp(S1, S2);
if C < 0 then Result := ' is less than ' else
+
if C > 0 then Result := ' is greater than ' else
Result := ' is equal to ';
S
Canvas.TextOut(10, 10, StrPas(S1) + Result + StrPas(S2));
end;
See also
StrIComp function, StrLComp function, StrLIComp function
Example
uses SysUtils;
var
S: array[0..12] of Char;
begin
StrCopy(S, 'ObjectPascal');
Canvas.TextOut(10, 10, StrPas(S));
end;
See also
StrECopy function, StrLCopy function
See also
StrNew function
Declaration
property Stretch: Boolean;
Setting the Stretch property to True permits bitmaps and metafiles to assume the size
and shape of the image control. When the image control is resized, the image resizes
also. The Stretch property has no affect on icons.
If you prefer to have the image control resize to fit the native size of the image, set the
AutoSize property to True.
Example
This example uses an image component on a form. When the form is created, the
specified image is loaded and stretched to fit the boundaries of the image component.
procedure TForm1.FormCreate(Sender: TObject);
begin
Image1.Stretch := True;
Image1.Picture.LoadFromFile('C:\DELPHI\DEMOS\GRAPHEX\PASTE.BMP');
end;
See also
AutoSize property, LoadFromFile method, Picture property
StretchDraw method
Applies to
TCanvas object
Declaration
procedure StretchDraw(const Rect: TRect; Graphic: TGraphic);
This method draws the graphic specified by the Graphic parameter in the rectangle
specified by the Rect parameter. Use this method to stretch or resize a graphic to the size
of the rectangle.
Example
The following code stretches the bitmap to fill the client area of Form1.
Form1.Canvas.StretchDraw(Form1.ClientRect, TheGraphic);
begin
ListBox1.Items[0] := 'First';
ListBox1.Items[1] := 'Second';
ListBox1.Items[2] := 'Third';
end;
See also
Add method, AddObject method, AddStrings method, Assign method, Clear method,
Count property, Delete method, Exchange method, IndexOf method, LoadFromFile
method, Objects property, SaveToFile method
Example
uses SysUtils;
var
S: array[0..13] of Char;
begin
StrLCopy(S, 'Object', SizeOf(S) - 1);
StrLCat(S, ' ', SizeOf(S) - 1);
StrLCat(S, 'Pascal', SizeOf(S) - 1);
Canvas.TextOut(10, 10, StrPas(S));
end;
See also
SizeOf function, StrCat function
Example
uses SysUtils;
See also
StrComp function, StrIComp function, StrLIComp function
Example
uses SysUtils;
var
S: array[0..11] of Char;
begin
StrLCopy(S, 'ObjectPascal', SizeOf(S) - 1);
Canvas.TextOut(10, 10, StrPas(S));
end;
See also
SizeOf function, StrCopy function
Example
uses SysUtils;
const
S: PChar = 'E Pluribus Unum';
begin
Canvas.TextOut(5, 10, 'The string length of “' + StrPas(S) + '“ is ' +
IntToStr(StrLen(S)));
end;
See also
StrEnd function
See also
StrComp function, StrIComp function, StrLComp function
Example
uses SysUtils;
const
S: PChar = 'A fUnNy StRiNg'
begin
Canvas.TextOut(5, 10, StrPas(StrLower(S)) + ' ' + StrPas(StrUpper(S)));
end;
See also
StrUpper function
Example
uses SysUtils;
function AHeapaString(S: PChar): PChar;
{ Allocate string on heap }
var
L: Word;
P: PChar;
begin
StrNew := nil;
if (S <> nil) and (S[0] <> #0) then
begin
L := StrLen(S) + 1;
GetMem(P, L);
StrNew := StrMove(P, S, L);
end;
end;
procedure DisposeDaString(S: PChar);
{ Dispose string on heap }
begin
See also
GetMem procedure, StrDispose function
Example
uses SysUtils;
const
A: PChar = 'I love the smell of Object Pascal in the morning.';
var
S: string[79];
begin
S := StrPas(A);
Canvas.TextOut(10, 10, S);
end;
See also
StrPCopy function
Example
uses SysUtils;
var
A: array[0..79] of Char;
begin
S := 'Honk if you know Blaise.';
StrPCopy(A, S);
Canvas.TextOut(10, 10, StrPas(A));
end;
See also
StrCopy procedure
end;
Canvas.TextOut(10, 10, 'Substring found at index ' + IntToStr(P - S));
+
S
StrRScan function SysUtils
Declaration
function StrRScan(Str: PChar; Chr: Char): PChar;
The StrRScan function returns a pointer to the last occurrence of Chr in Str.
If Chr does not occur in Str, StrRScan returns nil. The null terminator is considered to be
part of the string.
Example
{ Return pointer to name part of a full path name }
uses SysUtils;
function NamePart(FileName: PChar): PChar;
var
P: PChar;
begin
P := StrRScan(FileName, '\');
if P = nil then
begin
P := StrRScan(FileName, ':');
if P = nil then P := FileName;
end;
NamePart := P;
end;
var
S : string;
begin
S := StrPas(NamePart('C:\Test.fil'));
Canvas.TextOut(10, 10, S);
end;
See also
StrScan function
Example
uses SysUtils;
function HasWildcards(FileName: PChar): Boolean;
{ Return true if file name has wildcards in it }
begin
HasWildcards := (StrScan(FileName, '*') <> nil) or
(StrScan(FileName, '?') <> nil);
end;
const
P: PChar = 'C:\Test.* ';
begin
if HasWildcards(P) then
Canvas.TextOut(20, 20, 'The string has wildcards')
else
See also
DateToStr function, StrToDateTime function, StrToTime function
The StrToDateTime function converts a string into a date and time format. The string
specified as the S parameter must be in the MM/DD/YY HH:MM:SS format unless the
value of the value of the date and time typed constants has changed. Specifying AM or
PM as part of the time is optional, as are the seconds. You should use 24-hour time (7:45
PM is entered as 19:45, for example) if you don’t specify AM or PM.
Note You must use another format to specify a date and time string if you change the value of
the some of the date and time typed constants.
Example
This example uses an edit box, a label, and a button on the form. When the user enters a
date and time in the edit box in the MM/DD/YY HH:MM:SS format, the string entered
is converted to a TDateTime value. This value is then converted back to a string value so
it can appear as the caption of the label:
procedure TForm1.Button1Click(Sender: TObject);
var
ADateAndTime: TDateTime;
begin
ADateAndTime := StrToDateTime(Edit1.Text);
Label1.Caption := DateTimeToStr(ADateAndTime);
end;
See also
DateTimeToStr function, StrToDate function, StrToTime function
See also
IntToStr function, StrToInt function
Example
This example uses an edit box, a label, and a button on a form. When the user enters a
time in the edit box in the HH:MM:SS format, the string entered is converted to a
TDateTime value. This value is then converted back to a string value so it can appear as
the caption of the label:
procedure TForm1.Button1Click(Sender: TObject);
var
ATime: TDateTime;
begin
ATime := StrToTime(Edit1.Text);
Label1.Caption := TimeToStr(ATime);
end;
See also
StrToDate function, StrToDateTime function, TimeToStr function
Example
uses SysUtils;
const
S: PChar = 'A fUnNy StRiNg'
begin
begin
if Drawing then
Canvas.LineTo(X, Y);
end;
procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Canvas.LineTo(X, Y);
Drawing := False;
end;
procedure TForm1.RadioButton1Click(Sender: TObject);
begin
Canvas.Pen.Style := psDot;
end;
procedure TForm1.RadioButton2Click(Sender: TObject);
begin
Canvas.Pen.Style := psSolid;
end;
For brushes
Declaration
property Style: TBrushStyle;
The Style property of a brush determines the brush’s pattern for painting backgrounds
of windows or graphic shapes. The following table shows the different values for Style
and the resulting patterns:
bsClear bsDiagCross
bsBDiagonal bsHorizontal
bsFDiagonal bsVertical
Example
This example displays a rectangle filled with red horizontal stripes whenever a form
OnPaint event occurs.
procedure TForm1.FormPaint(Sender: TObject);
begin
+
fsUnderline The font is underlined.
fsStrikeout The font is displayed with a horizontal line through it.
The Style property is a set, so it can contain multiple values. For example, a font could be
both boldfaced and italicized.
+
Example
+
The following code boldfaces the font used in the memo.. +
Memo1.Font.Style := [fsBold];
+
For combo boxes
+
Declaration
property Style: TComboBoxStyle;
S
The Style property determines how a combo box displays its items. By default, Style is
csDropDown, meaning that the combo box displays each item as a string in a drop-down
list. By changing the value of Style, you can create owner-draw combo boxes, meaning
that items can be graphical of either fixed or varying height. You can set Style to any of
the following values:
Value Meaning
csDropDown Creates a drop-down list with an edit box in which the user can enter text. All
items are strings, with each item having the same height.
For database combo boxes, the combo box displays the contents of the field of
the current records. The user can choose another item from the drop-down list
and change the value of the field or type a new value in the edit box.
csSimple Creates an edit box with no list.
For database combo boxes, the current contents of the linked field displays in
the combo box. The user can change the contents of the field by typing in a new
value.
csDropDownList Creates a drop-down list with no attached edit box, so the user can’t edit an
item or type in a new item. All items are strings, with each item having the same
height.
For database combo boxes, the edit box is blank unless the current contents of
the field matches one of the specified Items in the drop-down list. The user can
change the contents of the field only by selecting one of the strings from the
drop-down list.
csOwnerDrawFixed Each item in the combo box is the height specified by the ItemHeight property.
For database combo boxes, the combo box is blank unless the current contents
of the field matches one of the specified Items in the drop-down list. The user
can change the contents of the field only by selecting one of the strings from the
drop-down list.
csOwnerDrawVariable Items in the combo box can be of varying heights.
For database combo boxes, the combo box is blank unless the current contents
of the field matches one of the specified Items in the drop-down list. The user
can change the contents of the field only by selecting one of the strings from the
drop-down list.
Owner-draw combo boxes can display items other than strings. For example, a combo
box could display graphical images along with or instead of its strings. Owner-draw
combo boxes require more programming, however, as the application needs
information on how to render the image for each item in the list.
Each time an item is displayed in an csOwnerDrawFixed combo box, the OnDrawItem
event occurs. The event handler for OnDrawItem draws the specified item. The
ItemHeight property determines the height of all the items.
Each time an item is displayed in an csOwnerDrawVariable combo box, two events occur.
The first is the OnMeasureItem event. The event handler for OnMeasureItem can set the
height of each item. Then the OnDrawItem event occurs. The OnDrawItem handler draws
each item in the list box using the size specified by the OnMeasureItem handler.
Example
This example uses a combo box and a check box on a form. If the user checks the check
box, the combo box becomes a drop-down list. When the user unchecks the check box,
the combo box becomes a simple combo box:
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
if CheckBox1.Checked then
Example
This example uses a list box and a check box. When the user checks the check box, the
list box becomes an fixed owner-draw list box. When the user unchecks the check box,
the list box becomes a standard list box:
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
if CheckBox1.Checked then
ListBox1.Style := lbOwnerDrawFixed
else
ListBox1.Style := lbStandard;
end;
Value Meaning
bsAutoDetect When you are using Windows 3.x, the bitmap button uses the standard Windows 3.x look.
When you are using a later version of Windows, the bitmap button uses a newer look.
bsWin31 Uses the standard Windows 3.1 look, regardless of which version of Windows you are
running.
bsNew Uses a new bitmap button look, regardless of which version of Windows you are running.
Example
This example uses a bitmap button and a check box on a form. When the user checks the
check box, the bitmap button assumes the new bitmap style. When the user unchecks
the check box, the bitmap button takes on the Windows 3.1 look:
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
if CheckBox1.Checked then
BitBtn1.Style := bsNew
else
BitBtn1.Style := bsWin31;
end;
See also
Kind property
Value Meaning
tsStandard Each tab has the standard size and look.
tsOwnerDraw Each tab has the height specified with the TabHeight property and width needed to
hold the text or glyph.
Example
The following code sets the style of Outline1 to owner-draw.
Outline1.Style := otOwnerDraw;
For bevels
Declaration
property Style: TBevelStyle;
The value of the Style property determines if the bevel is raised or lowered. These are the
possible values:
Value Meaning
bsLowered The bevel is lowered.
bsRaised The bevel is raised.
Example
This example uses a bevel and a check box on a form. When the check box is checked,
the bevel is raised. When the check box is unchecked, the bevel is lowered:
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
if CheckBox1.Checked then
Bevel1.Style := bsRaised
else
Bevel1.Style := bsLowered;
end;
Value Meaning
csDropDown Creates a drop-down list with an edit box in which the user can enter text.
csDropDownList Creates a drop-down list with no attached edit box, so the user can’t edit an item or
type in a new item.
Example
var
X: Word;
begin
X := Swap($1234); { $3412 }
end;
See also
Hi function, Lo function
TableName property
Applies to
TTable component
Declaration
property TableName: TFileName;
The TableName property is the name of the database table to which the TTable is linked.
Note The TTable must be closed to change this property.
TableType property
Applies to
TTable component
Declaration
property TableType: TTableType
The TableType property specifies the type of the underlying database table. This
property is not used for SQL tables.
If TableType is set to Default, the table’s file-name extension determines the table type:
• Extension of .DB or no file-name extension: Paradox table
• Extension of .DBF : dBASE table
• Extension of .TXT : ASCII table
If the value of TableType is not Default, then the table will always be of the specified
TableType, regardless of file-name extension:
• ttASCII: Text file
• ttDBase: dBASE table
• ttParadox: Paradox table
Note The TTable must be closed to change this property.
See also
CreateTable method, TableName property
When you execute your application, the application’s Run method is called. The
Terminate method ends application execution. The name of your application’s
executable file is the value of the ExeName property.
The main form of your application is the form specified as the value of the MainForm
property. By default, Delphi uses Form1 as the main form. If you want to make another
form the main form, the form that is created first, use the Forms page of the Options|
Project Options dialog box to do so.
When the user minimizes the application, the Minimize method is called. When the user
restores the application to normal size, the Restore method is called. Your application
can call these methods programmatically as well.
A minimized application appears as an icon on the Windows desktop. You can assign
the icon of your choice to represent your application using the Icon property. The text
that appears below the icon is the value of the Title property. If your application has a
help file, specify its name as the value of the HelpFile property, and the Windows Help
system can display help for your application. You can specify an icon, a help file, and
the title of the application in the Options|Project dialog box on the Application page.
To display the help file for your application, call the HelpContext method.
You can specify how exceptions are handled for your application using the
HandleException method, the OnException event, and the ShowException method.
To display a message to the user, use the MessageBox method.
TApplication has several events that let you specify how your application processes the
occurrence of special events. The code you write in the OnActivate and OnDeactivate
event handlers specifies what happens when your application becomes active and
inactive. You specify how help hints appear in the OnHint and OnShowHint event
handlers. The OnIdle event handler is used to determine what happens as your
application becomes idle, and the OnMessage event handler is used to process Windows
messages your application receives. Search help for “Handling Application Events” for
more information about creating event handlers for application events.
In addition to these properties, methods, and events, this component also has the
properties and methods that apply to all components.
Properties
Active HelpFile Name
ComponentCount Hint Owner
ComponentIndex HintColor ShowHint
Components HintPause Tag
ExeName Icon Terminated
Handle MainForm Title
Methods
Create HelpContext RemoveComponent
CreateForm HelpJump Restore
Events
OnActivate OnHelp OnMessage
+
OnDeactivate
OnException
OnHint
OnIdle
+
+
TAttachMode type Outline +
Declaration +
+
TAttachMode = (oaAdd, oaAddChild, oaInsert);
Description
TAttachMode is the type of the AttachMode parameter of the MoveTo method.
TAttachMode specifies the different ways which an outline item can attach to the new
+
position when moved in an outline. +
TAutoActivate type ToCtrl
+
Declaration
+
TAutoActivate = (aaManual, aaGetFocus, aaDoubleClick); +
TAutoActivate is the type of the AutoActivate property of the TOLEContainer component.
+
TBatchMode type DBTables +
Declaration T
TBatchMode = (batAppend, batUpdate, batAppendUpdate, batDelete, batCopy);
The TBatchMode type is the set of values which are passed to the BatchMove method of a
TTable or the Mode property of a TBatchMove component. batAppend appends all records.
(The destination must not have any records with the key of the any of the records in the
source.) batUpdate replaces all existing records with the new versions. (Each record in
the source must have a record in the destination with the same key.) batAppendUpdate
appends any records which do not already exist and replaces those which do. batDelete
deletes the records in the source from the destination. (Each source record must have a
key which is also found in the destination.) batCopy makes an exact duplicate of the
source table.
TBatchMove component
TBatchMove enables you to perform operations on groups of records or entire tables. Set
the Source property to specify a dataset (a TQuery or TTable component) corresponding
to an existing source table. Set the Destination property to specify a TTable component
corresponding to a database table. The destination table may or may not already exist.
Use the Mode property to specify the operations to perform. Set the Mappings property if
the Source and Destination have different column names and you want to control how
those fields are transferred.
Set AbortOnProblem to specifiy whether to abort the operation when a data type
conversion error occurs. Set the AbortOnKeyViol property to specify whether to abort the
operation when an integrity (key) violation occurs. Set KeyViolTableName and
ProblemTableName to create Paradox tables to hold records that caused errors. Set the
ChangedTableName property to save the replaced or deleted records from Destination.
Set the Transliterate property to specify whether to transliterate character data to the
preferred character set for the destination table.
In addition to these properties and methods, this component also has the properties and
methods that apply to all components.
Properties
AbortOnKeyViol KeyViolTableName ProblemCount
AbortOnProblem Mappings ProblemTableName
ChangedCount Mode RecordCount
ChangedTableName MovedCount Source
Destination Name Transliterate
KeyViolCount Owner Tag
Methods
Execute
TBCDField component
A TBCDField represents a field of a record in a dataset. It is represented as a BCD value.
Use TBCDField for a floating-point number with a fixed number of digits following the
decimal point. The range depends on the number of digits after the decimal point, since
the accuracy is 18 digits.
Set the DisplayFormat property to control the formatting of the field for display
+
purposes, and the EditFormat property for editing purposes. Set the Size property to
define the number of BCD digits following the decimal point. Use the Value property to
+
access or change the current field value. +
The TBCDField component has the properties, methods, and events of the TField
component. +
Properties +
Alignment
AsBoolean
DisplayLabel
DisplayName
MinValue
Name
+
AsDateTime
AsFloat
DisplayText
DisplayWidth
Owner
Precision
+
AsInteger
AsString
EditFormat
EditMask
ReadOnly
Required
+
Calculated
CanModify
EditMaskPtr
FieldName
Size
Tag
+
Currency
DataSet
FieldNo
Index
Text
Value
+
DataSize
DataType
IsIndexField
IsNull
Visible
+
DisplayFormat MaxValue
+
Methods +
Assign
AssignValue
FocusControl
GetData
SetData
+
Clear IsValidChar
+
Events
+
OnChange
OnGetText
OnSetText OnValidate
+
TBevel component
T
ExtCtrls
The TBevel component lets you put beveled lines, boxes, or frames on the forms in your
application.
You determine if the bevel appears as a box, frame, or line using the Shape property. The
bevel can appear raised or lowered, depending on the value selected for the Style
property.
To keep the bevel aligned within the form so that even if the user resizes the form, the
bevel remains in the same relative position, set the Align property.
In addition to these properties and methods, this component also has the properties and
methods that apply to all controls.
For more information, search for Bevel component in the online Help, and choose the
topic Using the Bevel Component.
Properties
Align Height Shape
BoundsRect Hint ShowHint
ComponentIndex Left Style
Components Name Tag
ControlCount Owner Top
Controls Parent Visible
Handle ParentShowHint Width
Methods
BeginDrag Hide SetBounds
BringToFront Refresh Show
ClientToScreen Repaint Update
Dragging ScreenToClient
EndDrag SendToBack
Properties
Align HelpContext PopupMenu
BoundsRect Hint ShowHint
Cancel Kind Showing
Caption Layout Spacing
ComponentIndex Left Style
Cursor Margin TabOrder
Default ModalResult TabStop
DragCursor Name Tag
DragMode NumGlyphs Top
Enabled Owner Visible
Font Parent Width
Glyph ParentFont
Height ParentShowHint
Methods
BeginDrag GetTextBuf SendToBack
BringToFront GetTextLen SetBounds
CanFocus Hide SetFocus
Click Refresh SetTextBuf
ClientToScreen Repaint Show
Dragging ScaleBy Update
EndDrag ScreenToClient
Focused ScrollBy
Events
OnClick OnEnter OnKeyUp
OnDragDrop OnExit OnMouseDown
OnDragOver OnKeyDown OnMouseMove
OnEndDrag OnKeyPress OnMouseUp
TBlobField component
A TBlobField component represents a field of a record in a dataset. It is represented by a
value consisting of an arbitrary set of bytes of indefinite size.
Use the Assign method to copy values from another field to a TBlobField. Use the
LoadFromFile method to load a field’s contents from a file. Use LoadFromStream method
to load a field from a Stream. Use SaveToFile method to write a field’s contents to a file.
Use SaveToStream method to write a field’s contents to a Stream.
The TBlobField component has the properties, methods, and events of the TField
component.
Properties
Alignment DataType IsIndexField
AsBoolean DisplayLabel IsNull
AsDateTime DisplayName Name
AsFloat DisplayText Owner
AsInteger DisplayWidth ReadOnly
AsString EditMask Required
Calculated EditMaskPtr Size
CanModify FieldName Tag
DataSet FieldNo Text
DataSize Index Visible
Methods
Assign GetData SaveToFile
AssignValue IsValidChar SaveToStream
Clear LoadFromFile SetData
FocusControl LoadFromStream
Events
OnChange OnSetText OnValidate
OnGetText
TBlobStream object
The TBlobStream object provides a simple technique to access or modify a TBlobField,
TBytesField or TVarBytesField by allowing you to “read” from or “write” to the field as if
it were a file or stream.
Use the Create constructor to link the field to the BLOB stream. Call the Read or Write
methods to access or change the contents of the field. Use Seek to position within the
field. Call the Truncate method to delete all information in the field from the current
position on.
In addition to these methods, this object also has the methods that apply to all objects.
Methods
Assign FocusControl SetData
AssignValue GetData
Clear IsValidChar
Events
OnChange OnSetText OnValidate
OnGetText
Methods
Assign ClassType Free
+
ClassName
ClassParent
Create
Destroy
+
Events
+
OnChange
+
+
TBrushStyle type Graphics T
Declaration
TBrushStyle = (bsSolid, bsClear, bsHorizontal, bsVertical, bsFDiagonal, bsBDiagonal, bsCross,
bsDiagCross);
The TBrushStyle type is used by the Style property to determine the pattern of a TBrush
object.
Properties
Align Font ParentShowHint
BoundsRect Height PopupMenu
Cancel HelpContext ShowHint
Caption Hint Showing
ComponentIndex Left TabOrder
Cursor ModalResult TabStop
Default Name Tag
DragCursor Owner Top
DragMode Parent Visible
Enabled ParentFont Width
Methods
BeginDrag GetTextBuf ScrollBy
BringToFront GetTextLen SendToBack
CanFocus Hide SetBounds
ClientToScreen Refresh SetFocus
Dragging Repaint SetTextBuf
EndDrag ScaleBy Show
Focused ScreenToClient Update
The TButtonStyle type contains the values the Style property of bitmap buttons (TBitBtn)
and speed buttons (TSpeedButton) can assume.
TByteArray SysUtils
Declaration
PByteArray = ^TByteArray;
TByteArray = array[0..32767] of Byte;
TByteArray declares a general array of type Byte that can be used in typecasting.
TBytesField component
A TBytesField represents a field of a record in a dataset. It is represented by a value
consisting of an arbitrary set of bytes with indefinite size.
Use the Assign method to copy values from another field to a TBytesField.
The TBytesField component has the properties, methods, and events of the TField
component.
Properties
Alignment DataType IsIndexField
AsBoolean DisplayLabel IsNull
AsDateTime DisplayName Name
AsFloat DisplayText Owner
AsInteger DisplayWidth ReadOnly
AsString EditMask Required
Calculated EditMaskPtr Size
CanModify FieldName Tag
DataSet FieldNo Text
DataSize Index Visible
Methods
Assign FocusControl SetData
AssignValue GetData
Clear IsValidChar
Events
OnChange OnSetText OnValidate
OnGetText
Destroy Pie
Draw Polygon
Events
OnChange OnChanging
Description
TChangeRange specifies the valid values that can be passed to the ChangeLevelBy method.
-1 moves an outline item up one level, and 1 moves an outline item down one level. 0
has no effect.
For more information, search for Check Box component in the online Help, and choose
+
the topic Using the Check Box Component. +
Properties +
Align
Alignment
Font
Height
PopupMenu
ShowHint
+
AllowGrayed
Caption
HelpContext
Hint
Showing
State
+
Checked
Color
Left
Name
TabOrder
TabStop
+
ComponentIndex
Ctl3D
Owner
Parent
Tag
Top
+
Cursor
DragCursor
ParentColor
ParentCtl3D
Visible
Width
+
DragMode
Enabled
ParentFont
ParentShowHint
+
Methods +
BeginDrag Focused ScrollBy +
BringToFront
CanFocus
GetTextBuf
GetTextLen
ScreenToClient
SendToBack +
ClientToScreen
Dragging
Hide
Refresh
SetBounds
SetTextBuf +
EndDrag
FindComponent
Repaint
ScaleBy
Show
Update +
Events +
OnClick
OnDragDrop
OnEnter
OnExit
OnKeyUp
OnMouseDown
+
OnDragOver
OnEndDrag
OnKeyDown
OnKeyPress
OnMouseMove
OnMouseUp
+
See also
T
TDBCheckBox component, TRadioButton component
Properties
AsText FormatCount Formats
Methods
Assign Destroy Open
Clear GetAsHandle SetAsHandle
Close GetComponent SetComponent
Create HasFormat SetTextBuf
The TCloseEvent type points to a method that handles the closing of a form. The value of
+
the Action parameter determines if the form actually closes. The possible values of
Action are defined by the TCloseAction type.
+
TCloseEvent is the type of the OnClose event. +
TCloseQueryEvent type
+
Forms
+
Declaration
TCloseQueryEvent = procedure(Sender: TObject; var CanClose: Boolean) of object; +
The TCloseQueryEvent type points to the method that determines whether a form can be
closed. The value of the CanClose parameter determines if the form can close or not.
+
TCloseQueryEvent is the type of the OnCloseQuery event. +
TColor type Graphics
+
Declaration
+
TColor = -(COLOR_ENDCOLORS + 1)..$02FFFFFF; +
The TColor type is used to specify the color of an object. It is used by the Color property
of many components and the BackgroundColor of a tab set (TTabSet).
+
The Graphics unit contains definitions of useful constants for TColor. These constants
map either directly to the closest matching color in the system palette (for example,
+
clBlue maps to blue) or to the corresponding system screen element color defined in the
Color section of the Windows Control panel (for example, clBtnFace maps to the system
+
color for button faces).
The constants that map to the closest matching system colors are clAqua, clBlack, clBlue,
+
clDkGray, clFuchsia, clGray, clGreen, clLime, clLtGray, clMaroon, clNavy, clOlive, clPurple,
clRed, clSilver, clTeal, clWhite, and clYellow.
+
The constants that map to the system screen element colors are clActiveBorder,
clActiveCaption, clAppWorkSpace, clBackground, clBtnFace, clBtnHighlight, clBtnShadow,
+
clBtnText, clCaptionText, clGrayText, clHighlight, clHighlightText, clInactiveBorder,
clInactiveCaption, clInactiveCaptionText, clMenu, clMenuText, clScrollBar, clWindow,
T
clWindowFrame, and clWindowText.
If you specify TColor as a specific 4-byte hexadecimal number instead of using the
constants defined in the Graphics unit, the low three bytes represent RGB color
intensities for blue, green, and red, respectively. The value $00FF0000 represents full-
intensity, pure blue, $0000FF00 is pure green, and $000000FF is pure red. $00000000 is
black and $00FFFFFF is white.
If the highest-order byte is zero ($00), the color obtained is the closest matching color in
the system palette. If the highest-order byte is one ($01), the color obtained is the closest
matching color in the currently realized palette. If the highest-order byte is two ($02), the
value is matched with the nearest color in the logical palette of the current device
context.
To work with logical palettes, you must select the palette with the Windows API
function SelectPalette. To realize a palette, you must use the Windows API function
RealizePalette.
Properties
Color HelpContext Owner
ComponentIndex Left Tag
Ctl3D Name Top
CustomColors Options
Methods
Execute
Methods
BeginDrag GetTextBuf ScrollBy
BringToFront GetTextLen SelectAll
CanFocus Hide SendToBack
Clear Invalidate SetBounds
ClientToScreen Refresh SetTextBuf
Dragging Repaint Show
EndDrag ScaleBy Update
Focused ScreenToClient
Events
OnChange OnDrawItem OnKeyDown
OnClick OnDropDown OnKeyPress
OnDblClick OnEndDrag OnKeyUp
OnDragDrop OnEnter OnMeasureItem
OnDragOver OnExit
See also
Creating an owner-draw control
The HorzScrollBar and VertScrollBar objects have nested properties that determine how
+
these scroll bars behave. The Range property determines how far a user can scroll a form
or scroll box. Increment determines how many positions the thumb tab on a scroll bar
+
moves when the user clicks on the scroll bar arrows. You can set the position of the
thumb tab with the Position property. If you don’t want a scroll bar to appear, set the
+
Visible property to False.
If you want to prevent controls from scrolling partially off screen so the user can’t scroll
+
them back into view, use the Margin property. +
In addition to these properties, this object also has the methods that apply to all objects.
+
Properties
Align Margin Range
+
ComponentIndex
Increment
Name
Owner
ScrollPos
Tag
+
Kind Position Visible +
TCopyMode type Graphics
+
Declaration
+
TCopyMode = Longint; +
TCopyMode is the type of the CopyMode property of a TCanvas object.
+
TCurrencyField component +
A TCurrencyField represents a field of a record in a dataset. It is represented as a binary +
value with a range from (positive or negative) 5.0 * 10-324 to 1.7 * 10308. It has an accuracy
of 15 to 16 digits. Use TCurrencyField for fields that hold currency values. +
Set the DisplayFormat property to control the formatting of the field for display
purposes, and the EditFormat property for editing purposes. Use the Value property to +
access or change the current field value.
The TCurrencyField component has the properties, methods, and events of the TField
T
component.
Properties
Alignment DisplayLabel MinValue
AsBoolean DisplayName Name
AsDateTime DisplayText Owner
AsFloat DisplayWidth Precision
AsInteger EditFormat ReadOnly
AsString EditMask Required
Methods
Assign FocusControl SetData
AssignValue GetData
Clear IsValidChar
Events
OnChange OnSetText OnValidate
OnGetText
TDatabase component DB
The TDatabase component is not required for database access, but it provides additional
control over factors that are important for client/server applications. If you do not create
an explicit TDatabase component for a database, and an application opens a table in the
database, then Delphi will create a temporary (virtual) TDatabase component.
DatabaseName is the name of the database connection that can be used by dataset
+
components. In other words, this is the name of the local alias defined by the component
that will show up in the DatabaseName drop-down list of dataset components.
+
AliasName is the name of an existing BDE alias defined with the BDE Configuration +
Utility. This is where the TDatabase component gets its default parameter settings. This
property will be cleared if DriverName is set. The Params property holds the connection
parameters for the alias.
+
DriverName is the name of a BDE driver, such as STANDARD (for dBASE and Paradox), +
ORACLE, SYBASE, INFORMIX or INTERBASE. This property will be cleared if
AliasName is set, because an AliasName specifies a driver type. +
The DataSets property of TDatabase is an array of references to the active datasets in the
TDatabase. The DatasetCount property is an integer that specifies the number of active +
datasets.
Set the Connected property to open or close the database. Set KeepConnection to True to
+
avoid having to log in to the server each time the database is opened.
Set LoginPrompt to True to always prompt for user name and password when logging in
+
to the database server. +
The TDatabase component controls server transactions. Call StartTransaction to begin a
transaction, RollBack to cancel it, or Commit to commit the changes. The TransIsolation
property specifies the transaction isolation level to request on the server.
+
In addition to these properties and methods, this component also has the properties and +
methods that apply to all components.
+
Properties
AliasName Handle Owner
+
Connected
DatabaseName
IsSQLBased
KeepConnection
Params
Tag
+
DatasetCount
Datasets
Locale
LoginPrompt
Temporary
TransIsolation
+
DriverName Name +
Methods T
Close Commit Rollback
CloseDatasets Open StartTransaction
Events
OnLogin
TDataChangeEvent type DB
Declaration
TDataChangeEvent = procedure(Sender: TObject; Field: TField) of object;
The TDataChangeEvent points to a method that handles the changing of data in a data
source component (TDataSource). The Field parameter is the field in which the data is
changing. It is used by the OnDataChange event of the data source.
TDataSetNotifyEvent type DB
Declaration
TDataSetNotifyEvent = procedure(DataSet: TDataSet) of object;
The TDataSetNotifyEvent type points to a method that notifies a dataset component that
an event has occurred. It is used by all the events of the tables, queries, and stored
procedures (TTable, TQuery, and TStoredProc components).
TDataSetState type DB
Declaration
TDataSetState = (dsInactive, dsBrowse, dsEdit, dsInsert, dsSetKey, dsCalcFields);
The TDataSetState type is the set of values of the State property of a dataset component.
Properties
Alignment DataType IsIndexField
AsBoolean DisplayLabel IsNull
AsDateTime DisplayName Name
AsFloat DisplayText Owner
AsInteger DisplayWidth ReadOnly
AsString EditMask Required
Calculated EditMaskPtr Size
CanModify FieldName Tag
DataSet FieldNo Text
DataSize Index Visible
Methods
Assign FocusControl SetData
AssignValue GetData
Clear IsValidChar
Events
OnChange OnSetText OnValidate
OnGetText
TDateTimeField component
A TDateTimeField component represents a field of a record in a dataset. It represents a
value consisting of a date and time.
Set the DisplayFormat property to control the formatting of the field for display
purposes, and the EditFormat property for editing purposes. Use the Value property to
access or change the current field value.
The TDateTimeField component has the properties, methods, and events of the TField
component.
If your application doesn’t require the data-aware capabilities of TDBCheckBox, use the
check box (TCheckBox) component instead to conserve system resources.
In addition to these properties, methods, and events, this component also has the
properties, methods, and events that apply to all windowed controls.
For more information, search for DBCheckBox component in the online Help, and
choose the Using the DBCheck Box Component.
Properties
Align Enabled PopupMenu
Alignment Font ReadOnly
AllowGrayed Height ShowHint
Caption HelpContext Showing
Checked Hint State
Color Left TabOrder
ComponentIndex Name TabStop
Ctl3D Owner Tag
Cursor Parent Top
DataField ParentColor ValueChecked
DataSource ParentCtl3D ValueUnchecked
DragCursor ParentFont Visible
DragMode ParentShowHint Width
Methods
BeginDrag GetTextBuf ScreenToClient
BringToFront GetTextLen ScrollBy
CanFocus Hide SendToBack
ClientToScreen Invalidate SetBounds
Dragging Refresh SetTextBuf
EndDrag Repaint Show
Focused ScaleBy Update
Events
OnClick OnEnter OnKeyUp
OnDragDrop OnExit OnMouseDown
OnDragOver OnKeyDown OnMouseMove
OnEndDrag OnKeyPress OnMouseUp
from a list or by typing in the edit box part of the control. The selected item or entered
+
text becomes the new value of the field if the database combo box’s ReadOnly property is
False.
+
How a database combo box appears and behaves depends on the value of its Style +
property.
You can link the database combo box with a dataset by specifying the data source +
component (TDataSource) that identifies the dataset as the value of the memo’s
DataSource property. Specify the field in the dataset you want to access as the value of +
the DataField property.
You specify the values the user can choose from in the combo box with the Items
+
property. For example, if you want the user to choose from five different values in the
combo box list, specify five strings as the value of Items. Just as with an ordinary combo +
box, you can add, delete, and insert items to it using the Add, Delete, and Insert methods
of the Items object, which is of type TStrings. For example, to add a string to a database
combo box, you could write this line of code:
+
DBListBox1.Items.Add(‘New item’); +
The ItemIndex property indicates which item in the database combo box is selected.
Sort the items in the list with the Sorted property.
+
At run time, you can select all the text in the edit box of the database combo box with the +
SelectAll method. To find out which text the user selected, or to replace selected text, use
the SelText property. To select only part of the text or to find out what part of the text is
selected, use the SelStart and SelLength properties.
+
In addition to these properties, methods, and events, this component also has the +
properties, methods, and events that apply to all windowed controls.
For more information, search for DBComboBox component in the online Help, and
+
choose the topic Using the DBCombo Box Component.
+
Properties
+
Align
BoundsRect
Height
HelpContext
ReadOnly
SelLength +
Color
ComponentIndex
Hint
ItemHeight
SelStart
SelText T
Ctl3D ItemIndex ShowHint
Cursor Items Showing
DataField Left Sorted
DataSource Name Style
DragCursor Owner TabOrder
DragMode Parent TabStop
DropDownCount ParentColor Tag
Enabled ParentCtl3D Text
Fields ParentFont Top
Methods
BeginDrag Focused ScreenToClient
BringToFront GetTextBuf ScrollBy
CanFocus GetTextLen SelectAll
Clear Hide SendToBack
ClientToScreen Invalidate SetBounds
CopyToClipboard PasteFromClipboard SetFocus
CutToClipboard Refresh SetTextBuf
Dragging Repaint Show
EndDrag ScaleBy Update
Events
OnChange OnDrawItem OnKeyDown
OnClick OnDropDown OnKeyPress
OnDblClick OnEndDrag OnKeyUp
OnDragDrop OnEnter OnMeasureItem
OnDragOver OnExit
You can cut, copy, and paste text in an edit box using the CutToClipboard,
+
CopyToClipboard, and PasteFromClipboard methods. +
Your application can use an edit box that displays a specified character rather than the
actual character typed into it. If the edit box is used to enter a password, onlookers won’t +
be able to read the typed text. Specify the special character with the PasswordChar
property. +
If you want the edit box to automatically resize to accommodate a change in font size,
use the AutoSize property. +
If your application doesn’t require the data-aware capabilities of TDBEdit, use the TEdit
component instead to conserve system resources.
+
In addition to these properties, methods, and events, this component also has the
properties, methods, and events that apply to all windowed controls.
+
For more information, search for DBEdit component in the online Help, and choose the
topic Using the DBEdit Component.
+
Properties
+
Align Fields PasswordChar
+
AutoSelect
AutoSize
Font
Height
PopupMenu
ReadOnly
+
BorderStyle
BoundsRect
HelpContext
Hint
SelLength
SelStart
+
CharCase
Color
IsMasked
Left
SelText
ShowHint
+
ComponentIndex
Ctl3D
MaxLength
Modified
Showing
TabOrder
+
Cursor
DataField
Name
Owner
TabStop
Tag
+
DataSource
DragCursor
Parent
ParentColor
Text
Top
+
DragMode
EditText
ParentCtl3D
ParentFont
Visible
Width
+
Enabled ParentShowHint
T
Methods
BeginDrag GetSelTextBuf SelectAll
BringToFront GetTextBuf SendToBack
CanFocus GetTextLen SetBounds
Clear Hide SetFocus
ClearSelection Invalidate SetSelTextBuf
ClientToScreen PasteFromClipboard SetTextBuf
CopyToClipboard Refresh Show
CutToClipboard Repaint Update
Events
OnChange OnEndDrag OnKeyUp
OnClick OnEnter OnMouseDown
OnDblClick OnExit OnMouseMove
OnDragDrop OnKeyDown OnMouseUp
OnDragOver OnKeyPress
Properties
Align Fields ParentShowHint
AutoDisplay Font PopupMenu
BorderStyle Handle ReadOnly
Center Height ShowHint
Color HelpContext Stretch
ComponentIndex Hint TabOrder
Ctl3D Left TabStop
Cursor Name Tag
DataField Owner Top
DataSource Parent Visible
DragCursor ParentColor Width
For more information, search for DBListBox component in the online Help, and choose
the topic Using the DBListBox Component.
Properties
Align Font ParentFont
BorderStyle Handle PopupMenu
BoundsRect Height ReadOnly
Brush HelpContext SelCount
Canvas Hint Selected
Color ItemIndex Showing
ComponentIndex IntegralHeight Sorted
Ctl3D ItemHeight Style
Cursor Items TabOrder
DataField Left TabStop
DataSource Name Tag
DragCursor Owner Top
DragMode Parent TopIndex
Enabled ParentColor Visible
Fields ParentCtl3D Width
Methods
BeginDrag GetTextLen ScrollBy
BringToFront Hide SendToBack
CanFocus ItemAtPos SetBounds
Clear ItemRect SetFocus
ClientToScreen Invalidate SetTextBuf
Dragging Refresh Show
EndDrag Repaint Update
Focused ScaleBy
GetTextBuf ScreenToClient
Events
OnClick OnEndDrag OnKeyUp
OnDblClick OnEnter OnMeasureItem
OnDragDrop OnExit OnMouseDown
OnDragOver OnKeyDown OnMouseMove
OnDrawItem OnKeyPress OnMouseUp
Properties
Align Height PopupMenu
AutoSelect HelpContext ReadOnly
BoundsRect Hint SelLength
Color Left SelStart
ComponentIndex LookupDisplay SelText
Ctl3D LookupField ShowHint
Cursor LookupSource Showing
DataField MaxLength Style
DataSource Name TabOrder
DisplayValue Options TabStop
DragCursor Owner Tag
DragMode Parent Text
DropDownCount ParentColor Top
DropDownWidth ParentCtl3D Value
Enabled ParentFont Visible
Font ParentShowHint Width
Methods
BeginDrag Focused ScrollBy
BringToFront GetTextBuf SelectAll
CanFocus GetTextLen SendToBack
Clear Hide SetBounds
ClientToScreen Invalidate SetTextBuf
CloseUp Refresh Show
Dragging Repaint Update
DropDown ScaleBy
EndDrag ScreenToClient
Events
OnChange OnDropDown OnKeyPress
OnClick OnEndDrag OnKeyUp
OnDblClick OnEnter OnMouseDown
OnDragDrop OnExit OnMouseMove
OnDragOver OnKeyDown OnMouseUp
The TDBLookupComboStyle determines the kind of combo box. It is the type of the Style
+
property for a database lookup combo box (TDBLookupCombo). +
TDBLookupList component DBLookup
+
A TDBLookupList component is a data-aware list box that “looks up” a value in a lookup
+
table.
For example, imagine that DataSource1 identifies the table called Books, and DataSource2
+
identifies the table called BookOrders. The BookOrders table contains a Volume field that
use a number to identify the book the customer ordered. When the user moves through
+
the records of the BookOrders table, you want the database lookup list box to display the
titles of the books. You can do this, because Books also contains a field that identifies the
+
book by number (Volume), as well as the title of the book.
For the database lookup list box to look up the title of the book, set the DataSource
+
property value of the list box to DataSource2, which refers to the BookOrders table. Set the
DataField property value to Volume. The LookupSource is the data source that refers to the
+
table the combo box uses to look up the title of the book—in this case, DataSource1—
because the Books table contains the book’s title. +
Set the LookupField property to Volume. LookupField links the two tables on the value that
identifies the book by number. In this example, both the DataField value and the
+
LookupField value have the same field name, but this isn’t required. If the Active property
of both tables is True, the database list box now displays the value of the Volume field. +
You want to see the title of the book—not the volume number—so set the LookupDisplay
property to Title, the field that contains the title of the book. Now as you move through +
the records in the BookOrders table, the title of the ordered book appears in the database
lookup list box. +
You can choose to display multiple fields in the list box by entering the list of fields to
display as the value of the LookupDisplay property, separating each field with a +
semicolon. To display the resulting columns the way you want, use the Options
property. +
If the ReadOnly property is False, the user can select a displayed value in the database
lookup list box and the corresponding value in current record of the primary dataset +
updates with a new value. Using the Books and BookOrders example, when the user
selects a title in the lookup table using the database lookup list box, the value of the
CustNo field in the primary dataset updates accordingly.
T
The Value property is the string the combo box uses to identify which record in the
lookup table to display. The DisplayValue is the actual displayed string in the list box.
In addition to these properties, methods, and events, this component also has the
properties, methods, and events that apply to all windowed controls.
Properties
Align Fields ParentFont
BorderStyle Font ParentShowHint
Methods
BeginDrag GetTextBuf ScrollBy
BringToFront GetTextLen SendToBack
CanFocus Hide SetBounds
ClientToScreen Invalidate SetFocus
Dragging Refresh SetTextBuf
EndDrag Repaint Show
FindComponent ScaleBy Update
Focused ScreenToClient
Events
OnClick OnEndDrag OnKeyPress
OnDblClick OnEnter OnKeyUp
OnDragDrop OnExit
OnDragOver OnKeyDown
For more information, search for DBMemo Component in the online Help, and choose
the topic Using the DBMemo Component.
Properties
Align HelpContext SelLength
Alignment Hint SelStart
AutoDisplay Left SelText
BorderStyle Lines ShowHint
Color MaxLength Showing
ComponentIndex Modified TabOrder
Ctl3D Name TabStop
Cursor Owner Tag
DataField Parent Text
DataSource ParentColor Top
DragCursor ParentCtl3D Visible
DragMode ParentFont WantTabs
Enabled ParentShowHint Width
Fields PopupMenu WordWrap
Font ReadOnly
Height ScrollBars
Methods
BeginDrag GetTextBuf ScrollBy
BringToFront GetTextLen SelectAll
CanFocus Hide SendToBack
ClientToScreen Invalidate SetBounds
Clear LoadMemo SetFocus
Dragging Refresh SetSelTextBuf
EndDrag Repaint SetTextBuf
Focused ScaleBy Show
GetSelTextBuf ScreenToClient Update
Events
OnChange OnEndDrag OnKeyUp
OnClick OnEnter OnMouseDown
OnDblClick OnExit OnMouseMove
OnDragDrop OnKeyDown OnMouseUp
OnDragOver OnKeyPress
When the user chooses one of the navigator buttons, the appropriate action occurs on
+
the dataset the navigator is linked to. For example, if the user clicks the Insert button, a
blank record is inserted in the dataset.
+
This table describes the buttons on the navigator: +
Button Purpose +
First
Prior
Sets the current record to the first record in the dataset, disables the First and Prior buttons,
and enables the Next and last buttons if they are disabled
Sets the current record to the previous record and enables the Last and Next buttons if they
+
Next
are disabled
Sets the current record to the next record and enables the First and Prior buttons if they are
+
Last
disabled
Sets the current record to the last record in the dataset, disables the Last and Next buttons,
and enables the First and Prior buttons if they are disabled
+
Insert Inserts a new record before the current record, and sets the dataset into Insert and Edit
states
+
Delete
Edit
Deletes the current record and makes the next record the current record
Puts the dataset into Edit state so that the current record can be modified
+
Post
Cancel
Writes changes in the current record to the database
Cancels edits to the current record, restores the record display to its condition prior to
T
editing, and turns off Insert and Edit states if they are active
Refresh Redisplays the current record from the dataset, thereby updating the display of the record
on the form
Using the VisibleButtons property, you can decide which operations are allowed on the
data and when.
You can customize the Help Hints available for the buttons on the database navigator by
specifying values in the Hints property.
In addition to these properties, methods, and events, this component also has the
properties, methods, and events that apply to all windowed controls.
For more information, search for DBNavigator in the online Help, and choose the topic
Using the DBNavigator Component.
Properties
Align Height PopupMenu
BoundsRect HelpContext Showing
ComponentIndex Hint ShowHint
ConfirmDelete Hints TabOrder
Ctl3D Left TabStop
Cursor Name Tag
DataSource Owner Top
DragCursor Parent Visible
DragMode ParentCtl3D VisibleButtons
Enabled ParentShowHint Width
Methods
BeginDrag GetTextBuf ScrollBy
BringToFront GetTextLen SendToBack
BtnClick Hide SetBounds
CanFocus Invalidate SetFocus
ClientToScreen Refresh SetTextBuf
Dragging Repaint Show
EndDrag ScaleBy Update
Focused ScreenToClient
Events
OnClick OnEndDrag OnMouseMove
OnDblClick OnEnter OnMouseUp
OnDragDrop OnExit OnResize
OnDragOver OnMouseDown
Link the database radio group box with a dataset by specifying the data source
+
component (TDataSource) that identifies the dataset as the value of the group box’s
DataSource property. Specify the field in the dataset you want to access as the value of
+
the group box’s DataField property. +
The radio buttons are added to the group box when strings are entered as the value of
the Items property. The strings entered in the Items property become the captions of the
radio buttons if there are no strings in the Values property. If there are strings in the
+
Values property, the first string is associated with the first radio button, the second with
the second radio button, and so on. The Values string for a radio button is the value in
+
the field of the current record that selects the radio button.
If the user selects a radio button and the ReadOnly property is False, the Values string for
+
the radio button becomes the contents of the field for the current record in the dataset. +
The Value property contains the contents of the field of the current record in the dataset.
You can display the radio buttons in a single column or in multiple columns by setting
+
the value of the Columns property.
In addition to these properties, methods, and events, this component also has the
+
properties, methods, and events that apply to all windowed controls. +
For more information, search for DBRadioGroup in the online Help, and choose the
topic Using the DBRadioGroup Component. +
Properties +
Align
Caption
Font
Height
ParentShowHint
PopupMenu
+
Color
Columns
HelpContext
Hint
ReadOnly
ShowHint
+
ComponentIndex
Ctl3D
ItemIndex
Items
Showing
TabOrder
+
Cursor
DataField
Left
Name
TabStop
Tag
+
DataSource
DragCursor
Owner
Parent
Top
Value
+
DragMode
Enabled
ParentColor
ParentCtl3D
Values
Visible
T
Fields ParentFont Width
Methods
BeginDrag GetTextBuf ScrollBy
BringToFront GetTextLen SendToBack
CanFocus Hide SetBounds
ClientToScreen Invalidate SetFocus
ContainsControl Refresh SetTextBuf
Dragging Repaint Show
Events
OnChange OnDragDrop OnEnter
OnClick OnDragOver OnExit
OnDblClick OnEndDrag
Properties
Align Enabled ParentShowHint
Alignment Fields PopupMenu
AutoSize Font ShowHint
BoundsRect Height Tag
Color Hint Top
ComponentIndex Left Transparent
Cursor Name Visible
DataField Owner Width
DataSource Parent WordWrap
Properties
ComponentIndex DDETopic Owner
ConnectMode FormatChars ServiceApplication
DDEService Name Tag
Methods
CloseLink OpenLink RequestData
ExecuteMacro PokeData SetLink
ExecuteMacroLines PokeDataLines
Events
OnClose OnOpen
Properties
ComponentIndex Lines Tag
DDEConv Name Text
DDEItem Owner
Properties
ComponentIndex Owner Text
Lines ServerConv
Name Tag
Methods
CopyToClipboard
Events
OnChange OnPokeData
Events
OnClick OnEndDrag OnKeyUp
OnDblClick OnEnter OnMouseDown
OnDragDrop OnExit OnMouseMove
OnDragOver OnKeyDown OnMouseUp
OnDropDown OnKeyPress
See also
TDragState type
dsDragLeave
to be dropped.
The state a drag object is in when it leaves a control that would allow the drag object to +
+
be dropped
Example
This code is a OnDragOver event handler that won’t allow a label control to be dropped
on a panel control and stops the dragging of the label as soon as the user drags the label
+
onto the panel: +
procedure TForm1.Panel1DragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
begin
+
Accept := False;
if (Source is TLabel) and (State = dsDragEnter) then
+
end;
(Source as TLabel).EndDrag(False);
+
The Source parameter is the label being dragged, the Sender parameter is the panel
control, and the State parameter is the drag state. +
See also +
TDragOverEvent type
+
TDrawCellEvent type Grids T
Declaration
TDrawCellEvent = procedure (Sender: TObject; ACol, ARow: Longint; ARect: TRect; AState:
TGridDrawState) of object;
The TDrawCellEvent type points to a method that handles the drawing of a cell in an
owner-draw grid control. The ACol parameter is the column of the cell in the grid, and
the ARow parameter is the row of the cell. ARect is the cell area where the drawing
occurs, and AState is current state of the cell.
TDrawCellEvent is the type of the OnDrawCell event.
For more information, search for DrawGrid component in the online Help, and choose
+
the topic Using the Draw Grid Component. +
Properties +
Align
BorderStyle
FixedColor
FixedCols
PopupMenu
Row
+
BoundsRect
Brush
FixedRows
Font
RowCount
RowHeights
+
Canvas
Col
GridHeight
GridLineWidth
Scrollbars
Selection
+
ColCount
Color
GridWidth
Height
Showing
TabOrder
+
ColWidths
ComponentIndex
HelpContext
Hint
TabStop
TabStops
+
Ctl3D
Cursor
Left
LeftCol
Tag
Top
+
DefaultColWidth
DefaultDrawing
Name
Options
TopRow
Visible
+
DefaultRowHeight
DragCursor
Owner
Parent
VisibleColCount
VisibleRowCount
+
DragMode
EditorMode
ParentColor
ParentCtl3D
Width
+
Enabled ParentFont
+
Methods
+
BeginDrag
BringToFront
EndDrag
Focused
ScaleBy
ScreenToClient +
CanFocus
CellRect
GetTextBuf
GetTextLen
ScrollBy
SendToBack +
ClassName
ClassParent
Hide
Invalidate
SetBounds
SetFocus +
T
ClassType MouseToCell SetTextBuf
ClientToScreen Refresh Show
Dragging Repaint Update
Events
OnClick OnEnter OnMouseDown
OnColumnMoved OnExit OnMouseMove
OnDblClick OnGetEditMask OnMouseUp
OnDragDrop OnGetEditText OnRowMoved
OnDragOver OnKeyDown OnSelectCell
Value Meaning
odSelected The item is selected
odDisabled The entire list box is disabled
odFocused The item currently has focus
If your application uses the drive combo box with a directory list box and a file list box,
+
you can synchronize them with this code written in the drive combo box OnChange
event handler and in the directory list box OnChange event handler:
+
procedure TForm1.DriveComboBox1Change(Sender: TObject);
begin
+
DirectoryListBox1.Drive := DriveComboBox1.Drive;
end;
+
procedure TForm1.DirectoryListBox1Change(Sender: TObject);
begin
+
FileListBox1.Directory := DirectoryListBox1.Directory;
end;
+
Now when the user selects a new drive using the drive combo box, the directory list box
and the file list box are updated also.
+
Another way to accomplish the same task is to set the DirList property of the drive
combo box and the FileList property of the directory list box.
+
In addition to these properties, methods, and events, this component also has the +
properties, methods, and events that apply to all windowed controls.
For more information, search for DriveComboBox component in the online Help, and
+
choose the topic Using the Drive Combo Box Component.
+
Properties
+
Align
BoundsRect
HelpContext
Hint
SelStart
SelText +
Color
ComponentIndex
ItemIndex
Items
Showing
TabOrder +
Ctl3D
Cursor
Left
Name
TabStop
Tag +
DirList
DragCursor
Owner
Parent
Text
TextCase +
DragMode
Drive
ParentColor
ParentCtl3D
Top
Visible +
Enabled
Font
ParentFont
PopupMenu
Width
T
Height SelLength
Methods
BeginDrag GetTextBuf ScrollBy
BringToFront GetTextLen SelectAll
CanFocus Hide SendToBack
Clear Invalidate SetBounds
ClientToScreen Refresh SetFocus
Dragging Repaint SetTextBuf
Events
OnChange OnDragOver OnExit
OnClick OnDropDown OnKeyDown
OnDblClick OnEndDrag OnKeyPress
OnDragDrop OnEnter OnKeyUp
See also
TDirectoryListBox component, TFileListBox component
Your application can replace the characters typed into the edit box with another
+
specified character. If the edit box is used to enter a password, for example, onlookers
won’t be able to read the typed characters. Specify the replacement character with the
+
PasswordChar property. +
If you want the edit box to automatically resize to accommodate a change in font size,
use the AutoSize property. +
In addition to these properties, methods, and events, this component also has the
properties, methods, and events that apply to all windowed controls. +
For more information about using edit boxes, search for Edit component in the online
Help, and choose the topic Using the Edit Component.
+
Properties +
Align HideSelection ReadOnly +
AutoSelect
AutoSize
Hint
Left
SelLength
SelStart +
BorderStyle
CharCase
MaxLength
Modified
SelText
ShowHint +
Color
ComponentIndex
Name
OEMConvert
Showing
TabOrder +
Ctl3D
Cursor
Owner
Parent
TabStop
Tag +
DragCursor
DragMode
ParentColor
ParentCtl3D
Text
Top +
Enabled
Font
ParentFont
ParentShowHint
Visible
Width +
Height
HelpContext
PasswordChar
PopupMenu +
Methods +
BeginDrag
BringToFront
Free
GetSelTextBuf
ScreenToClient
ScrollBy
+
ClientToScreen
Clear
GetTextBuf
GetTextLen
SelectAll
SendToBack
T
ClearSelection Hide SetBounds
CopyToClipboard Invalidate SetFocus
CutToClipboard PasteFromClipboard SetSelTextBuf
Dragging Refresh SetTextBuf
EndDrag Repaint Show
FindComponent ScaleBy Update
Events
OnChange OnEnter OnMouseDown
OnDblClick OnExit OnMouseMove
OnDragDrop OnKeyDown OnMouseUp
OnDragOver OnKeyPress
OnEndDrag OnKeyUp
See also
TDBEdit component, TComboBox component
Temporary property
Applies to
TDataBase component
Declaration
property Temporary: Boolean;
Run-time only. The Temporary property is True if the TDatabase component was created
because none existed when a database table was opened. Such a database will
automatically be destroyed when the table or query is closed. You can set Temporary to
False so that it will be preserved until you explicitly free it with Free. If you explicitly
created the TDatabase component, then Temporary will be False, but you can set it to be
True and it will automatically be freed when the last dataset linked to it is closed.
Example
Table1.Database.Temporary := False;
See also
Database property
Declaration
property Terminated: Boolean;
Read and run-time only. The Terminated property determines whether the application
has received the Windows WM_QUIT message, which then terminates the application.
Your Delphi application receives this message usually because the main window of the
application has closed, or the Terminate method has been called, thereby requiring
windows to quit the application.
The Terminated property is usually used when calling the ProcessMessages method so
that your application doesn’t attempt to process Windows messages after the
application has quit.
Example
The application calls the ProcessMessages method if the application has not received the
message from Windows to quit executing:
if Application.Terminated = False then
Application.ProcessMessages;
...
See also
ProcessMessages method, Run method, Terminate method
Value Definition
0 Processor is an 8086.
1 Processor is an 80286.
2 Processor is an 80386 or later.
When the run-time library detects that the processor is an 80386 or later CPU, it will use
80386 instructions to speed up certain operations. In particular, Longint multiplication,
division, and shifts are performed using 32-bit instructions when an 80386 is detected.
Example
This example uses an edit box, a list box, and a button named Add on a form. Each time
the user clicks the Add button, the text in the edit box is added to the list in the list box:
procedure TForm1.AddClick(Sender: TObject);
begin
ListBox1.Items.Add(Edit1.Text);
end;
See also
GetSelTextBuf method, GetTextBuf method, SetTextBuf method, SetSelTextBuf method
Example
The following code stores the value of the first item of a combo box in the Text property
in the OnCreate event handler of the form containing the combo box. The first item will
be displayed in the combo box at run time.
procedure TForm1.FormCreate(Sender: TObject);
begin
ComboBox1.Text := ComboBox1.Items[0];
end;
See also
Drive property, Filter property
Example
The following code should be attached to the OnClick event handler of an TOutline
component. When the value of the Text of the SelectedItem is ‘Aqua’, the Color of the
outline becomes clAqua.
For queries
Declaration
property Text: PChar;
Run-time and read only. The Text property holds the actual text of the SQL query sent to
the Borland Database Engine. In general, you should not need to examine this property.
However, if you encounter problems with an SQL statement, you may want to inspect
the Text property to be sure that the statement is as expected.
Example
var
ActualText: PChar;
Buf: array [0..20] of Char;
...
ActualText := Query1.Text;
repeat
StrLCopy(Buf, ActualText, SizeOf(Buf));
WriteLn(Buf);
if StrLen(ActualText) > 20 then Inc(ActualText, 20)
else Break;
until False;
See also
SQL property
For fields
Declaration
property Text: string;
Run-time only. Text contains the string value of the field a data-aware control uses for
display when the control is in edit mode. Data-aware controls such as TDBEdit rely on
Text to provide the editing format for each field.
You can control the strings returned by Text by assigning an OnGetText event handler,
or you can accept Delphi defaults, which depend on the field’s data type.
For TStringField, the AsString property is returned.
For TIntegerField, TSmallintField, and TWordField, if EditFormat or DisplayFormat (in that
order) is assigned a value, FloatToTextFmt is called. Otherwise, Str is called.
For TBCDField and TFloatField, FloatToTextFmt is called with value of EditFormat or
DisplayFormat (in that order).
For a TCurrencyField, if EditFormat or DisplayFormat (in that order) is assigned a value,
FloatToTextFmt is called. Otherwise, FloatToTextFmt is called with the ffCurrency flag and
CurrencyDecimals variable.
For a TDateTimeField, DateTimeToStr is called with the value of DisplayFormat.
For a TDateField, DateTimeToStr is called with the DisplayFormat property, except that the
ShortDateFormat variable is substituted if DisplayFormat is unassigned. For a TTimeField,
DateTimeToStr is called with the DisplayFormat property, except that the LongTimeFormat
variable is substituted if DisplayFormat is unassigned.
The default value is tcLowerCase. If you use the Object Inspector to change the value to
tcUpperCase, you won’t see the results until your application runs.
Example
Assuming a drive combo box exists on the form, this code displays the volume name in
the drive combo box in uppercase letters when the form appears:
Example
The following example declares the variable F as a text file.
var
F: TextFile;
See also
AssignFile procedure, CloseFile procedure
TextHeight method
Applies to
TCanvas object
Declaration
function TextHeight(const Text: string): Integer;
TextHeight returns the height in pixels of the string passed in Text when rendered in the
current font. You can use TextHeight to specify whether the entire string will appear in a
given space.
Example
This example displays the height of a text string in the current font of the canvas in an
edit box on the form:
procedure TForm1.FormCreate(Sender: TObject);
var
L: LongInt;
begin
L := Canvas.TextHeight('Object Pascal is the best');
Edit1.Text := IntToStr(L) + ' pixels in height';
end;
See also
Font property, TextWidth method
TheRect.Right := 100;
Form1.Canvas.TextRect(TheRect,0,0,'Hello, world!');
end;
See also
TextOut method
Example
This example uses a main menu that contains an Open command, an edit box, and a
button. Delphi automatically names the menu item for the Open command Open1.
When the user enters the desired shortcut text in the edit box and clicks the button, a
shortcut is created and the shortcut text appears next to the Open menu item.
procedure TForm1.Button1Click(Sender: TObject);
var
NewShortCut: TShortCut;
begin
NewShortCut := TextToShortCut(Edit1.Text);
Open1.ShortCut := NewShortCut;
end;
TField component
TField components are used to access fields in a record. By default, a set of TField
components is created automatically each time a dataset component is activated; the
resulting set of TField components is dynamic, mirroring the actual columns in an
underlying physical table at that time.
At design time, you can use the Fields Editor to create a persistent, unchanging set of
TField components for a dataset. Creating TField components with the Fields Editor
provides efficient, readable, and type-safe programmatic access to underlying data. It
guarantees that each time your application runs, it uses and displays the same columns,
in the same order, every time, even if the physical structure of the underlying database
has changed. Creating TField components at design time guarantees that data-aware
components and program code that rely on specific fields always work as expected. If a
column on which a persistent TField component is based is deleted or changed, then
Delphi generates an exception rather than running the application against a nonexistent
column or mismatched data.
A TField component is an abstract object. The Fields property of a dataset is always one
of the following TField descendants:
Each TField component and its properties, methods, and events can be accessed
programmatically. At run time, dynamically created components can be accessed
through the Fields property of the dataset; at design time, use the Fields Editor to select a
field component and use the Object Inspector to modify the field’s properties.
Most TField descendants have the same properties, but some properties, such as
+
AsBoolean or EditMask only apply to some fields. Use the AsBoolean, AsDateTime, AsFloat,
AsInteger, or AsString properties as appropriate to access or modify the current value of
+
the field. Test the CanModify property to see if the field can be changed. Use the DataSet
property to reference the dataset of the field. Use the DataType property to test the type
+
of the field. Set the DisplayLabel property to a column heading for a data grid(TDBGrid).
The DisplayText property will format the field for display purposes; Text will format it +
for editing purposes. Set the DisplayWidth to control the column width in a data grid. Set
the EditMask property to limit the characters entered to a selected set. Use the FieldName
property to get the name of the field in the dataset. Test the IsNull property to see if the
+
field has been assigned a value. Set the ReadOnly property to prevent or allow the user
to change the value. Set the Visible property to control whether the field appears in a
+
data grid. Call the Clear method to erase any data assigned. Call the GetData method to
access the data in native format, or SetData to assign new data. Use the OnChange event
+
to be notified when the value of the field is changed. Use the OnGetText event to do your
own formatting of the data for display or edit purposes, and the OnSetText event to +
convert the edited data back to native format. Use the OnValidate event to validate the
data before it is stored into the record. +
In addition to these properties, methods, and events, this component also has the
properties and methods that apply to all components. +
Properties +
Alignment DataType IsIndexField +
AsBoolean
AsDateTime
DisplayLabel
DisplayName
IsNull
Name +
AsFloat
AsInteger
DisplayText
DisplayWidth
Owner
ReadOnly +
AsString
Calculated
EditMask
EditMaskPtr
Required
Size +
CanModify
DataSet
FieldName
FieldNo
Tag
Text +
DataSize Index Visible
+
Methods
Assign FocusControl SetData
T
AssignValue GetData
Clear IsValidChar
Events
OnChange OnSetText OnValidate
OnGetText
TFieldGetTextEvent type DB
Declaration
TFieldGetTextEvent = procedure(Sender: TField; var Text: string; DisplayText: Boolean) of
object;
The TFieldGetTextEvent points to a method that retrieves the text in the field. It is used by
the OnGetText event of field components. The Text parameter references the text, and the
DisplayText parameter determines whether the text is formatted for display. If
DisplayText is True, the text is in display format. If DisplayText is False, the text is not
formatted for display.
TFieldNotifyEvent type DB
Declaration
TFieldNotifyEvent = procedure(Sender: TField) of object;
The TFieldNotifyEvent type points to a method that handles the validation of data in a
field or handles the changing of data in a field. It is the type of the OnChange and
OnValidate events of a field component.
TFieldSetTextEvent type DB
Declaration
TFieldSetTextEvent = procedure(Sender: TField; const Text: string) of object;
The TFieldSetTextEvent type points to a method that stores text in a field. It is used by the
OnSetText event of field components. The Text parameter is the text that is being stored
in the field.
Properties
Align Handle ParentFont
BoundsRect Height ParentShowHint
Canvas HelpContext PopupMenu
ComponentIndex Hint Selected
Color IntegralHeight ShowGlyphs
Controls ItemHeight ShowHint
Ctl3D ItemIndex Showing
Cursor Items TabOrder
Directory Left TabStop
DragCursor Mask Tag
DragMode MultiSelect Top
Enabled Name TopIndex
FileEdit Owner Visible
FileName Parent Width
FileType ParentColor
Font ParentCtl3D
Methods
BeginDrag GetTextLen ScrollBy
BringToFront Hide SendToBack
CanFocus Invalidate SetBounds
Clear ItemAtPos SetFocus
ClientToScreen ItemRect SetTextBuf
Dragging Refresh Show
EndDrag Repaint Update
Focused ScaleBy
GetTextBuf ScreenToClient
Events
OnChange OnEndDrag OnKeyUp
OnClick OnEnter OnMouseDown
OnDblClick OnExit OnMouseMove
OnDragDrop OnKeyDown OnMouseUp
OnDragOver OnKeyPress
See also
TDirectoryListBox component, TDriveComboBox component
Properties
Count Items
Methods
Add ClassType Free
AddFieldDesc Clear IndexOf
Assign Create Update
ClassName Destroy
ClassParent Find
TFieldType type DB
Declaration
TFieldType = (ftUnknown, ftString, ftSmallint, ftInteger, ftWord, ftBoolean, ftFloat,
ftCurrency, ftBCD, ftDate, ftTime, ftDateTime, ftBytes, ftVarBytes, ftBlob, ftMemo,
ftGraphic);
The TFieldType type is the set of values of the DataType property of a TField component
or TFieldDef component.
Properties
Align Height ParentFont
BoundsRect HelpContext SelLength
Color Hint SelStart
ComponentIndex ItemIndex SelText
Ctl3D Items Showing
Methods
BeginDrag GetTextBuf ScrollBy
BringToFront GetTextLen SelectAll
CanFocus Hide SendToBack
Clear Invalidate SetBounds
ClientToScreen Refresh SetFocus
Dragging Repaint SetTextBuf
EndDrag ScaleBy Show
Focused ScreenToClient Update
Events
OnChange OnDragOver OnExit
OnClick OnDropDown OnKeyDown
OnDblClick OnEndDrag OnKeyPress
OnDragDrop OnEnter OnKeyUp
For more information, search for FindDialog component in the online Help, and choose
+
the topic Using the Find Dialog Component. +
Properties +
ComponentIndex
Ctl3D
HelpContext
Name
Position
Tag
+
FindText
Handle
Options
Owner
+
Methods
+
CloseDialog Execute +
Events +
OnFind +
TFindItemKind type Menus
+
Declaration
+
TFindItemKind = (fkCommand, fkHandle, fkShortCut); +
The TFindItemKind defines the possible values of the Kind parameter in the FindItem
method of a menu component.
+
+
TFindOptions type Dialogs
+
Declaration
TFindOption = (frDown, frFindNext, frHideMatchCase, frHideWholeWord, frHideUpDown,
+
frMatchCase, frDisableMatchCase, frDisableUpDown, frDisableWholeWord, frReplace,
frReplaceAll, frWholeWord, frShowHelp); +
TFindOptions = set of TFindOption; T
The TFindOptions type defines the set of possible values for the Options property of the
Find and Replace dialog boxes (TFindDialog and TReplaceDialog components).
TFloatField component
A TFloatField represents a field of a record in a dataset. It is represented as a binary value
with a range from (positive or negative) 5.0 * 10-324 to 1.7 * 10308. It has an accuracy of 15
to 16 digits. Use TFloatField for fields that hold floating-point numbers.
Set the DisplayFormat property to control the formatting of the field for display
purposes, and the EditFormat property for editing purposes. Use the Value property to
access or change the current field value.
The TFloatField component has the properties, methods, and events of the TField
component.
Properties
Alignment DisplayLabel MinValue
AsBoolean DisplayName Name
AsDateTime DisplayText Owner
AsFloat DisplayWidth Precision
AsInteger EditFormat ReadOnly
AsString EditMask Required
Calculated EditMaskPtr Size
CanModify FieldName Tag
Currency FieldNo Text
DataSet Index Value
DataSize IsIndexField Visible
DataType IsNull
DisplayFormat MaxValue
Methods
Assign FocusControl SetData
AssignValue GetData
Clear IsValidChar
Events
OnChange OnSetText OnValidate
OnGetText
TFloatFormat SysUtils
Declaration
TFloatFormat = (ffGeneral, ffExponent, ffFixed, ffNumber, ffCurrency);
+
format.
ffNumber Number format. The value is converted to a string of the form "-d,ddd,ddd.ddd...". The
ffNumber format corresponds to the ffFixed format, except that the resulting string contains
ffCurrency
thousand separators.
Currency format. The value is converted to a string that represents a currency amount. The
+
conversion is controlled by the CurrencyString, CurrencyFormat, NegCurrFormat,
ThousandSeparator, and DecimalSeparator global variables, all of which are initialized from the
Currency Format in the International section of the Windows Control Panel. The number of
+
digits after the decimal point is given by the Digits parameter—it must be between 0 and 18.
+
See also
FloatToDecimal procedure, FloatToStr function, FloatToStrF function, FloatToText +
function, FloatToTextFmt function
+
TFloatRec SysUtils +
Declaration +
TFloatRec = record
Exponent: Integer;
Negative: Boolean;
T
Digits: array[0..18] of Char;
end;
TFloatRec is the FloatToDecimal result record.
A TFont object defines a set of characters by specifying their height, font family
(typeface) name, and so on. The height is specified by the Height property. The typeface
is specified by the Name property. The size in points is specified by the Size property.
The color is specified by the Color property. The attributes of the font (bold, italic, and so
on) are specified by the Style property.
When a font is modified, an OnChange event occurs.
In addition to these properties, methods, and events, this object also has the methods
that apply to all objects.
Properties
Color Name Size
Handle Pitch Style
Height PixelsPerInch
Methods
Assign Destroy Free
Create
Events
OnChange
creating MDI applications, search for “MDI applications, creating” in the online Help,
+
and choose the topic “Multiple Document Interface (MDI) Applications.” +
Most MDI applications have a Window menu that lists the open child forms or
windows at the bottom of the menu. You can specify which item on the main menu of +
your application is the Window menu as the value of the WindowMenu property, and at
run time, the open child forms are automatically listed at the bottom of the specified
menu. Usually, Window menus have commands that allow the user to manage the
+
windows or forms in the running application. You can call the Cascade, Tile, Previous,
Next, and ArrangeIcons methods in the OnClick event handlers for the appropriate menu
+
commands, which make it very easy to give your users this capability.
If you want your form to display different menus at various times while your
+
application runs, you specify the menu you want to use with the Menu property. If you
want your application to be able to process key events rather than have them go
+
immediately to the selected control on the form, set the form’s KeyPreview property to
True. +
You can use the OnCreate event handler of the form to set initial values for properties
and do any processing you want to occur before the user begins interacting with the
+
form.
In addition to these properties, methods, and events, this component also has the
+
properties, methods, and events that apply to all windowed controls. +
For more information, search for Form component in the online Help, and choose the
topic Using the Form Component. +
Properties +
Active
ActiveControl
Controls
Ctl3D
Owner
Parent
+
ActiveMDIChild
Align
Cursor
Enabled
PixelsPerInch
PopupMenu
+
AutoScroll
BorderIcons
Font
FormStyle
Position
PrintScale
+
BorderStyle
Brush
Handle
Height
Scaled
ShowHint
+
Caption
Canvas
HelpContext
Hint
Showing
TabOrder
T
ClientHandle HorzScrollBar TabStop
ClientHeight Icon Tag
ClientOrigin KeyPreview TileMode
ClientRect Left Top
ClientWidth MDIChildCount VertScrollBar
Color MDIChildren Visible
ComponentCount Menu Width
ComponentIndex ModalResult WindowMenu
Methods
ArrangeIcons GetFormImage RemoveComponent
BringToFront GetTextBuf Repaint
CanFocus GetTextLen ScaleBy
Cascade Hide ScreenToClient
ClientToScreen HandleAllocated ScrollBy
Close HandleNeeded ScrollInView
CloseQuery Hide SendToBack
ContainsControl InsertComponent SetBounds
Create InsertControl SetFocus
CreateNew Invalidate SetTextBuf
Destroy Next Show
Dragging Previous ShowModal
FindComponent Print Tile
Focused Refresh Update
Free Release
Events
OnActivate OnDragDrop OnMouseDown
OnClick OnDragOver OnMouseMove
OnClose OnEnter OnMouseUp
OnCloseQuery OnExit OnPaint
OnCreate OnHide OnResize
OnDestroy OnKeyDown OnShow
OnDblClick OnKeyPress
OnDeactivate OnKeyUp
Events
OnChange
TGraphicField component
A TGraphicField represents a field of a record which is represented by a value consisting
of an arbitrary set of bytes with indefinite size. The bytes should correspond to graphics
data.
Use the Assign method to transfer another component to a TGraphicField. Use the
LoadFromFile method to load a field’s contents from a file. Use LoadFromStream method
to load a field from a Stream. Use SaveToFile method to write a field’s contents to a file.
Use SaveToStream method to write a field’s contents to a Stream.
The TGraphicField component has the properties, methods, and events of the TField
component.
Properties
Alignment DataType IsIndexField
AsBoolean DisplayLabel IsNull
AsDateTime DisplayName Name
AsFloat DisplayText Owner
AsInteger DisplayWidth ReadOnly
AsString EditMask Required
Calculated EditMaskPtr Size
CanModify FieldName Tag
DataSet FieldNo Text
DataSize Index Visible
Methods
Assign GetData SaveToFile
AssignValue IsValidChar SaveToStream
Clear LoadFromFile SetData
FocusControl LoadFromStream
Events
OnChange OnSetText OnValidate
OnGetText
Properties
Align Height PopupMenu
Caption HelpContext Showing
Color Hint TabOrder
Controls Left TabStop
Ctl3D Name Tag
Cursor Owner Top
DragCursor Parent Visible
DragMode ParentColor Width
Enabled ParentCtl3D
Font ParentFont
Methods
BeginDrag Focused ScaleBy
BringToFront GetTextBuf ScreenToClient
CanFocus GetTextLen ScrollBy
ClientToScreen Hide SendToBack
ContainsControl Invalidate SetBounds
Dragging Refresh SetFocus
EndDrag Repaint SetTextBuf
Events
OnClick OnEndDrag OnMouseMove
OnDblClick OnEnter OnMouseUp
Focused ScrollBy
GetTextBuf ScreenToClient
Events
OnEnter OnSized OnSizing
OnExit
The height and width in pixels of the icon are specified by the Height and Width
+
properties, respectively. +
To load an icon from a file, call the LoadFromFile method. To save an icon to a file, call
SaveToFile. +
To draw an icon on a canvas, call the Draw or StretchDraw methods of a TCanvas object,
passing a TIcon as a parameter. +
When the icon is modified, an OnChange event occurs. +
In addition to these properties, methods, and events, this object also has the methods
that apply to all objects. +
Properties +
Empty
Handle
Height Width +
Methods
+
Assign ClassType Free
+
ClassName
ClassParent
Create
Destroy
LoadFromFile
SaveToFile
+
Events
+
OnChange +
+
TIdleEvent type Forms
+
Declaration
TIdleEvent = procedure (Sender: TObject; var Done: Boolean) of object;
+
The TIdleEvent type points to a method that runs when your application is idle. It is the
type of the OnIdle event of the application (TApplication).
+
The Boolean parameter Done is True by default. When Done is True, the Windows API T
WaitMessage function is called when OnIdle returns. WaitMessage yields control to other
applications until a new message appears in the message queue of your application. If
Done is False, WaitMessage is not called.
Tile method
Applies to
TForm component
Declaration
procedure Tile;
The Tile method arranges the child forms of a parent form in your application so that the
forms are all the same size. At the same time, all the forms together completely fill up
the client area of the parent form. How the forms arrange themselves depends upon the
value of the TileMode property.
The Tile method applies only to forms that are MDI parent forms (have a FormStyle
property value of fsMDIForm).
Example
This example uses three forms. The first form has its FormStyle property set to MDIForm.
The other two have their FormStyle properties set to MDIChild and their Visible
properties set to True. Add a main menu component and name one of the menu items
TileForms. This is code for the TileFormsClick handler:
procedure TForm1.TileForms1Click(Sender: TObject);
begin
TileMode := tbVertical;
Tile;
end;
When the user chooses the TileForms command, the child forms tile vertically within
the MDI frame form.
See also
ArrangeIcons method, Cascade method, Next method, Previous method
TileMode property
Applies to
TForm component
Declaration
property TileMode: TTileMode;
Run-time only. The TileMode property determines how the child forms within a parent
form arrange themselves when the application calls the Tile method. These are the
possible values the TileMode property can have:
Value Meaning
tbHorizontal Each form stretches across the width of the parent form
tbVertical Each form stretches along the height of the parent form
Setting the TileMode property is meaningful only in an MDI parent form (has a FormStyle
property value of fsMDIForm).
Methods
BeginDrag Hide SendToBack
BringToFront Invalidate SetBounds
ClientToScreen Refresh Show
Dragging Repaint Update
EndDrag ScaleBy
Focused ScreenToClient
Events
OnClick OnDragOver OnMouseMove
OnDblClick OnEndDrag OnMouseUp
OnDragDrop OnMouseDown
Example
This example uses a label and a button on a form. When the user clicks the button, the
current time displays in the caption of the label:
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption := 'The time is ' + TimeToStr(Time);
end;
See also
Date function, DecodeTime procedure, Now function, TimeToStr function
TimeFormat property
Applies to
TMediaPlayer component
Declaration
property TimeFormat: TMPTimeFormats;
Run-time only. The TimeFormat property determines the format used to specify position
information.
TimeFormat determines how the StartPos, Length, Position, Start, and EndPos properties
+
are interpreted. For example, if Position is 180 and TimeFormat is tfMilliseconds, the
current position is 180 milliseconds into the medium. If Position is 180 and TimeFormat is
+
tfMSF, the current position is 180 minutes into the medium. +
Not all formats are supported by every device. If you try to set an unsupported format,
the assignment is ignored. +
The current timing information is always passed in a 4-byte integer. In some formats,
the timing information returned is not really one integer, but single bytes of information +
packed in the long integer.
The following table lists the possible values for the TimeFormat property:
+
Value Time format +
tfMilliseconds
tfHMS
Milliseconds are stored as a 4-byte integer variable.
Hours, minutes, and seconds packed into a 4-byte integer. From least significant to
+
most significant byte, the data values are
Hours (least significant byte)
Minutes
+
tfMSF
Seconds
Unused (most significant byte)
Minutes, seconds, and frames packed into a 4-byte integer. From least significant to
+
most significant byte, the data values are
Minutes (least significant byte) +
+
Seconds
Frames
Unused (most significant byte)
tfFrames
tfSMPTE24
Frames are stored as a 4-byte integer variable.
24-frame SMPTE packs values in a 4-byte variable. From least significant to most +
+
significant byte, the data values are
Hours (least significant byte)
Minutes
Seconds
Frames (most significant byte)
SMPTE (Society of Motion Picture and Television Engineers) time is an absolute time
+
tfSMPTE25
format expressed in hours, minutes, seconds, and frames. The standard SMPTE
division types are 24, 25, and 30 frames per second.
25-frame SMPTE packs data into a 4-byte variable in the same order as 24-frame
+
tfSMPTE30
SMPTE.
30-frame SMPTE packs data into the 4-byte variable in the same order as 24-frame
+
tfSMPTE30Drop
SMPTE.
30-drop-frame SMPTE packs data into the 4-byte variable in the same order as 24-
frame SMPTE.
T
tfBytes Bytes are stored as a 4-byte integer variable.
tfSamples Samples are stored as a 4-byte integer variable.
tfTMSF Tracks, minutes, seconds, and frames are packed in the 4-byte variable. From least
significant to most significant byte, the data values are
Tracks (least significant byte)
Minutes
Seconds
Frames (most significant byte)
Note that MCI uses continuous track numbering.
Note Functions provided with MCI to help you decode the 4-byte integer specified in a given
time format are documented under MCI Macros for Encoding and Decoding Time Data in
the MMSYSTEM.HLP Help file.
Example
The following code declares a HMSRec record with four byte fields. If TimeFormat is
tfHMS, the first field specifies hours, the second field specifies minutes, the third field
specifies seconds, and the fourth field corresponds to the unused most-significant byte
of the tfHMS time format. A LongInt variable is typecast to an HMSRec record, then the
hours, minutes, and seconds of the Length of the loaded media are displayed in labels
when the user clicks a button.
type
HMSRec = record
Hours: byte;
Minutes: byte;
Seconds: byte;
NotUsed: byte;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
TheLength: LongInt;
begin
TimeFormat := tfHMS; { Set time format - note that some devices don’t support tfHMS }
TheLength := MediaPlayer1.Length; { Store length of currently loaded media in var }
with HMSRec(TheLength) do { Typecast TheLength as a HMSRec record }
begin
Label1.Caption := IntToStr(Hours); { Display Hours in Label1 }
Label2.Caption := IntToStr(Minutes); { Display Minutes in Label2 }
Label3.Caption := IntToStr(Seconds); { Display Seconds in Label3 }
end;
end;
Example
This example uses a label and a button on a form. When the user clicks the button, the
current time appears as the caption of the label:
procedure TForm1.Button1Click(Sender: TObject);
begin
Methods
Add ClassType FindIndexForFields
Assign Clear Free
ClassName Create IndexOf
ClassParent Destroy Update
TIndexOptions type DB
Declaration
TIndexOptions = set of (ixPrimary, ixUnique, ixDescending, ixNonMaintained,
ixCaseInsensitive);
The TIndexOptions type is the set of values that can be used in creating a new index. It is
used by the AddIndex method of a dataset component.
TIntegerField component
A TIntegerField component represents a field of a record in a dataset. It is represented as
a binary value with a range from -2,147,483,648 to 2,147,483,647. Use TIntegerField for
fields that hold large, signed whole numbers.
Set the DisplayFormat property to control the formatting of the field for display
purposes, and the EditFormat property for editing purposes. Use the Value property to
access or change the current field value. Set the MinValue or the MaxValue property to
limit the smallest or largest value permitted in a field.
The TIntegerField component has the properties, methods, and events of the TField
component.
Title property
+
Applies to
+
TPrinter object; TApplication, TOpenDialog, TSaveDialog components +
The Title property specifies the text used to title an object, component, or application.
+
For applications T
Declaration
property Title: string;
The Title property determines the text that appears with an icon representing your
application when it is minimized. The default value is the project name (the name of the
project file without the .PRJ file extension).
You can set the title at run time, or you can enter the value of the Title property on the
Application page of the Options|Project Options dialog box.
Example
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.Title := 'My Incredible Application';
end;
See also
Application variable, Caption property, Icon property, Minimize method
Example
This code displays the Open dialog box with the text “Open Pascal files” in its title bar
and lists only Pascal files in the list box:
procedure TForm1.Button1Click(Sender: TObject);
begin
OpenDialog1.Filter := ’Pascal files (*.PAS)|*.PAS’;
OpenDialog1.Title := ’Open Pascal files’;
OpenDialog1.Execute;
end;
Example
This line of code sets the value of the Title property for the printer object:
Printer.Title := ‘My incredible application’;
See also
Printer variable
State Meaning
ssShift The Shift key is held down.
ssAlt The Alt key is held down.
State Meaning
ssCtrl The Ctrl key is held down.
ssLeft The left mouse button is held down.
ssMiddle The middle mouse button is held down.
ssDouble Both the right and left mouse buttons are held down.
Properties
Align FocusControl PopupMenu
Alignment Font ShowAccelChar
AutoSize Height ShowHint
BoundsRect Hint Tag
+
Enabled ParentShowHint
Methods
BeginDrag GetTextLen ScreenToClient
+
BringToFront
ClientToScreen
Hide
Invalidate
SendToBack
SetBounds
+
Dragging
EndDrag
Refresh
Repaint
SetTextBuf
Show
+
GetTextBuf ScaleBy Update
+
Events
+
OnClick
OnDblClick
OnDragOver
OnEndDrag
OnMouseMove
OnMouseUp +
OnDragDrop OnMouseDown
+
TLeftRight type Classes +
Declaration +
TAlignment = (taLeftJustify, taRightJustify, taCenter);
TLeftRight = taLeftJustify..taRightJustify;
+
TLeftRight is the type of the Alignment property of check boxes and radio buttons. +
+
TList object Classes
T
The TList object is used to maintain lists of objects.
The List property is a list of pointers to all the objects in the list. You can access a
particular item referenced in the list using the Items property. To find the position of an
item in the list, use the IndexOf method.
You can add, delete, insert, remove, move, and exchange items in the list using the Add,
Delete, Insert, Remove, Move, and Exchange methods. Use the Count property to determine
how many items are in the list.
Use the First method to move to the beginning of the list, and use the Last method to
move to the end of the list.
The number of items the list can maintain is determined by the value of the Capacity
property. If you need to increase the size of the list, call the Expand method. You can
remove all nil pointers in the list with the Pack method.
In addition to these properties and methods, this object also has the methods that apply
to all objects.
Properties
Capacity Items List
Count
Methods
Add Delete IndexOf
ClassName Destroy Insert
ClassParent Exchange Last
ClassType Expand Pack
Create First Remove
Clear Free
The TListBoxStyle type is the type of the Style property for a list box (TListBox
component).
TLocale type DB
Declaration
TLocale = Pointer;
The TLocale type is the type of a Locale or DBLocale property. These properties are only
used or needed when making direct calls to the Borland Database Engine.
TLoginEvent type DB
Declaration
TLoginEvent = procedure(Database: TDatabase; LoginParams: TStrings) of object;
The TLoginEvent type is the header for the method that handles an OnLogin event for a
TDatabase. The Database parameter is the database. LoginParams is a TStrings object
which holds the username and password, along with any other parameters to be used in
opening the Database. The username is a string of the form ‘USER NAME=John_Doe’.
The password is a string of the form ‘PASSWORD=His_Password’. The OnLogin event
handler should add both the username and password to LoginParams when called.
You can choose to have the menus of one form merge with those of another using the
+
AutoMerge property and the Merge and Unmerge methods. +
In addition to these properties and methods, this component also has the properties and
methods that apply to all components. +
For more information, search for MainMenu component in the online Help, and choose
the topic Using the Main Menu Component. +
Properties +
AutoMerge Items Owner +
ComponentIndex Name Tag
+
Methods
FindItem GetHelpContext Unmerge
+
Free Merge +
See also
ShortCut function, ShortCutToKey procedure, ShortCutToText function, TextToShortCut
+
function, TPopupMenu component +
TMaskEdit component Mask
+
A mask edit box is an much like an ordinary edit box (TEdit component), except you can
+
require the user to enter only valid characters through the use of an EditMask property.
You can also use the mask to format the display of data. +
The text the user enters in the edit box is the value of the Text property, just as it is with
any edit box. The text of the edit box with the mask specified in the EditMask property
+
applied to it is the value of the EditText property.
Your application can tell if the value of Text changes by checking the value of the
+
Modified property. To limit the number of characters users can enter into the mask edit
box, use the MaxLength property.
+
If you want to prevent the user from changing the value of the Text property by typing
in the edit box, set the ReadOnly property to True.
T
You can choose to have the text in a mask edit box automatically selected whenever it
becomes the active control with the AutoSelect property. At run time, you can select all
the text in the edit box with the SelectAll method. To find out which text in the edit box
the user has selected or to replace selected text, use the SelText property. To clear
selected text, call the ClearSelection method. To select only part of the text or to find out
what part of the text is selected, use the SelStart and SelLength properties.
You can cut, copy, and paste text to and from a mask edit box using the CutToClipboard,
CopyToClipboard, and PasteFromClipboard methods.
Your application can display a specified character rather than the actual character typed
into an edit box. If the edit box is used to enter a password, onlookers won’t be able to
read the typed text. Specify the special character with the PasswordChar property.
If you want the edit box to automatically resize to accommodate a change in font size,
use the AutoSize property.
In addition to these properties, methods, and events, this component also has the
properties, methods, and events that apply to all windowed controls.
For more information, search for MaskEdit component in the online Help, and choose
the topic Using the MaskEdit Component.
Properties
Align Height ReadOnly
AutoSelect HelpContext SelLength
AutoSize Hint SelStart
BorderStyle IsMasked SelText
CharCase Left ShowHint
Color MaxLength Showing
ComponentIndex Modified TabOrder
Ctl3D Name TabStop
Cursor Owner Tag
DragCursor Parent Text
DragMode ParentColor Top
EditMask ParentCtl3D Visible
EditText ParentFont Width
Enabled ParentShowHint
Font PasswordChar
Methods
BeginDrag GetSelTextBuf SelectAll
BringToFront GetTextBuf SendToBack
CanFocus GetTextLen SetBounds
Clear Hide SetFocus
ClearSelection Invalidate SetSelTextBuf
ClientToScreen PasteFromClipboard SetTextBuf
CopyToClipboard Refresh Show
CutToClipboard Repaint Update
Dragging ScaleBy ValidateEdit
EndDrag ScreenToClient
Focused ScrollBy
The media player component consists of multiple buttons. These buttons can be clicked
with the mouse, but are not separate objects or button components.
The multimedia device is played, paused, stopped, and so on when the user clicks the
corresponding button on the TMediaPlayer component. The device can also be controlled
by the control methods that correspond to the buttons (Play, Pause, Stop, Next, Previous,
Step, Back, StartRecording, and Eject).
The type of multimedia device (such as dtWaveAudio or dtVideodisc) is specified by the
DeviceType property. If the device stores its media in a file, the name of the media file is
specified by the FileName property. If DeviceType is dtAutoSelect, the media player
attempts to determine the type of device from the extension of the file specified by
FileName.
To open a multimedia device, call the Open method. To have the media player attempt
to open the device specified by DeviceType automatically when the media player
component is created at run time, set the AutoOpen property to True.
In addition to these properties, methods, and events, this component also has the
properties, methods, and events that apply to all windowed controls.
For more information, search for MediaPlayer component in the online Help, and
choose the topic Using the Media Player Component.
Properties
Align ErrorMessage ShowHint
AutoEnable FileName Showing
AutoOpen Frames Start
AutoRewind Height StartPos
BoundsRect HelpContext TabOrder
+
Display NotifyValue Tracks
DisplayRect Owner Visible
+
Enabled Parent VisibleButtons
EnabledButtons ParentShowHint Wait
+
EndPos Position Width
Error Shareable
Methods +
Back
BeginDrag
Hide
Invalidate
Save
ScaleBy
+
BringToFront
CanFocus
Next
Open
ScreenToClient
SendToBack
+
ClientToScreen
Close
Pause
PauseOnly
SetBounds
SetFocus
+
Dragging
Eject
Play
Previous
SetTextBuf
Show
+
EndDrag
Focused
Refresh
Repaint
StartRecording
Step
+
GetTextBuf
GetTextLen
Resume
Rewind
Stop
Update
+
Events +
OnClick OnExit OnPostClick +
OnEnter OnNotify
+
TMemo component StdCtrls T
A TMemo component displays text to the user and permits the user to enter text into the
application much like a TEdit component. The TMemo component permits multiple lines
to be entered or displayed, unlike TEdit.
The text in the memo is the value of the Text property. Your application can tell if the
value of Text changes by checking the value of the Modified property. To limit the
number of characters users can enter into the memo, use the MaxLength property
You can also access the text line by line using the Lines property. If you want to work
with the text as one chunk, use the Text property. If you want to work with individual
lines of text, the Lines property will suit your needs better.
You can add, delete, insert, and move lines in a memo control using the Add, Delete, and
Insert methods of the Lines object, which is of type TStrings. For example, to add a line to
a memo, you could write this line of code:
Memo1.Lines.Add(‘Another line is added’);
You can cut, copy, and paste text to and from a memo control using the CutToClipboard,
CopyToClipboard, and PasteFromClipboard methods.
If you want the user to be able to read the text in the memo but not to change it, set the
ReadOnly property to True.
Several properties affect how the memo appears and how text is entered. You can
choose to supply scroll bars in the memo with the ScrollBars property. If you want the
memo to automatically resize to accommodate a change in font size, use the AutoSize
property. If you want the text to break into lines, set WordWrap to True. If you want the
user to be able to use tabs in the text, set WantTabs to True.
You can choose to have the text in a memo automatically selected whenever it becomes
the active control with the AutoSelect property. At run time, you can select all the text in
the memo with the SelectAll method. To find out which text in the memo the user has
selected, or to replace selected text, use the SelText property. To select only part of the
text or to find out what part of the text is selected, use the SelStart and SelLength
properties.
In addition to these properties, methods, and events, this component also has the
properties, methods, and events that apply to all windowed controls.
For more information, search for Memo component in the online Help, and choose the
topic Using the Memo Component.
Properties
Align Left SelStart
Alignment Lines SelText
BorderStyle MaxLength ShowHint
Color Modified Showing
ComponentIndex Name TabOrder
Ctl3D Owner TabStop
Cursor Parent Tag
DragCursor ParentColor Text
DragMode ParentCtl3D Top
Enabled ParentFont Visible
Font ParentShowHint WantReturns
Height PopupMenu WantTabs
HelpContext ReadOnly Width
HideSelection ScrollBars WordWrap
Hint SelLength
Methods
Assign GetData SaveToFile
AssignValue IsValidChar SaveToStream
Clear LoadFromFile SetData
FocusControl LoadFromStream
Events
OnChange OnSetText OnValidate
OnGetText
When you want to merge menus of one form with those of another, use the GroupIndex
+
property of menu items, and either the AutoMerge property or the Merge and Unmerge
methods of a main menu (TMainMenu).
+
You can insert and delete menu items from a menu at run time with the Insert and +
Remove methods.
In addition to these properties, methods, and events, this component also has the +
properties and methods that apply to all components.
+
Properties
+
+
Break Enabled Owner
Caption GroupIndex Parent
+
Checked HelpContext ShortCut
Command Hint Tag
+
ComponentIndex Items Visible
Count Name
Methods +
Add
Click
IndexOf
Insert
Remove
+
Events
+
OnClick +
See also +
ShortCut function, ShortCutToKey procedure, ShortCutToText function, TextToShortCut
function, TMainMenu component, TPopupMenu component +
+
TMessageEvent type Forms
+
Declaration
TMessageEvent = procedure (var Msg: TMsg; var Handled: Boolean) of object;
T
The TMessageEvent type points to a method that handles the processing of incoming
Windows messages. It is the type of the OnMessage event handler. The Msg parameter
identifies the Windows message, and the Handled parameter determines whether the
message is handled or not.
The height and width in pixels of the metafile are specified by the Height and Width
properties, respectively.
To load a metafile from a file, call the LoadFromFile method. To save a bitmap to a file,
call SaveToFile.
To draw a metafile on a canvas, call the Draw or StretchDraw methods of a TCanvas
object, passing a TMetafile as a parameter.
When the metafile is modified, an OnChange event occurs.
In addition to these properties, methods, and events, this object also has the methods
that apply to all objects.
Properties
Empty Height Width
Handle Inch
Methods
Assign ClassType Free
ClassName Create LoadFromFile
ClassParent Destroy SaveToFile
Events
OnChange
TMethod SysUtils
Declaration
TMethod = record
Code, Data: Pointer;
end;
TMethod declares a record that stores the Code and Data fields as type Pointer.
See also
OnMouseMove event
+
DragMode Parent
Enabled ParentCtl3D
Methods +
BeginDrag
BringToFront
HandleAllocated
HandleNeeded
ScreenToClient
ScrollBy
+
CanFocus
ClientToScreen
Hide
Invalidate
SendToBack
SetBounds
+
CopyToClipboard
Dragging
LoadFromFile
OLEObjAllocated
SetFocus
SetTextBuf
+
EndDrag
Focused
Refresh
Repaint
Show
Update
+
GetTextBuf
GetTextLen
SaveToFile
ScaleBy
+
Events +
OnActivate OnEnter OnMouseDown +
OnDblClick
OnDragDrop
OnExit
OnKeyDown
OnMouseMove
OnMouseUp +
OnDragOver
OnEndDrag
OnKeyPress
OnKeyUp
OnStatusLineEvent
+
+
TOLEDropNotify object Toctrl
+
The TOLEDropNotify object is the type of the Source parameter of the OnDragDrop event
of a form when an OLE object is dropped on it. To accept dropped objects, a form must
be registered with the RegisterFormAsOLEDropTarget procedure.
T
In order to use the Source object as a TOLEDropNotify object, Source must be typecast as a
TOLEDropNotify object.
The DataFormat property specifies the Clipboard format of the dropped object. The
DataHandle property specifies a handle to the dropped data.
The PInitInfo property corresponds to the PInitInfo property of a TOLEContainer
component. If the dropped object is an OLE object, PInitInfo points to an OLE
initialization information structure for the OLE object. To initialize an OLE container,
assign the value of the PInitInfo property of a TOLEDropNotify object to the PInitInfo
property of a TOLEContainer component.
In addition to these properties and methods, this object also has the methods that apply
to all objects.
Properties
DataFormat DataHandle PInitInfo
Methods
ClassName ClassType Destroy
ClassParent Create Free
Top property
Applies to
All controls; TFindDialog, TReplaceDialog components
Declaration
property Top: Integer;
The Top property determines the y coordinate of the top left corner of a control, relative
to the form in pixels. For forms, the value of the Top property is relative to the screen in
pixels.
For the Find and Replace dialog boxes, Top is a run-time only property. The default
value is -1.
Example
The following code moves a button 10 pixels up each time a user clicks it:
procedure TForm1.Button1Click(Sender: TObject);
begin
Button1.Top := Button1.Top - 10;
end;
See also
Left property, SetBounds method
ToPage property
Applies to
TPrintDialog component
Declaration
property ToPage: Integer;
The value of the ToPage property determines on which page the print job ends. The
+
default value is 0, which means no ending page is specified. +
Example
This example uses a print dialog box on a form. The code sets up the print dialog box so
+
that when it appears, the default values of 1 and 1 are the default starting and ending
values for the Pages From and To edit boxes:
+
PrintDialog1.Options := [poPageNums];
PrintDialog1.FromPage := 1;
+
PrintDialog1.ToPage := 1;
+
See also
FromPage property, Options property
+
+
TOpenDialog component Dialogs
+
The TOpenDialog component makes an Open dialog box available to your application.
The purpose of the dialog box is to let a user specify a file to open. Use the Execute +
method to display the Open dialog box.
When the user chooses OK in the dialog box, the user’s file name selection is stored in
+
the dialog box’s FileName property, which you can then use to process as you want.
You can let the user decide which files to make visible in the list box of the Open dialog
+
box with the Filter property. The user can then use the List Files of Type combo box to
determine which files display in the list box. You set the default filter using the
+
FilterIndex property.
You can permit the user to choose multiple file names with the Options property so that
+
the Files property contains a list of all the selected file names in the list box. You can
customize how the Open dialog box appears and behaves with the Options property.
+
If you want a file extension automatically appended to the file name typed in the File
Name edit box of the Open dialog box, use the DefaultExt property.
+
In addition to these properties and methods, this component also has the properties and +
methods that apply to all components.
For more information, search for OpenDialog component in the online Help, and choose
T
the topic Using the Open Dialog Component.
Properties
ComponentIndex Filter Options
Ctl3D FilterIndex Owner
DefaultExt HelpContext Tag
FileEditStyle HistoryList Title
FileName InitialDir
Files Name
Methods
Execute
TOpenOptions type
Declaration
TOpenOption = (ofReadOnly, ofOverwritePrompt, ofHideReadOnly, ofNoChangeDir,
ofShowHelp, ofNoValidate, ofAllowMultiSelect, ofExtensionDifferent,
ofPathMustExist, ofFileMustExist, ofCreatePrompt, ofShareAware, ofNoReadOnlyReturn,
ofNoTestFileCreate);
TOpenOptions = set of TOpenOption;
The TOpenOptions type contains the set of values the Options property of the Open
dialog box (TOpenDialog) can assume.
TopIndex property
Applies to
TDirectoryListBox, TFileListBox, TListBox components
Declaration
property TopIndex: Integer;
The TopIndex property is the index number of the item that appears at the top of the list
box. You can use the TopIndex property to determine which item is the first item
displayed at the top of the list box and to set it to the item of your choosing.
Example
This example uses a list box containing a list of strings, a button, and an edit box on a
form. When the user runs the application and clicks the button, the third item in the list
becomes the first item, and the index value of that item appears in the edit box. The
index value displayed is 2, indicating the third item in the list (the first item in the list
has an index value of 0):
procedure TForm1.FormCreate(Sender: TObject);
var
Number: Integer;
begin
for Number := 1 to 20 do
ListBox1.Items.Add('Item ' + IntToStr(Number));
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ListBox1.TopIndex := 2;
Edit1.Text := IntToStr(ListBox1.TopIndex);
See also
Level property +
TopRow property +
Applies to
+
TDrawGrid, TStringGrid components +
Declaration T
property TopRow: Longint;
Run-time only. The TopRow property determines which row in the grid appears at the
top of the grid.
If you have one or more nonscrolling rows in the grid, they remain at the top, regardless
of the value of the TopRow property. In this case, the row you specify as the top row will
be the first row below the nonscrolling rows.
Example
This code uses a string grid and a button on a form. When the user clicks the button, the
last row of the string grid becomes the top row:
procedure TForm1.Button1Click(Sender: TObject);
begin
StringGrid1.TopRow := StringGrid1.RowCount;
end;
See also
FixedRows property, LeftCol property, OnTopLeftChange event
Properties
Data Index Text
Expanded IsVisible TopItem
FullPath Level
HasItems Parent
The TOwnerDrawState type defines the possible values for the State parameter in the
TDrawItemEvent method pointer of an owner-draw list box.
Properties
Align Font ParentShowHint
BoundsRect Height PopupMenu
Canvas Hint ShowHint
ComponentIndex Left Tag
Color Name Top
Cursor Owner Visible
DragCursor Parent Width
DragMode ParentColor
Enabled ParentFont
Methods
BeginDrag GetTextBuf SendToBack
BringToFront GetTextLen SetBounds
ClientToScreen Invalidate SetTextBuf
Dragging Refresh Update
EndDrag Repaint
Focused ScreenToClient
Events
OnClick OnDragOver OnMouseUp
OnDblClick OnMouseDown OnPaint
OnDragDrop OnMouseMove
Methods
BeginDrag GetTextBuf ScaleBy
BringToFront GetTextLen ScreenToClient
CanFocus Hide ScrollBy
ClientToScreen InsertComponent SendToBack
Events
OnClick OnDragOver OnMouseMove
OnDblClick OnEndDrag OnMouseUp
OnDragDrop OnMouseDown OnResize
TParam object
The TParam object holds information about a parameter of a TQuery or TStoredProc. In
addition to the parameter value, TParam stores the field type, name, and (for a stored
procedure) the parameter type.
You generally do not need to create a TParam explicitly, since TQuery or TStoredProc will
create it as an element of its Params property as needed. All you have to do is assign
values to the parameters by assigning one of the properties: AsBCD, AsBoolean,
AsCurrency, AsDate, AsDateTime, AsFloat, AsInteger, AsSmallint, AsString, AsTime, or
AsWord.
In addition to these properties and methods, this object also has the methods that apply
to all objects.
Properties
AsBCD AsInteger IsNull
AsBoolean AsSmallInt Name
AsCurrency AsString ParamType
AsDate AsTime Text
AsDateTime AsWord
AsFloat DataType
TPasswordEvent type DB
Declaration
TPasswordEvent = procedure(Sender: TObject; var Continue: Boolean);
The TPasswordEvent type is the header for the procedure that handles a password
exception event. The value of Sender is the TSession component of the DB unit. Continue
determines whether the caller will make another attempt to access the database. The
procedure should add any available additional passwords and set Continue to True. If
there are no additional passwords available, set Continue to False. TPasswordEvent is
used by the OnPassword event
Properties
Color Mode Width
Handle Style
Methods
Assign ClassType Free
ClassName Create
ClassParent Destroy
Properties
Bitmap Height Metafile
Graphic Icon Width
Methods
Assign ClassType Free
ClassName Create LoadFromFile
ClassParent Destroy SaveToFile
Events
OnChange
The items on the pop-up menu are specified with the Items object, a property of a pop-
+
up menu. The Items object is of type TMenuItem. Your application can use the Items
property to access a particular item on the menu.
+
If you want the pop-up menu to appear when the user clicks the right mouse button on +
the control to which the pop-up menu is assigned, set the AutoPopup property to True. If
you want to use code to control when a pop-up menu appears, use the Popup method. +
Pop-up menus have an OnPopup event handler you can use to specify special processing
you want to occur in your application just before a pop-up menu appears. +
In addition to these properties, methods, and events, this component also has the
properties and methods that apply to all components.
+
For more information, search for PopupMenu component in the online Help, and
choose the topic Using the Popup Menu Component.
+
Properties
+
Alignment Components Name
+
AutoPopup
ComponentCount
Handle
HelpContext
Owner
PopupComponent
+
ComponentIndex Items Tag
+
Methods
+
FindComponent
FindItem
Free Popup
+
Events +
OnPopup +
See also
ShortCut function, ShortCutToKey procedure, ShortCutToText function, TextToShortCut
+
function, TMainMenu component, TMenuItem component +
TPosition type Forms
T
Declaration
TPosition = (poDesigned, poDefault, poDefaultPosOnly, poDefaultSizeOnly, poScreenCenter);
The TPosition type enumerates the values the Position property of a form can have.
Properties
Collate MaxPage PrintRange
ComponentIndex MinPage PrintToFile
Copies Name Tag
FromPage Options ToPage
HelpContext Owner
Methods
Execute
Methods
Abort ClassType GetPrinter
BeginDoc Create NewPage
ClassName Destroy SetPrinter
ClassParent EndDoc
Properties
ComponentIndex Name Tag
HelpContext Owner
Methods
Execute
The TPrintRange type defines the values the PrintRange property can have in the Print
+
dialog box (TPrintDialog). +
TPrintScale type Forms
+
Declaration
+
TPrintScale = (poNone, poProportional, poPrintToFit); +
The TPrintScale type defines the possible values of the PrintScale property of the form.
+
TQuery component DBTables +
TQuery enables Delphi applications to issue SQL statements to a database engine--either +
the BDE or an SQL server. TQuery provides the interface between an SQL server (or the
BDE) and TDataSource components. TDataSource components then provide the interface
to data-aware controls such as TDBGrid.
+
Set the DatabaseName property to specify the database to query. Enter a single SQL +
statement to execute in the SQL property. To query dBASE or Paradox tables, use local
SQL. To query SQL server tables, use passthrough SQL. The SQL statement can be a
static SQL statement or a dynamic SQL statement.
+
At run time, an application can supply parameter values for dynamic queries with the +
Params property, the ParamByName method, or the DataSource property. Use the Prepare
method to optimize a dynamic query. +
A result set is the group of records returned by a query to an application. A TQuery can
return two kinds of result sets: +
• “Live” result sets: As with TTable components, users can edit data in the result set
with data controls. The changes are sent to the database when a Post occurs, or when
+
the user tabs off a control.
• “Read only” result sets: Users cannot edit data in the result set with data controls.
+
If you want the query to provide a live result set, the SQL must conform to certainsyntax +
requirements. If the SQL syntax does not conform to these requirements, the query will
provide a read-only result set. T
Execute the SQL statement at design time by setting the Active property to True . Execute
the SQL statement at run time with the Open or ExecSQL methods.
Call the First, Next, Prior, Last, and MoveBy methods to navigate through the result set.
Test the BOF and EOF properties to determine if the cursor is at the beginning or end of
the result set, respectively.
Call the Append, Insert, AppendRecord or InsertRecord methods to add a record to the
underlying database table. Call the Delete method to delete the current record. Call the
Edit method to allow modification of the fields of the current record, and Post to post the
changes or Cancel to discard them.
In addition to these properties, methods, and events, this component also has the
properties and methods that apply to all components.
Properties
Active FieldDefs RecordCount
AutoCalcFields Fields RequestLive
BOF Handle SQL
CanModify Local SQLBinary
Database Locale State
DatabaseName Modified StmtHandle
DataSource Name Tag
DBHandle Owner Text
DBLocale ParamCount UniDirectional
EOF Params UpdateMode
FieldCount Prepared
Methods
Append FieldByName Open
AppendRecord FindField ParamByName
Cancel First Post
CheckBrowseMode FreeBookmark Prepare
ClearFields GetBookmark Prior
Close GetFieldNames Refresh
CursorPosChanged GotoBookmark SetFields
Delete Insert UnPrepare
DisableControls InsertRecord UpdateCursorPos
Edit Last UpdateRecord
EnableControls MoveBy
ExecSQL Next
Declaration
property TrackLength[TrackNum: Integer]: Longint;
Run-time and read only. The TrackLength property reports the length of the track
specified by the TrackNum index. The value of TrackLength is specified according to the
current time format, which is specified in the TimeFormat property.
Example
The following code shows the length of the currently playing .WAV audio file
(CARTOON.WAV in this example) in the Caption of a label.
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
with MediaPlayer1 do begin
TimeFormat := tfMilliseconds;
DeviceType := dtWaveAudio;
FileName := 'cartoon.wav';
Open;
Label1.Caption := IntToStr(TrackLength[1]);
end;
end;
See also
Length property, TrackPosition property, Tracks property
TrackPosition property
Applies to
TMediaPlayer component
Declaration
property TrackPosition[TrackNum: Integer]: Longint;
Run-time and read only. The TrackPosition property reports the starting position of the
track specified by the TrackNum index. The value of TrackPosition is specified according
to the current time format, which is specified in the TimeFormat property.
Example
The following code shows the starting position of the first track of the currently loaded
audio CD in the Caption of a label.
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
with MediaPlayer1 do begin
TimeFormat := tfMilliseconds;
DeviceType := dtCDAudio;
Open;
Label1.Caption := IntToStr(TrackPosition[1]);
end;
end;
See also
Position property, TrackLength property, Tracks property
For more information, search for RadioButton component in the online Help, and
choose the topic Using the Radio Button Component.
Properties
Align Font ParentFont
Alignment Handle ParentShowHint
Caption Height PopupMenu
Checked HelpContext ShowHint
Color Hint Showing
ComponentIndex Left TabOrder
Ctl3D Name TabStop
Cursor Owner Tag
DragCursor Parent Top
DragMode ParentColor Visible
Enabled ParentCtl3D Width
Methods
BeginDrag GetTextLen SendToBack
BringToFront Hide SetBounds
CanFocus Invalidate SetFocus
ClientToScreen Refresh SetTextBuf
Dragging Repaint Show
EndDrag ScaleBy Update
Focused ScreenToClient
GetTextBuf ScrollBy
Events
OnClick OnEnter OnMouseDown
OnDblClick OnExit OnMouseMove
OnDragDrop OnKeyDown OnMouseUp
OnDragOver OnKeyPress
OnEndDrag OnKeyUp
See also
TDBRadioGroup component
The radio buttons are added to the group box when strings are entered as the value of
+
the Items property. Each string in Items makes a radio button appear in the group box
with the string appearing as the caption of the radio button. The value of the ItemIndex
+
property determines which radio button is currently selected. +
You can choose to display the radio buttons in a single column or in multiple columns
by setting the value of the Columns property. +
When the user selects a radio button in the radio button group box, the previously
selected radio button is unselected automatically. +
You can place other types of controls in a radio group box besides radio buttons.
In addition to these properties, methods, and events, this component also has the
+
properties, methods, and events that apply to all windowed controls. +
For more information, search for RadioGroup in the online Help, and choose the topic
Using the RadioGroup Component. +
Properties +
Align
Caption
Height
HelpContext
ParentShowHint
PopupMenu
+
Color
Columns
Hint
Items
ShowHint
Showing
+
ComponentIndex
Ctl3D
ItemIndex
Left
TabOrder
TabStop
+
Cursor
DragCursor
Name
Owner
Tag
Top
+
DragMode
Enabled
Parent
ParentColor
Visible
Width
+
Font
Handle
ParentCtl3D
ParentFont
+
Methods
+
BeginDrag Focused ScreenToClient
+
BringToFront
CanFocus
GetTextBuf
GetTextLen
ScrollBy
SendToBack
T
ClientToScreen Hide SetBounds
ContainsControl Invalidate SetFocus
Dragging Refresh SetTextBuf
EndDrag Repaint
FindComponent ScaleBy
Events
OnClick OnDragOver OnEnter
OnDragDrop OnEndDrag OnExit
See also
TDBRadioGroup component, TGroupBox component, TRadioButton component
TransIsolation property
Applies to
TDataBase component
Declaration
property TransIsolation: TTransIsolation;
The TransIsolation property specifies the transaction isolation level used by an SQL
server. tiDirtyRead causes any change to be returned, regardless of whether the record
has been committed. tiReadCommitted will return only committed versions of the record;
uncommitted changes will not be reflected in the result. tiRepeatableRead will return only
the original record for the duration of the transaction, even if another application has
committed a change.
Database servers may support these isolation levels differently or not at all. If the
requested isolation level is not supported by the server, then Delphi will use the next
highest isolation level, as shown in the following table. For a detailed description of how
each isolation level is implemented, see your server documentation.
Sybase and
TransIsolation Microsoft SQL
setting Oracle servers Informix InterBase
Dirty read Read committed Read committed Dirty Read Read committed
Read committed Read committed Read committed Read committed Read committed
(Default)
Repeatable read Repeatable read Read committed Repeatable Read Repeatable Read
(READ ONLY)
Example
Database1.TransIsolation := tiReadCommitted;
Transliterate property
Applies to
TBatchMove, TMemoField, TStringField component
Declaration
property Transliterate: Boolean;
The Transliterate property controls whether translations to and from the respective
+
locales of the Source and Destination properties will be done. Transliterate is True by
default.
+
Example
+
{ Suppress translations }
BatchMove1.Transliterate := False;
+
See also
+
DBLocale property +
Transparent property +
Applies to
+
TLabel, TDBText components +
Declaration +
+
property Transparent: Boolean;
The Transparent property determines if a label or database text control is transparent.
You could place a transparent label or text control on top of a bitmap, and the control
won’t hide part of the bitmap. For example, if you have placed a bitmap of the world on +
a form, you could label the South American continent with a label control, and you
would still see the continent in the label space. +
Example
This code makes a label transparent:
+
Label1.Transparent := True; +
See also +
BorderStyle property
+
TRect type WinTypes T
Declaration
TRect = record
case Integer of
0: (Left, Top, Right, Bottom: Integer);
1: (TopLeft, BottomRight: TPoint);
end;
The TRect type defines a rectangle. The coordinates are specified either as four separate
integers representing the pixel locations of the left, top, right, and bottom sides, or as
two points representing the pixel locations of the top left and bottom right corners. The
origin of the pixel coordinate system is in the top left corner of the screen.
Properties
ComponentIndex HelpContext Owner
Ctl3D Name ReplaceText
FindText Options Tag
Methods
CloseDialog Execute
Events
OnFind OnReplace
Methods
CloseApplication Print RunMacro
CloseReport RecalcReport SetVariable
Connect Run SetVariableLines
Example
var
S, T: string;
begin
Str(1.4:2:1, T);
S := T + ' Truncs to ' + IntToStr(Trunc(1.4)) + #13#10;
Str(1.5:2:1, T);
S := S + T + ' Truncs to ' + IntToStr(Trunc(1.5)) + #13#10;
Str(-1.4:2:1, T);
S := S + T + ' Truncs to ' + IntToStr(Trunc(-1.4)) + #13#10;
Str(-1.5:2:1, T);
S := S + T + ' Truncs to ' + IntToStr(Trunc(-1.5));
MessageDlg(S, mtInformation, [mbOk], 0);
end;
See also
Int function, Round function
Truncate method
Applies to
TBlobStream object
Declaration
procedure Truncate;
The Truncate method discards all data in the TBlobField, TBytesField or TVarBytesField
+
from the current position. +
Example +
{ Discard all data after the first 1000 bytes }
with BlobStream1 do
begin
+
Seek(0, 1000);
Truncate;
+
end;
+
Truncate procedure System +
Declaration +
procedure Truncate(var F);
The Truncate procedure deletes all records in the file after the current file position F. The
+
current file position also becomes end-of-file (Eof(F) is True). +
F is a file variable of any type. Truncate does not work on text files. F must be open.
{$I+} lets you handle run-time errors using exceptions. For more information on
+
handling run-time library exceptions, see Handling RTL Exceptions in the Help system.
If you are using {$I–}, you must use IOResult to check for I/O errors.
+
Example
+
uses WinCRT; +
var
f: file of Integer; +
i,j: Integer;
begin
AssignFile(f,'TEST.INT');
+
Rewrite(f);
for i := 1 to 6 do
+
Write(f,i);
Writeln('File before truncation:'); T
Reset(f);
while not Eof(f) do
begin
Read(f,i);
Writeln(i);
end;
Reset(f);
for i := 1 to 3 do
Read(f,j); { Read ahead 3 records }
Truncate(f); { Cut file off here }
Writeln;
Writeln('File after truncation:');
Reset(f);
while not Eof(f) do
begin
Read(f,i);
Writeln(i);
end;
CloseFile(f);
Erase(f);
end;
See also
Reset procedure, Rewrite procedure, Seek procedure
Properties
ComponentIndex Filter Options
Ctl3D FilterIndex Owner
DefaultExt HelpContext Tag
FileEditStyle HistoryList Title
FileName InitialDir
Files Name
Events
OnActiveControlChange OnActiveFormChan
ge
Properties
Align Kind Position
ComponentIndex LargeChange ShowHint
Ctl3D Left Showing
Cursor Max SmallChange
DragCursor Min TabOrder
DragMode Name TabStop
Enabled Owner Tag
Handle Parent Top
Height ParentCtl3D Visible
HelpContext ParentShowHint Width
Hint PopupMenu
Methods
BeginDrag GetTextLen SetBounds
BringToFront Hide SetFocus
CanFocus Invalidate SetParams
ClientToScreen Refresh SetTextBuf
Dragging Repaint Show
EndDrag ScaleBy Update
You determine the behavior of the horizontal and vertical scroll bars on the scroll box by
setting the properties of the HorzScrollBar and VertScrollBar objects, which are properties
of a scroll box.
To assure that a particular control on the scroll box is in view, use the ScrollInView
method.
In addition to these properties, methods, and events, this component also has the
properties, methods, and events that apply to all windowed controls.
Properties
Align Enabled ParentShowHint
BorderStyle Font PopupMenu
Brush Height ShowHint
Color HelpContext Showing
ComponentCount Hint TabOrder
ComponentIndex HorzScrollBar TabStop
Components Left Tag
ControlCount Name Top
Controls Owner VertScrollBar
Ctl3D Parent Visible
Cursor ParentColor Width
DragCursor ParentCtl3D
DragMode ParentFont
Methods
BeginDrag GetTextLen ScrollBy
BringToFront Hide ScrollInView
CanFocus InsertComponent SendToBack
ClientToScreen InsertControl SetBounds
ContainsControl Invalidate SetFocus
Dragging Refresh SetTextBuf
EndDrag RemoveComponent Show
FindComponent Repaint Update
Focused ScaleBy
GetTextBuf ScreenToClient
Events
OnClick OnEndDrag OnMouseMove
OnDblClick OnEnter OnMouseUp
OnDragDrop OnExit OnResize
OnDragOver OnMouseDown
The TScrollStyle type defines the different combinations of scroll bars a memo control or
a grid can have. TScrollStyle is the type of the ScrollBars property of TMemo, TDBMemo,
TDrawGrid, and TStringGrid.
To test for an attribute, combine the value of the Attr field with the attribute constant
with the and operator. If the file has that attribute, the result will be greater than 0. For
example, if the found file is a hidden file, the following expression will evaluate to True:
(SearchRec.Attr and faHidden > 0).
Time contains the time stamp of the file. Size contains the size of the file in bytes. Name
contains the DOS file name and extension.
The TSectionEvent type is used by the OnSized and OnSizing events of the THeader
+
component. The index of the header section being resized is passed in the ASection
parameter, and its width in pixels is passed in the AWidth parameter.
+
+
TSelectCellEvent type Grids +
Declaration +
+
TSelectCellEvent = procedure (Sender: TObject; Col, Row: Longint; var CanSelect: Boolean) of
object;
The TSelectEvent type points to a method that handles the selecting of a cell in a draw
grid (TDrawGrid) or string grid (TStringGrid). The Col and Row parameters specify the
column and row of the selected cell. The value of the CanSelect parameter determines
+
whether the user can successfully select the cell in the grid. +
TSelectEvent is the type of the OnSelectCell event of the draw and string grid
components. +
TSelectDirOpts type
+
FileCtrl
+
Declaration
TSelectDirOpt = (sdAllowCreate, sdPerformCreate, sdPrompt); +
TSelectDirOpts = set of TSelectDirOpt; +
The TSelectDirOpts type defines the possible values of the Options parameter in the
SelectDirectory function. +
TSession component
+
You cannot see nor explicitly create a TSession component, but you can use its methods
+
and properties to globally affect an application. Delphi creates a TSession component
named Session each time an application runs. Do not attempt to create any other TSession
+
or destroy and recreate Session itself.
TSession provides global control over database connections for an application. The
T
Databases property of TSession is an array of all the active databases in the session. The
DatabaseCount property is an integer specifying the number of active databases in the
Session.
KeepConnections is a Boolean property that specifies whether to keep inactive database
connections for temporary TDatabase components. The DropConnections method will
drop all inactive database connections.
The NetFileDir property specifies the directory path of the BDE network control
directory. The PrivateDir property specifies the path of the directory in which to store
temporary files.
In addition to these properties, methods, and events, this component also has the
properties and methods that apply to all components.
Properties
DatabaseCount Locale PrivateDir
Databases Name Tag
Handle NetFileDir
KeepConnections Owner
Methods
AddPassword GetAliasParams GetTableNames
CloseDatabase GetDatabaseNames GetStoredProcNames
DropConnections GetDriverNames OpenDatabase
FindDatabase GetDriverParams RemoveAllPassword
s
GetAliasNames GetPassword RemovePassword
Events
OnPassword
Description
The TSetEditEvent type points to a method that handles the changes the user makes to
the text in a cell in a draw grid (TDrawGrid) or string grid (TStringGrid). The ACol
parameter specifies the column of the cell, and the ARow parameter specifies the row of
the cell. The Text parameter is the text string the editor has changed.
TSetEditEvent is the type of the OnSetEditText event of the draw and string grid
components.
The TShapeType type is used by the Shape property of the TShape component to
determine if the TShape component appears as a rectangle, square, rounded rectangle,
rounded square, ellipse, or circle.
See also
TKeyEvent type, TMouseEvent type
The HintColor field of the record contains the name of the control for which hint
+
processing is occurring. +
The HintPos field determines the default position in screen coordinates of the top-left
corner of the hint window. You can change where the window appears by changing this +
value.
The HintMaxWidth field determines the maximum width of the hint window before +
word wrapping begins. By default, the value is the width of the screen (Screen.Width).
The CursorRect field determines the rectangle the user’s mouse pointer must be in for the
+
hint window to appear. The default value for CursorRect is the client rectangle of the
control. Your application can change this value so that a single control can divided into
+
several hint regions. When the user moves the mouse pointer moves outside the
rectangle, the hint window disappears. +
The CursorPos field contains the location of the mouse pointer within the control.
+
TSmallintField component +
A TSmallintField represents a field of a record in a dataset. It is represented as a binary +
value with a range from –32,768 to 32,767. Use TSmallintField for fields that hold signed
whole numbers. +
Set the DisplayFormat property to control the formatting of the field for display
purposes, and the EditFormat property for editing purposes. Use the Value property to
+
access or change the current field value. Set the MinValue or the MaxValue property to
limit the smallest or largest value permitted in a field. +
The TSmallintField component has the properties, methods, and events of the TField
component.
+
Properties
+
Alignment DisplayFormat IsNull +
AsBoolean
AsDateTime
DisplayLabel
DisplayName
MaxValue
MinValue +
AsFloat
AsInteger
DisplayText
DisplayWidth
Name
Owner T
AsString EditFormat ReadOnly
Calculated EditMask Required
CanModify EditMaskPtr Size
DataSet FieldName Tag
DataSize FieldNo Text
DataType Index Value
AsFloat IsIndexField Visible
Methods
Assign FocusControl SetData
AssignValue GetData
Clear IsValidChar
Events
OnChange OnSetText OnValidate
OnGetText
Properties
Align GroupIndex ParentFont
AllowAllUp Height ParentShowHint
BoundsRect Hint ShowHint
Caption Layout Showing
ComponentIndex Left Spacing
Cursor Margin Tag
Down Name Top
Enabled NumGlyphs Visible
A stored procedure can return either a singleton result or a result set with a cursor, if the
server supports it. Execute a stored procedure with the ExecProc method, if the stored
procedure returns a singleton result (one row), or Open method, if the stored procedure
returns a result set (multiple rows).
In addition to these properties, methods, and events, this component also has the
properties and methods that apply to all components.
Properties
Active FieldDefs Params
AutoCalcFields Fields Prepared
BOF Handle RecordCount
CanModify Locale State
Database Modified StmtHandle
DatabaseName Name StoredProcName
DBHandle Owner Tag
DBLocale Overload UpdateMode
EOF ParamBindMode
FieldCount ParamCount
Methods
Append ExecProc Next
AppendRecord FieldByName Open
Cancel FindField ParamByName
CheckBrowseMode First Post
ClearFields FreeBookmark Prepare
Close GetBookmark Prior
CopyParams GetFieldNames Refresh
CursorPosChanged GetResults SetFields
Delete GotoBookmark UnPrepare
DescriptionsAvailabl Insert UpdateCursorPos
e
DisableControls InsertRecord UpdateRecord
Edit Last
EnableControls MoveBy
Events
AfterCancel AfterPost BeforeOpen
AfterClose BeforeCancel BeforePost
AfterDelete BeforeClose OnCalcFields
AfterEdit BeforeDelete OnNewRecord
AfterInsert BeforeEdit
AfterOpen BeforeInsert
All the strings and their associated objects for a particular column can be accessed using
the Cols property. The Rows property gives you access to all the strings and their
associated objects for a particular row.
In addition to these properties, methods, and events, this component also has the
properties, methods, and events that apply to all windowed controls.
For more information, search for StringGrid component in online Help, and choose the
topic Using the String Grid Component.
Properties
Align DefaultRowHeight ParentColor
BorderStyle DragCursor ParentCtl3D
BoundsRect DragMode ParentFont
Canvas EditorMode ParentShowHint
Cells Enabled PopupMenu
ClientHeight FixedColor Row
ClientOrigin FixedCols RowCount
ClientRect FixedRows RowHeights
ClientWidth Font Rows
Col GridHeight ScrollBars
ColCount GridLineWidth Selection
Color GridWidth ShowHint
Cols Handle Showing
ColWidths Height TabOrder
ComponentCount HelpContext TabStop
ComponentIndex Hint TabStops
Components Left Tag
ControlCount LeftCol Top
Controls Name TopRow
Ctl3D Objects Visible
Cursor Options VisibleColCount
DefaultColWidth Owner VisibleRowCount
DefaultDrawing Parent Width
Methods
BeginDrag GetTextBuf ScaleBy
BringToFront GetTextLen ScreenToClient
CanFocus Hide SendToBack
CellRect Invalidate SetBounds
ClientToScreen MouseToCell SetFocus
Dragging Refresh SetTextBuf
EndDrag RemoveComponent Show
Focused Repaint Update
Properties
Count Objects Strings
Duplicates Sorted Values
Methods
Add Clear Insert
AddObject Delete InsertObject
AddStrings EndUpdate LoadFromFile
Assign Exchange SaveToFile
BeginUpdate Free SetText
ClassName GetText Sort
ClassParent IndexOf
ClassType IndexOfObject
Events
OnChange
In addition to these properties and methods, this object also has the methods that apply
+
to all objects. +
Properties +
Count
Objects
Strings Values
+
Methods
+
Add Clear Insert +
AddObject
AddStrings
Delete
Exchange
InsertObject
LoadFromFile +
Assign
BeginUpdate
EndUpdate
Free
Move
SaveToFile +
ClassName
ClassParent
GetText
IndexOf
SetText
+
ClassType IndexOfObject
+
TSymbolStr type DB +
Declaration +
TSymbolStr = string[DBIMAXNAMELEN];
The TSymbolStr type is the type of a string of the correct length for a database object
+
name, such as a Locale property, a field name, or a password. +
TTabbedNotebook component TabNotBk
+
The TTabbedNotebook component contains multiple pages, each with its own set of
+
controls. The user selects a page by clicking the page’s tab that appears at the top of the
control. +
The pages available in the tabbed notebook control are the strings specified as the value
of the Pages property. You can access a particular page in the notebook either with the
T
PageIndex property or the ActivePage property.
At run time, you can change the active page in the tabbed notebook with the SetTabFocus
method. If you need to determine the PageIndex value of a particular page, call the
GetIndexForPage method.
You determine how many tabs appear in a row by setting the TabsPerRow property. If
there are more pages than there are tabs in one row, multiple rows automatically appear
in the control. You can specify the font of the text on the tabs with the TabFont property.
In addition to these properties, methods, and events, this component also has the
properties, methods, and events that apply to all windowed controls.
Properties
ActivePage Handle Parent
Align Height TabOrder
BoundsRect HelpContext TabsPerRow
ComponentIndex Hint TabStop
ControlCount Left Tag
Controls Name Top
Cursor Owner Visible
Enabled PageIndex Width
Font Pages
Methods
BeginDrag GetTextBuf ScrollBy
BringToFront GetTextLen SendToBack
CanFocus Hide SetBounds
ClientToScreen InsertControl SetFocus
ContainsControl Invalidate SetTabFocus
Dragging Refresh SetTextBuf
EndDrag Repaint Show
Focused ScaleBy Update
GetIndexForPage ScreenToClient
Events
OnEnter OnExit
Methods
AddIndex EditKey GotoNearest
ApplyRange EditRangeEnd Insert
Events
AfterCancel AfterPost BeforeOpen
AfterClose BeforeCancel BeforePost
AfterDelete BeforeClose OnCalcFields
AfterEdit BeforeDelete OnNewRecord
AfterInsert BeforeEdit
AfterOpen BeforeInsert
Then, in the OnClick event handler of the tab set control, this line of code changes the
+
current page in the notebook control when the user clicks a tab: +
Notebook1.PageIndex := TabSet1.TabIndex;
To determine which tab is currently selected or to use code to select a tab, use the
+
TabIndex property. To find out which tab is the first visible tab in the tab set control or to
make a tab the first visible tab, use the FirstIndex property. +
Several properties affect the appearance of the tab set control. Tabs are usually
displayed at the bottom of a form. To display the tabs at the bottom of the form, choose
+
alBottom as the Align property value. Set the SelectedColor and UnselectedColor properties
to help the user tell the difference between a selected and an unselected tab. The +
BackgroundColor and the DitherBackground properties determine how the background of
the tab set appears. You can determine how far from the edge of the control the tabs are +
positioned with the StartMargin and EndMargin properties. If you want scroll buttons to
appear automatically when the tab set control doesn’t have enough room to display all
the tabs, set AutoScroll to True.
+
You can display graphics on tabs as well as text. Use the Style property select an owner- +
draw tab style.
In addition to these properties, methods, and events, this component also has the
+
properties, methods, and events that apply to all windowed controls.
For more information, search for TabSet component in online Help, and choose the topic
+
Using the TabSet Component.
+
Properties +
Align
AutoScroll
Height
HelpContext
Style
TabHeight +
BackgroundColor
Canvas
Hint
Left
TabIndex
Tabs +
ComponentIndex
Cursor
Name
Owner
Tag
Top +
DitherBackground
DragMode
Parent
ParentShowHint
UnselectedColor
Visible +
Enabled
EndMargin
SelectedColor
ShowHint
VisibleTabs
Width T
FirstIndex Showing
Font StartMargin
Methods
BeginDrag GetTextLen ScreenToClient
BringToFront Hide ScrollBy
CanFocus Invalidate SelectNext
ClientToScreen ItemAtPos SendToBack
Dragging ItemRect SetBounds
Events
OnChange OnDragOver OnEnter
OnClick OnDrawTab OnExit
OnDragDrop OnEndDrag OnMeasureTab
Methods
Assign FocusControl SetData
AssignValue GetData
Clear IsValidChar
Events
OnChange OnSetText OnValidate
OnGetText
Properties
ComponentIndex Interval Owner
Enabled Name Tag
Events
OnTimer
TTransIsolation type DB
Declaration
TTransIsolation = (tiDirtyRead, tiReadCommitted, tiRepeatableRead);
The TTransIsolation type is used by the TransIsolation property and it is the set of values
that can be used to start a transaction. They control how records which have been
modified by another application will be returned to your application by the server.
TVarBytesField component
A TVarBytesField represents a field of a record which is represented by a value
consisting of an arbitrary set of up to 65535 bytes. The first two bytes are a binary value
defining the actual length.
Use the Assign method to copy values from another field to a TVarBytesField.
The TVarBytesField component has the properties, methods, and events of the TField
+
component. +
Properties +
Alignment
AsBoolean
DataType
DisplayLabel
IsIndexField
IsNull
+
AsDateTime
AsFloat
DisplayName
DisplayText
Name
Owner
+
AsInteger
AsString
DisplayWidth
EditMask
ReadOnly
Required
+
Calculated
CanModify
EditMaskPtr
FieldName
Size
Tag
+
DataSet
DataSize
FieldNo
Index
Text
Visible
+
Methods +
Assign FocusControl SetData +
AssignValue
Clear
GetData
IsValidChar +
Events +
OnChange
OnGetText
OnSetText OnValidate +
+
TVarRec type System +
Declaration +
const
vtInteger
vtBoolean
=
=
0;
1;
+
vtChar
vtExtended
=
=
2;
3;
T
vtString = 4;
vtPointer = 5;
vtPChar = 6;
vtObject = 7;
vtClass = 8;
type
TVarRec = record
case Integer of
vtInteger: (VInteger: Longint; VType: Byte);
vtBoolean: (VBoolean: Boolean);
vtChar: (VChar: Char);
TWordArray SysUtils
Declaration
PWordArray = ^TWordArray;
TWordArray = array[0..16383] of Word;
TWordArray declares a general array of type Word that can be used in typecasting.
TWordField component
A TWordField represents a field of a record in a dataset. It is represented as a binary
value with a range from 0 to 65,535. Use TWordField for fields that hold unsigned whole
numbers.
Set the DisplayFormat property to control the formatting of the field for display
purposes, and the EditFormat property for editing purposes. Use the Value property to
access or change the current field value. Set the MinValue or the MaxValue property to
limit the smallest or largest value permitted in a field.
The TWordField component has the properties, methods, and events of the TField
component.
Example
{Note: use TypeOf for the older “Object” object hierarchy}
uses WinCrt;
uses Objects;
type
PBaseObject = ^TBaseObject;
TBaseObject = object(TObject)
end;
PChildObject = ^TChildObject;
TChildObject = object(TBaseObject)
end;
var
P,Q : PObject; { abstract object pointer }
begin
P := New(PBaseObject, Init);
Q := New(PChildObject, Init);
if TypeOf(P^) = TypeOf(TBaseObject) then
writeln('P is a TBaseObject instance')
else
writeln('P is not a TBaseObject instance');
if TypeOf(Q^) = TypeOf(TChildObject) then
writeln('Q is a TChildObject instance')
else
writeln('Q is not a TChildObject instance');
if TypeOf(Q^) <> TypeOf(P^) then
writeln('Q is not the same kind of object instance as P');
Dispose(P, Done);
Dispose(Q, Done);
end;
See also
SizeOf function
UniDirectional property
Applies to
TQuery component
Declaration
property UniDirectional: Boolean;
If an application only needs to be able to move forward in the result set of a TQuery
component, set the UniDirectional property to True. When UniDirectional is True, an
application requires less memory (because the records do not have to be cached), but the
+
application cannot move backwards in the result set. +
UniDirectional is False by default.
+
Unmerge method +
Applies to +
TMainMenu component
+
Declaration
procedure Unmerge(Menu: TMainMenu);
+
The Unmerge method reverses the merging of two menus into one in a non-MDI
application. The Menu parameter is the merged menu that you no longer want to be
+
merged.
+
Example
This example uses two forms, each containing a main menu created with the Menu
+
Designer. It also uses a button on Form1. When the user clicks the button, Form2 appears
and the main menu of Form2 merges with that of Form1. +
procedure TForm1.Button1Click(Sender: TObject);
begin
+
Form2.Show;
MainMenu1.Merge(Form2.MainMenu1); +
+
end;
bo
Form2 also has a button. When the user clicks the button on Form2, the menu of Form2 is
no longer merged with the menu on Form1: +
procedure TForm2.Button1Click(Sender: TObject);
begin +
Form1.MainMenu1.Unmerge(MainMenu1);
end; +
To run this example, create a uses clause in the implementation section of each unit and
add the other unit to it. For example, the uses clause in the implementation section of +
Unit1 would look like this:
uses Unit2; U
See also
AutoMerge property, Merge method
UnPrepare method
Applies to
TQuery, TStoredProc component
Example
StoredProc1.UnPrepare;
See also
Prepared property, Prepare method
For queries
Declaration
procedure UnPrepare;
The UnPrepare method sets the Prepared property to False. This ensures that the SQL
property will be translated again before the request is submitted to the server. In
addition, the server is notified that it can release any resources allocated for
optimization purposes, since a new request will be sent before (or in conjunction with) a
call to the Open or ExecSQL method.
Preparing a query consumes some database resources, so it is good practice for an
application to unprepare a query once it is done using it. The UnPrepare method
unprepares a query. When you change the text of a query at run time, Delphi
automatically closes and unprepares the query.
See also
Prepare method
UnselectedColor property
Applies to
TTabSet component
Example
The following sample code sets the directory of DirectoryListBox1 to C:\TEMP when the
form is created. When Button1 is pressed, a subdirectory called MYDIR is added to C:\
TEMP, but note that it is not updated in DirectoryListBox1 until Button2 is pressed and
Update is called.
procedure TForm1.Button1Click(Sender: TObject);
begin
MkDir('c:\temp\mydir');
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
DirectoryListBox1.Directory := 'c:\temp';
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
DirectoryListBox1.Update;
end;
Example
When this line of code runs, Windows repaints EditBox1:
Edit1.Update;
See also
Invalidate method, Refresh method
Declaration
property UpdateMode;
The UpdateMode property determines how Delphi will find records being updated in a
SQL database. This property is important in a multi-user environment when users may
retrieve the same records and make conflicting changes to them.
When a user posts an update, Delphi uses the original values in the record to find the
record in the database. This approach is similar to an optimistic locking scheme.
UpdateMode specifies which columns Delphi uses to find the record. In SQL terms,
UpdateMode specifies which columns are included in the WHERE clause of an UPDATE
statement. If Delphi cannot find a record with the original values in the columns
specified (if another user has changed the values in the database), Delphi will not make
the update and will generate an exception.
The UpdateMode property may have the following values:
• WhereAll (the default): Delphi uses every column to find the record being updated.
This is the most restrictive mode.
• WhereKeyOnly: Delphi uses only the key columns to find the record being updated.
This is the least restrictive mode and should be used only if other users will not be
changing the records being updated.
• WhereChanged: Delphi uses key columns and columns that have changed to find the
record being updated.
Example
Consider a COUNTRY table with columns for NAME (the key), CAPITAL, and
CONTINENT. Suppose you and another user simultaneously retrieve a record with the
following values:
• NAME = “Philippines”
• CAPITAL = “Nairobi”
• CONTINENT = “Africa”
Both you and the other user notice that the information in this record is incorrect and
should be changed. Now, suppose the other user changes CONTINENT to “Asia”,
CAPITAL to “Manila”, and posts the change to the database. A few seconds later, you
change NAME to “Kenya” and post your change to the database.
If your application has UpdateMode set to WhereKey on the dataset, Delphi compares the
original value of the key column (NAME = “Philippines”) to the current value in the
database. Since the other user did not change NAME, your update occurs. You think the
record is now [“Kenya”, “Nairobi”, “Africa”] and the other users thinks it is
[“Philippines”, “Asia”, “Manila”]. Unfortunately, it is actually [“Kenya”, “Asia”,
“Manila”], which is still incorrect, even though both you and the other user think you
have corrected the mistake. This problem occurred because you had UpdateMode set to
its least restrictive level, which does not protect against such occurrences.
If your application had UpdateMode set to WhereAll, the Delphi would check all the
columns when you attempt to make your update. Since the other user changed
CAPITAL and CONTINENT, Delphi would not let you make the update. When you
retrieved the record again, you would see the new values entered by the other user and
realize that the mistake had already been corrected.
Setting Result
{$R+} An out-of-range value always generates a run-time error.
{$R–} The values for out-of-range vary depending upon the data type of V.
Example
uses Dialogs;
var
I, Code: Integer;
begin
{ Get text from TEdit control }
Val(Edit1.Text, I, Code);
{ Error during conversion to integer? }
if code <> 0 then
MessageDlg('Error at position: ' + IntToStr(Code), mtWarning, [mbOk], 0);
else
Canvas.TextOut(10, 10, 'Value = ' + IntToStr(I));
Readln;
end;
See also
Str procedure
ValidateEdit method
Applies to
TDBEdit, TMaskEdit components
Declaration
procedure ValidateEdit;
The ValidateEdit method checks the value of the EditText property for blank required
characters in the edit box. If one is found, the EDBEditError exception is raised. If no
exception occurs, you can be sure all required characters have been entered in the edit
box.
See also
EditText property
+
+
ValidParentForm function Forms +
Declaration +
+
function ValidParentForm(Control: TControl): TForm;
The ValidParentForm function returns the form that contains the control specified in the
Control parameter. If the specified control is not on a form, ValidParentForm generates an
EInvalidOperation exception. +
If you prefer that the function return nil when the specified control is not on a form, use
the GetParentForm function. +
Example +
The following code calls ValidParentForm to find the parent form of the
MyForm.MyButton control. If found, that form is shown modally. If not, an exception +
occurs.
procedure TForm1.Button3Click(Sender: TObject);
+
begin
ValidParentForm(MyForm.MyButton).ShowModal; +
+
end;
Value property +
Applies to
TDBLookupCombo, TDBLookupList, TDBRadioGroup, TBCDField, TBooleanField,
+
TCurrencyField, TDateField, TDateTimeField, TFloatField, TIntegerField, TSmallintField,
TStringField, TTimeField, TWordField components
+
For database radio groups
V
Declaration
property Value: string;
The value of the Value property is the current contents of the field for the current record
in the dataset. When the user selects a radio button, the value of the Value property
changes to the value of the Items string for the radio button. The new value of the Value
property becomes the value of the field for the current record in the dataset.
If the ReadOnly property of the database radio group box is True, the user won’t be able
to select a button or change the contents of the field.
Example
The following code concatenates some text to the string in the Value property. When the
user chooses a radio button in DBRadioGroup1, the value of Value is stored in the
corresponding field in the DataSource (if ReadOnly is False). In the OnChange event
handler, a label is updated, indicating to the user that this change has occurred.
procedure TForm1.DBRadioGroup1Change(Sender: TObject);
begin
Label1.Caption := 'Field ' + DBRadioGroup1.DataField + ' has changed to ' +
DBRadioGroup1.Value;
end;
See also
ItemIndex property
Example
The following code changes the Value property, and thus, the value of the field in the
connected dataset to ‘Green’.
DBLookupCombo1.Value := ‘Green’;
See also
DisplayValue property
For fields
Declaration
property Value: string; {TStringField}
If the contents of the field of the current record matches a string specified as the value of
the ValueUnchecked property, the check box is unchecked. If the contents of the field
matches no string in either ValueChecked or ValueUnchecked, the check box appears gray.
If the DataField of the database check box is a logical field, the check box is always
checked if the contents of the field is True, and it is always unchecked if the contents of
the field is False. The values of the ValueChecked and ValueUnchecked properties have no
affect on logical fields.
If the user checks a database check box, the string that is the value of the ValueChecked
property is placed in the database field, as long as the ReadOnly property is False. If the
value is a semicolon-delimited list of items, the first item in the list is inserted as the
contents of the field of the current record.
The default value of ValueChecked is the string ‘True’.
Example
The following code toggles the value of the ValueChecked property of DBCheckBox1 from
‘True’ to ‘False’ or from ‘False’ to ‘True’.
with DBCheckBox1 do
if (ValueChecked = ‘True’) or (ValueChecked = ‘False’) then
if ValueChecked = ‘True’ then ValueChecked := ‘False’
else ValueChecked := ‘True’;
See also
ValueUnchecked property
Values property
The Values property is used by string and string list objects, and by database radio group
boxes.
Applies to
TStrings, TStringList objects
Declaration
property Values[const Name: string]: string;
The Values property gives you access to a specific string in a list of strings. The strings
must have a unique structure before you can use the Values property array to access
them:
Name=Value
The Name that identifies the string is to the left of the equal sign (=), and the current
Value of the Name identifier is on the right side of the equal sign. There should be no
spaces present before and after the equal sign.
Such strings are commonly found in .INI files. For example, here are a few strings taken
from a DELPHI.INI file:
DisplayGrid=1
For example, suppose you have two strings in the Items property for a database radio
group: Yes and No. If there are no strings in the Values property, the data field must
contain either the value Yes or No to select one of the radio buttons. If the user selects
one of these buttons, the string Yes or No becomes the contents of the data field.
If the data field contains values such as Y or N, rather than Yes or No, you can specify Y
or N as Values strings. This way, the Yes or No radio buttons are selected when a Y or N
value appears in the data field. When the user selects one of the radio buttons, Y or N
becomes the value of the field of the current record.
Example
This example uses a database radio group box connected to field in a dataset. The field
contains the values ‘Y’, ‘N’, or ‘M’. You want the captions of the radio buttons to be
‘Yes’, ‘No’, or ‘Maybe’, so the code adds these three strings to the Items property array.
The actual values that are in the field and that can entered into the field are the ‘Y’, ‘N’,
and ‘M’ strings, so these are added to the Values property array.
procedure TForm1.FormCreate(Sender: TObject);
begin
with DBRadioGroup1 do
begin
Items.Add('Yes');
Items.Add('No');
Items.Add('Maybe');
Values.Add('Y');
Values.Add('N');
Values.Add('M');
end;
end;
When the code runs, three radio buttons appear in the group box. If the current record
in the dataset contains any of the values contained in the Values property, the
appropriate radio button is checked. When the user selects a radio button, the
corresponding string in the Values property is entered into the field.
See also
ItemIndex property, Items property
ValueUnchecked property
Applies to
TDBCheckBox component
Declaration
property ValueUnchecked: string;
If the value of the ValueUnchecked property is equal to the data in the field of the current
record of the dataset, the database check box is unchecked.
You also can enter a semicolon-delimited list of items as the value of ValueUnchecked. If
+
any of the items matches the contents of the field of the current record in the dataset, the
check box is unchecked. For example, you can specify a ValueUnchecked string like this:
+
DBCheckBox1.ValueUnchecked := ‘False;No;Off’; +
If the string False, No, or Off is the contents of the field specified as the database check
box’s DataField, the check box is unchecked. +
If the contents of the field of the current record matches a string specified as the value of
the ValueChecked property, the check box is checked. If the contents of the field matches
+
no string in either ValueChecked or ValueUnchecked, the check box appears gray.
If the DataField of the database check box is a logical field, the check box is always
+
checked if the contents of the field is True, and it is always unchecked if the contents of
the field is False. The values of the ValueChecked and ValueUnchecked properties have no
+
affect on logical fields.
If the user checks a database check box, the string that is the value of the ValueUnchecked
+
property is placed in the database field, as long as the ReadOnly property is False. If the
value is a semicolon-delimited list of items, the first item in the list is inserted as the
+
contents of the field of the current record.
The default value of ValueUnchecked is the string ‘False’.
+
Example
+
The following code changes ValueUnchecked to ‘NO’. When the value of the linked field
is ‘NO’, DBCheckBox1 is unchecked.
+
DBCheckBox1.ValueUnchecked := ‘NO’; +
See also
ValueChecked property
+
+
VersionMajor property +
Applies to
TReport component
+
Declaration
+
property VersionMajor: Integer; +
Run-time and read only. The value of the VersionMajor property identifies which major
version of ReportSmith you are running. For example, if you are using ReportSmith 2.5, V
the value of VersionMajor is 2. The minor version value is reported in the VersionMinor
property.
See also
VersionMinor property
VersionMinor property
Applies to
TReport component
Declaration
property VersionMajor: Integer;
Run-time and read only. The value of the VersionMinor property identifies which minor
version of ReportSmith you are running. For example, if you are using ReportSmith 2.5,
the value of VersionMinor is 5. The major version value is reported in the VersionMajor
property.
See also
VersionMajor property
VertScrollBar property
Applies to
TForm, TScrollBox components
Declaration
property VertScrollBar: TControlScrollBar;
The VertScrollBar property is the form’s or scroll box’s vertical scroll bar. The values of
VertScrollBar’s nested properties determines how the vertical scroll bar behaves.
To make a vertical scroll bar appear on a form or scroll box, these nested properties of
VertScrollBar must be set like this:
• Visible must be x.
• The value of the Range property must be greater than the value of the ClientHeight
property of the form or the Height property of the scroll box.
Example
This example places a vertical scroll bar on the form, as long as the ClientHeight of the
form is not greater than 500:
procedure TForm1.FormCreate(Sender: TObject);
begin
with VertScrollBar do
begin
Range := 500;
Visible := True;
end;
end;
The VisibleButtons property determines which of the buttons on the media player are
visible. If a button is not made visible with VisibleButtons, it does not appear on the
media player control. By default, all buttons are visible when a media player component
is added to a form.
Example
The following line of code causes only the Play and Stop buttons of MediaPlayer1 to be
displayed:
MediaPlayer1.VisibleButtons := [btPlay, btStop];
See also
ColoredButtons property, EnabledButtons property
Declaration
property VisibleButtons: TButtonSet;
The value of the VisibleButtons property determines which buttons appear on the
database navigator component. By default, all the buttons are visible. By changing the
value of the VisibleButtons set, you can hide some of the buttons, and therefore, prevent
the user from performing certain operations. For example, if you only want the user to
view the records in the dataset, you would include only the nbFirst, nbPrior, nbNext, and
nbLast values in the VisibleButtons set.
Declaration
function VisibleRowCount: Integer;
Run-time and read only. The VisibleRowCount contains the number of rows, other than
fixed or nonscrolling rows, that are fully displayed in the grid. If another row is partially
displayed in the grid, it won’t be part of the count.
Example
This example uses a draw grid, two labels, and a button on a form. When the user clicks
the button, the number of rows and columns, excluding partial and fixed ones, are
reported in the captions of the two labels:
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption := IntToStr(DrawGrid1.VisibleRowCount) + ' rows';
Label2.Caption := IntToStr(DrawGrid1.VisibleColCount) + ' columns';
end;
See also
RowCount property, VisibleColCount property
VisibleTabs property
Applies to
TTabSet component
Declaration
property VisibleTabs: Integer;
Read only. The value of the VisibleTabs property contains the number of tabs currently
visible in the tab set control.
Example
This example queries the VisibleTabs property to find out how many tabs are visible in
the tab set control and assigns the number to a variable:
SeeTabs := TabSet11.VisibleTabs;
Wait property
Applies to
TMediaPlayer component
Declaration
property Wait: Boolean;
The Wait property determines whether a media control method (Back, Close, Eject, Next,
+
Open, Pause, PauseOnly, Play, Previous, StartRecording, Resume, Rewind, Step, or Stop)
returns control to the application only after it has been completed. Wait is unavailable at
+
design time. +
If Wait is True, the media player component waits until the next media control method
has completed before returning control to the application. If Wait is False, the application
won’t wait for the next media control method to finish before continuing.
+
Wait affects only the next media control method called after setting Wait. You must reset +
Wait to affect any subsequent call to a media control method.
By default, Play and StartRecording function as if Wait is False. You must set Wait to True
+
before calling Play or StartRecording to prevent control from returning to the application
before playing or recording has finished. By default, all other media control methods +
Note
function as if Wait is True.
Usually you would set Wait to False only if the next media control is expected to take a
+
long time, so that your application can execute other code before the media control
method has completed. If you set Wait to False, you might want to set Notify to True so +
the application is notified when the media control method completes.
+
Example
The following code plays a .WAV audio file named NI!.WAV twice. The first call to Play
doesn't return control to the application until the file is done playing. Note that if you
+
remove the line of code that sets wait to true, the sound is only played once. +
procedure TForm1.Button1Click(Sender: TObject);
begin
with MediaPlayer1 do begin
+
FileName := 'ni!.wav';
AutoRewind := True;
+
try
Open; { Open Media Player } +
+
Wait := True; { Waits until sounds is done playing to return }
Play; { Play sound }
Play; { Play again }
finally
Close; { Close media player }
+
end;
end; +
+
end;
WantReturns property +
Applies to
TDBMemo, TMemo components
W
Declaration
property WantReturns: Boolean;
The WantReturns property determines whether return characters the user enters in the
memo by pressing Enter affect the text in the memo, or go to the form. If WantReturns is
True and the user presses Enter, a return character is entered in the memo. If WantReturns
is False and the user presses Enter, a return is not entered in the memo, but instead goes
to the form. For example, if there is a default button on a form, pressing Enter would
choose the button instead of affecting the memo’s text.
To enter return characters in a memo when WantReturns is False, press Ctrl+Enter.
Example
This example uses a memo and a check box on a form. If the check box is checked, the
user can enter return characters into text entered in the memo. If the check box is
unchecked, return characters aren’t entered into the memo, but go to the form.
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
if CheckBox1.Checked then
Memo1.WantReturns := True
else
Memo1.WantReturns := False;
end;
See also
KeyPreview property, WantTabs property, WordWrap property
WantTabs property
Applies to
TDBMemo, TMemo components
Declaration
property WantTabs: Boolean;
The WantTabs property determines if tabs are enabled in a memo control. To enable tabs
in a memo control, set WantTabs to True. To turn tabs off, set WantTabs to False.
Caution If WantTabs is True, the user can’t use the Tab key to select the next control on the form.
The user can tab into a memo control, but can’t tab out.
Example
This example uses a memo and a check box on a form. When the check box is checked,
the user can enter tab characters into the memo’s text. When the check box is unchecked,
the user can’t enter tab characters into the text, but can use the Tab key to move between
the memo and the check box controls.
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
if CheckBox1.Checked then
Memo1.WantTabs := True
See also
GoToXY procedure, WhereX function
Width property
Applies to
All controls; TBitmap, TGraphic, TIcon, TMetafile, TPen, TPicture objects; TForm, TScreen
components
Declaration
property Width: Integer;
The Width property determines horizontal size.
Example
The following code doubles the width of a button:
Button1.Width := Button1.Width * 2;
See also
ClientWidth property, Height property, SetBounds method
Example
To set the pen width to a random value from 1 to 10,
Canvas.Pen.Width := 1 + Random(10);
See also
Height property
See also
FormStyle property, TMenuItem component
WindowState property
Applies to
TForm component
Declaration
property WindowState: TWindowState
The WindowState determines the initial state of the form. These are the possible values:
Value Meaning
wsNormal The form appears neither maximized nor minimized
wsMaximized The form is maximized
wsMinimized The form is minimized
See also
+
TWindowState type
+
WindowTitle variable WinCrt +
Declaration
+
var WindowTitle: array[0..79] of Char; +
The WindowTitle variable determines the title of the CRT window.
The default value is the full path of the program's .EXE file.
+
You can change the title by storing a new string in WindowTitle before the CRT window
is created.
+
Here is an example: +
StrCopy(WindowTitle, 'Hello World');
+
WordRec SysUtils +
Declaration +
WordRec = record
Lo, Hi: Byte;
+
end;
WordRec declares a utility record that stores the high and low order bytes of the
+
specified variable as type Byte. +
See also
Hi function, Lo function
+
+
WordWrap property W
Applies to
TDBMemo, TDBText, TLabel, TMemo components
Declaration
property WordWrap: Boolean;
The WordWrap property determines if text in a label or memo control wraps at the right
margin so that it fits in the control. You can give the user access to the lines which aren’t
visible in a memo control by setting its ScrollBars property to add horizontal, vertical, or
both scrollbars to the memo control. There should be no reason to use a horizontal scroll
bar if WordWrap is True.
The memo control must be tall enough to display at least one line of text to allow the
user to edit its contents, even if WordWrap is True.
The default value is False.
Example
This example allows text a user enters in the Memo1 control to wrap to the next line, if
the control is large enough to hold the text:
Memo1.WordWrap := True;
See also
ScrollBars property, Text property, AutoSize property
Write method
Applies to
TBlobStream object
Declaration
function Write(const Buffer; Count: Longint): Longint; override;
The Write method copies up to Count bytes from Buffer to the current position in the
field. Buffer must have at least Count bytes allocated for it. Write returns the number of
bytes transferred (which may be less than the number requested in Count.) Transfers
which require crossing a selector boundary in the source will be handled correctly.
Example
BlobStream1.Write(Buf, 4096);
See also
TBlobField component, TBytesField component, TVarBytesField component
The Section constant identifies the section of the .INI file where the value is written. For
example, the WIN.INI for Windows contains a [Desktop] section.
The Ident parameter is the name of the identifier for which you want to change the
value. The Value parameter contains the new value.
Example
This example creates an .INI file for a game with two entries in the Options section, and
one entry in the Configuration section.
Before you try this example, you must add IniFiles to the uses clause of your unit.
var
GameIni: TIniFile;
begin
Gamini := TIniFile.Create('FUNGAME.INI');
with GameIni do
begin
WriteBool('Options', 'Sound', True);
WriteInteger('Options', 'Level', 3);
WriteString('Configuration', 'Name', 'Teresa Ace');
Free;
end;
end;
See also
ReadBool method, WriteInteger method, WriteString method
Example
uses WinCrt;
var
MyBuffer: PChar;
begin
GetMem(MyBuffer, 80);
MyBuffer := 'This is an example of WriteBuf';
WriteBuf(MyBuffer, 30);
See also
Write procedure
WriteInteger method
Applies to
TIniFile object
Declaration
procedure WriteInteger(const Section, Ident: string; Value: Longint);
The WriteInteger method writes an integer value in an .INI file.
The Section constant identifies the section of the .INI file where the value is written. For
example, the WIN.INI for Windows contains a [Desktop] section.
The Ident constant is the name of the identifier for which you want to change the value.
The Value parameter contains the new value.
Example
This example creates an .INI file for a game with two entries in the Options section, and
one entry in the Configuration section.
Before you try this example, you must add IniFiles to the uses clause of your unit.
var
GameIni: TIniFile;
begin
GameIni := TIniFile.Create('FUNGAME.INI');
GameIni.WriteBool('Options', 'Sound', True);
GameIni.WriteInteger('Options', 'Level', 3);
GameIni.WriteString('Configuration', 'Name', 'Teresa Ace');
GameIni.Free;
end;
See also
ReadInteger method, WriteBool method, WriteString method
WriteString method
Applies to
TIniFile object
Value Meaning
z100 Zoom to 100% of OLE object’s original size
z150 Zoom to 150% of OLE object’s original size
z200 Zoom to 200% of OLE object’s original size
Example
The following code should be attached to the OnClick event handlers of the Zoom In and
Zoom Out buttons. When the ZoomInBtn is clicked, the image in OLEContainer1 is
magnified. When the ZoomOutBtn is clicked, the image in OLEContainer1 is reduced.
procedure TForm1.ZoomInBtnClick(Sender: TObject);
begin
OLEContainer1.Zoom := Succ(OLEContainer1.Zoom)
end;
procedure TForm1.ZoomOutBtnClick(Sender: TObject);
begin
OLEContainer1.Zoom := Pred(OLEContainer1.Zoom)
end;
Index 1001
Alignment property 32–34 AppendStr procedure 40 as operator
TAlignment and 773 Application component 773 illegal typecasting 235
TLeftRight and 883 application objects 41 AsBCD property 44
TPopupAlignment and 918 Application variable 41, 773 AsBoolean property 45
alLeft constant 31 applications AssignValue and 56
allocating memory 350 activating 504, 521 ASCII files See text files
components 158, 579 client/server See DDE; OLE AsCurrency property 45
field values 179 applications AsDate property 46
files 157 database See databases AsDateTime property 46–47
objects 159 handles 370 AsFloat property 47–48
queries 342 idle 538, 871 AssignValue and 56
allocating string buffers 744 instantiating 41, 773 AsInteger property 48
AllocMem function 34 main form 452 AssignValue and 56
FreeMem and 34 maximizing 554 Assign method 49–52
AllowAllUp property 34 message boxes and 723, 724 AssignValue and 56
Down and 211 minimized 389, 472, 879 IsNull and 415
AllowGrayed property 35 handling events 544, 554 AssignCrt procedure 52
AllowInPlace property 36 multi-form 367, 624 See also AssignFile, Read,
AllowResize property 36 naming 879 Readln, Write, Writeln
alNone constant 31 quitting 837, 838 procedures
alphabetic characters ReportSmith See ReportSmith Assigned function 53
masks 227 applications AssignField method 53
alphanumeric characters restoring to previous IsNull and 415
masks 227 state 665 AssignFile procedure 54
alphanumeric fields 57, 58 running 674, 937, 943 See also Append, FileClose,
alRight constant 31 handling events 504, 521 Reset, Rewrite procedures
other Windows and
Alt key, testing 946 Delphi 521 assigning objects to
alTop constant 31 terminating 11, 13, 22, 269, Clipboard 49, 58
ampersands (&) in captions 103 270, 368 assigning values 40, 56, 410,
ancestor objects 3, 114 ApplyFilePath method 41 703, 977
ANSI characters 37, 487 applying fonts 847 binary-coded decimals 45
AnsiCompareStr function 37 ApplyRange method 42 Boolean 45
See also AnsiCompareText CancelRange and 96 currency 46
function SetRange and 706 date/time 46, 47, 59
AnsiCompareText function 37 SetRangeEnd and 707 DDE applications 509
See also AnsiCompareStr SetRangeStart and 708 floating-point 47, 48
function integers 48
Arc method 43
AnsiLowerCase function 37 key field searches 305, 362
arcs, drawing 43 lookup tables 208, 449, 450
See also AnsiUpperCase, ArcTan function 43
LowerCase functions maximum 461
See also Cos, Sin functions; minimum 473
AnsiToNative function 37 trigonometric functions
AnsiUpperCase function 38 required 663
arctangent 43 Smallint types 57
See also AnsiLowerCase, arguments See parameters
UpperCase functions SQL statements 54, 56, 180,
ArrangeIcons method 44 182
Append method 38 arranging icons
AfterInsert and 29 dynamic queries 585
minimized forms 44, 872 stored procedures 54, 56, 182
BeforeInsert and 75
arrays string 57, 58
Insert vs. 405
child controls 148 word 59
Post and 619, 620
Clipboard formats 328 AssignPrn procedure 55
Append procedure 39 components 142
See also AssignFile, FileClose, AssignStr procedure 55
field objects 301, 425 See also DisposeStr procedure
Reset, Rewrite procedures list objects 102
appending text 39 AssignValue method 56
objects 499 AssignValues method 56
AppendRecord method 40 queries 587
InsertRecord vs. 410 AsSmallInt property 57
releasing controls 656 associating data with
Post and 620 strings 105, 137 outlines 22, 24, 171
Index 1003
specifying type 81, 359 BOLE_MED_MFPICT Bounds function 89
strings and 498 constant 85 BoundsRect property 89
testing existence 241 BOLE_MED_NULL constant 85 boxes 777
testing for changes 477 BOLE_MED_STORAGE Break procedure 90
transparent labels 931 constant 85 See also Continue, Exit, Halt
bkAbort constant 432 BOLE_MED_STREAM procedures
bkAll constant 432 constant 85 Break property 91
bkCancel constant 431 BOLEFormat type 84 TMenuBreak and 894
bkClose constant 432 BOLEMedium and 85 breakpoint interrupts 221
bkCustom constant 431 BOLEMedium type 85 BringToFront method 91
bkHelp constant 431 BOLEMediumCalc and 85 Browse mode 564, 740
bkIgnore constant 432 BOLEMediumCalc function 85 Brush property 92
bkNo constant 431 bookmarks 783 FloodFill and 315
bkOK constant 431 freeing memory 334 FrameRect and 332
bkRetry constant 432 retrieving 360 BrushCopy method 93
bkYes constant 431 setting 339 brushes 92, 785, 866
blank characters Boolean fields 45, 783 bitmaps and 80
masks 228, 231 check boxes and 977 filling rectangles 295, 332
blGlyphBottom constant 435 formatting data 208 flood filling 315, 855
blGlyphLeft constant 435 radio buttons and 976, 979 setting styles 785
blGlyphRight constant 435 string values and 58 styles 764
blGlyphTop constant 435 Boolean types 45 bsAutoDetect constant 768
BLOB fields 781 INI files and 639, 995 bsBDiagonal constant 764
clearing 935 BooleanField component 783 bsBottomLine constant 714
reading from 58, 637, 782 BorderColor property 86 bsBox constant 714
size, returning 726, 727 BorderIcons property 86 bsClear constant 764
streams and 158, 678, 782, 783 TBorderIcons and 784 bsCross constant 764
string values and 58 borderless forms 87 bsDiagCross constant 764
writing to 444, 782 borders 86–88, 785 bsDialog constant 87
BlobField component 781 coloring 135 bsFDiagonal constant 764
BLOBs multicolored 315 bsFrame constant 714
See also BLOB fields border-style constants 87, 88, bsHorizontal constant 764
accessing 782 784, 864 bsLeftLine constant 715
changing 782 BorderStyle property 87–88 bsLowered constant 770
copying 154 TBorderStyle and 784 bsNew constant 768
deleting 171 TFormBorderStyle and 864 bsNone constant 87, 88
displaying 106, 810, 817 BorderWidth property 88 bsRaised constant 770
automatically 61 TBorderWidth and 785 bsRightLine constant 715
loading 445 Borland Assist program 1 bsSingle constant 87, 88
resizing 68 Borland Database Engine 168, bsSizeable constant 87
BlobStream object 782 971 bsSolid constant 764
BlockRead procedure 81 accessing tables 956 bsTopLine constant 714
See also BlockWrite procedure adding fields 23 bsVertical constant 764
blocks aliases 30, 338, 342
exiting 269 bsWin31 constant 768
returning 337 btBack constant 241
text 690, 710 calling 185, 371, 446, 447, 741
BlockWrite procedure 82 btEject constant 241
driver types 217
See also BlockRead procedure returning 343, 344 BtnClick method 94
bmRead constant 158, 783 exception handling 224 btNext constant 241
bmReadWrite constant 158, 783 network control file 487 btPause constant 241
bmWrite constant 158, 783 referencing fields 279, 280 btPlay constant 241
BOF property 84 bounding rectangles 89, 421 btPrev constant 241
BOLE_MED_FILE constant 85 cells in grids 104 btRecord constant 241
BOLE_MED_GDI constant 85 client areas 121 btStep constant 241
BOLE_MED_HGLOBAL clipping 123, 845 btStop constant 241
constant 85 display windows 206 buffers
grids 867 formatting 324
Index 1005
bitmaps 81, 101 Chord method 112 OnClick and 513
components 510, 700 chords, drawing 112 TNavigateBtn and 900
data 277, 804, 811 Chr function 112 client areas 120, 121, 122
batch moves 72, 106 See also Ord function height 120
BLOBs 782 circles 715 width 122
discarding changes 27, 73, clActiveBorder constant 793 client/server applications 798
95 clActiveCaption constant 793 See also DDE applications;
entire records 97, 110, clAppWorkSpace constant 793 OLE applications
219, 225, 479 ClientHandle property 119
handling events 27, 73, clAqua constant 793
classes 114, 115 ClientHeight property 120
510, 520, 560, 800, 850 GridHeight and 364
placing restrictions 644 graphics 866
not found exceptions 222 ClientOrigin property 120
specific fields 98
directories 109, 565, 826 OLE objects 496 ClientRect property 121
extensions 107, 274 registration exceptions 233 ClientToScreen method 121
graphics 510, 511 returning names 113 ClientWidth property 122
identifiers 222 ClassName method 113 GridWidth and 366
mouse cursor image 523 ClassParent method 114 HorzScrollBar and 387
notebook pages 549, 581, ClassType method 115 clInactiveBorder constant 793
709, 900 clBackground constant 793 clInactiveCaption constant 793
objects 510 clBlack constant 793 clInactiveCaptionText
OLE links 441 clBlue constant 793 constant 793
strings 511, 979 clBtnFace constant 793 Clipboard 792
tab sets 509 clBtnHighlight constant 793 assigning objects 49, 58
tracks 490 clBtnShadow constant 793 clearing 117
character fields 57, 58, 951 clBtnText constant 793 closing 124
characters clCaptionText constant 793 copying text 357, 710
clearing 131 clDkGray constant 793 data-aware components 810
filling 295 Clear method 115–116 formats 85, 175
returning 112 IsNull and 415 clearing 118
strings See strings ClearFields method 117 registering 84, 651
CharCase property 108 returning 325, 328
ClearFormOLEDropFormats testing for 373
TEditCharCase and 836 procedure 118
ChDir procedure 109 handles 338, 700
BOLEFormat and 84 instantiating 123
See also GetDir, MkDir, RmDir RegisterFormAs
procedures opening 124, 562
OLEDropTarget and 651 overwriting contents 562
check boxes 790 clearing pasting objects 84, 340, 596,
3-D controls and 163 characters 131 598
aligning captions 32, 883 Clipboard 117 reading from 328, 338, 596,
buttons as 35 screens 131 700
checking/unchecking 35, stream buffers 935 returning current content 49
111, 739 ClearSelection method 118 as text strings 58
data-aware 803, 977, 980 clFuchsia constant 793 writing to 152, 171, 328, 701
states 739, 791 clGray constant 793 Clipboard object 792
check marks 111, 739 clGrayText constant 793 Clipboard variable 123, 792
Check procedure 110 clGreen constant 793 Clipbrd unit 123, 792
Check property 111 clHighlight constant 793 ClipRect property 123
CheckBox component 790 clHighlightText constant 793 clLime constant 793
CheckBreak typed constant 110 click events 514, 521 clLtGray constant 793
CheckBrowseMode method 110 fonts 507 clMaroon constant 793
CheckEOF typed constant 111 grids 517 clMenu constant 793
child controls 407 media player buttons 512,
counting 147 clMenuText constant 793
552 clNavy constant 793
returning 145, 147, 148 navigator buttons 94, 119, 513
child forms See MDI applications clock 802, 961, 962
notebook pages 900 See also Timer component
child windows 589 simulating 94, 119 conversions 46, 47, 59
choosing See selecting Click method 119 clOlive constant 793
Index 1007
ComboBox component 795 copying 701 connecting data-aware
command buttons See buttons; creating 2, 158 components 178, 203, 243
speed buttons data-aware See data-aware connecting tabs to notebook
Command property 139 components pages 958
command-line parameters 132 destroying 158, 197, 333 connecting to databases 127, 564
commands See menu items handling events 522 See also database servers;
Commit method 139 displaying 983 servers
committing transactions 139, 738 enabling/disabling 243 dropping connections 217
isolation levels 930, 962 initializing 158 login scripts and 448, 541, 886
common dialog boxes listed 3 testing connections 144, 426,
See also dialog boxes moving 31 427
3-D controls and 163 naming 485, 796, 879 connection modes 145, 800
closing 128 at run time 222 connection parameters 588
color options 135, 794 nonwindowed 945 ConnectMode property 145
custom 170, 566, 798 objects vs. 2 SetLink and 705
display options 566, 567, 568, overlapping 91, 698 TDataMode and 800
569, 570 owned 142, 158, 406 constants
displaying 436, 619, 904 counting 141 activation, OLE objects 60
finding text 856 parent vs. 579
alignment 773
returning 142
font-selection 860 bitmap buttons 435, 787
specifying owner 579
naming 880 check boxes 33
parent 589, 656
opening files 905 controls 31, 773
referencing 485, 519 menus 33
printer setup 922 registering 651
printing 920 radio buttons 33
exception handling 222 speed buttons 435, 787
options 134, 149 renaming 222, 486
replacing text 932 text 32
repainting 969 arrays 963
saving files 936 resizing 68–70
CompareStr function 140 batch moves 477, 775
returning 301 bevel 78, 79, 778, 779
See also CompareText function saving 677
CompareText function 140 bevel shapes 714
selecting 514 BLOB streams 158, 783
See also CompareStr function sending to back 698
comparing border styles 87, 88, 784, 864
setting boundaries 700 brush styles 764
strings 37, 140, 745, 750, 751, settings See properties
753 button styles 768
testing for 723 button types 431, 780
comparing values Components property 142
database searches 42, 972 message boxes 465, 466,
ComponentCount and 141 468
strings 751 ComponentIndex and 142
component library See Visual case 108, 843
Controls vs. 148 check box states 739
Component Library InsertComponent and 406 Clipboard formats 85, 373
Component palette 2, 4 RemoveComponent and 656 color 134, 475, 793
ComponentCount property 141 Concat function 143 connection modes 145, 800
ComponentIndex property 142 See also Copy, Delete, Insert, copy 150
components 2, 222 Length, Pos functions cursor 169
See also specific component concatenating strings 143, 744, data states 219, 740, 800
activating 514, 528 746, 750 data types 182, 854
adding captions 103, 317, 790 See also strings device
aligning 31 confirmation messages fonts 198, 861
arrays 142 deleting data 144, 574 media players 199
bringing to front 91 ConfirmDelete property 144 display options
changing 510, 700 Connect method 144 combo boxes 574, 766, 770
coloring 134, 793 Connected property 144 common dialog boxes 566,
constructing 2, 158, 197, 333 AliasName and 30 567, 568, 569, 570
container 853 Close and 125 grids 572, 573
activating 14 DatabaseName and 173 list boxes 767
OLE See OLE containers DriverName and 217 lookup tables 574
resizing 70 KeepConnection and 426 outlines 571, 769
controls vs. 5 drag/drop modes 214, 828
Open and 564
Index 1009
CopyRect method 152 cursors 169 csOwnerDrawFixed
BrushCopy vs. 93 mouse images 166, 212 constant 766
CopyToClipboard method crHSplit constant csOwnerDrawVariable
152–154 cursors 169 constant 766
Cos function 154 mouse images 167, 212 csSimple constant 766
See also ArcTan, Sin functions; crIBeam constant Ctl3D property 162
trigonometric functions cursors 169 ParentCtl3D and 592
cosine 154 mouse images 167, 212 CTL3DV2.DLL 163
Count property 155–156 crMultiDrag constant 169 Ctrl key, testing 946
Capacity vs. 102 crNoDrop constant currency fields 46, 797
counting cursors 169 formatting data 166
child controls 147 mouse images 166, 212 string values and 58
child windows 462 crNone constant 169 currency formatting
columns in grids 133, 985 crSize constant variables 163
components 141 cursors 169 Currency property 166
databases 172 mouse images 167, 212 DisplayFormat vs. 205
datasets 178 crSizeNESW constant CurrencyField component 797
fields 156, 278, 393 cursors 169 current dates/time 182, 494, 874
database searches 428 mouse images 166, 212 current directory
forms 329 crSizeNS constant common dialog boxes 398
index elements 156 cursors 169 list boxes 200, 201, 565
items in lists 155, 689 mouse images 166, 212 current form See active form
outlines items 419 crSizeNWSE constant current printer 353, 627
records 649 cursors 169 specifying 706
batch moves 106, 430, mouse images 166, 212
482, 632, 648 cursor constants 169
crSizeWE constant Cursor property 166–167
rows in grids 672, 986 cursors 169
visible tabs 986 TCursor and 798
mouse images 167, 212 Cursor typed constant 168
crArrow constant CRT window
cursors 169 CursorPosChanged method 168
active title 993 cursors 168, 798
mouse images 166, 212 character cells 576
crCross constant customizing 169
creating 399 databases 168, 971
cursors 169 cursor
mouse images 166, 212 moving 306, 361
automatic tracking 70 specified distance 482
crDefault constant location 70, 168 to first record 309
cursors 169 destroying 211 to last record 434
mouse images 166, 212 end-of-line status 111 to next record 491
crDrag constant inactive state, preventing 211 to previous record 631
cursors 169 inactive title 390 keeping visible 925
mouse images 166, 212 initial size 992 location 70, 131, 168, 169, 362,
Create method 156–158 inputting from51 639 989
Free and 333 location 992 mouse image 166, 167, 212
OnCreate and 519 user termination 110 moving 169, 362
TBlobStreamMode and 783 virtual screen size 576, 680 Cursors property 168
CreateField method 159 crUpArrow constant CursorTo procedure 169
CreateFmt method 262 cursors 169 See also GoToXY procedure
CreateFmtHelp method 262 mouse images 167, 212 CustomColors property 170
CreateForm method 159 crVSplit constant customer assistance 1
CreateHelp method 262 cursors 169 cutting text 171, 195, 328
CreateNew method 160 mouse images 167, 212 See also deleting
CreateParam method 160 CS register 161 CutToClipboard method 171
CreateRes method 262 csDropDown constant 766, 770
CreateResFmt method 262 csDropDownList constant 766,
CreateResFmtHelp method 263 770 D
CreateResHelp method 263 CSeg function 161 data
CreateTable method 161 See also DSeg, SSeg functions accessing 105, 782, 801
crHourglass constant BLOBs 782
Index 1011
data transactions login scripts and 448, 541, DataField property 175
committing 139, 738 886 LookupField and 449
isolation levels 930, 962 modes 145 Value and 976
rolling back 669 testing connections 144, DataFormat property 175
data types 426, 427 DataHandle property 177
See also types exception handling 225 DataSet property 177–178
compatible 50 heterogeneous queries 733 OnChangeState and 560
returning 278 opening databases 541, 588 DatasetCount property 178
specifying 54, 181, 182, 854 security 448 datasets 801
batch moves 57 login events 541, 886 accessing data 782
data-aware components 801, 822 password events 916 lookup tables 449, 450
check boxes 803 DatabaseCount property 172 activating 14, 848
checking/ DatabaseError procedure 173 batch operations 776
unchecking 977, 980 DbiError and 185 closing 14, 125, 127
Clipboard 810 DatabaseName property handling events 28, 73
combo boxes 804, 813 173–174 counting 178
display options 816 CreateTable and 161 data states 740, 800
setting current values 976 DeleteTable and 196 displaying data 175, 180, 650
styles 815 EmptyTable and 242 filtering data 42, 230, 231,
connecting 178, 203, 243 GotoCurrent and 360 427, 706, 707, 708
contents, read-only 643 databases indexes 425
database navigator and 819 See also data; fields; records; opening 564
edit boxes 804, 806 tables handling events 29, 75
validating required accessing 144, 174, 564 position indicators 84, 252
characters 974 adding images 445 returning 179
graphics 810 assigning aliases 30, 173, 342 setting current values 976,
handling events 510 checking for nonzero 977, 979
list boxes 811, 815, 816 values 110 specifying 178, 560
display options 816 closing 125, 127 updating data 243, 971, 973
setting current values 976 committing changes 139, 738 Datasets property 179
radio buttons 95, 820 isolation levels 930, 962 DataSize property 179
setting current connecting to See database
contents 976, 979 DataSource component 801
servers DataSource property 180–181
retrieving information 277 counting 172
setting input focus 317 DataType property 181–182
creating 565 AsBCD and 45
transparent labels 931 detail tables
updating 562, 972 AsBoolean and 45
linking to master 456, 457 AsCurrency and 46
Database component 798 discarding changes 27, 95
testing existence 836 AsDate and 46
handling events 73 AsDateTime and 46
database drivers 217, 416 exception handling 173, 185,
returning 343, 344 AsFloat and 47
223 AsInteger and 48
database engine See Borland integrity (key) violations 12, AssignField and 54
Database Engine 430 AsSmallInt and 57
database handles 185, 371 labels, autosizing 69 AsString and 57
database navigator 819 lookup tables See lookup AsTime and 59
buttons 819 tables AsWord and 59
activating 94 maintaining 699 TFieldType and 854
creating help for 385 master tables 456, 457
date fields 801, 802
enabling/disabling 787, moving through 819
984 assigning values 46, 47, 59
naming 174, 955
handling events 513 string values and 58
opening 565, 836
types 245, 900 database servers 541, 588 Date function 182
confirming deletions 144 read-only text 69 See also DateToStr,
Database Parameters Editor 588 referencing 172, 174 DayOfWeek, Now, Time
Database property 172 returning active 172, 174, 302 functions; DecodeDate
database servers rolling back changes 669 procedure
connecting to 127, 564 temporary 836 date/time formatting
dropping connections 217 Databases property 174 variables 163
Index 1013
handling events 522 private 631 bounding rectangle 206
controls 197 returning 343 DisplayFormat property 205
objects 197, 333, 499, 652 selecting 690 Currency vs. 166
detaching from servers testing existence 200 DisplayText and 207
database 217 directory list boxes 826 EditFormat and 226
detail tables See also list boxes displaying
linking to master 456, 457 drive combo boxes and 202 bitmaps 479
device constants synchronizing 833 BLOBs 106, 810, 817
fonts 198, 861 file list boxes and 286 automatically 61
media players 199 directory lists 826 columns and rows in
Device property 198 clearing text 117 grids 436, 561, 572, 573, 907
TFontDialogDevice and 861 columns 138 components 983
DeviceID property 198 counting items 689 controls 66, 380, 436, 904, 983
devices current directory data 175, 180, 983
input 400 displaying 201 column and row
output 577 selecting 565 format 191, 808, 830
screen 680 setting 200 datasets 650
DeviceType property 199 current drive 216 handling events 829, 830,
Open and 563 displaying files 286 867
TMPDeviceTypes and 898 filtering 286 memo fields 61
dgAlwaysShowEditor returning paths 348 OLE applications 902
selecting items 691 dialog boxes 436, 619, 904
constant 573
updating 41, 970 directory structures 202, 216
dgAlwaysShowSelection files 851
constant 573 Directory property 200
Drive and 216 combo boxes 287, 386, 854
dgCancelOnExit constant 574 directory lists 286
dgColLines constant 573 DirectoryExists function 200
DirectoryListBox file lists 286, 294, 855
dgColumnResize constant 573 forms 380, 608, 719, 919
dgConfirmDelete constant 574 component 826
DirLabel property 201 specifying position 617
dgEditing constant 573 Help Hints 721, 722
ApplyFileEditText and 41
dgIndicator constant 573 list boxes 411
DirList property 202
dgRowLines constant 573 message boxes 469, 491, 529
ApplyFileEditText and 41
dgRowSelect constant 573 notebook pages 347, 581
DisableControls method 202 online help 379
dgTabs constant 573 EnableControls and 243
dgTitles constant 573 panels 80
disabled controls, searching pictures 68
dialog boxes 862 for 147
See also common dialog boxes pop-up menus 33, 65, 613,
disabling 918
3-D effects 163
components 243 handling events 552
adding buttons 431
drag and drop 214 scroll bars 796
default 190
media player buttons 62, text 69, 859
borders 87
244, 787, 984 automatically 61
history lists 386
input 401, 402 navigator buttons 787, 984 data-aware
messages 464, 465, 468 OLE objects 14, 36, 60, 400, components 817, 822
defining buttons 899 775 edit boxes 68, 381
displaying 469, 491 scroll bars 681 input focus and 381
types 900 disconnecting datasets from lookup tables 68
modal 474 data sources 203 memos 381, 839
opening 724 disconnecting from servers resizeable 869
multi-page 958 database 217 warnings 720
updating file lists 41 disk drive See drive DisplayLabel property 205
dialogs See dialog boxes DiskFree function 203 DisplayName vs. 206
directories See also DiskSize function FieldName and 279
See also directory lists DiskSize function 204 DisplayName property 206
changing 109, 565, 826 See also DiskFree function display-only data formats 205,
creating 321, 473 Display property 204 207, 842
deleting 668 display windows 204 handling events 534, 556, 850
displaying structures 202, 216 See also media players DisplayRect property 206
Index 1015
edit boxes 795, 834, 887 ApplyRange and 42 enabling See activating
adding items 460 SetRangeEnd vs. 707 ENavClick type 245
borders 88 EditRangeStart method 230 TNavigateBtn and 900
copying text 354 ApplyRange and 42 EncodeDate function 246
data-aware 804, 806 SetRangeStart vs. 708 See also DateToStr,
validating required EditText property 231 EncodeTime functions;
characters 974 Text and 839 DecodeDate procedure
deleting items 117, 118, 171 ValidateEdit and 974 EncodeTime function 246
displaying items 381 EDivByZero object 231 See also DecodeTime
editing text 231 EFault object 232 procedure; EncodeDate
file lists and 41 EFCreateError object 232 function
hiding characters 595 EFilerError object 232 encoding time data 876
multiline 891 EFOpenError object 233 encryption 636
naming 839 EGPFault object 233 See also passwords
passwords and 595 EInOutError object 233 EndDoc method 247
resizing 68 EIntError object 234 BeginDoc and 76
restricting data entry EIntOverflow object 234 EndDrag method 248
valid characters only 175 EndMargin property 248
selecting text 67, 690, 696, 697 EInvalidCast object 235
EInvalidGraphic object 235 StartMarging and 736
getting starting
EInvalidGraphicOperation end-of-file status 251
position 696
setting case 108, 836 object 235 end-of-line status 111, 252, 687
testing for changes 478 EInvalidGridOperation EndPage property 249
edit buttons 560 object 236 EndPos property 249
Edit component 834 EInvalidImage object 236 AutoRewind and 65
Edit method 225 EInvalidOp object 236 Play and 609
AfterEdit and 29 EInvalidOpCode object 236 TimeFormat and 875
AutoEdit and 61 EInvalidOperation object 237 EndUpdate method 250
BeforeEdit and 74 EInvalidPointer object 237 SetUpdateState vs. 713
SetFields and 703 Eject method 237 Eof function 251
Edit mode 61, 225, 740 Wait and 987 See also Eoln, SeekEof
grids 229 ejecting loaded medium 237 functions
retrieving text strings 865 elephants and marshmallows EOF property 252
EditFormat property 226 See Pat Z Eoln function 252
Currency vs. 166 EListError object 238 See also Eof, SeekEof functions
editing Ellipse method 239 EOutlineChange type 253
See also changing ellipses 239, 605, 715 EOutlineError object 253
data connecting points 112 EOutOfMemory object 253
databases 60, 61, 225, 226 filling 785 EOutOfResources object 253
grids 229, 944 EMathError object 240 EOverflow object 254
events 533, 556 embedded OLE objects 902 EPageFault object 254
options 572, 573 EMCIDeviceError object 240 EParserError object 254
handling events 29, 74 EMenuError object 240 EPrinter object 255
strings 229, 944 EMPNotify type 240 EProcessorException object 255
handling events 533, 556 ERangeError object 255
text EMPPostNotify type 241
Empty property 241 Erase procedure 256
edit boxes 231 See also Rename procedure
list boxes 282 empty strings 242, 495, 843
EmptyStr constant 242 EraseSection method 257
masks 231 erasing files 195, 256
EditKey method 226 EmptyTable method 242
EnableControls method 242 erasing images 650
GotoKey and 361 EReadError object 258
GotoNearest and 361 DisableControls and 203
Enabled property 243–244 EReportError object 258
SetKey vs. 704
EnabledButtons property 244 EResNotFound object 258
EditMask property 227
EditMaskPtr and 229 AutoEnable vs. 62 error codes
TButtonSet and 787 media players 258, 259
EditMaskPtr property 229
EnableExceptionHandler error messages
EditorMode property 229
procedure 245 creating 173, 185, 262
EditRangeEnd method 230
Index 1017
underflow 261 Exp function 271 field objects 853
media players 240, 258, 259 See also Ln function creating 17, 23, 159
menus 240 Expand method 271 sets 49
opening files 233 Expanded property 272 pointers 425
outlines 253 Collapse and 133 returning 301
pointers 237 FullCollapse and 336 subsets 853
printing 255 FullExpand and 336 clearing 116
reporting 269 OnCollapse and 518 testing for 277
reports 258 OnExpand and 531 Field property 277
silent 11, 221 ExpandFileName function 273 FieldByName method 277
streams 233, 258, 262 expanding outline items 253, FieldClass property 277
base object 261 272, 273, 336, 417 FieldCount property 278
system resources 253, 254 handling events 531 FieldDefs property 278
text forms 254 exponentials CreateTable and 161
typecasting 235 See Exp function FieldName property 279
unhandled 269 Expression property 273 DisplayLabel and 206
ExceptObject function 275 ExtendedSelect property 274 DisplayName vs. 206
ExceptProc typed constant 269 ExtractFileExt function 274 FieldNo property 279–280
Exchange method 263 ExtractFileName function 274 fields 848
exchanging bytes 771 ExtractFilePath function 275 See also field objects; specific
Exclude procedure 263 EZeroDivide object 276 types
See also Include procedure allocating memory 179
Exclusive property 264 assigning values 40, 56, 410,
DeleteIndex and 196 F 703, 977
EmptyTable and 242 Fail procedure 276 Boolean 45
ExecProc method 265 See also New procedure date/time 47
Open vs. 564 faults floating-point 48
ExecSQL method 265 base exception object 232 integers 48
Open vs. 564 general protection 233 maximum 461
SQL and 733 invalid opcodes 236 minimum 473
executable files 268 page 254 required 663
message boxes and 466, 468 stack 260 string 58
Execute method 265–267 batch moves 452
fdAnsiOnly constant 567
Font and 320 calculated 95
fdBoth constant 198 handling events 508
ProblemTableName and 632 fdEffects constant 567
ExecuteMacro method 267 naming 279
fdFixedPitchOnly constant 567 changing data 98, 510, 800,
OnExecuteMacro and 530 fdForceFontExist constant 567
PokeData and 611 850
fdLimitSize constant 567 combo boxes and 804
PokeDataLines and 612 fdNoFaceSel constant 567 list boxes and 811
ExecuteMacroLines method 268 fdNoOEMFonts constant 567 combo boxes and
PokeData and 611 fdNoSimulations constant 567 multiple 218, 449, 574
PokeDataLines and 612 fdNoSizeSel constant 567 comparing values 42
ExeName property 268 fdNoStyleSel constant 567 copying contents 50
Exit procedure 269 fdNoVectorFonts constant 567 counting 156, 278, 393
See also Halt procedure database searches 428
fdPrinter constant 198
exit procedures displaying 983
fdScalableOnly constant 567
adding 22 indexes 280, 304, 393, 397, 415
calling 270 fdScreen constant 198
fdShowHelp constant 567 returning values 693
chaining 270 key 393, 428
installing 270 fdTrueTypeOnly constant 568
fdWysiwyg constant 568 searching on 305, 306
ExitCode variable 270 masks and 227, 839
See also ErrorAddr, ExitProc Field component 848
descendant objects 848 naming 487
variables null 42
ExitProc variable 270 Field Link Designer 456
specifying 116
See also ErrorAddr, ExitCode field names 206, 279 testing for 416
variables See also headers numbering 280
far calls and 270 returning 206 raw data
Index 1019
See also FleRead, FileSeek TFindItemKind and 857 selected text and 381
functions FindKey method 305 setting 703
fill patterns 92, 785 SetKey and 704 testing 97
brushes 764 FindNearest method 306 FocusControl method 317
pens 763 KeyExclusive and 427 FocusControl property 317
specifying 785 SetKey and 704 Focused method 318
FillChar procedure 295 FindNext function 307 Font common dialog box 860
See also Move procedure See also FindFirst function display options 861
filling bytes 295 FindText property 307 handling events 507, 847
FillRect method 295 ReplaceText and 660 limiting font size 459, 471
filter combo boxes 286, 855 First method 308–309 opening 266
file list boxes and 286 Post and 619 selecting fonts 319
file masks and 297, 455 FirstIndex property 309 setting default font 319
specifying initial items 840 FixedColor property 310 specifying behavior 567
Filter property 296–299 FixedCols property 311 specifying device 198, 861
FilterIndex and 299 FixedRows property 312 Font property 319–320
GraphicFilter and 364 fixed-width fonts 606 ParentFont and 593
Text and 840 fkCommand constant 305 FontDialog component 860
FilterComboBox component 855 fkHandle constant 305 fonts 319–320, 859, 860, 866
FilterIndex property 299 fkShortCut constant 305 applying 507, 847
filters 855 float fields 857 character widths 606
See also masks currency values and 166 color options 567
applying 41, 286 string values and 58 default 319
clearing text 117 FloatField component 857 headers 881
combo boxes 298 floating-point math naming 486, 861
data 42, 230, 231, 427, 706, exceptions 222, 254, 261, 276 pitch 606, 862
707, 708 base object 240 screen 320, 568
DDE applications 324 invalid opcodes 236 selecting 319, 567
displaying files 286 size
floating-point values 47, 48, 776,
list boxes 296–297 changing 68, 69
857 checking 844, 847
selecting text 690, 696, 697 conversions
getting starting setting 376, 459, 471, 609,
exception handling 222 726, 862
position 696 overflow conditions 254
specifying default 299 status, retrieving 593
underflow conditions 261 styles 765, 862
Find common dialog box 856 FloatToDecimal procedure 312
accessing 370 TrueType 320, 568
FloatToStr function 313 Fonts property 320
adding search strings 308
closing 128 FloatToStrF function 313 for statements
display options 857 FloatToText function 314 continuing 146
displaying 436, 619, 904 Currency and 166 exiting 90
Find Next button 532 FloatToTextFmt function 315 ForceDirectories procedure 321
opening 266 Currency and 166 Form component 862
specifying behavior 570 DisplayText and 207 form objects
Find method 300–301 FloodFill method 315 destroying 652
find sequences 301, 303, 307, 942 TFillStyle and 855 form properties See properties
FindClose procedure 301 Flush procedure 315 Format function 321
See also FindFirst, FindNext See also ShowerScald format specifiers 322–324
functions procedure format strings See strings
FindComponent method 301 FmtLoadStr function 316 format
FindDatabase method 302 See also Format funciton FormatBuf function 324
OpenDatabase and 565 FmtStr procedure 316 FormatChars property 324
FindDialog component 856 focus 215 FormatCount property 324
FindField method 302 active control 15, 317, 318
FormatDateTime functon 325
current form 16
FindFirst function 303 FormatFloat function 326
data-aware components 317
See also FindNext function Formats property 328
grids 132
FindIndexForFields method 304 moving 958 FormatCount and 325
FindItem method 304 handling events 505, 530 HasFormat and 373
Index 1021
See also ChDir function; goRangeSelect constant 572 specifying type 363
MkDir, RmDir procedures goRowMoving constant 572 testing existence 241
GetDriverNames method 343 goRowSelect constant 573 testing for changes 477
GetDriverParams method 344 goRowSizing constant 572 graphics tools 866
GetFieldNames method 344 goTabs constant 573 Graphics unit 793
GetFirstChild method 345 goThumbTracking constant 573 GridHeight property 364
GetFormatSettings GotoBookmark method 360 GridLineWidth property 365
procedure 345 FreeBookmark and 334 grids See data grids; draw grids;
GetFormImage method 345 TBookmark and 783 string grids
GetHelpContext method 346 GotoCurrent method 360 GridWidth property 365
GetIndexForPage method 346 GotoKey method 361 group boxes 868
GetIndexNames method 347 SetKey and 704 See also radio group boxes
GetItem method 348 GotoNearest method 361 GroupBox component 868
GetItemPath method 348 KeyExclusive and 427 GroupIndex property 366–368
GetLastChild method 349 SetKey and 704 grouping buttons 366, 928
GetLongHint function 349 GoToXY procedure 362 grouping menu items 367
GetMem procedure 350 See also CursorTo, WhereX, grouping related controls 868
See also Dispose, FreeMem, WhereY procedures
New procedures goVertLine constant 572
GPFs 233
H
GetNextChild method 351
GetParentForm function 351 graphic fields 866 Halt procedure 368
ValidParentForm vs. 975 associating with streams 678 See also Exit, RunError
GetPassword method 352 size, returning 726, 727 procedures
GetPrevChild method 352 streams and 678 Handle property 369–371
GetPrinter method 353 string values and 58 CursorPosChanged and 168
GetProfileChar function 353 writing to 444 HandleAllocated method 371
GetProfileStr function 353 graphic files HandleException method 372
GetResults method 353 filtering 364 OnException and 529
GetSelTextBuf method 354 loading 443, 444, 445, 640 HandleNeeded method 372
GetShortHint function 355 BLOBs 445 handles 369–371
invalid access 235, 236 bitmaps 653, 654
GetStoredProcNames
returning 363 Clipboard 338, 700
method 355
Graphic property 362 creating 373
GetTableNames method 356 GraphicExtension function 363 data access 177
GetText method 356 databases 185, 371
GraphicField component 866
GetTextBuf method 357 instance 382
GraphicFilter function 363
GetTextLen and 358 invalid operations 237, 254,
graphics 781, 865, 870, 873, 895,
GetTextItem method 357 535
917
GetTextLen method 358 MDI applications 120
See also images; pictures
GetTextBuf and 357 reports 661
adding 443
Glyph property 358 buttons and 902, 948 testing for 371
glyphs changing 510, 511 hardware exceptions 260
See also bitmaps Clipboard formats 373 base object 255
buttons 359 coloring 92, 793 interrupts 221, 260
returning 495 copying 49 memory 233
list boxes and 720 data-aware 810 stack 260
message boxes 467, 469 drawing 214 swap files 254
goAlwaysShowEditor exception handling 235 undefined instructions 236
constant 572 resources and 236, 258 HasFormat method 373
goColMoving constant 572 handles 369 HasItems property 374
goColSizing constant 572 painting backgrounds 764 Header component 869
goDrawFocusSelected pasting 596 header pages (networks) 880
constant 572 pictures vs. 865 headers 869
goEditing constant 572 resizing 748 borders 88
goFixedHorzLine constant 572 scaling 966, 999 fonts 881
goFixedVertLine constant 572 size 990 multi-line 684
goHorzLine constant 572 setting 376 resizing 36, 943
Index 1023
Index property 392–393 reading from 644, 645 Insert procedure 406
GetDataItem and 342 Boolean values 639 See also Concat, Copy, Length,
GetFirstChild and 345 integers 641 Pos functions; Delete
GetItem and 348 retrieving strings 646 procedure
GetItemPath and 348 accessing strings 978 InsertComponent method 406
GetLastChild and 349 writing to 995, 998, 999 InsertControl method 407
GetNextChild and 351 InitialDir property 398 InsertObject method 407–409
GetPrevChild and 352 initializing InsertOLEObjectDlg
GetTextItem and 358 components 158 function 409
Items and 423 objects 159, 409 PInitInfo and 605
IndexDefs property 393 OLE objects 496, 497, 500, ReleaseOLEInitInfo and 653
CreateTable and 161 502, 596 InsertRecord method 410
indexes object pointer 605 AppendRecord vs. 40
buttons 420 releasing memory 653 Post and 620
combo boxes 420 InitialValues property 399 instance handles 382
components 142 InitWinCrt procedure 399 instantiation 2
datasets 425 See also ScreenSize, applications 41, 773
fields 280, 304, 393, 397, 415 WindowOrg, WindowSize Clipboard 123
returning values 693 typed constants; forms 160
list boxes 418, 420, 906 WindowTitle variable printer objects 627
notebook pages 581 InOutRes variable 399 instructions
object lists 403 in-place activation 14, 36, 400 undefined 236
outlines 392, 907 See also OLE objects Int function 411
strings 403 InPlaceActive property 400 See also Frac, Round, Trunc
tables 393, 877 input functions
characteristics 575 See also I/O IntegerField component 878
clearing elements 116 exception handling 233
counting elements 156 integers 48, 773
input device, standard 400 conversions
counting fields 393 input dialog boxes 401, 402
creating 18, 23, 50, 157, exception handling 222
input focus 215 strings 328, 760
158, 878 active control 15, 317, 318
dBASE 273, 395 generic exceptions 234
current form 16 INI files and 998
entering fields 23, 394
data-aware components 317 out-of-range 255
naming 347, 486
retrieving grids 132 overflow conditions 234
information 394, 397, 971 moving 958 returning 411
searching on 305, 306 handling events 505, 530 values and INI files 641
secondary 395 selected text and 381 IntegralHeight property 411
deleting 196 setting 703 integrity violations 12, 430
IndexFieldCount property 393 testing 97 internal routines 294
IndexFieldNames property 394 input parameters interrupts
EditRangeEnd and 230 See also stored procedures debugger 221, 260
EditRangeStart and 231 Input variable 400 Interval property 412
FindNearest and 306 See also Output OnTimer and 561
IndexName and 395 variable;TextFile type IntToHex function 412
IndexFields property 394 InputBox function 401 See also IntToStr function
indexing queen InputQuery vs. 402 IntToStr function 413
See Frances InputQuery function 402 See also IntToHex, StrToInt
IndexName property 395 InputBox vs. 401 functions
FindNearest and 306 Insert method 402–405 invalid names 232
IndexFieldNames and 394 See also Add method invalid opcode exception 236
IndexOf method 395–397 AfterInsert and 29 invalid pointers 237
IndexOfObject method 397 Append vs. 38 Invalidate method 413
BeforeInsert and 75 Refresh and 650
informational messages 466, 468
Post and 619, 620
.INI files 353, 878 invisible borders 88
Insert mode 405, 740
creating 157 invisible components 983
erasing sections 257 Insert Object dialog box 409, 496,
invisible controls 380
International section 345 497
invisible forms 380
Index 1025
synchronizing with combo See also databases getting starting
boxes 833 adding data 460 position 696
testing for items 418 assigning values 208 selecting text 690
updating 41, 970 calculated fields and 95 validating required
list objects See object lists closing 28, 130, 218 characters 974
List property 441 counting fields 278 Mask property 455–456
FileEditStyle and 283 displaying values 68, 175, Filter and 298
First and 309 180, 449 Mask unit 228
Index Of and 396 current field 840 MaskEdit component 887
Last and 434 data sources 450 MaskFieldSeparator
Pack and 579 in columns 816 constant 228
ListBox component 884 multiple fields 218, 449, 574 MaskNoSave constant 228
literal characters opening 217, 219 masks 455–456, 887
masks 227, 231 returning specific fields 280, See also filters
live result sets (defined) 923 693 clearing text 117, 118
Ln function 442 setting current values 976 creating 227–228, 296
See also Exp function LookupDisplay property 449 data fields 227, 839
Lo function 443 Style and 770 deleting items 171
See also Hi, Swap functions LookupField property 449 displaying text 68
LoadField property Style and 770 editing 231
LookupDisplay and 449 LookupSource property 450 exception handling 224
LoadFromFile method 443–444 loops file lists 296–299, 456
LoadFromStream method 444 continuing 146 passwords and 595
loading graphic files 443, 444, exiting 90 pointers 229
445, 640 loRowLines constant 574 retrieving text strings 865
BLOBs 445 loTitles constant 574 returning changes 478
invalid access 235, 236 Low function 450 setting case 108, 227
LoadMemo method 444 See also High function testing for 415
LoadPicture method 445 lowercase characters 37, 227, validating entries 227, 974
LoadStr function 446 451, 754 master tables
Local property 446 See also uppercase linking detail tables 456, 457
Locale property 446–447 combo boxes 843 MasterFields property 456
TLocale and 886 edit boxes 108 MasterSource property 457
Locked property 447 masks 108 MasterFields and 456
loColLines constant 574 LowerCase function 451 matching whole words 570, 571
See also AnsiLowerCase, math exceptions
logarithm
UpperCase functions base object 234, 240
bases See Exp function
natural 442 low-order byte 443 conversions 222
logical fields 45, 783 divide-by-zero 232, 276
check boxes and 977 M overflow 234, 254
formatting data 208 range errors 255
macros undefined instructions 236
radio buttons and 976, 979 executing 267, 268, 530
string values and 58 underflow 261
reports 675 Max property 457
logical palettes 794 poking data and 611, 612 Min and 470
Login dialog box 448 main form 330, 452, 865 Position and 617
login parameters 541 main menus See menu bars SetParams and 706
login scripts 448 MainForm property 452 MaxAvail function 458
handling events 541, 886 MainMenu component 886 MaxFontSize property 459
LoginPrompt property 448 Mappings property 452 Maximize buttons 86
Longint types 48 Margin property 453–455 maximizing applications 554
lookup combo boxes 813 margins maximizing forms 86
See also combo boxes buttons 453
creating drop-down lists 770 MaxLength property 459
scroll bars 454 MaxPage property 460
specifying initial items 840 tab sets 248, 736
styles 770 MaxRecords property 460
mask edit boxes 839, 887 MaxTabNameLen constant 461
lookup tables 813, 815 selecting items 696, 697 MaxValue property 461
Index 1027
separators 103 Icon and 389 monetary formats 46
underlining characters 103 metafiles 895, 917 See also currency fields
Menu property 463 See also graphics Monochrome property 479
menu shortcut routines 8 adding 443, 470 monospaced fonts 567
menus 886, 918 Clipboard formats 85, 373 mouse buttons 882
accessing 370, 423, 615 coordinate mappings 391 clicking 119, 512, 513, 514,
breaking into columns 91, copying 49 521
894 fitting to images 748 shift keys and 544, 545,
coloring 135 handles 387 546
commands See menu items reading 640 determining state 946
Control (System) 86 size, setting 376 displaying menus 65, 552
displaying 33, 65, 613, 918 testing existence 241 testing for 897
handling events 552 testing for changes 477 mouse cursor
exception handling 240 method pointers See pointers changing image 523
MDI applications 991 methods 3, 5, 6, 7 moving 897
merging See merging menus MIDI sequencer See media specifying 166, 212
names, returning 615 players screen objects 167
objects and 614 milliseconds per day 485 testing for 480
OLE applications 368, 497 Min property 470 mouse events 544, 545, 546, 897,
sharing 614 Max and 457 946
Windows messages and 139 Position and 617 See also mouse buttons,
Merge method 463 SetParams and 706 clicking
merging menus 63, 367 MinFontSize property 471 drag-and-drop 77, 248, 522,
See also MDI applications Minimize buttons 86 523, 528, 828, 829, 837
non-MDI applications 63, Minimize method 472 clearing formats and 118
463, 967 OnMinimize and 544 disabling 214
OLE applications 368 minimized applications 389, 472, OLE objects 84, 903
message boxes 464, 465, 468 879 retrieving status 213
adding buttons 464, 466, 468 handling events 544, 554 setting mouse image 212
applications 723, 724 responding to 243
minimized forms 515, 992
defining buttons 899 returning coordinates 480
arranging icons 44, 872
displaying 469, 491, 529 simulating 94, 119
captions 103
exceptions 720 specifying icons 388 mouse image constants 166, 212
types 900 minimizing forms 86 MouseToCell method 480
message constants 466, 468 MinPage property 472 Move method 480
message dialog box routines 8 MinValue property 473 Move procedure 481
Message property 224, 262 See also FillChar procedure;
mixed case
MessageBox method 464 SizeOf function
See also lowercase; uppercase
MessageDlg function 465 masks 108 MoveBy method 482
TMsgDlgButtons and 899 Post and 619
MkDir procedure 473
TMsgDlgType and 900 See also ChDir, CreateDir, MovedCount property 482
MessageDlgPos function 468 GetDir, RmDir procedures MoveTo method 483–484
TMsgDlgButtons and 899 CreateDir vs. 473 PenPos vs. 601
TMsgDlgType and 900 modal dialog boxes 474, 724 TAttachMode and 775
messages modal forms 724 moving
confirmation closing 474 bytes 481
deleting data 144, 574 terminating 896 columns and rows in
data states 560 grids 572, 898, 907
ModalResult property 474
error See error messages handling events 519, 554
ShowModal and 724 components 31
OLE applications 560, 949 TModalResult and 896
processing 543, 633, 895 cursors in databases 306, 361
Mode property 475–477 specified distance 482
warning 466, 468 TBatchMode and 775
common dialog boxes 568, to first record 309
TMPModes and 899 to last record 434
569
TPenMode and 917 to next record 491
displaying 720
Metafile property 470 Modified property 477–479 to previous record 631
Bitmap and 81 OnNewRecord and 547 data 648, 931
modifying See changing; editing
Index 1029
Resume and 666, 667 object lists 883 OLE See OLE objects
Save and 676 accessing items 424, 498 pasting 84, 340, 596, 598
StartRecording and 738 adding items 18, 403 persistent 373
Step and 741, 742 arrays, allocated size 102 pop-up menus and 614
NotifyValue property 493 Clipboard formats 328 referencing 853
TMPNotifyValues and 899 counting items 155 retrieving from Clipboard 49
Now function 494 deleting items 117, 193, 579, returning names 113
See also Date, DateTimeToStr, 654 Objects property 498–499
Time functions exception handling 238, 261 IndexOfObject and 397
null fields 42 item position 396 Move and 481
specifying 116 moving items 263, 481 ObjItem property 499
testing for 416 referencing items 441 Odd function 500
null values 116, 703 removing components 656 See also Addr, Seg functions
testing for 415 returning items 309, 434 odd numbers 500
NullStr constant 495 updating 77, 250 odDisabled constant 832
EmptyStr and 495 object methods 3 odFocused constant 832
null-terminated strings 132, 757 object pointers 102, 301, 425 odSelected constant 832
converting 755, 846 accessing 424 OEM characters 501
reading 354, 357, 708, 710 drag and drop 828, 837 OEMConvert property 501
returning 356 initialization information 605 ofAllowMultiSelect constant 569
writing 710 nil items 579 ofCreatePrompt constant 569
numbers 973 returning 309, 434 ofExtensionDifferent
See also integers storing 441 constant 569
binary-coded decimal 45 object types ofFileMustExist constant 569
currency, formatting 163 TField 853 offsets 501–502
dates, formatting 163 ObjectMenuItem property 497 ofHideReadOnly constant 569
decimal 620, 727 object-oriented programming 2 ofNoChangeDir constant 569
large 878 objects 2 ofNoReadOnlyReturn
masks and 227 See also components
constant 569
odd 500 addresses 26
out-of-range errors 255 ancestor 3, 114 ofNoTestFileCreate constant 569
random See random numbers application 41 ofNoValidate constant 569
rounding 669 arrays 499 ofOverwritePrompt
time, formatting 163 as operator and 235 constant 570
numeric fields 48, 878, 947, 964 assignment 51 ofPathMustExist constant 570
floating-point numbers 47, Clipboard 49, 58 ofReadOnly constant 570
48, 776, 857 associated with strings 23, Ofs function 501–502
setting precision 620 397, 408, 498, 499 ofShareAware constant 570
string values and 58 accessing 137, 498, 499, ofShowHelp constant 570
NumGlyphs property 495 673 OK buttons 431, 468
TNumGlyphs and 902 base exception message boxes 465, 466, 468
nvAborted constant 494 faults 232 OLE applications
nvFailure constant 494 hardware 255 container
nvSuccessful constant 493 math errors 234, 240 testing for changes 478
nvSuperseded constant 493 streams 233, 261 context-sensitive help 149
changing 510 displaying data 902
coloring 134, 137, 793 menus 497
O components vs. 2 merging 368
oaAdd constant 484 constructing 159, 333 messages 560, 949
oaAddChild constant 484 controls vs. 2 status bars 447, 560
oaInsert constant 484 descendant 848 OLE containers 902
destroying 197, 333, 499, 652 See also OLE objects
ObjClass property 496
determining class 115 accessing 742
ObjDoc property 496 dynamic, deallocating 276
ObjItem vs. 500 activating 14
handles 369 resizing 70
Object Inspector 2 initializing 159, 409
Object Linking and Embedding testing 502
listed 3 OLE links 441
See OLE naming 879
Index 1031
TShowHintEvent and 946 files 41, 287, 905 adding items 20, 21, 404, 439,
OnSized event 558 exception handling 233 443, 840, 910
TSectionEvent and 943 lookup tables 217 associating data with 22, 24,
OnSizing event 559 media players 563 171, 408
TSectionEvent and 943 automatically 64 borders 88
OnStateChange event 559 modal forms 724 collapsing 133, 253, 336
OnStatusLineEvent event 560 opening files 281, 664 handling events 518
TStatusLineEvent and 949 OpenLink method 566 counting items 419
OnTimer event 560 OpenLink property deleting items 117, 194
initiating 962 SetLink and 705 display options 769, 911
Interval and 412 Options property 566–575 drawing items 99, 420, 911
OnTopLeftChanged event 561 EditorMode and 229 options 571, 577
OnUpdateData event 561 MaxFontSize and 459 exception handling 253
OnValidate event 562 MaxPage and 460 expanding 253, 272, 273, 336,
EditMask and 227 MinFontSize and 471 417
Required and 663 MinPage and 472 handling events 531
TFieldNotifyEvent and 850 PrintRange and 629 indenting items 107, 438
ooDrawFocusRect constant 572 TColorDialogOptions moving items 107, 484, 775,
and 794 790
ooDrawTreeRoot constant 571
TDBGridOptions and 810 pictures and 602, 603, 604
ooStretchBitmaps constant 572 reindexing items 77, 250, 712
opcodes TDBLookupListOptions
and 816 retrieving items 342, 351, 358,
invalid 236 374, 392
Open common dialog box 905 TFindOptions and 857
TFontDialogOptions and 861 active 694
directories at run time 671
setting initial 398 TGridOptions and 867
TOpenOptions and 906 first 345
file names last 349
default extensions 191, TOutlineOptions and 911
TPrintDialogOptions and 920 onscreen location 348
851 previous 352
displaying 287, 386, 854 options See user options
Oracle tables testing for visible items 417
entering 283, 851 updating 77, 250, 712
opening 266 stored procedures 743
overloading 578 OutlineStyle property 577
options 906 FullCollapse and 336
selecting files 290 Ord function 575
See also Chr function FullExpand and 336
file masks and 296, 299 OnCollapse and 518
specifying behavior 569 ordinal values 575
TOutlineStyle and 911
titles 880 ordinal-type expressions 575
out-of-memory exceptions 253
Open method 562–564 Orientation property 575
OutOfMemoryError
Active vs. 14 TPrinterOrientation and 922
procedure 577
AfterOpen and 29 Origin typed constant 576
BeforeOpen and 75 out-of-range errors 255
osPictureText constant 577
Capabilities and 101 osPlusMinusPictureText output
DeviceID and 199 See also I/O
constant 577 exception handling 233
DeviceType and 199 osPlusMinusText constant 577
ExecSQL vs. 265 media players 204, 206
osText constant 577 output device, standard 577
SQL and 733 osTreePictureText constant 577
Start and 735 output file, standard 578
osTreeText constant 577 output parameters 353
Wait and 987 otOwnerDraw constant 769
OpenCurrent method 564 See also stored procedures
otStandard constant 769 Output variable 577, 578
OpenDatabase method 565 Outline component 908
CloseDatabase and 127 See also Input variable;
outline nodes 910 TextFile type
OpenDialog component 905 creating 157
opening Write and 578
identifying parent item 591 Writeln and 578
Clipboard 124, 562 paths 337, 426
databases 565, 836 overflow math exceptions 234,
row position 423 254
database servers 541, 588 outlines 908
datasets 14, 564 overlapping
active item 694 components 91, 698
handling events 29, 75
Index 1033
handling events 541, 916 images 602 DDE macros 886
Paradox tables 26 Pie method 605 events 800
deleting 655, 658 PInitInfo property 605 closing forms 793
handling events 352, 551 DataFormat and 175 keyboard 881, 882
Paste Special dialog box 500, ObjClass and 496 mouse 897
596, 598 ObjDoc and 497 grids
PasteFromClipboard ObjItem and 500 changing text 944
method 596 pipe (|) characters drawing events 829, 830,
PasteSpecialDlg function 596 filters 296, 298 867
BOLEFormat and 84 hints 383 moving columns and
PasteSpecialEnabled and 598 Pitch property 606 rows 898
PInitInfo and 605 TFontPitch and 862 selecting cells 943
ReleaseOLEInitInfo and 653 pixels 607 Help Hints 946
PasteSpecialEnabled client areas 120, 122 incrementing or
metafiles and 391 decrementing 695
function 598
returning 608 invalid 237
BOLEFormat and 84
list boxes
pasting graphics 596 Pixels property 607 drawing events 832
pasting objects 340 PixelsPerInch property 607–609 owner-draw 889, 912
OLE 84, 596, 598 Scaled and 679 masks 229
pasting text 596 Play method 609 nil 654, 656
patterns 80 EndPos and 250 objects 102, 425
See also fill patterns StartPos and 737 accessing 424
Pause method 598 Wait and 987 drag and drop 828, 837
Wait and 987 playing media players 609 initialization
PauseOnly method 600 starting position 735, 737 information 605
Wait and 987 stopping 742 returning 301, 309, 434
pausing media players 598, 600 pmBlack constant 475 storing 441
Pen property 600 pmCopy constant 475 scroll bars 941
NewPage and 489 pmMask constant 476 tab sets 956
PenPos property 601 pmMaskNotPen constant 476 owner-draw 832, 889
MoveTo vs. 483 pmMaskPenNot constant 476 text 850, 865
pens 866, 916 pmMerge constant 476 Windows messages 895
current position 601 pmMergeNotPen constant 476 PokeData method 611
modes 917 pmMergePenNot constant 476 ExecuteMacro and 267
moving 483 pmNop constant 475 ExecuteMacroLines and 268
setting color 475 pmNot constant 475 OnChange and 509
specifying 600 pmNotCopy constant 476 OnPokeData and 551
styles 763, 917 pmNotMask constant 476 PokeDataLines vs. 612
persistent objects 373 pmNotMerge constant 476 PokeDataLines method 611
Pi function 601 pmNotXor constant 476 ExecuteMacro and 267
Picture property 602 pmWhite constant 475 ExecuteMacroLines and 268
PictureClosed property 602 OnPokeData and 551
pmXor constant 476
PictureLeaf property 603 PokeData vs. 611
poDefault constant 617
PictureMinus property 603 poking data 611, 841
poDefaultPosOnly constant 617 See also DDE applications
PictureOpen property 604 poDefaultSizeOnly constant 617
PicturePlus property 604 handling events 509, 551
poDesigned constant 617 poLandscape constant 576
pictures 917 poDisablePrintToFile
See also images Polygon method 612
constant 568 polygons 612
adding 443, 445 poHelp constant 568
Clipboard formats 373 PolyLine method 613
Point function 610 poNone constant 630
copying 49 point routines 8
displaying 68 poPageNums constant 568
pointer, mouse See mouse cursor poPortrait constant 576
graphics vs. 865 pointers
outlines 577, 602, 603, 604 poPrintToFile constant 568
applications 871 poPrintToFit constant 630
reading 640
data 800, 830, 850
size, setting 376 outlines 342 poProportional constant 630
specifying type 81, 363, 389 pop-up menus 918
Index 1035
Ptr function 634 See also Random function; realizing palettes 781
See also Addr function RandSeed variable ReAllocMem function 647
ptResult constant 916 RandSeed variable 635, 636 See also AllocMem function
ptUnknown constant 916 See also Random function; RecalcReport method 647
push buttons 779, 786 Randomize procedure RecordCount property 649
See also buttons Range property 636 recording 874
specifying default 190 HorzScrollBar and 387 starting 738
Margin and 454 stopping 250, 742
Q Position and 617
ranges
records
See also databases
qualified names 519 data searches 427 adding fields 848
queries canceling 96 batch operations 776
See also SQL statements; changing 230, 231 bookmarks and 334, 339,
stored procedures setting 42, 706, 707, 708 360, 783
allocating memory 342 exception handling 255 changing 97, 110, 219, 225,
arrays 587 lowest value 450 479
batch operations and 733 page 460, 472, 629, 923 counting 649
closing forms 793 first page 335 batch moves 106, 430,
handling events 800 last page 905 482, 632, 648
heterogeneous 733 returning current deleting from tables 194, 242
linked 180 page 582 handling events 28, 74
moving through 819 raw data inserting 38, 40, 405, 410
parameterized 923 returning 341 handling events 29, 75,
accessing data 180 setting 702 547
optimizing 622, 623, 966, Read method 637 moving to specific 361
968 Read procedure 638 number of 293
referencing 425, 446, 585 See also Eof, ReadKey posting 619, 973
result sets 353, 663, 966, 972 functions, Readln, Write, handling events 30, 75
defined 923 Writeln, procedures retrieving 60
running 265, 622, 733, 968 read/write exceptions 233, 258, Rect function 648
temporary tables 631 262 Rectangle method 649
Query component 923 base object 261 RoundRect vs. 670
questions 466, 468 file creation 232 rectangle routines 8
ReadBool method 639 rectangles 648, 715, 931
R ReadBuf function 639 adding graphics 748
See also ReadKey function bounding 89, 421
radio buttons 927 ReadFrom method 640 cells in grids 104
3-D controls and 163 ReadInteger method 641 client areas 121
accessing 95 ReadKey function 642 clipping 123, 845
aligning captions 32, 883 See also KeyPressed, ReadBuf display windows 206
columns 138 functions grids 867
data-aware 95, 820 Readln procedure 641 drawing 89, 215, 332, 649
setting current See also Read, Writeln rounded 670
contents 976, 979 filling 295, 332, 785
procedures
grouping 928 input focus and 215
selecting 111 read-only controls 643
read-only data 97, 643, 644 rounded
radio group boxes 820, 928 drawing 670
returning strings 422 read-only fields 644, 822
references
RadioButton component 927 ReadOnly property 643–644
components 485, 519
RadioGroup component 928 CanModify and 98
databases 172, 174
ValueChecked and 978
Random function 635 fields 279, 487
ValueUnchecked and 981
See also Randomize objects 441, 853
procedure; RandSeed read-only result sets
parameterized queries 425,
variable (defined) 923 446, 585
random numbers read-only text 69 Refresh method 650
generating 635, 636 ReadSection method 644 Repaint vs. 659
initializing generator 635 ReadSectionValues method 645
Randomize procedure 635 ReadString method 646
Index 1037
RunError procedure 675 scLineDown constant 941 scrolling 683, 938, 939, 941
See also Exit, Halt procedures scLineUp constant 941 See also scroll bars; scroll boxes
RunMacro method 675 scPageDown constant 941 forms 66, 681, 682, 938
running applications 674, 937, scPageUp constant 941 handling events 941
943 scPosition constant 941 horizontal scroll bars
handling events 504, 521 screen coordinates 680, 918 and 387
other Windows and bounding rectangle 89 vertical scroll bars and 982
Delphi 521 client areas 120, 121, 122 grids 573, 681
running batch operations 267 controls 436, 904 memos 681
running reports 70, 661, 674 dialog boxes 436, 904 notebook pages 66
initial values 399 screen devices 680 scroll boxes 682
run-time errors 675 screen fonts 198, 568 ScrollInView method 682
Abstract and 13 screen objects 937 ScrollPos property 683
addresses 259 creating 680 ScrollTo procedure 683
handlers 260, 269 setting size 991 See also GoToXY procedure
run-time library 8 size, setting 376 scTop constant 941
specifying mouse cursor scTrack constant 941
S image 167 sdAllowCreate constant 690
Screen variable 679 sdPerformCreate constant 691
Save common dialog box 936 screens sdPrompt constant 691
directories clearing 131 search key buffer 704
setting initial 398 flood filling 315, 855 searching for components 301
file names repainting 77, 250, 650, 659 searching for data 427, 428
default extensions 191, supported fonts 320 key fields and 305, 306, 361,
851 ScreenSize typed constant 680 704
displaying 287, 386, 854 ScreenToClient method 680 multiple fields 226
entering 283, 851 ranges 427
scroll bars 157, 938
opening 266 canceling 96
adding 387, 432, 681, 982
selecting files 290 changing 230, 231
file masks and 296, 299 automatically displaying 66
disabling 681 setting 42, 706, 707, 708
specifying behavior 569 searching for disabled
titles 880 displaying 796
handling events 555, 941 controls 147
Save method 676 searching for strings 306, 616
incrementing 457, 470
SaveDialog component 936 large change 433 finding next occurrence 571
SaveToFile method 677 margins 454 searching for text 308, 856
LoadFromFile and 444 moving thumb tabs 939, 941 handling events 532, 553
LoadFromStream and 444 specifying position 617, matching whole words 570,
SaveToStream method 678 706 571
LoadFromFile and 444 orientation options 939, 942 replace options 932
LoadFromStream and 444 scrolling ranges 636 string lists 300
saving setting position 683 secondary indexes 395
components 677 small change 728 deleting 196
controls 677 states 941 Sections property 684
files 287, 936 scroll boxes 939 SectionWidth property 684
reports 660 adding scroll bars 387, 432, security 448
sbHorizontal constant 432 982 login events 541, 886
sbVertical constant 432 borders 88 password events 916
ScaleBy method 678 moving 391, 433, 457, 470, Seek method 685
scaled fonts 567 728 Seek procedure 685
Scaled property 679 scrolling 682 See also FilePos function
PixelsPerInch and 608 scroll buttons SeekEof function 686
scaling controls 678 tab set controls 66, 248 See also Eof, SeekEoln
scaling forms 679 ScrollBar component 938 functions
scaling graphics 966, 999 ScrollBars property 681 SeekEoln function 687
scan codes (keyboard) 881 TScrollStyle and 942 See also Eoln, SeekEof
scBottom constant 941 ScrollBox component 939 functions
scEndScroll constant 941 ScrollBy method 681 Seg function 688
Index 1039
ModalResult and 474 changing 97 testing for 446
ShowModal method 724 closing datasets 14 SQL transactions 972
silent exceptions 221 handling events 28, 73 committing 139
simple combo boxes 766 connecting to datasets 203, initiating 738, 962
simulating click events 119 243 isolation levels 930, 962
navigator buttons 94, 119 counting records 649 rolling back 669
Sin function 725 creating 587, 733 Sqr function 733
See also ArcTan, Cos, TypeOf multiple 733 See also Sqrt function
functions data states 740 Sqrt function 733
sine 725 deleting records 194 See also Sqr function
single-line borders 87, 88 handling events 28, 74 square root 733
single-step interrupts 260 executing 265, 564, 622, 733, squares 715
968 SS register value 734
singleton results 950
problems with 842 ssAlt constant 881, 946
Size property 725–727 inserting records 38, 40, 405,
Height vs. 376 ssBoth constant 681
410
SizeOf function 727 ssCtrl constant 882, 946
handling events 29, 75,
See also FillChar, GetMem, 547 ssDouble constant 882, 946
Move procedures opening datasets 14, 564 SSeg function 734
SmallChange property 728 handling events 29, 75 See also CSeg, DSeg, SPtr
Max and 457 optimizing 622, 623, 966, 968 functions
Min and 470 parameters 914, 915 ssHorizontal constant 681
TScrollBarInc and 939 adding 25, 160 ssLeft constant 882, 946
Smallint types 947 assigning data 50, 54, 56, ssMiddle constant 882, 946
batch moves and 57 180, 182, 415 ssNone constant 681
SmallintField component 947 BCD values 45 ssRight constant 946
SMPTE time formats 875 Boolean values 45 ssShift constant 881, 946
Sort method 728 currency values 46 ssVertical constant 681
Sorted property 729–730 date/time values 46, 59 stack exceptions 260
sorting dynamic queries 585 stack pointer 731
items in lists 729 float values 47 stacking controls 92, 698
strings in lists 728, 730 integer values 48
string values 57 stacking controls See Z order
sound effects See media players standard input device 400
word values 59
Source property 730 clearing 51, 116, 657 standard output device 577
Spacing property 731 data assignments 116 standard output file 578
speed buttons 948 copying 50, 54, 341, 342, Start property 735
See also buttons 702 Rewind and 667
adding glyphs 359, 495 counting 156, 586 TimeFormat and 875
aligning images 787 naming 486 StartMargin property 736
arranging text and referencing 425, 585 EndMargin and 248
images 731 restoring 51 StartPage property 736
as check boxes 35 returning 353 StartPos property 737
grouping 366 saving 51 AutoRewind and 65
margins 453 setting to null 116 Play and 609
multiple images 495 passthrough SQL and 663, TimeFormat and 875
selecting 34, 119, 211, 366 923 StartRecording method 738
styles 788 posting records 619, 973 EndPos and 250
SpeedButton component 948 handling events 30, 75 StartPos and 737
SPtr function 731 result sets 353, 663, 966, 972 Wait and 987
See also SSeg function defined 923 StartTransaction method 738
SQL property 732 updating data 972 Commit and 139
SQL servers 923 SQL tables 923 Rollback and 669
opening databases 541, 588 returning names 356 State property 739–740
SQL statements 923 searching for data 230, 231, CheckBrowseMode and 110
See also queries 306, 706, 707, 708 dsEditModes and 219
allocating memory 342 security 448 Edit and 225
associating with login events 541, 886 OnDateChange and 520
databases 174 password events 916
Index 1041
returning coordinates 694, comparing 745, 750, 751 treating as blocks 710
867 case insensitive 37, 140, updating 77, 250
rows 753 Strings property 749
counting 672, 985, 986 case sensitive 37, 140 StrLCat function 750
current 480 concatenating 143, 744, 746, See also SizeOf, StrCat
displaying 436, 561, 572, 750 functions
907 conversions 58 StrLComp function 751
moving 898, 907 data to 843 See also StrComp, StrIComp,
setting size 192, 672 exception handling 222 StrLIComp functions
scrolling 681 converting 743 StrLCopy function 752
width 366 null-terminated 755, 846 MaxLen and 752
string lists 953 Pascal-type 756 StrLen function 752
accessing strings 978 to dates 759 See also StrEnd function
adding strings 19, 27, 403, 443 to integers 760, 761
to lowercase 37, 451, 754 StrLFmt function 753
and objects 23, 408, 498 StrLIComp function 753
changing items 511, 979 to null-terminated 756
to numbers 973 See also StrComp, StrIComp,
counting items 155 StrLComp functions
deleting items 117, 193 to Pascal-type 755
to time formats 759, 762 StrLower function 754
duplicate strings 221, 834
to uppercase 38, 762, 973 See also StrUpper function
exception handling 238, 261
headers and 684 copying 745, 746, 752, 755, StrMove function 754
INI files and 644, 645 756, 757 See also Move function
item position 396 counting 155 StrNew function 755
locating objects 397 deleting 193 See also GetMem procedure;
moving items 263, 481 display-only 207, 842 StrDispose function
multiple strings and 356, 710 handling events 534, 556, stRoundRect constant 715
searching for items 300 850 stRoundSquare constant 715
sorting strings 728, 730 disposing 210, 746 StrPas function 755
updating 77, 250 editing 229, 944 See also StrPCopy function
string tables 316 handling events 533, 556 StrPCopy function 756
string types 57, 58, 955 empty 242, 495, 843 See also StrCopy function
captions 790 end 747 StrPLCopy function 757
exceeding maximum 708 StrPos functions 756, 757
StringField component 951
exception handling 238 StrRScan function 757
StringGrid component 951 finding next occurrence 571
strings 954 See also StrScan function
first occurrence 756–757 StrScan function 758
accessing 105, 137, 499, 673, format 322–324
749, 978 See also StrRScan function
INI files and 646, 978, 999 Chr and 758
adding objects 23, 397, 408, length 437
498 StrToDate function 759
loading 446 See also DateToStr,
allocating 489 maximum length 354, 839
allocating buffers 744 StrToDateTime, StrToTime
merging See concatenating functions
appending 40 moving 263, 481, 754
arrays 105, 137 StrToDateTime function 759
new 489, 755 See also DateTimeToStr,
assigning 55 null-terminated 132, 710,
changing 511, 979 StrToDate, StrToTime
744, 757 functions
characters reading 354, 357, 708, 710
converting to StrToFloat function 760
returning 356
uppercase 969 exception handling 222
outline items and 358
first occurence 758 Pascal-type 755, 757 StrToInt function 760
last occurence 757 position, returning 396 See also IntToHex, IntToStr,
number 752 StrToIntDef functions
maximum 744 retrieving 422, 865
searching for 306 exception handling 222
writing to windows StrToIntDef function 761
996–997 substrings
deleting 195 See also IntToStr, StrToInt
clearing 117 functions
Clipboard and 58 inserting 406
returning 150 StrToTime function 762
combo boxes 208
searching for 616
returning 422
Index 1043
Tag property 773 TCopyMode type 797 TDrawGrid component 830
taLeftJustify constant 32, 33 tcUpperCase constant 843 TDrawItemEvent method
TAlign type 773 TCurrencyField component 797 TOwnerDrawState and 912
TAlignment type 773, 883 TCursor type 798 TDrawItemEvent type 832
TApplication component 773 TCustomColors type 798 TDrawTabEvent type 832
taRightJustify constant 32, 33 TDatabase component 798 TDriveComboBox
TAttachMode type 775 TDataChangeEvent type 800 component 832
TAutoActivate type 775 TDataMode type 800 TDuplicates type 834
TBatchMode type 775 TDataSetNotifyEvent type 800 technical support 1
BatchMove and 72 TDataSetState type 800 TEdit component 834
TBatchMove component 776 dsEditModes and 219 TDBEdit vs. 807
TBCDField component 776 State and 740 TMemo vs. 891
TBevel component 777 TDataSource component 801 TEditCharCase type 836
TBevelShape type 778 TDataChangeEvent and 800 Temporary property 836
TBevelStyle type 778 TTable and 956 TEndDragEvent type 837
TBevelWidth type 779 TDateField component 801 Terminate method 837
tbHorizontal constant 872 TDateTime type 802 Terminated property 837
TBitBtn component 779 TDateTimeField component 802 terminating applications 11, 13,
TBitBtnKind type 780 TDBCheckBox component 803 269, 270, 368
TBitmap object 781 TDBComboBox component 804 terminating batch
TBlobField component 781 TDBEdit component 806 operations 12, 13
TBlobStream object 782 TDBError type 224 terminating print jobs 11, 247
TBlobStreamMode type 783 TDBGrid component 808 testing status 12
TBookmark type 783 TDBGridOption type 809 terminating sessions
TBooleanField component 783 TDBGridOptions type 809 unexpectedly 225
TBorderIcons type 784 TDBImage component 810 Test8086 variable 838
TBorderStyle type 784 TDBListBox component 811 testing for active control 15, 318
TBorderWidth type 784 TDBLookupCombo testing for active form 16
TBrush object 785 component 813 TExceptionEventType 838
TBrushStyle type 785 TDBLookupComboStyle text 839–843, 891
TButton component 786 type 814 See also captions; labels; titles
TButtonLayout type 787 TDBLookupListOption type 816 aligning 32–34
TButtonSet type 787 TDBLookupListOptions appending 39
TButtonStyle type 787 type 816 blocks 690, 710
tbVertical constant 872 TDBMemo component 817 color options 135
TBytesField component 788 TDBNavigator component 819 conversions
TCanvas object 789 TDBRadioGroup OEM characters 501
component 820 copying 58, 152, 354, 357, 710
TCaption type 790
TDBText component 822 edit boxes 354
TChangeRange type 790 deleting 117, 118, 193–194
TCheckBox component 790 TDDEClientConv
Clipboard and 117, 171,
TCheckBoxState type 791 component 823 328
TClipboard object 792 TDDEClientItem displaying 69, 859
TCloseAction type 792 component 824 automatically 61
TCloseEvent type 792 TDDEServerConv data-aware
TCloseQueryEvent type 793 component 825 components 817, 822
tcLowerCase constant 843 TDDEServerItem edit boxes 68, 381
TColor type 793 component 825 input focus and 381
TColorDialog component 794 TDirectoryListBox lookup tables 68
TColorDialogOptions type 794 component 826 memos 381, 839
TComboBox component 795 TDragDropEvent type 828 resizeable 869
TComboBoxStyle type 796 TDragMode type 828 drawing 845
TComponent type 3–5 TDragOverEvent type 828 editing
TDragState type 829 edit boxes 231
TComponentName type 796
TDrawCellEvent type 829 list boxes 282
TControl type 5–6 masks 231
TControlScrollBar object 796 TGridDrawState and 867
entering
TDrawDataCellEvent type 830
Index 1045
See also Date, Now, TimeToStr TMessageEvent type 895 TPoint type 918
functions; DecodeTime TMetafile object 895 TPointerList type 442
procedure TModalResult type 896 TPopupAlignment type 918
TimeField component 961 TMouseButton type 897 TPopupMenu component 918
TimeFormat property 874 TMouseEvent type 897 TPosition type 919
EndPos and 250 TMouseMoveEvent type 897 TPrintDialog component 920
Length and 437 TMovedEvent type 898 TPrintDialogOptions type 920
Position and 618 TMPBtnType type 898 TPrinter object 921
TMPTimeFormats and 899 TMPDevCapsSet type 898 TPrinterOrientation type 922
TrackLength and 925 TMPDeviceTypes type 898 TPrinterSetupDialog
TrackPosition and 926 TMPModes type 899 component 922
Timer component 962 TMPNotifyValues type 899 TPrintRange type 922
timer events 561 TMPTimeFormats type 899 TPrintScale type 923
initiating 412 TMsgDlgButtons type 899 TQuery component 923
responding to 243 TMsgDlgType type 900 TrackCursor procedure 925
TimeToStr function 876 TNavigateBtn type 900 See also ScrollTo procedure
See also DateTimeToStr, TrackLength property 925
TNotebook component 900
DateToStr, StrToDateTime,
TNotifyEvent type 901 TrackPosition property 926
Time functions
TNumGlyphs type 902 Tracks property 927
TIndexDef object 877
TObject type TRadioButton component 927
TIndexDefs object 877
AssignValue and 56 TRadioGroup component 928
TIndexOptions type 878
AddIndex and 23 toggles See check boxes trailing blanks
TOLEContainer component 902 masks 227
TIniFile object 878
TOLEDropNotify object 903 transactions 972
TIntegerField component 878
tool bars 913, 948 committing 139
tiReadCommitted constant 930 initiating 738, 962
tiRepeatableRead constant 930 tool palettes 913, 948
ToolHelp DLL 245 isolation levels 930, 962
title bars 784 rolling back 669
adding icons 86, 784 Top property 904
ToPage property 904 TransIsolation property 930
labels 103, 880 StartTransaction and 738
Title property 879–880 TOpenDialog component 905
TOpenOptions type 906 TTransIsolation and 962
TitleFont property 881 Transliterate property 930
titles 879–880 TopIndex property 906
TopItem property 907 transparent controls 931
See also captions; labels; text transparent images 93
TKey type 881 TopRow property 907
OnTopLeftChanged and 561 Transparent property 931
TKeyEvent type 881 TRect type 931
TKeyPressEvent type 882 TOutline component 908
EOutlineChange and 253 Rect vs. 648
TLabel component 882 TReplaceDialog component 932
TLeftRight type 883 TOutlineNode object 910
TOutlineOptions type 911 TReport component 933
TList object 883 trigonometric functions 43, 154,
TListBox component 884 TOutlineStyle type 911
TOutlineType type 911 725
TDBListBox vs. 811 TrueType fonts 320, 568
TListBoxStyle type 885 TOwnerDrawState type 911
TPaintBox component 912 Trunc function 934
TLocale type 886 See also Int, Round functions
TLoginEvent type 886 TPanel component 913
TPanelBevel type 914 Truncate method 934
TMacroEvent type 886 Truncate procedure 935
TMainMenu component 886 TParam object 914
TParamBindMode type 915 See also Reset, Rewrite, Seek
TMaskEdit component 887 procedures
TMeasureItemEvent type 889 TParams object 915
TParamType type 916 TSaveDialog component 936
TMeasureTabEvent type 889 TScreen component 937
OnMeasureTab and 543 TPasswordEvent type 916
TPen object 916 TScrollBar component 938
TMediaPlayer component 889 TScrollBarInc type 939
TMemo component 891 TPenMode type 917
TPenStyle type 917 TScrollBarKind type 939
TMemoField component 893 TScrollBox component 939
TMenuBreak type 894 TPicture object 917
TPoint records 610 TScrollCode type 941
TMenuItem component 894 TScrollEvent type 941
Index 1047
converting VCRs See media players exiting 90
floating-point to string 313 VersionMajor property 981 Width property 990–991
floating-point to text 315 VersionMinor property 982 HorzScrollBar and 387
See also conversions vertical scroll bars 157, 432, 939, wildcard characters 296, 297, 298
string to integer 760 982 See also file filters
formatting floating-point 326 displaying 796 WIN.INI file
nil 703 scrolling ranges 636 See also INI files
object lists 579 setting position 683 loading characters from 353
nonzero VertScrollBar property 982 window handles
testing for 110 TControlScrollBar and 796 applications 370
null 116, 703 Clipboard 338, 700
videos See media players
testing for 415 controls 370
numeric See integers; viewing See displaying
virtual key codes 718 creating 373
numbers testing for 371
ordinal 575 virtual method tables 965
Visible property 983 invalid operations 237, 254,
required 663, 887 535
validating 974 Hide and 380
HorzScrollBar and 387 menu items 370
restoring default 117 Window menu 863, 991
storing 773 OnCreate and 519
Show and 719 windowed controls 6
strings listed 6
comparing 751 Showing and 723
VisibleButtons property 983–985 returning children 147
truncating 934 stacking order 92, 698
writing to files 995 TButtonSet and 787
VisibleColCount property 985 WindowMenu property 991
Values property 978–980
VisibleRowCount property 985 WindowOrg typed constant 992
ReadSectionValues and 645
VisibleTabs property 986 windows 862
ValueUnchecked property 980
Visual Component Library See also CRT windows
VStrLCopy function coloring 135
See also SizeOf, StrCopy (VCL) 2
painting backgrounds 764
functions scrolling 938
VarBytesField component 962 W specifying icons 388
See also byte fields Windows applications
variables Wait property 986
Open and 563 running Delphi with 521
converting Windows common dialog boxes
date to string 183 Pause and 599
time to string 183 PauseOnly and 600 See common dialog boxes
currency formats 163 Play and 609 Windows messages
date/time type 802 Previous and 625 menus and 139
decrementing 188 Resume and 666, 667 processing 543, 633, 895
dynamic Save and 676 Windows swap files 254
creating 350, 488 StartRecording and 738 Windows system colors 135, 137
disposing 334 Step and 741, 742 WindowSize typed constant 992
releasing memory WantReturns property 987 WindowState property 992
allocations 209 WantTabs property 988 Restore vs. 665
file, typecasting 854 warning messages 466, 468 TWindowState and 964
heap 374 common dialog boxes 568, WindowTitle variable 993
incrementing 390 569 WinHelp
pointer, creating new 488 displaying 720 calling 377, 379
procedural, unassigned 53 WhereAll constant 972 WM_COMMAND
reading file components WhereChanged constant 972 messages 139
into 638 WhereKeyOnly constant 972 .WMF files See metafiles
reading text file values WhereX function 989 Word types 59
into 638 See also GoToXY procedure; word values 59
text 960 WhereY function WordField component 964
text files 844 WhereY function 989 WordWrap property 993
writing records to files 82 See also CoToXY procedure; workspaces
variable-width fonts 606 WhereX function coloring 135
VCL See Visual Component while statements wrapping text 994
Library continuing 146 Write method 994
Index 1049
1050 Delphi Visual Component Library Reference
Visual Component
Library Reference
®
Borland
™
Delphi
Borland International, Inc., 100 Borland Way
P.O. Box 660001, Scotts Valley, CA 95067-0001
Borland may have patents and/or pending patent applications covering subject matter in this document. The
furnishing of this document does not give you any license to these patents.
COPYRIGHT © 1995 Borland International. All rights reserved. All Borland product names are trademarks or
registered trademarks of Borland International, Inc. Other brand and product names are trademarks or registered
trademarks of their respective holders.
Printed in the U.S.A.
1E0R395
9596979899-987654321
W1
Contents
Introduction 1 AddPassword method . . . . . . . . . . . . . . . 25
Manual conventions . . . . . . . . . . . . . . . . . 1 Addr function . . . . . . . . . . . . . . . . . . . . 26
Contacting Borland. . . . . . . . . . . . . . . . . . 1 AddStrings method. . . . . . . . . . . . . . . . . 26
Delphi Visual Component Library. . . . . . . . . 2 AfterCancel event . . . . . . . . . . . . . . . . . . 27
Visual Component Library objects . . . . . . . . .2 AfterClose event. . . . . . . . . . . . . . . . . . . 28
Visual Component Library components . . . . .3 AfterDelete event . . . . . . . . . . . . . . . . . . 28
Visual Component Library controls . . . . . . . .5 AfterEdit event . . . . . . . . . . . . . . . . . . . 28
Visual Component Library windowed AfterInsert event . . . . . . . . . . . . . . . . . . 29
controls . . . . . . . . . . . . . . . . . . . . . . 6 AfterOpen event. . . . . . . . . . . . . . . . . . . 29
Visual Component Library nonwindowed
controls . . . . . . . . . . . . . . . . . . . . . . 7 AfterPost event . . . . . . . . . . . . . . . . . . . 30
Visual Component Library procedures and AliasName property . . . . . . . . . . . . . . . . 30
functions . . . . . . . . . . . . . . . . . . . . . . .7 Align property . . . . . . . . . . . . . . . . . . . . 31
Library reference . . . . . . . . . . . . . . . . . . . 8 Alignment property. . . . . . . . . . . . . . . . . 32
Sample entry. . . . . . . . . . . . . . . . . . . . . . 9 For labels, memos, and panels . . . . . . . . . . 32
For check boxes and radio buttons . . . . . . . 32
Delphi Library Reference 11 For pop-up menus . . . . . . . . . . . . . . . . . 33
Abort method . . . . . . . . . . . . . . . . . . . . 11 For field components . . . . . . . . . . . . . . . 34
Abort procedure . . . . . . . . . . . . . . . . . . 11 AllocMem function . . . . . . . . . . . . . . . . . 34
Aborted property . . . . . . . . . . . . . . . . . . 12 AllowAllUp property. . . . . . . . . . . . . . . . 34
AbortOnKeyViol property . . . . . . . . . . . . 12 AllowGrayed property. . . . . . . . . . . . . . . 35
AbortOnProblem property . . . . . . . . . . . . 13 AllowInPlace property . . . . . . . . . . . . . . . 36
Abs function . . . . . . . . . . . . . . . . . . . . . 13 AllowResize property . . . . . . . . . . . . . . . 36
Abstract procedure . . . . . . . . . . . . . . . . . 13 AnsiCompareStr function . . . . . . . . . . . . . 37
Active property . . . . . . . . . . . . . . . . . . . 14 AnsiCompareText function . . . . . . . . . . . . 37
For tables, queries, and stored procedures . . . 14 AnsiLowerCase function. . . . . . . . . . . . . . 37
For OLE containers . . . . . . . . . . . . . . . . . 14 AnsiToNative function . . . . . . . . . . . . . . . 37
ActiveControl property . . . . . . . . . . . . . . 15 AnsiUpperCase function. . . . . . . . . . . . . . 38
ActiveForm property. . . . . . . . . . . . . . . . 15 Append method. . . . . . . . . . . . . . . . . . . 38
ActiveMDIChild property. . . . . . . . . . . . . 16 Append procedure . . . . . . . . . . . . . . . . . 39
ActivePage property . . . . . . . . . . . . . . . . 17 AppendRecord method . . . . . . . . . . . . . . 40
Add method . . . . . . . . . . . . . . . . . . . . . 17 AppendStr procedure . . . . . . . . . . . . . . . 40
For field definitions. . . . . . . . . . . . . . . . . 17 Application variable . . . . . . . . . . . . . . . . 41
For index definitions . . . . . . . . . . . . . . . . 18 ApplyFilePath method . . . . . . . . . . . . . . . 41
For list objects . . . . . . . . . . . . . . . . . . . . 18 ApplyRange method . . . . . . . . . . . . . . . . 42
For string and string list objects . . . . . . . . . 19
For menu items . . . . . . . . . . . . . . . . . . . 20 Arc method. . . . . . . . . . . . . . . . . . . . . . 43
For outlines . . . . . . . . . . . . . . . . . . . . . 20 ArcTan function . . . . . . . . . . . . . . . . . . . 43
AddChild method . . . . . . . . . . . . . . . . . 21 ArrangeIcons method . . . . . . . . . . . . . . . 44
AddChildObject method . . . . . . . . . . . . . 22 AsBCD property. . . . . . . . . . . . . . . . . . . 44
AddExitProc procedure . . . . . . . . . . . . . . 22 AsBoolean property. . . . . . . . . . . . . . . . . 45
AddFieldDesc method . . . . . . . . . . . . . . . 22 For TParam objects . . . . . . . . . . . . . . . . 45
For Boolean and string field components . . . 45
AddIndex method . . . . . . . . . . . . . . . . . 23
AsCurrency property. . . . . . . . . . . . . . . . 45
AddObject method . . . . . . . . . . . . . . . . . 23
For string and string list objects . . . . . . . . . 23 AsDate property. . . . . . . . . . . . . . . . . . . 46
For outlines . . . . . . . . . . . . . . . . . . . . . 24 AsDateTime property. . . . . . . . . . . . . . . . 46
AddParam method . . . . . . . . . . . . . . . . . 25 For TParam objects . . . . . . . . . . . . . . . . 46
i
For date, date-time, time, and string field For OLE containers . . . . . . . . . . . . . . . . 69
components . . . . . . . . . . . . . . . . . . . . 47 AutoTracking typed constant . . . . . . . . . . . 70
AsFloat property . . . . . . . . . . . . . . . . . . 47 AutoUnload property . . . . . . . . . . . . . . . 70
For TParam objects . . . . . . . . . . . . . . . . . 47 Back method . . . . . . . . . . . . . . . . . . . . . 71
For field components. . . . . . . . . . . . . . . . 47
BackgroundColor property . . . . . . . . . . . . 72
AsInteger property . . . . . . . . . . . . . . . . . 48
BatchMove method . . . . . . . . . . . . . . . . . 72
For TParam objects . . . . . . . . . . . . . . . . . 48
For field components. . . . . . . . . . . . . . . . 48 BeforeCancel event . . . . . . . . . . . . . . . . . 73
Assign method . . . . . . . . . . . . . . . . . . . 49 BeforeClose event . . . . . . . . . . . . . . . . . . 73
For the Clipboard . . . . . . . . . . . . . . . . . . 49 BeforeDelete event . . . . . . . . . . . . . . . . . 74
For field definitions. . . . . . . . . . . . . . . . . 49 BeforeEdit event . . . . . . . . . . . . . . . . . . . 74
For index definitions . . . . . . . . . . . . . . . . 50 BeforeInsert event . . . . . . . . . . . . . . . . . . 74
For field components. . . . . . . . . . . . . . . . 50 BeforeOpen event . . . . . . . . . . . . . . . . . . 75
For TParam objects . . . . . . . . . . . . . . . . . 50 BeforePost event. . . . . . . . . . . . . . . . . . . 75
For TParams objects . . . . . . . . . . . . . . . . 51
BeginDoc method . . . . . . . . . . . . . . . . . . 76
For other objects . . . . . . . . . . . . . . . . . . 51
BeginDrag method . . . . . . . . . . . . . . . . . 76
AssignCrt procedure . . . . . . . . . . . . . . . . 52
BeginUpdate method. . . . . . . . . . . . . . . . 77
Assigned function . . . . . . . . . . . . . . . . . 53
BevelInner property. . . . . . . . . . . . . . . . . 78
AssignField method . . . . . . . . . . . . . . . . 53
BevelOuter property . . . . . . . . . . . . . . . . 79
AssignFile procedure. . . . . . . . . . . . . . . . 54
BevelWidth property . . . . . . . . . . . . . . . . 79
AssignPrn procedure. . . . . . . . . . . . . . . . 55
Bitmap property. . . . . . . . . . . . . . . . . . . 80
AssignStr procedure . . . . . . . . . . . . . . . . 55
For brushes . . . . . . . . . . . . . . . . . . . . . 80
AssignValue method . . . . . . . . . . . . . . . . 56 For pictures . . . . . . . . . . . . . . . . . . . . . 81
AssignValues method . . . . . . . . . . . . . . . 56 BlockRead procedure . . . . . . . . . . . . . . . . 81
AsSmallInt property . . . . . . . . . . . . . . . . 57 BlockWrite procedure. . . . . . . . . . . . . . . . 82
AsString property. . . . . . . . . . . . . . . . . . 57 BOF property . . . . . . . . . . . . . . . . . . . . 84
For TParam objects . . . . . . . . . . . . . . . . . 57
BOLEFormat type. . . . . . . . . . . . . . . . . . 84
For field components. . . . . . . . . . . . . . . . 58
BOLEMedium type . . . . . . . . . . . . . . . . . 85
AsText property . . . . . . . . . . . . . . . . . . . 58
BOLEMediumCalc function. . . . . . . . . . . . 85
AsTime property . . . . . . . . . . . . . . . . . . 59
BorderColor property. . . . . . . . . . . . . . . . 86
AsWord property . . . . . . . . . . . . . . . . . . 59
BorderIcons property . . . . . . . . . . . . . . . . 86
AutoActivate property. . . . . . . . . . . . . . . 60
BorderStyle property . . . . . . . . . . . . . . . . 87
AutoCalcFields property . . . . . . . . . . . . . 60
For forms . . . . . . . . . . . . . . . . . . . . . . 87
AutoDisplay property . . . . . . . . . . . . . . . 61 For controls . . . . . . . . . . . . . . . . . . . . . 88
AutoEdit property . . . . . . . . . . . . . . . . . 61 BorderWidth property . . . . . . . . . . . . . . . 88
AutoEnable property. . . . . . . . . . . . . . . . 62 Bounds function. . . . . . . . . . . . . . . . . . . 89
AutoMerge property . . . . . . . . . . . . . . . . 63 BoundsRect property . . . . . . . . . . . . . . . . 89
AutoOpen property . . . . . . . . . . . . . . . . 64 Break procedure . . . . . . . . . . . . . . . . . . . 90
AutoPopup property. . . . . . . . . . . . . . . . 64 Break property. . . . . . . . . . . . . . . . . . . . 91
AutoRewind property . . . . . . . . . . . . . . . 65 BringToFront method. . . . . . . . . . . . . . . . 91
AutoScroll property . . . . . . . . . . . . . . . . 66 Brush property. . . . . . . . . . . . . . . . . . . . 92
For tab set controls . . . . . . . . . . . . . . . . . 66
BrushCopy method . . . . . . . . . . . . . . . . . 93
For forms and scroll boxes. . . . . . . . . . . . . 66
BtnClick method . . . . . . . . . . . . . . . . . . 94
AutoSelect property . . . . . . . . . . . . . . . . 67
Buttons property . . . . . . . . . . . . . . . . . . 94
AutoSize property . . . . . . . . . . . . . . . . . 67
For images . . . . . . . . . . . . . . . . . . . . . . 68 Calculated property. . . . . . . . . . . . . . . . . 95
For edit boxes and database lookup Cancel method. . . . . . . . . . . . . . . . . . . . 95
combo boxes. . . . . . . . . . . . . . . . . . . . 68 Cancel property . . . . . . . . . . . . . . . . . . . 96
For label and database text components . . . . 69 CancelRange method. . . . . . . . . . . . . . . . 96
ii
CanFocus method . . . . . . . . . . . . . . . . . 96 ClientHeight property . . . . . . . . . . . . . . 120
CanModify property . . . . . . . . . . . . . . . . 97 ClientOrigin property . . . . . . . . . . . . . . 120
For tables, queries, and stored procedures . . . 97 ClientRect property . . . . . . . . . . . . . . . . 121
For field components. . . . . . . . . . . . . . . . 98 ClientToScreen method. . . . . . . . . . . . . . 121
Canvas property . . . . . . . . . . . . . . . . . . 98 ClientWidth property. . . . . . . . . . . . . . . 122
For forms, images, and paint boxes . . . . . . . 98 Clipboard variable . . . . . . . . . . . . . . . . 123
For list boxes, combo boxes, and outlines. . . . 99
For grids . . . . . . . . . . . . . . . . . . . . . . 100
ClipRect property . . . . . . . . . . . . . . . . . 123
For printer objects . . . . . . . . . . . . . . . . 100 Close method . . . . . . . . . . . . . . . . . . . 123
For bitmap objects . . . . . . . . . . . . . . . . 100 For forms . . . . . . . . . . . . . . . . . . . . . .124
Capabilities property . . . . . . . . . . . . . . . 101 For Clipboard objects . . . . . . . . . . . . . . .124
For media player controls . . . . . . . . . . . .124
Capacity property. . . . . . . . . . . . . . . . . 102 For tables, queries, and stored procedures . . .125
Caption property . . . . . . . . . . . . . . . . . 102 For databases . . . . . . . . . . . . . . . . . . . .125
For forms. . . . . . . . . . . . . . . . . . . . . . 103 Close procedure . . . . . . . . . . . . . . . . . . 125
For all other components . . . . . . . . . . . . 103
CloseApplication method . . . . . . . . . . . . 126
Cascade method . . . . . . . . . . . . . . . . . 104
CloseDatabase method. . . . . . . . . . . . . . 127
CellRect method . . . . . . . . . . . . . . . . . 104
CloseDatasets method . . . . . . . . . . . . . . 127
Cells property . . . . . . . . . . . . . . . . . . . 105
CloseDialog method . . . . . . . . . . . . . . . 128
Center property . . . . . . . . . . . . . . . . . . 105
CloseFile procedure. . . . . . . . . . . . . . . . 128
ChangedCount property . . . . . . . . . . . . 106
CloseLink method. . . . . . . . . . . . . . . . . 128
ChangedTableName property . . . . . . . . . 106
CloseQuery method . . . . . . . . . . . . . . . 129
ChangeFileExt function . . . . . . . . . . . . . 107
CloseReport method . . . . . . . . . . . . . . . 130
ChangeLevelBy method . . . . . . . . . . . . . 107
CloseUp method . . . . . . . . . . . . . . . . . 130
CharCase property . . . . . . . . . . . . . . . . 108
ClrEol procedure . . . . . . . . . . . . . . . . . 131
ChDir procedure . . . . . . . . . . . . . . . . . 109
ClrScr procedure . . . . . . . . . . . . . . . . . 131
Check procedure . . . . . . . . . . . . . . . . . .110
CmdLine variable . . . . . . . . . . . . . . . . . 132
CheckBreak typed constant . . . . . . . . . . . .110
CmdShow variable . . . . . . . . . . . . . . . . 132
CheckBrowseMode method . . . . . . . . . . .110
Col property . . . . . . . . . . . . . . . . . . . . 132
Checked property. . . . . . . . . . . . . . . . . .111
ColCount property . . . . . . . . . . . . . . . . 133
CheckEOF typed constant. . . . . . . . . . . . .111
Collapse method . . . . . . . . . . . . . . . . . 133
Chord method. . . . . . . . . . . . . . . . . . . .112
Collate property . . . . . . . . . . . . . . . . . . 133
Chr function . . . . . . . . . . . . . . . . . . . . .112
Color property . . . . . . . . . . . . . . . . . . . 134
ClassName method. . . . . . . . . . . . . . . . .113 For the Color dialog box . . . . . . . . . . . . .135
ClassParent method . . . . . . . . . . . . . . . .114 ColoredButtons property . . . . . . . . . . . . 136
ClassType method . . . . . . . . . . . . . . . . .115 ColorToRGB function. . . . . . . . . . . . . . . 136
Clear method . . . . . . . . . . . . . . . . . . . .115 Cols property . . . . . . . . . . . . . . . . . . . 137
For TParams objects . . . . . . . . . . . . . . . 116
For TParam objects . . . . . . . . . . . . . . . . 116
Columns property. . . . . . . . . . . . . . . . . 137
For TIndexDefs objects. . . . . . . . . . . . . . 116 ColWidths property. . . . . . . . . . . . . . . . 138
For TFieldsDefs objects . . . . . . . . . . . . . 116 Command property. . . . . . . . . . . . . . . . 139
For fields . . . . . . . . . . . . . . . . . . . . . . 116 Commit method. . . . . . . . . . . . . . . . . . 139
For other objects and components . . . . . . . 117 CompareStr function . . . . . . . . . . . . . . . 140
ClearFields method. . . . . . . . . . . . . . . . .117 CompareText function . . . . . . . . . . . . . . 140
ClearFormOLEDropFormats procedure . . . .118 ComponentCount property . . . . . . . . . . . 141
ClearSelection method . . . . . . . . . . . . . . .118 ComponentIndex property . . . . . . . . . . . 142
Click method . . . . . . . . . . . . . . . . . . . .119 Components property . . . . . . . . . . . . . . 142
For menu items and buttons . . . . . . . . . . 119 Concat function . . . . . . . . . . . . . . . . . . 143
For database navigator controls . . . . . . . . 119 ConfirmDelete property . . . . . . . . . . . . . 144
ClientHandle property. . . . . . . . . . . . . . .119
iii
Connect method . . . . . . . . . . . . . . . . . 144 Cursors property . . . . . . . . . . . . . . . . . 168
Connected property . . . . . . . . . . . . . . . 144 CursorTo procedure. . . . . . . . . . . . . . . . 169
ConnectMode property . . . . . . . . . . . . . 145 CustomColors property . . . . . . . . . . . . . 170
ContainsControl method . . . . . . . . . . . . 145 CutToClipboard method . . . . . . . . . . . . . 171
Continue procedure . . . . . . . . . . . . . . . 146 Data property . . . . . . . . . . . . . . . . . . . 171
ControlAtPos method . . . . . . . . . . . . . . 147 Database property. . . . . . . . . . . . . . . . . 172
ControlCount property . . . . . . . . . . . . . 147 DatabaseCount property. . . . . . . . . . . . . 172
Controls property . . . . . . . . . . . . . . . . . 148 DatabaseError procedure . . . . . . . . . . . . 173
ConvertDlgHelp property. . . . . . . . . . . . 148 DatabaseName property. . . . . . . . . . . . . 173
Copies property . . . . . . . . . . . . . . . . . . 149 For database components. . . . . . . . . . . . .173
Copy function . . . . . . . . . . . . . . . . . . . 150 For tables, queries, and stored procedures . . .173
CopyMode property . . . . . . . . . . . . . . . 150 Databases property . . . . . . . . . . . . . . . . 174
CopyParams method. . . . . . . . . . . . . . . 151 DataField property . . . . . . . . . . . . . . . . 175
CopyRect method. . . . . . . . . . . . . . . . . 152 DataFormat property . . . . . . . . . . . . . . . 175
CopyToClipboard method . . . . . . . . . . . 152 DataHandle property. . . . . . . . . . . . . . . 177
For edit boxes and memos . . . . . . . . . . . 152 DataSet property . . . . . . . . . . . . . . . . . 177
For OLE containers . . . . . . . . . . . . . . . . 153 For data source components . . . . . . . . . . .177
For DDE server items . . . . . . . . . . . . . . 153 For field components . . . . . . . . . . . . . . .178
For database images . . . . . . . . . . . . . . . 154 DatasetCount property. . . . . . . . . . . . . . 178
Cos function . . . . . . . . . . . . . . . . . . . . 154 Datasets property . . . . . . . . . . . . . . . . . 179
Count property . . . . . . . . . . . . . . . . . . 155 DataSize property . . . . . . . . . . . . . . . . . 179
For lists and menu items. . . . . . . . . . . . . 155 DataSource property . . . . . . . . . . . . . . . 180
For TParams objects . . . . . . . . . . . . . . . 156 For data-aware controls . . . . . . . . . . . . . .180
For TFieldDefs objects . . . . . . . . . . . . . . 156 For queries . . . . . . . . . . . . . . . . . . . . .180
For TIndexDefs objects. . . . . . . . . . . . . . 156 DataType property . . . . . . . . . . . . . . . . 181
Create method. . . . . . . . . . . . . . . . . . . 156 For field definition objects . . . . . . . . . . . .181
For TIniFile objects . . . . . . . . . . . . . . . . 157 For field definitions . . . . . . . . . . . . . . . .181
For outline nodes . . . . . . . . . . . . . . . . . 157 For TParam objects . . . . . . . . . . . . . . . .182
For control scroll bars . . . . . . . . . . . . . . 157 Date function. . . . . . . . . . . . . . . . . . . . 182
For TIndexDef objects . . . . . . . . . . . . . . 157 DateTimeToFileDate function . . . . . . . . . . 182
For TIndexDefs objects. . . . . . . . . . . . . . 158
For blob streams . . . . . . . . . . . . . . . . . 158
DateTimeToString procedure . . . . . . . . . . 183
For all other components . . . . . . . . . . . . 158 DateToStr function . . . . . . . . . . . . . . . . 183
For all other objects. . . . . . . . . . . . . . . . 159 DateTimeToStr function . . . . . . . . . . . . . 183
CreateField method. . . . . . . . . . . . . . . . 159 DayOfWeek function . . . . . . . . . . . . . . . 184
CreateForm method . . . . . . . . . . . . . . . 159 DBHandle property. . . . . . . . . . . . . . . . 184
CreateNew method. . . . . . . . . . . . . . . . 160 DbiError procedure . . . . . . . . . . . . . . . . 185
CreateParam method. . . . . . . . . . . . . . . 160 DBLocale property . . . . . . . . . . . . . . . . 185
CreateTable method . . . . . . . . . . . . . . . 161 DDEConv property . . . . . . . . . . . . . . . . 185
CSeg function . . . . . . . . . . . . . . . . . . . 161 DDEItem property . . . . . . . . . . . . . . . . 186
Ctl3D property . . . . . . . . . . . . . . . . . . 162 DDEService property . . . . . . . . . . . . . . . 186
Currency and date/time formatting DDETopic property . . . . . . . . . . . . . . . . 187
variables . . . . . . . . . . . . . . . . . . . . . 163 Dec procedure . . . . . . . . . . . . . . . . . . . 188
Currency property . . . . . . . . . . . . . . . . 166 DecodeDate procedure. . . . . . . . . . . . . . 188
Cursor property . . . . . . . . . . . . . . . . . . 166 DecodeTime procedure. . . . . . . . . . . . . . 189
For all controls. . . . . . . . . . . . . . . . . . . 166 Default property. . . . . . . . . . . . . . . . . . 190
For screen objects . . . . . . . . . . . . . . . . . 167 DefaultColWidth property. . . . . . . . . . . . 190
Cursor typed constant . . . . . . . . . . . . . . 168 DefaultDrawing property . . . . . . . . . . . . 191
CursorPosChanged method . . . . . . . . . . 168 DefaultExt property. . . . . . . . . . . . . . . . 191
iv
DefaultRowHeight property . . . . . . . . . . 192 DroppedDown property . . . . . . . . . . . . . 219
Delete method. . . . . . . . . . . . . . . . . . . 193 dsEditModes const . . . . . . . . . . . . . . . . 219
For list and string objects and menu items . . 193 DSeg function . . . . . . . . . . . . . . . . . . . 219
For outlines . . . . . . . . . . . . . . . . . . . . 194 Duplicates property. . . . . . . . . . . . . . . . 221
For queries and tables . . . . . . . . . . . . . . 194 EAbort object. . . . . . . . . . . . . . . . . . . . 221
Delete procedure . . . . . . . . . . . . . . . . . 195 EBreakpoint object . . . . . . . . . . . . . . . . 221
DeleteFile function . . . . . . . . . . . . . . . . 195 EClassNotFound object . . . . . . . . . . . . . 222
DeleteIndex method . . . . . . . . . . . . . . . 195 EComponentError object. . . . . . . . . . . . . 222
DeleteTable method . . . . . . . . . . . . . . . 196 EConvertError object . . . . . . . . . . . . . . . 222
DescriptionsAvailable method . . . . . . . . . 196 EDatabaseError object . . . . . . . . . . . . . . 223
Destination property . . . . . . . . . . . . . . . 197 EDBEngineError object. . . . . . . . . . . . . . 223
Destroy method . . . . . . . . . . . . . . . . . . 197 EDBEditError object . . . . . . . . . . . . . . . 224
Device property . . . . . . . . . . . . . . . . . . 198 EDDEError object . . . . . . . . . . . . . . . . . 225
DeviceID property . . . . . . . . . . . . . . . . 198 Edit method . . . . . . . . . . . . . . . . . . . . 225
DeviceType property . . . . . . . . . . . . . . . 199 For tables and queries . . . . . . . . . . . . . . .225
Directory property . . . . . . . . . . . . . . . . 200 For datasource components . . . . . . . . . . .225
DirectoryExists function . . . . . . . . . . . . . 200 EditFormat property . . . . . . . . . . . . . . . 226
DirLabel property. . . . . . . . . . . . . . . . . 201 EditKey method . . . . . . . . . . . . . . . . . . 226
DirList property. . . . . . . . . . . . . . . . . . 202 EditMask property . . . . . . . . . . . . . . . . 227
DisableControls method. . . . . . . . . . . . . 202 EditMaskPtr property . . . . . . . . . . . . . . 229
DiskFree function . . . . . . . . . . . . . . . . . 203 EditorMode property. . . . . . . . . . . . . . . 229
DiskSize function . . . . . . . . . . . . . . . . . 204 EditRangeEnd method . . . . . . . . . . . . . . 230
Display property . . . . . . . . . . . . . . . . . 204 EditRangeStart method . . . . . . . . . . . . . 230
DisplayFormat property . . . . . . . . . . . . . 205 EditText property . . . . . . . . . . . . . . . . . 231
DisplayLabel property . . . . . . . . . . . . . . 205 EDivByZero object . . . . . . . . . . . . . . . . 231
DisplayName property . . . . . . . . . . . . . 206 EFault object . . . . . . . . . . . . . . . . . . . . 232
DisplayRect property. . . . . . . . . . . . . . . 206 EFCreateError object . . . . . . . . . . . . . . . 232
DisplayText property. . . . . . . . . . . . . . . 207 EFilerError object . . . . . . . . . . . . . . . . . 232
DisplayValue property . . . . . . . . . . . . . . 208 EFOpenError object. . . . . . . . . . . . . . . . 233
DisplayValues property . . . . . . . . . . . . . 208 EGPFault object . . . . . . . . . . . . . . . . . . 233
DisplayWidth property . . . . . . . . . . . . . 209 EInOutError object . . . . . . . . . . . . . . . . 233
Dispose procedure . . . . . . . . . . . . . . . . 209 EIntError object . . . . . . . . . . . . . . . . . . 234
DisposeStr procedure . . . . . . . . . . . . . . 210 EIntOverflow object. . . . . . . . . . . . . . . . 234
DitherBackground property . . . . . . . . . . 210 EInvalidCast object . . . . . . . . . . . . . . . . 235
DoneWinCrt procedure . . . . . . . . . . . . . .211 EInvalidGraphic object . . . . . . . . . . . . . . 235
Down property . . . . . . . . . . . . . . . . . . .211 EInvalidGraphicOperation object . . . . . . . 235
DragCursor property. . . . . . . . . . . . . . . 212 EInvalidGridOperation object. . . . . . . . . . 236
Dragging method . . . . . . . . . . . . . . . . . 212 EInvalidImage object . . . . . . . . . . . . . . . 236
DragMode property . . . . . . . . . . . . . . . 213 EInvalidOp object . . . . . . . . . . . . . . . . . 236
Draw method . . . . . . . . . . . . . . . . . . . 214 EInvalidOpCode object . . . . . . . . . . . . . 236
DrawFocusRect method . . . . . . . . . . . . . 215 EInvalidOperation object . . . . . . . . . . . . 237
Drive property. . . . . . . . . . . . . . . . . . . 216 EInvalidPointer object . . . . . . . . . . . . . . 237
DriverName property . . . . . . . . . . . . . . 216 Eject method . . . . . . . . . . . . . . . . . . . . 237
DropConnections method. . . . . . . . . . . . 217 EListError object. . . . . . . . . . . . . . . . . . 238
DropDown method. . . . . . . . . . . . . . . . 217 Ellipse method. . . . . . . . . . . . . . . . . . . 239
DropDownCount property . . . . . . . . . . . 218 EMathError object. . . . . . . . . . . . . . . . . 240
DropDownWidth property . . . . . . . . . . . 218 EMCIDeviceError object . . . . . . . . . . . . . 240
v
EMenuError object . . . . . . . . . . . . . . . . 240 EUnderflow object . . . . . . . . . . . . . . . . 261
EMPNotify type. . . . . . . . . . . . . . . . . . 240 EWriteError object. . . . . . . . . . . . . . . . . 261
EMPPostNotify type . . . . . . . . . . . . . . . 241 Exception object . . . . . . . . . . . . . . . . . . 262
Empty property . . . . . . . . . . . . . . . . . . 241 Exchange method . . . . . . . . . . . . . . . . . 263
EmptyStr constant . . . . . . . . . . . . . . . . 242 Exclude procedure . . . . . . . . . . . . . . . . 263
EmptyTable method . . . . . . . . . . . . . . . 242 Exclusive property . . . . . . . . . . . . . . . . 264
EnableControls method . . . . . . . . . . . . . 242 ExecProc method . . . . . . . . . . . . . . . . . 265
Enabled property . . . . . . . . . . . . . . . . . 243 ExecSQL method . . . . . . . . . . . . . . . . . 265
For all controls, menu items, and timers . . . 243 Execute method . . . . . . . . . . . . . . . . . . 265
For data source components . . . . . . . . . . 244 For Color, Font, Open, Save, Print, Find,
EnabledButtons property . . . . . . . . . . . . 244 and Replace dialog boxes . . . . . . . . . . . .266
EnableExceptionHandler procedure. . . . . . 245 For Printer Setup dialog boxes. . . . . . . . . .266
ENavClick type . . . . . . . . . . . . . . . . . . 245 For batch move components . . . . . . . . . . .266
EncodeDate function . . . . . . . . . . . . . . . 246 ExecuteMacro method . . . . . . . . . . . . . . 267
EncodeTime function. . . . . . . . . . . . . . . 246 ExecuteMacroLines method. . . . . . . . . . . 268
EndDoc method. . . . . . . . . . . . . . . . . . 247 ExeName property . . . . . . . . . . . . . . . . 268
EndDrag method . . . . . . . . . . . . . . . . . 248 ExceptionClass typed constant . . . . . . . . . 269
EndMargin property . . . . . . . . . . . . . . . 248 ExceptProc typed constant. . . . . . . . . . . . 269
EndPage property . . . . . . . . . . . . . . . . 249 Exit procedure . . . . . . . . . . . . . . . . . . . 269
EndPos property . . . . . . . . . . . . . . . . . 249 ExitCode variable . . . . . . . . . . . . . . . . . 270
EndUpdate method . . . . . . . . . . . . . . . 250 ExitProc variable . . . . . . . . . . . . . . . . . 270
Eof function . . . . . . . . . . . . . . . . . . . . 251 Exp function . . . . . . . . . . . . . . . . . . . . 271
EOF property . . . . . . . . . . . . . . . . . . . 252 Expand method . . . . . . . . . . . . . . . . . . 271
For lists . . . . . . . . . . . . . . . . . . . . . . .271
Eoln function . . . . . . . . . . . . . . . . . . . 252
For outline nodes . . . . . . . . . . . . . . . . .272
EOutlineChange type . . . . . . . . . . . . . . 253
Expanded property . . . . . . . . . . . . . . . . 272
EOutlineError object . . . . . . . . . . . . . . . 253
ExpandFileName function. . . . . . . . . . . . 273
EOutOfMemory object. . . . . . . . . . . . . . 253
Expression property . . . . . . . . . . . . . . . 273
EOutOfResources object . . . . . . . . . . . . . 253
ExtendedSelect property . . . . . . . . . . . . . 274
EOverflow object . . . . . . . . . . . . . . . . . 254
ExtractFileExt function . . . . . . . . . . . . . . 274
EPageFault object . . . . . . . . . . . . . . . . . 254
ExtractFileName function . . . . . . . . . . . . 274
EParserError object . . . . . . . . . . . . . . . . 254
ExtractFilePath function . . . . . . . . . . . . . 275
EPrinter object . . . . . . . . . . . . . . . . . . . 255
ExceptObject function . . . . . . . . . . . . . . 275
EProcessorException object . . . . . . . . . . . 255
ExceptAddr function . . . . . . . . . . . . . . . 276
ERangeError object . . . . . . . . . . . . . . . . 255
EZeroDivide object . . . . . . . . . . . . . . . . 276
Erase procedure . . . . . . . . . . . . . . . . . . 256
Fail procedure . . . . . . . . . . . . . . . . . . . 276
EraseSection method . . . . . . . . . . . . . . . 257
Field property . . . . . . . . . . . . . . . . . . . 277
EReadError object. . . . . . . . . . . . . . . . . 258
FieldByName method . . . . . . . . . . . . . . 277
EReportError object. . . . . . . . . . . . . . . . 258
FieldClass property . . . . . . . . . . . . . . . . 277
EResNotFound object . . . . . . . . . . . . . . 258
FieldCount property . . . . . . . . . . . . . . . 278
Error property . . . . . . . . . . . . . . . . . . . 258
FieldDefs property . . . . . . . . . . . . . . . . 278
ErrorAddr variable . . . . . . . . . . . . . . . . 259
FieldName property . . . . . . . . . . . . . . . 279
ErrorMessage property . . . . . . . . . . . . . 259
FieldNo property . . . . . . . . . . . . . . . . . 279
ErrorProc typed constant . . . . . . . . . . . . 260 For TFieldDef objects . . . . . . . . . . . . . . .279
ESingleStep object. . . . . . . . . . . . . . . . . 260 For fields . . . . . . . . . . . . . . . . . . . . . .280
EStackFault object. . . . . . . . . . . . . . . . . 260 Fields property. . . . . . . . . . . . . . . . . . . 280
EStreamError object . . . . . . . . . . . . . . . 261 For grids, lookup lists, queries, stored
EStringListError object . . . . . . . . . . . . . . 261 procedures, and tables. . . . . . . . . . . . . .280
vi
File mode constants. . . . . . . . . . . . . . . . 280 First method . . . . . . . . . . . . . . . . . . . . 308
File open mode constants . . . . . . . . . . . . 281 For list objects. . . . . . . . . . . . . . . . . . . .309
FileAge function . . . . . . . . . . . . . . . . . 281 For tables, queries, and stored procedures . . .309
FileClose procedure . . . . . . . . . . . . . . . 282 FirstIndex property . . . . . . . . . . . . . . . . 309
FileCreate function . . . . . . . . . . . . . . . . 282 FixedColor property . . . . . . . . . . . . . . . 310
FileEdit property . . . . . . . . . . . . . . . . . 282 FixedCols property . . . . . . . . . . . . . . . . 311
FileEditStyle property . . . . . . . . . . . . . . 283 FixedRows property . . . . . . . . . . . . . . . 312
FileExists function . . . . . . . . . . . . . . . . 284 FloatToDecimal procedure. . . . . . . . . . . . 312
FileDateToDateTime function. . . . . . . . . . 285 FloatToStr function . . . . . . . . . . . . . . . . 313
FileGetAttr function . . . . . . . . . . . . . . . 285 FloatToStrF function . . . . . . . . . . . . . . . 313
FileGetDate function . . . . . . . . . . . . . . . 285 FloatToText function . . . . . . . . . . . . . . . 314
FileList property. . . . . . . . . . . . . . . . . . 286 FloatToTextFmt function . . . . . . . . . . . . . 315
FileMode variable. . . . . . . . . . . . . . . . . 286 FloodFill method . . . . . . . . . . . . . . . . . 315
FileName property . . . . . . . . . . . . . . . . 287 Flush procedure . . . . . . . . . . . . . . . . . . 315
For Open and Save dialog boxes . . . . . . . . 287 FmtLoadStr function . . . . . . . . . . . . . . . 316
For media player components . . . . . . . . . 288 FmtStr procedure . . . . . . . . . . . . . . . . . 316
For the file list boxes . . . . . . . . . . . . . . . 288 FocusControl method . . . . . . . . . . . . . . 317
For TIniFile objects . . . . . . . . . . . . . . . . 289 FocusControl property . . . . . . . . . . . . . . 317
FilePos function . . . . . . . . . . . . . . . . . . 289 Focused method. . . . . . . . . . . . . . . . . . 318
FileRead function . . . . . . . . . . . . . . . . . 290 Font property . . . . . . . . . . . . . . . . . . . 319
Files property . . . . . . . . . . . . . . . . . . . 290 For Font dialog boxes . . . . . . . . . . . . . . .319
FileSearch function . . . . . . . . . . . . . . . . 291 Fonts property . . . . . . . . . . . . . . . . . . . 320
FileSeek function . . . . . . . . . . . . . . . . . 291 ForceDirectories procedure . . . . . . . . . . . 321
FileSetAttr function. . . . . . . . . . . . . . . . 292 Format function . . . . . . . . . . . . . . . . . . 321
FileSetDate procedure . . . . . . . . . . . . . . 292 Format strings . . . . . . . . . . . . . . . . . . . 322
FileSize function. . . . . . . . . . . . . . . . . . 293 FormatBuf function . . . . . . . . . . . . . . . . 324
FileType property . . . . . . . . . . . . . . . . . 294 FormatChars property . . . . . . . . . . . . . . 324
FileWrite function. . . . . . . . . . . . . . . . . 294 FormatCount property . . . . . . . . . . . . . . 324
FillChar procedure . . . . . . . . . . . . . . . . 295 FormatDateTime function . . . . . . . . . . . . 325
FillRect method . . . . . . . . . . . . . . . . . . 295 FormatFloat function . . . . . . . . . . . . . . . 326
Filter property . . . . . . . . . . . . . . . . . . . 296 Formats property . . . . . . . . . . . . . . . . . 328
For Open and Save dialog boxes . . . . . . . . 296 FormCount property . . . . . . . . . . . . . . . 329
For filter combo boxes . . . . . . . . . . . . . . 297 Forms property . . . . . . . . . . . . . . . . . . 329
FilterIndex property . . . . . . . . . . . . . . . 299 FormStyle property . . . . . . . . . . . . . . . . 330
Find method . . . . . . . . . . . . . . . . . . . . 300 Frac function . . . . . . . . . . . . . . . . . . . . 331
For string list objects . . . . . . . . . . . . . . . 300
For TFieldDefs objects . . . . . . . . . . . . . . 301
FrameRect method . . . . . . . . . . . . . . . . 331
FindClose procedure . . . . . . . . . . . . . . . 301 Frames property. . . . . . . . . . . . . . . . . . 332
FindComponent method . . . . . . . . . . . . 301 Free method . . . . . . . . . . . . . . . . . . . . 333
FindDatabase method . . . . . . . . . . . . . . 302 Free procedure. . . . . . . . . . . . . . . . . . . 333
FindField method. . . . . . . . . . . . . . . . . 302 FreeBookmark method. . . . . . . . . . . . . . 334
FindFirst function. . . . . . . . . . . . . . . . . 303 FreeMem procedure . . . . . . . . . . . . . . . 334
FindIndexForFields method . . . . . . . . . . 304 FromPage property . . . . . . . . . . . . . . . . 335
FindItem method . . . . . . . . . . . . . . . . . 304 FullCollapse method . . . . . . . . . . . . . . . 336
FindKey method . . . . . . . . . . . . . . . . . 305 FullExpand method. . . . . . . . . . . . . . . . 336
FindNearest method . . . . . . . . . . . . . . . 306 FullPath property . . . . . . . . . . . . . . . . . 337
FindNext function . . . . . . . . . . . . . . . . 307 GetAliasNames method . . . . . . . . . . . . . 337
FindText property. . . . . . . . . . . . . . . . . 307 GetAliasParams method . . . . . . . . . . . . . 338
vii
GetAsHandle method . . . . . . . . . . . . . . 338 GraphicExtension function . . . . . . . . . . . 363
GetBookmark method . . . . . . . . . . . . . . 339 GraphicFilter function . . . . . . . . . . . . . . 363
GetComponent method . . . . . . . . . . . . . 339 GridHeight property . . . . . . . . . . . . . . . 364
GetData method . . . . . . . . . . . . . . . . . 340 GridLineWidth property . . . . . . . . . . . . . 365
For fields . . . . . . . . . . . . . . . . . . . . . . 340 GridWidth property . . . . . . . . . . . . . . . 365
For Tparam objects . . . . . . . . . . . . . . . . 341 GroupIndex property. . . . . . . . . . . . . . . 366
GetDatabaseNames method . . . . . . . . . . 341 For speed button controls. . . . . . . . . . . . .366
GetDataItem method. . . . . . . . . . . . . . . 342 For menu items. . . . . . . . . . . . . . . . . . .367
GetDataSize method . . . . . . . . . . . . . . . 342 Halt procedure. . . . . . . . . . . . . . . . . . . 368
GetDir procedure . . . . . . . . . . . . . . . . . 343 Handle property. . . . . . . . . . . . . . . . . . 369
GetDriverNames method . . . . . . . . . . . . 343 For graphics objects . . . . . . . . . . . . . . . .369
GetDriverParams method . . . . . . . . . . . . 344 For applications, Find and Replace dialog
boxes, windowed controls . . . . . . . . . . .370
GetFieldNames method . . . . . . . . . . . . . 344
For menu items, main menus, and pop-up
GetFirstChild method . . . . . . . . . . . . . . 345 menus . . . . . . . . . . . . . . . . . . . . . . .370
GetFormatSettings procedure. . . . . . . . . . 345 For printer objects . . . . . . . . . . . . . . . . .370
GetFormImage method . . . . . . . . . . . . . 345 For sessions . . . . . . . . . . . . . . . . . . . . .370
GetHelpContext method . . . . . . . . . . . . 346 For tables, queries, and stored procedures . . .371
GetIndexForPage method . . . . . . . . . . . . 346 For databases . . . . . . . . . . . . . . . . . . . .371
GetIndexNames method . . . . . . . . . . . . 347 HandleAllocated method . . . . . . . . . . . . 371
GetItem method. . . . . . . . . . . . . . . . . . 348 HandleException method . . . . . . . . . . . . 372
GetItemPath method . . . . . . . . . . . . . . . 348 HandleNeeded method . . . . . . . . . . . . . 372
GetLastChild method . . . . . . . . . . . . . . 349 HasFormat method . . . . . . . . . . . . . . . . 373
GetLongHint function . . . . . . . . . . . . . . 349 HasItems property . . . . . . . . . . . . . . . . 374
GetMem procedure. . . . . . . . . . . . . . . . 350 Heap variables. . . . . . . . . . . . . . . . . . . 374
GetNextChild method . . . . . . . . . . . . . . 351 Height property . . . . . . . . . . . . . . . . . . 375
GetParentForm function . . . . . . . . . . . . . 351 For controls, forms, and graphics . . . . . . . .376
For the screen. . . . . . . . . . . . . . . . . . . .376
GetPassword method . . . . . . . . . . . . . . 352 For fonts . . . . . . . . . . . . . . . . . . . . . . .376
GetPrevChild method . . . . . . . . . . . . . . 352 HelpCommand method . . . . . . . . . . . . . 377
GetPrinter method . . . . . . . . . . . . . . . . 353 HelpContext method . . . . . . . . . . . . . . . 377
GetProfileChar function . . . . . . . . . . . . . 353 HelpContext property . . . . . . . . . . . . . . 378
GetProfileStr function . . . . . . . . . . . . . . 353 HelpFile property . . . . . . . . . . . . . . . . . 378
GetResults method . . . . . . . . . . . . . . . . 353 HelpJump method . . . . . . . . . . . . . . . . 379
GetSelTextBuf method . . . . . . . . . . . . . . 354 Hi function . . . . . . . . . . . . . . . . . . . . . 380
GetShortHint function . . . . . . . . . . . . . . 355 Hide method. . . . . . . . . . . . . . . . . . . . 380
GetStoredProcNames method . . . . . . . . . 355 HideSelection property. . . . . . . . . . . . . . 381
GetTableNames method . . . . . . . . . . . . . 356 High function . . . . . . . . . . . . . . . . . . . 381
GetText method . . . . . . . . . . . . . . . . . . 356 HInstance and HPrevInst variables . . . . . . 382
GetTextBuf method . . . . . . . . . . . . . . . . 357 Hint property . . . . . . . . . . . . . . . . . . . 383
GetTextItem method . . . . . . . . . . . . . . . 357 HintColor property . . . . . . . . . . . . . . . . 384
GetTextLen method. . . . . . . . . . . . . . . . 358 HintPause property. . . . . . . . . . . . . . . . 385
Glyph property . . . . . . . . . . . . . . . . . . 358 Hints property . . . . . . . . . . . . . . . . . . . 385
GotoBookmark method . . . . . . . . . . . . . 360 HistoryList property . . . . . . . . . . . . . . . 386
GotoCurrent method. . . . . . . . . . . . . . . 360 HMetafile type. . . . . . . . . . . . . . . . . . . 387
GotoKey method . . . . . . . . . . . . . . . . . 361 HorzScrollBar property . . . . . . . . . . . . . 387
GotoNearest method . . . . . . . . . . . . . . . 361 HPrevInst variable . . . . . . . . . . . . . . . . 388
GotoXY procedure . . . . . . . . . . . . . . . . 362 Icon property. . . . . . . . . . . . . . . . . . . . 388
Graphic property . . . . . . . . . . . . . . . . . 362 For forms . . . . . . . . . . . . . . . . . . . . . .388
viii
For picture objects . . . . . . . . . . . . . . . . 389 Invalidate method. . . . . . . . . . . . . . . . . 413
For an application . . . . . . . . . . . . . . . . 389 IOResult function . . . . . . . . . . . . . . . . . 414
InactiveTitle typed constant . . . . . . . . . . . 390 IsIndexField property. . . . . . . . . . . . . . . 414
Inc procedure . . . . . . . . . . . . . . . . . . . 390 IsMasked property . . . . . . . . . . . . . . . . 415
Inch property . . . . . . . . . . . . . . . . . . . 390 IsNull property . . . . . . . . . . . . . . . . . . 415
Include procedure . . . . . . . . . . . . . . . . 391 For TParam objects . . . . . . . . . . . . . . . .415
Increment property . . . . . . . . . . . . . . . . 391 For fields . . . . . . . . . . . . . . . . . . . . . .416
Index property. . . . . . . . . . . . . . . . . . . 392 IsSQLBased property . . . . . . . . . . . . . . . 416
For outline nodes . . . . . . . . . . . . . . . . . 392 IsValidChar method . . . . . . . . . . . . . . . 416
For fields . . . . . . . . . . . . . . . . . . . . . . 393 IsValidIdent function . . . . . . . . . . . . . . . 417
IndexDefs property. . . . . . . . . . . . . . . . 393 IsVisible property . . . . . . . . . . . . . . . . . 417
IndexFieldCount property. . . . . . . . . . . . 393 ItemAtPos method . . . . . . . . . . . . . . . . 417
IndexFieldNames property . . . . . . . . . . . 394 For list boxes . . . . . . . . . . . . . . . . . . . .418
IndexFields property . . . . . . . . . . . . . . . 394 For tab sets . . . . . . . . . . . . . . . . . . . . .418
IndexName property. . . . . . . . . . . . . . . 395 ItemCount property . . . . . . . . . . . . . . . 419
IndexOf method. . . . . . . . . . . . . . . . . . 395 ItemHeight property . . . . . . . . . . . . . . . 419
For menu items . . . . . . . . . . . . . . . . . . 395 ItemIndex property . . . . . . . . . . . . . . . . 420
For list objects . . . . . . . . . . . . . . . . . . . 396 ItemRect method . . . . . . . . . . . . . . . . . 421
For string objects . . . . . . . . . . . . . . . . . 396 Items property . . . . . . . . . . . . . . . . . . . 422
For TIndexDefs objects. . . . . . . . . . . . . . 397 For list boxes, combo boxes, and radio
For TFieldDefs objects . . . . . . . . . . . . . . 397 group boxes . . . . . . . . . . . . . . . . . . . .422
IndexOfObject method. . . . . . . . . . . . . . 397 For menu items, main menus, and pop-up
InitialDir property . . . . . . . . . . . . . . . . 398 menus . . . . . . . . . . . . . . . . . . . . . . .422
InitialValues property . . . . . . . . . . . . . . 399 For outlines . . . . . . . . . . . . . . . . . . . . .423
InitWinCrt procedure . . . . . . . . . . . . . . 399 For list objects. . . . . . . . . . . . . . . . . . . .423
For TIndexDefs objects . . . . . . . . . . . . . .425
InOutRes variable. . . . . . . . . . . . . . . . . 399 For TParams objects . . . . . . . . . . . . . . . .425
InPlaceActive property . . . . . . . . . . . . . 400 For TFieldDefs objects. . . . . . . . . . . . . . .425
Input variable . . . . . . . . . . . . . . . . . . . 400 ItemSeparator property . . . . . . . . . . . . . 425
InputBox function. . . . . . . . . . . . . . . . . 401 KeepConnection property . . . . . . . . . . . . 426
InputQuery function . . . . . . . . . . . . . . . 402 KeepConnections property . . . . . . . . . . . 427
Insert method . . . . . . . . . . . . . . . . . . . 402 KeyExclusive property . . . . . . . . . . . . . . 427
For list objects . . . . . . . . . . . . . . . . . . . 403 KeyFieldCount property . . . . . . . . . . . . . 428
For string objects . . . . . . . . . . . . . . . . . 403
For menu items . . . . . . . . . . . . . . . . . . 404 KeyPressed function . . . . . . . . . . . . . . . 428
For outlines . . . . . . . . . . . . . . . . . . . . 404 KeyPreview property. . . . . . . . . . . . . . . 429
For tables and queries . . . . . . . . . . . . . . 405 KeyViolCount property . . . . . . . . . . . . . 430
Insert procedure. . . . . . . . . . . . . . . . . . 406 KeyViolTableName property . . . . . . . . . . 430
InsertComponent method. . . . . . . . . . . . 406 Kind property . . . . . . . . . . . . . . . . . . . 431
InsertControl method . . . . . . . . . . . . . . 407 For bitmap buttons . . . . . . . . . . . . . . . .431
InsertObject method . . . . . . . . . . . . . . . 407 For scroll bars. . . . . . . . . . . . . . . . . . . .432
For string and string list objects . . . . . . . . 407 LargeChange property . . . . . . . . . . . . . . 433
For outlines . . . . . . . . . . . . . . . . . . . . 408 Last method . . . . . . . . . . . . . . . . . . . . 433
InsertOLEObjectDlg function. . . . . . . . . . 409 For list objects. . . . . . . . . . . . . . . . . . . .434
InsertRecord method . . . . . . . . . . . . . . . 410 For tables, queries, and stored procedures . . .434
Int function. . . . . . . . . . . . . . . . . . . . . .411 Layout property . . . . . . . . . . . . . . . . . . 435
IntegralHeight property . . . . . . . . . . . . . .411 Left property . . . . . . . . . . . . . . . . . . . . 436
Interval property . . . . . . . . . . . . . . . . . 412 LeftCol property. . . . . . . . . . . . . . . . . . 436
IntToHex function. . . . . . . . . . . . . . . . . 412 Length function . . . . . . . . . . . . . . . . . . 437
IntToStr function . . . . . . . . . . . . . . . . . 413 Length property . . . . . . . . . . . . . . . . . . 437
ix
Level property. . . . . . . . . . . . . . . . . . . 437 MaxValue property . . . . . . . . . . . . . . . . 461
Lines property. . . . . . . . . . . . . . . . . . . 438 MDIChildCount property . . . . . . . . . . . . 461
Lines property for memos. . . . . . . . . . . . 438 MDIChildren property . . . . . . . . . . . . . . 462
Lines property for outlines . . . . . . . . . . . 439 MemAvail function . . . . . . . . . . . . . . . . 462
Lines property for DDE items . . . . . . . . . 439 Menu property. . . . . . . . . . . . . . . . . . . 463
LineTo method . . . . . . . . . . . . . . . . . . 440 Merge method . . . . . . . . . . . . . . . . . . . 463
LinksDlg procedure . . . . . . . . . . . . . . . 440 MessageBox method . . . . . . . . . . . . . . . 464
LinksDlgEnabled function . . . . . . . . . . . 441 MessageDlg function . . . . . . . . . . . . . . . 465
List property . . . . . . . . . . . . . . . . . . . . 441 MessageDlgPos function. . . . . . . . . . . . . 468
Ln function. . . . . . . . . . . . . . . . . . . . . 442 Metafile property . . . . . . . . . . . . . . . . . 470
Lo function. . . . . . . . . . . . . . . . . . . . . 443 Min property. . . . . . . . . . . . . . . . . . . . 470
LoadFromFile method . . . . . . . . . . . . . . 443 MinFontSize property . . . . . . . . . . . . . . 471
For graphics objects and outlines. . . . . . . . 443
For blob, graphic, and memo fields . . . . . . 444
Minimize method . . . . . . . . . . . . . . . . . 472
LoadFromStream method . . . . . . . . . . . . 444 MinPage property. . . . . . . . . . . . . . . . . 472
LoadMemo method . . . . . . . . . . . . . . . 444 MinValue property . . . . . . . . . . . . . . . . 473
LoadPicture method . . . . . . . . . . . . . . . 445 MkDir procedure . . . . . . . . . . . . . . . . . 473
LoadStr function . . . . . . . . . . . . . . . . . 446 ModalResult property . . . . . . . . . . . . . . 474
Local property. . . . . . . . . . . . . . . . . . . 446 Mode property. . . . . . . . . . . . . . . . . . . 475
For pen objects . . . . . . . . . . . . . . . . . . .475
Locale property . . . . . . . . . . . . . . . . . . 446 For media player controls . . . . . . . . . . . .476
For tables, queries, and stored procedures . . 446 For batch move components . . . . . . . . . . .477
For sessions . . . . . . . . . . . . . . . . . . . . 447
For database components . . . . . . . . . . . . 447
Modified property . . . . . . . . . . . . . . . . 477
For graphics objects . . . . . . . . . . . . . . . .477
Locked property . . . . . . . . . . . . . . . . . 447 For OLE containers . . . . . . . . . . . . . . . .478
LoginPrompt property . . . . . . . . . . . . . . 448 For edit boxes and memos . . . . . . . . . . . .478
LongRec . . . . . . . . . . . . . . . . . . . . . . 448 For tables, queries, and stored procedures . . .479
LookupDisplay property . . . . . . . . . . . . 449 Monochrome property . . . . . . . . . . . . . . 479
LookupField property . . . . . . . . . . . . . . 449 MouseToCell method. . . . . . . . . . . . . . . 480
LookupSource property . . . . . . . . . . . . . 450 Move method . . . . . . . . . . . . . . . . . . . 480
Low function . . . . . . . . . . . . . . . . . . . 450 Move procedure . . . . . . . . . . . . . . . . . . 481
LowerCase function . . . . . . . . . . . . . . . 451 MoveBy method. . . . . . . . . . . . . . . . . . 482
MainForm property . . . . . . . . . . . . . . . 452 MovedCount property . . . . . . . . . . . . . . 482
Mappings property. . . . . . . . . . . . . . . . 452 MoveTo method . . . . . . . . . . . . . . . . . . 483
Margin property . . . . . . . . . . . . . . . . . 453 For canvases . . . . . . . . . . . . . . . . . . . .483
For bitmap buttons and speed buttons . . . . 453 For outline nodes . . . . . . . . . . . . . . . . .484
For form and scroll box scroll bars . . . . . . . 454 MSecsPerDay constant . . . . . . . . . . . . . . 485
Mask property. . . . . . . . . . . . . . . . . . . 455 MultiSelect property . . . . . . . . . . . . . . . 485
For filter combo boxes . . . . . . . . . . . . . . 455 Name property . . . . . . . . . . . . . . . . . . 485
For file list boxes . . . . . . . . . . . . . . . . . 456 For components . . . . . . . . . . . . . . . . . .485
MasterFields property . . . . . . . . . . . . . . 456 For font objects . . . . . . . . . . . . . . . . . . .486
MasterSource property. . . . . . . . . . . . . . 457 For TIndexDef objects . . . . . . . . . . . . . . .486
Max property . . . . . . . . . . . . . . . . . . . 457 For TParam objects . . . . . . . . . . . . . . . .486
MaxAvail function . . . . . . . . . . . . . . . . 458 For TFieldDef objects . . . . . . . . . . . . . . .487
MaxFontSize property . . . . . . . . . . . . . . 459 NativeToAnsi procedure . . . . . . . . . . . . . 487
MaxLength property . . . . . . . . . . . . . . . 459 NetFileDir property. . . . . . . . . . . . . . . . 487
MaxPage property . . . . . . . . . . . . . . . . 460 New procedure . . . . . . . . . . . . . . . . . . 488
MaxRecords property . . . . . . . . . . . . . . 460 NewPage method . . . . . . . . . . . . . . . . . 488
MaxTabNameLen constant . . . . . . . . . . . 461 NewStr function. . . . . . . . . . . . . . . . . . 489
x
Next method. . . . . . . . . . . . . . . . . . . . 490 OnCreate event . . . . . . . . . . . . . . . . . . 519
For forms. . . . . . . . . . . . . . . . . . . . . . 490 OnDataChange event. . . . . . . . . . . . . . . 520
For media player controls . . . . . . . . . . . . 490 OnDblClick event . . . . . . . . . . . . . . . . . 520
For tables, queries, and stored procedures . . 491 OnDeactivate event . . . . . . . . . . . . . . . . 521
NormalizeTopMosts method . . . . . . . . . . 491 OnDestroy event . . . . . . . . . . . . . . . . . 522
Notify property . . . . . . . . . . . . . . . . . . 492 OnDragDrop event . . . . . . . . . . . . . . . . 522
NotifyValue property. . . . . . . . . . . . . . . 493 OnDragOver event . . . . . . . . . . . . . . . . 523
Now function . . . . . . . . . . . . . . . . . . . 494 OnDrawCell event . . . . . . . . . . . . . . . . 524
NullStr constant. . . . . . . . . . . . . . . . . . 495 OnDrawDataCell event . . . . . . . . . . . . . 524
NumGlyphs property . . . . . . . . . . . . . . 495 OnDrawItem event . . . . . . . . . . . . . . . . 525
ObjClass property. . . . . . . . . . . . . . . . . 496 OnDrawTab event. . . . . . . . . . . . . . . . . 526
ObjDoc property . . . . . . . . . . . . . . . . . 496 OnDropDown event . . . . . . . . . . . . . . . 527
ObjectMenuItem property. . . . . . . . . . . . 497 OnEndDrag event. . . . . . . . . . . . . . . . . 527
Objects property. . . . . . . . . . . . . . . . . . 498 OnEnter event . . . . . . . . . . . . . . . . . . . 528
For string objects . . . . . . . . . . . . . . . . . 498
For string grids . . . . . . . . . . . . . . . . . . 499
OnException event . . . . . . . . . . . . . . . . 529
ObjItem property . . . . . . . . . . . . . . . . . 499 OnExecuteMacro event . . . . . . . . . . . . . 530
Odd function . . . . . . . . . . . . . . . . . . . 500 OnExit event . . . . . . . . . . . . . . . . . . . . 530
OEMConvert property. . . . . . . . . . . . . . 501 OnExpand event . . . . . . . . . . . . . . . . . 531
Ofs function . . . . . . . . . . . . . . . . . . . . 501 OnFind event . . . . . . . . . . . . . . . . . . . 532
OLEObjAllocated method. . . . . . . . . . . . 502 OnGetEditMask event . . . . . . . . . . . . . . 533
OnActivate event . . . . . . . . . . . . . . . . . 502 OnGetEditText event . . . . . . . . . . . . . . . 533
For forms. . . . . . . . . . . . . . . . . . . . . . 503 OnGetText event. . . . . . . . . . . . . . . . . . 534
For OLE containers . . . . . . . . . . . . . . . . 503 OnHide event . . . . . . . . . . . . . . . . . . . 534
For an application . . . . . . . . . . . . . . . . 504 OnHelp event . . . . . . . . . . . . . . . . . . . 536
OnActiveControlChange event. . . . . . . . . 505 OnHint event . . . . . . . . . . . . . . . . . . . 536
OnActiveFormChange event . . . . . . . . . . 506 OnIdle event . . . . . . . . . . . . . . . . . . . . 538
OnApply event . . . . . . . . . . . . . . . . . . 507 OnKeyDown event . . . . . . . . . . . . . . . . 539
OnCalcFields event. . . . . . . . . . . . . . . . 508 OnKeyPress event. . . . . . . . . . . . . . . . . 539
OnChange event . . . . . . . . . . . . . . . . . 508 OnKeyUp event . . . . . . . . . . . . . . . . . . 540
For tab set controls . . . . . . . . . . . . . . . . 509 OnLogin event. . . . . . . . . . . . . . . . . . . 541
For DDE client item and DDE server item OnMeasureItem event . . . . . . . . . . . . . . 541
controls . . . . . . . . . . . . . . . . . . . . . . 509
OnMeasureTab event . . . . . . . . . . . . . . . 542
For data-aware components . . . . . . . . . . 510
For fields . . . . . . . . . . . . . . . . . . . . . . 510 OnMessage event . . . . . . . . . . . . . . . . . 543
For other components and objects . . . . . . . 510 OnMinimize event . . . . . . . . . . . . . . . . 544
OnChanging event . . . . . . . . . . . . . . . . .511 OnMouseDown event . . . . . . . . . . . . . . 544
OnClick event . . . . . . . . . . . . . . . . . . . .511 OnMouseMove event . . . . . . . . . . . . . . 545
For the media player components . . . . . . . 511 OnMouseUp event . . . . . . . . . . . . . . . . 546
For database navigators . . . . . . . . . . . . . 513 OnNewRecord event . . . . . . . . . . . . . . . 547
For forms and other components . . . . . . . 514 OnNotify event . . . . . . . . . . . . . . . . . . 547
OnClose event. . . . . . . . . . . . . . . . . . . 514 OnOpen event . . . . . . . . . . . . . . . . . . . 548
For forms. . . . . . . . . . . . . . . . . . . . . . 515 OnPageChanged event. . . . . . . . . . . . . . 548
For DDE components . . . . . . . . . . . . . . 515 OnPaint event . . . . . . . . . . . . . . . . . . . 549
OnCloseQuery event . . . . . . . . . . . . . . . 516 OnPassword event . . . . . . . . . . . . . . . . 550
OnColEnter event. . . . . . . . . . . . . . . . . 516 OnPokeData event . . . . . . . . . . . . . . . . 551
OnColExit event. . . . . . . . . . . . . . . . . . 517 OnPopup event . . . . . . . . . . . . . . . . . . 552
OnCollapse event . . . . . . . . . . . . . . . . . 518 OnPostClick event . . . . . . . . . . . . . . . . 552
OnColumnMoved event. . . . . . . . . . . . . 518 OnReplace event . . . . . . . . . . . . . . . . . 553
xi
OnResize event . . . . . . . . . . . . . . . . . . 553 Pages property. . . . . . . . . . . . . . . . . . . 582
OnRestore event. . . . . . . . . . . . . . . . . . 554 PageWidth property . . . . . . . . . . . . . . . 583
OnRowMoved event . . . . . . . . . . . . . . . 554 Palette property . . . . . . . . . . . . . . . . . . 583
OnScroll event. . . . . . . . . . . . . . . . . . . 555 ParamBindMode property. . . . . . . . . . . . 584
OnSelectCell event . . . . . . . . . . . . . . . . 555 ParamByName method . . . . . . . . . . . . . 584
OnSetEditText event . . . . . . . . . . . . . . . 556 For TParam objects . . . . . . . . . . . . . . . .585
OnSetText event . . . . . . . . . . . . . . . . . . 556 For queries and stored procedures . . . . . . .585
OnShow event. . . . . . . . . . . . . . . . . . . 557 ParamCount function. . . . . . . . . . . . . . . 585
OnShowHint event . . . . . . . . . . . . . . . . 557 ParamCount property . . . . . . . . . . . . . . 586
OnSized event . . . . . . . . . . . . . . . . . . . 558 For query components . . . . . . . . . . . . . .586
For stored procedures . . . . . . . . . . . . . . .586
OnSizing event . . . . . . . . . . . . . . . . . . 559
Params property. . . . . . . . . . . . . . . . . . 587
OnStateChange event . . . . . . . . . . . . . . 559 For stored procedures . . . . . . . . . . . . . . .587
OnStatusLineEvent event . . . . . . . . . . . . 560 For queries . . . . . . . . . . . . . . . . . . . . .587
OnTimer event . . . . . . . . . . . . . . . . . . 560 For database components. . . . . . . . . . . . .588
OnTopLeftChanged event. . . . . . . . . . . . 561 ParamStr function. . . . . . . . . . . . . . . . . 588
OnUpdateData event. . . . . . . . . . . . . . . 561 ParamType property . . . . . . . . . . . . . . . 589
OnValidate event . . . . . . . . . . . . . . . . . 562 Parent property . . . . . . . . . . . . . . . . . . 589
Open method . . . . . . . . . . . . . . . . . . . 562 For controls . . . . . . . . . . . . . . . . . . . . .589
For the Clipboard . . . . . . . . . . . . . . . . . 562 For menu items. . . . . . . . . . . . . . . . . . .590
For media player controls . . . . . . . . . . . . 563 For outline nodes . . . . . . . . . . . . . . . . .591
For tables, queries, and stored procedures . . 564 ParentColor property . . . . . . . . . . . . . . . 591
For databases . . . . . . . . . . . . . . . . . . . 564 ParentCtl3D property. . . . . . . . . . . . . . . 592
OpenCurrent method . . . . . . . . . . . . . . 564 ParentFont property . . . . . . . . . . . . . . . 593
OpenDatabase method . . . . . . . . . . . . . 565 ParentShowHint property . . . . . . . . . . . . 594
OpenLink method . . . . . . . . . . . . . . . . 566 PasswordChar property . . . . . . . . . . . . . 595
Options property . . . . . . . . . . . . . . . . . 566 PasteFromClipboard method . . . . . . . . . . 596
For Color dialog boxes . . . . . . . . . . . . . . 566 PasteSpecialDlg function. . . . . . . . . . . . . 596
For Font dialog boxes . . . . . . . . . . . . . . 567
For Print dialog boxes . . . . . . . . . . . . . . 568 PasteSpecialEnabled function . . . . . . . . . . 598
For Open and Save dialog boxes . . . . . . . . 569 Pause method . . . . . . . . . . . . . . . . . . . 598
For Find and Replace dialog boxes. . . . . . . 570 PauseOnly method . . . . . . . . . . . . . . . . 600
For outlines . . . . . . . . . . . . . . . . . . . . 571 Pen property . . . . . . . . . . . . . . . . . . . . 600
For draw and string grids . . . . . . . . . . . . 572 PenPos property. . . . . . . . . . . . . . . . . . 601
For data grids . . . . . . . . . . . . . . . . . . . 573 Pi function . . . . . . . . . . . . . . . . . . . . . 601
For database lookup combo boxes and list Picture property . . . . . . . . . . . . . . . . . . 602
boxes . . . . . . . . . . . . . . . . . . . . . . . 574
For TIndexDef objects . . . . . . . . . . . . . . 575 PictureClosed property. . . . . . . . . . . . . . 602
Ord function . . . . . . . . . . . . . . . . . . . . 575 PictureLeaf property . . . . . . . . . . . . . . . 603
Orientation property . . . . . . . . . . . . . . . 575 PictureMinus property . . . . . . . . . . . . . . 603
Origin typed constant . . . . . . . . . . . . . . 576 PictureOpen property . . . . . . . . . . . . . . 604
OutlineStyle property . . . . . . . . . . . . . . 577 PicturePlus property . . . . . . . . . . . . . . . 604
OutOfMemoryError procedure. . . . . . . . . 577 Pie method . . . . . . . . . . . . . . . . . . . . . 605
Output variable . . . . . . . . . . . . . . . . . . 577 PInitInfo property . . . . . . . . . . . . . . . . . 605
Overload property . . . . . . . . . . . . . . . . 578 Pitch property . . . . . . . . . . . . . . . . . . . 606
Owner property. . . . . . . . . . . . . . . . . . 578 Pixels property. . . . . . . . . . . . . . . . . . . 607
Pack method. . . . . . . . . . . . . . . . . . . . 579 PixelsPerInch property . . . . . . . . . . . . . . 607
For forms . . . . . . . . . . . . . . . . . . . . . .608
PageHeight property . . . . . . . . . . . . . . . 580
For the screen. . . . . . . . . . . . . . . . . . . .608
PageIndex property . . . . . . . . . . . . . . . 581 For fonts . . . . . . . . . . . . . . . . . . . . . . .609
PageNumber property . . . . . . . . . . . . . . 582
xii
Play method . . . . . . . . . . . . . . . . . . . . 609 Randomize procedure . . . . . . . . . . . . . . 635
Point function . . . . . . . . . . . . . . . . . . . 610 RandSeed variable . . . . . . . . . . . . . . . . 636
PokeData method. . . . . . . . . . . . . . . . . .611 Range property . . . . . . . . . . . . . . . . . . 636
PokeDataLines method . . . . . . . . . . . . . .611 Read method. . . . . . . . . . . . . . . . . . . . 637
Polygon method . . . . . . . . . . . . . . . . . 612 Read procedure . . . . . . . . . . . . . . . . . . 638
PolyLine method . . . . . . . . . . . . . . . . . 613 ReadBool method . . . . . . . . . . . . . . . . . 639
Popup method . . . . . . . . . . . . . . . . . . 613 ReadBuf function . . . . . . . . . . . . . . . . . 639
PopupComponent property . . . . . . . . . . 614 ReadFrom method . . . . . . . . . . . . . . . . 640
PopupMenu property . . . . . . . . . . . . . . 615 Readln procedure . . . . . . . . . . . . . . . . . 641
Pos function . . . . . . . . . . . . . . . . . . . . 616 ReadInteger method . . . . . . . . . . . . . . . 641
Position property . . . . . . . . . . . . . . . . . 616 ReadKey function . . . . . . . . . . . . . . . . . 642
For forms. . . . . . . . . . . . . . . . . . . . . . 616 ReadOnly property . . . . . . . . . . . . . . . . 643
For scroll bars . . . . . . . . . . . . . . . . . . . 617 For controls . . . . . . . . . . . . . . . . . . . . .643
For media player controls . . . . . . . . . . . . 618 For tables . . . . . . . . . . . . . . . . . . . . . .644
For Find and Replace dialog boxes. . . . . . . 619 For field components . . . . . . . . . . . . . . .644
Post method . . . . . . . . . . . . . . . . . . . . 619 ReadSection method . . . . . . . . . . . . . . . 644
Precision property . . . . . . . . . . . . . . . . 620 ReadSectionValues method . . . . . . . . . . . 645
Pred function . . . . . . . . . . . . . . . . . . . 620 ReadString method . . . . . . . . . . . . . . . . 646
PrefixSeg variable. . . . . . . . . . . . . . . . . 621 ReAllocMem function . . . . . . . . . . . . . . 647
Prepare method . . . . . . . . . . . . . . . . . . 621 RecalcReport method. . . . . . . . . . . . . . . 647
For stored procedures . . . . . . . . . . . . . . 621 Rect function . . . . . . . . . . . . . . . . . . . . 648
For queries . . . . . . . . . . . . . . . . . . . . . 622 RecordCount property . . . . . . . . . . . . . . 648
Prepared property . . . . . . . . . . . . . . . . 622 For batch move components . . . . . . . . . . .648
For stored procedures . . . . . . . . . . . . . . 622 For tables, queries, and stored procedures . . .649
For queries . . . . . . . . . . . . . . . . . . . . . 623 Rectangle method . . . . . . . . . . . . . . . . . 649
Preview property . . . . . . . . . . . . . . . . . 623 Refresh method . . . . . . . . . . . . . . . . . . 650
Previous method . . . . . . . . . . . . . . . . . 624 For all controls . . . . . . . . . . . . . . . . . . .650
For forms. . . . . . . . . . . . . . . . . . . . . . 624 For tables, queries, and stored procedures . . .650
For media players. . . . . . . . . . . . . . . . . 624 RegisterFormAsOLEDropTarget
Print method. . . . . . . . . . . . . . . . . . . . 625 procedure . . . . . . . . . . . . . . . . . . . . . 651
For forms. . . . . . . . . . . . . . . . . . . . . . 625 Release method . . . . . . . . . . . . . . . . . . 652
For reports . . . . . . . . . . . . . . . . . . . . . 626
Release procedure. . . . . . . . . . . . . . . . . 652
PrintCopies property. . . . . . . . . . . . . . . 626
ReleaseHandle method. . . . . . . . . . . . . . 653
Printer variable . . . . . . . . . . . . . . . . . . 627
ReleaseOLEInitInfo procedure . . . . . . . . . 653
PrinterIndex property . . . . . . . . . . . . . . 627
ReleasePalette method . . . . . . . . . . . . . . 654
Printers property . . . . . . . . . . . . . . . . . 628
Remove method. . . . . . . . . . . . . . . . . . 654
Printing property . . . . . . . . . . . . . . . . . 628
RemoveAllPasswords method . . . . . . . . . 655
PrintRange property . . . . . . . . . . . . . . . 629
RemoveComponent method . . . . . . . . . . 656
PrintScale property . . . . . . . . . . . . . . . . 629
RemoveControl method . . . . . . . . . . . . . 656
PrintToFile property . . . . . . . . . . . . . . . 630
RemoveParam method. . . . . . . . . . . . . . 657
Prior method. . . . . . . . . . . . . . . . . . . . 631
RemovePassword method. . . . . . . . . . . . 657
PrivateDir property. . . . . . . . . . . . . . . . 631
Rename procedure . . . . . . . . . . . . . . . . 658
ProblemCount property . . . . . . . . . . . . . 632
RenameFile function . . . . . . . . . . . . . . . 659
ProblemTableName property . . . . . . . . . . 632
Repaint method . . . . . . . . . . . . . . . . . . 659
ProcessMessages method . . . . . . . . . . . . 632
ReplaceText property . . . . . . . . . . . . . . . 660
Ptr function . . . . . . . . . . . . . . . . . . . . 634
ReportDir property . . . . . . . . . . . . . . . . 660
PtrRec . . . . . . . . . . . . . . . . . . . . . . . . 635
ReportHandle property . . . . . . . . . . . . . 661
Random function . . . . . . . . . . . . . . . . . 635
ReportName property . . . . . . . . . . . . . . 661
xiii
RequestData method . . . . . . . . . . . . . . . 662 Selected property . . . . . . . . . . . . . . . . . 691
RequestLive property . . . . . . . . . . . . . . 662 SelectedColor property. . . . . . . . . . . . . . 692
Required property . . . . . . . . . . . . . . . . 663 SelectedField property . . . . . . . . . . . . . . 693
For field components. . . . . . . . . . . . . . . 663 SelectedIndex property. . . . . . . . . . . . . . 693
For TFieldDef objects. . . . . . . . . . . . . . . 663 SelectedItem property . . . . . . . . . . . . . . 694
Reset procedure . . . . . . . . . . . . . . . . . . 664 Selection property. . . . . . . . . . . . . . . . . 694
Restore method . . . . . . . . . . . . . . . . . . 665 SelectNext method . . . . . . . . . . . . . . . . 695
RestoreTopMosts method . . . . . . . . . . . . 665 SelectorInc variable . . . . . . . . . . . . . . . . 695
Resume method. . . . . . . . . . . . . . . . . . 666 SelLength property . . . . . . . . . . . . . . . . 695
Rewind method . . . . . . . . . . . . . . . . . . 667 SelStart property. . . . . . . . . . . . . . . . . . 696
Rewrite procedure . . . . . . . . . . . . . . . . 667 SelText property . . . . . . . . . . . . . . . . . . 697
RmDir procedure . . . . . . . . . . . . . . . . . 668 SendToBack method . . . . . . . . . . . . . . . 697
Rollback method . . . . . . . . . . . . . . . . . 669 ServerConv property . . . . . . . . . . . . . . . 698
Round function . . . . . . . . . . . . . . . . . . 669 ServiceApplication property . . . . . . . . . . 699
RoundRect method. . . . . . . . . . . . . . . . 670 Session variable . . . . . . . . . . . . . . . . . . 699
Row property . . . . . . . . . . . . . . . . . . . 671 SetAsHandle method. . . . . . . . . . . . . . . 700
RowCount property . . . . . . . . . . . . . . . 672 SetBounds method . . . . . . . . . . . . . . . . 700
RowHeights property . . . . . . . . . . . . . . 672 SetComponent method. . . . . . . . . . . . . . 701
Rows property. . . . . . . . . . . . . . . . . . . 673 SetData method . . . . . . . . . . . . . . . . . . 702
Run method . . . . . . . . . . . . . . . . . . . . 674 For TParam objects . . . . . . . . . . . . . . . .702
For an application . . . . . . . . . . . . . . . . 674 For field components . . . . . . . . . . . . . . .702
For reports . . . . . . . . . . . . . . . . . . . . . 674 SetFields method . . . . . . . . . . . . . . . . . 703
RunError procedure . . . . . . . . . . . . . . . 675 SetFocus method . . . . . . . . . . . . . . . . . 703
RunMacro method . . . . . . . . . . . . . . . . 675 SetFormOLEDropFormats procedure . . . . . 704
Save method . . . . . . . . . . . . . . . . . . . . 676 SetKey method . . . . . . . . . . . . . . . . . . 704
SaveToFile method . . . . . . . . . . . . . . . . 677 SetLink method . . . . . . . . . . . . . . . . . . 705
SaveToStream method . . . . . . . . . . . . . . 678 SetParams method . . . . . . . . . . . . . . . . 705
ScaleBy method . . . . . . . . . . . . . . . . . . 678 SetPrinter method. . . . . . . . . . . . . . . . . 706
Scaled property . . . . . . . . . . . . . . . . . . 679 SetRange method . . . . . . . . . . . . . . . . . 706
Screen variable . . . . . . . . . . . . . . . . . . 679 SetRangeEnd method . . . . . . . . . . . . . . 707
ScreenSize typed constant . . . . . . . . . . . . 680 SetRangeStart method . . . . . . . . . . . . . . 708
ScreenToClient method . . . . . . . . . . . . . 680 SetSelTextBuf method . . . . . . . . . . . . . . 708
ScrollBars property . . . . . . . . . . . . . . . . 681 SetTabFocus method . . . . . . . . . . . . . . . 709
ScrollBy method. . . . . . . . . . . . . . . . . . 681 SetText method . . . . . . . . . . . . . . . . . . 710
ScrollInView method . . . . . . . . . . . . . . . 682 SetTextBuf method . . . . . . . . . . . . . . . . 710
ScrollPos property . . . . . . . . . . . . . . . . 683 SetTextBuf procedure . . . . . . . . . . . . . . . 711
ScrollTo procedure . . . . . . . . . . . . . . . . 683 SetUpdateState method . . . . . . . . . . . . . 712
Sections property . . . . . . . . . . . . . . . . . 684 SetVariable method . . . . . . . . . . . . . . . . 713
SectionWidth property . . . . . . . . . . . . . . 684 SetVariableLines method. . . . . . . . . . . . . 713
Seek method . . . . . . . . . . . . . . . . . . . . 685 Shape property . . . . . . . . . . . . . . . . . . 714
Seek procedure . . . . . . . . . . . . . . . . . . 685 For bevels . . . . . . . . . . . . . . . . . . . . . .714
SeekEof function . . . . . . . . . . . . . . . . . 686 For shape controls . . . . . . . . . . . . . . . . .715
SeekEoln function. . . . . . . . . . . . . . . . . 687 Shareable property . . . . . . . . . . . . . . . . 716
Seg function . . . . . . . . . . . . . . . . . . . . 688 ShortCut function . . . . . . . . . . . . . . . . . 716
SelCount property . . . . . . . . . . . . . . . . 689 ShortCut property. . . . . . . . . . . . . . . . . 717
SelectAll method . . . . . . . . . . . . . . . . . 690 ShortCutToKey procedure . . . . . . . . . . . . 718
SelectDirectory function . . . . . . . . . . . . . 690 ShortCutToText function . . . . . . . . . . . . . 718
xiv
Show method . . . . . . . . . . . . . . . . . . . 719 StrCat function. . . . . . . . . . . . . . . . . . . 744
ShowAccelChar property . . . . . . . . . . . . 719 StrComp function . . . . . . . . . . . . . . . . . 745
ShowException method . . . . . . . . . . . . . 720 StrCopy function . . . . . . . . . . . . . . . . . 745
ShowException procedure . . . . . . . . . . . 720 StrDispose function . . . . . . . . . . . . . . . . 746
ShowGlyphs property . . . . . . . . . . . . . . 720 StrECopy function . . . . . . . . . . . . . . . . 746
ShowHint property. . . . . . . . . . . . . . . . 721 StrEnd function . . . . . . . . . . . . . . . . . . 747
For all controls. . . . . . . . . . . . . . . . . . . 721 Stretch property . . . . . . . . . . . . . . . . . . 747
For applications . . . . . . . . . . . . . . . . . . 722 StretchDraw method . . . . . . . . . . . . . . . 748
Showing property. . . . . . . . . . . . . . . . . 722 StrFmt function . . . . . . . . . . . . . . . . . . 748
ShowMessage procedure . . . . . . . . . . . . 723 Strings property . . . . . . . . . . . . . . . . . . 749
ShowMessagePos procedure . . . . . . . . . . 724 StrLCat function . . . . . . . . . . . . . . . . . . 750
ShowModal method . . . . . . . . . . . . . . . 724 StrIComp function . . . . . . . . . . . . . . . . 750
Sin function . . . . . . . . . . . . . . . . . . . . 725 StrLComp function . . . . . . . . . . . . . . . . 751
Size property. . . . . . . . . . . . . . . . . . . . 725 StrLCopy function . . . . . . . . . . . . . . . . 752
For fonts . . . . . . . . . . . . . . . . . . . . . . 726 StrLen function . . . . . . . . . . . . . . . . . . 752
For TFieldDef objects. . . . . . . . . . . . . . . 726
For field components. . . . . . . . . . . . . . . 727
StrLFmt function . . . . . . . . . . . . . . . . . 753
SizeOf function . . . . . . . . . . . . . . . . . . 727 StrLIComp function. . . . . . . . . . . . . . . . 753
SmallChange property . . . . . . . . . . . . . . 728 StrLower function. . . . . . . . . . . . . . . . . 754
Sort method . . . . . . . . . . . . . . . . . . . . 728 StrMove function . . . . . . . . . . . . . . . . . 754
Sorted property . . . . . . . . . . . . . . . . . . 729 StrNew function. . . . . . . . . . . . . . . . . . 755
For combo and list boxes . . . . . . . . . . . . 729 StrPas function. . . . . . . . . . . . . . . . . . . 755
For string list objects . . . . . . . . . . . . . . . 730 StrPCopy function . . . . . . . . . . . . . . . . 756
Source property . . . . . . . . . . . . . . . . . . 730 StrPLCopy function. . . . . . . . . . . . . . . . 757
Spacing property . . . . . . . . . . . . . . . . . 731 StrPos function. . . . . . . . . . . . . . . . . . . 757
SPtr function. . . . . . . . . . . . . . . . . . . . 731 StrRScan function . . . . . . . . . . . . . . . . . 757
SQL property . . . . . . . . . . . . . . . . . . . 732 StrScan function . . . . . . . . . . . . . . . . . . 758
Sqr function . . . . . . . . . . . . . . . . . . . . 733 StrToDate function . . . . . . . . . . . . . . . . 759
Sqrt function . . . . . . . . . . . . . . . . . . . . 733 StrToDateTime function . . . . . . . . . . . . . 759
SSeg function . . . . . . . . . . . . . . . . . . . 734 StrToFloat function . . . . . . . . . . . . . . . . 760
Start property . . . . . . . . . . . . . . . . . . . 735 StrToInt function. . . . . . . . . . . . . . . . . . 760
StartMargin property. . . . . . . . . . . . . . . 736 StrToIntDef function . . . . . . . . . . . . . . . 761
StartPage property . . . . . . . . . . . . . . . . 736 StrToTime function . . . . . . . . . . . . . . . . 762
StartPos property . . . . . . . . . . . . . . . . . 737 StrUpper function. . . . . . . . . . . . . . . . . 762
StartRecording method . . . . . . . . . . . . . 738 Style property . . . . . . . . . . . . . . . . . . . 763
StartTransaction method. . . . . . . . . . . . . 738 For pen objects . . . . . . . . . . . . . . . . . . .763
State property . . . . . . . . . . . . . . . . . . . 739 For brushes . . . . . . . . . . . . . . . . . . . . .764
For fonts . . . . . . . . . . . . . . . . . . . . . . .765
For check boxes . . . . . . . . . . . . . . . . . . 739
For combo boxes . . . . . . . . . . . . . . . . . .765
For data source components . . . . . . . . . . 740
For list boxes . . . . . . . . . . . . . . . . . . . .767
For tables, queries, and stored procedures . . 740
For bitmap buttons . . . . . . . . . . . . . . . .768
Step method . . . . . . . . . . . . . . . . . . . . 740 For tab set controls. . . . . . . . . . . . . . . . .768
StmtHandle property. . . . . . . . . . . . . . . 741 For outlines . . . . . . . . . . . . . . . . . . . . .769
Stop method . . . . . . . . . . . . . . . . . . . . 742 For bevels . . . . . . . . . . . . . . . . . . . . . .770
Storage property . . . . . . . . . . . . . . . . . 742 For database lookup combo boxes . . . . . . .770
StoredProcName property . . . . . . . . . . . 743 Succ function. . . . . . . . . . . . . . . . . . . . 771
Str procedure . . . . . . . . . . . . . . . . . . . 743 Swap function . . . . . . . . . . . . . . . . . . . 771
StrAlloc function . . . . . . . . . . . . . . . . . 744 TableName property . . . . . . . . . . . . . . . 772
StrBufSize function . . . . . . . . . . . . . . . . 744 TableType property . . . . . . . . . . . . . . . . 772
xv
Tag property . . . . . . . . . . . . . . . . . . . . 773 TComponentName type . . . . . . . . . . . . . 796
TAlign type . . . . . . . . . . . . . . . . . . . . 773 TControlScrollBar object . . . . . . . . . . . . . 796
TAlignment type . . . . . . . . . . . . . . . . . 773 TCopyMode type . . . . . . . . . . . . . . . . . 797
TApplication component . . . . . . . . . . . . 773 TCurrencyField component . . . . . . . . . . . 797
TAttachMode type . . . . . . . . . . . . . . . . 775 TCursor type . . . . . . . . . . . . . . . . . . . . 798
TAutoActivate type. . . . . . . . . . . . . . . . 775 TCustomColors type . . . . . . . . . . . . . . . 798
TBatchMode type . . . . . . . . . . . . . . . . . 775 TDatabase component . . . . . . . . . . . . . . 798
TBatchMove component. . . . . . . . . . . . . 776 TDataChangeEvent type. . . . . . . . . . . . . 800
TBCDField component . . . . . . . . . . . . . 776 TDataMode type . . . . . . . . . . . . . . . . . 800
TBevel component . . . . . . . . . . . . . . . . 777 TDataSetNotifyEvent type. . . . . . . . . . . . 800
TBevelShape type. . . . . . . . . . . . . . . . . 778 TDataSetState type . . . . . . . . . . . . . . . . 800
TBevelStyle type . . . . . . . . . . . . . . . . . 778 TDataSource component. . . . . . . . . . . . . 801
TBevelWidth type. . . . . . . . . . . . . . . . . 779 TDateField component . . . . . . . . . . . . . . 801
TBitBtn component . . . . . . . . . . . . . . . . 779 TDateTime type . . . . . . . . . . . . . . . . . . 802
TBitBtnKind type . . . . . . . . . . . . . . . . . 780 TDateTimeField component. . . . . . . . . . . 802
TBitmap object . . . . . . . . . . . . . . . . . . 781 TDBCheckBox component. . . . . . . . . . . . 803
TBlobField component. . . . . . . . . . . . . . 781 TDBComboBox component . . . . . . . . . . . 804
TBlobStream object . . . . . . . . . . . . . . . . 782 TDBEdit component . . . . . . . . . . . . . . . 806
TBlobStreamMode type . . . . . . . . . . . . . 783 TDBGrid component . . . . . . . . . . . . . . . 808
TBookmark type . . . . . . . . . . . . . . . . . 783 TDBGridOptions type . . . . . . . . . . . . . . 809
TBooleanField component . . . . . . . . . . . 783 TDBImage component . . . . . . . . . . . . . . 810
TBorderIcons type . . . . . . . . . . . . . . . . 784 TDBListBox component . . . . . . . . . . . . . 811
TBorderStyle type. . . . . . . . . . . . . . . . . 784 TDBLookupCombo component . . . . . . . . 813
TBorderWidth type . . . . . . . . . . . . . . . . 784 TDBLookupComboStyle type. . . . . . . . . . 814
TBrush object . . . . . . . . . . . . . . . . . . . 785 TDBLookupList component. . . . . . . . . . . 815
TBrushStyle type . . . . . . . . . . . . . . . . . 785 TDBLookupListOptions type . . . . . . . . . . 816
TButton component . . . . . . . . . . . . . . . 786 TDBMemo component . . . . . . . . . . . . . . 817
TButtonLayout type . . . . . . . . . . . . . . . 787 TDBNavigator component . . . . . . . . . . . 819
TButtonSet type . . . . . . . . . . . . . . . . . . 787 TDBRadioGroup component . . . . . . . . . . 820
For media players. . . . . . . . . . . . . . . . . 787 TDBText component . . . . . . . . . . . . . . . 822
For database navigators . . . . . . . . . . . . . 787 TDDEClientConv component. . . . . . . . . . 823
TButtonStyle type. . . . . . . . . . . . . . . . . 787 TDDEClientItem component . . . . . . . . . . 824
TByteArray . . . . . . . . . . . . . . . . . . . . 788 TDDEServerConv component . . . . . . . . . 825
TBytesField component . . . . . . . . . . . . . 788 TDDEServerItem component . . . . . . . . . . 825
TCanvas object . . . . . . . . . . . . . . . . . . 789 TDirectoryListBox component . . . . . . . . . 826
TCaption type . . . . . . . . . . . . . . . . . . . 790 TDragDropEvent type . . . . . . . . . . . . . . 828
TChangeRange type . . . . . . . . . . . . . . . 790 TDragMode type . . . . . . . . . . . . . . . . . 828
TCheckBox component . . . . . . . . . . . . . 790 TDragOverEvent type . . . . . . . . . . . . . . 828
TCheckBoxState type. . . . . . . . . . . . . . . 791 TDragState type . . . . . . . . . . . . . . . . . . 829
TClipboard object . . . . . . . . . . . . . . . . . 792 TDrawCellEvent type . . . . . . . . . . . . . . 829
TCloseEvent type . . . . . . . . . . . . . . . . . 792 TDrawDataCellEvent type . . . . . . . . . . . 830
TCloseQueryEvent type . . . . . . . . . . . . . 793 TDrawGrid component . . . . . . . . . . . . . 830
TColor type . . . . . . . . . . . . . . . . . . . . 793 TDrawItemEvent type . . . . . . . . . . . . . . 832
TColorDialog component . . . . . . . . . . . . 794 TDrawTabEvent type. . . . . . . . . . . . . . . 832
TColorDialogOptions type . . . . . . . . . . . 794 TDriveComboBox component . . . . . . . . . 832
TComboBox component. . . . . . . . . . . . . 795 TDuplicates type . . . . . . . . . . . . . . . . . 834
TComboBoxStyle type . . . . . . . . . . . . . . 796 TEdit component . . . . . . . . . . . . . . . . . 834
xvi
TEditCharCase type . . . . . . . . . . . . . . . 836 TFontDialogDevice type . . . . . . . . . . . . . 861
Temporary property . . . . . . . . . . . . . . . 836 TFontDialogOptions type . . . . . . . . . . . . 861
TEndDragEvent type. . . . . . . . . . . . . . . 837 TFontName type . . . . . . . . . . . . . . . . . 861
Terminate method . . . . . . . . . . . . . . . . 837 TFontPitch type . . . . . . . . . . . . . . . . . . 862
Terminated property . . . . . . . . . . . . . . . 837 TFontStyles type. . . . . . . . . . . . . . . . . . 862
Test8086 variable . . . . . . . . . . . . . . . . . 838 TForm component . . . . . . . . . . . . . . . . 862
TExceptionEvent type . . . . . . . . . . . . . . 838 TFormBorderStyle type . . . . . . . . . . . . . 864
Text property . . . . . . . . . . . . . . . . . . . 839 TFormStyle type. . . . . . . . . . . . . . . . . . 865
For edit boxes and memo controls . . . . . . . 839 TGetEditEvent type. . . . . . . . . . . . . . . . 865
For combo boxes . . . . . . . . . . . . . . . . . 840 TGraphic object . . . . . . . . . . . . . . . . . . 865
For outline nodes . . . . . . . . . . . . . . . . . 840 TGraphicField component. . . . . . . . . . . . 866
For DDE items. . . . . . . . . . . . . . . . . . . 841
For queries . . . . . . . . . . . . . . . . . . . . . 841
TGraphicsObject object. . . . . . . . . . . . . . 866
For fields . . . . . . . . . . . . . . . . . . . . . . 842 TGridDrawState type. . . . . . . . . . . . . . . 867
For TParam objects . . . . . . . . . . . . . . . . 843 TGridOptions type . . . . . . . . . . . . . . . . 867
TextCase property. . . . . . . . . . . . . . . . . 843 TGridRect type . . . . . . . . . . . . . . . . . . 867
TextFile type . . . . . . . . . . . . . . . . . . . . 844 TGroupBox component . . . . . . . . . . . . . 868
TextHeight method . . . . . . . . . . . . . . . . 844 THeader component . . . . . . . . . . . . . . . 869
TextOut method. . . . . . . . . . . . . . . . . . 845 THelpContext type . . . . . . . . . . . . . . . . 870
TextRect method . . . . . . . . . . . . . . . . . 845 THelpEvent type . . . . . . . . . . . . . . . . . 870
TextToFloat function . . . . . . . . . . . . . . . 846 THintInfo type. . . . . . . . . . . . . . . . . . . 870
TextToShortCut function. . . . . . . . . . . . . 846 TIcon object. . . . . . . . . . . . . . . . . . . . . 870
TextWidth method . . . . . . . . . . . . . . . . 847 TIdleEvent type . . . . . . . . . . . . . . . . . . 871
TFDApplyEvent type . . . . . . . . . . . . . . 847 Tile method. . . . . . . . . . . . . . . . . . . . . 871
TField component . . . . . . . . . . . . . . . . 848 TileMode property . . . . . . . . . . . . . . . . 872
TFieldGetTextEvent type . . . . . . . . . . . . 850 TImage component . . . . . . . . . . . . . . . . 873
TFieldNotifyEvent type . . . . . . . . . . . . . 850 Time function . . . . . . . . . . . . . . . . . . . 874
TFieldSetTextEvent type . . . . . . . . . . . . . 850 TimeFormat property. . . . . . . . . . . . . . . 874
TFileEditStyle type . . . . . . . . . . . . . . . . 851 TimeToStr function . . . . . . . . . . . . . . . . 876
TFileExt type. . . . . . . . . . . . . . . . . . . . 851 TIndexDef object . . . . . . . . . . . . . . . . . 877
TFileListBox component. . . . . . . . . . . . . 851 TIndexDefs object . . . . . . . . . . . . . . . . . 877
TFieldClass type . . . . . . . . . . . . . . . . . 853 TIndexOptions type . . . . . . . . . . . . . . . 878
TFieldDef object. . . . . . . . . . . . . . . . . . 853 TIniFile object . . . . . . . . . . . . . . . . . . . 878
TFieldDefs object . . . . . . . . . . . . . . . . . 853 TIntegerField component . . . . . . . . . . . . 878
TFieldType type . . . . . . . . . . . . . . . . . . 854 Title property. . . . . . . . . . . . . . . . . . . . 879
TFileName type . . . . . . . . . . . . . . . . . . 854 For applications . . . . . . . . . . . . . . . . . .879
TFileRec type . . . . . . . . . . . . . . . . . . . 854 For Open and Save dialog boxes . . . . . . . .880
For printer objects . . . . . . . . . . . . . . . . .880
TFileType type. . . . . . . . . . . . . . . . . . . 855
TitleFont property . . . . . . . . . . . . . . . . . 881
TFillStyle type . . . . . . . . . . . . . . . . . . . 855
TKey type. . . . . . . . . . . . . . . . . . . . . . 881
TFilterComboBox component . . . . . . . . . 855
TKeyEvent type . . . . . . . . . . . . . . . . . . 881
TFindDialog component. . . . . . . . . . . . . 856
TKeyPressEvent type . . . . . . . . . . . . . . . 882
TFindItemKind type . . . . . . . . . . . . . . . 857
TLabel component . . . . . . . . . . . . . . . . 882
TFindOptions type . . . . . . . . . . . . . . . . 857
TLeftRight type . . . . . . . . . . . . . . . . . . 883
TFloatField component . . . . . . . . . . . . . 857
TList object . . . . . . . . . . . . . . . . . . . . . 883
TFloatFormat . . . . . . . . . . . . . . . . . . . 858
TListBox component . . . . . . . . . . . . . . . 884
TFloatRec. . . . . . . . . . . . . . . . . . . . . . 859
TListBoxStyle type . . . . . . . . . . . . . . . . 885
TFont object . . . . . . . . . . . . . . . . . . . . 859
TLocale type . . . . . . . . . . . . . . . . . . . . 886
TFontDialog component. . . . . . . . . . . . . 860
xvii
TLoginEvent type. . . . . . . . . . . . . . . . . 886 TPanel component . . . . . . . . . . . . . . . . 913
TMacroEvent type . . . . . . . . . . . . . . . . 886 TPanelBevel type . . . . . . . . . . . . . . . . . 914
TMainMenu component. . . . . . . . . . . . . 886 TParam object . . . . . . . . . . . . . . . . . . . 914
TMaskEdit component. . . . . . . . . . . . . . 887 TParamBindMode type . . . . . . . . . . . . . 915
TMeasureItemEvent type . . . . . . . . . . . . 889 TParams object. . . . . . . . . . . . . . . . . . . 915
TMeasureTabEvent type . . . . . . . . . . . . . 889 TParamType type . . . . . . . . . . . . . . . . . 916
TMediaPlayer component. . . . . . . . . . . . 889 TPasswordEvent type . . . . . . . . . . . . . . 916
TMemo component. . . . . . . . . . . . . . . . 891 TPen object . . . . . . . . . . . . . . . . . . . . . 916
TMemoField component . . . . . . . . . . . . 893 TPenMode type . . . . . . . . . . . . . . . . . . 917
TMenuBreak type. . . . . . . . . . . . . . . . . 894 TPenStyle type. . . . . . . . . . . . . . . . . . . 917
TMenuItem component . . . . . . . . . . . . . 894 TPicture object . . . . . . . . . . . . . . . . . . . 917
TMessageEvent type . . . . . . . . . . . . . . . 895 TPoint type . . . . . . . . . . . . . . . . . . . . . 918
TMetafile object . . . . . . . . . . . . . . . . . . 895 TPopupAlignment type . . . . . . . . . . . . . 918
TMethod . . . . . . . . . . . . . . . . . . . . . . 896 TPopupMenu component . . . . . . . . . . . . 918
TModalResult type . . . . . . . . . . . . . . . . 896 TPosition type . . . . . . . . . . . . . . . . . . . 919
TMouseButton type . . . . . . . . . . . . . . . 897 TPrintDialog component. . . . . . . . . . . . . 920
TMouseEvent type . . . . . . . . . . . . . . . . 897 TPrintDialogOptions type . . . . . . . . . . . . 920
TMouseMoveEvent type . . . . . . . . . . . . 897 TPrinter object . . . . . . . . . . . . . . . . . . . 921
TMovedEvent type . . . . . . . . . . . . . . . . 898 TPrinterOrientation type. . . . . . . . . . . . . 922
TMPBtnType type. . . . . . . . . . . . . . . . . 898 TPrinterSetupDialog component . . . . . . . . 922
TMPDevCapsSet type . . . . . . . . . . . . . . 898 TPrintRange type . . . . . . . . . . . . . . . . . 922
TMPDeviceTypes type . . . . . . . . . . . . . . 898 TPrintScale type . . . . . . . . . . . . . . . . . . 923
TMPModes type . . . . . . . . . . . . . . . . . 899 TQuery component . . . . . . . . . . . . . . . . 923
TMPNotifyValues type. . . . . . . . . . . . . . 899 TrackCursor procedure. . . . . . . . . . . . . . 925
TMPTimeFormats type. . . . . . . . . . . . . . 899 TrackLength property . . . . . . . . . . . . . . 925
TMsgDlgButtons type . . . . . . . . . . . . . . 899 TrackPosition property . . . . . . . . . . . . . . 926
TMsgDlgType type . . . . . . . . . . . . . . . . 900 Tracks property . . . . . . . . . . . . . . . . . . 927
TNavigateBtn type . . . . . . . . . . . . . . . . 900 TRadioButton component . . . . . . . . . . . . 927
TNotebook component . . . . . . . . . . . . . 900 TRadioGroup component . . . . . . . . . . . . 928
TNotifyEvent type . . . . . . . . . . . . . . . . 901 TransIsolation property. . . . . . . . . . . . . . 930
TNumGlyphs type . . . . . . . . . . . . . . . . 902 Transliterate property. . . . . . . . . . . . . . . 930
TOLEContainer component. . . . . . . . . . . 902 Transparent property . . . . . . . . . . . . . . . 931
TOLEDropNotify object . . . . . . . . . . . . . 903 TRect type . . . . . . . . . . . . . . . . . . . . . 931
Top property . . . . . . . . . . . . . . . . . . . . 904 TReplaceDialog component . . . . . . . . . . . 932
ToPage property. . . . . . . . . . . . . . . . . . 904 TReport component. . . . . . . . . . . . . . . . 933
TOpenDialog component . . . . . . . . . . . . 905 Trunc function . . . . . . . . . . . . . . . . . . . 934
TOpenOptions type . . . . . . . . . . . . . . . 906 Truncate method . . . . . . . . . . . . . . . . . 934
TopIndex property . . . . . . . . . . . . . . . . 906 Truncate procedure . . . . . . . . . . . . . . . . 935
TopItem property . . . . . . . . . . . . . . . . . 907 TSaveDialog component. . . . . . . . . . . . . 936
TopRow property . . . . . . . . . . . . . . . . . 907 TScreen component . . . . . . . . . . . . . . . . 937
TOutline component . . . . . . . . . . . . . . . 908 TScrollBar component . . . . . . . . . . . . . . 938
TOutlineNode object . . . . . . . . . . . . . . . 910 TScrollBarInc type. . . . . . . . . . . . . . . . . 939
TOutlineOptions type . . . . . . . . . . . . . . .911 TScrollBarKind type . . . . . . . . . . . . . . . 939
TOutlineStyle type . . . . . . . . . . . . . . . . .911 TScrollBox component . . . . . . . . . . . . . . 939
TOutlineType type . . . . . . . . . . . . . . . . .911 TScrollCode type . . . . . . . . . . . . . . . . . 941
TOwnerDrawState type . . . . . . . . . . . . . .911 TScrollEvent type . . . . . . . . . . . . . . . . . 941
TPaintBox component . . . . . . . . . . . . . . 912 TScrollStyle type. . . . . . . . . . . . . . . . . . 941
xviii
TSearchRec type. . . . . . . . . . . . . . . . . . 942 For directory and file list boxes . . . . . . . . .970
TSectionEvent type . . . . . . . . . . . . . . . . 942 For all controls . . . . . . . . . . . . . . . . . . .970
TSelectCellEvent type . . . . . . . . . . . . . . 943 For TFieldDefs objects. . . . . . . . . . . . . . .971
For TIndexDefs objects . . . . . . . . . . . . . .971
TSelectDirOpts type . . . . . . . . . . . . . . . 943
TSession component . . . . . . . . . . . . . . . 943 UpdateCursorPos method. . . . . . . . . . . . 971
TSetEditEvent type . . . . . . . . . . . . . . . . 944 UpdateMode property . . . . . . . . . . . . . . 971
TShape component . . . . . . . . . . . . . . . . 945 UpdateRecord method . . . . . . . . . . . . . . 973
TShapeType type . . . . . . . . . . . . . . . . . 945 UpperCase function . . . . . . . . . . . . . . . 973
TShiftState type . . . . . . . . . . . . . . . . . . 946 Val procedure . . . . . . . . . . . . . . . . . . . 973
TShortCut type . . . . . . . . . . . . . . . . . . 946 ValidateEdit method . . . . . . . . . . . . . . . 974
TShowHintEvent type . . . . . . . . . . . . . . 946 ValidParentForm function . . . . . . . . . . . . 975
TSmallintField component . . . . . . . . . . . 947 Value property . . . . . . . . . . . . . . . . . . . 975
For database radio groups . . . . . . . . . . . .975
TSpeedButton component. . . . . . . . . . . . 948 For database lookup combo and list boxes. . .976
TStatusLineEvent type . . . . . . . . . . . . . . 949 For fields . . . . . . . . . . . . . . . . . . . . . .976
TStoredProc component . . . . . . . . . . . . . 949 ValueChecked property . . . . . . . . . . . . . 977
TStringField component . . . . . . . . . . . . . 951 Values property . . . . . . . . . . . . . . . . . . 978
TStringGrid component . . . . . . . . . . . . . 951 For string and string list objects . . . . . . . . .978
TStringList object . . . . . . . . . . . . . . . . . 953 For database radio group boxes . . . . . . . . .979
TStrings object. . . . . . . . . . . . . . . . . . . 954 ValueUnchecked property . . . . . . . . . . . . 980
TSymbolStr type . . . . . . . . . . . . . . . . . 955 VersionMajor property . . . . . . . . . . . . . . 981
TTabbedNotebook component . . . . . . . . . 955 VersionMinor property . . . . . . . . . . . . . . 982
TTabChangeEvent type . . . . . . . . . . . . . 956 VertScrollBar property . . . . . . . . . . . . . . 982
TTable component . . . . . . . . . . . . . . . . 956 Visible property . . . . . . . . . . . . . . . . . . 983
TTabOrder type . . . . . . . . . . . . . . . . . . 958 VisibleButtons property . . . . . . . . . . . . . 983
TTabSet component. . . . . . . . . . . . . . . . 958 For database navigator controls . . . . . . . . .984
TTabStyle type. . . . . . . . . . . . . . . . . . . 960 VisibleColCount property . . . . . . . . . . . . 985
TTextCase type . . . . . . . . . . . . . . . . . . 960 VisibleRowCount property . . . . . . . . . . . 985
TTextRec type . . . . . . . . . . . . . . . . . . . 960 VisibleTabs property . . . . . . . . . . . . . . . 986
TTileMode type . . . . . . . . . . . . . . . . . . 961 Wait property . . . . . . . . . . . . . . . . . . . 986
TTimeField component . . . . . . . . . . . . . 961 WantReturns property . . . . . . . . . . . . . . 987
TTimer component . . . . . . . . . . . . . . . . 962 WantTabs property . . . . . . . . . . . . . . . . 988
TTransIsolation type . . . . . . . . . . . . . . . 962 WhereX function . . . . . . . . . . . . . . . . . 989
TVarBytesField component . . . . . . . . . . . 962 WhereY function . . . . . . . . . . . . . . . . . 989
TVarRec type. . . . . . . . . . . . . . . . . . . . 963 Width property . . . . . . . . . . . . . . . . . . 990
TWindowState type . . . . . . . . . . . . . . . 964 For forms and controls . . . . . . . . . . . . . .990
TWordArray . . . . . . . . . . . . . . . . . . . . 964 For graphic objects. . . . . . . . . . . . . . . . .990
For screen components . . . . . . . . . . . . . .991
TWordField component . . . . . . . . . . . . . 964
WindowMenu property . . . . . . . . . . . . . 991
TypeOf function. . . . . . . . . . . . . . . . . . 965
WindowOrg typed constant. . . . . . . . . . . 992
TZoomFactor type . . . . . . . . . . . . . . . . 966
WindowSize typed constant. . . . . . . . . . . 992
UniDirectional property . . . . . . . . . . . . . 966
WindowState property . . . . . . . . . . . . . . 992
Unmerge method . . . . . . . . . . . . . . . . . 967
WindowTitle variable. . . . . . . . . . . . . . . 993
UnPrepare method . . . . . . . . . . . . . . . . 968
For stored procedures . . . . . . . . . . . . . . 968 WordRec . . . . . . . . . . . . . . . . . . . . . . 993
For queries . . . . . . . . . . . . . . . . . . . . . 968 WordWrap property . . . . . . . . . . . . . . . 993
UnselectedColor property. . . . . . . . . . . . 968 Write method . . . . . . . . . . . . . . . . . . . 994
UpCase function . . . . . . . . . . . . . . . . . 969 Write procedure . . . . . . . . . . . . . . . . . . 995
Update method . . . . . . . . . . . . . . . . . . 969 WriteBool method. . . . . . . . . . . . . . . . . 995
xix
WriteBuf procedure. . . . . . . . . . . . . . . . 996 WriteString method . . . . . . . . . . . . . . . . 998
WriteChar procedure. . . . . . . . . . . . . . . 997 Zoom property . . . . . . . . . . . . . . . . . . 999
WriteIn procedure. . . . . . . . . . . . . . . . . 997
WriteInteger method . . . . . . . . . . . . . . . 998 Index 1001
xx