Copyright: (C) 2004 Petroleum Entertainment


Contents

This is the help file for all the MyXXXX Components and the My_XXXX Functions.

There are currently 6 My_Components:

TDBOleCtnr
TDBPostal
TMyDBEdit
TMyDBGrid
TMyEdit
TPhoneEdit


blank


TDBOleCtnr

Hierarchy	Properties	Methods	Events

TDBOleCtnr displays a OLE object from a BLOB field of the current record of a dataset.

Unit
MyDBEdit

Description
Use TDBOleCtnr to represent an entire OLE control using a field of a dataset. OLE objects can be quite large (The minimum size is 20K) so they should be used sparingly.

TDBOleCtnr only loads the BLOB if explicitly told to in order to conserve system resources.


TDBOLECtnr

Ancestry

TOleContainer

TCustomControl

TWinControl

TControl

TComponent

TPersistent

TObject


TDBOleCtnr Properties

In TDBOLECtnr
DataField
DataSource
OleModified
NewOleClassName
ProgressBar
ProgressBarAlign

Ancestry

TOleContainer

TCustomControl

TWinControl

TControl

TComponent

TPersistent

TObject


TDBOleCtnr Methods

in TDBOleCtnr
LoadRecord
NewRecord
SaveRecord


TDBOleCtnr Events

TDBOleCtnr Methods

in TDBOleCtnr
OnRecordChange


TDBOleCtnr
TDBOleCtnr.DataField

DataField specifies the field from which the TDBOLECtnr displays data.

property DataField: string;

Description
Use DataField to bind the OLE control to a field in the dataset. To fully specify a database field, both the dataset and the field within that dataset must be defined. The DataSource property of the OLE control specifies the dataset which contains the DataField.

DataField must refer to a Binary Large Object (BLOB) Field.


TDBOleCtnr
TDBOleCtnr.DataSource

DataSource links the OLE control to the dataset that contains the field it represents.

property DataSource: TDataSource;

Description

Use DataSource to link the OLE control to a dataset in which the data can be found. To fully specify a database field for the OLE control, both the dataset and a field within that dataset must be defined. Use the DataField property to specify the particular field within the dataset.


TDBOleCtnr
TDBOleCtnr.OLEModified

property OLEModified: Boolean;

Description

TDBOLEContainer uses OLEModified internally to tell if the user has loaded the OLE object that the BLOB field represents. Thus it is TRUE as long as the OLE object has been loaded, regardless of whether or not the user has actually modified it.


TDBOleCtnr
TDBOleCtnr.ProgressBar

property ProgressBar: TProgressBar;

Description

ProgressBar indicates the User-designed ProgressBar that the TDBOLECtnr uses when loading and saving files. If no ProgressBar is created here, then one is created at run-time.


TDBOleCtnr
TDBOleCtnr.ProgressBarAlign

Align determines how the OLE control aligns its ProgressBar.

TAlign = (alNone, alTop, alBottom, alLeft, alRight, alClient);

property Align: TAlign;

Description

Use Align to align the ProgressBar to the top, bottom, left, or right of the TDBOleCtnr and have it remain there even if the size of the OLE control changes.


TDBOleCtnr
TDBOleCtnr.NewOleClassName

property NewOleClassName: String;

Description

NewOleClassName indicates the type of OLE object to read to and from the datafield, and especially when generating new entries.

The value required here varies widely even between different versions of the same software. For Word in Office 97, NewOleClassName should be set to Word.Document.8


TDBOleCtnr
TDBOleCtnr.LoadRecord

Procedure LoadRecord; virtual;

Description

Loads and displays the current record that dataset points to. There must be a record present.


TDBOleCtnr
TDBOleCtnr.NewRecord

Procedure NewRecord; virtual;

Description

Creates and displays a new OLE object of NewOLEClassName type and inserts it into the current field.


TDBOleCtnr
TDBOleCtnr.LoadRecord

Procedure LoadRecord; virtual;

Description

Saves the currently loaded OLE object into the BLOB field that DataSet points to.


TDBOleCtnr
TDBOleCtnr.OnRecordChange

OnRecordChange occurs when the user has caused the current record to change and the OLECtnr is preparing to save the most recent changes to the database.

type
property OnRecordChange: TNotifyEvent


TMyDBEdit

TMyDBEdit is identical to TDBEdit except it defines two new events that make it similar to TMyEdit.

/b OnLostFocus is called when the control loses the input focus.

/b OnUpdate occurs when the user clicks the ENTER key.


TMyEdit

TMyEdit is identical to TEdit except it defines two new events.

