TpfgPalmRemoteTable
The TpfgPalmRemoteTable component allows access to tables located on
a Palm device, providing an interface almost identical in style to
that of a standard TTable component.
Properties
CardNum: Word
The card number to use
CreatorID: string
The Creator ID for the table, a four character string
TableType: string
The Table Type identifier for the table, a four character string
Version: LongWord
The 4-byte version identifier for the table
Options: TpfgPalmRemoteTableOptions
TpfgPalmRemoteTableOptions = set of (opShowSecret, opArchived, opModified,
opStringsAlign);
opShowSecret | If set, shows only secret records |
opArchived | If set, shows only archived records |
opModiifed | If set, shows only modified records |
opStringsAlign | If set, specifies that strings in a
Palm record should align the following field to the specified alignment
boundary. The default is to ignore alignment after strings |
CategoryFilter: Integer
Filters down the list of records to only those in the specified
category
Handle: Byte [rt]
Palm CDK database handle used internally by the table component. Valid
only when the table is open
AppInfo: TModifiedMemoryStream [rt]
Provides access to the application info block of the database. Note that
TModifiedMemoryStream is a subclassed TMemoryStream that
adds a Modified property that is set when the stream contents are
changed
RecNo: Integer [rt]
Returns the record number of the current record. Valid only when the
table is active
dbFlags: TpfgPalmRemoteTableFlags [rt]
Provides access to the Flags field of the database for when a new table is
being created. The options are defined as:
TpfgPalmRemoteTableFlag = set of (tfAppInfoDirty,tfBackupDB,tfOkToInstallNewer,
tfCopyPrevention,tfResetAfterInstall);
Methods
function LocateById(ARecID: LongWord): Boolean;
Tries to locate the record with the specified ID, returning true if it is found.
Note: If a record is not found, the table will not be in a defined state. Do
not expect BOF, EOF, etc. to work - use First or Last to
reposition the database cursor, or use LocateById again to search for another ID.
procedure PurgeTable;
Purges the currently open databse of all deleted records.
procedure SaveToFile(Filename: string);
Saves the currently open database to a local file in the Palm PDB file format.
TpfgPalmTable
The TpfgPalmTable class is the base class for the Palm related table components.
It contains all the basic functionality, and is used by all the sub-object
properties as a common interface point. The individual descendant classes
thus simply override the appropriate methods in this class to define table
functionality, rather than needing to have descendant classes of the subclasses.
Properties
FieldDefs: TpfgPalmFieldDefs
Contains a list of the field definitions of the table. Whilst PC based tables can read
their field list from a table itself, for accessing tables on the Palm, you are expected
to specify a set of field definitions to map the record structure of the table.
Fields: TpfgPalmFields
Contains the data for the fields of the current record when the table is active. It is
slightly different from standard TFieldDefs in that field definitions cannot be set here -
the FieldDefs property must be used. There are also extra properties for the record
properties.
ReadOnly: Boolean
Specifies whether the table should be opened in readonly mode or not
TableName: string
Specifies the name of the table to be used when creating a new table
FieldCount: Integer [rt]
Specifies the number of fields in the table
Active: Boolean [rt]
Specifies whether the table is currently open
BOF: Boolean [rt]
Returns true if you are at the beginning of the table
EOF: Boolean [rt]
Returns true if you are at the end of the table
Methods
procedure Append;
Puts the table into append mode, where a new record will be saved
at the end of the table.
procedure Cancel;
Cancels the current edit/insert operation, and returns to browse mode.
procedure Close;
Closes the table. Equivalent to setting the Active property to false.
procedure CreateTable;
Creates the specified table. For Palm tables, remember to have filled
in the TableName, CreatorID, and TableType fields [and optionally
the Version field] before creating the table
procedure DeleteTable;
Deletes the specified table
procedure Edit;
Puts the table into edit mode, where the fields of the current
record can be changed.
procedure EmptyTable;
Empties the specified table
function Exists: Boolean;
Returns true if the specified table exists
function FieldByName(FieldName: string): TpfgPalmField;
Similar to FindField, except that an exception is generated if the
field cannot be found
function FindField(FieldName: string): TpfgPalmField;
Searches for the specified field. Returns the field, or NULL if a
field with a matching name could not be found
procedure First;
Moves to the first record. Valid only when the table is open
procedure Insert;
Conceptually, this method would insert a new record at the current
table position. Note that currently the the Palm CDK does not support
inserting records at arbitrary positions. This method currently only
maps to the Append method
procedure Last;
Moves to the end of the table. Valid only when the table is open
procedure Next;
Moves to the next record. Valid only when the table is open
procedure Open;;
Opens the table for access. Equivalent to setting the Active property
to true.
procedure Post;
Posts the currently editted record into the database, either at the
end of the table, or replacing an existing record (depending on
whether Edit or Append was previously used
procedure Prior;
Moves to the previous record. Valid only when the table is open
Events
OnBeforeClose: TNotifyEvent
Generated before the table is closed
OnAfterClose: TNotifyEvent
Generated after the table is closed
OnBeforeOpen: TNotifyEvent
Generated before the table is opened
OnAfterOpen: TNotifyEvent
Generated after the table is opened
OnBeforeRecChange: TNotifyEvent
Generated before the current record changes
OnAfterRecChange: TNotifyEvent
Generated after the current record changes
OnBeforeEdit: TNotifyEvent
Generated before edit mode is enetered
OnAfterEdit: TNotifyEvent
Generated after edit mode is enetered
OnBeforeInsert: TNotifyEvent
Generated before insert mode is enetered
OnAfterInsert: TNotifyEvent
Generated after insert mode is enetered
OnBeforePost: TNotifyEvent
Generated before a Post is performed
OnAfterPost: TNotifyEvent
Generated after a Post is performed
OnBeforeCancel: TNotifyEvent
Generated before a Cancel is performed
OnAfterCancel: TNotifyEvent
Generated after a Cancel is performed
OnReadField: TpfgPalmReadFieldEvent
TpfgPalmReadFieldEvent = procedure (Sender: TObject; pData: Pointer;
DataSize: Integer; FieldIndex: Integer; var DataPos: LongWord;
out Data: string) of object;
Generated during the decoding of remote records. By providing your own
event handler, you can override the standard field handling, and thus
handle tables with a variable number of fields or structure
OnWriteField: TpfgPalmWriteFieldEvent
TpfgPalmWriteFieldEvent = procedure (Sender: TObject; FieldIndex: Integer;
out Data: Variant) of object;
Generated during the encoding of records to send to the Palm. By providing
your own, you can specify what data, if any, a field is represented by in
the final remote record. The Data must be passed out as a single dimensional
variant array of bytes, with the lower bound starting at zero.
|