Copyright: Copyright c1996 Lance Leverich


TMailLabel Component

properties	methods	events

The TMailLabel component is used for easy definition and printing of mailing labels. The developer may set the LabelDefinition to provide a pre-defined label layout.  Using the various link fields, the developer sets the interface to the database(s) for retrieval of mailing address information.  Optionally, using the OnRetrieveXXX events, the developer may provide an alternate method of getting mailing address information.

Label Line Sequence

Name Line

Address Line 1

Address Line 2

City, State  Zip  Line

Extra Data Line

Note: Version 1.0 of the component relies upon the data that will be used for the Name line of the mailing address to know when the list is complete.  In the case of the developer using the NameLink, printing will stop when the NameLink.DataSource.DataSet.EOF is true.  If the developer uses the OnRetrieveName, printing will continue until a blank name() is received.


Addr1Link
Addr1Link: TFieldLink

This is the link to a database resource which will provide the data to be printed on the first address line.


Addr2Link
Addr2Link: TFieldLink

This is the link to a database resource which will provide the data to be printed on the second address line.


CityLink
CityLink: TFieldLink

This is the link to a database resource which will provide the data to be printed in the city slot, on the City/State/Zip address line.


ExtraLink
ExtraLink: TFieldLink

This is the link to a database resource which will provide the data to be printed on the extra data line of the address label.

Note: This line is only printed if PrintExtra is true.


NameLink
NameLink: TFieldLink

This is the link to a database resource which will provide the data to be printed on the name line of the address label.

Note: In version 1.0 of this component, if OnRetrieveName is not defined, this link will determine when the end of the list has been reached.


StateLink
StateLink: TFieldLink

This is the link to a database resource which will provide the data to be printed in the state slot, on the City/State/Zip line of the address label.


ZipLink
ZipLink: TFieldLink

This is the link to a database resource which will provide the data to be printed in the zip slot, on the City/State/Zip line of the address label.


PreDefLabelDBName
PreDefLabelDBName: String

This property defines the Database Alias/Directory containing the file LABELDEF.DB.  This file contains pre-defined label layouts.  These can be used in the Label Definition Dialog to easily and quickly set the label dimensions.


LabelDefinition
LabelDefinition: TLabelDefinition

This property contains the information used to define label size and placement. See TLabelDefinition for details about this un-published component.


UseBlankAddr2
UseBlankAddr2: Boolean

This property signals the print routine whether space should be left on the second address line, even if the text is blank.


PrintExtra
PrintExtra: Boolean

This property signals the print routine whether the text associated with the extra data line should be printed.


Print method
TMailLabel.Print Method: procedure Print;

This method is called by the application to cause the TMailLabel component to print labels.  The number of labels printed depends on whether the OnRetrieveName event is assigned.  If assigned, returning a blank string will cause the program halt further mail label printing.  If On RetrieveName is not assigned, an end-of-file condition for the NameLink will signal the end of label printing.


OnRetrieveXXX
OnRetrieveXXX: TMailLabelFieldEvent

These events are called to obtain their respective field information.  There are seven of these events:

¨	OnRetrieveName

¨	OnRetrieveAddr1

¨	OnRetrieveAddr2

¨	OnRetrieveCity

¨	OnRetrieveState

¨	OnRetrieveZip

¨	OnRetrieveExtra


OnNextLabel
OnNextLabel: TNotifyEvent

This event is sent after a label has printed and prior to the next label being printed.


OnPaintLabel
OnPaintLabel: TMailLabelPaintEvent

This event allows the developer to paint on the labels canvas prior to the text for the label being placed.


TLabelDefinition
TLabelDefinition: Un-published Component

properties	methods	events

This un-published component is used to hold the label definition(s).


LabelHeight/LabelWidth
LabelHeight,LabelWidth: Single

These hold the height and width of a single label, respectively.

Note: Both measurements are in inches.


LeftMargin/TopMargin
LeftMargin, TopMargin: Single

The LeftMargin is the distance from the left edge of the label sheet to the first column of labels.

The TopMargin is the distande from the top edge of the label sheet to the first row of labels.

Note: Both measurements are in inches.


HorizontalGap/VerticalGap
HorizontalGap, VerticalGap: Single

The HorizontalGap is the distance between columns of labels.

The VerticalGap is the distance between rows of labels.

Note: Both measurements are in inches.


LabelsAcross/LabelsDown
LabelsAcross, LabelsDown: Integer

The LabelsAcross is the number of columns of labels on a page, and the LabelsDown is the number of rows of labels on a page.


LabelDefinitionEdit
TLabelDefinition.Edit Method: procedure Edit;

This method invokes the Label Definition Dialog, using the calling instance of TLabelDefinition as its resource for values.  Using this method, the developer may allow users to define the labels being used.

Note: When the LABELDEF Paradox table is available, the user may also select label definitions from the pre-defined label list.


OnDefinitionChange
OnDefinitionChange: TNotifyEvent

This event is triggered whenever there is a change in the layout of the labels.  It is used internally by the TMailLabel Component, and care should be taken not to change the value of the MailLabel.LabelDefinition.OnDefinitionChange.

Note: In future versions of these components, TMailLabel will expose this event for use by developers.


TMailLabelFieldEvent: function (Sender: TObject): String of object;

This event type is triggered in response to a request for data from the TMailLabel component.

The function should return a string that will be printed in the place for the field making the request.

Note: In version 1.0 of TMailLabel, the OnRetrieveName event should return an empty string(   ) to signify the end of the label list.


TFieldLink
TFieldLink: Un-published Component Type

properties	events

This new aggregate component allows other components to reference multiple fields and even multiple data sources within a single component. Registered users who have received the source code will be able to incorporate TFieldLinks into their own components by including the FLDLNKS source in the uses statement of the component source.


OnFieldDefChange
TFieldLink.OnFieldDefChange: TNotifyEvent

This event is triggered when the DataSource or DataField of the TFieldLink is changed.  Users of the TMailLabel component should refrain from changing the internal FieldLinks OnFieldDefChange value.  Registered users who have received the source code will be able to incorporate TFieldLinks into their own components by including the FLDLNKS source in the uses statement of the component source.


OnActiveChange
TFieldLink.OnActiveChange: TNotifyEvent

This event is triggered when the DataSet associated with this FieldLink changes Active state.  Again, users of the TMailLabel component should be very careful in changing the internal FieldLinks OnActiveChange value. Registered users who have received the source code will be able to incorporate TFieldLinks into their own components by including the FLDLNKS source in the uses statement of the component source.


Addr1Link	Addr2Link	CityLink

ExtraLink	LabelDefinition	NameLink

PreDefLabelDBName	PrintExtra	StateLink

UseBlankAddr2	ZipLink


Print


OnRetrieveXXX

OnNextLabel

OnPaintLabel


LabelHeight	LabelWidth	LeftMargin

TopMargin	HorizontalGap	VerticalGap

LabelsAcross	LabelsDown


Edit


OnDefinitionChange


DataSource	DataField


OnFieldDefChange	OnActiveChange