/b EnterKillsFocus determines if the enter key causes OnKillFocus.

/b OnKillFocus is called when the control loses the input focus.

/b OnEnterKey occurs when the user clicks the ENTER key.


TPhoneDBEdit

TPhoneDBEdit is identical to TMyDBEdit but it automatically formats text into phone number format. This is, by definition, of the form (###)###-####.

TPhoneDBEdit is descended from TMyDBEdit


TDBPostal

Properties

TDBPostal is identical to TMyDBEdit but it automatically formats text  into Postal Code Format. For the United States, it uses #####. For England and Canada it uses A#A #A# or AA#A #A#.

TDBPostal is descended from TMyDBEdit


TDBPostal Properties

In TDBPostal
DBCity
DBProvinvce
DBCountry
ForceChange

Ancestry

TMyDBEdit

TDBEdit

TCustomMaskEdit

TCustomEdit

TWinControl

TControl

TComponent

TPersistent

TObject


TDBPostal
TDBPostal.DBCity

Points to a Control which will receive the city corresponding to the postal code entered.

property DBCity: TDBEdit;

Description

For example, the user sets the postal code to "V6C 2M2" and the Control will be set to "Vancouver". This is useful for self-populating fields. Note that cities only work for Canadian Postal Codes.

If TDBPostal cannot figure out the appropriate information it will leave the control blank. If the control is already populated, it will leave it as is unless ForceChange is True;


TDBPostal
TDBPostal.DBProvince

Points to a Control which will receive the province/state corresponding to the postal code entered.

property DBProvince: TDBEdit;

Description

For example, the user sets the postal code to "V6C 2M2" and the Control will be set to "British Columbia". This is useful for self-populating fields. Note that Provinces only work for Canadian Postal Codes, though a few American States have been included.

If TDBPostal cannot figure out the appropriate information it will leave the control blank. If the control is already populated, it will leave it as is unless ForceChange is True;


TDBPostal
TDBPostal.DBCountry

Points to a Control which will receive the country corresponding to the postal code entered.

property DBCountry: TDBEdit;

Description

For example, the user sets the postal code to "V6C 2M2" and the Control will be set to "Canada". This is useful for self-populating fields. Note that the only legal countries are Canada, England and the United States, in that order. (Our sample postal code (above) will display "Canada" even if the postal code exists in England)

If TDBPostal cannot figure out the appropriate information it will leave the control blank. If the control is already populated, it will leave it as is unless ForceChange is True;


TDBPostal
TDBPostal.ForceChange

Specifies if the control should force new data into the fields of its update controls.

property ForceChange: Boolean;

Description

Normally if a TDBPostal is updated, it will change any blank Update fields (DBCity, DBProvince and DBCountry), leaving filled ones as they are. Set ForceChange to True and these fields will be updated, replacing any previous information they contained.


TMyDBGrid

TMyDBGrid is identical to TDBGrid except it defines a new event called RecordChange and it gives the user the ability to dynamically display its columns.


TMyDBGrid
TMyDBGrid.OnRecordChange

OnRecordChange occurs when the user has caused the current record to change.

type
property OnRecordChange: TNotifyEvent


TADOCheckBox

TADOCheckBox is a database-aware CheckBox specifically designed to run with the ADODataset components, since for some inconceivable reason TDBCheckBox creates Access Violations.


TDataManager

Properties	Methods

TDataManager encapsulates a connection to an ADO (Access Database Object) service.

Start a project by adding a TDataManager. Then when you use ADODataSets, set their DataManager Property to this component.


TDataManager Properties

In TDataManager
Catalog
Connected
Connection
DataBaseName
Provider

Ancestry

TComponent

TPersistent

TObject


TDataManager
TDataManager.Connected

Connects the Database to the underlying database.

property Connected: Boolean;

Description

Set Connected to True in order to connect to the Database.

You must set DataBaseName to an appropriate Datasource. Provider must be "MsDataShape" or another provider (a blank Provider will cause errors). ADODataSets will attempt to connect their DataManagers, if they are not connected, when activated.

Connections wait 60 seconds for a connection and Time-out if they fail. During this time is is theoretically possible to try to set the connection again, so it is best not to toggle connected while the hourglass is visible. (Several ADO Components accessing the same DataManager will sequence themselves appropriately; it requires direct user intervention to create problems)


TDataManager
TDataManager.DatabaseName

Specifies the underlying Datasource to use.

property DatabaseName: String;

Description

Set DatabaseName to the DataSource you wish to connect to.


TDataManager
TDataManager.Provider

Specifies the Provider to use.

property Provider: String;

Description

Set Provider to "MsDataShape" unless you really know ADO and really know what you are doing. TADOTable assumes it has DataShaping abilities available.


TDataManager
TDataManager.Catalog

Specifies the underlying Catalog COM Object.

property Catalog: OleVariant;

Description

Read Catalog to access the catalog object and perform OLE commands on it. This is one of the objects for which TDatamanager is just a wrapper.

Catalog is nil unless OpenCatalog has been called. It is safe to call OpenCatalog multiple times, so best to call it just before reading from Catalog;


TDataManager
TDataManager.Connection

Specifies the underlying Connection COM Object.

property Connection: OleVariant;

Description

Read Connection to access the catalog object and perform OLE commands on it. This is one of the objects for which TDatamanager is just a wrapper.

Connection is nil unless Connected is True;


TDataManager Methods

in TDataManager
Connect
OpenCatalog
CreateDataSource


TDataManager
TDataManager.Connect;

Procedure Connect;

Description

Connects the DataManager.


TDataManager
TDataManager.OpenCatalog;

Procedure OpenCatalog;

Description

Assigns a catalog to the /uldb Catalog/v TDataManager_PCa Property if one has not already been assigned.


TDataManager
TDataManager.CreateDataSource

Function CreateDataSource(AName, FileName, Description: String): Boolean;

Description

Creates an ODBC datasource using the provided data. It displays a dialog, allowing the user to OK it and returns True if everything was successful.


TADODataSet

Properties	Methods

TADODataSet is the base type for TADOTable and TADOQuery. The latter of these is rather useless as TADOTables can get at the queries even in Access which is faster, but TADOQuery remains just-in-case.

To use a TADODataSet you need to create a TDataManager component and connect it for its DataManager Property. You will also need to set TableName to an existing Access table for the DataManager.


TADODataSet Properties

In TADODataSet
Catalog
Connected
Connection
DataBaseName
Provider

Ancestry

TDataSet

TComponent

TPersistent

TObject


TADODataSet Methods

in TADODataSet
Connect
OpenCatalog
CreateDataSource


TADOTable

TADODTable is just a wrapper around TADODataSet to differentiate it from TADOQuery. It adds only a few functions such as TableName (Which is hidden in its ancestor) and such.


MyString32: Overview
MyStrings32 (mStrin32.pas)
by Keneto. Last update: Jan 11, 2004

Here, at last is the infamous mStrin32 library which performs a lot of the backbone work in my older projects, and still appears in newer work cause it's so useful. There are 4 Main categories of functions in here:

Date Functions.
Day
Month
Year
Time Difference

String Conversion Functions
Add_Decimal
My_DWordString
My_ExtendedString
My_ExtendedPrice
My_FloatToComma
My_StringExtended

String Modification Functions
My_StringFrom
My_StringFromEx
My_StringTo
My_StringToEx
My_StringToFirst
My_SubString
WordInString

File Functions
My_FileDirectory
My_FileExtension
My_FileName

Old & Obsolete Functions
My_FloatPrice
My_HexInt
My_Int
My_IntHex
My_PChar
My_PtrToString

Math Functions
Power Function


MyString32: Day Function
Day function
See Also

Unit
mStrin32

Category
Time/Date handling routines

Function Day(D: TDateTime): Integer;

Description
Returns the day from D

Example

procedure TForm1.Button1Click(Sender: TObject);
var
  Value: Integer;
begin
  Value := Day(Now);
end;


MyString32: Month Function
Month function
See Also

Unit
mStrin32

Category
Time/Date handling routines

Function Month(D: TDateTime): Integer;

Description
Returns the Month from D

Example

procedure TForm1.Button1Click(Sender: TObject);
var
  Value: Integer;
begin
  Value := Month(Now);
end;


MyString32: Year Function
Year function
See Also

Unit
mStrin32

Category
Time/Date handling routines

Function Year(D: TDateTime): Integer;

Description
Returns the Year from D

Example

procedure TForm1.Button1Click(Sender: TObject);
var
  Value: Integer;
begin
  Value := Year(Now);
end;


MyString32: My_TimeDifference
My_TimeDifference function
See Also

Unit
mStrin32

Category
Time/Date handling routines

Function My_TimeDifference(FirstTime, SecondTime: TDateTime): ;

Description
Returns a time difference eg '1hour, 32minutes'

Example

procedure TForm1.Button1Click(Sender: TObject);
var
 D: TDateTime;
begin
  Edit1.Text := MyTimeDifference(Now, D);
end;


MyString32: Add_Decimal
Add_Decimal function
See Also

Unit
mStrin32

Category
String Conversion routines

Function Add_Decimal(A: ShortString): ShortString;

Description
Takes a string like '4' or '4.5' and makes it into '4.00' or '4.50'

Example

procedure TForm1.Button1Click(Sender: TObject);
begin
  Edit1.Text := Add_Decimal('4');
  Edit2.Text := Add_Decimal('4.5');
end;


MyString32: My_DWordString
My_DWordString function
See Also

Unit
mStrin32

Category
String Conversion routines

Function My_DWordString(A: Integer): String;

Description
True unsigned DWord to String conversion so $FFFFEEEE does not return a negative

Example

procedure TForm1.Button1Click(Sender: TObject);
begin
  Edit1.Text := My_DWordString($FFFFEEE);
end;

Displays
4294962918


MyString32: My_ExtendedString
My_ExtendedString function
See Also

Unit
mStrin32

Category
String Conversion routines

Function My_ExtendedString(A: Extended): String;

Description
Converts a float into a string, but just keeps adding zeros until it gets there.

Example

procedure TForm1.Button1Click(Sender: TObject);
begin
  Edit1.Text := My_ExtendedString(4e20);
end;

Displays
40 000 000 000 000 000 000


MyString32: My_ExtendedPrice
My_ExtendedPrice function
See Also

Unit
mStrin32

Category
String Conversion routines

Function My_ExtendedPrice(M: Extended): String;

Description
Like My_ExtendedString, converts a float into a string but also adds 2 digits of cents at the end.

Example

procedure TForm1.Button1Click(Sender: TObject);
begin
  Edit1.Text := My_ExtendedPrice(5);
end;


MyString32: My_FloatToComma
My_FloatToComma function
See Also

Unit
mStrin32

Category
String Conversion routines

Function My_FloatToComma(E: Extended): String;

Description
Like My_ExtendedString, but adds Thousand separators as it converts the value.

Example

procedure TForm1.Button1Click(Sender: TObject);
begin
  ThousandSeparator := ',';
  Edit1.Text := My_FloatToComma(4e6);
end;

Displays
4 000 000


MyString32: My_StringExtended
My_StringExtended function
See Also

Unit
mStrin32

Category
String Conversion routines

Function My_StringExtended(A: String): Extended;

Description
Returns a floating-point value for a string. Ignores intervening commas and other.

Example

procedure TForm1.Button1Click(Sender: TObject);
var
 F: Single;
begin
  F := My_StringExtended('4,000,0a0');
end;

Sets:
F becomes 4e5;


MyString32: MyStringFrom
MyStringFrom function
See Also

Unit
mStrin32

Category
String Modification routines

Function My_StringFrom(Source: String; StartChar: Char): String;

Description
Returns substring, from Start to end

Example

procedure TForm1.Button1Click(Sender: TObject);
var
A: String;
begin
A := My_StringFrom('abcdefghij', 'g');
end;

Displays:
ghij


MyString32: MyStringFromEx
MyStringFromEx function
See Also

Unit
mStrin32

Category
String Modification routines

Function My_StringFromEx(Source: String; StartChar: Char): String;

Description
Returns substring, from Start + 1 to end

Example

procedure TForm1.Button1Click(Sender: TObject);
var
 A: String;
begin
  A := My_StringFromEx('abcdefghij', 'g');
end;

Displays:
hij


MyString32: MyStringTo
MyStringTo function
See Also

Unit
mStrin32

Category
String Modification routines

Function My_StringTo(Source: String; StopChar: Char): String;

Description
Returns substring, from 1 to Stop

Example

procedure TForm1.Button1Click(Sender: TObject);
var
 A: String;
begin
  A := My_StringTo('abcdefghij', 'g');
end;

Displays:
abcdefg


MyString32: MyStringToEx
MyStringToEx function
See Also

Unit
mStrin32

Category
String Modification routines

Function My_StringToEx(Source: String; StopChar: Char): String;

Description
Returns substring, from 1 to Stop - 1

Example

procedure TForm1.Button1Click(Sender: TObject);
var
 A: String;
begin
  A := My_StringToEx('abcdefghij', 'g');
end;

Displays:
abcdef


MyString32: MyStringToFirst
MyStringToFirst function
See Also

Unit
mStrin32

Category
String Modification routines

Function My_StringToFirst(Source: String; StopChar: Char): String;

Description
Misnomer. Actually starts at the end looking for StopChar

Example

procedure TForm1.Button1Click(Sender: TObject);
var
 A: String;
begin
  A := My_StringToFirst('abgcdefghij', 'g');
end;

Displays:
abgcdefg


MyString32: My_SubString
My_SubString function
See Also

Unit
mStrin32

Category
String Modification routines

Function My_SubString(Source: String; Start, Stop: Integer): String;

Description
Returns substring, from Start + 1 to Stop

Example

procedure TForm1.Button1Click(Sender: TObject);
var
 A: String;
begin
  A := My_SubString('abcdefghij', 2, 4);
end;

Displays:
bcd


MyString32: WordInString
WordInString function
See Also

Unit
mStrin32

Category
String Modification routines

Function WordInString(S: String; Index: Word): String;

Description
Returns the Indexed word in the string using space as a delimiter.

Example

procedure TForm1.Button1Click(Sender: TObject);
var
 A: String;
begin
  A := WordInString('abc def ghij', 2);
end;

Displays:
def


MyString32: My_FileDirectory
My_FileDirectory function
See Also

Unit
mStrin32

Category
File Functions

Function My_FileDirectory(FileName: String): String;

Description
Returns the File Directory pointed to in FileName including trailing \

Example

procedure TForm1.Button1Click(Sender: TObject);
var
 A: String;
begin
  A := My_FileDirectory('c:\apps\yaada.txt');
end;

Displays:
c:\apps\


MyString32: My_FileExtension
My_FileExtension function
See Also

Unit
mStrin32

Category
File Functions

Function My_FileExtension(FileName: String): String;

Description
Returns the extention in .ext format

Example

procedure TForm1.Button1Click(Sender: TObject);
var
 A: String;
begin
  A := My_FileExtension('c:\apps\yaada.txt');
end;

Displays:
.txt


MyString32: My_FileName
My_FileName function
See Also

Unit
mStrin32

Category
File Functions

Function My_FileName(FileName: String): String;

Description
Strips out everything but the bare Filename

Example

procedure TForm1.Button1Click(Sender: TObject);
var
 A: String;
begin
  A := My_FileName('c:\apps\yaada.txt');
end;

Displays:
yaada


MyString32: My_FloatPrice
My_FloatPrice function
See Also

Unit
mStrin32

Category
Obsolete Functions

Function My_FloatPrice(E: Extended): String;

Description
Converts a floating-point value into a price including $ symbol and cents.

Example

procedure TForm1.Button1Click(Sender: TObject);
var
 A: String;
begin
  A := My_FloatPrice(5);
end;

Displays:
$5.00


MyString32: My_HexInt
My_HexInt function
See Also

Unit
mStrin32

Category
Obsolete Functions

Function My_HexInt(A: String): Integer;

Description
Converts a hexadecimal string into an integer. Capable of converting MegaTraveller (role-playing game) values right up to L.
Use StrToInt() now, but make sure leading char is $

Example

procedure TForm1.Button1Click(Sender: TObject);
var
 I: Integer;
begin
 I :=  My_HexInt('FF');
end;

Sets:
I becomes 255;


MyString32: My_Int
My_Int function
See Also

Unit
mStrin32

Category
Obsolete Functions

Function My_Int(A: String): Integer;

Description
Converts a string into an integer. Does not generate exceptions.
Use Format() now

Example

procedure TForm1.Button1Click(Sender: TObject);
var
 I: Integer;
begin
  I := My_Int('111');
end;

Displays:
I becomes 111


MyString32: My_IntHex
My_IntHex function
See Also

Unit
mStrin32

Category
Obsolete Functions

Function My_IntHex(A: LongInt): String;

Description
Converts an integer into a hexadecimal string.
Use IntToHex() now.

Example

procedure TForm1.Button1Click(Sender: TObject);
var
 A: String;
begin
  A := My_IntHex(16);
end;

Displays:
10


MyString32: My_PChar
My_PChar function
See Also

Unit
mStrin32

Category
Obsolete Functions

Function My_PChar(A: String): PChar;

Description
Loads the value of A into a buffer.
Use PChar() now.

Example

procedure TForm1.Button1Click(Sender: TObject);
var
 P: PChar;
begin
  P := My_PChar('abcdefghij');
end;


MyString32: My_PtrToString
My_PtrToString function
See Also

Unit
mStrin32

Category
Obsolete Functions

Function My_PtrToString(P: Pointer; PtrLen: LongInt): String;

Description
Converts the buffer into a string.
Use Move or other now.


MyString32: Power Function
Pwr function

Unit
mStrin32

Category
Obsolete Functions

Function Pwr(Base, Exponent: Double): Double;

Description
     -Base^Exponent calculation

Example

procedure TForm1.Button1Click(Sender: TObject);
var
 I: Singlel
begin
  I := Pwr(8, 2);
end;

Sets:
I becomes 64