Trimsdk PDF
Trimsdk PDF
Trimsdk PDF
TRIM SDK
Legal Notices
Warranty
The only warranties for HP products and services are set forth in the express warranty statements
accompanying such products and services. Nothing herein should be construed as constituting an additional
warranty. HP shall not be liable for technical or editorial errors or omissions contained herein.
The information contained herein is subject to change without notice.
Restricted Rights Legend
Confidential computer software. Valid license from HP required for possession, use or copying. Consistent
with FAR 12.211 and 12.212, Commercial Computer Software, Computer Software Documentation, and
Technical Data for Commercial Items are licensed to the U.S. Government under vendor's standard
commercial license.
Copyright Notices
Copyright 2008-2009 Hewlett-Packard Development Company, L.P.
Outside In Viewer Technology Copyright 1991, 2009 Oracle Corporation, Redwood City, California
Trademark Notices
Adobe is a trademark of Adobe Systems Incorporated.
Intel, Intel Itanium, Intel Xeon, and Pentium are trademarks or registered trademarks of Intel
Corporation or its subsidiaries in the United States and other countries.
Java is a U.S. trademark of Sun Microsystems, Inc.
Microsoft, Windows, and Windows XP are U.S. registered trademarks of Microsoft Corporation.
Microsoft Vista is either a registered trademark or trademark of Microsoft Corporation in the United
States and/or other countries.
Oracle is a registered U.S. trademark of Oracle Corporation, Redwood City, California.
UNIX is a registered trademark of The Open Group.
Outside In is a registered trademark of Oracle Corporation, Redwood City, California
Documentation Updates
The title page of this document contains the following identifying information:
Document Release Date, which changes each time the document is updated.
Software Release Date, which indicates the release date of this version of the software.
To check for recent updates or to verify that you are using the most recent edition of a document, go to:
http://h20230.www2.hp.com/selfsolve/manuals
This site requires that you register for an HP Passport and sign-in. To register for an HP Passport ID, go to:
http://h20229.www2.hp.com/passport-registration.html
Or click the New users - please register link on the HP Passport login page.
You will also receive updated or new editions if you subscribe to the appropriate product support service.
Contact your HP sales representative for details.
Support
Visit the HP Software Support web site at:
http://www.hp.com/go/hpsoftwaresupport
This Web site provides contact information and details about the products, services, and support that HP
Software offers.
HP Software online support provides customer self-solve capabilities. It provides a fast and efficient way to
access interactive technical support tools needed to manage your business. As a valued support customer,
you can benefit by using the support web site to:
Most of the support areas require that you register as an HP Passport user and sign in. Many also require a
support contract. To register for an HP Passport ID, go to:
http://h20229.www2.hp.com/passport-registration.html
To find more information about access levels, go to:
http://h20230.www2.hp.com/new_access_levels.jsp
Contents
Page 8
interface.
The security model is common to both the SDK and the TRIM client application
therefore any custom process that calls the SDK must connect to the Database using
the current user's login, and this user's TRIM security profile determines the extent
of data and functionality that the process can access.
In addition to the SDK exposing TRIM's data and functionality, TRIM 5 and 6 includes
some other great features for the integration developer. These include ActiveX
controls for bringing the rich experience of the TRIM User Interface into custom
applications, and an event processor interface for responding to key events as they
occur in TRIM.
Hear, Say
As an Automation server, the TRIM SDK defines the methods and properties that an
Automation client (a program or macro) can invoke. Another way of thinking of this
is that the SDK is the set of questions that TRIM can answer, and the commands that
it will obey.
The client and server relationship is sometimes called the master/slave relationship:
the former does all the talking, and the latter does all the doing (and does not speak
until spoken to).
The TRIM 5 and 6 SDK includes a feature that emancipates TRIM from this abject
slavery, and gives it the opportunity to speak for itself. The TRIMEventProcessor is a
special class the TRIM Object Model. It is an outbound interface, meaning that TRIM
calls methods on this interface in response to events that occur in TRIM. The
integration programmer can write code that implements these methods, and
therefore can execute code in a server process in response to actions in the TRIM
client.
Taking Controls
Another feature of the SDK that extends TRIM's integration options is the set of
ActiveX controls. These are core elements of the TRIM application's user interface
that can be built directly into another application's interface. The SDK includes
methods that allow the programmer to invoke certain TRIM dialogs with the
appearance of being 'hosted' by another application, but the ActiveX controls take
the concept further, allowing edit controls, record lists and document viewers to be
directly embedded inside custom dialogs and forms at design time.
Page 10
Generic Interfaces
In TRIM 4.3, all objects had a single interface, and all methods and properties that
the object implemented were accessed through that interface. In the HP TRIM SDK,
things are slightly different, as there are certain common interfaces that are
implemented by many different objects, in addition to the object's own default
interface. The benefit of this is that different types of objects can be treated
polymorphically, using the common interface. It also allows extensibility of the SDK,
such that new types of objects can be introduced in later versions, without breaking
the existing interface.
The common interfaces in the SDK are:
Interface
Implemented By
IBaseObject
IBaseChildObject
IBaseObjects
IBaseChildObjects
Which common interface is implemented depends on the type of object, i.e. whether
it is considered a Base Object or a Child Object (or a collection of either of the two.)
Base Objects
A Base Object is any first-order entity in the TRIM Database. It exists independently
of other objects (although it may be related to many objects) and can be explicitly
created or deleted by a user with the appropriate authority.
Examples of base objects are Records, Locations, Record Types, Keywords,
Schedules, Document Stores, and many others.
Base Objects are also called 'persistent' objects because they persist after the
program code that manipulates them is not executing (that is, the data for the object
Page 11
can be saved in the TRIM Database and retrieved later to recreate the object).
All Base Objects have an internal Unique Row Identifier (URI) that uniquely identifies
different objects of the same type, and most have a corresponding unique name or
other identifier (such as Record Number) that is visible to the user. Whenever a
persistent object is modified in the SDK, you must call a 'Save' method on the object
to commit the changes to the TRIM Database.
Child Objects
Child objects, on the other hand, only exist as a dependent of another object.
Examples of Child objects are Requests (children of a Record), Addresses (children of
a Location), and Lookup Items (children of a Lookup Set).
Generally speaking, child objects are created indirectly, as a result of performing
some task on a base object or a dependent collection object.
Some child objects represent a relationship between Base objects, such as Record
Locations, Record Keywords, and Related Records. Adding or removing child objects
does not directly affect the 'parent' Base objects (for example, the AttachedKeyword
object represents a Keyword (from the Thesaurus) associated with a particular
Record). Each instance of this object defines a relationship between a Record object
and a Keyword object, but if the AttachedKeyword instance is removed, the Record
and the Keyword objects themselves are unaffected.
Because of the dependence upon the parent object, child objects cannot be
independently saved, but the data they contain is persisted when the parent object is
saved.
Collections
Collections are a special class of objects that are used to temporarily hold and
manipulate a set of several objects of the same type. They have a standard
interface that allows the programmer to access the items in the collection directly by
index position or to iterate through the collection sequentially. The standard
convention in the SDK is that a collection object takes the plural name of the type of
object that it contains (for example, the Locations collection is used to hold multiple
Location objects).
If a given object implements the IBaseObject interface, then the Collection of those
objects will implement the IBaseObjects interface. Similarly, if a given object
implements the IBaseChildObject interface, then the Collection of those objects will
implement the IBaseChildObjects interface.
Page 12
Common Properties
Many objects in the TRIM 5 and 6 object model implement Properties with the same
names. This makes it easier for the programmer to learn the object model.
Although not all objects implement these properties, the meaning is consistent for
those that do.
Property
Description
Database
Uri
Verified
Type
Returns the object type for this object (for example, Record,
Location etc.)
ErrorMessage
Common Methods
As with common Properties, many objects implement Methods with the same (or
similar) names.
Method
Description
GetProperty
Page 13
property Id.
SetProperty
Save
Delete
Interactive Methods
Most methods in the TRIM 5 and 6 object model allow the programmer to
automatically perform some sort of data transformation in TRIM based on values
provided in code. The values may be determined at design-time, or they may be
derived from the user at run-time through the custom application's user interface.
However, sometimes the integrated application requires that the user interacts
directly with one or more TRIM objects, and therefore requires a TRIM dialog to be
displayed. The TRIM 5 and 6 object model exposes various methods that allow the
programmer to invoke standard TRIM dialogs to be displayed to the user.
These interactive methods must only be called by code running on a client
workstation, as most will invoke a modal dialog, which must be explicitly cleared by
the user before program execution can continue.
The interactive methods of an object are always identified by the suffix "UI" (for User
Interface) and will always take a ParentHWND parameter, which is a handle to the
window object that will be the parent of the dialog. (Windows requires this to know
how the dialog should behave when the user switches between running applications.)
In the Visual Basic development environment, the global property hWnd will always
contain a handle to the current active window, and can therefore be used as the
argument for the ParentHWND parameter. If the parent window handle is not able
to be determined, you can pass a "0" instead, in which case TRIM will place the
dialog in front of the current foreground window of the current application. It is also
possible to force a null parent for the dialog by passing a handle of "1". This will
force the dialog to be a top level desktop window.
! Note: An alternative to calling interactive methods to achieve a TRIM 'lookand-feel' in an integrated application is to use the TRIM 5 and 6 ActiveX controls
within the user interface of the application. This is described later in the TRIM 5
and 6 ActiveX Controls section.
Page 14
Databases
Records
NewRecord/s
RecLocations
RecLocations (prop.)
Record
Database
RecLocation
GetRecord
RecordTypes
RecKeywords
RecKeywords (prop.)
NewRecordType/s
RecKeyword
RecordType
GetRecordType
RecLinkedDocuments
InputDocument
RecLinkedDocuments (prop.)
RecordSearches
RecLinkedDocument
NewRecordSearch/es
RecordSearch
GetRecordSearch
RecRelationships
RecRelated (prop.)
EnumHelper
RecRelationship
ElectronicStores
NewRecordType/s
ElectronicStore
GetRecordType
RecRenditions
RecRenditions (prop.)
RecRendition
SignatureTool
SecurityLevels
RecRequests
NewSecurityLevel/s
SecurityLevel
PropertyDefs
PropertyDef
RecRequests (prop.)
RecRequest
GetSecurityLevel
SecurityCaveats
NewSecurityCaveat/s
RecRevisions
RecRevisions (prop.)
SecurityCaveat
RecRevision
GetSecurityCaveat
TRIMEventProcessor
Locations
NewLocation/s
Location
GetLocation
LocEAddresses
LocEAddresses (prop.)
LocEAddress
Spaces
NewSpace/s
Space
GetSpace
LocAddresses
LocAddresses (prop.)
LocAddress
SavedActivities
NewSavedActivity/ies
SavedActivity
GetSavedActivity
SavedTemplates
NewSavedTemplate/s
SavedTemplate
GetSavedTemplate
Legend
Collection
Object
SavedWorkflows
NewSavedWorkflow/s
SavedWorkflow
GetSavedWorkflow
See Next Page
Page 15
Database
LookupSets
NewLookupSet/s
LookupSet
CdsLookupItems
GetLookupSet
LookupItems
LookupItem
Keywords
NewKeyword/s
Keyword
GetKeyword
Schedules
NewSchedule/s
Schedule
GetShedule
Classifications
NewClassification/s
Classification
GetClassification
Reports
NewReport/s
Report
ActionDefs
GetReport
NewActionDef/s
ActionDef
GetActionDef
ActionNames
NewActionName/s
ActionName
GetActionName
Holds
NewHold/s
Hold
GetHold
HtmlLayouts
NewHtmlLayout/s
HtmlLayout
GetHtmlLayout
Stopwords
NewStopword/s
Stopword
GetStopword
ZipCodes
NewZipCode/s
ZipCode
FieldDefs
GetZipCode
NewFieldDef/s
FieldDef
GetFieldDef
NewHistoryCollection
HistoryCollection
History
GetHistory
Page 16
Database Object
The Database object is the top-level object in the TRIM object model hierarchy. It is
generally the first object to be created when using the TRIM SDK.
Because most objects in TRIM can only exist in the context of a Database, the
Database object is used for accessing and creating all other persistent business
objects in the TRIM SDK. These objects are dependent upon the Database object
and cannot be created independently.
! Note: There are certain helper objects in the object model that do not need a
Database, such as InputDocument, ExtractDocument, SignatureTool and
EnumHelper.
Page 17
C# Example
The following example code instantiates an existing record object with a Record Id of
"RP95/1".
// Determine the identifier
string vntRecId = "RP95/1";
// Call Get to instantiate the object
TRIMSDK.Record objRecord = db.GetRecord(vntRecId);
// Check that a record with this record number was found
if (objRecord == null)
{
MessageBox.Show("Record ID not found or not accessible due to security.");
}
2.
On a Database object, call one of the NewObject methods. (The return value is
the new object.)
3.
Set the properties of the <Object> variable, or call methods on it to set its
data.
4.
C# Example
The following example code creates a new Keyword (Thesaurus Term) object.
Page 18
// Declare the object variable and call New to instantiate the object
TRIMSDK.Keyword objKeyword = db.NewKeyword();
// Set properties
objKeyword.Name = "Example";
objKeyword.TopTerm = true;
// Save to the Database
objKeyword.Save();
2.
3.
Add items to the collection using a "Select" method, or allow the user to
search for items using the RefineUI method (if implemented on this collection
type).
4.
5.
C# Example
The following example code allows the user to choose a single Record Type from all
the Record Types in the Database.
TRIMSDK.RecordTypes colRecTypes = db.MakeRecordTypes();
colRecTypes.SelectAll();
int hWnd = Handle.ToInt32();
TRIMSDK.RecordType objRecType = colRecTypes.ChooseOneUI(hWnd);
Method
Description
Page 19
SelectAll
Fill the collection with all the objects of its type from the
Database.
SelectByPrefix
SelectByUris
other "Select"
methods
RefineUI
2.
Set the collection object variable to receive the value of the <ChildObjects>
read-only property on an instantiated parent (Record, LookupSet or Location)
object.
C# Example
The following example code instantiates the collection of Attached Keywords for the
Record "RP95/1", and displays them to the user.
Page 20
2.
From an instantiated child collection, set the child object variable to receive the
return value of the GetByUri method, the Item(n) read-only property or the
ChooseOne method.
3.
Edit the properties of (and/or call methods on) the child object variable.
4.
C# Example
The following example code modifies the contacts for the Record "G96/201",
changing contacts of type 'Other' into type 'Addressee'.
TRIMSDK.Record objRecord = db.GetRecord("G96/201");
TRIMSDK.RecLocations colContacts = objRecord.RecLocations;
TRIMSDK.RecLocation objContact;
for (int i = 0; i < colContacts.Count; i++)
// NB collections are zero-based
{
objContact = colContacts.Item(i);
if (
objContact.RecLocType == rlRecordLocationType.rlContact
&& objContact.Subtype == ctContactType.ctOther)
{
objContact.Subtype = ctContactType.ctAddressee;
}
}
objRecord.Save();
Page 21
2.
From an instantiated child collection, set the child object variable to receive the
return value of the New method.
3.
Edit the properties of (and/or call methods on) the child object variable.
4.
! Note: however, that in most cases the Record object also provides 'shortcut'
methods as an alternative means of creating new child objects, where the
properties of the child object are set through parameters on the method (for
example, the AttachRelationship method creates a new RecRelationship child
object).
(See the table below for the shortcut methods exposed by the Record interface.)
Record Method
AttachContact
RecLocation
AttachKeyword
RecKeyword
AttachRelationship
RecRelationship
MakeRequest
RecRequest
2.
From an instantiated child collection, set the child object variable to receive the
return value of the GetByUri method, the Item(n) read-only property or the
ChooseOne method.
3.
4.
Page 22
InputDocument
ExtractDocument
SignatureTool
EnumHelper
The above of objects are not instantiated through the database object, with a
Database.New<object> statement. They are simply instantiated on their own, as is
any typical object in your IDE.
Page 23
Object Properties
This section describes how an object's data is manipulated via properties and
methods.
Overview
The standard data properties of an object are explicitly exposed that is, there is a
named property representing each predefined value of an object. These properties
are strongly typed meaning that each has a specific data type (for example, String,
Boolean, Long Integer, Date) and the data variable used to set or get the property
value must match that type. An object's properties can be accessed according to the
conventions of the automation language you are using.
In Visual Basic (and most other automation languages), an object property is
accessed in the following way:
strMyValue = objRecord.Title
objRecord.Title = strMyValue
Reading Properties
You can read the value of an individual TRIM object property simply by accessing the
property by name. Properties always have a specific data type, and therefore your
usage of the property should be consistent with the property type. A Record object's
Title property, for example, is a String type, whereas the HomeLoc property returns
a Location object.
All Base and Child objects also expose a GetProperty method, and you can call this
method to retrieve a property value as a Variant type. The method requires that you
pass as a parameter the unique property identifier for the property you require.
Updating Properties
You can set or update the value of an object property by assigning a value of the
correct data type directly to the property by name.
! Note: that some named object properties are read-only, and therefore cannot
be updated. The reference documentation and the object viewer indicate which
properties are read-only.
Most objects also expose a SetProperty method, and you can call this method to
update the property value by passing a new value argument as a Variant and the
unique property identifier as an integer value.
Page 24
User-Defined Properties
In HP TRIM, the system administrator can define any number of additional User
Defined Fields to be associated with TRIM records. The values of these User Defined
Fields can be accessed and updated through the SDK by using the Record object's
GetUserField and SetUserField methods.
These methods pass field values as variant data types, and require a FieldDefinition
argument to specify the desired field. A FieldDefinition object can be instantiated (by
name or Uri) using the GetFieldDefinition method on the Database object.
(See The FieldDefinition Object section.)
End Sub
C# Example
This example demonstrates the use of a PropertyDefs collection, which is in this case
instantiated using the method SelectViewPaneItems, passing the Record object type
identifier. In a loop, a PropertyDef object is used to iterate the collection, and the
program outputs each property's Caption and the string representation of its data
Page 25
value.
private void PrintProperties(Record objRecord)
{
TRIMSDK.PropertyDef objProp = new TRIMSDK.PropertyDef();
TRIMSDK.PropertyDefs colProps = new TRIMSDK.PropertyDefs();
// C# requires specification of default parameters
colProps.SelectViewPaneItems(btyBaseObjectTypes.btyRecord,false);
for (int i = 0; i < colProps.Count; i++)
{
objProp = colProps[i];
Console.WriteLine("{0}:{1}", objProp.GetCaption(objRecord.Database,
false), objRecord.GetPropertyAsString(objProp, sdStringDisplayType.sdDefault, false));
}
}
RecordAddIn
FieldAddIn
EventProcessor
Page 26
RecordAddIn
The RecordAddIn gives access to generic entry points in various processes for the
Record. Methods, within which custom code may be placed, are shown below in blue.
Although the RecordAddIn class is defined in the TRIMSDK Type Library (along with
all the other TRIM SDK object classes), it is a special class, in that it is only an
interface definition, and the programmer must implement the interface to act upon
method calls made by TRIM. (All other classes in the Type Library represent
interfaces implemented by TRIM, and the programmer can call the methods on these
interfaces).
The ErrorMessage property of the FieldAddIn (not shown in the diagram below)
provides some functionality for catching and displaying error messages to the user.
If the PreSave or PreDelete return false, the ErrorMessage property will be called and
populated with the corresponding error message. The SDK programmer may also call
the ErrorMessage property explicitly in code and populate it with a customized error
message.
It should be noted that none of the methods of the RecordAddIn provide a
ParentHWnd parameter (a handle to the users current window). is not advisable to
use dialogs in situations where no ParentHWnd parameter is provided, as without a
handle to the users window, the dialogs may be popping up on the server machine
with nobody to answer them.
Page 27
Page 28
FieldAddIn
The FieldAddIn provides access to generic entry points in processes involving User
Field modification. Methods, within which custom code may be placed, are shown
below in blue.
Although the FieldAddIn class is defined in the TRIMSDK Type Library (along with all
the other TRIM SDK object classes), it is a special class, in that it is only an interface
definition, and the programmer must implement the interface to act upon method
calls made by TRIM. (All other classes in the Type Library represent interfaces
implemented by TRIM, and the programmer can call the methods on these
interfaces).
The ErrorMessage property of the FieldAddIn (not shown in the diagram below)
provides some functionality for catching and displaying error messages to the user.
If the VerifyFieldValue method returns false, the ErrorMessage property will be
called and populated with the corresponding error message. The SDK programmer
may also call the ErrorMessage property explicitly in code and populate it with a
customized error message.
Another feature of the FieldAddIn is the ParentHWnd parameter provided to the
SelectFieldValue method. This provides a handle to the users current window and
enables custom dialogs to be displayed to the user (even when the FieldAddIn is
running on the server). It is not advisable to use dialogs in situations where no
ParentHWnd parameter is provided, as without a handle to the users window, the
dialogs may be popping up on the server machine with nobody to answer them.
It is often desirable to access the object to which the user field undergoing the
selection or verification belongs. This may be done using the FieldDefinition method
GetCurrentObject for the user field passed to the FieldAddIn methods. In contrast,
in the BaseObjectAddIn, the parent object to the user field is passed as a parameter
to the SelectFieldValue and VerifyFieldValue methods, so when using the
BaseObjectAddIn using the GetCurrentObject method is not necessary.
Page 29
Page 30
BaseObjectAddIn
The BaseObjectAddIn is a generic AddIn that can respond to entry points within the
Save or Delete process for any TRIM Object. Methods, within which custom code may
be placed, are shown below in blue.
Although the BaseObjectAddIn class is defined in the TRIMSDK Type Library (along
with all the other TRIM SDK object classes), it is a special class, in that it is only an
interface definition, and the programmer must implement the interface to act upon
method calls made by TRIM. (All other classes in the Type Library represent
interfaces implemented by TRIM, and the programmer can call the methods on these
interfaces).
The ErrorMessage property of the BaseObjectAddIn (not shown in the diagram
below) provides some functionality for catching and displaying error messages to the
user. If any of the PreSave, PreDelete, or VerifyFieldValue methods return false, the
ErrorMessage property will be called and populated with the corresponding error
message. The SDK programmer may also call the ErrorMessage property explicitly in
code and populate it with a customized error message.
Another feature of the BaseObjectAddIn is the ParentHWnd parameter provided to
the SelectFieldValue method. This provides a handle to the users current window
and enables custom dialogs to be displayed to the user (even when the FieldAddIn is
running on the server). It is not advisable to use dialogs in situations where no
ParentHWnd parameter is provided, as without a handle to the users window, the
dialogs may be popping up on the server machine with nobody to answer them.
The SelectFieldValue and VerifyFieldValue methods of the BaseObjectAddIn differ
from the TRIMFieldAddIn in that a the object to which the user field belongs is
passed to the method. This enables the programmer to access other properties and
fields of the parent object, which may be useful in selecting/verifying the value of the
user field. It may also be used to set other properties and fields of the parent object
at the time a value for the user field is selected or verified.
Page 31
Page 32
EventProcessor
The EventProcessor interface is an AddIn that responds to the processing of a TRIM
Event by the TRIM Event Processor. Methods, within which custom code may be
placed, are shown below in blue.
Although the TRIMEventProcessor class is defined in the TRIMSDK Type Library
(along with all the other TRIM SDK object classes), it is a special class, in that it is
only an interface definition, and the programmer must implement the interface to act
upon method calls made by TRIM. (All other classes in the Type Library represent
interfaces implemented by TRIM, and the programmer can call the methods on these
interfaces).
The range of events processed by the Event Processor is wide, but includes actions
such as users logging on and off, records being created or modified, documents
being accessed, and various security-related events.
It is important to note that events are processed by the Event Processor (and the
ProcessEvent method called) at a later time to that at which the event occurred. As a
result the SDK programmer cannot rely on the object to which the event occurred
still being in the state indicated by the event, since the ProcessEvent method is not
called in direct response to the event occurring. This must be taken into account in
the design of a program implementing the EventProcessor interface. For example, if
a hold is added to a record, the event evHoldAdded is fired. However, by the time
the EventProcessor comes to process this evHoldAdded event, the Hold may have
already been removed from the record, so you cannot rely on the record being under
a Litigation Hold at the time the evHoldAdded event is processed.
Page 33
ActiveX Controls
In addition to the SDK's, which allow direct access to TRIM's data and functionality,
the TRIM 5 and 6 SDK makes available certain components of the user interface as
ActiveX controls. These controls are core elements of TRIM's user interface that can
be built directly into another application's interface at design time.
The ActiveX controls have methods and properties that the programmer can access
to control the behavior and appearance of each instance of a control at run-time.
They also fire events to notify their 'host' of user actions such as data entry and
mouse clicks on the control, so that the application can take appropriate action.
There are three TRIM controls included in the SDK:
Document Viewer
Edit Box
Tree Box
The controls are contained in a component called "HP TRIM ActiveX Controls" and
implemented by the file "tsjOCX.dll"; the methods and properties are defined in the
Type Library "TRIMOCXLib".
Page 34
Custom Browser
Date Picker
Directory Selector
Spelling Checker
Format Checker
The default behavior is pre-programmed into the control in all modes except Custom
Browser and Format checker modes. That is, if the control is set at design-time to
be a Date Picker, at run-time the control will display a calendar to the user when the
KwikSelect is pressed, and the selected date will be entered into the text area of the
control. No code is required by the client programmer to provide this functionality.
Similarly, if the control is set as an Input File selector, the standard File Open dialog
is displayed for the user to select a file from their file system, and the name of the
selected file is automatically entered in the text of the control.
If the control is set to be a Custom Browser or Format Checker then the programmer
will need to write code in response to the Browse event, which will be fired by the
control when the user presses the KwikSelect button. This is because the required
behavior will depend upon the context in which the control is being used.
Page 35
Page 36
Page 37
Connecting to a Database
The Database object manages each client's connection to a Database, and in doing
so it authenticates the current user (from their network login) and applies their TRIM
security profile when accessing any TRIM data. The Database object's Connect
method will attempt to connect the user to their default Database. It does not
require any parameters.
In Visual Basic:
Dim objTRIM as TRIMSDK.Database
Dim colDBs as New TRIMSDK.Databases
If colDBs.Count > 1 Then
' Let user select a Database in a dialog
Set objTRIM = colDBs.ChooseOneUI(hWnd)
End If
objTRIM.Connect
In C#:
TRIMSDK.Database db = null;
TRIMSDK.Databases colDBs = new TRIMSDK.Databases();
if (colDBs.Count > 1)
{
int hWnd = Handle.ToInt32();
// Let user select a Database in a dialog
db = colDBs.ChooseOneUI(hWnd);
}
if ( db != null )
{
db.Connect();
}
In C#:
for ( int i=0; i < colDBs.Count; i++)
{
db = colDBs.Item(i);
if (db.Name == "MyTRIM")
{
db.Connect();
break;
}
}
Page 38
In C#:
TRIMSDK.Database db = new TRIMSDK.Database();
db.Connect();
Note: Calling the Connect method in this way is optional. If the Database
object is not connected when a method requiring a Database service is called,
TRIM will automatically attempt a connection.
In Visual Basic:
Dim objTRIM As TRIMSDK.Database
Set objTRIM = New TRIMSDK.Database
' Connection is automatic when required if not explicit
Set objRec = objTRIM.GetRecord(123)
In C#:
TRIMSDK.Database db = new TRIMSDK.Database();
// Connection is automatic when required if not explicit
TRIMSDK.Record objRec = db.GetRecord(123);
Page 39
In C#:
TRIMSDK.Database db = new TRIMSDK.Database();
db.Id = 45; //45 is the id of the TRIM Demonstration Database
db.Connect();
Note: Calling the Connect method in this way is optional. If the Database
object is not connected when a method requiring a Database service is called,
TRIM will automatically attempt a connection.
Page 40
Code Example C#
// Instantiate collection of valid TRIM Databases
TRIMSDK.Databases dbCol = new TRIMSDK.Databases();
// Display the list of Databases.
// Assign the selection to the modular level TRIM Database variable
int hWnd = Handle.ToInt32();
TRIMSDK.Database db = dbCol.ChooseOneUI(hWnd);
if (db == null)
{
Console.WriteLine("User Cancelled!");
}
else
{
Console.WriteLine( "TRIM Database " + db.Name + " is Connected(T/F) - " +
db.IsConnected);
}
// Release object
dbCol = null;
Page 41
Page 42
Page 43
Code Example C#
private TRIMSDK.Database db = new TRIMSDK.Database();
int hWnd = Handle.ToInt32();
if (db.PropertiesUI(hWnd))
{
if (db.Verify(false))
{
db.Save();
}
else
{
MessageBox.Show("Error Saving Database properties " + db.ErrorMessage,"
",System.Windows.Forms.MessageBoxButtons.OK,
System.Windows.Forms.MessageBoxIcon.Exclamation);
}
}
else
{
Console.WriteLine( "User Cancelled");
}
Page 44
Accessing a Record
To read information stored on records in a TRIM Database, the API programmer
must first determine how to access the records required. If a particular record's
internal or external unique identifier is known, the associated record can be accessed
directly and efficiently using the GetRecord method. (If neither of these unique
identifiers are known, it will be necessary to construct a search. This is covered in
the section Searching for Records.)
Page 45
In C#:
TRIMSDK.Record objRecord = db.GetRecord ("02/59"); //instantiate by number
Note: TRIM stores the Record Number in two formats. The expanded format
(for example, "2002/0059") is held in the LongNumber property, and the
compressed format (for example, "02/59") is held in the Number property. Both
can be passed to the GetRecord method.
Page 46
In C#:
objRecord = db.GetRecord (130); // instantiate by URI
Once an instantiated record object has been returned by the GetRecord method, the
programmer can access properties and call methods on the object. These are
discussed in the following subsections.
Page 47
Example value
Number
Title
"G1997/0770"
"Greenhouse Journal of Global Warming Dugong Habitats"
#8/20/1997#
"GJGW 97PB"
5617
DateCreated
ExternalId
AccessionNbr
C# Example
TRIMSDK.Database db = new TRIMSDK.Database();
TRIMSDK.Record objRecord = db.GetRecord ("G97/770");
DateTime date = new DateTime(2000,01,01);
if (objRecord.AccessionNbr > 5000
&& objRecord.DateCreated < date)
{
MessageBox.Show (objRecord.Title, "Record " + objRecord.Number);
}
Page 48
objRecord As Record
objContainer As Record
objRecord = objTRIM.GetRecord ("G99/15")
objContainer = objRecord.Container ' objContainer is now 97/1004
C# Example
The following code instantiates a record object (in variable objRecord) and then
assigns its Container to another variable (objContainer).
TRIMSDK.Record objRecord = db.GetRecord ("G99/15");
TRIMSDK.Record objContainer = objRecord.Container;
// objContainer is now 97/1004
Page 49
PrimaryContactLoc The main contact person (or organization) for the record.
To access the properties and methods of these location objects, you can create and
instantiate them using the following style of code:
In Visual Basic:
Dim objRec as Record
Dim objLoc as Location
Set objRec = objTRIM.GetRecord ("2002/0059") ' instantiate the record
Set objLoc = objRec.AuthorLoc ' get the author location object
Msgbox "Author's name is: " & objLoc.FormattedName
In C#:
// instantiate the record
TRIMSDK.Record objRecord = db.GetRecord ("G99/15");
// get the author location object
TRIMSDK.Location objLoc = objRecord.AuthorLoc;
MessageBox.Show ("Author's name is:" + objLoc.FormattedName);
Page 50
Updating Records
So far we have only considered the methods for reading information from records in
TRIM. The SDK also allows you to update TRIM records, either by updating the
values of properties on a given record object, or by calling methods on the record.
Updating properties is the simplest way to modify the metadata of a record. You
simply assign a new value of the correct data type to the named property of the
object. Field-level verification is carried out, and an error will be raised if the
property update is invalid (see also Verifying and Error Trapping section). For more
complicated types of update to a record, you must generally call methods that
instruct TRIM to modify the record, based on arguments passed.
Page 51
Modifying Properties
The simplest way to update data in a TRIM record is to modify the named properties
on the Record object. This can only be done on properties that are not marked as
read-only. This includes most of the Date properties, certain Location properties
(AuthorLoc, AddresseLoc and OtherLoc) and miscellaneous properties such as
External Id, Priority, Accession Number and Foreign Barcode.
Visual Basic Example
Set objRecord = objTRIM.GetRecord(30)
objRecord.Title = "New title for this record"
objRecord.DateDue = Date + 10 ' Due in ten days
objRecord.DatePublished = #20/05/2002#
Set objRecord.AuthorLoc = objTRIM.CurrentUser
C# Example
TRIMSDK.Record objRecord = db.GetRecord(30);
objRecord.Title = "New Title for this record";
objRecord.DateDue = DateTime.Today.AddDays(10);
DateTime datePub = new DateTime(2002,05,20);
objRecord.DatePublished = datePub;
objRecord.AuthorLoc = db.CurrentUser;
Page 52
In C#:
TRIMSDK.Location objMyUnitLoc = db.CurrentUser;
objRecord.SetCurrentLocation(objMyUnitLoc,DateTime.Today);
In many cases other parameters can be specified that control the behavior of the
update:
In Visual Basic:
' Set Current location to me, effective from yesterday
Call objRecord.SetCurrentLocation(objTRIM.CurrentUser, Date - 1)
In C#:
// Set Current location to me, effective from yesterday
DateTime yesterday = DateTime.Today.AddDays(-1);
objRecord.SetCurrentLocation(db.CurrentUser, yesterday);
Page 53
In C#:
// Set the title (property id=3)
objRecord.SetProperty(3, "Barrier Reef manatee population figures");
Page 54
Page 55
C# Example
if (! objRecord.Verify(true))
{
MessageBox.Show(objRecord.ErrorMessage,"Verify Failed");
}
else
{
objRecord.Save();
}
If it is not called explicitly in code, the Verify method will be automatically called
before an object is saved and if verification fails it will not be saved. This ensures
that data cannot become corrupted and that business rules are observed when using
the SDK, just as they are for users of the TRIM Client interface.
Page 56
C# Example
//Assumming db is a connected database object
RecordType recType = db.GetRecordType("Document");
RecordClass rec = (RecordClass)db.NewRecord(recType);
rec.Title = "Test Record";
rec.Save();
rec.DatePublished = rec.DateCreated.AddDays(-1);
IBaseObject recBaseObj = (IBaseObject)rec; //retrieves the base object for this record
//Now we verify the DatePublished property (property id = 111)
//This will fail since the date published must be later than the date created
if (! rec.VerifyProperty(111, false))
{
MessageBox.Show(rec.ErrorMessage,"VerifyProperty failed");
}
The second parameter of the VerifyProperty method gives the programmer the
additional option to check whether the property is mandatory. If using this option,
the VerifyProperty method will fail if the property is mandatory and has not yet been
given a value.
The following code example demonstrates a case in which the VerifyProperty method
Page 57
C# Example
//Assumming db is a connected database object
RecordType recType = db.GetRecordType("Document")
Record rec = db.NewRecord(recType);
IBaseObject recBaseObj = rec; //retrieves the base object for this record
//Now we verify the title property (property id = 3)
//This will fail since the title property is mandatory
//and we have not set a value for it
if (! recBaseObj.VerifyProperty(3, True))
{
MessageBox.Show(objRecord.ErrorMessage,"VerifyProperty failed");
}
Page 58
C# Example
The following code demonstrates how the Verified property changes according to the
state of the object.
// To demonstrate the Verified property
Page 59
Page 60
Page 61
C# Example
TRIMSDK.Record objRecord = db.GetRecord("G97/770");
objRecord.Title = objRecord.Title + " plus New Part of Title";
DateTime dateDue = new DateTime(2003,1,1);
objRecord.DateDue = dateDue;
objRecord.AuthorLoc = db.CurrentUser;
objRecord.Save(); // commit all these changes to the Database
Page 62
2.
3.
Add additional clauses and combine them with logical operators (optional)
4.
5.
6.
7.
8.
C# Example
// Construct a new search object
TRIMSDK.RecordSearch objSearch = db.NewRecordSearch();
// Search for "reef" in record titles
objSearch.AddTitleWordClause("reef");
// Hold the results in a collection
TRIMSDK.Records colRecords = objSearch.GetRecords();
Page 63
C# Example
// declare & make the search object
TRIMSDK.RecordSearch objSearch = db.NewRecordSearch();
int hWnd = Handle.ToInt32();
objSearch.EditQueryUI(hWnd); // call methods on the object
Page 64
In C#:
objSearch.AddTitleWordClause("reef"); //search for titles with "reef"
To retrieve records that were created since January 1, 2001, you would add a Date
Created clause passing the arguments "1/1/2001" and the current date, as follows:
In Visual Basic:
objSearch.AddDateCreatedClause(#01/01/2001#, Date)
In C#:
System.DateTime dateCreated = new DateTime(2001,01,01);
objSearch.AddDateCreatedClause(dateCreated, DateTime.Today);
You can build search criteria by calling multiple methods, and applying specific logical
relationships, using the Boolean operators, as described below.
Page 65
In C#:
objSearch.AddTrayClause(ttTrayType.ttWorktray);
DateTime dateFrom = new DateTime(2001,1,1);
DateTime dateTo = new DateTime(2002,1,1);
objSearch.AddDateCreatedClause(dateFrom, dateTo);
objSearch.AddCaveatClause("Medical in Confidence");
objSearch.Not();
objSearch.And();
objSearch.Or();
TRIMSDK.Location objAdminLoc = db.GetLocation("Administration");
objSearch.AddLocationClause(objAdminLoc, ltSearchLocationType.ltCurrent, true);
objSearch.And();
This results in the search: "(Records in my Worktray or (created today and without
the Caveat Ministerial in Confidence)) and currently located in Administration unit".
Page 66
C# Example
TRIMSDK.RecordSearch objSearch = db.NewRecordSearch();
objSearch.AddTitleWordClause("Press");
DateTime yesterday = DateTime.Today.AddDays(-1);
DateTime today = DateTime.Today;
objSearch.AddDateRegisteredClause(yesterday, today);
objSearch.And();
int hWnd = Handle.ToInt32();
if (! objSearch.EditQueryUI(hWnd))
{
return; // (Search dialog cancelled)
}
Page 67
Applying Filters
An optional step in searching for records is to filter the returned records on the basis
of Record Type, disposition, class and finalized status. The default is to include all
records that meet the criteria, regardless of these categories. To apply filtering,
there are methods on the RecordSearch object prefixed with 'Filter'
Visual Basic Example
With objSearch
.AddTitleWordClause("manatee")
.FilterClass(rcReference) ' include only Reference class
.FilterDisposition(rdDestroyed, False) ' include all except Destroyed
.FilterTypes(colMyTypes) ' include Types matching this collection
End With
C# Example
objSearch.AddTitleWordClause("manatee");
// include only Reference class
objSearch.FilterClass(rcRecordClass.rcReference,true);
// include all except Destroyed
objSearch.FilterDisposition(rdRecordDisp.rdDestroyed, false);
// include Types matching this collection
objSearch.FilterRecordTypes(colMyTypes);
Page 68
Sorting
Another optional step when constructing a record search is to define the sort order
for the search results.
The Sort method allows you to specify up to three different sort criteria, and whether
to sort in ascending (the default) or descending order for each.
The following example sorts the results by ascending Priority, then Record Type,
then descending Date Due.
In Visual Basic:
Call objSearch.Sort(rsPiority,,rsRecordType,,rsDateDue, True)
In C#:
objSearch.Sort(rsRecordSortFields.rsPriority,false,rsRecordSortFields.rsRecordType,false,
rsRecordSortFields.rsDateDue, true);
Page 69
Displaying Results
Once the search criteria, filters and sort order have been specified, you can retrieve
the records that match the criteria. These records can either be processed
sequentially in code (see Processing Results Sequentially) or they can be copied to a
record collection for reporting or displaying to the user.
To copy the results to a Records collection, you must call the GetRecords method.
Visual Basic Example
Dim objSearch As RecordSearch
Dim colResults As Records
Set objSearch = objTRIM.NewRecordSearch
Call objSearch.AddTitleWordClause("water")
Set colResults = objSearch.GetRecords
Call colResults.DisplayUI(hWnd) ' browse the results
C# Example
TRIMSDK.RecordSearch objSearch = db.NewRecordSearch();
objSearch.AddTitleWordClause("water");
TRIMSDK.Records colResults = objSearch.GetRecords();
int hWnd = Handle.ToInt32();
colResults.DisplayUI(hWnd); // browse the results
When the results have been copied to a Records collection, you have several options
for displaying records, including allowing the user to select one record
(ChooseOneUI), to select multiple records (ChooseManyUI) or simply to browse the
results for viewing (DisplayUI).
Page 70
Code Example C#
In this example, all records returned by the search are processed by adding up the
values in a User Defined Field called 'Actual Cost', subtotalled by month based on the
date the record was created.
double[] sCosts = new double[12];
int iMonth;
// Get the user-defined field Actual Cost
TRIMSDK.FieldDefinition objCost = db.GetFieldDefinition("Actual Cost");
// Create the search
TRIMSDK.RecordSearch objSearch = db.NewRecordSearch();
objSearch.AddTitleWordClause("Project Cost Report");
// Process the results in a loop
TRIMSDK.Record objRecord = objSearch.Next();
while (objRecord != null)
{
iMonth = objRecord.DateCreated.Month;
double cost =
Convert.ToDouble(objRecord.GetUserField(objCost,TRIMSDK.sdStringDisplayType.sdDefault))
sCosts[iMonth] = sCosts[iMonth] + cost;
objRecord = objSearch.GetNext();
}
Page 71
Methods
o
AddTitleWordClause
GetRecords
ChooseOneUI
Properties
o
ErrorMessage
Page 72
Methods
o
AddTitleWordClause
Or
GetRecords
ChooseOneUI
Properties
o
ErrorMessage
Page 73
Saved Search
Create a Saved Search. Save the record search object.
Methods
o
PropertiesUI
Verify
Save
Properties
o
Name
ErrorMessage
Page 74
Code Examples C#
Methods
o
AddTitleWordClause
GetRecords
ChooseOneUI
Properties
o
ErrorMessage
C# Code:
// Assumes TRIMDatabase is a valid TRIMSDK Database
// Instantiate a new TRIM record search object
TRIMSDK.RecordSearch recordSearch = db.NewRecordSearch();
if (! recordSearch.AddTitleWordClause("title"))
{
MessageBox.Show( "Add Title Word Clause error " + recordSearch.ErrorMessage, "",
MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
return;
}
// Fill the Records Collection from the Search object
TRIMSDK.Records recordResults = recordSearch.GetRecords();
// Instantiate a record by choosing it from the collection
int hWnd = Handle.ToInt32();
TRIMSDK.Record recordItem = recordResults.ChooseOneUI(hWnd);
if (recordItem == null)
{
Console.WriteLine( "User cancelled!");
}
else
{
Console.WriteLine( recordItem.Number + " - " + recordItem.Title);
}
Page 75
Methods
o
AddTitleWordClause
Or
GetRecords
ChooseOneUI
Properties
o
ErrorMessage
C# Code:
// Assumes TRIMDatabase is a valid TRIMSDK Database
// Instantiate a new TRIM record search object
TRIMSDK.RecordSearch recordSearch = db.NewRecordSearch();
if (! recordSearch.AddTitleWordClause("txtSearch1.Text"))
{
MessageBox.Show("Add Title Word Clause error " + recordSearch.ErrorMessage, "",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
if (! recordSearch.AddTitleWordClause("txtSearch2.Text"))
{
MessageBox.Show( "Add Title Word Clause error " + recordSearch.ErrorMessage, "",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
if (! recordSearch.Or())
{
MessageBox.Show( "Adding Boolean 'OR' failed " + recordSearch.ErrorMessage, "",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
// Fill the Records Collection from the Search object
TRIMSDK.Records recordResults = recordSearch.GetRecords();
// Instantiate a record by choosing it from the collection
TRIMSDK.Record recordItem =
recordResults.ChooseOneUI(Handle.ToInt32());
if (recordItem == null)
{
Console.WriteLine( "User cancelled!");
}
else
{
Console.WriteLine( recordItem.Number + " - " + recordItem.Title);
}
Page 76
Saved Search
Create a Saved Search. Save the record search object.
Methods
o
PropertiesUI
Verify
Save
Properties
o
Name
ErrorMessage
C# Code:
TRIMSDK.RecordSearch recordSearch = db.NewRecordSearch();
int hWnd = Handle.ToInt32();
// Display the properties of a RecordSearch object
// returns True if the user presses OK
if (recordSearch.PropertiesUI(hWnd))
{
if (recordSearch.Verify(true))
{
// If no errors or warnings, Save the Record Search
recordSearch.Save();
MessageBox.Show( "Saved Search created - " + recordSearch.Name, "",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
// Display Errors
MessageBox.Show( "Record Search Verify failed: " +
recordSearch.ErrorMessage, "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
Page 77
2.
3.
4.
5.
6.
7.
8.
9.
10.
Page 78
In C#:
//Create a new Case File record
TRIMSDK.RecordType objRecType = db.GetRecordType("Case File");
TRIMSDK.Record objRecord = db.NewRecord(objRecType);
Note: It is possible to create new Record Types using the SDK; however, this
is not recommended as this is generally an Administrator's function only.)
Page 79
C# Example
if (objRecordType.TitlingMethod == tmTitlingMethods.tmClassification)
{
// Assign classification of 610/600/ = Insurance - Property
objRecord.Classification = db.GetClassification("610/600/");
}
objRecord.TypedTitle = "Storm damage to Mackay information center";
Similarly, Thesaurus (or Keyword) titling allows a file to be titled using either a
choice of individual keywords from a controlled list or a specific 'branch' of related
terms according to a hierarchical structure (similar to a record plan or Classification.)
A Thesaurus-titled file might have a name such as "Administration Finance
Donations Bequest from the estate of Lady Marchcroft".
Visual Basic Example
objRecord.GeneratedTitle = "Administration - Finance - Donations"
objRecord.TypedTitle = "Bequest from the estate of Lady Marchcroft"
C# Example
objRecord.GeneratedTitle = "Administration - Finance - Donations";
objRecord.TypedTitle = "Bequest from the estate of Lady Marchcroft";
Page 80
C# Example
// Assign "Confidential" level
TRIMSDK.SecurityLevel objSec = db.GetSecurityLevel("Confidential");
objRecord.SecLevel = objSec;
// Assign "Research Projects" Caveat
TRIMSDK.SecurityCaveat objCav = db.GetSecurityCaveat("Research Projects");
objRecord.AddCaveat(objCav);
// Assign "Staff in Confidence" Caveat
objRecord.AddCaveat(db.GetSecurityCaveat("Staff in Confidence"));
C# Example
// Assign security level and two Caveats
objRecord.Security = "Confidential, Research Projects, Staff in Confidence";
Page 81
Access Control
In addition to Security Levels and Caveats, Access Control provides fine-grained
control over different methods of access to a record and its electronic attachment.
(See TRIM.chm Administrator Guide Ch 1- Security Access Control.)
Access Control associates individual users or groups of users with specific actions
allowed for a record. The actions are:
reading metadata
updating metadata
The default for a record that has no Access Control specified is that all users can
perform all actions (subject to Security Levels and Caveats.)
Access Control is normally applied to individual Container records, and may be
inherited by contained records or explicitly set for each contained record.
The SetAccessControlDetails method of the Record object is used to add
specifications of the Access Control for the record. This method requires that you
specify one of the six actions listed above and the access level (including the
locations, if private or ad-hoc.)
Visual Basic Example:
This example grants the following:
! Note: that the connected user must have 'Modify Access Control' permission
for this code to work.
Call objRecord.SetAccessControlDetails(dxViewRecord, asPublic)
Call objRecord.SetAccessControlDetails(dxUpdateMetadata, asInherited)
Call objRecord.SetAccessControlDetails(dxDeleteRecord, asPrivate,
objTRIM.GetLocation("Records Manager"))
C# Example:
This example grants the following:
Page 82
! Note: that the connected user must have 'Modify Access Control' permission
for this code to work.
objRecord.SetAccessControlDetails(dxRecordAccess.dxViewRecord,
asAccessControlSettings.asPublic,null);
objRecord.SetAccessControlDetails(dxRecordAccess.dxUpdateMetadata,
asAccessControlSettings.asInherited,null);
objRecord.SetAccessControlDetails(dxRecordAccess.dxDeleteRecord,
asAccessControlSettings.asPrivate, db.GetLocation("Records Manager"));
Page 83
Relationships
The context of a document in TRIM is generally provided by the Container file in
which it is logically enclosed. To provide useful context for a Container file record,
you can use various techniques such as a Classification system. You can also
provide context by creating relationships with other records in the Database. TRIM
defines some standard relationship types, but you can also create custom
relationship definitions. Apart from the generic type of "related", all relationship
types in TRIM are transitive, meaning that the relationship has a subject and an
object (for example, the transitive relationship "A supersedes B" is not the same as
"B supersedes A").
In the SDK, you use the Record object's AttachRelationship method to relate another
record to the current record. The record on which the method is being called is the
subject of the relationship, and the other record (passed as an argument to the
method) is the object. The relationship type is determined by passing a value of the
rrRecordRelationship enumeration.
Visual Basic Example
This line of code creates a relationship of "Record A supersedes Record B".
objRecordA.AttachRelationship(objRecordB, rrDoesSupersede)
C# Example
This line of code creates a relationship of "Record A supersedes Record B".
objRecordA.AttachRelationship(objRecordB, rrRecordRelationship.rrDoesSupersede);
Page 84
Record Locations
Defining relationships between a Container file and location objects (people and
places) provides additional and useful context for the record.
Unlike record relationships, which can be user defined, you can only use TRIM's
predefined standard relationship types for record locations (and for contacts, see
Record Contacts).
Record Locations represent actual (in the case of paper and other physical records)
or logical (in the case of electronic records) places where a record resides. Every
record in TRIM has a property representing it's Current Location (where the record is
now) and another for it's Home Location (where the record should normally be or
where it is to be returned.) There is also a property for Owner Location the exact
meaning of this can vary according to the practises of each TRIM implementation,
but normally represents the person or body that is responsible for the record. The
Home and Owner location of a record are typically derived from the default values for
each Record Type, but all record location properties can be set on creation of a new
record or modified later.
The Record object has methods for setting or changing the value of these location
properties, which allow the option of specifying the date & time of the change of
location (the default is the current time.)
Visual Basic Example
This example sets the record's Home location to the unit called "Administration", and
the Current location to the connected user.
objRecord.SetHomeLocation(objTRIM.GetLocation("Administration"))
objRecord.SetCurrentLocation(objTRIM.CurrentUser)
C# Example
This example sets the record's Home location to the unit called "Administration", and
the Current location to the connected user.
objRecord.SetHomeLocation(db.GetLocation("Administration"));
objRecord.SetCurrentLocation(db.CurrentUser,DateTime.Now);
Page 85
Record Contacts
Unlike record locations (see Record Locations), which tend to be internal units,
Record Contacts are more commonly people or organisations that have a direct
association with the record, and may be internal or external to the organisation.
Using the AttachContact method, TRIM allows each contact to be specifically
identified as an Author, Addressee, Representative or Client. Other contact
relationship types must use the generic type of 'Other'.
Visual Basic Example
This example sets the record's Representative (and primary contact) to be the
connected user, and the Client to be the organisation called "My Organization".
objRecord.AttachContact(objTRIM.CurrentUser, ctRepresentative, True)
objRecord.AttachContact(objTRIM.GetLocation("My Organization"), ctClient)
' ctClient = Client
C# Example
This example sets the record's Representative (and primary contact) to be the
connected user, and the Client to be the organisation called "My Organization".
objRecord.AttachContact(db.CurrentUser, ctContactType.ctRepresentative,
true,DateTime.Now);
objRecord.AttachContact(db.GetLocation("My Organization"),
ctContactType.ctClient,false,DateTime.Now);
// ctClient = Client
Page 86
Page 87
Code Example - C#
This code demonstrates many of the features described above. The code will work
with the Demonstration Database provided on the TRIM installation disk.
TRIMSDK.Database db = new TRIMSDK.Database();
// Create a new File Folder record
TRIMSDK.RecordType objRecordType = db.GetRecordType("Research Project File");
TRIMSDK.Record objRecord = db.NewRecord(objRecordType);
// Set keyword title and free text title
objRecord.GeneratedTitle = "Administration - Finance - Donations";
objRecord.TypedTitle = "Bequest from the estate of Lady Marchcroft";
// Relate to the superseded record
TRIMSDK.Record objRecordB = db.GetRecord("76/915");
objRecord.AttachRelationship(objRecordB, rrRecordRelationship.rrDoesSupersede);
// Assign "Confidential" security level
objRecord.SecLevel = db.GetSecurityLevel("Confidential");
// Add "Research Projects" Caveat
objRecord.AddCaveat(db.GetSecurityCaveat("Research Projects"));
// Access Control - only this user can update
objRecord.SetAccessControlDetails(dxRecordAccess.dxUpdateMetadata,
asAccessControlSettings.asPrivate, db.CurrentUser);
// Locations
objRecord.SetHomeLocation(db.GetLocation("Administration"));
objRecord.SetCurrentLocation(db.CurrentUser,DateTime.Now);
// Contacts
objRecord.AttachContact(db.CurrentUser, ctContactType.ctAuthor, true,DateTime.Now);
objRecord.AttachContact(db.GetLocation("Bay Books"),
ctContactType.ctClient,false,DateTime.Now);
// Verify and Save
if (! objRecord.Verify(false))
{
MessageBox.Show (objRecord.ErrorMessage);
}
else
{
objRecord.Save();
}
Page 88
Creating a Document
This scenario describes the general processes for using the SDK to create a record of
a generic Record Type we are calling a 'Document'.
(See Searching for Records - Creating a Container File).
While Container Files are usually created and maintained by specialist records
managers, Documents, on the other hand, are usually created by end-users, and
require little specific metadata other than the identification of the appropriate
Container File to which the Document belongs, as most other metadata and context
is inherited from the Container. A Document record usually consists of an electronic
object (the source document, image or other file), a unique identifier (which may be
automatically generated by TRIM), a record title and any other metadata required to
profile and index the record, and a pointer to the Container File from which the
document derives its context.
The general steps for creating a new Document record are as follows:
1.
2.
3.
4.
5.
6.
7.
8.
9.
Page 89
C# Example
objRecord.Title = "Letter from executor regarding disbursements of Lady Marchcrofts
bequest";
objRecord.LongNumber = "XK/008936";
Page 90
Assigning to a Container
Although it is not compulsory, it is most common that an electronic record is logically
assigned to a Container file that represents the subject matter, case, client file or
other contextual grouping relevant to the document.
To assign a record to a Container, the existing Container record must be instantiated
(by Id or URI) and then passed as an argument to the (contained) record object's
SetContainer method. The method includes a parameter for specifying whether the
record is also 'enclosed in' the Container, i.e. that the current location should reflect
that it is with the Container.
Visual Basic Example
Dim objContainer As Record
Set objContainer = objTRIM.GetRecord("76/915")
objRecord.SetContainer(objContainer, True)
C# Example
TRIMSDK.Record objContainer = db.GetRecord("76/915");
objRecord.SetContainer(objContainer, true);
Page 91
C# Example
TRIMSDK.InputDocument objDoc = new InputDocument();
// note that in C# the \ character is an escape symbol,
// unless the string is preceded by an @.
objDoc.SetAsFile(@"C:\myDocs\ThisFile.doc");
objRecord.SetDocument(objDoc, false, false, "Created via SDK");
Alternatively, if the file to be attached is not known until run-time, you can call the
SetDocumentUI method, which will display a dialog for the user to select the file.
Visual Basic Example
If Not objRecord.SetDocumentUI(hWnd, "TheDefault.doc", "Attach Document", False) Then
Msgbox "Action cancelled."
Exit Sub
End If
C# Example
int hWnd = Handle.ToInt32();
if (! objRecord.SetDocumentUI(hWnd, "", "Attach Document", false))
{
MessageBox.Show("Action cancelled.");
}
Page 92
Document Author
Record Contacts are TRIM location objects commonly representing people or
organisations that have a direct association with the record. The most common type
of Contact to be specified for an electronic document is the Author. Although the
AttachContact method can be used for this and other contact types, a shortcut is
provided through the AuthorLoc property.
Visual Basic Example
This example sets the document's Author to be the connected user.
objRecord.AuthorLoc = objTRIM.CurrentUser
C# Example
This example sets the document's Author to be the connected user.
objRecord.AuthorLoc = db.CurrentUser;
Page 93
Private access to the connected user for updating the electronic document
C# Example
This example grants the following:
Private access to the connected user for updating the electronic document
objRecord.SetAccessControlDetails(dxRecordAccess.dxUpdateDocument,
asAccessControlSettings.asPrivate, db.CurrentUser);
objRecord.SetAccessControlDetails(dxRecordAccess.dxViewDocument,
asAccessControlSettings.asPublic,null);
Page 94
C# Example
This example assumes that a User Defined String Field called "Job Code" has been
created in TRIM. It assigns a value of "D0933" to this field on the current record.
objRecord.SetUserField(db.GetFieldDefinition("Job Code"), "D0933");
Page 95
variables (p_)
As TRIMSDK.RecordTypes
As TRIMSDK.RecordType
As TRIMSDK.Record
Page 96
Code Example C#
private TRIMSDK.Database db = new TRIMSDK.Database();
// Instantiate a collection of Record Types.
TRIMSDK.RecordTypes recordTypes = db.MakeRecordTypes();
// Fill the collection with all Record Types, before filtering
recordTypes.SelectAll();
// Instantiate a Record Type by choosing it from the collection
int hWnd = Handle.ToInt32();
TRIMSDK.RecordType recordType = recordTypes.ChooseOneUI(hWnd);
if (recordType == null)
{
Console.WriteLine( "User pressed Cancel");
return;
}
// Instantiate a new Record of the Record Type passed in.
TRIMSDK.Record newRecord = db.NewRecord(recordType);
// Display the properties of new Record
// Returns True if the user selects OK.
if (newRecord.PropertiesUI(hWnd))
{
if (newRecord.Verify(false))
{
newRecord.Save();
MessageBox.Show( "Created a new record - " + newRecord.Number);
}
else
{
MessageBox.Show( "Error saving new Record properties " +
newRecord.ErrorMessage, "", MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
}
}
// Clean Up
recordTypes = null;
recordType = null;
newRecord = null;
Page 97
variables (p_)
As TRIMSDK.RecordTypes
As TRIMSDK.RecordType
As TRIMSDK.Record
Page 98
Code Example C#
TRIMSDK.Database db = new TRIMSDK.Database();
try
{
// Instantiate a Record Type from its name or Uri
TRIMSDK.RecordType recordType = db.GetRecordType("Research Project File");
if (recordType == null)
{
// Name or Uri did not uniquely identify a record type.
Console.WriteLine ("Error instantiating Record Type.");
return;
}
TRIMSDK.Location homeLocation = db.GetLocation("Llewellyn, Brian (Professor)
OBE");
if (homeLocation == null)
{
// Name or Uri did not uniquely identify a TRIM Location.
Console.WriteLine( "Error instantiating Location: " +
recordType.ErrorMessage);
return;
}
// Instantiate a new Record of the Record Type passed in.
TRIMSDK.Record newRecord = db.NewRecord(recordType);
// Complete all of the new record's properties.
// An error is raised if any of these properties fail.
// Thesaurus titling
newRecord.GeneratedTitle = "ADMINISTRATION - FINANCE - LEASES AND RENTAL
AGREEMENTS - SUPPLIER [Larger than Life Ventures]"; //p_Keyword.Name
// Free text titling
newRecord.TypedTitle = "New Record Title";
// Record's Home location
if (newRecord.Verify(false))
{
newRecord.Save();
Console.WriteLine( "Created a new record - " + newRecord.Number);
}
else
{
MessageBox.Show( "Error saving new Record" +
newRecord.ErrorMessage,"",MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
recordType = null;
newRecord = null;
homeLocation = null;
return;
}
catch(Exception ex)
{
// The error message is also populated in the ex object.
MessageBox.Show( "Error: " + ex.Message, "", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
Page 99
C# Example
This example combines some elements of the options described above, by using a
Records collection to display the contents of a specific Container file, and
instantiating the record that the user selects from a displayed result list.
TRIMSDK.Record objContainer = db.GetRecord("96/715");
TRIMSDK.Records colContents = db.MakeRecords();
colContents.SelectContentsOf(objContainer);
int hWnd = Handle.ToInt32();
TRIMSDK.Record objDoc = colContents.ChooseOneUI(hWnd);
if ( objDoc != null && ! objDoc.IsElectronic)
{
return;
}
Page 100
C# Example
if (objDoc.IsElectronic)
{
objDoc.GetDocument(@"C:\tmp\MyFile.doc", true, "Checked out via SDK", " ");
}
Alternatively, a user can choose a document to check out to their TopDrawer via a
dialog by calling TopDrawerDisplayUI on a collection of records.
Visual Basic Example
In this example, the user selects from their list of favorite documents.
Call colRecords.SelectFavorites
Call colRecords.TopDrawerDisplayUI(hWnd)
C# Example
In this example, the user selects from their list of favorite documents.
colRecords.SelectFavorites();
int hWnd = Handle.ToInt32();
colRecords.TopDrawerDisplayUI(hWnd);
Page 101
Check In
After a document has been edited and it is ready to be returned to TRIM, it must be
Checked-in. This can be done manually either through the TRIM or TopDrawer
clients (if the document was checked out to TopDrawer.) To Check-in a document
programmatically, you must use the SetDocument method of the record that has
been checked-out. The method provides options for adding notes and specifying
whether the latest revision should replace the current one or be stored as a new
revision.
Visual Basic Example
If objDoc.CheckedOutTo.Uri = objTRIM.CurrentUser.Uri Then
objDoc.SetDocument("C:\tmp\MyFile.doc", True, False, "Checked in via SDK")
End If
C# Example
if (objDoc.CheckedOutTo.Uri == db.CurrentUser.Uri)
{
TRIMSDK.InputDocument document = new InputDocument();
document.SetAsFile(@"C:\myDocs\ThisFile.doc");
objDoc.SetDocument(document, true, false, "Checked in via SDK");
}
To check-in a document interactively, you can use the SetDocumentUI method. This
will display a TRIM dialog to allow the user to specify the check-in options.
Visual Basic Example
If Not SetDocumentUI(hWnd, "MyFile.doc", "Check-In", False) Then
MsgBox "Check-in cancelled"
End If
C# Example
int hWnd = Handle.ToInt32();
if (! objDoc.SetDocumentUI(hWnd, "", "Check-In", false))
{
MessageBox.Show("Check-in cancelled");
}
Page 102
C# Example
TRIMSDK.Location objLoc = db.GetLocation("Abbott, Peter (Mr)");
Alternatively, you can pass a sub-string of the person's name followed by a wildcard
(asterisk) character, as long as the text provided uniquely identifies a location.
Visual Basic Example
Set objLoc = objTRIM.GetLocation("Abbott, P*")
Set objLoc = objTRIM.GetLocation("Abbott*")
Set objLoc = objTRIM.GetLocation("Abbott, Peter*")
C# Example
objLoc = db.GetLocation("Abbott, P*");
objLoc = db.GetLocation("Abbott*");
objLoc = db.GetLocation("Abbott, Peter*");
If the sub-string does not uniquely identify a location (i.e. there are no matches, or
there is more than one match) then a null object will be returned.
Visual Basic Example
Set objLoc = objTRIM.GetLocation("Abb*") ' finds Abbott and Abbey
If objLoc Is Nothing Then Exit Sub
C# Example
objLoc = db.GetLocation("Abb*"); //finds Abbott and Abbey
if (objLoc == null)
{
return;
}
Page 103
Page 104
objUnit As Location
objBoss As Location
objPeer As Location
objRole As Location
objSec As SecurityLevel
objEmail As LocEAddress
bRoleSecurity As Boolean
bRoleSecurity = False
Set objRole = objTRIM.GetLocation("Project Manager")
Set objLoc = objTRIM.NewLocation
With objLoc
.LocType = lcPerson
' Name
.Surname = "Evans"
.GivenNames = "David"
.Initial1 = "D"
.Initial2 = "W"
.Honorific = "Mr"
' Personal & Administrative
.IsWithin = True
' Internal to the org
.IdNumber = 793906
.ReviewDate = Date + 365
.DateOfBirth = #11/29/1966#
.PhoneNo = "555 123496"
.MobileNo = "+44 7939 062736"
.Notes = "Created via SDK"
' Login details
.CanLogin = True
.LoginExpires = Date + (365 * 3) ' Valid for 3 years
.LogsInAs = "evans"
' Network login id
' Security
If bRoleSecurity Then
.UseProfileOf = objRole
Else
Set objSec = objTRIM.GetSecurityLevel("Confidential")
.SecLevel = objSec
.UserType = utRecordsWorker
End If
' Email address
Set objEmail = .LocEAddresses.New
objEmail.EAddressType = etMail
objEmail.EAddress = "[email protected]"
objEmail.Description = "Default business email"
' Relationships
Call .AddRelationship(objRole, lrHasGroups)
Set objUnit = objTRIM.GetLocation("Administration")
Call .AddRelationship(objUnit, lrMemberOf, True)
Set objBoss = objTRIM.GetLocation("Neumann, Ilse*")
Call .AddRelationship(objBoss, lrBossedBy)
' Confirm & Save
If .Verify(True) Then
.Save
MsgBox .FormattedName & " created."
Else
MsgBox .ErrorMessage
End If
End With
Page 105
Code Example C#
bool bRoleSecurity = false;
TRIMSDK.Location objRole = db.GetLocation("Project Manager");
TRIMSDK.Location objLoc = db.NewLocation();
objLoc.LocType = lcLocationType.lcPerson;
// Name
objLoc.Surname = "Evans";
objLoc.GivenNames = "David";
objLoc.Initial1 = "D";
objLoc.Initial2 = "W";
objLoc.Honorific = "Mr";
// Personal & Administrative
objLoc.IsWithin = true; // Internal to the org
objLoc.IdNumber = Convert.ToString(793906);
objLoc.ReviewDate = DateTime.Today.AddYears(1);
DateTime dob = new DateTime(1966,11,29);
objLoc.DateOfBirth = dob;
objLoc.PhoneNo = "555 123496";
objLoc.MobileNo = "+44 7939 062736";
objLoc.Notes = "Created via SDK";
// Login details
objLoc.CanLogin = true;
objLoc.LoginExpires = DateTime.Today.AddYears(3); // Valid for 3 yrs
objLoc.LogsInAs = "evans"; // Network login id
// Security
if (bRoleSecurity)
{
objLoc.UseProfileOf = objRole;
}
else
{
TRIMSDK.SecurityLevel objSec = db.GetSecurityLevel("Confidential");
objLoc.SecLevel = objSec;
objLoc.UserType = utUserTypes.utRecordsWorker;
}
// Email address
TRIMSDK.LocEAddress objEmail = objLoc.LocEAddresses.New();
objEmail.EAddressType = etEAddressType.etMail;
objEmail.EAddress = "[email protected]";
objEmail.Description = "Default business email";
// Relationships
objLoc.AddRelationship(objRole, lrLocRelationshipType.lrHasGroups,false);
TRIMSDK.Location objUnit = db.GetLocation("Administration");
objLoc.AddRelationship(objUnit, lrLocRelationshipType.lrMemberOf, true);
TRIMSDK.Location objBoss = db.GetLocation("Neumann, Ilse*");
objLoc.AddRelationship(objBoss, lrLocRelationshipType.lrBossedBy,false);
// Confirm & Save
if (objLoc.Verify(true))
{
objLoc.Save();
MessageBox.Show( objLoc.FormattedName + " created.");
}
else
{
MessageBox.Show( objLoc.ErrorMessage);
}
Page 106
Reference
Objects
As of TRIM 6.1, the reference section detailing the methods and properties of each
TRIM SDK object has been replaced by helpstrings which appear in the object
browser of your chosen Integrated Development Environment. These helpstrings
contain the most up-to-date information about each method and property in the HP
TRIM SDK.
ActiveX Controls
The controls are contained in a component called "HP TRIM ActiveX Controls" and
implemented by the file "tsjOCX.dll"; the methods and properties are defined in the
Type Library "TRIMOCXLib".
To use these ActiveX controls in a Microsoft Visual Basic project assuming your editor
is Microsoft Visual Studio, select Project | Components from the menu and ensure
that the check box against "HP TRIM ActiveX Controls" is checked.
Page 107
Properties
Name
Description
CanSaveOrLaunchCurrent
DocFormat
Enabled
Font
Control font
MenuHandle
HMENU handle.
PermitLaunch
StatusText
Text
Page 108
CanSaveOrLaunchCurrent
If true, the methods TRIMViewer.SaveCurrent and TRIMViewer.LaunchCurrent will
function.
If false, these methods will do nothing.
Syntax
TRIMviewer.CanSaveOrLaunchCurrent = [Boolean]
Page 109
Page 110
Enabled
Returns/sets a value that determines whether an object can respond to usergenerated events.
Syntax
TRIMviewer.Enabled = [Boolean]
Page 111
Font
Font used by the control.
Syntax
TRIMviewer.Font = [stdole.IfontDisp ]
Page 112
Page 113
PermitLaunch
Returns/Sets a boolean value that determines if the native application is to be
launched when the viewer is unable to view an electronic file.
Syntax
TRIMviewer.PermitLaunch = [Boolean]
Page 114
Page 115
Text
Returns/Sets a string that is displayed in the TRIMviewer control when there is no
file currently being displayed.
Syntax
TRIMviewer.Text = [String]
Page 116
Methods
Name
Description
CanView
Copy
Clear
DoMenu
EnableMenu
LaunchCurrent
PrintCurrent
View
Page 117
CanView
Tests the entered file and returns true if the viewer can display this file.
Syntax
[Boolean] = TRIMviewer.CanView (fileName As String, stream As Unknown)
Parameters
Name
Type
Default Description
Filename
String
Stream
Unknown
Return Value
Type
Description
Boolean
Page 118
Copy
Copy Selection to the Clipboard.
Syntax
TRIMviewer.Copy ()
Page 119
Clear
If the viewer is currently viewing a file using this method will clear the reference to
this file. The TRIMviewer will then be blank.
Syntax
TRIMviewer.Clear ()
Page 120
DoMenu
Do not use.
Page 121
EnableMenu
Do not use.
Page 122
LaunchCurrent
Launches a copy of the current document using the associated application instead of
the TRIMViewer.
! Note: The method does not allow changes to be made to the document while
launched in the associated application. The document is saved to a temporary
directory as a read-only file which is then opened for viewing with the associated
application. The temporary file is deleted when TRIM is closed down.
Syntax
TRIMviewer.LaunchCurrent ()
Page 123
Print
Prints the nominated file, deleting the file if it is marked as a tempfile and showing a
print dialog if desired.
Syntax
TRIMviewer.Print (fileName As String, tempFile As Boolean, stream As Unknown, showDialogs
As Boolean)
Parameters
Name
Type
Default Description
filename
String
tempFile
Boolean
stream
Unknown
showDialogs
Boolean
Page 124
PrintCurrent
Prints the file that is currently being viewed, showing a print dialog if desired.
Syntax
TRIMviewer.PrintCurrent (showDialogs As Boolean)
Parameters
Name
Type
showDialogs Boolean
Default Description
Indicates if a print dialog (user interface) is to
be displayed prior to printing. Set this value to
true to display the dialog.
Page 125
View
The primary method on the TRIMviewer control, it is used to display the nominated
file. If it is marked as a temp file, it will delete the file when a new file is viewed, the
clear method is called or the control destroyed.
Syntax
[Boolean] = TRIMviewer.View (fileName As String, tempFile As Boolean, stream As Unknown,
launched As Boolean)
Parameters
Name
Type
Default Description
Filename
String
tempFile
Boolean
Stream
Unknown
launched
Boolean
Return Value
Type
Description
Boolean
launched
Returns true if the viewer could not display the file and so
launched the associated application
Page 126
Events
Name
Description
View
Page 127
View
If the file being viewed has an embedded or contained object and the user double
clicks it the view event occurs (for example, The file bing viewed is a zip file and one
of the compressed files is double clicked, you could capture this event to launch or
view the compressed file).
Syntax
TRIMviewer.View (fileName As String, displayName As String, deleteAfter As Boolean,
handled As Boolean)
Parameters
Name
Type
filename
String
Default Description
The path and file name of the file embedded or
contained file
displayName String
deleteAfter
Boolean
True
handled
Boolean
False
Page 128
Picture
Constituant Description
Controls
Browse
None
Spell
Check
HP TRIM
Spell Check
Control
Select
Directory
Browse
Folder
Control
Input File
File Open
Control
Page 129
Save As
Control
Date and
Time
Calander
Control
When selected a
Calander control is
displayed to assist the
user in selecting a date.
If any canned dates are
supported
(CannedDatesMode
property on the TRIMedit
control) the drop down
list on the calander
control will be populated
with the supported
values. The Date or
canned date will then be
entered in the date area
of the control.
Date
Calander
Control
Format
None
Page 130
Page 131
Constituent Controls
Name
Picture
Spell Check
File Open
Control
Page 132
Save As
Control
Calendar
Control
Page 133
Browse Folder
Control
As you can see the TRIMedit control can be a powerful tool to get required
functionality into your program fast.
Page 134
Property Pages
The TRIMedit Control has the following property pages to assist the developer in
setting up the control.
! Note: Not all properties of the TRIMedit control are relevant in all Select
Modes (for example, the Force Spell Check property on the Verification page is
not relevant when the Mode is set to Date).
Page 135
General
Type
Select Mode
SelectMode
ksSelectMode
Scroll Bars
ScrollBars
ksScrollMode
History Limit
HistoryLimit
Long
Visible History
HistoryVisibleRows
Long
Window Text
Text
String
Browse State
BrowseState
ksBrowseMode
HistoryKey
String
Numbers Only
Number
Boolean
Password
PassWord
Boolean
Border
Border
Boolean
Locked
Locked
Boolean
Multiline
MultiLine
Boolean
Want Return
WantReturn
Boolean
Page 136
Verification
Type
CannedDatesMode
ksCannedDatesMode
Allow Blank
AllowBlank
Boolean
AllowBlankTime
Boolean
Allow Overwrite
AllowOverwrite
Boolean
Maximum Length
MaxLength
Long
Allow Create
AllowCreate
Boolean
Confirm Overwrite
ConfirmOverwrite
Boolean
ForceSpellCheck
Boolean
Page 137
Fonts
Type
ifontDisp
Font
The fonts page is provided to assist the programmer in setting the attributes of the
font property.
Page 138
Properties
Name
AllowBlank
Description
All
Output File
All
All
All
AllowBlankTime
AllowCreate
AllowOverwrite
Border
BrowseState
CannedDatesMode
CanUndo
CaptionWindow
All
All
All
ConfirmOverwrite
CurSel
CursorPosition
DateTime
Page 139
Enabled
ExtraText
All
All
All
All
All
All
All
All
All
All
Returns/Sets an indicater
as to whether the text area
ExtraTextInList
FileFilter
Font
ForceSpellCheck
HistoryCount
HistoryKey
HistoryLimit
HistoryVisibleRows
HistoryWhenLocked
ItemCount
Locked
Page 140
Returns/Sets the
maximum length of text a
user can enter into the text
area of the control
All
All
All
All
All
N/A
All
All
All
All
MaxLength
Modified
MultiLine
Number
PassWord
ScrollBars
SelectMode
SelectOnFocus
Text
ToolTips
Uri
Page 141
WantReturn
AllowBlank
Returns/Sets a value that determines if the control can be valid even if the text area
of the control is blank.
Syntax
TRIMedit.AllowBlank = [Boolean]
Page 142
AllowBlankTime
Allow the Time section of the control when in Date and Time mode to be blank.
Syntax
TRIMedit.AllowBlankTime = [Boolean]
Page 143
AllowCreate
Enables the control to create a file system directory or folder when required.
Syntax
TRIMedit.AllowCreate = [Boolean]
Page 144
AllowOverwrite
Enables the control to overwrite an existing file where required.
Syntax
TRIMedit.AllowOverwrite= [Boolean]
Page 145
Border
Detirmines if the control will be displayed with a boarder (3D) or without (flat).
Syntax
TRIMedit.Border= [Boolean]
Page 146
BrowseState
Returns/Sets the active state of the control.
Syntax
TRIMedit.BrowseState= [ksBrowseMode]
Page 147
CannedDatesMode
Returns/Sets which if any canned dates are supported by the control. Ony relevant
when the controls mode is set to Date or Date Time.
Syntax
TRIMedit.CannedDatesMode= [ksCannedDatesMode]
Page 148
CanUndo
Determines if the EditUndo method is able to be used.
Syntax
TRIMedit.CanUndo= [Boolean]
Page 149
CaptionWindow
A Windows Handle (HWnd) to a static control. The text of the static control will be
used as the caption of the messagebox for any message concerning the TRIMedit
Control.
Syntax
TRIMedit.CaptionWindow= [hWnd]
Page 150
ConfirmOverwrite
Returns/Sets whether the control will prompt the user when overwriting an existing
file. Only relevant when the control's SelectMode is set to Output File.
Syntax
TRIMedit.ConfirmOverwrite= [Boolean]
Page 151
CurSel
Returns/Sets the index of the item selected on the dropdown list,
Syntax
TRIMedit.CurSel= [Long ]
Page 152
CursorPosition
Returns/Sets the current position of the cursor in the text area of the control.
Syntax
TRIMedit.CursorPosition= [Long]
Page 153
DateTime
Returns/Sets the DateTime value of the control. Only relevant when the control is in
either Date or Date and Time SelectMode.
Syntax
TRIMedit.DateTime= [TRIMdateTime]
Page 154
Enabled
Returns/sets a value that determines whether an object can respond to usergenerated events.
Syntax
TRIMedit.Enabled= [Boolean]
Page 155
ExtraText
Returns/sets any extra text for use in tool tips (for example, if a TRIM record number
is displayed in the text area of the control, the extratext property could be set to
equal the title of the record. This would cause it to be displayed if the user hoved
the mouse over the control).
Syntax
TRIMedit.ExtraText = [String]
Page 156
ExtraTextInList
Returns/Sets a value that determines if any extra text is displayed as a tooltip on an
item in the dropdown list.
Syntax
TRIMedit.ExtraTextInList = [Boolean]
Page 157
FileFilter
Returns/Sets a value that determines which file types to filter for and how to display
the file type. This property is only used when SelectMode is set to InputFile or
OutputFile.
Syntax
TRIMedit.FileFilter = [String ]
Remarks
The expected format of the FileFilter string:
"Description of fileType (A) (B)|*.extensionA;*.extensionB|Description of file Type
(C) (D)|*.extensionC; *.extensionD|"
For a single file type:
"Description of the fileType|*.extension|"
Example: "Text Files (*.txt)|*.txt|"
Will add the line "Text Files (*.txt)" to the Files of Type area on the "File Open
Conrol" and the "Save As Control" and filter the file list area so that only files with
the extension .txt will be displayed.
For multiple file type support using the one line:
"Description of the fileTypes|*.extension;*.extension|"
between the extensions.
"Documents (*.txt) (*.doc)" - when this line is selected the file list area is
filtered so that only files with the extensions *.txt or *.doc will be displayed.
2.
"Web Documents (*.html) (*.htm)" - when this line is selected the file list area
is filtered so that only files with the extensions *.html or *.htm will be
displayed.
The line "All Files (*.*)" is always on the dropdown list so it does not need to be
added, it is the default value for the Files of Type field if the FileFilter property is left
blank. If there is a value in the FileFilter property it will be selected by default, if
there is more than one line the first line is selected by default. In the above example
"Documents (*.txt) (*.doc)" will be the default.
Page 158
Font
Returns/Sets the font used in the text area of the control.
Syntax
TRIMedit.Font = [stdole.IFontDisp]
Page 159
ForceSpellCheck
Returns/Sets the value that determines if a spelling check must be performed on the
string in the text area of the control. The spelling check does not happen
automaticaly, it is a flag for the programmer to use to indicate if the SpellCheck
method needs to be run befor the information is saved or the form is closed etc.
Syntax
TRIMedit.ForceSpellCheck = [Boolean]
Remarks
If the program requires that the user run the Spelling Check on the text in the
TRIMedit control the theory would be to set the flag to true at design time or on
load. If the user clicks the spell check button the program could catch the
BrowseSelected event and set the ForceSpellCheck property to false. Likewise if the
user changes the contents of the TRIMedit control the program could catch the
Change event and set ForceSpellCheck back to true. This property could then be
checked on the programs save or close function and the SpellCheck method called if
required.
Page 160
Page 161
HistoryKey
Returns/Sets the registry key that the TRIMedit control will store and retrieve its
history items from.
Syntax
TRIMedit.HistoryKey = [String ]
Remarks
The Historykey is always prefixed with "HKEY_CURRENT_USER\". This means that
you should NOT include "HKEY_CURRENT_USER\" in the HistoryKey you assign.
History items are loaded and saved to this registry key using the methods
LoadHistory and SaveHistory.
Example:
If you want the history items stored in the following registry key:
HKEY_CURRENT_USER\Software\My Cool Context SDK Appliction\TRIMedit History
Then you would set the HistoryKey property to "Software\My Cool Context SDK
Appliction\TRIMedit History".
Page 162
HistoryLimit
Returns/Sets the number of items that can be held in history. When this limit is
reached and an item is added to the history, the oldest history item will be dropped.
Syntax
TRIMedit.HistoryLimit = [Long]
Page 163
HistoryVisibleRows
Returns/Sets the number of history rows that are displayed on the dropdown list. To
get the total number of items in the dropdown list you would have to add the value
of this property to the value of the ItemsCount property.
Syntax
TRIMedit.HistoryVisibleRows = [Long ]
Page 164
HistoryWhenLocked
Returns/Sets a value that determines if a user can select an item on the dropdown
list even if the control is in a locked state.
Syntax
TRIMedit.HistoryWhenLocked= [Boolean]
Page 165
Page 166
Locked
Returns/Sets the locked state of the control. When the control is locked a user
cannot enter a value directly into the text area of the control. It may still be possible
to get a value into the text area of the control via the history drop down of the kwick
select button depending on the values of the HistoryWhenLocked and BrowseState
properties.
Syntax
TRIMedit.Locked = [Boolean]
Page 167
MaxLength
Returns/Sets the maximum characters that the user is allowed to enter in the text
area of the control.
Syntax
TRIMedit.MaxLength= [Long ]
Page 168
Modified
Returns/Sets a value that determines if the value in the text area of the control has
changed. This property is set to true by the control when a user changes the value
in the text area of the control. It is up to the programmer to set this value back to
False where appropriate.
Syntax
TRIMedit.Modified= [Boolean]
Remarks
This feature can be used to determine if a save is required when creating your own
record entry forms (for example, the values from a record saved in a TRIM Database
can be displayed in TRIMedit controls on a form or dialog and displayed to a user).
When the form or dialog is closed a quick iteration through the Modified property on
the TRIMedit controls can determine if the record needs to be updated and saved.
Page 169
MultiLine
Returns/Sets a value that determines if text in the text area of the control can span
more that a single line. If the text in the text area of the control does not fit in the
width of a control that has MultiLine set to true, the text will wrap automatically.
Syntax
TRIMedit.MultiLine= [Boolean]
Page 170
Name (ReadOnly)
Returns the name used in code to identify this control. The name property can only
be set at design time.
Syntax
TRIMedit.Name= [String ]
Page 171
Number
Returns/Sets a value that determines if all text is allowed in the text area of the
control or if the text is limited to numbers only. A control with this property set to
true will not allow non-digit characters to be entered in the text area.
Syntax
TRIMedit.Number= [Boolean]
Page 172
PassWord
Returns/Sets a value that determines if text entered in the text area of the control is
masked using the asterisk character.
Syntax
TRIMedit.PassWord= [Boolean]
Page 173
ScrollBars
Returns/Sets a value that determines which if any, scroll bars are displayed on the
control.
Syntax
TRIMedit.ScrollBars= [ksScrollMode]
Page 174
SelectMode
The key property of the control, returns/sets a value that determines what mode the
control is in. This in tern determines what the control look like, and its default
behavour as well as the relevants of other properties.
Syntax
TRIMedit.SelectMode= [ksSelectMode]
Remarks
See the first table in the TRIMedit section of this help file for a brief overview of the
different modes available to this control.
Page 175
SelectOnFocus
Returns/Sets a value that determines if the text in the text area of the control gets
selected when the control gets focus. If you want the contents of the control to be
selected when a user tabs to it, you would set this value to true.
Syntax
TRIMedit.SelectOnFocus= [Boolean]
Page 176
TabIndex
Returns/sets the tab order of an object within its parent form.
Syntax
TRIMedit.TabIndex= [Integer]
Page 177
TabStop
Returns/sets a value indicating whether a user can use the TAB key to give the focus
to this control.
Syntax
TRIMedit.TabStop= [Boolean]
Page 178
Tag
Returns/Sets a value that is at the programmers descretion. The primary function of
the tag property is to store any extra data needed for your program.
Syntax
TRIMedit.Tag= [String]
Page 179
Text
Returns/Sets the value displayed in the text area of the control.
Syntax
TRIMedit.Text = [String]
Remarks
If the control is set to Date and Time mode the Date and Time areas of the controlled
are joined using a pipe character "|" as a separator (for example, to put the enter
the value "24/01/2002" in the date area and "10:30:00 AM" in the time area the
string passed to the text property would be "24/01/2002|10:30:00 AM").
Page 180
ToolTips
Returns/Sets a value that determines if extra text will be displayed for this control as
a tooltip.
Syntax
TRIMedit.ToolTips = [Boolean]
Page 181
Uri
Returns/Sets a value that is the unique record identifier for the object or record
being displayed in the TRIMedit control. It is basically a property like Tag that the
programmer can use where they think appropriate.
Syntax
TRIMedit.Uri = [Variant]
Remarks
Generally when working with TRIM you will be working with TRIM Record objects or
TRIM Location objects. All of these objects are identifiable to TRIM by their Uri
property.
If for example you have a TRIMedit control in Browse mode that does a lookup for a
TRIM location when the Kwick select button is pressed. The user wants to select
"Orsen Carte" but there are two in this Database, they can tell from other location
information such as address which "Orsen Carte" they want so they select it.
The location name "Orsen Carte" is displayed in the text area of the control but you
the programmer need to keep a reference to the locations Uri in order for you to
know which "Orsen Carte" in the Database to update or attach as a contact to a
record etc.
The controls Uri property could be set to equal the Uri property of the location. The
reference to the TRIM location object could then be destroyed and recreated at any
stage using the TRIMSDK.Database.GetLocation method that accepts a Uri and
returns a TRIM location.
Page 182
Validated
Returns/Sets a value that determines the validation state of the control.
Syntax
TRIMedit.Validated= [ksEditValidMode]
Page 183
WantReturn
If true, allows carriage returns to be inserted upon pressing ENTER in a multiline
TRIMEdit Box.
If false, when the user presses ENTER, the dialog's default button will be clicked.
Syntax
TRIMedit.WantReturn= [Boolean]
Page 184
Methods
Name
Description
AddHistory
AddHistoryAt
AddHistoryAtEx
Adds an item to the history list including Uri and Exra text
at a specified index
AddHistoryEx
Adds an item to the history list including Uri and Exra text
AddItem
AddItemAt
AddItemAtEx
AddItemEx
EditCopy
EditCut
Copies the selected text value to the clipboard and sets the
selected text to a null string
EditDelete
EditPaste
EditUndo
FindInList
FindUriInList
Returns the index of the dropdown list item that has the
specified Uri
GetListAt
GetSel
GetUriAt
Returns the Uri of the dropdown list item that has the
specified index
LoadHistory
PressBrowse
RemoveHistory
Page 185
RemoveItem
ReplaceSel
ResetHistory
ResetItems
Clears any items from the dropdown list that are not history
items
SaveHistory
SetIcons
SetSel
SetupContents
SpellCheck
Verify
Page 186
AddHistory
Adds the nominated text as a history item for the control.
Syntax
TRIMedit.AddHistory (Text As String)
Parameters
Name
Type
Text
String
Default Description
The string to be added as a history item
Page 187
AddHistoryAt
Adds the nominated text as a history item for the control at the specified index.
Syntax
TRIMedit.AddHistoryAt (Text As String, index As Long)
Parameters
Name
Type
Default Description
Text
String
Index
Long
Page 188
AddHistoryAtEx
Adds the nominated text as a history item for the control at the specified index along
with a unique identifier and any extra text.
Syntax
TRIMedit.AddHistoryAtEx (Text As String, index As Long, Uri, ExtraText As String)
Parameters
Name
Type
Text
String
Index
Long
Uri
Variant
ExtraText String
Default Description
Page 189
AddHistoryEx
Adds the nominated text as a history item for the control along with a unique
identifier and any extra text. Recommended when dealing with TRIM objects in the
control. The item gets added to the top of the history list.
Syntax
TRIMedit.AddHistoryEx (Text As String, Uri, ExtraText As String)
Parameters
Name
Type
Text
String
Uri
Variant
ExtraText String
Default Description
Page 190
AddItem
Adds the nominated text as an item to the dropdown list for the control. Using
AddItem will not affect the history items (for example, you would use it to add
default items to the dropdown list that will be displayed regardless of the history).
Syntax
TRIMedit.AddItem (Text As String)
Parameters
Name
Type
Text
String
Default Description
The string to be added as an item to the
dropdown list
Page 191
AddItemAt
Adds the nominated text as an item to the dropdown list for the control at the
specified index. Using AddItemAt will not affect the history items (for example, you
would use it to add default items to the dropdown list that will be displayed
regardless of the history).
Syntax
TRIMedit.AddItemAt (Text As String, index As Long)
Parameters
Name
Type
Default Description
Text
String
Index
Long
Page 192
AddItemAtEx
Adds the nominated text as an item to the dropdown list for the control at the
specified index along with a unique identifier and any extra text. Using AddItemAtEx
will not affect the history items (for example, you would use it to add default items
to the dropdown list that will be displayed regardless of the history).
Syntax
TRIMedit.AddItemAtEx (Text As String, index As Long, Uri, ExtraText As String)
Parameters
Name
Type
Default Description
Filename
String
Index
Long
Uri
Variant
ExtraText
String
Page 193
AddItemEx
Adds the nominated text as an item to the dropdown list for the control along with a
unique identifier and any extra text. Using AddItemEx will not affect the history
items (for example, you would use it to add default items to the dropdown list that
will be displayed regardless of the history).
Syntax
[Boolean] =TRIMedit.AddItemEx (Text As String, Uri, ExtraText As String)
Parameters
Name
Type
Filename
String
Uri
Variant
ExtraText String
Default Description
Page 194
EditCopy
Copy the value of any selected text to the clipboard.
Syntax
TRIMedit.EditCopy ()
Page 195
EditCut
Copies the value of the selected text to the clipboard and sets the value of the
selected text to a null string.
Syntax
TRIMedit.EditCut ()
Page 196
EditDelete
Sets the value of the selected text to a null string.
Syntax
TRIMedit.EditDelete ()
Page 197
EditPaste
Sets the value of the selected text to a the string held in the clipboard, updating the
text area of the control.
Syntax
TRIMedit.EditPaste ()
Page 198
EditUndo
Undoes the last command performed in the text area. Depends on the CanUndo
property being set to True.
Syntax
TRIMedit.EditUndo ()
Page 199
FindInList
Finds the nominated text in the dropdown list. It must be an exact match of the
string in the dropdown list. It returns the index of the list item where the fist find
occurs. You might use this to ensure you did not add the same value to the list more
than once.
Syntax
[Long] =TRIMedit.FindInList (Text As String)
Parameters
Name
Type
Text
String
Default Description
The string to find in the dropdown list
Return Value
Type
Description
Long
Page 200
FindUriInList
Recommended when using TRIM objects. Finds the first occurance of the nominated
uri and returns the index of the list item. The issue with some TRIM objects (for
example, locations is that you can have more than one with the same name). To see
if a location already exists on the list you can use the FindUriInList method.
Syntax
[Long] =TRIMedit.FindUriInList (Uri As Variant)
Parameters
Name
Type
Uri
Variant
Default Description
The Uri to look for in the list items
Return Value
Type
Description
Long
Page 201
GetListAt
Returns the value in the dropdown list at the specified index.
Syntax
[String] =TRIMedit.GetListAt (index as Long)
Parameters
Name
Type
index
Long
Default Description
Index of the list item you want returned
Return Value
Type
Description
String
Page 202
GetSel
Returns the start and end positions of the selection. You need to pass in two
variables of the correct type to use this method. The method will set the passed in
variables to the position of the start and end characters in the selection. If nothing
is selected both values will return 0.
Syntax
TRIMedit.GetSel (startChar As Long, endChar As Long)
Parameters
Name
Type
Default Description
StartChar
EndChar
Page 203
GetUriAt
Returns the Uri of the nominated dropdown list item.
Syntax
[Variant] =TRIMedit.GetUriAt (index As Long)
Parameters
Name
Type
index
Long
Default Description
The index of the list item where you want
the Uri
Return Value
Type
Description
Variant
Page 204
LoadHistory
Loads the history items stored in the registry for this control and adds them to the
dropdown list. It relies on the HistoryKey property having a valid value and that the
SaveHistory method has been called when the control has had some history items.
Syntax
TRIMedit.LoadHistory ()
Page 205
PressBrowse
This will do the same as if the user had pressed the kwikselect themselves.
! Note: Nothing happens if the kwikselect is disabled.
Syntax
TRIMedit.PressBrowse ()
Page 206
RemoveHistory
Removes the history item at the specified index.
Syntax
[Boolean] = TRIMedit.RemoveHistory (index As Long)
Parameters
Name
Type
Index
Long
Default Description
Index of the history item to remove
Return Value
Type
Description
Boolean
Page 207
RemoveItem
Removes the specified item from the dropdown list.
Syntax
[Boolean] =TRIMedit.RemoveItem (index As Long)
Parameters
Name
Type
index
Long
Default Description
Index of the dropdown item to remove
Return Value
Type
Description
Boolean
Page 208
ReplaceSel
Replaces the selected text with the text specified and theis command can be set so
that using EditUndo will reverse it.
Syntax
TRIMedit.ReplaceSel (replaceStr As String, CanUndo As Boolean)
Parameters
Name
Type
Default Description
ReplaceStr
String
CanUndo
Boolean
Page 209
ResetHistory
Clears the history for this control. It is the same as doing a RemoveHistory on each
of the history items.
Syntax
TRIMedit.ResetHistory ()
Page 210
ResetItems
Clears the dropdown list of any non history items. It is the same as doing a
RemoveItem on each of the items in the dropdown list.
Syntax
TRIMedit.ResetItems ()
Page 211
SaveHistory
Saves the control's current history items to the registry at the key specified in the
HistoryKey property.
Syntax
TRIMedit.SaveHistory ()
Page 212
SetIcons
Internal use only.
Syntax
[Boolean] =TRIMedit.SetIcons (smallIcon, bigIcon)
Parameters
Name
Type
Default Description
smallIcon
bigIcon
Return Value
Type
Description
Boolean
Page 213
SetSel
Selects text using the start and end positions specified.
Syntax
[Boolean] =TRIMedit.SetSel (startChar As Long, endChar As Long)
Parameters
Name
Type
Default Description
startChar
Long
endChar
Long
Page 214
SetupContents
Sets up the contents of the TRIMedit control to save using a number of different
properties such as Text and Uri. It also has the advantage of being able to set the
valid mode, which you can use to bypass any validation (If you are loading the
TRIMedit control with a value that you know is valid you can set the control to a valid
state.
Syntax
TRIMedit.SetupContents (Text As String, ExtraText As String, Uri, Validated As
ksEditValidMode, Modified As Boolean)
Parameters
Name
Type
Default Description
Text
String
ExtraText
String
Uri
Variant
Validated
ksEditValidMode
Modified
Boolean
Page 215
SpellCheck
Runs the TRIM spelling checker against the contents of the text area.
Syntax
TRIMedit.SpellCheck ()
Page 216
Verify
Does any verification it can internal to the control such as checking that a date is
valid when in date or datetime mode. It will then fire the controls Verify event.
Syntax
[Boolean] =TRIMedit.Verify (displayError As Boolean, forceVerify As Boolean)
Parameters
Name
Type
Default Description
displayError
Boolean
forceVerify
Boolean
***UNDER CONSTRUCTION***
Return Value
Type
Description
Boolean
Page 217
Events
Name
Description
Browse
BrowseSelected
Change
HistoryDelAllowed
HistoryDelDone
HistorySelected
IdleTimeout
LoadHistory
Occurs when the History items for the control are loaded from
the registry
SaveHistory
Occurs when the the History items for the control are saved to
the registry
SelChange
ValidChanged
Verify
Page 218
Browse
Occurs if the controls SelectMode property is set to either ksBrowse or ksFormat and
the kwick select button is clicked.
Syntax
TRIMedit_Browse (reserved As Boolean)
Parameters
Name
Type
Reserved
Boolean
Default Description
Reserved for future use
Page 219
BrowseSelected
Occurs when control is returned to the TRIMedit control from a constituent control.
This event might be used to do extra validation on the information returned by a
constituent control (for example, if the controls SelectMode property is set to ksDate,
the date the user has selected might be tested to ensure that it falls within a
particular range required by the application).
Syntax
TRIMedit_BrowseSelected ()
Page 220
Change
Similar to the Change event on a Visual Basic Textbox, the event occurs when the
contents of the text area is changed.
Syntax
TRIMedit_Change ()
Page 221
HistoryDelAllowed
Occurs if the controls Delete key (Del on some keyboards) is pressed while the
dropdown list is down with a user highlighting one of the items on the list. It does
not matter if the item is a history item or just an item added to the list. This event is
used to allow users to remove items from the dropdown list. The removal of the list
item is handeled at the end of the event if you set the allowed parameter to true. If
the allowed parameter is set to true and the confirm parameter is also true at the
end of the event then a confermation dialog will be displayed and the item deleted or
removed only is the user agrees. If the item is a history item that has been saved,
the history item will be cleaned up much like using the RemoveHistory method.
Syntax
TRIMedit_HistoryDelAllowed (index As Long, allowed As Boolean, confirm As Boolean)
Parameters
Name
Type
Default Description
Index
Long
Allowed
Boolean
False
Confirm
Boolean
True
Page 222
HistoryDelDone
Occurs if the controls HistoryDelAllowed event has finished with a result where the
item has been deleted or removed from the list. This event can be used if
information regarding the item in the drop down list is stored in a location other than
the controls History Key and further cleanup is required by your application.
Syntax
TRIMedit_HistoryDelDone (index As Long, Uri, Text As String)
Parameters
Name
Type
Index
Long
Uri
Variant
Text
String
Default Description
The list index the item used to have before it
was deleted
0
Page 223
HistorySelected
Occurs if an item on the dropdown list has been selected by the user.
Syntax
TRIMedit_HistorySelected ()
Page 224
IdleTimeout
***UNDER CONSTRUCTION***
Occurs each time the user has had no interaction with the control for a time period.
This event can be used to do some extra validation on the contents of the control.
Syntax
TRIMedit_IdleTimeout ()
Page 225
LoadHistory
Occurs when the history items for the control are loaded from the registry. This
event can be used to add other default items to the controls dropdown list.
Syntax
TRIMedit_LoadHistory ()
Page 226
SaveHistory
Occurs when the history items are saved to the registry. This event can be used to
save other non-history items in the controls dropdown list.
Syntax
TRIMedit_SaveHistory ()
Page 227
SelChange
Occurs if a different item on the dropdownlist has been selected.
Syntax
TRIMedit_SelChange ()
Page 228
ValidChanged
Occurs if the value of the controls Validated property has changed.
Syntax
TRIMedit_ValidChanged ()
Page 229
Verify
Occurs if the controls Verify method has been called. This event gives you the
opportunity to do any extra validation (on top of the validation native to the control
and its settings) and determine the new valid state of the control, the value of the
controls Validated property.
Syntax
TRIMedit_Verify (displayError As Boolean, newValidState As ksEditValidMode)
Parameters
Name
Type
DisplayError
Boolean
NewValidState ksEditValidMode
Default Description
Determines if a dialog is to be
displayed with any error information
The valid state of the control
Page 230
Page 231
Sample Code
Page 232
Add a TRIMtreeBox control to a Visual Basic form and ensure that the name of
the TRIMtreeBox control is TRIMtreeBox1
2.
Add two Visual Basic CommandButton controls to the form and ensure they are
named Command1 and Command2
3.
Size the Form and TRIMtreeBox Control so that it is wide enough to make
sense.
Form example:
4.
TRIM objects and the methods, properties and events used in this example;
Objects
TRIMOCXLib.TRIMtreeBox
TRIMSDK.Database
TRIMSDK.PropertyDefs
TRIMSDK.RecordSearch
TRIMSDK.Records
TRIMSDK.Record
Methods
TRIMtreeBox
AddManyColumns
AddManyRows
GetFirstRow
GetNextRow
Page 233
Database
NewRecordSearch
MakeRecords
GetRecord
PropertyDefs
SelectTreeColumns
GetTreeInitString
RecordSearch
EditQueryUI
GetRecords
Records
SelectContentsOf
GetTreeString
SelectByUris
DisplayUI
Properties
TRIMtreeBox
Message
AnyTagged
CurrentRow
Records
Count
Record
IsContainer
Events
TRIMtreeBox
AboutToExpand
In the forms code area copy and paste the following code;
Visual Basic Example
Option Explicit
'// Modular level (m_)
Private m_TRIMDatabase As TRIMSDK.Database
Private m_PropertyDefs As TRIMSDK.PropertyDefs
Private Sub Command1_Click()
'// Clicking the Command1 button causes a TRIM search dialog to be displayed. Any
records returned by the search are listed in the TRIMtreeBox.
'// Procedural level variables (p_)
Dim p_RecordSearch As TRIMSDK.RecordSearch
Dim p_Records As TRIMSDK.Records
Page 234
Dim p_blnClickedOK
Set m_TRIMDatabase
'/// This bit gets
'// Instantiate a
Set p_RecordSearch
dialog.
button
As Boolean
= New TRIMSDK.Database
some TRIM Records that will be listed in the TRIMtreeBox control.
new Record Search object.
= m_TRIMDatabase.NewRecordSearch
'// Use the EditQueryUI method of the search object to '//display the TRIM search
This method returns a boolean that indicates if the user clicked the OK or cancel
p_blnClickedOK = p_RecordSearch.EditQueryUI(Me.hWnd)
If p_blnClickedOK = True Then
'// User clicked the OK button so the search is done.
returned by the search in to the TRIM Records object
Set p_Records = p_RecordSearch.GetRecords
Else
'/// User clicked the cancel button
Exit Sub
End If
'/// This bit gets just the default TreeColumns for a TRIM Record object into the
TRIMtreeBox control
'/// Get the default columns for TRIM Records
'// Instantiate the Property Definitions object
Set m_PropertyDefs = New TRIMSDK.PropertyDefs
'/// Use the SelectTreeColumns method to get the default property '/// definitions.
'/// To be used as column headers in a TRIMtreeBox
m_PropertyDefs.SelectTreeColumns btyRecord, True
'/// Add the names of the default property definitions as column '/// headers to the
TRIMtreeBox
TRIMtreeBox1.AddManyColumns m_PropertyDefs.GetTreeInitString(m_TRIMDatabase,
False)
'/// Add the values of the default record properties to the
'/// TRIMtreeBox for the records returned by the search
If p_Records.Count > 0 Then
TRIMtreeBox1.Message = vbNullString
TRIMtreeBox1.AddManyRows p_Records.GetTreeString(m_PropertyDefs)
Else
'// If no records were found add an appropriate comment to the Edit box
TRIMtreeBox1.Message = "No Records found."
End If
End Sub
Private Sub Command2_Click()
'/// Clicking the Command2 button shows how the Tagged rows in a TRIMtreebox can be used
to retrieve the associated objects from TRIM. In this example the records represented by any
tagged rows are simply retrieved and displayed but from this you can see how you might
iterate through any tagged times performing the same function. Eg. You might set the assignee
location on all the tagged records to a location selected by the user, Etc.
'//
Dim
Dim
Dim
Dim
p_intUriCntr = -1
'// Check to see that there are some tagged rows
If TRIMtreeBox1.AnyTagged Then
'// Get the first row, indicating that we are referring to tagged rows only.
From this point on GetNextRow will return the next tagged row
Set p_TRIMtreeRow = TRIMtreeBox1.GetFirstRow(True, False)
'// Loop until we have all the rows
Do While Not p_TRIMtreeRow Is Nothing
p_intUriCntr = p_intUriCntr + 1
ReDim Preserve p_lngUriAr(p_intUriCntr)
Page 235
Get the tagged records from the Database and display them
Instantiate a new Records
p_Records = m_TRIMDatabase.MakeRecords
Fill the Records object using the array of uris retrieved from the
TRIMtreeBox.
p_Records.SelectByUris p_lngUriAr
'// Display the records in a TRIM Records dialog
p_Records.DisplayUI Me.hWnd
End If
End Sub
'/// The TRIMtreeBox1_AboutToExpand event occurs when a user clicks the plus box on a
TRIMtreeBox Row
Private Sub TRIMtreeBox1_AboutToExpand(ByVal Row As TRIMOCXLib.TRIMtreeRow)
'// Procedural level variables (p_)
Dim p_Record As TRIMSDK.Record
Dim p_Records As TRIMSDK.Records
'// If the row has ever been expanded nothin needs to be done...
If Row.EverExpanded = False Then
'// Get the record from the Database object based on the uri stored in the
TRIMtreeBox.
Set p_Record = m_TRIMDatabase.GetRecord(Row.Uri)
'// Check that the record is a container
If p_Record.IsContainer Then
'// Instantiate a new Records object
Set p_Records = m_TRIMDatabase.MakeRecords
'// Fill the Records object with any records that are contained within
the selected record
p_Records.SelectContentsOf p_Record
If p_Records.Count > 0 Then
'// If there were some contained records then add them to the
current row
Row.AddManyRows(p_Records.GetTreeString(m_PropertyDefs)
End If
End If
End If
End Sub
Page 236
Add a TRIMtreeBox control to a C# form and ensure that the name of the
TRIMtreeBox control is axTRIMtreeBox1
2.
Add two Button controls to the form and ensure they are named Button1 and
Button2
3.
Size the Form and TRIMtreeBox Control so that it is wide enough to make
sense.
Form example:
4.
TRIM objects and the methods, properties and events used in this example;
Objects
TRIMOCXLib.TRIMtreeBox
TRIMSDK.Database
TRIMSDK.PropertyDefs
TRIMSDK.RecordSearch
TRIMSDK.Records
TRIMSDK.Record
Methods
TRIMtreeBox
AddManyColumns
AddManyRows
GetFirstRow
GetNextRow
Page 237
Database
NewRecordSearch
MakeRecords
GetRecord
PropertyDefs
SelectTreeColumns
GetTreeInitString
RecordSearch
EditQueryUI
GetRecords
Records
SelectContentsOf
GetTreeString
SelectByUris
DisplayUI
Properties
TRIMtreeBox
Message
AnyTagged
CurrentRow
Records
Count
Record
IsContainer
Events
TRIMtreeBox
AboutToExpand
In the forms code area copy and paste the following code;
C# Example
// Modular level (m_)
private TRIMSDK.Database m_TRIMDatabase = null;
private TRIMSDK.PropertyDefs m_PropertyDefs = null;
private string [] m_UrisReceived = null;
private TRIMSDK.RecordSearch m_RecordSearch = null;
private void button1_Click(object sender, System.EventArgs e)
{
// Any records returned by the search are listed in the TRIMtreeBox
bool p_blnClickedOK;
m_TRIMDatabase = new TRIMSDK.Database();
Page 238
// This bit gets some TRIM Records that will be listed in the TRIMtreeBox control
// Instantiate a new Record Search object
m_RecordSearch = m_TRIMDatabase.NewRecordSearch();
// Use the EditQueryUI method of the search object to display the TRIM search dialog.
This method returns a boolean that indicates if the user clicked the OK or cancel button
p_blnClickedOK = m_RecordSearch.EditQueryUI(Handle.ToInt32());
if (p_blnClickedOK == false) return; // User clicked cancel.
// This bit gets just the default TreeColumns for a TRIM Record object into the
TRIMtreeBox control
// Instantiate the Property Definitions object
m_PropertyDefs = new TRIMSDK.PropertyDefs();
// Use the SelectTreeColumns method to all property definitions possible for use as tree
columns to be used as column headers in a TRIMtreeBox
m_PropertyDefs.SelectTreeColumns (TRIMSDK.btyBaseObjectTypes.btyRecord, false);
// Add the names of the default property definitions as column headers to the
TRIMtreeBox
axTRIMtreeBox1.AddManyColumns (m_PropertyDefs.GetTreeInitString (m_TRIMDatabase,
false));
// Dim the Uris received array to 0
m_UrisReceived = new string[0];
axTRIMtreeBox1.Message = null;
// Set the Full property of the TRIMtreeBox control to False. The control will then
test to see if there is any room for more rows which is obviously true initially because it is
empty. This in turn will cause the RoomForRows event to fire starting the process of the
bouncing list...
axTRIMtreeBox1.Full = false;
}
// The TRIMtreeBox1_AboutToExpand event occurs whrn a user clicks the plus box on a TRIMtreeBox
Row
private void TRIMtreeBox1_AboutToExpand (TRIMOCXLib.TRIMtreeRowClass Row)
{
// If the row has ever been expanded nothing needs to be done...
if (Row.EverExpanded == false)
{
// Get the record from the Database object based on the uri stored in the
TRIMtreeBox
TRIMSDK.Record p_Record = m_TRIMDatabase.GetRecord(Row.Uri);
// Check that the record is a container
if (p_Record.IsContainer)
{
// Instantiate a new Records object
TRIMSDK.Records p_Records = m_TRIMDatabase.MakeRecords();
// Fill the Records object with any records that are contained within the
selected record
p_Records.SelectContentsOf(p_Record);
if (p_Records.Count > 0)
{
// If there were some contained records then add them to the
current row...
string defA = "0";
bool defB = false;
Row.AddManyRows (p_Records.GetTreeString(m_PropertyDefs,
false,
-1,
out defA,
out defB));
}
}
}
}
private void axTRIMtreeBox1_RoomForRows(object sender,
AxTRIMOCXLib.ITRIMtreeBoxEvents_RoomForRowsEvent e)
{
// The "Count" parameter passed in is the number of rows required to enable a Page Down
to function. That is the number of rows required to refil the visable area. If performance is
an issue then count can be used in the GetTreeString method as is done in this example.
However you can use any number that may be more apporpriate. Eg. '50' will return 50 rows and
this event will not fire until the user has made it to within a display areas worth of rows.
Page 239
Page 240
Add a TRIMtreeBox control to a Visual Basic form so that the name of the
TRIMtreeBox control is TRIMtreeBox1
2.
Add a Visual Basic CommandButton control to the form and ensure it is named
Command1
3.
4.
Size the Form and TRIMtreeBox Control so that it wide enough to make sense.
Form example:
TRIM objects and the methods, properties and events used in this example;
Objects
TRIMOCXLib.TRIMtreeBox
TRIMSDK.Database
TRIMSDK.PropertyDefs
TRIMSDK.RecordSearch
TRIMSDK.Records
TRIMSDK.Record
Methods
TRIMtreeBox
AddManyColumns
AddManyRows
Database
NewRecordSearch
Page 241
MakeRecords
GetRecord
PropertyDefs
SelectTreeColumns
RecordSearch
ChooseManyUI
SelectContentsOf
GetTreeString
Properties
TRIMtreeBox
Message
Full
Record
IsContainer
Events
TRIMtreeBox
AboutToExpand
RoomForRows
In the forms code area copy and paste the following code;
Option Explicit
'// Modular level (m_)
Private m_TRIMDatabase As TRIMSDK.Database
Private m_PropertyDefs As TRIMSDK.PropertyDefs
Private m_UrisReceived()
As String
Private m_RecordSearch As TRIMSDK.RecordSearch
Private Sub Command1_Click()
'// Clicking the Command1 button causes a TRIM search dialog to be '// displayed. Any
records returned by the search are listed in the '// TRIMtreeBox
'// Procedural level variables (p_)
Dim p_blnClickedOK
As Boolean
Set m_TRIMDatabase = New TRIMSDK.Database
'/// This bit gets some TRIM Records that will be listed in the TRIMtreeBox control
'// Instantiate a new Record Search object
Set m_RecordSearch = m_TRIMDatabase.NewRecordSearch
'// Use the EditQueryUI method of the search object to display the TRIM search dialog
'// This method returns a boolean that indicates if the user clicked the OK or cancel
button
p_blnClickedOK = m_RecordSearch.EditQueryUI(Me.hWnd)
If p_blnClickedOK = False Then Exit Sub '///User clicked cancel
'/// This bit gets just the defult TreeColumns for a TRIM Record object into the
TRIMtreeBox control
'/// Get the default columns for TRIM Records
'// Instantiate the Property Definitions object
Set m_PropertyDefs = New TRIMSDK.PropertyDefs
'/// Use the SelectTreeColumns method to all property definitions possible for use as
tree columns
'/// to be used as column headers in a TRIMtreeBox
m_PropertyDefs.SelectTreeColumns btyRecord, False
Page 242
'/// Add the names of the default property definitions as column headers to the
TRIMtreeBox
TRIMtreeBox1.AddManyColumns
m_PropertyDefs.GetTreeInitString(m_TRIMDatabase,
False)
'// Dim the Uris received array to 0
ReDim m_UrisReceived(0)
TRIMtreeBox1.Message = vbNullString
'/// Set the Full property of the TRIMtreeBox control to False
'/// The control will then test to see if there is any room for more rows
'/// which is obvously true initially because it is empty
'/// this in turn will cause the RoomForRows event to fire starting the process of the
bouncing list...
TRIMtreeBox1.Full = False
End Sub
'/// The TRIMtreeBox1_AboutToExpand event occurs when a user clicks
'/// the plus box on a TRIMtreeBox Row
Private Sub TRIMtreeBox1_AboutToExpand(ByVal Row As TRIMOCXLib.TRIMtreeRow)
'// Procedural level variables (p_)
Dim p_Record As TRIMSDK.Record
Dim p_Records As TRIMSDK.Records
'// If the row has ever been expanded nothin needs to be done...
If Row.EverExpanded = False Then
'// Get the record from the Database object based on the uri stored in the
TRIMtreeBox
Set p_Record = m_TRIMDatabase.GetRecord(Row.Uri)
'// Check that the record is a container
If p_Record.IsContainer Then
'// Instantiate a new Records object
Set p_Records = m_TRIMDatabase.MakeRecords
'// Fill the Records object with any records that are contained within
the selected record
p_Records.SelectContentsOf p_Record
If p_Records.Count > 0 Then
'// If there were some contained records then add them to the current
row...
Row.AddManyRows p_Records.GetTreeString(m_PropertyDefs)
End If
End If
End If
End Sub
Private Sub TRIMtreeBox1_RoomForRows(ByVal Count As Long)
'// The "Count" parameter passed in is the number of rows required to enable a Page Down
to function. That is the number of rows required to refil the visable area.
If performance is an issue then count can be used in the GetTreeString method as is done in
this example.
However you can use any number that may be more apporpriate. Eg. '50' will return 50 rows and
this event will not fire until the user has made it to within a display areas worth of rows.
'// Procedural level variables (p_)
Dim p_strUrisReturned As String
Dim p_blnRecordListExausted As Boolean
'// Test the first element in the uri array to see if there is a value. If there is add
an "and not uris(uri array) clause to the search so we dont get the same records that are
already in the TRIMtreeBox.
If Len(m_UrisReceived(0)) > 0 Then
m_RecordSearch.AddUrisClause (m_UrisReceived)
m_RecordSearch.Not
m_RecordSearch.And
End If
'// Use the GetTreeString to Add only a certine number of rows "MaximunRowsToReturn" to
the TRIMtreeBox
TRIMtreeBox1.AddManyRows m_RecordSearch.GetRecords.GetTreeString(m_PropertyDefs,
False, Count, p_strUrisReturned, p_blnRecordListExausted)
'// Set the Full property true when there are no longer any rows to return. This removes
the "More To Go" Icon from at the right of the horizontal scrollbar and prevents this event
from firing
TRIMtreeBox1.Full = p_blnRecordListExausted
'// Reset the UriArray to those returned from the GetTreeString method
Erase m_UrisReceived
Page 243
Page 244
Properties
Name
Description
AllowExpandAll
AllowSort
AnyTagged
ColumnCount
ColumnsLocked
Count
CurrentRow
CurSel
DbId
Font
Full
Heading
IdealHeight
IdealWidth
Message
NumberTagged
PrefixPopup
RegKey
RowHeight
ScrollBars
Page 245
ShowCurSel
SnapLastColumn
TaggingMode
TagNewRows
ToolTips
TopSel
Page 246
AllowExpandAll
Returns/Sets a value that determines if rows in the treebox can be expanded in a
recursive fashion.
Syntax
TRIMtreeBox.AllowExpandAll = [Boolean]
Page 247
AllowSort
Returns/Sets a value that determines if rows in the treebox can be sorted based in
the values in a column.
Syntax
TRIMtreeBox.AllowSort = [Boolean]
Page 248
Page 249
Page 250
ColumnsLocked
When ColumnsLocked is TRUE, the columns cannot be resized, repositioned or
otherwise altered (although they can still be sorted by). The menu displayed by the
Right Mouse Button is also removed.
Syntax
[Boolean] = TRIMtreeBox.ColumnsLocked
Page 251
Page 252
Page 253
CurSel
Returns the index of the currently selected row or sets the current selected row by
the index.
Syntax
TRIMtreeBox.CurSel = [Long]
Page 254
DbId
For Internal use only.
Page 255
Font
Returns/Sets the font used to display text in the treebox.
Syntax
TRIMtreeBox. Font = [stdole.IFontDisp]
Page 256
Full
Returns/Sets a value that indicates if the treebox has loaded all of the available
rows.
Syntax
TRIMtreeBox. Full = [Boolean]
Page 257
Heading
Returns/Sets a value that determines if the column heading is used.
Syntax
TRIMtreeBox.ColumnCount = [Boolean]
Page 258
Page 259
Page 260
Message
Returns/Sets a string that is displayed in the list area of the control. When this value
is a null string the controls rows are displayed. If it contains any text, no rows are
displayed and the list area becomes like a text box where this message is displayed
(for example, if you are using this control to display the results of a search and the
search returned nothing, you could display an appropriate message to the user by
setting this property).
Syntax
TRIMtreeBox.Message = [String]
Page 261
Page 262
PrefixPopup
Returns/Sets a value that determines if a select by prefix dialog will be displayed if
the user starts typing while the treebox control has focus. The treebox will then
display the list with any rows where the sort column value starts with the entered
prefix. It is used as a quick way to jump to the desired row in a large list.
Syntax
TRIMtreeBox.PrefixPopup = [Boolean]
Page 263
RegKey
Returns/Sets the registry key value where the column state of the treebox will be
saved.
Syntax
TRIMtreeBox. RegKey = [String]
Remarks
The string, "HKEY_CURRENT_USER\" is always used to prefix the value of this
property. To save the the column state at the following registry key:
HKEY_CURRENT_USER\Software\My Cool Context SDK Appliction\TRIMtreeBox History
Page 264
Page 265
ScrollBars
Returns/Sets a value that determines if and which ScrollBars will be used by the
treebox control.
Syntax
TRIMtreeBox.ScrollBars= [ksScrollMode]
Page 266
SelectFirstRow
Returns/Sets a value that determines if the first row in the treebox will be selected
by default.
Syntax
TRIMtreeBox.SelectFirstRow= [Boolean]
Page 267
ShowCurSel
Returns/Sets a value that determines if the selected treebox row is highlighted.
Useful in situations where the user selecting a row does not make sense to your
application. If set to False, it can make it appear to the user that clicking on a row
does nothing.
Syntax
TRIMtreeBox.ShowCurSel= [Boolean]
Page 268
SnapLastColumn
Returns/Sets a value that indicates if the last column should be sized to end at the
end of the treebox. Useful when there is only one column in the treebox control,
when set to True the column width will be that of the treebox control making it
appear neat.
Syntax
TRIMtreeBox.SnapLastColumn = [Boolean]
Page 269
TaggingMode
Returns/Sets a value that determines if tagging is allowed.
Syntax
TRIMtreeBox.TaggingMode = [tbTagMode]
Page 270
TagNewRows
Returns/Sets a value that determines if rows added to the treebox control will be
tagged automatically. Generaly not used as it is set to true when the TagAll method
is called.
Syntax
TRIMtreeBox.TagNewRows = [Boolean]
Page 271
ToolTips
Returns/Sets a value that determines if tooltips will be active or not.
Syntax
TRIMtreeBox.ToolTips
= [Boolean]
Page 272
TopSel
Returns/Sets the index of the top most visable row in the treebox. This will usually
return "0" the first row in the list unless the user has scrolled down in which case you
get the index of the first row that is visable. Use this property and the CurSel
property in the TopSelChanged event to set the current row to be the top most
visable row.
Syntax
[Long] = TRIMtreeBox.TopSel
Sample:
Private Sub TRIMtreeBox_TopSelChanged()
TRIMtreeBox.CurSel = TRIMtreeBox.TopSel
End Sub
Page 273
Methods
Name
Description
AddColumn
AddColumnEx
AddManyColumns
AddManyRows
AddRow
AddRowEx
ClearColumns
ClearList
CollapseRow
CustomizeColumns
DeleteColumn
DeleteRow
ExpandRow
FindRow
FindRowEx
FindRowEx2
GetFirstColumn
GetFirstRow
GetNextColumn
GetNextRow
GetRow
GetRowRect
InsertRow
InsertRowEx
LoadColumnState
Page 274
registry
Move
SaveColumnState
SetFocus
ShowWhatsThis
SortColumn
SwapRows
TagAll
ZOrder
Page 275
AddColumn
Adds a column to the control. The column caption and width of the column are
specified.
Syntax
[TRIMtreeCol] = TRIMtreeBox.AddColumn (HeadingCaption As String, CharWidth As Long)
Parameters
Name
Type
Default Description
HeadingCaption
String
CharWidth
Long
Return Value
Type
Description
TRIMtreeCol
Page 276
AddColumnEx
Adds a column to the control. An expantion on the AddColumn method. The column
caption and width of the column are specified as well as a heading icon.
Syntax
[TRIMtreeCol] = TRIMtreeBox.AddColumnEx (HeadingCaption As String, HeadingIcon,
CharWidth As Long)
Parameters
Name
Type
Default Description
HeadingCaption
String
HeadingIcon
Variant
***UNDER CONSTRUCTION***
CharWidth
Long
Return Value
Type
Description
TRIMtreeCol
Page 277
AddManyColumns
Adds a multiple columns to the control. Provides an easy method of adding TRIM
columns to the control using the PropertyDefs.GetTreeInitString method to get a
string in the correct format to pass to this method. See the Remarks area below for
the required format of the string.
Syntax
[Long] = TRIMtreeBox.AddManyColumns (Text as String)
Parameters
Name
Type
Default Description
Text
String
Return Value
Type
Description
Long
Remarks
The Text parameter of this method requires a specially formatted string containing
TRIM tree box control column information delimited by semi colons.
Required format for the Text parameter:
ID|Caption|Width|VisibleState|IconID|Alignment|DisplayMode|IsDefault;NEXT Column
So Each column definition contains the following components delimited by the pipe
symbol (|):
Component
Description
ID
Caption
Width
VisibleState
1 = Visible, 2 = Invisible
IconID
Alignment
DisplayMode
IsDefault
Page 278
Sample Code
Page 279
AddManyRows
Adds multiple rows to the control. Provides an easy method of adding rows that
represent TRIM objects to the list area of the control. The GetTreeString method
found on most TRIM SDK collection objects returns a string in the correct format to
pass to this method. See the Remarks area below for the required format of the
string. An example code snipit is used to demonstrate how to set up a TRIMtreeBox
control with column headers and rows containing some basic record object
information.
Syntax
[Long] = TRIMtreeBox.AddManyRows (Text as String)
Parameters
Name
Type
Default Description
Text
String
Return Value
Type
Description
Long
Remarks
The Text parameter of this method requires a specially formatted string containing
TRIM tree row information delimited by semi colons.
The required format of this string is detailed in the IbaseObjects.GetTreeString
section of this help file.
! Note: Care should be taken to ensure that the rows cell contents information
should match that of the controls columns. If the GetTreeString method is to be
used then the PropertyDefs in the Properties Collection should be identical to
that used to get the column information via the GetTreeInitString method.
Sample Code
Page 280
AddRow
Adds a row to the control. The Row being added must match the columns in the
control. See Remarks, below for the format of the string that represents the row to
add.
Syntax
[TRIMtreeRow] = TRIMtreeBox.AddRow (Text As String)
Parameters
Name
Type
Text
String
Default Description
A string formatted as indicated in the
Remarks area below
Return Value
Type
Description
TRIMtreeRow
Remarks
The string required by the Text parameter will be in the following format;
CellContents(IconID^Text)|CellContents|Etc
See also:
AddManyRows
AddManyColumns
Page 281
AddRowEx
Adds a row to the control. The Row being added must match the columns in the
control. The Uri and Id can also be set along with an indication of wether the row
will have child row/s.
Syntax
[TRIMtreeRow] = TRIMtreeBox.AddRowEx (Text As String, Uri, MayHaveKids As Boolean, Id As
Long, Reserved As Boolean)
Parameters
Name
Type
Default Description
Text
String
Uri
Variant
MayHaveKids Boolean
Id
Long
Return Value
Type
Description
TRIMtreeRow
Page 282
ClearColumns
Clears the the TRIMtreeBox control. Columns and as a result any existing rows get
cleared by this method.
Syntax
TRIMtreeBox.ClearColumns ()
Page 283
ClearList
Clears any rows from the control. Columns are left intact by this method.
Syntax
TRIMtreeBox. ClearList ()
Page 284
CollapseRow
Causes the row to collapse if it is currently expanded to display any child rows. The
same method is used when a user clicks on a minus "-" box on an expanded row.
This is a way of doing the collapse via code.
Syntax
TRIMtreeBox. CollapseRow (Index As Long)
Parameters
Name
Type
Index
Long
Default Description
The index of the row in the TRIMtreeBox that
is to be to acted upon
Page 285
CustomizeColumns
Displays the Column Preferences dialog that enables users to configure a number of
things about how the columns in the TRIMtreeBox are displayed. An example of
some of the customisation that can be done via this dialog are which columns are
visible, the order of the columns and which columns display icons, text or both.
Syntax
TRIMtreeBox.CustomizeColumns ()
Page 286
DeleteColumn
Removes a column from the TRIMtreeBox.
***UNDER CONSTRUCTION***
Syntax
TRIMtreeBox.DeleteColumn (Column)
Parameters
Name
Type
Column
Variant
Default Description
Accepts either the column index OR a TRIMtreeCol
Page 287
DeleteRow
Removes a row from the control. The index of subsequent rows is moved up to fill
the gap. If the row has child rows these are also removed.
Syntax
TRIMtreeBox.DeleteRow (Index as Long)
Parameters
Name
Type
Index
Long
Default Description
The index of the row to be removed
Example
To remove the currently selected row the code would look something like this:
TRIMtreeBox1.DeleteRow TRIMtreeBox1.CurrentRow.index
Page 288
ExpandRow
Expands the row at the given index if it has child rows. Includes a recursive switch
to indicate if chid rows that also have chid rows are to be expanded also. The same
behavour is seen in this control if the user click on a plus "+" box on a row, though
only the next level will be expanded with no option fo this behavour to be recursive.
Syntax
TRIMtreeBox.ExpandRow (Index As Long, recursive As Boolean)
Parameters
Name
Type
Default Description
Index
Long
recursive
Boolean
Page 289
FindRow
Returns a TRIMtreeRow which matches the passed in search criteria. If a match is
found, then if supplied, foundInRow and foundInColldx will be set to the matching
row and column indexes. If no match is found, these values will be set to 1.
Syntax
[TRIMtreeRow] = TRIMtreeBox.FindRow (SearchString As String, LookInCol, CaseSensitive As
Boolean, PrefixSearch As Boolean, VisibleOnly As Boolean, FoundInRow As Long,
FoundInColIdx As Long)
Parameters
Name
Type
Default Description
SearchString
String
LookInCol
Variant
CaseSensitive Boolean
PrefixSearch
Boolean
VisibleOnly
Boolean
FoundInRow
Return Value
Type
Description
TRIMtreeRow
Page 290
FindRowEx
Returns a TRIMtreeRow which matches the passed in search criteria. If a match is
found, then if supplied, foundInRow will be set to the matching row index. If no
match is found, foundInRow will be set to 1.
Syntax
[TRIMtreeRow] = TRIMtreeBox.FindRowEx (SearchUri, AnId As Long, FoundInRow As Long)
Parameters
Name
Type
SearchUri
Variant
AnId
Long
FoundInRow Long
Default Description
Return Value
Type
Description
TRIMtreeRow
Page 291
FindRowEx2
Returns a TRIMtreeRow that matches the passed in search criteria. The search can
be started on the row after the last row that matched the search criteria. This
method would be used where the Uri and Id of the rows might not be unique and all
rows that match the search criteria should be found. If a match is found, then
foundInRow will be set to the matching row index. If no match is found, foundInRow
will be set to 1.
Syntax
[TRIMtreeRow] = TRIMtreeBox.FindRowEx2 (SearchUri, AnId As Long, FoundInRow As Long,
StartFromIndex As Long)
Parameters
Name
Type
SearchUri
Variant
AnId
Long
FoundInRow
StartFromIndex Long
Default Description
Return Value
Type
Description
TRIMtreeRow
Page 292
GetFirstColumn
Returns the first column starting from on the left side of the TRIMtreeBox control.
Syntax
[TRIMtreeCol] = TRIMtreeBox.GetFirstColumn ()
Return Value
Type
Description
TRIMtreeCol
See also:
GetNextColumn
Page 293
GetFirstRow
Returns the first row in the TRIMtreeBox control (The first tagged row depending on
the value set for the onlyTagged parameter) and sets up the iteration of the rows
(GetNextRow) to return all rows ao just the tagged rows.
Syntax
[TRIMtreeRow] = TRIMtreeBox.GetFirstRow (onlyTagged As Boolean, Reserved As Boolean)
Parameters
Name
Type
Default Description
OnlyTagged Boolean
Reserved
Boolean
Return Value
Type
Description
TRIMtreeRow
Remarks
Known limitation: It is not safe to modify the ID or URI of a TRIMtreeRow whilst
inside a GetFirstRow / GetNextRow loop if the onlyTagged parameter is set to true.
See also:
GetNextRow
Page 294
GetNextColumn
Returns the next column in the TRIMtreeBox control. Used after the GetFirstColumn
method has been called. The returned TRIMtreeCol object will be nothing if all of the
columns have been returned. GetFirstColumn is then required to reset the iteration
back to the beginning of the columns.
Syntax
[TRIMtreeCol] = TRIMtreeBox.GetNextColumn ()
Return Value
Type
Description
TRIMtreeCol
Example
To loop through all the columns in the TRIMtreeBox control the Visual Basic code
might look something like this:
Dim MyTRIMtreeCol As TRIMOCXLib.TRIMtreeCol
'// Get the first column
Set MyTRIMtreeCol = TRIMtreeBox1.GetFirstColumn
'// Loop until the returned column object is nothing
Do Until MyTRIMtreeCol Is Nothing
'// Perform an action on each column
MsgBox MyTRIMtreeCol.Caption
'// Get the next column
Set MyTRIMtreeCol = TRIMtreeBox1.GetNextColumn
Loop
Page 295
GetNextRow
Returns the next row or the next tagged row in the TRIMtreeBox control. Wherther
it gets just tagged or all rows is dependent on what was specified when the
GetFirrstRow method was called. The GetFirstRow method must be called prior to
callin this method. The returned TRIMtreeRow object will be nothing if all of the
rows have been returned. GetFirstRow is then required to reset the iteration back to
the beginning of the rows.
Syntax
[TRIMtreeRow] = TRIMtreeBox.GetNextRow ()
Return Value
Type
Description
TRIMtreeRow
Remarks
Known limitation: It is not safe to modify the ID or URI of a TRIMtreeRow whilst
inside a GetFirstRow / GetNextRow loop if the GetFirstRow onlyTagged parameter
was set to true.
Example
To loop through all the rows in the TRIMtreeBox control the Visual Basic code might
look something like this:
Dim MyTRIMtreeRow As TRIMOCXLib.TRIMtreeRow
'// Get the first Row
'// In this case the onlyTagged parameter is set to False to return all rows not just
the tagged ones)
Set MyTRIMtreeRow = TRIMtreeBox1.GetFirstRow(False, False)
'// Loop until the returned row object is nothing
Do Until MyTRIMtreeRow Is Nothing
'// Perform an action on each column
MsgBox MyTRIMtreeRow.index
'// Get the next row
Set MyTRIMtreeRow = TRIMtreeBox1.GetNextRow
Loop
Have a look at the Sample Code in the "Private Sub Command2_Click()" procedure
to see another example.
Page 296
GetRow
Returns the row in the TRIMtreeBox control with the specified index.
Syntax
[TRIMtreeRow] = TRIMtreeBox.GetRow (Index As Long)
Return Value
Type
Description
TRIMtreeRow
TRIMtreeRow object
Page 297
GetRowRect
Returns the first rectangle that is the boundary of the row.
Syntax
[Long] = TRIMtreeBox.GetFirstRow (RowIdx As Long, Left As Long, Top As Long, Right As
Long, Bottom As Long)
Parameters
Name
Type
Default Description
RowIdx
Long
Left
Top
Right
Bottom
Return Value
Type
Description
Long
***UNDER CONSTRUCTION***
Page 298
InsertRow
Inserts a row at the nominated index and returns the TRIMtreeRow object created.
Syntax
[TRIMtreeRow] = TRIMtreeBox.InsertRow (Index As Long, Text As String)
Parameters
Name
Type
Default Description
Index
Long
Text
String
Return Value
Type
Description
TRIMtreeRow
Remarks
The string required in the Text parameter needs to be in the following format;
CellContents(IconID^Text)|CellContents|Etc
See also:
InsertRowEx
Page 299
InsertRowEx
Inserts a row at the nominated index and returns the TRIMtreeRow object created.
It allows for the Uri and/or Id properties of the row to be set along with an indication
of whether the row may have child rows.
Syntax
[TRIMtreeRow] = TRIMtreeBox.InsertRowEx (Index As Long, Text As String, Uri, MayHaveKids
As Boolean, Id As Long, Reserved As Boolean)
Parameters
Name
Type
Default Description
Index
Long
Text
String
Uri
Variant
MayHaveKids Boolean
Id
Long
Reserved
Boolean
Return Value
Type
Description
TRIMtreeRow
Page 300
LoadColumnState
Loads a saved column state from the registry key stored in the RegKey property of
the TRIMtreeBox control. Once the column state is loaded it cannot be loaded again
during the lifetime of the control. It does not add columns to the control it merely
returns them to the last saved state. If the column state information saved does not
match the current columns in the control, nothing will happen and the return value
will be False.
Syntax
[Boolean] = TRIMtreeBox. LoadColumnState ()
Return Value
Type
Description
Boolean
Remarks
Columns must be added to the control before calling this method.
Page 301
SaveColumnState
Saves the current column state into the registry key stored in the RegKey property
of the TRIMtreeBox control.
Syntax
[Boolean] = TRIMtreeBox.SaveColumnState ()
Return Value
Type
Description
Boolean
Remarks
A possible reason for this method to fail might be inadequate permissions to the
system registry current user area.
Page 302
SortColumn
Sorts the rows in the TRIMtreeBox using the specified column and direction. This
method is dependent on the value of the property AllowSort being True.
Syntax
TRIMtreeBox.SortColumn (Column, ascending As Boolean, SortCurrentRows As Boolean)
Parameters
Name
Type
Column
Variant
Ascending
Boolean
SortCurrentRows Boolean
Default Description
***UNDER CONSTRUCTION***
Page 303
SwapRows
Swaps the position of two rows in the TRIMtreeBox. This fuction can be used to do
sorting outside the scope of the column sorting native to the control.
Syntax
TRIMtreeBox.SwapRows (Index1 As Long, Index2 As Long)
Parameters
Name
Type
Default Description
Index1
Long
Index2
Long
Remarks
To avoid concusion and unexpected results, ensure that the rows are collapsed
before using this method.
Page 304
TagAll
Tag or untag all rows in the TRIMtreeBox control depending on the specified tagged
state.
Syntax
TRIMtreeBox.TagAll (NewTagState As Boolean)
Parameters
Name
Type
NewTagState Boolean
Default Description
Determines if all rows will be tagged (True) or
untagged (False)
Remarks
Sets the TagNewRows property to the same as the NewTagState parameter. So if all
rows are tagged, any new rows added to the TRIMtreeBox will also be tagged. If all
rows have been untagged then any new rows added to the TRIMtreeBox are not
tagged.
Page 305
Events
Name
Description
AboutToExpand
AboutToSort
BreakTriggered
ColMadeVisible
ContextMenu
DelKeyPressed
FileDropped
***UNDER CONSTRUCTION***
LButtonClick
LButtonDblClick
MenuItemEnable
MenuItemSelected
OLEDragDrop
***UNDER CONSTRUCTION***
OLEDragOver
***UNDER CONSTRUCTION***
OLEStartDrag
***UNDER CONSTRUCTION***
PrefixOkForColumn
PrefixOutOfRange
RButtonClick
RButtonDblClick
RoomForRows
SelectionChanged
SortCompare
***UNDER CONSTRUCTION***
TagChanged
TimerTriggered
***UNDER CONSTRUCTION***
TopSelChanged
Page 306
AboutToExpand
Occurs if the plus "+" box has been clicked indicating that the row should be
expanded to display any child rows. Also occurs as a result of the ExpandRow
method.
Syntax
TRIMtreeBox_AboutToExpand (Row As TRIMtreeRow)
Parameters
Name
Type
Row
TRIMtreeRow
Default Description
The row which is about to expand
Remarks
This event can be used to test the current row to see if it has already been
expanded, and if not the appropriate caod can be executed to load in any child rows.
Check out the Code Sample "Private Sub TRIMtreeBox1_AboutToExpand" for an
example use of this event.
Page 307
AboutToSort
Occurs if a column header is clicked by the user indicating that they want to sort the
rows using the data in the selected column.
Syntax
TRIMtreeBox_AboutToSort (Col As TRIMtreeCol, ascending As Boolean, SortCurrentRows As
Boolean, Allow As Boolean)
Parameters
Name
Type
Default Description
Col
TRIMtreeCol
ascending
Boolean
SortCurrentRows Boolean
***UNDER CONSTRUCTION***
Allow
Boolean
Remarks
This event can be used enable the parent application code to do the sorting (using
the SwapRows method to get rows in the right order) rather than the controls
internal sorting. If the parent application did the sort the Allow parameter should be
set to False to prevent the controls internal search from being executed.
Page 308
BreakTriggered
Occurs if the user pressed the 'Break' key whilst doing a sort.
Syntax
TRIMtreeBox_ BreakTriggered ()
Page 309
ColMadeVisible
Occurs if a column is added to the Active Columns in the Column Preferences dialog
displayed using the CustomizeColumns method and OK is clicked. This event will
occur for each column made visable if more than one column is added to the Active
Columns list.
Syntax
TRIMtreeBox_ColMadeVisible (Col As TRIMtreeCol, CellNumber As Long)
Parameters
Name
Type
Default Description
Col
TRIMtreeCol
CellNumber
Long
Page 310
ContextMenu
Occurs if either the right mouse button is clicked on a row or if SHIFT + F10 was
used on the keyboard (Windows standards for context menues) while a row was
selected and the control had focus.
Syntax
TRIMtreeBox_ContextMenu (Row As TRIMtreeRow, WithMouse As Boolean)
Parameters
Name
Type
Default Description
Row
TRIMtreeRow
WithMouse
Boolean
Remarks
Generally, code to display a popup menu would be called as a result of this event.
The WithMouse property can be tested because if this event has occurred because of
keyboard input the location of the popup menu will need to be determined so that it
appears in the correct place.
Page 311
DelKeyPressed
Occurs if the Delete (Del) key is pressed while a row is selected and the control has
focus.
Syntax
TRIMtreeBox_DelKeyPressed (Row As TRIMtreeRow)
Parameters
Name
Type
Row
TRIMtreeRow
Default Description
The selected row
Remarks
This event can be used call code to remove the selected row if appropriate.
Page 312
FileDropped
Occurs if a or some files have been dropped onto a row in the control.
***UNDER CONSTRUCTION***
Syntax
TRIMtreeBox_FileDropped (OverRow As TRIMtreeRow, FileList As String, FileCount As Long)
Parameters
Name
Type
Row
TRIMtreeRow
Default Description
The selected row
Page 313
LButtonClick
Occurs if the left mouse button is clicked while on a row in the control.
Syntax
TRIMtreeBox_LButtonClick (Row As TRIMtreeRow)
Parameters
Name
Type
Row
TRIMtreeRow
Default Description
The row on which the left click occured
Page 314
LButtonDblClick
Occurs if the left mouse button is double clicked while on a row in the control.
Syntax
TRIMtreeBox_LButtonDblClick (Row As TRIMtreeRow)
Parameters
Name
Type
Row
TRIMtreeRow
Default Description
The row on which the left click occured
Page 315
MenuItemEnable
For Internal Use Only.
Syntax
TRIMtreeBox_MenuItemEnable (Id As Long, Handled As Boolean, ShouldEnable As Boolean)
Parameters
Name
Type
Default Description
Id
Long
Reserved
Handled
Boolean
Reserved
ShouldEnable Boolean
Reserved
Remarks
This event is reserved for internal use.
Page 316
MenuItemSelected
For Internal Use Only.
Syntax
TRIMtreeBox_MenuItemSelected (Id As Long, Handled As Boolean)
Parameters
Name
Type
Default Description
Id
Long
Reserved
Handled
Boolean
Reserved
ShouldEnable Boolean
Reserved
Remarks
This event is reserved for internal use.
Page 317
OLEDragDrop
***UNDER CONSTRUCTION***
Syntax
TRIMtreeBox_OLEDragDrop (OverRow As TRIMtreeRow, SrcUri, SrcType As Long, Effect As Long,
State As Long, X As Long, Y As Long)
Parameters
Name
Type
Default Description
OverRow
TRIMtreeRow
Reserved
SrcUri
Variant
Reserved
SrcType
Long
Reserved
Effect
Long
Reserved
State
Long
Reserved
Long
Reserved
Long
Reserved
Remarks
This event is reserved for future use.
Page 318
OLEDragOver
***UNDER CONSTRUCTION***
Syntax
TRIMtreeBox_OLEDragOver (OverRow As TRIMtreeRow, SrcUri, SrcType As Long, Effect As Long,
State As Long, X As Long, Y As Long)
Parameters
Name
Type
Default Description
OverRow
TRIMtreeRow
Reserved
SrcUri
Variant
Reserved
SrcType
Long
Reserved
Effect
Long
Reserved
State
Long
Reserved
Long
Reserved
Long
Reserved
Remarks
This event is reserved for future use.
Page 319
OLEStartDrag
***UNDER CONSTRUCTION***
Syntax
TRIMtreeBox_OLEStartDrag (DragRow As TRIMtreeRow, Effect As Long)
Parameters
Name
Type
Default Description
DragRow
TRIMtreeRow
Reserved
Effect
Long
Reserved
Remarks
This event is reserved for future use.
Page 320
PrefixOkForColumn
Occurs if the user starts typing while the control has focus. The prefix behavior can
jump to the row in which the sort column has a value that starts with the key
pressed. It can also display a dialog that enables the user to enter more than one
character to be used as the prefix. The behavior is determined by the value of the
parameters at the end of the event.
Prefix Search dialog:
Syntax
TRIMtreeBox_PrefixOkForColumn (PrefixCol As TRIMtreeCol, PrefixOK As Boolean,
PrefixReselectOK As Boolean)
Parameters
Name
Type
PrefixCol
TRIMtreeCol
PrefixOK
Boolean
PrefixReselectOK Boolean
Default Description
Remarks
This event can be used to enable the appropriate behavour depending on the current
sort column.
Page 321
PrefixOutOfRange
Occurs if the prefix search can find no matches, and user opts to reselect by a new
prefix. This allows the list to be repopulated based on a new prefix.
Syntax
TRIMtreeBox.PrefixOutOfRange (PrefixCol As TRIMtreeCol, Prefix As String)
Parameters
Name
Type
Default Description
PrefixCol
TRIMtreeCol
Prefix
String
Page 322
RButtonClick
Occurs if the right mouse button is clicked while on a row in the control.
Syntax
TRIMtreeBox_RButtonClick (Row As TRIMtreeRow)
Parameters
Name
Type
Row
TRIMtreeRow
Default Description
The row on which the left click occurred
Remarks
If you intend to use this event to display a context menu (right mouse button menu)
the ContextMenu event may be more appropriate as it occurs with the right mouse
button click and the Windows keyboard shortcut for context menus (SHIFT + F10).
Page 323
RButtonDblClick
Occurs if the right mouse button is double clicked while on a row in the control.
Syntax
TRIMtreeBox_ RButtonDblClick (Row As TRIMtreeRow)
Parameters
Name
Type
Row
TRIMtreeRow
Default Description
The row on which the left click occurred
Page 324
RoomForRows
Occurs if there is room in the control for more rows to be added and the Full
property is False. When filling the TRIMtreeBox control it can be advantageous to
return control to the user as soon as there are enough loaded rows to be useful and
only return to get more rows when the user has scrolled down, activating this event.
Syntax
TRIMtreeBox_ RoomForRows (Count As Long)
Parameters
Name
Type
Count
Long
Default Description
The number of rows available to be filled in the
control
Remarks
See the GetTreeString method which can be used to return a specified number of
rows.
See the Visual Basic Sample Code for an example of how to use this event to
advantage.
Page 325
SelectionChanged
Occurs if a different row is selected.
Syntax
TRIMtreeBox_SelectionChanged ()
Page 326
SortCompare
Occurs if the column's SortMode property is set to tbsmOwnerEvent. This enables
sort comparison to take place.
Syntax
TRIMtreeBox_SortCompare (Col As TRIMtreeCol, RowA As TRIMtreeRow, RowB As TRIMtreeRow,
AlessThanB As Boolean)
Parameters
Name
Type
Col
TRIMtreeCol
RowA
TRIMtreeRow
RowB
TRIMtreeRow
AlessThanB Boolean
Default Description
Page 327
TagChanged
Occurs if the tagged state of a row is changed.
Syntax
TRIMtreeBox_TagChanged (Row As TRIMtreeRow)
Parameters
Name
Type
Row
TRIMtreeRow
Default Description
The row whose tagged state has changed
Page 328
TimerTriggered
For Internal Use Only.
Syntax
TRIMtreeBox_TimerTriggered (Id as Long)
Parameters
Name
Type
Id
Long
Default Description
Reserved.
Remarks
This event is reserved for internal use.
Page 329
TopSelChanged
Occurs if the visible top row changes, usually caused by the user scrolling up or
down in the TRIMtreeBox control.
Syntax
TRIMtreeBox_TopSelChanged ()
Page 330
Used By
TRIMdateTime
TRIMedit
TRIMfavorites
Reserved
TRIMtreeCol
TRIMtreeBox
TRIMtreeRow
TRIMtreeBox
Page 331
TRIMdateTime
Used by the TRIMedit control when in date or date time mode, the TRIMdateTime
object provide an interface to the individual properties of a datetime that can be
relevant to the TRIMedit control.
Page 332
Properties
Name
``
CannedDate
Date
***UNDER CONSTRUCTION***
DateHi
***UNDER CONSTRUCTION***
IgnoreDate
IgnoreTime
Page 333
CannedDate
Returns/Sets the canned date value of the TRIMdateTime.
Syntax
TRIMdateTime.CannedDate= [dtCannedDate]
Page 334
Date
Returns/Sets the date value of the TRIMdateTime.
Syntax
TRIMdateTime.Date = [Date]
Page 335
DateHi
Returns/Sets.
***UNDER CONSTRUCTION***
Syntax
TRIMdateTime.DateHi = [Date]
Page 336
IgnoreDate
Returns/Sets a switch on the TRIMdateTime to ignore the Date component of a
DateTime. This enables the TRIMdateTime to be a used to set and return time
values.
Syntax
TRIMdateTime. IgnoreDate = [Boolean ]
Page 337
IgnoreTime
Returns/Sets a switch on the TRIMdateTime to ignore the Time component of a
DateTime. This enables the TRIMdateTime to be a used to set and return date
values.
Syntax
TRIMdateTime. IgnoreTime = [Boolean]
Page 338
TRIMfavorites
Reserved. This object class is not currently in use.
Page 339
TRIMtreeCol
The TRIMtreeCol object represents a column in the TRIMtreeBox control. It is used
to hold information about a particular column of the TRIMtreeBox control and can be
passed to some TRIMtreeRow methods that require a cell or column identifier.
Page 340
Properties
Name
``
Alignment
Caption
CharWidth
DisplayMode
Ellipsis
Id
Index
IsDefault
Sizeable
SortMode
SortState
Visible
VisibleMode
Width
Page 341
Alignment
Returns/Sets a value that determines if the text in this column is left aligned, right
aligned or centred in the column.
Syntax
TRIMtreeCol.Alignment = [tbAlignmentMode]
Page 342
Caption
Returns/Sets the text to display as the column header. The caption is only displayed
if the TRIMtreeBox.Heading property is set to True (Its default state).
Syntax
TRIMtreeCol.Caption= [String]
Page 343
CharWidth
Returns/Sets the width of the column in characters.
Syntax
TRIMtreeCol.CharWidth = [Long]
Page 344
DisplayMode
Returns/Sets a value that determines if the column will display Icons, Text or both.
Syntax
TRIMtreeCol.DisplayMode = [tbDisplayMode]
Page 345
Ellipsis
Returns/Sets a value that determines if ellipsis () will be displayed if the text in a
column does not all fit.
Syntax
TRIMtreeCol.Ellipsis = [tbEllipsisMode]
Page 346
Id
Returns/Sets a value that is used as an identifier for the column. This could be set
to the property Id of the property being displayed in this column.
Syntax
TRIMtreeCol.Alignment = [String]
Page 347
Page 348
IsDefault
Returns/Sets a value that determines the default status of the column. Only one
column in a TRIMtreeBox can be the default. Setting this to true on a column sets
the same property to false on all other columns available to the TRIMtreeBox. Being
the default column means that any sorting that is done is carried out on the values in
this column. The user at runtime can change the value of this property by clicking
on a column header.
Syntax
TRIMtreeCol.IsDefault = [Boolean]
Page 349
Sizeable
Returns/Sets a value that determines if the columns width can be customized at
runtime.
Syntax
TRIMtreeCol.Alignment = [tbAlignmentMode]
Page 350
SortMode
Returns/Sets a value that determines the type of sorting that is applied to this
column. Setting this property to have a value of tbsmOwnerEvent will cause the
TRIMtreeBox_ SortCompare event to fire which in turn can be caught and some
customized sorting code executed.
Syntax
TRIMtreeCol.SortMode= [tbSortMode]
Page 351
SortState
Returns/Sets a value that determines if the column is sorted in ascending or
descending order or if in fact it is sorted at all.
Syntax
TRIMtreeCol.SortState = [tbSortState]
Page 352
Visible
Returns/Sets a value that determines if the column is displayed.
Syntax
TRIMtreeCol.Visible = [Boolean]
Page 353
VisibleMode
Returns/Sets a value that determines if the column is hidden from the user
completely, must be displayed in the TRIMtreeBox (cannot be removed from the
active list by the user when customizing columns) or is not hidden from the user nor
is it mandatory for it to be displayed.
Syntax
TRIMtreeCol.VisibleMode = [tbVisibleMode]
Page 354
Page 355
Methods
Name
``
SetIcon
Page 356
SetIcon
Sets the Icon to be used in this column.
Syntax
[Boolean] = TRIMtreeCol. SetIcon (Icon)
Parameters
Name
Type
Icon
Variant
Default Description
***UNDER CONSTRUCTION***
Return Value
Type
Description
Boolean
Page 357
TRIMtreeRow
The TRIMtreeRow object represents a row in the TRIMtreeBox control. It is used to
hold row information and provides a way of manipulating details of a row.
TRIMtreeRows may have child rows and it is through a TRIMtreeRow object that
access to the child rows can be found.
Page 358
Properties
Name
``
AutoRedraw
Bold
Enabled
EverExpanded
Expanded
ExpandLocked
Id
Index
MayHaveKids
RowText
Tagged
TagStateLocked
Uri
Visible
Page 359
AutoRedraw
Returns/Sets a value that determines if auto redrewar is enabled.
Syntax
TRIMtreeRow.AutoRedraw = [Boolean]
Page 360
Bold
Returns/Sets a value that determines if the font appears bold in the row.
Syntax
TRIMtreeRow.Bold = [Boolean]
Page 361
Enabled
Returns/Sets a value that determines if the row is enabled.
Syntax
TRIMtreeRow.Enabled = [Boolean]
Page 362
Page 363
Page 364
ExpandLocked
Returns/Sets a value that determines if the row can be expanded or collapsed.
Syntax
TRIMtreeRow. ExpandLocked = [Boolean]
Page 365
Id
Returns/Sets an identifier value on the row. For TRIM objects this could indicate the
object type (btyBaseObjectTypes).
Syntax
TRIMtreeRow.Id = [Long]
Page 366
Page 367
MayHaveKids
Returns/Sets a value that indicates that the row may have a/some child row/s. In
terms of the user interface a plus (+) box will be displayed on a row where
MayHaveKids = True.
Syntax
TRIMtreeRow.MayHaveKids = [Boolean]
Page 368
RowText
Returns/Sets a specially formatted string that gets or sets the icon and test values of
the cells. See the remarks area of the TRIMtreeBox.AddRow method for the format
of the string.
Syntax
TRIMtreeRow.RowText = [Boolean]
Page 369
Tagged
Returns/Sets the tagged state of the row.
Syntax
TRIMtreeRow.Tagged = [Boolean]
Page 370
TagStateLocked
Returns/Sets a boolean that determines if a user can tag or untag a row through the
user interface.
Syntax
TRIMtreeRow.TagStateLocked = [Boolean]
Page 371
Uri
Returns/Sets a unique identifier of an item that the row data represents. For a TRIM
object this can contain the value from the objects Uri property.
Syntax
TRIMtreeRow.Uri = [Variant]
Page 372
Visible
Returns/Sets the visible state of the row.
Syntax
TRIMtreeRow.Visible = [Boolean]
Page 373
Methods
Name
``
AddChild
AddManyRows
ClearChildren
CollapseRow
DeleteChildRow
ExpandRow
GetCellText
GetFirstRow
GetNextRow
GetParentRow
InsertChild
SetCellIcon
SetCellText
Page 374
AddChild
Adds a child row to this TRIMtreeRow.
Syntax
[TRIMtreeRow] = TRIMtreeRow.AddChild (Text As String, Uri, MayHaveKids As Boolean, Id As
Long)
Parameters
Name
Type
Default Description
Text
String
Uri
Variant
MayHaveKids Boolean
Id
Long
Return Value
Type
Description
TRIMtreeRow
See also:
AddManyRows
Page 375
AddManyRows
Adds many child rows to the the TRIMtreeRow. Functions in the same way as the
AddManyRows method on the TRIMtreeBox control only that the many rows are
added as child rows.
Syntax
[TRIMtreeRow] = TRIMtreeRow.AddManyRows (Text As String)
Parameters
Name
Type
Default Description
Text
String
Return Value
Type
Description
Long
Remarks
The Text parameter of this method requires a specially formatted string containing
TRIM tree row information delimited by semi colons.
The required format of this string is detailed in the IbaseObjects.GetTreeString
section of this help file.
! Note: Care should be taken to ensure that the rows cell contents information
should match that of the controls columns. If the GetTreeString method is to be
used then the PropertyDefs in the Properties Collection should be identical to
that used to get the column information via the GetTreeInitString method.
Page 376
ClearChildren
Removes any child rows from the TRIMtreeRow.
Syntax
TRIMtreeRow.ClearChildren ()
Page 377
CollapseRow
Returns the TRIMtreeRow to an unexpanded state. The same behavior as if the user
has clicked on the minus (-) box on the row in the TRIMtreeBox control. The row is
collapsed and the minus(-) box is replaced with a plus (+) box to indicate the row
may have child rows and be able to expand.
Syntax
TRIMtreeRow. CollapseRow ()
Page 378
DeleteChildRow
Removes the child row at the specified index from the TRIMtreeBox control.
Syntax
TRIMtreeRow. DeleteChildRow (Index as Long)
Parameters
Name
Type
Index
Long
Default Description
The index of the child row to remove
Page 379
ExpandRow
Expands the TRIMtreeRow to display any child rows. The same behavior as if the
user has clicked on the plus (+) box on the row in the TRIMtreeBox control. The row
is expanded and the plus (+) box is replaced with a minus (-) box to indicate the row
is in an expanded state (or removed if there are no child rows to display).
Syntax
TRIMtreeRow. ExpandRow (recursive As Boolean)
Parameters
Name
Type
recursive Boolean
Default Description
Determines if the ExpandRow function should be
applied to any child rows that may have child rows
in turn (MayHaveKids = true)
Page 380
GetCellText
Returns the value as a string of the specified cell from this TRIMtreeRow in the
TRIMtreeBox control.
Syntax
[String] = TRIMtreeRow.GetCellText (Column)
Parameters
Name
Type
Default Description
Column
Variant
Return Value
Type
Description
String
Page 381
GetFirstRow
Returns the first row in the child row iteration. Used with the GetNextRow method to
iterate through any child rows. It also indicates if the iteration includes all rows or
only tagged rows and resets the iteration. Similar to the GetFirstRow method on the
TRIMtreeBox control.
Syntax
[TRIMtreeRow] = TRIMtreeRow.GetFirstRow (onlyTagged As Boolean)
Parameters
Name
Type
Default Description
onlyTagged
Boolean
Return Value
Type
Description
TRIMtreeRow
Page 382
GetNextRow
Returns the next row in the child row iteration. Used with the GetFirstRow method
to iterate through any child rows. It returns the next child row or the next tagged
child row depending on value of the onlyTagged parameter of the GetFirstRow
method. Similar to the GetNextRow method on the TRIMtreeBox control.
Syntax
[TRIMtreeRow] = TRIMtreeRow. GetNextRow ()
Return Value
Type
Description
TRIMtreeRow
The next row found in the child row iteration. If the end of the
iteration has been reached the returned TRIMtreeRow will be set
to Nothing.
Remarks
The GetFirstRow method must be used prior to using this method in order to set up
the row iteration.
Page 383
GetParentRow
Returns the parent row of this TRIMtreeRow.
Syntax
[TRIMtreeRow] = TRIMtreeRow. GetParentRow ()
Return Value
Type
Description
TRIMtreeRow
Page 384
InsertChild
Inserts a child row into the TRIMtreeRow at the specified index.
Syntax
[TRIMtreeRow] = TRIMtreeRow. InsertChild (Index As Long, Text As String, Uri, MayHaveKids
As Boolean, Id As Long)
Parameters
Name
Type
Default Description
Index
Long
Text
String
Uri
Variant
MayHaveKids Boolean
Id
Long
Return Value
Type
Description
TRIMtreeRow
Page 385
SetCellIcon
Sets the Icon used in the specified cell of this TRIMtreeRow.
Syntax
[Boolean] = TRIMtreeRow.SetCellIcon (Column, Icon)
Parameters
Name
Type
Default Description
Column Variant
Icon
Variant
Return Value
Type
Description
Boolean
Page 386
SetCellText
Sets the text used in the specified cell of this TRIMtreeRow.
Syntax
[Boolean] = TRIMtreeRow. SetCellText (Column, Text as String)
Parameters
Name
Type
Default Description
Column
Variant
Text
String
Return Value
Type
Description
Boolean
Page 387
Description
dtCannedDate
fvFavoriteType
Favorite types
ksBrowseMode
ksCannedDatesMode Canned Date Modes for the contents of a HP TRIM Edit Box
ksEditValidMode
ksScrollMode
ksSelectMode
tagTRIMIconId
tbAlignmentMode
tbDisplayMode
tbEllipsisMode
tbSortMode
tbSortState
tbTagMode
tbVisibleMode
TRIMIconId
vwDocFormat
Page 388
dtCannedDate
Name
Value
Description
cd_none
None
cd_yesterday
Yesterdays date
cd_today
PrivateTodays date
cd_tomorrow
Tomorrows date
cd_lastWeek
cd_thisWeek
cd_nextWeek
cd_lastMonth
cd_thisMonth
cd_nextMonth
cd_this year
10
cd_yearToDate
11
12
13
14
cd_last7Days
cd_next7Days
cd_last14Days
Page 389
fvFavoriteType
Name
fvNormal
fvWorktray
fvRecentDocuments
fvRecentFolders
Value
Description
Page 390
ksBrowseMode
Name
Value
Description
ksBrowseDisabled
Disabled
ksBrowseActive
Active
ksBrowseEvenLocked 2
Page 391
ksCannedDatesMode
Name
Value
Description
cdNone
No Canned dates
cdAll
cdNoRanges
cdOnlyFuture
cdOnlyFutureNoRanges
Page 392
ksEditValidMode
Name
Value
Description
ksUnknown
-1
Unknown
ksNotValidated
Invalid
ksValid
Valid
ksAmbiguous
Ambiguous
Page 393
ksScrollMode
Name
Value
Description
ksNone
No Scroll bars
ksHoriz
ksVert
ksBoth
Page 394
ksSelectMode
Name
Value
Description
ksSpell
ksDir
ksFileIn
ksDateTime
KsDate
ksBrowse
ksFileOut
KsFormat
Page 395
tbAlignmentMode
Name
Value
Description
tbaLeft
Align Left
tbaRight
Align Right
tbaCenter
Align Centre
Page 396
tbDisplayMode
Name
Value
Description
tbdmTextOnly
tbdmIconOnly
tbdmText
Display text
tbdmIcon
Display icon
tbdmBoth
Page 397
tbEllipsisMode
Name
Value
Description
tbeNone
No ellipsis
tbeRight
Page 398
ltbSortMode
Name
Value Description
tbsmNone
No sort mode
tbsmAlphaNoCase
tbsmAlphaCase
tbsmNumeric
Sort numerically
tbsmIcon
Sort by icon
tbsmDate
Sort by Date
tbsmTime
Sort by Time
tbsmDateTime
tbsmFileSize
10
11
12
Sort by Currency
tbsmOwnerEvent
tbsmAlphaNoCaseEnhanced
tbsmAlphaCaseEnhanced
tbsmCurrency
Page 399
tbSortState
Name
Value
Description
tbssUnsorted
Unsorted
tbssAscending
Sort Ascending
tbssDescending
Sort Descending
Page 400
tbTagMode
Name
Value
Description
tbtmDisabled
Tagging disabled
tbtmTags
Tagging enabled
Page 401
tbVisibleMode
Name
Value
Description
tbvHidden
Must be hidden
tbvMandatory
Must be visable
tbvEither
Page 402
TRIMIconId
Enums representing the icons used in HP TRIM. A description has only been
provided where the name of the icon is not self explanatory. A Prefix key table has
been provided to assist.
Prefix Key
Prefix
Description
icon_rty_
icon_act
Action icon
icon_prc
Procedure icon
icon_odma_
icon_loc
Location icons
icon_loceadd
icon_login
icon_rec_in_
icon_wkc_doc
icon_edm..
icon_sch..
icon_th
Thesaurus icons
Name
Value
Description
icon_tower
icon_topdrawer
icon_trf
icon_viewer
icon_tick
450
Tick icon
icon_cross
451
Cross icon
icon_noentry
454
icon_rty_yellowfile
502
Page 403
icon_rty_yellowdoc
503
icon_rty_yellowbox
504
icon_rty_yellowbook
505
icon_rty_whitefile
506
icon_rty_whitedoc
507
icon_rty_whitebox
508
icon_rty_whitebook
509
icon_rty_greenfile
510
icon_rty_greendoc
511
icon_rty_greenbox
512
icon_rty_greenbook
513
icon_rty_ltbluefile
514
icon_rty_ltbluedoc
515
icon_rty_ltbluebox
516
icon_rty_ltbluebook
517
icon_rty_dkbluefile
518
icon_rty_dkbluedoc
519
icon_rty_dkbluebox
520
icon_rty_dkbluebook
521
icon_rty_blackfile
522
icon_rty_blackdoc
523
icon_rty_blackbox
524
icon_rty_blackbook
525
icon_rty_redfile
526
icon_actdone
527
icon_rty_reddoc
527
icon_rty_redbox
528
icon_rty_redbook
529
Page 404
icon_rty_greyfile
530
icon_rty_greydoc
531
icon_rty_greybox
532
icon_rty_greybook
533
icon_rty_pinkfile
534
icon_rty_pinkdoc
535
icon_rty_pinkbox
536
icon_rty_pinkbook
537
icon_rty_tealfile
538
icon_rty_tealdoc
539
icon_rty_tealbox
540
icon_rty_tealbook
541
icon_rty_envopen
542
icon_rty_envclosed
543
icon_rty_cd
544
icon_rty_clipboard
545
icon_rty_tape1
546
icon_rty_tape2
547
icon_rty_floppy3
548
icon_rty_floppy5
549
icon_rty_orangefile
550
icon_rty_orangedoc
551
icon_rty_orangebox
552
icon_rty_orangebook
553
icon_rty_brownfile
554
icon_rty_browndoc
555
icon_rty_brownbox
556
icon_rty_brownbook
557
Page 405
icon_act
570
Action icon #1
icon_action
571
Action icon #2
icon_actdue
573
icon_actnormal
574
icon_actoverdue
575
icon_prcdone
576
icon_prcdue
577
icon_prcnormal
578
icon_prcoverdue
579
icon_procedure
580
Procedure icon
icon_census
585
Census icon
icon_Caveat
590
icon_extrafields
591
icon_lookupsets
592
icon_securitylevel
593
icon_webLayouts
594
icon_searchmethod
600
icon_odma_draft
605
icon_odma_modified
606
icon_odma_readonly
607
icon_odma_unknown
608
icon_odma_unmodified
609
icon_class_inactive
615
icon_plannotok
616
icon_fpplans
617
icon_activeloc
620
icon_localllist
621
icon_contact
622
Contact icon
Page 406
icon_loccontactlist
623
icon_locdirectory
624
icon_loceaddrimage
625
icon_loceaddrmail
626
icon_loceaddrrdn
627
icon_loceaddrurl
628
icon_externalloc
629
icon_locextlist
630
icon_extposition
631
icon_group
632
Group icon
icon_groupadhoc
633
icon_locgroupslist
634
icon_inactiveloc
635
icon_internalloc
636
icon_locintlist
637
icon_loginadmin
638
icon_logincustom
639
icon_logindisabled
640
icon_loginenduser
641
icon_loginenquiry
642
icon_loginexpired
643
icon_loginmanager
644
icon_loginnone
645
No Login icon
icon_loginworker
646
icon_org
647
Organization icon
icon_locorglist
648
icon_person
649
Person icon
icon_position
650
Position icon
Page 407
icon_locposlist
651
icon_postalCode
652
icon_locstafflist
653
icon_unit
654
Unit icon
icon_locunitlist
655
icon_unknownloc
656
icon_locunknownlist
657
icon_rec_at_home
660
icon_duetray
661
icon_edmdocavailable
662
icon_edmdoccheckedout
663
icon_edmdoccheckedouttoyou 664
icon_edmnodocument
665
icon_rec_in_container
666
icon_rec_in_space
667
icon_intray
668
In Tray icon
icon_induetray
669
icon_missing
670
icon_record
671
Record icon
icon_securitybreach
672
icon_worktray
673
WorkTray icon
icon_bpbarcode
680
Barcode icon
icon_rpbitmap
681
icon_rpcaption
682
icon_rp_childlist
683
icon_rpfield
684
Page 408
icon_rpline
685
icon_rpproperty
686
icon_rprectangle
687
icon_reports
688
icon_rp_selectors
689
icon_rptabstop
690
icon_rptext
691
icon_rty_inactive
699
icon_recordtype
700
icon_active
705
Active icon
icon_archivedfinal
706
icon_archivedinterim
707
icon_archivedlocal
708
icon_cases
709
Cases icon
icon_destroyed
710
Destroyed icon
icon_sch_inactive
711
icon_hold_inactive
712
icon_inactive
713
Inacive icon
icon_schlesssevere
714
icon_schmaybemoresevere
715
icon_schmoresevere
716
icon_schedule
717
icon_space
720
icon_tdfileview
725
icon_tdfolderview
726
icon_toolstepdone
730
Page 409
icon_toolsteprogress
735
icon_thaspect
740
icon_th_inactive
741
icon_thkeynode
742
icon_thkeyword
743
icon_thlist
744
icon_thnonpreferred
745
icon_thprompt
746
icon_thprompttop
747
icon_broader
748
icon_forbidden
749
icon_narrower
750
icon_preferred
751
icon_related
752
icon_thterm
753
icon_topforbidden
754
icon_barcodescanner
760
icon_stopword
765
icon_edmstore
766
icon_wkc_docoriginactin
770
icon_wkc_docoriginactout
771
icon_wkc_docoriginWorkflow 772
icon_wkc_docstatusclear
773
Page 410
icon_wkc_docstatusin
774
icon_wkc_docstatusnone
775
icon_wkc_docstatustd
776
icon_Workflow
779
Workflow icon
icon_Workflowtemplate
805
Page 411
vwDocFormat
Name
Value
Description
vwUnknown
Unknown
vwDoc
Word Processor
vwSS
Spreadsheet
vwDB
Database
vwHex
Hex
vwImage
Raster Image
vwArchive
Archive
vwVector
Vector image
vwSound
10
Sound
vwMail
11
Mail Message
vwTiff
12
TIF Image
Page 412
Property Ids
Unique property identifiers are used by various methods for reading and updating
properties of an object. The Property Id for a specific property can be discovered
through querying the Database within the TRIM SDK.
Sample programs in C# and Visual Basic which use the SDK to generate a table of
Property Ids are included in the SDK samples section of the HP TRIM CD. Registered
users may also find these samples on the HP Software Support Online (SSO) portal
http://support.openview.hp.com/. Click Use self-solve knowledge search
and then search for TRIM SDK.
Page 413
Summary of Changes
Subject
Captura
TRIM 5 and 6
Tsapi.exe
Trimsdk.dll
Out of process
In process
tsapi
TRIM 4.3 API Type Library
TRIMSDK
TRIM SDK Type Library
General
Server
Type Library
name &
description
Database object
Object names
Database
connection
Explicit
Automatic to default DB
db.Connect
obj = Make<object>
obj = Get<object>
obj.Lookup(123)
obj = GetRecord(123)
obj.Open("97/1004")
obj = GetRecord("97/1004")
col = Make<objects>
col = Make<objects>
obj = New<object>
obj = New<object>
obj.Edit
obj.PropertiesUI
obj.Verify
If obj.Verified Then
obj.Save
ITS_recordType
RecordType
type.Select(hwnd, False)
types.SelectAll
type = types.ChooseOneUI
Instantiating
objects
Instantiating
objects by URI
Instantiating
objects by name
Instantiating
Collections
Create new base
object
Edit object in
dialog
Verify Save OK
Record Type
Select Record
Type
Page 414
type.Select(hwnd, True)
.SelectAll
.SetFilter(rfElectronic)
type = .ChooseOneUI
.GetNextViewPaneAttribute
.SelectViewPaneItems
ITS_record
Record
Create new
Record
rec = NewRecord(recType)
rec.SetTitle("A Title")
rec.SetNumber("2002/054")
rec.Create
rec = NewRecord(recType)
rec.Title = ("A Title")
rec.LongNumber = "2002/054"
rec.Save
Change Type
[Not Possible]
Select electronic
Record Type
Determine view
pane attributes
Record
Check-in
Electronic
Document
Attributes by
name
User defined
fields
rec.SetDocument(strFile)
rec.RecordType = recType
rec.SetDocumentUI,
rec.SetDocument
rec.GetProperty
rec.SetProperty
rec.Field1, rec.Date3)
rec.GetUserField
rec.SetUserField
Get Current
User
Create new
external contact
locations
Create new staff
within a unit
Search
Add Search
idoc.SetAsMailMessage
rec.SetDocument(idoc)
rec.SetRelated
rec.AttachRelationship
srch.RelatedTo(rec.Uri)
rels = rec.RecRelationships
rels.DisplayUI
ITS_location
Location
lcName, lcContact
lcUnit, lcOrganization
lcPosition
lcPerson
lcOrganization
lcPosition
lcGroup
lcUnknown
loc.Open("%ME%")
loc = db.CurrentUser
NewContact
NewLocation
LocType = lcPerson
IsWithin = False
NewStaff(objUnit)
NewLocation
LocType = lcPerson
AddRelationship(objUnit, lrMemberOf)
ITS_search
RecordSearch
srch.<clause>
(for example: srch.TitleWord)
srch.Add<clause>Clause
(for example, srch.AddTitleWordClause)
Page 415
clause
Sorting
Search Criteria
dialog
Copy search
results to record
collection
Display search
results
Select one
record from
search results
Tag multiple
records from
search results
srch.Edit
srch.EditQueryUI
srch.Fill(recs)
recs = srch.GetRecords
srch.Browse
recs = srch.GetRecords
recs.DisplayUI
srch.SelectOne
recs = srch.GetRecords
recs.ChooseOneUI
[Not possible]
recs = srch.GetRecords
recs2 = recs.ChooseManyUI
rec.SetAccessControlDetails
Page 416
New Objects
Action Definition
Thesaurus Keywords
Electronic Store
Field Definitions
Property Definitions
Census
Litigation Hold
History
Address
Record Locations
Record Relationships
Renditions
Revisions
Requests
Reports
Space Management
Digital Signatures
Workflow
Page 417
New Concepts
Verification
Property Definitions
Data Strings
Publishing to HTML
Child Lists
Enumeration Helper
Renaming Captions
System/Database Options
Page 418
Objects
There are vastly more objects in the TRIM 5 and 6 SDK. TRIM Captura's API object
model consists of 7 objects, 4 collections and 9 enumeration groups. TRIM 5 and 6,
on the other hand, has 43 objects, 39 collections and 62 enumeration groups.
When converting Captura API code to TRIM 5 and 6, all TRIM object declarations will
need to be updated, as the names of all objects represented in the API have changed
in TRIM 5 and 6.
The Type Library name in Captura was "tsapi"; in TRIM 5 and 6 it is "TRIMSDK". You
will only need to use this name as an object qualifier if you have other object
libraries referenced in your project with similar object names.
TRIM 4.3
Public objTRIM As New tsapi.Application
Public objRecord As ITS_record
TRIM 5 and 6
Public objTRIM As New TRIMSDK.Database
Public objRecord As Record
The equivalent objects and their correct names are tabled below.
Captura (tsapi)
CapturaContext (TRIMSDK)
Application
Database
ITS_recordType
RecordType
ITS_recordTypes
RecordTypes
ITS_record
Record
ITS_records
Records
ITS_search
RecordSearch
ITS_searches
RecordSearches
ITS_location
Location
ITS_locations
Locations
ITS_accessControl
[none use
Record.SetAccessControlDetails method]
ITS_mailMessage
Page 419
Connecting to TRIM
The TRIM 4.3 API required explicit declaration of a user name, password and
Database when connecting to TRIM. The programmer's options were to call the
Connect method to specify these arguments in code, or to call ConnectTD (or
GetLoginDetails then Connect) to get these details from a user in a dialog.
TRIM 5 and 6 manages the connection to the Database through the users' operating
system login and the default Database. The Database object's Connect method will
attempt to connect the current user to their default Database. It does not require
any parameters.
Set objTRIM = New TRIMSDK.Database
objTRIM.Connect
For more details see Connecting.
Page 420
Instantiating Objects
Instantiating existing objects in Captura involved calling 'Make<object>' methods on
the Application object to return an object, then passing the URI or Name of the
required object to a Lookup or Open method.
In TRIM 5 and 6, you can instantiate the object at the same time as you create the
object, by passing a name or URI value to a 'Get<object>' method on the Database
object. The 'Get' methods accept a variant parameter for the name or URI of the
object.
'4.3 - Change title of Record number 97/1004
Dim objRec As ITS_record
Set objRec = objTRIM.MakeRecord
If Not objRec.Open("97/1004") Then
MsgBox objRec.ErrorMessage
Exit Sub
End If
objRec.SetTitle("New Title")
objRec.Save
'5.0 - Change title of Record number 97/1004
Dim objRec As Record
Set objRec = objTRIM.GetRecord("97/1004")
If objRec Is Nothing Then
MsgBox "Record not found"
Exit Sub
End If
objRec.Title = "New Title"
objRec.Save
Page 421
The TRIM 5.0 SDK introduces a new object called an Input Document. It allows the
electronic details of a record to be set up before creating the record. It has two
forms, a file object or a mail message object. Pass the InputDocument object as an
argument to the SetDocument method. The properties of the new record can be
viewed and edited using the PropertiesUI method of the Record. Call Save to persist
the Record to the Database.
'5.0
'Select the Record Type
Dim DocTypesCollection As TRIMSDK.RecordTypes
Dim DocType As TRIMSDK.RecordTypes
Set DocTypesCollection = app50.NewRecordTypes
' Fill the Collection with all Record Types
DocTypesCollection.SelectAll
' Filter the Collection, only include those RecordTypes that
' support the creation of electronic records
DocTypesCollection.SetFilter (rfElectronicForCreate)
Set DocType = DocTypesCollection.ChooseOneUI(hwnd)
'Initialise the new Record
Set detail = app50.NewRecord(DocType)
For more details on creating objects generally, see Creating a New Object.
Page 422